Bug 1425321 - Renaming nsINode::RemoveChildAt to RemoveChildAt_Deprecated, r=catalinb

This commit is contained in:
Andrea Marchesini 2018-01-03 14:01:03 +01:00
parent 00e79ef07b
commit 6ee7f4e6f3
31 changed files with 57 additions and 54 deletions

View File

@ -327,7 +327,7 @@ Attr::InsertChildAt(nsIContent* aKid, uint32_t aIndex,
}
void
Attr::RemoveChildAt(uint32_t aIndex, bool aNotify)
Attr::RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify)
{
}

View File

@ -69,7 +69,7 @@ public:
virtual int32_t IndexOf(const nsINode* aPossibleChild) const override;
virtual nsresult InsertChildAt(nsIContent* aKid, uint32_t aIndex,
bool aNotify) override;
virtual void RemoveChildAt(uint32_t aIndex, bool aNotify) override;
virtual void RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify) override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
virtual already_AddRefed<nsIURI> GetBaseURI(bool aTryUseXHRDocBaseURI = false) const override;

View File

@ -1159,10 +1159,10 @@ FragmentOrElement::InsertChildAt(nsIContent* aKid,
}
void
FragmentOrElement::RemoveChildAt(uint32_t aIndex, bool aNotify)
FragmentOrElement::RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify)
{
nsCOMPtr<nsIContent> oldKid = mAttrsAndChildren.GetSafeChildAt(aIndex);
NS_ASSERTION(oldKid == GetChildAt_Deprecated(aIndex), "Unexpected child in RemoveChildAt");
NS_ASSERTION(oldKid == GetChildAt_Deprecated(aIndex), "Unexpected child in RemoveChildAt_Deprecated");
if (oldKid) {
doRemoveChildAt(aIndex, aNotify, oldKid, mAttrsAndChildren);
@ -2296,7 +2296,7 @@ FragmentOrElement::SetInnerHTMLInternal(const nsAString& aInnerHTML, ErrorResult
uint32_t childCount = target->GetChildCount();
nsAutoMutationBatch mb(target, true, false);
for (uint32_t i = 0; i < childCount; ++i) {
target->RemoveChildAt(0, true);
target->RemoveChildAt_Deprecated(0, true);
}
mb.RemovalDone();

View File

@ -122,7 +122,7 @@ public:
virtual int32_t IndexOf(const nsINode* aPossibleChild) const override;
virtual nsresult InsertChildAt(nsIContent* aKid, uint32_t aIndex,
bool aNotify) override;
virtual void RemoveChildAt(uint32_t aIndex, bool aNotify) override;
virtual void RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify) override;
virtual void GetTextContentInternal(nsAString& aTextContent,
mozilla::OOMReporter& aError) override;
virtual void SetTextContentInternal(const nsAString& aTextContent,

View File

@ -5314,7 +5314,7 @@ nsContentUtils::SetNodeTextContent(nsIContent* aContent,
removeIndex = 1;
}
else {
aContent->RemoveChildAt(removeIndex, true);
aContent->RemoveChildAt_Deprecated(removeIndex, true);
}
}
@ -5325,7 +5325,7 @@ nsContentUtils::SetNodeTextContent(nsIContent* aContent,
else {
mb.Init(aContent, true, false);
for (uint32_t i = 0; i < childCount; ++i) {
aContent->RemoveChildAt(0, true);
aContent->RemoveChildAt_Deprecated(0, true);
}
}
mb.RemovalDone();

View File

@ -4471,7 +4471,7 @@ nsDocument::InsertChildAt(nsIContent* aKid, uint32_t aIndex,
}
void
nsDocument::RemoveChildAt(uint32_t aIndex, bool aNotify)
nsDocument::RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify)
{
nsCOMPtr<nsIContent> oldKid = GetChildAt_Deprecated(aIndex);
if (!oldKid) {
@ -7550,7 +7550,7 @@ nsDOMAttributeMap::BlastSubtreeToPieces(nsINode *aNode)
uint32_t count = aNode->GetChildCount();
for (uint32_t i = 0; i < count; ++i) {
BlastSubtreeToPieces(aNode->GetFirstChild());
aNode->RemoveChildAt(0, false);
aNode->RemoveChildAt_Deprecated(0, false);
}
}
@ -7750,7 +7750,7 @@ nsIDocument::AdoptNode(nsINode& aAdoptedNode, ErrorResult& rv)
if (parent) {
int32_t idx = parent->IndexOf(adoptedNode);
MOZ_ASSERT(idx >= 0);
parent->RemoveChildAt(idx, true);
parent->RemoveChildAt_Deprecated(idx, true);
} else {
MOZ_ASSERT(!adoptedNode->IsInUncomposedDoc());

View File

@ -559,7 +559,7 @@ public:
virtual uint32_t GetChildCount() const override;
virtual nsresult InsertChildAt(nsIContent* aKid, uint32_t aIndex,
bool aNotify) override;
virtual void RemoveChildAt(uint32_t aIndex, bool aNotify) override;
virtual void RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify) override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override
{

View File

@ -659,7 +659,7 @@ nsGenericDOMDataNode::InsertChildAt(nsIContent* aKid, uint32_t aIndex,
}
void
nsGenericDOMDataNode::RemoveChildAt(uint32_t aIndex, bool aNotify)
nsGenericDOMDataNode::RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify)
{
}

View File

@ -109,7 +109,7 @@ public:
virtual int32_t IndexOf(const nsINode* aPossibleChild) const override;
virtual nsresult InsertChildAt(nsIContent* aKid, uint32_t aIndex,
bool aNotify) override;
virtual void RemoveChildAt(uint32_t aIndex, bool aNotify) override;
virtual void RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify) override;
virtual void GetTextContentInternal(nsAString& aTextContent,
mozilla::OOMReporter& aError) override
{

View File

@ -614,7 +614,7 @@ nsINode::RemoveChild(nsINode& aOldChild, ErrorResult& aError)
return nullptr;
}
RemoveChildAt(index, true);
RemoveChildAt_Deprecated(index, true);
return &aOldChild;
}
@ -721,7 +721,7 @@ nsINode::Normalize()
"Should always have a parent unless "
"mutation events messed us up");
if (parent) {
parent->RemoveChildAt(parent->IndexOf(node), true);
parent->RemoveChildAt_Deprecated(parent->IndexOf(node), true);
}
}
}
@ -1926,7 +1926,8 @@ nsINode::doRemoveChildAt(uint32_t aIndex, bool aNotify,
// NOTE: This function must not trigger any calls to
// nsIDocument::GetRootElement() calls until *after* it has removed aKid from
// aChildArray. Any calls before then could potentially restore a stale
// value for our cached root element, per note in nsDocument::RemoveChildAt().
// value for our cached root element, per note in
// nsDocument::RemoveChildAt_Deprecated().
MOZ_ASSERT(aKid && aKid->GetParentNode() == this &&
aKid == GetChildAt_Deprecated(aIndex) &&
IndexOf(aKid) == (int32_t)aIndex, "Bogus aKid");
@ -2259,7 +2260,7 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
mozAutoDocUpdate batch(newContent->GetComposedDoc(),
UPDATE_CONTENT_MODEL, true);
nsAutoMutationBatch mb(oldParent, true, true);
oldParent->RemoveChildAt(removeIndex, true);
oldParent->RemoveChildAt_Deprecated(removeIndex, true);
if (nsAutoMutationBatch::GetCurrentBatch() == &mb) {
mb.RemovalDone();
mb.SetPrevSibling(oldParent->GetChildAt_Deprecated(removeIndex - 1));
@ -2339,7 +2340,7 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
nsAutoMutationBatch mb(newContent, false, true);
for (uint32_t i = count; i > 0;) {
newContent->RemoveChildAt(--i, true);
newContent->RemoveChildAt_Deprecated(--i, true);
}
}
@ -2437,7 +2438,7 @@ nsINode::ReplaceOrInsertBefore(bool aReplace, nsINode* aNewChild,
// An since nodeToInsertBefore is at index insPos, we want to remove
// at the previous index.
NS_ASSERTION(insPos >= 1, "insPos too small");
RemoveChildAt(insPos-1, true);
RemoveChildAt_Deprecated(insPos-1, true);
--insPos;
}

View File

@ -763,6 +763,9 @@ public:
}
/**
* NOTE: this function is going to be removed soon (hopefully!) Don't use it
* in new code.
*
* Remove a child from this node. This method handles calling UnbindFromTree
* on the child appropriately.
*
@ -773,7 +776,7 @@ public:
*
* Note: If there is no child at aIndex, this method will simply do nothing.
*/
virtual void RemoveChildAt(uint32_t aIndex, bool aNotify) = 0;
virtual void RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify) = 0;
/**
* Get a property associated with this node.

View File

@ -170,7 +170,7 @@ HTMLFieldSetElement::InsertChildAt(nsIContent* aChild, uint32_t aIndex,
}
void
HTMLFieldSetElement::RemoveChildAt(uint32_t aIndex, bool aNotify)
HTMLFieldSetElement::RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify)
{
bool firstLegendHasChanged = false;
@ -188,7 +188,7 @@ HTMLFieldSetElement::RemoveChildAt(uint32_t aIndex, bool aNotify)
}
}
nsGenericHTMLFormElement::RemoveChildAt(aIndex, aNotify);
nsGenericHTMLFormElement::RemoveChildAt_Deprecated(aIndex, aNotify);
if (firstLegendHasChanged) {
NotifyElementsForFirstLegendChange(aNotify);

View File

@ -43,7 +43,7 @@ public:
virtual nsresult InsertChildAt(nsIContent* aChild, uint32_t aIndex,
bool aNotify) override;
virtual void RemoveChildAt(uint32_t aIndex, bool aNotify) override;
virtual void RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify) override;
// nsIFormControl
NS_IMETHOD Reset() override;

View File

@ -88,11 +88,11 @@ HTMLOptGroupElement::InsertChildAt(nsIContent* aKid,
}
void
HTMLOptGroupElement::RemoveChildAt(uint32_t aIndex, bool aNotify)
HTMLOptGroupElement::RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify)
{
SafeOptionListMutation safeMutation(GetSelect(), this, nullptr, aIndex,
aNotify);
nsGenericHTMLElement::RemoveChildAt(aIndex, aNotify);
nsGenericHTMLElement::RemoveChildAt_Deprecated(aIndex, aNotify);
}
nsresult

View File

@ -27,7 +27,7 @@ public:
// nsINode
virtual nsresult InsertChildAt(nsIContent* aKid, uint32_t aIndex,
bool aNotify) override;
virtual void RemoveChildAt(uint32_t aIndex, bool aNotify) override;
virtual void RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify) override;
// nsIContent
virtual nsresult GetEventTargetParent(

View File

@ -33,7 +33,7 @@ NS_IMPL_ISUPPORTS_INHERITED0(HTMLPictureElement, nsGenericHTMLElement)
NS_IMPL_ELEMENT_CLONE(HTMLPictureElement)
void
HTMLPictureElement::RemoveChildAt(uint32_t aIndex, bool aNotify)
HTMLPictureElement::RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify)
{
nsCOMPtr<nsIContent> child = GetChildAt_Deprecated(aIndex);
@ -55,7 +55,7 @@ HTMLPictureElement::RemoveChildAt(uint32_t aIndex, bool aNotify)
}
}
nsGenericHTMLElement::RemoveChildAt(aIndex, aNotify);
nsGenericHTMLElement::RemoveChildAt_Deprecated(aIndex, aNotify);
}
nsresult

View File

@ -23,7 +23,7 @@ public:
virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult,
bool aPreallocateChildren) const override;
virtual void RemoveChildAt(uint32_t aIndex, bool aNotify) override;
virtual void RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify) override;
virtual nsresult InsertChildAt(nsIContent* aKid, uint32_t aIndex, bool aNotify) override;
protected:

View File

@ -218,10 +218,10 @@ HTMLSelectElement::InsertChildAt(nsIContent* aKid,
}
void
HTMLSelectElement::RemoveChildAt(uint32_t aIndex, bool aNotify)
HTMLSelectElement::RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify)
{
SafeOptionListMutation safeMutation(this, this, nullptr, aIndex, aNotify);
nsGenericHTMLFormElementWithState::RemoveChildAt(aIndex, aNotify);
nsGenericHTMLFormElementWithState::RemoveChildAt_Deprecated(aIndex, aNotify);
}

View File

@ -293,7 +293,7 @@ public:
virtual bool IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable, int32_t* aTabIndex) override;
virtual nsresult InsertChildAt(nsIContent* aKid, uint32_t aIndex,
bool aNotify) override;
virtual void RemoveChildAt(uint32_t aIndex, bool aNotify) override;
virtual void RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify) override;
// Overriden nsIFormControl methods
NS_IMETHOD Reset() override;

View File

@ -3106,7 +3106,7 @@ nsGenericHTMLElement::SetInnerText(const nsAString& aValue)
mb.Init(this, true, false);
for (uint32_t i = 0; i < childCount; ++i) {
RemoveChildAt(0, true);
RemoveChildAt_Deprecated(0, true);
}
mb.RemovalDone();

View File

@ -94,9 +94,9 @@ SVGSwitchElement::InsertChildAt(nsIContent* aKid,
}
void
SVGSwitchElement::RemoveChildAt(uint32_t aIndex, bool aNotify)
SVGSwitchElement::RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify)
{
SVGSwitchElementBase::RemoveChildAt(aIndex, aNotify);
SVGSwitchElementBase::RemoveChildAt_Deprecated(aIndex, aNotify);
MaybeInvalidate();
}

View File

@ -42,7 +42,7 @@ public:
// nsINode
virtual nsresult InsertChildAt(nsIContent* aKid, uint32_t aIndex,
bool aNotify) override;
virtual void RemoveChildAt(uint32_t aIndex, bool aNotify) override;
virtual void RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify) override;
// nsIContent
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;

View File

@ -386,7 +386,7 @@ nsXBLPrototypeBinding::AttributeChanged(nsAtom* aAttribute,
// Flush out all our kids.
uint32_t childCount = realElement->GetChildCount();
for (uint32_t i = 0; i < childCount; i++)
realElement->RemoveChildAt(0, aNotify);
realElement->RemoveChildAt_Deprecated(0, aNotify);
if (!aRemoveFlag) {
// Construct a new text node and insert it.

View File

@ -650,7 +650,7 @@ txMozillaXMLOutput::createTxWrapper()
++j;
}
else {
mDocument->RemoveChildAt(j, true);
mDocument->RemoveChildAt_Deprecated(j, true);
rv = wrapper->AppendChildTo(childContent, true);
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -3949,13 +3949,13 @@ XULDocument::OverlayForwardReference::Merge(Element* aTargetElement,
// non-null ID.
rv = Merge(elementInDocument, currContent->AsElement(), aNotify);
if (NS_FAILED(rv)) return rv;
aOverlayElement->RemoveChildAt(0, false);
aOverlayElement->RemoveChildAt_Deprecated(0, false);
continue;
}
}
aOverlayElement->RemoveChildAt(0, false);
aOverlayElement->RemoveChildAt_Deprecated(0, false);
rv = InsertElement(aTargetElement, currContent, aNotify);
if (NS_FAILED(rv)) return rv;
@ -4339,7 +4339,7 @@ XULDocument::RemoveElement(nsINode* aParent, nsINode* aChild)
{
int32_t nodeOffset = aParent->IndexOf(aChild);
aParent->RemoveChildAt(nodeOffset, true);
aParent->RemoveChildAt_Deprecated(nodeOffset, true);
return NS_OK;
}

View File

@ -863,7 +863,7 @@ nsXULElement::UnbindFromTree(bool aDeep, bool aNullParent)
}
void
nsXULElement::RemoveChildAt(uint32_t aIndex, bool aNotify)
nsXULElement::RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify)
{
nsCOMPtr<nsIContent> oldKid = mAttrsAndChildren.GetSafeChildAt(aIndex);
if (!oldKid) {
@ -932,7 +932,7 @@ nsXULElement::RemoveChildAt(uint32_t aIndex, bool aNotify)
}
}
nsStyledElement::RemoveChildAt(aIndex, aNotify);
nsStyledElement::RemoveChildAt_Deprecated(aIndex, aNotify);
if (newCurrentIndex == -2) {
controlElement->SetCurrentItem(nullptr);

View File

@ -370,7 +370,7 @@ public:
nsIContent* aBindingParent,
bool aCompileEventHandlers) override;
virtual void UnbindFromTree(bool aDeep, bool aNullParent) override;
virtual void RemoveChildAt(uint32_t aIndex, bool aNotify) override;
virtual void RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify) override;
virtual void DestroyContent() override;
#ifdef DEBUG

View File

@ -915,10 +915,9 @@ nsXULContentBuilder::RemoveMember(nsIContent* aContent)
NS_ASSERTION(pos >= 0, "parent doesn't think this child has an index");
if (pos < 0) return NS_OK;
// Note: RemoveChildAt sets |child|'s document to null so that
// it'll get knocked out of the XUL doc's resource-to-element
// map.
parent->RemoveChildAt(pos, true);
// Note: RemoveChildAt_Deprecated sets |child|'s document to null so
// that it'll get knocked out of the XUL doc's resource-to-element map.
parent->RemoveChildAt_Deprecated(pos, true);
}
// Remove from the content support map.
@ -1311,7 +1310,7 @@ nsXULContentBuilder::RemoveGeneratedContent(nsIContent* aElement)
}
// If we get here, it's "generated". Bye bye!
element->RemoveChildAt(i, true);
element->RemoveChildAt_Deprecated(i, true);
// Remove this and any children from the content support map.
mContentSupportMap.Remove(child);

View File

@ -278,7 +278,7 @@ XULSortServiceImpl::SortContainer(nsIContent *aContainer, nsSortState* aSortStat
// may generate results which get placed in different locations.
items[i].parent = parent;
int32_t index = parent->IndexOf(child);
parent->RemoveChildAt(index, true);
parent->RemoveChildAt_Deprecated(index, true);
}
}

View File

@ -1304,7 +1304,7 @@ nsTextControlFrame::UpdateValueDisplay(bool aNotify,
}
if (aBeforeEditorInit && value.IsEmpty()) {
mRootNode->RemoveChildAt(0, true);
mRootNode->RemoveChildAt_Deprecated(0, true);
return NS_OK;
}

View File

@ -245,7 +245,7 @@ nsHtml5TreeOperation::Detach(nsIContent* aNode, nsHtml5DocumentBuilder* aBuilder
aBuilder->GetDocument());
int32_t pos = parent->IndexOf(aNode);
NS_ASSERTION((pos >= 0), "Element not found as child of its parent");
parent->RemoveChildAt(pos, true);
parent->RemoveChildAt_Deprecated(pos, true);
}
}
@ -262,7 +262,7 @@ nsHtml5TreeOperation::AppendChildrenToNewParent(nsIContent* aNode,
bool didAppend = false;
while (aNode->HasChildren()) {
nsCOMPtr<nsIContent> child = aNode->GetFirstChild();
aNode->RemoveChildAt(0, true);
aNode->RemoveChildAt_Deprecated(0, true);
nsresult rv = aParent->AppendChildTo(child, false);
NS_ENSURE_SUCCESS(rv, rv);
didAppend = true;