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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 } 45 }
46 46
47 static inline double nullValue() 47 static inline double nullValue()
48 { 48 {
49 return std::numeric_limits<double>::quiet_NaN(); 49 return std::numeric_limits<double>::quiet_NaN();
50 } 50 }
51 51
52 class TimedItemEventDelegate { 52 class TimedItemEventDelegate {
53 public: 53 public:
54 virtual ~TimedItemEventDelegate() { }; 54 virtual ~TimedItemEventDelegate() { };
55 virtual void onEventCondition(bool wasInPlay, bool isInPlay, double previous Iteration, double currentIteration) = 0; 55 virtual void onEventCondition(bool wasInPlay, bool isInPlay, bool wasCurrent , bool isCurrent, double previousIteration, double currentIteration) = 0;
56 }; 56 };
57 57
58 class TimedItem : public RefCounted<TimedItem> { 58 class TimedItem : public RefCounted<TimedItem> {
59 friend class Player; // Calls attach/detach, updateInheritedTime. 59 friend class Player; // Calls attach/detach, updateInheritedTime.
60 public: 60 public:
61 virtual ~TimedItem() { } 61 virtual ~TimedItem() { }
62 62
63 bool isCurrent() const { return ensureCalculated().isCurrent; } 63 bool isCurrent() const { return ensureCalculated().isCurrent; }
64 bool isInEffect() const { return ensureCalculated().isInEffect; } 64 bool isInEffect() const { return ensureCalculated().isInEffect; }
65 bool isInPlay() const { return ensureCalculated().isInPlay; } 65 bool isInPlay() const { return ensureCalculated().isInPlay; }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 100
101 // FIXME: m_parent and m_startTime are placeholders, they depend on timing g roups. 101 // FIXME: m_parent and m_startTime are placeholders, they depend on timing g roups.
102 TimedItem* const m_parent; 102 TimedItem* const m_parent;
103 const double m_startTime; 103 const double m_startTime;
104 Player* m_player; 104 Player* m_player;
105 Timing m_specified; 105 Timing m_specified;
106 OwnPtr<TimedItemEventDelegate> m_eventDelegate; 106 OwnPtr<TimedItemEventDelegate> m_eventDelegate;
107 107
108 // FIXME: Should be versioned by monotonic value on player. 108 // FIXME: Should be versioned by monotonic value on player.
109 mutable struct CalculatedTiming { 109 mutable struct CalculatedTiming {
110 CalculatedTiming();
111 double activeDuration; 110 double activeDuration;
112 double currentIteration; 111 double currentIteration;
113 double timeFraction; 112 double timeFraction;
114 bool isCurrent; 113 bool isCurrent;
115 bool isInEffect; 114 bool isInEffect;
116 bool isInPlay; 115 bool isInPlay;
117 } m_calculated; 116 } m_calculated;
117 mutable bool m_isFirstSample;
118 118
119 // FIXME: Should check the version and reinherit time if inconsistent. 119 // FIXME: Should check the version and reinherit time if inconsistent.
120 const CalculatedTiming& ensureCalculated() const { return m_calculated; } 120 const CalculatedTiming& ensureCalculated() const { return m_calculated; }
121 }; 121 };
122 122
123 } // namespace WebCore 123 } // namespace WebCore
124 124
125 #endif 125 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698