Bug 1293380: Don't fire show events for child nodes after they're moved to new parent draft
authorMichael Li <michael.li11702@gmail.com>
Mon, 08 Aug 2016 16:21:56 -0400
changeset 398181 59ab92c9ef452811786eba024dc25cdba77eaab4
parent 398124 e35f07bea6e782e5bbccc4f197cc8e8bc9e2d97d
child 398206 76834ec5e28ce580966efca4fb42f8b31c54b51e
push id25471
push userbmo:mili@mozilla.com
push dateMon, 08 Aug 2016 20:22:26 +0000
bugs1293380
milestone51.0a1
Bug 1293380: Don't fire show events for child nodes after they're moved to new parent MozReview-Commit-ID: 1Xz1zH7qRy1
accessible/generic/Accessible.cpp
accessible/generic/DocAccessible.cpp
--- a/accessible/generic/Accessible.cpp
+++ b/accessible/generic/Accessible.cpp
@@ -2175,17 +2175,18 @@ Accessible::MoveChild(uint32_t aNewIndex
   }
 
   for (uint32_t idx = startIdx; idx <= endIdx; idx++) {
     mChildren[idx]->mIndexInParent = idx;
     mChildren[idx]->mStateFlags |= eGroupInfoDirty;
     mChildren[idx]->mInt.mIndexOfEmbeddedChild = -1;
   }
 
-  if (eventTree) {
+  // Only add a show event if it's a direct child of the root
+  if (eventTree && aChild->Document() == aChild->Parent()) {
     eventTree->Shown(aChild);
     mDoc->Controller()->QueueNameChange(aChild);
   }
 }
 
 Accessible*
 Accessible::GetChildAt(uint32_t aIndex) const
 {
--- a/accessible/generic/DocAccessible.cpp
+++ b/accessible/generic/DocAccessible.cpp
@@ -2175,17 +2175,20 @@ DocAccessible::MoveChild(Accessible* aCh
 
   // No insertion point for the child.
   if (aIdxInParent == -1) {
     return true;
   }
 
   TreeMutation imut(aNewParent);
   aNewParent->InsertChildAt(aIdxInParent, aChild);
-  imut.AfterInsertion(aChild);
+  // Only add a show event if it's a direct child of the root
+  if (aChild->Document() == aNewParent) {
+    imut.AfterInsertion(aChild);
+  }
   imut.Done();
 
 #ifdef A11Y_LOG
   logging::TreeInfo("move child: old parent tree after",
                     logging::eVerbose, curParent);
   logging::TreeInfo("move child: new parent tree after",
                     logging::eVerbose, aNewParent);
 #endif