From 32758d4ffde0f568f976d2e1a8aa3473ddf205ed Mon Sep 17 00:00:00 2001 From: "dbaron%dbaron.org" Date: Wed, 22 Mar 2006 07:10:31 +0000 Subject: [PATCH] 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 --- mozilla/layout/generic/nsGfxScrollFrame.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/mozilla/layout/generic/nsGfxScrollFrame.cpp b/mozilla/layout/generic/nsGfxScrollFrame.cpp index 6dc1745d267..30c2bbda535 100644 --- a/mozilla/layout/generic/nsGfxScrollFrame.cpp +++ b/mozilla/layout/generic/nsGfxScrollFrame.cpp @@ -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