Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 735320ebc77efe74594007f13e20cdaea92ece6e
https://github.com/WebKit/WebKit/commit/735320ebc77efe74594007f13e20cdaea92ece6e
Author: Richard Robinson <[email protected]>
Date: 2026-09-29 (Tue, 29 Sep 2026)
Changed paths:
M Source/WebKit/Platform/spi/mac/AppKitSPI.h
M Source/WebKit/UIProcess/mac/AppKitGestures/WKAppKitGestureController.mm
M Source/WebKit/UIProcess/mac/AppKitGestures/WKPressGestureRecognizer.h
M Source/WebKit/UIProcess/mac/AppKitGestures/WKPressGestureRecognizer.swift
M Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm
M Source/WebKit/WebProcess/WebPage/WebPage.h
M Tools/TestWebKitAPI/Tests/WebKit/WebPage/AppKit Gesture
Tests/BasicAppKitGesturesTests.swift
Log Message:
-----------
[AppKit Gestures] Double clicking in a word in a text field sometimes does
not select the word
https://bugs.webkit.org/show_bug.cgi?id=325564
rdar://188646974
Reviewed by Abrar Rahman Protyasha.
Fix two issues that caused this and made several tests flaky:
1. AppKit's text selection press, which selects the word, inherits
NSPressGestureRecognizer's behavior of
waiting for every press with a longer minimum duration to fail. That includes
the Live Text preflight,
whose minimum duration is 0.1s. So whenever the second click lasted at least
that long, the preflight
recognized first and the text selection press failed.
Fix by having the preflight GR refuse to be a failure requirement for any other
one. It only
observes the press, so nothing should wait for it. WKPressGestureRecognizer
already keeps our own
events from waiting on each other by overriding
`shouldRequireFailureOfGestureRecognizer`, but that
can't stop AppKit's presses from waiting on it. So add a
`refusesToBeFailureRequirement` property that
overrides `_acceptsBeingFailureRequirementForGestureRecognizer`, and set it on
the preflight.
2. The second click's synthetic click is committed before the text selection
begins, but for form
controls its dispatch is deferred to the next run loop turn. The UI process
cancels the click when the
text selection begins, but the cancellation has no effect once the click is
committed. So the click
could be dispatched after the word was selected and break the selection, which
clears it in a
read-only field.
Fix by dispatching any such deferred click as soon as the cancellation arrives,
so that it always
lands before the selection, and no committed clicks are dropped.
Test: Tools/TestWebKitAPI/Tests/WebKit/WebPage/AppKit Gesture
Tests/BasicAppKitGesturesTests.swift
* Source/WebKit/UIProcess/mac/AppKitGestures/WKAppKitGestureController.mm:
(-[WKAppKitGestureController _imageAnalysisShouldBeginAtLocation:]):
(-[WKAppKitGestureController gestureRecognizerShouldBegin:]):
* Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::handleSyntheticClick):
(WebKit::WebPage::dispatchDeferredSyntheticClickIfNeeded):
(WebKit::WebPage::cancelPotentialTap):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Tools/TestWebKitAPI/Tests/WebKit/WebPage/AppKit Gesture
Tests/BasicAppKitGesturesTests.swift:
(AppKitGesturesTests.doubleClickingInWordInTextFieldSelectsWordRegardlessOfSecondClickDuration(_:secondClickDuration:)):
Canonical link: https://commits.webkit.org/322139@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications