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

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

Issue 200069: Get window origin only once in BrowserToolbarGtk::GetPopupBounds. (Closed)
Patch Set: Created 11 years, 3 months 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gtk/browser_toolbar_gtk.cc
diff --git a/chrome/browser/gtk/browser_toolbar_gtk.cc b/chrome/browser/gtk/browser_toolbar_gtk.cc
index 24fbf7a868efe812d34c141a8c53490644c33b24..8f4c00c1612cba4ecac8e0ef4ab61af6caac5d5f 100644
--- a/chrome/browser/gtk/browser_toolbar_gtk.cc
+++ b/chrome/browser/gtk/browser_toolbar_gtk.cc
@@ -431,16 +431,18 @@ gfx::Rect BrowserToolbarGtk::GetPopupBounds() const {
right = go_->widget();
}
- // TODO(deanm): The go and star buttons probably share the same window,
- // so this could be optimized to only one origin request.
- gint right_x;
- gdk_window_get_origin(right->window, &right_x, NULL);
- right_x += right->allocation.x + right->allocation.width;
-
- gint left_x, left_y;
- gdk_window_get_origin(left->window, &left_x, &left_y);
- left_x += left->allocation.x;
- left_y += left->allocation.y + left->allocation.height; // Bottom edge.
+ gint origin_x, origin_y;
+ DCHECK_EQ(left->window, right->window);
+ gdk_window_get_origin(left->window, &origin_x, &origin_y);
+
+ gint right_x = origin_x + right->allocation.x + right->allocation.width;
+
+ gint left_x = origin_x + left->allocation.x;
+
+ // Bottom edge.
+ gint left_y = origin_y + left->allocation.y + left->allocation.height;
+
+ DCHECK_LE(left_x, right_x);
return gfx::Rect(left_x + kPopupLeftRightMargin, left_y + kPopupTopMargin,
right_x - left_x - (2 * kPopupLeftRightMargin), 0);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698