summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-21 22:14:41 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-21 22:14:41 +0000
commitfc2e0870089a2cf644e29ec14e58f3bc6168e591 (patch)
tree11cea988309da72f2efabb6bacbee60e07977c2d /chrome/common
parent7bd394d220e29b212b9480cb8a7f4986cb8275ce (diff)
downloadchromium_src-fc2e0870089a2cf644e29ec14e58f3bc6168e591.zip
chromium_src-fc2e0870089a2cf644e29ec14e58f3bc6168e591.tar.gz
chromium_src-fc2e0870089a2cf644e29ec14e58f3bc6168e591.tar.bz2
More interactive test porting for Linux.
Also fix a bug in the Windows implementation of SendMouseMoveNotifyWhenDone where the task would never be run if the cursor was already in the destination position before the call. BUG=19076 BUG=19881 Review URL: http://codereview.chromium.org/174201 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24027 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/gtk_util.cc32
1 files changed, 8 insertions, 24 deletions
diff --git a/chrome/common/gtk_util.cc b/chrome/common/gtk_util.cc
index a491763..67595e9 100644
--- a/chrome/common/gtk_util.cc
+++ b/chrome/common/gtk_util.cc
@@ -148,33 +148,17 @@ void ForceFontSizePixels(GtkWidget* widget, double size_pixels) {
}
gfx::Point GetWidgetScreenPosition(GtkWidget* widget) {
- int x = 0, y = 0;
-
- if (GTK_IS_WINDOW(widget)) {
- gdk_window_get_origin(widget->window, &x, &y);
- return gfx::Point(x, y);
- } else {
- x = widget->allocation.x;
- y = widget->allocation.y;
+ if (!widget->window) {
+ NOTREACHED() << "Must only be called on realized widgets.";
+ return gfx::Point(0, 0);
}
- GtkWidget* parent = gtk_widget_get_parent(widget);
- while (parent) {
- if (GTK_IS_WINDOW(parent)) {
- int window_x, window_y;
- // Returns the origin of the window, excluding the frame if one is exists.
- gdk_window_get_origin(parent->window, &window_x, &window_y);
- x += window_x;
- y += window_y;
- return gfx::Point(x, y);
- }
-
- if (!GTK_WIDGET_NO_WINDOW(parent)) {
- x += parent->allocation.x;
- y += parent->allocation.y;
- }
+ gint x, y;
+ gdk_window_get_origin(widget->window, &x, &y);
- parent = gtk_widget_get_parent(parent);
+ if (!GTK_IS_WINDOW(widget)) {
+ x += widget->allocation.x;
+ y += widget->allocation.y;
}
return gfx::Point(x, y);