Bug 1442207: Remove unneeded arguments to nsIMutationObserver. r=smaug

aDocument is always content->OwnerDoc().
aContainer is always content->GetParent().

Differential Revision: https://phabricator.services.mozilla.com/D664

MozReview-Commit-ID: 4xwPCOnhyIL
This commit is contained in:
Emilio Cobos Álvarez
2018-03-01 12:36:58 +01:00
parent 8c82b58930
commit 0ff849122a
42 changed files with 369 additions and 729 deletions

View File

@@ -702,10 +702,10 @@ NS_IMPL_NSIDOCUMENTOBSERVER_LOAD_STUB(DocAccessible)
NS_IMPL_NSIDOCUMENTOBSERVER_STYLE_STUB(DocAccessible) NS_IMPL_NSIDOCUMENTOBSERVER_STYLE_STUB(DocAccessible)
void void
DocAccessible::AttributeWillChange(nsIDocument* aDocument, DocAccessible::AttributeWillChange(dom::Element* aElement,
dom::Element* aElement,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsAtom* aAttribute, int32_t aModType, nsAtom* aAttribute,
int32_t aModType,
const nsAttrValue* aNewValue) const nsAttrValue* aNewValue)
{ {
Accessible* accessible = GetAccessible(aElement); Accessible* accessible = GetAccessible(aElement);
@@ -748,15 +748,13 @@ DocAccessible::AttributeWillChange(nsIDocument* aDocument,
} }
void void
DocAccessible::NativeAnonymousChildListChange(nsIDocument* aDocument, DocAccessible::NativeAnonymousChildListChange(nsIContent* aContent,
nsIContent* aContent,
bool aIsRemove) bool aIsRemove)
{ {
} }
void void
DocAccessible::AttributeChanged(nsIDocument* aDocument, DocAccessible::AttributeChanged(dom::Element* aElement,
dom::Element* aElement,
int32_t aNameSpaceID, nsAtom* aAttribute, int32_t aNameSpaceID, nsAtom* aAttribute,
int32_t aModType, int32_t aModType,
const nsAttrValue* aOldValue) const nsAttrValue* aOldValue)
@@ -1086,9 +1084,7 @@ DocAccessible::ARIAActiveDescendantChanged(Accessible* aAccessible)
} }
void void
DocAccessible::ContentAppended(nsIDocument* aDocument, DocAccessible::ContentAppended(nsIContent* aFirstNewContent)
nsIContent* aContainer,
nsIContent* aFirstNewContent)
{ {
} }
@@ -1139,35 +1135,30 @@ DocAccessible::DocumentStatesChanged(nsIDocument* aDocument,
} }
void void
DocAccessible::CharacterDataWillChange(nsIDocument* aDocument, DocAccessible::CharacterDataWillChange(nsIContent* aContent,
nsIContent* aContent,
const CharacterDataChangeInfo&) const CharacterDataChangeInfo&)
{ {
} }
void void
DocAccessible::CharacterDataChanged(nsIDocument* aDocument, DocAccessible::CharacterDataChanged(nsIContent* aContent,
nsIContent* aContent,
const CharacterDataChangeInfo&) const CharacterDataChangeInfo&)
{ {
} }
void void
DocAccessible::ContentInserted(nsIDocument* aDocument, nsIContent* aContainer, DocAccessible::ContentInserted(nsIContent* aChild)
nsIContent* aChild)
{ {
} }
void void
DocAccessible::ContentRemoved(nsIDocument* aDocument, DocAccessible::ContentRemoved(nsIContent* aChildNode,
nsIContent* aContainerNode,
nsIContent* aChildNode,
nsIContent* aPreviousSiblingNode) nsIContent* aPreviousSiblingNode)
{ {
#ifdef A11Y_LOG #ifdef A11Y_LOG
if (logging::IsEnabled(logging::eTree)) { if (logging::IsEnabled(logging::eTree)) {
logging::MsgBegin("TREE", "DOM content removed; doc: %p", this); logging::MsgBegin("TREE", "DOM content removed; doc: %p", this);
logging::Node("container node", aContainerNode); logging::Node("container node", aChildNode->GetParent());
logging::Node("content node", aChildNode); logging::Node("content node", aChildNode);
logging::MsgEnd(); logging::MsgEnd();
} }

View File

@@ -253,23 +253,20 @@ nsSHEntryShared::NodeWillBeDestroyed(const nsINode* aNode)
} }
void void
nsSHEntryShared::CharacterDataWillChange(nsIDocument* aDocument, nsSHEntryShared::CharacterDataWillChange(nsIContent* aContent,
nsIContent* aContent,
const CharacterDataChangeInfo&) const CharacterDataChangeInfo&)
{ {
} }
void void
nsSHEntryShared::CharacterDataChanged(nsIDocument* aDocument, nsSHEntryShared::CharacterDataChanged(nsIContent* aContent,
nsIContent* aContent,
const CharacterDataChangeInfo&) const CharacterDataChangeInfo&)
{ {
RemoveFromBFCacheAsync(); RemoveFromBFCacheAsync();
} }
void void
nsSHEntryShared::AttributeWillChange(nsIDocument* aDocument, nsSHEntryShared::AttributeWillChange(dom::Element* aContent,
dom::Element* aContent,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsAtom* aAttribute, nsAtom* aAttribute,
int32_t aModType, int32_t aModType,
@@ -278,15 +275,13 @@ nsSHEntryShared::AttributeWillChange(nsIDocument* aDocument,
} }
void void
nsSHEntryShared::NativeAnonymousChildListChange(nsIDocument* aDocument, nsSHEntryShared::NativeAnonymousChildListChange(nsIContent* aContent,
nsIContent* aContent,
bool aIsRemove) bool aIsRemove)
{ {
} }
void void
nsSHEntryShared::AttributeChanged(nsIDocument* aDocument, nsSHEntryShared::AttributeChanged(dom::Element* aElement,
dom::Element* aElement,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsAtom* aAttribute, nsAtom* aAttribute,
int32_t aModType, int32_t aModType,
@@ -296,25 +291,19 @@ nsSHEntryShared::AttributeChanged(nsIDocument* aDocument,
} }
void void
nsSHEntryShared::ContentAppended(nsIDocument* aDocument, nsSHEntryShared::ContentAppended(nsIContent* aFirstNewContent)
nsIContent* aContainer,
nsIContent* aFirstNewContent)
{ {
RemoveFromBFCacheAsync(); RemoveFromBFCacheAsync();
} }
void void
nsSHEntryShared::ContentInserted(nsIDocument* aDocument, nsSHEntryShared::ContentInserted(nsIContent* aChild)
nsIContent* aContainer,
nsIContent* aChild)
{ {
RemoveFromBFCacheAsync(); RemoveFromBFCacheAsync();
} }
void void
nsSHEntryShared::ContentRemoved(nsIDocument* aDocument, nsSHEntryShared::ContentRemoved(nsIContent* aChild,
nsIContent* aContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling) nsIContent* aPreviousSibling)
{ {
RemoveFromBFCacheAsync(); RemoveFromBFCacheAsync();

View File

@@ -224,12 +224,10 @@ NodeIterator::Detach()
* nsIMutationObserver interface * nsIMutationObserver interface
*/ */
void NodeIterator::ContentRemoved(nsIDocument *aDocument, void NodeIterator::ContentRemoved(nsIContent* aChild,
nsIContent *aContainer, nsIContent* aPreviousSibling)
nsIContent *aChild,
nsIContent *aPreviousSibling)
{ {
nsINode *container = NODE_FROM(aContainer, aDocument); nsINode* container = aChild->GetParentNode();
mPointer.AdjustAfterRemoval(mRoot, container, aChild, aPreviousSibling); mPointer.AdjustAfterRemoval(mRoot, container, aChild, aPreviousSibling);
mWorkingPointer.AdjustAfterRemoval(mRoot, container, aChild, aPreviousSibling); mWorkingPointer.AdjustAfterRemoval(mRoot, container, aChild, aPreviousSibling);

View File

@@ -438,8 +438,7 @@ ShadowRoot::SetInnerHTML(const nsAString& aInnerHTML, ErrorResult& aError)
} }
void void
ShadowRoot::AttributeChanged(nsIDocument* aDocument, ShadowRoot::AttributeChanged(Element* aElement,
Element* aElement,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsAtom* aAttribute, nsAtom* aAttribute,
int32_t aModType, int32_t aModType,
@@ -468,26 +467,22 @@ ShadowRoot::AttributeChanged(nsIDocument* aDocument,
} }
void void
ShadowRoot::ContentAppended(nsIDocument* aDocument, ShadowRoot::ContentAppended(nsIContent* aFirstNewContent)
nsIContent* aContainer,
nsIContent* aFirstNewContent)
{ {
for (nsIContent* content = aFirstNewContent; for (nsIContent* content = aFirstNewContent;
content; content;
content = content->GetNextSibling()) { content = content->GetNextSibling()) {
ContentInserted(aDocument, aContainer, content); ContentInserted(content);
} }
} }
void void
ShadowRoot::ContentInserted(nsIDocument* aDocument, ShadowRoot::ContentInserted(nsIContent* aChild)
nsIContent* aContainer,
nsIContent* aChild)
{ {
// Check to ensure that the content is in the same anonymous tree // Check to ensure that the child not an anonymous subtree root because
// as the container because anonymous content may report its container // even though its parent could be the host it may not be in the host's child
// as the host but it may not be in the host's child list. // list.
if (!nsContentUtils::IsInSameAnonymousTree(aContainer, aChild)) { if (aChild->IsRootOfAnonymousSubtree()) {
return; return;
} }
@@ -495,7 +490,7 @@ ShadowRoot::ContentInserted(nsIDocument* aDocument,
return; return;
} }
if (aContainer && aContainer == GetHost()) { if (aChild->GetParent() == GetHost()) {
if (const HTMLSlotElement* slot = AssignSlotFor(aChild)) { if (const HTMLSlotElement* slot = AssignSlotFor(aChild)) {
slot->EnqueueSlotChangeEvent(); slot->EnqueueSlotChangeEvent();
} }
@@ -504,7 +499,7 @@ ShadowRoot::ContentInserted(nsIDocument* aDocument,
// If parent's root is a shadow root, and parent is a slot whose assigned // If parent's root is a shadow root, and parent is a slot whose assigned
// nodes is the empty list, then run signal a slot change for parent. // nodes is the empty list, then run signal a slot change for parent.
HTMLSlotElement* slot = HTMLSlotElement::FromContentOrNull(aContainer); HTMLSlotElement* slot = HTMLSlotElement::FromContentOrNull(aChild->GetParent());
if (slot && slot->GetContainingShadow() == this && if (slot && slot->GetContainingShadow() == this &&
slot->AssignedNodes().IsEmpty()) { slot->AssignedNodes().IsEmpty()) {
slot->EnqueueSlotChangeEvent(); slot->EnqueueSlotChangeEvent();
@@ -512,15 +507,12 @@ ShadowRoot::ContentInserted(nsIDocument* aDocument,
} }
void void
ShadowRoot::ContentRemoved(nsIDocument* aDocument, ShadowRoot::ContentRemoved(nsIContent* aChild, nsIContent* aPreviousSibling)
nsIContent* aContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling)
{ {
// Check to ensure that the content is in the same anonymous tree // Check to ensure that the child not an anonymous subtree root because
// as the container because anonymous content may report its container // even though its parent could be the host it may not be in the host's child
// as the host but it may not be in the host's child list. // list.
if (!nsContentUtils::IsInSameAnonymousTree(aContainer, aChild)) { if (aChild->IsRootOfAnonymousSubtree()) {
return; return;
} }
@@ -528,7 +520,7 @@ ShadowRoot::ContentRemoved(nsIDocument* aDocument,
return; return;
} }
if (aContainer && aContainer == GetHost()) { if (aChild->GetParent() == GetHost()) {
nsAutoString slotName; nsAutoString slotName;
if (aChild->IsElement()) { if (aChild->IsElement()) {
aChild->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::slot, slotName); aChild->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::slot, slotName);
@@ -541,7 +533,7 @@ ShadowRoot::ContentRemoved(nsIDocument* aDocument,
// If parent's root is a shadow root, and parent is a slot whose assigned // If parent's root is a shadow root, and parent is a slot whose assigned
// nodes is the empty list, then run signal a slot change for parent. // nodes is the empty list, then run signal a slot change for parent.
HTMLSlotElement* slot = HTMLSlotElement::FromContentOrNull(aContainer); HTMLSlotElement* slot = HTMLSlotElement::FromContentOrNull(aChild->GetParent());
if (slot && slot->GetContainingShadow() == this && if (slot && slot->GetContainingShadow() == this &&
slot->AssignedNodes().IsEmpty()) { slot->AssignedNodes().IsEmpty()) {
slot->EnqueueSlotChangeEvent(); slot->EnqueueSlotChangeEvent();

View File

@@ -681,8 +681,7 @@ nsContentList::Item(uint32_t aIndex)
} }
void void
nsContentList::AttributeChanged(nsIDocument* aDocument, nsContentList::AttributeChanged(Element* aElement,
Element* aElement,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsAtom* aAttribute, nsAtom* aAttribute,
int32_t aModType, int32_t aModType,
@@ -715,25 +714,24 @@ nsContentList::AttributeChanged(nsIDocument* aDocument,
} }
void void
nsContentList::ContentAppended(nsIDocument* aDocument, nsContentList::ContentAppended(nsIContent* aFirstNewContent)
nsIContent* aContainer,
nsIContent* aFirstNewContent)
{ {
NS_PRECONDITION(aContainer, "Can't get at the new content if no container!"); nsIContent* container = aFirstNewContent->GetParent();
NS_PRECONDITION(container, "Can't get at the new content if no container!");
/* /*
* If the state is LIST_DIRTY then we have no useful information in our list * If the state is LIST_DIRTY then we have no useful information in our list
* and we want to put off doing work as much as possible. * and we want to put off doing work as much as possible.
* *
* Also, if aContainer is anonymous from our point of view, we know that we * Also, if container is anonymous from our point of view, we know that we
* can't possibly be matching any of the kids. * can't possibly be matching any of the kids.
* *
* Optimize out also the common case when just one new node is appended and * Optimize out also the common case when just one new node is appended and
* it doesn't match us. * it doesn't match us.
*/ */
if (mState == LIST_DIRTY || if (mState == LIST_DIRTY ||
!nsContentUtils::IsInSameAnonymousTree(mRootNode, aContainer) || !nsContentUtils::IsInSameAnonymousTree(mRootNode, container) ||
!MayContainRelevantNodes(aContainer) || !MayContainRelevantNodes(container) ||
(!aFirstNewContent->HasChildren() && (!aFirstNewContent->HasChildren() &&
!aFirstNewContent->GetNextSibling() && !aFirstNewContent->GetNextSibling() &&
!MatchSelf(aFirstNewContent))) { !MatchSelf(aFirstNewContent))) {
@@ -749,7 +747,7 @@ nsContentList::ContentAppended(nsIDocument* aDocument,
* already have. * already have.
*/ */
int32_t count = aContainer->GetChildCount(); int32_t count = container->GetChildCount();
if (count > 0) { if (count > 0) {
uint32_t ourCount = mElements.Length(); uint32_t ourCount = mElements.Length();
@@ -800,7 +798,7 @@ nsContentList::ContentAppended(nsIDocument* aDocument,
if (mDeep) { if (mDeep) {
for (nsIContent* cur = aFirstNewContent; for (nsIContent* cur = aFirstNewContent;
cur; cur;
cur = cur->GetNextNode(aContainer)) { cur = cur->GetNextNode(container)) {
if (cur->IsElement() && Match(cur->AsElement())) { if (cur->IsElement() && Match(cur->AsElement())) {
mElements.AppendElement(cur); mElements.AppendElement(cur);
} }
@@ -818,15 +816,13 @@ nsContentList::ContentAppended(nsIDocument* aDocument,
} }
void void
nsContentList::ContentInserted(nsIDocument *aDocument, nsContentList::ContentInserted(nsIContent* aChild)
nsIContent* aContainer,
nsIContent* aChild)
{ {
// Note that aContainer can be null here if we are inserting into // Note that aChild->GetParentNode() can be null here if we are inserting into
// the document itself; any attempted optimizations to this method // the document itself; any attempted optimizations to this method should deal
// should deal with that. // with that.
if (mState != LIST_DIRTY && if (mState != LIST_DIRTY &&
MayContainRelevantNodes(NODE_FROM(aContainer, aDocument)) && MayContainRelevantNodes(aChild->GetParentNode()) &&
nsContentUtils::IsInSameAnonymousTree(mRootNode, aChild) && nsContentUtils::IsInSameAnonymousTree(mRootNode, aChild) &&
MatchSelf(aChild)) { MatchSelf(aChild)) {
SetDirty(); SetDirty();
@@ -836,16 +832,11 @@ nsContentList::ContentInserted(nsIDocument *aDocument,
} }
void void
nsContentList::ContentRemoved(nsIDocument *aDocument, nsContentList::ContentRemoved(nsIContent* aChild,
nsIContent* aContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling) nsIContent* aPreviousSibling)
{ {
// Note that aContainer can be null here if we are removing from
// the document itself; any attempted optimizations to this method
// should deal with that.
if (mState != LIST_DIRTY && if (mState != LIST_DIRTY &&
MayContainRelevantNodes(NODE_FROM(aContainer, aDocument)) && MayContainRelevantNodes(aChild->GetParentNode()) &&
nsContentUtils::IsInSameAnonymousTree(mRootNode, aChild) && nsContentUtils::IsInSameAnonymousTree(mRootNode, aChild) &&
MatchSelf(aChild)) { MatchSelf(aChild)) {
SetDirty(); SetDirty();
@@ -1113,8 +1104,7 @@ nsCachableElementsByNameNodeList::WrapObject(JSContext *cx, JS::Handle<JSObject*
} }
void void
nsCachableElementsByNameNodeList::AttributeChanged(nsIDocument* aDocument, nsCachableElementsByNameNodeList::AttributeChanged(Element* aElement,
Element* aElement,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsAtom* aAttribute, nsAtom* aAttribute,
int32_t aModType, int32_t aModType,
@@ -1126,7 +1116,7 @@ nsCachableElementsByNameNodeList::AttributeChanged(nsIDocument* aDocument,
return; return;
} }
nsCacheableFuncStringContentList::AttributeChanged(aDocument, aElement, nsCacheableFuncStringContentList::AttributeChanged(aElement,
aNameSpaceID, aAttribute, aNameSpaceID, aAttribute,
aModType, aOldValue); aModType, aOldValue);
} }
@@ -1150,7 +1140,7 @@ nsLabelsNodeList::WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto)
} }
void void
nsLabelsNodeList::AttributeChanged(nsIDocument* aDocument, Element* aElement, nsLabelsNodeList::AttributeChanged(Element* aElement,
int32_t aNameSpaceID, nsAtom* aAttribute, int32_t aNameSpaceID, nsAtom* aAttribute,
int32_t aModType, int32_t aModType,
const nsAttrValue* aOldValue) const nsAttrValue* aOldValue)
@@ -1170,24 +1160,21 @@ nsLabelsNodeList::AttributeChanged(nsIDocument* aDocument, Element* aElement,
} }
void void
nsLabelsNodeList::ContentAppended(nsIDocument* aDocument, nsLabelsNodeList::ContentAppended(nsIContent* aFirstNewContent)
nsIContent* aContainer,
nsIContent* aFirstNewContent)
{ {
nsIContent* container = aFirstNewContent->GetParent();
// If a labelable element is moved to outside or inside of // If a labelable element is moved to outside or inside of
// nested associated labels, we're gonna have to modify // nested associated labels, we're gonna have to modify
// the content list. // the content list.
if (mState != LIST_DIRTY || if (mState != LIST_DIRTY ||
nsContentUtils::IsInSameAnonymousTree(mRootNode, aContainer)) { nsContentUtils::IsInSameAnonymousTree(mRootNode, container)) {
SetDirty(); SetDirty();
return; return;
} }
} }
void void
nsLabelsNodeList::ContentInserted(nsIDocument* aDocument, nsLabelsNodeList::ContentInserted(nsIContent* aChild)
nsIContent* aContainer,
nsIContent* aChild)
{ {
// If a labelable element is moved to outside or inside of // If a labelable element is moved to outside or inside of
// nested associated labels, we're gonna have to modify // nested associated labels, we're gonna have to modify
@@ -1200,9 +1187,7 @@ nsLabelsNodeList::ContentInserted(nsIDocument* aDocument,
} }
void void
nsLabelsNodeList::ContentRemoved(nsIDocument* aDocument, nsLabelsNodeList::ContentRemoved(nsIContent* aChild,
nsIContent* aContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling) nsIContent* aPreviousSibling)
{ {
// If a labelable element is removed, we're gonna have to clean // If a labelable element is removed, we're gonna have to clean

View File

@@ -120,8 +120,7 @@ nsMutationReceiver::Disconnect(bool aRemoveFromObserver)
} }
void void
nsMutationReceiver::NativeAnonymousChildListChange(nsIDocument* aDocument, nsMutationReceiver::NativeAnonymousChildListChange(nsIContent* aContent,
nsIContent* aContent,
bool aIsRemove) { bool aIsRemove) {
if (!NativeAnonymousChildList()) { if (!NativeAnonymousChildList()) {
return; return;
@@ -152,8 +151,7 @@ nsMutationReceiver::NativeAnonymousChildListChange(nsIDocument* aDocument,
} }
void void
nsMutationReceiver::AttributeWillChange(nsIDocument* aDocument, nsMutationReceiver::AttributeWillChange(mozilla::dom::Element* aElement,
mozilla::dom::Element* aElement,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsAtom* aAttribute, nsAtom* aAttribute,
int32_t aModType, int32_t aModType,
@@ -190,8 +188,7 @@ nsMutationReceiver::AttributeWillChange(nsIDocument* aDocument,
} }
void void
nsMutationReceiver::CharacterDataWillChange(nsIDocument* aDocument, nsMutationReceiver::CharacterDataWillChange(nsIContent* aContent,
nsIContent* aContent,
const CharacterDataChangeInfo&) const CharacterDataChangeInfo&)
{ {
if (nsAutoMutationBatch::IsBatching() || if (nsAutoMutationBatch::IsBatching() ||
@@ -217,11 +214,9 @@ nsMutationReceiver::CharacterDataWillChange(nsIDocument* aDocument,
} }
void void
nsMutationReceiver::ContentAppended(nsIDocument* aDocument, nsMutationReceiver::ContentAppended(nsIContent* aFirstNewContent)
nsIContent* aContainer,
nsIContent* aFirstNewContent)
{ {
nsINode* parent = NODE_FROM(aContainer, aDocument); nsINode* parent = aFirstNewContent->GetParentNode();
bool wantsChildList = bool wantsChildList =
ChildList() && ChildList() &&
((Subtree() && RegisterTarget()->SubtreeRoot() == parent->SubtreeRoot()) || ((Subtree() && RegisterTarget()->SubtreeRoot() == parent->SubtreeRoot()) ||
@@ -257,11 +252,9 @@ nsMutationReceiver::ContentAppended(nsIDocument* aDocument,
} }
void void
nsMutationReceiver::ContentInserted(nsIDocument* aDocument, nsMutationReceiver::ContentInserted(nsIContent* aChild)
nsIContent* aContainer,
nsIContent* aChild)
{ {
nsINode* parent = NODE_FROM(aContainer, aDocument); nsINode* parent = aChild->GetParentNode();
bool wantsChildList = bool wantsChildList =
ChildList() && ChildList() &&
((Subtree() && RegisterTarget()->SubtreeRoot() == parent->SubtreeRoot()) || ((Subtree() && RegisterTarget()->SubtreeRoot() == parent->SubtreeRoot()) ||
@@ -291,16 +284,14 @@ nsMutationReceiver::ContentInserted(nsIDocument* aDocument,
} }
void void
nsMutationReceiver::ContentRemoved(nsIDocument* aDocument, nsMutationReceiver::ContentRemoved(nsIContent* aChild,
nsIContent* aContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling) nsIContent* aPreviousSibling)
{ {
if (!IsObservable(aChild)) { if (!IsObservable(aChild)) {
return; return;
} }
nsINode* parent = NODE_FROM(aContainer, aDocument); nsINode* parent = aChild->GetParentNode();
if (Subtree() && parent->SubtreeRoot() != RegisterTarget()->SubtreeRoot()) { if (Subtree() && parent->SubtreeRoot() != RegisterTarget()->SubtreeRoot()) {
return; return;
} }

View File

@@ -404,13 +404,12 @@ public:
NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
NS_DECL_NSIMUTATIONOBSERVER_NODEWILLBEDESTROYED NS_DECL_NSIMUTATIONOBSERVER_NODEWILLBEDESTROYED
virtual void AttributeSetToCurrentValue(nsIDocument* aDocument, virtual void AttributeSetToCurrentValue(mozilla::dom::Element* aElement,
mozilla::dom::Element* aElement,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsAtom* aAttribute) override nsAtom* aAttribute) override
{ {
// We can reuse AttributeWillChange implementation. // We can reuse AttributeWillChange implementation.
AttributeWillChange(aDocument, aElement, aNameSpaceID, aAttribute, AttributeWillChange(aElement, aNameSpaceID, aAttribute,
mozilla::dom::MutationEventBinding::MODIFICATION, nullptr); mozilla::dom::MutationEventBinding::MODIFICATION, nullptr);
} }

View File

@@ -3216,11 +3216,10 @@ nsFrameLoader::ApplySandboxFlags(uint32_t sandboxFlags)
} }
/* virtual */ void /* virtual */ void
nsFrameLoader::AttributeChanged(nsIDocument* aDocument, nsFrameLoader::AttributeChanged(mozilla::dom::Element* aElement,
mozilla::dom::Element* aElement, int32_t aNameSpaceID,
int32_t aNameSpaceID, nsAtom* aAttribute,
nsAtom* aAttribute, int32_t aModType,
int32_t aModType,
const nsAttrValue* aOldValue) const nsAttrValue* aOldValue)
{ {
MOZ_ASSERT(mObservingOwnerContent); MOZ_ASSERT(mObservingOwnerContent);

View File

@@ -108,7 +108,6 @@ public:
* added/removed from the document (the other notifications are used * added/removed from the document (the other notifications are used
* for that). * for that).
* *
* @param aDocument The owner-document of aContent. Can be null.
* @param aContent The piece of content that changed. Is never null. * @param aContent The piece of content that changed. Is never null.
* @param aInfo The structure with information details about the change. * @param aInfo The structure with information details about the change.
* *
@@ -118,8 +117,7 @@ public:
* assume that this call will happen when there are script blockers on * assume that this call will happen when there are script blockers on
* the stack. * the stack.
*/ */
virtual void CharacterDataWillChange(nsIDocument* aDocument, virtual void CharacterDataWillChange(nsIContent* aContent,
nsIContent* aContent,
const CharacterDataChangeInfo&) = 0; const CharacterDataChangeInfo&) = 0;
/** /**
@@ -130,7 +128,6 @@ public:
* added/removed from the document (the other notifications are used * added/removed from the document (the other notifications are used
* for that). * for that).
* *
* @param aDocument The owner-document of aContent. Can be null.
* @param aContent The piece of content that changed. Is never null. * @param aContent The piece of content that changed. Is never null.
* @param aInfo The structure with information details about the change. * @param aInfo The structure with information details about the change.
* *
@@ -140,8 +137,7 @@ public:
* assume that this call will happen when there are script blockers on * assume that this call will happen when there are script blockers on
* the stack. * the stack.
*/ */
virtual void CharacterDataChanged(nsIDocument* aDocument, virtual void CharacterDataChanged(nsIContent* aContent,
nsIContent* aContent,
const CharacterDataChangeInfo&) = 0; const CharacterDataChangeInfo&) = 0;
/** /**
@@ -151,7 +147,6 @@ public:
* attribute doesn't actually change there will be no corresponding * attribute doesn't actually change there will be no corresponding
* AttributeChanged). * AttributeChanged).
* *
* @param aDocument The owner-document of aContent. Can be null.
* @param aContent The element whose attribute will change * @param aContent The element whose attribute will change
* @param aNameSpaceID The namespace id of the changing attribute * @param aNameSpaceID The namespace id of the changing attribute
* @param aAttribute The name of the changing attribute * @param aAttribute The name of the changing attribute
@@ -167,17 +162,15 @@ public:
* assume that this call will happen when there are script blockers on * assume that this call will happen when there are script blockers on
* the stack. * the stack.
*/ */
virtual void AttributeWillChange(nsIDocument* aDocument, virtual void AttributeWillChange(mozilla::dom::Element* aElement,
mozilla::dom::Element* aElement, int32_t aNameSpaceID,
int32_t aNameSpaceID, nsAtom* aAttribute,
nsAtom* aAttribute, int32_t aModType,
int32_t aModType,
const nsAttrValue* aNewValue) = 0; const nsAttrValue* aNewValue) = 0;
/** /**
* Notification that an attribute of an element has changed. * Notification that an attribute of an element has changed.
* *
* @param aDocument The owner-document of aContent. Can be null.
* @param aElement The element whose attribute changed * @param aElement The element whose attribute changed
* @param aNameSpaceID The namespace id of the changed attribute * @param aNameSpaceID The namespace id of the changed attribute
* @param aAttribute The name of the changed attribute * @param aAttribute The name of the changed attribute
@@ -193,36 +186,31 @@ public:
* assume that this call will happen when there are script blockers on * assume that this call will happen when there are script blockers on
* the stack. * the stack.
*/ */
virtual void AttributeChanged(nsIDocument* aDocument, virtual void AttributeChanged(mozilla::dom::Element* aElement,
mozilla::dom::Element* aElement, int32_t aNameSpaceID,
int32_t aNameSpaceID, nsAtom* aAttribute,
nsAtom* aAttribute, int32_t aModType,
int32_t aModType,
const nsAttrValue* aOldValue) = 0; const nsAttrValue* aOldValue) = 0;
/** /**
* Notification that the root of a native anonymous has been added * Notification that the root of a native anonymous has been added
* or removed. * or removed.
* *
* @param aDocument Owner doc of aContent
* @param aContent Anonymous node that's been added or removed * @param aContent Anonymous node that's been added or removed
* @param aIsRemove True if it's a removal, false if an addition * @param aIsRemove True if it's a removal, false if an addition
*/ */
virtual void NativeAnonymousChildListChange(nsIDocument* aDocument, virtual void NativeAnonymousChildListChange(nsIContent* aContent,
nsIContent* aContent,
bool aIsRemove) {} bool aIsRemove) {}
/** /**
* Notification that an attribute of an element has been * Notification that an attribute of an element has been
* set to the value it already had. * set to the value it already had.
* *
* @param aDocument The owner-document of aContent.
* @param aElement The element whose attribute changed * @param aElement The element whose attribute changed
* @param aNameSpaceID The namespace id of the changed attribute * @param aNameSpaceID The namespace id of the changed attribute
* @param aAttribute The name of the changed attribute * @param aAttribute The name of the changed attribute
*/ */
virtual void AttributeSetToCurrentValue(nsIDocument* aDocument, virtual void AttributeSetToCurrentValue(mozilla::dom::Element* aElement,
mozilla::dom::Element* aElement,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsAtom* aAttribute) {} nsAtom* aAttribute) {}
@@ -230,10 +218,7 @@ public:
* Notification that one or more content nodes have been appended to the * Notification that one or more content nodes have been appended to the
* child list of another node in the tree. * child list of another node in the tree.
* *
* @param aDocument The owner-document of aContent. Can be null. * @param aFirstNewContent the first node appended.
* @param aContainer The container that had new children appended. Is never
* null.
* @param aFirstNewContent the node at aIndexInContainer in aContainer.
* *
* @note Callers of this method might not hold a strong reference to the * @note Callers of this method might not hold a strong reference to the
* observer. The observer is responsible for making sure it stays * observer. The observer is responsible for making sure it stays
@@ -241,22 +226,13 @@ public:
* assume that this call will happen when there are script blockers on * assume that this call will happen when there are script blockers on
* the stack. * the stack.
*/ */
virtual void ContentAppended(nsIDocument* aDocument, virtual void ContentAppended(nsIContent* aFirstNewContent) = 0;
nsIContent* aContainer,
nsIContent* aFirstNewContent) = 0;
/** /**
* Notification that a content node has been inserted as child to another * Notification that a content node has been inserted as child to another
* node in the tree. * node in the tree.
* *
* @param aDocument The owner-document of aContent, or, when aContainer * @param aChild The newly inserted child.
* is null, the container that had the child inserted.
* Can be null.
* @param aContainer The container that had new a child inserted. Can be
* null to indicate that the child was inserted into
* aDocument
* @param aChild The newly inserted child.
* @param aIndexInContainer The index in the container of the new child.
* *
* @note Callers of this method might not hold a strong reference to the * @note Callers of this method might not hold a strong reference to the
* observer. The observer is responsible for making sure it stays * observer. The observer is responsible for making sure it stays
@@ -264,23 +240,13 @@ public:
* assume that this call will happen when there are script blockers on * assume that this call will happen when there are script blockers on
* the stack. * the stack.
*/ */
virtual void ContentInserted(nsIDocument* aDocument, virtual void ContentInserted(nsIContent* aChild) = 0;
nsIContent* aContainer,
nsIContent* aChild) = 0;
/** /**
* Notification that a content node has been removed from the child list of * Notification that a content node has been removed from the child list of
* another node in the tree. * another node in the tree.
* *
* @param aDocument The owner-document of aContent, or, when aContainer
* is null, the container that had the child removed.
* Can be null.
* @param aContainer The container that had new a child removed. Can be
* null to indicate that the child was removed from
* aDocument.
* @param aChild The child that was removed. * @param aChild The child that was removed.
* @param aIndexInContainer The index in the container which the child used
* to have.
* @param aPreviousSibling The previous sibling to the child that was removed. * @param aPreviousSibling The previous sibling to the child that was removed.
* Can be null if there was no previous sibling. * Can be null if there was no previous sibling.
* *
@@ -290,9 +256,7 @@ public:
* assume that this call will happen when there are script blockers on * assume that this call will happen when there are script blockers on
* the stack. * the stack.
*/ */
virtual void ContentRemoved(nsIDocument* aDocument, virtual void ContentRemoved(nsIContent* aChild,
nsIContent* aContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling) = 0; nsIContent* aPreviousSibling) = 0;
/** /**
@@ -336,50 +300,39 @@ public:
NS_DEFINE_STATIC_IID_ACCESSOR(nsIMutationObserver, NS_IMUTATION_OBSERVER_IID) NS_DEFINE_STATIC_IID_ACCESSOR(nsIMutationObserver, NS_IMUTATION_OBSERVER_IID)
#define NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATAWILLCHANGE \ #define NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATAWILLCHANGE \
virtual void CharacterDataWillChange(nsIDocument* aDocument, \ virtual void CharacterDataWillChange(nsIContent* aContent, \
nsIContent* aContent, \
const CharacterDataChangeInfo& aInfo) override; const CharacterDataChangeInfo& aInfo) override;
#define NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED \ #define NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED \
virtual void CharacterDataChanged(nsIDocument* aDocument, \ virtual void CharacterDataChanged(nsIContent* aContent, \
nsIContent* aContent, \
const CharacterDataChangeInfo& aInfo) override; const CharacterDataChangeInfo& aInfo) override;
#define NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTEWILLCHANGE \ #define NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTEWILLCHANGE \
virtual void AttributeWillChange(nsIDocument* aDocument, \ virtual void AttributeWillChange(mozilla::dom::Element* aElement, \
mozilla::dom::Element* aElement, \
int32_t aNameSpaceID, \ int32_t aNameSpaceID, \
nsAtom* aAttribute, \ nsAtom* aAttribute, \
int32_t aModType, \ int32_t aModType, \
const nsAttrValue* aNewValue) override; const nsAttrValue* aNewValue) override;
#define NS_DECL_NSIMUTATIONOBSERVER_NATIVEANONYMOUSCHILDLISTCHANGE \ #define NS_DECL_NSIMUTATIONOBSERVER_NATIVEANONYMOUSCHILDLISTCHANGE \
virtual void NativeAnonymousChildListChange(nsIDocument* aDocument, \ virtual void NativeAnonymousChildListChange(nsIContent* aContent, \
nsIContent* aContent, \
bool aIsRemove) override; bool aIsRemove) override;
#define NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED \ #define NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED \
virtual void AttributeChanged(nsIDocument* aDocument, \ virtual void AttributeChanged(mozilla::dom::Element* aElement, \
mozilla::dom::Element* aElement, \
int32_t aNameSpaceID, \ int32_t aNameSpaceID, \
nsAtom* aAttribute, \ nsAtom* aAttribute, \
int32_t aModType, \ int32_t aModType, \
const nsAttrValue* aOldValue) override; const nsAttrValue* aOldValue) override;
#define NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED \ #define NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED \
virtual void ContentAppended(nsIDocument* aDocument, \ virtual void ContentAppended(nsIContent* aFirstNewContent) override;
nsIContent* aContainer, \
nsIContent* aFirstNewContent) override;
#define NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED \ #define NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED \
virtual void ContentInserted(nsIDocument* aDocument, \ virtual void ContentInserted(nsIContent* aChild) override;
nsIContent* aContainer, \
nsIContent* aChild) override;
#define NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED \ #define NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED \
virtual void ContentRemoved(nsIDocument* aDocument, \ virtual void ContentRemoved(nsIContent* aChild, \
nsIContent* aContainer, \
nsIContent* aChild, \
nsIContent* aPreviousSibling) override; nsIContent* aPreviousSibling) override;
#define NS_DECL_NSIMUTATIONOBSERVER_NODEWILLBEDESTROYED \ #define NS_DECL_NSIMUTATIONOBSERVER_NODEWILLBEDESTROYED \
@@ -402,26 +355,23 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIMutationObserver, NS_IMUTATION_OBSERVER_IID)
#define NS_IMPL_NSIMUTATIONOBSERVER_CORE_STUB(_class) \ #define NS_IMPL_NSIMUTATIONOBSERVER_CORE_STUB(_class) \
void \ void \
_class::NodeWillBeDestroyed(const nsINode* aNode) \ _class::NodeWillBeDestroyed(const nsINode* aNode) \
{ \ { \
} }
#define NS_IMPL_NSIMUTATIONOBSERVER_CONTENT(_class) \ #define NS_IMPL_NSIMUTATIONOBSERVER_CONTENT(_class) \
void \ void \
_class::CharacterDataWillChange(nsIDocument* aDocument, \ _class::CharacterDataWillChange(nsIContent* aContent, \
nsIContent* aContent, \
const CharacterDataChangeInfo& aInfo) \ const CharacterDataChangeInfo& aInfo) \
{ \ { \
} \ } \
void \ void \
_class::CharacterDataChanged(nsIDocument* aDocument, \ _class::CharacterDataChanged(nsIContent* aContent, \
nsIContent* aContent, \
const CharacterDataChangeInfo& aInfo) \ const CharacterDataChangeInfo& aInfo) \
{ \ { \
} \ } \
void \ void \
_class::AttributeWillChange(nsIDocument* aDocument, \ _class::AttributeWillChange(mozilla::dom::Element* aElement, \
mozilla::dom::Element* aElement, \
int32_t aNameSpaceID, \ int32_t aNameSpaceID, \
nsAtom* aAttribute, \ nsAtom* aAttribute, \
int32_t aModType, \ int32_t aModType, \
@@ -429,14 +379,12 @@ _class::AttributeWillChange(nsIDocument* aDocument, \
{ \ { \
} \ } \
void \ void \
_class::NativeAnonymousChildListChange(nsIDocument* aDocument, \ _class::NativeAnonymousChildListChange(nsIContent* aContent, \
nsIContent* aContent, \
bool aIsRemove) \ bool aIsRemove) \
{ \ { \
} \ } \
void \ void \
_class::AttributeChanged(nsIDocument* aDocument, \ _class::AttributeChanged(mozilla::dom::Element* aElement, \
mozilla::dom::Element* aElement, \
int32_t aNameSpaceID, \ int32_t aNameSpaceID, \
nsAtom* aAttribute, \ nsAtom* aAttribute, \
int32_t aModType, \ int32_t aModType, \
@@ -444,22 +392,15 @@ _class::AttributeChanged(nsIDocument* aDocument, \
{ \ { \
} \ } \
void \ void \
_class::ContentAppended(nsIDocument* aDocument, \ _class::ContentAppended(nsIContent* aFirstNewContent) \
nsIContent* aContainer, \
nsIContent* aFirstNewContent) \
{ \ { \
} \ } \
void \ void \
_class::ContentInserted(nsIDocument* aDocument, \ _class::ContentInserted(nsIContent* aChild) \
nsIContent* aContainer, \
nsIContent* aChild) \
{ \ { \
} \ } \
void \ void \
_class::ContentRemoved(nsIDocument* aDocument, \ _class::ContentRemoved(nsIContent* aChild, nsIContent* aPreviousSibling) \
nsIContent* aContainer, \
nsIContent* aChild, \
nsIContent* aPreviousSibling) \
{ \ { \
} \ } \
void \ void \

View File

@@ -134,7 +134,7 @@ nsNodeUtils::CharacterDataWillChange(nsIContent* aContent,
{ {
nsIDocument* doc = aContent->OwnerDoc(); nsIDocument* doc = aContent->OwnerDoc();
IMPL_MUTATION_NOTIFICATION(CharacterDataWillChange, aContent, IMPL_MUTATION_NOTIFICATION(CharacterDataWillChange, aContent,
(doc, aContent, aInfo), IsRemoveNotification::No); (aContent, aInfo), IsRemoveNotification::No);
} }
void void
@@ -143,7 +143,7 @@ nsNodeUtils::CharacterDataChanged(nsIContent* aContent,
{ {
nsIDocument* doc = aContent->OwnerDoc(); nsIDocument* doc = aContent->OwnerDoc();
IMPL_MUTATION_NOTIFICATION(CharacterDataChanged, aContent, IMPL_MUTATION_NOTIFICATION(CharacterDataChanged, aContent,
(doc, aContent, aInfo), IsRemoveNotification::No); (aContent, aInfo), IsRemoveNotification::No);
} }
void void
@@ -155,7 +155,7 @@ nsNodeUtils::AttributeWillChange(Element* aElement,
{ {
nsIDocument* doc = aElement->OwnerDoc(); nsIDocument* doc = aElement->OwnerDoc();
IMPL_MUTATION_NOTIFICATION(AttributeWillChange, aElement, IMPL_MUTATION_NOTIFICATION(AttributeWillChange, aElement,
(doc, aElement, aNameSpaceID, aAttribute, (aElement, aNameSpaceID, aAttribute,
aModType, aNewValue), IsRemoveNotification::No); aModType, aNewValue), IsRemoveNotification::No);
} }
@@ -168,7 +168,7 @@ nsNodeUtils::AttributeChanged(Element* aElement,
{ {
nsIDocument* doc = aElement->OwnerDoc(); nsIDocument* doc = aElement->OwnerDoc();
IMPL_MUTATION_NOTIFICATION(AttributeChanged, aElement, IMPL_MUTATION_NOTIFICATION(AttributeChanged, aElement,
(doc, aElement, aNameSpaceID, aAttribute, (aElement, aNameSpaceID, aAttribute,
aModType, aOldValue), IsRemoveNotification::No); aModType, aOldValue), IsRemoveNotification::No);
} }
@@ -179,7 +179,7 @@ nsNodeUtils::AttributeSetToCurrentValue(Element* aElement,
{ {
nsIDocument* doc = aElement->OwnerDoc(); nsIDocument* doc = aElement->OwnerDoc();
IMPL_MUTATION_NOTIFICATION(AttributeSetToCurrentValue, aElement, IMPL_MUTATION_NOTIFICATION(AttributeSetToCurrentValue, aElement,
(doc, aElement, aNameSpaceID, aAttribute), (aElement, aNameSpaceID, aAttribute),
IsRemoveNotification::No); IsRemoveNotification::No);
} }
@@ -190,7 +190,7 @@ nsNodeUtils::ContentAppended(nsIContent* aContainer,
nsIDocument* doc = aContainer->OwnerDoc(); nsIDocument* doc = aContainer->OwnerDoc();
IMPL_MUTATION_NOTIFICATION(ContentAppended, aContainer, IMPL_MUTATION_NOTIFICATION(ContentAppended, aContainer,
(doc, aContainer, aFirstNewContent), (aFirstNewContent),
IsRemoveNotification::No); IsRemoveNotification::No);
} }
@@ -202,7 +202,7 @@ nsNodeUtils::NativeAnonymousChildListChange(nsIContent* aContent,
auto isRemove = aIsRemove auto isRemove = aIsRemove
? IsRemoveNotification::Yes : IsRemoveNotification::No; ? IsRemoveNotification::Yes : IsRemoveNotification::No;
IMPL_MUTATION_NOTIFICATION(NativeAnonymousChildListChange, aContent, IMPL_MUTATION_NOTIFICATION(NativeAnonymousChildListChange, aContent,
(doc, aContent, aIsRemove), (aContent, aIsRemove),
isRemove); isRemove);
} }
@@ -213,19 +213,8 @@ nsNodeUtils::ContentInserted(nsINode* aContainer,
NS_PRECONDITION(aContainer->IsContent() || NS_PRECONDITION(aContainer->IsContent() ||
aContainer->IsNodeOfType(nsINode::eDOCUMENT), aContainer->IsNodeOfType(nsINode::eDOCUMENT),
"container must be an nsIContent or an nsIDocument"); "container must be an nsIContent or an nsIDocument");
nsIContent* container;
nsIDocument* doc = aContainer->OwnerDoc(); nsIDocument* doc = aContainer->OwnerDoc();
nsIDocument* document; IMPL_MUTATION_NOTIFICATION(ContentInserted, aContainer, (aChild),
if (aContainer->IsContent()) {
container = aContainer->AsContent();
document = doc;
} else {
container = nullptr;
document = static_cast<nsIDocument*>(aContainer);
}
IMPL_MUTATION_NOTIFICATION(ContentInserted, aContainer,
(document, container, aChild),
IsRemoveNotification::No); IsRemoveNotification::No);
} }
@@ -237,19 +226,11 @@ nsNodeUtils::ContentRemoved(nsINode* aContainer,
NS_PRECONDITION(aContainer->IsContent() || NS_PRECONDITION(aContainer->IsContent() ||
aContainer->IsNodeOfType(nsINode::eDOCUMENT), aContainer->IsNodeOfType(nsINode::eDOCUMENT),
"container must be an nsIContent or an nsIDocument"); "container must be an nsIContent or an nsIDocument");
nsIContent* container;
nsIDocument* doc = aContainer->OwnerDoc(); nsIDocument* doc = aContainer->OwnerDoc();
nsIDocument* document; MOZ_ASSERT(aChild->GetParentNode() == aContainer,
if (aContainer->IsContent()) { "We expect the parent link to be still around at this point");
container = static_cast<nsIContent*>(aContainer);
document = doc;
} else {
container = nullptr;
document = static_cast<nsIDocument*>(aContainer);
}
IMPL_MUTATION_NOTIFICATION(ContentRemoved, aContainer, IMPL_MUTATION_NOTIFICATION(ContentRemoved, aContainer,
(document, container, aChild, aPreviousSibling), (aChild, aPreviousSibling),
IsRemoveNotification::Yes); IsRemoveNotification::Yes);
} }

View File

@@ -517,8 +517,7 @@ nsRange::UnregisterCommonAncestor(nsINode* aNode, bool aIsUnlinking)
* nsIMutationObserver implementation * nsIMutationObserver implementation
******************************************************/ ******************************************************/
void void
nsRange::CharacterDataChanged(nsIDocument* aDocument, nsRange::CharacterDataChanged(nsIContent* aContent,
nsIContent* aContent,
const CharacterDataChangeInfo& aInfo) const CharacterDataChangeInfo& aInfo)
{ {
MOZ_ASSERT(!mNextEndRef); MOZ_ASSERT(!mNextEndRef);
@@ -673,15 +672,12 @@ nsRange::CharacterDataChanged(nsIDocument* aDocument,
} }
void void
nsRange::ContentAppended(nsIDocument* aDocument, nsRange::ContentAppended(nsIContent* aFirstNewContent)
nsIContent* aContainer,
nsIContent* aFirstNewContent)
{ {
NS_ASSERTION(mIsPositioned, "shouldn't be notified if not positioned"); NS_ASSERTION(mIsPositioned, "shouldn't be notified if not positioned");
nsINode* container = NODE_FROM(aContainer, aDocument); nsINode* container = aFirstNewContent->GetParentNode();
MOZ_ASSERT(container); MOZ_ASSERT(container);
MOZ_ASSERT(aFirstNewContent->GetParentNode() == container);
if (container->IsSelectionDescendant() && IsInSelection()) { if (container->IsSelectionDescendant() && IsInSelection()) {
nsINode* child = aFirstNewContent; nsINode* child = aFirstNewContent;
while (child) { while (child) {
@@ -711,14 +707,12 @@ nsRange::ContentAppended(nsIDocument* aDocument,
} }
void void
nsRange::ContentInserted(nsIDocument* aDocument, nsRange::ContentInserted(nsIContent* aChild)
nsIContent* aContainer,
nsIContent* aChild)
{ {
MOZ_ASSERT(mIsPositioned, "shouldn't be notified if not positioned"); MOZ_ASSERT(mIsPositioned, "shouldn't be notified if not positioned");
bool updateBoundaries = false; bool updateBoundaries = false;
nsINode* container = NODE_FROM(aContainer, aDocument); nsINode* container = aChild->GetParentNode();
MOZ_ASSERT(container); MOZ_ASSERT(container);
RawRangeBoundary newStart(mStart); RawRangeBoundary newStart(mStart);
RawRangeBoundary newEnd(mEnd); RawRangeBoundary newEnd(mEnd);
@@ -763,13 +757,12 @@ nsRange::ContentInserted(nsIDocument* aDocument,
} }
void void
nsRange::ContentRemoved(nsIDocument* aDocument, nsRange::ContentRemoved(nsIContent* aChild, nsIContent* aPreviousSibling)
nsIContent* aContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling)
{ {
MOZ_ASSERT(mIsPositioned, "shouldn't be notified if not positioned"); MOZ_ASSERT(mIsPositioned, "shouldn't be notified if not positioned");
nsINode* container = NODE_FROM(aContainer, aDocument); nsINode* container = aChild->GetParentNode();
MOZ_ASSERT(container);
RawRangeBoundary newStart; RawRangeBoundary newStart;
RawRangeBoundary newEnd; RawRangeBoundary newEnd;
Maybe<bool> gravitateStart; Maybe<bool> gravitateStart;

View File

@@ -273,8 +273,7 @@ nsAttributeTextNode::UnbindFromTree(bool aDeep, bool aNullParent)
} }
void void
nsAttributeTextNode::AttributeChanged(nsIDocument* aDocument, nsAttributeTextNode::AttributeChanged(Element* aElement,
Element* aElement,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsAtom* aAttribute, nsAtom* aAttribute,
int32_t aModType, int32_t aModType,

View File

@@ -925,8 +925,7 @@ IMEContentObserver::OnMouseButtonEvent(nsPresContext* aPresContext,
} }
void void
IMEContentObserver::CharacterDataWillChange(nsIDocument* aDocument, IMEContentObserver::CharacterDataWillChange(nsIContent* aContent,
nsIContent* aContent,
const CharacterDataChangeInfo& aInfo) const CharacterDataChangeInfo& aInfo)
{ {
NS_ASSERTION(aContent->IsNodeOfType(nsINode::eTEXT), NS_ASSERTION(aContent->IsNodeOfType(nsINode::eTEXT),
@@ -958,8 +957,7 @@ IMEContentObserver::CharacterDataWillChange(nsIDocument* aDocument,
} }
void void
IMEContentObserver::CharacterDataChanged(nsIDocument* aDocument, IMEContentObserver::CharacterDataChanged(nsIContent* aContent,
nsIContent* aContent,
const CharacterDataChangeInfo& aInfo) const CharacterDataChangeInfo& aInfo)
{ {
NS_ASSERTION(aContent->IsNodeOfType(nsINode::eTEXT), NS_ASSERTION(aContent->IsNodeOfType(nsINode::eTEXT),
@@ -1107,28 +1105,22 @@ IMEContentObserver::NotifyContentAdded(nsINode* aContainer,
} }
void void
IMEContentObserver::ContentAppended(nsIDocument* aDocument, IMEContentObserver::ContentAppended(nsIContent* aFirstNewContent)
nsIContent* aContainer,
nsIContent* aFirstNewContent)
{ {
NotifyContentAdded(NODE_FROM(aContainer, aDocument), nsIContent* parent = aFirstNewContent->GetParent();
aFirstNewContent, aContainer->GetLastChild()); MOZ_ASSERT(parent);
NotifyContentAdded(parent, aFirstNewContent, parent->GetLastChild());
} }
void void
IMEContentObserver::ContentInserted(nsIDocument* aDocument, IMEContentObserver::ContentInserted(nsIContent* aChild)
nsIContent* aContainer,
nsIContent* aChild)
{ {
MOZ_ASSERT(aChild); MOZ_ASSERT(aChild);
NotifyContentAdded(NODE_FROM(aContainer, aDocument), NotifyContentAdded(aChild->GetParentNode(), aChild, aChild);
aChild, aChild);
} }
void void
IMEContentObserver::ContentRemoved(nsIDocument* aDocument, IMEContentObserver::ContentRemoved(nsIContent* aChild,
nsIContent* aContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling) nsIContent* aPreviousSibling)
{ {
if (!NeedsTextChangeNotification() || if (!NeedsTextChangeNotification() ||
@@ -1139,8 +1131,7 @@ IMEContentObserver::ContentRemoved(nsIDocument* aDocument,
mEndOfAddedTextCache.Clear(); mEndOfAddedTextCache.Clear();
MaybeNotifyIMEOfAddedTextDuringDocumentChange(); MaybeNotifyIMEOfAddedTextDuringDocumentChange();
nsINode* containerNode = NODE_FROM(aContainer, aDocument); nsINode* containerNode = aChild->GetParentNode();
MOZ_ASSERT(containerNode); MOZ_ASSERT(containerNode);
uint32_t offset = 0; uint32_t offset = 0;
@@ -1191,8 +1182,7 @@ IMEContentObserver::ContentRemoved(nsIDocument* aDocument,
} }
void void
IMEContentObserver::AttributeWillChange(nsIDocument* aDocument, IMEContentObserver::AttributeWillChange(dom::Element* aElement,
dom::Element* aElement,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsAtom* aAttribute, nsAtom* aAttribute,
int32_t aModType, int32_t aModType,
@@ -1207,8 +1197,7 @@ IMEContentObserver::AttributeWillChange(nsIDocument* aDocument,
} }
void void
IMEContentObserver::AttributeChanged(nsIDocument* aDocument, IMEContentObserver::AttributeChanged(dom::Element* aElement,
dom::Element* aElement,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsAtom* aAttribute, nsAtom* aAttribute,
int32_t aModType, int32_t aModType,

View File

@@ -1531,9 +1531,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED_0(HTMLMediaElement, nsGenericHTMLElement) NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED_0(HTMLMediaElement, nsGenericHTMLElement)
void void
HTMLMediaElement::ContentRemoved(nsIDocument* aDocument, HTMLMediaElement::ContentRemoved(nsIContent* aChild,
nsIContent* aContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling) nsIContent* aPreviousSibling)
{ {
if (aChild == mSourcePointer) { if (aChild == mSourcePointer) {

View File

@@ -179,30 +179,23 @@ void HTMLOutputElement::DescendantsChanged()
// nsIMutationObserver // nsIMutationObserver
void HTMLOutputElement::CharacterDataChanged(nsIDocument* aDocument, void HTMLOutputElement::CharacterDataChanged(nsIContent* aContent,
nsIContent* aContent,
const CharacterDataChangeInfo&) const CharacterDataChangeInfo&)
{ {
DescendantsChanged(); DescendantsChanged();
} }
void HTMLOutputElement::ContentAppended(nsIDocument* aDocument, void HTMLOutputElement::ContentAppended(nsIContent* aFirstNewContent)
nsIContent* aContainer,
nsIContent* aFirstNewContent)
{ {
DescendantsChanged(); DescendantsChanged();
} }
void HTMLOutputElement::ContentInserted(nsIDocument* aDocument, void HTMLOutputElement::ContentInserted(nsIContent* aChild)
nsIContent* aContainer,
nsIContent* aChild)
{ {
DescendantsChanged(); DescendantsChanged();
} }
void HTMLOutputElement::ContentRemoved(nsIDocument* aDocument, void HTMLOutputElement::ContentRemoved(nsIContent* aChild,
nsIContent* aContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling) nsIContent* aPreviousSibling)
{ {
DescendantsChanged(); DescendantsChanged();

View File

@@ -64,33 +64,26 @@ HTMLStyleElement::SetDisabled(bool aDisabled)
} }
void void
HTMLStyleElement::CharacterDataChanged(nsIDocument* aDocument, HTMLStyleElement::CharacterDataChanged(nsIContent* aContent,
nsIContent* aContent,
const CharacterDataChangeInfo&) const CharacterDataChangeInfo&)
{ {
ContentChanged(aContent); ContentChanged(aContent);
} }
void void
HTMLStyleElement::ContentAppended(nsIDocument* aDocument, HTMLStyleElement::ContentAppended(nsIContent* aFirstNewContent)
nsIContent* aContainer,
nsIContent* aFirstNewContent)
{ {
ContentChanged(aContainer); ContentChanged(aFirstNewContent->GetParent());
} }
void void
HTMLStyleElement::ContentInserted(nsIDocument* aDocument, HTMLStyleElement::ContentInserted(nsIContent* aChild)
nsIContent* aContainer,
nsIContent* aChild)
{ {
ContentChanged(aChild); ContentChanged(aChild);
} }
void void
HTMLStyleElement::ContentRemoved(nsIDocument* aDocument, HTMLStyleElement::ContentRemoved(nsIContent* aChild,
nsIContent* aContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling) nsIContent* aPreviousSibling)
{ {
ContentChanged(aChild); ContentChanged(aChild);

View File

@@ -447,12 +447,11 @@ TableRowsCollection::HandleInsert(nsIContent* aContainer,
// nsIMutationObserver // nsIMutationObserver
void void
TableRowsCollection::ContentAppended(nsIDocument* aDocument, TableRowsCollection::ContentAppended(nsIContent* aFirstNewContent)
nsIContent* aContainer,
nsIContent* aFirstNewContent)
{ {
nsIContent* container = aFirstNewContent->GetParent();
if (!nsContentUtils::IsInSameAnonymousTree(mParent, aFirstNewContent) || if (!nsContentUtils::IsInSameAnonymousTree(mParent, aFirstNewContent) ||
!InterestingContainer(aContainer)) { !InterestingContainer(container)) {
return; return;
} }
@@ -460,37 +459,33 @@ TableRowsCollection::ContentAppended(nsIDocument* aDocument,
// appending into mParent, in which case we can provide the guess that we // appending into mParent, in which case we can provide the guess that we
// should insert at the end of the body, which can help us avoid potentially // should insert at the end of the body, which can help us avoid potentially
// expensive work in the common case. // expensive work in the common case.
int32_t indexGuess = mParent == aContainer ? mFootStart : -1; int32_t indexGuess = mParent == container ? mFootStart : -1;
// Insert each of the newly added content one at a time. The indexGuess should // Insert each of the newly added content one at a time. The indexGuess should
// make insertions of a large number of elements cheaper. // make insertions of a large number of elements cheaper.
for (nsIContent* content = aFirstNewContent; for (nsIContent* content = aFirstNewContent;
content; content = content->GetNextSibling()) { content; content = content->GetNextSibling()) {
indexGuess = HandleInsert(aContainer, content, indexGuess); indexGuess = HandleInsert(container, content, indexGuess);
} }
} }
void void
TableRowsCollection::ContentInserted(nsIDocument* aDocument, TableRowsCollection::ContentInserted(nsIContent* aChild)
nsIContent* aContainer,
nsIContent* aChild)
{ {
if (!nsContentUtils::IsInSameAnonymousTree(mParent, aChild) || if (!nsContentUtils::IsInSameAnonymousTree(mParent, aChild) ||
!InterestingContainer(aContainer)) { !InterestingContainer(aChild->GetParent())) {
return; return;
} }
HandleInsert(aContainer, aChild); HandleInsert(aChild->GetParent(), aChild);
} }
void void
TableRowsCollection::ContentRemoved(nsIDocument* aDocument, TableRowsCollection::ContentRemoved(nsIContent* aChild,
nsIContent* aContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling) nsIContent* aPreviousSibling)
{ {
if (!nsContentUtils::IsInSameAnonymousTree(mParent, aChild) || if (!nsContentUtils::IsInSameAnonymousTree(mParent, aChild) ||
!InterestingContainer(aContainer)) { !InterestingContainer(aChild->GetParent())) {
return; return;
} }

View File

@@ -988,33 +988,26 @@ HTMLTextAreaElement::BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
} }
void void
HTMLTextAreaElement::CharacterDataChanged(nsIDocument* aDocument, HTMLTextAreaElement::CharacterDataChanged(nsIContent* aContent,
nsIContent* aContent,
const CharacterDataChangeInfo&) const CharacterDataChangeInfo&)
{ {
ContentChanged(aContent); ContentChanged(aContent);
} }
void void
HTMLTextAreaElement::ContentAppended(nsIDocument* aDocument, HTMLTextAreaElement::ContentAppended(nsIContent* aFirstNewContent)
nsIContent* aContainer,
nsIContent* aFirstNewContent)
{ {
ContentChanged(aFirstNewContent); ContentChanged(aFirstNewContent);
} }
void void
HTMLTextAreaElement::ContentInserted(nsIDocument* aDocument, HTMLTextAreaElement::ContentInserted(nsIContent* aChild)
nsIContent* aContainer,
nsIContent* aChild)
{ {
ContentChanged(aChild); ContentChanged(aChild);
} }
void void
HTMLTextAreaElement::ContentRemoved(nsIDocument* aDocument, HTMLTextAreaElement::ContentRemoved(nsIContent* aChild,
nsIContent* aContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling) nsIContent* aPreviousSibling)
{ {
ContentChanged(aChild); ContentChanged(aChild);

View File

@@ -54,34 +54,27 @@ HTMLTitleElement::SetText(const nsAString& aText, ErrorResult& aError)
} }
void void
HTMLTitleElement::CharacterDataChanged(nsIDocument *aDocument, HTMLTitleElement::CharacterDataChanged(nsIContent* aContent,
nsIContent *aContent,
const CharacterDataChangeInfo&) const CharacterDataChangeInfo&)
{ {
SendTitleChangeEvent(false); SendTitleChangeEvent(false);
} }
void void
HTMLTitleElement::ContentAppended(nsIDocument *aDocument, HTMLTitleElement::ContentAppended(nsIContent* aFirstNewContent)
nsIContent *aContainer,
nsIContent *aFirstNewContent)
{ {
SendTitleChangeEvent(false); SendTitleChangeEvent(false);
} }
void void
HTMLTitleElement::ContentInserted(nsIDocument *aDocument, HTMLTitleElement::ContentInserted(nsIContent* aChild)
nsIContent *aContainer,
nsIContent *aChild)
{ {
SendTitleChangeEvent(false); SendTitleChangeEvent(false);
} }
void void
HTMLTitleElement::ContentRemoved(nsIDocument *aDocument, HTMLTitleElement::ContentRemoved(nsIContent* aChild,
nsIContent *aContainer, nsIContent* aPreviousSibling)
nsIContent *aChild,
nsIContent *aPreviousSibling)
{ {
SendTitleChangeEvent(false); SendTitleChangeEvent(false);
} }

View File

@@ -251,8 +251,9 @@ bool nsDOMStringMap::AttrToDataProp(const nsAString& aAttr,
} }
void void
nsDOMStringMap::AttributeChanged(nsIDocument *aDocument, Element* aElement, nsDOMStringMap::AttributeChanged(Element* aElement,
int32_t aNameSpaceID, nsAtom* aAttribute, int32_t aNameSpaceID,
nsAtom* aAttribute,
int32_t aModType, int32_t aModType,
const nsAttrValue* aOldValue) const nsAttrValue* aOldValue)
{ {

View File

@@ -78,16 +78,14 @@ ScriptElement::ScriptEvaluated(nsresult aResult,
} }
void void
ScriptElement::CharacterDataChanged(nsIDocument* aDocument, ScriptElement::CharacterDataChanged(nsIContent* aContent,
nsIContent* aContent,
const CharacterDataChangeInfo&) const CharacterDataChangeInfo&)
{ {
MaybeProcessScript(); MaybeProcessScript();
} }
void void
ScriptElement::AttributeChanged(nsIDocument* aDocument, ScriptElement::AttributeChanged(Element* aElement,
Element* aElement,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsAtom* aAttribute, nsAtom* aAttribute,
int32_t aModType, int32_t aModType,
@@ -97,17 +95,13 @@ ScriptElement::AttributeChanged(nsIDocument* aDocument,
} }
void void
ScriptElement::ContentAppended(nsIDocument* aDocument, ScriptElement::ContentAppended(nsIContent* aFirstNewContent)
nsIContent* aContainer,
nsIContent* aFirstNewContent)
{ {
MaybeProcessScript(); MaybeProcessScript();
} }
void void
ScriptElement::ContentInserted(nsIDocument* aDocument, ScriptElement::ContentInserted(nsIContent* aChild)
nsIContent* aContainer,
nsIContent* aChild)
{ {
MaybeProcessScript(); MaybeProcessScript();
} }

View File

@@ -188,8 +188,7 @@ SVGMPathElement::GetStringInfo()
// nsIMutationObserver methods // nsIMutationObserver methods
void void
SVGMPathElement::AttributeChanged(nsIDocument* aDocument, SVGMPathElement::AttributeChanged(Element* aElement,
Element* aElement,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsAtom* aAttribute, nsAtom* aAttribute,
int32_t aModType, int32_t aModType,

View File

@@ -133,33 +133,26 @@ SVGStyleElement::ParseAttribute(int32_t aNamespaceID,
// nsIMutationObserver methods // nsIMutationObserver methods
void void
SVGStyleElement::CharacterDataChanged(nsIDocument* aDocument, SVGStyleElement::CharacterDataChanged(nsIContent* aContent,
nsIContent* aContent,
const CharacterDataChangeInfo&) const CharacterDataChangeInfo&)
{ {
ContentChanged(aContent); ContentChanged(aContent);
} }
void void
SVGStyleElement::ContentAppended(nsIDocument* aDocument, SVGStyleElement::ContentAppended(nsIContent* aFirstNewContent)
nsIContent* aContainer,
nsIContent* aFirstNewContent)
{ {
ContentChanged(aContainer); ContentChanged(aFirstNewContent->GetParent());
} }
void void
SVGStyleElement::ContentInserted(nsIDocument* aDocument, SVGStyleElement::ContentInserted(nsIContent* aChild)
nsIContent* aContainer,
nsIContent* aChild)
{ {
ContentChanged(aChild); ContentChanged(aChild);
} }
void void
SVGStyleElement::ContentRemoved(nsIDocument* aDocument, SVGStyleElement::ContentRemoved(nsIContent* aChild,
nsIContent* aContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling) nsIContent* aPreviousSibling)
{ {
ContentChanged(aChild); ContentChanged(aChild);

View File

@@ -39,34 +39,27 @@ SVGTitleElement::~SVGTitleElement()
} }
void void
SVGTitleElement::CharacterDataChanged(nsIDocument* aDocument, SVGTitleElement::CharacterDataChanged(nsIContent* aContent,
nsIContent* aContent,
const CharacterDataChangeInfo&) const CharacterDataChangeInfo&)
{ {
SendTitleChangeEvent(false); SendTitleChangeEvent(false);
} }
void void
SVGTitleElement::ContentAppended(nsIDocument *aDocument, SVGTitleElement::ContentAppended(nsIContent* aFirstNewContent)
nsIContent *aContainer,
nsIContent *aFirstNewContent)
{ {
SendTitleChangeEvent(false); SendTitleChangeEvent(false);
} }
void void
SVGTitleElement::ContentInserted(nsIDocument *aDocument, SVGTitleElement::ContentInserted(nsIContent* aChild)
nsIContent *aContainer,
nsIContent *aChild)
{ {
SendTitleChangeEvent(false); SendTitleChangeEvent(false);
} }
void void
SVGTitleElement::ContentRemoved(nsIDocument *aDocument, SVGTitleElement::ContentRemoved(nsIContent* aChild,
nsIContent *aContainer, nsIContent* aPreviousSibling)
nsIContent *aChild,
nsIContent *aPreviousSibling)
{ {
SendTitleChangeEvent(false); SendTitleChangeEvent(false);
} }

View File

@@ -147,8 +147,7 @@ SVGUseElement::Height()
// nsIMutationObserver methods // nsIMutationObserver methods
void void
SVGUseElement::CharacterDataChanged(nsIDocument* aDocument, SVGUseElement::CharacterDataChanged(nsIContent* aContent,
nsIContent* aContent,
const CharacterDataChangeInfo&) const CharacterDataChangeInfo&)
{ {
if (nsContentUtils::IsInSameAnonymousTree(this, aContent)) { if (nsContentUtils::IsInSameAnonymousTree(this, aContent)) {
@@ -157,8 +156,7 @@ SVGUseElement::CharacterDataChanged(nsIDocument* aDocument,
} }
void void
SVGUseElement::AttributeChanged(nsIDocument* aDocument, SVGUseElement::AttributeChanged(Element* aElement,
Element* aElement,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsAtom* aAttribute, nsAtom* aAttribute,
int32_t aModType, int32_t aModType,
@@ -170,30 +168,27 @@ SVGUseElement::AttributeChanged(nsIDocument* aDocument,
} }
void void
SVGUseElement::ContentAppended(nsIDocument *aDocument, SVGUseElement::ContentAppended(nsIContent* aFirstNewContent)
nsIContent *aContainer,
nsIContent *aFirstNewContent)
{ {
if (nsContentUtils::IsInSameAnonymousTree(this, aContainer)) { // FIXME(emilio, bug 1442336): Why does this check the parent but
// ContentInserted the child?
if (nsContentUtils::IsInSameAnonymousTree(this, aFirstNewContent->GetParent())) {
TriggerReclone(); TriggerReclone();
} }
} }
void void
SVGUseElement::ContentInserted(nsIDocument *aDocument, SVGUseElement::ContentInserted(nsIContent* aChild)
nsIContent *aContainer,
nsIContent *aChild)
{ {
// FIXME(emilio, bug 1442336): Why does this check the child but
// ContentAppended the parent?
if (nsContentUtils::IsInSameAnonymousTree(this, aChild)) { if (nsContentUtils::IsInSameAnonymousTree(this, aChild)) {
TriggerReclone(); TriggerReclone();
} }
} }
void void
SVGUseElement::ContentRemoved(nsIDocument *aDocument, SVGUseElement::ContentRemoved(nsIContent* aChild, nsIContent* aPreviousSibling)
nsIContent *aContainer,
nsIContent *aChild,
nsIContent *aPreviousSibling)
{ {
if (nsContentUtils::IsInSameAnonymousTree(this, aChild)) { if (nsContentUtils::IsInSameAnonymousTree(this, aChild)) {
TriggerReclone(); TriggerReclone();

View File

@@ -828,13 +828,12 @@ InsertAppendedContent(XBLChildrenElement* aPoint,
} }
void void
nsBindingManager::ContentAppended(nsIDocument* aDocument, nsBindingManager::ContentAppended(nsIContent* aFirstNewContent)
nsIContent* aContainer,
nsIContent* aFirstNewContent)
{ {
// Try to find insertion points for all the new kids. // Try to find insertion points for all the new kids.
XBLChildrenElement* point = nullptr; XBLChildrenElement* point = nullptr;
nsIContent* parent = aContainer; nsIContent* container = aFirstNewContent->GetParent();
nsIContent* parent = container;
// Handle appending of default content. // Handle appending of default content.
if (parent && parent->IsActiveChildrenElement()) { if (parent && parent->IsActiveChildrenElement()) {
@@ -863,7 +862,7 @@ nsBindingManager::ContentAppended(nsIDocument* aDocument,
// points. // points.
for (nsIContent* currentChild = aFirstNewContent; currentChild; for (nsIContent* currentChild = aFirstNewContent; currentChild;
currentChild = currentChild->GetNextSibling()) { currentChild = currentChild->GetNextSibling()) {
HandleChildInsertion(aContainer, currentChild, true); HandleChildInsertion(container, currentChild, true);
} }
return; return;
@@ -896,23 +895,19 @@ nsBindingManager::ContentAppended(nsIDocument* aDocument,
} }
void void
nsBindingManager::ContentInserted(nsIDocument* aDocument, nsBindingManager::ContentInserted(nsIContent* aChild)
nsIContent* aContainer,
nsIContent* aChild)
{ {
HandleChildInsertion(aContainer, aChild, false); HandleChildInsertion(aChild->GetParent(), aChild, false);
} }
void void
nsBindingManager::ContentRemoved(nsIDocument* aDocument, nsBindingManager::ContentRemoved(nsIContent* aChild,
nsIContent* aContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling) nsIContent* aPreviousSibling)
{ {
aChild->SetXBLInsertionPoint(nullptr); aChild->SetXBLInsertionPoint(nullptr);
XBLChildrenElement* point = nullptr; XBLChildrenElement* point = nullptr;
nsIContent* parent = aContainer; nsIContent* parent = aChild->GetParent();
// Handle appending of default content. // Handle appending of default content.
if (parent && parent->IsActiveChildrenElement()) { if (parent && parent->IsActiveChildrenElement()) {

View File

@@ -221,8 +221,7 @@ nsXMLPrettyPrinter::Unhook()
} }
void void
nsXMLPrettyPrinter::AttributeChanged(nsIDocument* aDocument, nsXMLPrettyPrinter::AttributeChanged(Element* aElement,
Element* aElement,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsAtom* aAttribute, nsAtom* aAttribute,
int32_t aModType, int32_t aModType,
@@ -232,28 +231,22 @@ nsXMLPrettyPrinter::AttributeChanged(nsIDocument* aDocument,
} }
void void
nsXMLPrettyPrinter::ContentAppended(nsIDocument* aDocument, nsXMLPrettyPrinter::ContentAppended(nsIContent* aFirstNewContent)
nsIContent* aContainer,
nsIContent* aFirstNewContent)
{ {
MaybeUnhook(aContainer); MaybeUnhook(aFirstNewContent->GetParent());
} }
void void
nsXMLPrettyPrinter::ContentInserted(nsIDocument* aDocument, nsXMLPrettyPrinter::ContentInserted(nsIContent* aChild)
nsIContent* aContainer,
nsIContent* aChild)
{ {
MaybeUnhook(aContainer); MaybeUnhook(aChild->GetParent());
} }
void void
nsXMLPrettyPrinter::ContentRemoved(nsIDocument* aDocument, nsXMLPrettyPrinter::ContentRemoved(nsIContent* aChild,
nsIContent* aContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling) nsIContent* aPreviousSibling)
{ {
MaybeUnhook(aContainer); MaybeUnhook(aChild->GetParent());
} }
void void

View File

@@ -122,16 +122,14 @@ XPathResult::NodeWillBeDestroyed(const nsINode* aNode)
} }
void void
XPathResult::CharacterDataChanged(nsIDocument* aDocument, XPathResult::CharacterDataChanged(nsIContent* aContent,
nsIContent* aContent,
const CharacterDataChangeInfo&) const CharacterDataChangeInfo&)
{ {
Invalidate(aContent); Invalidate(aContent);
} }
void void
XPathResult::AttributeChanged(nsIDocument* aDocument, XPathResult::AttributeChanged(Element* aElement,
Element* aElement,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsAtom* aAttribute, nsAtom* aAttribute,
int32_t aModType, int32_t aModType,
@@ -141,28 +139,21 @@ XPathResult::AttributeChanged(nsIDocument* aDocument,
} }
void void
XPathResult::ContentAppended(nsIDocument* aDocument, XPathResult::ContentAppended(nsIContent* aFirstNewContent)
nsIContent* aContainer,
nsIContent* aFirstNewContent)
{ {
Invalidate(aContainer); Invalidate(aFirstNewContent->GetParent());
} }
void void
XPathResult::ContentInserted(nsIDocument* aDocument, XPathResult::ContentInserted(nsIContent* aChild)
nsIContent* aContainer,
nsIContent* aChild)
{ {
Invalidate(aContainer); Invalidate(aChild->GetParent());
} }
void void
XPathResult::ContentRemoved(nsIDocument* aDocument, XPathResult::ContentRemoved(nsIContent* aChild, nsIContent* aPreviousSibling)
nsIContent* aContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling)
{ {
Invalidate(aContainer); Invalidate(aChild->GetParent());
} }
nsresult nsresult

View File

@@ -1235,16 +1235,14 @@ txMozillaXSLTProcessor::NodeWillBeDestroyed(const nsINode* aNode)
} }
void void
txMozillaXSLTProcessor::CharacterDataChanged(nsIDocument* aDocument, txMozillaXSLTProcessor::CharacterDataChanged(nsIContent* aContent,
nsIContent* aContent,
const CharacterDataChangeInfo&) const CharacterDataChangeInfo&)
{ {
mStylesheet = nullptr; mStylesheet = nullptr;
} }
void void
txMozillaXSLTProcessor::AttributeChanged(nsIDocument* aDocument, txMozillaXSLTProcessor::AttributeChanged(Element* aElement,
Element* aElement,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsAtom* aAttribute, nsAtom* aAttribute,
int32_t aModType, int32_t aModType,
@@ -1254,25 +1252,19 @@ txMozillaXSLTProcessor::AttributeChanged(nsIDocument* aDocument,
} }
void void
txMozillaXSLTProcessor::ContentAppended(nsIDocument* aDocument, txMozillaXSLTProcessor::ContentAppended(nsIContent* aFirstNewContent)
nsIContent* aContainer,
nsIContent* aFirstNewContent)
{ {
mStylesheet = nullptr; mStylesheet = nullptr;
} }
void void
txMozillaXSLTProcessor::ContentInserted(nsIDocument* aDocument, txMozillaXSLTProcessor::ContentInserted(nsIContent* aChild)
nsIContent* aContainer,
nsIContent* aChild)
{ {
mStylesheet = nullptr; mStylesheet = nullptr;
} }
void void
txMozillaXSLTProcessor::ContentRemoved(nsIDocument* aDocument, txMozillaXSLTProcessor::ContentRemoved(nsIContent* aChild,
nsIContent* aContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling) nsIContent* aPreviousSibling)
{ {
mStylesheet = nullptr; mStylesheet = nullptr;

View File

@@ -855,12 +855,11 @@ ShouldPersistAttribute(Element* aElement, nsAtom* aAttribute)
} }
void void
XULDocument::AttributeChanged(nsIDocument* aDocument, XULDocument::AttributeChanged(Element* aElement, int32_t aNameSpaceID,
Element* aElement, int32_t aNameSpaceID,
nsAtom* aAttribute, int32_t aModType, nsAtom* aAttribute, int32_t aModType,
const nsAttrValue* aOldValue) const nsAttrValue* aOldValue)
{ {
NS_ASSERTION(aDocument == this, "unexpected doc"); NS_ASSERTION(aElement->OwnerDoc() == this, "unexpected doc");
// Might not need this, but be safe for now. // Might not need this, but be safe for now.
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this); nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
@@ -943,11 +942,9 @@ XULDocument::AttributeChanged(nsIDocument* aDocument,
} }
void void
XULDocument::ContentAppended(nsIDocument* aDocument, XULDocument::ContentAppended(nsIContent* aFirstNewContent)
nsIContent* aContainer,
nsIContent* aFirstNewContent)
{ {
NS_ASSERTION(aDocument == this, "unexpected doc"); NS_ASSERTION(aFirstNewContent->OwnerDoc() == this, "unexpected doc");
// Might not need this, but be safe for now. // Might not need this, but be safe for now.
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this); nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
@@ -961,11 +958,9 @@ XULDocument::ContentAppended(nsIDocument* aDocument,
} }
void void
XULDocument::ContentInserted(nsIDocument* aDocument, XULDocument::ContentInserted(nsIContent* aChild)
nsIContent* aContainer,
nsIContent* aChild)
{ {
NS_ASSERTION(aDocument == this, "unexpected doc"); NS_ASSERTION(aChild->OwnerDoc() == this, "unexpected doc");
// Might not need this, but be safe for now. // Might not need this, but be safe for now.
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this); nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
@@ -974,12 +969,9 @@ XULDocument::ContentInserted(nsIDocument* aDocument,
} }
void void
XULDocument::ContentRemoved(nsIDocument* aDocument, XULDocument::ContentRemoved(nsIContent* aChild, nsIContent* aPreviousSibling)
nsIContent* aContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling)
{ {
NS_ASSERTION(aDocument == this, "unexpected doc"); NS_ASSERTION(aChild->OwnerDoc() == this, "unexpected doc");
// Might not need this, but be safe for now. // Might not need this, but be safe for now.
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this); nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);

View File

@@ -314,8 +314,7 @@ HTMLEditor::DeleteRefToAnonymousNode(ManualNACPtr aContent,
// FIXME(emilio): This is the only caller to PresShell::ContentRemoved that // FIXME(emilio): This is the only caller to PresShell::ContentRemoved that
// passes NAC into it. This is not great! // passes NAC into it. This is not great!
aShell->ContentRemoved( aShell->ContentRemoved(aContent, nullptr);
aContent->GetComposedDoc(), parentContent, aContent, nullptr);
if (document) { if (document) {
aShell->EndUpdate(document, UPDATE_CONTENT_MODEL); aShell->EndUpdate(document, UPDATE_CONTENT_MODEL);

View File

@@ -3136,25 +3136,19 @@ HTMLEditor::InsertTextImpl(nsIDocument& aDocument,
} }
void void
HTMLEditor::ContentAppended(nsIDocument* aDocument, HTMLEditor::ContentAppended(nsIContent* aFirstNewContent)
nsIContent* aContainer,
nsIContent* aFirstNewContent)
{ {
DoContentInserted(aDocument, aContainer, aFirstNewContent, eAppended); DoContentInserted(aFirstNewContent, eAppended);
} }
void void
HTMLEditor::ContentInserted(nsIDocument* aDocument, HTMLEditor::ContentInserted(nsIContent* aChild)
nsIContent* aContainer,
nsIContent* aChild)
{ {
DoContentInserted(aDocument, aContainer, aChild, eInserted); DoContentInserted(aChild, eInserted);
} }
bool bool
HTMLEditor::IsInObservedSubtree(nsIDocument* aDocument, HTMLEditor::IsInObservedSubtree(nsIContent* aChild)
nsIContent* aContainer,
nsIContent* aChild)
{ {
if (!aChild) { if (!aChild) {
return false; return false;
@@ -3173,16 +3167,14 @@ HTMLEditor::IsInObservedSubtree(nsIDocument* aDocument,
} }
void void
HTMLEditor::DoContentInserted(nsIDocument* aDocument, HTMLEditor::DoContentInserted(nsIContent* aChild,
nsIContent* aContainer,
nsIContent* aChild,
InsertedOrAppended aInsertedOrAppended) InsertedOrAppended aInsertedOrAppended)
{ {
MOZ_ASSERT(aChild); MOZ_ASSERT(aChild);
nsINode* container = NODE_FROM(aContainer, aDocument); nsINode* container = aChild->GetParentNode();
MOZ_ASSERT(container); MOZ_ASSERT(container);
if (!IsInObservedSubtree(aDocument, aContainer, aChild)) { if (!IsInObservedSubtree(aChild)) {
return; return;
} }
@@ -3223,12 +3215,10 @@ HTMLEditor::DoContentInserted(nsIDocument* aDocument,
} }
void void
HTMLEditor::ContentRemoved(nsIDocument* aDocument, HTMLEditor::ContentRemoved(nsIContent* aChild,
nsIContent* aContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling) nsIContent* aPreviousSibling)
{ {
if (!IsInObservedSubtree(aDocument, aContainer, aChild)) { if (!IsInObservedSubtree(aChild)) {
return; return;
} }
@@ -3243,9 +3233,8 @@ HTMLEditor::ContentRemoved(nsIDocument* aDocument,
NewRunnableMethod("HTMLEditor::NotifyRootChanged", NewRunnableMethod("HTMLEditor::NotifyRootChanged",
this, this,
&HTMLEditor::NotifyRootChanged)); &HTMLEditor::NotifyRootChanged));
}
// We don't need to handle our own modifications // We don't need to handle our own modifications
else if (!mAction && (aContainer ? aContainer->IsEditable() : aDocument->IsEditable())) { } else if (!mAction && aChild->GetParentNode()->IsEditable()) {
if (aChild && IsMozEditorBogusNode(aChild)) { if (aChild && IsMozEditorBogusNode(aChild)) {
// Ignore removal of the bogus node // Ignore removal of the bogus node
return; return;

View File

@@ -1163,9 +1163,7 @@ protected:
int32_t& aMarginLeft, int32_t& aMarginLeft,
int32_t& aMarginTop); int32_t& aMarginTop);
bool IsInObservedSubtree(nsIDocument* aDocument, bool IsInObservedSubtree(nsIContent* aChild);
nsIContent* aContainer,
nsIContent* aChild);
void UpdateRootElement(); void UpdateRootElement();
@@ -1359,9 +1357,7 @@ private:
nsAtom* aAttribute, nsAtom* aAttribute,
const nsAString& aValue); const nsAString& aValue);
typedef enum { eInserted, eAppended } InsertedOrAppended; typedef enum { eInserted, eAppended } InsertedOrAppended;
void DoContentInserted(nsIDocument* aDocument, nsIContent* aContainer, void DoContentInserted(nsIContent* aChild, InsertedOrAppended);
nsIContent* aChild,
InsertedOrAppended aInsertedOrAppended);
already_AddRefed<Element> GetElementOrParentByTagName( already_AddRefed<Element> GetElementOrParentByTagName(
const nsAString& aTagName, nsINode* aNode); const nsAString& aTagName, nsINode* aNode);
already_AddRefed<Element> CreateElementWithDefaults( already_AddRefed<Element> CreateElementWithDefaults(

View File

@@ -4291,12 +4291,11 @@ PresShell::DoFlushPendingNotifications(mozilla::ChangesToFlush aFlush)
} }
void void
PresShell::CharacterDataChanged(nsIDocument* aDocument, PresShell::CharacterDataChanged(nsIContent* aContent,
nsIContent* aContent,
const CharacterDataChangeInfo& aInfo) const CharacterDataChangeInfo& aInfo)
{ {
NS_PRECONDITION(!mIsDocumentGone, "Unexpected CharacterDataChanged"); NS_PRECONDITION(!mIsDocumentGone, "Unexpected CharacterDataChanged");
NS_PRECONDITION(aDocument == mDocument, "Unexpected aDocument"); NS_PRECONDITION(aContent->OwnerDoc() == mDocument, "Unexpected document");
nsAutoCauseReflowNotifier crNotifier(this); nsAutoCauseReflowNotifier crNotifier(this);
@@ -4357,15 +4356,14 @@ PresShell::DocumentStatesChanged(nsIDocument* aDocument, EventStates aStateMask)
} }
void void
PresShell::AttributeWillChange(nsIDocument* aDocument, PresShell::AttributeWillChange(Element* aElement,
Element* aElement, int32_t aNameSpaceID,
int32_t aNameSpaceID, nsAtom* aAttribute,
nsAtom* aAttribute, int32_t aModType,
int32_t aModType,
const nsAttrValue* aNewValue) const nsAttrValue* aNewValue)
{ {
NS_PRECONDITION(!mIsDocumentGone, "Unexpected AttributeWillChange"); NS_PRECONDITION(!mIsDocumentGone, "Unexpected AttributeWillChange");
NS_PRECONDITION(aDocument == mDocument, "Unexpected aDocument"); NS_PRECONDITION(aElement->OwnerDoc() == mDocument, "Unexpected document");
// XXXwaterson it might be more elegant to wait until after the // XXXwaterson it might be more elegant to wait until after the
// initial reflow to begin observing the document. That would // initial reflow to begin observing the document. That would
@@ -4380,15 +4378,14 @@ PresShell::AttributeWillChange(nsIDocument* aDocument,
} }
void void
PresShell::AttributeChanged(nsIDocument* aDocument, PresShell::AttributeChanged(Element* aElement,
Element* aElement, int32_t aNameSpaceID,
int32_t aNameSpaceID, nsAtom* aAttribute,
nsAtom* aAttribute, int32_t aModType,
int32_t aModType,
const nsAttrValue* aOldValue) const nsAttrValue* aOldValue)
{ {
NS_PRECONDITION(!mIsDocumentGone, "Unexpected AttributeChanged"); NS_PRECONDITION(!mIsDocumentGone, "Unexpected AttributeChanged");
NS_PRECONDITION(aDocument == mDocument, "Unexpected aDocument"); NS_PRECONDITION(aElement->OwnerDoc() == mDocument, "Unexpected document");
// XXXwaterson it might be more elegant to wait until after the // XXXwaterson it might be more elegant to wait until after the
// initial reflow to begin observing the document. That would // initial reflow to begin observing the document. That would
@@ -4402,39 +4399,18 @@ PresShell::AttributeChanged(nsIDocument* aDocument,
} }
} }
// nsIMutationObserver callbacks have this terrible API where aContainer is
// null in the case that the container is the document (since nsIDocument is
// not an nsIContent), and callees are supposed to figure this out and use the
// document instead. It would be nice to fix that API to just pass a single
// nsINode* parameter in place of the nsIDocument*, nsIContent* pair, but
// there are quite a lot of consumers. So we fix things up locally with this
// routine for now.
static inline nsINode*
RealContainer(nsIDocument* aDocument, nsIContent* aContainer, nsIContent* aContent)
{
MOZ_ASSERT(aDocument);
MOZ_ASSERT(!aContainer || aContainer->OwnerDoc() == aDocument);
MOZ_ASSERT(aContent->OwnerDoc() == aDocument);
MOZ_ASSERT(aContainer || aContent->GetParentNode() == aDocument);
if (!aContainer) {
return aDocument;
}
return aContainer;
}
void void
PresShell::ContentAppended(nsIDocument *aDocument, PresShell::ContentAppended(nsIContent* aFirstNewContent)
nsIContent* aContainer,
nsIContent* aFirstNewContent)
{ {
NS_PRECONDITION(!mIsDocumentGone, "Unexpected ContentAppended"); NS_PRECONDITION(!mIsDocumentGone, "Unexpected ContentAppended");
NS_PRECONDITION(aDocument == mDocument, "Unexpected aDocument"); NS_PRECONDITION(aFirstNewContent->OwnerDoc() == mDocument,
"Unexpected document");
// We never call ContentAppended with a document as the container, so we can // We never call ContentAppended with a document as the container, so we can
// assert that we have an nsIContent container. // assert that we have an nsIContent container.
MOZ_ASSERT(aContainer); nsIContent* container = aFirstNewContent->GetParent();
MOZ_ASSERT(aContainer->IsElement() || MOZ_ASSERT(container);
aContainer->IsNodeOfType(nsINode::eDOCUMENT_FRAGMENT)); MOZ_ASSERT(container->IsElement() || container->IsShadowRoot());
if (!mDidInitialize) { if (!mDidInitialize) {
return; return;
} }
@@ -4444,10 +4420,10 @@ PresShell::ContentAppended(nsIDocument *aDocument,
// Call this here so it only happens for real content mutations and // Call this here so it only happens for real content mutations and
// not cases when the frame constructor calls its own methods to force // not cases when the frame constructor calls its own methods to force
// frame reconstruction. // frame reconstruction.
mPresContext->RestyleManager()->ContentAppended(aContainer, aFirstNewContent); mPresContext->RestyleManager()->ContentAppended(container, aFirstNewContent);
mFrameConstructor->ContentAppended( mFrameConstructor->ContentAppended(
aContainer, container,
aFirstNewContent, aFirstNewContent,
nsCSSFrameConstructor::InsertionKind::Async); nsCSSFrameConstructor::InsertionKind::Async);
@@ -4455,13 +4431,11 @@ PresShell::ContentAppended(nsIDocument *aDocument,
} }
void void
PresShell::ContentInserted(nsIDocument* aDocument, PresShell::ContentInserted(nsIContent* aChild)
nsIContent* aMaybeContainer,
nsIContent* aChild)
{ {
NS_PRECONDITION(!mIsDocumentGone, "Unexpected ContentInserted"); NS_PRECONDITION(!mIsDocumentGone, "Unexpected ContentInserted");
NS_PRECONDITION(aDocument == mDocument, "Unexpected aDocument"); NS_PRECONDITION(aChild->OwnerDoc() == mDocument, "Unexpected document");
nsINode* container = RealContainer(aDocument, aMaybeContainer, aChild); nsINode* container = aChild->GetParentNode();
if (!mDidInitialize) { if (!mDidInitialize) {
return; return;
@@ -4475,7 +4449,7 @@ PresShell::ContentInserted(nsIDocument* aDocument,
mPresContext->RestyleManager()->ContentInserted(container, aChild); mPresContext->RestyleManager()->ContentInserted(container, aChild);
mFrameConstructor->ContentInserted( mFrameConstructor->ContentInserted(
aMaybeContainer, aChild->GetParent(),
aChild, aChild,
nullptr, nullptr,
nsCSSFrameConstructor::InsertionKind::Async); nsCSSFrameConstructor::InsertionKind::Async);
@@ -4484,25 +4458,17 @@ PresShell::ContentInserted(nsIDocument* aDocument,
} }
void void
PresShell::ContentRemoved(nsIDocument* aDocument, PresShell::ContentRemoved(nsIContent* aChild, nsIContent* aPreviousSibling)
nsIContent* aMaybeContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling)
{ {
NS_PRECONDITION(!mIsDocumentGone, "Unexpected ContentRemoved"); NS_PRECONDITION(!mIsDocumentGone, "Unexpected ContentRemoved");
NS_PRECONDITION(aDocument == mDocument, "Unexpected aDocument"); NS_PRECONDITION(aChild->OwnerDoc() == mDocument, "Unexpected document");
nsINode* container = RealContainer(aDocument, aMaybeContainer, aChild); nsINode* container = aChild->GetParentNode();
// Notify the ESM that the content has been removed, so that // Notify the ESM that the content has been removed, so that
// it can clean up any state related to the content. // it can clean up any state related to the content.
// XXX_jwir3: There is no null check for aDocument necessary, since, even
// though by nsIMutationObserver, aDocument could be null, the
// precondition check that mDocument == aDocument ensures that
// aDocument will not be null (since mDocument can't be null unless
// we're still intializing).
mPresContext->EventStateManager() mPresContext->EventStateManager()
->ContentRemoved(aDocument, aMaybeContainer, aChild); ->ContentRemoved(mDocument, aChild->GetParent(), aChild);
nsAutoCauseReflowNotifier crNotifier(this); nsAutoCauseReflowNotifier crNotifier(this);
@@ -4524,11 +4490,12 @@ PresShell::ContentRemoved(nsIDocument* aDocument,
// After removing aChild from tree we should save information about live ancestor // After removing aChild from tree we should save information about live ancestor
if (mPointerEventTarget && if (mPointerEventTarget &&
nsContentUtils::ContentIsDescendantOf(mPointerEventTarget, aChild)) { nsContentUtils::ContentIsDescendantOf(mPointerEventTarget, aChild)) {
mPointerEventTarget = aMaybeContainer; mPointerEventTarget = aChild->GetParent();
} }
mFrameConstructor->ContentRemoved(aMaybeContainer, aChild, oldNextSibling, mFrameConstructor->ContentRemoved(
nsCSSFrameConstructor::REMOVE_CONTENT); aChild->GetParent(), aChild, oldNextSibling,
nsCSSFrameConstructor::REMOVE_CONTENT);
VERIFY_STYLE_TREE; VERIFY_STYLE_TREE;
} }
@@ -6787,7 +6754,7 @@ nsIFrame* GetNearestFrameContainingPresShell(nsIPresShell* aPresShell)
} }
static bool static bool
FlushThrottledStyles(nsIDocument *aDocument, void *aData) FlushThrottledStyles(nsIDocument* aDocument, void *aData)
{ {
nsIPresShell* shell = aDocument->GetShell(); nsIPresShell* shell = aDocument->GetShell();
if (shell && shell->IsVisible()) { if (shell && shell->IsVisible()) {

View File

@@ -1466,7 +1466,6 @@ NS_IMPL_ISUPPORTS(nsTextControlFrame::nsAnonDivObserver, nsIMutationObserver)
void void
nsTextControlFrame::nsAnonDivObserver::CharacterDataChanged( nsTextControlFrame::nsAnonDivObserver::CharacterDataChanged(
nsIDocument* aDocument,
nsIContent* aContent, nsIContent* aContent,
const CharacterDataChangeInfo&) const CharacterDataChangeInfo&)
{ {
@@ -1475,26 +1474,19 @@ nsTextControlFrame::nsAnonDivObserver::CharacterDataChanged(
void void
nsTextControlFrame::nsAnonDivObserver::ContentAppended( nsTextControlFrame::nsAnonDivObserver::ContentAppended(
nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent) nsIContent* aFirstNewContent)
{ {
mFrame.ClearCachedValue(); mFrame.ClearCachedValue();
} }
void void
nsTextControlFrame::nsAnonDivObserver::ContentInserted( nsTextControlFrame::nsAnonDivObserver::ContentInserted(nsIContent* aChild)
nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild)
{ {
mFrame.ClearCachedValue(); mFrame.ClearCachedValue();
} }
void void
nsTextControlFrame::nsAnonDivObserver::ContentRemoved( nsTextControlFrame::nsAnonDivObserver::ContentRemoved(
nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild, nsIContent* aChild,
nsIContent* aPreviousSibling) nsIContent* aPreviousSibling)
{ {

View File

@@ -880,11 +880,10 @@ nsImageMap::MaybeUpdateAreas(nsIContent* aContent)
} }
void void
nsImageMap::AttributeChanged(nsIDocument* aDocument, nsImageMap::AttributeChanged(dom::Element* aElement,
dom::Element* aElement, int32_t aNameSpaceID,
int32_t aNameSpaceID, nsAtom* aAttribute,
nsAtom* aAttribute, int32_t aModType,
int32_t aModType,
const nsAttrValue* aOldValue) const nsAttrValue* aOldValue)
{ {
// If the parent of the changing content node is our map then update // If the parent of the changing content node is our map then update
@@ -909,19 +908,15 @@ nsImageMap::AttributeChanged(nsIDocument* aDocument,
} }
void void
nsImageMap::ContentAppended(nsIDocument *aDocument, nsImageMap::ContentAppended(nsIContent* aFirstNewContent)
nsIContent* aContainer,
nsIContent* aFirstNewContent)
{ {
MaybeUpdateAreas(aContainer); MaybeUpdateAreas(aFirstNewContent->GetParent());
} }
void void
nsImageMap::ContentInserted(nsIDocument *aDocument, nsImageMap::ContentInserted(nsIContent* aChild)
nsIContent* aContainer,
nsIContent* aChild)
{ {
MaybeUpdateAreas(aContainer); MaybeUpdateAreas(aChild->GetParent());
} }
static UniquePtr<Area> static UniquePtr<Area>
@@ -945,12 +940,10 @@ TakeArea(nsImageMap::AreaList& aAreas, HTMLAreaElement* aArea)
} }
void void
nsImageMap::ContentRemoved(nsIDocument *aDocument, nsImageMap::ContentRemoved(nsIContent* aChild,
nsIContent* aContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling) nsIContent* aPreviousSibling)
{ {
if (aContainer != mMap && !mConsiderWholeSubtree) { if (aChild->GetParent() != mMap && !mConsiderWholeSubtree) {
return; return;
} }

View File

@@ -618,7 +618,7 @@ inDOMView::NodeWillBeDestroyed(const nsINode* aNode)
} }
void void
inDOMView::AttributeChanged(nsIDocument* aDocument, dom::Element* aElement, inDOMView::AttributeChanged(dom::Element* aElement,
int32_t aNameSpaceID, nsAtom* aAttribute, int32_t aNameSpaceID, nsAtom* aAttribute,
int32_t aModType, int32_t aModType,
const nsAttrValue* aOldValue) const nsAttrValue* aOldValue)
@@ -747,17 +747,14 @@ inDOMView::AttributeChanged(nsIDocument* aDocument, dom::Element* aElement,
} }
void void
inDOMView::ContentAppended(nsIDocument *aDocument, inDOMView::ContentAppended(nsIContent* aFirstNewContent)
nsIContent* aContainer,
nsIContent* aFirstNewContent)
{ {
if (!mTree) { if (!mTree) {
return; return;
} }
for (nsIContent* cur = aFirstNewContent; cur; cur = cur->GetNextSibling()) { for (nsIContent* cur = aFirstNewContent; cur; cur = cur->GetNextSibling()) {
// Our ContentInserted impl doesn't use the index ContentInserted(cur);
ContentInserted(aDocument, aContainer, cur);
} }
} }
@@ -772,8 +769,7 @@ GetParentForNode(nsINode* aChild, bool aShowAnonymous)
} }
void void
inDOMView::ContentInserted(nsIDocument *aDocument, nsIContent* aContainer, inDOMView::ContentInserted(nsIContent* aChild)
nsIContent* aChild)
{ {
if (!mTree) if (!mTree)
return; return;
@@ -845,8 +841,7 @@ inDOMView::ContentInserted(nsIDocument *aDocument, nsIContent* aContainer,
} }
void void
inDOMView::ContentRemoved(nsIDocument *aDocument, nsIContent* aContainer, inDOMView::ContentRemoved(nsIContent* aChild, nsIContent* aPreviousSibling)
nsIContent* aChild, nsIContent* aPreviousSibling)
{ {
if (!mTree) if (!mTree)
return; return;

View File

@@ -113,8 +113,7 @@ nsSVGRenderingObserver::NotifyEvictedFromRenderingObserverList()
} }
void void
nsSVGRenderingObserver::AttributeChanged(nsIDocument* aDocument, nsSVGRenderingObserver::AttributeChanged(dom::Element* aElement,
dom::Element* aElement,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsAtom* aAttribute, nsAtom* aAttribute,
int32_t aModType, int32_t aModType,
@@ -137,25 +136,19 @@ nsSVGRenderingObserver::AttributeChanged(nsIDocument* aDocument,
} }
void void
nsSVGRenderingObserver::ContentAppended(nsIDocument* aDocument, nsSVGRenderingObserver::ContentAppended(nsIContent* aFirstNewContent)
nsIContent* aContainer,
nsIContent* aFirstNewContent)
{ {
OnRenderingChange(); OnRenderingChange();
} }
void void
nsSVGRenderingObserver::ContentInserted(nsIDocument* aDocument, nsSVGRenderingObserver::ContentInserted(nsIContent* aChild)
nsIContent* aContainer,
nsIContent* aChild)
{ {
OnRenderingChange(); OnRenderingChange();
} }
void void
nsSVGRenderingObserver::ContentRemoved(nsIDocument* aDocument, nsSVGRenderingObserver::ContentRemoved(nsIContent* aChild,
nsIContent* aContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling) nsIContent* aPreviousSibling)
{ {
OnRenderingChange(); OnRenderingChange();

View File

@@ -3338,44 +3338,33 @@ SVGTextFrame::ScheduleReflowSVGNonDisplayText(nsIPresShell::IntrinsicDirty aReas
NS_IMPL_ISUPPORTS(SVGTextFrame::MutationObserver, nsIMutationObserver) NS_IMPL_ISUPPORTS(SVGTextFrame::MutationObserver, nsIMutationObserver)
void void
SVGTextFrame::MutationObserver::ContentAppended(nsIDocument* aDocument, SVGTextFrame::MutationObserver::ContentAppended(nsIContent* aFirstNewContent)
nsIContent* aContainer,
nsIContent* aFirstNewContent)
{ {
mFrame->NotifyGlyphMetricsChange(); mFrame->NotifyGlyphMetricsChange();
} }
void void
SVGTextFrame::MutationObserver::ContentInserted( SVGTextFrame::MutationObserver::ContentInserted(nsIContent* aChild)
nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild)
{ {
mFrame->NotifyGlyphMetricsChange(); mFrame->NotifyGlyphMetricsChange();
} }
void void
SVGTextFrame::MutationObserver::ContentRemoved( SVGTextFrame::MutationObserver::ContentRemoved(nsIContent* aChild,
nsIDocument *aDocument, nsIContent* aPreviousSibling)
nsIContent* aContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling)
{ {
mFrame->NotifyGlyphMetricsChange(); mFrame->NotifyGlyphMetricsChange();
} }
void void
SVGTextFrame::MutationObserver::CharacterDataChanged( SVGTextFrame::MutationObserver::CharacterDataChanged(nsIContent* aContent,
nsIDocument* aDocument, const CharacterDataChangeInfo&)
nsIContent* aContent,
const CharacterDataChangeInfo&)
{ {
mFrame->NotifyGlyphMetricsChange(); mFrame->NotifyGlyphMetricsChange();
} }
void void
SVGTextFrame::MutationObserver::AttributeChanged( SVGTextFrame::MutationObserver::AttributeChanged(
nsIDocument* aDocument,
mozilla::dom::Element* aElement, mozilla::dom::Element* aElement,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsAtom* aAttribute, nsAtom* aAttribute,

View File

@@ -895,8 +895,7 @@ nsTreeContentView::GetIndexOfItem(nsIDOMElement* aItem, int32_t* _retval)
} }
void void
nsTreeContentView::AttributeChanged(nsIDocument* aDocument, nsTreeContentView::AttributeChanged(dom::Element* aElement,
dom::Element* aElement,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsAtom* aAttribute, nsAtom* aAttribute,
int32_t aModType, int32_t aModType,
@@ -1050,28 +1049,25 @@ nsTreeContentView::AttributeChanged(nsIDocument* aDocument,
} }
void void
nsTreeContentView::ContentAppended(nsIDocument *aDocument, nsTreeContentView::ContentAppended(nsIContent* aFirstNewContent)
nsIContent* aContainer,
nsIContent* aFirstNewContent)
{ {
for (nsIContent* cur = aFirstNewContent; cur; cur = cur->GetNextSibling()) { for (nsIContent* cur = aFirstNewContent; cur; cur = cur->GetNextSibling()) {
// Our contentinserted doesn't use the index // Our contentinserted doesn't use the index
ContentInserted(aDocument, aContainer, cur); ContentInserted(cur);
} }
} }
void void
nsTreeContentView::ContentInserted(nsIDocument *aDocument, nsTreeContentView::ContentInserted(nsIContent* aChild)
nsIContent* aContainer,
nsIContent* aChild)
{ {
NS_ASSERTION(aChild, "null ptr"); NS_ASSERTION(aChild, "null ptr");
nsIContent* container = aChild->GetParent();
// Make sure this notification concerns us. // Make sure this notification concerns us.
// First check the tag to see if it's one that we care about. // First check the tag to see if it's one that we care about.
// Don't allow non-XUL nodes. // Don't allow non-XUL nodes.
if (!aChild->IsXULElement() || !aContainer->IsXULElement()) if (!aChild->IsXULElement() || !container->IsXULElement())
return; return;
if (!aChild->IsAnyOfXULElements(nsGkAtoms::treeitem, if (!aChild->IsAnyOfXULElements(nsGkAtoms::treeitem,
@@ -1085,7 +1081,7 @@ nsTreeContentView::ContentInserted(nsIDocument *aDocument,
// If we have a legal tag, go up to the tree/select and make sure // If we have a legal tag, go up to the tree/select and make sure
// that it's ours. // that it's ours.
for (nsIContent* element = aContainer; element != mBody; element = element->GetParent()) { for (nsIContent* element = container; element != mBody; element = element->GetParent()) {
if (!element) if (!element)
return; // this is not for us return; // this is not for us
if (element->IsXULElement(nsGkAtoms::tree)) if (element->IsXULElement(nsGkAtoms::tree))
@@ -1096,7 +1092,7 @@ nsTreeContentView::ContentInserted(nsIDocument *aDocument,
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this); nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
if (aChild->IsXULElement(nsGkAtoms::treechildren)) { if (aChild->IsXULElement(nsGkAtoms::treechildren)) {
int32_t index = FindContent(aContainer); int32_t index = FindContent(container);
if (index >= 0) { if (index >= 0) {
Row* row = mRows[index].get(); Row* row = mRows[index].get();
row->SetEmpty(false); row->SetEmpty(false);
@@ -1111,15 +1107,15 @@ nsTreeContentView::ContentInserted(nsIDocument *aDocument,
} }
else if (aChild->IsAnyOfXULElements(nsGkAtoms::treeitem, else if (aChild->IsAnyOfXULElements(nsGkAtoms::treeitem,
nsGkAtoms::treeseparator)) { nsGkAtoms::treeseparator)) {
InsertRowFor(aContainer, aChild); InsertRowFor(container, aChild);
} }
else if (aChild->IsXULElement(nsGkAtoms::treerow)) { else if (aChild->IsXULElement(nsGkAtoms::treerow)) {
int32_t index = FindContent(aContainer); int32_t index = FindContent(container);
if (index >= 0 && mBoxObject) if (index >= 0 && mBoxObject)
mBoxObject->InvalidateRow(index); mBoxObject->InvalidateRow(index);
} }
else if (aChild->IsXULElement(nsGkAtoms::treecell)) { else if (aChild->IsXULElement(nsGkAtoms::treecell)) {
nsCOMPtr<nsIContent> parent = aContainer->GetParent(); nsCOMPtr<nsIContent> parent = container->GetParent();
if (parent) { if (parent) {
int32_t index = FindContent(parent); int32_t index = FindContent(parent);
if (index >= 0 && mBoxObject) if (index >= 0 && mBoxObject)
@@ -1129,18 +1125,17 @@ nsTreeContentView::ContentInserted(nsIDocument *aDocument,
} }
void void
nsTreeContentView::ContentRemoved(nsIDocument *aDocument, nsTreeContentView::ContentRemoved(nsIContent* aChild,
nsIContent* aContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling) nsIContent* aPreviousSibling)
{ {
NS_ASSERTION(aChild, "null ptr"); NS_ASSERTION(aChild, "null ptr");
nsIContent* container = aChild->GetParent();
// Make sure this notification concerns us. // Make sure this notification concerns us.
// First check the tag to see if it's one that we care about. // First check the tag to see if it's one that we care about.
// We don't consider non-XUL nodes. // We don't consider non-XUL nodes.
if (!aChild->IsXULElement() || !aContainer->IsXULElement()) if (!aChild->IsXULElement() || !container->IsXULElement())
return; return;
if (!aChild->IsAnyOfXULElements(nsGkAtoms::treeitem, if (!aChild->IsAnyOfXULElements(nsGkAtoms::treeitem,
@@ -1154,7 +1149,7 @@ nsTreeContentView::ContentRemoved(nsIDocument *aDocument,
// If we have a legal tag, go up to the tree/select and make sure // If we have a legal tag, go up to the tree/select and make sure
// that it's ours. // that it's ours.
for (nsIContent* element = aContainer; element != mBody; element = element->GetParent()) { for (nsIContent* element = container; element != mBody; element = element->GetParent()) {
if (!element) if (!element)
return; // this is not for us return; // this is not for us
if (element->IsXULElement(nsGkAtoms::tree)) if (element->IsXULElement(nsGkAtoms::tree))
@@ -1165,7 +1160,7 @@ nsTreeContentView::ContentRemoved(nsIDocument *aDocument,
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this); nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
if (aChild->IsXULElement(nsGkAtoms::treechildren)) { if (aChild->IsXULElement(nsGkAtoms::treechildren)) {
int32_t index = FindContent(aContainer); int32_t index = FindContent(container);
if (index >= 0) { if (index >= 0) {
Row* row = mRows[index].get(); Row* row = mRows[index].get();
row->SetEmpty(true); row->SetEmpty(true);
@@ -1187,12 +1182,12 @@ nsTreeContentView::ContentRemoved(nsIDocument *aDocument,
} }
} }
else if (aChild->IsXULElement(nsGkAtoms::treerow)) { else if (aChild->IsXULElement(nsGkAtoms::treerow)) {
int32_t index = FindContent(aContainer); int32_t index = FindContent(container);
if (index >= 0 && mBoxObject) if (index >= 0 && mBoxObject)
mBoxObject->InvalidateRow(index); mBoxObject->InvalidateRow(index);
} }
else if (aChild->IsXULElement(nsGkAtoms::treecell)) { else if (aChild->IsXULElement(nsGkAtoms::treecell)) {
nsCOMPtr<nsIContent> parent = aContainer->GetParent(); nsCOMPtr<nsIContent> parent = container->GetParent();
if (parent) { if (parent) {
int32_t index = FindContent(parent); int32_t index = FindContent(parent);
if (index >= 0 && mBoxObject) if (index >= 0 && mBoxObject)

View File

@@ -138,8 +138,7 @@ nsFormFillController::~nsFormFillController()
// //
void void
nsFormFillController::AttributeChanged(nsIDocument* aDocument, nsFormFillController::AttributeChanged(mozilla::dom::Element* aElement,
mozilla::dom::Element* aElement,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsAtom* aAttribute, int32_t aModType, nsAtom* aAttribute, int32_t aModType,
const nsAttrValue* aOldValue) const nsAttrValue* aOldValue)
@@ -159,7 +158,7 @@ nsFormFillController::AttributeChanged(nsIDocument* aDocument,
this, this,
&nsFormFillController::MaybeStartControllingInput, &nsFormFillController::MaybeStartControllingInput,
focusedInput); focusedInput);
aDocument->Dispatch(TaskCategory::Other, event.forget()); aElement->OwnerDoc()->Dispatch(TaskCategory::Other, event.forget());
} }
if (mListNode && mListNode->Contains(aElement)) { if (mListNode && mListNode->Contains(aElement)) {
@@ -168,53 +167,44 @@ nsFormFillController::AttributeChanged(nsIDocument* aDocument,
} }
void void
nsFormFillController::ContentAppended(nsIDocument* aDocument, nsFormFillController::ContentAppended(nsIContent* aChild)
nsIContent* aContainer,
nsIContent* aChild)
{ {
if (mListNode && mListNode->Contains(aContainer)) { if (mListNode && mListNode->Contains(aChild->GetParent())) {
RevalidateDataList(); RevalidateDataList();
} }
} }
void void
nsFormFillController::ContentInserted(nsIDocument* aDocument, nsFormFillController::ContentInserted(nsIContent* aChild)
nsIContent* aContainer,
nsIContent* aChild)
{ {
if (mListNode && mListNode->Contains(aContainer)) { if (mListNode && mListNode->Contains(aChild->GetParent())) {
RevalidateDataList(); RevalidateDataList();
} }
} }
void void
nsFormFillController::ContentRemoved(nsIDocument* aDocument, nsFormFillController::ContentRemoved(nsIContent* aChild,
nsIContent* aContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling) nsIContent* aPreviousSibling)
{ {
if (mListNode && mListNode->Contains(aContainer)) { if (mListNode && mListNode->Contains(aChild->GetParent())) {
RevalidateDataList(); RevalidateDataList();
} }
} }
void void
nsFormFillController::CharacterDataWillChange(nsIDocument* aDocument, nsFormFillController::CharacterDataWillChange(nsIContent* aContent,
nsIContent* aContent,
const CharacterDataChangeInfo&) const CharacterDataChangeInfo&)
{ {
} }
void void
nsFormFillController::CharacterDataChanged(nsIDocument* aDocument, nsFormFillController::CharacterDataChanged(nsIContent* aContent,
nsIContent* aContent,
const CharacterDataChangeInfo&) const CharacterDataChangeInfo&)
{ {
} }
void void
nsFormFillController::AttributeWillChange(nsIDocument* aDocument, nsFormFillController::AttributeWillChange(mozilla::dom::Element* aElement,
mozilla::dom::Element* aElement,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsAtom* aAttribute, int32_t aModType, nsAtom* aAttribute, int32_t aModType,
const nsAttrValue* aNewValue) const nsAttrValue* aNewValue)
@@ -222,8 +212,7 @@ nsFormFillController::AttributeWillChange(nsIDocument* aDocument,
} }
void void
nsFormFillController::NativeAnonymousChildListChange(nsIDocument* aDocument, nsFormFillController::NativeAnonymousChildListChange(nsIContent* aContent,
nsIContent* aContent,
bool aIsRemove) bool aIsRemove)
{ {
} }

View File

@@ -67,26 +67,22 @@ nsresult nsMenuGroupOwnerX::Create(mozilla::dom::Element* aContent)
// //
void nsMenuGroupOwnerX::CharacterDataWillChange(nsIDocument* aDocument, void nsMenuGroupOwnerX::CharacterDataWillChange(nsIContent* aContent,
nsIContent* aContent,
const CharacterDataChangeInfo&) const CharacterDataChangeInfo&)
{ {
} }
void nsMenuGroupOwnerX::CharacterDataChanged(nsIDocument* aDocument, void nsMenuGroupOwnerX::CharacterDataChanged(nsIContent* aContent,
nsIContent* aContent,
const CharacterDataChangeInfo&) const CharacterDataChangeInfo&)
{ {
} }
void nsMenuGroupOwnerX::ContentAppended(nsIDocument* aDocument, void nsMenuGroupOwnerX::ContentAppended(nsIContent* aFirstNewContent)
nsIContent* aContainer,
nsIContent* aFirstNewContent)
{ {
for (nsIContent* cur = aFirstNewContent; cur; cur = cur->GetNextSibling()) { for (nsIContent* cur = aFirstNewContent; cur; cur = cur->GetNextSibling()) {
ContentInserted(aDocument, aContainer, cur); ContentInserted(cur);
} }
} }
@@ -96,8 +92,7 @@ void nsMenuGroupOwnerX::NodeWillBeDestroyed(const nsINode * aNode)
} }
void nsMenuGroupOwnerX::AttributeWillChange(nsIDocument* aDocument, void nsMenuGroupOwnerX::AttributeWillChange(dom::Element* aContent,
dom::Element* aContent,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsAtom* aAttribute, nsAtom* aAttribute,
int32_t aModType, int32_t aModType,
@@ -105,14 +100,12 @@ void nsMenuGroupOwnerX::AttributeWillChange(nsIDocument* aDocument,
{ {
} }
void nsMenuGroupOwnerX::NativeAnonymousChildListChange(nsIDocument* aDocument, void nsMenuGroupOwnerX::NativeAnonymousChildListChange(nsIContent* aContent,
nsIContent* aContent,
bool aIsRemove) bool aIsRemove)
{ {
} }
void nsMenuGroupOwnerX::AttributeChanged(nsIDocument* aDocument, void nsMenuGroupOwnerX::AttributeChanged(dom::Element* aElement,
dom::Element* aElement,
int32_t aNameSpaceID, int32_t aNameSpaceID,
nsAtom* aAttribute, nsAtom* aAttribute,
int32_t aModType, int32_t aModType,
@@ -121,58 +114,58 @@ void nsMenuGroupOwnerX::AttributeChanged(nsIDocument* aDocument,
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this); nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
nsChangeObserver* obs = LookupContentChangeObserver(aElement); nsChangeObserver* obs = LookupContentChangeObserver(aElement);
if (obs) if (obs)
obs->ObserveAttributeChanged(aDocument, aElement, aAttribute); obs->ObserveAttributeChanged(aElement->OwnerDoc(), aElement, aAttribute);
} }
void nsMenuGroupOwnerX::ContentRemoved(nsIDocument * aDocument, void nsMenuGroupOwnerX::ContentRemoved(nsIContent* aChild,
nsIContent * aContainer, nsIContent* aPreviousSibling)
nsIContent * aChild,
nsIContent * aPreviousSibling)
{ {
if (!aContainer) { nsIContent* container = aChild->GetParent();
if (!container) {
return; return;
} }
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this); nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
nsChangeObserver* obs = LookupContentChangeObserver(aContainer); nsChangeObserver* obs = LookupContentChangeObserver(container);
if (obs) if (obs)
obs->ObserveContentRemoved(aDocument, aContainer, aChild, aPreviousSibling); obs->ObserveContentRemoved(aChild->OwnerDoc(), container, aChild,
else if (aContainer != mContent) { aPreviousSibling);
else if (container != mContent) {
// We do a lookup on the parent container in case things were removed // We do a lookup on the parent container in case things were removed
// under a "menupopup" item. That is basically a wrapper for the contents // under a "menupopup" item. That is basically a wrapper for the contents
// of a "menu" node. // of a "menu" node.
nsCOMPtr<nsIContent> parent = aContainer->GetParent(); nsCOMPtr<nsIContent> parent = container->GetParent();
if (parent) { if (parent) {
obs = LookupContentChangeObserver(parent); obs = LookupContentChangeObserver(parent);
if (obs) if (obs)
obs->ObserveContentRemoved(aDocument, aContainer, aChild, aPreviousSibling); obs->ObserveContentRemoved(aChild->OwnerDoc(), aChild->GetParent(),
aChild, aPreviousSibling);
} }
} }
} }
void nsMenuGroupOwnerX::ContentInserted(nsIDocument * aDocument, void nsMenuGroupOwnerX::ContentInserted(nsIContent* aChild)
nsIContent * aContainer,
nsIContent * aChild)
{ {
if (!aContainer) { nsIContent* container = aChild->GetParent();
if (!container) {
return; return;
} }
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this); nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
nsChangeObserver* obs = LookupContentChangeObserver(aContainer); nsChangeObserver* obs = LookupContentChangeObserver(container);
if (obs) if (obs)
obs->ObserveContentInserted(aDocument, aContainer, aChild); obs->ObserveContentInserted(aChild->OwnerDoc(), container, aChild);
else if (aContainer != mContent) { else if (container != mContent) {
// We do a lookup on the parent container in case things were removed // We do a lookup on the parent container in case things were removed
// under a "menupopup" item. That is basically a wrapper for the contents // under a "menupopup" item. That is basically a wrapper for the contents
// of a "menu" node. // of a "menu" node.
nsCOMPtr<nsIContent> parent = aContainer->GetParent(); nsCOMPtr<nsIContent> parent = container->GetParent();
if (parent) { if (parent) {
obs = LookupContentChangeObserver(parent); obs = LookupContentChangeObserver(parent);
if (obs) if (obs)
obs->ObserveContentInserted(aDocument, aContainer, aChild); obs->ObserveContentInserted(aChild->OwnerDoc(), container, aChild);
} }
} }
} }