Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 6c0e1dc821389bd22729429636a8c46963f76474
https://github.com/WebKit/WebKit/commit/6c0e1dc821389bd22729429636a8c46963f76474
Author: Abrar Rahman Protyasha <[email protected]>
Date: 2026-04-25 (Sat, 25 Apr 2026)
Changed paths:
M Source/WebKit/UIProcess/mac/WKAppKitGestureController.h
M Source/WebKit/UIProcess/mac/WKAppKitGestureController.mm
M Source/WebKit/UIProcess/mac/WebViewImpl.mm
Log Message:
-----------
[AppKit Gestures] Support gesture recognizer-initiated drag sessions
https://bugs.webkit.org/show_bug.cgi?id=313285
rdar://166409432
Reviewed by Wenson Hsieh.
This commit brings up support to drive drag-and-drop interactions with
gesture recognizers, using WebCore's existing mouse event pipeline.
When a press gesture fires, we synthesize mouseDown/mouseDragged/mouseUp
events that end up routing through EventHandler::handleDrag. Once event
handling decides to start a drag, WebViewImpl::startDrag() uses the
beginDraggingSessionWithItems: API and pumps a dragging session through
updateDragWithGesture:.
The drag press gesture recognizes simultaneously with the click and
mouse tracking gestures so that synthetic clicks can fire before the
press threshold is reached. When the press gesture does fire, it cancels
any pending click via _handleClickCancelled and suppresses the mouse
tracking handler to prevent competing synthetic events. In the future,
we can consider collapsing the drag-and-drop gesture recognizer with the
mouse tracking gesture recognizer, given how similar their work is, but
disambiguation will require more work in WebCore event handling to make
that happen.
* Source/WebKit/UIProcess/mac/WKAppKitGestureController.h:
* Source/WebKit/UIProcess/mac/WKAppKitGestureController.mm:
(-[WKAppKitGestureController setUpGestureRecognizers]):
(-[WKAppKitGestureController addGesturesToWebView]):
(-[WKAppKitGestureController enableGesturesIfNeeded]):
(-[WKAppKitGestureController mouseTrackingGestureRecognized:]):
(-[WKAppKitGestureController setUpDragPressGestureRecognizer]):
(-[WKAppKitGestureController dragPressGestureRecognized:]):
(-[WKAppKitGestureController activeDragGestureRecognizer]):
(-[WKAppKitGestureController setGestureDraggingSession:]):
(-[WKAppKitGestureController clearGestureDragState]):
(-[WKAppKitGestureController
gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::draggingSessionEnded):
(WebKit::WebViewImpl::startDrag):
Canonical link: https://commits.webkit.org/312023@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications