diff options
author | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-22 20:53:00 +0000 |
---|---|---|
committer | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-22 20:53:00 +0000 |
commit | 379ca24af3d07223af4f09f5e42f0200d3b268d3 (patch) | |
tree | bf293b1c5973c4e094c14e667d8541df9a1e9e18 /chrome/browser | |
parent | 996458802438a60261c9f2d9afd26d2dd3036539 (diff) | |
download | chromium_src-379ca24af3d07223af4f09f5e42f0200d3b268d3.zip chromium_src-379ca24af3d07223af4f09f5e42f0200d3b268d3.tar.gz chromium_src-379ca24af3d07223af4f09f5e42f0200d3b268d3.tar.bz2 |
Fix a bug in popup menus where we sent the wrong mouse events coordinates to the
renderer.
gtk_grab_add() causes us to receive all events. That means we receive
mouse events for other widgets with the coordinates relative to the other
widget. We actually the coordinates relative to the popup.
This caused jankiness with the popup on news.google.com. Since the popup happened to be on
the left side of the page, we sent event coordinates that happened to land in
the popup, causing us to select stuff.
BUG=12025
Review URL: http://codereview.chromium.org/113750
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16791 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/renderer_host/render_widget_host_view_gtk.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc index ea5163d..b3324bf 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc @@ -122,6 +122,16 @@ class RenderWidgetHostViewGtkWidget { static gboolean ButtonPressReleaseEvent( GtkWidget* widget, GdkEventButton* event, RenderWidgetHostViewGtk* host_view) { + // We want to translate the coordinates of events that do not originate + // from this widget to be relative to the top left of the widget. + GtkWidget* event_widget = gtk_get_event_widget((GdkEvent*)event); + if (event_widget != widget) { + int x = 0; + int y = 0; + gtk_widget_get_pointer(widget, &x, &y); + event->x = x; + event->y = y; + } host_view->GetRenderWidgetHost()->ForwardMouseEvent( WebInputEventFactory::mouseEvent(event)); @@ -135,6 +145,16 @@ class RenderWidgetHostViewGtkWidget { static gboolean MouseMoveEvent(GtkWidget* widget, GdkEventMotion* event, RenderWidgetHostViewGtk* host_view) { + // We want to translate the coordinates of events that do not originate + // from this widget to be relative to the top left of the widget. + GtkWidget* event_widget = gtk_get_event_widget((GdkEvent*)event); + if (event_widget != widget) { + int x = 0; + int y = 0; + gtk_widget_get_pointer(widget, &x, &y); + event->x = x; + event->y = y; + } host_view->GetRenderWidgetHost()->ForwardMouseEvent( WebInputEventFactory::mouseEvent(event)); return FALSE; |