| 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 28 matching lines...) Expand all Loading... |
| 39 #include "wtf/RefPtr.h" | 39 #include "wtf/RefPtr.h" |
| 40 | 40 |
| 41 namespace WebCore { | 41 namespace WebCore { |
| 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 TimedItem { | 48 class Animation FINAL : public TimedItem { |
| 49 | |
| 50 public: | 49 public: |
| 51 enum Priority { DefaultPriority, TransitionPriority }; | 50 enum Priority { DefaultPriority, TransitionPriority }; |
| 52 | 51 |
| 53 static PassRefPtr<Animation> create(PassRefPtr<Element>, PassRefPtrWillBeRaw
Ptr<AnimationEffect>, const Timing&, Priority = DefaultPriority, PassOwnPtr<Even
tDelegate> = nullptr); | 52 static PassRefPtrWillBeRawPtr<Animation> create(PassRefPtr<Element>, PassRef
PtrWillBeRawPtr<AnimationEffect>, const Timing&, Priority = DefaultPriority, Pas
sOwnPtr<EventDelegate> = nullptr); |
| 54 // Web Animations API Bindings constructors. | 53 // Web Animations API Bindings constructors. |
| 55 static PassRefPtr<Animation> create(Element*, PassRefPtrWillBeRawPtr<Animati
onEffect>, const Dictionary& timingInputDictionary); | 54 static PassRefPtrWillBeRawPtr<Animation> create(Element*, PassRefPtrWillBeRa
wPtr<AnimationEffect>, const Dictionary& timingInputDictionary); |
| 56 static PassRefPtr<Animation> create(Element*, PassRefPtrWillBeRawPtr<Animati
onEffect>, double duration); | 55 static PassRefPtrWillBeRawPtr<Animation> create(Element*, PassRefPtrWillBeRa
wPtr<AnimationEffect>, double duration); |
| 57 static PassRefPtr<Animation> create(Element*, PassRefPtrWillBeRawPtr<Animati
onEffect>); | 56 static PassRefPtrWillBeRawPtr<Animation> create(Element*, PassRefPtrWillBeRa
wPtr<AnimationEffect>); |
| 58 static PassRefPtr<Animation> create(Element*, const Vector<Dictionary>& keyf
rameDictionaryVector, const Dictionary& timingInputDictionary, ExceptionState&); | 57 static PassRefPtrWillBeRawPtr<Animation> create(Element*, const Vector<Dicti
onary>& keyframeDictionaryVector, const Dictionary& timingInputDictionary, Excep
tionState&); |
| 59 static PassRefPtr<Animation> create(Element*, const Vector<Dictionary>& keyf
rameDictionaryVector, double duration, ExceptionState&); | 58 static PassRefPtrWillBeRawPtr<Animation> create(Element*, const Vector<Dicti
onary>& keyframeDictionaryVector, double duration, ExceptionState&); |
| 60 static PassRefPtr<Animation> create(Element*, const Vector<Dictionary>& keyf
rameDictionaryVector, ExceptionState&); | 59 static PassRefPtrWillBeRawPtr<Animation> create(Element*, const Vector<Dicti
onary>& keyframeDictionaryVector, ExceptionState&); |
| 61 | 60 |
| 62 virtual bool isAnimation() const OVERRIDE { return true; } | 61 virtual bool isAnimation() const OVERRIDE { return true; } |
| 63 | 62 |
| 64 bool affects(CSSPropertyID) const; | 63 bool affects(CSSPropertyID) const; |
| 65 const AnimationEffect* effect() const { return m_effect.get(); } | 64 const AnimationEffect* effect() const { return m_effect.get(); } |
| 66 AnimationEffect* effect() { return m_effect.get(); } | 65 AnimationEffect* effect() { return m_effect.get(); } |
| 67 Priority priority() const { return m_priority; } | 66 Priority priority() const { return m_priority; } |
| 68 Element* target() { return m_target.get(); } | 67 Element* target() { return m_target.get(); } |
| 69 | 68 |
| 70 void notifySampledEffectRemovedFromAnimationStack(); | 69 void notifySampledEffectRemovedFromAnimationStack(); |
| 71 | 70 |
| 72 bool isCandidateForAnimationOnCompositor() const; | 71 bool isCandidateForAnimationOnCompositor() const; |
| 73 // Must only be called once. | 72 // Must only be called once. |
| 74 bool maybeStartAnimationOnCompositor(double startTime); | 73 bool maybeStartAnimationOnCompositor(double startTime); |
| 75 bool hasActiveAnimationsOnCompositor() const; | 74 bool hasActiveAnimationsOnCompositor() const; |
| 76 bool hasActiveAnimationsOnCompositor(CSSPropertyID) const; | 75 bool hasActiveAnimationsOnCompositor(CSSPropertyID) const; |
| 77 void cancelAnimationOnCompositor(); | 76 void cancelAnimationOnCompositor(); |
| 78 void pauseAnimationForTestingOnCompositor(double pauseTime); | 77 void pauseAnimationForTestingOnCompositor(double pauseTime); |
| 79 | 78 |
| 79 virtual void trace(Visitor*); |
| 80 |
| 80 protected: | 81 protected: |
| 81 void applyEffects(); | 82 void applyEffects(); |
| 82 void clearEffects(); | 83 void clearEffects(); |
| 83 virtual void updateChildrenAndEffects() const OVERRIDE; | 84 virtual void updateChildrenAndEffects() const OVERRIDE; |
| 84 virtual void didAttach() OVERRIDE; | 85 virtual void attach(AnimationPlayer*) OVERRIDE; |
| 85 virtual void willDetach() OVERRIDE; | 86 virtual void detach() OVERRIDE; |
| 86 virtual void specifiedTimingChanged() OVERRIDE; | 87 virtual void specifiedTimingChanged() OVERRIDE; |
| 87 virtual double calculateTimeToEffectChange(bool forwards, double inheritedTi
me, double timeToNextIteration) const OVERRIDE; | 88 virtual double calculateTimeToEffectChange(bool forwards, double inheritedTi
me, double timeToNextIteration) const OVERRIDE; |
| 88 | 89 |
| 89 private: | 90 private: |
| 90 Animation(PassRefPtr<Element>, PassRefPtrWillBeRawPtr<AnimationEffect>, cons
t Timing&, Priority, PassOwnPtr<EventDelegate>); | 91 Animation(PassRefPtr<Element>, PassRefPtrWillBeRawPtr<AnimationEffect>, cons
t Timing&, Priority, PassOwnPtr<EventDelegate>); |
| 91 | 92 |
| 92 RefPtr<Element> m_target; | 93 RefPtr<Element> m_target; |
| 93 RefPtrWillBePersistent<AnimationEffect> m_effect; | 94 RefPtrWillBeMember<AnimationEffect> m_effect; |
| 94 | 95 RawPtrWillBeMember<SampledEffect> m_sampledEffect; |
| 95 SampledEffect* m_sampledEffect; | |
| 96 | 96 |
| 97 Priority m_priority; | 97 Priority m_priority; |
| 98 | 98 |
| 99 Vector<int> m_compositorAnimationIds; | 99 Vector<int> m_compositorAnimationIds; |
| 100 | 100 |
| 101 friend class AnimationAnimationV8Test; | 101 friend class AnimationAnimationV8Test; |
| 102 }; | 102 }; |
| 103 | 103 |
| 104 DEFINE_TYPE_CASTS(Animation, TimedItem, timedItem, timedItem->isAnimation(), tim
edItem.isAnimation()); | 104 DEFINE_TYPE_CASTS(Animation, TimedItem, timedItem, timedItem->isAnimation(), tim
edItem.isAnimation()); |
| 105 | 105 |
| 106 } // namespace WebCore | 106 } // namespace WebCore |
| 107 | 107 |
| 108 #endif | 108 #endif |
| OLD | NEW |