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

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

Issue 961993003: Web Animations: Fix Player's timing update when source content becomes longer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: test Created 5 years, 10 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/animation/AnimationPlayer.h ('k') | Source/core/animation/css/CSSAnimations.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/animation/AnimationPlayer.cpp
diff --git a/Source/core/animation/AnimationPlayer.cpp b/Source/core/animation/AnimationPlayer.cpp
index 94cd7cc2d75907f12ad1a1edf94fc1ea1833baff..3e20c4abbdd8f2d15b81003c7245350da78b40e9 100644
--- a/Source/core/animation/AnimationPlayer.cpp
+++ b/Source/core/animation/AnimationPlayer.cpp
@@ -166,19 +166,24 @@ void AnimationPlayer::setCurrentTimeInternal(double newCurrentTime, TimingUpdate
void AnimationPlayer::updateCurrentTimingState(TimingUpdateReason reason)
{
if (m_held) {
- // Add hystersis due to floating point error accumulation
- if (!isNull(m_startTime) && m_timeline && !limited(calculateCurrentTime() + 0.001 * m_playbackRate) && playStateInternal() == Finished) {
- m_held = false;
- setCurrentTimeInternal(calculateCurrentTime(), reason);
- return;
+ double newCurrentTime = m_holdTime;
+ if (playStateInternal() == Finished && !isNull(m_startTime) && m_timeline) {
+ // Add hystersis due to floating point error accumulation
+ if (!limited(calculateCurrentTime() + 0.001 * m_playbackRate)) {
+ // The current time became unlimited, eg. due to a backwards
+ // seek of the timeline.
+ newCurrentTime = calculateCurrentTime();
+ } else if (!limited(m_holdTime)) {
+ // The hold time became unlimited, eg. due to the source content
+ // becoming longer.
+ newCurrentTime = clampTo<double>(calculateCurrentTime(), 0, sourceEnd());
+ }
}
- setCurrentTimeInternal(m_holdTime, reason);
- return;
+ setCurrentTimeInternal(newCurrentTime, reason);
+ } else if (limited(calculateCurrentTime())) {
+ m_held = true;
+ m_holdTime = m_playbackRate < 0 ? 0 : sourceEnd();
}
- if (!limited(calculateCurrentTime()))
- return;
- m_held = true;
- m_holdTime = m_playbackRate < 0 ? 0 : sourceEnd();
}
double AnimationPlayer::startTime(bool& isNull) const
@@ -222,6 +227,16 @@ double AnimationPlayer::currentTimeInternal() const
return result;
}
+double AnimationPlayer::unlimitedCurrentTimeInternal() const
+{
+#if ENABLE(ASSERT)
+ currentTimeInternal();
+#endif
+ return playStateInternal() == Paused || isNull(m_startTime)
+ ? currentTimeInternal()
+ : calculateCurrentTime();
+}
+
void AnimationPlayer::preCommit(int compositorGroup, bool startOnCompositor)
{
PlayStateUpdateScope updateScope(*this, TimingUpdateOnDemand, DoNotSetCompositorPending);
« no previous file with comments | « Source/core/animation/AnimationPlayer.h ('k') | Source/core/animation/css/CSSAnimations.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698