| 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 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 TEST_F(LayerTreeHostCommonTest, TransformsAboutScrollOffset) { | 515 TEST_F(LayerTreeHostCommonTest, TransformsAboutScrollOffset) { |
| 516 const gfx::ScrollOffset kScrollOffset(50, 100); | 516 const gfx::ScrollOffset kScrollOffset(50, 100); |
| 517 const gfx::Vector2dF kScrollDelta(2.34f, 5.67f); | 517 const gfx::Vector2dF kScrollDelta(2.34f, 5.67f); |
| 518 const gfx::Vector2d kMaxScrollOffset(200, 200); | 518 const gfx::Vector2d kMaxScrollOffset(200, 200); |
| 519 const gfx::PointF kScrollLayerPosition(-kScrollOffset.x(), | 519 const gfx::PointF kScrollLayerPosition(-kScrollOffset.x(), |
| 520 -kScrollOffset.y()); | 520 -kScrollOffset.y()); |
| 521 float page_scale = 0.888f; | 521 float page_scale = 0.888f; |
| 522 const float kDeviceScale = 1.666f; | 522 const float kDeviceScale = 1.666f; |
| 523 | 523 |
| 524 FakeImplTaskRunnerProvider task_runner_provider; | 524 FakeImplTaskRunnerProvider task_runner_provider; |
| 525 TestSharedBitmapManager shared_bitmap_manager; | |
| 526 TestTaskGraphRunner task_graph_runner; | 525 TestTaskGraphRunner task_graph_runner; |
| 527 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, | 526 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); |
| 528 &task_graph_runner); | |
| 529 | 527 |
| 530 std::unique_ptr<LayerImpl> sublayer_scoped_ptr( | 528 std::unique_ptr<LayerImpl> sublayer_scoped_ptr( |
| 531 LayerImpl::Create(host_impl.active_tree(), 1)); | 529 LayerImpl::Create(host_impl.active_tree(), 1)); |
| 532 LayerImpl* sublayer = sublayer_scoped_ptr.get(); | 530 LayerImpl* sublayer = sublayer_scoped_ptr.get(); |
| 533 sublayer->SetDrawsContent(true); | 531 sublayer->SetDrawsContent(true); |
| 534 sublayer->SetBounds(gfx::Size(500, 500)); | 532 sublayer->SetBounds(gfx::Size(500, 500)); |
| 535 | 533 |
| 536 std::unique_ptr<LayerImpl> scroll_layer_scoped_ptr( | 534 std::unique_ptr<LayerImpl> scroll_layer_scoped_ptr( |
| 537 LayerImpl::Create(host_impl.active_tree(), 2)); | 535 LayerImpl::Create(host_impl.active_tree(), 2)); |
| 538 LayerImpl* scroll_layer = scroll_layer_scoped_ptr.get(); | 536 LayerImpl* scroll_layer = scroll_layer_scoped_ptr.get(); |
| (...skipping 2904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3443 ->transform_tree.Node(grand_child->transform_tree_index()) | 3441 ->transform_tree.Node(grand_child->transform_tree_index()) |
| 3444 ->ancestors_are_invertible); | 3442 ->ancestors_are_invertible); |
| 3445 | 3443 |
| 3446 // CalcDrawProps skips a subtree when a layer's screen space transform is | 3444 // CalcDrawProps skips a subtree when a layer's screen space transform is |
| 3447 // uninvertible | 3445 // uninvertible |
| 3448 EXPECT_EQ(gfx::Rect(), grand_child->visible_layer_rect()); | 3446 EXPECT_EQ(gfx::Rect(), grand_child->visible_layer_rect()); |
| 3449 } | 3447 } |
| 3450 | 3448 |
| 3451 TEST_F(LayerTreeHostCommonTest, OcclusionBySiblingOfTarget) { | 3449 TEST_F(LayerTreeHostCommonTest, OcclusionBySiblingOfTarget) { |
| 3452 FakeImplTaskRunnerProvider task_runner_provider; | 3450 FakeImplTaskRunnerProvider task_runner_provider; |
| 3453 TestSharedBitmapManager shared_bitmap_manager; | |
| 3454 TestTaskGraphRunner task_graph_runner; | 3451 TestTaskGraphRunner task_graph_runner; |
| 3455 std::unique_ptr<CompositorFrameSink> compositor_frame_sink = | 3452 std::unique_ptr<CompositorFrameSink> compositor_frame_sink = |
| 3456 FakeCompositorFrameSink::Create3d(); | 3453 FakeCompositorFrameSink::Create3d(); |
| 3457 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, | 3454 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); |
| 3458 &task_graph_runner); | |
| 3459 | 3455 |
| 3460 std::unique_ptr<LayerImpl> root = | 3456 std::unique_ptr<LayerImpl> root = |
| 3461 LayerImpl::Create(host_impl.active_tree(), 1); | 3457 LayerImpl::Create(host_impl.active_tree(), 1); |
| 3462 std::unique_ptr<LayerImpl> child = | 3458 std::unique_ptr<LayerImpl> child = |
| 3463 LayerImpl::Create(host_impl.active_tree(), 2); | 3459 LayerImpl::Create(host_impl.active_tree(), 2); |
| 3464 std::unique_ptr<TextureLayerImpl> surface = | 3460 std::unique_ptr<TextureLayerImpl> surface = |
| 3465 TextureLayerImpl::Create(host_impl.active_tree(), 3); | 3461 TextureLayerImpl::Create(host_impl.active_tree(), 3); |
| 3466 std::unique_ptr<TextureLayerImpl> surface_child = | 3462 std::unique_ptr<TextureLayerImpl> surface_child = |
| 3467 TextureLayerImpl::Create(host_impl.active_tree(), 4); | 3463 TextureLayerImpl::Create(host_impl.active_tree(), 4); |
| 3468 std::unique_ptr<TextureLayerImpl> surface_sibling = | 3464 std::unique_ptr<TextureLayerImpl> surface_sibling = |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3521 | 3517 |
| 3522 // Mask layer should have the same occlusion. | 3518 // Mask layer should have the same occlusion. |
| 3523 actual_occlusion = | 3519 actual_occlusion = |
| 3524 surface_child_mask_ptr->draw_properties().occlusion_in_content_space; | 3520 surface_child_mask_ptr->draw_properties().occlusion_in_content_space; |
| 3525 EXPECT_TRUE(expected_occlusion.IsEqual(actual_occlusion)); | 3521 EXPECT_TRUE(expected_occlusion.IsEqual(actual_occlusion)); |
| 3526 } | 3522 } |
| 3527 | 3523 |
| 3528 TEST_F(LayerTreeHostCommonTest, | 3524 TEST_F(LayerTreeHostCommonTest, |
| 3529 OcclusionForLayerWithUninvertibleDrawTransform) { | 3525 OcclusionForLayerWithUninvertibleDrawTransform) { |
| 3530 FakeImplTaskRunnerProvider task_runner_provider; | 3526 FakeImplTaskRunnerProvider task_runner_provider; |
| 3531 TestSharedBitmapManager shared_bitmap_manager; | |
| 3532 TestTaskGraphRunner task_graph_runner; | 3527 TestTaskGraphRunner task_graph_runner; |
| 3533 std::unique_ptr<CompositorFrameSink> compositor_frame_sink = | 3528 std::unique_ptr<CompositorFrameSink> compositor_frame_sink = |
| 3534 FakeCompositorFrameSink::Create3d(); | 3529 FakeCompositorFrameSink::Create3d(); |
| 3535 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, | 3530 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); |
| 3536 &task_graph_runner); | |
| 3537 | 3531 |
| 3538 std::unique_ptr<LayerImpl> root = | 3532 std::unique_ptr<LayerImpl> root = |
| 3539 LayerImpl::Create(host_impl.active_tree(), 1); | 3533 LayerImpl::Create(host_impl.active_tree(), 1); |
| 3540 std::unique_ptr<LayerImpl> child = | 3534 std::unique_ptr<LayerImpl> child = |
| 3541 LayerImpl::Create(host_impl.active_tree(), 2); | 3535 LayerImpl::Create(host_impl.active_tree(), 2); |
| 3542 std::unique_ptr<LayerImpl> grand_child = | 3536 std::unique_ptr<LayerImpl> grand_child = |
| 3543 LayerImpl::Create(host_impl.active_tree(), 3); | 3537 LayerImpl::Create(host_impl.active_tree(), 3); |
| 3544 std::unique_ptr<LayerImpl> occluding_child = | 3538 std::unique_ptr<LayerImpl> occluding_child = |
| 3545 LayerImpl::Create(host_impl.active_tree(), 4); | 3539 LayerImpl::Create(host_impl.active_tree(), 4); |
| 3546 | 3540 |
| (...skipping 1244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4791 child->SetBounds(gfx::Size(10, 10)); | 4785 child->SetBounds(gfx::Size(10, 10)); |
| 4792 child->test_properties()->opacity = 0.5f; | 4786 child->test_properties()->opacity = 0.5f; |
| 4793 grand_child->SetBounds(gfx::Size(10, 10)); | 4787 grand_child->SetBounds(gfx::Size(10, 10)); |
| 4794 grand_child->SetDrawsContent(true); | 4788 grand_child->SetDrawsContent(true); |
| 4795 ExecuteCalculateDrawProperties(root); | 4789 ExecuteCalculateDrawProperties(root); |
| 4796 EXPECT_FALSE(child->has_render_surface()); | 4790 EXPECT_FALSE(child->has_render_surface()); |
| 4797 } | 4791 } |
| 4798 | 4792 |
| 4799 TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) { | 4793 TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) { |
| 4800 FakeImplTaskRunnerProvider task_runner_provider; | 4794 FakeImplTaskRunnerProvider task_runner_provider; |
| 4801 TestSharedBitmapManager shared_bitmap_manager; | |
| 4802 TestTaskGraphRunner task_graph_runner; | 4795 TestTaskGraphRunner task_graph_runner; |
| 4803 FakeLayerTreeHostImpl host_impl(host()->GetSettings(), &task_runner_provider, | 4796 FakeLayerTreeHostImpl host_impl(host()->GetSettings(), &task_runner_provider, |
| 4804 &shared_bitmap_manager, &task_graph_runner); | 4797 &task_graph_runner); |
| 4805 host_impl.CreatePendingTree(); | 4798 host_impl.CreatePendingTree(); |
| 4806 std::unique_ptr<LayerImpl> root = | 4799 std::unique_ptr<LayerImpl> root = |
| 4807 LayerImpl::Create(host_impl.pending_tree(), 1); | 4800 LayerImpl::Create(host_impl.pending_tree(), 1); |
| 4808 root->SetBounds(gfx::Size(100, 100)); | 4801 root->SetBounds(gfx::Size(100, 100)); |
| 4809 root->SetDrawsContent(true); | 4802 root->SetDrawsContent(true); |
| 4810 | 4803 |
| 4811 std::unique_ptr<LayerImpl> child = | 4804 std::unique_ptr<LayerImpl> child = |
| 4812 LayerImpl::Create(host_impl.pending_tree(), 2); | 4805 LayerImpl::Create(host_impl.pending_tree(), 2); |
| 4813 child->SetBounds(gfx::Size(50, 50)); | 4806 child->SetBounds(gfx::Size(50, 50)); |
| 4814 child->SetDrawsContent(true); | 4807 child->SetDrawsContent(true); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4896 } | 4889 } |
| 4897 | 4890 |
| 4898 using LCDTextTestParam = std::tr1::tuple<bool, bool, bool>; | 4891 using LCDTextTestParam = std::tr1::tuple<bool, bool, bool>; |
| 4899 class LCDTextTest : public LayerTreeHostCommonTestBase, | 4892 class LCDTextTest : public LayerTreeHostCommonTestBase, |
| 4900 public testing::TestWithParam<LCDTextTestParam> { | 4893 public testing::TestWithParam<LCDTextTestParam> { |
| 4901 public: | 4894 public: |
| 4902 LCDTextTest() | 4895 LCDTextTest() |
| 4903 : LayerTreeHostCommonTestBase(LCDTextTestLayerTreeSettings()), | 4896 : LayerTreeHostCommonTestBase(LCDTextTestLayerTreeSettings()), |
| 4904 host_impl_(LCDTextTestLayerTreeSettings(), | 4897 host_impl_(LCDTextTestLayerTreeSettings(), |
| 4905 &task_runner_provider_, | 4898 &task_runner_provider_, |
| 4906 &shared_bitmap_manager_, | |
| 4907 &task_graph_runner_) {} | 4899 &task_graph_runner_) {} |
| 4908 | 4900 |
| 4909 scoped_refptr<AnimationTimeline> timeline() { return timeline_; } | 4901 scoped_refptr<AnimationTimeline> timeline() { return timeline_; } |
| 4910 | 4902 |
| 4911 protected: | 4903 protected: |
| 4912 LayerTreeSettings LCDTextTestLayerTreeSettings() { | 4904 LayerTreeSettings LCDTextTestLayerTreeSettings() { |
| 4913 LayerTreeSettings settings = VerifyTreeCalcsLayerTreeSettings(); | 4905 LayerTreeSettings settings = VerifyTreeCalcsLayerTreeSettings(); |
| 4914 | 4906 |
| 4915 can_use_lcd_text_ = std::tr1::get<0>(GetParam()); | 4907 can_use_lcd_text_ = std::tr1::get<0>(GetParam()); |
| 4916 layers_always_allowed_lcd_text_ = std::tr1::get<1>(GetParam()); | 4908 layers_always_allowed_lcd_text_ = std::tr1::get<1>(GetParam()); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4955 grand_child_->SetBounds(gfx::Size(1, 1)); | 4947 grand_child_->SetBounds(gfx::Size(1, 1)); |
| 4956 | 4948 |
| 4957 child_->test_properties()->force_render_surface = | 4949 child_->test_properties()->force_render_surface = |
| 4958 std::tr1::get<2>(GetParam()); | 4950 std::tr1::get<2>(GetParam()); |
| 4959 } | 4951 } |
| 4960 | 4952 |
| 4961 bool can_use_lcd_text_; | 4953 bool can_use_lcd_text_; |
| 4962 bool layers_always_allowed_lcd_text_; | 4954 bool layers_always_allowed_lcd_text_; |
| 4963 | 4955 |
| 4964 FakeImplTaskRunnerProvider task_runner_provider_; | 4956 FakeImplTaskRunnerProvider task_runner_provider_; |
| 4965 TestSharedBitmapManager shared_bitmap_manager_; | |
| 4966 TestTaskGraphRunner task_graph_runner_; | 4957 TestTaskGraphRunner task_graph_runner_; |
| 4967 FakeLayerTreeHostImpl host_impl_; | 4958 FakeLayerTreeHostImpl host_impl_; |
| 4968 scoped_refptr<AnimationTimeline> timeline_; | 4959 scoped_refptr<AnimationTimeline> timeline_; |
| 4969 | 4960 |
| 4970 LayerImpl* root_ = nullptr; | 4961 LayerImpl* root_ = nullptr; |
| 4971 LayerImpl* child_ = nullptr; | 4962 LayerImpl* child_ = nullptr; |
| 4972 LayerImpl* grand_child_ = nullptr; | 4963 LayerImpl* grand_child_ = nullptr; |
| 4973 }; | 4964 }; |
| 4974 | 4965 |
| 4975 TEST_P(LCDTextTest, CanUseLCDText) { | 4966 TEST_P(LCDTextTest, CanUseLCDText) { |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5113 } | 5104 } |
| 5114 | 5105 |
| 5115 INSTANTIATE_TEST_CASE_P(LayerTreeHostCommonTest, | 5106 INSTANTIATE_TEST_CASE_P(LayerTreeHostCommonTest, |
| 5116 LCDTextTest, | 5107 LCDTextTest, |
| 5117 testing::Combine(testing::Bool(), | 5108 testing::Combine(testing::Bool(), |
| 5118 testing::Bool(), | 5109 testing::Bool(), |
| 5119 testing::Bool())); | 5110 testing::Bool())); |
| 5120 | 5111 |
| 5121 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayerImpl) { | 5112 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayerImpl) { |
| 5122 FakeImplTaskRunnerProvider task_runner_provider; | 5113 FakeImplTaskRunnerProvider task_runner_provider; |
| 5123 TestSharedBitmapManager shared_bitmap_manager; | |
| 5124 TestTaskGraphRunner task_graph_runner; | 5114 TestTaskGraphRunner task_graph_runner; |
| 5125 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, | 5115 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); |
| 5126 &task_graph_runner); | |
| 5127 host_impl.CreatePendingTree(); | 5116 host_impl.CreatePendingTree(); |
| 5128 | 5117 |
| 5129 std::unique_ptr<LayerImpl> root = | 5118 std::unique_ptr<LayerImpl> root = |
| 5130 LayerImpl::Create(host_impl.pending_tree(), 1); | 5119 LayerImpl::Create(host_impl.pending_tree(), 1); |
| 5131 root->SetBounds(gfx::Size(50, 50)); | 5120 root->SetBounds(gfx::Size(50, 50)); |
| 5132 root->SetDrawsContent(true); | 5121 root->SetDrawsContent(true); |
| 5133 LayerImpl* root_layer = root.get(); | 5122 LayerImpl* root_layer = root.get(); |
| 5134 | 5123 |
| 5135 std::unique_ptr<LayerImpl> child = | 5124 std::unique_ptr<LayerImpl> child = |
| 5136 LayerImpl::Create(host_impl.pending_tree(), 2); | 5125 LayerImpl::Create(host_impl.pending_tree(), 2); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 5157 // We should have one render surface and two layers. The grand child has | 5146 // We should have one render surface and two layers. The grand child has |
| 5158 // hidden itself. | 5147 // hidden itself. |
| 5159 ASSERT_EQ(1u, render_surface_layer_list.size()); | 5148 ASSERT_EQ(1u, render_surface_layer_list.size()); |
| 5160 ASSERT_EQ(2u, root_layer->render_surface()->layer_list().size()); | 5149 ASSERT_EQ(2u, root_layer->render_surface()->layer_list().size()); |
| 5161 EXPECT_EQ(1, root_layer->render_surface()->layer_list().at(0)->id()); | 5150 EXPECT_EQ(1, root_layer->render_surface()->layer_list().at(0)->id()); |
| 5162 EXPECT_EQ(2, root_layer->render_surface()->layer_list().at(1)->id()); | 5151 EXPECT_EQ(2, root_layer->render_surface()->layer_list().at(1)->id()); |
| 5163 } | 5152 } |
| 5164 | 5153 |
| 5165 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayersImpl) { | 5154 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayersImpl) { |
| 5166 FakeImplTaskRunnerProvider task_runner_provider; | 5155 FakeImplTaskRunnerProvider task_runner_provider; |
| 5167 TestSharedBitmapManager shared_bitmap_manager; | |
| 5168 TestTaskGraphRunner task_graph_runner; | 5156 TestTaskGraphRunner task_graph_runner; |
| 5169 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, | 5157 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); |
| 5170 &task_graph_runner); | |
| 5171 host_impl.CreatePendingTree(); | 5158 host_impl.CreatePendingTree(); |
| 5172 | 5159 |
| 5173 std::unique_ptr<LayerImpl> root = | 5160 std::unique_ptr<LayerImpl> root = |
| 5174 LayerImpl::Create(host_impl.pending_tree(), 1); | 5161 LayerImpl::Create(host_impl.pending_tree(), 1); |
| 5175 root->SetBounds(gfx::Size(50, 50)); | 5162 root->SetBounds(gfx::Size(50, 50)); |
| 5176 root->SetDrawsContent(true); | 5163 root->SetDrawsContent(true); |
| 5177 LayerImpl* root_layer = root.get(); | 5164 LayerImpl* root_layer = root.get(); |
| 5178 | 5165 |
| 5179 std::unique_ptr<LayerImpl> child = | 5166 std::unique_ptr<LayerImpl> child = |
| 5180 LayerImpl::Create(host_impl.pending_tree(), 2); | 5167 LayerImpl::Create(host_impl.pending_tree(), 2); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 5201 // hidden itself and the grand child. | 5188 // hidden itself and the grand child. |
| 5202 ASSERT_EQ(1u, render_surface_layer_list.size()); | 5189 ASSERT_EQ(1u, render_surface_layer_list.size()); |
| 5203 ASSERT_EQ(1u, root_layer->render_surface()->layer_list().size()); | 5190 ASSERT_EQ(1u, root_layer->render_surface()->layer_list().size()); |
| 5204 EXPECT_EQ(1, root_layer->render_surface()->layer_list().at(0)->id()); | 5191 EXPECT_EQ(1, root_layer->render_surface()->layer_list().at(0)->id()); |
| 5205 } | 5192 } |
| 5206 | 5193 |
| 5207 void EmptyCopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {} | 5194 void EmptyCopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {} |
| 5208 | 5195 |
| 5209 TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) { | 5196 TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) { |
| 5210 FakeImplTaskRunnerProvider task_runner_provider; | 5197 FakeImplTaskRunnerProvider task_runner_provider; |
| 5211 TestSharedBitmapManager shared_bitmap_manager; | |
| 5212 TestTaskGraphRunner task_graph_runner; | 5198 TestTaskGraphRunner task_graph_runner; |
| 5213 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, | 5199 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); |
| 5214 &task_graph_runner); | |
| 5215 host_impl.CreatePendingTree(); | 5200 host_impl.CreatePendingTree(); |
| 5216 | 5201 |
| 5217 std::unique_ptr<LayerImpl> root = | 5202 std::unique_ptr<LayerImpl> root = |
| 5218 LayerImpl::Create(host_impl.pending_tree(), 1); | 5203 LayerImpl::Create(host_impl.pending_tree(), 1); |
| 5219 root->SetBounds(gfx::Size(50, 50)); | 5204 root->SetBounds(gfx::Size(50, 50)); |
| 5220 root->SetDrawsContent(true); | 5205 root->SetDrawsContent(true); |
| 5221 LayerImpl* root_layer = root.get(); | 5206 LayerImpl* root_layer = root.get(); |
| 5222 | 5207 |
| 5223 std::unique_ptr<LayerImpl> copy_grand_parent = | 5208 std::unique_ptr<LayerImpl> copy_grand_parent = |
| 5224 LayerImpl::Create(host_impl.pending_tree(), 2); | 5209 LayerImpl::Create(host_impl.pending_tree(), 2); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5347 node = tree.Node(copy_grand_child_layer->effect_tree_index()); | 5332 node = tree.Node(copy_grand_child_layer->effect_tree_index()); |
| 5348 EXPECT_FALSE(node->is_drawn); | 5333 EXPECT_FALSE(node->is_drawn); |
| 5349 | 5334 |
| 5350 // Though copy_layer is drawn, it shouldn't contribute to drawn surface as its | 5335 // Though copy_layer is drawn, it shouldn't contribute to drawn surface as its |
| 5351 // actually hidden. | 5336 // actually hidden. |
| 5352 EXPECT_FALSE(copy_layer->render_surface()->contributes_to_drawn_surface()); | 5337 EXPECT_FALSE(copy_layer->render_surface()->contributes_to_drawn_surface()); |
| 5353 } | 5338 } |
| 5354 | 5339 |
| 5355 TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) { | 5340 TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) { |
| 5356 FakeImplTaskRunnerProvider task_runner_provider; | 5341 FakeImplTaskRunnerProvider task_runner_provider; |
| 5357 TestSharedBitmapManager shared_bitmap_manager; | |
| 5358 TestTaskGraphRunner task_graph_runner; | 5342 TestTaskGraphRunner task_graph_runner; |
| 5359 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, | 5343 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); |
| 5360 &task_graph_runner); | |
| 5361 host_impl.CreatePendingTree(); | 5344 host_impl.CreatePendingTree(); |
| 5362 | 5345 |
| 5363 std::unique_ptr<LayerImpl> root = | 5346 std::unique_ptr<LayerImpl> root = |
| 5364 LayerImpl::Create(host_impl.pending_tree(), 1); | 5347 LayerImpl::Create(host_impl.pending_tree(), 1); |
| 5365 root->SetBounds(gfx::Size(50, 50)); | 5348 root->SetBounds(gfx::Size(50, 50)); |
| 5366 root->SetDrawsContent(true); | 5349 root->SetDrawsContent(true); |
| 5367 | 5350 |
| 5368 std::unique_ptr<LayerImpl> copy_parent = | 5351 std::unique_ptr<LayerImpl> copy_parent = |
| 5369 LayerImpl::Create(host_impl.pending_tree(), 2); | 5352 LayerImpl::Create(host_impl.pending_tree(), 2); |
| 5370 copy_parent->SetDrawsContent(true); | 5353 copy_parent->SetDrawsContent(true); |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5857 | 5840 |
| 5858 // Verify which render surfaces were created. | 5841 // Verify which render surfaces were created. |
| 5859 EXPECT_TRUE(root->has_render_surface()); | 5842 EXPECT_TRUE(root->has_render_surface()); |
| 5860 EXPECT_FALSE(child1->has_render_surface()); | 5843 EXPECT_FALSE(child1->has_render_surface()); |
| 5861 EXPECT_TRUE(child2->has_render_surface()); | 5844 EXPECT_TRUE(child2->has_render_surface()); |
| 5862 EXPECT_FALSE(child3->has_render_surface()); | 5845 EXPECT_FALSE(child3->has_render_surface()); |
| 5863 } | 5846 } |
| 5864 | 5847 |
| 5865 TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) { | 5848 TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) { |
| 5866 FakeImplTaskRunnerProvider task_runner_provider; | 5849 FakeImplTaskRunnerProvider task_runner_provider; |
| 5867 TestSharedBitmapManager shared_bitmap_manager; | |
| 5868 TestTaskGraphRunner task_graph_runner; | 5850 TestTaskGraphRunner task_graph_runner; |
| 5869 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, | 5851 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); |
| 5870 &task_graph_runner); | |
| 5871 | 5852 |
| 5872 std::unique_ptr<LayerImpl> root = | 5853 std::unique_ptr<LayerImpl> root = |
| 5873 LayerImpl::Create(host_impl.active_tree(), 12345); | 5854 LayerImpl::Create(host_impl.active_tree(), 12345); |
| 5874 std::unique_ptr<LayerImpl> child1 = | 5855 std::unique_ptr<LayerImpl> child1 = |
| 5875 LayerImpl::Create(host_impl.active_tree(), 123456); | 5856 LayerImpl::Create(host_impl.active_tree(), 123456); |
| 5876 std::unique_ptr<LayerImpl> child2 = | 5857 std::unique_ptr<LayerImpl> child2 = |
| 5877 LayerImpl::Create(host_impl.active_tree(), 1234567); | 5858 LayerImpl::Create(host_impl.active_tree(), 1234567); |
| 5878 std::unique_ptr<LayerImpl> child3 = | 5859 std::unique_ptr<LayerImpl> child3 = |
| 5879 LayerImpl::Create(host_impl.active_tree(), 12345678); | 5860 LayerImpl::Create(host_impl.active_tree(), 12345678); |
| 5880 | 5861 |
| (...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6557 TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) { | 6538 TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) { |
| 6558 // This test verifies that a scrolling layer that gets snapped to | 6539 // This test verifies that a scrolling layer that gets snapped to |
| 6559 // integer coordinates doesn't move a fixed position child. | 6540 // integer coordinates doesn't move a fixed position child. |
| 6560 // | 6541 // |
| 6561 // + root | 6542 // + root |
| 6562 // + container | 6543 // + container |
| 6563 // + scroller | 6544 // + scroller |
| 6564 // + fixed | 6545 // + fixed |
| 6565 // | 6546 // |
| 6566 FakeImplTaskRunnerProvider task_runner_provider; | 6547 FakeImplTaskRunnerProvider task_runner_provider; |
| 6567 TestSharedBitmapManager shared_bitmap_manager; | |
| 6568 TestTaskGraphRunner task_graph_runner; | 6548 TestTaskGraphRunner task_graph_runner; |
| 6569 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, | 6549 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); |
| 6570 &task_graph_runner); | |
| 6571 host_impl.CreatePendingTree(); | 6550 host_impl.CreatePendingTree(); |
| 6572 std::unique_ptr<LayerImpl> root_ptr = | 6551 std::unique_ptr<LayerImpl> root_ptr = |
| 6573 LayerImpl::Create(host_impl.active_tree(), 1); | 6552 LayerImpl::Create(host_impl.active_tree(), 1); |
| 6574 LayerImpl* root = root_ptr.get(); | 6553 LayerImpl* root = root_ptr.get(); |
| 6575 std::unique_ptr<LayerImpl> container = | 6554 std::unique_ptr<LayerImpl> container = |
| 6576 LayerImpl::Create(host_impl.active_tree(), 2); | 6555 LayerImpl::Create(host_impl.active_tree(), 2); |
| 6577 LayerImpl* container_layer = container.get(); | 6556 LayerImpl* container_layer = container.get(); |
| 6578 std::unique_ptr<LayerImpl> scroller = | 6557 std::unique_ptr<LayerImpl> scroller = |
| 6579 LayerImpl::Create(host_impl.active_tree(), 3); | 6558 LayerImpl::Create(host_impl.active_tree(), 3); |
| 6580 LayerImpl* scroll_layer = scroller.get(); | 6559 LayerImpl* scroll_layer = scroller.get(); |
| (...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7588 private: | 7567 private: |
| 7589 explicit AnimationScaleFactorTrackingLayerImpl(LayerTreeImpl* tree_impl, | 7568 explicit AnimationScaleFactorTrackingLayerImpl(LayerTreeImpl* tree_impl, |
| 7590 int id) | 7569 int id) |
| 7591 : LayerImpl(tree_impl, id) { | 7570 : LayerImpl(tree_impl, id) { |
| 7592 SetDrawsContent(true); | 7571 SetDrawsContent(true); |
| 7593 } | 7572 } |
| 7594 }; | 7573 }; |
| 7595 | 7574 |
| 7596 TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) { | 7575 TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) { |
| 7597 FakeImplTaskRunnerProvider task_runner_provider; | 7576 FakeImplTaskRunnerProvider task_runner_provider; |
| 7598 TestSharedBitmapManager shared_bitmap_manager; | |
| 7599 TestTaskGraphRunner task_graph_runner; | 7577 TestTaskGraphRunner task_graph_runner; |
| 7600 LayerTreeSettings settings = host()->GetSettings(); | 7578 LayerTreeSettings settings = host()->GetSettings(); |
| 7601 settings.layer_transforms_should_scale_layer_contents = true; | 7579 settings.layer_transforms_should_scale_layer_contents = true; |
| 7602 FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider, | 7580 FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider, |
| 7603 &shared_bitmap_manager, &task_graph_runner); | 7581 &task_graph_runner); |
| 7604 std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> grand_parent = | 7582 std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> grand_parent = |
| 7605 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 1); | 7583 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 1); |
| 7606 std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> parent = | 7584 std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> parent = |
| 7607 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 2); | 7585 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 2); |
| 7608 std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> child = | 7586 std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> child = |
| 7609 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 3); | 7587 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 3); |
| 7610 std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> grand_child = | 7588 std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> grand_child = |
| 7611 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 4); | 7589 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 4); |
| 7612 | 7590 |
| 7613 AnimationScaleFactorTrackingLayerImpl* parent_raw = parent.get(); | 7591 AnimationScaleFactorTrackingLayerImpl* parent_raw = parent.get(); |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7846 if (!it.represents_contributing_render_surface()) | 7824 if (!it.represents_contributing_render_surface()) |
| 7847 continue; | 7825 continue; |
| 7848 | 7826 |
| 7849 if (layer->render_surface()->MaskLayer()) | 7827 if (layer->render_surface()->MaskLayer()) |
| 7850 drawn_layers->insert(layer->render_surface()->MaskLayer()); | 7828 drawn_layers->insert(layer->render_surface()->MaskLayer()); |
| 7851 } | 7829 } |
| 7852 } | 7830 } |
| 7853 | 7831 |
| 7854 TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) { | 7832 TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) { |
| 7855 FakeImplTaskRunnerProvider task_runner_provider; | 7833 FakeImplTaskRunnerProvider task_runner_provider; |
| 7856 TestSharedBitmapManager shared_bitmap_manager; | |
| 7857 TestTaskGraphRunner task_graph_runner; | 7834 TestTaskGraphRunner task_graph_runner; |
| 7858 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, | 7835 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); |
| 7859 &task_graph_runner); | |
| 7860 | 7836 |
| 7861 std::unique_ptr<LayerImpl> grand_parent = | 7837 std::unique_ptr<LayerImpl> grand_parent = |
| 7862 LayerImpl::Create(host_impl.active_tree(), 1); | 7838 LayerImpl::Create(host_impl.active_tree(), 1); |
| 7863 std::unique_ptr<LayerImpl> parent = | 7839 std::unique_ptr<LayerImpl> parent = |
| 7864 LayerImpl::Create(host_impl.active_tree(), 3); | 7840 LayerImpl::Create(host_impl.active_tree(), 3); |
| 7865 std::unique_ptr<LayerImpl> child = | 7841 std::unique_ptr<LayerImpl> child = |
| 7866 LayerImpl::Create(host_impl.active_tree(), 5); | 7842 LayerImpl::Create(host_impl.active_tree(), 5); |
| 7867 std::unique_ptr<LayerImpl> grand_child1 = | 7843 std::unique_ptr<LayerImpl> grand_child1 = |
| 7868 LayerImpl::Create(host_impl.active_tree(), 7); | 7844 LayerImpl::Create(host_impl.active_tree(), 7); |
| 7869 std::unique_ptr<LayerImpl> grand_child2 = | 7845 std::unique_ptr<LayerImpl> grand_child2 = |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8072 expected.insert(grand_child1_raw); | 8048 expected.insert(grand_child1_raw); |
| 8073 expected.insert(grand_child2_raw); | 8049 expected.insert(grand_child2_raw); |
| 8074 | 8050 |
| 8075 actual.clear(); | 8051 actual.clear(); |
| 8076 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); | 8052 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); |
| 8077 EXPECT_EQ(expected, actual); | 8053 EXPECT_EQ(expected, actual); |
| 8078 } | 8054 } |
| 8079 | 8055 |
| 8080 TEST_F(LayerTreeHostCommonTest, DrawPropertyScales) { | 8056 TEST_F(LayerTreeHostCommonTest, DrawPropertyScales) { |
| 8081 FakeImplTaskRunnerProvider task_runner_provider; | 8057 FakeImplTaskRunnerProvider task_runner_provider; |
| 8082 TestSharedBitmapManager shared_bitmap_manager; | |
| 8083 TestTaskGraphRunner task_graph_runner; | 8058 TestTaskGraphRunner task_graph_runner; |
| 8084 LayerTreeSettings settings = host()->GetSettings(); | 8059 LayerTreeSettings settings = host()->GetSettings(); |
| 8085 settings.layer_transforms_should_scale_layer_contents = true; | 8060 settings.layer_transforms_should_scale_layer_contents = true; |
| 8086 FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider, | 8061 FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider, |
| 8087 &shared_bitmap_manager, &task_graph_runner); | 8062 &task_graph_runner); |
| 8088 | 8063 |
| 8089 std::unique_ptr<LayerImpl> root = | 8064 std::unique_ptr<LayerImpl> root = |
| 8090 LayerImpl::Create(host_impl.active_tree(), 1); | 8065 LayerImpl::Create(host_impl.active_tree(), 1); |
| 8091 LayerImpl* root_layer = root.get(); | 8066 LayerImpl* root_layer = root.get(); |
| 8092 std::unique_ptr<LayerImpl> child1 = | 8067 std::unique_ptr<LayerImpl> child1 = |
| 8093 LayerImpl::Create(host_impl.active_tree(), 2); | 8068 LayerImpl::Create(host_impl.active_tree(), 2); |
| 8094 LayerImpl* child1_layer = child1.get(); | 8069 LayerImpl* child1_layer = child1.get(); |
| 8095 std::unique_ptr<LayerImpl> child2 = | 8070 std::unique_ptr<LayerImpl> child2 = |
| 8096 LayerImpl::Create(host_impl.active_tree(), 3); | 8071 LayerImpl::Create(host_impl.active_tree(), 3); |
| 8097 LayerImpl* child2_layer = child2.get(); | 8072 LayerImpl* child2_layer = child2.get(); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8187 child1_layer->test_properties()->mask_layer->GetIdealContentsScale()); | 8162 child1_layer->test_properties()->mask_layer->GetIdealContentsScale()); |
| 8188 EXPECT_FLOAT_EQ(60.f, child2_layer->GetIdealContentsScale()); | 8163 EXPECT_FLOAT_EQ(60.f, child2_layer->GetIdealContentsScale()); |
| 8189 | 8164 |
| 8190 EXPECT_FLOAT_EQ(0.f, GetMaximumAnimationScale(root_layer)); | 8165 EXPECT_FLOAT_EQ(0.f, GetMaximumAnimationScale(root_layer)); |
| 8191 EXPECT_FLOAT_EQ(0.f, GetMaximumAnimationScale(child1_layer)); | 8166 EXPECT_FLOAT_EQ(0.f, GetMaximumAnimationScale(child1_layer)); |
| 8192 EXPECT_FLOAT_EQ(96.f, GetMaximumAnimationScale(child2_layer)); | 8167 EXPECT_FLOAT_EQ(96.f, GetMaximumAnimationScale(child2_layer)); |
| 8193 } | 8168 } |
| 8194 | 8169 |
| 8195 TEST_F(LayerTreeHostCommonTest, AnimationScales) { | 8170 TEST_F(LayerTreeHostCommonTest, AnimationScales) { |
| 8196 FakeImplTaskRunnerProvider task_runner_provider; | 8171 FakeImplTaskRunnerProvider task_runner_provider; |
| 8197 TestSharedBitmapManager shared_bitmap_manager; | |
| 8198 TestTaskGraphRunner task_graph_runner; | 8172 TestTaskGraphRunner task_graph_runner; |
| 8199 LayerTreeSettings settings = host()->GetSettings(); | 8173 LayerTreeSettings settings = host()->GetSettings(); |
| 8200 settings.layer_transforms_should_scale_layer_contents = true; | 8174 settings.layer_transforms_should_scale_layer_contents = true; |
| 8201 FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider, | 8175 FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider, |
| 8202 &shared_bitmap_manager, &task_graph_runner); | 8176 &task_graph_runner); |
| 8203 | 8177 |
| 8204 std::unique_ptr<LayerImpl> root = | 8178 std::unique_ptr<LayerImpl> root = |
| 8205 LayerImpl::Create(host_impl.active_tree(), 1); | 8179 LayerImpl::Create(host_impl.active_tree(), 1); |
| 8206 LayerImpl* root_layer = root.get(); | 8180 LayerImpl* root_layer = root.get(); |
| 8207 std::unique_ptr<LayerImpl> child1 = | 8181 std::unique_ptr<LayerImpl> child1 = |
| 8208 LayerImpl::Create(host_impl.active_tree(), 2); | 8182 LayerImpl::Create(host_impl.active_tree(), 2); |
| 8209 LayerImpl* child1_layer = child1.get(); | 8183 LayerImpl* child1_layer = child1.get(); |
| 8210 std::unique_ptr<LayerImpl> child2 = | 8184 std::unique_ptr<LayerImpl> child2 = |
| 8211 LayerImpl::Create(host_impl.active_tree(), 3); | 8185 LayerImpl::Create(host_impl.active_tree(), 3); |
| 8212 LayerImpl* child2_layer = child2.get(); | 8186 LayerImpl* child2_layer = child2.get(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8266 child2_layer->transform_tree_index(), 100.f, 100.f); | 8240 child2_layer->transform_tree_index(), 100.f, 100.f); |
| 8267 EXPECT_FLOAT_EQ(100.f, GetMaximumAnimationScale(child2_layer)); | 8241 EXPECT_FLOAT_EQ(100.f, GetMaximumAnimationScale(child2_layer)); |
| 8268 EXPECT_FLOAT_EQ(100.f, GetStartingAnimationScale(child2_layer)); | 8242 EXPECT_FLOAT_EQ(100.f, GetStartingAnimationScale(child2_layer)); |
| 8269 } | 8243 } |
| 8270 | 8244 |
| 8271 TEST_F(LayerTreeHostCommonTest, | 8245 TEST_F(LayerTreeHostCommonTest, |
| 8272 AnimationScaleWhenLayerTransformShouldNotScaleLayerBounds) { | 8246 AnimationScaleWhenLayerTransformShouldNotScaleLayerBounds) { |
| 8273 // Returns empty scale if layer_transforms_should_scale_layer_contents is | 8247 // Returns empty scale if layer_transforms_should_scale_layer_contents is |
| 8274 // false. | 8248 // false. |
| 8275 FakeImplTaskRunnerProvider task_runner_provider; | 8249 FakeImplTaskRunnerProvider task_runner_provider; |
| 8276 TestSharedBitmapManager shared_bitmap_manager; | |
| 8277 TestTaskGraphRunner task_graph_runner; | 8250 TestTaskGraphRunner task_graph_runner; |
| 8278 LayerTreeSettings settings = host()->GetSettings(); | 8251 LayerTreeSettings settings = host()->GetSettings(); |
| 8279 settings.layer_transforms_should_scale_layer_contents = false; | 8252 settings.layer_transforms_should_scale_layer_contents = false; |
| 8280 FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider, | 8253 FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider, |
| 8281 &shared_bitmap_manager, &task_graph_runner); | 8254 &task_graph_runner); |
| 8282 | 8255 |
| 8283 std::unique_ptr<LayerImpl> root = | 8256 std::unique_ptr<LayerImpl> root = |
| 8284 LayerImpl::Create(host_impl.active_tree(), 1); | 8257 LayerImpl::Create(host_impl.active_tree(), 1); |
| 8285 LayerImpl* root_layer = root.get(); | 8258 LayerImpl* root_layer = root.get(); |
| 8286 std::unique_ptr<LayerImpl> child = | 8259 std::unique_ptr<LayerImpl> child = |
| 8287 LayerImpl::Create(host_impl.active_tree(), 2); | 8260 LayerImpl::Create(host_impl.active_tree(), 2); |
| 8288 LayerImpl* child_layer = child.get(); | 8261 LayerImpl* child_layer = child.get(); |
| 8289 | 8262 |
| 8290 root->test_properties()->AddChild(std::move(child)); | 8263 root->test_properties()->AddChild(std::move(child)); |
| 8291 host_impl.active_tree()->SetRootLayerForTesting(std::move(root)); | 8264 host_impl.active_tree()->SetRootLayerForTesting(std::move(root)); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8346 // by the viewport. | 8319 // by the viewport. |
| 8347 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), root->visible_layer_rect()); | 8320 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), root->visible_layer_rect()); |
| 8348 | 8321 |
| 8349 // Layers drawing to a child render surface should still have their visible | 8322 // Layers drawing to a child render surface should still have their visible |
| 8350 // content rect clipped by the viewport. | 8323 // content rect clipped by the viewport. |
| 8351 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), content->visible_layer_rect()); | 8324 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), content->visible_layer_rect()); |
| 8352 } | 8325 } |
| 8353 | 8326 |
| 8354 TEST_F(LayerTreeHostCommonTest, BoundsDeltaAffectVisibleContentRect) { | 8327 TEST_F(LayerTreeHostCommonTest, BoundsDeltaAffectVisibleContentRect) { |
| 8355 FakeImplTaskRunnerProvider task_runner_provider; | 8328 FakeImplTaskRunnerProvider task_runner_provider; |
| 8356 TestSharedBitmapManager shared_bitmap_manager; | |
| 8357 TestTaskGraphRunner task_graph_runner; | 8329 TestTaskGraphRunner task_graph_runner; |
| 8358 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, | 8330 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); |
| 8359 &task_graph_runner); | |
| 8360 | 8331 |
| 8361 // Set two layers: the root layer clips it's child, | 8332 // Set two layers: the root layer clips it's child, |
| 8362 // the child draws its content. | 8333 // the child draws its content. |
| 8363 | 8334 |
| 8364 gfx::Size root_size = gfx::Size(300, 500); | 8335 gfx::Size root_size = gfx::Size(300, 500); |
| 8365 | 8336 |
| 8366 // Sublayer should be bigger than the root enlarged by bounds_delta. | 8337 // Sublayer should be bigger than the root enlarged by bounds_delta. |
| 8367 gfx::Size sublayer_size = gfx::Size(300, 1000); | 8338 gfx::Size sublayer_size = gfx::Size(300, 1000); |
| 8368 | 8339 |
| 8369 // Device viewport accomidated the root and the top controls. | 8340 // Device viewport accomidated the root and the top controls. |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8977 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); | 8948 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); |
| 8978 AddAnimationToElementWithExistingPlayer(child->element_id(), timeline(), | 8949 AddAnimationToElementWithExistingPlayer(child->element_id(), timeline(), |
| 8979 std::move(animation)); | 8950 std::move(animation)); |
| 8980 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get()); | 8951 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get()); |
| 8981 update_list = GetUpdateLayerList(); | 8952 update_list = GetUpdateLayerList(); |
| 8982 EXPECT_TRUE(VerifyLayerInList(grandchild, update_list)); | 8953 EXPECT_TRUE(VerifyLayerInList(grandchild, update_list)); |
| 8983 } | 8954 } |
| 8984 | 8955 |
| 8985 TEST_F(LayerTreeHostCommonTest, SkippingLayerImpl) { | 8956 TEST_F(LayerTreeHostCommonTest, SkippingLayerImpl) { |
| 8986 FakeImplTaskRunnerProvider task_runner_provider; | 8957 FakeImplTaskRunnerProvider task_runner_provider; |
| 8987 TestSharedBitmapManager shared_bitmap_manager; | |
| 8988 TestTaskGraphRunner task_graph_runner; | 8958 TestTaskGraphRunner task_graph_runner; |
| 8989 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, | 8959 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); |
| 8990 &task_graph_runner); | |
| 8991 | 8960 |
| 8992 std::unique_ptr<LayerImpl> root = | 8961 std::unique_ptr<LayerImpl> root = |
| 8993 LayerImpl::Create(host_impl.active_tree(), 1); | 8962 LayerImpl::Create(host_impl.active_tree(), 1); |
| 8994 std::unique_ptr<LayerImpl> child = | 8963 std::unique_ptr<LayerImpl> child = |
| 8995 LayerImpl::Create(host_impl.active_tree(), 2); | 8964 LayerImpl::Create(host_impl.active_tree(), 2); |
| 8996 std::unique_ptr<LayerImpl> grandchild = | 8965 std::unique_ptr<LayerImpl> grandchild = |
| 8997 LayerImpl::Create(host_impl.active_tree(), 3); | 8966 LayerImpl::Create(host_impl.active_tree(), 3); |
| 8998 | 8967 |
| 8999 std::unique_ptr<FakePictureLayerImpl> greatgrandchild( | 8968 std::unique_ptr<FakePictureLayerImpl> greatgrandchild( |
| 9000 FakePictureLayerImpl::Create(host_impl.active_tree(), 4)); | 8969 FakePictureLayerImpl::Create(host_impl.active_tree(), 4)); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9166 ExecuteCalculateDrawProperties(root); | 9135 ExecuteCalculateDrawProperties(root); |
| 9167 EXPECT_EQ(gfx::Rect(0, 0), grand_child->visible_layer_rect()); | 9136 EXPECT_EQ(gfx::Rect(0, 0), grand_child->visible_layer_rect()); |
| 9168 EXPECT_EQ(gfx::Rect(0, 0), child->visible_layer_rect()); | 9137 EXPECT_EQ(gfx::Rect(0, 0), child->visible_layer_rect()); |
| 9169 | 9138 |
| 9170 host_impl()->active_tree()->animation_host()->UnregisterPlayerForElement( | 9139 host_impl()->active_tree()->animation_host()->UnregisterPlayerForElement( |
| 9171 grand_child->element_id(), player.get()); | 9140 grand_child->element_id(), player.get()); |
| 9172 } | 9141 } |
| 9173 | 9142 |
| 9174 TEST_F(LayerTreeHostCommonTest, SkippingPendingLayerImpl) { | 9143 TEST_F(LayerTreeHostCommonTest, SkippingPendingLayerImpl) { |
| 9175 FakeImplTaskRunnerProvider task_runner_provider; | 9144 FakeImplTaskRunnerProvider task_runner_provider; |
| 9176 TestSharedBitmapManager shared_bitmap_manager; | |
| 9177 TestTaskGraphRunner task_graph_runner; | 9145 TestTaskGraphRunner task_graph_runner; |
| 9178 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, | 9146 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); |
| 9179 &task_graph_runner); | |
| 9180 | 9147 |
| 9181 host_impl.CreatePendingTree(); | 9148 host_impl.CreatePendingTree(); |
| 9182 std::unique_ptr<LayerImpl> root = | 9149 std::unique_ptr<LayerImpl> root = |
| 9183 LayerImpl::Create(host_impl.pending_tree(), 1); | 9150 LayerImpl::Create(host_impl.pending_tree(), 1); |
| 9184 std::unique_ptr<LayerImpl> child = | 9151 std::unique_ptr<LayerImpl> child = |
| 9185 LayerImpl::Create(host_impl.pending_tree(), 2); | 9152 LayerImpl::Create(host_impl.pending_tree(), 2); |
| 9186 std::unique_ptr<LayerImpl> grandchild = | 9153 std::unique_ptr<LayerImpl> grandchild = |
| 9187 LayerImpl::Create(host_impl.pending_tree(), 3); | 9154 LayerImpl::Create(host_impl.pending_tree(), 3); |
| 9188 | 9155 |
| 9189 std::unique_ptr<FakePictureLayerImpl> greatgrandchild( | 9156 std::unique_ptr<FakePictureLayerImpl> greatgrandchild( |
| (...skipping 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10374 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); | 10341 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); |
| 10375 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); | 10342 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); |
| 10376 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); | 10343 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); |
| 10377 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); | 10344 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); |
| 10378 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); | 10345 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); |
| 10379 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); | 10346 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); |
| 10380 } | 10347 } |
| 10381 | 10348 |
| 10382 } // namespace | 10349 } // namespace |
| 10383 } // namespace cc | 10350 } // namespace cc |
| OLD | NEW |