Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: ee35cc63fdab16c3d96fe632dae98b90552315e5
https://github.com/WebKit/WebKit/commit/ee35cc63fdab16c3d96fe632dae98b90552315e5
Author: Dominic Mazzoni <[email protected]>
Date: 2025-11-03 (Mon, 03 Nov 2025)
Changed paths:
M
LayoutTests/accessibility/mac/active-descendant-after-visibility-change.html
M Source/WebCore/accessibility/AXObjectCache.cpp
M Source/WebCore/accessibility/AccessibilityScrollView.cpp
M Source/WebCore/dom/Document.cpp
M Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm
Log Message:
-----------
AX: focused node should be nullptr when a different frame has focus
https://bugs.webkit.org/show_bug.cgi?id=301760
rdar://163797834
Reviewed by Joshua Hoffman.
This is a fix that applies when the ENABLE_ACCESSIBILITY_LOCAL_FRAME
flag is enabled, in preparation for site isolation.
Previously, there was one AXObjectCache for the whole page, and the
current focused element always returned the focused element from any
frame. If there was no focused element, the root was returned.
With this flag enabled (required for site isolation), there's one
AXObjectCache for each frame. When determining the focused node across
all frames in the current process, each frame is now keeping track of
focus separately - that means that frames that are not currently
focused must return nullptr as their own focused node.
This required three main changes:
- Document needs to call AXObjectCache::onFocusChange even if the new
focused element is nullptr
- WebProcess::accessibilityFocusedUIElement() needs to only consider frames
where the focused node is not nullptr
- AXObjectCache::focusedObjectForLocalFrame should only return the root
as a fallback if the current frame has focus but no specific element
is focused. Otherwise it should return nullptr
This fixes the following layout tests (with ENABLE_ACCESSIBILITY_LOCAL_FRAME
enabled):
accessibility/mac/search-with-frames.html [ Failure ]
accessibility/scroll-to-global-point-iframe-nested.html [ Failure ]
accessibility/scroll-to-make-visible-iframe.html [ Failure ]
accessibility/scroll-to-global-point-iframe-nested.html [ Failure ]
* LayoutTests/accessibility/mac/active-descendant-after-visibility-change.html:
* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::focusedObjectForLocalFrame):
(WebCore::AXObjectCache::getOrCreateIsolatedTree):
* Source/WebCore/accessibility/AccessibilityScrollView.cpp:
(WebCore::AccessibilityScrollView::crossFrameParentObject const):
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::setFocusedElement):
* Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::accessibilityFocusedUIElement):
Canonical link: https://commits.webkit.org/302501@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications