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

Unified Diff: Source/core/animation/AnimationPlayer.cpp

Issue 555063002: Web Animations: Add tests for player state transitions and fix discovered issues (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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: Source/core/animation/AnimationPlayer.cpp
diff --git a/Source/core/animation/AnimationPlayer.cpp b/Source/core/animation/AnimationPlayer.cpp
index 6d4e287345dd835980d56907164d16d1f4faa32a..68fb4c3e711dcd877b1b0176bc4ea27703ee5f6f 100644
--- a/Source/core/animation/AnimationPlayer.cpp
+++ b/Source/core/animation/AnimationPlayer.cpp
@@ -305,7 +305,7 @@ void AnimationPlayer::setCurrentTime(double newCurrentTime)
void AnimationPlayer::setStartTime(double startTime)
{
- if (m_paused) // FIXME: Should this throw an exception?
+ if (m_paused || m_idle)
return;
if (!std::isfinite(startTime))
return;
@@ -458,18 +458,8 @@ void AnimationPlayer::reverse()
}
uncancel();
-
- if (m_content) {
- if (m_playbackRate > 0 && currentTimeInternal() > sourceEnd()) {
- setCurrentTimeInternal(sourceEnd(), TimingUpdateOnDemand);
- ASSERT(finished());
- } else if (m_playbackRate < 0 && currentTimeInternal() < 0) {
- setCurrentTimeInternal(0, TimingUpdateOnDemand);
- ASSERT(finished());
- }
- }
setPlaybackRate(-m_playbackRate);
- unpauseInternal();
+ play();
}
void AnimationPlayer::finish(ExceptionState& exceptionState)
@@ -486,13 +476,14 @@ void AnimationPlayer::finish(ExceptionState& exceptionState)
}
uncancel();
- m_startTime = 0;
- if (m_playbackRate < 0) {
- setCurrentTimeInternal(0, TimingUpdateOnDemand);
- } else {
- setCurrentTimeInternal(sourceEnd(), TimingUpdateOnDemand);
+ double newCurrentTime = m_playbackRate < 0 ? 0 : sourceEnd();
+ setCurrentTimeInternal(newCurrentTime, TimingUpdateOnDemand);
+ if (!paused()) {
+ m_startTime = calculateStartTime(newCurrentTime);
}
+
+ m_currentTimePending = false;
ASSERT(finished());
}
@@ -532,7 +523,7 @@ void AnimationPlayer::setPlaybackRate(double playbackRate)
return;
setCompositorPending();
- if (!finished() && !paused())
+ if (!finished() && !paused() && hasStartTime())
m_currentTimePending = true;
double storedCurrentTime = currentTimeInternal();
@@ -649,6 +640,7 @@ void AnimationPlayer::cancel()
m_held = true;
m_idle = true;
m_startTime = nullValue();
+ m_currentTimePending = false;
setCompositorPending();
}

Powered by Google App Engine
This is Rietveld 408576698