OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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_common.h" | 5 #include "cc/trees/layer_tree_host_common.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 4892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4903 grand_child->SetBounds(gfx::Size(10, 10)); | 4903 grand_child->SetBounds(gfx::Size(10, 10)); |
4904 grand_child->SetDrawsContent(true); | 4904 grand_child->SetDrawsContent(true); |
4905 ExecuteCalculateDrawProperties(root); | 4905 ExecuteCalculateDrawProperties(root); |
4906 EXPECT_FALSE(child->has_render_surface()); | 4906 EXPECT_FALSE(child->has_render_surface()); |
4907 } | 4907 } |
4908 | 4908 |
4909 TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) { | 4909 TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) { |
4910 FakeImplTaskRunnerProvider task_runner_provider; | 4910 FakeImplTaskRunnerProvider task_runner_provider; |
4911 TestSharedBitmapManager shared_bitmap_manager; | 4911 TestSharedBitmapManager shared_bitmap_manager; |
4912 TestTaskGraphRunner task_graph_runner; | 4912 TestTaskGraphRunner task_graph_runner; |
4913 FakeLayerTreeHostImpl host_impl(host()->settings(), &task_runner_provider, | 4913 FakeLayerTreeHostImpl host_impl(host()->GetSettings(), &task_runner_provider, |
4914 &shared_bitmap_manager, &task_graph_runner); | 4914 &shared_bitmap_manager, &task_graph_runner); |
4915 host_impl.CreatePendingTree(); | 4915 host_impl.CreatePendingTree(); |
4916 std::unique_ptr<LayerImpl> root = | 4916 std::unique_ptr<LayerImpl> root = |
4917 LayerImpl::Create(host_impl.pending_tree(), 1); | 4917 LayerImpl::Create(host_impl.pending_tree(), 1); |
4918 root->SetBounds(gfx::Size(100, 100)); | 4918 root->SetBounds(gfx::Size(100, 100)); |
4919 root->SetDrawsContent(true); | 4919 root->SetDrawsContent(true); |
4920 | 4920 |
4921 std::unique_ptr<LayerImpl> child = | 4921 std::unique_ptr<LayerImpl> child = |
4922 LayerImpl::Create(host_impl.pending_tree(), 2); | 4922 LayerImpl::Create(host_impl.pending_tree(), 2); |
4923 child->SetBounds(gfx::Size(50, 50)); | 4923 child->SetBounds(gfx::Size(50, 50)); |
(...skipping 2098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7022 int id) | 7022 int id) |
7023 : LayerImpl(tree_impl, id) { | 7023 : LayerImpl(tree_impl, id) { |
7024 SetDrawsContent(true); | 7024 SetDrawsContent(true); |
7025 } | 7025 } |
7026 }; | 7026 }; |
7027 | 7027 |
7028 TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) { | 7028 TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) { |
7029 FakeImplTaskRunnerProvider task_runner_provider; | 7029 FakeImplTaskRunnerProvider task_runner_provider; |
7030 TestSharedBitmapManager shared_bitmap_manager; | 7030 TestSharedBitmapManager shared_bitmap_manager; |
7031 TestTaskGraphRunner task_graph_runner; | 7031 TestTaskGraphRunner task_graph_runner; |
7032 LayerTreeSettings settings = host()->settings(); | 7032 LayerTreeSettings settings = host()->GetSettings(); |
7033 settings.layer_transforms_should_scale_layer_contents = true; | 7033 settings.layer_transforms_should_scale_layer_contents = true; |
7034 FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider, | 7034 FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider, |
7035 &shared_bitmap_manager, &task_graph_runner); | 7035 &shared_bitmap_manager, &task_graph_runner); |
7036 std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> grand_parent = | 7036 std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> grand_parent = |
7037 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 1); | 7037 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 1); |
7038 std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> parent = | 7038 std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> parent = |
7039 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 2); | 7039 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 2); |
7040 std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> child = | 7040 std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> child = |
7041 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 3); | 7041 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 3); |
7042 std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> grand_child = | 7042 std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> grand_child = |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7508 | 7508 |
7509 actual.clear(); | 7509 actual.clear(); |
7510 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); | 7510 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); |
7511 EXPECT_EQ(expected, actual); | 7511 EXPECT_EQ(expected, actual); |
7512 } | 7512 } |
7513 | 7513 |
7514 TEST_F(LayerTreeHostCommonTest, DrawPropertyScales) { | 7514 TEST_F(LayerTreeHostCommonTest, DrawPropertyScales) { |
7515 FakeImplTaskRunnerProvider task_runner_provider; | 7515 FakeImplTaskRunnerProvider task_runner_provider; |
7516 TestSharedBitmapManager shared_bitmap_manager; | 7516 TestSharedBitmapManager shared_bitmap_manager; |
7517 TestTaskGraphRunner task_graph_runner; | 7517 TestTaskGraphRunner task_graph_runner; |
7518 LayerTreeSettings settings = host()->settings(); | 7518 LayerTreeSettings settings = host()->GetSettings(); |
7519 settings.layer_transforms_should_scale_layer_contents = true; | 7519 settings.layer_transforms_should_scale_layer_contents = true; |
7520 FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider, | 7520 FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider, |
7521 &shared_bitmap_manager, &task_graph_runner); | 7521 &shared_bitmap_manager, &task_graph_runner); |
7522 | 7522 |
7523 std::unique_ptr<LayerImpl> root = | 7523 std::unique_ptr<LayerImpl> root = |
7524 LayerImpl::Create(host_impl.active_tree(), 1); | 7524 LayerImpl::Create(host_impl.active_tree(), 1); |
7525 LayerImpl* root_layer = root.get(); | 7525 LayerImpl* root_layer = root.get(); |
7526 std::unique_ptr<LayerImpl> child1 = | 7526 std::unique_ptr<LayerImpl> child1 = |
7527 LayerImpl::Create(host_impl.active_tree(), 2); | 7527 LayerImpl::Create(host_impl.active_tree(), 2); |
7528 LayerImpl* child1_layer = child1.get(); | 7528 LayerImpl* child1_layer = child1.get(); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7635 | 7635 |
7636 EXPECT_FLOAT_EQ(0.f, GetMaximumAnimationScale(root_layer)); | 7636 EXPECT_FLOAT_EQ(0.f, GetMaximumAnimationScale(root_layer)); |
7637 EXPECT_FLOAT_EQ(0.f, GetMaximumAnimationScale(child1_layer)); | 7637 EXPECT_FLOAT_EQ(0.f, GetMaximumAnimationScale(child1_layer)); |
7638 EXPECT_FLOAT_EQ(96.f, GetMaximumAnimationScale(child2_layer)); | 7638 EXPECT_FLOAT_EQ(96.f, GetMaximumAnimationScale(child2_layer)); |
7639 } | 7639 } |
7640 | 7640 |
7641 TEST_F(LayerTreeHostCommonTest, AnimationScales) { | 7641 TEST_F(LayerTreeHostCommonTest, AnimationScales) { |
7642 FakeImplTaskRunnerProvider task_runner_provider; | 7642 FakeImplTaskRunnerProvider task_runner_provider; |
7643 TestSharedBitmapManager shared_bitmap_manager; | 7643 TestSharedBitmapManager shared_bitmap_manager; |
7644 TestTaskGraphRunner task_graph_runner; | 7644 TestTaskGraphRunner task_graph_runner; |
7645 LayerTreeSettings settings = host()->settings(); | 7645 LayerTreeSettings settings = host()->GetSettings(); |
7646 settings.layer_transforms_should_scale_layer_contents = true; | 7646 settings.layer_transforms_should_scale_layer_contents = true; |
7647 FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider, | 7647 FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider, |
7648 &shared_bitmap_manager, &task_graph_runner); | 7648 &shared_bitmap_manager, &task_graph_runner); |
7649 | 7649 |
7650 std::unique_ptr<LayerImpl> root = | 7650 std::unique_ptr<LayerImpl> root = |
7651 LayerImpl::Create(host_impl.active_tree(), 1); | 7651 LayerImpl::Create(host_impl.active_tree(), 1); |
7652 LayerImpl* root_layer = root.get(); | 7652 LayerImpl* root_layer = root.get(); |
7653 std::unique_ptr<LayerImpl> child1 = | 7653 std::unique_ptr<LayerImpl> child1 = |
7654 LayerImpl::Create(host_impl.active_tree(), 2); | 7654 LayerImpl::Create(host_impl.active_tree(), 2); |
7655 LayerImpl* child1_layer = child1.get(); | 7655 LayerImpl* child1_layer = child1.get(); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7714 EXPECT_FLOAT_EQ(100.f, GetStartingAnimationScale(child2_layer)); | 7714 EXPECT_FLOAT_EQ(100.f, GetStartingAnimationScale(child2_layer)); |
7715 } | 7715 } |
7716 | 7716 |
7717 TEST_F(LayerTreeHostCommonTest, | 7717 TEST_F(LayerTreeHostCommonTest, |
7718 AnimationScaleWhenLayerTransformShouldNotScaleLayerBounds) { | 7718 AnimationScaleWhenLayerTransformShouldNotScaleLayerBounds) { |
7719 // Returns empty scale if layer_transforms_should_scale_layer_contents is | 7719 // Returns empty scale if layer_transforms_should_scale_layer_contents is |
7720 // false. | 7720 // false. |
7721 FakeImplTaskRunnerProvider task_runner_provider; | 7721 FakeImplTaskRunnerProvider task_runner_provider; |
7722 TestSharedBitmapManager shared_bitmap_manager; | 7722 TestSharedBitmapManager shared_bitmap_manager; |
7723 TestTaskGraphRunner task_graph_runner; | 7723 TestTaskGraphRunner task_graph_runner; |
7724 LayerTreeSettings settings = host()->settings(); | 7724 LayerTreeSettings settings = host()->GetSettings(); |
7725 settings.layer_transforms_should_scale_layer_contents = false; | 7725 settings.layer_transforms_should_scale_layer_contents = false; |
7726 FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider, | 7726 FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider, |
7727 &shared_bitmap_manager, &task_graph_runner); | 7727 &shared_bitmap_manager, &task_graph_runner); |
7728 | 7728 |
7729 std::unique_ptr<LayerImpl> root = | 7729 std::unique_ptr<LayerImpl> root = |
7730 LayerImpl::Create(host_impl.active_tree(), 1); | 7730 LayerImpl::Create(host_impl.active_tree(), 1); |
7731 LayerImpl* root_layer = root.get(); | 7731 LayerImpl* root_layer = root.get(); |
7732 std::unique_ptr<LayerImpl> child = | 7732 std::unique_ptr<LayerImpl> child = |
7733 LayerImpl::Create(host_impl.active_tree(), 2); | 7733 LayerImpl::Create(host_impl.active_tree(), 2); |
7734 LayerImpl* child_layer = child.get(); | 7734 LayerImpl* child_layer = child.get(); |
(...skipping 2084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9819 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); | 9819 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); |
9820 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); | 9820 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); |
9821 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); | 9821 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); |
9822 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); | 9822 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); |
9823 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); | 9823 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); |
9824 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); | 9824 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); |
9825 } | 9825 } |
9826 | 9826 |
9827 } // namespace | 9827 } // namespace |
9828 } // namespace cc | 9828 } // namespace cc |
OLD | NEW |