Bug 1293380: Don't fire show events for child nodes after they're moved to new parent
MozReview-Commit-ID: 1Xz1zH7qRy1
--- 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