Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 1028333002: Chromium -> Mojo roll. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_host_common.h ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
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
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
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
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
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
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
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
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
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
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 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
7639 // right clip, our render_surface_layer_list's order should be unaffected. 7641 // right clip, our render_surface_layer_list's order should be unaffected.
7640 EXPECT_EQ(3u, render_surface_layer_list.size()); 7642 EXPECT_EQ(3u, render_surface_layer_list.size());
7641 EXPECT_EQ(root.get(), render_surface_layer_list.at(0)); 7643 EXPECT_EQ(root.get(), render_surface_layer_list.at(0));
7642 EXPECT_EQ(render_surface2.get(), render_surface_layer_list.at(1)); 7644 EXPECT_EQ(render_surface2.get(), render_surface_layer_list.at(1));
7643 EXPECT_EQ(render_surface1.get(), render_surface_layer_list.at(2)); 7645 EXPECT_EQ(render_surface1.get(), render_surface_layer_list.at(2));
7644 EXPECT_TRUE(render_surface_layer_list.at(0)->render_surface()); 7646 EXPECT_TRUE(render_surface_layer_list.at(0)->render_surface());
7645 EXPECT_TRUE(render_surface_layer_list.at(1)->render_surface()); 7647 EXPECT_TRUE(render_surface_layer_list.at(1)->render_surface());
7646 EXPECT_TRUE(render_surface_layer_list.at(2)->render_surface()); 7648 EXPECT_TRUE(render_surface_layer_list.at(2)->render_surface());
7647 } 7649 }
7648 7650
7651 TEST_F(LayerTreeHostCommonTest, FixedPositionWithInterveningRenderSurface) {
7652 // Ensures that when we have a render surface between a fixed position layer
7653 // and its container, we compute the fixed position layer's draw transform
7654 // with respect to that intervening render surface, not with respect to its
7655 // container's render target.
7656 //
7657 // + root
7658 // + render_surface
7659 // + fixed
7660 //
7661 scoped_refptr<Layer> root = Layer::Create();
7662 scoped_refptr<LayerWithForcedDrawsContent> render_surface =
7663 make_scoped_refptr(new LayerWithForcedDrawsContent());
7664 scoped_refptr<LayerWithForcedDrawsContent> fixed =
7665 make_scoped_refptr(new LayerWithForcedDrawsContent());
7666
7667 root->AddChild(render_surface);
7668 render_surface->AddChild(fixed);
7669
7670 root->SetIsContainerForFixedPositionLayers(true);
7671 render_surface->SetForceRenderSurface(true);
7672
7673 LayerPositionConstraint constraint;
7674 constraint.set_is_fixed_position(true);
7675 fixed->SetPositionConstraint(constraint);
7676
7677 SetLayerPropertiesForTesting(root.get(), gfx::Transform(), gfx::Point3F(),
7678 gfx::PointF(), gfx::Size(50, 50), true, false);
7679 SetLayerPropertiesForTesting(render_surface.get(), gfx::Transform(),
7680 gfx::Point3F(), gfx::PointF(7.f, 9.f),
7681 gfx::Size(50, 50), true, false);
7682 SetLayerPropertiesForTesting(fixed.get(), gfx::Transform(), gfx::Point3F(),
7683 gfx::PointF(10.f, 15.f), gfx::Size(50, 50), true,
7684 false);
7685
7686 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
7687 host->SetRootLayer(root);
7688
7689 ExecuteCalculateDrawProperties(root.get());
7690
7691 gfx::Transform expected_draw_transform;
7692 expected_draw_transform.Translate(10.f, 15.f);
7693 EXPECT_EQ(expected_draw_transform, fixed->draw_transform());
7694
7695 gfx::Transform expected_screen_space_transform;
7696 expected_screen_space_transform.Translate(17.f, 24.f);
7697 EXPECT_EQ(expected_screen_space_transform, fixed->screen_space_transform());
7698 }
7699
7649 TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) { 7700 TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) {
7650 // This test verifies that a scrolling layer that gets snapped to 7701 // This test verifies that a scrolling layer that gets snapped to
7651 // integer coordinates doesn't move a fixed position child. 7702 // integer coordinates doesn't move a fixed position child.
7652 // 7703 //
7653 // + root 7704 // + root
7654 // + container 7705 // + container
7655 // + scroller 7706 // + scroller
7656 // + fixed 7707 // + fixed
7657 // 7708 //
7658 FakeImplProxy proxy; 7709 FakeImplProxy proxy;
7659 TestSharedBitmapManager shared_bitmap_manager; 7710 TestSharedBitmapManager shared_bitmap_manager;
7660 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); 7711 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr);
7661 host_impl.CreatePendingTree(); 7712 host_impl.CreatePendingTree();
7662 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); 7713 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
7663 scoped_ptr<LayerImpl> container = 7714 scoped_ptr<LayerImpl> container =
7664 LayerImpl::Create(host_impl.active_tree(), 2); 7715 LayerImpl::Create(host_impl.active_tree(), 2);
7665 LayerImpl* container_layer = container.get(); 7716 LayerImpl* container_layer = container.get();
7666 scoped_ptr<LayerImpl> scroller = 7717 scoped_ptr<LayerImpl> scroller =
7667 LayerImpl::Create(host_impl.active_tree(), 3); 7718 LayerImpl::Create(host_impl.active_tree(), 3);
7668 LayerImpl* scroll_layer = scroller.get(); 7719 LayerImpl* scroll_layer = scroller.get();
7669 scoped_ptr<LayerImpl> fixed = LayerImpl::Create(host_impl.active_tree(), 4); 7720 scoped_ptr<LayerImpl> fixed = LayerImpl::Create(host_impl.active_tree(), 4);
7670 LayerImpl* fixed_layer = fixed.get(); 7721 LayerImpl* fixed_layer = fixed.get();
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
7794 // This test verifies that a scrolling layer that has fractional scroll offset 7845 // This test verifies that a scrolling layer that has fractional scroll offset
7795 // from main doesn't move a fixed position child. 7846 // from main doesn't move a fixed position child.
7796 // 7847 //
7797 // + root 7848 // + root
7798 // + container 7849 // + container
7799 // + scroller 7850 // + scroller
7800 // + fixed 7851 // + fixed
7801 // 7852 //
7802 FakeImplProxy proxy; 7853 FakeImplProxy proxy;
7803 TestSharedBitmapManager shared_bitmap_manager; 7854 TestSharedBitmapManager shared_bitmap_manager;
7804 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); 7855 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr);
7805 host_impl.CreatePendingTree(); 7856 host_impl.CreatePendingTree();
7806 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); 7857 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
7807 scoped_ptr<LayerImpl> container = 7858 scoped_ptr<LayerImpl> container =
7808 LayerImpl::Create(host_impl.active_tree(), 2); 7859 LayerImpl::Create(host_impl.active_tree(), 2);
7809 LayerImpl* container_layer = container.get(); 7860 LayerImpl* container_layer = container.get();
7810 scoped_ptr<LayerImpl> scroller = 7861 scoped_ptr<LayerImpl> scroller =
7811 LayerImpl::Create(host_impl.active_tree(), 3); 7862 LayerImpl::Create(host_impl.active_tree(), 3);
7812 LayerImpl* scroll_layer = scroller.get(); 7863 LayerImpl* scroll_layer = scroller.get();
7813 scoped_ptr<LayerImpl> fixed = LayerImpl::Create(host_impl.active_tree(), 4); 7864 scoped_ptr<LayerImpl> fixed = LayerImpl::Create(host_impl.active_tree(), 4);
7814 LayerImpl* fixed_layer = fixed.get(); 7865 LayerImpl* fixed_layer = fixed.get();
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
7888 explicit AnimationScaleFactorTrackingLayerImpl(LayerTreeImpl* tree_impl, 7939 explicit AnimationScaleFactorTrackingLayerImpl(LayerTreeImpl* tree_impl,
7889 int id) 7940 int id)
7890 : LayerImpl(tree_impl, id) { 7941 : LayerImpl(tree_impl, id) {
7891 SetDrawsContent(true); 7942 SetDrawsContent(true);
7892 } 7943 }
7893 }; 7944 };
7894 7945
7895 TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) { 7946 TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) {
7896 FakeImplProxy proxy; 7947 FakeImplProxy proxy;
7897 TestSharedBitmapManager shared_bitmap_manager; 7948 TestSharedBitmapManager shared_bitmap_manager;
7898 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); 7949 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr);
7899 gfx::Transform identity_matrix; 7950 gfx::Transform identity_matrix;
7900 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> grand_parent = 7951 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> grand_parent =
7901 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 1); 7952 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 1);
7902 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> parent = 7953 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> parent =
7903 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 2); 7954 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 2);
7904 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> child = 7955 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> child =
7905 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 3); 7956 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 3);
7906 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> grand_child = 7957 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> grand_child =
7907 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 4); 7958 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 4);
7908 7959
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
8105 if (layer->mask_layer()) 8156 if (layer->mask_layer())
8106 drawn_layers->insert(layer->mask_layer()); 8157 drawn_layers->insert(layer->mask_layer());
8107 if (layer->replica_layer() && layer->replica_layer()->mask_layer()) 8158 if (layer->replica_layer() && layer->replica_layer()->mask_layer())
8108 drawn_layers->insert(layer->replica_layer()->mask_layer()); 8159 drawn_layers->insert(layer->replica_layer()->mask_layer());
8109 } 8160 }
8110 } 8161 }
8111 8162
8112 TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) { 8163 TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) {
8113 FakeImplProxy proxy; 8164 FakeImplProxy proxy;
8114 TestSharedBitmapManager shared_bitmap_manager; 8165 TestSharedBitmapManager shared_bitmap_manager;
8115 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); 8166 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr);
8116 gfx::Transform identity_matrix; 8167 gfx::Transform identity_matrix;
8117 8168
8118 scoped_ptr<LayerImpl> grand_parent = 8169 scoped_ptr<LayerImpl> grand_parent =
8119 LayerImpl::Create(host_impl.active_tree(), 1); 8170 LayerImpl::Create(host_impl.active_tree(), 1);
8120 scoped_ptr<LayerImpl> parent = LayerImpl::Create(host_impl.active_tree(), 3); 8171 scoped_ptr<LayerImpl> parent = LayerImpl::Create(host_impl.active_tree(), 3);
8121 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.active_tree(), 5); 8172 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.active_tree(), 5);
8122 scoped_ptr<LayerImpl> grand_child1 = 8173 scoped_ptr<LayerImpl> grand_child1 =
8123 LayerImpl::Create(host_impl.active_tree(), 7); 8174 LayerImpl::Create(host_impl.active_tree(), 7);
8124 scoped_ptr<LayerImpl> grand_child2 = 8175 scoped_ptr<LayerImpl> grand_child2 =
8125 LayerImpl::Create(host_impl.active_tree(), 9); 8176 LayerImpl::Create(host_impl.active_tree(), 9);
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
8348 expected.insert(grand_child2_raw); 8399 expected.insert(grand_child2_raw);
8349 8400
8350 actual.clear(); 8401 actual.clear();
8351 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); 8402 GatherDrawnLayers(render_surface_layer_list_impl(), &actual);
8352 EXPECT_EQ(expected, actual); 8403 EXPECT_EQ(expected, actual);
8353 } 8404 }
8354 8405
8355 TEST_F(LayerTreeHostCommonTest, DrawPropertyScales) { 8406 TEST_F(LayerTreeHostCommonTest, DrawPropertyScales) {
8356 FakeImplProxy proxy; 8407 FakeImplProxy proxy;
8357 TestSharedBitmapManager shared_bitmap_manager; 8408 TestSharedBitmapManager shared_bitmap_manager;
8358 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); 8409 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr);
8359 8410
8360 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); 8411 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
8361 LayerImpl* root_layer = root.get(); 8412 LayerImpl* root_layer = root.get();
8362 scoped_ptr<LayerImpl> child1 = LayerImpl::Create(host_impl.active_tree(), 2); 8413 scoped_ptr<LayerImpl> child1 = LayerImpl::Create(host_impl.active_tree(), 2);
8363 LayerImpl* child1_layer = child1.get(); 8414 LayerImpl* child1_layer = child1.get();
8364 scoped_ptr<LayerImpl> child2 = LayerImpl::Create(host_impl.active_tree(), 3); 8415 scoped_ptr<LayerImpl> child2 = LayerImpl::Create(host_impl.active_tree(), 3);
8365 LayerImpl* child2_layer = child2.get(); 8416 LayerImpl* child2_layer = child2.get();
8366 8417
8367 root->AddChild(child1.Pass()); 8418 root->AddChild(child1.Pass());
8368 root->AddChild(child2.Pass()); 8419 root->AddChild(child2.Pass());
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
8628 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), root->visible_content_rect()); 8679 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), root->visible_content_rect());
8629 8680
8630 // Layers drawing to a child render surface should still have their visible 8681 // Layers drawing to a child render surface should still have their visible
8631 // content rect clipped by the viewport. 8682 // content rect clipped by the viewport.
8632 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), content->visible_content_rect()); 8683 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), content->visible_content_rect());
8633 } 8684 }
8634 8685
8635 TEST_F(LayerTreeHostCommonTest, BoundsDeltaAffectVisibleContentRect) { 8686 TEST_F(LayerTreeHostCommonTest, BoundsDeltaAffectVisibleContentRect) {
8636 FakeImplProxy proxy; 8687 FakeImplProxy proxy;
8637 TestSharedBitmapManager shared_bitmap_manager; 8688 TestSharedBitmapManager shared_bitmap_manager;
8638 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); 8689 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr);
8639 8690
8640 // Set two layers: the root layer clips it's child, 8691 // Set two layers: the root layer clips it's child,
8641 // the child draws its content. 8692 // the child draws its content.
8642 8693
8643 gfx::Size root_size = gfx::Size(300, 500); 8694 gfx::Size root_size = gfx::Size(300, 500);
8644 8695
8645 // Sublayer should be bigger than the root enlarged by bounds_delta. 8696 // Sublayer should be bigger than the root enlarged by bounds_delta.
8646 gfx::Size sublayer_size = gfx::Size(300, 1000); 8697 gfx::Size sublayer_size = gfx::Size(300, 1000);
8647 8698
8648 // Device viewport accomidated the root and the top controls. 8699 // Device viewport accomidated the root and the top controls.
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
8847 rotated->AddChild(surface); 8898 rotated->AddChild(surface);
8848 surface->AddChild(container); 8899 surface->AddChild(container);
8849 surface->AddChild(box); 8900 surface->AddChild(box);
8850 8901
8851 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); 8902 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
8852 host->SetRootLayer(root); 8903 host->SetRootLayer(root);
8853 8904
8854 ExecuteCalculateDrawProperties(root.get()); 8905 ExecuteCalculateDrawProperties(root.get());
8855 } 8906 }
8856 8907
8908 TEST_F(LayerTreeHostCommonTest, OnlyApplyFixedPositioningOnce) {
8909 gfx::Transform identity;
8910 gfx::Transform translate_z;
8911 translate_z.Translate3d(0, 0, 10);
8912
8913 scoped_refptr<Layer> root = Layer::Create();
8914 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(),
8915 gfx::PointF(), gfx::Size(800, 800), true, false);
8916 root->SetIsContainerForFixedPositionLayers(true);
8917
8918 scoped_refptr<Layer> frame_clip = Layer::Create();
8919 SetLayerPropertiesForTesting(frame_clip.get(), translate_z, gfx::Point3F(),
8920 gfx::PointF(500, 100), gfx::Size(100, 100), true,
8921 false);
8922 frame_clip->SetMasksToBounds(true);
8923
8924 scoped_refptr<LayerWithForcedDrawsContent> fixed =
8925 make_scoped_refptr(new LayerWithForcedDrawsContent());
8926 SetLayerPropertiesForTesting(fixed.get(), identity, gfx::Point3F(),
8927 gfx::PointF(), gfx::Size(1000, 1000), true,
8928 false);
8929
8930 LayerPositionConstraint constraint;
8931 constraint.set_is_fixed_position(true);
8932 fixed->SetPositionConstraint(constraint);
8933
8934 root->AddChild(frame_clip);
8935 frame_clip->AddChild(fixed);
8936
8937 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
8938 host->SetRootLayer(root);
8939
8940 ExecuteCalculateDrawProperties(root.get());
8941
8942 gfx::Rect expected(0, 0, 100, 100);
8943 EXPECT_EQ(expected, fixed->visible_rect_from_property_trees());
8944 }
8945
8857 } // namespace 8946 } // namespace
8858 } // namespace cc 8947 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_common.h ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698