Commit 01210142 authored by Alexander Surkov's avatar Alexander Surkov Committed by Commit Bot

Text level elements should participate in recursive name computation

Accessible name computation fails to pick up content of text level elements not listed elsewhere (refer to HTML-aam spec) when the elements are located in subtree of an element of name-from-content role

R=dmazzoni@chromium.org

Bug: 1053507
Change-Id: I702e04269ef298a16cb085b226709209a67517b1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2068755Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Commit-Queue: Alexander Surkkov <asurkov@igalia.com>
Cr-Commit-Position: refs/heads/master@{#744929}
parent b53f5caa
......@@ -3502,7 +3502,6 @@ bool AXObject::NameFromContents(bool recursive) const {
case ax::mojom::Role::kBanner:
case ax::mojom::Role::kBlockquote:
case ax::mojom::Role::kCaret:
case ax::mojom::Role::kCode:
case ax::mojom::Role::kClient:
case ax::mojom::Role::kColorWell:
case ax::mojom::Role::kColumn:
......@@ -3512,7 +3511,6 @@ bool AXObject::NameFromContents(bool recursive) const {
case ax::mojom::Role::kContentInfo:
case ax::mojom::Role::kDate:
case ax::mojom::Role::kDateTime:
case ax::mojom::Role::kDefinition:
case ax::mojom::Role::kDesktop:
case ax::mojom::Role::kDialog:
case ax::mojom::Role::kDirectory:
......@@ -3604,7 +3602,6 @@ bool AXObject::NameFromContents(bool recursive) const {
case ax::mojom::Role::kTextField:
case ax::mojom::Role::kTextFieldWithComboBox:
case ax::mojom::Role::kTitleBar:
case ax::mojom::Role::kTime:
case ax::mojom::Role::kTimer:
case ax::mojom::Role::kToolbar:
case ax::mojom::Role::kTree:
......@@ -3621,8 +3618,10 @@ bool AXObject::NameFromContents(bool recursive) const {
case ax::mojom::Role::kAbbr:
case ax::mojom::Role::kCanvas:
case ax::mojom::Role::kCaption:
case ax::mojom::Role::kCode:
case ax::mojom::Role::kContentDeletion:
case ax::mojom::Role::kContentInsertion:
case ax::mojom::Role::kDefinition:
case ax::mojom::Role::kDescriptionListDetail:
case ax::mojom::Role::kDescriptionList:
case ax::mojom::Role::kDescriptionListTerm:
......@@ -3658,6 +3657,7 @@ bool AXObject::NameFromContents(bool recursive) const {
case ax::mojom::Role::kRubyAnnotation:
case ax::mojom::Role::kSection:
case ax::mojom::Role::kStrong:
case ax::mojom::Role::kTime:
result = recursive || (CanReceiveAccessibilityFocus() && !IsEditable());
break;
......
<!DOCTYPE HTML>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<a id="a-code" href="www.igalia.com" title="oops">
<code>code</code>
</div>
<a id="a-dfn" href="www.igalia.com" title="oops">
<dfn>definition</dfn>
</div>
<a id="a-p" href="www.igalia.com" title="oops">
<p>paragraph</p>
</div>
<a id="a-time" href="www.igalia.com" title="oops">
<time datetime="2016-04-12T11:27:16+02:00">12/04/2016</time>
</div>
<a id="a-norecursion" href="www.igalia.com" title="yay">
<table role="table"><tr><td>cell</td></tr></table>
</div>
<script>
test(function(t) {
const snippets = [
[ 'a-code', 'code' ],
[ 'a-dfn', 'definition' ],
[ 'a-p', 'paragraph' ],
[ 'a-time', '12/04/2016' ],
];
for (let [ id, expectedName ] of snippets) {
let a = accessibilityController.accessibleElementById(id);
assert_equals(a.name, expectedName, `Name from ${id} subtree`);
}
// Example when recursion is not allowed for name computation.
let a = accessibilityController.accessibleElementById('a-norecursion');
assert_equals(a.name, 'yay', `No name from a-norecursion subtree`);
}, 'Names from subtree');
</script>
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