Chromium Code Reviews| Index: Source/core/animation/AnimationClock.h |
| diff --git a/Source/core/animation/AnimationClock.h b/Source/core/animation/AnimationClock.h |
| index f6a2cdb84991f6777818a1f67bf251d269e1b757..0d2545e487c448f44bd71b189ec1c87ca7605ffc 100644 |
| --- a/Source/core/animation/AnimationClock.h |
| +++ b/Source/core/animation/AnimationClock.h |
| @@ -34,6 +34,17 @@ |
| #include "wtf/CurrentTime.h" |
| #include "wtf/PassOwnPtr.h" |
| +namespace { |
|
abarth-chromium
2014/02/20 17:52:00
Please don't use anonymous namespaces in headers.
dstockwell
2014/02/24 06:03:25
Done.
|
| + |
| +// FIXME: This value is used to suppress updates when time is required outside of a frame. |
| +// The purpose of allowing the clock to update during such periods is to allow animations |
| +// to have an appropriate start time and for getComputedStyle to attempt to catch-up to a |
| +// compositor animation. However a more accurate system might be to attempt to phase-lock |
| +// with the frame clock. |
| +const double minTimeBeforeUnsynchronizedTick = 0.005; |
| + |
| +} |
| + |
| namespace WebCore { |
| class AnimationClock { |
| @@ -52,8 +63,11 @@ public: |
| double currentTime() |
| { |
| - if (!m_frozen) |
| - updateTime(m_monotonicallyIncreasingTime()); |
| + if (!m_frozen) { |
| + double newTime = m_monotonicallyIncreasingTime(); |
| + if (newTime >= m_time + minTimeBeforeUnsynchronizedTick) |
| + m_time = newTime; |
| + } |
| return m_time; |
| } |