| Index: Source/core/animation/TimedItem.h
|
| diff --git a/Source/core/animation/TimedItem.h b/Source/core/animation/TimedItem.h
|
| index 93b79a7fc7b9503257f36bbed398dab0249c2b72..501a71170224154f1a2230bacd501a110f04793e 100644
|
| --- a/Source/core/animation/TimedItem.h
|
| +++ b/Source/core/animation/TimedItem.h
|
| @@ -49,17 +49,26 @@ static inline double nullValue()
|
| return std::numeric_limits<double>::quiet_NaN();
|
| }
|
|
|
| -class TimedItemEventDelegate {
|
| -public:
|
| - virtual ~TimedItemEventDelegate() { };
|
| - virtual void onEventCondition(bool wasInPlay, bool isInPlay, double previousIteration, double currentIteration) = 0;
|
| -};
|
| -
|
| class TimedItem : public RefCounted<TimedItem> {
|
| friend class Player; // Calls attach/detach, updateInheritedTime.
|
| public:
|
| + // Note that logic in CSSAnimations depends on the order of these values.
|
| + enum Phase {
|
| + PhaseBefore,
|
| + PhaseActive,
|
| + PhaseAfter,
|
| + PhaseNone,
|
| + };
|
| +
|
| + class EventDelegate {
|
| + public:
|
| + virtual ~EventDelegate() { };
|
| + virtual void onEventCondition(bool isFirstSample, Phase previousPhase, Phase currentPhase, double previousIteration, double currentIteration) = 0;
|
| + };
|
| +
|
| virtual ~TimedItem() { }
|
|
|
| + Phase phase() const { return ensureCalculated().phase; }
|
| bool isCurrent() const { return ensureCalculated().isCurrent; }
|
| bool isInEffect() const { return ensureCalculated().isInEffect; }
|
| bool isInPlay() const { return ensureCalculated().isInPlay; }
|
| @@ -71,15 +80,8 @@ public:
|
| double timeFraction() const { return ensureCalculated().timeFraction; }
|
| Player* player() const { return m_player; }
|
|
|
| - enum Phase {
|
| - PhaseBefore,
|
| - PhaseActive,
|
| - PhaseAfter,
|
| - PhaseNone,
|
| - };
|
| -
|
| protected:
|
| - TimedItem(const Timing&, PassOwnPtr<TimedItemEventDelegate> = nullptr);
|
| + TimedItem(const Timing&, PassOwnPtr<EventDelegate> = nullptr);
|
|
|
| // When TimedItem receives a new inherited time via updateInheritedTime
|
| // it will (if necessary) recalculate timings and (if necessary) call
|
| @@ -103,18 +105,19 @@ private:
|
| const double m_startTime;
|
| Player* m_player;
|
| Timing m_specified;
|
| - OwnPtr<TimedItemEventDelegate> m_eventDelegate;
|
| + OwnPtr<EventDelegate> m_eventDelegate;
|
|
|
| // FIXME: Should be versioned by monotonic value on player.
|
| mutable struct CalculatedTiming {
|
| - CalculatedTiming();
|
| double activeDuration;
|
| + Phase phase;
|
| double currentIteration;
|
| double timeFraction;
|
| bool isCurrent;
|
| bool isInEffect;
|
| bool isInPlay;
|
| } m_calculated;
|
| + mutable bool m_isFirstSample;
|
|
|
| // FIXME: Should check the version and reinherit time if inconsistent.
|
| const CalculatedTiming& ensureCalculated() const { return m_calculated; }
|
|
|