Index: Source/core/html/parser/HTMLParserIdioms.cpp |
diff --git a/Source/core/html/parser/HTMLParserIdioms.cpp b/Source/core/html/parser/HTMLParserIdioms.cpp |
index a71d9a54fac468194b7e3214334c3b4862f4ca14..a3f8810b27fe239281fce3f22b62a550cfcfea6d 100644 |
--- a/Source/core/html/parser/HTMLParserIdioms.cpp |
+++ b/Source/core/html/parser/HTMLParserIdioms.cpp |
@@ -93,10 +93,16 @@ String serializeForNumberType(double number) |
return String::numberToStringECMAScript(number); |
} |
-Decimal parseToDecimalForNumberType(const String& string, const Decimal& fallbackValue) |
+static bool isSpaceCharacter(UChar c) |
+{ |
+ return c == ' '; |
+} |
+ |
+Decimal parseToDecimalForNumberType(const String& numberString, const Decimal& fallbackValue) |
tkent
2014/04/14 00:47:37
Do not modify this function. The behavior of this
|
{ |
// http://www.whatwg.org/specs/web-apps/current-work/#floating-point-numbers and parseToDoubleForNumberType |
// String::toDouble() accepts leading + and whitespace characters, which are not valid here. |
+ String string = numberString.removeCharacters(isSpaceCharacter); |
const UChar firstCharacter = string[0]; |
if (firstCharacter != '-' && firstCharacter != '.' && !isASCIIDigit(firstCharacter)) |
return fallbackValue; |
@@ -114,10 +120,11 @@ Decimal parseToDecimalForNumberType(const String& string, const Decimal& fallbac |
return value.isZero() ? Decimal(0) : value; |
} |
-double parseToDoubleForNumberType(const String& string, double fallbackValue) |
+double parseToDoubleForNumberType(const String& numberString, double fallbackValue) |
tkent
2014/04/14 00:47:37
Ditto.
|
{ |
// http://www.whatwg.org/specs/web-apps/current-work/#floating-point-numbers |
// String::toDouble() accepts leading + and whitespace characters, which are not valid here. |
+ String string = numberString.removeCharacters(isSpaceCharacter); |
UChar firstCharacter = string[0]; |
if (firstCharacter != '-' && firstCharacter != '.' && !isASCIIDigit(firstCharacter)) |
return fallbackValue; |