| 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 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 } | 718 } |
| 719 | 719 |
| 720 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 720 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 721 | 721 |
| 722 void DidCommit() override { | 722 void DidCommit() override { |
| 723 switch (layer_tree_host()->source_frame_number()) { | 723 switch (layer_tree_host()->source_frame_number()) { |
| 724 case 1: { | 724 case 1: { |
| 725 std::unique_ptr<ScrollOffsetAnimationCurve> curve( | 725 std::unique_ptr<ScrollOffsetAnimationCurve> curve( |
| 726 ScrollOffsetAnimationCurve::Create( | 726 ScrollOffsetAnimationCurve::Create( |
| 727 gfx::ScrollOffset(500.f, 550.f), | 727 gfx::ScrollOffset(500.f, 550.f), |
| 728 EaseInOutTimingFunction::Create())); | 728 CubicBezierTimingFunction::CreatePreset( |
| 729 CubicBezierTimingFunction::EaseType::EASE_IN_OUT))); |
| 729 std::unique_ptr<Animation> animation(Animation::Create( | 730 std::unique_ptr<Animation> animation(Animation::Create( |
| 730 std::move(curve), 1, 0, TargetProperty::SCROLL_OFFSET)); | 731 std::move(curve), 1, 0, TargetProperty::SCROLL_OFFSET)); |
| 731 animation->set_needs_synchronized_start_time(true); | 732 animation->set_needs_synchronized_start_time(true); |
| 732 bool impl_scrolling_supported = | 733 bool impl_scrolling_supported = |
| 733 layer_tree_host()->proxy()->SupportsImplScrolling(); | 734 layer_tree_host()->proxy()->SupportsImplScrolling(); |
| 734 if (impl_scrolling_supported) | 735 if (impl_scrolling_supported) |
| 735 player_child_->AddAnimation(std::move(animation)); | 736 player_child_->AddAnimation(std::move(animation)); |
| 736 else | 737 else |
| 737 EndTest(); | 738 EndTest(); |
| 738 break; | 739 break; |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 933 LayerTreeHostAnimationTest::SetupTree(); | 934 LayerTreeHostAnimationTest::SetupTree(); |
| 934 | 935 |
| 935 scroll_layer_ = FakePictureLayer::Create(&client_); | 936 scroll_layer_ = FakePictureLayer::Create(&client_); |
| 936 scroll_layer_->SetScrollClipLayerId(layer_tree_host()->root_layer()->id()); | 937 scroll_layer_->SetScrollClipLayerId(layer_tree_host()->root_layer()->id()); |
| 937 scroll_layer_->SetBounds(gfx::Size(10000, 10000)); | 938 scroll_layer_->SetBounds(gfx::Size(10000, 10000)); |
| 938 client_.set_bounds(scroll_layer_->bounds()); | 939 client_.set_bounds(scroll_layer_->bounds()); |
| 939 scroll_layer_->SetScrollOffset(gfx::ScrollOffset(100.0, 200.0)); | 940 scroll_layer_->SetScrollOffset(gfx::ScrollOffset(100.0, 200.0)); |
| 940 layer_tree_host()->root_layer()->AddChild(scroll_layer_); | 941 layer_tree_host()->root_layer()->AddChild(scroll_layer_); |
| 941 | 942 |
| 942 std::unique_ptr<ScrollOffsetAnimationCurve> curve( | 943 std::unique_ptr<ScrollOffsetAnimationCurve> curve( |
| 943 ScrollOffsetAnimationCurve::Create(gfx::ScrollOffset(6500.f, 7500.f), | 944 ScrollOffsetAnimationCurve::Create( |
| 944 EaseInOutTimingFunction::Create())); | 945 gfx::ScrollOffset(6500.f, 7500.f), |
| 946 CubicBezierTimingFunction::CreatePreset( |
| 947 CubicBezierTimingFunction::EaseType::EASE_IN_OUT))); |
| 945 std::unique_ptr<Animation> animation(Animation::Create( | 948 std::unique_ptr<Animation> animation(Animation::Create( |
| 946 std::move(curve), 1, 0, TargetProperty::SCROLL_OFFSET)); | 949 std::move(curve), 1, 0, TargetProperty::SCROLL_OFFSET)); |
| 947 animation->set_needs_synchronized_start_time(true); | 950 animation->set_needs_synchronized_start_time(true); |
| 948 | 951 |
| 949 AttachPlayersToTimeline(); | 952 AttachPlayersToTimeline(); |
| 950 player_child_->AttachElement(scroll_layer_->id()); | 953 player_child_->AttachElement(scroll_layer_->id()); |
| 951 player_child_->AddAnimation(std::move(animation)); | 954 player_child_->AddAnimation(std::move(animation)); |
| 952 } | 955 } |
| 953 | 956 |
| 954 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 957 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| (...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1768 private: | 1771 private: |
| 1769 scoped_refptr<Layer> layer_; | 1772 scoped_refptr<Layer> layer_; |
| 1770 FakeContentLayerClient client_; | 1773 FakeContentLayerClient client_; |
| 1771 }; | 1774 }; |
| 1772 | 1775 |
| 1773 MULTI_THREAD_TEST_F( | 1776 MULTI_THREAD_TEST_F( |
| 1774 LayerTreeHostAnimationTestRebuildPropertyTreesOnAnimationSetNeedsCommit); | 1777 LayerTreeHostAnimationTestRebuildPropertyTreesOnAnimationSetNeedsCommit); |
| 1775 | 1778 |
| 1776 } // namespace | 1779 } // namespace |
| 1777 } // namespace cc | 1780 } // namespace cc |
| OLD | NEW |