Bug 1466822 - Implement support for new blockquote, caption, and paragraph ARIA roles r=Jamie
authorJoanmarie Diggs <jdiggs@igalia.com>
Tue, 05 Jun 2018 09:54:00 +0300
changeset 421526 5a34a56825e8d40140808a2543e29ced97bfd448
parent 421525 b75e6bb295a948cda358d42f96a0b8c95db8655d
child 421527 25f96c342f93d6f5bd60d8c4b3573887377cbf6e
push id34096
push usernbeleuzu@mozilla.com
push dateWed, 06 Jun 2018 09:37:23 +0000
treeherdermozilla-central@cec4a3cecc29 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersJamie
bugs1466822
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1466822 - Implement support for new blockquote, caption, and paragraph ARIA roles r=Jamie * Create BLOCKQUOTE internal role (also needed for correct exposure of blockquote element on ATK) * Add new ARIA roles to internal ARIA map * Add new roles to existing ARIA roles mochitest and update blockquote element test to reflect mapping to the new internal role
accessible/base/ARIAMap.cpp
accessible/base/MarkupMap.h
accessible/base/Role.h
accessible/base/RoleMap.h
accessible/interfaces/nsIAccessibleRole.idl
accessible/tests/mochitest/elm/test_HTMLSpec.html
accessible/tests/mochitest/role.js
accessible/tests/mochitest/role/test_aria.html
accessible/tests/mochitest/role/test_general.html
accessible/tests/mochitest/tree/test_txtcntr.html
xpcom/ds/nsGkAtomList.h
--- a/accessible/base/ARIAMap.cpp
+++ b/accessible/base/ARIAMap.cpp
@@ -83,27 +83,45 @@ static const nsRoleMapEntry sWAIRoleMaps
     roles::NOTHING,
     kUseNativeRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
     eLandmark,
     kNoReqStates
   },
+  { // blockquote
+    &nsGkAtoms::blockquote,
+    roles::BLOCKQUOTE,
+    kUseMapRole,
+    eNoValue,
+    eNoAction,
+    eNoLiveAttr,
+    kGenericAccType,
+  },
   { // button
     &nsGkAtoms::button,
     roles::PUSHBUTTON,
     kUseMapRole,
     eNoValue,
     ePressAction,
     eNoLiveAttr,
     eButton,
     kNoReqStates
     // eARIAPressed is auto applied on any button
   },
+  { // caption
+    &nsGkAtoms::caption,
+    roles::CAPTION,
+    kUseMapRole,
+    eNoValue,
+    eNoAction,
+    eNoLiveAttr,
+    kGenericAccType,
+  },
   { // cell
     &nsGkAtoms::cell,
     roles::CELL,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
     eTableCell,
@@ -892,16 +910,25 @@ static const nsRoleMapEntry sWAIRoleMaps
     eNoValue,
     eSelectAction,
     eNoLiveAttr,
     kGenericAccType,
     kNoReqStates,
     eARIASelectable,
     eARIACheckedMixed
   },
+  { // paragraph
+    &nsGkAtoms::paragraph,
+    roles::PARAGRAPH,
+    kUseMapRole,
+    eNoValue,
+    eNoAction,
+    eNoLiveAttr,
+    kGenericAccType,
+  },
   { // presentation
     &nsGkAtoms::presentation,
     roles::NOTHING,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
     kGenericAccType,
--- a/accessible/base/MarkupMap.h
+++ b/accessible/base/MarkupMap.h
@@ -23,17 +23,17 @@ MARKUPMAP(article,
           Attr(xmlroles, article))
 
 MARKUPMAP(aside,
           New_HyperText,
           roles::NOTE)
 
 MARKUPMAP(blockquote,
           New_HyperText,
-          roles::SECTION)
+          roles::BLOCKQUOTE)
 
 MARKUPMAP(dd,
           New_HTMLDefinition,
           roles::DEFINITION)
 
 MARKUPMAP(details,
           New_HyperText,
           roles::DETAILS)
