Bug 1425440 - Introduce nsINode::RemoveChildNode, r=catalinb

This commit is contained in:
Andrea Marchesini
2018-01-15 17:18:38 +01:00
parent 1b99fb5dd6
commit fd42ab061c
22 changed files with 226 additions and 2 deletions

View File

@@ -58,6 +58,30 @@ HTMLPictureElement::RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify)
nsGenericHTMLElement::RemoveChildAt_Deprecated(aIndex, aNotify);
}
void
HTMLPictureElement::RemoveChildNode(nsIContent* aKid, bool aNotify)
{
if (aKid && aKid->IsHTMLElement(nsGkAtoms::img)) {
HTMLImageElement* img = HTMLImageElement::FromContent(aKid);
if (img) {
img->PictureSourceRemoved(aKid->AsContent());
}
} else if (aKid && aKid->IsHTMLElement(nsGkAtoms::source)) {
// Find all img siblings after this <source> to notify them of its demise
nsCOMPtr<nsIContent> nextSibling = aKid->GetNextSibling();
if (nextSibling && nextSibling->GetParentNode() == this) {
do {
HTMLImageElement* img = HTMLImageElement::FromContent(nextSibling);
if (img) {
img->PictureSourceRemoved(aKid->AsContent());
}
} while ( (nextSibling = nextSibling->GetNextSibling()) );
}
}
nsGenericHTMLElement::RemoveChildNode(aKid, aNotify);
}
nsresult
HTMLPictureElement::InsertChildAt(nsIContent* aKid, uint32_t aIndex, bool aNotify)
{