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

Side by Side Diff: third_party/WebKit/Source/core/animation/AnimationEffectReadOnly.h

Issue 2236583003: Rename AnimationEffect to AnimationEffectReadOnly (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@deprecated-assert
Patch Set: Rebase Created 4 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
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 10 matching lines...) Expand all
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef AnimationEffect_h 31 #ifndef AnimationEffectReadOnly_h
32 #define AnimationEffect_h 32 #define AnimationEffectReadOnly_h
33 33
34 #include "bindings/core/v8/ScriptWrappable.h" 34 #include "bindings/core/v8/ScriptWrappable.h"
35 #include "core/CoreExport.h" 35 #include "core/CoreExport.h"
36 #include "core/animation/Timing.h" 36 #include "core/animation/Timing.h"
37 #include "platform/heap/Handle.h" 37 #include "platform/heap/Handle.h"
38 38
39 namespace blink { 39 namespace blink {
40 40
41 class Animation; 41 class Animation;
42 class AnimationEffect; 42 class AnimationEffectReadOnly;
43 class AnimationEffectTiming; 43 class AnimationEffectTiming;
44 class ComputedTimingProperties; 44 class ComputedTimingProperties;
45 45
46 enum TimingUpdateReason { 46 enum TimingUpdateReason {
47 TimingUpdateOnDemand, 47 TimingUpdateOnDemand,
48 TimingUpdateForAnimationFrame 48 TimingUpdateForAnimationFrame
49 }; 49 };
50 50
51 static inline bool isNull(double value) 51 static inline bool isNull(double value)
52 { 52 {
53 return std::isnan(value); 53 return std::isnan(value);
54 } 54 }
55 55
56 static inline double nullValue() 56 static inline double nullValue()
57 { 57 {
58 return std::numeric_limits<double>::quiet_NaN(); 58 return std::numeric_limits<double>::quiet_NaN();
59 } 59 }
60 60
61 // Represents the content of an Animation and its fractional timing state. 61 // Represents the content of an Animation and its fractional timing state.
62 // http://w3c.github.io/web-animations/#animation-effect 62 // http://w3c.github.io/web-animations/#animation-effect
63 class CORE_EXPORT AnimationEffect : public GarbageCollectedFinalized<AnimationEf fect>, public ScriptWrappable { 63 class CORE_EXPORT AnimationEffectReadOnly : public GarbageCollectedFinalized<Ani mationEffectReadOnly>, public ScriptWrappable {
64 DEFINE_WRAPPERTYPEINFO(); 64 DEFINE_WRAPPERTYPEINFO();
65 friend class Animation; // Calls attach/detach, updateInheritedTime. 65 friend class Animation; // Calls attach/detach, updateInheritedTime.
66 public: 66 public:
67 // Note that logic in CSSAnimations depends on the order of these values. 67 // Note that logic in CSSAnimations depends on the order of these values.
68 enum Phase { 68 enum Phase {
69 PhaseBefore, 69 PhaseBefore,
70 PhaseActive, 70 PhaseActive,
71 PhaseAfter, 71 PhaseAfter,
72 PhaseNone, 72 PhaseNone,
73 }; 73 };
74 74
75 class EventDelegate : public GarbageCollectedFinalized<EventDelegate> { 75 class EventDelegate : public GarbageCollectedFinalized<EventDelegate> {
76 public: 76 public:
77 virtual ~EventDelegate() { } 77 virtual ~EventDelegate() { }
78 virtual bool requiresIterationEvents(const AnimationEffect&) = 0; 78 virtual bool requiresIterationEvents(const AnimationEffectReadOnly&) = 0 ;
79 virtual void onEventCondition(const AnimationEffect&) = 0; 79 virtual void onEventCondition(const AnimationEffectReadOnly&) = 0;
80 DEFINE_INLINE_VIRTUAL_TRACE() { } 80 DEFINE_INLINE_VIRTUAL_TRACE() { }
81 }; 81 };
82 82
83 virtual ~AnimationEffect() { } 83 virtual ~AnimationEffectReadOnly() { }
84 84
85 virtual bool isKeyframeEffect() const { return false; } 85 virtual bool isKeyframeEffect() const { return false; }
86 virtual bool isInertEffect() const { return false; } 86 virtual bool isInertEffect() const { return false; }
87 87
88 Phase getPhase() const { return ensureCalculated().phase; } 88 Phase getPhase() const { return ensureCalculated().phase; }
89 bool isCurrent() const { return ensureCalculated().isCurrent; } 89 bool isCurrent() const { return ensureCalculated().isCurrent; }
90 bool isInEffect() const { return ensureCalculated().isInEffect; } 90 bool isInEffect() const { return ensureCalculated().isInEffect; }
91 bool isInPlay() const { return ensureCalculated().isInPlay; } 91 bool isInPlay() const { return ensureCalculated().isInPlay; }
92 double currentIteration() const { return ensureCalculated().currentIteration ; } 92 double currentIteration() const { return ensureCalculated().currentIteration ; }
93 double progress() const { return ensureCalculated().progress; } 93 double progress() const { return ensureCalculated().progress; }
94 double timeToForwardsEffectChange() const { return ensureCalculated().timeTo ForwardsEffectChange; } 94 double timeToForwardsEffectChange() const { return ensureCalculated().timeTo ForwardsEffectChange; }
95 double timeToReverseEffectChange() const { return ensureCalculated().timeToR everseEffectChange; } 95 double timeToReverseEffectChange() const { return ensureCalculated().timeToR everseEffectChange; }
96 96
97 double iterationDuration() const; 97 double iterationDuration() const;
98 double activeDurationInternal() const; 98 double activeDurationInternal() const;
99 double endTimeInternal() const { return specifiedTiming().startDelay + activ eDurationInternal() + specifiedTiming().endDelay; } 99 double endTimeInternal() const { return specifiedTiming().startDelay + activ eDurationInternal() + specifiedTiming().endDelay; }
100 100
101 const Animation* animation() const { return m_animation; } 101 const Animation* animation() const { return m_animation; }
102 Animation* animation() { return m_animation; } 102 Animation* animation() { return m_animation; }
103 const Timing& specifiedTiming() const { return m_timing; } 103 const Timing& specifiedTiming() const { return m_timing; }
104 AnimationEffectTiming* timing(); 104 AnimationEffectTiming* timing();
105 void updateSpecifiedTiming(const Timing&); 105 void updateSpecifiedTiming(const Timing&);
106 106
107 void getComputedTiming(ComputedTimingProperties&); 107 void getComputedTiming(ComputedTimingProperties&);
108 ComputedTimingProperties getComputedTiming(); 108 ComputedTimingProperties getComputedTiming();
109 109
110 DECLARE_VIRTUAL_TRACE(); 110 DECLARE_VIRTUAL_TRACE();
111 111
112 protected: 112 protected:
113 explicit AnimationEffect(const Timing&, EventDelegate* = nullptr); 113 explicit AnimationEffectReadOnly(const Timing&, EventDelegate* = nullptr);
114 114
115 // When AnimationEffect receives a new inherited time via updateInheritedTim e 115 // When AnimationEffectReadOnly receives a new inherited time via updateInhe ritedTime
116 // it will (if necessary) recalculate timings and (if necessary) call 116 // it will (if necessary) recalculate timings and (if necessary) call
117 // updateChildrenAndEffects. 117 // updateChildrenAndEffects.
118 void updateInheritedTime(double inheritedTime, TimingUpdateReason) const; 118 void updateInheritedTime(double inheritedTime, TimingUpdateReason) const;
119 void invalidate() const { m_needsUpdate = true; } 119 void invalidate() const { m_needsUpdate = true; }
120 bool requiresIterationEvents() const { return m_eventDelegate && m_eventDele gate->requiresIterationEvents(*this); } 120 bool requiresIterationEvents() const { return m_eventDelegate && m_eventDele gate->requiresIterationEvents(*this); }
121 void clearEventDelegate() { m_eventDelegate = nullptr; } 121 void clearEventDelegate() { m_eventDelegate = nullptr; }
122 122
123 virtual void attach(Animation* animation) 123 virtual void attach(Animation* animation)
124 { 124 {
125 m_animation = animation; 125 m_animation = animation;
(...skipping 30 matching lines...) Expand all
156 } m_calculated; 156 } m_calculated;
157 mutable bool m_needsUpdate; 157 mutable bool m_needsUpdate;
158 mutable double m_lastUpdateTime; 158 mutable double m_lastUpdateTime;
159 String m_name; 159 String m_name;
160 160
161 const CalculatedTiming& ensureCalculated() const; 161 const CalculatedTiming& ensureCalculated() const;
162 }; 162 };
163 163
164 } // namespace blink 164 } // namespace blink
165 165
166 #endif // AnimationEffect_h 166 #endif // AnimationEffectReadOnly_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698