Bug 604737 - nsHTMLFieldSetElement::RemoveChildAt should update mFirstLegend. r=smaug a=blocking

This commit is contained in:
Mounir Lamouri 2010-10-21 13:11:01 +02:00
parent e157dd74d7
commit eb0b89befa
4 changed files with 31 additions and 4 deletions

View File

@ -216,13 +216,15 @@ nsHTMLFieldSetElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify,
{
bool firstLegendHasChanged = false;
if (GetChildAt(aIndex) == mFirstLegend) {
if (mFirstLegend && (GetChildAt(aIndex) == mFirstLegend)) {
// If we are removing the first legend we have to found another one.
for (nsIContent* child = mFirstLegend; child;
child = child->GetNextSibling()) {
nsIContent* child = mFirstLegend->GetNextSibling();
mFirstLegend = nsnull;
firstLegendHasChanged = true;
for (; child; child = child->GetNextSibling()) {
if (child->IsHTML(nsGkAtoms::legend)) {
mFirstLegend = child;
firstLegendHasChanged = true;
break;
}
}

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<body>
<fieldset disabled>
<legend>
<input>
</legend>
</fieldset>
</body>
</html>

View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html class='reftest-wait'>
<body onload="document.getElementsByTagName('fieldset')[0].removeChild(document.getElementById('l'));
document.documentElement.className = '';">
<fieldset disabled>
<legend id='l'>
<input>
</legend>
<legend>
<input>
</legend>
</fieldset>
</body>
</html>

View File

@ -1519,6 +1519,7 @@ fails-if(!haveTestPlugin) == 599476.html 599476-ref.html
== 600045-1.html 600045-1-ref.html
== 600803-1.html 600803-1-ref.html
== 600974-1.html 600974-1-ref.html
== 604737.html 604737-ref.html
== 600974-2.html 600974-1-ref.html
== 600974-3.html 600974-1-ref.html
== 605157-1.xhtml 605157-1-ref.xhtml