Index: third_party/WebKit/Source/core/svg/SVGPointList.cpp |
diff --git a/third_party/WebKit/Source/core/svg/SVGPointList.cpp b/third_party/WebKit/Source/core/svg/SVGPointList.cpp |
index e7f67b8bf7635bf6707258b47e149823a4e67c58..85057dbdf278ef820cbbb86000f57f9355a2d89e 100644 |
--- a/third_party/WebKit/Source/core/svg/SVGPointList.cpp |
+++ b/third_party/WebKit/Source/core/svg/SVGPointList.cpp |
@@ -56,56 +56,50 @@ String SVGPointList::valueAsString() const |
} |
template <typename CharType> |
-bool SVGPointList::parse(const CharType*& ptr, const CharType* end) |
+SVGParsingError SVGPointList::parse(const CharType*& ptr, const CharType* end) |
{ |
- clear(); |
- |
- skipOptionalSVGSpaces(ptr, end); |
- if (ptr >= end) |
- return true; |
+ if (!skipOptionalSVGSpaces(ptr, end)) |
+ return SVGParseStatus::NoError; |
+ const CharType* listStart = ptr; |
for (;;) { |
- float x = 0.0f; |
- float y = 0.0f; |
- bool valid = parseNumber(ptr, end, x) && parseNumber(ptr, end, y, DisallowWhitespace); |
- if (!valid) { |
- return false; |
- } |
+ float x = 0; |
+ float y = 0; |
+ if (!parseNumber(ptr, end, x) |
+ || !parseNumber(ptr, end, y, DisallowWhitespace)) |
+ return SVGParsingError(SVGParseStatus::ExpectedNumber, ptr - listStart); |
+ |
append(SVGPoint::create(FloatPoint(x, y))); |
- skipOptionalSVGSpaces(ptr, end); |
- if (ptr < end && *ptr == ',') { |
+ if (!skipOptionalSVGSpaces(ptr, end)) |
+ break; |
+ |
+ if (*ptr == ',') { |
++ptr; |
skipOptionalSVGSpaces(ptr, end); |
// ',' requires the list to be continued |
continue; |
} |
- |
- // check end of list |
- if (ptr >= end) |
- return true; |
} |
+ return SVGParseStatus::NoError; |
} |
SVGParsingError SVGPointList::setValueAsString(const String& value) |
{ |
- if (value.isEmpty()) { |
- clear(); |
+ clear(); |
+ |
+ if (value.isEmpty()) |
return SVGParseStatus::NoError; |
- } |
- bool valid = false; |
if (value.is8Bit()) { |
const LChar* ptr = value.characters8(); |
const LChar* end = ptr + value.length(); |
- valid = parse(ptr, end); |
- } else { |
- const UChar* ptr = value.characters16(); |
- const UChar* end = ptr + value.length(); |
- valid = parse(ptr, end); |
+ return parse(ptr, end); |
} |
- return valid ? SVGParseStatus::NoError : SVGParseStatus::ParsingFailed; |
+ const UChar* ptr = value.characters16(); |
+ const UChar* end = ptr + value.length(); |
+ return parse(ptr, end); |
} |
void SVGPointList::add(PassRefPtrWillBeRawPtr<SVGPropertyBase> other, SVGElement* contextElement) |