Bug 651120 - Remove index argument from content removed/appended/inserted notifications. r=peterv

This commit is contained in:
Catalin Badea 2017-07-27 14:49:52 +01:00
parent 3e1919eba7
commit f8162c4bfd
51 changed files with 143 additions and 270 deletions

View File

@ -1096,8 +1096,7 @@ DocAccessible::ARIAActiveDescendantChanged(Accessible* aAccessible)
void
DocAccessible::ContentAppended(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent,
int32_t /* unused */)
nsIContent* aFirstNewContent)
{
}
@ -1163,14 +1162,14 @@ DocAccessible::CharacterDataChanged(nsIDocument* aDocument,
void
DocAccessible::ContentInserted(nsIDocument* aDocument, nsIContent* aContainer,
nsIContent* aChild, int32_t /* unused */)
nsIContent* aChild)
{
}
void
DocAccessible::ContentRemoved(nsIDocument* aDocument,
nsIContent* aContainerNode,
nsIContent* aChildNode, int32_t /* unused */,
nsIContent* aChildNode,
nsIContent* aPreviousSiblingNode)
{
#ifdef A11Y_LOG

View File

@ -301,8 +301,7 @@ nsSHEntryShared::AttributeChanged(nsIDocument* aDocument,
void
nsSHEntryShared::ContentAppended(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent,
int32_t /* unused */)
nsIContent* aFirstNewContent)
{
RemoveFromBFCacheAsync();
}
@ -310,8 +309,7 @@ nsSHEntryShared::ContentAppended(nsIDocument* aDocument,
void
nsSHEntryShared::ContentInserted(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t /* unused */)
nsIContent* aChild)
{
RemoveFromBFCacheAsync();
}
@ -320,7 +318,6 @@ void
nsSHEntryShared::ContentRemoved(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer,
nsIContent* aPreviousSibling)
{
RemoveFromBFCacheAsync();

View File

@ -272,7 +272,6 @@ NS_IMETHODIMP NodeIterator::GetPointerBeforeReferenceNode(bool *aBeforeNode)
void NodeIterator::ContentRemoved(nsIDocument *aDocument,
nsIContent *aContainer,
nsIContent *aChild,
int32_t aIndexInContainer,
nsIContent *aPreviousSibling)
{
nsINode *container = NODE_FROM(aContainer, aDocument);

View File

@ -493,8 +493,7 @@ ShadowRoot::AttributeChanged(nsIDocument* aDocument,
void
ShadowRoot::ContentAppended(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent,
int32_t aNewIndexInContainer)
nsIContent* aFirstNewContent)
{
if (mInsertionPointChanged) {
DistributeAllNodes();
@ -525,8 +524,7 @@ ShadowRoot::ContentAppended(nsIDocument* aDocument,
void
ShadowRoot::ContentInserted(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer)
nsIContent* aChild)
{
if (mInsertionPointChanged) {
DistributeAllNodes();
@ -553,7 +551,6 @@ void
ShadowRoot::ContentRemoved(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer,
nsIContent* aPreviousSibling)
{
if (mInsertionPointChanged) {

View File

@ -743,8 +743,7 @@ nsContentList::AttributeChanged(nsIDocument *aDocument, Element* aElement,
void
nsContentList::ContentAppended(nsIDocument* aDocument, nsIContent* aContainer,
nsIContent* aFirstNewContent,
int32_t aNewIndexInContainer)
nsIContent* aFirstNewContent)
{
NS_PRECONDITION(aContainer, "Can't get at the new content if no container!");
@ -847,8 +846,7 @@ nsContentList::ContentAppended(nsIDocument* aDocument, nsIContent* aContainer,
void
nsContentList::ContentInserted(nsIDocument *aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer)
nsIContent* aChild)
{
// Note that aContainer can be null here if we are inserting into
// the document itself; any attempted optimizations to this method
@ -867,7 +865,6 @@ void
nsContentList::ContentRemoved(nsIDocument *aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer,
nsIContent* aPreviousSibling)
{
// Note that aContainer can be null here if we are removing from
@ -1201,8 +1198,7 @@ nsLabelsNodeList::AttributeChanged(nsIDocument* aDocument, Element* aElement,
void
nsLabelsNodeList::ContentAppended(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent,
int32_t aNewIndexInContainer)
nsIContent* aFirstNewContent)
{
// If a labelable element is moved to outside or inside of
// nested associated labels, we're gonna have to modify
@ -1217,8 +1213,7 @@ nsLabelsNodeList::ContentAppended(nsIDocument* aDocument,
void
nsLabelsNodeList::ContentInserted(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer)
nsIContent* aChild)
{
// If a labelable element is moved to outside or inside of
// nested associated labels, we're gonna have to modify
@ -1234,7 +1229,6 @@ void
nsLabelsNodeList::ContentRemoved(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer,
nsIContent* aPreviousSibling)
{
// If a labelable element is removed, we're gonna have to clean

View File

@ -1310,8 +1310,7 @@ nsContentSink::NotifyAppend(nsIContent* aContainer, uint32_t aStartIndex)
// Scope so we call EndUpdate before we decrease mInNotification
MOZ_AUTO_DOC_UPDATE(mDocument, UPDATE_CONTENT_MODEL, !mBeganUpdate);
nsNodeUtils::ContentAppended(aContainer,
aContainer->GetChildAt(aStartIndex),
aStartIndex);
aContainer->GetChildAt(aStartIndex));
mLastNotificationTime = PR_Now();
}

View File

@ -222,8 +222,7 @@ nsMutationReceiver::CharacterDataWillChange(nsIDocument *aDocument,
void
nsMutationReceiver::ContentAppended(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent,
int32_t aNewIndexInContainer)
nsIContent* aFirstNewContent)
{
nsINode* parent = NODE_FROM(aContainer, aDocument);
bool wantsChildList =
@ -263,8 +262,7 @@ nsMutationReceiver::ContentAppended(nsIDocument* aDocument,
void
nsMutationReceiver::ContentInserted(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer)
nsIContent* aChild)
{
nsINode* parent = NODE_FROM(aContainer, aDocument);
bool wantsChildList =
@ -299,7 +297,6 @@ void
nsMutationReceiver::ContentRemoved(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer,
nsIContent* aPreviousSibling)
{
if (!IsObservable(aChild)) {
@ -371,11 +368,14 @@ nsMutationReceiver::ContentRemoved(nsIDocument* aDocument,
// Already handled case.
return;
}
MOZ_ASSERT(parent);
m->mTarget = parent;
m->mRemovedNodes = new nsSimpleContentList(parent);
m->mRemovedNodes->AppendElement(aChild);
m->mPreviousSibling = aPreviousSibling;
m->mNextSibling = parent->GetChildAt(aIndexInContainer);
m->mNextSibling = aPreviousSibling ?
aPreviousSibling->GetNextSibling() : parent->GetFirstChild();
}
// We need to schedule always, so that after microtask mTransientReceivers
// can be cleared correctly.

View File

@ -2351,7 +2351,7 @@ nsDocument::ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup,
// now-stale value.
mCachedRootElement = nullptr;
}
nsNodeUtils::ContentRemoved(this, content, i, previousSibling);
nsNodeUtils::ContentRemoved(this, content, previousSibling);
content->UnbindFromTree();
}
MOZ_ASSERT(!mCachedRootElement,

View File

@ -234,8 +234,6 @@ public:
* @param aContainer The container that had new children appended. Is never
* null.
* @param aFirstNewContent the node at aIndexInContainer in aContainer.
* @param aNewIndexInContainer the index in the container of the first
* new child
*
* @note Callers of this method might not hold a strong reference to the
* observer. The observer is responsible for making sure it stays
@ -245,8 +243,7 @@ public:
*/
virtual void ContentAppended(nsIDocument *aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent,
int32_t aNewIndexInContainer) = 0;
nsIContent* aFirstNewContent) = 0;
/**
* Notification that a content node has been inserted as child to another
@ -269,8 +266,7 @@ public:
*/
virtual void ContentInserted(nsIDocument *aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer) = 0;
nsIContent* aChild) = 0;
/**
* Notification that a content node has been removed from the child list of
@ -297,7 +293,6 @@ public:
virtual void ContentRemoved(nsIDocument *aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer,
nsIContent* aPreviousSibling) = 0;
/**
@ -374,20 +369,17 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIMutationObserver, NS_IMUTATION_OBSERVER_IID)
#define NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED \
virtual void ContentAppended(nsIDocument* aDocument, \
nsIContent* aContainer, \
nsIContent* aFirstNewContent, \
int32_t aNewIndexInContainer) override;
nsIContent* aFirstNewContent) override;
#define NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED \
virtual void ContentInserted(nsIDocument* aDocument, \
nsIContent* aContainer, \
nsIContent* aChild, \
int32_t aIndexInContainer) override;
nsIContent* aChild) override;
#define NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED \
virtual void ContentRemoved(nsIDocument* aDocument, \
nsIContent* aContainer, \
nsIContent* aChild, \
int32_t aIndexInContainer, \
nsIContent* aPreviousSibling) override;
#define NS_DECL_NSIMUTATIONOBSERVER_NODEWILLBEDESTROYED \
@ -454,22 +446,19 @@ _class::AttributeChanged(nsIDocument* aDocument, \
void \
_class::ContentAppended(nsIDocument* aDocument, \
nsIContent* aContainer, \
nsIContent* aFirstNewContent, \
int32_t aNewIndexInContainer) \
nsIContent* aFirstNewContent) \
{ \
} \
void \
_class::ContentInserted(nsIDocument* aDocument, \
nsIContent* aContainer, \
nsIContent* aChild, \
int32_t aIndexInContainer) \
nsIContent* aChild) \
{ \
} \
void \
_class::ContentRemoved(nsIDocument* aDocument, \
nsIContent* aContainer, \
nsIContent* aChild, \
int32_t aIndexInContainer, \
nsIContent* aPreviousSibling) \
{ \
} \

View File

@ -1631,9 +1631,9 @@ nsINode::doInsertChildAt(nsIContent* aKid, uint32_t aIndex,
// Note that we always want to call ContentInserted when things are added
// as kids to documents
if (parent && isAppend) {
nsNodeUtils::ContentAppended(parent, aKid, aIndex);
nsNodeUtils::ContentAppended(parent, aKid);
} else {
nsNodeUtils::ContentInserted(this, aKid, aIndex);
nsNodeUtils::ContentInserted(this, aKid);
}
if (nsContentUtils::HasMutationListeners(aKid,
@ -1939,7 +1939,7 @@ nsINode::doRemoveChildAt(uint32_t aIndex, bool aNotify,
}
if (aNotify) {
nsNodeUtils::ContentRemoved(this, aKid, aIndex, previousSibling);
nsNodeUtils::ContentRemoved(this, aKid, previousSibling);
}
aKid->UnbindFromTree();
@ -2475,7 +2475,6 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
bool appending =
!IsNodeOfType(eDOCUMENT) && uint32_t(insPos) == GetChildCount();
int32_t firstInsPos = insPos;
nsIContent* firstInsertedContent = fragChildren->ElementAt(0);
// Iterate through the fragment's children, and insert them in the new
@ -2489,8 +2488,7 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
// Make sure to notify on any children that we did succeed to insert
if (appending && i != 0) {
nsNodeUtils::ContentAppended(static_cast<nsIContent*>(this),
firstInsertedContent,
firstInsPos);
firstInsertedContent);
}
return nullptr;
}
@ -2503,7 +2501,7 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
// Notify and fire mutation events when appending
if (appending) {
nsNodeUtils::ContentAppended(static_cast<nsIContent*>(this),
firstInsertedContent, firstInsPos);
firstInsertedContent);
if (mutationBatch) {
mutationBatch->NodesAdded();
}

View File

@ -160,14 +160,12 @@ nsNodeUtils::AttributeSetToCurrentValue(Element* aElement,
void
nsNodeUtils::ContentAppended(nsIContent* aContainer,
nsIContent* aFirstNewContent,
int32_t aNewIndexInContainer)
nsIContent* aFirstNewContent)
{
nsIDocument* doc = aContainer->OwnerDoc();
IMPL_MUTATION_NOTIFICATION(ContentAppended, aContainer,
(doc, aContainer, aFirstNewContent,
aNewIndexInContainer));
(doc, aContainer, aFirstNewContent));
}
void
@ -181,8 +179,7 @@ nsNodeUtils::NativeAnonymousChildListChange(nsIContent* aContent,
void
nsNodeUtils::ContentInserted(nsINode* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer)
nsIContent* aChild)
{
NS_PRECONDITION(aContainer->IsNodeOfType(nsINode::eCONTENT) ||
aContainer->IsNodeOfType(nsINode::eDOCUMENT),
@ -200,13 +197,12 @@ nsNodeUtils::ContentInserted(nsINode* aContainer,
}
IMPL_MUTATION_NOTIFICATION(ContentInserted, aContainer,
(document, container, aChild, aIndexInContainer));
(document, container, aChild));
}
void
nsNodeUtils::ContentRemoved(nsINode* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer,
nsIContent* aPreviousSibling)
{
NS_PRECONDITION(aContainer->IsNodeOfType(nsINode::eCONTENT) ||
@ -225,8 +221,7 @@ nsNodeUtils::ContentRemoved(nsINode* aContainer,
}
IMPL_MUTATION_NOTIFICATION(ContentRemoved, aContainer,
(document, container, aChild, aIndexInContainer,
aPreviousSibling));
(document, container, aChild, aPreviousSibling));
}
Maybe<NonOwningAnimationTarget>

View File

@ -92,12 +92,10 @@ public:
* Send ContentAppended notifications to nsIMutationObservers
* @param aContainer Node into which new child/children were added
* @param aFirstNewContent First new child
* @param aNewIndexInContainer Index of first new child
* @see nsIMutationObserver::ContentAppended
*/
static void ContentAppended(nsIContent* aContainer,
nsIContent* aFirstNewContent,
int32_t aNewIndexInContainer);
nsIContent* aFirstNewContent);
/**
* Send NativeAnonymousChildList notifications to nsIMutationObservers
@ -112,22 +110,19 @@ public:
* Send ContentInserted notifications to nsIMutationObservers
* @param aContainer Node into which new child was inserted
* @param aChild Newly inserted child
* @param aIndexInContainer Index of new child
* @see nsIMutationObserver::ContentInserted
*/
static void ContentInserted(nsINode* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer);
nsIContent* aChild);
/**
* Send ContentRemoved notifications to nsIMutationObservers
* @param aContainer Node from which child was removed
* @param aChild Removed child
* @param aIndexInContainer Index of removed child
* @param aPreviousSibling Previous sibling of the removed child
* @see nsIMutationObserver::ContentRemoved
*/
static void ContentRemoved(nsINode* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer,
nsIContent* aPreviousSibling);
/**
* Send ParentChainChanged notifications to nsIMutationObservers

View File

@ -638,8 +638,7 @@ nsRange::CharacterDataChanged(nsIDocument* aDocument,
void
nsRange::ContentAppended(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent,
int32_t aNewIndexInContainer)
nsIContent* aFirstNewContent)
{
NS_ASSERTION(mIsPositioned, "shouldn't be notified if not positioned");
@ -677,8 +676,7 @@ nsRange::ContentAppended(nsIDocument* aDocument,
void
nsRange::ContentInserted(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t /* aIndexInContainer */)
nsIContent* aChild)
{
MOZ_ASSERT(mIsPositioned, "shouldn't be notified if not positioned");
@ -731,7 +729,6 @@ void
nsRange::ContentRemoved(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t /* aIndexInContainer */,
nsIContent* aPreviousSibling)
{
MOZ_ASSERT(mIsPositioned, "shouldn't be notified if not positioned");

View File

@ -1121,8 +1121,7 @@ IMEContentObserver::NotifyContentAdded(nsINode* aContainer,
void
IMEContentObserver::ContentAppended(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent,
int32_t /* unused */)
nsIContent* aFirstNewContent)
{
NotifyContentAdded(NODE_FROM(aContainer, aDocument),
aFirstNewContent, aContainer->GetLastChild());
@ -1131,9 +1130,9 @@ IMEContentObserver::ContentAppended(nsIDocument* aDocument,
void
IMEContentObserver::ContentInserted(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t /* unused */)
nsIContent* aChild)
{
MOZ_ASSERT(aChild);
NotifyContentAdded(NODE_FROM(aContainer, aDocument),
aChild, aChild);
}
@ -1142,7 +1141,6 @@ void
IMEContentObserver::ContentRemoved(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t /* unused */,
nsIContent* aPreviousSibling)
{
if (!NeedsTextChangeNotification()) {
@ -1154,6 +1152,8 @@ IMEContentObserver::ContentRemoved(nsIDocument* aDocument,
nsINode* containerNode = NODE_FROM(aContainer, aDocument);
MOZ_ASSERT(containerNode);
uint32_t offset = 0;
nsresult rv = NS_OK;
if (!mStartOfRemovingTextRangeCache.Match(containerNode, aPreviousSibling)) {

View File

@ -1527,10 +1527,9 @@ NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(HTMLMediaElement, Preload, preload, nullptr)
void
HTMLMediaElement::ContentRemoved(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t /* aIndexInContainer */,
nsIContent* aPreviousSibling)
nsIContent* aContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling)
{
if (aChild == mSourcePointer) {
mSourcePointer = aPreviousSibling;

View File

@ -193,16 +193,14 @@ void HTMLOutputElement::CharacterDataChanged(nsIDocument* aDocument,
void HTMLOutputElement::ContentAppended(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent,
int32_t aNewIndexInContainer)
nsIContent* aFirstNewContent)
{
DescendantsChanged();
}
void HTMLOutputElement::ContentInserted(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer)
nsIContent* aChild)
{
DescendantsChanged();
}
@ -210,7 +208,6 @@ void HTMLOutputElement::ContentInserted(nsIDocument* aDocument,
void HTMLOutputElement::ContentRemoved(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer,
nsIContent* aPreviousSibling)
{
DescendantsChanged();

View File

@ -75,8 +75,7 @@ HTMLStyleElement::CharacterDataChanged(nsIDocument* aDocument,
void
HTMLStyleElement::ContentAppended(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent,
int32_t aNewIndexInContainer)
nsIContent* aFirstNewContent)
{
ContentChanged(aContainer);
}
@ -84,8 +83,7 @@ HTMLStyleElement::ContentAppended(nsIDocument* aDocument,
void
HTMLStyleElement::ContentInserted(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer)
nsIContent* aChild)
{
ContentChanged(aChild);
}
@ -94,7 +92,6 @@ void
HTMLStyleElement::ContentRemoved(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer,
nsIContent* aPreviousSibling)
{
ContentChanged(aChild);

View File

@ -479,8 +479,7 @@ TableRowsCollection::HandleInsert(nsIContent* aContainer,
void
TableRowsCollection::ContentAppended(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent,
int32_t aNewIndexInContainer)
nsIContent* aFirstNewContent)
{
if (!nsContentUtils::IsInSameAnonymousTree(mParent, aFirstNewContent) ||
!InterestingContainer(aContainer)) {
@ -504,8 +503,7 @@ TableRowsCollection::ContentAppended(nsIDocument* aDocument,
void
TableRowsCollection::ContentInserted(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer)
nsIContent* aChild)
{
if (!nsContentUtils::IsInSameAnonymousTree(mParent, aChild) ||
!InterestingContainer(aContainer)) {
@ -519,7 +517,6 @@ void
TableRowsCollection::ContentRemoved(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer,
nsIContent* aPreviousSibling)
{
if (!nsContentUtils::IsInSameAnonymousTree(mParent, aChild) ||

View File

@ -1035,8 +1035,7 @@ HTMLTextAreaElement::CharacterDataChanged(nsIDocument* aDocument,
void
HTMLTextAreaElement::ContentAppended(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent,
int32_t /* unused */)
nsIContent* aFirstNewContent)
{
ContentChanged(aFirstNewContent);
}
@ -1044,8 +1043,7 @@ HTMLTextAreaElement::ContentAppended(nsIDocument* aDocument,
void
HTMLTextAreaElement::ContentInserted(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t /* unused */)
nsIContent* aChild)
{
ContentChanged(aChild);
}
@ -1054,7 +1052,6 @@ void
HTMLTextAreaElement::ContentRemoved(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer,
nsIContent* aPreviousSibling)
{
ContentChanged(aChild);

View File

@ -64,8 +64,7 @@ HTMLTitleElement::CharacterDataChanged(nsIDocument *aDocument,
void
HTMLTitleElement::ContentAppended(nsIDocument *aDocument,
nsIContent *aContainer,
nsIContent *aFirstNewContent,
int32_t aNewIndexInContainer)
nsIContent *aFirstNewContent)
{
SendTitleChangeEvent(false);
}
@ -73,8 +72,7 @@ HTMLTitleElement::ContentAppended(nsIDocument *aDocument,
void
HTMLTitleElement::ContentInserted(nsIDocument *aDocument,
nsIContent *aContainer,
nsIContent *aChild,
int32_t aIndexInContainer)
nsIContent *aChild)
{
SendTitleChangeEvent(false);
}
@ -83,7 +81,6 @@ void
HTMLTitleElement::ContentRemoved(nsIDocument *aDocument,
nsIContent *aContainer,
nsIContent *aChild,
int32_t aIndexInContainer,
nsIContent *aPreviousSibling)
{
SendTitleChangeEvent(false);

View File

@ -1091,7 +1091,7 @@ HTMLContentSink::NotifyInsert(nsIContent* aContent,
// Scope so we call EndUpdate before we decrease mInNotification
MOZ_AUTO_DOC_UPDATE(mDocument, UPDATE_CONTENT_MODEL, !mBeganUpdate);
nsNodeUtils::ContentInserted(NODE_FROM(aContent, mDocument),
aChildContent, aIndexInContainer);
aChildContent);
mLastNotificationTime = PR_Now();
}

View File

@ -99,8 +99,7 @@ ScriptElement::AttributeChanged(nsIDocument* aDocument,
void
ScriptElement::ContentAppended(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent,
int32_t aNewIndexInContainer)
nsIContent* aFirstNewContent)
{
MaybeProcessScript();
}
@ -108,8 +107,7 @@ ScriptElement::ContentAppended(nsIDocument* aDocument,
void
ScriptElement::ContentInserted(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer)
nsIContent* aChild)
{
MaybeProcessScript();
}

View File

@ -160,8 +160,7 @@ SVGStyleElement::CharacterDataChanged(nsIDocument* aDocument,
void
SVGStyleElement::ContentAppended(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent,
int32_t aNewIndexInContainer)
nsIContent* aFirstNewContent)
{
ContentChanged(aContainer);
}
@ -169,8 +168,7 @@ SVGStyleElement::ContentAppended(nsIDocument* aDocument,
void
SVGStyleElement::ContentInserted(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer)
nsIContent* aChild)
{
ContentChanged(aChild);
}
@ -179,7 +177,6 @@ void
SVGStyleElement::ContentRemoved(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer,
nsIContent* aPreviousSibling)
{
ContentChanged(aChild);

View File

@ -50,8 +50,7 @@ SVGTitleElement::CharacterDataChanged(nsIDocument *aDocument,
void
SVGTitleElement::ContentAppended(nsIDocument *aDocument,
nsIContent *aContainer,
nsIContent *aFirstNewContent,
int32_t aNewIndexInContainer)
nsIContent *aFirstNewContent)
{
SendTitleChangeEvent(false);
}
@ -59,8 +58,7 @@ SVGTitleElement::ContentAppended(nsIDocument *aDocument,
void
SVGTitleElement::ContentInserted(nsIDocument *aDocument,
nsIContent *aContainer,
nsIContent *aChild,
int32_t aIndexInContainer)
nsIContent *aChild)
{
SendTitleChangeEvent(false);
}
@ -69,7 +67,6 @@ void
SVGTitleElement::ContentRemoved(nsIDocument *aDocument,
nsIContent *aContainer,
nsIContent *aChild,
int32_t aIndexInContainer,
nsIContent *aPreviousSibling)
{
SendTitleChangeEvent(false);

View File

@ -170,8 +170,7 @@ SVGUseElement::AttributeChanged(nsIDocument* aDocument,
void
SVGUseElement::ContentAppended(nsIDocument *aDocument,
nsIContent *aContainer,
nsIContent *aFirstNewContent,
int32_t aNewIndexInContainer)
nsIContent *aFirstNewContent)
{
if (nsContentUtils::IsInSameAnonymousTree(this, aContainer)) {
TriggerReclone();
@ -181,8 +180,7 @@ SVGUseElement::ContentAppended(nsIDocument *aDocument,
void
SVGUseElement::ContentInserted(nsIDocument *aDocument,
nsIContent *aContainer,
nsIContent *aChild,
int32_t aIndexInContainer)
nsIContent *aChild)
{
if (nsContentUtils::IsInSameAnonymousTree(this, aChild)) {
TriggerReclone();
@ -193,7 +191,6 @@ void
SVGUseElement::ContentRemoved(nsIDocument *aDocument,
nsIContent *aContainer,
nsIContent *aChild,
int32_t aIndexInContainer,
nsIContent *aPreviousSibling)
{
if (nsContentUtils::IsInSameAnonymousTree(this, aChild)) {

View File

@ -838,13 +838,8 @@ InsertAppendedContent(XBLChildrenElement* aPoint,
void
nsBindingManager::ContentAppended(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent,
int32_t aNewIndexInContainer)
nsIContent* aFirstNewContent)
{
if (aNewIndexInContainer == -1) {
return;
}
// Try to find insertion points for all the new kids.
XBLChildrenElement* point = nullptr;
nsIContent* parent = aContainer;
@ -874,11 +869,9 @@ nsBindingManager::ContentAppended(nsIDocument* aDocument,
// We could optimize this in the case when we've nested a few levels
// deep already, without hitting bindings that have filtered insertion
// points.
int32_t currentIndex = aNewIndexInContainer;
for (nsIContent* currentChild = aFirstNewContent; currentChild;
currentChild = currentChild->GetNextSibling()) {
HandleChildInsertion(aContainer, currentChild,
currentIndex++, true);
HandleChildInsertion(aContainer, currentChild, true);
}
return;
@ -913,21 +906,15 @@ nsBindingManager::ContentAppended(nsIDocument* aDocument,
void
nsBindingManager::ContentInserted(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer)
nsIContent* aChild)
{
if (aIndexInContainer == -1) {
return;
}
HandleChildInsertion(aContainer, aChild, aIndexInContainer, false);
HandleChildInsertion(aContainer, aChild, false);
}
void
nsBindingManager::ContentRemoved(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer,
nsIContent* aPreviousSibling)
{
aChild->SetXBLInsertionParent(nullptr);
@ -1039,13 +1026,9 @@ nsBindingManager::Traverse(nsIContent *aContent,
void
nsBindingManager::HandleChildInsertion(nsIContent* aContainer,
nsIContent* aChild,
uint32_t aIndexInContainer,
bool aAppend)
{
NS_PRECONDITION(aChild, "Must have child");
NS_PRECONDITION(!aContainer ||
uint32_t(aContainer->IndexOf(aChild)) == aIndexInContainer,
"Child not at the right index?");
MOZ_ASSERT(aChild, "Must have child");
XBLChildrenElement* point = nullptr;
nsIContent* parent = aContainer;

View File

@ -181,10 +181,9 @@ protected:
// Called by ContentAppended and ContentInserted to handle a single child
// insertion. aChild must not be null. aContainer may be null.
// aIndexInContainer is the index of the child in the parent. aAppend is
// true if this child is being appended, not inserted.
// aAppend is true if this child is being appended, not inserted.
void HandleChildInsertion(nsIContent* aContainer, nsIContent* aChild,
uint32_t aIndexInContainer, bool aAppend);
bool aAppend);
// Same as ProcessAttachedQueue, but also nulls out
// mProcessAttachedQueueEvent

View File

@ -401,8 +401,7 @@ nsXMLContentSink::OnTransformDone(nsresult aResult,
NS_ASSERTION(mDocument->IndexOf(rootElement) != -1,
"rootElement not in doc?");
mDocument->BeginUpdate(UPDATE_CONTENT_MODEL);
nsNodeUtils::ContentInserted(mDocument, rootElement,
mDocument->IndexOf(rootElement));
nsNodeUtils::ContentInserted(mDocument, rootElement);
mDocument->EndUpdate(UPDATE_CONTENT_MODEL);
}

View File

@ -227,8 +227,7 @@ nsXMLPrettyPrinter::AttributeChanged(nsIDocument* aDocument,
void
nsXMLPrettyPrinter::ContentAppended(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent,
int32_t aNewIndexInContainer)
nsIContent* aFirstNewContent)
{
MaybeUnhook(aContainer);
}
@ -236,8 +235,7 @@ nsXMLPrettyPrinter::ContentAppended(nsIDocument* aDocument,
void
nsXMLPrettyPrinter::ContentInserted(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer)
nsIContent* aChild)
{
MaybeUnhook(aContainer);
}
@ -246,7 +244,6 @@ void
nsXMLPrettyPrinter::ContentRemoved(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer,
nsIContent* aPreviousSibling)
{
MaybeUnhook(aContainer);

View File

@ -144,8 +144,7 @@ XPathResult::AttributeChanged(nsIDocument* aDocument,
void
XPathResult::ContentAppended(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent,
int32_t aNewIndexInContainer)
nsIContent* aFirstNewContent)
{
Invalidate(aContainer);
}
@ -153,8 +152,7 @@ XPathResult::ContentAppended(nsIDocument* aDocument,
void
XPathResult::ContentInserted(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer)
nsIContent* aChild)
{
Invalidate(aContainer);
}
@ -163,7 +161,6 @@ void
XPathResult::ContentRemoved(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer,
nsIContent* aPreviousSibling)
{
Invalidate(aContainer);

View File

@ -1232,8 +1232,7 @@ txMozillaXSLTProcessor::AttributeChanged(nsIDocument* aDocument,
void
txMozillaXSLTProcessor::ContentAppended(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent,
int32_t /* unused */)
nsIContent* aFirstNewContent)
{
mStylesheet = nullptr;
}
@ -1241,8 +1240,7 @@ txMozillaXSLTProcessor::ContentAppended(nsIDocument* aDocument,
void
txMozillaXSLTProcessor::ContentInserted(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t /* unused */)
nsIContent* aChild)
{
mStylesheet = nullptr;
}
@ -1251,7 +1249,6 @@ void
txMozillaXSLTProcessor::ContentRemoved(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer,
nsIContent* aPreviousSibling)
{
mStylesheet = nullptr;

View File

@ -1049,8 +1049,7 @@ XULDocument::AttributeChanged(nsIDocument* aDocument,
void
XULDocument::ContentAppended(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent,
int32_t aNewIndexInContainer)
nsIContent* aFirstNewContent)
{
NS_ASSERTION(aDocument == this, "unexpected doc");
@ -1068,8 +1067,7 @@ XULDocument::ContentAppended(nsIDocument* aDocument,
void
XULDocument::ContentInserted(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer)
nsIContent* aChild)
{
NS_ASSERTION(aDocument == this, "unexpected doc");
@ -1083,7 +1081,6 @@ void
XULDocument::ContentRemoved(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer,
nsIContent* aPreviousSibling)
{
NS_ASSERTION(aDocument == this, "unexpected doc");

View File

@ -1040,8 +1040,7 @@ nsXULContentBuilder::CreateContainerContents(nsIContent* aElement,
MOZ_AUTO_DOC_UPDATE(container->GetUncomposedDoc(), UPDATE_CONTENT_MODEL,
true);
nsNodeUtils::ContentAppended(container,
container->GetChildAt(newIndexInContainer),
newIndexInContainer);
container->GetChildAt(newIndexInContainer));
}
NS_IF_RELEASE(container);

View File

@ -1213,7 +1213,6 @@ void
nsXULTemplateBuilder::ContentRemoved(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer,
nsIContent* aPreviousSibling)
{
if (mRoot && nsContentUtils::ContentIsDescendantOf(mRoot, aChild)) {

View File

@ -307,11 +307,8 @@ HTMLEditor::DeleteRefToAnonymousNode(ManualNACPtr aContent,
docObserver->BeginUpdate(document, UPDATE_CONTENT_MODEL);
}
// XXX This is wrong (bug 439258). Once it's fixed, the NS_WARNING
// in RestyleManager::RestyleForRemove should be changed back
// to an assertion.
docObserver->ContentRemoved(aContent->GetComposedDoc(),
parentContent, aContent, -1,
parentContent, aContent,
aContent->GetPreviousSibling());
if (document) {
docObserver->EndUpdate(document, UPDATE_CONTENT_MODEL);

View File

@ -3133,21 +3133,17 @@ HTMLEditor::InsertTextImpl(const nsAString& aStringToInsert,
void
HTMLEditor::ContentAppended(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent,
int32_t aIndexInContainer)
nsIContent* aFirstNewContent)
{
DoContentInserted(aDocument, aContainer, aFirstNewContent, aIndexInContainer,
eAppended);
DoContentInserted(aDocument, aContainer, aFirstNewContent, eAppended);
}
void
HTMLEditor::ContentInserted(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer)
nsIContent* aChild)
{
DoContentInserted(aDocument, aContainer, aChild, aIndexInContainer,
eInserted);
DoContentInserted(aDocument, aContainer, aChild, eInserted);
}
bool
@ -3175,7 +3171,6 @@ void
HTMLEditor::DoContentInserted(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t /* aIndexInContainer */,
InsertedOrAppended aInsertedOrAppended)
{
MOZ_ASSERT(aChild);
@ -3226,7 +3221,6 @@ void
HTMLEditor::ContentRemoved(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer,
nsIContent* aPreviousSibling)
{
if (!IsInObservedSubtree(aDocument, aContainer, aChild)) {

View File

@ -1076,7 +1076,7 @@ private:
const nsAString& aValue);
typedef enum { eInserted, eAppended } InsertedOrAppended;
void DoContentInserted(nsIDocument* aDocument, nsIContent* aContainer,
nsIContent* aChild, int32_t aIndexInContainer,
nsIContent* aChild,
InsertedOrAppended aInsertedOrAppended);
already_AddRefed<Element> GetElementOrParentByTagName(
const nsAString& aTagName, nsINode* aNode);

View File

@ -4354,8 +4354,7 @@ RealContainer(nsIDocument* aDocument, nsIContent* aContainer, nsIContent* aConte
void
PresShell::ContentAppended(nsIDocument *aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent,
int32_t aNewIndexInContainer)
nsIContent* aFirstNewContent)
{
NS_PRECONDITION(!mIsDocumentGone, "Unexpected ContentAppended");
NS_PRECONDITION(aDocument == mDocument, "Unexpected aDocument");
@ -4387,8 +4386,7 @@ PresShell::ContentAppended(nsIDocument *aDocument,
void
PresShell::ContentInserted(nsIDocument* aDocument,
nsIContent* aMaybeContainer,
nsIContent* aChild,
int32_t aIndexInContainer)
nsIContent* aChild)
{
NS_PRECONDITION(!mIsDocumentGone, "Unexpected ContentInserted");
NS_PRECONDITION(aDocument == mDocument, "Unexpected aDocument");
@ -4423,7 +4421,6 @@ void
PresShell::ContentRemoved(nsIDocument *aDocument,
nsIContent* aMaybeContainer,
nsIContent* aChild,
int32_t aIndexInContainer,
nsIContent* aPreviousSibling)
{
NS_PRECONDITION(!mIsDocumentGone, "Unexpected ContentRemoved");
@ -4446,7 +4443,9 @@ PresShell::ContentRemoved(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.
nsIContent* oldNextSibling = container->GetChildAt(aIndexInContainer);
nsIContent* oldNextSibling = nullptr;
oldNextSibling = aPreviousSibling ?
aPreviousSibling->GetNextSibling() : container->GetFirstChild();
mPresContext->RestyleManager()->ContentRemoved(container, aChild, oldNextSibling);

View File

@ -1477,8 +1477,7 @@ void
nsTextControlFrame::nsAnonDivObserver::ContentAppended(
nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent,
int32_t /* unused */)
nsIContent* aFirstNewContent)
{
mFrame.ClearCachedValue();
}
@ -1487,8 +1486,7 @@ void
nsTextControlFrame::nsAnonDivObserver::ContentInserted(
nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t /* unused */)
nsIContent* aChild)
{
mFrame.ClearCachedValue();
}
@ -1498,7 +1496,6 @@ nsTextControlFrame::nsAnonDivObserver::ContentRemoved(
nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer,
nsIContent* aPreviousSibling)
{
mFrame.ClearCachedValue();

View File

@ -924,8 +924,7 @@ nsImageMap::AttributeChanged(nsIDocument* aDocument,
void
nsImageMap::ContentAppended(nsIDocument *aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent,
int32_t /* unused */)
nsIContent* aFirstNewContent)
{
MaybeUpdateAreas(aContainer);
}
@ -933,8 +932,7 @@ nsImageMap::ContentAppended(nsIDocument *aDocument,
void
nsImageMap::ContentInserted(nsIDocument *aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t /* unused */)
nsIContent* aChild)
{
MaybeUpdateAreas(aContainer);
}
@ -943,7 +941,6 @@ void
nsImageMap::ContentRemoved(nsIDocument *aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer,
nsIContent* aPreviousSibling)
{
MaybeUpdateAreas(aContainer);

View File

@ -763,8 +763,7 @@ inDOMView::AttributeChanged(nsIDocument* aDocument, dom::Element* aElement,
void
inDOMView::ContentAppended(nsIDocument *aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent,
int32_t /* unused */)
nsIContent* aFirstNewContent)
{
if (!mTree) {
return;
@ -772,13 +771,13 @@ inDOMView::ContentAppended(nsIDocument *aDocument,
for (nsIContent* cur = aFirstNewContent; cur; cur = cur->GetNextSibling()) {
// Our ContentInserted impl doesn't use the index
ContentInserted(aDocument, aContainer, cur, 0);
ContentInserted(aDocument, aContainer, cur);
}
}
void
inDOMView::ContentInserted(nsIDocument *aDocument, nsIContent* aContainer,
nsIContent* aChild, int32_t /* unused */)
nsIContent* aChild)
{
if (!mTree)
return;
@ -859,8 +858,7 @@ inDOMView::ContentInserted(nsIDocument *aDocument, nsIContent* aContainer,
void
inDOMView::ContentRemoved(nsIDocument *aDocument, nsIContent* aContainer,
nsIContent* aChild, int32_t aIndexInContainer,
nsIContent* aPreviousSibling)
nsIContent* aChild, nsIContent* aPreviousSibling)
{
if (!mTree)
return;

View File

@ -138,8 +138,7 @@ nsSVGRenderingObserver::AttributeChanged(nsIDocument* aDocument,
void
nsSVGRenderingObserver::ContentAppended(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent,
int32_t /* unused */)
nsIContent* aFirstNewContent)
{
DoUpdate();
}
@ -147,8 +146,7 @@ nsSVGRenderingObserver::ContentAppended(nsIDocument* aDocument,
void
nsSVGRenderingObserver::ContentInserted(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t /* unused */)
nsIContent* aChild)
{
DoUpdate();
}
@ -157,7 +155,6 @@ void
nsSVGRenderingObserver::ContentRemoved(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer,
nsIContent* aPreviousSibling)
{
DoUpdate();

View File

@ -3338,8 +3338,7 @@ NS_IMPL_ISUPPORTS(SVGTextFrame::MutationObserver, nsIMutationObserver)
void
SVGTextFrame::MutationObserver::ContentAppended(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent,
int32_t aNewIndexInContainer)
nsIContent* aFirstNewContent)
{
mFrame->NotifyGlyphMetricsChange();
}
@ -3348,8 +3347,7 @@ void
SVGTextFrame::MutationObserver::ContentInserted(
nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer)
nsIContent* aChild)
{
mFrame->NotifyGlyphMetricsChange();
}
@ -3359,7 +3357,6 @@ SVGTextFrame::MutationObserver::ContentRemoved(
nsIDocument *aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer,
nsIContent* aPreviousSibling)
{
mFrame->NotifyGlyphMetricsChange();

View File

@ -1095,20 +1095,18 @@ nsTreeContentView::AttributeChanged(nsIDocument* aDocument,
void
nsTreeContentView::ContentAppended(nsIDocument *aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent,
int32_t /* unused */)
nsIContent* aFirstNewContent)
{
for (nsIContent* cur = aFirstNewContent; cur; cur = cur->GetNextSibling()) {
// Our contentinserted doesn't use the index
ContentInserted(aDocument, aContainer, cur, 0);
ContentInserted(aDocument, aContainer, cur);
}
}
void
nsTreeContentView::ContentInserted(nsIDocument *aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t /* unused */)
nsIContent* aChild)
{
NS_ASSERTION(aChild, "null ptr");
@ -1177,7 +1175,6 @@ void
nsTreeContentView::ContentRemoved(nsIDocument *aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer,
nsIContent* aPreviousSibling)
{
NS_ASSERTION(aChild, "null ptr");

View File

@ -179,11 +179,10 @@ nsHtml5TreeOperation::Append(nsIContent* aNode,
nsresult rv = NS_OK;
nsHtml5OtherDocUpdate update(aParent->OwnerDoc(),
aBuilder->GetDocument());
uint32_t childCount = aParent->GetChildCount();
rv = aParent->AppendChildTo(aNode, false);
if (NS_SUCCEEDED(rv)) {
aNode->SetParserHasNotified();
nsNodeUtils::ContentAppended(aParent, aNode, childCount);
nsNodeUtils::ContentAppended(aParent, aNode);
}
return rv;
}
@ -198,7 +197,6 @@ nsHtml5TreeOperation::AppendToDocument(nsIContent* aNode,
nsresult rv = NS_OK;
nsIDocument* doc = aBuilder->GetDocument();
uint32_t childCount = doc->GetChildCount();
rv = doc->AppendChildTo(aNode, false);
if (rv == NS_ERROR_DOM_HIERARCHY_REQUEST_ERR) {
aNode->SetParserHasNotified();
@ -206,7 +204,7 @@ nsHtml5TreeOperation::AppendToDocument(nsIContent* aNode,
}
NS_ENSURE_SUCCESS(rv, rv);
aNode->SetParserHasNotified();
nsNodeUtils::ContentInserted(doc, aNode, childCount);
nsNodeUtils::ContentInserted(doc, aNode);
NS_ASSERTION(!nsContentUtils::IsSafeToRunScript(),
"Someone forgot to block scripts");
@ -260,7 +258,6 @@ nsHtml5TreeOperation::AppendChildrenToNewParent(nsIContent* aNode,
nsHtml5OtherDocUpdate update(aParent->OwnerDoc(),
aBuilder->GetDocument());
uint32_t childCount = aParent->GetChildCount();
bool didAppend = false;
while (aNode->HasChildren()) {
nsCOMPtr<nsIContent> child = aNode->GetFirstChild();
@ -270,8 +267,7 @@ nsHtml5TreeOperation::AppendChildrenToNewParent(nsIContent* aNode,
didAppend = true;
}
if (didAppend) {
nsNodeUtils::ContentAppended(aParent, aParent->GetChildAt(childCount),
childCount);
nsNodeUtils::ContentAppended(aParent, aParent->GetLastChild());
}
return NS_OK;
}
@ -294,7 +290,7 @@ nsHtml5TreeOperation::FosterParent(nsIContent* aNode,
uint32_t pos = foster->IndexOf(aTable);
nsresult rv = foster->InsertChildAt(aNode, pos, false);
NS_ENSURE_SUCCESS(rv, rv);
nsNodeUtils::ContentInserted(foster, aNode, pos);
nsNodeUtils::ContentInserted(foster, aNode);
return rv;
}
@ -634,7 +630,7 @@ nsHtml5TreeOperation::FosterParentText(nsIContent* aStackParent,
rv = foster->InsertChildAt(text, pos, false);
NS_ENSURE_SUCCESS(rv, rv);
nsNodeUtils::ContentInserted(foster, text, pos);
nsNodeUtils::ContentInserted(foster, text);
return rv;
}

View File

@ -170,8 +170,7 @@ nsFormFillController::AttributeChanged(nsIDocument* aDocument,
void
nsFormFillController::ContentAppended(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer)
nsIContent* aChild)
{
if (mListNode && mListNode->Contains(aContainer)) {
RevalidateDataList();
@ -181,8 +180,7 @@ nsFormFillController::ContentAppended(nsIDocument* aDocument,
void
nsFormFillController::ContentInserted(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer)
nsIContent* aChild)
{
if (mListNode && mListNode->Contains(aContainer)) {
RevalidateDataList();
@ -193,7 +191,6 @@ void
nsFormFillController::ContentRemoved(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer,
nsIContent* aPreviousSibling)
{
if (mListNode && mListNode->Contains(aContainer)) {

View File

@ -12,9 +12,10 @@ class nsIDocument;
class nsIAtom;
#define NS_DECL_CHANGEOBSERVER \
void ObserveAttributeChanged(nsIDocument *aDocument, nsIContent *aContent, nsIAtom *aAttribute) override; \
void ObserveContentRemoved(nsIDocument *aDocument, nsIContent *aChild, int32_t aIndexInContainer) override; \
void ObserveContentInserted(nsIDocument *aDocument, nsIContent* aContainer, nsIContent *aChild) override;
void ObserveAttributeChanged(nsIDocument* aDocument, nsIContent* aContent, nsIAtom* aAttribute) override; \
void ObserveContentRemoved(nsIDocument* aDocument, nsIContent* aContainer, \
nsIContent* aChild, nsIContent* aPreviousChild) override; \
void ObserveContentInserted(nsIDocument* aDocument, nsIContent* aContainer, nsIContent* aChild) override;
// Something that wants to be alerted to changes in attributes or changes in
// its corresponding content object.
@ -33,8 +34,9 @@ public:
nsIAtom* aAttribute)=0;
virtual void ObserveContentRemoved(nsIDocument* aDocument,
nsIContent* aChild,
int32_t aIndexInContainer)=0;
nsIContent* aContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling)=0;
virtual void ObserveContentInserted(nsIDocument* aDocument,
nsIContent* aContainer,

View File

@ -309,10 +309,14 @@ void nsMenuBarX::ObserveAttributeChanged(nsIDocument* aDocument,
}
void nsMenuBarX::ObserveContentRemoved(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t aIndexInContainer)
nsIContent* aPreviousSibling)
{
RemoveMenuAtIndex(aIndexInContainer);
nsINode* parent = NODE_FROM(aContainer, aDocument);
MOZ_ASSERT(parent);
int32_t index = parent->IndexOf(aPreviousSibling) + 1;
RemoveMenuAtIndex(index);
}
void nsMenuBarX::ObserveContentInserted(nsIDocument* aDocument,

View File

@ -83,11 +83,10 @@ void nsMenuGroupOwnerX::CharacterDataChanged(nsIDocument* aDocument,
void nsMenuGroupOwnerX::ContentAppended(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aFirstNewContent,
int32_t /* unused */)
nsIContent* aFirstNewContent)
{
for (nsIContent* cur = aFirstNewContent; cur; cur = cur->GetNextSibling()) {
ContentInserted(aDocument, aContainer, cur, 0);
ContentInserted(aDocument, aContainer, cur);
}
}
@ -129,7 +128,6 @@ void nsMenuGroupOwnerX::AttributeChanged(nsIDocument* aDocument,
void nsMenuGroupOwnerX::ContentRemoved(nsIDocument * aDocument,
nsIContent * aContainer,
nsIContent * aChild,
int32_t aIndexInContainer,
nsIContent * aPreviousSibling)
{
if (!aContainer) {
@ -139,7 +137,7 @@ void nsMenuGroupOwnerX::ContentRemoved(nsIDocument * aDocument,
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
nsChangeObserver* obs = LookupContentChangeObserver(aContainer);
if (obs)
obs->ObserveContentRemoved(aDocument, aChild, aIndexInContainer);
obs->ObserveContentRemoved(aDocument, aContainer, aChild, aPreviousSibling);
else if (aContainer != 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
@ -148,7 +146,7 @@ void nsMenuGroupOwnerX::ContentRemoved(nsIDocument * aDocument,
if (parent) {
obs = LookupContentChangeObserver(parent);
if (obs)
obs->ObserveContentRemoved(aDocument, aChild, aIndexInContainer);
obs->ObserveContentRemoved(aDocument, aContainer, aChild, aPreviousSibling);
}
}
}
@ -156,8 +154,7 @@ void nsMenuGroupOwnerX::ContentRemoved(nsIDocument * aDocument,
void nsMenuGroupOwnerX::ContentInserted(nsIDocument * aDocument,
nsIContent * aContainer,
nsIContent * aChild,
int32_t /* unused */)
nsIContent * aChild)
{
if (!aContainer) {
return;

View File

@ -346,7 +346,10 @@ nsMenuItemX::ObserveAttributeChanged(nsIDocument *aDocument, nsIContent *aConten
NS_OBJC_END_TRY_ABORT_BLOCK;
}
void nsMenuItemX::ObserveContentRemoved(nsIDocument *aDocument, nsIContent *aChild, int32_t aIndexInContainer)
void nsMenuItemX::ObserveContentRemoved(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling)
{
if (aChild == mCommandContent) {
mMenuGroupOwner->UnregisterForContentChanges(mCommandContent);

View File

@ -761,8 +761,10 @@ void nsMenuX::ObserveAttributeChanged(nsIDocument *aDocument, nsIContent *aConte
NS_OBJC_END_TRY_ABORT_BLOCK;
}
void nsMenuX::ObserveContentRemoved(nsIDocument *aDocument, nsIContent *aChild,
int32_t aIndexInContainer)
void nsMenuX::ObserveContentRemoved(nsIDocument* aDocument,
nsIContent* aContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling)
{
if (gConstructingMenu)
return;