AX: Implement support for new blockquote, caption, and paragraph ARIA roles
authorjdiggs@igalia.com <jdiggs@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Jun 2018 15:55:06 +0000 (15:55 +0000)
committerjdiggs@igalia.com <jdiggs@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Jun 2018 15:55:06 +0000 (15:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=186274

Reviewed by Chris Fleizach.

Source/WebCore:

Add the three new ARIA roles to the internal rolemap so that they are treated in
the same fashion as their HTML element counterparts. Also ensure that an element
with an explicit caption role does not get pruned from the macOS accessibility tree.

No new tests. Instead add the roles to the existing role-exposure tests.

* accessibility/AccessibilityObject.cpp:
(WebCore::initializeRoleMap):
* accessibility/mac/AccessibilityObjectMac.mm:
(WebCore::AccessibilityObject::accessibilityPlatformIncludesObject const):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(createAccessibilityRoleMap):

LayoutTests:

Add the three ARIA roles to the existing role-exposure tests and update
expectations accordingly. Also update several additional GTK tests because
the mapping of these ARIA roles results in new object attributes appearing
for native HTML blockquote, paragraph, and caption elements.

* accessibility/gtk/object-attributes-expected.txt:
* accessibility/gtk/xml-roles-exposed-expected.txt:
* accessibility/gtk/xml-roles-exposed.html:
* accessibility/roles-computedRoleString-expected.txt:
* accessibility/roles-computedRoleString.html:
* accessibility/roles-exposed.html:
* inspector/dom/hideHighlight-expected.txt:
* platform/gtk/accessibility/roles-computedRoleString-expected.txt:
* platform/gtk/accessibility/roles-exposed-expected.txt:
* platform/gtk/accessibility/table-one-cell-expected.txt:
* platform/mac/accessibility/roles-computedRoleString-expected.txt:
* platform/mac/accessibility/roles-exposed-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232508 268f45cc-cd09-0410-ab3c-d52691b4dbfc

17 files changed:
LayoutTests/ChangeLog
LayoutTests/accessibility/gtk/object-attributes-expected.txt
LayoutTests/accessibility/gtk/xml-roles-exposed-expected.txt
LayoutTests/accessibility/gtk/xml-roles-exposed.html
LayoutTests/accessibility/roles-computedRoleString-expected.txt
LayoutTests/accessibility/roles-computedRoleString.html
LayoutTests/accessibility/roles-exposed.html
LayoutTests/inspector/dom/hideHighlight-expected.txt
LayoutTests/platform/gtk/accessibility/roles-computedRoleString-expected.txt
LayoutTests/platform/gtk/accessibility/roles-exposed-expected.txt
LayoutTests/platform/gtk/accessibility/table-one-cell-expected.txt
LayoutTests/platform/mac/accessibility/roles-computedRoleString-expected.txt
LayoutTests/platform/mac/accessibility/roles-exposed-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityObject.cpp
Source/WebCore/accessibility/mac/AccessibilityObjectMac.mm
Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

index 613e2d6..9bf2a8b 100644 (file)
@@ -1,3 +1,28 @@
+2018-06-05  Joanmarie Diggs  <jdiggs@igalia.com>
+
+        AX: Implement support for new blockquote, caption, and paragraph ARIA roles
+        https://bugs.webkit.org/show_bug.cgi?id=186274
+
+        Reviewed by Chris Fleizach.
+
+        Add the three ARIA roles to the existing role-exposure tests and update
+        expectations accordingly. Also update several additional GTK tests because
+        the mapping of these ARIA roles results in new object attributes appearing
+        for native HTML blockquote, paragraph, and caption elements.
+
+        * accessibility/gtk/object-attributes-expected.txt:
+        * accessibility/gtk/xml-roles-exposed-expected.txt:
+        * accessibility/gtk/xml-roles-exposed.html:
+        * accessibility/roles-computedRoleString-expected.txt:
+        * accessibility/roles-computedRoleString.html:
+        * accessibility/roles-exposed.html:
+        * inspector/dom/hideHighlight-expected.txt:
+        * platform/gtk/accessibility/roles-computedRoleString-expected.txt:
+        * platform/gtk/accessibility/roles-exposed-expected.txt:
+        * platform/gtk/accessibility/table-one-cell-expected.txt:
+        * platform/mac/accessibility/roles-computedRoleString-expected.txt:
+        * platform/mac/accessibility/roles-exposed-expected.txt:
+
 2018-06-04  Chris Dumez  <cdumez@apple.com>
 
         Rename "Cross-Origin-Options" HTTP header to "Cross-Origin-Window-Policy"
index c294348..16e2b29 100644 (file)
@@ -232,7 +232,7 @@ AXEnabled: 1
 AXExpanded: 0
 AXRequired: 0
 AXChecked: 0
-AXPlatformAttributes: html-id:description, tag:p, toolkit:WebKitGtk
+AXPlatformAttributes: computed-role:paragraph, html-id:description, tag:p, toolkit:WebKitGtk
 ------------
 
 PASS successfullyParsed is true
index da61396..afd40be 100644 (file)
@@ -98,6 +98,25 @@ AXRequired: 0
 AXChecked: 0
 AXPlatformAttributes: computed-role:banner, xml-roles:banner, tag:div, toolkit:WebKitGtk
 ------------
+AXRole: AXBlockquote
+AXParent: AXWebArea
+AXChildren: 0
+AXPosition: { 0.000000, 0.000000 }
+AXSize: { 0.000000, 0.000000 }
+AXTitle: 
+AXDescription: 
+AXValue: 
+AXFocusable: 0
+AXFocused: 0
+AXSelectable: 0
+AXSelected: 0
+AXMultiSelectable: 0
+AXEnabled: 1
+AXExpanded: 0
+AXRequired: 0
+AXChecked: 0
+AXPlatformAttributes: computed-role:blockquote, xml-roles:blockquote, tag:div, toolkit:WebKitGtk
+------------
 AXRole: AXButton
 AXParent: AXWebArea
 AXChildren: 0
@@ -117,6 +136,25 @@ AXRequired: 0
 AXChecked: 0
 AXPlatformAttributes: computed-role:button, xml-roles:button, tag:div, toolkit:WebKitGtk
 ------------
+AXRole: AXCaption
+AXParent: AXWebArea
+AXChildren: 0
+AXPosition: { 0.000000, 0.000000 }
+AXSize: { 0.000000, 0.000000 }
+AXTitle: 
+AXDescription: 
+AXValue: 
+AXFocusable: 0
+AXFocused: 0
+AXSelectable: 0
+AXSelected: 0
+AXMultiSelectable: 0
+AXEnabled: 1
+AXExpanded: 0
+AXRequired: 0
+AXChecked: 0
+AXPlatformAttributes: computed-role:caption, xml-roles:caption, tag:div, toolkit:WebKitGtk
+------------
 AXRole: AXCheckBox
 AXParent: AXWebArea
 AXChildren: 0
@@ -517,6 +555,25 @@ AXRequired: 0
 AXChecked: 0
 AXPlatformAttributes: computed-role:note, xml-roles:note, tag:div, toolkit:WebKitGtk
 ------------
+AXRole: AXParagraph
+AXParent: AXWebArea
+AXChildren: 0
+AXPosition: { 0.000000, 0.000000 }
+AXSize: { 0.000000, 0.000000 }
+AXTitle: 
+AXDescription: 
+AXValue: 
+AXFocusable: 1
+AXFocused: 0
+AXSelectable: 0
+AXSelected: 0
+AXMultiSelectable: 0
+AXEnabled: 1
+AXExpanded: 0
+AXRequired: 0
+AXChecked: 0
+AXPlatformAttributes: computed-role:paragraph, xml-roles:paragraph, tag:div, toolkit:WebKitGtk
+------------
 AXRole: AXProgressIndicator
 AXParent: AXWebArea
 AXChildren: 0
@@ -1659,7 +1716,7 @@ AXEnabled: 1
 AXExpanded: 0
 AXRequired: 0
 AXChecked: 0
-AXPlatformAttributes: html-id:description, tag:p, toolkit:WebKitGtk
+AXPlatformAttributes: computed-role:paragraph, html-id:description, tag:p, toolkit:WebKitGtk
 ------------
 
 PASS successfullyParsed is true
index a3e10d8..b858a4b 100644 (file)
@@ -10,7 +10,9 @@
  <div role="application"></div>
  <div role="article"></div>
  <div role="banner"></div>
+ <div role="blockquote"></div>
  <div role="button"></div>
+ <div role="caption"></div>
  <div role="checkbox"></div>
  <div role="combobox"></div>
  <div role="complementary"></div>
@@ -32,6 +34,7 @@
  <div role="math"></div>
  <div role="navigation"></div>
  <div role="note"></div>
+ <div role="paragraph"></div>
  <div role="presentation"></div>
  <div role="progressbar"></div>
  <div role="radio"></div>
index 6e004f5..2778771 100644 (file)
@@ -47,7 +47,7 @@ PASS: meter -> progressbar.
 PASS: nav -> navigation. 
 PASS: ol -> list. 
 PASS: li -> listitem. 
-PASS: p -> . 
+PASS: p -> paragraph
 PASS: pre -> group. 
 PASS: progress -> progressbar. 
 PASS: samp -> . 
@@ -63,6 +63,7 @@ PASS: option -> option.
 PASS: sub -> . 
 PASS: sup -> . 
 PASS: table -> table. 
+PASS: caption -> caption. 
 PASS: tr -> row. 
 PASS: th -> columnheader. 
 PASS: tr -> row. 
@@ -97,7 +98,9 @@ PASS: div[role="alertdialog"] -> alertdialog.
 PASS: div[role="application"] -> application. 
 PASS: div[role="article"] -> article. 
 PASS: div[role="banner"] -> banner. 
+PASS: div[role="blockquote"] -> blockquote. 
 PASS: div[role="button"] -> button. 
+PASS: div[role="caption"] -> caption. 
 PASS: div[role="checkbox"] -> checkbox. 
 PASS: div[role="combobox"] -> combobox. 
 PASS: div[role="complementary"] -> complementary. 
@@ -134,6 +137,7 @@ PASS: div[role="menuitemcheckbox"] -> menuitemcheckbox.
 PASS: div[role="menuitemradio"] -> menuitemradio. 
 PASS: div[role="navigation"] -> navigation. 
 PASS: div[role="note"] -> note. 
+PASS: div[role="paragraph"] -> paragraph. 
 PASS: div[role="progressbar"] -> progressbar. 
 PASS: div[role="radiogroup"] -> radiogroup. 
 PASS: div[role="radio"] -> radio. 
index efcc1b4..9df7640 100644 (file)
@@ -68,7 +68,7 @@
 <!-- skipped <optgroup> -->
 <!-- skipped <option> -->
 <!-- skipped <output> -->
-<p data-role="" data-platform="atk,mac" class="ex">X</p>
+<p data-role="paragraph" data-platform="atk,mac" class="ex">X</p>
 <!-- skipped <param> -->
 <pre data-role="" data-platform="atk,mac" class="ex">X</pre>
 <progress data-role="progressbar" data-platform="atk,mac" class="ex" value="0.75">X</progress>
 <svg data-role="" data-platform="atk,mac" class="ex">X</svg>
 
 <table data-role="table" data-platform="atk,mac" class="ex">
-    <caption data-role="" data-platform="atk,mac" class="ex">X</caption>
+    <caption data-role="caption" data-platform="atk,mac" class="ex">X</caption>
     <thead data-role="rowgroup" data-platform="atk,mac" class="ex">
         <tr data-role="row" data-platform="atk,mac" class="ex">
             <th data-role="columnheader" data-platform="atk,mac" class="ex">X</th>
 <div role="application"              data-role="application" data-platform="atk,mac" class="ex">X</div>
 <div role="article"                  data-role="article" data-platform="atk,mac" class="ex">X</div>
 <div role="banner"                   data-role="banner" data-platform="atk,mac" class="ex">X</div>
+<div role="blockquote"               data-role="blockquote" data-platform="atk,mac" class="ex">X</div>
 <div role="button"                   data-role="button" data-platform="atk,mac" class="ex">X</div>
+<div role="caption"                  data-role="caption" data-platform="atk,mac" class="ex">X</div>
 <div role="checkbox"                 data-role="checkbox" data-platform="atk,mac" class="ex">X</div>
 <div role="combobox"                 data-role="combobox" data-platform="atk,mac" class="ex">X</div>
 <div role="complementary"            data-role="complementary" data-platform="atk,mac" class="ex">X</div>
 </div>
 <div role="navigation"               data-role="navigation" data-platform="atk,mac" class="ex">X</div>
 <div role="note"                     data-role="note" data-platform="atk,mac" class="ex">X</div>
+<div role="paragraph"                data-role="paragraph" data-platform="atk,mac" class="ex">X</div>
 <div role="presentation"             data-role="" data-platform="atk,mac" class="ex">X</div>
 <div role="progressbar"              data-role="progressbar" data-platform="atk,mac" class="ex">X</div>
 <div role="radiogroup"               data-role="radiogroup" data-platform="atk,mac" class="ex">
index 0eea237..35ab601 100644 (file)
 <div role="application"              data-platform="atk,mac" class="ex">X</div>
 <div role="article"                  data-platform="atk,mac" class="ex">X</div>
 <div role="banner"                   data-platform="atk,mac" class="ex">X</div>
+<div role="blockquote"               data-platform="atk,mac" class="ex">X</div>
 <div role="button"                   data-platform="atk,mac" class="ex">X</div>
+<div role="caption"                  data-platform="atk,mac" class="ex">X</div>
 <div role="checkbox"                 data-platform="atk,mac" class="ex">X</div>
 <div role="combobox"                 data-platform="atk,mac" class="ex">X</div>
 <div role="complementary"            data-platform="atk,mac" class="ex">X</div>
 </div>
 <div role="navigation"               data-platform="atk,mac" class="ex">X</div>
 <div role="note"                     data-platform="atk,mac" class="ex">X</div>
+<div role="paragraph"                data-platform="atk,mac" class="ex">X</div>
 <div role="presentation"             data-platform="atk,mac" class="ex">X</div>
 <div role="progressbar"              data-platform="atk,mac" class="ex">X</div>
 <div role="radiogroup"               data-platform="atk,mac" class="ex">
index 373cc44..bbee55b 100644 (file)
@@ -21,7 +21,7 @@ PASS: Should be no highlight.
 
 -- Running test case: HighlightNode
 PASS: Should be one highlighted node.
-Highlighted Element Data: {"tagName":"p","idValue":"target","size":{"width":500,"height":100},"role":""}
+Highlighted Element Data: {"tagName":"p","idValue":"target","size":{"width":500,"height":100},"role":"paragraph"}
 
 -- Running test case: HideHighlight
 PASS: Should be no highlight.
index 47cc62a..738b847 100644 (file)
@@ -46,7 +46,7 @@ PASS: math -> math.
 PASS: nav -> navigation. 
 PASS: ol -> list. 
 PASS: li -> listitem. 
-PASS: p -> . 
+PASS: p -> paragraph
 PASS: pre -> . 
 PASS: progress -> progressbar. 
 PASS: samp -> . 
@@ -64,7 +64,7 @@ PASS: option -> option.
 PASS: sub -> . 
 PASS: sup -> . 
 PASS: table -> table. 
-PASS: caption -> . 
+PASS: caption -> caption
 PASS: tr -> row. 
 PASS: th -> columnheader. 
 PASS: tr -> row. 
@@ -100,7 +100,9 @@ PASS: div[role="alertdialog"] -> alertdialog.
 PASS: div[role="application"] -> application. 
 PASS: div[role="article"] -> article. 
 PASS: div[role="banner"] -> banner. 
+PASS: div[role="blockquote"] -> blockquote. 
 PASS: div[role="button"] -> button. 
+PASS: div[role="caption"] -> caption. 
 PASS: div[role="checkbox"] -> checkbox. 
 PASS: div[role="combobox"] -> combobox. 
 PASS: div[role="complementary"] -> complementary. 
@@ -142,6 +144,7 @@ PASS: div[role="menuitemcheckbox"] -> menuitemcheckbox.
 PASS: div[role="menuitemradio"] -> menuitemradio. 
 PASS: div[role="navigation"] -> navigation. 
 PASS: div[role="note"] -> note. 
+PASS: div[role="paragraph"] -> paragraph. 
 PASS: div[role="progressbar"] -> progressbar. 
 PASS: div[role="radiogroup"] -> radiogroup. 
 PASS: div[role="radio"] -> radio. 
index 029cdbd..e5913dd 100644 (file)
@@ -499,9 +499,15 @@ div[role=article]
 div[role=banner]
       AXRole: AXLandmarkBanner
       
+div[role=blockquote]
+      AXRole: AXBlockquote
+      
 div[role=button]
       AXRole: AXButton
       
+div[role=caption]
+      AXRole: AXCaption
+      
 div[role=checkbox]
       AXRole: AXCheckBox
       
@@ -745,6 +751,9 @@ div[role=navigation]
 div[role=note]
       AXRole: AXComment
       
+div[role=paragraph]
+      AXRole: AXParagraph
+      
 div[role=presentation]
       AXRole: 
       
index f990261..aac6249 100644 (file)
@@ -18,4 +18,4 @@ AXEnabled: 1
 AXExpanded: 0
 AXRequired: 0
 AXChecked: 0
-AXPlatformAttributes: tag:p, toolkit:WebKitGtk
+AXPlatformAttributes: computed-role:paragraph, tag:p, toolkit:WebKitGtk
index 0aefe4e..997fa26 100644 (file)
@@ -48,7 +48,7 @@ PASS: meter -> progressbar.
 PASS: nav -> navigation. 
 PASS: ol -> list. 
 PASS: li -> listitem. 
-PASS: p -> . 
+PASS: p -> paragraph
 PASS: pre -> . 
 PASS: progress -> progressbar. 
 PASS: samp -> . 
@@ -99,7 +99,9 @@ PASS: div[role="alertdialog"] -> alertdialog.
 PASS: div[role="application"] -> application. 
 PASS: div[role="article"] -> article. 
 PASS: div[role="banner"] -> banner. 
+PASS: div[role="blockquote"] -> blockquote. 
 PASS: div[role="button"] -> button. 
+PASS: div[role="caption"] -> caption. 
 PASS: div[role="checkbox"] -> checkbox. 
 PASS: div[role="combobox"] -> combobox. 
 PASS: div[role="complementary"] -> complementary. 
@@ -141,6 +143,7 @@ PASS: div[role="menuitemcheckbox"] -> menuitemcheckbox.
 PASS: div[role="menuitemradio"] -> menuitemradio. 
 PASS: div[role="navigation"] -> navigation. 
 PASS: div[role="note"] -> note. 
+PASS: div[role="paragraph"] -> paragraph. 
 PASS: div[role="progressbar"] -> progressbar. 
 PASS: div[role="radiogroup"] -> radiogroup. 
 PASS: div[role="radio"] -> radio. 
index 35dcfe5..36453a1 100644 (file)
@@ -834,11 +834,21 @@ div[role=banner]
       AXSubrole: AXLandmarkBanner
       AXRoleDescription: banner
       
+div[role=blockquote]
+      AXRole: AXGroup
+      AXSubrole: 
+      AXRoleDescription: group
+      
 div[role=button]
       AXRole: AXButton
       AXSubrole: 
       AXRoleDescription: button
       
+div[role=caption]
+      AXRole: AXGroup
+      AXSubrole: 
+      AXRoleDescription: group
+      
 div[role=checkbox]
       AXRole: AXCheckBox
       AXSubrole: 
@@ -1244,6 +1254,11 @@ div[role=note]
       AXSubrole: AXDocumentNote
       AXRoleDescription: note
       
+div[role=paragraph]
+      AXRole: AXGroup
+      AXSubrole: 
+      AXRoleDescription: group
+      
 div[role=presentation]
       AXRole: 
       AXSubrole: 
index fa786a4..c6e22cb 100644 (file)
@@ -1,3 +1,23 @@
+2018-06-05  Joanmarie Diggs  <jdiggs@igalia.com>
+
+        AX: Implement support for new blockquote, caption, and paragraph ARIA roles
+        https://bugs.webkit.org/show_bug.cgi?id=186274
+
+        Reviewed by Chris Fleizach.
+
+        Add the three new ARIA roles to the internal rolemap so that they are treated in
+        the same fashion as their HTML element counterparts. Also ensure that an element
+        with an explicit caption role does not get pruned from the macOS accessibility tree.
+
+        No new tests. Instead add the roles to the existing role-exposure tests.
+
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::initializeRoleMap):
+        * accessibility/mac/AccessibilityObjectMac.mm:
+        (WebCore::AccessibilityObject::accessibilityPlatformIncludesObject const):
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (createAccessibilityRoleMap):
+
 2018-06-05  Zalan Bujtas  <zalan@apple.com>
 
         [LFC] Merge width and margin computation for block-level, replaced elements in normal flow
