bug 1270916 - call CreateSubtree() before firing a show event for the tree root
authorTrevor Saunders <tbsaunde@tbsaunde.org>
Thu, 10 Nov 2016 23:35:51 -0500
changeset 440428 1b22ff1fe4a66ea222ea4d8217f07c0f84d75911
parent 440427 0919d58c4e9e09a5aab6bce2c703cecd4dcb92c5
child 440429 43708cd293faa60fc2855a437602cb82d8bb9715
push id36216
push userbmo:ato@mozilla.com
push dateThu, 17 Nov 2016 13:57:13 +0000
bugs1270916
milestone53.0a1
bug 1270916 - call CreateSubtree() before firing a show event for the tree root r=davidb This ensures that if creating the sub tree creates events to fire they will go before the show event for the root of the tree. It is fine to fire show events for the subtree before the root because they will just get coalesced away anyway. However it is important that any hide events come before the hidden subtree appears in the new tree.
accessible/generic/DocAccessible.cpp
--- a/accessible/generic/DocAccessible.cpp
+++ b/accessible/generic/DocAccessible.cpp
@@ -1855,18 +1855,18 @@ DocAccessible::ProcessContentInserted(Ac
     }
 
     if (aContainer->InsertAfter(iter.Child(), iter.ChildBefore())) {
 #ifdef A11Y_LOG
       logging::TreeInfo("accessible was inserted", 0,
                         "container", aContainer, "child", iter.Child(), nullptr);
 #endif
 
+      CreateSubtree(iter.Child());
       mt.AfterInsertion(iter.Child());
-      CreateSubtree(iter.Child());
       continue;
     }
 
     MOZ_ASSERT_UNREACHABLE("accessible was rejected");
     iter.Rejected();
   } while (iter.Next());
 
   mt.Done();
@@ -1902,20 +1902,20 @@ DocAccessible::ProcessContentInserted(Ac
       child = GetAccService()->CreateAccessible(aNode, aContainer);
     }
 
     if (child) {
       TreeMutation mt(aContainer);
       if (!aContainer->InsertAfter(child, walker.Prev())) {
         return;
       }
+      CreateSubtree(child);
       mt.AfterInsertion(child);
       mt.Done();
 
-      CreateSubtree(child);
       FireEventsOnInsertion(aContainer);
     }
   }
 
 #ifdef A11Y_LOG
   logging::TreeInfo("children after insertion", logging::eVerbose, aContainer);
 #endif
 }