Bug 1431000 - Introduce nsINode::InsertChildBefore, r=catalinb
This commit is contained in:
@@ -139,6 +139,39 @@ HTMLFieldSetElement::SubmitNamesValues(HTMLFormSubmission* aFormSubmission)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLFieldSetElement::InsertChildBefore(nsIContent* aChild,
|
||||
nsIContent* aBeforeThis,
|
||||
bool aNotify)
|
||||
{
|
||||
bool firstLegendHasChanged = false;
|
||||
|
||||
if (aChild->IsHTMLElement(nsGkAtoms::legend)) {
|
||||
if (!mFirstLegend) {
|
||||
mFirstLegend = aChild;
|
||||
// We do not want to notify the first time mFirstElement is set.
|
||||
} else {
|
||||
// If mFirstLegend is before aIndex, we do not change it.
|
||||
// Otherwise, mFirstLegend is now aChild.
|
||||
int32_t index = aBeforeThis ? ComputeIndexOf(aBeforeThis) : GetChildCount();
|
||||
if (index <= ComputeIndexOf(mFirstLegend)) {
|
||||
mFirstLegend = aChild;
|
||||
firstLegendHasChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsresult rv =
|
||||
nsGenericHTMLFormElement::InsertChildBefore(aChild, aBeforeThis, aNotify);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (firstLegendHasChanged) {
|
||||
NotifyElementsForFirstLegendChange(aNotify);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLFieldSetElement::InsertChildAt_Deprecated(nsIContent* aChild,
|
||||
uint32_t aIndex,
|
||||
|
||||
Reference in New Issue
Block a user