summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/ui/gtk/download/download_item_gtk.cc42
-rw-r--r--chrome/browser/ui/gtk/download/download_shelf_gtk.cc10
-rw-r--r--chrome/browser/ui/gtk/infobars/infobar_container_gtk.cc8
-rw-r--r--chrome/browser/ui/gtk/infobars/infobar_gtk.cc9
-rw-r--r--chrome/browser/ui/gtk/location_bar_view_gtk.cc8
5 files changed, 45 insertions, 32 deletions
diff --git a/chrome/browser/ui/gtk/download/download_item_gtk.cc b/chrome/browser/ui/gtk/download/download_item_gtk.cc
index 54d44983..51c2349 100644
--- a/chrome/browser/ui/gtk/download/download_item_gtk.cc
+++ b/chrome/browser/ui/gtk/download/download_item_gtk.cc
@@ -700,11 +700,13 @@ void DownloadItemGtk::InitNineBoxes() {
gboolean DownloadItemGtk::OnHboxExpose(GtkWidget* widget, GdkEventExpose* e) {
if (theme_service_->UsingNativeTheme()) {
- int border_width = GTK_CONTAINER(widget)->border_width;
- int x = widget->allocation.x + border_width;
- int y = widget->allocation.y + border_width;
- int width = widget->allocation.width - border_width * 2;
- int height = widget->allocation.height - border_width * 2;
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(widget, &allocation);
+ int border_width = gtk_container_get_border_width(GTK_CONTAINER(widget));
+ int x = allocation.x + border_width;
+ int y = allocation.y + border_width;
+ int width = allocation.width - border_width * 2;
+ int height = allocation.height - border_width * 2;
if (IsDangerous()) {
// Draw a simple frame around the area when we're displaying the warning.
@@ -723,17 +725,11 @@ gboolean DownloadItemGtk::OnHboxExpose(GtkWidget* widget, GdkEventExpose* e) {
// separator. We then repeat this for the right button.
GtkStyle* style = body_.get()->style;
- GtkAllocation left_allocation = body_.get()->allocation;
- GdkRectangle left_clip = {
- left_allocation.x, left_allocation.y,
- left_allocation.width, left_allocation.height
- };
+ GtkAllocation left_clip;
+ gtk_widget_get_allocation(body_.get(), &left_clip);
- GtkAllocation right_allocation = menu_button_->allocation;
- GdkRectangle right_clip = {
- right_allocation.x, right_allocation.y,
- right_allocation.width, right_allocation.height
- };
+ GtkAllocation right_clip;
+ gtk_widget_get_allocation(menu_button_, &right_clip);
GtkShadowType body_shadow =
GTK_BUTTON(body_.get())->depressed ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
@@ -755,13 +751,14 @@ gboolean DownloadItemGtk::OnHboxExpose(GtkWidget* widget, GdkEventExpose* e) {
// is hard and relies on copying GTK internals, so instead steal the
// allocation of the gtk arrow which is close enough (and will error on
// the conservative side).
- GtkAllocation arrow_allocation = arrow_->allocation;
+ GtkAllocation arrow_allocation;
+ gtk_widget_get_allocation(arrow_, &arrow_allocation);
gtk_paint_vline(style, widget->window,
gtk_widget_get_state(widget),
&e->area, widget, "button",
arrow_allocation.y,
arrow_allocation.y + arrow_allocation.height,
- left_allocation.x + left_allocation.width);
+ left_clip.x + left_clip.width);
}
}
return FALSE;
@@ -814,23 +811,26 @@ gboolean DownloadItemGtk::OnButtonPress(GtkWidget* button,
gboolean DownloadItemGtk::OnProgressAreaExpose(GtkWidget* widget,
GdkEventExpose* event) {
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(widget, &allocation);
+
// Create a transparent canvas.
gfx::CanvasSkiaPaint canvas(event, false);
if (complete_animation_.is_animating()) {
if (get_download()->IsInterrupted()) {
download_util::PaintDownloadInterrupted(&canvas,
- widget->allocation.x, widget->allocation.y,
+ allocation.x, allocation.y,
complete_animation_.GetCurrentValue(),
download_util::SMALL);
} else {
download_util::PaintDownloadComplete(&canvas,
- widget->allocation.x, widget->allocation.y,
+ allocation.x, allocation.y,
complete_animation_.GetCurrentValue(),
download_util::SMALL);
}
} else if (get_download()->IsInProgress()) {
download_util::PaintDownloadProgress(&canvas,
- widget->allocation.x, widget->allocation.y,
+ allocation.x, allocation.y,
progress_angle_,
get_download()->PercentComplete(),
download_util::SMALL);
@@ -842,7 +842,7 @@ gboolean DownloadItemGtk::OnProgressAreaExpose(GtkWidget* widget,
if (icon_small_) {
const int offset = download_util::kSmallProgressIconOffset;
canvas.DrawBitmapInt(*icon_small_,
- widget->allocation.x + offset, widget->allocation.y + offset);
+ allocation.x + offset, allocation.y + offset);
}
return TRUE;
diff --git a/chrome/browser/ui/gtk/download/download_shelf_gtk.cc b/chrome/browser/ui/gtk/download/download_shelf_gtk.cc
index cc6901a..a2a934d 100644
--- a/chrome/browser/ui/gtk/download/download_shelf_gtk.cc
+++ b/chrome/browser/ui/gtk/download/download_shelf_gtk.cc
@@ -263,7 +263,9 @@ void DownloadShelfGtk::Observe(int type,
}
int DownloadShelfGtk::GetHeight() const {
- return slide_widget_->widget()->allocation.height;
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(slide_widget_->widget(), &allocation);
+ return allocation.height;
}
void DownloadShelfGtk::RemoveDownloadItem(DownloadItemGtk* download_item) {
@@ -363,9 +365,11 @@ void DownloadShelfGtk::DidProcessEvent(GdkEvent* event) {
bool DownloadShelfGtk::IsCursorInShelfZone(
const gfx::Point& cursor_screen_coords) {
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(shelf_.get(), &allocation);
+
gfx::Rect bounds(gtk_util::GetWidgetScreenPosition(shelf_.get()),
- gfx::Size(shelf_.get()->allocation.width,
- shelf_.get()->allocation.height));
+ gfx::Size(allocation.width, allocation.height));
// Negative insets expand the rectangle. We only expand the top.
bounds.Inset(gfx::Insets(-kShelfAuraSize, 0, 0, 0));
diff --git a/chrome/browser/ui/gtk/infobars/infobar_container_gtk.cc b/chrome/browser/ui/gtk/infobars/infobar_container_gtk.cc
index 422db16..4f24b97 100644
--- a/chrome/browser/ui/gtk/infobars/infobar_container_gtk.cc
+++ b/chrome/browser/ui/gtk/infobars/infobar_container_gtk.cc
@@ -16,6 +16,7 @@
#include "chrome/browser/ui/gtk/gtk_util.h"
#include "chrome/browser/ui/gtk/infobars/infobar_gtk.h"
#include "third_party/skia/include/effects/SkGradientShader.h"
+#include "ui/base/gtk/gtk_compat.h"
#include "ui/gfx/canvas_skia_paint.h"
#include "ui/gfx/color_utils.h"
#include "ui/gfx/rect.h"
@@ -133,8 +134,11 @@ void InfoBarContainerGtk::PaintInfobarBitsOn(GtkWidget* sender,
gtk_widget_translate_coordinates((*it)->widget(), sender,
0, 0,
NULL, &y);
- if (GTK_WIDGET_NO_WINDOW(sender))
- y += sender->allocation.y;
+ if (!gtk_widget_get_has_window(sender)) {
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(sender, &allocation);
+ y += allocation.y;
+ }
// We rely on the +1 in the y calculation so we hide the bottom of the drawn
// triangle just right outside the view bounds.
diff --git a/chrome/browser/ui/gtk/infobars/infobar_gtk.cc b/chrome/browser/ui/gtk/infobars/infobar_gtk.cc
index eb22a33..2c0b31a 100644
--- a/chrome/browser/ui/gtk/infobars/infobar_gtk.cc
+++ b/chrome/browser/ui/gtk/infobars/infobar_gtk.cc
@@ -212,7 +212,9 @@ void InfoBarGtk::OnCloseButton(GtkWidget* button) {
gboolean InfoBarGtk::OnBackgroundExpose(GtkWidget* sender,
GdkEventExpose* event) {
- const int height = sender->allocation.height;
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(sender, &allocation);
+ const int height = allocation.height;
cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(sender->window));
gdk_cairo_rectangle(cr, &event->area);
@@ -238,9 +240,8 @@ gboolean InfoBarGtk::OnBackgroundExpose(GtkWidget* sender,
border_color.green / 65535.0,
border_color.blue / 65535.0);
cairo_set_line_width(cr, 1.0);
- int y = sender->allocation.height;
- cairo_move_to(cr, 0, y - 0.5);
- cairo_rel_line_to(cr, sender->allocation.width, 0);
+ cairo_move_to(cr, 0, allocation.height - 0.5);
+ cairo_rel_line_to(cr, allocation.width, 0);
cairo_stroke(cr);
cairo_destroy(cr);
diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.cc b/chrome/browser/ui/gtk/location_bar_view_gtk.cc
index 83407de..abbfb8c 100644
--- a/chrome/browser/ui/gtk/location_bar_view_gtk.cc
+++ b/chrome/browser/ui/gtk/location_bar_view_gtk.cc
@@ -915,8 +915,12 @@ void LocationBarViewGtk::UpdateEVCertificateLabelSize() {
// The EV label should never take up more than half the hbox. We try to
// correct our inaccurate measurement units ("the average character width")
// by dividing more than an even 2.
- int text_area = security_info_label_->allocation.width +
- entry_box_->allocation.width;
+ GtkAllocation security_label_allocation;
+ gtk_widget_get_allocation(security_info_label_, &security_label_allocation);
+ GtkAllocation entry_box_allocation;
+ gtk_widget_get_allocation(entry_box_, &entry_box_allocation);
+ int text_area = security_label_allocation.width +
+ entry_box_allocation.width;
int max_chars = static_cast<int>(static_cast<float>(text_area) /
static_cast<float>(char_width) / 2.75);
// Don't let the label be smaller than 10 characters so that the country