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

Unified Diff: ui/base/gtk/gtk_screen_util.cc

Issue 11269022: Add Vector2d classes that represent offsets, instead of using Point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: RenderText fixup Created 8 years, 2 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
Index: ui/base/gtk/gtk_screen_util.cc
diff --git a/ui/base/gtk/gtk_screen_util.cc b/ui/base/gtk/gtk_screen_util.cc
index f0ef4d35b336cbee3e0c8bb42568a271cb5498d6..000f9509472b01ac1b554d54135412eb3755a1cf 100644
--- a/ui/base/gtk/gtk_screen_util.cc
+++ b/ui/base/gtk/gtk_screen_util.cc
@@ -26,12 +26,12 @@ gfx::Point ClientPoint(GtkWidget* widget) {
return gfx::Point(x, y);
}
-gfx::Point GetWidgetScreenPosition(GtkWidget* widget) {
+gfx::Vector2d GetWidgetScreenOffset(GtkWidget* widget) {
GdkWindow* window = gtk_widget_get_window(widget);
if (!window) {
NOTREACHED() << "Must only be called on realized widgets.";
- return gfx::Point(0, 0);
+ return gfx::Vector2d(0, 0);
}
gint x, y;
@@ -44,17 +44,15 @@ gfx::Point GetWidgetScreenPosition(GtkWidget* widget) {
y += allocation.y;
}
- return gfx::Point(x, y);
+ return gfx::Vector2d(x, y);
}
gfx::Rect GetWidgetScreenBounds(GtkWidget* widget) {
- gfx::Point position = GetWidgetScreenPosition(widget);
-
GtkAllocation allocation;
gtk_widget_get_allocation(widget, &allocation);
- return gfx::Rect(position.x(), position.y(),
- allocation.width, allocation.height);
+ return gfx::Rect(PointAtOffsetFromOrigin(GetWidgetScreenOffset(widget)),
+ gfx::Size(allocation.width, allocation.height));
}
} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698