Title: [107847] branches/safari-534.54-branch/Source/WebKit2

Diff

Modified: branches/safari-534.54-branch/Source/WebKit2/ChangeLog (107846 => 107847)


--- branches/safari-534.54-branch/Source/WebKit2/ChangeLog	2012-02-15 23:14:24 UTC (rev 107846)
+++ branches/safari-534.54-branch/Source/WebKit2/ChangeLog	2012-02-15 23:36:34 UTC (rev 107847)
@@ -1,3 +1,16 @@
+2012-02-15  Anders Carlsson  <[email protected]>
+
+        <rdar://problem/10574154> Mouse input events in plug-ins have a vertical offset when the page is zoomed
+
+        Do apply the scale factor to mouse events. This was removed in r102540, but it's needed on the branch since
+        we don't do the same coordinate conversion inside NetscapePluginMac.mm on the branch that we do in ToT.
+
+        * Shared/WebEvent.h:
+        * Shared/WebMouseEvent.cpp:
+        (WebKit::WebMouseEvent::WebMouseEvent):
+        * WebProcess/Plugins/PluginView.cpp:
+        (WebKit::PluginView::handleEvent):
+
 2011-02-13  Lucas Forschler  <[email protected]>
 
     Rollout r105763.

Modified: branches/safari-534.54-branch/Source/WebKit2/Shared/WebEvent.h (107846 => 107847)


--- branches/safari-534.54-branch/Source/WebKit2/Shared/WebEvent.h	2012-02-15 23:14:24 UTC (rev 107846)
+++ branches/safari-534.54-branch/Source/WebKit2/Shared/WebEvent.h	2012-02-15 23:36:34 UTC (rev 107847)
@@ -124,6 +124,8 @@
 #if PLATFORM(WIN)
     WebMouseEvent(Type, Button, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers, double timestamp, bool didActivateWebView);
 #endif
+    
+    WebMouseEvent(const WebMouseEvent&, float pageScaleFactor);
 
     Button button() const { return static_cast<Button>(m_button); }
     const WebCore::IntPoint& position() const { return m_position; }

Modified: branches/safari-534.54-branch/Source/WebKit2/Shared/WebMouseEvent.cpp (107846 => 107847)


--- branches/safari-534.54-branch/Source/WebKit2/Shared/WebMouseEvent.cpp	2012-02-15 23:14:24 UTC (rev 107846)
+++ branches/safari-534.54-branch/Source/WebKit2/Shared/WebMouseEvent.cpp	2012-02-15 23:36:34 UTC (rev 107847)
@@ -78,6 +78,21 @@
 }
 #endif
 
+WebMouseEvent::WebMouseEvent(const WebMouseEvent& event, float pageScaleFactor)
+    : WebEvent(event.type(), event.modifiers(), event.timestamp())
+    , m_button(event.button())
+    , m_position(WebCore::IntPoint(event.position().x() / pageScaleFactor, event.position().y() / pageScaleFactor))
+    , m_globalPosition(m_position + (event.globalPosition() - event.position()))
+    , m_deltaX(event.deltaX())
+    , m_deltaY(event.deltaY())
+    , m_deltaZ(event.deltaZ())
+    , m_clickCount(event.clickCount())
+#if PLATFORM(WIN)
+    , m_didActivateWebView(false)
+#endif
+{
+}
+
 void WebMouseEvent::encode(CoreIPC::ArgumentEncoder* encoder) const
 {
     WebEvent::encode(encoder);

Modified: branches/safari-534.54-branch/Source/WebKit2/WebProcess/Plugins/PluginView.cpp (107846 => 107847)


--- branches/safari-534.54-branch/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2012-02-15 23:14:24 UTC (rev 107846)
+++ branches/safari-534.54-branch/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2012-02-15 23:36:34 UTC (rev 107847)
@@ -641,8 +641,10 @@
         // FIXME: Clicking in a scroll bar should not change focus.
         if (currentEvent->type() == WebEvent::MouseDown)
             focusPluginElement();
-
-        didHandleEvent = m_plugin->handleMouseEvent(static_cast<const WebMouseEvent&>(*currentEvent));
+        
+        // Adjust mouse coordinates to account for pageScaleFactor
+        WebMouseEvent eventWithScaledCoordinates(*static_cast<const WebMouseEvent*>(currentEvent), frame()->pageScaleFactor());
+        didHandleEvent = m_plugin->handleMouseEvent(eventWithScaledCoordinates);
     } else if (event->type() == eventNames().mousewheelEvent && currentEvent->type() == WebEvent::Wheel) {
         // We have a wheel event.
         didHandleEvent = m_plugin->handleWheelEvent(static_cast<const WebWheelEvent&>(*currentEvent));
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to