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

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

Issue 8872004: GTK: More changes from raw widget->allocation to using the accessor. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 9 years 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/avatar_menu_button_gtk.cc ('k') | chrome/browser/ui/gtk/bubble/bubble_gtk.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc
diff --git a/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc b/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc
index ba41578acef154cb616f516c0b82237cb960fb5f..326112f815c7ae801ba668e81760b7c8faf6f154 100644
--- a/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc
+++ b/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc
@@ -583,7 +583,11 @@ void BrowserActionsToolbarGtk::HidePopup() {
void BrowserActionsToolbarGtk::AnimateToShowNIcons(int count) {
desired_width_ = WidthForIconCount(count);
- start_width_ = button_hbox_->allocation.width;
+
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(button_hbox_.get(), &allocation);
+ start_width_ = allocation.width;
+
resize_animation_.Reset();
resize_animation_.Show();
}
@@ -762,8 +766,12 @@ gboolean BrowserActionsToolbarGtk::OnDragMotion(GtkWidget* widget,
if (!drag_button_)
return FALSE;
- if (base::i18n::IsRTL())
- x = widget->allocation.width - x;
+ if (base::i18n::IsRTL()) {
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(widget, &allocation);
+ x = allocation.width - x;
+ }
+
drop_index_ = x < kButtonWidth ? 0 : x / (kButtonWidth + kButtonPadding);
// We will go ahead and reorder the child in order to provide visual feedback
@@ -829,10 +837,18 @@ gboolean BrowserActionsToolbarGtk::OnGripperMotionNotify(
// Calculate how much the user dragged the gripper and subtract that off the
// button container's width.
- int distance_dragged = base::i18n::IsRTL() ?
- -event->x :
- event->x - widget->allocation.width;
- gint new_width = button_hbox_->allocation.width - distance_dragged;
+ int distance_dragged;
+ if (base::i18n::IsRTL()) {
+ distance_dragged = -event->x;
+ } else {
+ GtkAllocation widget_allocation;
+ gtk_widget_get_allocation(widget, &widget_allocation);
+ distance_dragged = event->x - widget_allocation.width;
+ }
+
+ GtkAllocation button_hbox_allocation;
+ gtk_widget_get_allocation(button_hbox_.get(), &button_hbox_allocation);
+ gint new_width = button_hbox_allocation.width - distance_dragged;
SetButtonHBoxWidth(new_width);
return FALSE;
@@ -864,8 +880,10 @@ gboolean BrowserActionsToolbarGtk::OnGripperLeaveNotify(
gboolean BrowserActionsToolbarGtk::OnGripperButtonRelease(
GtkWidget* gripper, GdkEventButton* event) {
- gfx::Rect gripper_rect(0, 0,
- gripper->allocation.width, gripper->allocation.height);
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(gripper, &allocation);
+ gfx::Rect gripper_rect(0, 0, allocation.width, allocation.height);
+
gfx::Point release_point(event->x, event->y);
if (!gripper_rect.Contains(release_point))
gdk_window_set_cursor(gtk_widget_get_window(gripper), NULL);
« no previous file with comments | « chrome/browser/ui/gtk/avatar_menu_button_gtk.cc ('k') | chrome/browser/ui/gtk/bubble/bubble_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698