summaryrefslogtreecommitdiffstats
path: root/WebCore/plugins
diff options
context:
space:
mode:
authorDerek Sollenberger <djsollen@google.com>2009-08-03 15:45:38 -0400
committerDerek Sollenberger <djsollen@google.com>2009-08-03 16:27:57 -0400
commit5655832af95b56bf25c0183a2d5d2cd909d6c8f4 (patch)
tree8a04a08cb255e2a90eb5649f3fc6d1dcef9b95e9 /WebCore/plugins
parent51c0d4c6b1b74fff7336d81451ba7d2fc132e31c (diff)
downloadexternal_webkit-5655832af95b56bf25c0183a2d5d2cd909d6c8f4.zip
external_webkit-5655832af95b56bf25c0183a2d5d2cd909d6c8f4.tar.gz
external_webkit-5655832af95b56bf25c0183a2d5d2cd909d6c8f4.tar.bz2
Fixing mouse and touch coordinates inside iframes.
Diffstat (limited to 'WebCore/plugins')
-rw-r--r--WebCore/plugins/android/PluginViewAndroid.cpp43
1 files changed, 17 insertions, 26 deletions
diff --git a/WebCore/plugins/android/PluginViewAndroid.cpp b/WebCore/plugins/android/PluginViewAndroid.cpp
index 54a085d..d88692d 100644
--- a/WebCore/plugins/android/PluginViewAndroid.cpp
+++ b/WebCore/plugins/android/PluginViewAndroid.cpp
@@ -228,13 +228,11 @@ void PluginView::handleTouchEvent(TouchEvent* event)
evt.data.touch.modifiers = 0; // todo
- // 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;
+ // convert to coordinates that are relative to the plugin. The pageX / pageY
+ // values are the only values in the event that are consistently in frame
+ // coordinates despite their misleading name.
+ evt.data.touch.x = event->pageX() - m_npWindow.x;
+ evt.data.touch.y = event->pageY() - m_npWindow.y;
if (m_plugin->pluginFuncs()->event(m_instance, &evt)) {
event->setDefaultPrevented(true);
@@ -253,13 +251,11 @@ void PluginView::handleMouseEvent(MouseEvent* event)
SkANP::InitEvent(&evt, kMouse_ANPEventType);
evt.data.mouse.action = isUp ? kUp_ANPMouseAction : kDown_ANPMouseAction;
- // 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;
+ // convert to coordinates that are relative to the plugin. The pageX / pageY
+ // values are the only values in the event that are consistently in frame
+ // coordinates despite their misleading name.
+ evt.data.mouse.x = event->pageX() - m_npWindow.x;
+ evt.data.mouse.y = event->pageY() - m_npWindow.y;
}
else {
return;
@@ -377,21 +373,16 @@ void PluginView::setNPWindowRect(const IntRect& rect)
if (!m_isStarted)
return;
- const int width = rect.width();
- const int height = rect.height();
-
- // the rect is relative to the frameview's (0,0), so use convertToContainingWindow
- IntPoint p = parent()->convertToContainingWindow(rect.location());
- m_npWindow.x = p.x();
- m_npWindow.y = p.y();
-
- m_npWindow.width = width;
- m_npWindow.height = height;
+ // the rect is relative to the frameview's (0,0)
+ m_npWindow.x = rect.x();
+ m_npWindow.y = rect.y();
+ m_npWindow.width = rect.width();
+ m_npWindow.height = rect.height();
m_npWindow.clipRect.left = 0;
m_npWindow.clipRect.top = 0;
- m_npWindow.clipRect.right = width;
- m_npWindow.clipRect.bottom = height;
+ m_npWindow.clipRect.right = rect.width();
+ m_npWindow.clipRect.bottom = rect.height();
if (m_plugin->pluginFuncs()->setwindow) {
#if USE(JSC)