Title: [251517] trunk/Source
Revision
251517
Author
timothy_hor...@apple.com
Date
2019-10-23 17:55:02 -0700 (Wed, 23 Oct 2019)

Log Message

macCatalyst: Should dispatch contextmenu event on right click
https://bugs.webkit.org/show_bug.cgi?id=203316
<rdar://problem/54617376>

Reviewed by Wenson Hsieh.

Source/WebCore:

macCatalyst does not have ENABLE(CONTEXT_MENUS), because it uses the
iOS-style platform-driven context menu API, but should still dispatch
the contextmenu event on right click, for pages that depend on that.

Separate ENABLE(CONTEXT_MENU_EVENT) out from ENABLE(CONTEXT_MENUS).

In the future, calling preventDefault on the contextmenu event should
block the platform context menu from appearing, but currently they
use entirely different gestures.

* page/EventHandler.cpp:
* page/EventHandler.h:
* replay/UserInputBridge.cpp:
* replay/UserInputBridge.h:

Source/WebKit:

* WebProcess/WebPage/WebPage.cpp:
(WebKit::isContextClick):
(WebKit::handleContextMenuEvent):
(WebKit::WebPage::contextMenuForKeyEvent):
(WebKit::handleMouseEvent):
* WebProcess/WebPage/WebPage.h:

Source/WTF:

* wtf/FeatureDefines.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (251516 => 251517)


--- trunk/Source/WTF/ChangeLog	2019-10-24 00:18:15 UTC (rev 251516)
+++ trunk/Source/WTF/ChangeLog	2019-10-24 00:55:02 UTC (rev 251517)
@@ -1,3 +1,13 @@
+2019-10-23  Tim Horton  <timothy_hor...@apple.com>
+
+        macCatalyst: Should dispatch contextmenu event on right click
+        https://bugs.webkit.org/show_bug.cgi?id=203316
+        <rdar://problem/54617376>
+
+        Reviewed by Wenson Hsieh.
+
+        * wtf/FeatureDefines.h:
+
 2019-10-23  Truitt Savell  <tsav...@apple.com>
 
         Unreviewed, rolling out r251261.

Modified: trunk/Source/WTF/wtf/FeatureDefines.h (251516 => 251517)


--- trunk/Source/WTF/wtf/FeatureDefines.h	2019-10-24 00:18:15 UTC (rev 251516)
+++ trunk/Source/WTF/wtf/FeatureDefines.h	2019-10-24 00:55:02 UTC (rev 251517)
@@ -77,6 +77,12 @@
 #define ENABLE_CONTEXT_MENUS 0
 #endif
 
+#if !defined(ENABLE_CONTEXT_MENU_EVENT)
+#if !PLATFORM(MACCATALYST)
+#define ENABLE_CONTEXT_MENU_EVENT 0
+#endif
+#endif
+
 #if !defined(ENABLE_CURSOR_SUPPORT)
 #define ENABLE_CURSOR_SUPPORT 0
 #endif
@@ -422,6 +428,10 @@
 #define ENABLE_CONTEXT_MENUS 1
 #endif
 
+#if !defined(ENABLE_CONTEXT_MENU_EVENT)
+#define ENABLE_CONTEXT_MENU_EVENT 1
+#endif
+
 #if !defined(ENABLE_CSS3_TEXT)
 #define ENABLE_CSS3_TEXT 0
 #endif

Modified: trunk/Source/WebCore/ChangeLog (251516 => 251517)


