Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 58632972e5782aa052b5ad4ea44036a4fc0d504c
https://github.com/WebKit/WebKit/commit/58632972e5782aa052b5ad4ea44036a4fc0d504c
Author: Abrar Rahman Protyasha <[email protected]>
Date: 2026-10-02 (Fri, 02 Oct 2026)
Changed paths:
M Source/WebKit/Scripts/webkit/messages.py
M Source/WebKit/Shared/Cocoa/GestureTypes.h
M Source/WebKit/Shared/Cocoa/GestureTypes.serialization.in
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/AppKitGestures/WKAppKitGestureController.h
M Source/WebKit/UIProcess/mac/AppKitGestures/WKAppKitGestureController.mm
M Source/WebKit/UIProcess/mac/AppKitGestures/WKAppKitGestureController.swift
M
Source/WebKit/UIProcess/mac/AppKitGestures/WKDOMDoubleClickGestureRecognizer.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 a YouTube video pauses it
https://bugs.webkit.org/show_bug.cgi?id=325977
rdar://187488912
Reviewed by Wenson Hsieh.
We have a bug where a double click sequence produces this sequence:
{ click, click, dblclick, click }. Thus, content that toggles per click,
such as the youtube.com video player, ends up in the wrong state after a
double click sequence.
Typically, the gesture that sends the double click would not recognize
simultaneously with the single click gesture, so exactly one of them
handles the second click. However, NSGestureRecognizer holds back events
from other gestures while one that requires two clicks is pending (see
319115@main and rdar://184563102), and so we cannot establish the
appropriate simultaneity relation between the two gestures.
Instead, in this patch, we send the double click eagerly before
committing to it, and we have the web process skip the click when it
dispatches the double click. Some more details in-line.
Instead, in this patch, when the second click completes a double click,
we reflect that in the synthetic click commit: the web process
dispatches it with a click count of 2 (a click with detail 2, followed
by a dblclick) to the node the single click targets, if a dblclick
listener can receive it there, and as a regular click otherwise. The
second click is then delivered once, and to the same node either way.
Test:
AppKitGesturesTests.DoubleClick.doubleClickWithListenerOnUnselectableContentFiresOneClickPerPress
AppKitGesturesTests.DoubleClick.doubleClickWithoutListenerOnUnselectableContentFiresTwoSingleClicks
AppKitGesturesTests.DoubleClick.doubleClickWithAncestorListenerOnStyleAdjustedContentFiresOneClickPerPress
AppKitGesturesTests.DoubleClick.doubleClickNextToClickableElementTargetsItWithBothClicks
* Source/WebKit/Scripts/webkit/messages.py:
(headers_for_type):
* Source/WebKit/Shared/Cocoa/GestureTypes.h:
* Source/WebKit/Shared/Cocoa/GestureTypes.serialization.in:
* Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::commitPotentialTap):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _singleTapRecognized:]):
* Source/WebKit/UIProcess/mac/AppKitGestures/WKAppKitGestureController.h:
* Source/WebKit/UIProcess/mac/AppKitGestures/WKAppKitGestureController.mm:
(-[WKAppKitGestureController domDoubleClickGestureRecognized:]):
(-[WKAppKitGestureController _handleClickEnded:]):
* Source/WebKit/UIProcess/mac/AppKitGestures/WKAppKitGestureController.swift:
(WKAppKitGestureController.takeCompletedDOMDoubleClick):
*
Source/WebKit/UIProcess/mac/AppKitGestures/WKDOMDoubleClickGestureRecognizer.swift:
(state):
(reset):
(takeCompletedDoubleClick):
The two click gestures' actions for a second click can come in either
order, and when the single click gesture's comes first, the DOM double
click gesture's state does not reflect the double click yet. So, we now
record whether a click completed a double click as soon as the click
ends, and whichever action comes first sends the double click.
* Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::commitPotentialTap):
(WebKit::WebPage::completeSyntheticClick):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:
* Tools/TestWebKitAPI/Tests/WebKit/WebPage/AppKit Gesture
Tests/DoubleClickGesturesTests.swift:
(AppKitGesturesTests.doubleClickWithListenerOnUnselectableContentFiresOneClickPerPress):
(AppKitGesturesTests.doubleClickWithoutListenerOnUnselectableContentFiresTwoSingleClicks):
(AppKitGesturesTests.doubleClickWithAncestorListenerOnStyleAdjustedContentFiresOneClickPerPress):
(AppKitGesturesTests.doubleClickNextToClickableElementTargetsItWithBothClicks):
(AppKitGesturesTests.loadUnselectableHTML(_:)):
Canonical link: https://commits.webkit.org/322530@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications