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

Side by Side Diff: Source/core/animation/DocumentTimeline.cpp

Issue 46043014: Web Animations CSS: Unfreeze AnimationClock if sampling timelines does not trigger style recalc (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Reinstate assert Created 7 years, 1 month 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 | Annotate | Revision Log
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 m_timing->serviceOnNextFrame(); 70 m_timing->serviceOnNextFrame();
71 71
72 return player.release(); 72 return player.release();
73 } 73 }
74 74
75 void DocumentTimeline::wake() 75 void DocumentTimeline::wake()
76 { 76 {
77 m_timing->serviceOnNextFrame(); 77 m_timing->serviceOnNextFrame();
78 } 78 }
79 79
80 void DocumentTimeline::serviceAnimations(double monotonicAnimationStartTime) 80 bool DocumentTimeline::serviceAnimations()
81 { 81 {
82 TRACE_EVENT0("webkit", "DocumentTimeline::serviceAnimations"); 82 TRACE_EVENT0("webkit", "DocumentTimeline::serviceAnimations");
83 83
84 m_timing->cancelWake(); 84 m_timing->cancelWake();
85 85
86 m_document->animationClock().updateTime(monotonicAnimationStartTime);
87
88 double timeToNextEffect = std::numeric_limits<double>::infinity(); 86 double timeToNextEffect = std::numeric_limits<double>::infinity();
89 double playerNextEffect; 87 bool didTriggerStyleRecalc = false;
90 for (int i = m_players.size() - 1; i >= 0; --i) { 88 for (int i = m_players.size() - 1; i >= 0; --i) {
91 if (!m_players[i]->update(&playerNextEffect)) 89 double playerNextEffect;
90 bool playerDidTriggerStyleRecalc;
91 if (!m_players[i]->update(&playerNextEffect, &playerDidTriggerStyleRecal c))
92 m_players.remove(i); 92 m_players.remove(i);
93 didTriggerStyleRecalc |= playerDidTriggerStyleRecalc;
93 if (playerNextEffect < timeToNextEffect) 94 if (playerNextEffect < timeToNextEffect)
94 timeToNextEffect = playerNextEffect; 95 timeToNextEffect = playerNextEffect;
95 } 96 }
96 97
97 if (!m_players.isEmpty()) { 98 if (!m_players.isEmpty()) {
98 if (timeToNextEffect < s_minimumDelay) 99 if (timeToNextEffect < s_minimumDelay)
99 m_timing->serviceOnNextFrame(); 100 m_timing->serviceOnNextFrame();
100 else if (timeToNextEffect != std::numeric_limits<double>::infinity()) 101 else if (timeToNextEffect != std::numeric_limits<double>::infinity())
101 m_timing->wakeAfter(timeToNextEffect - s_minimumDelay); 102 m_timing->wakeAfter(timeToNextEffect - s_minimumDelay);
102 } 103 }
103 104
104 if (m_document->view() && !m_players.isEmpty()) 105 if (m_document->view() && !m_players.isEmpty())
105 m_document->view()->scheduleAnimation(); 106 m_document->view()->scheduleAnimation();
107
108 return didTriggerStyleRecalc;
106 } 109 }
107 110
108 void DocumentTimeline::setZeroTime(double zeroTime) 111 void DocumentTimeline::setZeroTime(double zeroTime)
109 { 112 {
110 ASSERT(isNull(m_zeroTime)); 113 ASSERT(isNull(m_zeroTime));
111 m_zeroTime = zeroTime; 114 m_zeroTime = zeroTime;
112 ASSERT(!isNull(m_zeroTime)); 115 ASSERT(!isNull(m_zeroTime));
113 } 116 }
114 117
115 void DocumentTimeline::DocumentTimelineTiming::wakeAfter(double duration) 118 void DocumentTimeline::DocumentTimelineTiming::wakeAfter(double duration)
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 } 153 }
151 154
152 size_t DocumentTimeline::numberOfActiveAnimationsForTesting() const 155 size_t DocumentTimeline::numberOfActiveAnimationsForTesting() const
153 { 156 {
154 // Includes all players whose directly associated timed items 157 // Includes all players whose directly associated timed items
155 // are current or in effect. 158 // are current or in effect.
156 return isNull(m_zeroTime) ? 0 : m_players.size(); 159 return isNull(m_zeroTime) ? 0 : m_players.size();
157 } 160 }
158 161
159 } // namespace 162 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698