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

Side by Side Diff: Source/core/animation/DocumentTimeline.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 unified diff | Download patch
« no previous file with comments | « Source/core/animation/DocumentTimeline.h ('k') | Source/core/animation/css/CSSAnimations.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 RefPtr<AnimationPlayer> player = AnimationPlayer::create(*this, child); 73 RefPtr<AnimationPlayer> player = AnimationPlayer::create(*this, child);
74 AnimationPlayer* result = player.get(); 74 AnimationPlayer* result = player.get();
75 m_players.add(result); 75 m_players.add(result);
76 setOutdatedAnimationPlayer(result); 76 setOutdatedAnimationPlayer(result);
77 return result; 77 return result;
78 } 78 }
79 79
80 AnimationPlayer* DocumentTimeline::play(TimedItem* child) 80 AnimationPlayer* DocumentTimeline::play(TimedItem* child)
81 { 81 {
82 AnimationPlayer* player = createAnimationPlayer(child); 82 AnimationPlayer* player = createAnimationPlayer(child);
83 player->setStartTime(currentTime()); 83 player->setStartTime(effectiveTime());
84 return player; 84 return player;
85 } 85 }
86 86
87 void DocumentTimeline::wake() 87 void DocumentTimeline::wake()
88 { 88 {
89 m_timing->serviceOnNextFrame(); 89 m_timing->serviceOnNextFrame();
90 } 90 }
91 91
92 void DocumentTimeline::serviceAnimations() 92 void DocumentTimeline::serviceAnimations()
93 { 93 {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 m_timeline->m_document->view()->scheduleAnimation(); 144 m_timeline->m_document->view()->scheduleAnimation();
145 } 145 }
146 146
147 double DocumentTimeline::currentTime() 147 double DocumentTimeline::currentTime()
148 { 148 {
149 if (!m_document) 149 if (!m_document)
150 return std::numeric_limits<double>::quiet_NaN(); 150 return std::numeric_limits<double>::quiet_NaN();
151 return m_document->animationClock().currentTime() - m_zeroTime; 151 return m_document->animationClock().currentTime() - m_zeroTime;
152 } 152 }
153 153
154 double DocumentTimeline::effectiveTime()
155 {
156 double time = currentTime();
157 return std::isnan(time) ? 0 : time;
158 }
159
154 void DocumentTimeline::pauseAnimationsForTesting(double pauseTime) 160 void DocumentTimeline::pauseAnimationsForTesting(double pauseTime)
155 { 161 {
156 for (HashSet<RefPtr<AnimationPlayer> >::iterator it = m_playersNeedingUpdate .begin(); it != m_playersNeedingUpdate.end(); ++it) 162 for (HashSet<RefPtr<AnimationPlayer> >::iterator it = m_playersNeedingUpdate .begin(); it != m_playersNeedingUpdate.end(); ++it)
157 (*it)->pauseForTesting(pauseTime); 163 (*it)->pauseForTesting(pauseTime);
158 serviceAnimations(); 164 serviceAnimations();
159 } 165 }
160 166
161 void DocumentTimeline::setOutdatedAnimationPlayer(AnimationPlayer* player) 167 void DocumentTimeline::setOutdatedAnimationPlayer(AnimationPlayer* player)
162 { 168 {
163 m_playersNeedingUpdate.add(player); 169 m_playersNeedingUpdate.add(player);
(...skipping 17 matching lines...) Expand all
181 count += (timedItem && (timedItem->isCurrent() || timedItem->isInEff ect())); 187 count += (timedItem && (timedItem->isCurrent() || timedItem->isInEff ect()));
182 } 188 }
183 return count; 189 return count;
184 } 190 }
185 191
186 void DocumentTimeline::detachFromDocument() { 192 void DocumentTimeline::detachFromDocument() {
187 m_document = 0; 193 m_document = 0;
188 } 194 }
189 195
190 } // namespace 196 } // namespace
OLDNEW
« no previous file with comments | « Source/core/animation/DocumentTimeline.h ('k') | Source/core/animation/css/CSSAnimations.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698