- Revision
- 292564
- Author
- [email protected]
- Date
- 2022-04-07 14:03:10 -0700 (Thu, 07 Apr 2022)
Log Message
AX ITM: ARIATreeItemContent, ARIATreeRows, and DisclosedRows properties need to be updated after dynamic page changes
https://bugs.webkit.org/show_bug.cgi?id=238844
Reviewed by Chris Fleizach.
Source/WebCore:
Before this patch, we never updated these properties after
initializing isolated objects, so they become inaccurate
when content / rows were added or removed.
Test: accessibility/mac/tree-properties-update-after-dynamic-change.html
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::ariaTreeItemContent):
Make this function return a value instead of by out-parameter.
* accessibility/AccessibilityObject.h:
* accessibility/AccessibilityObjectInterface.h:
* accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::initializeAttributeData):
* accessibility/isolatedtree/AXIsolatedObject.h:
* accessibility/isolatedtree/AXIsolatedTree.cpp:
(WebCore::AXIsolatedTree::updateNodeProperty):
Handle updates to AXPropertyName::ARIATreeItemContent, AXPropertyName::ARIATreeRows, and
AXPropertyName::DisclosedRows. Also, updateNodeProperty now
takes an `AXCoreObject&` instead of `const AXCoreObject&`
since calling ariaTreeItemContent(), ariaTreeRows(), and disclosedRows() is inherently not const.
(WebCore::AXIsolatedTree::updateChildren):
If the object being updated is a treeitem, also update AXPropertyName::ARIATreeItemContent
and AXPropertyName::DisclosedRows. And if the object has a tree role ancestor, update
AXPropertyName::ARIATreeRows for that ancestor.
* accessibility/isolatedtree/AXIsolatedTree.h:
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
LayoutTests:
* accessibility/mac/tree-properties-update-after-dynamic-change-expected.txt: Added.
* accessibility/mac/tree-properties-update-after-dynamic-change.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (292563 => 292564)
--- trunk/LayoutTests/ChangeLog 2022-04-07 20:58:35 UTC (rev 292563)
+++ trunk/LayoutTests/ChangeLog 2022-04-07 21:03:10 UTC (rev 292564)
@@ -1,3 +1,13 @@
+2022-04-07 Tyler Wilcock <[email protected]>
+
+ AX ITM: ARIATreeItemContent, ARIATreeRows, and DisclosedRows properties need to be updated after dynamic page changes
+ https://bugs.webkit.org/show_bug.cgi?id=238844
+
+ Reviewed by Chris Fleizach.
+
+ * accessibility/mac/tree-properties-update-after-dynamic-change-expected.txt: Added.
+ * accessibility/mac/tree-properties-update-after-dynamic-change.html: Added.
+
2022-04-07 Alan Bujtas <[email protected]>
Unreviewed test gardening.
Added: trunk/LayoutTests/accessibility/mac/tree-properties-update-after-dynamic-change-expected.txt (0 => 292564)
--- trunk/LayoutTests/accessibility/mac/tree-properties-update-after-dynamic-change-expected.txt (rev 0)
+++ trunk/LayoutTests/accessibility/mac/tree-properties-update-after-dynamic-change-expected.txt 2022-04-07 21:03:10 UTC (rev 292564)
@@ -0,0 +1,28 @@
+This test ensures that tree and treeitem objects report the most up-to-date children and rows after dynamic page changes.
+
+#treeitem1 childrenCount: 0
+#treeitem2 childrenCount: 0
+#tree rowCount: 3
+ row 0: AXRole: AXRow, #treeitem1
+ row 1: AXRole: AXRow, #treeitem2
+ row 2: AXRole: AXRow, #treeitem3
+
+Adding content to #treeitem1 and #treeitem2.
+
+#treeitem1 childrenCount: 1
+ child: AXRole: AXButton
+#treeitem2 childrenCount: 0
+#treeitem2 had disclosed row #treeitem3
+#treeitem2 had disclosed row #treeitem4
+#tree rowCount: 4
+ row 0: AXRole: AXRow, #treeitem1
+ row 1: AXRole: AXRow, #treeitem2
+ row 2: AXRole: AXRow, #treeitem3
+ row 3: AXRole: AXRow, #treeitem4
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Button inside treeitem1
+Button inside treeitem3
+Button inside treeitem4
Added: trunk/LayoutTests/accessibility/mac/tree-properties-update-after-dynamic-change.html (0 => 292564)
--- trunk/LayoutTests/accessibility/mac/tree-properties-update-after-dynamic-change.html (rev 0)
+++ trunk/LayoutTests/accessibility/mac/tree-properties-update-after-dynamic-change.html 2022-04-07 21:03:10 UTC (rev 292564)
@@ -0,0 +1,88 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+
+<ul id="tree" role="tree" tabindex="0">
+ <li id="treeitem1" role="treeitem"></li>
+ <li id="treeitem2" role="treeitem"></li>
+ <li id="treeitem3" role="treeitem">
+ <button>Button inside treeitem3</button>
+ </li>
+</ul>
+
+<div id="group" role="group">
+ <li id="treeitem4" role="treeitem">
+ <button>Button inside treeitem4</button>
+ </li>
+</div>
+
+<script>
+ var testOutput = "This test ensures that tree and treeitem objects report the most up-to-date children and rows after dynamic page changes.\n\n";
+
+ function verifyChildren(id) {
+ const axElement = accessibilityController.accessibleElementById(id);
+ if (!axElement)
+ return;
+
+ const childrenCount = axElement.childrenCount;
+ testOutput += `#${id} childrenCount: ${childrenCount}\n`;
+ for (let i = 0; i < childrenCount; i++)
+ testOutput += ` child: ${axElement.childAtIndex(i).role}\n`;
+ }
+
+ function verifyTreeRows() {
+ const axElement = accessibilityController.accessibleElementById("tree");
+ if (!axElement)
+ return;
+
+ const rowCount = axElement.rowCount;
+ testOutput += `#tree rowCount: ${rowCount}\n`;
+ for (let i = 0; i < rowCount; i++) {
+ const row = axElement.rowAtIndex(i);
+ testOutput += ` row ${i}: ${row.role}, #${row.domIdentifier}\n`;
+ }
+ }
+
+ if (window.accessibilityController) {
+ window.jsTestIsAsync = true;
+ verifyChildren("treeitem1");
+ verifyChildren("treeitem2");
+ verifyTreeRows();
+
+ let button = document.createElement("button");
+ button.innerHTML = "Button inside treeitem1";
+ document.getElementById("treeitem1").appendChild(button);
+
+ testOutput += "\nAdding content to #treeitem1 and #treeitem2.\n\n";
+ document.getElementById("treeitem2").appendChild(document.getElementById("treeitem3"));
+ document.getElementById("treeitem2").appendChild(document.getElementById("group"));
+ setTimeout(async function() {
+ let firstDisclosedRow, secondDisclosedRow;
+ await waitFor(() => {
+ const treeitem1 = accessibilityController.accessibleElementById("treeitem1");
+ if (!treeitem1 || treeitem1.childrenCount !== 1)
+ return false;
+ const treeitem2 = accessibilityController.accessibleElementById("treeitem2");
+ firstDisclosedRow = treeitem2.disclosedRowAtIndex(0);
+ secondDisclosedRow = treeitem2.disclosedRowAtIndex(1);
+ return firstDisclosedRow && secondDisclosedRow;
+ });
+ verifyChildren("treeitem1");
+ // We added a group and treeitem to #treeitem2, neither of which should show up as a child (but should be considered when computing disclosed rows).
+ verifyChildren("treeitem2");
+ testOutput += `#treeitem2 had disclosed row #${firstDisclosedRow.domIdentifier}\n`;
+ testOutput += `#treeitem2 had disclosed row #${secondDisclosedRow.domIdentifier}\n`;
+ verifyTreeRows();
+
+ debug(testOutput);
+ finishJSTest();
+ }, 0);
+ }
+</script>
+</body>
+</html>
+
Modified: trunk/Source/WebCore/ChangeLog (292563 => 292564)
--- trunk/Source/WebCore/ChangeLog 2022-04-07 20:58:35 UTC (rev 292563)
+++ trunk/Source/WebCore/ChangeLog 2022-04-07 21:03:10 UTC (rev 292564)
@@ -1,3 +1,38 @@
+2022-04-07 Tyler Wilcock <[email protected]>
+
+ AX ITM: ARIATreeItemContent, ARIATreeRows, and DisclosedRows properties need to be updated after dynamic page changes
+ https://bugs.webkit.org/show_bug.cgi?id=238844
+
+ Reviewed by Chris Fleizach.
+
+ Before this patch, we never updated these properties after
+ initializing isolated objects, so they become inaccurate
+ when content / rows were added or removed.
+
+ Test: accessibility/mac/tree-properties-update-after-dynamic-change.html
+
+ * accessibility/AccessibilityObject.cpp:
+ (WebCore::AccessibilityObject::ariaTreeItemContent):
+ Make this function return a value instead of by out-parameter.
+ * accessibility/AccessibilityObject.h:
+ * accessibility/AccessibilityObjectInterface.h:
+ * accessibility/isolatedtree/AXIsolatedObject.cpp:
+ (WebCore::AXIsolatedObject::initializeAttributeData):
+ * accessibility/isolatedtree/AXIsolatedObject.h:
+ * accessibility/isolatedtree/AXIsolatedTree.cpp:
+ (WebCore::AXIsolatedTree::updateNodeProperty):
+ Handle updates to AXPropertyName::ARIATreeItemContent, AXPropertyName::ARIATreeRows, and
+ AXPropertyName::DisclosedRows. Also, updateNodeProperty now
+ takes an `AXCoreObject&` instead of `const AXCoreObject&`
+ since calling ariaTreeItemContent(), ariaTreeRows(), and disclosedRows() is inherently not const.
+ (WebCore::AXIsolatedTree::updateChildren):
+ If the object being updated is a treeitem, also update AXPropertyName::ARIATreeItemContent
+ and AXPropertyName::DisclosedRows. And if the object has a tree role ancestor, update
+ AXPropertyName::ARIATreeRows for that ancestor.
+ * accessibility/isolatedtree/AXIsolatedTree.h:
+ * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+ (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
+
2022-04-07 Youenn Fablet <[email protected]>
(Safari 15 - iOS15): Increased audio latency on streaming via webrtc
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (292563 => 292564)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2022-04-07 20:58:35 UTC (rev 292563)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2022-04-07 21:03:10 UTC (rev 292564)
@@ -2039,13 +2039,15 @@
ariaTreeRows(rows, ancestors);
}
-void AccessibilityObject::ariaTreeItemContent(AccessibilityChildrenVector& result)
+AXCoreObject::AccessibilityChildrenVector AccessibilityObject::ariaTreeItemContent()
{
- // The ARIA tree item content are the item that are not other tree items or their containing groups.
+ AccessibilityChildrenVector result;
+ // The content of a treeitem excludes other treeitems or their containing groups.
for (const auto& child : children()) {
if (!child->isGroup() && child->roleValue() != AccessibilityRole::TreeItem)
result.append(child);
}
+ return result;
}
AXCoreObject::AccessibilityChildrenVector AccessibilityObject::disclosedRows()
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (292563 => 292564)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.h 2022-04-07 20:58:35 UTC (rev 292563)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h 2022-04-07 21:03:10 UTC (rev 292564)
@@ -627,7 +627,7 @@
// Used by an ARIA tree to get all its rows.
void ariaTreeRows(AccessibilityChildrenVector&) override;
// Used by an ARIA tree item to get only its content, and not its child tree items and groups.
- void ariaTreeItemContent(AccessibilityChildrenVector&) override;
+ AccessibilityChildrenVector ariaTreeItemContent() override;
// ARIA live-region features.
bool supportsLiveRegion(bool excludeIfOff = true) const override;
Modified: trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h (292563 => 292564)
--- trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h 2022-04-07 20:58:35 UTC (rev 292563)
+++ trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h 2022-04-07 21:03:10 UTC (rev 292564)
@@ -1354,7 +1354,7 @@
// Used by an ARIA tree to get all its rows.
virtual void ariaTreeRows(AccessibilityChildrenVector&) = 0;
// Used by an ARIA tree item to get only its content, and not its child tree items and groups.
- virtual void ariaTreeItemContent(AccessibilityChildrenVector&) = 0;
+ virtual AccessibilityChildrenVector ariaTreeItemContent() = 0;
// ARIA live-region features.
virtual bool supportsLiveRegion(bool excludeIfOff = true) const = 0;
Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp (292563 => 292564)
--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp 2022-04-07 20:58:35 UTC (rev 292563)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp 2022-04-07 21:03:10 UTC (rev 292564)
@@ -285,11 +285,7 @@
if (object.isTreeItem()) {
setProperty(AXPropertyName::IsTreeItem, true);
-
- AccessibilityChildrenVector ariaTreeItemContent;
- object.ariaTreeItemContent(ariaTreeItemContent);
- setObjectVectorProperty(AXPropertyName::ARIATreeItemContent, ariaTreeItemContent);
-
+ setObjectVectorProperty(AXPropertyName::ARIATreeItemContent, object.ariaTreeItemContent());
setObjectVectorProperty(AXPropertyName::DisclosedRows, object.disclosedRows());
}
Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h (292563 => 292564)
--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h 2022-04-07 20:58:35 UTC (rev 292563)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h 2022-04-07 21:03:10 UTC (rev 292564)
@@ -291,7 +291,7 @@
bool isValueAutofillAvailable() const override { return boolAttributeValue(AXPropertyName::IsValueAutofillAvailable); }
AutoFillButtonType valueAutofillButtonType() const override { return static_cast<AutoFillButtonType>(intAttributeValue(AXPropertyName::ValueAutofillButtonType)); }
void ariaTreeRows(AccessibilityChildrenVector& children) override { fillChildrenVectorForProperty(AXPropertyName::ARIATreeRows, children); }
- void ariaTreeItemContent(AccessibilityChildrenVector& children) override { fillChildrenVectorForProperty(AXPropertyName::ARIATreeItemContent, children); }
+ AccessibilityChildrenVector ariaTreeItemContent() override { return tree()->objectsForIDs(vectorAttributeValue<AXID>(AXPropertyName::ARIATreeItemContent)); }
URL url() const override { return urlAttributeValue(AXPropertyName::URL); }
String accessKey() const override { return stringAttributeValue(AXPropertyName::AccessKey); }
String localizedActionVerb() const override { return stringAttributeValue(AXPropertyName::LocalizedActionVerb); }
Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp (292563 => 292564)
--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp 2022-04-07 20:58:35 UTC (rev 292563)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp 2022-04-07 21:03:10 UTC (rev 292564)
@@ -311,7 +311,7 @@
queueChange(change);
}
-void AXIsolatedTree::updateNodeProperty(const AXCoreObject& axObject, AXPropertyName property)
+void AXIsolatedTree::updateNodeProperty(AXCoreObject& axObject, AXPropertyName property)
{
AXTRACE("AXIsolatedTree::updateNodeProperty"_s);
ASSERT(isMainThread());
@@ -318,6 +318,15 @@
AXPropertyMap propertyMap;
switch (property) {
+ case AXPropertyName::ARIATreeItemContent:
+ propertyMap.set(AXPropertyName::ARIATreeItemContent, idsForObjects(axObject.ariaTreeItemContent()));
+ break;
+ case AXPropertyName::ARIATreeRows: {
+ AXCoreObject::AccessibilityChildrenVector ariaTreeRows;
+ axObject.ariaTreeRows(ariaTreeRows);
+ propertyMap.set(AXPropertyName::ARIATreeRows, idsForObjects(ariaTreeRows));
+ break;
+ }
case AXPropertyName::CanSetFocusAttribute:
propertyMap.set(AXPropertyName::CanSetFocusAttribute, axObject.canSetFocusAttribute());
break;
@@ -324,6 +333,9 @@
case AXPropertyName::CurrentValue:
propertyMap.set(AXPropertyName::CurrentValue, axObject.currentValue().isolatedCopy());
break;
+ case AXPropertyName::DisclosedRows:
+ propertyMap.set(AXPropertyName::DisclosedRows, idsForObjects(axObject.disclosedRows()));
+ break;
case AXPropertyName::IsChecked:
ASSERT(axObject.supportsCheckedState());
propertyMap.set(AXPropertyName::IsChecked, axObject.isChecked());
@@ -421,6 +433,15 @@
removeSubtreeFromNodeMap(axID, axAncestor, idsBeingChanged);
}
queueChangesAndRemovals(changes, oldChildrenIDs);
+
+ // Also queue updates for properties that derive from children().
+ if (axAncestor->isTreeItem()) {
+ updateNodeProperty(*axAncestor, AXPropertyName::ARIATreeItemContent);
+ updateNodeProperty(*axAncestor, AXPropertyName::DisclosedRows);
+ }
+
+ if (auto* treeAncestor = Accessibility::findAncestor(*axAncestor, true, [] (const auto& axObject) { return axObject.isTree(); }))
+ updateNodeProperty(*treeAncestor, AXPropertyName::ARIATreeRows);
}
RefPtr<AXIsolatedObject> AXIsolatedTree::focusedNode()
Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h (292563 => 292564)
--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h 2022-04-07 20:58:35 UTC (rev 292563)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h 2022-04-07 21:03:10 UTC (rev 292564)
@@ -352,7 +352,7 @@
void generateSubtree(AXCoreObject&, AXCoreObject*, bool attachWrapper);
void updateNode(AXCoreObject&);
- void updateNodeProperty(const AXCoreObject&, AXPropertyName);
+ void updateNodeProperty(AXCoreObject&, AXPropertyName);
void updateChildren(AXCoreObject&);
double loadingProgress() { return m_loadingProgress; }
Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (292563 => 292564)
--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm 2022-04-07 20:58:35 UTC (rev 292563)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm 2022-04-07 21:03:10 UTC (rev 292564)
@@ -1982,11 +1982,8 @@
return [self accessibilityAttributeValue:NSAccessibilityRowsAttribute];
// A tree item should only expose its content as its children (not its rows)
- if (backingObject->isTreeItem()) {
- AccessibilityObject::AccessibilityChildrenVector contentCopy;
- backingObject->ariaTreeItemContent(contentCopy);
- return makeNSArray(contentCopy);
- }
+ if (backingObject->isTreeItem())
+ return makeNSArray(backingObject->ariaTreeItemContent());
return self.childrenVectorArray;
}