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

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

Issue 2110683004: cc: Move filters to the effect tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments Created 4 years, 5 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/damage_tracker_unittest.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 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 15 matching lines...) Expand all
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 has_potential_transform_animation_ = false; 32 has_potential_transform_animation_ = false;
33 transform_is_currently_animating_ = false; 33 transform_is_currently_animating_ = false;
34 has_potential_opacity_animation_ = false; 34 has_potential_opacity_animation_ = false;
35 opacity_is_currently_animating_ = false; 35 opacity_is_currently_animating_ = false;
36 has_potential_filter_animation_ = false;
37 filter_is_currently_animating_ = false;
36 38
37 for (int i = 0; i <= TargetProperty::LAST_TARGET_PROPERTY; ++i) 39 for (int i = 0; i <= TargetProperty::LAST_TARGET_PROPERTY; ++i)
38 mutated_properties_[i] = false; 40 mutated_properties_[i] = false;
39 } 41 }
40 42
41 int TestLayer::transform_x() const { 43 int TestLayer::transform_x() const {
42 gfx::Vector2dF vec = transform_.To2dTranslation(); 44 gfx::Vector2dF vec = transform_.To2dTranslation();
43 return static_cast<int>(vec.x()); 45 return static_cast<int>(vec.x());
44 } 46 }
45 47
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 layer->set_opacity_is_currently_animating(is_animating); 163 layer->set_opacity_is_currently_animating(is_animating);
162 break; 164 break;
163 case AnimationChangeType::BOTH: 165 case AnimationChangeType::BOTH:
164 layer->set_has_potential_opacity_animation(is_animating); 166 layer->set_has_potential_opacity_animation(is_animating);
165 layer->set_opacity_is_currently_animating(is_animating); 167 layer->set_opacity_is_currently_animating(is_animating);
166 break; 168 break;
167 } 169 }
168 } 170 }
169 } 171 }
170 172
173 void TestHostClient::ElementFilterIsAnimatingChanged(
174 ElementId element_id,
175 ElementListType list_type,
176 AnimationChangeType change_type,
177 bool is_animating) {
178 TestLayer* layer = FindTestLayer(element_id, list_type);
179 if (layer) {
180 switch (change_type) {
181 case AnimationChangeType::POTENTIAL:
182 layer->set_has_potential_filter_animation(is_animating);
183 break;
184 case AnimationChangeType::RUNNING:
185 layer->set_filter_is_currently_animating(is_animating);
186 break;
187 case AnimationChangeType::BOTH:
188 layer->set_has_potential_filter_animation(is_animating);
189 layer->set_filter_is_currently_animating(is_animating);
190 break;
191 }
192 }
193 }
194
171 void TestHostClient::SetScrollOffsetForAnimation( 195 void TestHostClient::SetScrollOffsetForAnimation(
172 const gfx::ScrollOffset& scroll_offset) { 196 const gfx::ScrollOffset& scroll_offset) {
173 scroll_offset_ = scroll_offset; 197 scroll_offset_ = scroll_offset;
174 } 198 }
175 199
176 gfx::ScrollOffset TestHostClient::GetScrollOffsetForAnimation( 200 gfx::ScrollOffset TestHostClient::GetScrollOffsetForAnimation(
177 ElementId element_id) const { 201 ElementId element_id) const {
178 return scroll_offset_; 202 return scroll_offset_;
179 } 203 }
180 204
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 } 289 }
266 290
267 bool TestHostClient::GetHasPotentialOpacityAnimation( 291 bool TestHostClient::GetHasPotentialOpacityAnimation(
268 ElementId element_id, 292 ElementId element_id,
269 ElementListType list_type) const { 293 ElementListType list_type) const {
270 TestLayer* layer = FindTestLayer(element_id, list_type); 294 TestLayer* layer = FindTestLayer(element_id, list_type);
271 EXPECT_TRUE(layer); 295 EXPECT_TRUE(layer);
272 return layer->has_potential_opacity_animation(); 296 return layer->has_potential_opacity_animation();
273 } 297 }
274 298
299 bool TestHostClient::GetFilterIsCurrentlyAnimating(
300 ElementId element_id,
301 ElementListType list_type) const {
302 TestLayer* layer = FindTestLayer(element_id, list_type);
303 EXPECT_TRUE(layer);
304 return layer->filter_is_currently_animating();
305 }
306
307 bool TestHostClient::GetHasPotentialFilterAnimation(
308 ElementId element_id,
309 ElementListType list_type) const {
310 TestLayer* layer = FindTestLayer(element_id, list_type);
311 EXPECT_TRUE(layer);
312 return layer->has_potential_filter_animation();
313 }
314
275 void TestHostClient::ExpectFilterPropertyMutated(ElementId element_id, 315 void TestHostClient::ExpectFilterPropertyMutated(ElementId element_id,
276 ElementListType list_type, 316 ElementListType list_type,
277 float brightness) const { 317 float brightness) const {
278 TestLayer* layer = FindTestLayer(element_id, list_type); 318 TestLayer* layer = FindTestLayer(element_id, list_type);
279 EXPECT_TRUE(layer); 319 EXPECT_TRUE(layer);
280 EXPECT_TRUE(layer->is_property_mutated(TargetProperty::FILTER)); 320 EXPECT_TRUE(layer->is_property_mutated(TargetProperty::FILTER));
281 EXPECT_EQ(brightness, layer->brightness()); 321 EXPECT_EQ(brightness, layer->brightness());
282 } 322 }
283 323
284 void TestHostClient::ExpectOpacityPropertyMutated(ElementId element_id, 324 void TestHostClient::ExpectOpacityPropertyMutated(ElementId element_id,
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 return element_animations ? element_animations->players_list().head()->value() 506 return element_animations ? element_animations->players_list().head()->value()
467 : nullptr; 507 : nullptr;
468 } 508 }
469 509
470 int AnimationTimelinesTest::NextTestLayerId() { 510 int AnimationTimelinesTest::NextTestLayerId() {
471 next_test_layer_id_++; 511 next_test_layer_id_++;
472 return next_test_layer_id_; 512 return next_test_layer_id_;
473 } 513 }
474 514
475 } // namespace cc 515 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/animation_timelines_test_common.h ('k') | cc/trees/damage_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698