Skip to content

AX: Fix LocalFrame hit testing in layout tests#60747

Merged
webkit-commit-queue merged 1 commit intoWebKit:mainfrom
hoffmanjoshua:eng/AX-Fix-LocalFrame-hit-testing-in-layout-tests
Mar 19, 2026
Merged

AX: Fix LocalFrame hit testing in layout tests#60747
webkit-commit-queue merged 1 commit intoWebKit:mainfrom
hoffmanjoshua:eng/AX-Fix-LocalFrame-hit-testing-in-layout-tests

Conversation

@hoffmanjoshua
Copy link
Contributor

@hoffmanjoshua hoffmanjoshua commented Mar 17, 2026

ca8a934

AX: Fix LocalFrame hit testing in layout tests
https://bugs.webkit.org/show_bug.cgi?id=310080
rdar://172721343

Reviewed by Tyler Wilcock.

With ACCESSIBILITY_LOCAL_FRAME enabled, relative frames are no longer supported. This
is an issue for layout tests, since all coordinates for hit testing are expected to
be in page-relative position. This patch fixes that by converting page to screen coords
only when in test mode.

The other core fix here is recursively calling approximateHitTest on local frames. This
allows us to pass through a hit test seemlessly, and gets around some of the
complications with wrappers + LocalFrame.

To support tests, a new method, isFrameGeometryInitialized, was added. This will allow
layout tests to wait on initialization before performing any geometry-related actions
or queries.

* LayoutTests/accessibility-isolated-tree/TestExpectations:
* LayoutTests/accessibility/button-hit-test.html:
* LayoutTests/accessibility/dynamic-changes-update-position.html:
* LayoutTests/accessibility/hit-test-on-stitched-text.html:
* LayoutTests/accessibility/mac/imagemap-hittest.html:
* LayoutTests/accessibility/mac/line-range-for-text-marker.html:
* LayoutTests/accessibility/mac/scroll-to-visible-action.html:
* LayoutTests/accessibility/mac/text-marker-for-bounds.html:
* LayoutTests/accessibility/table-cell-hit-test-not-column.html:
* LayoutTests/accessibility/text-input-hit-test.html:
* LayoutTests/resources/accessibility-helper.js:
* Source/WebCore/accessibility/AXCoreObject.h:
(WebCore::AXCoreObject::isFrameGeometryInitialized const):
* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::AXObjectCache):
* Source/WebCore/accessibility/AccessibilityScrollView.cpp:
(WebCore::AccessibilityScrollView::isFrameGeometryInitialized const):
* Source/WebCore/accessibility/AccessibilityScrollView.h:
* Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper _accessibilityIsFrameGeometryInitialized]):
* Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::accessibilityHitTest const):
(WebCore::AXIsolatedObject::approximateHitTest const):
(WebCore::AXIsolatedObject::screenRelativePosition const):
(WebCore::AXIsolatedObject::screenRelativeRect const):
(WebCore::AXIsolatedObject::isFrameGeometryInitialized const):
* Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h:
* Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp:
(WebCore::AXIsolatedTree::createEmptyContent):
(WebCore::AXIsolatedTree::applyPendingChangesLocked):
(WebCore::createIsolatedObjectData):
* Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h:
(WebCore::AXIsolatedTree::isFrameGeometryInitialized const):
* Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(attributeValueForTesting):
* Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
(WTR::AccessibilityUIElement::isFrameGeometryInitialized const):
* Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
* Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.h:
* Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
(WTR::AccessibilityUIElementIOS::isFrameGeometryInitialized const):
* Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.h:
* Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(WTR::attributeValue):
(WTR::AccessibilityUIElementMac::isFrameGeometryInitialized const):

Canonical link: https://commits.webkit.org/309535@main

