Commit 6712c441 authored by Joanmarie Diggs's avatar Joanmarie Diggs Committed by Commit Bot

Implement support for new blockquote, caption, and paragraph ARIA roles

These three roles are part of reaching role parity with HTML5. As such,
they should be exposed via platform accessibility APIs in the same way
as their native host language counterparts. Thus just add them to the
map of ARIA roles to internal roles.

Bug: 849650
Change-Id: I9a513e187a5beccd57fc5c7306929b0fd194b6dd
Reviewed-on: https://chromium-review.googlesource.com/1169476
Commit-Queue: Nektarios Paisios <nektar@chromium.org>
Reviewed-by: default avatarNektarios Paisios <nektar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#582340}
parent 3584222f
...@@ -1720,8 +1720,11 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired"; ...@@ -1720,8 +1720,11 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired";
std::string role_attribute; std::string role_attribute;
if (owner_->GetHtmlAttribute("role", &role_attribute)) { if (owner_->GetHtmlAttribute("role", &role_attribute)) {
ax::mojom::Role internalRole = [self internalRole]; ax::mojom::Role internalRole = [self internalRole];
if ((internalRole != ax::mojom::Role::kGroup && if ((internalRole != ax::mojom::Role::kBlockquote &&
internalRole != ax::mojom::Role::kListItem) || internalRole != ax::mojom::Role::kCaption &&
internalRole != ax::mojom::Role::kGroup &&
internalRole != ax::mojom::Role::kListItem &&
internalRole != ax::mojom::Role::kParagraph) ||
internalRole == ax::mojom::Role::kTab) { internalRole == ax::mojom::Role::kTab) {
// TODO(dtseng): This is not localized; see crbug/84814. // TODO(dtseng): This is not localized; see crbug/84814.
return base::SysUTF8ToNSString(role_attribute); return base::SysUTF8ToNSString(role_attribute);
......
...@@ -412,6 +412,10 @@ IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAriaBanner) { ...@@ -412,6 +412,10 @@ IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAriaBanner) {
RunAriaTest(FILE_PATH_LITERAL("aria-banner.html")); RunAriaTest(FILE_PATH_LITERAL("aria-banner.html"));
} }
IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAriaBlockquote) {
RunAriaTest(FILE_PATH_LITERAL("aria-blockquote.html"));
}
IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAriaBusy) { IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAriaBusy) {
RunAriaTest(FILE_PATH_LITERAL("aria-busy.html")); RunAriaTest(FILE_PATH_LITERAL("aria-busy.html"));
} }
...@@ -420,6 +424,10 @@ IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAriaButton) { ...@@ -420,6 +424,10 @@ IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAriaButton) {
RunAriaTest(FILE_PATH_LITERAL("aria-button.html")); RunAriaTest(FILE_PATH_LITERAL("aria-button.html"));
} }
IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAriaCaption) {
RunAriaTest(FILE_PATH_LITERAL("aria-caption.html"));
}
IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAriaCell) { IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAriaCell) {
RunAriaTest(FILE_PATH_LITERAL("aria-cell.html")); RunAriaTest(FILE_PATH_LITERAL("aria-cell.html"));
} }
...@@ -733,6 +741,10 @@ IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAriaOption) { ...@@ -733,6 +741,10 @@ IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAriaOption) {
RunAriaTest(FILE_PATH_LITERAL("aria-option.html")); RunAriaTest(FILE_PATH_LITERAL("aria-option.html"));
} }
IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAriaParagraph) {
RunAriaTest(FILE_PATH_LITERAL("aria-paragraph.html"));
}
IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAriaPosinset) { IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, AccessibilityAriaPosinset) {
RunAriaTest(FILE_PATH_LITERAL("aria-posinset.html")); RunAriaTest(FILE_PATH_LITERAL("aria-posinset.html"));
} }
......
android.webkit.WebView focusable focused scrollable
++android.view.View role_description='blockquote' name='Blockquote'
[document web] enabled focusable focused sensitive showing visible<newline>
++[block quote] enabled sensitive showing visible<newline>
++++[text] name='Blockquote' enabled sensitive showing visible<newline>
AXWebArea AXRoleDescription='HTML content'
++AXGroup AXRoleDescription='group'
++++AXStaticText AXRoleDescription='text' AXValue='Blockquote'
ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
++IA2_ROLE_SECTION xml-roles:blockquote
++++ROLE_SYSTEM_STATICTEXT name='Blockquote'
<!--
@MAC-ALLOW:AXRole*
@WIN-ALLOW:xml-roles*
-->
<!DOCTYPE html>
<html>
<body>
<div role="blockquote">Blockquote</div>
</body>
</html>
android.webkit.WebView focusable focused scrollable
++android.view.View name='Caption'
[document web] enabled focusable focused sensitive showing visible<newline>
++[caption] enabled sensitive showing visible<newline>
++++[text] name='Caption' enabled sensitive showing visible<newline>
AXWebArea AXRoleDescription='HTML content'
++AXGroup AXRoleDescription='group'
++++AXStaticText AXRoleDescription='text' AXValue='Caption'
ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
++IA2_ROLE_CAPTION xml-roles:caption
++++ROLE_SYSTEM_STATICTEXT name='Caption'
<!--
@MAC-ALLOW:AXRole*
@WIN-ALLOW:xml-roles*
-->
<!DOCTYPE html>
<html>
<body>
<div role="caption">Caption</div>
</body>
</html>
android.webkit.WebView focusable focused scrollable
++android.view.View name='Paragraph'
[document web] enabled focusable focused sensitive showing visible<newline>
++[paragraph] enabled sensitive showing visible<newline>
++++[text] name='Paragraph' enabled sensitive showing visible<newline>
AXWebArea AXRoleDescription='HTML content'
++AXGroup AXRoleDescription='group'
++++AXStaticText AXRoleDescription='text' AXValue='Paragraph'
ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE
++IA2_ROLE_PARAGRAPH xml-roles:paragraph
++++ROLE_SYSTEM_STATICTEXT name='Paragraph'
<!--
@MAC-ALLOW:AXRole*
@WIN-ALLOW:xml-roles*
-->
<!DOCTYPE html>
<html>
<body>
<div role="paragraph">Paragraph</div>
</body>
</html>
[document web] enabled focusable focused sensitive showing visible<newline>
++[block quote] enabled sensitive showing visible<newline>
++++[paragraph] enabled sensitive showing visible<newline>
++++++[text] name='First blockquote has a child element.' enabled sensitive showing visible<newline>
++[block quote] enabled sensitive showing visible<newline>
++++[text] name='Second blockquote has no child.' enabled sensitive showing visible<newline>
[document web] enabled focusable focused sensitive showing visible<newline>
++[table] name='Browser and Engine' enabled sensitive showing visible<newline>
++++[caption] enabled sensitive showing visible<newline>
++++++[text] name='Browser and Engine' enabled sensitive showing visible<newline>
++++[table row] enabled sensitive showing visible<newline>
++++++[column header] name='Browser' enabled sensitive showing visible<newline>
++++++++[text] name='Browser' enabled sensitive showing visible<newline>
++++++[column header] name='Engine' enabled sensitive showing visible<newline>
++++++++[text] name='Engine' enabled sensitive showing visible<newline>
++++[table row] enabled sensitive showing visible<newline>
++++++[table cell] name='Chrome' enabled sensitive showing visible<newline>
++++++++[text] name='Chrome' enabled sensitive showing visible<newline>
++++++[table cell] name='Blink' enabled sensitive showing visible<newline>
++++++++[text] name='Blink' enabled sensitive showing visible<newline>
++++[table row] enabled sensitive showing visible<newline>
++++++[table cell] name='Safari' enabled sensitive showing visible<newline>
++++++++[text] name='Safari' enabled sensitive showing visible<newline>
++++++[table cell] name='WebKit' enabled sensitive showing visible<newline>
++++++++[text] name='WebKit' enabled sensitive showing visible<newline>
[document web] enabled focusable focused sensitive showing visible<newline>
++[text] name='Before' enabled sensitive showing visible<newline>
++[paragraph] enabled sensitive showing visible<newline>
++++[text] name='Paragraph' enabled sensitive showing visible<newline>
++[text] name='After' enabled sensitive showing visible<newline>
...@@ -95,7 +95,9 @@ const RoleEntry kRoles[] = {{"alert", kAlertRole}, ...@@ -95,7 +95,9 @@ const RoleEntry kRoles[] = {{"alert", kAlertRole},
{"application", kApplicationRole}, {"application", kApplicationRole},
{"article", kArticleRole}, {"article", kArticleRole},
{"banner", kBannerRole}, {"banner", kBannerRole},
{"blockquote", kBlockquoteRole},
{"button", kButtonRole}, {"button", kButtonRole},
{"caption", kCaptionRole},
{"cell", kCellRole}, {"cell", kCellRole},
{"checkbox", kCheckBoxRole}, {"checkbox", kCheckBoxRole},
{"columnheader", kColumnHeaderRole}, {"columnheader", kColumnHeaderRole},
...@@ -183,6 +185,7 @@ const RoleEntry kRoles[] = {{"alert", kAlertRole}, ...@@ -183,6 +185,7 @@ const RoleEntry kRoles[] = {{"alert", kAlertRole},
{"none", kNoneRole}, {"none", kNoneRole},
{"note", kNoteRole}, {"note", kNoteRole},
{"option", kListBoxOptionRole}, {"option", kListBoxOptionRole},
{"paragraph", kParagraphRole},
{"presentation", kPresentationalRole}, {"presentation", kPresentationalRole},
{"progressbar", kProgressIndicatorRole}, {"progressbar", kProgressIndicatorRole},
{"radio", kRadioButtonRole}, {"radio", kRadioButtonRole},
......
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