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

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

Issue 2394993002: Move Priority enum/field to KeyframeEffectReadOnly (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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 class KeyframeEffectOptions; 48 class KeyframeEffectOptions;
49 class PropertyHandle; 49 class PropertyHandle;
50 class SampledEffect; 50 class SampledEffect;
51 51
52 // Represents the effect of an Animation on an Element's properties. 52 // Represents the effect of an Animation on an Element's properties.
53 // http://w3c.github.io/web-animations/#keyframe-effect 53 // http://w3c.github.io/web-animations/#keyframe-effect
54 class CORE_EXPORT KeyframeEffect final : public KeyframeEffectReadOnly { 54 class CORE_EXPORT KeyframeEffect final : public KeyframeEffectReadOnly {
55 DEFINE_WRAPPERTYPEINFO(); 55 DEFINE_WRAPPERTYPEINFO();
56 56
57 public: 57 public:
58 enum Priority { DefaultPriority, TransitionPriority };
59
60 static KeyframeEffect* create(Element*, 58 static KeyframeEffect* create(Element*,
61 EffectModel*, 59 EffectModel*,
62 const Timing&, 60 const Timing&,
63 Priority = DefaultPriority, 61 KeyframeEffectReadOnly::Priority =
62 KeyframeEffectReadOnly::DefaultPriority,
64 EventDelegate* = nullptr); 63 EventDelegate* = nullptr);
65 // Web Animations API Bindings constructors. 64 // Web Animations API Bindings constructors.
66 static KeyframeEffect* create( 65 static KeyframeEffect* create(
67 ExecutionContext*, 66 ExecutionContext*,
68 Element*, 67 Element*,
69 const DictionarySequenceOrDictionary& effectInput, 68 const DictionarySequenceOrDictionary& effectInput,
70 double duration, 69 double duration,
71 ExceptionState&); 70 ExceptionState&);
72 static KeyframeEffect* create( 71 static KeyframeEffect* create(
73 ExecutionContext*, 72 ExecutionContext*,
74 Element*, 73 Element*,
75 const DictionarySequenceOrDictionary& effectInput, 74 const DictionarySequenceOrDictionary& effectInput,
76 const KeyframeEffectOptions& timingInput, 75 const KeyframeEffectOptions& timingInput,
77 ExceptionState&); 76 ExceptionState&);
78 static KeyframeEffect* create( 77 static KeyframeEffect* create(
79 ExecutionContext*, 78 ExecutionContext*,
80 Element*, 79 Element*,
81 const DictionarySequenceOrDictionary& effectInput, 80 const DictionarySequenceOrDictionary& effectInput,
82 ExceptionState&); 81 ExceptionState&);
83 82
84 ~KeyframeEffect() override; 83 ~KeyframeEffect() override;
85 84
86 bool isKeyframeEffect() const override { return true; } 85 bool isKeyframeEffect() const override { return true; }
87 86
88 bool affects(PropertyHandle) const; 87 bool affects(PropertyHandle) const;
89 const EffectModel* model() const { return m_model.get(); } 88 const EffectModel* model() const { return m_model.get(); }
90 EffectModel* model() { return m_model.get(); } 89 EffectModel* model() { return m_model.get(); }
91 void setModel(EffectModel* model) { m_model = model; } 90 void setModel(EffectModel* model) { m_model = model; }
92 Priority getPriority() const { return m_priority; }
93 Element* target() const { return m_target; } 91 Element* target() const { return m_target; }
94 92
95 void notifySampledEffectRemovedFromAnimationStack(); 93 void notifySampledEffectRemovedFromAnimationStack();
96 94
97 bool isCandidateForAnimationOnCompositor(double animationPlaybackRate) const; 95 bool isCandidateForAnimationOnCompositor(double animationPlaybackRate) const;
98 // Must only be called once. 96 // Must only be called once.
99 bool maybeStartAnimationOnCompositor(int group, 97 bool maybeStartAnimationOnCompositor(int group,
100 double startTime, 98 double startTime,
101 double timeOffset, 99 double timeOffset,
102 double animationPlaybackRate); 100 double animationPlaybackRate);
103 bool hasActiveAnimationsOnCompositor() const; 101 bool hasActiveAnimationsOnCompositor() const;
104 bool hasActiveAnimationsOnCompositor(CSSPropertyID) const; 102 bool hasActiveAnimationsOnCompositor(CSSPropertyID) const;
105 bool cancelAnimationOnCompositor(); 103 bool cancelAnimationOnCompositor();
106 void restartAnimationOnCompositor(); 104 void restartAnimationOnCompositor();
107 void cancelIncompatibleAnimationsOnCompositor(); 105 void cancelIncompatibleAnimationsOnCompositor();
108 void pauseAnimationForTestingOnCompositor(double pauseTime); 106 void pauseAnimationForTestingOnCompositor(double pauseTime);
109 107
110 void attachCompositedLayers(); 108 void attachCompositedLayers();
111 109
112 void setCompositorAnimationIdsForTesting( 110 void setCompositorAnimationIdsForTesting(
113 const Vector<int>& compositorAnimationIds) { 111 const Vector<int>& compositorAnimationIds) {
114 m_compositorAnimationIds = compositorAnimationIds; 112 m_compositorAnimationIds = compositorAnimationIds;
115 } 113 }
116 114
117 AnimationEffectTiming* timing() override; 115 AnimationEffectTiming* timing() override;
118 116
119 DECLARE_VIRTUAL_TRACE(); 117 DECLARE_VIRTUAL_TRACE();
120 118
121 void downgradeToNormal() { m_priority = DefaultPriority; }
122
123 protected: 119 protected:
124 void applyEffects(); 120 void applyEffects();
125 void clearEffects(); 121 void clearEffects();
126 void updateChildrenAndEffects() const override; 122 void updateChildrenAndEffects() const override;
127 void attach(Animation*) override; 123 void attach(Animation*) override;
128 void detach() override; 124 void detach() override;
129 void specifiedTimingChanged() override; 125 void specifiedTimingChanged() override;
130 double calculateTimeToEffectChange(bool forwards, 126 double calculateTimeToEffectChange(bool forwards,
131 double inheritedTime, 127 double inheritedTime,
132 double timeToNextIteration) const override; 128 double timeToNextIteration) const override;
133 virtual bool hasIncompatibleStyle(); 129 virtual bool hasIncompatibleStyle();
134 bool hasMultipleTransformProperties() const; 130 bool hasMultipleTransformProperties() const;
135 131
136 private: 132 private:
137 KeyframeEffect(Element*, 133 KeyframeEffect(Element*,
138 EffectModel*, 134 EffectModel*,
139 const Timing&, 135 const Timing&,
140 Priority, 136 KeyframeEffectReadOnly::Priority,
141 EventDelegate*); 137 EventDelegate*);
142 138
143 Priority m_priority;
144 Vector<int> m_compositorAnimationIds; 139 Vector<int> m_compositorAnimationIds;
145 140
146 friend class AnimationAnimationV8Test; 141 friend class AnimationAnimationV8Test;
147 }; 142 };
148 143
149 DEFINE_TYPE_CASTS(KeyframeEffect, 144 DEFINE_TYPE_CASTS(KeyframeEffect,
150 AnimationEffectReadOnly, 145 AnimationEffectReadOnly,
151 animationNode, 146 animationNode,
152 animationNode->isKeyframeEffect(), 147 animationNode->isKeyframeEffect(),
153 animationNode.isKeyframeEffect()); 148 animationNode.isKeyframeEffect());
154 149
155 } // namespace blink 150 } // namespace blink
156 151
157 #endif // KeyframeEffect_h 152 #endif // KeyframeEffect_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698