зеркало из https://github.com/mozilla/pjs.git
fixed call to ToInteger() to respect the error code
This commit is contained in:
Родитель
6e6e40b0a4
Коммит
d3f830f49e
|
@ -142,13 +142,17 @@ nsHTMLFontElement::StringToAttribute(nsIAtom* aAttribute,
|
||||||
(aAttribute == nsHTMLAtoms::pointSize) ||
|
(aAttribute == nsHTMLAtoms::pointSize) ||
|
||||||
(aAttribute == nsHTMLAtoms::fontWeight)) {
|
(aAttribute == nsHTMLAtoms::fontWeight)) {
|
||||||
nsAutoString tmp(aValue);
|
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);
|
PRInt32 ec, v = tmp.ToInteger(&ec);
|
||||||
|
if(NS_SUCCEEDED(ec)){
|
||||||
tmp.CompressWhitespace(PR_TRUE, PR_FALSE);
|
tmp.CompressWhitespace(PR_TRUE, PR_FALSE);
|
||||||
PRUnichar ch = tmp.First();
|
PRUnichar ch = tmp.First();
|
||||||
aResult.SetIntValue(v, ((ch == '+') || (ch == '-')) ?
|
aResult.SetIntValue(v, ((ch == '+') || (ch == '-')) ?
|
||||||
eHTMLUnit_Integer : eHTMLUnit_Enumerated);
|
eHTMLUnit_Integer : eHTMLUnit_Enumerated);
|
||||||
return NS_CONTENT_ATTR_HAS_VALUE;
|
return NS_CONTENT_ATTR_HAS_VALUE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (aAttribute == nsHTMLAtoms::color) {
|
if (aAttribute == nsHTMLAtoms::color) {
|
||||||
nsGenericHTMLElement::ParseColor(aValue, aResult);
|
nsGenericHTMLElement::ParseColor(aValue, aResult);
|
||||||
return NS_CONTENT_ATTR_HAS_VALUE;
|
return NS_CONTENT_ATTR_HAS_VALUE;
|
||||||
|
|
|
@ -142,13 +142,17 @@ nsHTMLFontElement::StringToAttribute(nsIAtom* aAttribute,
|
||||||
(aAttribute == nsHTMLAtoms::pointSize) ||
|
(aAttribute == nsHTMLAtoms::pointSize) ||
|
||||||
(aAttribute == nsHTMLAtoms::fontWeight)) {
|
(aAttribute == nsHTMLAtoms::fontWeight)) {
|
||||||
nsAutoString tmp(aValue);
|
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);
|
PRInt32 ec, v = tmp.ToInteger(&ec);
|
||||||
|
if(NS_SUCCEEDED(ec)){
|
||||||
tmp.CompressWhitespace(PR_TRUE, PR_FALSE);
|
tmp.CompressWhitespace(PR_TRUE, PR_FALSE);
|
||||||
PRUnichar ch = tmp.First();
|
PRUnichar ch = tmp.First();
|
||||||
aResult.SetIntValue(v, ((ch == '+') || (ch == '-')) ?
|
aResult.SetIntValue(v, ((ch == '+') || (ch == '-')) ?
|
||||||
eHTMLUnit_Integer : eHTMLUnit_Enumerated);
|
eHTMLUnit_Integer : eHTMLUnit_Enumerated);
|
||||||
return NS_CONTENT_ATTR_HAS_VALUE;
|
return NS_CONTENT_ATTR_HAS_VALUE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (aAttribute == nsHTMLAtoms::color) {
|
if (aAttribute == nsHTMLAtoms::color) {
|
||||||
nsGenericHTMLElement::ParseColor(aValue, aResult);
|
nsGenericHTMLElement::ParseColor(aValue, aResult);
|
||||||
return NS_CONTENT_ATTR_HAS_VALUE;
|
return NS_CONTENT_ATTR_HAS_VALUE;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче