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

Unified Diff: third_party/WebKit/Source/core/svg/SVGLengthTearOff.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/SVGLengthTearOff.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGLengthTearOff.cpp b/third_party/WebKit/Source/core/svg/SVGLengthTearOff.cpp
index 2fdbb899c1a9a6a21d0462293378e3636c21ed30..4b998361a0c8199db7290a9d47dbedadf85818fe 100644
--- a/third_party/WebKit/Source/core/svg/SVGLengthTearOff.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGLengthTearOff.cpp
@@ -131,10 +131,10 @@ float SVGLengthTearOff::valueInSpecifiedUnits()
return target()->valueInSpecifiedUnits();
}
-void SVGLengthTearOff::setValueInSpecifiedUnits(float value, ExceptionState& es)
+void SVGLengthTearOff::setValueInSpecifiedUnits(float value, ExceptionState& exceptionState)
{
if (isImmutable()) {
- es.throwDOMException(NoModificationAllowedError, "The attribute is read-only.");
+ exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only.");
return;
}
target()->setValueInSpecifiedUnits(value);
@@ -147,20 +147,23 @@ String SVGLengthTearOff::valueAsString()
return hasExposedLengthUnit() ? target()->valueAsString() : String::number(0);
}
-void SVGLengthTearOff::setValueAsString(const String& str, ExceptionState& es)
+void SVGLengthTearOff::setValueAsString(const String& str, ExceptionState& exceptionState)
{
if (isImmutable()) {
- es.throwDOMException(NoModificationAllowedError, "The attribute is read-only.");
+ exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only.");
return;
}
String oldValue = target()->valueAsString();
- target()->setValueAsString(str, es);
+ SVGParsingError status = target()->setValueAsString(str);
- if (!es.hadException() && !hasExposedLengthUnit()) {
- target()->setValueAsString(oldValue, ASSERT_NO_EXCEPTION); // rollback to old value
- es.throwDOMException(SyntaxError, "The value provided ('" + str + "') is invalid.");
+ if (status == NoError && !hasExposedLengthUnit()) {
+ target()->setValueAsString(oldValue); // rollback to old value
+ status = ParsingAttributeFailedError;
+ }
+ if (status != NoError) {
+ exceptionState.throwDOMException(SyntaxError, "The value provided ('" + str + "') is invalid.");
return;
}

Powered by Google App Engine
This is Rietveld 408576698