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

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

Issue 172003002: Web Animations: Don't mark players as outdated upon currentTime access (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@currentplayers
Patch Set: add test Created 6 years, 9 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/Player.h ('k') | Source/core/animation/PlayerTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/animation/Player.cpp
diff --git a/Source/core/animation/Player.cpp b/Source/core/animation/Player.cpp
index 35d2ed0f64897830a8f405a392f7fef49229b9ac..1e5972605e74b0cefef22ae71c362d831c3adfca 100644
--- a/Source/core/animation/Player.cpp
+++ b/Source/core/animation/Player.cpp
@@ -98,26 +98,31 @@ double Player::currentTimeWithLag() const
void Player::updateTimingState(double newCurrentTime)
{
ASSERT(!isNull(newCurrentTime));
+ bool oldHeld = m_held;
m_held = m_paused || !m_playbackRate || limited(newCurrentTime);
if (m_held) {
+ if (!oldHeld || m_holdTime != newCurrentTime)
+ setOutdated();
m_holdTime = newCurrentTime;
m_storedTimeLag = nullValue();
} else {
m_holdTime = nullValue();
m_storedTimeLag = currentTimeWithoutLag() - newCurrentTime;
+ setOutdated();
}
- setOutdated();
}
void Player::updateCurrentTimingState()
{
if (m_held) {
updateTimingState(m_holdTime);
- } else {
- updateTimingState(currentTimeWithLag());
- if (m_held && limited(m_holdTime))
- m_holdTime = m_playbackRate < 0 ? 0 : sourceEnd();
+ return;
}
+ if (!limited(currentTimeWithLag()))
+ return;
+ m_held = true;
+ m_holdTime = m_playbackRate < 0 ? 0 : sourceEnd();
+ m_storedTimeLag = nullValue();
}
double Player::currentTime()
@@ -141,8 +146,10 @@ void Player::setStartTime(double newStartTime)
return;
updateCurrentTimingState(); // Update the value of held
m_startTime = newStartTime;
- if (!m_held)
- updateCurrentTimingState();
+ if (m_held)
+ return;
+ updateCurrentTimingState();
+ setOutdated();
}
void Player::setSource(TimedItem* newSource)
@@ -264,15 +271,12 @@ void Player::cancelAnimationOnCompositor()
bool Player::update()
{
- if (!m_timeline)
- return false;
-
- double inheritedTime = isNull(m_timeline->currentTime()) ? nullValue() : currentTime();
m_outdated = false;
- if (!m_content)
+ if (!m_timeline || !m_content)
return false;
+ double inheritedTime = isNull(m_timeline->currentTime()) ? nullValue() : currentTime();
m_content->updateInheritedTime(inheritedTime);
ASSERT(!m_outdated);
« no previous file with comments | « Source/core/animation/Player.h ('k') | Source/core/animation/PlayerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698