| 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 27 matching lines...) Expand all Loading... |
| 38 #include "platform/heap/Handle.h" | 38 #include "platform/heap/Handle.h" |
| 39 #include "wtf/RefPtr.h" | 39 #include "wtf/RefPtr.h" |
| 40 | 40 |
| 41 namespace blink { | 41 namespace blink { |
| 42 | 42 |
| 43 class Dictionary; | 43 class Dictionary; |
| 44 class Element; | 44 class Element; |
| 45 class ExceptionState; | 45 class ExceptionState; |
| 46 class SampledEffect; | 46 class SampledEffect; |
| 47 | 47 |
| 48 class Animation FINAL : public AnimationNode { | 48 class Animation final : public AnimationNode { |
| 49 DEFINE_WRAPPERTYPEINFO(); | 49 DEFINE_WRAPPERTYPEINFO(); |
| 50 public: | 50 public: |
| 51 enum Priority { DefaultPriority, TransitionPriority }; | 51 enum Priority { DefaultPriority, TransitionPriority }; |
| 52 | 52 |
| 53 static PassRefPtrWillBeRawPtr<Animation> create(Element*, PassRefPtrWillBeRa
wPtr<AnimationEffect>, const Timing&, Priority = DefaultPriority, PassOwnPtrWill
BeRawPtr<EventDelegate> = nullptr); | 53 static PassRefPtrWillBeRawPtr<Animation> create(Element*, PassRefPtrWillBeRa
wPtr<AnimationEffect>, const Timing&, Priority = DefaultPriority, PassOwnPtrWill
BeRawPtr<EventDelegate> = nullptr); |
| 54 // Web Animations API Bindings constructors. | 54 // Web Animations API Bindings constructors. |
| 55 static PassRefPtrWillBeRawPtr<Animation> create(Element*, PassRefPtrWillBeRa
wPtr<AnimationEffect>, const Dictionary& timingInputDictionary); | 55 static PassRefPtrWillBeRawPtr<Animation> create(Element*, PassRefPtrWillBeRa
wPtr<AnimationEffect>, const Dictionary& timingInputDictionary); |
| 56 static PassRefPtrWillBeRawPtr<Animation> create(Element*, PassRefPtrWillBeRa
wPtr<AnimationEffect>, double duration); | 56 static PassRefPtrWillBeRawPtr<Animation> create(Element*, PassRefPtrWillBeRa
wPtr<AnimationEffect>, double duration); |
| 57 static PassRefPtrWillBeRawPtr<Animation> create(Element*, PassRefPtrWillBeRa
wPtr<AnimationEffect>); | 57 static PassRefPtrWillBeRawPtr<Animation> create(Element*, PassRefPtrWillBeRa
wPtr<AnimationEffect>); |
| 58 static PassRefPtrWillBeRawPtr<Animation> create(Element*, const Vector<Dicti
onary>& keyframeDictionaryVector, const Dictionary& timingInputDictionary, Excep
tionState&); | 58 static PassRefPtrWillBeRawPtr<Animation> create(Element*, const Vector<Dicti
onary>& keyframeDictionaryVector, const Dictionary& timingInputDictionary, Excep
tionState&); |
| 59 static PassRefPtrWillBeRawPtr<Animation> create(Element*, const Vector<Dicti
onary>& keyframeDictionaryVector, double duration, ExceptionState&); | 59 static PassRefPtrWillBeRawPtr<Animation> create(Element*, const Vector<Dicti
onary>& keyframeDictionaryVector, double duration, ExceptionState&); |
| 60 static PassRefPtrWillBeRawPtr<Animation> create(Element*, const Vector<Dicti
onary>& keyframeDictionaryVector, ExceptionState&); | 60 static PassRefPtrWillBeRawPtr<Animation> create(Element*, const Vector<Dicti
onary>& keyframeDictionaryVector, ExceptionState&); |
| 61 | 61 |
| 62 virtual ~Animation(); | 62 virtual ~Animation(); |
| 63 | 63 |
| 64 virtual bool isAnimation() const OVERRIDE { return true; } | 64 virtual bool isAnimation() const override { return true; } |
| 65 | 65 |
| 66 bool affects(CSSPropertyID) const; | 66 bool affects(CSSPropertyID) const; |
| 67 const AnimationEffect* effect() const { return m_effect.get(); } | 67 const AnimationEffect* effect() const { return m_effect.get(); } |
| 68 AnimationEffect* effect() { return m_effect.get(); } | 68 AnimationEffect* effect() { return m_effect.get(); } |
| 69 Priority priority() const { return m_priority; } | 69 Priority priority() const { return m_priority; } |
| 70 Element* target() { return m_target; } | 70 Element* target() { return m_target; } |
| 71 | 71 |
| 72 void notifySampledEffectRemovedFromAnimationStack(); | 72 void notifySampledEffectRemovedFromAnimationStack(); |
| 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 playerPlaybackRate) const; |
| 78 // Must only be called once. | 78 // Must only be called once. |
| 79 bool maybeStartAnimationOnCompositor(double startTime, double timeOffset); | 79 bool maybeStartAnimationOnCompositor(double startTime, double timeOffset); |
| 80 bool maybeStartAnimationOnCompositor(double startTime, double timeOffset, do
uble playerPlaybackRate); | 80 bool maybeStartAnimationOnCompositor(double startTime, double timeOffset, do
uble playerPlaybackRate); |
| 81 bool hasActiveAnimationsOnCompositor() const; | 81 bool hasActiveAnimationsOnCompositor() const; |
| 82 bool hasActiveAnimationsOnCompositor(CSSPropertyID) const; | 82 bool hasActiveAnimationsOnCompositor(CSSPropertyID) const; |
| 83 void cancelAnimationOnCompositor(); | 83 void cancelAnimationOnCompositor(); |
| 84 void pauseAnimationForTestingOnCompositor(double pauseTime); | 84 void pauseAnimationForTestingOnCompositor(double pauseTime); |
| 85 | 85 |
| 86 virtual void trace(Visitor*); | 86 virtual void trace(Visitor*); |
| 87 | 87 |
| 88 protected: | 88 protected: |
| 89 void applyEffects(); | 89 void applyEffects(); |
| 90 void clearEffects(); | 90 void clearEffects(); |
| 91 virtual void updateChildrenAndEffects() const OVERRIDE; | 91 virtual void updateChildrenAndEffects() const override; |
| 92 virtual void attach(AnimationPlayer*) OVERRIDE; | 92 virtual void attach(AnimationPlayer*) override; |
| 93 virtual void detach() OVERRIDE; | 93 virtual void detach() override; |
| 94 virtual void specifiedTimingChanged() OVERRIDE; | 94 virtual void specifiedTimingChanged() override; |
| 95 virtual double calculateTimeToEffectChange(bool forwards, double inheritedTi
me, double timeToNextIteration) const OVERRIDE; | 95 virtual double calculateTimeToEffectChange(bool forwards, double inheritedTi
me, double timeToNextIteration) const override; |
| 96 | 96 |
| 97 private: | 97 private: |
| 98 Animation(Element*, PassRefPtrWillBeRawPtr<AnimationEffect>, const Timing&,
Priority, PassOwnPtrWillBeRawPtr<EventDelegate>); | 98 Animation(Element*, PassRefPtrWillBeRawPtr<AnimationEffect>, const Timing&,
Priority, PassOwnPtrWillBeRawPtr<EventDelegate>); |
| 99 | 99 |
| 100 RawPtrWillBeMember<Element> m_target; | 100 RawPtrWillBeMember<Element> m_target; |
| 101 RefPtrWillBeMember<AnimationEffect> m_effect; | 101 RefPtrWillBeMember<AnimationEffect> m_effect; |
| 102 RawPtrWillBeMember<SampledEffect> m_sampledEffect; | 102 RawPtrWillBeMember<SampledEffect> m_sampledEffect; |
| 103 | 103 |
| 104 Priority m_priority; | 104 Priority m_priority; |
| 105 | 105 |
| 106 Vector<int> m_compositorAnimationIds; | 106 Vector<int> m_compositorAnimationIds; |
| 107 | 107 |
| 108 friend class AnimationAnimationV8Test; | 108 friend class AnimationAnimationV8Test; |
| 109 }; | 109 }; |
| 110 | 110 |
| 111 DEFINE_TYPE_CASTS(Animation, AnimationNode, animationNode, animationNode->isAnim
ation(), animationNode.isAnimation()); | 111 DEFINE_TYPE_CASTS(Animation, AnimationNode, animationNode, animationNode->isAnim
ation(), animationNode.isAnimation()); |
| 112 | 112 |
| 113 } // namespace blink | 113 } // namespace blink |
| 114 | 114 |
| 115 #endif // Animation_h | 115 #endif // Animation_h |
| OLD | NEW |