Chromium Code Reviews| 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(Element*, PassRefPtrWillBeRawPtr<Animati onEffect>, const Timing&, Priority = DefaultPriority, PassOwnPtr<EventDelegate> = nullptr); | 52 static PassRefPtrWillBeRawPtr<Animation> create(Element*, PassRefPtrWillBeRa wPtr<AnimationEffect>, const Timing&, Priority = DefaultPriority, PassOwnPtr<Eve ntDelegate> = 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 ~Animation(); | 61 virtual ~Animation(); |
| 63 | 62 |
| 64 virtual bool isAnimation() const OVERRIDE { return true; } | 63 virtual bool isAnimation() const OVERRIDE { return true; } |
| 65 | 64 |
| 66 bool affects(CSSPropertyID) const; | 65 bool affects(CSSPropertyID) const; |
| 67 const AnimationEffect* effect() const { return m_effect.get(); } | 66 const AnimationEffect* effect() const { return m_effect.get(); } |
| 68 AnimationEffect* effect() { return m_effect.get(); } | 67 AnimationEffect* effect() { return m_effect.get(); } |
| 69 Priority priority() const { return m_priority; } | 68 Priority priority() const { return m_priority; } |
| 70 Element* target() { return m_target; } | 69 Element* target() { return m_target; } |
| 71 | 70 |
| 72 void notifySampledEffectRemovedFromAnimationStack(); | 71 void notifySampledEffectRemovedFromAnimationStack(); |
| 73 void notifyElementDestroyed(); | 72 void notifyElementDestroyed(); |
| 74 | 73 |
| 75 bool isCandidateForAnimationOnCompositor() const; | 74 bool isCandidateForAnimationOnCompositor() const; |
| 76 // Must only be called once. | 75 // Must only be called once. |
| 77 bool maybeStartAnimationOnCompositor(double startTime); | 76 bool maybeStartAnimationOnCompositor(double startTime); |
| 78 bool hasActiveAnimationsOnCompositor() const; | 77 bool hasActiveAnimationsOnCompositor() const; |
| 79 bool hasActiveAnimationsOnCompositor(CSSPropertyID) const; | 78 bool hasActiveAnimationsOnCompositor(CSSPropertyID) const; |
| 80 void cancelAnimationOnCompositor(); | 79 void cancelAnimationOnCompositor(); |
| 81 void pauseAnimationForTestingOnCompositor(double pauseTime); | 80 void pauseAnimationForTestingOnCompositor(double pauseTime); |
| 82 | 81 |
| 82 virtual void trace(Visitor*); | |
| 83 | |
| 83 protected: | 84 protected: |
| 84 void applyEffects(); | 85 void applyEffects(); |
| 85 void clearEffects(); | 86 void clearEffects(); |
| 86 virtual void updateChildrenAndEffects() const OVERRIDE; | 87 virtual void updateChildrenAndEffects() const OVERRIDE; |
| 87 virtual void didAttach() OVERRIDE; | 88 virtual void attach(AnimationPlayer*) OVERRIDE; |
| 88 virtual void willDetach() OVERRIDE; | 89 virtual void detach() OVERRIDE; |
| 89 virtual void specifiedTimingChanged() OVERRIDE; | 90 virtual void specifiedTimingChanged() OVERRIDE; |
| 90 virtual double calculateTimeToEffectChange(bool forwards, double inheritedTi me, double timeToNextIteration) const OVERRIDE; | 91 virtual double calculateTimeToEffectChange(bool forwards, double inheritedTi me, double timeToNextIteration) const OVERRIDE; |
| 91 | 92 |
| 92 private: | 93 private: |
| 93 Animation(Element*, PassRefPtrWillBeRawPtr<AnimationEffect>, const Timing&, Priority, PassOwnPtr<EventDelegate>); | 94 Animation(Element*, PassRefPtrWillBeRawPtr<AnimationEffect>, const Timing&, Priority, PassOwnPtr<EventDelegate>); |
| 94 | 95 |
| 95 Element* m_target; | 96 Element* m_target; |
|
haraken
2014/04/29 04:47:35
Animation and Element should die together, so both
| |
| 96 RefPtrWillBePersistent<AnimationEffect> m_effect; | 97 RefPtrWillBeMember<AnimationEffect> m_effect; |
| 97 | 98 RawPtrWillBeMember<SampledEffect> m_sampledEffect; |
| 98 SampledEffect* m_sampledEffect; | |
| 99 | 99 |
| 100 Priority m_priority; | 100 Priority m_priority; |
| 101 | 101 |
| 102 Vector<int> m_compositorAnimationIds; | 102 Vector<int> m_compositorAnimationIds; |
| 103 | 103 |
| 104 friend class AnimationAnimationV8Test; | 104 friend class AnimationAnimationV8Test; |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 DEFINE_TYPE_CASTS(Animation, TimedItem, timedItem, timedItem->isAnimation(), tim edItem.isAnimation()); | 107 DEFINE_TYPE_CASTS(Animation, TimedItem, timedItem, timedItem->isAnimation(), tim edItem.isAnimation()); |
| 108 | 108 |
| 109 } // namespace WebCore | 109 } // namespace WebCore |
| 110 | 110 |
| 111 #endif | 111 #endif |
| OLD | NEW |