[webkit-changes] [WebKit/WebKit] 6a44b3: AX: Default to walking the DOM rather than the ren...
Tyler Wilcock
noreply at github.com
Mon Oct 28 19:25:59 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 6a44b38c10d068df677abf94c3f1d96e75fefb7a
https://github.com/WebKit/WebKit/commit/6a44b38c10d068df677abf94c3f1d96e75fefb7a
Author: Tyler Wilcock <tyler_w at apple.com>
Date: 2024-10-28 (Mon, 28 Oct 2024)
Changed paths:
M LayoutTests/accessibility/mac/attributed-string-with-listitem-multiple-lines.html
M LayoutTests/accessibility/mac/ruby-hierarchy-roles-expected.txt
M LayoutTests/accessibility/mac/ruby-hierarchy-roles.html
M Source/WebCore/accessibility/AXObjectCache.cpp
M Source/WebCore/accessibility/AXObjectCache.h
M Source/WebCore/accessibility/AccessibilityMathMLElement.cpp
M Source/WebCore/accessibility/AccessibilityMathMLElement.h
M Source/WebCore/accessibility/AccessibilityNodeObject.cpp
M Source/WebCore/accessibility/AccessibilityNodeObject.h
M Source/WebCore/accessibility/AccessibilityObject.cpp
M Source/WebCore/accessibility/AccessibilityObject.h
M Source/WebCore/accessibility/AccessibilityRenderObject.cpp
M Source/WebCore/accessibility/AccessibilityRenderObject.h
M Source/WebCore/accessibility/AccessibilityScrollView.h
M Source/WebCore/accessibility/AccessibilityTable.cpp
M Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm
M Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp
M Source/WebCore/style/StyleTreeResolver.cpp
Log Message:
-----------
AX: Default to walking the DOM rather than the render tree when building the accessibility tree
https://bugs.webkit.org/show_bug.cgi?id=281749
rdar://138184652
Reviewed by Chris Fleizach.
Walking the DOM rather than the render tree allows many simplifications to our code. Before this
patch, we had several display:contents special cases scattered throughout the code that are no longer
needed:
1. AccessibilityRenderObject::addNodeOnlyChildren() added display:contents children to the right
place in an object's render-tree children retroactively. This function is now unnecessary —
we get this property for free by walking the DOM to build the AX tree.
2. AccessibilityObject::insertChild had a special case to prevent double-insertion of display:contents children.
3. AccessibilityRenderObject::addCanvasChildren() only existed because canvas descendants are not rendered,
and thus not picked up by a render tree walk. This function is now removed.
4. Numerous other more minor checks throughout the code that only existed because we had to deal with
anonymous renderers are removed.
The flip side of this is that we don't get "interesting" anonymous renderers for free anymore, e.g.
list markers, CSS ::before and CSS ::after, mfenced element `open`, `close`, `separators` anonymous
renderers. This is still a great tradeoff, as there are far more uninteresting anonymous renderers
than there are interesting ones.
I tried to apply this change to USE(ATSPI) ports, but there are GTK tests that expect the presence of certain
anonymous renderers that I'm not sure we can outright remove (e.g. those in accessibility/gtk/replaced-objects-in-anonymous-blocks.html).
I filed a follow-up bug (https://bugs.webkit.org/show_bug.cgi?id=282117) to track this, more details are there.
Another important aspect of this change is the addition of AXObjectCache::onStyleChange. We have accessibility
properties cached based on element styles that never get updated, and the addition of this function gives us the
framework for starting to fix those.
* LayoutTests/accessibility/mac/ruby-hierarchy-roles-expected.txt:
* LayoutTests/accessibility/mac/ruby-hierarchy-roles.html:
Remove an else block from this test that only existed due to a useless
anonymous renderer child.
* Source/WebCore/accessibility/AXCoreObject.h:
* Source/WebCore/accessibility/AXLogger.cpp:
(WebCore::operator<<):
* Source/WebCore/accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::createObjectFromRenderer):
(WebCore::AXObjectCache::getOrCreate):
(WebCore::AXObjectCache::handleChildrenChanged):
(WebCore::AXObjectCache::onStyleChange):
* Source/WebCore/accessibility/AXObjectCache.h:
* Source/WebCore/accessibility/AccessibilityMathMLElement.cpp:
(WebCore::AccessibilityMathMLElement::addChildren):
* Source/WebCore/accessibility/AccessibilityMathMLElement.h:
* Source/WebCore/accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::parentObject const):
(WebCore::AccessibilityNodeObject::addChildren):
(WebCore::shouldUseAccessibilityObjectInnerText):
(WebCore::AccessibilityNodeObject::parentObjectIfExists const): Deleted.
* Source/WebCore/accessibility/AccessibilityNodeObject.h:
* Source/WebCore/accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::insertChild):
* Source/WebCore/accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::parentInCoreTree const):
(WebCore::AccessibilityObject::parentObjectIfExists const): Deleted.
* Source/WebCore/accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::parentObject const):
(WebCore::AccessibilityRenderObject::textUnderElement const):
(WebCore::AccessibilityRenderObject::shouldGetTextFromNode const):
(WebCore::AccessibilityRenderObject::boundingBoxRect const):
(WebCore::AccessibilityRenderObject::determineAccessibilityRole):
(WebCore::AccessibilityRenderObject::markerRenderer const):
(WebCore::AccessibilityRenderObject::addListItemMarker):
(WebCore::AccessibilityRenderObject::addChildren):
(WebCore::AccessibilityRenderObject::parentObjectIfExists const): Deleted.
(WebCore::AccessibilityRenderObject::addCanvasChildren): Deleted.
(WebCore::AccessibilityRenderObject::addNodeOnlyChildren): Deleted.
* Source/WebCore/accessibility/AccessibilityRenderObject.h:
* Source/WebCore/accessibility/AccessibilityScrollView.h:
* Source/WebCore/accessibility/AccessibilityTable.cpp:
(WebCore::AccessibilityTable::addChildren):
* Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper detailParentForSummaryObject:]):
(-[WebAccessibilityObjectWrapper accessibilitySupportsARIAExpanded]):
(-[WebAccessibilityObjectWrapper accessibilityIsExpanded]):
* Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp:
(WebCore::AXIsolatedTree::updateChildren):
* Source/WebCore/style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::resolveComposedTree):
Canonical link: https://commits.webkit.org/285807@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list