| 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 // Evolved from LayerTreeHostAnimationTestAddAnimationWithTimingFunction. | 197 // Evolved from LayerTreeHostAnimationTestAddAnimationWithTimingFunction. |
| 198 class LayerTreeHostTimelinesTestAddAnimationWithTimingFunction | 198 class LayerTreeHostTimelinesTestAddAnimationWithTimingFunction |
| 199 : public LayerTreeHostTimelinesTest { | 199 : public LayerTreeHostTimelinesTest { |
| 200 public: | 200 public: |
| 201 LayerTreeHostTimelinesTestAddAnimationWithTimingFunction() {} | 201 LayerTreeHostTimelinesTestAddAnimationWithTimingFunction() {} |
| 202 | 202 |
| 203 void SetupTree() override { | 203 void SetupTree() override { |
| 204 LayerTreeHostTimelinesTest::SetupTree(); | 204 LayerTreeHostTimelinesTest::SetupTree(); |
| 205 picture_ = FakePictureLayer::Create(layer_settings(), &client_); | 205 picture_ = FakePictureLayer::Create(layer_settings(), &client_); |
| 206 picture_->SetBounds(gfx::Size(4, 4)); | 206 picture_->SetBounds(gfx::Size(4, 4)); |
| 207 client_.set_bounds(picture_->bounds()); |
| 207 layer_tree_host()->root_layer()->AddChild(picture_); | 208 layer_tree_host()->root_layer()->AddChild(picture_); |
| 208 | 209 |
| 209 AttachPlayersToTimeline(); | 210 AttachPlayersToTimeline(); |
| 210 player_child_->AttachLayer(picture_->id()); | 211 player_child_->AttachLayer(picture_->id()); |
| 211 } | 212 } |
| 212 | 213 |
| 213 void BeginTest() override { | 214 void BeginTest() override { |
| 214 PostAddAnimationToMainThreadPlayer(player_child_.get()); | 215 PostAddAnimationToMainThreadPlayer(player_child_.get()); |
| 215 } | 216 } |
| 216 | 217 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 // Evolved from LayerTreeHostAnimationTestSynchronizeAnimationStartTimes. | 260 // Evolved from LayerTreeHostAnimationTestSynchronizeAnimationStartTimes. |
| 260 class LayerTreeHostTimelinesTestSynchronizeAnimationStartTimes | 261 class LayerTreeHostTimelinesTestSynchronizeAnimationStartTimes |
| 261 : public LayerTreeHostTimelinesTest { | 262 : public LayerTreeHostTimelinesTest { |
| 262 public: | 263 public: |
| 263 LayerTreeHostTimelinesTestSynchronizeAnimationStartTimes() {} | 264 LayerTreeHostTimelinesTestSynchronizeAnimationStartTimes() {} |
| 264 | 265 |
| 265 void SetupTree() override { | 266 void SetupTree() override { |
| 266 LayerTreeHostTimelinesTest::SetupTree(); | 267 LayerTreeHostTimelinesTest::SetupTree(); |
| 267 picture_ = FakePictureLayer::Create(layer_settings(), &client_); | 268 picture_ = FakePictureLayer::Create(layer_settings(), &client_); |
| 268 picture_->SetBounds(gfx::Size(4, 4)); | 269 picture_->SetBounds(gfx::Size(4, 4)); |
| 270 client_.set_bounds(picture_->bounds()); |
| 269 | 271 |
| 270 layer_tree_host()->root_layer()->AddChild(picture_); | 272 layer_tree_host()->root_layer()->AddChild(picture_); |
| 271 | 273 |
| 272 AttachPlayersToTimeline(); | 274 AttachPlayersToTimeline(); |
| 273 player_child_->set_layer_animation_delegate(this); | 275 player_child_->set_layer_animation_delegate(this); |
| 274 player_child_->AttachLayer(picture_->id()); | 276 player_child_->AttachLayer(picture_->id()); |
| 275 } | 277 } |
| 276 | 278 |
| 277 void BeginTest() override { | 279 void BeginTest() override { |
| 278 PostAddAnimationToMainThreadPlayer(player_child_.get()); | 280 PostAddAnimationToMainThreadPlayer(player_child_.get()); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 class LayerTreeHostTimelinesTestDoNotSkipLayersWithAnimatedOpacity | 358 class LayerTreeHostTimelinesTestDoNotSkipLayersWithAnimatedOpacity |
| 357 : public LayerTreeHostTimelinesTest { | 359 : public LayerTreeHostTimelinesTest { |
| 358 public: | 360 public: |
| 359 LayerTreeHostTimelinesTestDoNotSkipLayersWithAnimatedOpacity() | 361 LayerTreeHostTimelinesTestDoNotSkipLayersWithAnimatedOpacity() |
| 360 : update_check_layer_( | 362 : update_check_layer_( |
| 361 FakePictureLayer::Create(layer_settings(), &client_)) {} | 363 FakePictureLayer::Create(layer_settings(), &client_)) {} |
| 362 | 364 |
| 363 void SetupTree() override { | 365 void SetupTree() override { |
| 364 update_check_layer_->SetOpacity(0.f); | 366 update_check_layer_->SetOpacity(0.f); |
| 365 layer_tree_host()->SetRootLayer(update_check_layer_); | 367 layer_tree_host()->SetRootLayer(update_check_layer_); |
| 368 client_.set_bounds(update_check_layer_->bounds()); |
| 366 LayerTreeHostTimelinesTest::SetupTree(); | 369 LayerTreeHostTimelinesTest::SetupTree(); |
| 367 | 370 |
| 368 AttachPlayersToTimeline(); | 371 AttachPlayersToTimeline(); |
| 369 player_->AttachLayer(update_check_layer_->id()); | 372 player_->AttachLayer(update_check_layer_->id()); |
| 370 } | 373 } |
| 371 | 374 |
| 372 void BeginTest() override { | 375 void BeginTest() override { |
| 373 PostAddAnimationToMainThreadPlayer(player_.get()); | 376 PostAddAnimationToMainThreadPlayer(player_.get()); |
| 374 } | 377 } |
| 375 | 378 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 | 449 |
| 447 // Animations should not be started when frames are being skipped due to | 450 // Animations should not be started when frames are being skipped due to |
| 448 // checkerboard. | 451 // checkerboard. |
| 449 // Evolved from LayerTreeHostAnimationTestCheckerboardDoesntStartAnimations. | 452 // Evolved from LayerTreeHostAnimationTestCheckerboardDoesntStartAnimations. |
| 450 class LayerTreeHostTimelinesTestCheckerboardDoesntStartAnimations | 453 class LayerTreeHostTimelinesTestCheckerboardDoesntStartAnimations |
| 451 : public LayerTreeHostTimelinesTest { | 454 : public LayerTreeHostTimelinesTest { |
| 452 void SetupTree() override { | 455 void SetupTree() override { |
| 453 LayerTreeHostTimelinesTest::SetupTree(); | 456 LayerTreeHostTimelinesTest::SetupTree(); |
| 454 picture_ = FakePictureLayer::Create(layer_settings(), &client_); | 457 picture_ = FakePictureLayer::Create(layer_settings(), &client_); |
| 455 picture_->SetBounds(gfx::Size(4, 4)); | 458 picture_->SetBounds(gfx::Size(4, 4)); |
| 459 client_.set_bounds(picture_->bounds()); |
| 456 layer_tree_host()->root_layer()->AddChild(picture_); | 460 layer_tree_host()->root_layer()->AddChild(picture_); |
| 457 | 461 |
| 458 AttachPlayersToTimeline(); | 462 AttachPlayersToTimeline(); |
| 459 player_child_->AttachLayer(picture_->id()); | 463 player_child_->AttachLayer(picture_->id()); |
| 460 player_child_->set_layer_animation_delegate(this); | 464 player_child_->set_layer_animation_delegate(this); |
| 461 } | 465 } |
| 462 | 466 |
| 463 void InitializeSettings(LayerTreeSettings* settings) override { | 467 void InitializeSettings(LayerTreeSettings* settings) override { |
| 464 // Make sure that drawing many times doesn't cause a checkerboarded | 468 // Make sure that drawing many times doesn't cause a checkerboarded |
| 465 // animation to start so we avoid flake in this test. | 469 // animation to start so we avoid flake in this test. |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 : public LayerTreeHostTimelinesTest { | 540 : public LayerTreeHostTimelinesTest { |
| 537 public: | 541 public: |
| 538 LayerTreeHostTimelinesTestScrollOffsetChangesArePropagated() {} | 542 LayerTreeHostTimelinesTestScrollOffsetChangesArePropagated() {} |
| 539 | 543 |
| 540 void SetupTree() override { | 544 void SetupTree() override { |
| 541 LayerTreeHostTimelinesTest::SetupTree(); | 545 LayerTreeHostTimelinesTest::SetupTree(); |
| 542 | 546 |
| 543 scroll_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 547 scroll_layer_ = FakePictureLayer::Create(layer_settings(), &client_); |
| 544 scroll_layer_->SetScrollClipLayerId(layer_tree_host()->root_layer()->id()); | 548 scroll_layer_->SetScrollClipLayerId(layer_tree_host()->root_layer()->id()); |
| 545 scroll_layer_->SetBounds(gfx::Size(1000, 1000)); | 549 scroll_layer_->SetBounds(gfx::Size(1000, 1000)); |
| 550 client_.set_bounds(scroll_layer_->bounds()); |
| 546 scroll_layer_->SetScrollOffset(gfx::ScrollOffset(10, 20)); | 551 scroll_layer_->SetScrollOffset(gfx::ScrollOffset(10, 20)); |
| 547 layer_tree_host()->root_layer()->AddChild(scroll_layer_); | 552 layer_tree_host()->root_layer()->AddChild(scroll_layer_); |
| 548 | 553 |
| 549 AttachPlayersToTimeline(); | 554 AttachPlayersToTimeline(); |
| 550 player_child_->AttachLayer(scroll_layer_->id()); | 555 player_child_->AttachLayer(scroll_layer_->id()); |
| 551 } | 556 } |
| 552 | 557 |
| 553 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 558 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 554 | 559 |
| 555 void DidCommit() override { | 560 void DidCommit() override { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 public: | 602 public: |
| 598 LayerTreeHostTimelinesTestScrollOffsetAnimationRemoval() | 603 LayerTreeHostTimelinesTestScrollOffsetAnimationRemoval() |
| 599 : final_postion_(50.0, 100.0) {} | 604 : final_postion_(50.0, 100.0) {} |
| 600 | 605 |
| 601 void SetupTree() override { | 606 void SetupTree() override { |
| 602 LayerTreeHostTimelinesTest::SetupTree(); | 607 LayerTreeHostTimelinesTest::SetupTree(); |
| 603 | 608 |
| 604 scroll_layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 609 scroll_layer_ = FakePictureLayer::Create(layer_settings(), &client_); |
| 605 scroll_layer_->SetScrollClipLayerId(layer_tree_host()->root_layer()->id()); | 610 scroll_layer_->SetScrollClipLayerId(layer_tree_host()->root_layer()->id()); |
| 606 scroll_layer_->SetBounds(gfx::Size(10000, 10000)); | 611 scroll_layer_->SetBounds(gfx::Size(10000, 10000)); |
| 612 client_.set_bounds(scroll_layer_->bounds()); |
| 607 scroll_layer_->SetScrollOffset(gfx::ScrollOffset(100.0, 200.0)); | 613 scroll_layer_->SetScrollOffset(gfx::ScrollOffset(100.0, 200.0)); |
| 608 layer_tree_host()->root_layer()->AddChild(scroll_layer_); | 614 layer_tree_host()->root_layer()->AddChild(scroll_layer_); |
| 609 | 615 |
| 610 scoped_ptr<ScrollOffsetAnimationCurve> curve( | 616 scoped_ptr<ScrollOffsetAnimationCurve> curve( |
| 611 ScrollOffsetAnimationCurve::Create(gfx::ScrollOffset(6500.f, 7500.f), | 617 ScrollOffsetAnimationCurve::Create(gfx::ScrollOffset(6500.f, 7500.f), |
| 612 EaseInOutTimingFunction::Create())); | 618 EaseInOutTimingFunction::Create())); |
| 613 scoped_ptr<Animation> animation( | 619 scoped_ptr<Animation> animation( |
| 614 Animation::Create(curve.Pass(), 1, 0, Animation::SCROLL_OFFSET)); | 620 Animation::Create(curve.Pass(), 1, 0, Animation::SCROLL_OFFSET)); |
| 615 animation->set_needs_synchronized_start_time(true); | 621 animation->set_needs_synchronized_start_time(true); |
| 616 | 622 |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 870 SINGLE_AND_MULTI_THREAD_TEST_F( | 876 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 871 LayerTreeHostTimelinesTestAddAnimationAfterAnimating); | 877 LayerTreeHostTimelinesTestAddAnimationAfterAnimating); |
| 872 | 878 |
| 873 class LayerTreeHostTimelinesTestRemoveAnimation | 879 class LayerTreeHostTimelinesTestRemoveAnimation |
| 874 : public LayerTreeHostTimelinesTest { | 880 : public LayerTreeHostTimelinesTest { |
| 875 public: | 881 public: |
| 876 void SetupTree() override { | 882 void SetupTree() override { |
| 877 LayerTreeHostTimelinesTest::SetupTree(); | 883 LayerTreeHostTimelinesTest::SetupTree(); |
| 878 layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 884 layer_ = FakePictureLayer::Create(layer_settings(), &client_); |
| 879 layer_->SetBounds(gfx::Size(4, 4)); | 885 layer_->SetBounds(gfx::Size(4, 4)); |
| 886 client_.set_bounds(layer_->bounds()); |
| 880 layer_tree_host()->root_layer()->AddChild(layer_); | 887 layer_tree_host()->root_layer()->AddChild(layer_); |
| 881 | 888 |
| 882 AttachPlayersToTimeline(); | 889 AttachPlayersToTimeline(); |
| 883 | 890 |
| 884 player_->AttachLayer(layer_tree_host()->root_layer()->id()); | 891 player_->AttachLayer(layer_tree_host()->root_layer()->id()); |
| 885 player_child_->AttachLayer(layer_->id()); | 892 player_child_->AttachLayer(layer_->id()); |
| 886 } | 893 } |
| 887 | 894 |
| 888 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 895 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 889 | 896 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 928 | 935 |
| 929 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTimelinesTestRemoveAnimation); | 936 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTimelinesTestRemoveAnimation); |
| 930 | 937 |
| 931 class LayerTreeHostTimelinesTestAnimationFinishesDuringCommit | 938 class LayerTreeHostTimelinesTestAnimationFinishesDuringCommit |
| 932 : public LayerTreeHostTimelinesTest { | 939 : public LayerTreeHostTimelinesTest { |
| 933 public: | 940 public: |
| 934 void SetupTree() override { | 941 void SetupTree() override { |
| 935 LayerTreeHostTimelinesTest::SetupTree(); | 942 LayerTreeHostTimelinesTest::SetupTree(); |
| 936 layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 943 layer_ = FakePictureLayer::Create(layer_settings(), &client_); |
| 937 layer_->SetBounds(gfx::Size(4, 4)); | 944 layer_->SetBounds(gfx::Size(4, 4)); |
| 945 client_.set_bounds(layer_->bounds()); |
| 938 layer_tree_host()->root_layer()->AddChild(layer_); | 946 layer_tree_host()->root_layer()->AddChild(layer_); |
| 939 | 947 |
| 940 AttachPlayersToTimeline(); | 948 AttachPlayersToTimeline(); |
| 941 | 949 |
| 942 player_->AttachLayer(layer_tree_host()->root_layer()->id()); | 950 player_->AttachLayer(layer_tree_host()->root_layer()->id()); |
| 943 player_child_->AttachLayer(layer_->id()); | 951 player_child_->AttachLayer(layer_->id()); |
| 944 } | 952 } |
| 945 | 953 |
| 946 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 954 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 947 | 955 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1052 DISABLED_LayerTreeHostTimelinesTestSetPotentiallyAnimatingOnLacDestruction); | 1060 DISABLED_LayerTreeHostTimelinesTestSetPotentiallyAnimatingOnLacDestruction); |
| 1053 | 1061 |
| 1054 // Check that we invalidate property trees on AnimationPlayer::SetNeedsCommit. | 1062 // Check that we invalidate property trees on AnimationPlayer::SetNeedsCommit. |
| 1055 class LayerTreeHostTimelinesTestRebuildPropertyTreesOnAnimationSetNeedsCommit | 1063 class LayerTreeHostTimelinesTestRebuildPropertyTreesOnAnimationSetNeedsCommit |
| 1056 : public LayerTreeHostTimelinesTest { | 1064 : public LayerTreeHostTimelinesTest { |
| 1057 public: | 1065 public: |
| 1058 void SetupTree() override { | 1066 void SetupTree() override { |
| 1059 LayerTreeHostTimelinesTest::SetupTree(); | 1067 LayerTreeHostTimelinesTest::SetupTree(); |
| 1060 layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 1068 layer_ = FakePictureLayer::Create(layer_settings(), &client_); |
| 1061 layer_->SetBounds(gfx::Size(4, 4)); | 1069 layer_->SetBounds(gfx::Size(4, 4)); |
| 1070 client_.set_bounds(layer_->bounds()); |
| 1062 layer_tree_host()->root_layer()->AddChild(layer_); | 1071 layer_tree_host()->root_layer()->AddChild(layer_); |
| 1063 | 1072 |
| 1064 AttachPlayersToTimeline(); | 1073 AttachPlayersToTimeline(); |
| 1065 | 1074 |
| 1066 player_->AttachLayer(layer_tree_host()->root_layer()->id()); | 1075 player_->AttachLayer(layer_tree_host()->root_layer()->id()); |
| 1067 player_child_->AttachLayer(layer_->id()); | 1076 player_child_->AttachLayer(layer_->id()); |
| 1068 } | 1077 } |
| 1069 | 1078 |
| 1070 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1079 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 1071 | 1080 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1094 private: | 1103 private: |
| 1095 scoped_refptr<Layer> layer_; | 1104 scoped_refptr<Layer> layer_; |
| 1096 FakeContentLayerClient client_; | 1105 FakeContentLayerClient client_; |
| 1097 }; | 1106 }; |
| 1098 | 1107 |
| 1099 MULTI_THREAD_TEST_F( | 1108 MULTI_THREAD_TEST_F( |
| 1100 LayerTreeHostTimelinesTestRebuildPropertyTreesOnAnimationSetNeedsCommit); | 1109 LayerTreeHostTimelinesTestRebuildPropertyTreesOnAnimationSetNeedsCommit); |
| 1101 | 1110 |
| 1102 } // namespace | 1111 } // namespace |
| 1103 } // namespace cc | 1112 } // namespace cc |
| OLD | NEW |