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

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

Issue 1921583003: CC Animation: Let MutatorHostClient deals with elements instead of layers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@elementid
Patch Set: Rename methods in ElementAnimations 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/animation/element_animations_unittest.cc ('k') | cc/test/animation_timelines_test_common.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 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 #include "cc/test/animation_test_common.h" 5 #include "cc/test/animation_test_common.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "cc/animation/animation_host.h" 8 #include "cc/animation/animation_host.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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 player->AttachLayer(layer_id); 304 player->AttachLayer(layer_id);
305 DCHECK(player->element_animations()); 305 DCHECK(player->element_animations());
306 player->AddAnimation(std::move(animation)); 306 player->AddAnimation(std::move(animation));
307 } 307 }
308 308
309 void AddAnimationToLayerWithExistingPlayer( 309 void AddAnimationToLayerWithExistingPlayer(
310 int layer_id, 310 int layer_id,
311 scoped_refptr<AnimationTimeline> timeline, 311 scoped_refptr<AnimationTimeline> timeline,
312 std::unique_ptr<Animation> animation) { 312 std::unique_ptr<Animation> animation) {
313 scoped_refptr<ElementAnimations> element_animations = 313 scoped_refptr<ElementAnimations> element_animations =
314 timeline->animation_host()->GetElementAnimationsForLayerId(layer_id); 314 timeline->animation_host()->GetElementAnimationsForElementId(layer_id);
315 DCHECK(element_animations); 315 DCHECK(element_animations);
316 element_animations->AddAnimation(std::move(animation)); 316 element_animations->AddAnimation(std::move(animation));
317 } 317 }
318 318
319 void RemoveAnimationFromLayerWithExistingPlayer( 319 void RemoveAnimationFromLayerWithExistingPlayer(
320 int layer_id, 320 int layer_id,
321 scoped_refptr<AnimationTimeline> timeline, 321 scoped_refptr<AnimationTimeline> timeline,
322 int animation_id) { 322 int animation_id) {
323 scoped_refptr<ElementAnimations> element_animations = 323 scoped_refptr<ElementAnimations> element_animations =
324 timeline->animation_host()->GetElementAnimationsForLayerId(layer_id); 324 timeline->animation_host()->GetElementAnimationsForElementId(layer_id);
325 DCHECK(element_animations); 325 DCHECK(element_animations);
326 element_animations->RemoveAnimation(animation_id); 326 element_animations->RemoveAnimation(animation_id);
327 } 327 }
328 328
329 Animation* GetAnimationFromLayerWithExistingPlayer( 329 Animation* GetAnimationFromLayerWithExistingPlayer(
330 int layer_id, 330 int layer_id,
331 scoped_refptr<AnimationTimeline> timeline, 331 scoped_refptr<AnimationTimeline> timeline,
332 int animation_id) { 332 int animation_id) {
333 scoped_refptr<ElementAnimations> element_animations = 333 scoped_refptr<ElementAnimations> element_animations =
334 timeline->animation_host()->GetElementAnimationsForLayerId(layer_id); 334 timeline->animation_host()->GetElementAnimationsForElementId(layer_id);
335 DCHECK(element_animations); 335 DCHECK(element_animations);
336 return element_animations->GetAnimationById(animation_id); 336 return element_animations->GetAnimationById(animation_id);
337 } 337 }
338 338
339 int AddAnimatedFilterToLayerWithPlayer( 339 int AddAnimatedFilterToLayerWithPlayer(
340 int layer_id, 340 int layer_id,
341 scoped_refptr<AnimationTimeline> timeline, 341 scoped_refptr<AnimationTimeline> timeline,
342 double duration, 342 double duration,
343 float start_brightness, 343 float start_brightness,
344 float end_brightness) { 344 float end_brightness) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 player->AttachLayer(layer_id); 393 player->AttachLayer(layer_id);
394 DCHECK(player->element_animations()); 394 DCHECK(player->element_animations());
395 return AddOpacityTransitionToPlayer(player.get(), duration, start_opacity, 395 return AddOpacityTransitionToPlayer(player.get(), duration, start_opacity,
396 end_opacity, use_timing_function); 396 end_opacity, use_timing_function);
397 } 397 }
398 398
399 void AbortAnimationsOnLayerWithPlayer(int layer_id, 399 void AbortAnimationsOnLayerWithPlayer(int layer_id,
400 scoped_refptr<AnimationTimeline> timeline, 400 scoped_refptr<AnimationTimeline> timeline,
401 TargetProperty::Type target_property) { 401 TargetProperty::Type target_property) {
402 scoped_refptr<ElementAnimations> element_animations = 402 scoped_refptr<ElementAnimations> element_animations =
403 timeline->animation_host()->GetElementAnimationsForLayerId(layer_id); 403 timeline->animation_host()->GetElementAnimationsForElementId(layer_id);
404 DCHECK(element_animations); 404 DCHECK(element_animations);
405 element_animations->AbortAnimations(target_property); 405 element_animations->AbortAnimations(target_property);
406 } 406 }
407 407
408 } // namespace cc 408 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/element_animations_unittest.cc ('k') | cc/test/animation_timelines_test_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698