--- a/accessible/base/Role.h
+++ b/accessible/base/Role.h
@@ -1015,17 +1015,22 @@ enum Role {
   REGION = 173,
 
   /**
    * Represents a control with a text input and a popup with a set of predefined
    * choices. It is used for ARIA's combobox role. See also COMBOBOX.
    */
   EDITCOMBOBOX = 174,
 
-  LAST_ROLE = EDITCOMBOBOX
+  /**
+   * A section of content that is quoted from another source.
+   */
+  BLOCKQUOTE = 175,
+
+  LAST_ROLE = BLOCKQUOTE
 };
 
 } // namespace role
 
 typedef enum mozilla::a11y::roles::Role role;
 
 } // namespace a11y
 } // namespace mozilla
--- a/accessible/base/RoleMap.h
+++ b/accessible/base/RoleMap.h
@@ -1413,8 +1413,16 @@ ROLE(REGION,
 // See also COMBOBOX.
 ROLE(EDITCOMBOBOX,
      "editcombobox",
      ATK_ROLE_COMBO_BOX,
      NSAccessibilityComboBoxRole,
      ROLE_SYSTEM_COMBOBOX,
      ROLE_SYSTEM_COMBOBOX,
      eNameFromValueRule)
+
+ROLE(BLOCKQUOTE,
+     "blockquote",
+     ATK_ROLE_BLOCK_QUOTE,
+     NSAccessibilityGroupRole,
+     ROLE_SYSTEM_GROUPING,
+     IA2_ROLE_SECTION,
+     eNoNameRule)
--- a/accessible/interfaces/nsIAccessibleRole.idl
+++ b/accessible/interfaces/nsIAccessibleRole.idl
@@ -1009,9 +1009,14 @@ interface nsIAccessibleRole : nsISupport
    */
   const unsigned long ROLE_REGION = 173;
 
   /**
    * Represents a control with a text input and a popup with a set of predefined
    * choices. It is used for ARIA's combobox role. See also ROLE_COMBOBOX.
    */
   const unsigned long ROLE_EDITCOMBOBOX = 174;
+
+  /**
+   * A section of content that is quoted from another source.
+   */
+  const unsigned long ROLE_BLOCKQUOTE = 175;
 };
--- a/accessible/tests/mochitest/elm/test_HTMLSpec.html
+++ b/accessible/tests/mochitest/elm/test_HTMLSpec.html
@@ -175,17 +175,17 @@
         ]
       };
       testElm("bdo_container", obj);
 
       // ////////////////////////////////////////////////////////////////////////
       // HTML:blockquote
 
       obj = {
-        role: ROLE_SECTION,
+        role: ROLE_BLOCKQUOTE,
         interfaces: [ nsIAccessibleText, nsIAccessibleHyperText ],
         children: [ { role: ROLE_PARAGRAPH } ]
       };
       testElm("blockquote", obj);
 
       // ////////////////////////////////////////////////////////////////////////
       // HTML:br contained by paragraph
 
--- a/accessible/tests/mochitest/role.js
+++ b/accessible/tests/mochitest/role.js
@@ -2,16 +2,17 @@
 // Role constants
 
 const ROLE_ALERT = nsIAccessibleRole.ROLE_ALERT;
 const ROLE_ARTICLE = nsIAccessibleRole.ROLE_ARTICLE;
 const ROLE_ANIMATION = nsIAccessibleRole.ROLE_ANIMATION;
 const ROLE_APPLICATION = nsIAccessibleRole.ROLE_APPLICATION;
 const ROLE_APP_ROOT = nsIAccessibleRole.ROLE_APP_ROOT;
 const ROLE_AUTOCOMPLETE = nsIAccessibleRole.ROLE_AUTOCOMPLETE;
