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

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

Issue 210703002: Web Animations: Sort Animations in the AnimationStack (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix compile? :| 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/AnimationPlayer.h ('k') | Source/core/animation/AnimationPlayerTest.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 7019e955025d49b6f8f749a32ebb2c6e96dfab3c..48351215c4e60238decff833135fed84c1410bb3 100644
--- a/Source/core/animation/AnimationPlayer.cpp
+++ b/Source/core/animation/AnimationPlayer.cpp
@@ -56,13 +56,13 @@ AnimationPlayer::AnimationPlayer(DocumentTimeline& timeline, TimedItem* content)
, m_startTime(nullValue())
, m_holdTime(nullValue())
, m_storedTimeLag(0)
+ , m_sortInfo(nextSequenceNumber(), timeline.effectiveTime())
, m_content(content)
, m_timeline(&timeline)
, m_paused(false)
, m_held(false)
, m_isPausedForTesting(false)
, m_outdated(false)
- , m_sequenceNumber(nextSequenceNumber())
{
if (m_content) {
if (m_content->player())
@@ -93,10 +93,7 @@ double AnimationPlayer::currentTimeWithoutLag() const
{
if (isNull(m_startTime) || !m_timeline)
return 0;
- double timelineTime = m_timeline->currentTime();
- if (isNull(timelineTime))
- timelineTime = 0;
- return (timelineTime - m_startTime) * m_playbackRate;
+ return (m_timeline->effectiveTime() - m_startTime) * m_playbackRate;
}
double AnimationPlayer::currentTimeWithLag() const
@@ -157,6 +154,7 @@ void AnimationPlayer::setStartTime(double newStartTime)
return;
updateCurrentTimingState(); // Update the value of held
m_startTime = newStartTime;
+ m_sortInfo.m_startTime = newStartTime;
if (m_held)
return;
updateCurrentTimingState();
@@ -314,15 +312,14 @@ void AnimationPlayer::cancel()
m_content = nullptr;
}
-bool AnimationPlayer::hasLowerPriority(AnimationPlayer* player1, AnimationPlayer* player2)
+bool AnimationPlayer::SortInfo::operator<(const SortInfo& other) const
{
- if (player1->m_startTime < player2->m_startTime)
+ ASSERT(!std::isnan(m_startTime) && !std::isnan(other.m_startTime));
+ if (m_startTime < other.m_startTime)
return true;
- if (player1->m_startTime > player2->m_startTime)
+ if (m_startTime > other.m_startTime)
return false;
- if (isNull(player1->m_startTime) != isNull(player2->m_startTime))
- return isNull(player1->m_startTime);
- return player1->m_sequenceNumber < player2->m_sequenceNumber;
+ return m_sequenceNumber < other.m_sequenceNumber;
}
void AnimationPlayer::pauseForTesting(double pauseTime)
« no previous file with comments | « Source/core/animation/AnimationPlayer.h ('k') | Source/core/animation/AnimationPlayerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698