OLD | NEW |
---|---|
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 15 matching lines...) Expand all Loading... | |
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 KeyframeEffect_h | 31 #ifndef KeyframeEffect_h |
32 #define KeyframeEffect_h | 32 #define KeyframeEffect_h |
33 | 33 |
34 #include "core/CoreExport.h" | 34 #include "core/CoreExport.h" |
35 #include "core/animation/AnimationEffectTiming.h" | 35 #include "core/animation/AnimationEffectTiming.h" |
36 #include "core/animation/EffectInput.h" | |
37 #include "core/animation/EffectModel.h" | 36 #include "core/animation/EffectModel.h" |
38 #include "core/animation/KeyframeEffectReadOnly.h" | 37 #include "core/animation/KeyframeEffectReadOnly.h" |
39 #include "core/animation/TimingInput.h" | |
40 #include "platform/heap/Handle.h" | |
41 #include "wtf/RefPtr.h" | |
42 | 38 |
43 namespace blink { | 39 namespace blink { |
44 | 40 |
45 class Dictionary; | |
46 class Element; | 41 class Element; |
47 class ExceptionState; | 42 class ExceptionState; |
48 class KeyframeEffectOptions; | 43 class KeyframeEffectOptions; |
49 class PropertyHandle; | 44 class PropertyHandle; |
50 class SampledEffect; | |
51 | 45 |
52 // Represents the effect of an Animation on an Element's properties. | 46 // Represents the effect of an Animation on an Element's properties. |
53 // http://w3c.github.io/web-animations/#keyframe-effect | 47 // http://w3c.github.io/web-animations/#keyframe-effect |
54 class CORE_EXPORT KeyframeEffect final : public KeyframeEffectReadOnly { | 48 class CORE_EXPORT KeyframeEffect final : public KeyframeEffectReadOnly { |
55 DEFINE_WRAPPERTYPEINFO(); | 49 DEFINE_WRAPPERTYPEINFO(); |
56 | 50 |
57 public: | 51 public: |
58 static KeyframeEffect* create(Element*, | 52 static KeyframeEffect* create(Element*, |
59 EffectModel*, | 53 EffectModel*, |
60 const Timing&, | 54 const Timing&, |
(...skipping 16 matching lines...) Expand all Loading... | |
77 static KeyframeEffect* create( | 71 static KeyframeEffect* create( |
78 ExecutionContext*, | 72 ExecutionContext*, |
79 Element*, | 73 Element*, |
80 const DictionarySequenceOrDictionary& effectInput, | 74 const DictionarySequenceOrDictionary& effectInput, |
81 ExceptionState&); | 75 ExceptionState&); |
82 | 76 |
83 ~KeyframeEffect() override; | 77 ~KeyframeEffect() override; |
84 | 78 |
85 bool isKeyframeEffect() const override { return true; } | 79 bool isKeyframeEffect() const override { return true; } |
86 | 80 |
87 bool affects(PropertyHandle) const; | |
88 const EffectModel* model() const { return m_model.get(); } | |
89 EffectModel* model() { return m_model.get(); } | |
90 void setModel(EffectModel* model) { m_model = model; } | |
91 Element* target() const { return m_target; } | |
92 | |
93 void notifySampledEffectRemovedFromAnimationStack(); | |
94 | |
95 bool isCandidateForAnimationOnCompositor(double animationPlaybackRate) const; | |
96 // Must only be called once. | |
97 bool maybeStartAnimationOnCompositor(int group, | |
98 double startTime, | |
99 double timeOffset, | |
100 double animationPlaybackRate); | |
101 bool hasActiveAnimationsOnCompositor() const; | |
102 bool hasActiveAnimationsOnCompositor(CSSPropertyID) const; | |
103 bool cancelAnimationOnCompositor(); | |
104 void restartAnimationOnCompositor(); | |
105 void cancelIncompatibleAnimationsOnCompositor(); | |
106 void pauseAnimationForTestingOnCompositor(double pauseTime); | |
107 | |
108 void attachCompositedLayers(); | |
109 | |
110 void setCompositorAnimationIdsForTesting( | |
111 const Vector<int>& compositorAnimationIds) { | |
112 m_compositorAnimationIds = compositorAnimationIds; | |
113 } | |
114 | |
115 AnimationEffectTiming* timing() override; | 81 AnimationEffectTiming* timing() override; |
116 | 82 |
117 DECLARE_VIRTUAL_TRACE(); | |
118 | |
119 protected: | |
120 void applyEffects(); | |
121 void clearEffects(); | |
122 void updateChildrenAndEffects() const override; | |
123 void attach(Animation*) override; | |
124 void detach() override; | |
125 void specifiedTimingChanged() override; | |
126 double calculateTimeToEffectChange(bool forwards, | |
127 double inheritedTime, | |
128 double timeToNextIteration) const override; | |
129 virtual bool hasIncompatibleStyle(); | |
130 bool hasMultipleTransformProperties() const; | |
131 | |
132 private: | 83 private: |
133 KeyframeEffect(Element*, | 84 KeyframeEffect(Element*, |
134 EffectModel*, | 85 EffectModel*, |
135 const Timing&, | 86 const Timing&, |
136 KeyframeEffectReadOnly::Priority, | 87 KeyframeEffectReadOnly::Priority, |
137 EventDelegate*); | 88 EventDelegate*); |
138 | |
139 Vector<int> m_compositorAnimationIds; | |
140 | |
141 friend class AnimationAnimationV8Test; | |
suzyh_UTC10 (ex-contributor)
2016/10/07 00:46:00
Oh yes, I meant to comment on this. The AnimationA
| |
142 }; | 89 }; |
143 | 90 |
144 DEFINE_TYPE_CASTS(KeyframeEffect, | 91 DEFINE_TYPE_CASTS(KeyframeEffect, |
145 AnimationEffectReadOnly, | 92 AnimationEffectReadOnly, |
146 animationNode, | 93 animationNode, |
147 animationNode->isKeyframeEffect(), | 94 animationNode->isKeyframeEffect(), |
148 animationNode.isKeyframeEffect()); | 95 animationNode.isKeyframeEffect()); |
149 | 96 |
150 } // namespace blink | 97 } // namespace blink |
151 | 98 |
152 #endif // KeyframeEffect_h | 99 #endif // KeyframeEffect_h |
OLD | NEW |