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

@@ -195,6 +195,32 @@ HTMLFieldSetElement::RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify)
}
}
void
HTMLFieldSetElement::RemoveChildNode(nsIContent* aKid, bool aNotify)
{
bool firstLegendHasChanged = false;
if (mFirstLegend && aKid == mFirstLegend) {
// If we are removing the first legend we have to found another one.
nsIContent* child = mFirstLegend->GetNextSibling();
mFirstLegend = nullptr;
firstLegendHasChanged = true;
for (; child; child = child->GetNextSibling()) {
if (child->IsHTMLElement(nsGkAtoms::legend)) {
mFirstLegend = child;
break;
}
}
}
nsGenericHTMLFormElement::RemoveChildNode(aKid, aNotify);
if (firstLegendHasChanged) {
NotifyElementsForFirstLegendChange(aNotify);
}
}
void
HTMLFieldSetElement::AddElement(nsGenericHTMLFormElement* aElement)
{