diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-21 22:14:41 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-21 22:14:41 +0000 |
commit | fc2e0870089a2cf644e29ec14e58f3bc6168e591 (patch) | |
tree | 11cea988309da72f2efabb6bacbee60e07977c2d /chrome/browser/automation/automation_provider_gtk.cc | |
parent | 7bd394d220e29b212b9480cb8a7f4986cb8275ce (diff) | |
download | chromium_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/browser/automation/automation_provider_gtk.cc')
-rw-r--r-- | chrome/browser/automation/automation_provider_gtk.cc | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/chrome/browser/automation/automation_provider_gtk.cc b/chrome/browser/automation/automation_provider_gtk.cc index 31a5c99..9e91b52 100644 --- a/chrome/browser/automation/automation_provider_gtk.cc +++ b/chrome/browser/automation/automation_provider_gtk.cc @@ -4,13 +4,16 @@ #include "chrome/browser/automation/automation_provider.h" +#include "base/gfx/point.h" +#include "base/gfx/rect.h" #include "chrome/browser/gtk/view_id_util.h" +#include "chrome/common/gtk_util.h" void AutomationProvider::SetWindowBounds(int handle, const gfx::Rect& bounds, bool* success) { *success = false; - if (window_tracker_->ContainsHandle(handle)) { - GtkWindow* window = window_tracker_->GetResource(handle); + GtkWindow* window = window_tracker_->GetResource(handle); + if (window) { gtk_window_move(window, bounds.x(), bounds.height()); gtk_window_resize(window, bounds.width(), bounds.height()); *success = true; @@ -20,8 +23,8 @@ void AutomationProvider::SetWindowBounds(int handle, const gfx::Rect& bounds, void AutomationProvider::SetWindowVisible(int handle, bool visible, bool* result) { *result = false; - if (window_tracker_->ContainsHandle(handle)) { - GtkWindow* window = window_tracker_->GetResource(handle); + GtkWindow* window = window_tracker_->GetResource(handle); + if (window) { if (visible) { gtk_window_present(window); } else { @@ -37,8 +40,8 @@ void AutomationProvider::WindowGetViewBounds(int handle, int view_id, gfx::Rect* bounds) { *success = false; - if (window_tracker_->ContainsHandle(handle)) { - gfx::NativeWindow window = window_tracker_->GetResource(handle); + GtkWindow* window = window_tracker_->GetResource(handle); + if (window) { GtkWidget* widget = ViewIDUtil::GetWidget(GTK_WIDGET(window), static_cast<ViewID>(view_id)); if (!widget) @@ -48,11 +51,9 @@ void AutomationProvider::WindowGetViewBounds(int handle, int view_id, widget->allocation.width, widget->allocation.height); gint x, y; if (screen_coordinates) { - gdk_window_get_origin(widget->window, &x, &y); - if (GTK_WIDGET_NO_WINDOW(widget)) { - x += widget->allocation.x; - y += widget->allocation.y; - } + gfx::Point point = gtk_util::GetWidgetScreenPosition(widget); + x = point.x(); + y = point.y(); } else { gtk_widget_translate_coordinates(widget, GTK_WIDGET(window), 0, 0, &x, &y); |