Bug 484988 - Make HTML5 parser-performed removals notify but not fire mutation events

This commit is contained in:
Henri Sivonen
2009-05-28 20:42:26 +03:00
parent 54e9a08114
commit f9705d4540
19 changed files with 43 additions and 29 deletions

View File

@@ -3315,14 +3315,14 @@ nsGenericElement::doInsertChildAt(nsIContent* aKid, PRUint32 aIndex,
}
nsresult
nsGenericElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
nsGenericElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify, PRBool aMutationEvent)
{
nsCOMPtr<nsIContent> oldKid = mAttrsAndChildren.GetSafeChildAt(aIndex);
NS_ASSERTION(oldKid == GetChildAt(aIndex), "Unexpected child in RemoveChildAt");
if (oldKid) {
return doRemoveChildAt(aIndex, aNotify, oldKid, this, GetCurrentDoc(),
mAttrsAndChildren);
mAttrsAndChildren, aMutationEvent);
}
return NS_OK;
@@ -3333,7 +3333,8 @@ nsresult
nsGenericElement::doRemoveChildAt(PRUint32 aIndex, PRBool aNotify,
nsIContent* aKid, nsIContent* aParent,
nsIDocument* aDocument,
nsAttrAndChildArray& aChildArray)
nsAttrAndChildArray& aChildArray,
PRBool aMutationEvent)
{
NS_PRECONDITION(aParent || aDocument, "Must have document if no parent!");
NS_PRECONDITION(!aParent || aParent->GetCurrentDoc() == aDocument,
@@ -3369,6 +3370,7 @@ nsGenericElement::doRemoveChildAt(PRUint32 aIndex, PRBool aNotify,
mozAutoSubtreeModified subtree(nsnull, nsnull);
if (aNotify &&
aMutationEvent &&
nsContentUtils::HasMutationListeners(aKid,
NS_EVENT_BITS_MUTATION_NODEREMOVED, container)) {
mozAutoRemovableBlockerRemover blockerRemover;