| 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/layer_animation_controller.h" | 10 #include "cc/animation/layer_animation_controller.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "cc/output/copy_output_request.h" | 21 #include "cc/output/copy_output_request.h" |
| 22 #include "cc/output/copy_output_result.h" | 22 #include "cc/output/copy_output_result.h" |
| 23 #include "cc/test/animation_test_common.h" | 23 #include "cc/test/animation_test_common.h" |
| 24 #include "cc/test/fake_impl_proxy.h" | 24 #include "cc/test/fake_impl_proxy.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_picture_layer.h" | 27 #include "cc/test/fake_picture_layer.h" |
| 28 #include "cc/test/fake_picture_layer_impl.h" | 28 #include "cc/test/fake_picture_layer_impl.h" |
| 29 #include "cc/test/geometry_test_utils.h" | 29 #include "cc/test/geometry_test_utils.h" |
| 30 #include "cc/test/layer_tree_host_common_test.h" | 30 #include "cc/test/layer_tree_host_common_test.h" |
| 31 #include "cc/test/test_task_graph_runner.h" |
| 31 #include "cc/trees/layer_tree_impl.h" | 32 #include "cc/trees/layer_tree_impl.h" |
| 32 #include "cc/trees/proxy.h" | 33 #include "cc/trees/proxy.h" |
| 33 #include "cc/trees/single_thread_proxy.h" | 34 #include "cc/trees/single_thread_proxy.h" |
| 34 #include "testing/gmock/include/gmock/gmock.h" | 35 #include "testing/gmock/include/gmock/gmock.h" |
| 35 #include "testing/gtest/include/gtest/gtest.h" | 36 #include "testing/gtest/include/gtest/gtest.h" |
| 36 #include "ui/gfx/geometry/quad_f.h" | 37 #include "ui/gfx/geometry/quad_f.h" |
| 37 #include "ui/gfx/geometry/vector2d_conversions.h" | 38 #include "ui/gfx/geometry/vector2d_conversions.h" |
| 38 #include "ui/gfx/transform.h" | 39 #include "ui/gfx/transform.h" |
| 39 | 40 |
| 40 namespace cc { | 41 namespace cc { |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 const gfx::ScrollOffset kScrollOffset(50, 100); | 309 const gfx::ScrollOffset kScrollOffset(50, 100); |
| 309 const gfx::Vector2dF kScrollDelta(2.34f, 5.67f); | 310 const gfx::Vector2dF kScrollDelta(2.34f, 5.67f); |
| 310 const gfx::Vector2d kMaxScrollOffset(200, 200); | 311 const gfx::Vector2d kMaxScrollOffset(200, 200); |
| 311 const gfx::PointF kScrollLayerPosition(-kScrollOffset.x(), | 312 const gfx::PointF kScrollLayerPosition(-kScrollOffset.x(), |
| 312 -kScrollOffset.y()); | 313 -kScrollOffset.y()); |
| 313 const float kPageScale = 0.888f; | 314 const float kPageScale = 0.888f; |
| 314 const float kDeviceScale = 1.666f; | 315 const float kDeviceScale = 1.666f; |
| 315 | 316 |
| 316 FakeImplProxy proxy; | 317 FakeImplProxy proxy; |
| 317 TestSharedBitmapManager shared_bitmap_manager; | 318 TestSharedBitmapManager shared_bitmap_manager; |
| 318 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); | 319 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); |
| 319 | 320 |
| 320 gfx::Transform identity_matrix; | 321 gfx::Transform identity_matrix; |
| 321 scoped_ptr<LayerImpl> sublayer_scoped_ptr( | 322 scoped_ptr<LayerImpl> sublayer_scoped_ptr( |
| 322 LayerImpl::Create(host_impl.active_tree(), 1)); | 323 LayerImpl::Create(host_impl.active_tree(), 1)); |
| 323 LayerImpl* sublayer = sublayer_scoped_ptr.get(); | 324 LayerImpl* sublayer = sublayer_scoped_ptr.get(); |
| 324 sublayer->SetContentsScale(kPageScale * kDeviceScale, | 325 sublayer->SetContentsScale(kPageScale * kDeviceScale, |
| 325 kPageScale * kDeviceScale); | 326 kPageScale * kDeviceScale); |
| 326 SetLayerPropertiesForTesting(sublayer, identity_matrix, gfx::Point3F(), | 327 SetLayerPropertiesForTesting(sublayer, identity_matrix, gfx::Point3F(), |
| 327 gfx::PointF(), gfx::Size(500, 500), true, false, | 328 gfx::PointF(), gfx::Size(500, 500), true, false, |
| 328 false); | 329 false); |
| (...skipping 5385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5714 host->SetRootLayer(root); | 5715 host->SetRootLayer(root); |
| 5715 | 5716 |
| 5716 ExecuteCalculateDrawProperties(root.get()); | 5717 ExecuteCalculateDrawProperties(root.get()); |
| 5717 | 5718 |
| 5718 EXPECT_FALSE(child->render_surface()); | 5719 EXPECT_FALSE(child->render_surface()); |
| 5719 } | 5720 } |
| 5720 | 5721 |
| 5721 TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) { | 5722 TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) { |
| 5722 FakeImplProxy proxy; | 5723 FakeImplProxy proxy; |
| 5723 TestSharedBitmapManager shared_bitmap_manager; | 5724 TestSharedBitmapManager shared_bitmap_manager; |
| 5724 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); | 5725 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); |
| 5725 host_impl.CreatePendingTree(); | 5726 host_impl.CreatePendingTree(); |
| 5726 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); | 5727 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); |
| 5727 | 5728 |
| 5728 const gfx::Transform identity_matrix; | 5729 const gfx::Transform identity_matrix; |
| 5729 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), | 5730 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
| 5730 gfx::PointF(), gfx::Size(100, 100), true, false, | 5731 gfx::PointF(), gfx::Size(100, 100), true, false, |
| 5731 false); | 5732 false); |
| 5732 root->SetDrawsContent(true); | 5733 root->SetDrawsContent(true); |
| 5733 | 5734 |
| 5734 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2); | 5735 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 5756 ASSERT_EQ(1u, render_surface_layer_list.size()); | 5757 ASSERT_EQ(1u, render_surface_layer_list.size()); |
| 5757 ASSERT_EQ(2u, root->render_surface()->layer_list().size()); | 5758 ASSERT_EQ(2u, root->render_surface()->layer_list().size()); |
| 5758 } | 5759 } |
| 5759 | 5760 |
| 5760 using LCDTextTestParam = std::tr1::tuple<bool, bool, bool>; | 5761 using LCDTextTestParam = std::tr1::tuple<bool, bool, bool>; |
| 5761 class LCDTextTest | 5762 class LCDTextTest |
| 5762 : public LayerTreeHostCommonTestBase, | 5763 : public LayerTreeHostCommonTestBase, |
| 5763 public testing::TestWithParam<LCDTextTestParam> { | 5764 public testing::TestWithParam<LCDTextTestParam> { |
| 5764 public: | 5765 public: |
| 5765 LCDTextTest() | 5766 LCDTextTest() |
| 5766 : host_impl_(&proxy_, &shared_bitmap_manager_), | 5767 : host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_), |
| 5767 root_(nullptr), | 5768 root_(nullptr), |
| 5768 child_(nullptr), | 5769 child_(nullptr), |
| 5769 grand_child_(nullptr) {} | 5770 grand_child_(nullptr) {} |
| 5770 | 5771 |
| 5771 protected: | 5772 protected: |
| 5772 void SetUp() override { | 5773 void SetUp() override { |
| 5773 can_use_lcd_text_ = std::tr1::get<0>(GetParam()); | 5774 can_use_lcd_text_ = std::tr1::get<0>(GetParam()); |
| 5774 layers_always_allowed_lcd_text_ = std::tr1::get<1>(GetParam()); | 5775 layers_always_allowed_lcd_text_ = std::tr1::get<1>(GetParam()); |
| 5775 | 5776 |
| 5776 scoped_ptr<LayerImpl> root_ptr = | 5777 scoped_ptr<LayerImpl> root_ptr = |
| (...skipping 26 matching lines...) Expand all Loading... |
| 5803 SetLayerPropertiesForTesting(grand_child_, identity_matrix, gfx::Point3F(), | 5804 SetLayerPropertiesForTesting(grand_child_, identity_matrix, gfx::Point3F(), |
| 5804 gfx::PointF(), gfx::Size(1, 1), true, false, | 5805 gfx::PointF(), gfx::Size(1, 1), true, false, |
| 5805 false); | 5806 false); |
| 5806 } | 5807 } |
| 5807 | 5808 |
| 5808 bool can_use_lcd_text_; | 5809 bool can_use_lcd_text_; |
| 5809 bool layers_always_allowed_lcd_text_; | 5810 bool layers_always_allowed_lcd_text_; |
| 5810 | 5811 |
| 5811 FakeImplProxy proxy_; | 5812 FakeImplProxy proxy_; |
| 5812 TestSharedBitmapManager shared_bitmap_manager_; | 5813 TestSharedBitmapManager shared_bitmap_manager_; |
| 5814 TestTaskGraphRunner task_graph_runner_; |
| 5813 FakeLayerTreeHostImpl host_impl_; | 5815 FakeLayerTreeHostImpl host_impl_; |
| 5814 | 5816 |
| 5815 LayerImpl* root_; | 5817 LayerImpl* root_; |
| 5816 LayerImpl* child_; | 5818 LayerImpl* child_; |
| 5817 LayerImpl* grand_child_; | 5819 LayerImpl* grand_child_; |
| 5818 }; | 5820 }; |
| 5819 | 5821 |
| 5820 TEST_P(LCDTextTest, CanUseLCDText) { | 5822 TEST_P(LCDTextTest, CanUseLCDText) { |
| 5821 bool expect_lcd_text = can_use_lcd_text_ || layers_always_allowed_lcd_text_; | 5823 bool expect_lcd_text = can_use_lcd_text_ || layers_always_allowed_lcd_text_; |
| 5822 bool expect_not_lcd_text = layers_always_allowed_lcd_text_; | 5824 bool expect_not_lcd_text = layers_always_allowed_lcd_text_; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5940 | 5942 |
| 5941 INSTANTIATE_TEST_CASE_P(LayerTreeHostCommonTest, | 5943 INSTANTIATE_TEST_CASE_P(LayerTreeHostCommonTest, |
| 5942 LCDTextTest, | 5944 LCDTextTest, |
| 5943 testing::Combine(testing::Bool(), | 5945 testing::Combine(testing::Bool(), |
| 5944 testing::Bool(), | 5946 testing::Bool(), |
| 5945 testing::Bool())); | 5947 testing::Bool())); |
| 5946 | 5948 |
| 5947 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayer) { | 5949 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayer) { |
| 5948 FakeImplProxy proxy; | 5950 FakeImplProxy proxy; |
| 5949 TestSharedBitmapManager shared_bitmap_manager; | 5951 TestSharedBitmapManager shared_bitmap_manager; |
| 5950 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); | 5952 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); |
| 5951 host_impl.CreatePendingTree(); | 5953 host_impl.CreatePendingTree(); |
| 5952 const gfx::Transform identity_matrix; | 5954 const gfx::Transform identity_matrix; |
| 5953 | 5955 |
| 5954 scoped_refptr<Layer> root = Layer::Create(); | 5956 scoped_refptr<Layer> root = Layer::Create(); |
| 5955 SetLayerPropertiesForTesting(root.get(), | 5957 SetLayerPropertiesForTesting(root.get(), |
| 5956 identity_matrix, | 5958 identity_matrix, |
| 5957 gfx::Point3F(), | 5959 gfx::Point3F(), |
| 5958 gfx::PointF(), | 5960 gfx::PointF(), |
| 5959 gfx::Size(50, 50), | 5961 gfx::Size(50, 50), |
| 5960 true, | 5962 true, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5998 // hidden itself. | 6000 // hidden itself. |
| 5999 ASSERT_EQ(1u, render_surface_layer_list.size()); | 6001 ASSERT_EQ(1u, render_surface_layer_list.size()); |
| 6000 ASSERT_EQ(2u, root->render_surface()->layer_list().size()); | 6002 ASSERT_EQ(2u, root->render_surface()->layer_list().size()); |
| 6001 EXPECT_EQ(root->id(), root->render_surface()->layer_list().at(0)->id()); | 6003 EXPECT_EQ(root->id(), root->render_surface()->layer_list().at(0)->id()); |
| 6002 EXPECT_EQ(child->id(), root->render_surface()->layer_list().at(1)->id()); | 6004 EXPECT_EQ(child->id(), root->render_surface()->layer_list().at(1)->id()); |
| 6003 } | 6005 } |
| 6004 | 6006 |
| 6005 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayerImpl) { | 6007 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayerImpl) { |
| 6006 FakeImplProxy proxy; | 6008 FakeImplProxy proxy; |
| 6007 TestSharedBitmapManager shared_bitmap_manager; | 6009 TestSharedBitmapManager shared_bitmap_manager; |
| 6008 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); | 6010 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); |
| 6009 host_impl.CreatePendingTree(); | 6011 host_impl.CreatePendingTree(); |
| 6010 const gfx::Transform identity_matrix; | 6012 const gfx::Transform identity_matrix; |
| 6011 | 6013 |
| 6012 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); | 6014 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); |
| 6013 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), | 6015 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
| 6014 gfx::PointF(), gfx::Size(50, 50), true, false, | 6016 gfx::PointF(), gfx::Size(50, 50), true, false, |
| 6015 false); | 6017 false); |
| 6016 root->SetDrawsContent(true); | 6018 root->SetDrawsContent(true); |
| 6017 | 6019 |
| 6018 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2); | 6020 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 6043 // hidden itself. | 6045 // hidden itself. |
| 6044 ASSERT_EQ(1u, render_surface_layer_list.size()); | 6046 ASSERT_EQ(1u, render_surface_layer_list.size()); |
| 6045 ASSERT_EQ(2u, root->render_surface()->layer_list().size()); | 6047 ASSERT_EQ(2u, root->render_surface()->layer_list().size()); |
| 6046 EXPECT_EQ(1, root->render_surface()->layer_list().at(0)->id()); | 6048 EXPECT_EQ(1, root->render_surface()->layer_list().at(0)->id()); |
| 6047 EXPECT_EQ(2, root->render_surface()->layer_list().at(1)->id()); | 6049 EXPECT_EQ(2, root->render_surface()->layer_list().at(1)->id()); |
| 6048 } | 6050 } |
| 6049 | 6051 |
| 6050 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayers) { | 6052 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayers) { |
| 6051 FakeImplProxy proxy; | 6053 FakeImplProxy proxy; |
| 6052 TestSharedBitmapManager shared_bitmap_manager; | 6054 TestSharedBitmapManager shared_bitmap_manager; |
| 6053 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); | 6055 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); |
| 6054 host_impl.CreatePendingTree(); | 6056 host_impl.CreatePendingTree(); |
| 6055 const gfx::Transform identity_matrix; | 6057 const gfx::Transform identity_matrix; |
| 6056 | 6058 |
| 6057 scoped_refptr<Layer> root = Layer::Create(); | 6059 scoped_refptr<Layer> root = Layer::Create(); |
| 6058 SetLayerPropertiesForTesting(root.get(), | 6060 SetLayerPropertiesForTesting(root.get(), |
| 6059 identity_matrix, | 6061 identity_matrix, |
| 6060 gfx::Point3F(), | 6062 gfx::Point3F(), |
| 6061 gfx::PointF(), | 6063 gfx::PointF(), |
| 6062 gfx::Size(50, 50), | 6064 gfx::Size(50, 50), |
| 6063 true, | 6065 true, |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6100 // We should have one render surface and one layers. The child has | 6102 // We should have one render surface and one layers. The child has |
| 6101 // hidden itself and the grand child. | 6103 // hidden itself and the grand child. |
| 6102 ASSERT_EQ(1u, render_surface_layer_list.size()); | 6104 ASSERT_EQ(1u, render_surface_layer_list.size()); |
| 6103 ASSERT_EQ(1u, root->render_surface()->layer_list().size()); | 6105 ASSERT_EQ(1u, root->render_surface()->layer_list().size()); |
| 6104 EXPECT_EQ(root->id(), root->render_surface()->layer_list().at(0)->id()); | 6106 EXPECT_EQ(root->id(), root->render_surface()->layer_list().at(0)->id()); |
| 6105 } | 6107 } |
| 6106 | 6108 |
| 6107 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayersImpl) { | 6109 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayersImpl) { |
| 6108 FakeImplProxy proxy; | 6110 FakeImplProxy proxy; |
| 6109 TestSharedBitmapManager shared_bitmap_manager; | 6111 TestSharedBitmapManager shared_bitmap_manager; |
| 6110 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); | 6112 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); |
| 6111 host_impl.CreatePendingTree(); | 6113 host_impl.CreatePendingTree(); |
| 6112 const gfx::Transform identity_matrix; | 6114 const gfx::Transform identity_matrix; |
| 6113 | 6115 |
| 6114 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); | 6116 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); |
| 6115 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), | 6117 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
| 6116 gfx::PointF(), gfx::Size(50, 50), true, false, | 6118 gfx::PointF(), gfx::Size(50, 50), true, false, |
| 6117 true); | 6119 true); |
| 6118 root->SetDrawsContent(true); | 6120 root->SetDrawsContent(true); |
| 6119 | 6121 |
| 6120 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2); | 6122 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 6145 ASSERT_EQ(1u, render_surface_layer_list.size()); | 6147 ASSERT_EQ(1u, render_surface_layer_list.size()); |
| 6146 ASSERT_EQ(1u, root->render_surface()->layer_list().size()); | 6148 ASSERT_EQ(1u, root->render_surface()->layer_list().size()); |
| 6147 EXPECT_EQ(1, root->render_surface()->layer_list().at(0)->id()); | 6149 EXPECT_EQ(1, root->render_surface()->layer_list().at(0)->id()); |
| 6148 } | 6150 } |
| 6149 | 6151 |
| 6150 void EmptyCopyOutputCallback(scoped_ptr<CopyOutputResult> result) {} | 6152 void EmptyCopyOutputCallback(scoped_ptr<CopyOutputResult> result) {} |
| 6151 | 6153 |
| 6152 TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) { | 6154 TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) { |
| 6153 FakeImplProxy proxy; | 6155 FakeImplProxy proxy; |
| 6154 TestSharedBitmapManager shared_bitmap_manager; | 6156 TestSharedBitmapManager shared_bitmap_manager; |
| 6155 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); | 6157 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); |
| 6156 host_impl.CreatePendingTree(); | 6158 host_impl.CreatePendingTree(); |
| 6157 const gfx::Transform identity_matrix; | 6159 const gfx::Transform identity_matrix; |
| 6158 | 6160 |
| 6159 scoped_refptr<Layer> root = Layer::Create(); | 6161 scoped_refptr<Layer> root = Layer::Create(); |
| 6160 SetLayerPropertiesForTesting(root.get(), | 6162 SetLayerPropertiesForTesting(root.get(), |
| 6161 identity_matrix, | 6163 identity_matrix, |
| 6162 gfx::Point3F(), | 6164 gfx::Point3F(), |
| 6163 gfx::PointF(), | 6165 gfx::PointF(), |
| 6164 gfx::Size(50, 50), | 6166 gfx::Size(50, 50), |
| 6165 true, | 6167 true, |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6292 ASSERT_EQ(2u, copy_layer->render_surface()->layer_list().size()); | 6294 ASSERT_EQ(2u, copy_layer->render_surface()->layer_list().size()); |
| 6293 EXPECT_EQ(copy_layer->id(), | 6295 EXPECT_EQ(copy_layer->id(), |
| 6294 copy_layer->render_surface()->layer_list().at(0)->id()); | 6296 copy_layer->render_surface()->layer_list().at(0)->id()); |
| 6295 EXPECT_EQ(copy_child->id(), | 6297 EXPECT_EQ(copy_child->id(), |
| 6296 copy_layer->render_surface()->layer_list().at(1)->id()); | 6298 copy_layer->render_surface()->layer_list().at(1)->id()); |
| 6297 } | 6299 } |
| 6298 | 6300 |
| 6299 TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) { | 6301 TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) { |
| 6300 FakeImplProxy proxy; | 6302 FakeImplProxy proxy; |
| 6301 TestSharedBitmapManager shared_bitmap_manager; | 6303 TestSharedBitmapManager shared_bitmap_manager; |
| 6302 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); | 6304 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); |
| 6303 host_impl.CreatePendingTree(); | 6305 host_impl.CreatePendingTree(); |
| 6304 const gfx::Transform identity_matrix; | 6306 const gfx::Transform identity_matrix; |
| 6305 | 6307 |
| 6306 scoped_refptr<Layer> root = Layer::Create(); | 6308 scoped_refptr<Layer> root = Layer::Create(); |
| 6307 SetLayerPropertiesForTesting(root.get(), | 6309 SetLayerPropertiesForTesting(root.get(), |
| 6308 identity_matrix, | 6310 identity_matrix, |
| 6309 gfx::Point3F(), | 6311 gfx::Point3F(), |
| 6310 gfx::PointF(), | 6312 gfx::PointF(), |
| 6311 gfx::Size(50, 50), | 6313 gfx::Size(50, 50), |
| 6312 true, | 6314 true, |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6367 | 6369 |
| 6368 // The root render surface should only have 1 contributing layer, since the | 6370 // The root render surface should only have 1 contributing layer, since the |
| 6369 // other layers are empty/clipped away. | 6371 // other layers are empty/clipped away. |
| 6370 ASSERT_EQ(1u, root->render_surface()->layer_list().size()); | 6372 ASSERT_EQ(1u, root->render_surface()->layer_list().size()); |
| 6371 EXPECT_EQ(root->id(), root->render_surface()->layer_list().at(0)->id()); | 6373 EXPECT_EQ(root->id(), root->render_surface()->layer_list().at(0)->id()); |
| 6372 } | 6374 } |
| 6373 | 6375 |
| 6374 TEST_F(LayerTreeHostCommonTest, VisibleContentRectInsideSurface) { | 6376 TEST_F(LayerTreeHostCommonTest, VisibleContentRectInsideSurface) { |
| 6375 FakeImplProxy proxy; | 6377 FakeImplProxy proxy; |
| 6376 TestSharedBitmapManager shared_bitmap_manager; | 6378 TestSharedBitmapManager shared_bitmap_manager; |
| 6377 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); | 6379 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); |
| 6378 host_impl.CreatePendingTree(); | 6380 host_impl.CreatePendingTree(); |
| 6379 const gfx::Transform identity_matrix; | 6381 const gfx::Transform identity_matrix; |
| 6380 | 6382 |
| 6381 scoped_refptr<Layer> root = Layer::Create(); | 6383 scoped_refptr<Layer> root = Layer::Create(); |
| 6382 SetLayerPropertiesForTesting(root.get(), | 6384 SetLayerPropertiesForTesting(root.get(), |
| 6383 identity_matrix, | 6385 identity_matrix, |
| 6384 gfx::Point3F(), | 6386 gfx::Point3F(), |
| 6385 gfx::PointF(), | 6387 gfx::PointF(), |
| 6386 gfx::Size(50, 50), | 6388 gfx::Size(50, 50), |
| 6387 true, | 6389 true, |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6978 render_surface2->render_surface()->content_rect().ToString()); | 6980 render_surface2->render_surface()->content_rect().ToString()); |
| 6979 | 6981 |
| 6980 // Sanity check our num_unclipped_descendants values. | 6982 // Sanity check our num_unclipped_descendants values. |
| 6981 EXPECT_EQ(1, render_surface1->num_unclipped_descendants()); | 6983 EXPECT_EQ(1, render_surface1->num_unclipped_descendants()); |
| 6982 EXPECT_EQ(0, render_surface2->num_unclipped_descendants()); | 6984 EXPECT_EQ(0, render_surface2->num_unclipped_descendants()); |
| 6983 } | 6985 } |
| 6984 | 6986 |
| 6985 TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) { | 6987 TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) { |
| 6986 FakeImplProxy proxy; | 6988 FakeImplProxy proxy; |
| 6987 TestSharedBitmapManager shared_bitmap_manager; | 6989 TestSharedBitmapManager shared_bitmap_manager; |
| 6988 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); | 6990 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); |
| 6989 scoped_ptr<LayerImpl> root = | 6991 scoped_ptr<LayerImpl> root = |
| 6990 LayerImpl::Create(host_impl.active_tree(), 12345); | 6992 LayerImpl::Create(host_impl.active_tree(), 12345); |
| 6991 scoped_ptr<LayerImpl> child1 = | 6993 scoped_ptr<LayerImpl> child1 = |
| 6992 LayerImpl::Create(host_impl.active_tree(), 123456); | 6994 LayerImpl::Create(host_impl.active_tree(), 123456); |
| 6993 scoped_ptr<LayerImpl> child2 = | 6995 scoped_ptr<LayerImpl> child2 = |
| 6994 LayerImpl::Create(host_impl.active_tree(), 1234567); | 6996 LayerImpl::Create(host_impl.active_tree(), 1234567); |
| 6995 scoped_ptr<LayerImpl> child3 = | 6997 scoped_ptr<LayerImpl> child3 = |
| 6996 LayerImpl::Create(host_impl.active_tree(), 12345678); | 6998 LayerImpl::Create(host_impl.active_tree(), 12345678); |
| 6997 | 6999 |
| 6998 gfx::Transform identity_matrix; | 7000 gfx::Transform identity_matrix; |
| (...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7650 // This test verifies that a scrolling layer that gets snapped to | 7652 // This test verifies that a scrolling layer that gets snapped to |
| 7651 // integer coordinates doesn't move a fixed position child. | 7653 // integer coordinates doesn't move a fixed position child. |
| 7652 // | 7654 // |
| 7653 // + root | 7655 // + root |
| 7654 // + container | 7656 // + container |
| 7655 // + scroller | 7657 // + scroller |
| 7656 // + fixed | 7658 // + fixed |
| 7657 // | 7659 // |
| 7658 FakeImplProxy proxy; | 7660 FakeImplProxy proxy; |
| 7659 TestSharedBitmapManager shared_bitmap_manager; | 7661 TestSharedBitmapManager shared_bitmap_manager; |
| 7660 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); | 7662 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); |
| 7661 host_impl.CreatePendingTree(); | 7663 host_impl.CreatePendingTree(); |
| 7662 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); | 7664 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); |
| 7663 scoped_ptr<LayerImpl> container = | 7665 scoped_ptr<LayerImpl> container = |
| 7664 LayerImpl::Create(host_impl.active_tree(), 2); | 7666 LayerImpl::Create(host_impl.active_tree(), 2); |
| 7665 LayerImpl* container_layer = container.get(); | 7667 LayerImpl* container_layer = container.get(); |
| 7666 scoped_ptr<LayerImpl> scroller = | 7668 scoped_ptr<LayerImpl> scroller = |
| 7667 LayerImpl::Create(host_impl.active_tree(), 3); | 7669 LayerImpl::Create(host_impl.active_tree(), 3); |
| 7668 LayerImpl* scroll_layer = scroller.get(); | 7670 LayerImpl* scroll_layer = scroller.get(); |
| 7669 scoped_ptr<LayerImpl> fixed = LayerImpl::Create(host_impl.active_tree(), 4); | 7671 scoped_ptr<LayerImpl> fixed = LayerImpl::Create(host_impl.active_tree(), 4); |
| 7670 LayerImpl* fixed_layer = fixed.get(); | 7672 LayerImpl* fixed_layer = fixed.get(); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7794 // This test verifies that a scrolling layer that has fractional scroll offset | 7796 // This test verifies that a scrolling layer that has fractional scroll offset |
| 7795 // from main doesn't move a fixed position child. | 7797 // from main doesn't move a fixed position child. |
| 7796 // | 7798 // |
| 7797 // + root | 7799 // + root |
| 7798 // + container | 7800 // + container |
| 7799 // + scroller | 7801 // + scroller |
| 7800 // + fixed | 7802 // + fixed |
| 7801 // | 7803 // |
| 7802 FakeImplProxy proxy; | 7804 FakeImplProxy proxy; |
| 7803 TestSharedBitmapManager shared_bitmap_manager; | 7805 TestSharedBitmapManager shared_bitmap_manager; |
| 7804 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); | 7806 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); |
| 7805 host_impl.CreatePendingTree(); | 7807 host_impl.CreatePendingTree(); |
| 7806 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); | 7808 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); |
| 7807 scoped_ptr<LayerImpl> container = | 7809 scoped_ptr<LayerImpl> container = |
| 7808 LayerImpl::Create(host_impl.active_tree(), 2); | 7810 LayerImpl::Create(host_impl.active_tree(), 2); |
| 7809 LayerImpl* container_layer = container.get(); | 7811 LayerImpl* container_layer = container.get(); |
| 7810 scoped_ptr<LayerImpl> scroller = | 7812 scoped_ptr<LayerImpl> scroller = |
| 7811 LayerImpl::Create(host_impl.active_tree(), 3); | 7813 LayerImpl::Create(host_impl.active_tree(), 3); |
| 7812 LayerImpl* scroll_layer = scroller.get(); | 7814 LayerImpl* scroll_layer = scroller.get(); |
| 7813 scoped_ptr<LayerImpl> fixed = LayerImpl::Create(host_impl.active_tree(), 4); | 7815 scoped_ptr<LayerImpl> fixed = LayerImpl::Create(host_impl.active_tree(), 4); |
| 7814 LayerImpl* fixed_layer = fixed.get(); | 7816 LayerImpl* fixed_layer = fixed.get(); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7888 explicit AnimationScaleFactorTrackingLayerImpl(LayerTreeImpl* tree_impl, | 7890 explicit AnimationScaleFactorTrackingLayerImpl(LayerTreeImpl* tree_impl, |
| 7889 int id) | 7891 int id) |
| 7890 : LayerImpl(tree_impl, id) { | 7892 : LayerImpl(tree_impl, id) { |
| 7891 SetDrawsContent(true); | 7893 SetDrawsContent(true); |
| 7892 } | 7894 } |
| 7893 }; | 7895 }; |
| 7894 | 7896 |
| 7895 TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) { | 7897 TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) { |
| 7896 FakeImplProxy proxy; | 7898 FakeImplProxy proxy; |
| 7897 TestSharedBitmapManager shared_bitmap_manager; | 7899 TestSharedBitmapManager shared_bitmap_manager; |
| 7898 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); | 7900 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); |
| 7899 gfx::Transform identity_matrix; | 7901 gfx::Transform identity_matrix; |
| 7900 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> grand_parent = | 7902 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> grand_parent = |
| 7901 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 1); | 7903 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 1); |
| 7902 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> parent = | 7904 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> parent = |
| 7903 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 2); | 7905 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 2); |
| 7904 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> child = | 7906 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> child = |
| 7905 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 3); | 7907 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 3); |
| 7906 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> grand_child = | 7908 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> grand_child = |
| 7907 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 4); | 7909 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 4); |
| 7908 | 7910 |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8105 if (layer->mask_layer()) | 8107 if (layer->mask_layer()) |
| 8106 drawn_layers->insert(layer->mask_layer()); | 8108 drawn_layers->insert(layer->mask_layer()); |
| 8107 if (layer->replica_layer() && layer->replica_layer()->mask_layer()) | 8109 if (layer->replica_layer() && layer->replica_layer()->mask_layer()) |
| 8108 drawn_layers->insert(layer->replica_layer()->mask_layer()); | 8110 drawn_layers->insert(layer->replica_layer()->mask_layer()); |
| 8109 } | 8111 } |
| 8110 } | 8112 } |
| 8111 | 8113 |
| 8112 TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) { | 8114 TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) { |
| 8113 FakeImplProxy proxy; | 8115 FakeImplProxy proxy; |
| 8114 TestSharedBitmapManager shared_bitmap_manager; | 8116 TestSharedBitmapManager shared_bitmap_manager; |
| 8115 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); | 8117 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); |
| 8116 gfx::Transform identity_matrix; | 8118 gfx::Transform identity_matrix; |
| 8117 | 8119 |
| 8118 scoped_ptr<LayerImpl> grand_parent = | 8120 scoped_ptr<LayerImpl> grand_parent = |
| 8119 LayerImpl::Create(host_impl.active_tree(), 1); | 8121 LayerImpl::Create(host_impl.active_tree(), 1); |
| 8120 scoped_ptr<LayerImpl> parent = LayerImpl::Create(host_impl.active_tree(), 3); | 8122 scoped_ptr<LayerImpl> parent = LayerImpl::Create(host_impl.active_tree(), 3); |
| 8121 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.active_tree(), 5); | 8123 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.active_tree(), 5); |
| 8122 scoped_ptr<LayerImpl> grand_child1 = | 8124 scoped_ptr<LayerImpl> grand_child1 = |
| 8123 LayerImpl::Create(host_impl.active_tree(), 7); | 8125 LayerImpl::Create(host_impl.active_tree(), 7); |
| 8124 scoped_ptr<LayerImpl> grand_child2 = | 8126 scoped_ptr<LayerImpl> grand_child2 = |
| 8125 LayerImpl::Create(host_impl.active_tree(), 9); | 8127 LayerImpl::Create(host_impl.active_tree(), 9); |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8348 expected.insert(grand_child2_raw); | 8350 expected.insert(grand_child2_raw); |
| 8349 | 8351 |
| 8350 actual.clear(); | 8352 actual.clear(); |
| 8351 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); | 8353 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); |
| 8352 EXPECT_EQ(expected, actual); | 8354 EXPECT_EQ(expected, actual); |
| 8353 } | 8355 } |
| 8354 | 8356 |
| 8355 TEST_F(LayerTreeHostCommonTest, DrawPropertyScales) { | 8357 TEST_F(LayerTreeHostCommonTest, DrawPropertyScales) { |
| 8356 FakeImplProxy proxy; | 8358 FakeImplProxy proxy; |
| 8357 TestSharedBitmapManager shared_bitmap_manager; | 8359 TestSharedBitmapManager shared_bitmap_manager; |
| 8358 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); | 8360 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); |
| 8359 | 8361 |
| 8360 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); | 8362 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); |
| 8361 LayerImpl* root_layer = root.get(); | 8363 LayerImpl* root_layer = root.get(); |
| 8362 scoped_ptr<LayerImpl> child1 = LayerImpl::Create(host_impl.active_tree(), 2); | 8364 scoped_ptr<LayerImpl> child1 = LayerImpl::Create(host_impl.active_tree(), 2); |
| 8363 LayerImpl* child1_layer = child1.get(); | 8365 LayerImpl* child1_layer = child1.get(); |
| 8364 scoped_ptr<LayerImpl> child2 = LayerImpl::Create(host_impl.active_tree(), 3); | 8366 scoped_ptr<LayerImpl> child2 = LayerImpl::Create(host_impl.active_tree(), 3); |
| 8365 LayerImpl* child2_layer = child2.get(); | 8367 LayerImpl* child2_layer = child2.get(); |
| 8366 | 8368 |
| 8367 root->AddChild(child1.Pass()); | 8369 root->AddChild(child1.Pass()); |
| 8368 root->AddChild(child2.Pass()); | 8370 root->AddChild(child2.Pass()); |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8628 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), root->visible_content_rect()); | 8630 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), root->visible_content_rect()); |
| 8629 | 8631 |
| 8630 // Layers drawing to a child render surface should still have their visible | 8632 // Layers drawing to a child render surface should still have their visible |
| 8631 // content rect clipped by the viewport. | 8633 // content rect clipped by the viewport. |
| 8632 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), content->visible_content_rect()); | 8634 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), content->visible_content_rect()); |
| 8633 } | 8635 } |
| 8634 | 8636 |
| 8635 TEST_F(LayerTreeHostCommonTest, BoundsDeltaAffectVisibleContentRect) { | 8637 TEST_F(LayerTreeHostCommonTest, BoundsDeltaAffectVisibleContentRect) { |
| 8636 FakeImplProxy proxy; | 8638 FakeImplProxy proxy; |
| 8637 TestSharedBitmapManager shared_bitmap_manager; | 8639 TestSharedBitmapManager shared_bitmap_manager; |
| 8638 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); | 8640 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); |
| 8639 | 8641 |
| 8640 // Set two layers: the root layer clips it's child, | 8642 // Set two layers: the root layer clips it's child, |
| 8641 // the child draws its content. | 8643 // the child draws its content. |
| 8642 | 8644 |
| 8643 gfx::Size root_size = gfx::Size(300, 500); | 8645 gfx::Size root_size = gfx::Size(300, 500); |
| 8644 | 8646 |
| 8645 // Sublayer should be bigger than the root enlarged by bounds_delta. | 8647 // Sublayer should be bigger than the root enlarged by bounds_delta. |
| 8646 gfx::Size sublayer_size = gfx::Size(300, 1000); | 8648 gfx::Size sublayer_size = gfx::Size(300, 1000); |
| 8647 | 8649 |
| 8648 // Device viewport accomidated the root and the top controls. | 8650 // Device viewport accomidated the root and the top controls. |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8849 surface->AddChild(box); | 8851 surface->AddChild(box); |
| 8850 | 8852 |
| 8851 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 8853 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 8852 host->SetRootLayer(root); | 8854 host->SetRootLayer(root); |
| 8853 | 8855 |
| 8854 ExecuteCalculateDrawProperties(root.get()); | 8856 ExecuteCalculateDrawProperties(root.get()); |
| 8855 } | 8857 } |
| 8856 | 8858 |
| 8857 } // namespace | 8859 } // namespace |
| 8858 } // namespace cc | 8860 } // namespace cc |
| OLD | NEW |