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

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

Issue 1544673003: Refactor propagation of parsing errors for SVG attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 7399fc637fa0d010d7dafe330f49f616036bef2e..17978778d2a8988e2178013c5a4ffb2e90f2783e 100644
--- a/third_party/WebKit/Source/core/svg/SVGLengthList.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGLengthList.cpp
@@ -20,7 +20,6 @@
#include "core/svg/SVGLengthList.h"
-#include "bindings/core/v8/ExceptionStatePlaceholder.h"
#include "core/svg/SVGAnimationElement.h"
#include "core/svg/SVGParserUtilities.h"
#include "wtf/text/StringBuilder.h"
@@ -48,7 +47,7 @@ PassRefPtrWillBeRawPtr<SVGLengthList> SVGLengthList::clone()
PassRefPtrWillBeRawPtr<SVGPropertyBase> SVGLengthList::cloneForAnimation(const String& value) const
{
RefPtrWillBeRawPtr<SVGLengthList> ret = SVGLengthList::create(m_mode);
- ret->setValueAsString(value, IGNORE_EXCEPTION);
+ ret->setValueAsString(value);
return ret.release();
}
@@ -72,7 +71,7 @@ String SVGLengthList::valueAsString() const
}
template <typename CharType>
-void SVGLengthList::parseInternal(const CharType*& ptr, const CharType* end, ExceptionState& exceptionState)
+SVGParsingError SVGLengthList::parseInternal(const CharType*& ptr, const CharType* end)
{
clear();
while (ptr < end) {
@@ -81,34 +80,38 @@ void SVGLengthList::parseInternal(const CharType*& ptr, const CharType* end, Exc
ptr++;
if (ptr == start)
break;
-
- RefPtrWillBeRawPtr<SVGLength> length = SVGLength::create(m_mode);
String valueString(start, ptr - start);
if (valueString.isEmpty())
- return;
- length->setValueAsString(valueString, exceptionState);
- if (exceptionState.hadException())
- return;
+ break;
+
+ RefPtrWillBeRawPtr<SVGLength> length = SVGLength::create(m_mode);
+ SVGParsingError lengthParseStatus = length->setValueAsString(valueString);
+ if (lengthParseStatus != NoError)
+ return lengthParseStatus;
append(length);
skipOptionalSVGSpacesOrDelimiter(ptr, end);
}
+ return NoError;
}
-void SVGLengthList::setValueAsString(const String& value, ExceptionState& exceptionState)
+SVGParsingError SVGLengthList::setValueAsString(const String& value)
{
if (value.isEmpty()) {
clear();
- return;
+ return NoError;
}
+
+ SVGParsingError parseStatus;
if (value.is8Bit()) {
const LChar* ptr = value.characters8();
const LChar* end = ptr + value.length();
- parseInternal(ptr, end, exceptionState);
+ parseStatus = parseInternal(ptr, end);
} else {
const UChar* ptr = value.characters16();
const UChar* end = ptr + value.length();
- parseInternal(ptr, end, exceptionState);
+ parseStatus = parseInternal(ptr, end);
}
+ return parseStatus;
}
void SVGLengthList::add(PassRefPtrWillBeRawPtr<SVGPropertyBase> other, SVGElement* contextElement)

Powered by Google App Engine
This is Rietveld 408576698