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

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

Issue 2369833002: Introduce KeyframeEffectReadOnly interface (Closed)
Patch Set: Created 4 years, 2 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 14 matching lines...) Expand all
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 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/AnimationEffectReadOnly.h"
36 #include "core/animation/EffectInput.h" 35 #include "core/animation/EffectInput.h"
37 #include "core/animation/EffectModel.h" 36 #include "core/animation/EffectModel.h"
37 #include "core/animation/KeyframeEffectReadOnly.h"
38 #include "core/animation/TimingInput.h" 38 #include "core/animation/TimingInput.h"
39 #include "platform/heap/Handle.h" 39 #include "platform/heap/Handle.h"
40 #include "wtf/RefPtr.h" 40 #include "wtf/RefPtr.h"
41 41
42 namespace blink { 42 namespace blink {
43 43
44 class KeyframeEffectOptions; 44 class KeyframeEffectOptions;
45 class Dictionary; 45 class Dictionary;
46 class Element; 46 class Element;
47 class ExceptionState; 47 class ExceptionState;
48 class PropertyHandle; 48 class PropertyHandle;
49 class SampledEffect; 49 class SampledEffect;
50 50
51 // Represents the effect of an Animation on an Element's properties. 51 // Represents the effect of an Animation on an Element's properties.
52 // http://w3c.github.io/web-animations/#keyframe-effect 52 // http://w3c.github.io/web-animations/#keyframe-effect
53 class CORE_EXPORT KeyframeEffect final : public AnimationEffectReadOnly { 53 class CORE_EXPORT KeyframeEffect final : public KeyframeEffectReadOnly {
54 DEFINE_WRAPPERTYPEINFO(); 54 DEFINE_WRAPPERTYPEINFO();
55 public: 55 public:
56 enum Priority { DefaultPriority, TransitionPriority }; 56 static KeyframeEffect* create(Element*, EffectModel*, const Timing&, Keyfram eEffectReadOnly::Priority = KeyframeEffectReadOnly::DefaultPriority, EventDelega te* = nullptr);
57
58 static KeyframeEffect* create(Element*, EffectModel*, const Timing&, Priorit y = DefaultPriority, EventDelegate* = nullptr);
59 // Web Animations API Bindings constructors. 57 // Web Animations API Bindings constructors.
60 static KeyframeEffect* create(ExecutionContext*, Element*, const DictionaryS equenceOrDictionary& effectInput, double duration, ExceptionState&); 58 static KeyframeEffect* create(ExecutionContext*, Element*, const DictionaryS equenceOrDictionary& effectInput, double duration, ExceptionState&);
61 static KeyframeEffect* create(ExecutionContext*, Element*, const DictionaryS equenceOrDictionary& effectInput, const KeyframeEffectOptions& timingInput, Exce ptionState&); 59 static KeyframeEffect* create(ExecutionContext*, Element*, const DictionaryS equenceOrDictionary& effectInput, const KeyframeEffectOptions& timingInput, Exce ptionState&);
62 static KeyframeEffect* create(ExecutionContext*, Element*, const DictionaryS equenceOrDictionary& effectInput, ExceptionState&); 60 static KeyframeEffect* create(ExecutionContext*, Element*, const DictionaryS equenceOrDictionary& effectInput, ExceptionState&);
63 61
64 ~KeyframeEffect() override; 62 ~KeyframeEffect() override;
65 63
66 bool isKeyframeEffect() const override { return true; } 64 bool isKeyframeEffect() const override { return true; }
67 65
68 bool affects(PropertyHandle) const; 66 bool affects(PropertyHandle) const;
69 const EffectModel* model() const { return m_model.get(); } 67 const EffectModel* model() const { return m_model.get(); }
70 EffectModel* model() { return m_model.get(); } 68 EffectModel* model() { return m_model.get(); }
71 void setModel(EffectModel* model) { m_model = model; } 69 void setModel(EffectModel* model) { m_model = model; }
72 Priority getPriority() const { return m_priority; } 70 KeyframeEffectReadOnly::Priority getPriority() const { return m_priority; }
73 Element* target() const { return m_target; } 71 Element* target() const { return m_target; }
74 72
75 void notifySampledEffectRemovedFromAnimationStack(); 73 void notifySampledEffectRemovedFromAnimationStack();
76 74
77 bool isCandidateForAnimationOnCompositor(double animationPlaybackRate) const ; 75 bool isCandidateForAnimationOnCompositor(double animationPlaybackRate) const ;
78 // Must only be called once. 76 // Must only be called once.
79 bool maybeStartAnimationOnCompositor(int group, double startTime, double tim eOffset, double animationPlaybackRate); 77 bool maybeStartAnimationOnCompositor(int group, double startTime, double tim eOffset, double animationPlaybackRate);
80 bool hasActiveAnimationsOnCompositor() const; 78 bool hasActiveAnimationsOnCompositor() const;
81 bool hasActiveAnimationsOnCompositor(CSSPropertyID) const; 79 bool hasActiveAnimationsOnCompositor(CSSPropertyID) const;
82 bool cancelAnimationOnCompositor(); 80 bool cancelAnimationOnCompositor();
83 void restartAnimationOnCompositor(); 81 void restartAnimationOnCompositor();
84 void cancelIncompatibleAnimationsOnCompositor(); 82 void cancelIncompatibleAnimationsOnCompositor();
85 void pauseAnimationForTestingOnCompositor(double pauseTime); 83 void pauseAnimationForTestingOnCompositor(double pauseTime);
86 84
87 void attachCompositedLayers(); 85 void attachCompositedLayers();
88 86
89 void setCompositorAnimationIdsForTesting(const Vector<int>& compositorAnimat ionIds) { m_compositorAnimationIds = compositorAnimationIds; } 87 void setCompositorAnimationIdsForTesting(const Vector<int>& compositorAnimat ionIds) { m_compositorAnimationIds = compositorAnimationIds; }
90 88
91 DECLARE_VIRTUAL_TRACE(); 89 DECLARE_VIRTUAL_TRACE();
92 90
93 void downgradeToNormal() { m_priority = DefaultPriority; } 91 void downgradeToNormal() { m_priority = KeyframeEffectReadOnly::DefaultPrior ity; }
94 92
95 protected: 93 protected:
96 void applyEffects(); 94 void applyEffects();
97 void clearEffects(); 95 void clearEffects();
98 void updateChildrenAndEffects() const override; 96 void updateChildrenAndEffects() const override;
99 void attach(Animation*) override; 97 void attach(Animation*) override;
100 void detach() override; 98 void detach() override;
101 void specifiedTimingChanged() override; 99 void specifiedTimingChanged() override;
102 double calculateTimeToEffectChange(bool forwards, double inheritedTime, doub le timeToNextIteration) const override; 100 double calculateTimeToEffectChange(bool forwards, double inheritedTime, doub le timeToNextIteration) const override;
103 virtual bool hasIncompatibleStyle(); 101 virtual bool hasIncompatibleStyle();
104 bool hasMultipleTransformProperties() const; 102 bool hasMultipleTransformProperties() const;
105 103
106 private: 104 private:
107 KeyframeEffect(Element*, EffectModel*, const Timing&, Priority, EventDelegat e*); 105 KeyframeEffect(Element*, EffectModel*, const Timing&, KeyframeEffectReadOnly ::Priority, EventDelegate*);
108
109 Member<Element> m_target;
110 Member<EffectModel> m_model;
111 Member<SampledEffect> m_sampledEffect;
112
113 Priority m_priority;
114 106
115 Vector<int> m_compositorAnimationIds; 107 Vector<int> m_compositorAnimationIds;
116 108
117 friend class AnimationAnimationV8Test; 109 friend class AnimationAnimationV8Test;
118 }; 110 };
119 111
120 DEFINE_TYPE_CASTS(KeyframeEffect, AnimationEffectReadOnly, animationNode, animat ionNode->isKeyframeEffect(), animationNode.isKeyframeEffect()); 112 DEFINE_TYPE_CASTS(KeyframeEffect, AnimationEffectReadOnly, animationNode, animat ionNode->isKeyframeEffect(), animationNode.isKeyframeEffect());
121 113
122 } // namespace blink 114 } // namespace blink
123 115
124 #endif // KeyframeEffect_h 116 #endif // KeyframeEffect_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698