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

Unified Diff: chrome/browser/ui/gtk/custom_button.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/custom_button.h ('k') | chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/custom_button.cc
diff --git a/chrome/browser/ui/gtk/custom_button.cc b/chrome/browser/ui/gtk/custom_button.cc
index 0e0bfef31569201b4b41a316e7d0b96e63f3f893..c0f8111585af318f704c9b9d395bf4c2c4e943d5 100644
--- a/chrome/browser/ui/gtk/custom_button.cc
+++ b/chrome/browser/ui/gtk/custom_button.cc
@@ -90,11 +90,13 @@ gboolean CustomDrawButtonBase::OnExpose(GtkWidget* widget,
return FALSE;
cairo_t* cairo_context = gdk_cairo_create(GDK_DRAWABLE(widget->window));
- cairo_translate(cairo_context, widget->allocation.x, widget->allocation.y);
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(widget, &allocation);
+ cairo_translate(cairo_context, allocation.x, allocation.y);
if (flipped_) {
// Horizontally flip the image for non-LTR/RTL reasons.
- cairo_translate(cairo_context, widget->allocation.width, 0.0f);
+ cairo_translate(cairo_context, allocation.width, 0.0f);
cairo_scale(cairo_context, -1.0f, 1.0f);
}
@@ -102,7 +104,7 @@ gboolean CustomDrawButtonBase::OnExpose(GtkWidget* widget,
// start of the widget (left for LTR, right for RTL) and its bottom.
gfx::Rect bounds = gfx::Rect(0, 0, pixbuf->Width(), 0);
int x = gtk_util::MirroredLeftPointForRect(widget, bounds);
- int y = widget->allocation.height - pixbuf->Height();
+ int y = allocation.height - pixbuf->Height();
if (background_image_->valid()) {
background_image_->SetSource(cairo_context, x, y);
@@ -297,6 +299,12 @@ void CustomDrawButton::Observe(int type,
SetBrowserTheme();
}
+int CustomDrawButton::WidgetWidth() const {
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(widget_.get(), &allocation);
+ return allocation.width;
+}
+
int CustomDrawButton::SurfaceWidth() const {
return button_base_.Width();
}
« no previous file with comments | « chrome/browser/ui/gtk/custom_button.h ('k') | chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698