OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef KeyframeEffectReadOnly_h | 5 #ifndef KeyframeEffectReadOnly_h |
6 #define KeyframeEffectReadOnly_h | 6 #define KeyframeEffectReadOnly_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/animation/AnimationEffectReadOnly.h" | 9 #include "core/animation/AnimationEffectReadOnly.h" |
10 #include "core/animation/EffectModel.h" | 10 #include "core/animation/EffectModel.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 class KeyframeEffectOptions; | |
15 class DictionarySequenceOrDictionary; | 14 class DictionarySequenceOrDictionary; |
16 class Element; | 15 class Element; |
17 class ExceptionState; | 16 class ExceptionState; |
18 class ExecutionContext; | 17 class ExecutionContext; |
| 18 class KeyframeEffectOptions; |
| 19 class PropertyHandle; |
19 class SampledEffect; | 20 class SampledEffect; |
20 | 21 |
21 // Represents the effect of an Animation on an Element's properties. | 22 // Represents the effect of an Animation on an Element's properties. |
22 // http://w3c.github.io/web-animations/#the-keyframeeffect-interfaces | 23 // http://w3c.github.io/web-animations/#the-keyframeeffect-interfaces |
23 class CORE_EXPORT KeyframeEffectReadOnly : public AnimationEffectReadOnly { | 24 class CORE_EXPORT KeyframeEffectReadOnly : public AnimationEffectReadOnly { |
24 DEFINE_WRAPPERTYPEINFO(); | 25 DEFINE_WRAPPERTYPEINFO(); |
25 | 26 |
26 public: | 27 public: |
27 enum Priority { DefaultPriority, TransitionPriority }; | 28 enum Priority { DefaultPriority, TransitionPriority }; |
28 | 29 |
(...skipping 12 matching lines...) Expand all Loading... |
41 static KeyframeEffectReadOnly* create( | 42 static KeyframeEffectReadOnly* create( |
42 ExecutionContext*, | 43 ExecutionContext*, |
43 Element*, | 44 Element*, |
44 const DictionarySequenceOrDictionary& effectInput, | 45 const DictionarySequenceOrDictionary& effectInput, |
45 ExceptionState&); | 46 ExceptionState&); |
46 | 47 |
47 ~KeyframeEffectReadOnly() override {} | 48 ~KeyframeEffectReadOnly() override {} |
48 | 49 |
49 bool isKeyframeEffectReadOnly() const override { return true; } | 50 bool isKeyframeEffectReadOnly() const override { return true; } |
50 | 51 |
| 52 bool affects(PropertyHandle) const; |
| 53 const EffectModel* model() const { return m_model.get(); } |
| 54 EffectModel* model() { return m_model.get(); } |
| 55 void setModel(EffectModel* model) { m_model = model; } |
51 Priority getPriority() const { return m_priority; } | 56 Priority getPriority() const { return m_priority; } |
52 void downgradeToNormal() { m_priority = DefaultPriority; } | 57 Element* target() const { return m_target; } |
| 58 |
| 59 void notifySampledEffectRemovedFromAnimationStack(); |
| 60 |
| 61 bool isCandidateForAnimationOnCompositor(double animationPlaybackRate) const; |
| 62 // Must only be called once. |
| 63 bool maybeStartAnimationOnCompositor(int group, |
| 64 double startTime, |
| 65 double timeOffset, |
| 66 double animationPlaybackRate); |
| 67 bool hasActiveAnimationsOnCompositor() const; |
| 68 bool hasActiveAnimationsOnCompositor(CSSPropertyID) const; |
| 69 bool cancelAnimationOnCompositor(); |
| 70 void restartAnimationOnCompositor(); |
| 71 void cancelIncompatibleAnimationsOnCompositor(); |
| 72 void pauseAnimationForTestingOnCompositor(double pauseTime); |
| 73 |
| 74 void attachCompositedLayers(); |
| 75 |
| 76 void setCompositorAnimationIdsForTesting( |
| 77 const Vector<int>& compositorAnimationIds) { |
| 78 m_compositorAnimationIds = compositorAnimationIds; |
| 79 } |
53 | 80 |
54 DECLARE_VIRTUAL_TRACE(); | 81 DECLARE_VIRTUAL_TRACE(); |
55 | 82 |
| 83 void downgradeToNormal() { m_priority = DefaultPriority; } |
| 84 |
56 protected: | 85 protected: |
57 KeyframeEffectReadOnly(Element*, | 86 KeyframeEffectReadOnly(Element*, |
58 EffectModel*, | 87 EffectModel*, |
59 const Timing&, | 88 const Timing&, |
60 Priority, | 89 Priority, |
61 EventDelegate*); | 90 EventDelegate*); |
62 | 91 |
| 92 void applyEffects(); |
| 93 void clearEffects(); |
| 94 void updateChildrenAndEffects() const override; |
| 95 void attach(Animation*) override; |
| 96 void detach() override; |
| 97 void specifiedTimingChanged() override; |
| 98 double calculateTimeToEffectChange(bool forwards, |
| 99 double inheritedTime, |
| 100 double timeToNextIteration) const override; |
| 101 virtual bool hasIncompatibleStyle(); |
| 102 bool hasMultipleTransformProperties() const; |
| 103 |
| 104 private: |
63 Member<Element> m_target; | 105 Member<Element> m_target; |
64 Member<EffectModel> m_model; | 106 Member<EffectModel> m_model; |
65 Member<SampledEffect> m_sampledEffect; | 107 Member<SampledEffect> m_sampledEffect; |
66 | 108 |
67 Priority m_priority; | 109 Priority m_priority; |
| 110 |
| 111 Vector<int> m_compositorAnimationIds; |
68 }; | 112 }; |
69 | 113 |
70 // TODO(suzyh): Replace calls to toKeyframeEffect with toKeyframeEffectReadOnly | 114 // TODO(suzyh): Replace calls to toKeyframeEffect with toKeyframeEffectReadOnly |
71 // where possible | 115 // where possible |
72 DEFINE_TYPE_CASTS(KeyframeEffectReadOnly, | 116 DEFINE_TYPE_CASTS(KeyframeEffectReadOnly, |
73 AnimationEffectReadOnly, | 117 AnimationEffectReadOnly, |
74 animationNode, | 118 animationNode, |
75 animationNode->isKeyframeEffectReadOnly(), | 119 animationNode->isKeyframeEffectReadOnly(), |
76 animationNode.isKeyframeEffectReadOnly()); | 120 animationNode.isKeyframeEffectReadOnly()); |
77 | 121 |
78 } // namespace blink | 122 } // namespace blink |
79 | 123 |
80 #endif // KeyframeEffectReadOnly_h | 124 #endif // KeyframeEffectReadOnly_h |
OLD | NEW |