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

Unified Diff: third_party/WebKit/Source/core/svg/SVGNumber.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/SVGNumber.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGNumber.cpp b/third_party/WebKit/Source/core/svg/SVGNumber.cpp
index 3393b60c358c26454869f46837d6d3aeffad517b..a20b3642132510d7a32bb19f55378cb536a33cdb 100644
--- a/third_party/WebKit/Source/core/svg/SVGNumber.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGNumber.cpp
@@ -66,11 +66,11 @@ bool SVGNumber::parse(const CharType*& ptr, const CharType* end)
return true;
}
-void SVGNumber::setValueAsString(const String& string, ExceptionState& exceptionState)
+SVGParsingError SVGNumber::setValueAsString(const String& string)
{
if (string.isEmpty()) {
m_value = 0;
- return;
+ return NoError;
}
bool valid = false;
@@ -85,9 +85,10 @@ void SVGNumber::setValueAsString(const String& string, ExceptionState& exception
}
if (!valid) {
- exceptionState.throwDOMException(SyntaxError, "The value provided ('" + string + "') is invalid.");
m_value = 0;
pdr. 2015/12/23 04:00:08 Nit for contemplation: this isn't required, but we
fs 2015/12/23 10:04:17 Yes, I've been noticing these things here and ther
+ return ParsingAttributeFailedError;
}
+ return NoError;
}
void SVGNumber::add(PassRefPtrWillBeRawPtr<SVGPropertyBase> other, SVGElement*)
@@ -116,14 +117,13 @@ PassRefPtrWillBeRawPtr<SVGNumber> SVGNumberAcceptPercentage::clone() const
return create(m_value);
}
-void SVGNumberAcceptPercentage::setValueAsString(const String& string, ExceptionState& exceptionState)
+SVGParsingError SVGNumberAcceptPercentage::setValueAsString(const String& string)
{
- bool valid = parseNumberOrPercentage(string, m_value);
+ if (parseNumberOrPercentage(string, m_value))
+ return NoError;
- if (!valid) {
- exceptionState.throwDOMException(SyntaxError, "The value provided ('" + string + "') is invalid.");
- m_value = 0;
- }
+ m_value = 0;
+ return ParsingAttributeFailedError;
}
SVGNumberAcceptPercentage::SVGNumberAcceptPercentage(float value)

Powered by Google App Engine
This is Rietveld 408576698