Bug 1351414 - shutdown a moving accessible if it has no insertion point, r=yzen

This commit is contained in:
Alexander Surkov 2017-03-30 15:56:22 -04:00
Родитель 83c58678dc
Коммит 696f8370cf
1 изменённых файлов: 10 добавлений и 7 удалений

Просмотреть файл

@ -2242,18 +2242,21 @@ DocAccessible::MoveChild(Accessible* aChild, Accessible* aNewParent,
return false;
}
MOZ_ASSERT(aIdxInParent <= static_cast<int32_t>(aNewParent->ChildCount()),
"Wrong insertion point for a moving child");
// If the child cannot be re-inserted into the tree, then make sure to remove
// it from its present parent and then shutdown it.
bool hasInsertionPoint = (aIdxInParent != -1) ||
(aIdxInParent <= static_cast<int32_t>(aNewParent->ChildCount()));
TreeMutation rmut(curParent);
rmut.BeforeRemoval(aChild, TreeMutation::kNoShutdown);
rmut.BeforeRemoval(aChild, hasInsertionPoint && TreeMutation::kNoShutdown);
curParent->RemoveChild(aChild);
rmut.Done();
// No insertion point for the child.
if (aIdxInParent == -1) {
return true;
}
if (aIdxInParent > static_cast<int32_t>(aNewParent->ChildCount())) {
MOZ_ASSERT_UNREACHABLE("Wrong insertion point for a moving child");
if (!hasInsertionPoint) {
return true;
}