fixed call to ToInteger() to respect the error code

This commit is contained in:
rickg%netscape.com 1998-11-24 02:39:36 +00:00
Родитель fdba1f6194
Коммит e0364847d4
2 изменённых файлов: 20 добавлений и 12 удалений

Просмотреть файл

@ -142,13 +142,17 @@ nsHTMLFontElement::StringToAttribute(nsIAtom* aAttribute,
(aAttribute == nsHTMLAtoms::pointSize) ||
(aAttribute == nsHTMLAtoms::fontWeight)) {
nsAutoString tmp(aValue);
//rickg: fixed flaw where ToInteger error code was not being checked.
// This caused wrong default value for font size.
PRInt32 ec, v = tmp.ToInteger(&ec);
if(NS_SUCCEEDED(ec)){
tmp.CompressWhitespace(PR_TRUE, PR_FALSE);
PRUnichar ch = tmp.First();
aResult.SetIntValue(v, ((ch == '+') || (ch == '-')) ?
eHTMLUnit_Integer : eHTMLUnit_Enumerated);
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
if (aAttribute == nsHTMLAtoms::color) {
nsGenericHTMLElement::ParseColor(aValue, aResult);
return NS_CONTENT_ATTR_HAS_VALUE;

Просмотреть файл

@ -142,13 +142,17 @@ nsHTMLFontElement::StringToAttribute(nsIAtom* aAttribute,
(aAttribute == nsHTMLAtoms::pointSize) ||
(aAttribute == nsHTMLAtoms::fontWeight)) {
nsAutoString tmp(aValue);
//rickg: fixed flaw where ToInteger error code was not being checked.
// This caused wrong default value for font size.
PRInt32 ec, v = tmp.ToInteger(&ec);
if(NS_SUCCEEDED(ec)){
tmp.CompressWhitespace(PR_TRUE, PR_FALSE);
PRUnichar ch = tmp.First();
aResult.SetIntValue(v, ((ch == '+') || (ch == '-')) ?
eHTMLUnit_Integer : eHTMLUnit_Enumerated);
return NS_CONTENT_ATTR_HAS_VALUE;
}
}
if (aAttribute == nsHTMLAtoms::color) {
nsGenericHTMLElement::ParseColor(aValue, aResult);
return NS_CONTENT_ATTR_HAS_VALUE;