index 6e49c80..0c1abc4 100644 (file)
@@ -2290,7 +2290,9 @@ static void initializeRoleMap()
         { "application", AccessibilityRole::WebApplication },
         { "article", AccessibilityRole::DocumentArticle },
         { "banner", AccessibilityRole::LandmarkBanner },
+        { "blockquote", AccessibilityRole::Blockquote },
         { "button", AccessibilityRole::Button },
+        { "caption", AccessibilityRole::Caption },
         { "checkbox", AccessibilityRole::CheckBox },
         { "complementary", AccessibilityRole::LandmarkComplementary },
         { "contentinfo", AccessibilityRole::LandmarkContentInfo },
@@ -2373,6 +2375,7 @@ static void initializeRoleMap()
         { "note", AccessibilityRole::DocumentNote },
         { "navigation", AccessibilityRole::LandmarkNavigation },
         { "option", AccessibilityRole::ListBoxOption },
+        { "paragraph", AccessibilityRole::Paragraph },
         { "presentation", AccessibilityRole::Presentational },
         { "progressbar", AccessibilityRole::ProgressIndicator },
         { "radio", AccessibilityRole::RadioButton },
index af199d7..cce972c 100644 (file)
@@ -84,7 +84,7 @@ AccessibilityObjectInclusion AccessibilityObject::accessibilityPlatformIncludesO
     if (isMenuListPopup() || isMenuListOption())
         return AccessibilityObjectInclusion::IgnoreObject;
 
-    if (roleValue() == AccessibilityRole::Caption)
+    if (roleValue() == AccessibilityRole::Caption && ariaRoleAttribute() == AccessibilityRole::Unknown)
         return AccessibilityObjectInclusion::IgnoreObject;
     
     if (roleValue() == AccessibilityRole::Mark)
index 1e86237..dc83b4c 100644 (file)
@@ -1991,6 +1991,7 @@ static const AccessibilityRoleMap& createAccessibilityRoleMap()
         { AccessibilityRole::GraphicsDocument, NSAccessibilityGroupRole },
         { AccessibilityRole::GraphicsObject, NSAccessibilityGroupRole },
         { AccessibilityRole::GraphicsSymbol, NSAccessibilityImageRole },
+        { AccessibilityRole::Caption, NSAccessibilityGroupRole },
     };
     AccessibilityRoleMap& roleMap = *new AccessibilityRoleMap;