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

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: Really fix unit tests 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 79
80 void DocumentTimeline::serviceAnimations(double monotonicAnimationStartTime) 80 void DocumentTimeline::serviceAnimations(double monotonicAnimationStartTime)
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); 86 m_document->animationClock().updateTime(monotonicAnimationStartTime);
87 87
88 double timeToNextEffect = std::numeric_limits<double>::infinity(); 88 double timeToNextEffect = std::numeric_limits<double>::infinity();
89 double playerNextEffect; 89 bool didTriggerStyleRecalc = false;
90 for (int i = m_players.size() - 1; i >= 0; --i) { 90 for (int i = m_players.size() - 1; i >= 0; --i) {
91 if (!m_players[i]->update(&playerNextEffect)) 91 double playerNextEffect;
92 bool playerDidTriggerStyleRecalc;
93 if (!m_players[i]->update(&playerNextEffect, &playerDidTriggerStyleRecal c))
92 m_players.remove(i); 94 m_players.remove(i);
95 didTriggerStyleRecalc |= playerDidTriggerStyleRecalc;
93 if (playerNextEffect < timeToNextEffect) 96 if (playerNextEffect < timeToNextEffect)
94 timeToNextEffect = playerNextEffect; 97 timeToNextEffect = playerNextEffect;
95 } 98 }
96 99
100 if (!didTriggerStyleRecalc)
101 m_document->animationClock().unfreeze();
102
97 if (!m_players.isEmpty()) { 103 if (!m_players.isEmpty()) {
98 if (timeToNextEffect < s_minimumDelay) 104 if (timeToNextEffect < s_minimumDelay)
99 m_timing->serviceOnNextFrame(); 105 m_timing->serviceOnNextFrame();
100 else if (timeToNextEffect != std::numeric_limits<double>::infinity()) 106 else if (timeToNextEffect != std::numeric_limits<double>::infinity())
101 m_timing->wakeAfter(timeToNextEffect - s_minimumDelay); 107 m_timing->wakeAfter(timeToNextEffect - s_minimumDelay);
102 } 108 }
103 109
104 if (m_document->view() && !m_players.isEmpty()) 110 if (m_document->view() && !m_players.isEmpty())
105 m_document->view()->scheduleAnimation(); 111 m_document->view()->scheduleAnimation();
106 } 112 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 } 156 }
151 157
152 size_t DocumentTimeline::numberOfActiveAnimationsForTesting() const 158 size_t DocumentTimeline::numberOfActiveAnimationsForTesting() const
153 { 159 {
154 // Includes all players whose directly associated timed items 160 // Includes all players whose directly associated timed items
155 // are current or in effect. 161 // are current or in effect.
156 return isNull(m_zeroTime) ? 0 : m_players.size(); 162 return isNull(m_zeroTime) ? 0 : m_players.size();
157 } 163 }
158 164
159 } // namespace 165 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698