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

Side by Side Diff: third_party/WebKit/Source/core/animation/AnimationClock.cpp

Issue 2757543002: Ensure baseComputedStyle optimisation is cleared during registered custom property animations (Closed)
Patch Set: Rebased Created 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014, Google Inc. All rights reserved. 2 * Copyright (c) 2014, 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 unsigned AnimationClock::s_currentlyRunningTask = 0; 46 unsigned AnimationClock::s_currentlyRunningTask = 0;
47 47
48 void AnimationClock::updateTime(double time) { 48 void AnimationClock::updateTime(double time) {
49 if (time > m_time) 49 if (time > m_time)
50 m_time = time; 50 m_time = time;
51 m_taskForWhichTimeWasCalculated = s_currentlyRunningTask; 51 m_taskForWhichTimeWasCalculated = s_currentlyRunningTask;
52 } 52 }
53 53
54 double AnimationClock::currentTime() { 54 double AnimationClock::currentTime() {
55 if (m_taskForWhichTimeWasCalculated != s_currentlyRunningTask) { 55 if (m_monotonicallyIncreasingTime &&
56 m_taskForWhichTimeWasCalculated != s_currentlyRunningTask) {
56 const double currentTime = m_monotonicallyIncreasingTime(); 57 const double currentTime = m_monotonicallyIncreasingTime();
57 if (m_time < currentTime) { 58 if (m_time < currentTime) {
58 // Advance to the first estimated frame after the current time. 59 // Advance to the first estimated frame after the current time.
59 const double frameShift = 60 const double frameShift =
60 fmod(currentTime - m_time, approximateFrameTime); 61 fmod(currentTime - m_time, approximateFrameTime);
61 const double newTime = currentTime + (approximateFrameTime - frameShift); 62 const double newTime = currentTime + (approximateFrameTime - frameShift);
62 DCHECK_GE(newTime, currentTime); 63 DCHECK_GE(newTime, currentTime);
63 DCHECK_LE(newTime, currentTime + approximateFrameTime); 64 DCHECK_LE(newTime, currentTime + approximateFrameTime);
64 updateTime(newTime); 65 updateTime(newTime);
65 } else { 66 } else {
66 m_taskForWhichTimeWasCalculated = s_currentlyRunningTask; 67 m_taskForWhichTimeWasCalculated = s_currentlyRunningTask;
67 } 68 }
68 } 69 }
69 return m_time; 70 return m_time;
70 } 71 }
71 72
72 void AnimationClock::resetTimeForTesting(double time) { 73 void AnimationClock::resetTimeForTesting(double time) {
73 m_time = time; 74 m_time = time;
74 m_taskForWhichTimeWasCalculated = 0; 75 m_taskForWhichTimeWasCalculated = 0;
75 s_currentlyRunningTask = 0; 76 s_currentlyRunningTask = 0;
76 } 77 }
77 78
78 } // namespace blink 79 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/animation/AnimationClock.h ('k') | third_party/WebKit/Source/core/animation/ElementAnimation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698