| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "cc/animation/keyframed_animation_curve.h" | 10 #include "cc/animation/keyframed_animation_curve.h" |
| 11 #include "cc/animation/layer_animation_controller.h" | 11 #include "cc/animation/layer_animation_controller.h" |
| 12 #include "cc/animation/transform_operations.h" | 12 #include "cc/animation/transform_operations.h" |
| 13 #include "cc/base/math_util.h" | 13 #include "cc/base/math_util.h" |
| 14 #include "cc/layers/content_layer_client.h" | 14 #include "cc/layers/content_layer_client.h" |
| 15 #include "cc/layers/layer.h" | 15 #include "cc/layers/layer.h" |
| 16 #include "cc/layers/layer_client.h" | 16 #include "cc/layers/layer_client.h" |
| 17 #include "cc/layers/layer_impl.h" | 17 #include "cc/layers/layer_impl.h" |
| 18 #include "cc/layers/layer_iterator.h" | 18 #include "cc/layers/layer_iterator.h" |
| 19 #include "cc/layers/render_surface_impl.h" | 19 #include "cc/layers/render_surface_impl.h" |
| 20 #include "cc/output/copy_output_request.h" | 20 #include "cc/output/copy_output_request.h" |
| 21 #include "cc/output/copy_output_result.h" | 21 #include "cc/output/copy_output_result.h" |
| 22 #include "cc/test/animation_test_common.h" | 22 #include "cc/test/animation_test_common.h" |
| 23 #include "cc/test/fake_content_layer_client.h" | 23 #include "cc/test/fake_content_layer_client.h" |
| 24 #include "cc/test/fake_impl_proxy.h" | 24 #include "cc/test/fake_impl_task_runner_provider.h" |
| 25 #include "cc/test/fake_layer_tree_host.h" | 25 #include "cc/test/fake_layer_tree_host.h" |
| 26 #include "cc/test/fake_layer_tree_host_impl.h" | 26 #include "cc/test/fake_layer_tree_host_impl.h" |
| 27 #include "cc/test/fake_output_surface.h" | 27 #include "cc/test/fake_output_surface.h" |
| 28 #include "cc/test/fake_picture_layer.h" | 28 #include "cc/test/fake_picture_layer.h" |
| 29 #include "cc/test/fake_picture_layer_impl.h" | 29 #include "cc/test/fake_picture_layer_impl.h" |
| 30 #include "cc/test/geometry_test_utils.h" | 30 #include "cc/test/geometry_test_utils.h" |
| 31 #include "cc/test/layer_tree_host_common_test.h" | 31 #include "cc/test/layer_tree_host_common_test.h" |
| 32 #include "cc/test/test_task_graph_runner.h" | 32 #include "cc/test/test_task_graph_runner.h" |
| 33 #include "cc/trees/draw_property_utils.h" | 33 #include "cc/trees/draw_property_utils.h" |
| 34 #include "cc/trees/layer_tree_impl.h" | 34 #include "cc/trees/layer_tree_impl.h" |
| 35 #include "cc/trees/proxy.h" | |
| 36 #include "cc/trees/single_thread_proxy.h" | 35 #include "cc/trees/single_thread_proxy.h" |
| 36 #include "cc/trees/task_runner_provider.h" |
| 37 #include "testing/gmock/include/gmock/gmock.h" | 37 #include "testing/gmock/include/gmock/gmock.h" |
| 38 #include "testing/gtest/include/gtest/gtest.h" | 38 #include "testing/gtest/include/gtest/gtest.h" |
| 39 #include "ui/gfx/geometry/quad_f.h" | 39 #include "ui/gfx/geometry/quad_f.h" |
| 40 #include "ui/gfx/geometry/vector2d_conversions.h" | 40 #include "ui/gfx/geometry/vector2d_conversions.h" |
| 41 #include "ui/gfx/transform.h" | 41 #include "ui/gfx/transform.h" |
| 42 | 42 |
| 43 namespace cc { | 43 namespace cc { |
| 44 namespace { | 44 namespace { |
| 45 | 45 |
| 46 class LayerWithForcedDrawsContent : public Layer { | 46 class LayerWithForcedDrawsContent : public Layer { |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 | 270 |
| 271 TEST_F(LayerTreeHostCommonTest, TransformsAboutScrollOffset) { | 271 TEST_F(LayerTreeHostCommonTest, TransformsAboutScrollOffset) { |
| 272 const gfx::ScrollOffset kScrollOffset(50, 100); | 272 const gfx::ScrollOffset kScrollOffset(50, 100); |
| 273 const gfx::Vector2dF kScrollDelta(2.34f, 5.67f); | 273 const gfx::Vector2dF kScrollDelta(2.34f, 5.67f); |
| 274 const gfx::Vector2d kMaxScrollOffset(200, 200); | 274 const gfx::Vector2d kMaxScrollOffset(200, 200); |
| 275 const gfx::PointF kScrollLayerPosition(-kScrollOffset.x(), | 275 const gfx::PointF kScrollLayerPosition(-kScrollOffset.x(), |
| 276 -kScrollOffset.y()); | 276 -kScrollOffset.y()); |
| 277 const float kPageScale = 0.888f; | 277 const float kPageScale = 0.888f; |
| 278 const float kDeviceScale = 1.666f; | 278 const float kDeviceScale = 1.666f; |
| 279 | 279 |
| 280 FakeImplProxy proxy; | 280 FakeImplTaskRunnerProvider task_runner_provider; |
| 281 TestSharedBitmapManager shared_bitmap_manager; | 281 TestSharedBitmapManager shared_bitmap_manager; |
| 282 TestTaskGraphRunner task_graph_runner; | 282 TestTaskGraphRunner task_graph_runner; |
| 283 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, | 283 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, |
| 284 &task_graph_runner); | 284 &task_graph_runner); |
| 285 | 285 |
| 286 gfx::Transform identity_matrix; | 286 gfx::Transform identity_matrix; |
| 287 scoped_ptr<LayerImpl> sublayer_scoped_ptr( | 287 scoped_ptr<LayerImpl> sublayer_scoped_ptr( |
| 288 LayerImpl::Create(host_impl.active_tree(), 1)); | 288 LayerImpl::Create(host_impl.active_tree(), 1)); |
| 289 LayerImpl* sublayer = sublayer_scoped_ptr.get(); | 289 LayerImpl* sublayer = sublayer_scoped_ptr.get(); |
| 290 SetLayerPropertiesForTesting(sublayer, identity_matrix, gfx::Point3F(), | 290 SetLayerPropertiesForTesting(sublayer, identity_matrix, gfx::Point3F(), |
| 291 gfx::PointF(), gfx::Size(500, 500), true, false, | 291 gfx::PointF(), gfx::Size(500, 500), true, false, |
| 292 false); | 292 false); |
| 293 | 293 |
| (...skipping 2912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3206 // skipping decisions before computing a layer's draw transform. Property | 3206 // skipping decisions before computing a layer's draw transform. Property |
| 3207 // trees make skipping decisions after computing draw transforms, so could be | 3207 // trees make skipping decisions after computing draw transforms, so could be |
| 3208 // made to skip layers with an uninvertible draw transform (once CDP is | 3208 // made to skip layers with an uninvertible draw transform (once CDP is |
| 3209 // deleted). | 3209 // deleted). |
| 3210 EXPECT_EQ(gfx::Rect(grand_child->bounds()), | 3210 EXPECT_EQ(gfx::Rect(grand_child->bounds()), |
| 3211 grand_child->visible_layer_rect()); | 3211 grand_child->visible_layer_rect()); |
| 3212 } | 3212 } |
| 3213 | 3213 |
| 3214 TEST_F(LayerTreeHostCommonTest, | 3214 TEST_F(LayerTreeHostCommonTest, |
| 3215 OcclusionForLayerWithUninvertibleDrawTransform) { | 3215 OcclusionForLayerWithUninvertibleDrawTransform) { |
| 3216 FakeImplProxy proxy; | 3216 FakeImplTaskRunnerProvider task_runner_provider; |
| 3217 TestSharedBitmapManager shared_bitmap_manager; | 3217 TestSharedBitmapManager shared_bitmap_manager; |
| 3218 TestTaskGraphRunner task_graph_runner; | 3218 TestTaskGraphRunner task_graph_runner; |
| 3219 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d(); | 3219 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d(); |
| 3220 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, | 3220 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, |
| 3221 &task_graph_runner); | 3221 &task_graph_runner); |
| 3222 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); | 3222 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); |
| 3223 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.active_tree(), 2); | 3223 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.active_tree(), 2); |
| 3224 scoped_ptr<LayerImpl> grand_child = | 3224 scoped_ptr<LayerImpl> grand_child = |
| 3225 LayerImpl::Create(host_impl.active_tree(), 3); | 3225 LayerImpl::Create(host_impl.active_tree(), 3); |
| 3226 scoped_ptr<LayerImpl> occluding_child = | 3226 scoped_ptr<LayerImpl> occluding_child = |
| 3227 LayerImpl::Create(host_impl.active_tree(), 4); | 3227 LayerImpl::Create(host_impl.active_tree(), 4); |
| 3228 child->SetDrawsContent(true); | 3228 child->SetDrawsContent(true); |
| 3229 grand_child->SetDrawsContent(true); | 3229 grand_child->SetDrawsContent(true); |
| 3230 occluding_child->SetDrawsContent(true); | 3230 occluding_child->SetDrawsContent(true); |
| (...skipping 1599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4830 child->SetOpacity(0.5f); | 4830 child->SetOpacity(0.5f); |
| 4831 | 4831 |
| 4832 host()->SetRootLayer(root); | 4832 host()->SetRootLayer(root); |
| 4833 | 4833 |
| 4834 ExecuteCalculateDrawProperties(root.get()); | 4834 ExecuteCalculateDrawProperties(root.get()); |
| 4835 | 4835 |
| 4836 EXPECT_FALSE(child->has_render_surface()); | 4836 EXPECT_FALSE(child->has_render_surface()); |
| 4837 } | 4837 } |
| 4838 | 4838 |
| 4839 TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) { | 4839 TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) { |
| 4840 FakeImplProxy proxy; | 4840 FakeImplTaskRunnerProvider task_runner_provider; |
| 4841 TestSharedBitmapManager shared_bitmap_manager; | 4841 TestSharedBitmapManager shared_bitmap_manager; |
| 4842 TestTaskGraphRunner task_graph_runner; | 4842 TestTaskGraphRunner task_graph_runner; |
| 4843 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, | 4843 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, |
| 4844 &task_graph_runner); | 4844 &task_graph_runner); |
| 4845 host_impl.CreatePendingTree(); | 4845 host_impl.CreatePendingTree(); |
| 4846 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); | 4846 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); |
| 4847 | 4847 |
| 4848 const gfx::Transform identity_matrix; | 4848 const gfx::Transform identity_matrix; |
| 4849 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), | 4849 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
| 4850 gfx::PointF(), gfx::Size(100, 100), true, false, | 4850 gfx::PointF(), gfx::Size(100, 100), true, false, |
| 4851 false); | 4851 false); |
| 4852 root->SetDrawsContent(true); | 4852 root->SetDrawsContent(true); |
| 4853 | 4853 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 4876 ASSERT_EQ(1u, render_surface_layer_list.size()); | 4876 ASSERT_EQ(1u, render_surface_layer_list.size()); |
| 4877 ASSERT_EQ(2u, root->render_surface()->layer_list().size()); | 4877 ASSERT_EQ(2u, root->render_surface()->layer_list().size()); |
| 4878 } | 4878 } |
| 4879 | 4879 |
| 4880 using LCDTextTestParam = std::tr1::tuple<bool, bool, bool>; | 4880 using LCDTextTestParam = std::tr1::tuple<bool, bool, bool>; |
| 4881 class LCDTextTest : public LayerTreeHostCommonTestBase, | 4881 class LCDTextTest : public LayerTreeHostCommonTestBase, |
| 4882 public testing::TestWithParam<LCDTextTestParam> { | 4882 public testing::TestWithParam<LCDTextTestParam> { |
| 4883 public: | 4883 public: |
| 4884 LCDTextTest() | 4884 LCDTextTest() |
| 4885 : LayerTreeHostCommonTestBase(LayerTreeSettings()), | 4885 : LayerTreeHostCommonTestBase(LayerTreeSettings()), |
| 4886 host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_), | 4886 host_impl_(&task_runner_provider_, |
| 4887 &shared_bitmap_manager_, |
| 4888 &task_graph_runner_), |
| 4887 root_(nullptr), | 4889 root_(nullptr), |
| 4888 child_(nullptr), | 4890 child_(nullptr), |
| 4889 grand_child_(nullptr) {} | 4891 grand_child_(nullptr) {} |
| 4890 | 4892 |
| 4891 protected: | 4893 protected: |
| 4892 void SetUp() override { | 4894 void SetUp() override { |
| 4893 can_use_lcd_text_ = std::tr1::get<0>(GetParam()); | 4895 can_use_lcd_text_ = std::tr1::get<0>(GetParam()); |
| 4894 layers_always_allowed_lcd_text_ = std::tr1::get<1>(GetParam()); | 4896 layers_always_allowed_lcd_text_ = std::tr1::get<1>(GetParam()); |
| 4895 | 4897 |
| 4896 scoped_ptr<LayerImpl> root_ptr = | 4898 scoped_ptr<LayerImpl> root_ptr = |
| (...skipping 28 matching lines...) Expand all Loading... |
| 4925 gfx::PointF(), gfx::Size(1, 1), true, false, | 4927 gfx::PointF(), gfx::Size(1, 1), true, false, |
| 4926 std::tr1::get<2>(GetParam())); | 4928 std::tr1::get<2>(GetParam())); |
| 4927 SetLayerPropertiesForTesting(grand_child_, identity_matrix, gfx::Point3F(), | 4929 SetLayerPropertiesForTesting(grand_child_, identity_matrix, gfx::Point3F(), |
| 4928 gfx::PointF(), gfx::Size(1, 1), true, false, | 4930 gfx::PointF(), gfx::Size(1, 1), true, false, |
| 4929 false); | 4931 false); |
| 4930 } | 4932 } |
| 4931 | 4933 |
| 4932 bool can_use_lcd_text_; | 4934 bool can_use_lcd_text_; |
| 4933 bool layers_always_allowed_lcd_text_; | 4935 bool layers_always_allowed_lcd_text_; |
| 4934 | 4936 |
| 4935 FakeImplProxy proxy_; | 4937 FakeImplTaskRunnerProvider task_runner_provider_; |
| 4936 TestSharedBitmapManager shared_bitmap_manager_; | 4938 TestSharedBitmapManager shared_bitmap_manager_; |
| 4937 TestTaskGraphRunner task_graph_runner_; | 4939 TestTaskGraphRunner task_graph_runner_; |
| 4938 FakeLayerTreeHostImpl host_impl_; | 4940 FakeLayerTreeHostImpl host_impl_; |
| 4939 | 4941 |
| 4940 LayerImpl* root_; | 4942 LayerImpl* root_; |
| 4941 LayerImpl* child_; | 4943 LayerImpl* child_; |
| 4942 LayerImpl* grand_child_; | 4944 LayerImpl* grand_child_; |
| 4943 }; | 4945 }; |
| 4944 | 4946 |
| 4945 TEST_P(LCDTextTest, CanUseLCDText) { | 4947 TEST_P(LCDTextTest, CanUseLCDText) { |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5095 EXPECT_EQ(expect_lcd_text, grand_child_->can_use_lcd_text()); | 5097 EXPECT_EQ(expect_lcd_text, grand_child_->can_use_lcd_text()); |
| 5096 } | 5098 } |
| 5097 | 5099 |
| 5098 INSTANTIATE_TEST_CASE_P(LayerTreeHostCommonTest, | 5100 INSTANTIATE_TEST_CASE_P(LayerTreeHostCommonTest, |
| 5099 LCDTextTest, | 5101 LCDTextTest, |
| 5100 testing::Combine(testing::Bool(), | 5102 testing::Combine(testing::Bool(), |
| 5101 testing::Bool(), | 5103 testing::Bool(), |
| 5102 testing::Bool())); | 5104 testing::Bool())); |
| 5103 | 5105 |
| 5104 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayerImpl) { | 5106 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayerImpl) { |
| 5105 FakeImplProxy proxy; | 5107 FakeImplTaskRunnerProvider task_runner_provider; |
| 5106 TestSharedBitmapManager shared_bitmap_manager; | 5108 TestSharedBitmapManager shared_bitmap_manager; |
| 5107 TestTaskGraphRunner task_graph_runner; | 5109 TestTaskGraphRunner task_graph_runner; |
| 5108 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, | 5110 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, |
| 5109 &task_graph_runner); | 5111 &task_graph_runner); |
| 5110 host_impl.CreatePendingTree(); | 5112 host_impl.CreatePendingTree(); |
| 5111 const gfx::Transform identity_matrix; | 5113 const gfx::Transform identity_matrix; |
| 5112 | 5114 |
| 5113 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); | 5115 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); |
| 5114 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), | 5116 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
| 5115 gfx::PointF(), gfx::Size(50, 50), true, false, | 5117 gfx::PointF(), gfx::Size(50, 50), true, false, |
| 5116 false); | 5118 false); |
| 5117 root->SetDrawsContent(true); | 5119 root->SetDrawsContent(true); |
| 5118 | 5120 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 5142 | 5144 |
| 5143 // We should have one render surface and two layers. The grand child has | 5145 // We should have one render surface and two layers. The grand child has |
| 5144 // hidden itself. | 5146 // hidden itself. |
| 5145 ASSERT_EQ(1u, render_surface_layer_list.size()); | 5147 ASSERT_EQ(1u, render_surface_layer_list.size()); |
| 5146 ASSERT_EQ(2u, root->render_surface()->layer_list().size()); | 5148 ASSERT_EQ(2u, root->render_surface()->layer_list().size()); |
| 5147 EXPECT_EQ(1, root->render_surface()->layer_list().at(0)->id()); | 5149 EXPECT_EQ(1, root->render_surface()->layer_list().at(0)->id()); |
| 5148 EXPECT_EQ(2, root->render_surface()->layer_list().at(1)->id()); | 5150 EXPECT_EQ(2, root->render_surface()->layer_list().at(1)->id()); |
| 5149 } | 5151 } |
| 5150 | 5152 |
| 5151 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayersImpl) { | 5153 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayersImpl) { |
| 5152 FakeImplProxy proxy; | 5154 FakeImplTaskRunnerProvider task_runner_provider; |
| 5153 TestSharedBitmapManager shared_bitmap_manager; | 5155 TestSharedBitmapManager shared_bitmap_manager; |
| 5154 TestTaskGraphRunner task_graph_runner; | 5156 TestTaskGraphRunner task_graph_runner; |
| 5155 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, | 5157 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, |
| 5156 &task_graph_runner); | 5158 &task_graph_runner); |
| 5157 host_impl.CreatePendingTree(); | 5159 host_impl.CreatePendingTree(); |
| 5158 const gfx::Transform identity_matrix; | 5160 const gfx::Transform identity_matrix; |
| 5159 | 5161 |
| 5160 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); | 5162 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); |
| 5161 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), | 5163 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
| 5162 gfx::PointF(), gfx::Size(50, 50), true, false, | 5164 gfx::PointF(), gfx::Size(50, 50), true, false, |
| 5163 true); | 5165 true); |
| 5164 root->SetDrawsContent(true); | 5166 root->SetDrawsContent(true); |
| 5165 | 5167 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 5189 // We should have one render surface and one layers. The child has | 5191 // We should have one render surface and one layers. The child has |
| 5190 // hidden itself and the grand child. | 5192 // hidden itself and the grand child. |
| 5191 ASSERT_EQ(1u, render_surface_layer_list.size()); | 5193 ASSERT_EQ(1u, render_surface_layer_list.size()); |
| 5192 ASSERT_EQ(1u, root->render_surface()->layer_list().size()); | 5194 ASSERT_EQ(1u, root->render_surface()->layer_list().size()); |
| 5193 EXPECT_EQ(1, root->render_surface()->layer_list().at(0)->id()); | 5195 EXPECT_EQ(1, root->render_surface()->layer_list().at(0)->id()); |
| 5194 } | 5196 } |
| 5195 | 5197 |
| 5196 void EmptyCopyOutputCallback(scoped_ptr<CopyOutputResult> result) {} | 5198 void EmptyCopyOutputCallback(scoped_ptr<CopyOutputResult> result) {} |
| 5197 | 5199 |
| 5198 TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) { | 5200 TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) { |
| 5199 FakeImplProxy proxy; | 5201 FakeImplTaskRunnerProvider task_runner_provider; |
| 5200 TestSharedBitmapManager shared_bitmap_manager; | 5202 TestSharedBitmapManager shared_bitmap_manager; |
| 5201 TestTaskGraphRunner task_graph_runner; | 5203 TestTaskGraphRunner task_graph_runner; |
| 5202 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, | 5204 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, |
| 5203 &task_graph_runner); | 5205 &task_graph_runner); |
| 5204 host_impl.CreatePendingTree(); | 5206 host_impl.CreatePendingTree(); |
| 5205 const gfx::Transform identity_matrix; | 5207 const gfx::Transform identity_matrix; |
| 5206 | 5208 |
| 5207 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); | 5209 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); |
| 5208 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), | 5210 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
| 5209 gfx::PointF(), gfx::Size(50, 50), true, false, | 5211 gfx::PointF(), gfx::Size(50, 50), true, false, |
| 5210 true); | 5212 true); |
| 5211 root->SetDrawsContent(true); | 5213 root->SetDrawsContent(true); |
| 5212 | 5214 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5322 | 5324 |
| 5323 // The copy_layer's render surface should have two contributing layers. | 5325 // The copy_layer's render surface should have two contributing layers. |
| 5324 ASSERT_EQ(2u, copy_layer->render_surface()->layer_list().size()); | 5326 ASSERT_EQ(2u, copy_layer->render_surface()->layer_list().size()); |
| 5325 EXPECT_EQ(copy_layer->id(), | 5327 EXPECT_EQ(copy_layer->id(), |
| 5326 copy_layer->render_surface()->layer_list().at(0)->id()); | 5328 copy_layer->render_surface()->layer_list().at(0)->id()); |
| 5327 EXPECT_EQ(copy_child_layer->id(), | 5329 EXPECT_EQ(copy_child_layer->id(), |
| 5328 copy_layer->render_surface()->layer_list().at(1)->id()); | 5330 copy_layer->render_surface()->layer_list().at(1)->id()); |
| 5329 } | 5331 } |
| 5330 | 5332 |
| 5331 TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) { | 5333 TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) { |
| 5332 FakeImplProxy proxy; | 5334 FakeImplTaskRunnerProvider task_runner_provider; |
| 5333 TestSharedBitmapManager shared_bitmap_manager; | 5335 TestSharedBitmapManager shared_bitmap_manager; |
| 5334 TestTaskGraphRunner task_graph_runner; | 5336 TestTaskGraphRunner task_graph_runner; |
| 5335 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, | 5337 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, |
| 5336 &task_graph_runner); | 5338 &task_graph_runner); |
| 5337 host_impl.CreatePendingTree(); | 5339 host_impl.CreatePendingTree(); |
| 5338 const gfx::Transform identity_matrix; | 5340 const gfx::Transform identity_matrix; |
| 5339 | 5341 |
| 5340 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); | 5342 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); |
| 5341 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), | 5343 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
| 5342 gfx::PointF(), gfx::Size(50, 50), true, false, | 5344 gfx::PointF(), gfx::Size(50, 50), true, false, |
| 5343 true); | 5345 true); |
| 5344 root->SetDrawsContent(true); | 5346 root->SetDrawsContent(true); |
| 5345 | 5347 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5385 ASSERT_EQ(1u, render_surface_layer_list.size()); | 5387 ASSERT_EQ(1u, render_surface_layer_list.size()); |
| 5386 EXPECT_EQ(root->id(), render_surface_layer_list.at(0)->id()); | 5388 EXPECT_EQ(root->id(), render_surface_layer_list.at(0)->id()); |
| 5387 | 5389 |
| 5388 // The root render surface should only have 1 contributing layer, since the | 5390 // The root render surface should only have 1 contributing layer, since the |
| 5389 // other layers are empty/clipped away. | 5391 // other layers are empty/clipped away. |
| 5390 ASSERT_EQ(1u, root->render_surface()->layer_list().size()); | 5392 ASSERT_EQ(1u, root->render_surface()->layer_list().size()); |
| 5391 EXPECT_EQ(root->id(), root->render_surface()->layer_list().at(0)->id()); | 5393 EXPECT_EQ(root->id(), root->render_surface()->layer_list().at(0)->id()); |
| 5392 } | 5394 } |
| 5393 | 5395 |
| 5394 TEST_F(LayerTreeHostCommonTest, VisibleContentRectInsideSurface) { | 5396 TEST_F(LayerTreeHostCommonTest, VisibleContentRectInsideSurface) { |
| 5395 FakeImplProxy proxy; | 5397 FakeImplTaskRunnerProvider task_runner_provider; |
| 5396 TestSharedBitmapManager shared_bitmap_manager; | 5398 TestSharedBitmapManager shared_bitmap_manager; |
| 5397 TestTaskGraphRunner task_graph_runner; | 5399 TestTaskGraphRunner task_graph_runner; |
| 5398 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, | 5400 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, |
| 5399 &task_graph_runner); | 5401 &task_graph_runner); |
| 5400 host_impl.CreatePendingTree(); | 5402 host_impl.CreatePendingTree(); |
| 5401 const gfx::Transform identity_matrix; | 5403 const gfx::Transform identity_matrix; |
| 5402 | 5404 |
| 5403 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 5405 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 5404 SetLayerPropertiesForTesting(root.get(), | 5406 SetLayerPropertiesForTesting(root.get(), |
| 5405 identity_matrix, | 5407 identity_matrix, |
| 5406 gfx::Point3F(), | 5408 gfx::Point3F(), |
| 5407 gfx::PointF(), | 5409 gfx::PointF(), |
| 5408 gfx::Size(50, 50), | 5410 gfx::Size(50, 50), |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5837 // It also shouldn't have grown to accomodate the clip child. | 5839 // It also shouldn't have grown to accomodate the clip child. |
| 5838 EXPECT_EQ(gfx::Rect(0, 0, 5, 5).ToString(), | 5840 EXPECT_EQ(gfx::Rect(0, 0, 5, 5).ToString(), |
| 5839 render_surface2->render_surface()->content_rect().ToString()); | 5841 render_surface2->render_surface()->content_rect().ToString()); |
| 5840 | 5842 |
| 5841 // Sanity check our num_unclipped_descendants values. | 5843 // Sanity check our num_unclipped_descendants values. |
| 5842 EXPECT_EQ(1u, render_surface1->num_unclipped_descendants()); | 5844 EXPECT_EQ(1u, render_surface1->num_unclipped_descendants()); |
| 5843 EXPECT_EQ(0u, render_surface2->num_unclipped_descendants()); | 5845 EXPECT_EQ(0u, render_surface2->num_unclipped_descendants()); |
| 5844 } | 5846 } |
| 5845 | 5847 |
| 5846 TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) { | 5848 TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) { |
| 5847 FakeImplProxy proxy; | 5849 FakeImplTaskRunnerProvider task_runner_provider; |
| 5848 TestSharedBitmapManager shared_bitmap_manager; | 5850 TestSharedBitmapManager shared_bitmap_manager; |
| 5849 TestTaskGraphRunner task_graph_runner; | 5851 TestTaskGraphRunner task_graph_runner; |
| 5850 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, | 5852 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, |
| 5851 &task_graph_runner); | 5853 &task_graph_runner); |
| 5852 scoped_ptr<LayerImpl> root = | 5854 scoped_ptr<LayerImpl> root = |
| 5853 LayerImpl::Create(host_impl.active_tree(), 12345); | 5855 LayerImpl::Create(host_impl.active_tree(), 12345); |
| 5854 scoped_ptr<LayerImpl> child1 = | 5856 scoped_ptr<LayerImpl> child1 = |
| 5855 LayerImpl::Create(host_impl.active_tree(), 123456); | 5857 LayerImpl::Create(host_impl.active_tree(), 123456); |
| 5856 scoped_ptr<LayerImpl> child2 = | 5858 scoped_ptr<LayerImpl> child2 = |
| 5857 LayerImpl::Create(host_impl.active_tree(), 1234567); | 5859 LayerImpl::Create(host_impl.active_tree(), 1234567); |
| 5858 scoped_ptr<LayerImpl> child3 = | 5860 scoped_ptr<LayerImpl> child3 = |
| 5859 LayerImpl::Create(host_impl.active_tree(), 12345678); | 5861 LayerImpl::Create(host_impl.active_tree(), 12345678); |
| 5860 | 5862 |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6397 | 6399 |
| 6398 TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) { | 6400 TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) { |
| 6399 // This test verifies that a scrolling layer that gets snapped to | 6401 // This test verifies that a scrolling layer that gets snapped to |
| 6400 // integer coordinates doesn't move a fixed position child. | 6402 // integer coordinates doesn't move a fixed position child. |
| 6401 // | 6403 // |
| 6402 // + root | 6404 // + root |
| 6403 // + container | 6405 // + container |
| 6404 // + scroller | 6406 // + scroller |
| 6405 // + fixed | 6407 // + fixed |
| 6406 // | 6408 // |
| 6407 FakeImplProxy proxy; | 6409 FakeImplTaskRunnerProvider task_runner_provider; |
| 6408 TestSharedBitmapManager shared_bitmap_manager; | 6410 TestSharedBitmapManager shared_bitmap_manager; |
| 6409 TestTaskGraphRunner task_graph_runner; | 6411 TestTaskGraphRunner task_graph_runner; |
| 6410 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, | 6412 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, |
| 6411 &task_graph_runner); | 6413 &task_graph_runner); |
| 6412 host_impl.CreatePendingTree(); | 6414 host_impl.CreatePendingTree(); |
| 6413 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); | 6415 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); |
| 6414 scoped_ptr<LayerImpl> container = | 6416 scoped_ptr<LayerImpl> container = |
| 6415 LayerImpl::Create(host_impl.active_tree(), 2); | 6417 LayerImpl::Create(host_impl.active_tree(), 2); |
| 6416 LayerImpl* container_layer = container.get(); | 6418 LayerImpl* container_layer = container.get(); |
| 6417 scoped_ptr<LayerImpl> scroller = | 6419 scoped_ptr<LayerImpl> scroller = |
| 6418 LayerImpl::Create(host_impl.active_tree(), 3); | 6420 LayerImpl::Create(host_impl.active_tree(), 3); |
| 6419 LayerImpl* scroll_layer = scroller.get(); | 6421 LayerImpl* scroll_layer = scroller.get(); |
| 6420 scoped_ptr<LayerImpl> fixed = LayerImpl::Create(host_impl.active_tree(), 4); | 6422 scoped_ptr<LayerImpl> fixed = LayerImpl::Create(host_impl.active_tree(), 4); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6543 TEST_F(LayerTreeHostCommonTest, | 6545 TEST_F(LayerTreeHostCommonTest, |
| 6544 ScrollCompensationMainScrollOffsetFractionalPart) { | 6546 ScrollCompensationMainScrollOffsetFractionalPart) { |
| 6545 // This test verifies that a scrolling layer that has fractional scroll offset | 6547 // This test verifies that a scrolling layer that has fractional scroll offset |
| 6546 // from main doesn't move a fixed position child. | 6548 // from main doesn't move a fixed position child. |
| 6547 // | 6549 // |
| 6548 // + root | 6550 // + root |
| 6549 // + container | 6551 // + container |
| 6550 // + scroller | 6552 // + scroller |
| 6551 // + fixed | 6553 // + fixed |
| 6552 // | 6554 // |
| 6553 FakeImplProxy proxy; | 6555 FakeImplTaskRunnerProvider task_runner_provider; |
| 6554 TestSharedBitmapManager shared_bitmap_manager; | 6556 TestSharedBitmapManager shared_bitmap_manager; |
| 6555 TestTaskGraphRunner task_graph_runner; | 6557 TestTaskGraphRunner task_graph_runner; |
| 6556 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, | 6558 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, |
| 6557 &task_graph_runner); | 6559 &task_graph_runner); |
| 6558 host_impl.CreatePendingTree(); | 6560 host_impl.CreatePendingTree(); |
| 6559 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); | 6561 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); |
| 6560 scoped_ptr<LayerImpl> container = | 6562 scoped_ptr<LayerImpl> container = |
| 6561 LayerImpl::Create(host_impl.active_tree(), 2); | 6563 LayerImpl::Create(host_impl.active_tree(), 2); |
| 6562 LayerImpl* container_layer = container.get(); | 6564 LayerImpl* container_layer = container.get(); |
| 6563 scoped_ptr<LayerImpl> scroller = | 6565 scoped_ptr<LayerImpl> scroller = |
| 6564 LayerImpl::Create(host_impl.active_tree(), 3); | 6566 LayerImpl::Create(host_impl.active_tree(), 3); |
| 6565 LayerImpl* scroll_layer = scroller.get(); | 6567 LayerImpl* scroll_layer = scroller.get(); |
| 6566 scoped_ptr<LayerImpl> fixed = LayerImpl::Create(host_impl.active_tree(), 4); | 6568 scoped_ptr<LayerImpl> fixed = LayerImpl::Create(host_impl.active_tree(), 4); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6696 | 6698 |
| 6697 private: | 6699 private: |
| 6698 explicit AnimationScaleFactorTrackingLayerImpl(LayerTreeImpl* tree_impl, | 6700 explicit AnimationScaleFactorTrackingLayerImpl(LayerTreeImpl* tree_impl, |
| 6699 int id) | 6701 int id) |
| 6700 : LayerImpl(tree_impl, id) { | 6702 : LayerImpl(tree_impl, id) { |
| 6701 SetDrawsContent(true); | 6703 SetDrawsContent(true); |
| 6702 } | 6704 } |
| 6703 }; | 6705 }; |
| 6704 | 6706 |
| 6705 TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) { | 6707 TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) { |
| 6706 FakeImplProxy proxy; | 6708 FakeImplTaskRunnerProvider task_runner_provider; |
| 6707 TestSharedBitmapManager shared_bitmap_manager; | 6709 TestSharedBitmapManager shared_bitmap_manager; |
| 6708 TestTaskGraphRunner task_graph_runner; | 6710 TestTaskGraphRunner task_graph_runner; |
| 6709 LayerTreeSettings settings; | 6711 LayerTreeSettings settings; |
| 6710 settings.layer_transforms_should_scale_layer_contents = true; | 6712 settings.layer_transforms_should_scale_layer_contents = true; |
| 6711 FakeLayerTreeHostImpl host_impl(settings, &proxy, &shared_bitmap_manager, | 6713 FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider, |
| 6712 &task_graph_runner); | 6714 &shared_bitmap_manager, &task_graph_runner); |
| 6713 gfx::Transform identity_matrix; | 6715 gfx::Transform identity_matrix; |
| 6714 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> grand_parent = | 6716 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> grand_parent = |
| 6715 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 1); | 6717 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 1); |
| 6716 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> parent = | 6718 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> parent = |
| 6717 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 2); | 6719 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 2); |
| 6718 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> child = | 6720 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> child = |
| 6719 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 3); | 6721 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 3); |
| 6720 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> grand_child = | 6722 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> grand_child = |
| 6721 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 4); | 6723 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 4); |
| 6722 | 6724 |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7024 continue; | 7026 continue; |
| 7025 | 7027 |
| 7026 if (layer->mask_layer()) | 7028 if (layer->mask_layer()) |
| 7027 drawn_layers->insert(layer->mask_layer()); | 7029 drawn_layers->insert(layer->mask_layer()); |
| 7028 if (layer->replica_layer() && layer->replica_layer()->mask_layer()) | 7030 if (layer->replica_layer() && layer->replica_layer()->mask_layer()) |
| 7029 drawn_layers->insert(layer->replica_layer()->mask_layer()); | 7031 drawn_layers->insert(layer->replica_layer()->mask_layer()); |
| 7030 } | 7032 } |
| 7031 } | 7033 } |
| 7032 | 7034 |
| 7033 TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) { | 7035 TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) { |
| 7034 FakeImplProxy proxy; | 7036 FakeImplTaskRunnerProvider task_runner_provider; |
| 7035 TestSharedBitmapManager shared_bitmap_manager; | 7037 TestSharedBitmapManager shared_bitmap_manager; |
| 7036 TestTaskGraphRunner task_graph_runner; | 7038 TestTaskGraphRunner task_graph_runner; |
| 7037 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, | 7039 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, |
| 7038 &task_graph_runner); | 7040 &task_graph_runner); |
| 7039 gfx::Transform identity_matrix; | 7041 gfx::Transform identity_matrix; |
| 7040 | 7042 |
| 7041 scoped_ptr<LayerImpl> grand_parent = | 7043 scoped_ptr<LayerImpl> grand_parent = |
| 7042 LayerImpl::Create(host_impl.active_tree(), 1); | 7044 LayerImpl::Create(host_impl.active_tree(), 1); |
| 7043 scoped_ptr<LayerImpl> parent = LayerImpl::Create(host_impl.active_tree(), 3); | 7045 scoped_ptr<LayerImpl> parent = LayerImpl::Create(host_impl.active_tree(), 3); |
| 7044 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.active_tree(), 5); | 7046 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.active_tree(), 5); |
| 7045 scoped_ptr<LayerImpl> grand_child1 = | 7047 scoped_ptr<LayerImpl> grand_child1 = |
| 7046 LayerImpl::Create(host_impl.active_tree(), 7); | 7048 LayerImpl::Create(host_impl.active_tree(), 7); |
| 7047 scoped_ptr<LayerImpl> grand_child2 = | 7049 scoped_ptr<LayerImpl> grand_child2 = |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7274 expected.insert(child_raw); | 7276 expected.insert(child_raw); |
| 7275 expected.insert(grand_child1_raw); | 7277 expected.insert(grand_child1_raw); |
| 7276 expected.insert(grand_child2_raw); | 7278 expected.insert(grand_child2_raw); |
| 7277 | 7279 |
| 7278 actual.clear(); | 7280 actual.clear(); |
| 7279 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); | 7281 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); |
| 7280 EXPECT_EQ(expected, actual); | 7282 EXPECT_EQ(expected, actual); |
| 7281 } | 7283 } |
| 7282 | 7284 |
| 7283 TEST_F(LayerTreeHostCommonTest, DrawPropertyScales) { | 7285 TEST_F(LayerTreeHostCommonTest, DrawPropertyScales) { |
| 7284 FakeImplProxy proxy; | 7286 FakeImplTaskRunnerProvider task_runner_provider; |
| 7285 TestSharedBitmapManager shared_bitmap_manager; | 7287 TestSharedBitmapManager shared_bitmap_manager; |
| 7286 TestTaskGraphRunner task_graph_runner; | 7288 TestTaskGraphRunner task_graph_runner; |
| 7287 LayerTreeSettings settings; | 7289 LayerTreeSettings settings; |
| 7288 settings.layer_transforms_should_scale_layer_contents = true; | 7290 settings.layer_transforms_should_scale_layer_contents = true; |
| 7289 FakeLayerTreeHostImpl host_impl(settings, &proxy, &shared_bitmap_manager, | 7291 FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider, |
| 7290 &task_graph_runner); | 7292 &shared_bitmap_manager, &task_graph_runner); |
| 7291 | 7293 |
| 7292 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); | 7294 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); |
| 7293 LayerImpl* root_layer = root.get(); | 7295 LayerImpl* root_layer = root.get(); |
| 7294 scoped_ptr<LayerImpl> child1 = LayerImpl::Create(host_impl.active_tree(), 2); | 7296 scoped_ptr<LayerImpl> child1 = LayerImpl::Create(host_impl.active_tree(), 2); |
| 7295 LayerImpl* child1_layer = child1.get(); | 7297 LayerImpl* child1_layer = child1.get(); |
| 7296 scoped_ptr<LayerImpl> child2 = LayerImpl::Create(host_impl.active_tree(), 3); | 7298 scoped_ptr<LayerImpl> child2 = LayerImpl::Create(host_impl.active_tree(), 3); |
| 7297 LayerImpl* child2_layer = child2.get(); | 7299 LayerImpl* child2_layer = child2.get(); |
| 7298 | 7300 |
| 7299 root->AddChild(child1.Pass()); | 7301 root->AddChild(child1.Pass()); |
| 7300 root->AddChild(child2.Pass()); | 7302 root->AddChild(child2.Pass()); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7479 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), | 7481 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), |
| 7480 root->visible_rect_from_property_trees()); | 7482 root->visible_rect_from_property_trees()); |
| 7481 | 7483 |
| 7482 // Layers drawing to a child render surface should still have their visible | 7484 // Layers drawing to a child render surface should still have their visible |
| 7483 // content rect clipped by the viewport. | 7485 // content rect clipped by the viewport. |
| 7484 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), | 7486 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), |
| 7485 content->visible_rect_from_property_trees()); | 7487 content->visible_rect_from_property_trees()); |
| 7486 } | 7488 } |
| 7487 | 7489 |
| 7488 TEST_F(LayerTreeHostCommonTest, BoundsDeltaAffectVisibleContentRect) { | 7490 TEST_F(LayerTreeHostCommonTest, BoundsDeltaAffectVisibleContentRect) { |
| 7489 FakeImplProxy proxy; | 7491 FakeImplTaskRunnerProvider task_runner_provider; |
| 7490 TestSharedBitmapManager shared_bitmap_manager; | 7492 TestSharedBitmapManager shared_bitmap_manager; |
| 7491 TestTaskGraphRunner task_graph_runner; | 7493 TestTaskGraphRunner task_graph_runner; |
| 7492 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, | 7494 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, |
| 7493 &task_graph_runner); | 7495 &task_graph_runner); |
| 7494 | 7496 |
| 7495 // Set two layers: the root layer clips it's child, | 7497 // Set two layers: the root layer clips it's child, |
| 7496 // the child draws its content. | 7498 // the child draws its content. |
| 7497 | 7499 |
| 7498 gfx::Size root_size = gfx::Size(300, 500); | 7500 gfx::Size root_size = gfx::Size(300, 500); |
| 7499 | 7501 |
| 7500 // Sublayer should be bigger than the root enlarged by bounds_delta. | 7502 // Sublayer should be bigger than the root enlarged by bounds_delta. |
| 7501 gfx::Size sublayer_size = gfx::Size(300, 1000); | 7503 gfx::Size sublayer_size = gfx::Size(300, 1000); |
| 7502 | 7504 |
| (...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8248 scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)).Pass(), | 8250 scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)).Pass(), |
| 8249 animation_id, 1, Animation::OPACITY); | 8251 animation_id, 1, Animation::OPACITY); |
| 8250 animation->set_fill_mode(Animation::FILL_MODE_NONE); | 8252 animation->set_fill_mode(Animation::FILL_MODE_NONE); |
| 8251 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); | 8253 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); |
| 8252 child->AddAnimation(animation.Pass()); | 8254 child->AddAnimation(animation.Pass()); |
| 8253 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8255 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 8254 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_rect_from_property_trees()); | 8256 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_rect_from_property_trees()); |
| 8255 } | 8257 } |
| 8256 | 8258 |
| 8257 TEST_F(LayerTreeHostCommonTest, SkippingSubtreeImpl) { | 8259 TEST_F(LayerTreeHostCommonTest, SkippingSubtreeImpl) { |
| 8258 FakeImplProxy proxy; | 8260 FakeImplTaskRunnerProvider task_runner_provider; |
| 8259 TestSharedBitmapManager shared_bitmap_manager; | 8261 TestSharedBitmapManager shared_bitmap_manager; |
| 8260 TestTaskGraphRunner task_graph_runner; | 8262 TestTaskGraphRunner task_graph_runner; |
| 8261 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, | 8263 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, |
| 8262 &task_graph_runner); | 8264 &task_graph_runner); |
| 8263 | 8265 |
| 8264 gfx::Transform identity; | 8266 gfx::Transform identity; |
| 8265 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); | 8267 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); |
| 8266 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.active_tree(), 2); | 8268 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.active_tree(), 2); |
| 8267 scoped_ptr<LayerImpl> grandchild = | 8269 scoped_ptr<LayerImpl> grandchild = |
| 8268 LayerImpl::Create(host_impl.active_tree(), 3); | 8270 LayerImpl::Create(host_impl.active_tree(), 3); |
| 8269 | 8271 |
| 8270 scoped_ptr<FakePictureLayerImpl> greatgrandchild( | 8272 scoped_ptr<FakePictureLayerImpl> greatgrandchild( |
| 8271 FakePictureLayerImpl::Create(host_impl.active_tree(), 4)); | 8273 FakePictureLayerImpl::Create(host_impl.active_tree(), 4)); |
| (...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8907 bool root_in_rsll = | 8909 bool root_in_rsll = |
| 8908 std::find(rsll->begin(), rsll->end(), root) != rsll->end(); | 8910 std::find(rsll->begin(), rsll->end(), root) != rsll->end(); |
| 8909 EXPECT_TRUE(root_in_rsll); | 8911 EXPECT_TRUE(root_in_rsll); |
| 8910 bool render_surface2_in_rsll = | 8912 bool render_surface2_in_rsll = |
| 8911 std::find(rsll->begin(), rsll->end(), render_surface2) != rsll->end(); | 8913 std::find(rsll->begin(), rsll->end(), render_surface2) != rsll->end(); |
| 8912 EXPECT_FALSE(render_surface2_in_rsll); | 8914 EXPECT_FALSE(render_surface2_in_rsll); |
| 8913 } | 8915 } |
| 8914 | 8916 |
| 8915 } // namespace | 8917 } // namespace |
| 8916 } // namespace cc | 8918 } // namespace cc |
| OLD | NEW |