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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #include "platform/bindings/ScriptWrappable.h" | 43 #include "platform/bindings/ScriptWrappable.h" |
44 #include "platform/heap/Handle.h" | 44 #include "platform/heap/Handle.h" |
45 #include "platform/wtf/RefPtr.h" | 45 #include "platform/wtf/RefPtr.h" |
46 #include "platform/wtf/Vector.h" | 46 #include "platform/wtf/Vector.h" |
47 | 47 |
48 namespace blink { | 48 namespace blink { |
49 | 49 |
50 class Animation; | 50 class Animation; |
51 class AnimationEffectReadOnly; | 51 class AnimationEffectReadOnly; |
52 class Document; | 52 class Document; |
| 53 class DocumentTimelineOptions; |
53 | 54 |
54 // DocumentTimeline is constructed and owned by Document, and tied to its | 55 // DocumentTimeline is constructed and owned by Document, and tied to its |
55 // lifecycle. | 56 // lifecycle. |
56 class CORE_EXPORT DocumentTimeline : public AnimationTimeline { | 57 class CORE_EXPORT DocumentTimeline : public AnimationTimeline { |
57 DEFINE_WRAPPERTYPEINFO(); | 58 DEFINE_WRAPPERTYPEINFO(); |
58 | 59 |
59 public: | 60 public: |
60 class PlatformTiming : public GarbageCollectedFinalized<PlatformTiming> { | 61 class PlatformTiming : public GarbageCollectedFinalized<PlatformTiming> { |
61 public: | 62 public: |
62 // Calls DocumentTimeline's wake() method after duration seconds. | 63 // Calls DocumentTimeline's wake() method after duration seconds. |
63 virtual void WakeAfter(double duration) = 0; | 64 virtual void WakeAfter(double duration) = 0; |
64 virtual void ServiceOnNextFrame() = 0; | 65 virtual void ServiceOnNextFrame() = 0; |
65 virtual ~PlatformTiming() {} | 66 virtual ~PlatformTiming() {} |
66 DEFINE_INLINE_VIRTUAL_TRACE() {} | 67 DEFINE_INLINE_VIRTUAL_TRACE() {} |
67 }; | 68 }; |
68 | 69 |
69 static DocumentTimeline* Create(Document*, PlatformTiming* = nullptr); | 70 static DocumentTimeline* Create(Document*, |
| 71 double origin_time_in_milliseconds = 0.0, |
| 72 PlatformTiming* = nullptr); |
| 73 |
| 74 // Web Animations API IDL constructor |
| 75 static DocumentTimeline* Create(ExecutionContext*, |
| 76 const DocumentTimelineOptions&); |
70 | 77 |
71 virtual ~DocumentTimeline() {} | 78 virtual ~DocumentTimeline() {} |
72 | 79 |
73 bool IsDocumentTimeline() const final { return true; } | 80 bool IsDocumentTimeline() const final { return true; } |
74 | 81 |
75 void ServiceAnimations(TimingUpdateReason); | 82 void ServiceAnimations(TimingUpdateReason); |
76 void ScheduleNextService(); | 83 void ScheduleNextService(); |
77 | 84 |
78 Animation* Play(AnimationEffectReadOnly*); | 85 Animation* Play(AnimationEffectReadOnly*); |
79 HeapVector<Member<Animation>> getAnimations(); | 86 HeapVector<Member<Animation>> getAnimations(); |
(...skipping 25 matching lines...) Expand all Loading... |
105 CompositorAnimationTimeline* CompositorTimeline() const { | 112 CompositorAnimationTimeline* CompositorTimeline() const { |
106 return compositor_timeline_.get(); | 113 return compositor_timeline_.get(); |
107 } | 114 } |
108 | 115 |
109 Document* GetDocument() { return document_.Get(); } | 116 Document* GetDocument() { return document_.Get(); } |
110 void Wake(); | 117 void Wake(); |
111 void ResetForTesting(); | 118 void ResetForTesting(); |
112 | 119 |
113 DECLARE_VIRTUAL_TRACE(); | 120 DECLARE_VIRTUAL_TRACE(); |
114 | 121 |
115 protected: | 122 private: |
116 DocumentTimeline(Document*, PlatformTiming*); | 123 DocumentTimeline(Document*, |
| 124 double origin_time_in_milliseconds, |
| 125 PlatformTiming*); |
117 | 126 |
118 private: | |
119 Member<Document> document_; | 127 Member<Document> document_; |
| 128 double origin_time_; |
120 double zero_time_; | 129 double zero_time_; |
121 bool zero_time_initialized_; | 130 bool zero_time_initialized_; |
122 unsigned outdated_animation_count_; | 131 unsigned outdated_animation_count_; |
123 // Animations which will be updated on the next frame | 132 // Animations which will be updated on the next frame |
124 // i.e. current, in effect, or had timing changed | 133 // i.e. current, in effect, or had timing changed |
125 HeapHashSet<Member<Animation>> animations_needing_update_; | 134 HeapHashSet<Member<Animation>> animations_needing_update_; |
126 HeapHashSet<WeakMember<Animation>> animations_; | 135 HeapHashSet<WeakMember<Animation>> animations_; |
127 | 136 |
128 double playback_rate_; | 137 double playback_rate_; |
129 | 138 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 172 |
164 DEFINE_TYPE_CASTS(DocumentTimeline, | 173 DEFINE_TYPE_CASTS(DocumentTimeline, |
165 AnimationTimeline, | 174 AnimationTimeline, |
166 timeline, | 175 timeline, |
167 timeline->IsDocumentTimeline(), | 176 timeline->IsDocumentTimeline(), |
168 timeline.IsDocumentTimeline()); | 177 timeline.IsDocumentTimeline()); |
169 | 178 |
170 } // namespace blink | 179 } // namespace blink |
171 | 180 |
172 #endif | 181 #endif |
OLD | NEW |