Commit 30cbbba2 authored by Adam Ettenberger's avatar Adam Ettenberger Committed by Commit Bot

Allow recursive NameFromContents of Role::kStrong and Role::kEmphasis

Roles that allow NameFrom::kContents were not adding the text of
descendants with Role::kStrong or Role::kEmphasis.

This could cause screen readers read a portion of a word in some cases.

Bug: 1047549
Change-Id: Iaacd8e485684b61ee0977c44d31479f6aa3d108a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2032514
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Reviewed-by: default avatarKurt Catti-Schmidt <kschmi@microsoft.com>
Reviewed-by: default avatarAaron Leventhal <aleventhal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#737775}
parent 1a4e1171
android.webkit.WebView focusable focused scrollable android.webkit.WebView focusable focused scrollable
++android.widget.ListView role_description='list box' clickable collection item_count=2 row_count=2 ++android.widget.ListView role_description='list box' clickable collection item_count=4 row_count=4
++++android.view.View clickable collection_item focusable name='option 1' ++++android.view.View clickable collection_item focusable name='option 1'
++++android.view.View clickable collection_item focusable name='label 2' item_index=1 row_index=1 ++++android.view.View clickable collection_item focusable name='label 2' item_index=1 row_index=1
\ No newline at end of file ++++android.view.View clickable collection_item focusable name='caterpillar' item_index=2 row_index=2
++++android.view.View clickable collection_item focusable name='catfish' item_index=3 row_index=3
...@@ -2,3 +2,9 @@ ...@@ -2,3 +2,9 @@
++[list box] xml-roles:listbox ++[list box] xml-roles:listbox
++++[list item] name='option 1' selectable xml-roles:option ++++[list item] name='option 1' selectable xml-roles:option
++++[list item] name='label 2' selectable xml-roles:option ++++[list item] name='label 2' selectable xml-roles:option
++++[list item] name='caterpillar' selectable xml-roles:option
++++++[static] name='cat'
++++++[static] name='erpillar'
++++[list item] name='catfish' selectable xml-roles:option
++++++[static] name='cat'
++++++[static] name='fish'
...@@ -3,3 +3,13 @@ rootWebArea focusable ...@@ -3,3 +3,13 @@ rootWebArea focusable
++++listBox ++++listBox
++++++listBoxOption focusable name='option 1' selected=false ++++++listBoxOption focusable name='option 1' selected=false
++++++listBoxOption focusable name='label 2' selected=false ++++++listBoxOption focusable name='label 2' selected=false
++++++listBoxOption focusable name='caterpillar' selected=false
++++++++staticText name='cat'
++++++++++inlineTextBox name='cat'
++++++++staticText name='erpillar'
++++++++++inlineTextBox name='erpillar'
++++++listBoxOption focusable name='catfish' selected=false
++++++++staticText name='cat'
++++++++++inlineTextBox name='cat'
++++++++staticText name='fish'
++++++++++inlineTextBox name='fish'
AXWebArea AXRoleDescription='HTML content' AXWebArea AXRoleDescription='HTML content'
++AXList AXRoleDescription='list' ++AXList AXRoleDescription='list'
++++AXStaticText AXRoleDescription='text' AXValue='option 1' ++++AXStaticText AXRoleDescription='text' AXValue='option 1'
++++AXStaticText AXRoleDescription='text' AXValue='label 2' ++++AXStaticText AXRoleDescription='text' AXValue='label 2'
\ No newline at end of file ++++AXStaticText AXRoleDescription='text' AXValue='caterpillar'
++++++AXStaticText AXRoleDescription='text' AXValue='cat'
++++++AXStaticText AXRoleDescription='text' AXValue='erpillar'
++++AXStaticText AXRoleDescription='text' AXValue='catfish'
++++++AXStaticText AXRoleDescription='text' AXValue='cat'
++++++AXStaticText AXRoleDescription='text' AXValue='fish'
...@@ -2,3 +2,9 @@ ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ...@@ -2,3 +2,9 @@ ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
++ROLE_SYSTEM_LIST xml-roles:listbox ++ROLE_SYSTEM_LIST xml-roles:listbox
++++ROLE_SYSTEM_LISTITEM name='option 1' FOCUSABLE SELECTABLE xml-roles:option ++++ROLE_SYSTEM_LISTITEM name='option 1' FOCUSABLE SELECTABLE xml-roles:option
++++ROLE_SYSTEM_LISTITEM name='label 2' FOCUSABLE SELECTABLE xml-roles:option ++++ROLE_SYSTEM_LISTITEM name='label 2' FOCUSABLE SELECTABLE xml-roles:option
++++ROLE_SYSTEM_LISTITEM name='caterpillar' FOCUSABLE SELECTABLE xml-roles:option
++++++ROLE_SYSTEM_STATICTEXT name='cat'
++++++ROLE_SYSTEM_STATICTEXT name='erpillar'
++++ROLE_SYSTEM_LISTITEM name='catfish' FOCUSABLE SELECTABLE xml-roles:option
++++++ROLE_SYSTEM_STATICTEXT name='cat'
++++++ROLE_SYSTEM_STATICTEXT name='fish'
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
<div role="listbox"> <div role="listbox">
<div role="option">option 1</div> <div role="option">option 1</div>
<div role="option" aria-label="label 2">option 2</div> <div role="option" aria-label="label 2">option 2</div>
<div role="option">cat<strong>erpillar</strong></div>
<div role="option">cat<em>fish</em></div>
</div> </div>
</body> </body>
......
...@@ -3554,7 +3554,6 @@ bool AXObject::NameFromContents(bool recursive) const { ...@@ -3554,7 +3554,6 @@ bool AXObject::NameFromContents(bool recursive) const {
case ax::mojom::Role::kDocToc: case ax::mojom::Role::kDocToc:
case ax::mojom::Role::kDocument: case ax::mojom::Role::kDocument:
case ax::mojom::Role::kEmbeddedObject: case ax::mojom::Role::kEmbeddedObject:
case ax::mojom::Role::kEmphasis:
case ax::mojom::Role::kFeed: case ax::mojom::Role::kFeed:
case ax::mojom::Role::kFigure: case ax::mojom::Role::kFigure:
case ax::mojom::Role::kForm: case ax::mojom::Role::kForm:
...@@ -3596,7 +3595,6 @@ bool AXObject::NameFromContents(bool recursive) const { ...@@ -3596,7 +3595,6 @@ bool AXObject::NameFromContents(bool recursive) const {
case ax::mojom::Role::kSpinButton: case ax::mojom::Role::kSpinButton:
case ax::mojom::Role::kStatus: case ax::mojom::Role::kStatus:
case ax::mojom::Role::kSliderThumb: case ax::mojom::Role::kSliderThumb:
case ax::mojom::Role::kStrong:
case ax::mojom::Role::kSuggestion: case ax::mojom::Role::kSuggestion:
case ax::mojom::Role::kSvgRoot: case ax::mojom::Role::kSvgRoot:
case ax::mojom::Role::kTable: case ax::mojom::Role::kTable:
...@@ -3630,6 +3628,7 @@ bool AXObject::NameFromContents(bool recursive) const { ...@@ -3630,6 +3628,7 @@ bool AXObject::NameFromContents(bool recursive) const {
case ax::mojom::Role::kDescriptionList: case ax::mojom::Role::kDescriptionList:
case ax::mojom::Role::kDescriptionListTerm: case ax::mojom::Role::kDescriptionListTerm:
case ax::mojom::Role::kDetails: case ax::mojom::Role::kDetails:
case ax::mojom::Role::kEmphasis:
case ax::mojom::Role::kFigcaption: case ax::mojom::Role::kFigcaption:
case ax::mojom::Role::kFooter: case ax::mojom::Role::kFooter:
case ax::mojom::Role::kFooterAsNonLandmark: case ax::mojom::Role::kFooterAsNonLandmark:
...@@ -3659,6 +3658,7 @@ bool AXObject::NameFromContents(bool recursive) const { ...@@ -3659,6 +3658,7 @@ bool AXObject::NameFromContents(bool recursive) const {
case ax::mojom::Role::kRuby: case ax::mojom::Role::kRuby:
case ax::mojom::Role::kRubyAnnotation: case ax::mojom::Role::kRubyAnnotation:
case ax::mojom::Role::kSection: case ax::mojom::Role::kSection:
case ax::mojom::Role::kStrong:
result = recursive || (CanReceiveAccessibilityFocus() && !IsEditable()); result = recursive || (CanReceiveAccessibilityFocus() && !IsEditable());
break; break;
......
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