Index: third_party/WebKit/Source/core/animation/Animation.cpp |
diff --git a/third_party/WebKit/Source/core/animation/Animation.cpp b/third_party/WebKit/Source/core/animation/Animation.cpp |
index 197b921791673d6c093b822a87659bf8fcd47621..7c57d020d976a148e99b0d887bf99508f3c24e80 100644 |
--- a/third_party/WebKit/Source/core/animation/Animation.cpp |
+++ b/third_party/WebKit/Source/core/animation/Animation.cpp |
@@ -500,7 +500,7 @@ Animation::AnimationPlayState Animation::calculatePlayState() |
return Running; |
} |
-void Animation::pause() |
+void Animation::pause(ExceptionState& exceptionState) |
{ |
if (m_paused) |
return; |
@@ -509,6 +509,10 @@ void Animation::pause() |
double newCurrentTime = currentTimeInternal(); |
if (calculatePlayState() == Idle) { |
+ if (m_playbackRate < 0 && effectEnd() == std::numeric_limits<double>::infinity()) { |
+ exceptionState.throwDOMException(InvalidStateError, "Cannot pause, Animation has infinite target effect end."); |
+ return; |
+ } |
newCurrentTime = m_playbackRate < 0 ? effectEnd() : 0; |
} |
@@ -537,10 +541,16 @@ void Animation::unpauseInternal() |
setCurrentTimeInternal(currentTimeInternal(), TimingUpdateOnDemand); |
} |
-void Animation::play() |
+void Animation::play(ExceptionState& exceptionState) |
{ |
PlayStateUpdateScope updateScope(*this, TimingUpdateOnDemand); |
+ double currentTime = this->currentTimeInternal(); |
+ if (m_playbackRate < 0 && currentTime <= 0 && effectEnd() == std::numeric_limits<double>::infinity()) { |
+ exceptionState.throwDOMException(InvalidStateError, "Cannot play reversed Animation with infinite target effect end."); |
+ return; |
+ } |
+ |
if (!playing()) { |
m_startTime = nullValue(); |
} |
@@ -550,8 +560,6 @@ void Animation::play() |
m_holdTime = 0; |
} |
- double currentTime = this->currentTimeInternal(); |
- |
m_playState = Unset; |
m_finished = false; |
unpauseInternal(); |
@@ -565,14 +573,14 @@ void Animation::play() |
} |
} |
-void Animation::reverse() |
+void Animation::reverse(ExceptionState& exceptionState) |
{ |
if (!m_playbackRate) { |
return; |
} |
setPlaybackRateInternal(-m_playbackRate); |
- play(); |
+ play(exceptionState); |
} |
void Animation::finish(ExceptionState& exceptionState) |