Document-relative page overlays drop some mouse events with non-zero top content...
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Aug 2014 03:02:35 +0000 (03:02 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Aug 2014 03:02:35 +0000 (03:02 +0000)
https://bugs.webkit.org/show_bug.cgi?id=135871
<rdar://problem/17982275>

Reviewed by Beth Dakin.

* WebProcess/WebPage/PageOverlay.cpp:
(WebKit::PageOverlay::mouseEvent):
Convert the mouse position into document-relative coordinates; the bounds()
already are! This way, we can actually compare them without being wrong sometimes.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@172512 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp

index 5ca7961d72e87aed1803d8c6d7c23bd40c4f18f1..564ae7850a79ac1153883a64467c8fe1219dcfc2 100644 (file)
@@ -1,3 +1,16 @@
+2014-08-12  Tim Horton  <timothy_horton@apple.com>
+
+        Document-relative page overlays drop some mouse events with non-zero top content inset
+        https://bugs.webkit.org/show_bug.cgi?id=135871
+        <rdar://problem/17982275>
+
+        Reviewed by Beth Dakin.
+
+        * WebProcess/WebPage/PageOverlay.cpp:
+        (WebKit::PageOverlay::mouseEvent):
+        Convert the mouse position into document-relative coordinates; the bounds()
+        already are! This way, we can actually compare them without being wrong sometimes.
+
 2014-08-12  Peyton Randolph  <prandolph@apple.com>
 
         Runtime switch for long mouse press gesture. Part of 135257 - Add long mouse press gesture
index 588a3549bf91bd013b441227049975dc3494319f..8212ed2e3ac544d3a4525673933a70fc1892befe 100644 (file)
@@ -158,8 +158,13 @@ void PageOverlay::drawRect(GraphicsContext& graphicsContext, const IntRect& dirt
     
 bool PageOverlay::mouseEvent(const WebMouseEvent& mouseEvent)
 {
+    IntPoint mousePositionInOverlayCoordinates(mouseEvent.position());
+
+    if (m_overlayType == PageOverlay::OverlayType::Document)
+        mousePositionInOverlayCoordinates = m_webPage->corePage()->mainFrame().view()->rootViewToContents(mousePositionInOverlayCoordinates);
+
     // Ignore events outside the bounds.
-    if (!bounds().contains(mouseEvent.position()))
+    if (!bounds().contains(mousePositionInOverlayCoordinates))
         return false;
 
     return m_client->mouseEvent(this, mouseEvent);