| 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 21 matching lines...) Expand all Loading... |
| 32 #define SKY_ENGINE_CORE_ANIMATION_ANIMATION_H_ | 32 #define SKY_ENGINE_CORE_ANIMATION_ANIMATION_H_ |
| 33 | 33 |
| 34 #include "sky/engine/core/animation/AnimationEffect.h" | 34 #include "sky/engine/core/animation/AnimationEffect.h" |
| 35 #include "sky/engine/core/animation/AnimationNode.h" | 35 #include "sky/engine/core/animation/AnimationNode.h" |
| 36 #include "sky/engine/core/animation/EffectInput.h" | 36 #include "sky/engine/core/animation/EffectInput.h" |
| 37 #include "sky/engine/core/animation/TimingInput.h" | 37 #include "sky/engine/core/animation/TimingInput.h" |
| 38 #include "sky/engine/wtf/RefPtr.h" | 38 #include "sky/engine/wtf/RefPtr.h" |
| 39 | 39 |
| 40 namespace blink { | 40 namespace blink { |
| 41 | 41 |
| 42 class Dictionary; | |
| 43 class Element; | 42 class Element; |
| 44 class ExceptionState; | 43 class ExceptionState; |
| 45 class SampledEffect; | 44 class SampledEffect; |
| 46 | 45 |
| 47 class Animation final : public AnimationNode { | 46 class Animation final : public AnimationNode { |
| 48 DEFINE_WRAPPERTYPEINFO(); | 47 DEFINE_WRAPPERTYPEINFO(); |
| 49 public: | 48 public: |
| 50 enum Priority { DefaultPriority, TransitionPriority }; | 49 enum Priority { DefaultPriority, TransitionPriority }; |
| 51 | 50 |
| 52 static PassRefPtr<Animation> create(Element*, PassRefPtr<AnimationEffect>, c
onst Timing&, Priority = DefaultPriority, PassOwnPtr<EventDelegate> = nullptr); | 51 static PassRefPtr<Animation> create(Element*, PassRefPtr<AnimationEffect> ef
fect, const Timing&, Priority = DefaultPriority, PassOwnPtr<EventDelegate> = nul
lptr); |
| 53 // Web Animations API Bindings constructors. | 52 // Web Animations API Bindings constructors. |
| 54 static PassRefPtr<Animation> create(Element*, PassRefPtr<AnimationEffect>, c
onst Dictionary& timingInputDictionary); | 53 static PassRefPtr<Animation> create(Element*, ExceptionState&); |
| 55 static PassRefPtr<Animation> create(Element*, PassRefPtr<AnimationEffect>, d
ouble duration); | 54 static PassRefPtr<Animation> create(Element*, double duration, ExceptionStat
e&); |
| 56 static PassRefPtr<Animation> create(Element*, PassRefPtr<AnimationEffect>); | |
| 57 static PassRefPtr<Animation> create(Element*, const Vector<Dictionary>& keyf
rameDictionaryVector, const Dictionary& timingInputDictionary, ExceptionState&); | |
| 58 static PassRefPtr<Animation> create(Element*, const Vector<Dictionary>& keyf
rameDictionaryVector, double duration, ExceptionState&); | |
| 59 static PassRefPtr<Animation> create(Element*, const Vector<Dictionary>& keyf
rameDictionaryVector, ExceptionState&); | |
| 60 | 55 |
| 61 virtual ~Animation(); | 56 virtual ~Animation(); |
| 62 | 57 |
| 63 virtual bool isAnimation() const override { return true; } | 58 virtual bool isAnimation() const override { return true; } |
| 64 | 59 |
| 65 bool affects(CSSPropertyID) const; | 60 bool affects(CSSPropertyID) const; |
| 66 const AnimationEffect* effect() const { return m_effect.get(); } | 61 const AnimationEffect* effect() const { return m_effect.get(); } |
| 67 AnimationEffect* effect() { return m_effect.get(); } | 62 AnimationEffect* effect() { return m_effect.get(); } |
| 68 Priority priority() const { return m_priority; } | 63 Priority priority() const { return m_priority; } |
| 69 Element* target() { return m_target; } | 64 Element* target() { return m_target; } |
| 70 | 65 |
| 71 void notifySampledEffectRemovedFromAnimationStack(); | 66 void notifySampledEffectRemovedFromAnimationStack(); |
| 72 void notifyElementDestroyed(); | 67 void notifyElementDestroyed(); |
| 73 | 68 |
| 74 protected: | 69 protected: |
| 75 void applyEffects(); | 70 void applyEffects(); |
| 76 void clearEffects(); | 71 void clearEffects(); |
| 77 virtual void updateChildrenAndEffects() const override; | 72 virtual void updateChildrenAndEffects() const override; |
| 78 virtual void attach(AnimationPlayer*) override; | 73 virtual void attach(AnimationPlayer*) override; |
| 79 virtual void detach() override; | 74 virtual void detach() override; |
| 80 virtual void specifiedTimingChanged() override; | 75 virtual void specifiedTimingChanged() override; |
| 81 virtual double calculateTimeToEffectChange(bool forwards, double inheritedTi
me, double timeToNextIteration) const override; | 76 virtual double calculateTimeToEffectChange(bool forwards, double inheritedTi
me, double timeToNextIteration) const override; |
| 82 | 77 |
| 83 private: | 78 private: |
| 84 Animation(Element*, PassRefPtr<AnimationEffect>, const Timing&, Priority, Pa
ssOwnPtr<EventDelegate>); | 79 Animation(Element*, PassRefPtr<AnimationEffect> effect, const Timing&, Prior
ity, PassOwnPtr<EventDelegate>); |
| 85 | 80 |
| 86 RawPtr<Element> m_target; | 81 RawPtr<Element> m_target; |
| 87 RefPtr<AnimationEffect> m_effect; | 82 RefPtr<AnimationEffect> m_effect; |
| 88 RawPtr<SampledEffect> m_sampledEffect; | 83 RawPtr<SampledEffect> m_sampledEffect; |
| 89 | 84 |
| 90 Priority m_priority; | 85 Priority m_priority; |
| 91 | 86 |
| 92 friend class AnimationAnimationV8Test; | 87 friend class AnimationAnimationV8Test; |
| 93 }; | 88 }; |
| 94 | 89 |
| 95 DEFINE_TYPE_CASTS(Animation, AnimationNode, animationNode, animationNode->isAnim
ation(), animationNode.isAnimation()); | 90 DEFINE_TYPE_CASTS(Animation, AnimationNode, animationNode, animationNode->isAnim
ation(), animationNode.isAnimation()); |
| 96 | 91 |
| 97 } // namespace blink | 92 } // namespace blink |
| 98 | 93 |
| 99 #endif // SKY_ENGINE_CORE_ANIMATION_ANIMATION_H_ | 94 #endif // SKY_ENGINE_CORE_ANIMATION_ANIMATION_H_ |
| OLD | NEW |