9432874

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows Apple Internal
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win loading 🛠 ios-apple
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 ✅ 🧪 win-tests loading 🛠 mac-apple
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe loading 🛠 vision-apple
✅ 🧪 ios-wk2-wpt ✅ 🧪 api-mac-debug ✅ 🛠 gtk3-libwebrtc
✅ 🧪 api-ios ✅ 🧪 mac-wk1 ✅ 🛠 gtk
✅ 🛠 ios-safer-cpp ✅ 🧪 mac-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 api-gtk
✅ 🛠 🧪 merge ✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ✅ 🛠 playstation
✅ 🧪 vision-wk2 ✅ 🧪 mac-intel-wk2
✅ 🛠 tv ✅ 🛠 mac-safer-cpp
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@hoffmanjoshua hoffmanjoshua self-assigned this Mar 17, 2026
@hoffmanjoshua hoffmanjoshua added the Accessibility For bugs related to accessibility. label Mar 17, 2026
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Mar 17, 2026
@hoffmanjoshua hoffmanjoshua removed the merging-blocked Applied to prevent a change from being merged label Mar 17, 2026
@hoffmanjoshua hoffmanjoshua force-pushed the eng/AX-Fix-LocalFrame-hit-testing-in-layout-tests branch from 0ddc3bc to fe63c78 Compare March 17, 2026 14:45
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Mar 17, 2026
@hoffmanjoshua hoffmanjoshua removed the merging-blocked Applied to prevent a change from being merged label Mar 18, 2026
@hoffmanjoshua hoffmanjoshua force-pushed the eng/AX-Fix-LocalFrame-hit-testing-in-layout-tests branch from fe63c78 to fd328cd Compare March 18, 2026 02:06
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Mar 18, 2026
@hoffmanjoshua hoffmanjoshua removed the merging-blocked Applied to prevent a change from being merged label Mar 18, 2026
@hoffmanjoshua hoffmanjoshua force-pushed the eng/AX-Fix-LocalFrame-hit-testing-in-layout-tests branch from fd328cd to 0b73534 Compare March 18, 2026 04:19
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Mar 18, 2026
@hoffmanjoshua hoffmanjoshua removed the merging-blocked Applied to prevent a change from being merged label Mar 18, 2026
@hoffmanjoshua hoffmanjoshua force-pushed the eng/AX-Fix-LocalFrame-hit-testing-in-layout-tests branch from 0b73534 to a55fbdf Compare March 18, 2026 04:38
@hoffmanjoshua hoffmanjoshua force-pushed the eng/AX-Fix-LocalFrame-hit-testing-in-layout-tests branch from a55fbdf to 52a04d1 Compare March 18, 2026 05:45
@hoffmanjoshua hoffmanjoshua force-pushed the eng/AX-Fix-LocalFrame-hit-testing-in-layout-tests branch from 52a04d1 to 9432874 Compare March 18, 2026 17:57
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Mar 18, 2026
@hoffmanjoshua hoffmanjoshua added merge-queue Applied to send a pull request to merge-queue and removed merging-blocked Applied to prevent a change from being merged labels Mar 19, 2026
https://bugs.webkit.org/show_bug.cgi?id=310080
rdar://172721343

Reviewed by Tyler Wilcock.

With ACCESSIBILITY_LOCAL_FRAME enabled, relative frames are no longer supported. This
is an issue for layout tests, since all coordinates for hit testing are expected to
be in page-relative position. This patch fixes that by converting page to screen coords
only when in test mode.

The other core fix here is recursively calling approximateHitTest on local frames. This
allows us to pass through a hit test seemlessly, and gets around some of the
complications with wrappers + LocalFrame.

To support tests, a new method, isFrameGeometryInitialized, was added. This will allow
layout tests to wait on initialization before performing any geometry-related actions
or queries.

* LayoutTests/accessibility-isolated-tree/TestExpectations:
* LayoutTests/accessibility/button-hit-test.html:
* LayoutTests/accessibility/dynamic-changes-update-position.html:
* LayoutTests/accessibility/hit-test-on-stitched-text.html:
* LayoutTests/accessibility/mac/imagemap-hittest.html:
* LayoutTests/accessibility/mac/line-range-for-text-marker.html:
* LayoutTests/accessibility/mac/scroll-to-visible-action.html:
* LayoutTests/accessibility/mac/text-marker-for-bounds.html:
* LayoutTests/accessibility/table-cell-hit-test-not-column.html:
* LayoutTests/accessibility/text-input-hit-test.html:
* LayoutTests/resources/accessibility-helper.js:
* Source/WebCore/accessibility/AXCoreObject.h:
(WebCore::AXCoreObject::isFrameGeometryInitialized const):
* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::AXObjectCache):
* Source/WebCore/accessibility/AccessibilityScrollView.cpp:
(WebCore::AccessibilityScrollView::isFrameGeometryInitialized const):
* Source/WebCore/accessibility/AccessibilityScrollView.h:
* Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper _accessibilityIsFrameGeometryInitialized]):
* Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::accessibilityHitTest const):
(WebCore::AXIsolatedObject::approximateHitTest const):
(WebCore::AXIsolatedObject::screenRelativePosition const):
(WebCore::AXIsolatedObject::screenRelativeRect const):
(WebCore::AXIsolatedObject::isFrameGeometryInitialized const):
* Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h:
* Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp:
(WebCore::AXIsolatedTree::createEmptyContent):
(WebCore::AXIsolatedTree::applyPendingChangesLocked):
(WebCore::createIsolatedObjectData):
* Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h:
(WebCore::AXIsolatedTree::isFrameGeometryInitialized const):
* Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(attributeValueForTesting):
* Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
(WTR::AccessibilityUIElement::isFrameGeometryInitialized const):
* Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
* Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.h:
* Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
(WTR::AccessibilityUIElementIOS::isFrameGeometryInitialized const):
* Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.h:
* Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(WTR::attributeValue):
(WTR::AccessibilityUIElementMac::isFrameGeometryInitialized const):

Canonical link: https://commits.webkit.org/309535@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/AX-Fix-LocalFrame-hit-testing-in-layout-tests branch from 9432874 to ca8a934 Compare March 19, 2026 05:44
@webkit-commit-queue
Copy link
Collaborator

Committed 309535@main (ca8a934): https://commits.webkit.org/309535@main

Reviewed commits have been landed. Closing PR #60747 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit ca8a934 into WebKit:main Mar 19, 2026
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Accessibility For bugs related to accessibility.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants