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 #include "cc/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "cc/animation/animation_curve.h" | 9 #include "cc/animation/animation_curve.h" |
10 #include "cc/animation/animation_host.h" | 10 #include "cc/animation/animation_host.h" |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 | 479 |
480 void DidCommit() override { | 480 void DidCommit() override { |
481 if (layer_tree_host()->source_frame_number() == 1) { | 481 if (layer_tree_host()->source_frame_number() == 1) { |
482 AttachPlayersToTimeline(); | 482 AttachPlayersToTimeline(); |
483 | 483 |
484 scoped_refptr<Layer> layer = Layer::Create(); | 484 scoped_refptr<Layer> layer = Layer::Create(); |
485 player_->AttachLayer(layer->id()); | 485 player_->AttachLayer(layer->id()); |
486 player_->set_layer_animation_delegate(this); | 486 player_->set_layer_animation_delegate(this); |
487 | 487 |
488 // Any valid AnimationCurve will do here. | 488 // Any valid AnimationCurve will do here. |
489 scoped_ptr<AnimationCurve> curve(new FakeFloatAnimationCurve()); | 489 std::unique_ptr<AnimationCurve> curve(new FakeFloatAnimationCurve()); |
490 scoped_ptr<Animation> animation( | 490 std::unique_ptr<Animation> animation( |
491 Animation::Create(std::move(curve), 1, 1, TargetProperty::OPACITY)); | 491 Animation::Create(std::move(curve), 1, 1, TargetProperty::OPACITY)); |
492 player_->AddAnimation(std::move(animation)); | 492 player_->AddAnimation(std::move(animation)); |
493 | 493 |
494 // We add the animation *before* attaching the layer to the tree. | 494 // We add the animation *before* attaching the layer to the tree. |
495 layer_tree_host()->root_layer()->AddChild(layer); | 495 layer_tree_host()->root_layer()->AddChild(layer); |
496 } | 496 } |
497 } | 497 } |
498 | 498 |
499 void AnimateLayers(LayerTreeHostImpl* impl_host, | 499 void AnimateLayers(LayerTreeHostImpl* impl_host, |
500 base::TimeTicks monotonic_time) override { | 500 base::TimeTicks monotonic_time) override { |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 | 723 |
724 AttachPlayersToTimeline(); | 724 AttachPlayersToTimeline(); |
725 player_child_->AttachLayer(scroll_layer_->id()); | 725 player_child_->AttachLayer(scroll_layer_->id()); |
726 } | 726 } |
727 | 727 |
728 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 728 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
729 | 729 |
730 void DidCommit() override { | 730 void DidCommit() override { |
731 switch (layer_tree_host()->source_frame_number()) { | 731 switch (layer_tree_host()->source_frame_number()) { |
732 case 1: { | 732 case 1: { |
733 scoped_ptr<ScrollOffsetAnimationCurve> curve( | 733 std::unique_ptr<ScrollOffsetAnimationCurve> curve( |
734 ScrollOffsetAnimationCurve::Create( | 734 ScrollOffsetAnimationCurve::Create( |
735 gfx::ScrollOffset(500.f, 550.f), | 735 gfx::ScrollOffset(500.f, 550.f), |
736 EaseInOutTimingFunction::Create())); | 736 EaseInOutTimingFunction::Create())); |
737 scoped_ptr<Animation> animation(Animation::Create( | 737 std::unique_ptr<Animation> animation(Animation::Create( |
738 std::move(curve), 1, 0, TargetProperty::SCROLL_OFFSET)); | 738 std::move(curve), 1, 0, TargetProperty::SCROLL_OFFSET)); |
739 animation->set_needs_synchronized_start_time(true); | 739 animation->set_needs_synchronized_start_time(true); |
740 bool impl_scrolling_supported = | 740 bool impl_scrolling_supported = |
741 layer_tree_host()->proxy()->SupportsImplScrolling(); | 741 layer_tree_host()->proxy()->SupportsImplScrolling(); |
742 if (impl_scrolling_supported) | 742 if (impl_scrolling_supported) |
743 player_child_->AddAnimation(std::move(animation)); | 743 player_child_->AddAnimation(std::move(animation)); |
744 else | 744 else |
745 EndTest(); | 745 EndTest(); |
746 break; | 746 break; |
747 } | 747 } |
(...skipping 27 matching lines...) Expand all Loading... |
775 void SetupTree() override { | 775 void SetupTree() override { |
776 LayerTreeHostAnimationTest::SetupTree(); | 776 LayerTreeHostAnimationTest::SetupTree(); |
777 | 777 |
778 scroll_layer_ = FakePictureLayer::Create(&client_); | 778 scroll_layer_ = FakePictureLayer::Create(&client_); |
779 scroll_layer_->SetScrollClipLayerId(layer_tree_host()->root_layer()->id()); | 779 scroll_layer_->SetScrollClipLayerId(layer_tree_host()->root_layer()->id()); |
780 scroll_layer_->SetBounds(gfx::Size(10000, 10000)); | 780 scroll_layer_->SetBounds(gfx::Size(10000, 10000)); |
781 client_.set_bounds(scroll_layer_->bounds()); | 781 client_.set_bounds(scroll_layer_->bounds()); |
782 scroll_layer_->SetScrollOffset(gfx::ScrollOffset(100.0, 200.0)); | 782 scroll_layer_->SetScrollOffset(gfx::ScrollOffset(100.0, 200.0)); |
783 layer_tree_host()->root_layer()->AddChild(scroll_layer_); | 783 layer_tree_host()->root_layer()->AddChild(scroll_layer_); |
784 | 784 |
785 scoped_ptr<ScrollOffsetAnimationCurve> curve( | 785 std::unique_ptr<ScrollOffsetAnimationCurve> curve( |
786 ScrollOffsetAnimationCurve::Create(gfx::ScrollOffset(6500.f, 7500.f), | 786 ScrollOffsetAnimationCurve::Create(gfx::ScrollOffset(6500.f, 7500.f), |
787 EaseInOutTimingFunction::Create())); | 787 EaseInOutTimingFunction::Create())); |
788 scoped_ptr<Animation> animation(Animation::Create( | 788 std::unique_ptr<Animation> animation(Animation::Create( |
789 std::move(curve), 1, 0, TargetProperty::SCROLL_OFFSET)); | 789 std::move(curve), 1, 0, TargetProperty::SCROLL_OFFSET)); |
790 animation->set_needs_synchronized_start_time(true); | 790 animation->set_needs_synchronized_start_time(true); |
791 | 791 |
792 AttachPlayersToTimeline(); | 792 AttachPlayersToTimeline(); |
793 player_child_->AttachLayer(scroll_layer_->id()); | 793 player_child_->AttachLayer(scroll_layer_->id()); |
794 player_child_->AddAnimation(std::move(animation)); | 794 player_child_->AddAnimation(std::move(animation)); |
795 } | 795 } |
796 | 796 |
797 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 797 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
798 | 798 |
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1639 private: | 1639 private: |
1640 scoped_refptr<Layer> layer_; | 1640 scoped_refptr<Layer> layer_; |
1641 FakeContentLayerClient client_; | 1641 FakeContentLayerClient client_; |
1642 }; | 1642 }; |
1643 | 1643 |
1644 MULTI_THREAD_TEST_F( | 1644 MULTI_THREAD_TEST_F( |
1645 LayerTreeHostAnimationTestRebuildPropertyTreesOnAnimationSetNeedsCommit); | 1645 LayerTreeHostAnimationTestRebuildPropertyTreesOnAnimationSetNeedsCommit); |
1646 | 1646 |
1647 } // namespace | 1647 } // namespace |
1648 } // namespace cc | 1648 } // namespace cc |
OLD | NEW |