[webkit-changes] [WebKit/WebKit] 9ce57e: REGRESSION (iOS 16): New context menu (UIEditMenuI...

Devin Rousso noreply at github.com
Wed Oct 5 14:23:20 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9ce57ec0f4b36f9483635955f11fda7250c13eff
      https://github.com/WebKit/WebKit/commit/9ce57ec0f4b36f9483635955f11fda7250c13eff
  Author: Devin Rousso <drousso at apple.com>
  Date:   2022-10-05 (Wed, 05 Oct 2022)

  Changed paths:
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/iOSMouseSupport.mm

  Log Message:
  -----------
  REGRESSION (iOS 16): New context menu (UIEditMenuInteraction) can't be disabled
https://bugs.webkit.org/show_bug.cgi?id=244149
<rdar://problem/98935540>

Reviewed by Wenson Hsieh.

There doesn't really seem to be a common path or even a consistent ordering of events between the
page dispatching a JS `"contextmenu"` event and the UIProcess deciding whether to show the edit menu.

As such, we should keep track of whether the last JS `"contextmenu"` event was `preventDefault()`,
delaying relevant activity until that info is received in the UIProcess (from the WebProcess).

* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::handleMouseEvent):
(WebKit::WebPageProxy::handlePreventableTouchEvent):
(WebKit::WebPageProxy::dispatchAfterCurrentContextMenuEvent): Added.
(WebKit::WebPageProxy::processContextMenuCallbacks): Added.
(WebKit::WebPageProxy::didReceiveEvent):
Rename `TouchMovePreventionState` to `EventPreventionState` so that more things can use it and split
`ReceivedReply` into `Prevented` and `Allowed` to make it easier to manage state (e.g. keeping track
of one variable is easier than two).

* Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::prepareSelectionForContextMenuWithLocationInView):
If the last JS `"contextmenu"` event was `preventDefault()`, don't show the edit menu.

* Tools/TestWebKitAPI/Tests/WebKitCocoa/iOSMouseSupport.mm:
(TEST.iOSMouseSupport.RightClickDoesNotShowMenuIfPreventDefault): Added.

Canonical link: https://commits.webkit.org/255193@main




More information about the webkit-changes mailing list