Index: third_party/WebKit/Source/core/html/parser/HTMLParserIdioms.cpp |
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLParserIdioms.cpp b/third_party/WebKit/Source/core/html/parser/HTMLParserIdioms.cpp |
index 8631242a92978c046192b10baf959e86f1af0ba7..7b9109c7d6017bef8b7692bddb540e6561ed5a38 100644 |
--- a/third_party/WebKit/Source/core/html/parser/HTMLParserIdioms.cpp |
+++ b/third_party/WebKit/Source/core/html/parser/HTMLParserIdioms.cpp |
@@ -161,7 +161,9 @@ static bool parseHTMLIntegerInternal(const CharacterType* position, |
const CharacterType* end, |
int& value) { |
// Step 3 |
- int sign = 1; |
+ // We do not do this step and do not have a local sign |
+ // variable since due to a bug in charactersToIntStrict |
+ // we have to add the sign to the digits string. |
// Step 4 |
while (position < end) { |
@@ -176,8 +178,9 @@ static bool parseHTMLIntegerInternal(const CharacterType* position, |
ASSERT(position < end); |
// Step 6 |
+ StringBuilder digits; |
if (*position == '-') { |
- sign = -1; |
+ digits.append('-'); |
++position; |
} else if (*position == '+') |
++position; |
@@ -190,7 +193,6 @@ static bool parseHTMLIntegerInternal(const CharacterType* position, |
return false; |
// Step 8 |
- StringBuilder digits; |
while (position < end) { |
if (!isASCIIDigit(*position)) |
break; |
@@ -200,11 +202,9 @@ static bool parseHTMLIntegerInternal(const CharacterType* position, |
// Step 9 |
bool ok; |
if (digits.is8Bit()) |
- value = sign * |
- charactersToIntStrict(digits.characters8(), digits.length(), &ok); |
+ value = charactersToIntStrict(digits.characters8(), digits.length(), &ok); |
else |
- value = sign * |
- charactersToIntStrict(digits.characters16(), digits.length(), &ok); |
+ value = charactersToIntStrict(digits.characters16(), digits.length(), &ok); |
return ok; |
} |