Bug 1502875 - Don't call AddToIdTable when moving around a shadow root. r=smaug

This is needed to make the following patch work.

Differential Revision: https://phabricator.services.mozilla.com/D10083
This commit is contained in:
Emilio Cobos Álvarez 2018-10-29 18:22:46 +01:00
Родитель a5c0df3224
Коммит d08ae18dd8
1 изменённых файлов: 8 добавлений и 2 удалений

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

@ -1683,6 +1683,10 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
slots->mBindingParent = aBindingParent; // Weak, so no addref happens.
}
}
const bool hadParent = !!GetParentNode();
const bool wasInShadowTree = IsInShadowTree();
NS_ASSERTION(!aBindingParent || IsRootOfNativeAnonymousSubtree() ||
!HasFlag(NODE_IS_IN_NATIVE_ANONYMOUS_SUBTREE) ||
(aParent && aParent->IsInNativeAnonymousSubtree()),
@ -1706,7 +1710,7 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
}
}
bool hadParent = !!GetParentNode();
MOZ_ASSERT_IF(wasInShadowTree, IsInShadowTree());
// Now set the parent.
if (aParent) {
@ -1837,7 +1841,9 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsNodeUtils::NativeAnonymousChildListChange(this, false);
}
if (HasID()) {
// Ensure we only add to the table once, in the case we move the ShadowRoot
// around.
if (HasID() && !wasInShadowTree) {
AddToIdTable(DoGetID());
}