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 20 matching lines...) Expand all Loading... |
31 #ifndef Animation_h | 31 #ifndef Animation_h |
32 #define Animation_h | 32 #define Animation_h |
33 | 33 |
34 #include <memory> | 34 #include <memory> |
35 #include "bindings/core/v8/ExceptionState.h" | 35 #include "bindings/core/v8/ExceptionState.h" |
36 #include "bindings/core/v8/ScriptPromise.h" | 36 #include "bindings/core/v8/ScriptPromise.h" |
37 #include "bindings/core/v8/ScriptPromiseProperty.h" | 37 #include "bindings/core/v8/ScriptPromiseProperty.h" |
38 #include "core/CSSPropertyNames.h" | 38 #include "core/CSSPropertyNames.h" |
39 #include "core/CoreExport.h" | 39 #include "core/CoreExport.h" |
40 #include "core/animation/AnimationEffectReadOnly.h" | 40 #include "core/animation/AnimationEffectReadOnly.h" |
| 41 #include "core/animation/AnimationTimeline.h" |
41 #include "core/animation/CompositorAnimations.h" | 42 #include "core/animation/CompositorAnimations.h" |
42 #include "core/dom/ContextLifecycleObserver.h" | 43 #include "core/dom/ContextLifecycleObserver.h" |
43 #include "core/dom/DOMException.h" | 44 #include "core/dom/DOMException.h" |
44 #include "core/events/EventTarget.h" | 45 #include "core/events/EventTarget.h" |
45 #include "platform/animation/CompositorAnimationDelegate.h" | 46 #include "platform/animation/CompositorAnimationDelegate.h" |
46 #include "platform/animation/CompositorAnimationPlayerClient.h" | 47 #include "platform/animation/CompositorAnimationPlayerClient.h" |
47 #include "platform/bindings/ActiveScriptWrappable.h" | 48 #include "platform/bindings/ActiveScriptWrappable.h" |
48 #include "platform/graphics/CompositorElementId.h" | 49 #include "platform/graphics/CompositorElementId.h" |
49 #include "platform/heap/Handle.h" | 50 #include "platform/heap/Handle.h" |
50 #include "platform/wtf/RefPtr.h" | 51 #include "platform/wtf/RefPtr.h" |
51 | 52 |
52 namespace blink { | 53 namespace blink { |
53 | 54 |
54 class AnimationTimeline; | |
55 class CompositorAnimationPlayer; | 55 class CompositorAnimationPlayer; |
56 class Element; | 56 class Element; |
57 class ExceptionState; | 57 class ExceptionState; |
58 class TreeScope; | 58 class TreeScope; |
59 | 59 |
60 class CORE_EXPORT Animation final : public EventTargetWithInlineData, | 60 class CORE_EXPORT Animation final : public EventTargetWithInlineData, |
61 public ActiveScriptWrappable<Animation>, | 61 public ActiveScriptWrappable<Animation>, |
62 public ContextLifecycleObserver, | 62 public ContextLifecycleObserver, |
63 public CompositorAnimationDelegate, | 63 public CompositorAnimationDelegate, |
64 public CompositorAnimationPlayerClient { | 64 public CompositorAnimationPlayerClient { |
65 DEFINE_WRAPPERTYPEINFO(); | 65 DEFINE_WRAPPERTYPEINFO(); |
66 USING_GARBAGE_COLLECTED_MIXIN(Animation); | 66 USING_GARBAGE_COLLECTED_MIXIN(Animation); |
67 | 67 |
68 public: | 68 public: |
69 enum AnimationPlayState { | 69 enum AnimationPlayState { |
70 kUnset, | 70 kUnset, |
71 kIdle, | 71 kIdle, |
72 kPending, | 72 kPending, |
73 kRunning, | 73 kRunning, |
74 kPaused, | 74 kPaused, |
75 kFinished | 75 kFinished |
76 }; | 76 }; |
77 | 77 |
78 static Animation* Create(AnimationEffectReadOnly*, AnimationTimeline*); | 78 static Animation* Create(AnimationEffectReadOnly*, SuperAnimationTimeline*); |
79 | 79 |
80 // Web Animations API IDL constructors. | 80 // Web Animations API IDL constructors. |
81 static Animation* Create(ExecutionContext*, | 81 static Animation* Create(ExecutionContext*, |
82 AnimationEffectReadOnly*, | 82 AnimationEffectReadOnly*, |
83 ExceptionState&); | 83 ExceptionState&); |
84 static Animation* Create(ExecutionContext*, | 84 static Animation* Create(ExecutionContext*, |
85 AnimationEffectReadOnly*, | 85 AnimationEffectReadOnly*, |
86 AnimationTimeline*, | 86 SuperAnimationTimeline*, |
87 ExceptionState&); | 87 ExceptionState&); |
88 | 88 |
89 ~Animation(); | 89 ~Animation(); |
90 void Dispose(); | 90 void Dispose(); |
91 | 91 |
92 // Returns whether the animation is finished. | 92 // Returns whether the animation is finished. |
93 bool Update(TimingUpdateReason); | 93 bool Update(TimingUpdateReason); |
94 | 94 |
95 // timeToEffectChange returns: | 95 // timeToEffectChange returns: |
96 // infinity - if this animation is no longer in effect | 96 // infinity - if this animation is no longer in effect |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 DEFINE_ATTRIBUTE_EVENT_LISTENER(finish); | 132 DEFINE_ATTRIBUTE_EVENT_LISTENER(finish); |
133 DEFINE_ATTRIBUTE_EVENT_LISTENER(cancel); | 133 DEFINE_ATTRIBUTE_EVENT_LISTENER(cancel); |
134 | 134 |
135 const AtomicString& InterfaceName() const override; | 135 const AtomicString& InterfaceName() const override; |
136 ExecutionContext* GetExecutionContext() const override; | 136 ExecutionContext* GetExecutionContext() const override; |
137 bool HasPendingActivity() const final; | 137 bool HasPendingActivity() const final; |
138 void ContextDestroyed(ExecutionContext*) override; | 138 void ContextDestroyed(ExecutionContext*) override; |
139 | 139 |
140 double playbackRate() const; | 140 double playbackRate() const; |
141 void setPlaybackRate(double); | 141 void setPlaybackRate(double); |
142 const AnimationTimeline* timeline() const { return timeline_; } | 142 SuperAnimationTimeline* timeline() { |
143 AnimationTimeline* timeline() { return timeline_; } | 143 return static_cast<SuperAnimationTimeline*>(timeline_); |
| 144 } |
| 145 const AnimationTimeline* TimelineInternal() const { return timeline_; } |
| 146 AnimationTimeline* TimelineInternal() { return timeline_; } |
144 | 147 |
145 double CalculateStartTime(double current_time) const; | 148 double CalculateStartTime(double current_time) const; |
146 bool HasStartTime() const { return !IsNull(start_time_); } | 149 bool HasStartTime() const { return !IsNull(start_time_); } |
147 double startTime(bool& is_null) const; | 150 double startTime(bool& is_null) const; |
148 double startTime() const; | 151 double startTime() const; |
149 double StartTimeInternal() const { return start_time_; } | 152 double StartTimeInternal() const { return start_time_; } |
150 void setStartTime(double, bool is_null); | 153 void setStartTime(double, bool is_null); |
151 void SetStartTimeInternal(double); | 154 void SetStartTimeInternal(double); |
152 | 155 |
153 const AnimationEffectReadOnly* effect() const { return content_.Get(); } | 156 const AnimationEffectReadOnly* effect() const { return content_.Get(); } |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 | 370 |
368 bool effect_suppressed_; | 371 bool effect_suppressed_; |
369 | 372 |
370 FRIEND_TEST_ALL_PREFIXES(AnimationAnimationTest, | 373 FRIEND_TEST_ALL_PREFIXES(AnimationAnimationTest, |
371 NoCompositeWithoutCompositedElementId); | 374 NoCompositeWithoutCompositedElementId); |
372 }; | 375 }; |
373 | 376 |
374 } // namespace blink | 377 } // namespace blink |
375 | 378 |
376 #endif // Animation_h | 379 #endif // Animation_h |
OLD | NEW |