Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5018)

Unified Diff: chrome/browser/ui/gtk/browser_toolbar_gtk.cc

Issue 8743021: GTK: Move to gtk_widget_get_allocation() for some of chrome/browser/ui/gtk/ (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: comment nit Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc ('k') | chrome/browser/ui/gtk/custom_button.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/browser_toolbar_gtk.cc
diff --git a/chrome/browser/ui/gtk/browser_toolbar_gtk.cc b/chrome/browser/ui/gtk/browser_toolbar_gtk.cc
index 341e75711a4ebea2e52b3d5555e7f01b601dbe55..d02b0091510ae2fe8857b2b179e4a2e87ae96519 100644
--- a/chrome/browser/ui/gtk/browser_toolbar_gtk.cc
+++ b/chrome/browser/ui/gtk/browser_toolbar_gtk.cc
@@ -487,16 +487,17 @@ gboolean BrowserToolbarGtk::OnAlignmentExpose(GtkWidget* widget,
// between the edge of the toolbar and where we anchor the corner images.
const int kShadowThickness = 2;
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(widget, &allocation);
gfx::Rect area(e->area);
- gfx::Rect right(widget->allocation.x + widget->allocation.width -
- kCornerWidth,
- widget->allocation.y - kShadowThickness,
+ gfx::Rect right(allocation.x + allocation.width - kCornerWidth,
+ allocation.y - kShadowThickness,
kCornerWidth,
- widget->allocation.height + kShadowThickness);
- gfx::Rect left(widget->allocation.x - kShadowThickness,
- widget->allocation.y - kShadowThickness,
+ allocation.height + kShadowThickness);
+ gfx::Rect left(allocation.x - kShadowThickness,
+ allocation.y - kShadowThickness,
kCornerWidth,
- widget->allocation.height + kShadowThickness);
+ allocation.height + kShadowThickness);
if (window_->ShouldDrawContentDropShadow()) {
// Leave room to draw rounded corners.
@@ -524,8 +525,8 @@ gboolean BrowserToolbarGtk::OnAlignmentExpose(GtkWidget* widget,
cairo_surface_t* target = cairo_surface_create_similar(
cairo_get_target(cr),
CAIRO_CONTENT_COLOR_ALPHA,
- widget->allocation.x + widget->allocation.width,
- widget->allocation.y + widget->allocation.height);
+ allocation.x + allocation.width,
+ allocation.y + allocation.height);
cairo_t* copy_cr = cairo_create(target);
cairo_set_operator(copy_cr, CAIRO_OPERATOR_SOURCE);
@@ -568,9 +569,11 @@ gboolean BrowserToolbarGtk::OnAlignmentExpose(GtkWidget* widget,
gboolean BrowserToolbarGtk::OnLocationHboxExpose(GtkWidget* location_hbox,
GdkEventExpose* e) {
if (theme_service_->UsingNativeTheme()) {
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(location_hbox, &allocation);
gtk_util::DrawTextEntryBackground(offscreen_entry_.get(),
location_hbox, &e->area,
- &location_hbox->allocation);
+ &allocation);
}
return FALSE;
@@ -659,16 +662,17 @@ gboolean BrowserToolbarGtk::OnWrenchMenuButtonExpose(GtkWidget* sender,
if (!resource_id)
return FALSE;
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(sender, &allocation);
+
// Draw the chrome app menu icon onto the canvas.
const SkBitmap* badge = theme_service_->GetBitmapNamed(resource_id);
gfx::CanvasSkiaPaint canvas(expose, false);
- int x_offset = base::i18n::IsRTL() ? 0 :
- sender->allocation.width - badge->width();
+ int x_offset = base::i18n::IsRTL() ? 0 : allocation.width - badge->width();
int y_offset = 0;
- canvas.DrawBitmapInt(
- *badge,
- sender->allocation.x + x_offset,
- sender->allocation.y + y_offset);
+ canvas.DrawBitmapInt(*badge,
+ allocation.x + x_offset,
+ allocation.y + y_offset);
return FALSE;
}
« no previous file with comments | « chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc ('k') | chrome/browser/ui/gtk/custom_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698