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

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

Issue 2363823004: Fix parsing of minimum values (Closed)
Patch Set: Add tests 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..d250b9442b378236d6022f574179b9f7a1601cc5 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLParserIdioms.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLParserIdioms.cpp
@@ -160,9 +160,6 @@ template <typename CharacterType>
static bool parseHTMLIntegerInternal(const CharacterType* position,
const CharacterType* end,
int& value) {
- // Step 3
tkent 2016/10/06 14:37:42 Adding a comment why the implementation is differe
rwlbuis 2016/10/06 15:10:44 Done.
- int sign = 1;
-
// Step 4
while (position < end) {
if (!isHTMLSpace<CharacterType>(*position))
@@ -176,8 +173,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 +188,6 @@ static bool parseHTMLIntegerInternal(const CharacterType* position,
return false;
// Step 8
- StringBuilder digits;
while (position < end) {
if (!isASCIIDigit(*position))
break;
@@ -200,11 +197,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