Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: e53a936d1ef39dd4f759f997e6fedb576ded641a
https://github.com/WebKit/WebKit/commit/e53a936d1ef39dd4f759f997e6fedb576ded641a
Author: Richard Robinson <[email protected]>
Date: 2026-10-05 (Mon, 05 Oct 2026)
Changed paths:
M Source/WebCore/page/EventHandler.h
M Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm
M Source/WebKit/UIProcess/WebPageProxy.h
M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
M Source/WebKit/UIProcess/mac/WKTextSelectionController.swift
M Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm
M Source/WebKit/WebProcess/WebPage/WebPage.h
M Source/WebKit/WebProcess/WebPage/WebPage.messages.in
M Tools/TestWebKitAPI/Tests/WebKit/WebPage/AppKit Gesture
Tests/DoubleClickGesturesTests.swift
Log Message:
-----------
[AppKit Gestures] Double-clicking on maps.google.com sometimes doesn't work
https://bugs.webkit.org/show_bug.cgi?id=326413
rdar://188651994
Reviewed by Abrar Rahman Protyasha.
A page can keep a mouse double click from selecting a word by preventing the
default action of its
mousedown events. With AppKit gestures, AppKit begins the word selection for a
gesture double click
on its own, so nothing checks whether the page prevented it. Google Maps
prevents every mousedown,
yet double clicking the map selects it, and the map then ignores later clicks
on the selection.
Beginning the selection also cancels the pending second click, so Maps only
sees a single click.
Fix this by having the web process decide whether to begin the selection. The
first click of a
double click is committed before AppKit begins the selection, and the web
process handles messages
in order, so by the time it is asked to select, it has already dispatched that
click's mouse press
(or the second click's, when it is delivered as a double click first). If the
page prevented the
latest synthetic mouse press from starting a selection, the web process skips
the word or paragraph
selection and replies that the page prevented it. Otherwise, it makes the
selection and cancels the
second click's pending click, which would otherwise land on the new selection.
The web process
forgets the press when a click resolves without one, so a press on another
element or page does not
carry over to a later double click.
WKTextSelectionController now waits for that reply before suppressing the
single click, so a page
that prevents the selection still gets the second click. A quick double click
ends its range
selection before the reply arrives, by which point the web process has already
cancelled the second
click if it made the selection.
Test: Tools/TestWebKitAPI/Tests/WebKit/WebPage/AppKit Gesture
Tests/DoubleClickGesturesTests.swift
* Source/WebCore/page/EventHandler.h:
* Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::didHandleSyntheticMousePress):
(WebKit::WebPageProxy::recentSyntheticMousePressPreventedSelection const):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.messages.in:
* Source/WebKit/UIProcess/mac/WKTextSelectionController.swift:
(WKTextSelectionController.beginRangeSelection(at:with:modifiers:)):
(WKTextSelectionController.continueRangeSelection(at:)):
(WKTextSelectionController.endRangeSelection(at:)):
* Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::completeSyntheticClick):
* Tools/TestWebKitAPI/Tests/WebKit/WebPage/AppKit Gesture
Tests/DoubleClickGesturesTests.swift:
(AppKitGesturesTests.doubleClickDoesNotSelectWordWhenPagePreventsMousedown(_:)):
(AppKitGesturesTests.doubleClickSelectsWordWhenPageObservesMousedownWithoutPreventingIt):
(AppKitGesturesTests.doubleClickWhenPagePreventsMousedownDeliversBothClicks):
(AppKitGesturesTests.slowDoubleClickDoesNotSelectWordWhenPagePreventsMousedown):
(AppKitGesturesTests.doubleClickAndHoldDoesNotSelectWordWhenPagePreventsMousedown):
(AppKitGesturesTests.doubleClickAndHoldSelectsWord):
(AppKitGesturesTests.doubleClickOnCanvasThatPreventsMousedownDeliversBothClicksWithoutSelecting):
(AppKitGesturesTests.doubleClickText(_:secondPressDelay:secondPressDuration:)):
(AppKitGesturesTests.expectNoRangeSelection(_:)):
Canonical link: https://commits.webkit.org/322810@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications