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(); |
| 72 #if !ENABLE(OILPAN) |
73 void notifyElementDestroyed(); | 73 void notifyElementDestroyed(); |
| 74 #endif |
74 | 75 |
75 bool isCandidateForAnimationOnCompositor() const; | 76 bool isCandidateForAnimationOnCompositor() const; |
76 // Must only be called once. | 77 // Must only be called once. |
77 bool maybeStartAnimationOnCompositor(double startTime); | 78 bool maybeStartAnimationOnCompositor(double startTime); |
78 bool hasActiveAnimationsOnCompositor() const; | 79 bool hasActiveAnimationsOnCompositor() const; |
79 bool hasActiveAnimationsOnCompositor(CSSPropertyID) const; | 80 bool hasActiveAnimationsOnCompositor(CSSPropertyID) const; |
80 void cancelAnimationOnCompositor(); | 81 void cancelAnimationOnCompositor(); |
81 void pauseAnimationForTestingOnCompositor(double pauseTime); | 82 void pauseAnimationForTestingOnCompositor(double pauseTime); |
82 | 83 |
| 84 virtual void trace(Visitor*); |
| 85 |
83 protected: | 86 protected: |
84 void applyEffects(); | 87 void applyEffects(); |
85 void clearEffects(); | 88 void clearEffects(); |
86 virtual void updateChildrenAndEffects() const OVERRIDE; | 89 virtual void updateChildrenAndEffects() const OVERRIDE; |
87 virtual void didAttach() OVERRIDE; | 90 virtual void attach(AnimationPlayer*) OVERRIDE; |
88 virtual void willDetach() OVERRIDE; | 91 virtual void detach() OVERRIDE; |
89 virtual void specifiedTimingChanged() OVERRIDE; | 92 virtual void specifiedTimingChanged() OVERRIDE; |
90 virtual double calculateTimeToEffectChange(bool forwards, double inheritedTi
me, double timeToNextIteration) const OVERRIDE; | 93 virtual double calculateTimeToEffectChange(bool forwards, double inheritedTi
me, double timeToNextIteration) const OVERRIDE; |
91 | 94 |
92 private: | 95 private: |
93 Animation(Element*, PassRefPtrWillBeRawPtr<AnimationEffect>, const Timing&,
Priority, PassOwnPtr<EventDelegate>); | 96 Animation(Element*, PassRefPtrWillBeRawPtr<AnimationEffect>, const Timing&,
Priority, PassOwnPtr<EventDelegate>); |
94 | 97 |
95 Element* m_target; | 98 RawPtrWillBeMember<Element> m_target; |
96 RefPtrWillBePersistent<AnimationEffect> m_effect; | 99 RefPtrWillBeMember<AnimationEffect> m_effect; |
97 | 100 RawPtrWillBeMember<SampledEffect> m_sampledEffect; |
98 SampledEffect* m_sampledEffect; | |
99 | 101 |
100 Priority m_priority; | 102 Priority m_priority; |
101 | 103 |
102 Vector<int> m_compositorAnimationIds; | 104 Vector<int> m_compositorAnimationIds; |
103 | 105 |
104 friend class AnimationAnimationV8Test; | 106 friend class AnimationAnimationV8Test; |
105 }; | 107 }; |
106 | 108 |
107 DEFINE_TYPE_CASTS(Animation, TimedItem, timedItem, timedItem->isAnimation(), tim
edItem.isAnimation()); | 109 DEFINE_TYPE_CASTS(Animation, TimedItem, timedItem, timedItem->isAnimation(), tim
edItem.isAnimation()); |
108 | 110 |
109 } // namespace WebCore | 111 } // namespace WebCore |
110 | 112 |
111 #endif | 113 #endif |
OLD | NEW |