Bug 52019. Don't treat <font size='+.5'> as <font size='5'>. r=bzbarsky

This commit is contained in:
Makoto Kato 2010-05-14 17:17:56 -04:00
parent a491cefc6d
commit 33910f9bb0
4 changed files with 37 additions and 3 deletions

View File

@ -0,0 +1,11 @@
<html>
<head>
<title>Test for Bug 52019</title>
</head>
<body>
<font>font</font>
<font>font</font>
<font size="+2">font</font>
<font size="-2">font</font>
</body>
</html>

View File

@ -0,0 +1,11 @@
<html>
<head>
<title>Test for Bug 52019</title>
</head>
<body>
<font size="+.5">font</font>
<font size="-.5">font</font>
<font size="+2.5">font</font>
<font size="-2.5">font</font>
</body>
</html>

View File

@ -1,5 +1,6 @@
== 41464-1a.html 41464-1-ref.html
== 41464-1b.html 41464-1-ref.html
== 52019-1.html 52019-1-ref.html
!= 468263-1a.html about:blank
!= 468263-1b.html about:blank
!= 468263-1c.html about:blank

View File

@ -150,9 +150,20 @@ nsHTMLFontElement::ParseAttribute(PRInt32 aNamespaceID,
nsAutoString tmp(aValue);
tmp.CompressWhitespace(PR_TRUE, PR_TRUE);
PRUnichar ch = tmp.IsEmpty() ? 0 : tmp.First();
if ((ch == '+' || ch == '-') &&
aResult.ParseEnumValue(aValue, kRelFontSizeTable, PR_FALSE)) {
return PR_TRUE;
if ((ch == '+' || ch == '-')) {
if (aResult.ParseEnumValue(aValue, kRelFontSizeTable, PR_FALSE))
return PR_TRUE;
// truncate after digit, then parse it again.
PRUint32 i;
for (i = 1; i < tmp.Length(); i++) {
ch = tmp.CharAt(i);
if (!nsCRT::IsAsciiDigit(ch)) {
tmp.Truncate(i);
break;
}
}
return aResult.ParseEnumValue(tmp, kRelFontSizeTable, PR_FALSE);
}
return aResult.ParseIntValue(aValue);