diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-07-07 09:47:24 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-07-07 09:47:24 -0700 |
commit | d6a22e7b4e17e465d8c28805b578eee1846dc410 (patch) | |
tree | 7c5110647ee37667b6be11fff20a587accfd5542 | |
parent | ba11d034d7050033f698b2bc3a3c156e062ba2dd (diff) | |
parent | d5e46442a26bd94d35230562671fc1979b3bb7a0 (diff) | |
download | external_webkit-d6a22e7b4e17e465d8c28805b578eee1846dc410.zip external_webkit-d6a22e7b4e17e465d8c28805b578eee1846dc410.tar.gz external_webkit-d6a22e7b4e17e465d8c28805b578eee1846dc410.tar.bz2 |
Merge change 6353
* changes:
plugins are now sent the correct coordinates even when the page is scrolled.
-rw-r--r-- | WebCore/plugins/android/PluginViewAndroid.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/WebCore/plugins/android/PluginViewAndroid.cpp b/WebCore/plugins/android/PluginViewAndroid.cpp index 5622744..112a9a2 100644 --- a/WebCore/plugins/android/PluginViewAndroid.cpp +++ b/WebCore/plugins/android/PluginViewAndroid.cpp @@ -225,9 +225,14 @@ void PluginView::handleTouchEvent(TouchEvent* event) return; evt.data.touch.modifiers = 0; // todo - // these are relative to plugin - evt.data.touch.x = event->pageX() - m_npWindow.x; - evt.data.touch.y = event->pageY() - m_npWindow.y; + + // the event is relative to the window's (0,0), so use convertToContainingWindow + IntPoint winCoordinates = IntPoint(event->x(), event->y()); + IntPoint docCoordinates = parent()->windowToContents(winCoordinates); + + // convert to coordinates that are relative to the plugin + evt.data.touch.x = docCoordinates.x() - m_npWindow.x; + evt.data.touch.y = docCoordinates.y() - m_npWindow.y; if (m_plugin->pluginFuncs()->event(m_instance, &evt)) { event->setDefaultHandled(); @@ -245,9 +250,14 @@ void PluginView::handleMouseEvent(MouseEvent* event) if (isUp || isDown) { SkANP::InitEvent(&evt, kMouse_ANPEventType); evt.data.mouse.action = isUp ? kUp_ANPMouseAction : kDown_ANPMouseAction; - // these are relative to plugin - evt.data.mouse.x = event->x() - m_npWindow.x; - evt.data.mouse.y = event->y() - m_npWindow.y; + + // the event is relative to the window's (0,0), so use convertToContainingWindow + IntPoint winCoordinates = IntPoint(event->x(), event->y()); + IntPoint docCoordinates = parent()->windowToContents(winCoordinates); + + // convert to coordinates that are relative to the plugin + evt.data.mouse.x = docCoordinates.x() - m_npWindow.x; + evt.data.mouse.y = docCoordinates.y() - m_npWindow.y; } else { return; |