Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 2b9a29c2569d82a81a7e2f23ab45e9ac52a78b3e
https://github.com/WebKit/WebKit/commit/2b9a29c2569d82a81a7e2f23ab45e9ac52a78b3e
Author: Wenson Hsieh <[email protected]>
Date: 2024-01-10 (Wed, 10 Jan 2024)
Changed paths:
M Source/WebKit/UIProcess/ios/WKMouseInteraction.mm
Log Message:
-----------
REGRESSION (266610@main): Catalyst WKWebView does not dispatch `contextmenu`
on right click
https://bugs.webkit.org/show_bug.cgi?id=267361
rdar://119634050
Reviewed by Megan Gardner and Tim Horton.
After my refactoring in 266610@main, we no longer dispatch `contextmenu` events
when right clicking
in Mac Catalyst `WKWebView`. This is because UIKit's gesture environment skips
over the new
`WKMouseTouchGestureRecognizer` when delivering events to all gesture
recognizers on the window,
which in turn means that `-[WKMouseTouchGestureRecognizer
touchesBegan:withEvent:]` never gets
triggered and we don't dispatch any mouse (or context menu) events to the page.
This is due to UIKit having a Catalyst-specific codepath that returns `NO` in
the case where the
pointer is not the primary button. Previously, we avoided this by overriding
`-_shouldReceiveTouch:forEvent:recognizerView:` and returning `YES` in the case
of pointer touches.
Since the new `WKMouseTouchGestureRecognizer` doesn't use any SPI or IPI, this
bypass no longer
works.
To address this, simply override the IPI method `-_defaultAllowedMouseButtons`
to return both
primary and secondary mouse buttons to restore shipping behavior.
* Source/WebKit/UIProcess/ios/WKMouseInteraction.mm:
(-[WKMouseTouchGestureRecognizer _defaultAllowedMouseButtons]):
Canonical link: https://commits.webkit.org/272883@main
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes