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

Unified Diff: third_party/WebKit/Source/core/svg/SVGLengthList.cpp

Issue 1636503003: Error reporting for SVGLength and SVGLengthList (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: TestExpectations Created 4 years, 11 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
Index: third_party/WebKit/Source/core/svg/SVGLengthList.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGLengthList.cpp b/third_party/WebKit/Source/core/svg/SVGLengthList.cpp
index 40f422a5e60412b20afc27c739ccd99b158b2570..206b3a8ab51ad8cdfd92616c3ac2467bdc598a60 100644
--- a/third_party/WebKit/Source/core/svg/SVGLengthList.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGLengthList.cpp
@@ -71,7 +71,7 @@ String SVGLengthList::valueAsString() const
template <typename CharType>
SVGParsingError SVGLengthList::parseInternal(const CharType*& ptr, const CharType* end)
{
- clear();
+ const CharType* listStart = ptr;
while (ptr < end) {
const CharType* start = ptr;
while (ptr < end && *ptr != ',' && !isHTMLSpace<CharType>(*ptr))
@@ -85,7 +85,7 @@ SVGParsingError SVGLengthList::parseInternal(const CharType*& ptr, const CharTyp
RefPtrWillBeRawPtr<SVGLength> length = SVGLength::create(m_mode);
SVGParsingError lengthParseStatus = length->setValueAsString(valueString);
if (lengthParseStatus != SVGParseStatus::NoError)
- return lengthParseStatus;
+ return lengthParseStatus.offsetWith(start - listStart);
append(length);
skipOptionalSVGSpacesOrDelimiter(ptr, end);
}
@@ -94,22 +94,19 @@ SVGParsingError SVGLengthList::parseInternal(const CharType*& ptr, const CharTyp
SVGParsingError SVGLengthList::setValueAsString(const String& value)
{
- if (value.isEmpty()) {
- clear();
+ clear();
+
+ if (value.isEmpty())
return SVGParseStatus::NoError;
- }
- SVGParsingError parseStatus;
if (value.is8Bit()) {
const LChar* ptr = value.characters8();
const LChar* end = ptr + value.length();
- parseStatus = parseInternal(ptr, end);
- } else {
- const UChar* ptr = value.characters16();
- const UChar* end = ptr + value.length();
- parseStatus = parseInternal(ptr, end);
+ return parseInternal(ptr, end);
}
- return parseStatus;
+ const UChar* ptr = value.characters16();
+ const UChar* end = ptr + value.length();
+ return parseInternal(ptr, end);
}
void SVGLengthList::add(PassRefPtrWillBeRawPtr<SVGPropertyBase> other, SVGElement* contextElement)
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGLength.cpp ('k') | third_party/WebKit/Source/core/svg/SVGParsingError.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698