Bug 1001562 - Make SetXBLInsertionParent(nullptr) and SetXBLBinding(nullptr, ...) lazier. r=smaug

This commit is contained in:
Andrew McCreight 2014-04-28 06:15:08 -07:00
parent 2da264c3e1
commit 510ae624e0
2 changed files with 19 additions and 6 deletions

View File

@ -954,13 +954,16 @@ FragmentOrElement::SetXBLBinding(nsXBLBinding* aBinding,
bindingManager->RemoveFromAttachedQueue(oldBinding);
}
nsDOMSlots *slots = DOMSlots();
if (aBinding) {
SetFlags(NODE_MAY_BE_IN_BINDING_MNGR);
nsDOMSlots *slots = DOMSlots();
slots->mXBLBinding = aBinding;
bindingManager->AddBoundContent(this);
} else {
slots->mXBLBinding = nullptr;
nsDOMSlots *slots = GetExistingDOMSlots();
if (slots) {
slots->mXBLBinding = nullptr;
}
bindingManager->RemoveBoundContent(this);
if (oldBinding) {
oldBinding->SetBoundElement(nullptr);
@ -1011,11 +1014,16 @@ FragmentOrElement::SetShadowRoot(ShadowRoot* aShadowRoot)
void
FragmentOrElement::SetXBLInsertionParent(nsIContent* aContent)
{
nsDOMSlots *slots = DOMSlots();
if (aContent) {
nsDOMSlots *slots = DOMSlots();
SetFlags(NODE_MAY_BE_IN_BINDING_MNGR);
slots->mXBLInsertionParent = aContent;
} else {
nsDOMSlots *slots = GetExistingDOMSlots();
if (slots) {
slots->mXBLInsertionParent = nullptr;
}
}
slots->mXBLInsertionParent = aContent;
}
CustomElementData*

View File

@ -713,11 +713,16 @@ nsGenericDOMDataNode::GetXBLInsertionParent() const
void
nsGenericDOMDataNode::SetXBLInsertionParent(nsIContent* aContent)
{
nsDataSlots *slots = DataSlots();
if (aContent) {
nsDataSlots *slots = DataSlots();
SetFlags(NODE_MAY_BE_IN_BINDING_MNGR);
slots->mXBLInsertionParent = aContent;
} else {
nsDataSlots *slots = GetExistingDataSlots();
if (slots) {
slots->mXBLInsertionParent = nullptr;
}
}
slots->mXBLInsertionParent = aContent;
}
CustomElementData *