Chromium Code Reviews| Index: third_party/WebKit/Source/core/svg/SVGParserUtilities.cpp |
| diff --git a/third_party/WebKit/Source/core/svg/SVGParserUtilities.cpp b/third_party/WebKit/Source/core/svg/SVGParserUtilities.cpp |
| index f1af2cb4321e092b42b380458087a50be2a7f407..127a01858d34ab78702f85b30b2aaa3953f3d03d 100644 |
| --- a/third_party/WebKit/Source/core/svg/SVGParserUtilities.cpp |
| +++ b/third_party/WebKit/Source/core/svg/SVGParserUtilities.cpp |
| @@ -42,7 +42,6 @@ static bool genericParseNumber(const CharType*& ptr, const CharType* end, FloatT |
| { |
| FloatType integer, decimal, frac, exponent; |
| int sign, expsign; |
| - const CharType* start = ptr; |
| exponent = 0; |
| integer = 0; |
| @@ -62,6 +61,7 @@ static bool genericParseNumber(const CharType*& ptr, const CharType* end, FloatT |
| sign = -1; |
| } |
| + const CharType* digitsStart = ptr; |
| if (ptr == end || ((*ptr < '0' || *ptr > '9') && *ptr != '.')) |
| // The first character of a number must be one of [0-9+-.] |
| return false; |
| @@ -94,8 +94,12 @@ static bool genericParseNumber(const CharType*& ptr, const CharType* end, FloatT |
| decimal += (*(ptr++) - '0') * (frac *= static_cast<FloatType>(0.1)); |
| } |
| + // When we get here we should have consumed either a digit for the integer |
| + // part or a fractional part (with at least one digit after the '.'.) |
| + ASSERT_UNUSED(digitsStart, digitsStart != ptr); |
|
pdr.
2016/01/13 18:58:11
Can we reuse/rename ptrStartIntPart and change thi
fs
2016/01/13 19:16:27
Yepp. Like so.
|
| + |
| // read the exponent part |
| - if (ptr != start && ptr + 1 < end && (*ptr == 'e' || *ptr == 'E') |
| + if (ptr + 1 < end && (*ptr == 'e' || *ptr == 'E') |
| && (ptr[1] != 'x' && ptr[1] != 'm')) { |
| ptr++; |
| @@ -131,9 +135,6 @@ static bool genericParseNumber(const CharType*& ptr, const CharType* end, FloatT |
| if (!isValidRange(number)) |
| return false; |
| - if (start == ptr) |
| - return false; |
| - |
| if (mode & AllowTrailingWhitespace) |
| skipOptionalSVGSpacesOrDelimiter(ptr, end); |