Index: Source/core/animation/AnimationPlayer.h |
diff --git a/Source/core/animation/AnimationPlayer.h b/Source/core/animation/AnimationPlayer.h |
index c1ab1d8b2e0ba92ce92df6def6368f583ec47f92..5629ca483c066294dc82963f49bc11fe634e97f2 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; |
+ 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; } |
@@ -136,6 +136,7 @@ public: |
bool hasActiveAnimationsOnCompositor(); |
void setCompositorPending(bool sourceChanged = false); |
void notifyCompositorStartTime(double timelineTime); |
+ void notifyStartTime(double timelineTime); |
void preCommit(bool startOnCompositor); |
@@ -160,16 +161,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 +221,29 @@ private: |
CompositorAction pendingAction; |
}; |
+ enum CompositorPendingChange { |
+ SetCompositorPending, |
+ SetCompositorPendingWithSourceChanged, |
+ DoNotSetCompositorPending, |
+ }; |
+ |
+ class PlayStateUpdateScope { |
+ STACK_ALLOCATED(); |
+ public: |
+ PlayStateUpdateScope(AnimationPlayer&, TimingUpdateReason, CompositorPendingChange = SetCompositorPending); |
+ ~PlayStateUpdateScope(); |
+ private: |
+ AnimationPlayer& m_player; |
+ AnimationPlayState m_initial; |
+ CompositorPendingChange m_compositorPendingChange; |
+ }; |
+ |
// 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 |