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

Side by Side Diff: Source/core/animation/Player.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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 double Player::timeDrift() const 83 double Player::timeDrift() const
84 { 84 {
85 return pausedInternal() ? pausedTimeDrift() : m_timeDrift; 85 return pausedInternal() ? pausedTimeDrift() : m_timeDrift;
86 } 86 }
87 87
88 double Player::currentTime() const 88 double Player::currentTime() const
89 { 89 {
90 return currentTimeBeforeDrift() - timeDrift(); 90 return currentTimeBeforeDrift() - timeDrift();
91 } 91 }
92 92
93 bool Player::update(double* timeToEffectChange) 93 bool Player::update(double* timeToEffectChange, bool* didTriggerStyleRecalc)
94 { 94 {
95 if (!m_content) { 95 if (!m_content) {
96 if (timeToEffectChange) 96 if (timeToEffectChange)
97 *timeToEffectChange = std::numeric_limits<double>::infinity(); 97 *timeToEffectChange = std::numeric_limits<double>::infinity();
98 if (didTriggerStyleRecalc)
99 *didTriggerStyleRecalc = false;
98 return false; 100 return false;
99 } 101 }
100 102
101 double newTime = isNull(m_timeline.currentTime()) ? nullValue() : currentTim e(); 103 double newTime = isNull(m_timeline.currentTime()) ? nullValue() : currentTim e();
102 m_content->updateInheritedTime(newTime); 104 bool didTriggerStyleRecalcLocal = m_content->updateInheritedTime(newTime);
103 if (timeToEffectChange) 105 if (timeToEffectChange)
104 *timeToEffectChange = m_content->timeToEffectChange(); 106 *timeToEffectChange = m_content->timeToEffectChange();
107 if (didTriggerStyleRecalc)
108 *didTriggerStyleRecalc = didTriggerStyleRecalcLocal;
105 return m_content->isCurrent() || m_content->isInEffect(); 109 return m_content->isCurrent() || m_content->isInEffect();
106 } 110 }
107 111
108 void Player::cancel() 112 void Player::cancel()
109 { 113 {
110 if (!m_content) 114 if (!m_content)
111 return; 115 return;
112 116
113 ASSERT(m_content->player() == this); 117 ASSERT(m_content->player() == this);
114 m_content->detach(); 118 m_content->detach();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 } 156 }
153 157
154 void Player::setPlaybackRate(double newRate) 158 void Player::setPlaybackRate(double newRate)
155 { 159 {
156 double previousTime = currentTime(); 160 double previousTime = currentTime();
157 m_playbackRate = newRate; 161 m_playbackRate = newRate;
158 setCurrentTime(previousTime); 162 setCurrentTime(previousTime);
159 } 163 }
160 164
161 } // namespace 165 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698