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

Unified Diff: Source/core/animation/TimedItem.h

Issue 23173007: Web Animations: Fix CSS events to handle animations with very short durations (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/animation/Animation.cpp ('k') | Source/core/animation/TimedItem.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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; }
« no previous file with comments | « Source/core/animation/Animation.cpp ('k') | Source/core/animation/TimedItem.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698