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

Unified Diff: Source/core/svg/SVGAnimationElement.cpp

Issue 1088933005: Throw exception if querying SVGAnimationElement with unresolved interval (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 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
« no previous file with comments | « Source/core/svg/SVGAnimationElement.h ('k') | Source/core/svg/SVGAnimationElement.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGAnimationElement.cpp
diff --git a/Source/core/svg/SVGAnimationElement.cpp b/Source/core/svg/SVGAnimationElement.cpp
index e64f59ba332659c80e350769efb78941fd1caabd..4b59a4a2ed6bbea2eae633a3477221fa3a37659c 100644
--- a/Source/core/svg/SVGAnimationElement.cpp
+++ b/Source/core/svg/SVGAnimationElement.cpp
@@ -23,9 +23,9 @@
*/
#include "config.h"
-
#include "core/svg/SVGAnimationElement.h"
+#include "bindings/core/v8/ExceptionState.h"
#include "core/CSSPropertyNames.h"
#include "core/SVGNames.h"
#include "core/css/CSSComputedStyleDeclaration.h"
@@ -236,9 +236,14 @@ void SVGAnimationElement::animationAttributeChanged()
setInactive();
}
-float SVGAnimationElement::getStartTime() const
+float SVGAnimationElement::getStartTime(ExceptionState& exceptionState) const
{
- return narrowPrecisionToFloat(intervalBegin().value());
+ SMILTime startTime = intervalBegin();
+ if (!startTime.isFinite()) {
+ exceptionState.throwDOMException(InvalidStateError, "No current interval.");
+ return 0;
+ }
+ return narrowPrecisionToFloat(startTime.value());
}
float SVGAnimationElement::getCurrentTime() const
@@ -246,9 +251,14 @@ float SVGAnimationElement::getCurrentTime() const
return narrowPrecisionToFloat(elapsed().value());
}
-float SVGAnimationElement::getSimpleDuration() const
+float SVGAnimationElement::getSimpleDuration(ExceptionState& exceptionState) const
{
- return narrowPrecisionToFloat(simpleDuration().value());
+ SMILTime duration = simpleDuration();
+ if (!duration.isFinite()) {
+ exceptionState.throwDOMException(NotSupportedError, "No simple duration defined.");
+ return 0;
+ }
+ return narrowPrecisionToFloat(duration.value());
}
void SVGAnimationElement::beginElement()
« no previous file with comments | « Source/core/svg/SVGAnimationElement.h ('k') | Source/core/svg/SVGAnimationElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698