| 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 10 matching lines...) Expand all Loading... |
| 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 Animation_h | 31 #ifndef KeyframeEffect_h |
| 32 #define Animation_h | 32 #define KeyframeEffect_h |
| 33 | 33 |
| 34 #include "core/CoreExport.h" | 34 #include "core/CoreExport.h" |
| 35 #include "core/animation/AnimationEffect.h" | 35 #include "core/animation/AnimationEffect.h" |
| 36 #include "core/animation/AnimationNode.h" | |
| 37 #include "core/animation/EffectInput.h" | 36 #include "core/animation/EffectInput.h" |
| 37 #include "core/animation/EffectModel.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 AnimationTimingProperties; | 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 class CORE_EXPORT Animation final : public AnimationNode { | 51 class CORE_EXPORT KeyframeEffect final : public AnimationEffect { |
| 52 DEFINE_WRAPPERTYPEINFO(); | 52 DEFINE_WRAPPERTYPEINFO(); |
| 53 public: | 53 public: |
| 54 enum Priority { DefaultPriority, TransitionPriority }; | 54 enum Priority { DefaultPriority, TransitionPriority }; |
| 55 | 55 |
| 56 static PassRefPtrWillBeRawPtr<Animation> create(Element*, PassRefPtrWillBeRa
wPtr<AnimationEffect>, const Timing&, Priority = DefaultPriority, PassOwnPtrWill
BeRawPtr<EventDelegate> = nullptr); | 56 static PassRefPtrWillBeRawPtr<KeyframeEffect> create(Element*, PassRefPtrWil
lBeRawPtr<EffectModel>, const Timing&, Priority = DefaultPriority, PassOwnPtrWil
lBeRawPtr<EventDelegate> = nullptr); |
| 57 // Web Animations API Bindings constructors. | 57 // Web Animations API Bindings constructors. |
| 58 static PassRefPtrWillBeRawPtr<Animation> create(Element*, const Vector<Dicti
onary>& keyframeDictionaryVector, double duration, ExceptionState&); | 58 static PassRefPtrWillBeRawPtr<KeyframeEffect> create(Element*, const Vector<
Dictionary>& keyframeDictionaryVector, double duration, ExceptionState&); |
| 59 static PassRefPtrWillBeRawPtr<Animation> create(Element*, const Vector<Dicti
onary>& keyframeDictionaryVector, const AnimationTimingProperties& timingInput,
ExceptionState&); | 59 static PassRefPtrWillBeRawPtr<KeyframeEffect> create(Element*, const Vector<
Dictionary>& keyframeDictionaryVector, const KeyframeEffectOptions& timingInput,
ExceptionState&); |
| 60 static PassRefPtrWillBeRawPtr<Animation> create(Element*, const Vector<Dicti
onary>& keyframeDictionaryVector, ExceptionState&); | 60 static PassRefPtrWillBeRawPtr<KeyframeEffect> create(Element*, const Vector<
Dictionary>& keyframeDictionaryVector, ExceptionState&); |
| 61 | 61 |
| 62 virtual ~Animation(); | 62 virtual ~KeyframeEffect(); |
| 63 | 63 |
| 64 virtual bool isAnimation() const override { return true; } | 64 virtual bool isAnimation() const override { return true; } |
| 65 | 65 |
| 66 bool affects(PropertyHandle) const; | 66 bool affects(PropertyHandle) const; |
| 67 const AnimationEffect* effect() const { return m_effect.get(); } | 67 const EffectModel* effect() const { return m_effect.get(); } |
| 68 AnimationEffect* effect() { return m_effect.get(); } | 68 EffectModel* effect() { return m_effect.get(); } |
| 69 void setEffect(PassRefPtrWillBeRawPtr<AnimationEffect> effect) { m_effect =
effect; } | 69 void setEffect(PassRefPtrWillBeRawPtr<EffectModel> effect) { m_effect = effe
ct; } |
| 70 Priority priority() const { return m_priority; } | 70 Priority priority() const { return m_priority; } |
| 71 Element* target() const { return m_target; } | 71 Element* target() const { return m_target; } |
| 72 | 72 |
| 73 #if !ENABLE(OILPAN) | 73 #if !ENABLE(OILPAN) |
| 74 void notifyElementDestroyed(); | 74 void notifyElementDestroyed(); |
| 75 #endif | 75 #endif |
| 76 | 76 |
| 77 bool isCandidateForAnimationOnCompositor(double playerPlaybackRate) const; | 77 bool isCandidateForAnimationOnCompositor(double animationPlaybackRate) const
; |
| 78 // Must only be called once. | 78 // Must only be called once. |
| 79 bool maybeStartAnimationOnCompositor(int group, double startTime, double tim
eOffset, double playerPlaybackRate); | 79 bool maybeStartAnimationOnCompositor(int group, double startTime, double tim
eOffset, double animationPlaybackRate); |
| 80 bool hasActiveAnimationsOnCompositor() const; | 80 bool hasActiveAnimationsOnCompositor() const; |
| 81 bool hasActiveAnimationsOnCompositor(CSSPropertyID) const; | 81 bool hasActiveAnimationsOnCompositor(CSSPropertyID) const; |
| 82 bool cancelAnimationOnCompositor(); | 82 bool cancelAnimationOnCompositor(); |
| 83 void restartAnimationOnCompositor(); | 83 void restartAnimationOnCompositor(); |
| 84 void cancelIncompatibleAnimationsOnCompositor(); | 84 void cancelIncompatibleAnimationsOnCompositor(); |
| 85 void pauseAnimationForTestingOnCompositor(double pauseTime); | 85 void pauseAnimationForTestingOnCompositor(double pauseTime); |
| 86 | 86 |
| 87 bool canAttachCompositedLayers() const; | 87 bool canAttachCompositedLayers() const; |
| 88 void attachCompositedLayers(); | 88 void attachCompositedLayers(); |
| 89 | 89 |
| 90 void setCompositorAnimationIdsForTesting(const Vector<int>& compositorAnimat
ionIds) { m_compositorAnimationIds = compositorAnimationIds; } | 90 void setCompositorAnimationIdsForTesting(const Vector<int>& compositorAnimat
ionIds) { m_compositorAnimationIds = compositorAnimationIds; } |
| 91 | 91 |
| 92 DECLARE_VIRTUAL_TRACE(); | 92 DECLARE_VIRTUAL_TRACE(); |
| 93 | 93 |
| 94 void downgradeToNormalAnimation() { m_priority = DefaultPriority; } | 94 void downgradeToNormal() { m_priority = DefaultPriority; } |
| 95 | 95 |
| 96 protected: | 96 protected: |
| 97 void applyEffects(); | 97 void applyEffects(); |
| 98 void clearEffects(); | 98 void clearEffects(); |
| 99 virtual void updateChildrenAndEffects() const override; | 99 virtual void updateChildrenAndEffects() const override; |
| 100 virtual void attach(AnimationPlayer*) override; | 100 virtual void attach(Animation*) override; |
| 101 virtual void detach() override; | 101 virtual void detach() override; |
| 102 virtual void specifiedTimingChanged() override; | 102 virtual void specifiedTimingChanged() override; |
| 103 virtual double calculateTimeToEffectChange(bool forwards, double inheritedTi
me, double timeToNextIteration) const override; | 103 virtual double calculateTimeToEffectChange(bool forwards, double inheritedTi
me, double timeToNextIteration) const override; |
| 104 | 104 |
| 105 private: | 105 private: |
| 106 Animation(Element*, PassRefPtrWillBeRawPtr<AnimationEffect>, const Timing&,
Priority, PassOwnPtrWillBeRawPtr<EventDelegate>); | 106 KeyframeEffect(Element*, PassRefPtrWillBeRawPtr<EffectModel>, const Timing&,
Priority, PassOwnPtrWillBeRawPtr<EventDelegate>); |
| 107 | 107 |
| 108 RawPtrWillBeMember<Element> m_target; | 108 RawPtrWillBeMember<Element> m_target; |
| 109 RefPtrWillBeMember<AnimationEffect> m_effect; | 109 RefPtrWillBeMember<EffectModel> m_effect; |
| 110 RawPtrWillBeMember<SampledEffect> m_sampledEffect; | 110 RawPtrWillBeMember<SampledEffect> m_sampledEffect; |
| 111 | 111 |
| 112 Priority m_priority; | 112 Priority m_priority; |
| 113 | 113 |
| 114 Vector<int> m_compositorAnimationIds; | 114 Vector<int> m_compositorAnimationIds; |
| 115 | 115 |
| 116 friend class AnimationAnimationV8Test; | 116 friend class AnimationAnimationV8Test; |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 DEFINE_TYPE_CASTS(Animation, AnimationNode, animationNode, animationNode->isAnim
ation(), animationNode.isAnimation()); | 119 DEFINE_TYPE_CASTS(KeyframeEffect, AnimationEffect, animationNode, animationNode-
>isAnimation(), animationNode.isAnimation()); |
| 120 | 120 |
| 121 } // namespace blink | 121 } // namespace blink |
| 122 | 122 |
| 123 #endif // Animation_h | 123 #endif // KeyframeEffect_h |
| OLD | NEW |