| OLD | NEW |
| 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/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include "cc/animation/animation_curve.h" | 7 #include "cc/animation/animation_curve.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 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 if (layer_tree_host()->source_frame_number() == 1) { | 418 if (layer_tree_host()->source_frame_number() == 1) { |
| 419 AttachPlayersToTimeline(); | 419 AttachPlayersToTimeline(); |
| 420 | 420 |
| 421 scoped_refptr<Layer> layer = Layer::Create(layer_settings()); | 421 scoped_refptr<Layer> layer = Layer::Create(layer_settings()); |
| 422 player_->AttachLayer(layer->id()); | 422 player_->AttachLayer(layer->id()); |
| 423 player_->set_layer_animation_delegate(this); | 423 player_->set_layer_animation_delegate(this); |
| 424 | 424 |
| 425 // Any valid AnimationCurve will do here. | 425 // Any valid AnimationCurve will do here. |
| 426 scoped_ptr<AnimationCurve> curve(new FakeFloatAnimationCurve()); | 426 scoped_ptr<AnimationCurve> curve(new FakeFloatAnimationCurve()); |
| 427 scoped_ptr<Animation> animation( | 427 scoped_ptr<Animation> animation( |
| 428 Animation::Create(curve.Pass(), 1, 1, Animation::OPACITY)); | 428 Animation::Create(std::move(curve), 1, 1, Animation::OPACITY)); |
| 429 player_->AddAnimation(animation.Pass()); | 429 player_->AddAnimation(std::move(animation)); |
| 430 | 430 |
| 431 // We add the animation *before* attaching the layer to the tree. | 431 // We add the animation *before* attaching the layer to the tree. |
| 432 layer_tree_host()->root_layer()->AddChild(layer); | 432 layer_tree_host()->root_layer()->AddChild(layer); |
| 433 } | 433 } |
| 434 } | 434 } |
| 435 | 435 |
| 436 void AnimateLayers(LayerTreeHostImpl* impl_host, | 436 void AnimateLayers(LayerTreeHostImpl* impl_host, |
| 437 base::TimeTicks monotonic_time) override { | 437 base::TimeTicks monotonic_time) override { |
| 438 EndTest(); | 438 EndTest(); |
| 439 } | 439 } |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 | 552 |
| 553 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 553 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 554 | 554 |
| 555 void DidCommit() override { | 555 void DidCommit() override { |
| 556 switch (layer_tree_host()->source_frame_number()) { | 556 switch (layer_tree_host()->source_frame_number()) { |
| 557 case 1: { | 557 case 1: { |
| 558 scoped_ptr<ScrollOffsetAnimationCurve> curve( | 558 scoped_ptr<ScrollOffsetAnimationCurve> curve( |
| 559 ScrollOffsetAnimationCurve::Create( | 559 ScrollOffsetAnimationCurve::Create( |
| 560 gfx::ScrollOffset(500.f, 550.f), | 560 gfx::ScrollOffset(500.f, 550.f), |
| 561 EaseInOutTimingFunction::Create())); | 561 EaseInOutTimingFunction::Create())); |
| 562 scoped_ptr<Animation> animation( | 562 scoped_ptr<Animation> animation(Animation::Create( |
| 563 Animation::Create(curve.Pass(), 1, 0, Animation::SCROLL_OFFSET)); | 563 std::move(curve), 1, 0, Animation::SCROLL_OFFSET)); |
| 564 animation->set_needs_synchronized_start_time(true); | 564 animation->set_needs_synchronized_start_time(true); |
| 565 bool impl_scrolling_supported = | 565 bool impl_scrolling_supported = |
| 566 layer_tree_host()->proxy()->SupportsImplScrolling(); | 566 layer_tree_host()->proxy()->SupportsImplScrolling(); |
| 567 if (impl_scrolling_supported) | 567 if (impl_scrolling_supported) |
| 568 player_child_->AddAnimation(animation.Pass()); | 568 player_child_->AddAnimation(std::move(animation)); |
| 569 else | 569 else |
| 570 EndTest(); | 570 EndTest(); |
| 571 break; | 571 break; |
| 572 } | 572 } |
| 573 default: | 573 default: |
| 574 if (scroll_layer_->scroll_offset().x() > 10 && | 574 if (scroll_layer_->scroll_offset().x() > 10 && |
| 575 scroll_layer_->scroll_offset().y() > 20) | 575 scroll_layer_->scroll_offset().y() > 20) |
| 576 EndTest(); | 576 EndTest(); |
| 577 } | 577 } |
| 578 } | 578 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 604 scroll_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 604 scroll_layer_ = FakePictureLayer::Create(layer_settings(), &client_); |
| 605 scroll_layer_->SetScrollClipLayerId(layer_tree_host()->root_layer()->id()); | 605 scroll_layer_->SetScrollClipLayerId(layer_tree_host()->root_layer()->id()); |
| 606 scroll_layer_->SetBounds(gfx::Size(10000, 10000)); | 606 scroll_layer_->SetBounds(gfx::Size(10000, 10000)); |
| 607 scroll_layer_->SetScrollOffset(gfx::ScrollOffset(100.0, 200.0)); | 607 scroll_layer_->SetScrollOffset(gfx::ScrollOffset(100.0, 200.0)); |
| 608 layer_tree_host()->root_layer()->AddChild(scroll_layer_); | 608 layer_tree_host()->root_layer()->AddChild(scroll_layer_); |
| 609 | 609 |
| 610 scoped_ptr<ScrollOffsetAnimationCurve> curve( | 610 scoped_ptr<ScrollOffsetAnimationCurve> curve( |
| 611 ScrollOffsetAnimationCurve::Create(gfx::ScrollOffset(6500.f, 7500.f), | 611 ScrollOffsetAnimationCurve::Create(gfx::ScrollOffset(6500.f, 7500.f), |
| 612 EaseInOutTimingFunction::Create())); | 612 EaseInOutTimingFunction::Create())); |
| 613 scoped_ptr<Animation> animation( | 613 scoped_ptr<Animation> animation( |
| 614 Animation::Create(curve.Pass(), 1, 0, Animation::SCROLL_OFFSET)); | 614 Animation::Create(std::move(curve), 1, 0, Animation::SCROLL_OFFSET)); |
| 615 animation->set_needs_synchronized_start_time(true); | 615 animation->set_needs_synchronized_start_time(true); |
| 616 | 616 |
| 617 AttachPlayersToTimeline(); | 617 AttachPlayersToTimeline(); |
| 618 player_child_->AttachLayer(scroll_layer_->id()); | 618 player_child_->AttachLayer(scroll_layer_->id()); |
| 619 player_child_->AddAnimation(animation.Pass()); | 619 player_child_->AddAnimation(std::move(animation)); |
| 620 } | 620 } |
| 621 | 621 |
| 622 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 622 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 623 | 623 |
| 624 void BeginMainFrame(const BeginFrameArgs& args) override { | 624 void BeginMainFrame(const BeginFrameArgs& args) override { |
| 625 switch (layer_tree_host()->source_frame_number()) { | 625 switch (layer_tree_host()->source_frame_number()) { |
| 626 case 0: | 626 case 0: |
| 627 break; | 627 break; |
| 628 case 1: { | 628 case 1: { |
| 629 Animation* animation = player_child_->element_animations() | 629 Animation* animation = player_child_->element_animations() |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1094 private: | 1094 private: |
| 1095 scoped_refptr<Layer> layer_; | 1095 scoped_refptr<Layer> layer_; |
| 1096 FakeContentLayerClient client_; | 1096 FakeContentLayerClient client_; |
| 1097 }; | 1097 }; |
| 1098 | 1098 |
| 1099 MULTI_THREAD_TEST_F( | 1099 MULTI_THREAD_TEST_F( |
| 1100 LayerTreeHostTimelinesTestRebuildPropertyTreesOnAnimationSetNeedsCommit); | 1100 LayerTreeHostTimelinesTestRebuildPropertyTreesOnAnimationSetNeedsCommit); |
| 1101 | 1101 |
| 1102 } // namespace | 1102 } // namespace |
| 1103 } // namespace cc | 1103 } // namespace cc |
| OLD | NEW |