Commit c9345892 authored by Akihiro Ota's avatar Akihiro Ota Committed by Commit Bot

Substitute AXNode::GetPosInSet() and AXNode::GetSetSize().

This change only reflects updates to Android-specific
code. Substituting recently implemented
AXNode::GetPosInSet() and AXNode::GetSetSize() functions
when posinset and setsize computations are necessary.

Change-Id: I6cd876921cd1ab8cc6f47f058dcfc88d7c365897
Reviewed-on: https://chromium-review.googlesource.com/c/1361654
Commit-Queue: Akihiro Ota <akihiroota@chromium.org>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#614747}
parent dfe0e8df
......@@ -1064,7 +1064,7 @@ int BrowserAccessibilityAndroid::GetItemIndex() const {
case ax::mojom::Role::kListItem:
case ax::mojom::Role::kListBoxOption:
case ax::mojom::Role::kTreeItem:
index = GetIntAttribute(ax::mojom::IntAttribute::kPosInSet) - 1;
index = node()->GetPosInSet() - 1;
break;
default:
break;
......@@ -1085,7 +1085,7 @@ int BrowserAccessibilityAndroid::GetItemCount() const {
case ax::mojom::Role::kList:
case ax::mojom::Role::kListBox:
case ax::mojom::Role::kDescriptionList:
count = PlatformChildCount();
count = node()->GetSetSize();
break;
default:
break;
......@@ -1385,7 +1385,7 @@ int BrowserAccessibilityAndroid::RowCount() const {
GetRole() == ax::mojom::Role::kListBox ||
GetRole() == ax::mojom::Role::kDescriptionList ||
GetRole() == ax::mojom::Role::kTree) {
return PlatformChildCount();
return node()->GetSetSize();
}
return 0;
......@@ -1402,7 +1402,7 @@ int BrowserAccessibilityAndroid::RowIndex() const {
if (GetRole() == ax::mojom::Role::kListItem ||
GetRole() == ax::mojom::Role::kListBoxOption ||
GetRole() == ax::mojom::Role::kTreeItem) {
return GetIndexInParent();
return node()->GetPosInSet() - 1;
}
return node()->GetTableCellRowIndex();
......
android.webkit.WebView focusable focused scrollable
++android.widget.ListView role_description='list box' clickable collection item_count=5 row_count=5
++android.widget.ListView role_description='list box' clickable collection item_count=4 row_count=4
++++android.view.View clickable collection_item focusable name='Item 1'
++++android.view.View clickable collection_item focusable name='Item 2' item_index=1 row_index=1
++++android.view.View role_description='splitter'
++++android.view.View clickable collection_item focusable name='Second group item 1' row_index=3
++++android.view.View clickable collection_item focusable name='Second group item 2' item_index=1 row_index=4
\ No newline at end of file
++++android.view.View clickable collection_item focusable name='Second group item 1' item_index=2 row_index=2
++++android.view.View clickable collection_item focusable name='Second group item 2' item_index=3 row_index=3
android.webkit.WebView focusable focused scrollable
++android.widget.ListView collection item_count=2 row_count=2
++android.widget.ListView collection item_count=1 row_count=1
++++android.view.View collection_item name='Coffee'
++++android.view.View role_description='definition' name='Black hot drink'
android.webkit.WebView focusable focused scrollable
++android.widget.ListView collection item_count=2 row_count=2
++android.widget.ListView collection item_count=1 row_count=1
++++android.view.View collection_item name='Term'
++++android.view.View role_description='definition' name='Description'
++android.view.View role_description='definition' name='Definition'
android.webkit.WebView focusable focused scrollable
++android.widget.ListView collection item_count=2 row_count=2
++android.widget.ListView collection item_count=1 row_count=1
++++android.view.View collection_item name='Coffee'
++++android.view.View role_description='definition' name='Black hot drink'
......@@ -9,9 +9,9 @@ android.webkit.WebView focusable focused scrollable
++++android.view.View collection_item item_index=2 row_index=2
++++++android.view.View name='• '
++++++android.view.View name='toe'
++android.widget.ListView collection item_count=5 row_count=5
++android.widget.ListView collection item_count=3 row_count=3
++++android.view.View collection_item name='tic'
++++android.view.View name=' '
++++android.view.View collection_item name='tac' item_index=1 row_index=2
++++android.view.View collection_item name='tac' item_index=1 row_index=1
++++android.view.View name=' '
++++android.view.View collection_item name='toe' item_index=2 row_index=4
++++android.view.View collection_item name='toe' item_index=2 row_index=2
android.webkit.WebView focusable focused scrollable
++android.view.View name='This is a multi-leveled list'
++android.widget.ListView collection hierarchical item_count=4 row_count=4
++android.widget.ListView collection hierarchical item_count=3 row_count=3
++++android.view.View collection_item
++++++android.view.View name='1. '
++++++android.view.View name='Sports'
......
......@@ -14,6 +14,6 @@
</ol>
</li>
<li> Recipes </li>
<ol>
</ol>
<ol>
</ol>
</ol>
......@@ -588,6 +588,12 @@ bool AXNode::SetRoleMatchesItemRole(const AXNode* ordered_set) const {
case ax::mojom::Role::kRadioGroup:
return item_role == ax::mojom::Role::kRadioButton;
case ax::mojom::Role::kDescriptionList:
// Only the term for each description list entry should receive posinset
// and setsize.
return item_role == ax::mojom::Role::kDescriptionListTerm ||
item_role == ax::mojom::Role::kTerm;
default:
return false;
}
......
......@@ -171,6 +171,8 @@ bool IsItemLike(const ax::mojom::Role role) {
case ax::mojom::Role::kTreeItem:
case ax::mojom::Role::kListBoxOption:
case ax::mojom::Role::kRadioButton:
case ax::mojom::Role::kDescriptionListTerm:
case ax::mojom::Role::kTerm:
return true;
default:
return false;
......@@ -269,6 +271,7 @@ bool IsSetLike(const ax::mojom::Role role) {
case ax::mojom::Role::kTree:
case ax::mojom::Role::kListBox:
case ax::mojom::Role::kRadioGroup:
case ax::mojom::Role::kDescriptionList:
return true;
default:
return false;
......
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