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

Side by Side Diff: cc/test/animation_test_common.h

Issue 1882733005: CC Animation: Make LayerAnimationController to have just one value observer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@privatelac
Patch Set: Fix codereview issues. Created 4 years, 8 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
« no previous file with comments | « cc/animation/layer_animation_value_observer.h ('k') | cc/test/animation_test_common.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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(LayerTreeType tree_type) const {
94 float opacity() const { return opacity_; } 97 return filters_[ToIndex(tree_type)];
95 const gfx::Transform& transform() const { return transform_; } 98 }
96 gfx::ScrollOffset scroll_offset() { return scroll_offset_; } 99 float opacity(LayerTreeType tree_type) const {
100 return opacity_[ToIndex(tree_type)];
101 }
102 const gfx::Transform& transform(LayerTreeType tree_type) const {
103 return transform_[ToIndex(tree_type)];
104 }
105 gfx::ScrollOffset scroll_offset(LayerTreeType tree_type) {
106 return scroll_offset_[ToIndex(tree_type)];
107 }
97 108
98 bool animation_waiting_for_deletion() { 109 bool animation_waiting_for_deletion() {
99 return animation_waiting_for_deletion_; 110 return animation_waiting_for_deletion_;
100 } 111 }
101 112
102 bool transform_is_animating() { return transform_is_animating_; } 113 bool transform_is_animating(LayerTreeType tree_type) {
114 return transform_is_animating_[ToIndex(tree_type)];
115 }
103 116
104 private: 117 private:
105 FilterOperations filters_; 118 static int ToIndex(LayerTreeType tree_type);
106 float opacity_; 119
107 gfx::Transform transform_; 120 FilterOperations filters_[2];
108 gfx::ScrollOffset scroll_offset_; 121 float opacity_[2];
122 gfx::Transform transform_[2];
123 gfx::ScrollOffset scroll_offset_[2];
109 bool animation_waiting_for_deletion_; 124 bool animation_waiting_for_deletion_;
110 bool transform_is_animating_; 125 bool transform_is_animating_[2];
111 };
112
113 class FakeInactiveLayerAnimationValueObserver
114 : public FakeLayerAnimationValueObserver {
115 public:
116 bool IsActive() const override;
117 }; 126 };
118 127
119 class FakeLayerAnimationValueProvider : public LayerAnimationValueProvider { 128 class FakeLayerAnimationValueProvider : public LayerAnimationValueProvider {
120 public: 129 public:
121 gfx::ScrollOffset ScrollOffsetForAnimation() const override; 130 gfx::ScrollOffset ScrollOffsetForAnimation() const override;
122 131
123 void set_scroll_offset(const gfx::ScrollOffset& scroll_offset) { 132 void set_scroll_offset(const gfx::ScrollOffset& scroll_offset) {
124 scroll_offset_ = scroll_offset; 133 scroll_offset_ = scroll_offset;
125 } 134 }
126 135
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 float end_opacity, 227 float end_opacity,
219 bool use_timing_function); 228 bool use_timing_function);
220 229
221 void AbortAnimationsOnLayerWithPlayer(int layer_id, 230 void AbortAnimationsOnLayerWithPlayer(int layer_id,
222 scoped_refptr<AnimationTimeline> timeline, 231 scoped_refptr<AnimationTimeline> timeline,
223 TargetProperty::Type target_property); 232 TargetProperty::Type target_property);
224 233
225 } // namespace cc 234 } // namespace cc
226 235
227 #endif // CC_TEST_ANIMATION_TEST_COMMON_H_ 236 #endif // CC_TEST_ANIMATION_TEST_COMMON_H_
OLDNEW
« no previous file with comments | « cc/animation/layer_animation_value_observer.h ('k') | cc/test/animation_test_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698