Chromium Code Reviews| Index: Source/core/animation/AnimationPlayer.h |
| diff --git a/Source/core/animation/AnimationPlayer.h b/Source/core/animation/AnimationPlayer.h |
| index 3157b712ce9ca49f9bfde13cc00a0c67f88d361f..d0dd281e9b69602accacd2795d0880d130d58e52 100644 |
| --- a/Source/core/animation/AnimationPlayer.h |
| +++ b/Source/core/animation/AnimationPlayer.h |
| @@ -74,20 +74,20 @@ public: |
| double currentTime(); |
| void setCurrentTime(double newCurrentTime); |
| - double calculateCurrentTime() const; |
| - double currentTimeInternal(); |
| - void setCurrentTimeInternal(double newCurrentTime, TimingUpdateReason = TimingUpdateOnDemand); |
| + double currentTimeInternal() const; |
|
shans
2014/10/15 03:38:01
I like this patch already
dstockwell
2014/10/15 08:30:04
Ack.
|
| + void setCurrentTimeInternal(double newCurrentTime, TimingUpdateReason = TimingUpdateOnDemand); |
| bool paused() const { return m_paused && !m_isPausedForTesting; } |
| - String playState(); |
| - AnimationPlayState playStateInternal(); |
| + static const char* playStateString(AnimationPlayState); |
| + String playState() { return playStateString(playStateInternal()); } |
| + AnimationPlayState playStateInternal() const; |
| void pause(); |
| void play(); |
| void reverse(); |
| void finish(ExceptionState&); |
| - bool finished() { return !m_idle && limited(currentTimeInternal()); } |
| - bool playing() { return !(finished() || m_paused || m_isPausedForTesting || m_idle); } |
| + bool finished() const { return m_playState != Idle && limited(currentTimeInternal()); } |
| + bool playing() const { return !(playStateInternal() == Idle || finished() || m_paused || m_isPausedForTesting); } |
| // FIXME: Resolve whether finished() should just return the flag, and |
| // remove this method. |
| bool finishedInternal() const { return m_finished; } |
| @@ -160,16 +160,21 @@ public: |
| private: |
| AnimationPlayer(ExecutionContext*, AnimationTimeline&, AnimationNode*); |
| + |
| double sourceEnd() const; |
| bool limited(double currentTime) const; |
| - void setPlaybackRateInternal(double); |
| - void updateCurrentTimingState(TimingUpdateReason); |
| + |
| + AnimationPlayState calculatePlayState(); |
| + double calculateCurrentTime() const; |
| + |
| void unpauseInternal(); |
| void uncancel(); |
| - void setFinished(bool); |
| + void setPlaybackRateInternal(double); |
| + void updateCurrentTimingState(TimingUpdateReason); |
| - double m_playbackRate; |
| + AnimationPlayState m_playState; |
| + double m_playbackRate; |
| double m_startTime; |
| double m_holdTime; |
| @@ -215,13 +220,22 @@ private: |
| CompositorAction pendingAction; |
| }; |
| + class PlayStateUpdateScope { |
| + STACK_ALLOCATED(); |
| + public: |
| + PlayStateUpdateScope(AnimationPlayer&, TimingUpdateReason); |
| + ~PlayStateUpdateScope(); |
| + private: |
| + AnimationPlayer& m_player; |
| + AnimationPlayState m_initial; |
| + }; |
| + |
| // This mirrors the known compositor state. It is created when a compositor |
| // animation is started. Updated once the start time is known and each time |
| // modifications are pushed to the compositor. |
| OwnPtr<CompositorState> m_compositorState; |
| bool m_compositorPending; |
| bool m_currentTimePending; |
| - bool m_idle; |
| }; |
| } // namespace blink |