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

Side by Side Diff: cc/test/animation_timelines_test_common.cc

Issue 1987123002: cc : Track transform animation changes on transform tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/test/animation_timelines_test_common.h ('k') | cc/trees/layer_tree_host.h » ('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 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 #include "cc/test/animation_timelines_test_common.h" 5 #include "cc/test/animation_timelines_test_common.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "cc/animation/animation_events.h" 8 #include "cc/animation/animation_events.h"
9 #include "cc/animation/animation_id_provider.h" 9 #include "cc/animation/animation_id_provider.h"
10 #include "cc/animation/animation_player.h" 10 #include "cc/animation/animation_player.h"
(...skipping 11 matching lines...) Expand all
22 22
23 TestLayer::TestLayer() { 23 TestLayer::TestLayer() {
24 ClearMutatedProperties(); 24 ClearMutatedProperties();
25 } 25 }
26 26
27 void TestLayer::ClearMutatedProperties() { 27 void TestLayer::ClearMutatedProperties() {
28 transform_ = gfx::Transform(); 28 transform_ = gfx::Transform();
29 opacity_ = 0; 29 opacity_ = 0;
30 filters_ = FilterOperations(); 30 filters_ = FilterOperations();
31 scroll_offset_ = gfx::ScrollOffset(); 31 scroll_offset_ = gfx::ScrollOffset();
32 transform_is_animating_ = false; 32 has_potential_transform_animation_ = false;
33 transform_is_currently_animating_ = false;
33 has_potential_opacity_animation_ = false; 34 has_potential_opacity_animation_ = false;
34 opacity_is_currently_animating_ = false; 35 opacity_is_currently_animating_ = false;
35 36
36 for (int i = 0; i <= TargetProperty::LAST_TARGET_PROPERTY; ++i) 37 for (int i = 0; i <= TargetProperty::LAST_TARGET_PROPERTY; ++i)
37 mutated_properties_[i] = false; 38 mutated_properties_[i] = false;
38 } 39 }
39 40
40 int TestLayer::transform_x() const { 41 int TestLayer::transform_x() const {
41 gfx::Vector2dF vec = transform_.To2dTranslation(); 42 gfx::Vector2dF vec = transform_.To2dTranslation();
42 return static_cast<int>(vec.x()); 43 return static_cast<int>(vec.x());
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 117
117 void TestHostClient::SetElementScrollOffsetMutated( 118 void TestHostClient::SetElementScrollOffsetMutated(
118 ElementId element_id, 119 ElementId element_id,
119 ElementListType list_type, 120 ElementListType list_type,
120 const gfx::ScrollOffset& scroll_offset) { 121 const gfx::ScrollOffset& scroll_offset) {
121 TestLayer* layer = FindTestLayer(element_id, list_type); 122 TestLayer* layer = FindTestLayer(element_id, list_type);
122 if (layer) 123 if (layer)
123 layer->set_scroll_offset(scroll_offset); 124 layer->set_scroll_offset(scroll_offset);
124 } 125 }
125 126
126 void TestHostClient::ElementTransformIsPotentiallyAnimatingChanged( 127 void TestHostClient::ElementTransformIsAnimatingChanged(
127 ElementId element_id, 128 ElementId element_id,
128 ElementListType list_type, 129 ElementListType list_type,
130 AnimationChangeType change_type,
129 bool is_animating) { 131 bool is_animating) {
130 TestLayer* layer = FindTestLayer(element_id, list_type); 132 TestLayer* layer = FindTestLayer(element_id, list_type);
131 if (layer) 133 if (layer) {
132 layer->set_transform_is_animating(is_animating); 134 switch (change_type) {
135 case AnimationChangeType::POTENTIAL:
136 layer->set_has_potential_transform_animation(is_animating);
137 break;
138 case AnimationChangeType::RUNNING:
139 layer->set_transform_is_currently_animating(is_animating);
140 break;
141 case AnimationChangeType::BOTH:
142 layer->set_has_potential_transform_animation(is_animating);
143 layer->set_transform_is_currently_animating(is_animating);
144 break;
145 }
146 }
133 } 147 }
134 148
135 void TestHostClient::ElementOpacityIsAnimatingChanged( 149 void TestHostClient::ElementOpacityIsAnimatingChanged(
136 ElementId element_id, 150 ElementId element_id,
137 ElementListType list_type, 151 ElementListType list_type,
138 AnimationChangeType change_type, 152 AnimationChangeType change_type,
139 bool is_animating) { 153 bool is_animating) {
140 TestLayer* layer = FindTestLayer(element_id, list_type); 154 TestLayer* layer = FindTestLayer(element_id, list_type);
141 if (layer) { 155 if (layer) {
142 switch (change_type) { 156 switch (change_type) {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 } 233 }
220 234
221 gfx::ScrollOffset TestHostClient::GetScrollOffset( 235 gfx::ScrollOffset TestHostClient::GetScrollOffset(
222 ElementId element_id, 236 ElementId element_id,
223 ElementListType list_type) const { 237 ElementListType list_type) const {
224 TestLayer* layer = FindTestLayer(element_id, list_type); 238 TestLayer* layer = FindTestLayer(element_id, list_type);
225 EXPECT_TRUE(layer); 239 EXPECT_TRUE(layer);
226 return layer->scroll_offset(); 240 return layer->scroll_offset();
227 } 241 }
228 242
229 bool TestHostClient::GetTransformIsAnimating(ElementId element_id, 243 bool TestHostClient::GetTransformIsCurrentlyAnimating(
230 ElementListType list_type) const { 244 ElementId element_id,
245 ElementListType list_type) const {
231 TestLayer* layer = FindTestLayer(element_id, list_type); 246 TestLayer* layer = FindTestLayer(element_id, list_type);
232 EXPECT_TRUE(layer); 247 EXPECT_TRUE(layer);
233 return layer->transform_is_animating(); 248 return layer->transform_is_currently_animating();
249 }
250
251 bool TestHostClient::GetHasPotentialTransformAnimation(
252 ElementId element_id,
253 ElementListType list_type) const {
254 TestLayer* layer = FindTestLayer(element_id, list_type);
255 EXPECT_TRUE(layer);
256 return layer->has_potential_transform_animation();
234 } 257 }
235 258
236 bool TestHostClient::GetOpacityIsCurrentlyAnimating( 259 bool TestHostClient::GetOpacityIsCurrentlyAnimating(
237 ElementId element_id, 260 ElementId element_id,
238 ElementListType list_type) const { 261 ElementListType list_type) const {
239 TestLayer* layer = FindTestLayer(element_id, list_type); 262 TestLayer* layer = FindTestLayer(element_id, list_type);
240 EXPECT_TRUE(layer); 263 EXPECT_TRUE(layer);
241 return layer->opacity_is_currently_animating(); 264 return layer->opacity_is_currently_animating();
242 } 265 }
243 266
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 return element_animations ? element_animations->players_list().head()->value() 466 return element_animations ? element_animations->players_list().head()->value()
444 : nullptr; 467 : nullptr;
445 } 468 }
446 469
447 int AnimationTimelinesTest::NextTestLayerId() { 470 int AnimationTimelinesTest::NextTestLayerId() {
448 next_test_layer_id_++; 471 next_test_layer_id_++;
449 return next_test_layer_id_; 472 return next_test_layer_id_;
450 } 473 }
451 474
452 } // namespace cc 475 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/animation_timelines_test_common.h ('k') | cc/trees/layer_tree_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698