OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CC_ANIMATION_ANIMATION_HOST_H_ | 5 #ifndef CC_ANIMATION_ANIMATION_HOST_H_ |
6 #define CC_ANIMATION_ANIMATION_HOST_H_ | 6 #define CC_ANIMATION_ANIMATION_HOST_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "cc/animation/animation_events.h" | 14 #include "cc/animation/animation_events.h" |
15 #include "cc/base/cc_export.h" | 15 #include "cc/base/cc_export.h" |
16 | 16 |
| 17 namespace gfx { |
| 18 class ScrollOffset; |
| 19 } |
| 20 |
17 namespace cc { | 21 namespace cc { |
18 | 22 |
19 class AnimationPlayer; | 23 class AnimationPlayer; |
20 class AnimationRegistrar; | 24 class AnimationRegistrar; |
21 class AnimationTimeline; | 25 class AnimationTimeline; |
22 class LayerTreeHost; | 26 class LayerTreeHost; |
23 class LayerTreeMutatorsClient; | 27 class LayerTreeMutatorsClient; |
24 | 28 |
25 typedef std::vector<scoped_refptr<AnimationTimeline>> AnimationTimelineList; | 29 typedef std::vector<scoped_refptr<AnimationTimeline>> AnimationTimelineList; |
26 | 30 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 const gfx::BoxF& box, | 93 const gfx::BoxF& box, |
90 gfx::BoxF* bounds) const; | 94 gfx::BoxF* bounds) const; |
91 | 95 |
92 bool HasOnlyTranslationTransforms(int layer_id) const; | 96 bool HasOnlyTranslationTransforms(int layer_id) const; |
93 bool AnimationsPreserveAxisAlignment(int layer_id) const; | 97 bool AnimationsPreserveAxisAlignment(int layer_id) const; |
94 bool MaximumTargetScale(int layer_id, float* max_scale) const; | 98 bool MaximumTargetScale(int layer_id, float* max_scale) const; |
95 | 99 |
96 bool HasAnyAnimation(int layer_id) const; | 100 bool HasAnyAnimation(int layer_id) const; |
97 bool HasActiveAnimation(int layer_id) const; | 101 bool HasActiveAnimation(int layer_id) const; |
98 | 102 |
| 103 void ImplOnlyScrollAnimationCreate(int layer_id, |
| 104 const gfx::ScrollOffset& target_offset, |
| 105 const gfx::ScrollOffset& current_offset); |
| 106 bool ImplOnlyScrollAnimationUpdateTarget( |
| 107 int layer_id, |
| 108 const gfx::Vector2dF& scroll_delta, |
| 109 const gfx::ScrollOffset& max_scroll_offset, |
| 110 base::TimeTicks frame_monotonic_time); |
| 111 |
99 private: | 112 private: |
| 113 class ScrollOffsetAnimations; |
| 114 |
100 // TODO(loyso): Temporary 1:1 mapping. AnimationPlayers share | 115 // TODO(loyso): Temporary 1:1 mapping. AnimationPlayers share |
101 // LayerAnimationController for a given layer at the moment. | 116 // LayerAnimationController for a given layer at the moment. |
102 // Introduce LayersAnimations for the many AnimationPlayers to many Layers | 117 // Introduce LayersAnimations for the many AnimationPlayers to many Layers |
103 // mapping (a CC counterpart for blink::ElementAnimations). | 118 // mapping (a CC counterpart for blink::ElementAnimations). |
104 typedef base::hash_map<int, AnimationPlayer*> LayerToPlayerMap; | 119 typedef base::hash_map<int, AnimationPlayer*> LayerToPlayerMap; |
105 LayerToPlayerMap layer_to_player_map_; | 120 LayerToPlayerMap layer_to_player_map_; |
106 | 121 |
107 explicit AnimationHost(bool is_impl_instance); | 122 explicit AnimationHost(bool is_impl_instance); |
108 | 123 |
109 void PushTimelinesToImplThread(AnimationHost* host_impl) const; | 124 void PushTimelinesToImplThread(AnimationHost* host_impl) const; |
110 void RemoveTimelinesFromImplThread(AnimationHost* host_impl) const; | 125 void RemoveTimelinesFromImplThread(AnimationHost* host_impl) const; |
111 void PushPropertiesToImplThread(AnimationHost* host_impl); | 126 void PushPropertiesToImplThread(AnimationHost* host_impl); |
112 | 127 |
113 void EraseTimelines(AnimationTimelineList::iterator begin, | 128 void EraseTimelines(AnimationTimelineList::iterator begin, |
114 AnimationTimelineList::iterator end); | 129 AnimationTimelineList::iterator end); |
115 | 130 |
116 AnimationTimelineList timelines_; | 131 AnimationTimelineList timelines_; |
117 scoped_ptr<AnimationRegistrar> animation_registrar_; | 132 scoped_ptr<AnimationRegistrar> animation_registrar_; |
118 LayerTreeMutatorsClient* layer_tree_mutators_client_; | 133 LayerTreeMutatorsClient* layer_tree_mutators_client_; |
119 | 134 |
| 135 scoped_ptr<ScrollOffsetAnimations> scroll_offset_animations_; |
| 136 |
120 const bool is_impl_instance_; | 137 const bool is_impl_instance_; |
121 | 138 |
122 DISALLOW_COPY_AND_ASSIGN(AnimationHost); | 139 DISALLOW_COPY_AND_ASSIGN(AnimationHost); |
123 }; | 140 }; |
124 | 141 |
125 } // namespace cc | 142 } // namespace cc |
126 | 143 |
127 #endif // CC_ANIMATION_ANIMATION_HOST_H_ | 144 #endif // CC_ANIMATION_ANIMATION_HOST_H_ |
OLD | NEW |