+const ROLE_BLOCKQUOTE = nsIAccessibleRole.ROLE_BLOCKQUOTE;
 const ROLE_BUTTONDROPDOWNGRID = nsIAccessibleRole.ROLE_BUTTONDROPDOWNGRID;
 const ROLE_CANVAS = nsIAccessibleRole.ROLE_CANVAS;
 const ROLE_CAPTION = nsIAccessibleRole.ROLE_CAPTION;
 const ROLE_CELL = nsIAccessibleRole.ROLE_CELL;
 const ROLE_CHECKBUTTON = nsIAccessibleRole.ROLE_CHECKBUTTON;
 const ROLE_CHECK_MENU_ITEM = nsIAccessibleRole.ROLE_CHECK_MENU_ITEM;
 const ROLE_CHROME_WINDOW = nsIAccessibleRole.ROLE_CHROME_WINDOW;
 const ROLE_COMBOBOX = nsIAccessibleRole.ROLE_COMBOBOX;
--- a/accessible/tests/mochitest/role/test_aria.html
+++ b/accessible/tests/mochitest/role/test_aria.html
@@ -16,17 +16,19 @@
   <script type="application/javascript">
 
     function doTest() {
       // ARIA role map.
       testRole("aria_alert", ROLE_ALERT);
       testRole("aria_alertdialog", ROLE_DIALOG);
       testRole("aria_application", ROLE_APPLICATION);
       testRole("aria_article", ROLE_ARTICLE);
+      testRole("aria_blockquote", ROLE_BLOCKQUOTE);
       testRole("aria_button", ROLE_PUSHBUTTON);
+      testRole("aria_caption", ROLE_CAPTION);
       testRole("aria_checkbox", ROLE_CHECKBUTTON);
       testRole("aria_columnheader", ROLE_COLUMNHEADER);
       testRole("aria_combobox", ROLE_EDITCOMBOBOX);
       testRole("aria_dialog", ROLE_DIALOG);
       testRole("aria_directory", ROLE_LIST);
       testRole("aria_document", ROLE_NON_NATIVE_DOCUMENT);
       testRole("aria_form", ROLE_FORM);
       testRole("aria_feed", ROLE_GROUPING);
@@ -44,16 +46,17 @@
       testRole("aria_marquee", ROLE_ANIMATION);
       testRole("aria_math", ROLE_FLAT_EQUATION);
       testRole("aria_menu", ROLE_MENUPOPUP);
       testRole("aria_menubar", ROLE_MENUBAR);
       testRole("aria_menuitem", ROLE_MENUITEM);
       testRole("aria_menuitemcheckbox", ROLE_CHECK_MENU_ITEM);
       testRole("aria_menuitemradio", ROLE_RADIO_MENU_ITEM);
       testRole("aria_note", ROLE_NOTE);
+      testRole("aria_paragraph", ROLE_PARAGRAPH);
       testRole("aria_presentation", ROLE_TEXT); // weak role
       testRole("aria_progressbar", ROLE_PROGRESSBAR);
       testRole("aria_radio", ROLE_RADIOBUTTON);
       testRole("aria_radiogroup", ROLE_RADIO_GROUP);
       testRole("aria_region_no_name", ROLE_TEXT);
       testRole("aria_region_has_label", ROLE_REGION);
       testRole("aria_region_has_labelledby", ROLE_REGION);
       testRole("aria_region_has_title", ROLE_REGION);
@@ -204,17 +207,19 @@
   <div id="content" style="display: none"></div>
   <pre id="test">
   </pre>
 
   <span id="aria_alert" role="alert"/>
   <span id="aria_alertdialog" role="alertdialog"/>
   <span id="aria_application" role="application"/>
   <span id="aria_article" role="article"/>
+  <span id="aria_blockquote" role="blockquote"/>
   <span id="aria_button" role="button"/>
+  <span id="aria_caption" role="caption"/>
   <span id="aria_checkbox" role="checkbox"/>
   <span id="aria_columnheader" role="columnheader"/>
   <span id="aria_combobox" role="combobox"/>
   <span id="aria_dialog" role="dialog"/>
   <span id="aria_directory" role="directory"/>
   <span id="aria_document" role="document"/>
   <span id="aria_form" role="form"/>
   <span id="aria_feed" role="feed"/>
@@ -232,16 +237,17 @@
   <span id="aria_marquee" role="marquee"/>
   <span id="aria_math" role="math"/>
   <span id="aria_menu" role="menu"/>
   <span id="aria_menubar" role="menubar"/>
   <span id="aria_menuitem" role="menuitem"/>
   <span id="aria_menuitemcheckbox" role="menuitemcheckbox"/>
   <span id="aria_menuitemradio" role="menuitemradio"/>
   <span id="aria_note" role="note"/>
+  <span id="aria_paragraph" role="paragraph"/>
   <span id="aria_presentation" role="presentation" tabindex="0"/>
   <span id="aria_progressbar" role="progressbar"/>
   <span id="aria_radio" role="radio"/>
   <span id="aria_radiogroup" role="radiogroup"/>
   <span id="aria_region_no_name" role="region"/>
   <span id="aria_region_has_label" role="region" aria-label="label"/>
   <span id="aria_region_has_labelledby" role="region" aria-labelledby="label"/><span id="label" aria-label="label">
   <span id="aria_region_has_title" role="region" title="title"/>
--- a/accessible/tests/mochitest/role/test_general.html
+++ b/accessible/tests/mochitest/role/test_general.html
@@ -36,17 +36,17 @@
       testRole("aside_overflow", ROLE_NOTE);
       testRole("footer_overflow", ROLE_SECTION);
       testRole("article_overflow", ROLE_ARTICLE);
 
       // test html:div
       testRole("sec", ROLE_SECTION);
 
       // Test html:blockquote
-      testRole("quote", ROLE_SECTION);
+      testRole("quote", ROLE_BLOCKQUOTE);
 
       // Test html:h, all levels
       testRole("head1", ROLE_HEADING);
       testRole("head2", ROLE_HEADING);
       testRole("head3", ROLE_HEADING);
       testRole("head4", ROLE_HEADING);
       testRole("head5", ROLE_HEADING);
       testRole("head6", ROLE_HEADING);
--- a/accessible/tests/mochitest/tree/test_txtcntr.html
+++ b/accessible/tests/mochitest/tree/test_txtcntr.html
@@ -90,17 +90,17 @@
 
       testAccessibleTree("c4", accTree);
 
       // blockquote
       accTree = {
         role: ROLE_SECTION,
         children: [
           { // block quote
-            role: ROLE_SECTION,
+            role: ROLE_BLOCKQUOTE,
             children: [
               { // text child
                 role: ROLE_TEXT_LEAF,
                 name: "Hello",
                 children: []
               }
             ]
           }
--- a/xpcom/ds/nsGkAtomList.h
+++ b/xpcom/ds/nsGkAtomList.h
@@ -878,16 +878,17 @@ GK_ATOM(output, "output")
 GK_ATOM(overflow, "overflow")
 GK_ATOM(overlay, "overlay")
 GK_ATOM(p, "p")
 GK_ATOM(pack, "pack")
 GK_ATOM(page, "page")
 GK_ATOM(pageincrement, "pageincrement")
 GK_ATOM(paint_order, "paint-order")
 GK_ATOM(panel, "panel")
+GK_ATOM(paragraph, "paragraph")
 GK_ATOM(param, "param")
 GK_ATOM(parameter, "parameter")
 GK_ATOM(parent, "parent")
 GK_ATOM(parentfocused, "parentfocused")
 GK_ATOM(password, "password")
 GK_ATOM(pattern, "pattern")
 GK_ATOM(patternSeparator, "pattern-separator")
 GK_ATOM(perMille, "per-mille")