Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Side by Side Diff: third_party/WebKit/Source/core/animation/Animation.h

Issue 2944423003: Implement new AnimationTimeline superclass (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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/dom/ContextLifecycleObserver.h" 42 #include "core/dom/ContextLifecycleObserver.h"
42 #include "core/dom/DOMException.h" 43 #include "core/dom/DOMException.h"
43 #include "core/events/EventTarget.h" 44 #include "core/events/EventTarget.h"
44 #include "platform/animation/CompositorAnimationDelegate.h" 45 #include "platform/animation/CompositorAnimationDelegate.h"
45 #include "platform/animation/CompositorAnimationPlayerClient.h" 46 #include "platform/animation/CompositorAnimationPlayerClient.h"
46 #include "platform/bindings/ActiveScriptWrappable.h" 47 #include "platform/bindings/ActiveScriptWrappable.h"
47 #include "platform/graphics/CompositorElementId.h" 48 #include "platform/graphics/CompositorElementId.h"
48 #include "platform/heap/Handle.h" 49 #include "platform/heap/Handle.h"
49 #include "platform/wtf/RefPtr.h" 50 #include "platform/wtf/RefPtr.h"
50 51
51 namespace blink { 52 namespace blink {
52 53
53 class AnimationTimeline;
54 class CompositorAnimationPlayer; 54 class CompositorAnimationPlayer;
55 class Element; 55 class Element;
56 class ExceptionState; 56 class ExceptionState;
57 class TreeScope; 57 class TreeScope;
58 58
59 class CORE_EXPORT Animation final : public EventTargetWithInlineData, 59 class CORE_EXPORT Animation final : public EventTargetWithInlineData,
60 public ActiveScriptWrappable<Animation>, 60 public ActiveScriptWrappable<Animation>,
61 public ContextLifecycleObserver, 61 public ContextLifecycleObserver,
62 public CompositorAnimationDelegate, 62 public CompositorAnimationDelegate,
63 public CompositorAnimationPlayerClient { 63 public CompositorAnimationPlayerClient {
64 DEFINE_WRAPPERTYPEINFO(); 64 DEFINE_WRAPPERTYPEINFO();
65 USING_GARBAGE_COLLECTED_MIXIN(Animation); 65 USING_GARBAGE_COLLECTED_MIXIN(Animation);
66 66
67 public: 67 public:
68 enum AnimationPlayState { 68 enum AnimationPlayState {
69 kUnset, 69 kUnset,
70 kIdle, 70 kIdle,
71 kPending, 71 kPending,
72 kRunning, 72 kRunning,
73 kPaused, 73 kPaused,
74 kFinished 74 kFinished
75 }; 75 };
76 76
77 static Animation* Create(AnimationEffectReadOnly*, AnimationTimeline*); 77 static Animation* Create(AnimationEffectReadOnly*, SuperAnimationTimeline*);
78 78
79 // Web Animations API IDL constructors. 79 // Web Animations API IDL constructors.
80 static Animation* Create(ExecutionContext*, 80 static Animation* Create(ExecutionContext*,
81 AnimationEffectReadOnly*, 81 AnimationEffectReadOnly*,
82 ExceptionState&); 82 ExceptionState&);
83 static Animation* Create(ExecutionContext*, 83 static Animation* Create(ExecutionContext*,
84 AnimationEffectReadOnly*, 84 AnimationEffectReadOnly*,
85 AnimationTimeline*, 85 SuperAnimationTimeline*,
86 ExceptionState&); 86 ExceptionState&);
87 87
88 ~Animation(); 88 ~Animation();
89 void Dispose(); 89 void Dispose();
90 90
91 // Returns whether the animation is finished. 91 // Returns whether the animation is finished.
92 bool Update(TimingUpdateReason); 92 bool Update(TimingUpdateReason);
93 93
94 // timeToEffectChange returns: 94 // timeToEffectChange returns:
95 // infinity - if this animation is no longer in effect 95 // infinity - if this animation is no longer in effect
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 DEFINE_ATTRIBUTE_EVENT_LISTENER(finish); 131 DEFINE_ATTRIBUTE_EVENT_LISTENER(finish);
132 DEFINE_ATTRIBUTE_EVENT_LISTENER(cancel); 132 DEFINE_ATTRIBUTE_EVENT_LISTENER(cancel);
133 133
134 const AtomicString& InterfaceName() const override; 134 const AtomicString& InterfaceName() const override;
135 ExecutionContext* GetExecutionContext() const override; 135 ExecutionContext* GetExecutionContext() const override;
136 bool HasPendingActivity() const final; 136 bool HasPendingActivity() const final;
137 void ContextDestroyed(ExecutionContext*) override; 137 void ContextDestroyed(ExecutionContext*) override;
138 138
139 double playbackRate() const; 139 double playbackRate() const;
140 void setPlaybackRate(double); 140 void setPlaybackRate(double);
141 const AnimationTimeline* timeline() const { return timeline_; } 141 SuperAnimationTimeline* timeline() {
142 AnimationTimeline* timeline() { return timeline_; } 142 return static_cast<SuperAnimationTimeline*>(timeline_);
143 }
144 const AnimationTimeline* TimelineInternal() const { return timeline_; }
145 AnimationTimeline* TimelineInternal() { return timeline_; }
alancutter (OOO until 2018) 2017/06/21 05:36:17 Add TODO to remove the dependency on (future) Docu
143 146
144 double CalculateStartTime(double current_time) const; 147 double CalculateStartTime(double current_time) const;
145 bool HasStartTime() const { return !IsNull(start_time_); } 148 bool HasStartTime() const { return !IsNull(start_time_); }
146 double startTime(bool& is_null) const; 149 double startTime(bool& is_null) const;
147 double startTime() const; 150 double startTime() const;
148 double StartTimeInternal() const { return start_time_; } 151 double StartTimeInternal() const { return start_time_; }
149 void setStartTime(double, bool is_null); 152 void setStartTime(double, bool is_null);
150 void SetStartTimeInternal(double); 153 void SetStartTimeInternal(double);
151 154
152 const AnimationEffectReadOnly* effect() const { return content_.Get(); } 155 const AnimationEffectReadOnly* effect() const { return content_.Get(); }
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 369
367 bool effect_suppressed_; 370 bool effect_suppressed_;
368 371
369 FRIEND_TEST_ALL_PREFIXES(AnimationAnimationTest, 372 FRIEND_TEST_ALL_PREFIXES(AnimationAnimationTest,
370 NoCompositeWithoutCompositedElementId); 373 NoCompositeWithoutCompositedElementId);
371 }; 374 };
372 375
373 } // namespace blink 376 } // namespace blink
374 377
375 #endif // Animation_h 378 #endif // Animation_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698