Bug 971212 - Implement ARIA role=none, r=davidb
authorAlexander Surkov <surkov.alexander@gmail.com>
Thu, 19 Feb 2015 12:50:34 -0500
changeset 229920 06d87431a1aea07bfa4e8e0df47bddc6e9504215
parent 229919 d0b21535d0a280631652a0c660734b313aa3a942
child 229921 a286c01c617c1eb8a0c45e61d49b718995da19d2
push id11399
push userryanvm@gmail.com
push dateFri, 20 Feb 2015 00:03:38 +0000
treeherderfx-team@51458a066fda [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdavidb
bugs971212
milestone38.0a1
Bug 971212 - Implement ARIA role=none, r=davidb
accessible/base/ARIAMap.cpp
accessible/base/nsAccessibilityService.cpp
accessible/tests/mochitest/tree/test_aria_presentation.html
--- a/accessible/base/ARIAMap.cpp
+++ b/accessible/base/ARIAMap.cpp
@@ -361,16 +361,26 @@ static nsRoleMapEntry sWAIRoleMaps[] =
     kUseMapRole,
     eNoValue,
     eClickAction,
     eNoLiveAttr,
     kGenericAccType,
     kNoReqStates,
     eARIACheckableBool
   },
+  { // none
+    &nsGkAtoms::none,
+    roles::NOTHING,
+    kUseMapRole,
+    eNoValue,
+    eNoAction,
+    eNoLiveAttr,
+    kGenericAccType,
+    kNoReqStates
+  },
   { // note
     &nsGkAtoms::note_,
     roles::NOTE,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
     kGenericAccType,
--- a/accessible/base/nsAccessibilityService.cpp
+++ b/accessible/base/nsAccessibilityService.cpp
@@ -957,17 +957,19 @@ nsAccessibilityService::GetOrCreateAcces
     return newAcc;
   }
 
   nsRoleMapEntry* roleMapEntry = aria::GetRoleMap(aNode);
 
   // If the element is focusable or global ARIA attribute is applied to it or
   // it is referenced by ARIA relationship then treat role="presentation" on
   // the element as the role is not there.
