Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: f79cd48ee2b323d60af56ba9d04329859ef1d885
https://github.com/WebKit/WebKit/commit/f79cd48ee2b323d60af56ba9d04329859ef1d885
Author: Abrar Rahman Protyasha <[email protected]>
Date: 2026-03-15 (Sun, 15 Mar 2026)
Changed paths:
M Source/WebCore/page/EventHandler.cpp
M Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm
M Source/WebKit/UIProcess/mac/WKAppKitGestureController.mm
M Source/WebKit/UIProcess/mac/WebViewImpl.h
M Source/WebKit/UIProcess/mac/WebViewImpl.mm
Log Message:
-----------
[AppKit Gestures] Refactor pointer event dispatch to support
NSPressGestureRecognizer
https://bugs.webkit.org/show_bug.cgi?id=309939
rdar://170691859
Reviewed by Richard Robinson.
In an earlier series of commits (terminating in 307810@main), we simply
taught the gesture controller about click events. This left a gap in our
pointer tracking/event dispatch support since we were unable to dispatch
general pointerDown/Move/Up event sequences to the web.
This patch addresses this disparity by simulating a mouse tracking loop
with a press gesture recognizer. We synthesize representative NSEvent
instances based on the tracking recognizer's state changes, and pass
them through our native mouse event handling codepath in WebViewImpl.
Note that we make a special concession for mouseDown so as to not fight
against deferred click support. The intention is that either of the two
paths fires a mouseDown, and not both. Further note that we opt out of
much of the EventHandler::handleMouseDraggedEvent() path for pointer
events originating from this recognizer. Among other things, a refactor
of drag-and-drop flows to also support gesture reconizers is forthcoming.
* Source/WebCore/page/EventHandler.cpp:
(WebCore::EventHandler::handleMouseDraggedEvent):
* Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm:
(-[WKWebView mouseDragged:]):
* Source/WebKit/UIProcess/mac/WKAppKitGestureController.mm:
(-[WKAppKitGestureController initWithPage:viewImpl:]):
(-[WKAppKitGestureController setUpGestureRecognizers]):
(-[WKAppKitGestureController setUpMouseTrackingGestureRecognizer]):
(-[WKAppKitGestureController addGesturesToWebView]):
(-[WKAppKitGestureController enableGesturesIfNeeded]):
(-[WKAppKitGestureController mouseTrackingGestureRecognized:]):
(-[WKAppKitGestureController _handleClickBegan:]):
(-[WKAppKitGestureController
gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
(-[WKAppKitGestureController _gestureRecognizer:canPreventGestureRecognizer:]):
* Source/WebKit/UIProcess/mac/WebViewImpl.h:
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::mouseDraggedInternal):
(WebKit::WebViewImpl::mouseDragged):
Canonical link: https://commits.webkit.org/309295@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications