Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(510)

Unified Diff: third_party/WebKit/Source/core/html/parser/HTMLParserIdioms.cpp

Issue 2363823004: Fix parsing of minimum values (Closed)
Patch Set: Add a comment Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/imported/wpt/html/dom/reflection-text-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « third_party/WebKit/LayoutTests/imported/wpt/html/dom/reflection-text-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698