-  if (roleMapEntry && roleMapEntry->Is(nsGkAtoms::presentation)) {
+  if (roleMapEntry &&
+      (roleMapEntry->Is(nsGkAtoms::presentation) ||
+       roleMapEntry->Is(nsGkAtoms::none))) {
     if (!MustBeAccessible(content, document))
       return nullptr;
 
     roleMapEntry = nullptr;
   }
 
   if (!newAcc && isHTML) {  // HTML accessibles
     bool isARIATableOrCell = roleMapEntry &&
--- a/accessible/tests/mochitest/tree/test_aria_presentation.html
+++ b/accessible/tests/mochitest/tree/test_aria_presentation.html
@@ -16,122 +16,168 @@
           src="../role.js"></script>
 
   <script type="application/javascript">
   function doTest()
   {
     // Presentation role don't allow accessible.
     var tree =
       { SECTION: [ // container
-        { TEXT_LEAF: [ ] } // child text of presentation node
+        { TEXT_LEAF: [ ] }, // child text of 'presentation' node
+        { TEXT_LEAF: [ ] } // child text of 'none' node
       ] };
     testAccessibleTree("div_cnt", tree);
 
-    // Focusable element, presentation role is ignored.
+    // Focusable element, 'presentation' and 'none' roles are ignored.
     tree =
       { SECTION: [ // container
-        { PUSHBUTTON: [ // button
+        { PUSHBUTTON: [ // button having 'presentation' role
+          { TEXT_LEAF: [ ] }
+        ] },
+        { PUSHBUTTON: [ // button having 'none' role
           { TEXT_LEAF: [ ] }
         ] }
       ] };
     testAccessibleTree("btn_cnt", tree);
 
     // Presentation table, no table structure is exposed.
     tree =
       { SECTION: [ // container
-        { TEXT_CONTAINER: [ // td generic accessible
+        { TEXT_CONTAINER: [ // td generic accessible inside 'presentation' table
+          { TEXT_LEAF: [ ] } // cell text
+        ] },
+        { TEXT_CONTAINER: [ // td generic accessible inside 'none' table
           { TEXT_LEAF: [ ] } // cell text
         ] }
       ] };
     testAccessibleTree("tbl_cnt", tree);
 
-    // Focusable table, presentation role is ignored.
+    // Focusable table, 'presentation' and 'none' roles are ignored.
     tree =
       { SECTION: [ // container
-        { TABLE: [ // table
+        { TABLE: [ // table having 'presentation' role
           { ROW: [ // tr
-            { CELL: [ //td
+            { CELL: [ // td
+              { TEXT_LEAF: [ ] }
+            ] }
+          ] }
+        ] },
+        { TABLE: [ // table having 'none' role
+          { ROW: [ // tr
+            { CELL: [ // td
               { TEXT_LEAF: [ ] }
             ] }
           ] }
         ] }
       ] };
     testAccessibleTree("tblfocusable_cnt", tree);
 
     // Presentation list, expose generic accesisble for list items.
     tree =
       { SECTION: [ // container
-        { PARAGRAPH: [ // li generic accessible
+        { PARAGRAPH: [ // li generic accessible inside 'presentation' role
+          { TEXT_LEAF: [ ] } // li text
+        ] },
+        { PARAGRAPH: [ // li generic accessible inside 'none' role
           { TEXT_LEAF: [ ] } // li text
         ] }
       ] };
     testAccessibleTree("list_cnt", tree);
 
-    // Has ARIA globals or referred by ARIA relationship.
+    // Has ARIA globals or referred by ARIA relationship, role='presentation'
+    // and role='none' are ignored.
     tree =
       { SECTION: [ // container
         { LABEL: [ // label, has aria-owns
           { TEXT_LEAF: [ ] }
         ] },
         { TEXT_LEAF: [ ] },
         { LABEL: [ // label, referenced by aria-owns
           { TEXT_LEAF: [ ] }
+        ] },
+        { TEXT_LEAF: [ ] },
+        { LABEL: [ // label, has aria-owns
+          { TEXT_LEAF: [ ] }
+        ] },
+        { TEXT_LEAF: [ ] },
+        { LABEL: [ // label, referenced by aria-owns
+          { TEXT_LEAF: [ ] }
         ] }
       ] };
     testAccessibleTree("airaglobalprop_cnt", tree);
 
     SimpleTest.finish();
   }
 
   SimpleTest.waitForExplicitFinish();
   addA11yLoadEvent(doTest);
   </script>
 </head>
 <body>
 
   <a target="_blank"
      href="https://bugzilla.mozilla.org/show_bug.cgi?id=548291"
      title="Accessible tree of ARIA image maps">
-    Mozilla Bug 548291
+    Bug 548291
   </a>
   <a target="_blank"
      href="https://bugzilla.mozilla.org/show_bug.cgi?id=666504"
      title="Ignore role presentation on focusable elements">
-    Mozilla Bug 666504
+    Bug 666504
+  </a>
+  <a target="_blank"
+     href="https://bugzilla.mozilla.org/show_bug.cgi?id=971212"
+     title="Implement ARIA role=none">
+    Bug 971212
   </a>
   <p id="display"></p>
   <div id="content" style="display: none"></div>
   <pre id="test">
   </pre>
 
-  <div id="div_cnt"><div role="presentation">text</div></div>
+  <div id="div_cnt"><div role="presentation">t</div><div role="none">t</div></div>
 
-  <div id="btn_cnt"><button role="presentation">btn</button></div>
+  <div id="btn_cnt"><button role="presentation">btn</button><button role="none">btn</button></div>
 
   <div id="tbl_cnt">
     <table role="presentation">
       <tr>
         <td>cell</td>
       </tr>
     </table>
+    <table role="none">
+      <tr>
+        <td>cell</td>
+      </tr>
+    </table>
   </div>
 
   <div id="tblfocusable_cnt">
     <table role="presentation" tabindex="0">
       <tr>
         <td>cell</td>
       </tr>
     </table>
+    <table role="none" tabindex="0">
+      <tr>
+        <td>cell</td>
+      </tr>
+    </table>
   </div>
 
   <div id="list_cnt">
     <ul role="presentation">
       <li>item</li>
     </ul>
+    <ul role="none">
+      <li>item</li>
+    </ul>
   </div>
 
   <div id="airaglobalprop_cnt">
     <label role="presentation" aria-owns="ariaowned">has aria-owns</label>
     <label role="presentation" id="ariaowned">referred by aria-owns</label>
+    <label role="none" aria-owns="ariaowned2">has aria-owns</label>
+    <label role="none" id="ariaowned2">referred by aria-owns</label>
   </div>
 
 </body>
 </html>