Avoid potential problems initializing attributes to -1. b=192767 r+sr=roc

git-svn-id: svn://10.0.0.236/trunk@192763 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dbaron%dbaron.org
2006-03-22 07:10:31 +00:00
parent 7dd9517c77
commit 32758d4ffd

View File

@@ -2494,16 +2494,19 @@ nsGfxScrollFrameInner::SetAttribute(nsIBox* aBox, nsIAtom* aAtom, nscoord aSize,
// only set the attribute if it changed.
PRInt32 current = GetIntegerAttribute(aBox, aAtom, -1);
if (current != aSize)
{
nsAutoString newValue;
newValue.AppendInt(aSize);
aBox->GetContent()->SetAttr(kNameSpaceID_None, aAtom, newValue, aReflow);
return PR_TRUE;
}
nsIContent *content = aBox->GetContent();
return PR_FALSE;
nsAutoString oldValue;
content->GetAttr(kNameSpaceID_None, aAtom, oldValue);
nsAutoString newValue;
newValue.AppendInt(aSize);
if (oldValue == newValue)
return PR_FALSE;
content->SetAttr(kNameSpaceID_None, aAtom, newValue, aReflow);
return PR_TRUE;
}
nsRect