Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_TEST_ANIMATION_TEST_COMMON_H_ | 5 #ifndef CC_TEST_ANIMATION_TEST_COMMON_H_ |
| 6 #define CC_TEST_ANIMATION_TEST_COMMON_H_ | 6 #define CC_TEST_ANIMATION_TEST_COMMON_H_ |
| 7 | 7 |
| 8 #include "cc/animation/animation.h" | 8 #include "cc/animation/animation.h" |
| 9 #include "cc/animation/animation_curve.h" | 9 #include "cc/animation/animation_curve.h" |
| 10 #include "cc/animation/animation_timeline.h" | 10 #include "cc/animation/animation_timeline.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 base::TimeDelta duration_; | 74 base::TimeDelta duration_; |
| 75 float from_; | 75 float from_; |
| 76 float to_; | 76 float to_; |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 class FakeLayerAnimationValueObserver : public LayerAnimationValueObserver { | 79 class FakeLayerAnimationValueObserver : public LayerAnimationValueObserver { |
| 80 public: | 80 public: |
| 81 FakeLayerAnimationValueObserver(); | 81 FakeLayerAnimationValueObserver(); |
| 82 ~FakeLayerAnimationValueObserver() override; | 82 ~FakeLayerAnimationValueObserver() override; |
| 83 | 83 |
| 84 // LayerAnimationValueObserver implementation | 84 // LayerAnimationValueObserver implementation. |
| 85 void OnFilterAnimated(const FilterOperations& filters) override; | 85 void OnFilterAnimated(LayerTreeType tree_type, |
| 86 void OnOpacityAnimated(float opacity) override; | 86 const FilterOperations& filters) override; |
| 87 void OnTransformAnimated(const gfx::Transform& transform) override; | 87 void OnOpacityAnimated(LayerTreeType tree_type, float opacity) override; |
| 88 void OnScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset) override; | 88 void OnTransformAnimated(LayerTreeType tree_type, |
| 89 const gfx::Transform& transform) override; | |
| 90 void OnScrollOffsetAnimated(LayerTreeType tree_type, | |
| 91 const gfx::ScrollOffset& scroll_offset) override; | |
| 89 void OnAnimationWaitingForDeletion() override; | 92 void OnAnimationWaitingForDeletion() override; |
| 90 void OnTransformIsPotentiallyAnimatingChanged(bool is_animating) override; | 93 void OnTransformIsPotentiallyAnimatingChanged(LayerTreeType tree_type, |
| 91 bool IsActive() const override; | 94 bool is_animating) override; |
| 92 | 95 |
| 93 const FilterOperations& filters() const { return filters_; } | 96 const FilterOperations& filters() const { return filters_; } |
| 94 float opacity() const { return opacity_; } | 97 float opacity() const { return opacity_; } |
| 95 const gfx::Transform& transform() const { return transform_; } | 98 const gfx::Transform& transform() const { return transform_; } |
| 96 gfx::ScrollOffset scroll_offset() { return scroll_offset_; } | 99 gfx::ScrollOffset scroll_offset() { return scroll_offset_; } |
| 97 | 100 |
| 98 bool animation_waiting_for_deletion() { | 101 bool animation_waiting_for_deletion() { |
| 99 return animation_waiting_for_deletion_; | 102 return animation_waiting_for_deletion_; |
| 100 } | 103 } |
| 101 | 104 |
| 102 bool transform_is_animating() { return transform_is_animating_; } | 105 bool transform_is_animating() { return transform_is_animating_; } |
| 103 | 106 |
| 104 private: | 107 private: |
| 105 FilterOperations filters_; | 108 FilterOperations filters_; |
| 106 float opacity_; | 109 float opacity_; |
| 107 gfx::Transform transform_; | 110 gfx::Transform transform_; |
| 108 gfx::ScrollOffset scroll_offset_; | 111 gfx::ScrollOffset scroll_offset_; |
| 109 bool animation_waiting_for_deletion_; | 112 bool animation_waiting_for_deletion_; |
| 110 bool transform_is_animating_; | 113 bool transform_is_animating_; |
| 111 }; | 114 }; |
| 112 | 115 |
| 113 class FakeInactiveLayerAnimationValueObserver | 116 class FakeTypedLayerAnimationValueObserver |
|
ajuma
2016/04/14 14:01:18
Instead of having two fake observers types, can we
loyso (OOO)
2016/04/15 03:32:21
The observer (and any observations-related stuff)
loyso (OOO)
2016/04/15 03:53:27
Done.
| |
| 114 : public FakeLayerAnimationValueObserver { | 117 : public LayerAnimationValueObserver { |
| 115 public: | 118 public: |
| 116 bool IsActive() const override; | 119 FakeTypedLayerAnimationValueObserver(); |
| 120 ~FakeTypedLayerAnimationValueObserver() override; | |
| 121 | |
| 122 // LayerAnimationValueObserver implementation. | |
| 123 void OnFilterAnimated(LayerTreeType tree_type, | |
| 124 const FilterOperations& filters) override; | |
| 125 void OnOpacityAnimated(LayerTreeType tree_type, float opacity) override; | |
| 126 void OnTransformAnimated(LayerTreeType tree_type, | |
| 127 const gfx::Transform& transform) override; | |
| 128 void OnScrollOffsetAnimated(LayerTreeType tree_type, | |
| 129 const gfx::ScrollOffset& scroll_offset) override; | |
| 130 void OnAnimationWaitingForDeletion() override; | |
| 131 void OnTransformIsPotentiallyAnimatingChanged(LayerTreeType tree_type, | |
| 132 bool is_animating) override; | |
| 133 | |
| 134 const FilterOperations& filters(LayerTreeType tree_type) const { | |
| 135 return filters_[ToIndex(tree_type)]; | |
| 136 } | |
| 137 float opacity(LayerTreeType tree_type) const { | |
| 138 return opacity_[ToIndex(tree_type)]; | |
| 139 } | |
| 140 const gfx::Transform& transform(LayerTreeType tree_type) const { | |
| 141 return transform_[ToIndex(tree_type)]; | |
| 142 } | |
| 143 gfx::ScrollOffset scroll_offset(LayerTreeType tree_type) { | |
| 144 return scroll_offset_[ToIndex(tree_type)]; | |
| 145 } | |
| 146 | |
| 147 bool animation_waiting_for_deletion() { | |
| 148 return animation_waiting_for_deletion_; | |
| 149 } | |
| 150 | |
| 151 bool transform_is_animating(LayerTreeType tree_type) { | |
| 152 return transform_is_animating_[ToIndex(tree_type)]; | |
| 153 } | |
| 154 | |
| 155 private: | |
| 156 static int ToIndex(LayerTreeType tree_type); | |
| 157 | |
| 158 FilterOperations filters_[2]; | |
| 159 float opacity_[2]; | |
| 160 gfx::Transform transform_[2]; | |
| 161 gfx::ScrollOffset scroll_offset_[2]; | |
| 162 bool animation_waiting_for_deletion_; | |
| 163 bool transform_is_animating_[2]; | |
| 117 }; | 164 }; |
| 118 | 165 |
| 119 class FakeLayerAnimationValueProvider : public LayerAnimationValueProvider { | 166 class FakeLayerAnimationValueProvider : public LayerAnimationValueProvider { |
| 120 public: | 167 public: |
| 121 gfx::ScrollOffset ScrollOffsetForAnimation() const override; | 168 gfx::ScrollOffset ScrollOffsetForAnimation() const override; |
| 122 | 169 |
| 123 void set_scroll_offset(const gfx::ScrollOffset& scroll_offset) { | 170 void set_scroll_offset(const gfx::ScrollOffset& scroll_offset) { |
| 124 scroll_offset_ = scroll_offset; | 171 scroll_offset_ = scroll_offset; |
| 125 } | 172 } |
| 126 | 173 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 218 float end_opacity, | 265 float end_opacity, |
| 219 bool use_timing_function); | 266 bool use_timing_function); |
| 220 | 267 |
| 221 void AbortAnimationsOnLayerWithPlayer(int layer_id, | 268 void AbortAnimationsOnLayerWithPlayer(int layer_id, |
| 222 scoped_refptr<AnimationTimeline> timeline, | 269 scoped_refptr<AnimationTimeline> timeline, |
| 223 TargetProperty::Type target_property); | 270 TargetProperty::Type target_property); |
| 224 | 271 |
| 225 } // namespace cc | 272 } // namespace cc |
| 226 | 273 |
| 227 #endif // CC_TEST_ANIMATION_TEST_COMMON_H_ | 274 #endif // CC_TEST_ANIMATION_TEST_COMMON_H_ |
| OLD | NEW |