summaryrefslogtreecommitdiffstats
path: root/WebCore
diff options
context:
space:
mode:
authorDerek Sollenberger <djsollen@google.com>2009-07-07 11:32:48 -0400
committerDerek Sollenberger <djsollen@google.com>2009-07-07 11:32:48 -0400
commitd5e46442a26bd94d35230562671fc1979b3bb7a0 (patch)
tree2e79a5b9d3f69aaf770b41480e6dcf1c40af6fa4 /WebCore
parent3f84acc12c5a694d9c4073aa1de33fbdf1cd22d1 (diff)
downloadexternal_webkit-d5e46442a26bd94d35230562671fc1979b3bb7a0.zip
external_webkit-d5e46442a26bd94d35230562671fc1979b3bb7a0.tar.gz
external_webkit-d5e46442a26bd94d35230562671fc1979b3bb7a0.tar.bz2
plugins are now sent the correct coordinates even when the page is scrolled.
Diffstat (limited to 'WebCore')
-rw-r--r--WebCore/plugins/android/PluginViewAndroid.cpp22
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;