Bug 1385372 - Allow same id in aria-owns. r=surkov, a=gchang
authorEitan Isaacson <eitan@monotonous.org>
Wed, 09 Aug 2017 12:33:44 -0400
changeset 423513 9924d1eaa5016331df8d779492dc8d01d2fb8d97
parent 423512 ddc4f1a6d5edd9de1a47efbdeff82f7e8021121d
child 423514 a1ac56679ed31c9b0160d72e216da9e46ea57c69
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov, gchang
bugs1385372
milestone56.0
Bug 1385372 - Allow same id in aria-owns. r=surkov, a=gchang
accessible/generic/DocAccessible.cpp
--- a/accessible/generic/DocAccessible.cpp
+++ b/accessible/generic/DocAccessible.cpp
@@ -2103,16 +2103,20 @@ DocAccessible::DoARIAOwnsRelocation(Acce
       continue;
     }
 
 #ifdef A11Y_LOG
   logging::TreeInfo("aria owns traversal", logging::eVerbose,
                     "candidate", child, nullptr);
 #endif
 
+    if (owned->IndexOf(child) < idx) {
+      continue; // ignore second entry of same ID
+    }
+
     // Same child on same position, no change.
     if (child->Parent() == aOwner) {
       int32_t indexInParent = child->IndexInParent();
 
       // The child is being placed in its current index,
       // eg. aria-owns='id1 id2 id3' is changed to aria-owns='id3 id2 id1'.
       if (indexInParent == static_cast<int32_t>(insertIdx)) {
         MOZ_ASSERT(child->IsRelocated(),
@@ -2133,20 +2137,16 @@ DocAccessible::DoARIAOwnsRelocation(Acce
         owned->InsertElementAt(idx, child);
         idx++;
         continue;
       }
     }
 
     MOZ_ASSERT(owned->SafeElementAt(idx) != child, "Already in place!");
 
-    if (owned->IndexOf(child) < idx) {
-      continue; // ignore second entry of same ID
-    }
-
     // A new child is found, check for loops.
     if (child->Parent() != aOwner) {
       Accessible* parent = aOwner;
       while (parent && parent != child && !parent->IsDoc()) {
         parent = parent->Parent();
       }
       // A referred child cannot be a parent of the owner.
       if (parent == child) {