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

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

Issue 1412713004: Hoist some pre-condition checks out of SVGAngle/SVGEnumeration (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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/SVGAngleTearOff.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGAngleTearOff.cpp b/third_party/WebKit/Source/core/svg/SVGAngleTearOff.cpp
index 7e62fca7224f4c6e022d29ac0e7c04597e2633f7..120733b34ed2821ba0e4d49b9ee601cacd43ada6 100644
--- a/third_party/WebKit/Source/core/svg/SVGAngleTearOff.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGAngleTearOff.cpp
@@ -97,9 +97,13 @@ void SVGAngleTearOff::convertToSpecifiedUnits(unsigned short unitType, Exception
return;
}
- target()->convertToSpecifiedUnits(static_cast<SVGAngle::SVGAngleType>(unitType), exceptionState);
- if (!exceptionState.hadException())
- commitChange();
+ if (target()->unitType() == SVGAngle::SVG_ANGLETYPE_UNKNOWN) {
+ exceptionState.throwDOMException(NotSupportedError, "Cannot convert from unknown or invalid units.");
+ return;
+ }
+
+ target()->convertToSpecifiedUnits(static_cast<SVGAngle::SVGAngleType>(unitType));
+ commitChange();
}
void SVGAngleTearOff::setValueAsString(const String& value, ExceptionState& exceptionState)
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGAngle.cpp ('k') | third_party/WebKit/Source/core/svg/SVGAnimatedEnumerationBase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698