Bug 1425440 - Replace RemoveChildAt_Deprecated with RemoveChildNode in XULDocument, r=catalinb

This commit is contained in:
Andrea Marchesini 2018-01-25 16:04:50 +01:00
Родитель afff3a60fe
Коммит 7571a2b792
2 изменённых файлов: 9 добавлений и 17 удалений

Просмотреть файл

@ -3603,8 +3603,7 @@ XULDocument::OverlayForwardReference::Merge(Element* aTargetElement,
if (attr == nsGkAtoms::removeelement && value.EqualsLiteral("true")) { if (attr == nsGkAtoms::removeelement && value.EqualsLiteral("true")) {
nsCOMPtr<nsINode> parent = aTargetElement->GetParentNode(); nsCOMPtr<nsINode> parent = aTargetElement->GetParentNode();
if (!parent) return NS_ERROR_FAILURE; if (!parent) return NS_ERROR_FAILURE;
rv = RemoveElement(parent, aTargetElement); parent->RemoveChildNode(aTargetElement, true);
if (NS_FAILED(rv)) return rv;
return NS_OK; return NS_OK;
} }
@ -3671,13 +3670,19 @@ XULDocument::OverlayForwardReference::Merge(Element* aTargetElement,
// non-null ID. // non-null ID.
rv = Merge(elementInDocument, currContent->AsElement(), aNotify); rv = Merge(elementInDocument, currContent->AsElement(), aNotify);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
aOverlayElement->RemoveChildAt_Deprecated(0, false); nsIContent* firstChild = aOverlayElement->GetFirstChild();
if (firstChild) {
aOverlayElement->RemoveChildNode(firstChild, false);
}
continue; continue;
} }
} }
aOverlayElement->RemoveChildAt_Deprecated(0, false); nsIContent* firstChild = aOverlayElement->GetFirstChild();
if (firstChild) {
aOverlayElement->RemoveChildNode(firstChild, false);
}
rv = InsertElement(aTargetElement, currContent, aNotify); rv = InsertElement(aTargetElement, currContent, aNotify);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
@ -4037,15 +4042,6 @@ XULDocument::InsertElement(nsINode* aParent, nsIContent* aChild, bool aNotify)
return NS_OK; return NS_OK;
} }
nsresult
XULDocument::RemoveElement(nsINode* aParent, nsINode* aChild)
{
int32_t nodeOffset = aParent->ComputeIndexOf(aChild);
aParent->RemoveChildAt_Deprecated(nodeOffset, true);
return NS_OK;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// //
// CachedChromeStreamListener // CachedChromeStreamListener

Просмотреть файл

@ -524,10 +524,6 @@ protected:
nsresult nsresult
InsertElement(nsINode* aParent, nsIContent* aChild, bool aNotify); InsertElement(nsINode* aParent, nsIContent* aChild, bool aNotify);
static
nsresult
RemoveElement(nsINode* aParent, nsINode* aChild);
/** /**
* The current prototype that we are walking to construct the * The current prototype that we are walking to construct the
* content model. * content model.