- Revision
- 289238
- Author
- [email protected]
- Date
- 2022-02-07 13:19:31 -0800 (Mon, 07 Feb 2022)
Log Message
AX: The isolated tree needs to fix-up table cell parent relationships
https://bugs.webkit.org/show_bug.cgi?id=236156
Reviewed by Chris Fleizach.
Source/WebCore:
Tables are not very navigable by AX clients in isolated tree mode.
This is because our current representation of table elements doesn't
perfectly follow the normal parent-child relationship of other elements,
i.e. some non-row elements can return cells from children(), but the cells
must regard their row as the "real" parent.
We've had to work around this in the live tree in AccessibilityObject::insertChild, too:
https://github.com/WebKit/WebKit/blob/main/Source/WebCore/accessibility/AccessibilityObject.cpp#L626#L628
In this patch, when creating an isolated object, we override the "assumed" parent ID
to the correct parent ID for cell-like elements.
Test: accessibility/table-search-traversal.html
* accessibility/isolatedtree/AXIsolatedTree.cpp:
(WebCore::AXIsolatedTree::parentIDForObject):
Added.
(WebCore::AXIsolatedTree::nodeChangeForObject):
Call parentIDForObject to determine the correct parent for the
to-be-created isolated object.
* accessibility/isolatedtree/AXIsolatedTree.h:
Tools:
Add AccessibilityUIElement::role implementation for use in new
accessibility/table-search-traversal.html test.
* DumpRenderTree/ios/AccessibilityUIElementIOS.mm:
(AccessibilityUIElement::role):
Added implementation.
* WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
(WTR::AccessibilityUIElement::role):
Added implementation.
LayoutTests:
Add test verifying the the new, more correct isolated tree behavior.
* platform/glib/TestExpectations:
* platform/win/TestExpectations:
Skip new accessibility/table-search-traversal.html test due to
missing AccessibilityUIElement::uiElementForSearchPredicate implementation.
* platform/ios/TestExpectations:
Enable new accessibility/table-search-traversal.html test.
* accessibility/table-search-traversal.html: Added.
* platform/ios/accessibility/table-search-traversal-expected.txt: Added.
* platform/mac/accessibility/table-search-traversal-expected.txt: Added.
* platform/ios/imported/blink/accessibility/link-inside-label-expected.txt:
This patch implements AccessibilityUIElement::role on iOS, which
changes this test's output (in a positive way).
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (289237 => 289238)
--- trunk/LayoutTests/ChangeLog 2022-02-07 20:18:46 UTC (rev 289237)
+++ trunk/LayoutTests/ChangeLog 2022-02-07 21:19:31 UTC (rev 289238)
@@ -1,3 +1,27 @@
+2022-02-07 Tyler Wilcock <[email protected]>
+
+ AX: The isolated tree needs to fix-up table cell parent relationships
+ https://bugs.webkit.org/show_bug.cgi?id=236156
+
+ Reviewed by Chris Fleizach.
+
+ Add test verifying the the new, more correct isolated tree behavior.
+
+ * platform/glib/TestExpectations:
+ * platform/win/TestExpectations:
+ Skip new accessibility/table-search-traversal.html test due to
+ missing AccessibilityUIElement::uiElementForSearchPredicate implementation.
+ * platform/ios/TestExpectations:
+ Enable new accessibility/table-search-traversal.html test.
+
+ * accessibility/table-search-traversal.html: Added.
+ * platform/ios/accessibility/table-search-traversal-expected.txt: Added.
+ * platform/mac/accessibility/table-search-traversal-expected.txt: Added.
+
+ * platform/ios/imported/blink/accessibility/link-inside-label-expected.txt:
+ This patch implements AccessibilityUIElement::role on iOS, which
+ changes this test's output (in a positive way).
+
2022-02-07 Antoine Quint <[email protected]>
[css-logical] css/css-logical/animation-003.tentative is no longer a failure
Added: trunk/LayoutTests/accessibility/table-search-traversal.html (0 => 289238)
--- trunk/LayoutTests/accessibility/table-search-traversal.html (rev 0)
+++ trunk/LayoutTests/accessibility/table-search-traversal.html 2022-02-07 21:19:31 UTC (rev 289238)
@@ -0,0 +1,57 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+
+<div id="container" role="group">
+ <table>
+ <tr>
+ <td></td>
+ <th scope="col">Duck</th>
+ <th scope="col">Cat</th>
+ </tr>
+ <tr>
+ <th scope="row">Sound</th>
+ <td>Quack</td>
+ <td>Meow</td>
+ </tr>
+ <tr>
+ <th scope="row">Biological family</th>
+ <td>Anatidae</td>
+ <td>Felidae</td>
+ </tr>
+ </table>
+</div>
+
+<script>
+ var testOutput = "This test ensures we can traverse through entire tables via search.\n";
+
+ if (window.accessibilityController) {
+ const containerElement = accessibilityController.accessibleElementById("container");
+
+ let elementCount = 0;
+ let searchResult = null;
+ while (true) {
+ searchResult = containerElement.uiElementForSearchPredicate(searchResult, true, "AXAnyTypeSearchKey", "", false);
+ if (!searchResult)
+ break;
+ const role = searchResult.role;
+ testOutput += `\n${role}`;
+ if (role.includes("StaticText")) {
+ let textContent = accessibilityController.platformName === "ios" ? searchResult.description : searchResult.stringValue;
+ testOutput += `\n${textContent}`;
+ }
+
+ testOutput += "\n";
+ elementCount += 1;
+ }
+ testOutput += `\nTraversed ${elementCount} elements.`;
+ debug(testOutput);
+ }
+</script>
+</body>
+</html>
+
Modified: trunk/LayoutTests/platform/glib/TestExpectations (289237 => 289238)
--- trunk/LayoutTests/platform/glib/TestExpectations 2022-02-07 20:18:46 UTC (rev 289237)
+++ trunk/LayoutTests/platform/glib/TestExpectations 2022-02-07 21:19:31 UTC (rev 289238)
@@ -304,6 +304,9 @@
# Need to implement AccessibilityUIElement::domIdentifier() for this test to pass after webkit.org/b/234198.
accessibility/focusable-div.html [ Skip ]
+# Missing AccessibilityUIElement::uiElementForSearchPredicate implementation.
+accessibility/table-search-traversal.html [ Skip ]
+
webkit.org/b/212805 accessibility/svg-text.html [ Failure ]
# Added in r263823. Both tests are timing out.
Modified: trunk/LayoutTests/platform/ios/TestExpectations (289237 => 289238)
--- trunk/LayoutTests/platform/ios/TestExpectations 2022-02-07 20:18:46 UTC (rev 289237)
+++ trunk/LayoutTests/platform/ios/TestExpectations 2022-02-07 21:19:31 UTC (rev 289238)
@@ -2104,6 +2104,8 @@
# Enable "aria-table-attributes" test for iOS
webkit.org/b/150366 accessibility/aria-table-attributes.html [ Pass ]
+accessibility/table-search-traversal.html [ Pass ]
+
accessibility/selected-state-changed-notifications.html [ Pass ]
accessibility/element-line-rects-and-text.html [ Pass ]
Added: trunk/LayoutTests/platform/ios/accessibility/table-search-traversal-expected.txt (0 => 289238)
--- trunk/LayoutTests/platform/ios/accessibility/table-search-traversal-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/ios/accessibility/table-search-traversal-expected.txt 2022-02-07 21:19:31 UTC (rev 289238)
@@ -0,0 +1,33 @@
+This test ensures we can traverse through entire tables via search.
+
+StaticText
+AXLabel: Duck
+
+StaticText
+AXLabel: Cat
+
+StaticText
+AXLabel: Sound
+
+StaticText
+AXLabel: Quack
+
+StaticText
+AXLabel: Meow
+
+StaticText
+AXLabel: Biological family
+
+StaticText
+AXLabel: Anatidae
+
+StaticText
+AXLabel: Felidae
+
+Traversed 8 elements.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Duck Cat
+Sound Quack Meow
+Biological family Anatidae Felidae
Modified: trunk/LayoutTests/platform/ios/imported/blink/accessibility/link-inside-label-expected.txt (289237 => 289238)
--- trunk/LayoutTests/platform/ios/imported/blink/accessibility/link-inside-label-expected.txt 2022-02-07 20:18:46 UTC (rev 289237)
+++ trunk/LayoutTests/platform/ios/imported/blink/accessibility/link-inside-label-expected.txt 2022-02-07 21:19:31 UTC (rev 289238)
@@ -2,4 +2,4 @@
This tests that a link element present inside a label element is accessible when label has more than one child.
-Role was:
+Role was:WebCoreLink
Added: trunk/LayoutTests/platform/mac/accessibility/table-search-traversal-expected.txt (0 => 289238)
--- trunk/LayoutTests/platform/mac/accessibility/table-search-traversal-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/table-search-traversal-expected.txt 2022-02-07 21:19:31 UTC (rev 289238)
@@ -0,0 +1,59 @@
+This test ensures we can traverse through entire tables via search.
+
+AXRole: AXTable
+
+AXRole: AXRow
+
+AXRole: AXCell
+
+AXRole: AXCell
+
+AXRole: AXStaticText
+AXValue: Duck
+
+AXRole: AXCell
+
+AXRole: AXStaticText
+AXValue: Cat
+
+AXRole: AXRow
+
+AXRole: AXCell
+
+AXRole: AXStaticText
+AXValue: Sound
+
+AXRole: AXCell
+
+AXRole: AXStaticText
+AXValue: Quack
+
+AXRole: AXCell
+
+AXRole: AXStaticText
+AXValue: Meow
+
+AXRole: AXRow
+
+AXRole: AXCell
+
+AXRole: AXStaticText
+AXValue: Biological family
+
+AXRole: AXCell
+
+AXRole: AXStaticText
+AXValue: Anatidae
+
+AXRole: AXCell
+
+AXRole: AXStaticText
+AXValue: Felidae
+
+Traversed 21 elements.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Duck Cat
+Sound Quack Meow
+Biological family Anatidae Felidae
Modified: trunk/LayoutTests/platform/win/TestExpectations (289237 => 289238)
--- trunk/LayoutTests/platform/win/TestExpectations 2022-02-07 20:18:46 UTC (rev 289237)
+++ trunk/LayoutTests/platform/win/TestExpectations 2022-02-07 21:19:31 UTC (rev 289238)
@@ -469,6 +469,9 @@
# AccessibilityUIElement::isInCell().
accessibility/ancestor-computation.html [ Skip ]
+# Missing AccessibilityUIElement::uiElementForSearchPredicate implementation.
+accessibility/table-search-traversal.html [ Skip ]
+
# TODO Conic gradients
http/wpt/css/css-images-4/conic-gradient-parsing.html [ Skip ]
fast/gradients/conic-repeating.html [ Skip ]
Modified: trunk/Source/WebCore/ChangeLog (289237 => 289238)
--- trunk/Source/WebCore/ChangeLog 2022-02-07 20:18:46 UTC (rev 289237)
+++ trunk/Source/WebCore/ChangeLog 2022-02-07 21:19:31 UTC (rev 289238)
@@ -1,3 +1,33 @@
+2022-02-07 Tyler Wilcock <[email protected]>
+
+ AX: The isolated tree needs to fix-up table cell parent relationships
+ https://bugs.webkit.org/show_bug.cgi?id=236156
+
+ Reviewed by Chris Fleizach.
+
+ Tables are not very navigable by AX clients in isolated tree mode.
+ This is because our current representation of table elements doesn't
+ perfectly follow the normal parent-child relationship of other elements,
+ i.e. some non-row elements can return cells from children(), but the cells
+ must regard their row as the "real" parent.
+
+ We've had to work around this in the live tree in AccessibilityObject::insertChild, too:
+
+ https://github.com/WebKit/WebKit/blob/main/Source/WebCore/accessibility/AccessibilityObject.cpp#L626#L628
+
+ In this patch, when creating an isolated object, we override the "assumed" parent ID
+ to the correct parent ID for cell-like elements.
+
+ Test: accessibility/table-search-traversal.html
+
+ * accessibility/isolatedtree/AXIsolatedTree.cpp:
+ (WebCore::AXIsolatedTree::parentIDForObject):
+ Added.
+ (WebCore::AXIsolatedTree::nodeChangeForObject):
+ Call parentIDForObject to determine the correct parent for the
+ to-be-created isolated object.
+ * accessibility/isolatedtree/AXIsolatedTree.h:
+
2022-02-07 Wenson Hsieh <[email protected]>
Add PageClient plumbing for video frame extraction
Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp (289237 => 289238)
--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp 2022-02-07 20:18:46 UTC (rev 289237)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp 2022-02-07 21:19:31 UTC (rev 289238)
@@ -190,11 +190,31 @@
queueChangesAndRemovals(changes);
}
+AXID AXIsolatedTree::parentIDForObject(AXCoreObject& axObject, AXID assumedParentID)
+{
+ ASSERT(isMainThread());
+
+ auto role = axObject.roleValue();
+ if (role == AccessibilityRole::Cell || role == AccessibilityRole::RowHeader || role == AccessibilityRole::ColumnHeader) {
+ // Unfortunately, table relationships don't always follow the usual model we build the isolated tree with (a simple
+ // live-tree walk, calling children() and setting those children to have a parent of the caller of children()).
+ // Overwrite the parentID to be that of the actual parent.
+ if (auto* actualParent = axObject.parentObjectUnignored()) {
+ // Expect that the parent row has been created by now.
+ // If we hit this m_nodeMap.contains ASSERT, we may need to create an isolated object for `actualParent` here or elsewhere.
+ ASSERT(m_nodeMap.contains(actualParent->objectID()));
+ ASSERT(actualParent->roleValue() == AccessibilityRole::Row);
+ return actualParent->objectID();
+ }
+ }
+ return assumedParentID;
+}
+
AXIsolatedTree::NodeChange AXIsolatedTree::nodeChangeForObject(AXCoreObject& axObject, AXID parentID, bool attachWrapper, bool updateNodeMap)
{
ASSERT(isMainThread());
- auto object = AXIsolatedObject::create(axObject, this, parentID);
+ auto object = AXIsolatedObject::create(axObject, this, parentIDForObject(axObject, parentID));
NodeChange nodeChange { object, nullptr };
if (!object->objectID().isValid()) {
Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h (289237 => 289238)
--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h 2022-02-07 20:18:46 UTC (rev 289237)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h 2022-02-07 21:19:31 UTC (rev 289238)
@@ -384,7 +384,9 @@
static HashMap<AXIsolatedTreeID, Ref<AXIsolatedTree>>& treeIDCache() WTF_REQUIRES_LOCK(s_cacheLock);
static HashMap<PageIdentifier, Ref<AXIsolatedTree>>& treePageCache() WTF_REQUIRES_LOCK(s_cacheLock);
- // Called on main thread.
+ // Methods in this block are called on the main thread.
+ // Computes the parent ID of the given object, which is generally the "assumed" parent ID (but not always, like in the case of tables).
+ AXID parentIDForObject(AXCoreObject&, AXID assumedParentID);
NodeChange nodeChangeForObject(AXCoreObject&, AXID parentID, bool attachWrapper = true, bool updateNodeMap = true);
void collectNodeChangesForSubtree(AXCoreObject&, AXID parentID, bool attachWrapper, Vector<NodeChange>&, HashSet<AXID>* = nullptr);
void queueChange(const NodeChange&) WTF_REQUIRES_LOCK(m_changeLogLock);
Modified: trunk/Tools/ChangeLog (289237 => 289238)
--- trunk/Tools/ChangeLog 2022-02-07 20:18:46 UTC (rev 289237)
+++ trunk/Tools/ChangeLog 2022-02-07 21:19:31 UTC (rev 289238)
@@ -1,3 +1,20 @@
+2022-02-07 Tyler Wilcock <[email protected]>
+
+ AX: The isolated tree needs to fix-up table cell parent relationships
+ https://bugs.webkit.org/show_bug.cgi?id=236156
+
+ Reviewed by Chris Fleizach.
+
+ Add AccessibilityUIElement::role implementation for use in new
+ accessibility/table-search-traversal.html test.
+
+ * DumpRenderTree/ios/AccessibilityUIElementIOS.mm:
+ (AccessibilityUIElement::role):
+ Added implementation.
+ * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
+ (WTR::AccessibilityUIElement::role):
+ Added implementation.
+
2022-02-07 Roy Reapor <[email protected]>
[webkitcorepy] Autoinstaller may fail to install wheels
Modified: trunk/Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm (289237 => 289238)
--- trunk/Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm 2022-02-07 20:18:46 UTC (rev 289237)
+++ trunk/Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm 2022-02-07 21:19:31 UTC (rev 289238)
@@ -95,6 +95,7 @@
- (NSString *)_accessibilityPhotoDescription;
- (BOOL)accessibilityPerformEscape;
- (NSString *)accessibilityDOMIdentifier;
+- (NSString *)_accessibilityWebRoleAsString;
// TextMarker related
- (NSArray *)textMarkerRange;
@@ -761,7 +762,7 @@
JSRetainPtr<JSStringRef> AccessibilityUIElement::role()
{
- return WTR::createJSString();
+ return [[m_element _accessibilityWebRoleAsString] createJSStringRef];
}
JSRetainPtr<JSStringRef> AccessibilityUIElement::subrole()
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm (289237 => 289238)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm 2022-02-07 20:18:46 UTC (rev 289237)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm 2022-02-07 21:19:31 UTC (rev 289238)
@@ -110,6 +110,7 @@
- (id)_accessibilityPhotoDescription;
- (NSArray *)accessibilityImageOverlayElements;
- (NSRange)accessibilityVisibleCharacterRange;
+- (NSString *)_accessibilityWebRoleAsString;
// TextMarker related
- (NSArray *)textMarkerRange;
@@ -500,7 +501,7 @@
JSRetainPtr<JSStringRef> AccessibilityUIElement::role()
{
- return createJSString();
+ return [[m_element _accessibilityWebRoleAsString] createJSStringRef];
}
JSRetainPtr<JSStringRef> AccessibilityUIElement::subrole()