--- trunk/Source/WebCore/ChangeLog	2019-10-24 00:18:15 UTC (rev 251516)
+++ trunk/Source/WebCore/ChangeLog	2019-10-24 00:55:02 UTC (rev 251517)
@@ -1,3 +1,26 @@
+2019-10-23  Tim Horton  <timothy_hor...@apple.com>
+
+        macCatalyst: Should dispatch contextmenu event on right click
+        https://bugs.webkit.org/show_bug.cgi?id=203316
+        <rdar://problem/54617376>
+
+        Reviewed by Wenson Hsieh.
+
+        macCatalyst does not have ENABLE(CONTEXT_MENUS), because it uses the
+        iOS-style platform-driven context menu API, but should still dispatch
+        the contextmenu event on right click, for pages that depend on that.
+
+        Separate ENABLE(CONTEXT_MENU_EVENT) out from ENABLE(CONTEXT_MENUS).
+
+        In the future, calling preventDefault on the contextmenu event should
+        block the platform context menu from appearing, but currently they
+        use entirely different gestures.
+
+        * page/EventHandler.cpp:
+        * page/EventHandler.h:
+        * replay/UserInputBridge.cpp:
+        * replay/UserInputBridge.h:
+
 2019-10-23  Russell Epstein  <repst...@apple.com>
 
         Unreviewed, rolling out r251469.

Modified: trunk/Source/WebCore/page/EventHandler.cpp (251516 => 251517)


--- trunk/Source/WebCore/page/EventHandler.cpp	2019-10-24 00:18:15 UTC (rev 251516)
+++ trunk/Source/WebCore/page/EventHandler.cpp	2019-10-24 00:55:02 UTC (rev 251517)
@@ -2937,7 +2937,7 @@
 #endif
 }
 
-#if ENABLE(CONTEXT_MENUS)
+#if ENABLE(CONTEXT_MENU_EVENT)
 bool EventHandler::sendContextMenuEvent(const PlatformMouseEvent& event)
 {
     Ref<Frame> protectedFrame(m_frame);
@@ -3052,7 +3052,7 @@
 
     return sendContextMenuEvent(platformMouseEvent);
 }
-#endif // ENABLE(CONTEXT_MENUS)
+#endif // ENABLE(CONTEXT_MENU_EVENT)
 
 void EventHandler::scheduleHoverStateUpdate()
 {

Modified: trunk/Source/WebCore/page/EventHandler.h (251516 => 251517)


--- trunk/Source/WebCore/page/EventHandler.h	2019-10-24 00:18:15 UTC (rev 251516)
+++ trunk/Source/WebCore/page/EventHandler.h	2019-10-24 00:55:02 UTC (rev 251517)
@@ -248,7 +248,7 @@
     WEBCORE_EXPORT void dispatchSyntheticMouseMove(const PlatformMouseEvent&);
 #endif
 
-#if ENABLE(CONTEXT_MENUS)
+#if ENABLE(CONTEXT_MENU_EVENT)
     WEBCORE_EXPORT bool sendContextMenuEvent(const PlatformMouseEvent&);
     WEBCORE_EXPORT bool sendContextMenuEventForKey();
 #endif

Modified: trunk/Source/WebCore/replay/UserInputBridge.cpp (251516 => 251517)


--- trunk/Source/WebCore/replay/UserInputBridge.cpp	2019-10-24 00:18:15 UTC (rev 251516)
+++ trunk/Source/WebCore/replay/UserInputBridge.cpp	2019-10-24 00:55:02 UTC (rev 251517)
@@ -45,7 +45,7 @@
 {
 }
 
-#if ENABLE(CONTEXT_MENUS)
+#if ENABLE(CONTEXT_MENU_EVENT)
 bool UserInputBridge::handleContextMenuEvent(const PlatformMouseEvent& mouseEvent, Frame& frame, InputSource)
 {
     return frame.eventHandler().sendContextMenuEvent(mouseEvent);

Modified: trunk/Source/WebCore/replay/UserInputBridge.h (251516 => 251517)


--- trunk/Source/WebCore/replay/UserInputBridge.h	2019-10-24 00:18:15 UTC (rev 251516)
+++ trunk/Source/WebCore/replay/UserInputBridge.h	2019-10-24 00:55:02 UTC (rev 251517)
@@ -55,7 +55,7 @@
     UserInputBridge(Page&);
 
     // User input APIs.
-#if ENABLE(CONTEXT_MENUS)
+#if ENABLE(CONTEXT_MENU_EVENT)
     WEBCORE_EXPORT bool handleContextMenuEvent(const PlatformMouseEvent&, Frame&, InputSource = InputSource::User);
 #endif
     WEBCORE_EXPORT bool handleMousePressEvent(const PlatformMouseEvent&, InputSource source = InputSource::User);

Modified: trunk/Source/WebKit/ChangeLog (251516 => 251517)


--- trunk/Source/WebKit/ChangeLog	2019-10-24 00:18:15 UTC (rev 251516)
+++ trunk/Source/WebKit/ChangeLog	2019-10-24 00:55:02 UTC (rev 251517)
@@ -1,3 +1,18 @@
+2019-10-23  Tim Horton  <timothy_hor...@apple.com>
+
+        macCatalyst: Should dispatch contextmenu event on right click
+        https://bugs.webkit.org/show_bug.cgi?id=203316
+        <rdar://problem/54617376>
+
+        Reviewed by Wenson Hsieh.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::isContextClick):
+        (WebKit::handleContextMenuEvent):
+        (WebKit::WebPage::contextMenuForKeyEvent):
+        (WebKit::handleMouseEvent):
+        * WebProcess/WebPage/WebPage.h:
+
 2019-10-23  Jiewen Tan  <jiewen_...@apple.com>
 
         Unreviewed, a speculative build fix after r251498

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (251516 => 251517)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2019-10-24 00:18:15 UTC (rev 251516)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2019-10-24 00:55:02 UTC (rev 251517)
@@ -2604,10 +2604,10 @@
     const WebEvent* m_previousCurrentEvent;
 };
 
