Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 21ec347a90f7a2b949035e7110b9833cd05ab508
https://github.com/WebKit/WebKit/commit/21ec347a90f7a2b949035e7110b9833cd05ab508
Author: Lily Spiniolas <[email protected]>
Date: 2026-04-26 (Sun, 26 Apr 2026)
Changed paths:
A
LayoutTests/fast/events/touch/ios/touch-event-regions-layer-tree/dblclick-columns-expected.txt
A
LayoutTests/fast/events/touch/ios/touch-event-regions-layer-tree/dblclick-columns.html
A
LayoutTests/fast/events/touch/ios/touch-event-regions-layer-tree/dblclick-document-expected.txt
A
LayoutTests/fast/events/touch/ios/touch-event-regions-layer-tree/dblclick-document.html
A
LayoutTests/fast/events/touch/ios/touch-event-regions-layer-tree/dblclick-iframes-expected.txt
A
LayoutTests/fast/events/touch/ios/touch-event-regions-layer-tree/dblclick-iframes.html
A
LayoutTests/fast/events/touch/ios/touch-event-regions-layer-tree/dblclick-window-expected.txt
A
LayoutTests/fast/events/touch/ios/touch-event-regions-layer-tree/dblclick-window.html
M Source/WTF/wtf/PlatformEnable.h
M Source/WTF/wtf/PlatformEnableCocoa.h
M Source/WebCore/dom/Document.cpp
M Source/WebCore/dom/Document.h
M Source/WebCore/dom/Node.cpp
M Source/WebCore/page/LocalDOMWindow.cpp
M Source/WebCore/page/LocalFrame.cpp
M Source/WebCore/platform/EventTrackingRegions.cpp
M Source/WebCore/platform/EventTrackingRegions.h
M Source/WebCore/platform/graphics/ca/PlatformCALayer.h
M Source/WebCore/rendering/EventRegion.cpp
M Source/WebCore/rendering/EventRegion.h
M Source/WebCore/rendering/RenderBlock.cpp
M Source/WebCore/rendering/RenderLayerBacking.cpp
M Source/WebCore/rendering/style/RenderStyleConstants.cpp
M Source/WebCore/rendering/style/RenderStyleConstants.h
M Source/WebCore/style/StyleAdjuster.cpp
M Source/WebCore/testing/Internals.cpp
M Source/WebCore/testing/Internals.h
M Source/WebCore/testing/Internals.idl
M Source/WebKit/Shared/Cocoa/InteractionInformationAtPosition.h
M Source/WebKit/Shared/Cocoa/InteractionInformationAtPosition.mm
M
Source/WebKit/Shared/Cocoa/InteractionInformationAtPosition.serialization.in
M Source/WebKit/Shared/Cocoa/InteractionInformationRequest.cpp
M Source/WebKit/Shared/Cocoa/InteractionInformationRequest.h
M Source/WebKit/Shared/Cocoa/InteractionInformationRequest.serialization.in
M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
M Source/WebKit/UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h
M Source/WebKit/UIProcess/API/ios/WKWebViewTestingIOS.mm
M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h
M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm
M Source/WebKit/UIProcess/RemoteLayerTree/cocoa/RemoteScrollingTreeCocoa.h
M Source/WebKit/UIProcess/RemoteLayerTree/cocoa/RemoteScrollingTreeCocoa.mm
M Source/WebKit/UIProcess/WebPageProxy.cpp
M Source/WebKit/UIProcess/WebPageProxy.h
M Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
M Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm
M Source/WebKit/WebProcess/WebPage/Cocoa/PositionInformationForWebPage.mm
M Source/WebKit/WebProcess/WebPage/WebPage.h
M Source/WebKit/WebProcess/WebPage/WebPage.messages.in
M Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
A Tools/TestWebKitAPI/Tests/WebKit/WKWebView/CrossOriginDblclickHelpers.h
M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm
M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/iOSMouseSupport.mm
Log Message:
-----------
[iOS] Create event regions for dblclick
https://bugs.webkit.org/show_bug.cgi?id=312611
rdar://173882146
Reviewed by Aditya Keerthi and Abrar Rahman Protyasha.
Overhaul how `dblclick` events are dispatched on iOS, enabling them
to work in cross-origin frames when site isolation is enabled.
Build event regions on iOS like we do for touch events, and use these event
regions in the UIProcess to determine a) whether or not we should fire
a `dblclick` event, and b) which web process and frame the event needs to
be dispatched to.
In `gestureRecognizerShouldBegin`, rather than having to perform a
synchronous `InteractionInformationRequest` to determine if the point
falls inside of a node with an event listener, we now take the
`RemoteLayerTreeDrawingAreaProxy` and use `proxy->eventTrackingTypeForPoint`
to determine if the point hit an event region tracking `dblclick`. No
waiting required.
If the gesture recognizer begins and
`WebPageProxy::handleDoubleTapForDoubleClickAtPoint` triggers, we again use
the `RemoteLayerTreeDrawingAreaProxy`, this time to get specific information
about what the point hits inside the event region. Get this information by
using `proxy->eventRegionHitTestResultForDblclickAtPoint(point)` to yield
a struct `EventRegionHitTestResult` which contains the identifier of the
frame the region is associated with, and the point transformed into that
frame's coordinate space.
Since we can now immediately tell which frame we hit from the UI process, we
use `processContainingFrame` to determine the appropriate web process to
dispatch to, and we send it `HandleDoubleTapForDoubleClickAtPoint` with
the transformed point and frame identifier.
`WebPage::handleDoubleTapForDoubleClickAtPoint` no longer needs to
find the frame itself. Unlike other event types on iOS, this design allows
us to dispatch directly from the UIProcess to the singular correct web process
rather than having to dispatch to each child web process until the
correct one is found.
In `WebPage::handleDoubleTapForDoubleClickAtPoint`, with site isolation on,
the
`lastLayerTreeTransactionId.lessThanSameProcess(*firstTransactionID)` check
no longer prevented stale dispatch correctly since the transaction IDs were not
guaranteed to belong to the same process.
To fix this check, this, we collect the last layer tree transactions
ID for each web process, add it to a hashmap, and then pass to
`WebPageProxy::handleDoubleTapForDoubleClickAtPoint` so that we can
update the `lastLayerTreeTransactionId` passed to
`WebPage::handleDoubleTapForDoubleClickAtPoint` to be the last layer
tree transaction ID of the web process we are dispatching the message to.
Tests:
fast/events/touch/ios/touch-event-regions-layer-tree/dblclick-columns.html
fast/events/touch/ios/touch-event-regions-layer-tree/dblclick-document.html
fast/events/touch/ios/touch-event-regions-layer-tree/dblclick-iframes.html
fast/events/touch/ios/touch-event-regions-layer-tree/dblclick-window.html
Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm
Tools/TestWebKitAPI/Tests/WebKit/WKWebView/iOSMouseSupport.mm
*
LayoutTests/fast/events/touch/ios/touch-event-regions-layer-tree/dblclick-columns-expected.txt:
Added.
*
LayoutTests/fast/events/touch/ios/touch-event-regions-layer-tree/dblclick-columns.html:
Added.
*
LayoutTests/fast/events/touch/ios/touch-event-regions-layer-tree/dblclick-document-expected.txt:
Added.
*
LayoutTests/fast/events/touch/ios/touch-event-regions-layer-tree/dblclick-document.html:
Added.
*
LayoutTests/fast/events/touch/ios/touch-event-regions-layer-tree/dblclick-iframes-expected.txt:
Added.
*
LayoutTests/fast/events/touch/ios/touch-event-regions-layer-tree/dblclick-iframes.html:
Added.
*
LayoutTests/fast/events/touch/ios/touch-event-regions-layer-tree/dblclick-window-expected.txt:
Added.
*
LayoutTests/fast/events/touch/ios/touch-event-regions-layer-tree/dblclick-window.html:
Added.
* Source/WTF/wtf/PlatformEnable.h:
* Source/WTF/wtf/PlatformEnableCocoa.h:
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::willBeRemovedFromFrame):
(WebCore::Document::invalidateEventListenerRegions):
(WebCore::Document::eventHandlersIncludedInEventRegionsChanged):
(WebCore::Document::wheelEventHandlersChanged):
(WebCore::Document::didAddTouchEventHandler):
(WebCore::Document::didRemoveTouchEventHandler):
(WebCore::Document::didAddDoubleClickEventHandler):
(WebCore::Document::didRemoveDoubleClickEventHandler):
(WebCore::Document::didRemoveEventTargetNode):
(WebCore::Document::doubleClickEventHandlerCount const):
(WebCore::Document::hasDoubleClickEventHandlers const):
(WebCore::Document::wheelOrTouchEventHandlersChanged): Deleted.
* Source/WebCore/dom/Document.h:
(WebCore::Document::doubleClickEventTargetsContain const):
* Source/WebCore/dom/Node.cpp:
(WebCore::Node::~Node):
(WebCore::tryAddEventListener):
(WebCore::didRemoveEventListenersOfType):
* Source/WebCore/page/LocalDOMWindow.cpp:
(WebCore::LocalDOMWindow::addEventListener):
(WebCore::LocalDOMWindow::removeEventListener):
* Source/WebCore/page/LocalFrame.cpp:
(WebCore::LocalFrame::invalidateContentEventRegionsIfNeeded):
* Source/WebCore/platform/EventTrackingRegions.cpp:
(WebCore::EventTrackingRegions::eventName):
(WebCore::EventTrackingRegions::eventNameAtomString):
(WebCore::EventTrackingRegions::trackingTypeForPoint const):
* Source/WebCore/platform/EventTrackingRegions.h:
* Source/WebCore/platform/graphics/ca/PlatformCALayer.h:
* Source/WebCore/rendering/EventRegion.cpp:
(WebCore::EventRegion::EventRegion):
(WebCore::EventRegion::uniteEventListeners):
* Source/WebCore/rendering/EventRegion.h:
(WebCore::EventRegion::frameID const):
(WebCore::EventRegion::setFrameID):
* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::paintObject):
* Source/WebCore/rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::maintainsEventRegion const):
(WebCore::RenderLayerBacking::updateEventRegion):
(WebCore::patternForEventListenerRegionType):
(WebCore::RenderLayerBacking::paintDebugOverlays):
* Source/WebCore/rendering/style/RenderStyleConstants.cpp:
(WebCore::operator<<):
* Source/WebCore/rendering/style/RenderStyleConstants.h:
* Source/WebCore/style/StyleAdjuster.cpp:
(WebCore::Style::Adjuster::computeEventListenerRegionTypes):
* Source/WebCore/testing/Internals.cpp:
(WebCore::Internals::doubleClickEventHandlerCount):
* Source/WebCore/testing/Internals.h:
* Source/WebCore/testing/Internals.idl:
* Source/WebKit/Shared/Cocoa/InteractionInformationAtPosition.h:
* Source/WebKit/Shared/Cocoa/InteractionInformationAtPosition.mm:
(WebKit::InteractionInformationAtPosition::InteractionInformationAtPosition):
* Source/WebKit/Shared/Cocoa/InteractionInformationAtPosition.serialization.in:
* Source/WebKit/Shared/Cocoa/InteractionInformationRequest.cpp:
(WebKit::InteractionInformationRequest::isValidForRequest const):
* Source/WebKit/Shared/Cocoa/InteractionInformationRequest.h:
(WebKit::InteractionInformationRequest::InteractionInformationRequest):
* Source/WebKit/Shared/Cocoa/InteractionInformationRequest.serialization.in:
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
* Source/WebKit/UIProcess/API/ios/WKWebViewTestingIOS.mm:
(-[WKWebView _simulateDoubleClickAtLocation:]):
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::committedLayerTreeTransactionIDsByProcess
const):
(WebKit::RemoteLayerTreeDrawingAreaProxy::eventRegionHitTestResultForDoubleClickAtPoint):
* Source/WebKit/UIProcess/RemoteLayerTree/cocoa/RemoteScrollingTreeCocoa.h:
* Source/WebKit/UIProcess/RemoteLayerTree/cocoa/RemoteScrollingTreeCocoa.mm:
(WebKit::eventRegionForPoint):
(WebKit::hitLayerTreeNodeAtPoint):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.h:
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView cleanUpInteraction]):
(-[WKContentView _touchEventsRecognized]):
(-[WKContentView gestureRecognizerShouldBegin:]):
(-[WKContentView _doubleTapRecognizedForDoubleClick:]):
(-[WKContentView mouseInteraction:changedWithEvent:]):
(-[WKContentView _updateLastPointerRegionIfNeeded:]):
(-[WKContentView _simulateElementAction:atLocation:]):
(-[WKContentView _simulateDoubleClickAtLocation:]):
* Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::handleDoubleTapForDoubleClickAtPoint):
* Source/WebKit/WebProcess/WebPage/Cocoa/PositionInformationForWebPage.mm:
(WebKit::positionInformationForWebPage):
(WebKit::windowWithDoubleClickEventListener): Deleted.
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:
* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::handleDoubleTapForDoubleClickAtPoint):
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/CrossOriginDblclickHelpers.h:
Added.
(TestWebKitAPI::requestAnimationFrame):
(TestWebKitAPI::function):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm:
(TestWebKitAPI::(SiteIsolation,
DblclickWithWindowListenerInSimpleIFrameCrossOrigin)):
(TestWebKitAPI::(SiteIsolation,
DblclickWithWindowListenerInRotatedIFrameCrossOrigin)):
(TestWebKitAPI::(SiteIsolation,
DblclickWithWindowListenerInScaledIFrameCrossOrigin)):
(TestWebKitAPI::(SiteIsolation,
DblclickWithDocumentListenerInSimpleIFrameCrossOrigin)):
(TestWebKitAPI::(SiteIsolation,
DblclickWithDocumentListenerInRotatedIFrameCrossOrigin)):
(TestWebKitAPI::(SiteIsolation,
DblclickWithDocumentListenerInScaledIFrameCrossOrigin)):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/iOSMouseSupport.mm:
((iOSMouseSupport, DblclickWithWindowListenerInSimpleIFrameCrossOrigin)):
((iOSMouseSupport, DblclickWithWindowListenerInRotatedIFrameCrossOrigin)):
((iOSMouseSupport, DblclickWithWindowListenerInScaledIFrameCrossOrigin)):
((iOSMouseSupport, DblclickWithDocumentListenerInSimpleIFrameCrossOrigin)):
((iOSMouseSupport, DblclickWithDocumentListenerInRotatedIFrameCrossOrigin)):
((iOSMouseSupport, DblclickWithDocumentListenerInScaledIFrameCrossOrigin)):
Canonical link: https://commits.webkit.org/312036@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications