Web Inspector: artificial context menus don't work when Web Inspector is zoomed
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Jun 2019 22:46:14 +0000 (22:46 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Jun 2019 22:46:14 +0000 (22:46 +0000)
https://bugs.webkit.org/show_bug.cgi?id=198801

Reviewed by Joseph Pecoraro.

* inspector/InspectorFrontendHost.cpp:
(WebCore::InspectorFrontendHost::dispatchEventAsContextMenuEvent):
Use the `absoluteLocation` of the `MouseEvent`, which takes into account zoom and scale.

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

Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorFrontendHost.cpp

index 0a678a3..58894b2 100644 (file)
@@ -1,3 +1,14 @@
+2019-06-12  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: artificial context menus don't work when Web Inspector is zoomed
+        https://bugs.webkit.org/show_bug.cgi?id=198801
+
+        Reviewed by Joseph Pecoraro.
+
+        * inspector/InspectorFrontendHost.cpp:
+        (WebCore::InspectorFrontendHost::dispatchEventAsContextMenuEvent):
+        Use the `absoluteLocation` of the `MouseEvent`, which takes into account zoom and scale.
+
 2019-06-12  Sam Weinig  <weinig@apple.com>
 
         Remove dead code in user agent construction
index 64d1aba..71ca44b 100644 (file)
@@ -426,10 +426,8 @@ void InspectorFrontendHost::dispatchEventAsContextMenuEvent(Event& event)
         return;
 
     auto& mouseEvent = downcast<MouseEvent>(event);
-    IntPoint mousePoint { mouseEvent.clientX(), mouseEvent.clientY() };
     auto& frame = *downcast<Node>(mouseEvent.target())->document().frame();
-
-    m_frontendPage->contextMenuController().showContextMenuAt(frame, mousePoint);
+    m_frontendPage->contextMenuController().showContextMenuAt(frame, roundedIntPoint(mouseEvent.absoluteLocation()));
 #else
     UNUSED_PARAM(event);
 #endif