-#if ENABLE(CONTEXT_MENUS)
+#if ENABLE(CONTEXT_MENU_EVENT)
 static bool isContextClick(const PlatformMouseEvent& event)
 {
-#if PLATFORM(COCOA)
+#if USE(APPKIT)
     return WebEventFactory::shouldBeHandledAsContextClick(event);
 #else
     return event.button() == WebCore::RightButton;
@@ -2624,20 +2624,27 @@
         frame = result.innerNonSharedNode()->document().frame();
 
     bool handled = page->corePage()->userInputBridge().handleContextMenuEvent(platformMouseEvent, *frame);
+#if ENABLE(CONTEXT_MENUS)
     if (handled)
         page->contextMenu()->show();
-
+#endif
     return handled;
 }
 
 void WebPage::contextMenuForKeyEvent()
 {
+#if ENABLE(CONTEXT_MENUS)
     corePage()->contextMenuController().clearContextMenu();
+#endif
 
     Frame& frame = m_page->focusController().focusedOrMainFrame();
     bool handled = frame.eventHandler().sendContextMenuEventForKey();
+#if ENABLE(CONTEXT_MENUS)
     if (handled)
         contextMenu()->show();
+#else
+    UNUSED_PARAM(handled);
+#endif
 }
 #endif
 
@@ -2657,7 +2664,7 @@
 #endif
 
             bool handled = page->corePage()->userInputBridge().handleMousePressEvent(platformMouseEvent);
-#if ENABLE(CONTEXT_MENUS)
+#if ENABLE(CONTEXT_MENU_EVENT)
             if (isContextClick(platformMouseEvent))
                 handled = handleContextMenuEvent(platformMouseEvent, page);
 #endif

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (251516 => 251517)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2019-10-24 00:18:15 UTC (rev 251516)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2019-10-24 00:55:02 UTC (rev 251517)
@@ -1367,6 +1367,8 @@
 
 #if ENABLE(CONTEXT_MENUS)
     void contextMenuHidden() { m_isShowingContextMenu = false; }
+#endif
+#if ENABLE(CONTEXT_MENU_EVENT)
     void contextMenuForKeyEvent();
 #endif
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to