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 de47aa59e3
commit 2988d4e66d
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)
void
DocAccessible::AttributeWillChange(nsIDocument* aDocument,
dom::Element* aElement,
DocAccessible::AttributeWillChange(dom::Element* aElement,
int32_t aNameSpaceID,
nsAtom* aAttribute, int32_t aModType,
nsAtom* aAttribute,
int32_t aModType,
const nsAttrValue* aNewValue)
{
Accessible* accessible = GetAccessible(aElement);
@ -748,15 +748,13 @@ DocAccessible::AttributeWillChange(nsIDocument* aDocument,
}
void
DocAccessible::NativeAnonymousChildListChange(nsIDocument* aDocument,
nsIContent* aContent,
DocAccessible::NativeAnonymousChildListChange(nsIContent* aContent,
bool aIsRemove)
{
}
void
DocAccessible::AttributeChanged(nsIDocument* aDocument,
dom::Element* aElement,
DocAccessible::AttributeChanged(dom::Element* aElement,
int32_t aNameSpaceID, nsAtom* aAttribute,
int32_t aModType,
const nsAttrValue* aOldValue)
@ -1086,9 +1084,7 @@ DocAccessible::ARIAActiveDescendantChanged(Accessible* aAccessible)
}
void
DocAccessible::ContentAppended(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent)
DocAccessible::ContentAppended(nsIContent* aFirstNewContent)
{
}
@ -1139,35 +1135,30 @@ DocAccessible::DocumentStatesChanged(nsIDocument* aDocument,
}
void
DocAccessible::CharacterDataWillChange(nsIDocument* aDocument,
nsIContent* aContent,
DocAccessible::CharacterDataWillChange(nsIContent* aContent,
const CharacterDataChangeInfo&)
{
}
void
DocAccessible::CharacterDataChanged(nsIDocument* aDocument,
nsIContent* aContent,
DocAccessible::CharacterDataChanged(nsIContent* aContent,
const CharacterDataChangeInfo&)
{
}
void
DocAccessible::ContentInserted(nsIDocument* aDocument, nsIContent* aContainer,
nsIContent* aChild)
DocAccessible::ContentInserted(nsIContent* aChild)
{
}
void
DocAccessible::ContentRemoved(nsIDocument* aDocument,
nsIContent* aContainerNode,
nsIContent* aChildNode,
DocAccessible::ContentRemoved(nsIContent* aChildNode,
nsIContent* aPreviousSiblingNode)
{
#ifdef A11Y_LOG
if (logging::IsEnabled(logging::eTree)) {
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::MsgEnd();
}

View File

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

View File

@ -224,12 +224,10 @@ NodeIterator::Detach()
* nsIMutationObserver interface
*/
void NodeIterator::ContentRemoved(nsIDocument *aDocument,
nsIContent *aContainer,
nsIContent *aChild,
nsIContent *aPreviousSibling)
void NodeIterator::ContentRemoved(nsIContent* aChild,
nsIContent* aPreviousSibling)
{
nsINode *container = NODE_FROM(aContainer, aDocument);
nsINode* container = aChild->GetParentNode();
mPointer.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
ShadowRoot::AttributeChanged(nsIDocument* aDocument,
Element* aElement,
ShadowRoot::AttributeChanged(Element* aElement,
int32_t aNameSpaceID,
nsAtom* aAttribute,
int32_t aModType,
@ -468,26 +467,22 @@ ShadowRoot::AttributeChanged(nsIDocument* aDocument,
}
void
ShadowRoot::ContentAppended(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent)
ShadowRoot::ContentAppended(nsIContent* aFirstNewContent)
{
for (nsIContent* content = aFirstNewContent;
content;
content = content->GetNextSibling()) {
ContentInserted(aDocument, aContainer, content);
ContentInserted(content);
}
}
void
ShadowRoot::ContentInserted(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild)
ShadowRoot::ContentInserted(nsIContent* aChild)
{
// Check to ensure that the content is in the same anonymous tree
// as the container because anonymous content may report its container
// as the host but it may not be in the host's child list.
if (!nsContentUtils::IsInSameAnonymousTree(aContainer, aChild)) {
// Check to ensure that the child not an anonymous subtree root because
// even though its parent could be the host it may not be in the host's child
// list.
if (aChild->IsRootOfAnonymousSubtree()) {
return;
}
@ -495,7 +490,7 @@ ShadowRoot::ContentInserted(nsIDocument* aDocument,
return;
}
if (aContainer && aContainer == GetHost()) {
if (aChild->GetParent() == GetHost()) {
if (const HTMLSlotElement* slot = AssignSlotFor(aChild)) {
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
// 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 &&
slot->AssignedNodes().IsEmpty()) {
slot->EnqueueSlotChangeEvent();
@ -512,15 +507,12 @@ ShadowRoot::ContentInserted(nsIDocument* aDocument,
}
void
ShadowRoot::ContentRemoved(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling)
ShadowRoot::ContentRemoved(nsIContent* aChild, nsIContent* aPreviousSibling)
{
// Check to ensure that the content is in the same anonymous tree
// as the container because anonymous content may report its container
// as the host but it may not be in the host's child list.
if (!nsContentUtils::IsInSameAnonymousTree(aContainer, aChild)) {
// Check to ensure that the child not an anonymous subtree root because
// even though its parent could be the host it may not be in the host's child
// list.
if (aChild->IsRootOfAnonymousSubtree()) {
return;
}
@ -528,7 +520,7 @@ ShadowRoot::ContentRemoved(nsIDocument* aDocument,
return;
}
if (aContainer && aContainer == GetHost()) {
if (aChild->GetParent() == GetHost()) {
nsAutoString slotName;
if (aChild->IsElement()) {
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
// 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 &&
slot->AssignedNodes().IsEmpty()) {
slot->EnqueueSlotChangeEvent();

View File

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

View File

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

View File

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

View File

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

View File

@ -108,7 +108,6 @@ public:
* added/removed from the document (the other notifications are used
* for that).
*
* @param aDocument The owner-document of aContent. Can be null.
* @param aContent The piece of content that changed. Is never null.
* @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
* the stack.
*/
virtual void CharacterDataWillChange(nsIDocument* aDocument,
nsIContent* aContent,
virtual void CharacterDataWillChange(nsIContent* aContent,
const CharacterDataChangeInfo&) = 0;
/**
@ -130,7 +128,6 @@ public:
* added/removed from the document (the other notifications are used
* for that).
*
* @param aDocument The owner-document of aContent. Can be null.
* @param aContent The piece of content that changed. Is never null.
* @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
* the stack.
*/
virtual void CharacterDataChanged(nsIDocument* aDocument,
nsIContent* aContent,
virtual void CharacterDataChanged(nsIContent* aContent,
const CharacterDataChangeInfo&) = 0;
/**
@ -151,7 +147,6 @@ public:
* attribute doesn't actually change there will be no corresponding
* AttributeChanged).
*
* @param aDocument The owner-document of aContent. Can be null.
* @param aContent The element whose attribute will change
* @param aNameSpaceID The namespace id 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
* the stack.
*/
virtual void AttributeWillChange(nsIDocument* aDocument,
mozilla::dom::Element* aElement,
int32_t aNameSpaceID,
nsAtom* aAttribute,
int32_t aModType,
virtual void AttributeWillChange(mozilla::dom::Element* aElement,
int32_t aNameSpaceID,
nsAtom* aAttribute,
int32_t aModType,
const nsAttrValue* aNewValue) = 0;
/**
* 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 aNameSpaceID The namespace id 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
* the stack.
*/
virtual void AttributeChanged(nsIDocument* aDocument,
mozilla::dom::Element* aElement,
int32_t aNameSpaceID,
nsAtom* aAttribute,
int32_t aModType,
virtual void AttributeChanged(mozilla::dom::Element* aElement,
int32_t aNameSpaceID,
nsAtom* aAttribute,
int32_t aModType,
const nsAttrValue* aOldValue) = 0;
/**
* Notification that the root of a native anonymous has been added
* or removed.
*
* @param aDocument Owner doc of aContent
* @param aContent Anonymous node that's been added or removed
* @param aIsRemove True if it's a removal, false if an addition
*/
virtual void NativeAnonymousChildListChange(nsIDocument* aDocument,
nsIContent* aContent,
virtual void NativeAnonymousChildListChange(nsIContent* aContent,
bool aIsRemove) {}
/**
* Notification that an attribute of an element has been
* set to the value it already had.
*
* @param aDocument The owner-document of aContent.
* @param aElement The element whose attribute changed
* @param aNameSpaceID The namespace id of the changed attribute
* @param aAttribute The name of the changed attribute
*/
virtual void AttributeSetToCurrentValue(nsIDocument* aDocument,
mozilla::dom::Element* aElement,
virtual void AttributeSetToCurrentValue(mozilla::dom::Element* aElement,
int32_t aNameSpaceID,
nsAtom* aAttribute) {}
@ -230,10 +218,7 @@ public:
* Notification that one or more content nodes have been appended to the
* child list of another node in the tree.
*
* @param aDocument The owner-document of aContent. Can be null.
* @param aContainer The container that had new children appended. Is never
* null.
* @param aFirstNewContent the node at aIndexInContainer in aContainer.
* @param aFirstNewContent the first node appended.
*
* @note Callers of this method might not hold a strong reference to the
* 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
* the stack.
*/
virtual void ContentAppended(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent) = 0;
virtual void ContentAppended(nsIContent* aFirstNewContent) = 0;
/**
* Notification that a content node has been inserted as child to another
* node in the tree.
*
* @param aDocument The owner-document of aContent, or, when aContainer
* 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.
* @param aChild The newly inserted child.
*
* @note Callers of this method might not hold a strong reference to the
* 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
* the stack.
*/
virtual void ContentInserted(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild) = 0;
virtual void ContentInserted(nsIContent* aChild) = 0;
/**
* Notification that a content node has been removed from the child list of
* 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 aIndexInContainer The index in the container which the child used
* to have.
* @param aPreviousSibling The previous sibling to the child that was removed.
* 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
* the stack.
*/
virtual void ContentRemoved(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
virtual void ContentRemoved(nsIContent* aChild,
nsIContent* aPreviousSibling) = 0;
/**
@ -336,50 +300,39 @@ public:
NS_DEFINE_STATIC_IID_ACCESSOR(nsIMutationObserver, NS_IMUTATION_OBSERVER_IID)
#define NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATAWILLCHANGE \
virtual void CharacterDataWillChange(nsIDocument* aDocument, \
nsIContent* aContent, \
virtual void CharacterDataWillChange(nsIContent* aContent, \
const CharacterDataChangeInfo& aInfo) override;
#define NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED \
virtual void CharacterDataChanged(nsIDocument* aDocument, \
nsIContent* aContent, \
virtual void CharacterDataChanged(nsIContent* aContent, \
const CharacterDataChangeInfo& aInfo) override;
#define NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTEWILLCHANGE \
virtual void AttributeWillChange(nsIDocument* aDocument, \
mozilla::dom::Element* aElement, \
virtual void AttributeWillChange(mozilla::dom::Element* aElement, \
int32_t aNameSpaceID, \
nsAtom* aAttribute, \
int32_t aModType, \
const nsAttrValue* aNewValue) override;
#define NS_DECL_NSIMUTATIONOBSERVER_NATIVEANONYMOUSCHILDLISTCHANGE \
virtual void NativeAnonymousChildListChange(nsIDocument* aDocument, \
nsIContent* aContent, \
virtual void NativeAnonymousChildListChange(nsIContent* aContent, \
bool aIsRemove) override;
#define NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED \
virtual void AttributeChanged(nsIDocument* aDocument, \
mozilla::dom::Element* aElement, \
virtual void AttributeChanged(mozilla::dom::Element* aElement, \
int32_t aNameSpaceID, \
nsAtom* aAttribute, \
nsAtom* aAttribute, \
int32_t aModType, \
const nsAttrValue* aOldValue) override;
#define NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED \
virtual void ContentAppended(nsIDocument* aDocument, \
nsIContent* aContainer, \
nsIContent* aFirstNewContent) override;
virtual void ContentAppended(nsIContent* aFirstNewContent) override;
#define NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED \
virtual void ContentInserted(nsIDocument* aDocument, \
nsIContent* aContainer, \
nsIContent* aChild) override;
virtual void ContentInserted(nsIContent* aChild) override;
#define NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED \
virtual void ContentRemoved(nsIDocument* aDocument, \
nsIContent* aContainer, \
nsIContent* aChild, \
virtual void ContentRemoved(nsIContent* aChild, \
nsIContent* aPreviousSibling) override;
#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) \
void \
_class::NodeWillBeDestroyed(const nsINode* aNode) \
_class::NodeWillBeDestroyed(const nsINode* aNode) \
{ \
}
#define NS_IMPL_NSIMUTATIONOBSERVER_CONTENT(_class) \
void \
_class::CharacterDataWillChange(nsIDocument* aDocument, \
nsIContent* aContent, \
_class::CharacterDataWillChange(nsIContent* aContent, \
const CharacterDataChangeInfo& aInfo) \
{ \
} \
void \
_class::CharacterDataChanged(nsIDocument* aDocument, \
nsIContent* aContent, \
_class::CharacterDataChanged(nsIContent* aContent, \
const CharacterDataChangeInfo& aInfo) \
{ \
} \
void \
_class::AttributeWillChange(nsIDocument* aDocument, \
mozilla::dom::Element* aElement, \
_class::AttributeWillChange(mozilla::dom::Element* aElement, \
int32_t aNameSpaceID, \
nsAtom* aAttribute, \
int32_t aModType, \
@ -429,14 +379,12 @@ _class::AttributeWillChange(nsIDocument* aDocument, \
{ \
} \
void \
_class::NativeAnonymousChildListChange(nsIDocument* aDocument, \
nsIContent* aContent, \
_class::NativeAnonymousChildListChange(nsIContent* aContent, \
bool aIsRemove) \
{ \
} \
void \
_class::AttributeChanged(nsIDocument* aDocument, \
mozilla::dom::Element* aElement, \
_class::AttributeChanged(mozilla::dom::Element* aElement, \
int32_t aNameSpaceID, \
nsAtom* aAttribute, \
int32_t aModType, \
@ -444,22 +392,15 @@ _class::AttributeChanged(nsIDocument* aDocument, \
{ \
} \
void \
_class::ContentAppended(nsIDocument* aDocument, \
nsIContent* aContainer, \
nsIContent* aFirstNewContent) \
_class::ContentAppended(nsIContent* aFirstNewContent) \
{ \
} \
void \
_class::ContentInserted(nsIDocument* aDocument, \
nsIContent* aContainer, \
nsIContent* aChild) \
_class::ContentInserted(nsIContent* aChild) \
{ \
} \
void \
_class::ContentRemoved(nsIDocument* aDocument, \
nsIContent* aContainer, \
nsIContent* aChild, \
nsIContent* aPreviousSibling) \
_class::ContentRemoved(nsIContent* aChild, nsIContent* aPreviousSibling) \
{ \
} \
void \

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -447,12 +447,11 @@ TableRowsCollection::HandleInsert(nsIContent* aContainer,
// nsIMutationObserver
void
TableRowsCollection::ContentAppended(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent)
TableRowsCollection::ContentAppended(nsIContent* aFirstNewContent)
{
nsIContent* container = aFirstNewContent->GetParent();
if (!nsContentUtils::IsInSameAnonymousTree(mParent, aFirstNewContent) ||
!InterestingContainer(aContainer)) {
!InterestingContainer(container)) {
return;
}
@ -460,37 +459,33 @@ TableRowsCollection::ContentAppended(nsIDocument* aDocument,
// 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
// 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
// make insertions of a large number of elements cheaper.
for (nsIContent* content = aFirstNewContent;
content; content = content->GetNextSibling()) {
indexGuess = HandleInsert(aContainer, content, indexGuess);
indexGuess = HandleInsert(container, content, indexGuess);
}
}
void
TableRowsCollection::ContentInserted(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild)
TableRowsCollection::ContentInserted(nsIContent* aChild)
{
if (!nsContentUtils::IsInSameAnonymousTree(mParent, aChild) ||
!InterestingContainer(aContainer)) {
!InterestingContainer(aChild->GetParent())) {
return;
}
HandleInsert(aContainer, aChild);
HandleInsert(aChild->GetParent(), aChild);
}
void
TableRowsCollection::ContentRemoved(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
TableRowsCollection::ContentRemoved(nsIContent* aChild,
nsIContent* aPreviousSibling)
{
if (!nsContentUtils::IsInSameAnonymousTree(mParent, aChild) ||
!InterestingContainer(aContainer)) {
!InterestingContainer(aChild->GetParent())) {
return;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -855,12 +855,11 @@ ShouldPersistAttribute(Element* aElement, nsAtom* aAttribute)
}
void
XULDocument::AttributeChanged(nsIDocument* aDocument,
Element* aElement, int32_t aNameSpaceID,
XULDocument::AttributeChanged(Element* aElement, int32_t aNameSpaceID,
nsAtom* aAttribute, int32_t aModType,
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.
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
@ -943,11 +942,9 @@ XULDocument::AttributeChanged(nsIDocument* aDocument,
}
void
XULDocument::ContentAppended(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent)
XULDocument::ContentAppended(nsIContent* aFirstNewContent)
{
NS_ASSERTION(aDocument == this, "unexpected doc");
NS_ASSERTION(aFirstNewContent->OwnerDoc() == this, "unexpected doc");
// Might not need this, but be safe for now.
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
@ -961,11 +958,9 @@ XULDocument::ContentAppended(nsIDocument* aDocument,
}
void
XULDocument::ContentInserted(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild)
XULDocument::ContentInserted(nsIContent* aChild)
{
NS_ASSERTION(aDocument == this, "unexpected doc");
NS_ASSERTION(aChild->OwnerDoc() == this, "unexpected doc");
// Might not need this, but be safe for now.
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
@ -974,12 +969,9 @@ XULDocument::ContentInserted(nsIDocument* aDocument,
}
void
XULDocument::ContentRemoved(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling)
XULDocument::ContentRemoved(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.
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
// passes NAC into it. This is not great!
aShell->ContentRemoved(
aContent->GetComposedDoc(), parentContent, aContent, nullptr);
aShell->ContentRemoved(aContent, nullptr);
if (document) {
aShell->EndUpdate(document, UPDATE_CONTENT_MODEL);

View File

@ -3136,25 +3136,19 @@ HTMLEditor::InsertTextImpl(nsIDocument& aDocument,
}
void
HTMLEditor::ContentAppended(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent)
HTMLEditor::ContentAppended(nsIContent* aFirstNewContent)
{
DoContentInserted(aDocument, aContainer, aFirstNewContent, eAppended);
DoContentInserted(aFirstNewContent, eAppended);
}
void
HTMLEditor::ContentInserted(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild)
HTMLEditor::ContentInserted(nsIContent* aChild)
{
DoContentInserted(aDocument, aContainer, aChild, eInserted);
DoContentInserted(aChild, eInserted);
}
bool
HTMLEditor::IsInObservedSubtree(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild)
HTMLEditor::IsInObservedSubtree(nsIContent* aChild)
{
if (!aChild) {
return false;
@ -3173,16 +3167,14 @@ HTMLEditor::IsInObservedSubtree(nsIDocument* aDocument,
}
void
HTMLEditor::DoContentInserted(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
HTMLEditor::DoContentInserted(nsIContent* aChild,
InsertedOrAppended aInsertedOrAppended)
{
MOZ_ASSERT(aChild);
nsINode* container = NODE_FROM(aContainer, aDocument);
nsINode* container = aChild->GetParentNode();
MOZ_ASSERT(container);
if (!IsInObservedSubtree(aDocument, aContainer, aChild)) {
if (!IsInObservedSubtree(aChild)) {
return;
}
@ -3223,12 +3215,10 @@ HTMLEditor::DoContentInserted(nsIDocument* aDocument,
}
void
HTMLEditor::ContentRemoved(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
HTMLEditor::ContentRemoved(nsIContent* aChild,
nsIContent* aPreviousSibling)
{
if (!IsInObservedSubtree(aDocument, aContainer, aChild)) {
if (!IsInObservedSubtree(aChild)) {
return;
}
@ -3243,9 +3233,8 @@ HTMLEditor::ContentRemoved(nsIDocument* aDocument,
NewRunnableMethod("HTMLEditor::NotifyRootChanged",
this,
&HTMLEditor::NotifyRootChanged));
}
// 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)) {
// Ignore removal of the bogus node
return;

View File

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

View File

@ -4291,12 +4291,11 @@ PresShell::DoFlushPendingNotifications(mozilla::ChangesToFlush aFlush)
}
void
PresShell::CharacterDataChanged(nsIDocument* aDocument,
nsIContent* aContent,
PresShell::CharacterDataChanged(nsIContent* aContent,
const CharacterDataChangeInfo& aInfo)
{
NS_PRECONDITION(!mIsDocumentGone, "Unexpected CharacterDataChanged");
NS_PRECONDITION(aDocument == mDocument, "Unexpected aDocument");
NS_PRECONDITION(aContent->OwnerDoc() == mDocument, "Unexpected document");
nsAutoCauseReflowNotifier crNotifier(this);
@ -4357,15 +4356,14 @@ PresShell::DocumentStatesChanged(nsIDocument* aDocument, EventStates aStateMask)
}
void
PresShell::AttributeWillChange(nsIDocument* aDocument,
Element* aElement,
int32_t aNameSpaceID,
nsAtom* aAttribute,
int32_t aModType,
PresShell::AttributeWillChange(Element* aElement,
int32_t aNameSpaceID,
nsAtom* aAttribute,
int32_t aModType,
const nsAttrValue* aNewValue)
{
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
// initial reflow to begin observing the document. That would
@ -4380,15 +4378,14 @@ PresShell::AttributeWillChange(nsIDocument* aDocument,
}
void
PresShell::AttributeChanged(nsIDocument* aDocument,
Element* aElement,
int32_t aNameSpaceID,
nsAtom* aAttribute,
int32_t aModType,
PresShell::AttributeChanged(Element* aElement,
int32_t aNameSpaceID,
nsAtom* aAttribute,
int32_t aModType,
const nsAttrValue* aOldValue)
{
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
// 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
PresShell::ContentAppended(nsIDocument *aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent)
PresShell::ContentAppended(nsIContent* aFirstNewContent)
{
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
// assert that we have an nsIContent container.
MOZ_ASSERT(aContainer);
MOZ_ASSERT(aContainer->IsElement() ||
aContainer->IsNodeOfType(nsINode::eDOCUMENT_FRAGMENT));
nsIContent* container = aFirstNewContent->GetParent();
MOZ_ASSERT(container);
MOZ_ASSERT(container->IsElement() || container->IsShadowRoot());
if (!mDidInitialize) {
return;
}
@ -4444,10 +4420,10 @@ PresShell::ContentAppended(nsIDocument *aDocument,
// Call this here so it only happens for real content mutations and
// not cases when the frame constructor calls its own methods to force
// frame reconstruction.
mPresContext->RestyleManager()->ContentAppended(aContainer, aFirstNewContent);
mPresContext->RestyleManager()->ContentAppended(container, aFirstNewContent);
mFrameConstructor->ContentAppended(
aContainer,
container,
aFirstNewContent,
nsCSSFrameConstructor::InsertionKind::Async);
@ -4455,13 +4431,11 @@ PresShell::ContentAppended(nsIDocument *aDocument,
}
void
PresShell::ContentInserted(nsIDocument* aDocument,
nsIContent* aMaybeContainer,
nsIContent* aChild)
PresShell::ContentInserted(nsIContent* aChild)
{
NS_PRECONDITION(!mIsDocumentGone, "Unexpected ContentInserted");
NS_PRECONDITION(aDocument == mDocument, "Unexpected aDocument");
nsINode* container = RealContainer(aDocument, aMaybeContainer, aChild);
NS_PRECONDITION(aChild->OwnerDoc() == mDocument, "Unexpected document");
nsINode* container = aChild->GetParentNode();
if (!mDidInitialize) {
return;
@ -4475,7 +4449,7 @@ PresShell::ContentInserted(nsIDocument* aDocument,
mPresContext->RestyleManager()->ContentInserted(container, aChild);
mFrameConstructor->ContentInserted(
aMaybeContainer,
aChild->GetParent(),
aChild,
nullptr,
nsCSSFrameConstructor::InsertionKind::Async);
@ -4484,25 +4458,17 @@ PresShell::ContentInserted(nsIDocument* aDocument,
}
void
PresShell::ContentRemoved(nsIDocument* aDocument,
nsIContent* aMaybeContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling)
PresShell::ContentRemoved(nsIContent* aChild, nsIContent* aPreviousSibling)
{
NS_PRECONDITION(!mIsDocumentGone, "Unexpected ContentRemoved");
NS_PRECONDITION(aDocument == mDocument, "Unexpected aDocument");
nsINode* container = RealContainer(aDocument, aMaybeContainer, aChild);
NS_PRECONDITION(aChild->OwnerDoc() == mDocument, "Unexpected document");
nsINode* container = aChild->GetParentNode();
// Notify the ESM that the content has been removed, so that
// 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()
->ContentRemoved(aDocument, aMaybeContainer, aChild);
->ContentRemoved(mDocument, aChild->GetParent(), aChild);
nsAutoCauseReflowNotifier crNotifier(this);
@ -4524,11 +4490,12 @@ PresShell::ContentRemoved(nsIDocument* aDocument,
// After removing aChild from tree we should save information about live ancestor
if (mPointerEventTarget &&
nsContentUtils::ContentIsDescendantOf(mPointerEventTarget, aChild)) {
mPointerEventTarget = aMaybeContainer;
mPointerEventTarget = aChild->GetParent();
}
mFrameConstructor->ContentRemoved(aMaybeContainer, aChild, oldNextSibling,
nsCSSFrameConstructor::REMOVE_CONTENT);
mFrameConstructor->ContentRemoved(
aChild->GetParent(), aChild, oldNextSibling,
nsCSSFrameConstructor::REMOVE_CONTENT);
VERIFY_STYLE_TREE;
}
@ -6787,7 +6754,7 @@ nsIFrame* GetNearestFrameContainingPresShell(nsIPresShell* aPresShell)
}
static bool
FlushThrottledStyles(nsIDocument *aDocument, void *aData)
FlushThrottledStyles(nsIDocument* aDocument, void *aData)
{
nsIPresShell* shell = aDocument->GetShell();
if (shell && shell->IsVisible()) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -67,26 +67,22 @@ nsresult nsMenuGroupOwnerX::Create(mozilla::dom::Element* aContent)
//
void nsMenuGroupOwnerX::CharacterDataWillChange(nsIDocument* aDocument,
nsIContent* aContent,
void nsMenuGroupOwnerX::CharacterDataWillChange(nsIContent* aContent,
const CharacterDataChangeInfo&)
{
}
void nsMenuGroupOwnerX::CharacterDataChanged(nsIDocument* aDocument,
nsIContent* aContent,
void nsMenuGroupOwnerX::CharacterDataChanged(nsIContent* aContent,
const CharacterDataChangeInfo&)
{
}
void nsMenuGroupOwnerX::ContentAppended(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent)
void nsMenuGroupOwnerX::ContentAppended(nsIContent* aFirstNewContent)
{
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,
dom::Element* aContent,
void nsMenuGroupOwnerX::AttributeWillChange(dom::Element* aContent,
int32_t aNameSpaceID,
nsAtom* aAttribute,
int32_t aModType,
@ -105,14 +100,12 @@ void nsMenuGroupOwnerX::AttributeWillChange(nsIDocument* aDocument,
{
}
void nsMenuGroupOwnerX::NativeAnonymousChildListChange(nsIDocument* aDocument,
nsIContent* aContent,
void nsMenuGroupOwnerX::NativeAnonymousChildListChange(nsIContent* aContent,
bool aIsRemove)
{
}
void nsMenuGroupOwnerX::AttributeChanged(nsIDocument* aDocument,
dom::Element* aElement,
void nsMenuGroupOwnerX::AttributeChanged(dom::Element* aElement,
int32_t aNameSpaceID,
nsAtom* aAttribute,
int32_t aModType,
@ -121,58 +114,58 @@ void nsMenuGroupOwnerX::AttributeChanged(nsIDocument* aDocument,
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
nsChangeObserver* obs = LookupContentChangeObserver(aElement);
if (obs)
obs->ObserveAttributeChanged(aDocument, aElement, aAttribute);
obs->ObserveAttributeChanged(aElement->OwnerDoc(), aElement, aAttribute);
}
void nsMenuGroupOwnerX::ContentRemoved(nsIDocument * aDocument,
nsIContent * aContainer,
nsIContent * aChild,
nsIContent * aPreviousSibling)
void nsMenuGroupOwnerX::ContentRemoved(nsIContent* aChild,
nsIContent* aPreviousSibling)
{
if (!aContainer) {
nsIContent* container = aChild->GetParent();
if (!container) {
return;
}
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
nsChangeObserver* obs = LookupContentChangeObserver(aContainer);
nsChangeObserver* obs = LookupContentChangeObserver(container);
if (obs)
obs->ObserveContentRemoved(aDocument, aContainer, aChild, aPreviousSibling);
else if (aContainer != mContent) {
obs->ObserveContentRemoved(aChild->OwnerDoc(), container, aChild,
aPreviousSibling);
else if (container != mContent) {
// 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
// of a "menu" node.
nsCOMPtr<nsIContent> parent = aContainer->GetParent();
nsCOMPtr<nsIContent> parent = container->GetParent();
if (parent) {
obs = LookupContentChangeObserver(parent);
if (obs)
obs->ObserveContentRemoved(aDocument, aContainer, aChild, aPreviousSibling);
obs->ObserveContentRemoved(aChild->OwnerDoc(), aChild->GetParent(),
aChild, aPreviousSibling);
}
}
}
void nsMenuGroupOwnerX::ContentInserted(nsIDocument * aDocument,
nsIContent * aContainer,
nsIContent * aChild)
void nsMenuGroupOwnerX::ContentInserted(nsIContent* aChild)
{
if (!aContainer) {
nsIContent* container = aChild->GetParent();
if (!container) {
return;
}
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
nsChangeObserver* obs = LookupContentChangeObserver(aContainer);
nsChangeObserver* obs = LookupContentChangeObserver(container);
if (obs)
obs->ObserveContentInserted(aDocument, aContainer, aChild);
else if (aContainer != mContent) {
obs->ObserveContentInserted(aChild->OwnerDoc(), container, aChild);
else if (container != mContent) {
// 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
// of a "menu" node.
nsCOMPtr<nsIContent> parent = aContainer->GetParent();
nsCOMPtr<nsIContent> parent = container->GetParent();
if (parent) {
obs = LookupContentChangeObserver(parent);
if (obs)
obs->ObserveContentInserted(aDocument, aContainer, aChild);
obs->ObserveContentInserted(aChild->OwnerDoc(), container, aChild);
}
}
}