Commit 3f3c58c9 authored by Jacques Newman's avatar Jacques Newman Committed by Commit Bot

AX Sets should not reset after being interrupted by non-set items.

Fix:
Modified the decrease in level logic to only be applied when the
node would be part of a set.

Bug: 1021279
Change-Id: I26fa167cb062d36599d38f20a41eededd74f8bc6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1893118
Commit-Queue: Jacques Newman <janewman@microsoft.com>
Reviewed-by: default avatarAlice Boxhall <aboxhall@chromium.org>
Reviewed-by: default avatarKurt Catti-Schmidt <kschmi@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#713575}
parent 7a8d68eb
...@@ -1063,6 +1063,11 @@ IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest, AccessibilityAriaTreeGrid) { ...@@ -1063,6 +1063,11 @@ IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest, AccessibilityAriaTreeGrid) {
RunAriaTest(FILE_PATH_LITERAL("aria-treegrid.html")); RunAriaTest(FILE_PATH_LITERAL("aria-treegrid.html"));
} }
IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest,
AccessibilityAriaTreeDiscontinuous) {
RunAriaTest(FILE_PATH_LITERAL("aria-tree-discontinuous.html"));
}
IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest, AccessibilityAriaUndefined) { IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest, AccessibilityAriaUndefined) {
RunAriaTest(FILE_PATH_LITERAL("aria-undefined.html")); RunAriaTest(FILE_PATH_LITERAL("aria-undefined.html"));
} }
......
android.webkit.WebView focusable focused scrollable
++android.view.View role_description='tree' collection hierarchical item_count=2 row_count=2
++++android.view.View role_description='tree item' clickable collection_item focusable name='card content'
++++android.view.View
++++android.view.View role_description='tree item' clickable collection_item focusable name='card content' item_index=1 row_index=1
\ No newline at end of file
[document web]
++[tree] setsize:2
++++[tree item] name='card content' selectable level:1 posinset:1 setsize:2
++++++[static] name='card content'
++++[section]
++++[tree item] name='card content' selectable level:1 posinset:2 setsize:2
++++++[static] name='card content'
\ No newline at end of file
rootWebArea
++genericContainer ignored
++++tree setSize=2
++++++treeItem name='card content' hierarchicalLevel=1 setSize=2 posInSet=1 selected=false
++++++++staticText name='card content'
++++++++++inlineTextBox name='card content'
++++++genericContainer
++++++treeItem name='card content' hierarchicalLevel=1 setSize=2 posInSet=2 selected=false
++++++++staticText name='card content'
++++++++++inlineTextBox name='card content'
AXWebArea
++AXOutline AXARIASetSize='2'
++++AXRow AXTitle='card content' AXARIASetSize='2' AXARIAPosInSet='1'
++++++AXStaticText AXValue='card content'
++++AXGroup
++++AXRow AXTitle='card content' AXARIASetSize='2' AXARIAPosInSet='2'
++++++AXStaticText AXValue='card content'
\ No newline at end of file
document PositionInSet=0 SizeOfSet=0
++tree PositionInSet=0 SizeOfSet=2 Selection.CanSelectMultiple=false Selection.IsSelectionRequired=false
++++treeitem Name='card content' PositionInSet=1 SizeOfSet=2 ExpandCollapse.ExpandCollapseState='LeafNode' SelectionItem.IsSelected=false
++++group PositionInSet=0 SizeOfSet=0
++++treeitem Name='card content' PositionInSet=2 SizeOfSet=2 ExpandCollapse.ExpandCollapseState='LeafNode' SelectionItem.IsSelected=false
ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
++ROLE_SYSTEM_OUTLINE setsize:2
++++ROLE_SYSTEM_OUTLINEITEM name='card content' FOCUSABLE setsize:2 posinset:1
++++++ROLE_SYSTEM_STATICTEXT name='card content'
++++IA2_ROLE_SECTION
++++ROLE_SYSTEM_OUTLINEITEM name='card content' FOCUSABLE setsize:2 posinset:2
++++++ROLE_SYSTEM_STATICTEXT name='card content'
<!--
@MAC-ALLOW:AXARIA*
@WIN-ALLOW:setsize*
@WIN-ALLOW:posinset*
@UIA-WIN-ALLOW:SizeOfSet*
@UIA-WIN-ALLOW:PositionInSet*
@AURALINUX-ALLOW:setsize*
@AURALINUX-ALLOW:posinset*
@AURALINUX-ALLOW:level*
@BLINK-ALLOW:hierarchicalLevel*
@BLINK-ALLOW:setSize*
@BLINK-ALLOW:posInSet*
-->
<!DOCTYPE html>
<html>
<body>
<div role="tree">
<div role="treeitem" tabindex="0">
card content
</div>
<div aria-hidden="false"></div>
<div role="treeitem" tabindex="0">
card content
</div>
</div>
</body>
</html>
...@@ -1847,34 +1847,32 @@ void AXTree::PopulateOrderedSetItems(const AXNode* ordered_set, ...@@ -1847,34 +1847,32 @@ void AXTree::PopulateOrderedSetItems(const AXNode* ordered_set,
continue; continue;
} }
int child_level =
child->GetIntAttribute(ax::mojom::IntAttribute::kHierarchicalLevel);
if (child_level < original_level) {
// If a decrease in level occurs after the original node has been
// examined, stop adding to this set.
if (original_node_index < i)
break;
// If a decrease in level has been detected before the original node
// has been examined, then everything previously added to items actually
// belongs to a different set. Clear items vector.
items.clear();
continue;
} else if (child_level > original_level) {
continue;
}
// If role of node is kRadioButton, only add other kRadioButtons.
if (node_is_radio_button &&
child->data().role == ax::mojom::Role::kRadioButton)
items.push_back(child);
// Add child to items if role matches with ordered set's role. If role of // Add child to items if role matches with ordered set's role. If role of
// node is kRadioButton, don't add items of other roles, even if item role // node is kRadioButton, don't add items of other roles, even if item role
// matches ordered set role. // matches ordered set role.
if (!node_is_radio_button && child->SetRoleMatchesItemRole(ordered_set)) if ((node_is_radio_button &&
child->data().role == ax::mojom::Role::kRadioButton) ||
(!node_is_radio_button && child->SetRoleMatchesItemRole(ordered_set))) {
int child_level =
child->GetIntAttribute(ax::mojom::IntAttribute::kHierarchicalLevel);
if (child_level < original_level) {
// If a decrease in level occurs after the original node has been
// examined, stop adding to this set.
if (original_node_index < i)
break;
// If a decrease in level has been detected before the original node
// has been examined, then everything previously added to items actually
// belongs to a different set. Clear items vector.
items.clear();
continue;
} else if (child_level > original_level) {
continue;
}
items.push_back(child); items.push_back(child);
}
// Recurse if there is a generic container, ignored, or unknown. // Recurse if there is a generic container, ignored, or unknown.
if (child->IsIgnored() || if (child->IsIgnored() ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment