Bug 1357100 - change implicit val for aria-level on a heading to 2 r=Jamie
authorGautham Velchuru <gvelchuru@gmail.com>
Fri, 23 Aug 2019 01:28:13 +0000
changeset 553289 54d0977adb446888899d91be9ab9a5276ccbd012
parent 553288 41bb079385e1b88c6c216af7297f63b294e1995f
child 553290 5df00af5913e90ba7c60411e1e6cb78c2f7c46e0
push id2165
push userffxbld-merge
push dateMon, 14 Oct 2019 16:30:58 +0000
treeherdermozilla-release@0eae18af659f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersJamie
bugs1357100
milestone70.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 1357100 - change implicit val for aria-level on a heading to 2 r=Jamie Differential Revision: https://phabricator.services.mozilla.com/D35616
accessible/generic/Accessible.cpp
accessible/tests/mochitest/attributes/test_obj_group.html
--- a/accessible/generic/Accessible.cpp
+++ b/accessible/generic/Accessible.cpp
@@ -1163,17 +1163,24 @@ GroupPos Accessible::GroupPosition() {
 
   // If ARIA is missed and the accessible is visible then calculate group
   // position from hierarchy.
   if (State() & states::INVISIBLE) return groupPos;
 
   // Calculate group level if ARIA is missed.
   if (groupPos.level == 0) {
     int32_t level = GetLevelInternal();
-    if (level != 0) groupPos.level = level;
+    if (level != 0) {
+      groupPos.level = level;
+    } else {
+      const nsRoleMapEntry* role = this->ARIARoleMap();
+      if (role && role->Is(nsGkAtoms::heading)) {
+        groupPos.level = 2;
+      }
+    }
   }
 
   // Calculate position in group and group size if ARIA is missed.
   if (groupPos.posInSet == 0 || groupPos.setSize == 0) {
     int32_t posInSet = 0, setSize = 0;
     GetPositionAndSizeInternal(&posInSet, &setSize);
     if (posInSet != 0 && setSize != 0) {
       if (groupPos.posInSet == 0) groupPos.posInSet = posInSet;
@@ -1935,17 +1942,18 @@ void Accessible::AppendTextTo(nsAString&
     aText += kImaginaryEmbeddedObjectChar;
   } else {
     aText += kEmbeddedObjectChar;
   }
 }
 
 void Accessible::Shutdown() {
   // Mark the accessible as defunct, invalidate the child count and pointers to
-  // other accessibles, also make sure none of its children point to this parent
+  // other accessibles, also make sure none of its children point to this
+  // parent
   mStateFlags |= eIsDefunct;
 
   int32_t childCount = mChildren.Length();
   for (int32_t childIdx = 0; childIdx < childCount; childIdx++) {
     mChildren.ElementAt(childIdx)->UnbindFromParent();
   }
   mChildren.Clear();
 
--- a/accessible/tests/mochitest/attributes/test_obj_group.html
+++ b/accessible/tests/mochitest/attributes/test_obj_group.html
@@ -206,16 +206,17 @@
       // ////////////////////////////////////////////////////////////////////////
       // HTML headings
       testGroupAttrs("h1", 0, 0, 1);
       testGroupAttrs("h2", 0, 0, 2);
       testGroupAttrs("h3", 0, 0, 3);
       testGroupAttrs("h4", 0, 0, 4);
       testGroupAttrs("h5", 0, 0, 5);
       testGroupAttrs("h6", 0, 0, 6);
+      testGroupAttrs("ariaHeadingNoLevel", 0, 0, 2);
       // No child item counts or "hierarchical" flag for parent of headings
       testAbsentAttrs("headings", {"child-item-count": "", "hierarchical": ""});
 
       // ////////////////////////////////////////////////////////////////////////
       // ARIA combobox
       testGroupAttrs("combo1_opt1", 1, 4);
       testGroupAttrs("combo1_opt2", 2, 4);
       testGroupAttrs("combo1_opt3", 3, 4);
@@ -482,16 +483,17 @@
 
   <div id="headings">
     <h1 id="h1">heading1</h1>
     <h2 id="h2">heading2</h2>
     <h3 id="h3">heading3</h3>
     <h4 id="h4">heading4</h4>
     <h5 id="h5">heading5</h5>
     <h6 id="h6">heading6</h6>
+    <div id="ariaHeadingNoLevel" role="heading">ariaHeadingNoLevel</div>
   </div>
 
   <ul id="combo1" role="combobox">Password
     <li id="combo1_opt1" role="option">Xyzzy</li>
     <li id="combo1_opt2" role="option">Plughs</li>
     <li id="combo1_opt3" role="option">Shazaam</li>
     <li id="combo1_opt4" role="option">JoeSentMe</li>
   </ul>