Bug 794620 - group position of HTML radio buttons can be incorrect, r=surkov
authorAishwarya <aiishwarya.sivaraman@gmail.com>
Fri, 22 Feb 2013 01:31:40 +0900
changeset 122552 6a7e8e9791be7ee8e8a19f1be34a7bcbd3297b51
parent 122551 359ba50430a9095532b55a1f26823e633a97a268
child 122553 601c2d37c2bc9d7943807e9a3a94b665eb1ef7d0
push id23366
push usersurkov.alexander@gmail.com
push dateThu, 21 Feb 2013 16:28:09 +0000
treeherdermozilla-inbound@6a7e8e9791be [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov
bugs794620
milestone22.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 794620 - group position of HTML radio buttons can be incorrect, r=surkov
accessible/src/html/HTMLFormControlAccessible.cpp
accessible/tests/mochitest/attributes/test_obj_group.html
--- a/accessible/src/html/HTMLFormControlAccessible.cpp
+++ b/accessible/src/html/HTMLFormControlAccessible.cpp
@@ -167,18 +167,18 @@ HTMLRadioButtonAccessible::GetPositionAn
   int32_t indexOf = 0;
   int32_t count = 0;
 
   for (uint32_t index = 0; index < inputCount; index++) {
     nsIContent* inputElm = inputElms->Item(index, false);
     if (inputElm->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
                               type, eCaseMatters) &&
         inputElm->AttrValueIs(kNameSpaceID_None, nsGkAtoms::name,
-                              name, eCaseMatters)) {
-      count++;
+                              name, eCaseMatters) && mDoc->HasAccessible(inputElm)) {
+        count++;
       if (inputElm == mContent)
         indexOf = count;
     }
   }
 
   *aPosInSet = indexOf;
   *aSetSize = count;
 }
--- a/accessible/tests/mochitest/attributes/test_obj_group.html
+++ b/accessible/tests/mochitest/attributes/test_obj_group.html
@@ -36,16 +36,20 @@
       testGroupAttrs("radio2", 2, 2);
 
       //////////////////////////////////////////////////////////////////////////
       // HTML input@type="radio" within document
       testGroupAttrs("radio3", 1, 2);
       testGroupAttrs("radio4", 2, 2);
 
       //////////////////////////////////////////////////////////////////////////
+      // Hidden HTML input@type="radio"
+      testGroupAttrs("radio5", 1, 1);
+
+      //////////////////////////////////////////////////////////////////////////
       // HTML ul/ol
       testGroupAttrs("li1", 1, 3);
       testGroupAttrs("li2", 2, 3);
       testGroupAttrs("li3", 3, 3);
 
       //////////////////////////////////////////////////////////////////////////
       // HTML ul/ol (nested lists)
 
@@ -314,10 +318,14 @@
 
   <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>
 
+  <form>
+    <input type="radio" style="display: none;" name="group3">
+    <input type="radio" id="radio5" name="group3">
+  </form>
 </body>
 </html>