Skip to content
Permalink
Browse files
AX ITM: Update the target node of a ChildrenChanged notification in a…
…ddition of updating its children.

https://bugs.webkit.org/show_bug.cgi?id=241834

Reviewed by Chris Fleizach.

Fixes several tests in isolated tree mode, including:
    accessibility/mac/figure-element.html [ Failure ]
    accessibility/mac/progress-with-label-element.html [ Failure ]
    accessibility/mac/label-element-changing-children-string-value.html [ Timeout ]
    accessibility/mac/label-element-changing-textcontent-string-value.html [ Timeout ]
    accessibility/visible-elements.html [ Timeout ]

In updateChildren, replaced AXIsolatedTree::updateRelatedProperties with updateNodeAndDependetnProperties to replace the whole object instead of individual properties. This will update several properties that depend on the children of any given object such as those properties that compute textUnderElement. The added cost should be marginal given that updating the children is a lot more costly.

* LayoutTests/accessibility/mac/label-element-changing-children-string-value-expected.txt:
* LayoutTests/accessibility/mac/label-element-changing-children-string-value.html:
* Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp:
(WebCore::AXIsolatedTree::updateNodeAndDependentProperties):
(WebCore::AXIsolatedTree::updateChildren):
(WebCore::AXIsolatedTree::updateTableProperties): Deleted.
(WebCore::AXIsolatedTree::updateTreeItemProperties): Deleted.
(WebCore::AXIsolatedTree::updateRelatedProperties): Deleted.
* Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h:

Canonical link: https://commits.webkit.org/251732@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@295727 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
AndresGonzalezApple committed Jun 22, 2022
1 parent 75a0e5e commit 075e14459fd3b1cb08bf01d5f339a9bc5d6c4d4a
Showing 4 changed files with 10 additions and 62 deletions.
@@ -4,7 +4,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE


PASS label.role is 'AXRole: AXStaticText'
PASS initialStringValue is 'AXValue: first choice'
PASS label.stringValue is 'AXValue: first choice'
PASS label.stringValue === 'AXValue: first foo choice'
PASS successfullyParsed is true

@@ -15,21 +15,19 @@
<script>
description("This tests that if a label element's children change, the string value updates");

var label, initialStringValue;
if (window.accessibilityController) {
window.jsTestIsAsync = true;

label = accessibilityController.accessibleElementById("label");
initialStringValue = label.stringValue;
var label = accessibilityController.accessibleElementById("label");
shouldBe("label.role", "'AXRole: AXStaticText'");
shouldBe("label.stringValue", "'AXValue: first choice'");

let first = document.getElementById("first")
let span = document.createElement("span");
let textNode = document.createTextNode("foo");
span.appendChild(textNode);
first.appendChild(textNode);

shouldBe("label.role", "'AXRole: AXStaticText'");
shouldBe("initialStringValue", "'AXValue: first choice'");

setTimeout(async function() {
await expectAsyncExpression("label.stringValue", "'AXValue: first foo choice'");
finishJSTest();
@@ -38,6 +36,3 @@
</script>
</body>
</html>



@@ -448,56 +448,11 @@ void AXIsolatedTree::updateNodeProperty(AXCoreObject& axObject, AXPropertyName p
m_pendingPropertyChanges.append({ axObject.objectID(), propertyMap });
}

void AXIsolatedTree::updateTableProperties(AXCoreObject& axObject)
void AXIsolatedTree::updateNodeAndDependentProperties(AXCoreObject& axObject)
{
ASSERT(isMainThread());
ASSERT(axObject.isTable());

AXPropertyMap propertyMap {
{ AXPropertyName::IsTable, true },
{ AXPropertyName::IsExposable, axObject.isExposable() },
{ AXPropertyName::IsDataTable, axObject.isDataTable() },
{ AXPropertyName::TableLevel, axObject.tableLevel() },
{ AXPropertyName::SupportsSelectedRows, axObject.supportsSelectedRows() },
{ AXPropertyName::Columns, axIDs(axObject.columns()) },
{ AXPropertyName::Rows, axIDs(axObject.rows()) },
{ AXPropertyName::ColumnCount, axObject.columnCount() },
{ AXPropertyName::RowCount, axObject.rowCount() },
{ AXPropertyName::Cells, axIDs(axObject.cells()) },
{ AXPropertyName::ColumnHeaders, axIDs(axObject.columnHeaders()) },
{ AXPropertyName::RowHeaders, axIDs(axObject.rowHeaders()) },
{ AXPropertyName::VisibleRows, axIDs(axObject.visibleRows()) },
{ AXPropertyName::HeaderContainer, axObject.headerContainer() ? axObject.headerContainer()->objectID() : AXID() },
{ AXPropertyName::AXColumnCount, axObject.axColumnCount() },
{ AXPropertyName::AXRowCount, axObject.axRowCount() },
};

Locker locker { m_changeLogLock };
m_pendingPropertyChanges.append({ axObject.objectID(), propertyMap });
}

void AXIsolatedTree::updateTreeItemProperties(AXCoreObject& axObject)
{
ASSERT(isMainThread());
ASSERT(axObject.isTreeItem());

AXPropertyMap propertyMap {
{ AXPropertyName::ARIATreeItemContent, axIDs(axObject.ariaTreeItemContent()) },
{ AXPropertyName::DisclosedRows, axIDs(axObject.disclosedRows()) },
};

Locker locker { m_changeLogLock };
m_pendingPropertyChanges.append({ axObject.objectID(), propertyMap });
}

void AXIsolatedTree::updateRelatedProperties(AXCoreObject& axObject)
{
ASSERT(isMainThread());

if (axObject.isTable())
updateTableProperties(axObject);
else if (axObject.isTreeItem())
updateTreeItemProperties(axObject);
updateNode(axObject);

if (auto* treeAncestor = Accessibility::findAncestor(axObject, true, [] (const auto& object) { return object.isTree(); }))
updateNodeProperty(*treeAncestor, AXPropertyName::ARIATreeRows);
@@ -575,8 +530,8 @@ void AXIsolatedTree::updateChildren(AXCoreObject& axObject)
}
queueRemovalsAndUnresolvedChanges(oldChildrenIDs);

// Also queue updates for properties that derive from children().
updateRelatedProperties(*axAncestor);
// Also queue updates to the target node itself and any properties that depend on children().
updateNodeAndDependentProperties(*axAncestor);
}

RefPtr<AXIsolatedObject> AXIsolatedTree::focusedNode()
@@ -348,9 +348,7 @@ class AXIsolatedTree : public ThreadSafeRefCounted<AXIsolatedTree> {
void updateNode(AXCoreObject&);
void updateChildren(AXCoreObject&);
void updateNodeProperty(AXCoreObject&, AXPropertyName);
void updateRelatedProperties(AXCoreObject&);
void updateTableProperties(AXCoreObject&);
void updateTreeItemProperties(AXCoreObject&);
void updateNodeAndDependentProperties(AXCoreObject&);

double loadingProgress() { return m_loadingProgress; }
void updateLoadingProgress(double);

0 comments on commit 075e144

Please sign in to comment.