| 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 <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "cc/animation/layer_animation_controller.h" | 9 #include "cc/animation/layer_animation_controller.h" |
| 10 #include "cc/animation/transform_operations.h" | 10 #include "cc/animation/transform_operations.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 // and with identity transforms, then the draw transform, | 78 // and with identity transforms, then the draw transform, |
| 79 // screen space transform, and the hierarchy passed on to children | 79 // screen space transform, and the hierarchy passed on to children |
| 80 // layers should also be identity transforms. | 80 // layers should also be identity transforms. |
| 81 | 81 |
| 82 scoped_refptr<Layer> parent = Layer::Create(); | 82 scoped_refptr<Layer> parent = Layer::Create(); |
| 83 scoped_refptr<Layer> child = Layer::Create(); | 83 scoped_refptr<Layer> child = Layer::Create(); |
| 84 scoped_refptr<Layer> grand_child = Layer::Create(); | 84 scoped_refptr<Layer> grand_child = Layer::Create(); |
| 85 parent->AddChild(child); | 85 parent->AddChild(child); |
| 86 child->AddChild(grand_child); | 86 child->AddChild(grand_child); |
| 87 | 87 |
| 88 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 88 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 89 host->SetRootLayer(parent); | 89 host->SetRootLayer(parent); |
| 90 | 90 |
| 91 gfx::Transform identity_matrix; | 91 gfx::Transform identity_matrix; |
| 92 SetLayerPropertiesForTesting(parent.get(), | 92 SetLayerPropertiesForTesting(parent.get(), |
| 93 identity_matrix, | 93 identity_matrix, |
| 94 gfx::Point3F(), | 94 gfx::Point3F(), |
| 95 gfx::PointF(), | 95 gfx::PointF(), |
| 96 gfx::Size(100, 100), | 96 gfx::Size(100, 100), |
| 97 true, | 97 true, |
| 98 false); | 98 false); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 122 grand_child->screen_space_transform()); | 122 grand_child->screen_space_transform()); |
| 123 } | 123 } |
| 124 | 124 |
| 125 TEST_F(LayerTreeHostCommonTest, DoNotSkipLayersWithHandlers) { | 125 TEST_F(LayerTreeHostCommonTest, DoNotSkipLayersWithHandlers) { |
| 126 scoped_refptr<Layer> parent = Layer::Create(); | 126 scoped_refptr<Layer> parent = Layer::Create(); |
| 127 scoped_refptr<Layer> child = Layer::Create(); | 127 scoped_refptr<Layer> child = Layer::Create(); |
| 128 scoped_refptr<Layer> grand_child = Layer::Create(); | 128 scoped_refptr<Layer> grand_child = Layer::Create(); |
| 129 parent->AddChild(child); | 129 parent->AddChild(child); |
| 130 child->AddChild(grand_child); | 130 child->AddChild(grand_child); |
| 131 | 131 |
| 132 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 132 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 133 host->SetRootLayer(parent); | 133 host->SetRootLayer(parent); |
| 134 | 134 |
| 135 gfx::Transform identity_matrix; | 135 gfx::Transform identity_matrix; |
| 136 SetLayerPropertiesForTesting(parent.get(), | 136 SetLayerPropertiesForTesting(parent.get(), |
| 137 identity_matrix, | 137 identity_matrix, |
| 138 gfx::Point3F(), | 138 gfx::Point3F(), |
| 139 gfx::PointF(), | 139 gfx::PointF(), |
| 140 gfx::Size(100, 100), | 140 gfx::Size(100, 100), |
| 141 true, | 141 true, |
| 142 false); | 142 false); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 scoped_refptr<Layer> root = Layer::Create(); | 175 scoped_refptr<Layer> root = Layer::Create(); |
| 176 SetLayerPropertiesForTesting(root.get(), | 176 SetLayerPropertiesForTesting(root.get(), |
| 177 identity_matrix, | 177 identity_matrix, |
| 178 gfx::Point3F(), | 178 gfx::Point3F(), |
| 179 gfx::PointF(), | 179 gfx::PointF(), |
| 180 gfx::Size(1, 2), | 180 gfx::Size(1, 2), |
| 181 true, | 181 true, |
| 182 false); | 182 false); |
| 183 root->AddChild(layer); | 183 root->AddChild(layer); |
| 184 | 184 |
| 185 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 185 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 186 host->SetRootLayer(root); | 186 host->SetRootLayer(root); |
| 187 | 187 |
| 188 // Case 2: Setting the bounds of the layer should not affect either the draw | 188 // Case 2: Setting the bounds of the layer should not affect either the draw |
| 189 // transform or the screenspace transform. | 189 // transform or the screenspace transform. |
| 190 gfx::Transform translation_to_center; | 190 gfx::Transform translation_to_center; |
| 191 translation_to_center.Translate(5.0, 6.0); | 191 translation_to_center.Translate(5.0, 6.0); |
| 192 SetLayerPropertiesForTesting(layer.get(), | 192 SetLayerPropertiesForTesting(layer.get(), |
| 193 identity_matrix, | 193 identity_matrix, |
| 194 gfx::Point3F(), | 194 gfx::Point3F(), |
| 195 gfx::PointF(), | 195 gfx::PointF(), |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 TEST_F(LayerTreeHostCommonTest, TransformsForSimpleHierarchy) { | 384 TEST_F(LayerTreeHostCommonTest, TransformsForSimpleHierarchy) { |
| 385 gfx::Transform identity_matrix; | 385 gfx::Transform identity_matrix; |
| 386 scoped_refptr<Layer> root = Layer::Create(); | 386 scoped_refptr<Layer> root = Layer::Create(); |
| 387 scoped_refptr<Layer> parent = Layer::Create(); | 387 scoped_refptr<Layer> parent = Layer::Create(); |
| 388 scoped_refptr<Layer> child = Layer::Create(); | 388 scoped_refptr<Layer> child = Layer::Create(); |
| 389 scoped_refptr<Layer> grand_child = Layer::Create(); | 389 scoped_refptr<Layer> grand_child = Layer::Create(); |
| 390 root->AddChild(parent); | 390 root->AddChild(parent); |
| 391 parent->AddChild(child); | 391 parent->AddChild(child); |
| 392 child->AddChild(grand_child); | 392 child->AddChild(grand_child); |
| 393 | 393 |
| 394 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 394 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 395 host->SetRootLayer(root); | 395 host->SetRootLayer(root); |
| 396 | 396 |
| 397 // One-time setup of root layer | 397 // One-time setup of root layer |
| 398 SetLayerPropertiesForTesting(root.get(), | 398 SetLayerPropertiesForTesting(root.get(), |
| 399 identity_matrix, | 399 identity_matrix, |
| 400 gfx::Point3F(), | 400 gfx::Point3F(), |
| 401 gfx::PointF(), | 401 gfx::PointF(), |
| 402 gfx::Size(1, 2), | 402 gfx::Size(1, 2), |
| 403 true, | 403 true, |
| 404 false); | 404 false); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 TEST_F(LayerTreeHostCommonTest, TransformsForSingleRenderSurface) { | 511 TEST_F(LayerTreeHostCommonTest, TransformsForSingleRenderSurface) { |
| 512 scoped_refptr<Layer> root = Layer::Create(); | 512 scoped_refptr<Layer> root = Layer::Create(); |
| 513 scoped_refptr<Layer> parent = Layer::Create(); | 513 scoped_refptr<Layer> parent = Layer::Create(); |
| 514 scoped_refptr<Layer> child = Layer::Create(); | 514 scoped_refptr<Layer> child = Layer::Create(); |
| 515 scoped_refptr<LayerWithForcedDrawsContent> grand_child = | 515 scoped_refptr<LayerWithForcedDrawsContent> grand_child = |
| 516 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 516 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 517 root->AddChild(parent); | 517 root->AddChild(parent); |
| 518 parent->AddChild(child); | 518 parent->AddChild(child); |
| 519 child->AddChild(grand_child); | 519 child->AddChild(grand_child); |
| 520 | 520 |
| 521 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 521 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 522 host->SetRootLayer(root); | 522 host->SetRootLayer(root); |
| 523 | 523 |
| 524 // One-time setup of root layer | 524 // One-time setup of root layer |
| 525 gfx::Transform identity_matrix; | 525 gfx::Transform identity_matrix; |
| 526 SetLayerPropertiesForTesting(root.get(), | 526 SetLayerPropertiesForTesting(root.get(), |
| 527 identity_matrix, | 527 identity_matrix, |
| 528 gfx::Point3F(), | 528 gfx::Point3F(), |
| 529 gfx::PointF(), | 529 gfx::PointF(), |
| 530 gfx::Size(1, 2), | 530 gfx::Size(1, 2), |
| 531 true, | 531 true, |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 scoped_refptr<Layer> parent = Layer::Create(); | 608 scoped_refptr<Layer> parent = Layer::Create(); |
| 609 scoped_refptr<Layer> child = Layer::Create(); | 609 scoped_refptr<Layer> child = Layer::Create(); |
| 610 scoped_refptr<Layer> child_replica = Layer::Create(); | 610 scoped_refptr<Layer> child_replica = Layer::Create(); |
| 611 scoped_refptr<LayerWithForcedDrawsContent> grand_child = | 611 scoped_refptr<LayerWithForcedDrawsContent> grand_child = |
| 612 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 612 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 613 root->AddChild(parent); | 613 root->AddChild(parent); |
| 614 parent->AddChild(child); | 614 parent->AddChild(child); |
| 615 child->AddChild(grand_child); | 615 child->AddChild(grand_child); |
| 616 child->SetReplicaLayer(child_replica.get()); | 616 child->SetReplicaLayer(child_replica.get()); |
| 617 | 617 |
| 618 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 618 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 619 host->SetRootLayer(root); | 619 host->SetRootLayer(root); |
| 620 | 620 |
| 621 // One-time setup of root layer | 621 // One-time setup of root layer |
| 622 gfx::Transform identity_matrix; | 622 gfx::Transform identity_matrix; |
| 623 SetLayerPropertiesForTesting(root.get(), | 623 SetLayerPropertiesForTesting(root.get(), |
| 624 identity_matrix, | 624 identity_matrix, |
| 625 gfx::Point3F(), | 625 gfx::Point3F(), |
| 626 gfx::PointF(), | 626 gfx::PointF(), |
| 627 gfx::Size(1, 2), | 627 gfx::Size(1, 2), |
| 628 true, | 628 true, |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 parent->AddChild(child_of_root); | 729 parent->AddChild(child_of_root); |
| 730 render_surface1->AddChild(child_of_rs1); | 730 render_surface1->AddChild(child_of_rs1); |
| 731 render_surface1->AddChild(render_surface2); | 731 render_surface1->AddChild(render_surface2); |
| 732 render_surface2->AddChild(child_of_rs2); | 732 render_surface2->AddChild(child_of_rs2); |
| 733 child_of_root->AddChild(grand_child_of_root); | 733 child_of_root->AddChild(grand_child_of_root); |
| 734 child_of_rs1->AddChild(grand_child_of_rs1); | 734 child_of_rs1->AddChild(grand_child_of_rs1); |
| 735 child_of_rs2->AddChild(grand_child_of_rs2); | 735 child_of_rs2->AddChild(grand_child_of_rs2); |
| 736 render_surface1->SetReplicaLayer(replica_of_rs1.get()); | 736 render_surface1->SetReplicaLayer(replica_of_rs1.get()); |
| 737 render_surface2->SetReplicaLayer(replica_of_rs2.get()); | 737 render_surface2->SetReplicaLayer(replica_of_rs2.get()); |
| 738 | 738 |
| 739 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 739 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 740 host->SetRootLayer(root); | 740 host->SetRootLayer(root); |
| 741 | 741 |
| 742 // In combination with descendant draws content, opacity != 1 forces the layer | 742 // In combination with descendant draws content, opacity != 1 forces the layer |
| 743 // to have a new render surface. | 743 // to have a new render surface. |
| 744 render_surface1->SetOpacity(0.5f); | 744 render_surface1->SetOpacity(0.5f); |
| 745 render_surface2->SetOpacity(0.33f); | 745 render_surface2->SetOpacity(0.33f); |
| 746 | 746 |
| 747 // One-time setup of root layer | 747 // One-time setup of root layer |
| 748 gfx::Transform identity_matrix; | 748 gfx::Transform identity_matrix; |
| 749 SetLayerPropertiesForTesting(root.get(), | 749 SetLayerPropertiesForTesting(root.get(), |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1024 gfx::Point3F(), | 1024 gfx::Point3F(), |
| 1025 gfx::PointF(), | 1025 gfx::PointF(), |
| 1026 gfx::Size(10, 10), | 1026 gfx::Size(10, 10), |
| 1027 true, | 1027 true, |
| 1028 false); | 1028 false); |
| 1029 | 1029 |
| 1030 root->AddChild(child); | 1030 root->AddChild(child); |
| 1031 child->AddChild(grand_child); | 1031 child->AddChild(grand_child); |
| 1032 child->SetForceRenderSurface(true); | 1032 child->SetForceRenderSurface(true); |
| 1033 | 1033 |
| 1034 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 1034 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 1035 host->SetRootLayer(root); | 1035 host->SetRootLayer(root); |
| 1036 | 1036 |
| 1037 // No layers in this test should preserve 3d. | 1037 // No layers in this test should preserve 3d. |
| 1038 ASSERT_TRUE(root->should_flatten_transform()); | 1038 ASSERT_TRUE(root->should_flatten_transform()); |
| 1039 ASSERT_TRUE(child->should_flatten_transform()); | 1039 ASSERT_TRUE(child->should_flatten_transform()); |
| 1040 ASSERT_TRUE(grand_child->should_flatten_transform()); | 1040 ASSERT_TRUE(grand_child->should_flatten_transform()); |
| 1041 | 1041 |
| 1042 gfx::Transform expected_child_draw_transform = rotation_about_y_axis; | 1042 gfx::Transform expected_child_draw_transform = rotation_about_y_axis; |
| 1043 gfx::Transform expected_child_screen_space_transform = rotation_about_y_axis; | 1043 gfx::Transform expected_child_screen_space_transform = rotation_about_y_axis; |
| 1044 gfx::Transform expected_grand_child_draw_transform = | 1044 gfx::Transform expected_grand_child_draw_transform = |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1103 gfx::Point3F(), | 1103 gfx::Point3F(), |
| 1104 gfx::PointF(), | 1104 gfx::PointF(), |
| 1105 gfx::Size(10, 10), | 1105 gfx::Size(10, 10), |
| 1106 true, | 1106 true, |
| 1107 false); | 1107 false); |
| 1108 | 1108 |
| 1109 root->AddChild(child); | 1109 root->AddChild(child); |
| 1110 child->AddChild(grand_child); | 1110 child->AddChild(grand_child); |
| 1111 child->SetForceRenderSurface(true); | 1111 child->SetForceRenderSurface(true); |
| 1112 | 1112 |
| 1113 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 1113 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 1114 host->SetRootLayer(root); | 1114 host->SetRootLayer(root); |
| 1115 | 1115 |
| 1116 ExecuteCalculateDrawProperties(root.get()); | 1116 ExecuteCalculateDrawProperties(root.get()); |
| 1117 | 1117 |
| 1118 ASSERT_TRUE(child->render_surface()); | 1118 ASSERT_TRUE(child->render_surface()); |
| 1119 // This is the real test, the rest are sanity checks. | 1119 // This is the real test, the rest are sanity checks. |
| 1120 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, | 1120 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, |
| 1121 child->render_surface()->draw_transform()); | 1121 child->render_surface()->draw_transform()); |
| 1122 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, child->draw_transform()); | 1122 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, child->draw_transform()); |
| 1123 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, | 1123 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, |
| 1124 grand_child->draw_transform()); | 1124 grand_child->draw_transform()); |
| 1125 } | 1125 } |
| 1126 | 1126 |
| 1127 TEST_F(LayerTreeHostCommonTest, TransformAboveRootLayer) { | 1127 TEST_F(LayerTreeHostCommonTest, TransformAboveRootLayer) { |
| 1128 // Transformations applied at the root of the tree should be forwarded | 1128 // Transformations applied at the root of the tree should be forwarded |
| 1129 // to child layers instead of applied to the root RenderSurface. | 1129 // to child layers instead of applied to the root RenderSurface. |
| 1130 const gfx::Transform identity_matrix; | 1130 const gfx::Transform identity_matrix; |
| 1131 scoped_refptr<LayerWithForcedDrawsContent> root = | 1131 scoped_refptr<LayerWithForcedDrawsContent> root = |
| 1132 new LayerWithForcedDrawsContent; | 1132 new LayerWithForcedDrawsContent; |
| 1133 scoped_refptr<LayerWithForcedDrawsContent> child = | 1133 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 1134 new LayerWithForcedDrawsContent; | 1134 new LayerWithForcedDrawsContent; |
| 1135 child->SetScrollClipLayerId(root->id()); | 1135 child->SetScrollClipLayerId(root->id()); |
| 1136 root->AddChild(child); | 1136 root->AddChild(child); |
| 1137 | 1137 |
| 1138 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 1138 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 1139 host->SetRootLayer(root); | 1139 host->SetRootLayer(root); |
| 1140 | 1140 |
| 1141 SetLayerPropertiesForTesting(root.get(), | 1141 SetLayerPropertiesForTesting(root.get(), |
| 1142 identity_matrix, | 1142 identity_matrix, |
| 1143 gfx::Point3F(), | 1143 gfx::Point3F(), |
| 1144 gfx::PointF(), | 1144 gfx::PointF(), |
| 1145 gfx::Size(20, 20), | 1145 gfx::Size(20, 20), |
| 1146 true, | 1146 true, |
| 1147 false); | 1147 false); |
| 1148 SetLayerPropertiesForTesting(child.get(), | 1148 SetLayerPropertiesForTesting(child.get(), |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1275 } | 1275 } |
| 1276 } | 1276 } |
| 1277 | 1277 |
| 1278 TEST_F(LayerTreeHostCommonTest, | 1278 TEST_F(LayerTreeHostCommonTest, |
| 1279 RenderSurfaceListForRenderSurfaceWithClippedLayer) { | 1279 RenderSurfaceListForRenderSurfaceWithClippedLayer) { |
| 1280 scoped_refptr<Layer> parent = Layer::Create(); | 1280 scoped_refptr<Layer> parent = Layer::Create(); |
| 1281 scoped_refptr<Layer> render_surface1 = Layer::Create(); | 1281 scoped_refptr<Layer> render_surface1 = Layer::Create(); |
| 1282 scoped_refptr<LayerWithForcedDrawsContent> child = | 1282 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 1283 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 1283 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 1284 | 1284 |
| 1285 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 1285 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 1286 host->SetRootLayer(parent); | 1286 host->SetRootLayer(parent); |
| 1287 | 1287 |
| 1288 const gfx::Transform identity_matrix; | 1288 const gfx::Transform identity_matrix; |
| 1289 SetLayerPropertiesForTesting(parent.get(), | 1289 SetLayerPropertiesForTesting(parent.get(), |
| 1290 identity_matrix, | 1290 identity_matrix, |
| 1291 gfx::Point3F(), | 1291 gfx::Point3F(), |
| 1292 gfx::PointF(), | 1292 gfx::PointF(), |
| 1293 gfx::Size(10, 10), | 1293 gfx::Size(10, 10), |
| 1294 true, | 1294 true, |
| 1295 false); | 1295 false); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1329 ASSERT_TRUE(parent->render_surface()); | 1329 ASSERT_TRUE(parent->render_surface()); |
| 1330 EXPECT_EQ(1U, render_surface_layer_list.size()); | 1330 EXPECT_EQ(1U, render_surface_layer_list.size()); |
| 1331 } | 1331 } |
| 1332 | 1332 |
| 1333 TEST_F(LayerTreeHostCommonTest, RenderSurfaceListForTransparentChild) { | 1333 TEST_F(LayerTreeHostCommonTest, RenderSurfaceListForTransparentChild) { |
| 1334 scoped_refptr<Layer> parent = Layer::Create(); | 1334 scoped_refptr<Layer> parent = Layer::Create(); |
| 1335 scoped_refptr<Layer> render_surface1 = Layer::Create(); | 1335 scoped_refptr<Layer> render_surface1 = Layer::Create(); |
| 1336 scoped_refptr<LayerWithForcedDrawsContent> child = | 1336 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 1337 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 1337 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 1338 | 1338 |
| 1339 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 1339 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 1340 host->SetRootLayer(parent); | 1340 host->SetRootLayer(parent); |
| 1341 | 1341 |
| 1342 const gfx::Transform identity_matrix; | 1342 const gfx::Transform identity_matrix; |
| 1343 SetLayerPropertiesForTesting(render_surface1.get(), | 1343 SetLayerPropertiesForTesting(render_surface1.get(), |
| 1344 identity_matrix, | 1344 identity_matrix, |
| 1345 gfx::Point3F(), | 1345 gfx::Point3F(), |
| 1346 gfx::PointF(), | 1346 gfx::PointF(), |
| 1347 gfx::Size(10, 10), | 1347 gfx::Size(10, 10), |
| 1348 true, | 1348 true, |
| 1349 false); | 1349 false); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1376 EXPECT_EQ(gfx::Rect(), parent->drawable_content_rect()); | 1376 EXPECT_EQ(gfx::Rect(), parent->drawable_content_rect()); |
| 1377 } | 1377 } |
| 1378 | 1378 |
| 1379 TEST_F(LayerTreeHostCommonTest, ForceRenderSurface) { | 1379 TEST_F(LayerTreeHostCommonTest, ForceRenderSurface) { |
| 1380 scoped_refptr<Layer> parent = Layer::Create(); | 1380 scoped_refptr<Layer> parent = Layer::Create(); |
| 1381 scoped_refptr<Layer> render_surface1 = Layer::Create(); | 1381 scoped_refptr<Layer> render_surface1 = Layer::Create(); |
| 1382 scoped_refptr<LayerWithForcedDrawsContent> child = | 1382 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 1383 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 1383 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 1384 render_surface1->SetForceRenderSurface(true); | 1384 render_surface1->SetForceRenderSurface(true); |
| 1385 | 1385 |
| 1386 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 1386 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 1387 host->SetRootLayer(parent); | 1387 host->SetRootLayer(parent); |
| 1388 | 1388 |
| 1389 const gfx::Transform identity_matrix; | 1389 const gfx::Transform identity_matrix; |
| 1390 SetLayerPropertiesForTesting(parent.get(), | 1390 SetLayerPropertiesForTesting(parent.get(), |
| 1391 identity_matrix, | 1391 identity_matrix, |
| 1392 gfx::Point3F(), | 1392 gfx::Point3F(), |
| 1393 gfx::PointF(), | 1393 gfx::PointF(), |
| 1394 gfx::Size(10, 10), | 1394 gfx::Size(10, 10), |
| 1395 true, | 1395 true, |
| 1396 false); | 1396 false); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1465 scoped_refptr<Layer> grand_child = Layer::Create(); | 1465 scoped_refptr<Layer> grand_child = Layer::Create(); |
| 1466 scoped_refptr<Layer> great_grand_child = Layer::Create(); | 1466 scoped_refptr<Layer> great_grand_child = Layer::Create(); |
| 1467 scoped_refptr<LayerWithForcedDrawsContent> leaf_node1 = | 1467 scoped_refptr<LayerWithForcedDrawsContent> leaf_node1 = |
| 1468 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 1468 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 1469 scoped_refptr<LayerWithForcedDrawsContent> leaf_node2 = | 1469 scoped_refptr<LayerWithForcedDrawsContent> leaf_node2 = |
| 1470 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 1470 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 1471 parent->AddChild(child); | 1471 parent->AddChild(child); |
| 1472 child->AddChild(grand_child); | 1472 child->AddChild(grand_child); |
| 1473 grand_child->AddChild(great_grand_child); | 1473 grand_child->AddChild(great_grand_child); |
| 1474 | 1474 |
| 1475 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 1475 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 1476 host->SetRootLayer(parent); | 1476 host->SetRootLayer(parent); |
| 1477 | 1477 |
| 1478 // leaf_node1 ensures that parent and child are kept on the | 1478 // leaf_node1 ensures that parent and child are kept on the |
| 1479 // render_surface_layer_list, even though grand_child and great_grand_child | 1479 // render_surface_layer_list, even though grand_child and great_grand_child |
| 1480 // should be clipped. | 1480 // should be clipped. |
| 1481 child->AddChild(leaf_node1); | 1481 child->AddChild(leaf_node1); |
| 1482 great_grand_child->AddChild(leaf_node2); | 1482 great_grand_child->AddChild(leaf_node2); |
| 1483 | 1483 |
| 1484 SetLayerPropertiesForTesting(parent.get(), | 1484 SetLayerPropertiesForTesting(parent.get(), |
| 1485 identity_matrix, | 1485 identity_matrix, |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1563 const gfx::Transform identity_matrix; | 1563 const gfx::Transform identity_matrix; |
| 1564 scoped_refptr<Layer> parent = Layer::Create(); | 1564 scoped_refptr<Layer> parent = Layer::Create(); |
| 1565 scoped_refptr<Layer> child = Layer::Create(); | 1565 scoped_refptr<Layer> child = Layer::Create(); |
| 1566 scoped_refptr<Layer> grand_child = Layer::Create(); | 1566 scoped_refptr<Layer> grand_child = Layer::Create(); |
| 1567 scoped_refptr<LayerWithForcedDrawsContent> leaf_node = | 1567 scoped_refptr<LayerWithForcedDrawsContent> leaf_node = |
| 1568 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 1568 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 1569 parent->AddChild(child); | 1569 parent->AddChild(child); |
| 1570 child->AddChild(grand_child); | 1570 child->AddChild(grand_child); |
| 1571 grand_child->AddChild(leaf_node); | 1571 grand_child->AddChild(leaf_node); |
| 1572 | 1572 |
| 1573 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 1573 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 1574 host->SetRootLayer(parent); | 1574 host->SetRootLayer(parent); |
| 1575 | 1575 |
| 1576 SetLayerPropertiesForTesting(parent.get(), | 1576 SetLayerPropertiesForTesting(parent.get(), |
| 1577 identity_matrix, | 1577 identity_matrix, |
| 1578 gfx::Point3F(), | 1578 gfx::Point3F(), |
| 1579 gfx::PointF(), | 1579 gfx::PointF(), |
| 1580 gfx::Size(100, 100), | 1580 gfx::Size(100, 100), |
| 1581 true, | 1581 true, |
| 1582 false); | 1582 false); |
| 1583 SetLayerPropertiesForTesting(child.get(), | 1583 SetLayerPropertiesForTesting(child.get(), |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1665 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 1665 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 1666 scoped_refptr<LayerWithForcedDrawsContent> leaf_node2 = | 1666 scoped_refptr<LayerWithForcedDrawsContent> leaf_node2 = |
| 1667 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 1667 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 1668 root->AddChild(parent); | 1668 root->AddChild(parent); |
| 1669 parent->AddChild(child1); | 1669 parent->AddChild(child1); |
| 1670 parent->AddChild(child2); | 1670 parent->AddChild(child2); |
| 1671 child1->AddChild(grand_child); | 1671 child1->AddChild(grand_child); |
| 1672 child2->AddChild(leaf_node2); | 1672 child2->AddChild(leaf_node2); |
| 1673 grand_child->AddChild(leaf_node1); | 1673 grand_child->AddChild(leaf_node1); |
| 1674 | 1674 |
| 1675 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 1675 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 1676 host->SetRootLayer(root); | 1676 host->SetRootLayer(root); |
| 1677 | 1677 |
| 1678 child2->SetForceRenderSurface(true); | 1678 child2->SetForceRenderSurface(true); |
| 1679 | 1679 |
| 1680 SetLayerPropertiesForTesting(root.get(), | 1680 SetLayerPropertiesForTesting(root.get(), |
| 1681 identity_matrix, | 1681 identity_matrix, |
| 1682 gfx::Point3F(), | 1682 gfx::Point3F(), |
| 1683 gfx::PointF(), | 1683 gfx::PointF(), |
| 1684 gfx::Size(100, 100), | 1684 gfx::Size(100, 100), |
| 1685 true, | 1685 true, |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1823 scoped_refptr<Layer> grand_child2 = Layer::Create(); | 1823 scoped_refptr<Layer> grand_child2 = Layer::Create(); |
| 1824 scoped_refptr<Layer> grand_child3 = Layer::Create(); | 1824 scoped_refptr<Layer> grand_child3 = Layer::Create(); |
| 1825 scoped_refptr<Layer> grand_child4 = Layer::Create(); | 1825 scoped_refptr<Layer> grand_child4 = Layer::Create(); |
| 1826 | 1826 |
| 1827 parent->AddChild(child); | 1827 parent->AddChild(child); |
| 1828 child->AddChild(grand_child1); | 1828 child->AddChild(grand_child1); |
| 1829 child->AddChild(grand_child2); | 1829 child->AddChild(grand_child2); |
| 1830 child->AddChild(grand_child3); | 1830 child->AddChild(grand_child3); |
| 1831 child->AddChild(grand_child4); | 1831 child->AddChild(grand_child4); |
| 1832 | 1832 |
| 1833 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 1833 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 1834 host->SetRootLayer(parent); | 1834 host->SetRootLayer(parent); |
| 1835 | 1835 |
| 1836 SetLayerPropertiesForTesting(parent.get(), | 1836 SetLayerPropertiesForTesting(parent.get(), |
| 1837 identity_matrix, | 1837 identity_matrix, |
| 1838 gfx::Point3F(), | 1838 gfx::Point3F(), |
| 1839 gfx::PointF(), | 1839 gfx::PointF(), |
| 1840 gfx::Size(500, 500), | 1840 gfx::Size(500, 500), |
| 1841 true, | 1841 true, |
| 1842 false); | 1842 false); |
| 1843 SetLayerPropertiesForTesting(child.get(), | 1843 SetLayerPropertiesForTesting(child.get(), |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1924 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 1924 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 1925 scoped_refptr<LayerWithForcedDrawsContent> leaf_node4 = | 1925 scoped_refptr<LayerWithForcedDrawsContent> leaf_node4 = |
| 1926 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 1926 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 1927 | 1927 |
| 1928 parent->AddChild(child); | 1928 parent->AddChild(child); |
| 1929 child->AddChild(grand_child1); | 1929 child->AddChild(grand_child1); |
| 1930 child->AddChild(grand_child2); | 1930 child->AddChild(grand_child2); |
| 1931 child->AddChild(grand_child3); | 1931 child->AddChild(grand_child3); |
| 1932 child->AddChild(grand_child4); | 1932 child->AddChild(grand_child4); |
| 1933 | 1933 |
| 1934 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 1934 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 1935 host->SetRootLayer(parent); | 1935 host->SetRootLayer(parent); |
| 1936 | 1936 |
| 1937 // the leaf nodes ensure that these grand_children become render surfaces for | 1937 // the leaf nodes ensure that these grand_children become render surfaces for |
| 1938 // this test. | 1938 // this test. |
| 1939 grand_child1->AddChild(leaf_node1); | 1939 grand_child1->AddChild(leaf_node1); |
| 1940 grand_child2->AddChild(leaf_node2); | 1940 grand_child2->AddChild(leaf_node2); |
| 1941 grand_child3->AddChild(leaf_node3); | 1941 grand_child3->AddChild(leaf_node3); |
| 1942 grand_child4->AddChild(leaf_node4); | 1942 grand_child4->AddChild(leaf_node4); |
| 1943 | 1943 |
| 1944 SetLayerPropertiesForTesting(parent.get(), | 1944 SetLayerPropertiesForTesting(parent.get(), |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2061 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2061 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 2062 parent->AddChild(render_surface1); | 2062 parent->AddChild(render_surface1); |
| 2063 parent->AddChild(child_of_root); | 2063 parent->AddChild(child_of_root); |
| 2064 render_surface1->AddChild(child_of_rs1); | 2064 render_surface1->AddChild(child_of_rs1); |
| 2065 render_surface1->AddChild(render_surface2); | 2065 render_surface1->AddChild(render_surface2); |
| 2066 render_surface2->AddChild(child_of_rs2); | 2066 render_surface2->AddChild(child_of_rs2); |
| 2067 child_of_root->AddChild(grand_child_of_root); | 2067 child_of_root->AddChild(grand_child_of_root); |
| 2068 child_of_rs1->AddChild(grand_child_of_rs1); | 2068 child_of_rs1->AddChild(grand_child_of_rs1); |
| 2069 child_of_rs2->AddChild(grand_child_of_rs2); | 2069 child_of_rs2->AddChild(grand_child_of_rs2); |
| 2070 | 2070 |
| 2071 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 2071 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 2072 host->SetRootLayer(parent); | 2072 host->SetRootLayer(parent); |
| 2073 | 2073 |
| 2074 // Make our render surfaces. | 2074 // Make our render surfaces. |
| 2075 render_surface1->SetForceRenderSurface(true); | 2075 render_surface1->SetForceRenderSurface(true); |
| 2076 render_surface2->SetForceRenderSurface(true); | 2076 render_surface2->SetForceRenderSurface(true); |
| 2077 | 2077 |
| 2078 gfx::Transform layer_transform; | 2078 gfx::Transform layer_transform; |
| 2079 layer_transform.Translate(1.0, 1.0); | 2079 layer_transform.Translate(1.0, 1.0); |
| 2080 | 2080 |
| 2081 SetLayerPropertiesForTesting(parent.get(), | 2081 SetLayerPropertiesForTesting(parent.get(), |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2549 scoped_refptr<LayerWithForcedDrawsContent> child1 = | 2549 scoped_refptr<LayerWithForcedDrawsContent> child1 = |
| 2550 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2550 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 2551 scoped_refptr<LayerWithForcedDrawsContent> child2 = | 2551 scoped_refptr<LayerWithForcedDrawsContent> child2 = |
| 2552 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2552 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 2553 scoped_refptr<LayerWithForcedDrawsContent> child3 = | 2553 scoped_refptr<LayerWithForcedDrawsContent> child3 = |
| 2554 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2554 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 2555 root->AddChild(child1); | 2555 root->AddChild(child1); |
| 2556 root->AddChild(child2); | 2556 root->AddChild(child2); |
| 2557 root->AddChild(child3); | 2557 root->AddChild(child3); |
| 2558 | 2558 |
| 2559 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 2559 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 2560 host->SetRootLayer(root); | 2560 host->SetRootLayer(root); |
| 2561 | 2561 |
| 2562 gfx::Transform identity_matrix; | 2562 gfx::Transform identity_matrix; |
| 2563 SetLayerPropertiesForTesting(root.get(), | 2563 SetLayerPropertiesForTesting(root.get(), |
| 2564 identity_matrix, | 2564 identity_matrix, |
| 2565 gfx::Point3F(), | 2565 gfx::Point3F(), |
| 2566 gfx::PointF(), | 2566 gfx::PointF(), |
| 2567 gfx::Size(100, 100), | 2567 gfx::Size(100, 100), |
| 2568 true, | 2568 true, |
| 2569 false); | 2569 false); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2617 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2617 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 2618 scoped_refptr<LayerWithForcedDrawsContent> grand_child2 = | 2618 scoped_refptr<LayerWithForcedDrawsContent> grand_child2 = |
| 2619 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2619 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 2620 scoped_refptr<LayerWithForcedDrawsContent> grand_child3 = | 2620 scoped_refptr<LayerWithForcedDrawsContent> grand_child3 = |
| 2621 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2621 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 2622 root->AddChild(child); | 2622 root->AddChild(child); |
| 2623 child->AddChild(grand_child1); | 2623 child->AddChild(grand_child1); |
| 2624 child->AddChild(grand_child2); | 2624 child->AddChild(grand_child2); |
| 2625 child->AddChild(grand_child3); | 2625 child->AddChild(grand_child3); |
| 2626 | 2626 |
| 2627 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 2627 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 2628 host->SetRootLayer(root); | 2628 host->SetRootLayer(root); |
| 2629 | 2629 |
| 2630 gfx::Transform identity_matrix; | 2630 gfx::Transform identity_matrix; |
| 2631 SetLayerPropertiesForTesting(root.get(), | 2631 SetLayerPropertiesForTesting(root.get(), |
| 2632 identity_matrix, | 2632 identity_matrix, |
| 2633 gfx::Point3F(), | 2633 gfx::Point3F(), |
| 2634 gfx::PointF(), | 2634 gfx::PointF(), |
| 2635 gfx::Size(100, 100), | 2635 gfx::Size(100, 100), |
| 2636 true, | 2636 true, |
| 2637 false); | 2637 false); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2698 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2698 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 2699 scoped_refptr<LayerWithForcedDrawsContent> child2 = | 2699 scoped_refptr<LayerWithForcedDrawsContent> child2 = |
| 2700 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2700 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 2701 scoped_refptr<LayerWithForcedDrawsContent> child3 = | 2701 scoped_refptr<LayerWithForcedDrawsContent> child3 = |
| 2702 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2702 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 2703 root->AddChild(render_surface1); | 2703 root->AddChild(render_surface1); |
| 2704 render_surface1->AddChild(child1); | 2704 render_surface1->AddChild(child1); |
| 2705 render_surface1->AddChild(child2); | 2705 render_surface1->AddChild(child2); |
| 2706 render_surface1->AddChild(child3); | 2706 render_surface1->AddChild(child3); |
| 2707 | 2707 |
| 2708 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 2708 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 2709 host->SetRootLayer(root); | 2709 host->SetRootLayer(root); |
| 2710 | 2710 |
| 2711 gfx::Transform identity_matrix; | 2711 gfx::Transform identity_matrix; |
| 2712 SetLayerPropertiesForTesting(root.get(), | 2712 SetLayerPropertiesForTesting(root.get(), |
| 2713 identity_matrix, | 2713 identity_matrix, |
| 2714 gfx::Point3F(), | 2714 gfx::Point3F(), |
| 2715 gfx::PointF(), | 2715 gfx::PointF(), |
| 2716 gfx::Size(100, 100), | 2716 gfx::Size(100, 100), |
| 2717 true, | 2717 true, |
| 2718 false); | 2718 false); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2774 EXPECT_RECT_EQ(gfx::Rect(125, 125, 50, 50), child3->drawable_content_rect()); | 2774 EXPECT_RECT_EQ(gfx::Rect(125, 125, 50, 50), child3->drawable_content_rect()); |
| 2775 } | 2775 } |
| 2776 | 2776 |
| 2777 TEST_F(LayerTreeHostCommonTest, | 2777 TEST_F(LayerTreeHostCommonTest, |
| 2778 DrawableAndVisibleContentRectsForLayersWithUninvertibleTransform) { | 2778 DrawableAndVisibleContentRectsForLayersWithUninvertibleTransform) { |
| 2779 scoped_refptr<Layer> root = Layer::Create(); | 2779 scoped_refptr<Layer> root = Layer::Create(); |
| 2780 scoped_refptr<LayerWithForcedDrawsContent> child = | 2780 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 2781 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2781 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 2782 root->AddChild(child); | 2782 root->AddChild(child); |
| 2783 | 2783 |
| 2784 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 2784 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 2785 host->SetRootLayer(root); | 2785 host->SetRootLayer(root); |
| 2786 | 2786 |
| 2787 // Case 1: a truly degenerate matrix | 2787 // Case 1: a truly degenerate matrix |
| 2788 gfx::Transform identity_matrix; | 2788 gfx::Transform identity_matrix; |
| 2789 gfx::Transform uninvertible_matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); | 2789 gfx::Transform uninvertible_matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); |
| 2790 ASSERT_FALSE(uninvertible_matrix.IsInvertible()); | 2790 ASSERT_FALSE(uninvertible_matrix.IsInvertible()); |
| 2791 | 2791 |
| 2792 SetLayerPropertiesForTesting(root.get(), | 2792 SetLayerPropertiesForTesting(root.get(), |
| 2793 identity_matrix, | 2793 identity_matrix, |
| 2794 gfx::Point3F(), | 2794 gfx::Point3F(), |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2848 EXPECT_TRUE(child->drawable_content_rect().IsEmpty()); | 2848 EXPECT_TRUE(child->drawable_content_rect().IsEmpty()); |
| 2849 } | 2849 } |
| 2850 | 2850 |
| 2851 TEST_F(LayerTreeHostCommonTest, | 2851 TEST_F(LayerTreeHostCommonTest, |
| 2852 SingularTransformDoesNotPreventClearingDrawProperties) { | 2852 SingularTransformDoesNotPreventClearingDrawProperties) { |
| 2853 scoped_refptr<Layer> root = Layer::Create(); | 2853 scoped_refptr<Layer> root = Layer::Create(); |
| 2854 scoped_refptr<LayerWithForcedDrawsContent> child = | 2854 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 2855 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2855 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 2856 root->AddChild(child); | 2856 root->AddChild(child); |
| 2857 | 2857 |
| 2858 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 2858 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 2859 host->SetRootLayer(root); | 2859 host->SetRootLayer(root); |
| 2860 | 2860 |
| 2861 gfx::Transform identity_matrix; | 2861 gfx::Transform identity_matrix; |
| 2862 gfx::Transform uninvertible_matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); | 2862 gfx::Transform uninvertible_matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); |
| 2863 ASSERT_FALSE(uninvertible_matrix.IsInvertible()); | 2863 ASSERT_FALSE(uninvertible_matrix.IsInvertible()); |
| 2864 | 2864 |
| 2865 SetLayerPropertiesForTesting(root.get(), | 2865 SetLayerPropertiesForTesting(root.get(), |
| 2866 uninvertible_matrix, | 2866 uninvertible_matrix, |
| 2867 gfx::Point3F(), | 2867 gfx::Point3F(), |
| 2868 gfx::PointF(), | 2868 gfx::PointF(), |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2892 | 2892 |
| 2893 ExecuteCalculateDrawProperties(root.get()); | 2893 ExecuteCalculateDrawProperties(root.get()); |
| 2894 | 2894 |
| 2895 EXPECT_FALSE(child->draw_properties().sorted_for_recursion); | 2895 EXPECT_FALSE(child->draw_properties().sorted_for_recursion); |
| 2896 } | 2896 } |
| 2897 | 2897 |
| 2898 TEST_F(LayerTreeHostCommonTest, | 2898 TEST_F(LayerTreeHostCommonTest, |
| 2899 SingularNonAnimatingTransformDoesNotPreventClearingDrawProperties) { | 2899 SingularNonAnimatingTransformDoesNotPreventClearingDrawProperties) { |
| 2900 scoped_refptr<Layer> root = Layer::Create(); | 2900 scoped_refptr<Layer> root = Layer::Create(); |
| 2901 | 2901 |
| 2902 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 2902 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 2903 host->SetRootLayer(root); | 2903 host->SetRootLayer(root); |
| 2904 | 2904 |
| 2905 gfx::Transform identity_matrix; | 2905 gfx::Transform identity_matrix; |
| 2906 gfx::Transform uninvertible_matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); | 2906 gfx::Transform uninvertible_matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); |
| 2907 ASSERT_FALSE(uninvertible_matrix.IsInvertible()); | 2907 ASSERT_FALSE(uninvertible_matrix.IsInvertible()); |
| 2908 | 2908 |
| 2909 SetLayerPropertiesForTesting(root.get(), | 2909 SetLayerPropertiesForTesting(root.get(), |
| 2910 uninvertible_matrix, | 2910 uninvertible_matrix, |
| 2911 gfx::Point3F(), | 2911 gfx::Point3F(), |
| 2912 gfx::PointF(), | 2912 gfx::PointF(), |
| (...skipping 18 matching lines...) Expand all Loading... |
| 2931 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2931 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 2932 scoped_refptr<LayerWithForcedDrawsContent> child2 = | 2932 scoped_refptr<LayerWithForcedDrawsContent> child2 = |
| 2933 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2933 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 2934 scoped_refptr<LayerWithForcedDrawsContent> child3 = | 2934 scoped_refptr<LayerWithForcedDrawsContent> child3 = |
| 2935 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2935 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 2936 root->AddChild(render_surface1); | 2936 root->AddChild(render_surface1); |
| 2937 render_surface1->AddChild(child1); | 2937 render_surface1->AddChild(child1); |
| 2938 render_surface1->AddChild(child2); | 2938 render_surface1->AddChild(child2); |
| 2939 render_surface1->AddChild(child3); | 2939 render_surface1->AddChild(child3); |
| 2940 | 2940 |
| 2941 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 2941 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 2942 host->SetRootLayer(root); | 2942 host->SetRootLayer(root); |
| 2943 | 2943 |
| 2944 gfx::Transform identity_matrix; | 2944 gfx::Transform identity_matrix; |
| 2945 SetLayerPropertiesForTesting(root.get(), | 2945 SetLayerPropertiesForTesting(root.get(), |
| 2946 identity_matrix, | 2946 identity_matrix, |
| 2947 gfx::Point3F(), | 2947 gfx::Point3F(), |
| 2948 gfx::PointF(), | 2948 gfx::PointF(), |
| 2949 gfx::Size(100, 100), | 2949 gfx::Size(100, 100), |
| 2950 true, | 2950 true, |
| 2951 false); | 2951 false); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3021 scoped_refptr<LayerWithForcedDrawsContent> child2 = | 3021 scoped_refptr<LayerWithForcedDrawsContent> child2 = |
| 3022 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3022 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 3023 scoped_refptr<LayerWithForcedDrawsContent> child3 = | 3023 scoped_refptr<LayerWithForcedDrawsContent> child3 = |
| 3024 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3024 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 3025 root->AddChild(render_surface1); | 3025 root->AddChild(render_surface1); |
| 3026 render_surface1->AddChild(render_surface2); | 3026 render_surface1->AddChild(render_surface2); |
| 3027 render_surface2->AddChild(child1); | 3027 render_surface2->AddChild(child1); |
| 3028 render_surface2->AddChild(child2); | 3028 render_surface2->AddChild(child2); |
| 3029 render_surface2->AddChild(child3); | 3029 render_surface2->AddChild(child3); |
| 3030 | 3030 |
| 3031 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 3031 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 3032 host->SetRootLayer(root); | 3032 host->SetRootLayer(root); |
| 3033 | 3033 |
| 3034 gfx::Transform identity_matrix; | 3034 gfx::Transform identity_matrix; |
| 3035 SetLayerPropertiesForTesting(root.get(), | 3035 SetLayerPropertiesForTesting(root.get(), |
| 3036 identity_matrix, | 3036 identity_matrix, |
| 3037 gfx::Point3F(), | 3037 gfx::Point3F(), |
| 3038 gfx::PointF(), | 3038 gfx::PointF(), |
| 3039 gfx::Size(100, 100), | 3039 gfx::Size(100, 100), |
| 3040 true, | 3040 true, |
| 3041 false); | 3041 false); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3121 // Layers that have non-axis aligned bounds (due to transforms) have an | 3121 // Layers that have non-axis aligned bounds (due to transforms) have an |
| 3122 // expanded, axis-aligned DrawableContentRect and visible content rect. | 3122 // expanded, axis-aligned DrawableContentRect and visible content rect. |
| 3123 | 3123 |
| 3124 scoped_refptr<Layer> root = Layer::Create(); | 3124 scoped_refptr<Layer> root = Layer::Create(); |
| 3125 scoped_refptr<Layer> render_surface1 = Layer::Create(); | 3125 scoped_refptr<Layer> render_surface1 = Layer::Create(); |
| 3126 scoped_refptr<LayerWithForcedDrawsContent> child1 = | 3126 scoped_refptr<LayerWithForcedDrawsContent> child1 = |
| 3127 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3127 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 3128 root->AddChild(render_surface1); | 3128 root->AddChild(render_surface1); |
| 3129 render_surface1->AddChild(child1); | 3129 render_surface1->AddChild(child1); |
| 3130 | 3130 |
| 3131 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 3131 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 3132 host->SetRootLayer(root); | 3132 host->SetRootLayer(root); |
| 3133 | 3133 |
| 3134 gfx::Transform identity_matrix; | 3134 gfx::Transform identity_matrix; |
| 3135 gfx::Transform child_rotation; | 3135 gfx::Transform child_rotation; |
| 3136 child_rotation.Rotate(45.0); | 3136 child_rotation.Rotate(45.0); |
| 3137 SetLayerPropertiesForTesting(root.get(), | 3137 SetLayerPropertiesForTesting(root.get(), |
| 3138 identity_matrix, | 3138 identity_matrix, |
| 3139 gfx::Point3F(), | 3139 gfx::Point3F(), |
| 3140 gfx::PointF(), | 3140 gfx::PointF(), |
| 3141 gfx::Size(100, 100), | 3141 gfx::Size(100, 100), |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3192 // Layers that have non-axis aligned bounds (due to transforms) have an | 3192 // Layers that have non-axis aligned bounds (due to transforms) have an |
| 3193 // expanded, axis-aligned DrawableContentRect and visible content rect. | 3193 // expanded, axis-aligned DrawableContentRect and visible content rect. |
| 3194 | 3194 |
| 3195 scoped_refptr<Layer> root = Layer::Create(); | 3195 scoped_refptr<Layer> root = Layer::Create(); |
| 3196 scoped_refptr<Layer> render_surface1 = Layer::Create(); | 3196 scoped_refptr<Layer> render_surface1 = Layer::Create(); |
| 3197 scoped_refptr<LayerWithForcedDrawsContent> child1 = | 3197 scoped_refptr<LayerWithForcedDrawsContent> child1 = |
| 3198 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3198 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 3199 root->AddChild(render_surface1); | 3199 root->AddChild(render_surface1); |
| 3200 render_surface1->AddChild(child1); | 3200 render_surface1->AddChild(child1); |
| 3201 | 3201 |
| 3202 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 3202 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 3203 host->SetRootLayer(root); | 3203 host->SetRootLayer(root); |
| 3204 | 3204 |
| 3205 gfx::Transform identity_matrix; | 3205 gfx::Transform identity_matrix; |
| 3206 gfx::Transform child_rotation; | 3206 gfx::Transform child_rotation; |
| 3207 child_rotation.Rotate(45.0); | 3207 child_rotation.Rotate(45.0); |
| 3208 SetLayerPropertiesForTesting(root.get(), | 3208 SetLayerPropertiesForTesting(root.get(), |
| 3209 identity_matrix, | 3209 identity_matrix, |
| 3210 gfx::Point3F(), | 3210 gfx::Point3F(), |
| 3211 gfx::PointF(), | 3211 gfx::PointF(), |
| 3212 gfx::Size(50, 50), | 3212 gfx::Size(50, 50), |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3267 CreateDrawableContentLayer(&client); | 3267 CreateDrawableContentLayer(&client); |
| 3268 scoped_refptr<ContentLayer> child1 = CreateDrawableContentLayer(&client); | 3268 scoped_refptr<ContentLayer> child1 = CreateDrawableContentLayer(&client); |
| 3269 scoped_refptr<ContentLayer> child2 = CreateDrawableContentLayer(&client); | 3269 scoped_refptr<ContentLayer> child2 = CreateDrawableContentLayer(&client); |
| 3270 scoped_refptr<ContentLayer> child3 = CreateDrawableContentLayer(&client); | 3270 scoped_refptr<ContentLayer> child3 = CreateDrawableContentLayer(&client); |
| 3271 root->AddChild(render_surface1); | 3271 root->AddChild(render_surface1); |
| 3272 render_surface1->AddChild(render_surface2); | 3272 render_surface1->AddChild(render_surface2); |
| 3273 render_surface2->AddChild(child1); | 3273 render_surface2->AddChild(child1); |
| 3274 render_surface2->AddChild(child2); | 3274 render_surface2->AddChild(child2); |
| 3275 render_surface2->AddChild(child3); | 3275 render_surface2->AddChild(child3); |
| 3276 | 3276 |
| 3277 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 3277 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 3278 host->SetRootLayer(root); | 3278 host->SetRootLayer(root); |
| 3279 | 3279 |
| 3280 gfx::Transform identity_matrix; | 3280 gfx::Transform identity_matrix; |
| 3281 SetLayerPropertiesForTesting(root.get(), | 3281 SetLayerPropertiesForTesting(root.get(), |
| 3282 identity_matrix, | 3282 identity_matrix, |
| 3283 gfx::Point3F(), | 3283 gfx::Point3F(), |
| 3284 gfx::PointF(), | 3284 gfx::PointF(), |
| 3285 gfx::Size(100, 100), | 3285 gfx::Size(100, 100), |
| 3286 true, | 3286 true, |
| 3287 false); | 3287 false); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3394 | 3394 |
| 3395 parent->AddChild(front_facing_child); | 3395 parent->AddChild(front_facing_child); |
| 3396 parent->AddChild(back_facing_child); | 3396 parent->AddChild(back_facing_child); |
| 3397 parent->AddChild(front_facing_surface); | 3397 parent->AddChild(front_facing_surface); |
| 3398 parent->AddChild(back_facing_surface); | 3398 parent->AddChild(back_facing_surface); |
| 3399 front_facing_surface->AddChild(front_facing_child_of_front_facing_surface); | 3399 front_facing_surface->AddChild(front_facing_child_of_front_facing_surface); |
| 3400 front_facing_surface->AddChild(back_facing_child_of_front_facing_surface); | 3400 front_facing_surface->AddChild(back_facing_child_of_front_facing_surface); |
| 3401 back_facing_surface->AddChild(front_facing_child_of_back_facing_surface); | 3401 back_facing_surface->AddChild(front_facing_child_of_back_facing_surface); |
| 3402 back_facing_surface->AddChild(back_facing_child_of_back_facing_surface); | 3402 back_facing_surface->AddChild(back_facing_child_of_back_facing_surface); |
| 3403 | 3403 |
| 3404 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 3404 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 3405 host->SetRootLayer(parent); | 3405 host->SetRootLayer(parent); |
| 3406 | 3406 |
| 3407 // Nothing is double-sided | 3407 // Nothing is double-sided |
| 3408 front_facing_child->SetDoubleSided(false); | 3408 front_facing_child->SetDoubleSided(false); |
| 3409 back_facing_child->SetDoubleSided(false); | 3409 back_facing_child->SetDoubleSided(false); |
| 3410 front_facing_surface->SetDoubleSided(false); | 3410 front_facing_surface->SetDoubleSided(false); |
| 3411 back_facing_surface->SetDoubleSided(false); | 3411 back_facing_surface->SetDoubleSided(false); |
| 3412 front_facing_child_of_front_facing_surface->SetDoubleSided(false); | 3412 front_facing_child_of_front_facing_surface->SetDoubleSided(false); |
| 3413 back_facing_child_of_front_facing_surface->SetDoubleSided(false); | 3413 back_facing_child_of_front_facing_surface->SetDoubleSided(false); |
| 3414 front_facing_child_of_back_facing_surface->SetDoubleSided(false); | 3414 front_facing_child_of_back_facing_surface->SetDoubleSided(false); |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3600 | 3600 |
| 3601 parent->AddChild(front_facing_child); | 3601 parent->AddChild(front_facing_child); |
| 3602 parent->AddChild(back_facing_child); | 3602 parent->AddChild(back_facing_child); |
| 3603 parent->AddChild(front_facing_surface); | 3603 parent->AddChild(front_facing_surface); |
| 3604 parent->AddChild(back_facing_surface); | 3604 parent->AddChild(back_facing_surface); |
| 3605 front_facing_surface->AddChild(front_facing_child_of_front_facing_surface); | 3605 front_facing_surface->AddChild(front_facing_child_of_front_facing_surface); |
| 3606 front_facing_surface->AddChild(back_facing_child_of_front_facing_surface); | 3606 front_facing_surface->AddChild(back_facing_child_of_front_facing_surface); |
| 3607 back_facing_surface->AddChild(front_facing_child_of_back_facing_surface); | 3607 back_facing_surface->AddChild(front_facing_child_of_back_facing_surface); |
| 3608 back_facing_surface->AddChild(back_facing_child_of_back_facing_surface); | 3608 back_facing_surface->AddChild(back_facing_child_of_back_facing_surface); |
| 3609 | 3609 |
| 3610 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 3610 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 3611 host->SetRootLayer(parent); | 3611 host->SetRootLayer(parent); |
| 3612 | 3612 |
| 3613 // Nothing is double-sided | 3613 // Nothing is double-sided |
| 3614 front_facing_child->SetDoubleSided(false); | 3614 front_facing_child->SetDoubleSided(false); |
| 3615 back_facing_child->SetDoubleSided(false); | 3615 back_facing_child->SetDoubleSided(false); |
| 3616 front_facing_surface->SetDoubleSided(false); | 3616 front_facing_surface->SetDoubleSided(false); |
| 3617 back_facing_surface->SetDoubleSided(false); | 3617 back_facing_surface->SetDoubleSided(false); |
| 3618 front_facing_child_of_front_facing_surface->SetDoubleSided(false); | 3618 front_facing_child_of_front_facing_surface->SetDoubleSided(false); |
| 3619 back_facing_child_of_front_facing_surface->SetDoubleSided(false); | 3619 back_facing_child_of_front_facing_surface->SetDoubleSided(false); |
| 3620 front_facing_child_of_back_facing_surface->SetDoubleSided(false); | 3620 front_facing_child_of_back_facing_surface->SetDoubleSided(false); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3766 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3766 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 3767 scoped_refptr<LayerWithForcedDrawsContent> child2 = | 3767 scoped_refptr<LayerWithForcedDrawsContent> child2 = |
| 3768 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3768 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 3769 | 3769 |
| 3770 parent->AddChild(child); | 3770 parent->AddChild(child); |
| 3771 parent->AddChild(animating_surface); | 3771 parent->AddChild(animating_surface); |
| 3772 animating_surface->AddChild(child_of_animating_surface); | 3772 animating_surface->AddChild(child_of_animating_surface); |
| 3773 parent->AddChild(animating_child); | 3773 parent->AddChild(animating_child); |
| 3774 parent->AddChild(child2); | 3774 parent->AddChild(child2); |
| 3775 | 3775 |
| 3776 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 3776 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 3777 host->SetRootLayer(parent); | 3777 host->SetRootLayer(parent); |
| 3778 | 3778 |
| 3779 // Nothing is double-sided | 3779 // Nothing is double-sided |
| 3780 child->SetDoubleSided(false); | 3780 child->SetDoubleSided(false); |
| 3781 child2->SetDoubleSided(false); | 3781 child2->SetDoubleSided(false); |
| 3782 animating_surface->SetDoubleSided(false); | 3782 animating_surface->SetDoubleSided(false); |
| 3783 child_of_animating_surface->SetDoubleSided(false); | 3783 child_of_animating_surface->SetDoubleSided(false); |
| 3784 animating_child->SetDoubleSided(false); | 3784 animating_child->SetDoubleSided(false); |
| 3785 | 3785 |
| 3786 gfx::Transform backface_matrix; | 3786 gfx::Transform backface_matrix; |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3912 scoped_refptr<LayerWithForcedDrawsContent> child1 = | 3912 scoped_refptr<LayerWithForcedDrawsContent> child1 = |
| 3913 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3913 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 3914 scoped_refptr<LayerWithForcedDrawsContent> child2 = | 3914 scoped_refptr<LayerWithForcedDrawsContent> child2 = |
| 3915 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3915 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 3916 | 3916 |
| 3917 parent->AddChild(front_facing_surface); | 3917 parent->AddChild(front_facing_surface); |
| 3918 parent->AddChild(back_facing_surface); | 3918 parent->AddChild(back_facing_surface); |
| 3919 front_facing_surface->AddChild(child1); | 3919 front_facing_surface->AddChild(child1); |
| 3920 back_facing_surface->AddChild(child2); | 3920 back_facing_surface->AddChild(child2); |
| 3921 | 3921 |
| 3922 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 3922 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 3923 host->SetRootLayer(parent); | 3923 host->SetRootLayer(parent); |
| 3924 | 3924 |
| 3925 // RenderSurfaces are not double-sided | 3925 // RenderSurfaces are not double-sided |
| 3926 front_facing_surface->SetDoubleSided(false); | 3926 front_facing_surface->SetDoubleSided(false); |
| 3927 back_facing_surface->SetDoubleSided(false); | 3927 back_facing_surface->SetDoubleSided(false); |
| 3928 | 3928 |
| 3929 gfx::Transform backface_matrix; | 3929 gfx::Transform backface_matrix; |
| 3930 backface_matrix.Translate(50.0, 50.0); | 3930 backface_matrix.Translate(50.0, 50.0); |
| 3931 backface_matrix.RotateAboutYAxis(180.0); | 3931 backface_matrix.RotateAboutYAxis(180.0); |
| 3932 backface_matrix.Translate(-50.0, -50.0); | 3932 backface_matrix.Translate(-50.0, -50.0); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4080 gfx::Point3F(), | 4080 gfx::Point3F(), |
| 4081 gfx::PointF(2.f, 2.f), | 4081 gfx::PointF(2.f, 2.f), |
| 4082 gfx::Size(10, 10), | 4082 gfx::Size(10, 10), |
| 4083 false, | 4083 false, |
| 4084 true); | 4084 true); |
| 4085 | 4085 |
| 4086 parent->AddChild(child); | 4086 parent->AddChild(child); |
| 4087 parent->AddChild(child_empty); | 4087 parent->AddChild(child_empty); |
| 4088 parent->AddChild(child_no_scale); | 4088 parent->AddChild(child_no_scale); |
| 4089 | 4089 |
| 4090 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 4090 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 4091 host->SetRootLayer(parent); | 4091 host->SetRootLayer(parent); |
| 4092 | 4092 |
| 4093 float device_scale_factor = 2.5f; | 4093 float device_scale_factor = 2.5f; |
| 4094 float page_scale_factor = 1.f; | 4094 float page_scale_factor = 1.f; |
| 4095 | 4095 |
| 4096 RenderSurfaceLayerList render_surface_layer_list; | 4096 RenderSurfaceLayerList render_surface_layer_list; |
| 4097 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 4097 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
| 4098 parent.get(), parent->bounds(), &render_surface_layer_list); | 4098 parent.get(), parent->bounds(), &render_surface_layer_list); |
| 4099 inputs.device_scale_factor = device_scale_factor; | 4099 inputs.device_scale_factor = device_scale_factor; |
| 4100 inputs.page_scale_factor = page_scale_factor; | 4100 inputs.page_scale_factor = page_scale_factor; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4218 false, | 4218 false, |
| 4219 true); | 4219 true); |
| 4220 | 4220 |
| 4221 perspective_surface->SetForceRenderSurface(true); | 4221 perspective_surface->SetForceRenderSurface(true); |
| 4222 scale_surface->SetForceRenderSurface(true); | 4222 scale_surface->SetForceRenderSurface(true); |
| 4223 | 4223 |
| 4224 parent->AddChild(perspective_surface); | 4224 parent->AddChild(perspective_surface); |
| 4225 parent->AddChild(scale_surface); | 4225 parent->AddChild(scale_surface); |
| 4226 root->AddChild(parent); | 4226 root->AddChild(parent); |
| 4227 | 4227 |
| 4228 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 4228 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 4229 host->SetRootLayer(root); | 4229 host->SetRootLayer(root); |
| 4230 | 4230 |
| 4231 float device_scale_factor = 2.5f; | 4231 float device_scale_factor = 2.5f; |
| 4232 float page_scale_factor = 3.f; | 4232 float page_scale_factor = 3.f; |
| 4233 | 4233 |
| 4234 RenderSurfaceLayerList render_surface_layer_list; | 4234 RenderSurfaceLayerList render_surface_layer_list; |
| 4235 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 4235 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
| 4236 root.get(), parent->bounds(), &render_surface_layer_list); | 4236 root.get(), parent->bounds(), &render_surface_layer_list); |
| 4237 inputs.device_scale_factor = device_scale_factor; | 4237 inputs.device_scale_factor = device_scale_factor; |
| 4238 inputs.page_scale_factor = page_scale_factor; | 4238 inputs.page_scale_factor = page_scale_factor; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4317 identity_matrix, | 4317 identity_matrix, |
| 4318 gfx::Point3F(), | 4318 gfx::Point3F(), |
| 4319 gfx::PointF(), | 4319 gfx::PointF(), |
| 4320 gfx::Size(13, 13), | 4320 gfx::Size(13, 13), |
| 4321 false, | 4321 false, |
| 4322 true); | 4322 true); |
| 4323 | 4323 |
| 4324 parent->AddChild(child); | 4324 parent->AddChild(child); |
| 4325 parent->AddChild(child_no_scale); | 4325 parent->AddChild(child_no_scale); |
| 4326 | 4326 |
| 4327 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 4327 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 4328 host->SetRootLayer(parent); | 4328 host->SetRootLayer(parent); |
| 4329 | 4329 |
| 4330 float device_scale_factor = 1.7f; | 4330 float device_scale_factor = 1.7f; |
| 4331 float page_scale_factor = 1.f; | 4331 float page_scale_factor = 1.f; |
| 4332 | 4332 |
| 4333 RenderSurfaceLayerList render_surface_layer_list; | 4333 RenderSurfaceLayerList render_surface_layer_list; |
| 4334 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 4334 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
| 4335 parent.get(), parent->bounds(), &render_surface_layer_list); | 4335 parent.get(), parent->bounds(), &render_surface_layer_list); |
| 4336 inputs.device_scale_factor = device_scale_factor; | 4336 inputs.device_scale_factor = device_scale_factor; |
| 4337 inputs.page_scale_factor = page_scale_factor; | 4337 inputs.page_scale_factor = page_scale_factor; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4455 gfx::Size(10, 10), | 4455 gfx::Size(10, 10), |
| 4456 false, | 4456 false, |
| 4457 true); | 4457 true); |
| 4458 | 4458 |
| 4459 root->AddChild(parent); | 4459 root->AddChild(parent); |
| 4460 | 4460 |
| 4461 parent->AddChild(child_scale); | 4461 parent->AddChild(child_scale); |
| 4462 parent->AddChild(child_empty); | 4462 parent->AddChild(child_empty); |
| 4463 parent->AddChild(child_no_scale); | 4463 parent->AddChild(child_no_scale); |
| 4464 | 4464 |
| 4465 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 4465 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 4466 host->SetRootLayer(root); | 4466 host->SetRootLayer(root); |
| 4467 | 4467 |
| 4468 float device_scale_factor = 2.5f; | 4468 float device_scale_factor = 2.5f; |
| 4469 float page_scale_factor = 1.f; | 4469 float page_scale_factor = 1.f; |
| 4470 | 4470 |
| 4471 { | 4471 { |
| 4472 RenderSurfaceLayerList render_surface_layer_list; | 4472 RenderSurfaceLayerList render_surface_layer_list; |
| 4473 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 4473 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
| 4474 root.get(), root->bounds(), &render_surface_layer_list); | 4474 root.get(), root->bounds(), &render_surface_layer_list); |
| 4475 inputs.device_scale_factor = device_scale_factor; | 4475 inputs.device_scale_factor = device_scale_factor; |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4639 gfx::Size(10, 10), | 4639 gfx::Size(10, 10), |
| 4640 false, | 4640 false, |
| 4641 true); | 4641 true); |
| 4642 | 4642 |
| 4643 root->AddChild(parent); | 4643 root->AddChild(parent); |
| 4644 | 4644 |
| 4645 parent->AddChild(child_scale); | 4645 parent->AddChild(child_scale); |
| 4646 parent->AddChild(child_empty); | 4646 parent->AddChild(child_empty); |
| 4647 parent->AddChild(child_no_scale); | 4647 parent->AddChild(child_no_scale); |
| 4648 | 4648 |
| 4649 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 4649 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 4650 host->SetRootLayer(root); | 4650 host->SetRootLayer(root); |
| 4651 | 4651 |
| 4652 RenderSurfaceLayerList render_surface_layer_list; | 4652 RenderSurfaceLayerList render_surface_layer_list; |
| 4653 | 4653 |
| 4654 float device_scale_factor = 2.5f; | 4654 float device_scale_factor = 2.5f; |
| 4655 float page_scale_factor = 1.f; | 4655 float page_scale_factor = 1.f; |
| 4656 | 4656 |
| 4657 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 4657 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
| 4658 root.get(), root->bounds(), &render_surface_layer_list); | 4658 root.get(), root->bounds(), &render_surface_layer_list); |
| 4659 inputs.device_scale_factor = device_scale_factor; | 4659 inputs.device_scale_factor = device_scale_factor; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4721 gfx::Point3F(), | 4721 gfx::Point3F(), |
| 4722 gfx::PointF(2.f, 2.f), | 4722 gfx::PointF(2.f, 2.f), |
| 4723 gfx::Size(10, 10), | 4723 gfx::Size(10, 10), |
| 4724 false, | 4724 false, |
| 4725 true); | 4725 true); |
| 4726 | 4726 |
| 4727 root->AddChild(parent); | 4727 root->AddChild(parent); |
| 4728 | 4728 |
| 4729 parent->AddChild(child_scale); | 4729 parent->AddChild(child_scale); |
| 4730 | 4730 |
| 4731 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 4731 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 4732 host->SetRootLayer(root); | 4732 host->SetRootLayer(root); |
| 4733 | 4733 |
| 4734 float device_scale_factor = 2.5f; | 4734 float device_scale_factor = 2.5f; |
| 4735 float page_scale_factor = 0.01f; | 4735 float page_scale_factor = 0.01f; |
| 4736 | 4736 |
| 4737 { | 4737 { |
| 4738 RenderSurfaceLayerList render_surface_layer_list; | 4738 RenderSurfaceLayerList render_surface_layer_list; |
| 4739 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 4739 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
| 4740 root.get(), root->bounds(), &render_surface_layer_list); | 4740 root.get(), root->bounds(), &render_surface_layer_list); |
| 4741 inputs.device_scale_factor = device_scale_factor; | 4741 inputs.device_scale_factor = device_scale_factor; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4869 parent->AddChild(surface_no_scale); | 4869 parent->AddChild(surface_no_scale); |
| 4870 | 4870 |
| 4871 surface_scale->SetForceRenderSurface(true); | 4871 surface_scale->SetForceRenderSurface(true); |
| 4872 surface_scale->AddChild(surface_scale_child_scale); | 4872 surface_scale->AddChild(surface_scale_child_scale); |
| 4873 surface_scale->AddChild(surface_scale_child_no_scale); | 4873 surface_scale->AddChild(surface_scale_child_no_scale); |
| 4874 | 4874 |
| 4875 surface_no_scale->SetForceRenderSurface(true); | 4875 surface_no_scale->SetForceRenderSurface(true); |
| 4876 surface_no_scale->AddChild(surface_no_scale_child_scale); | 4876 surface_no_scale->AddChild(surface_no_scale_child_scale); |
| 4877 surface_no_scale->AddChild(surface_no_scale_child_no_scale); | 4877 surface_no_scale->AddChild(surface_no_scale_child_no_scale); |
| 4878 | 4878 |
| 4879 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 4879 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 4880 host->SetRootLayer(root); | 4880 host->SetRootLayer(root); |
| 4881 | 4881 |
| 4882 SkMScalar device_scale_factor = 5; | 4882 SkMScalar device_scale_factor = 5; |
| 4883 SkMScalar page_scale_factor = 7; | 4883 SkMScalar page_scale_factor = 7; |
| 4884 | 4884 |
| 4885 RenderSurfaceLayerList render_surface_layer_list; | 4885 RenderSurfaceLayerList render_surface_layer_list; |
| 4886 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 4886 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
| 4887 root.get(), root->bounds(), &render_surface_layer_list); | 4887 root.get(), root->bounds(), &render_surface_layer_list); |
| 4888 inputs.device_scale_factor = device_scale_factor; | 4888 inputs.device_scale_factor = device_scale_factor; |
| 4889 inputs.page_scale_factor = page_scale_factor; | 4889 inputs.page_scale_factor = page_scale_factor; |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5070 parent->AddChild(surface_no_scale); | 5070 parent->AddChild(surface_no_scale); |
| 5071 | 5071 |
| 5072 surface_scale->SetForceRenderSurface(true); | 5072 surface_scale->SetForceRenderSurface(true); |
| 5073 surface_scale->AddChild(surface_scale_child_scale); | 5073 surface_scale->AddChild(surface_scale_child_scale); |
| 5074 surface_scale->AddChild(surface_scale_child_no_scale); | 5074 surface_scale->AddChild(surface_scale_child_no_scale); |
| 5075 | 5075 |
| 5076 surface_no_scale->SetForceRenderSurface(true); | 5076 surface_no_scale->SetForceRenderSurface(true); |
| 5077 surface_no_scale->AddChild(surface_no_scale_child_scale); | 5077 surface_no_scale->AddChild(surface_no_scale_child_scale); |
| 5078 surface_no_scale->AddChild(surface_no_scale_child_no_scale); | 5078 surface_no_scale->AddChild(surface_no_scale_child_no_scale); |
| 5079 | 5079 |
| 5080 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 5080 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 5081 host->SetRootLayer(root); | 5081 host->SetRootLayer(root); |
| 5082 | 5082 |
| 5083 RenderSurfaceLayerList render_surface_layer_list; | 5083 RenderSurfaceLayerList render_surface_layer_list; |
| 5084 | 5084 |
| 5085 SkMScalar device_scale_factor = 5.0; | 5085 SkMScalar device_scale_factor = 5.0; |
| 5086 SkMScalar page_scale_factor = 7.0; | 5086 SkMScalar page_scale_factor = 7.0; |
| 5087 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 5087 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
| 5088 root.get(), root->bounds(), &render_surface_layer_list); | 5088 root.get(), root->bounds(), &render_surface_layer_list); |
| 5089 inputs.device_scale_factor = device_scale_factor; | 5089 inputs.device_scale_factor = device_scale_factor; |
| 5090 inputs.page_scale_factor = page_scale_factor; | 5090 inputs.page_scale_factor = page_scale_factor; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5213 gfx::Point3F(), | 5213 gfx::Point3F(), |
| 5214 gfx::PointF(2.f, 2.f), | 5214 gfx::PointF(2.f, 2.f), |
| 5215 gfx::Size(10, 10), | 5215 gfx::Size(10, 10), |
| 5216 false, | 5216 false, |
| 5217 true); | 5217 true); |
| 5218 | 5218 |
| 5219 root->AddChild(parent); | 5219 root->AddChild(parent); |
| 5220 | 5220 |
| 5221 parent->AddChild(child_scale); | 5221 parent->AddChild(child_scale); |
| 5222 | 5222 |
| 5223 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 5223 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 5224 host->SetRootLayer(root); | 5224 host->SetRootLayer(root); |
| 5225 | 5225 |
| 5226 // Now put an animating transform on child. | 5226 // Now put an animating transform on child. |
| 5227 int animation_id = AddAnimatedTransformToController( | 5227 int animation_id = AddAnimatedTransformToController( |
| 5228 child_scale->layer_animation_controller(), 10.0, 30, 0); | 5228 child_scale->layer_animation_controller(), 10.0, 30, 0); |
| 5229 | 5229 |
| 5230 { | 5230 { |
| 5231 RenderSurfaceLayerList render_surface_layer_list; | 5231 RenderSurfaceLayerList render_surface_layer_list; |
| 5232 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 5232 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
| 5233 root.get(), root->bounds(), &render_surface_layer_list); | 5233 root.get(), root->bounds(), &render_surface_layer_list); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 5258 } | 5258 } |
| 5259 } | 5259 } |
| 5260 | 5260 |
| 5261 TEST_F(LayerTreeHostCommonTest, | 5261 TEST_F(LayerTreeHostCommonTest, |
| 5262 ChangeInContentBoundsOrScaleTriggersPushProperties) { | 5262 ChangeInContentBoundsOrScaleTriggersPushProperties) { |
| 5263 MockContentLayerClient delegate; | 5263 MockContentLayerClient delegate; |
| 5264 scoped_refptr<Layer> root = Layer::Create(); | 5264 scoped_refptr<Layer> root = Layer::Create(); |
| 5265 scoped_refptr<Layer> child = CreateDrawableContentLayer(&delegate); | 5265 scoped_refptr<Layer> child = CreateDrawableContentLayer(&delegate); |
| 5266 root->AddChild(child); | 5266 root->AddChild(child); |
| 5267 | 5267 |
| 5268 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 5268 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 5269 host->SetRootLayer(root); | 5269 host->SetRootLayer(root); |
| 5270 | 5270 |
| 5271 gfx::Transform identity_matrix; | 5271 gfx::Transform identity_matrix; |
| 5272 SetLayerPropertiesForTesting(root.get(), | 5272 SetLayerPropertiesForTesting(root.get(), |
| 5273 identity_matrix, | 5273 identity_matrix, |
| 5274 gfx::Point3F(), | 5274 gfx::Point3F(), |
| 5275 gfx::PointF(), | 5275 gfx::PointF(), |
| 5276 gfx::Size(100, 100), | 5276 gfx::Size(100, 100), |
| 5277 true, | 5277 true, |
| 5278 false); | 5278 false); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5352 gfx::Point3F(), | 5352 gfx::Point3F(), |
| 5353 gfx::PointF(), | 5353 gfx::PointF(), |
| 5354 gfx::Size(10, 10), | 5354 gfx::Size(10, 10), |
| 5355 false, | 5355 false, |
| 5356 true); | 5356 true); |
| 5357 | 5357 |
| 5358 parent->AddChild(child); | 5358 parent->AddChild(child); |
| 5359 child->AddChild(duplicate_child_non_owner); | 5359 child->AddChild(duplicate_child_non_owner); |
| 5360 child->SetReplicaLayer(replica.get()); | 5360 child->SetReplicaLayer(replica.get()); |
| 5361 | 5361 |
| 5362 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 5362 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 5363 host->SetRootLayer(parent); | 5363 host->SetRootLayer(parent); |
| 5364 | 5364 |
| 5365 RenderSurfaceLayerList render_surface_layer_list; | 5365 RenderSurfaceLayerList render_surface_layer_list; |
| 5366 | 5366 |
| 5367 float device_scale_factor = 1.5f; | 5367 float device_scale_factor = 1.5f; |
| 5368 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 5368 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
| 5369 parent.get(), parent->bounds(), &render_surface_layer_list); | 5369 parent.get(), parent->bounds(), &render_surface_layer_list); |
| 5370 inputs.device_scale_factor = device_scale_factor; | 5370 inputs.device_scale_factor = device_scale_factor; |
| 5371 inputs.can_adjust_raster_scales = true; | 5371 inputs.can_adjust_raster_scales = true; |
| 5372 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 5372 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5487 gfx::Point3F(), | 5487 gfx::Point3F(), |
| 5488 gfx::PointF(), | 5488 gfx::PointF(), |
| 5489 gfx::Size(13, 11), | 5489 gfx::Size(13, 11), |
| 5490 false, | 5490 false, |
| 5491 true); | 5491 true); |
| 5492 | 5492 |
| 5493 parent->AddChild(child); | 5493 parent->AddChild(child); |
| 5494 child->AddChild(duplicate_child_non_owner); | 5494 child->AddChild(duplicate_child_non_owner); |
| 5495 child->SetReplicaLayer(replica.get()); | 5495 child->SetReplicaLayer(replica.get()); |
| 5496 | 5496 |
| 5497 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 5497 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 5498 host->SetRootLayer(parent); | 5498 host->SetRootLayer(parent); |
| 5499 | 5499 |
| 5500 float device_scale_factor = 1.7f; | 5500 float device_scale_factor = 1.7f; |
| 5501 | 5501 |
| 5502 RenderSurfaceLayerList render_surface_layer_list; | 5502 RenderSurfaceLayerList render_surface_layer_list; |
| 5503 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 5503 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
| 5504 parent.get(), parent->bounds(), &render_surface_layer_list); | 5504 parent.get(), parent->bounds(), &render_surface_layer_list); |
| 5505 inputs.device_scale_factor = device_scale_factor; | 5505 inputs.device_scale_factor = device_scale_factor; |
| 5506 inputs.can_adjust_raster_scales = true; | 5506 inputs.can_adjust_raster_scales = true; |
| 5507 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 5507 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5552 scoped_refptr<Layer> child = Layer::Create(); | 5552 scoped_refptr<Layer> child = Layer::Create(); |
| 5553 scoped_refptr<Layer> grand_child = Layer::Create(); | 5553 scoped_refptr<Layer> grand_child = Layer::Create(); |
| 5554 scoped_refptr<Layer> mask_layer = Layer::Create(); | 5554 scoped_refptr<Layer> mask_layer = Layer::Create(); |
| 5555 scoped_refptr<Layer> replica_layer = Layer::Create(); | 5555 scoped_refptr<Layer> replica_layer = Layer::Create(); |
| 5556 | 5556 |
| 5557 grand_child->SetReplicaLayer(replica_layer.get()); | 5557 grand_child->SetReplicaLayer(replica_layer.get()); |
| 5558 child->AddChild(grand_child.get()); | 5558 child->AddChild(grand_child.get()); |
| 5559 child->SetMaskLayer(mask_layer.get()); | 5559 child->SetMaskLayer(mask_layer.get()); |
| 5560 root->AddChild(child.get()); | 5560 root->AddChild(child.get()); |
| 5561 | 5561 |
| 5562 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 5562 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 5563 host->SetRootLayer(root); | 5563 host->SetRootLayer(root); |
| 5564 | 5564 |
| 5565 int nonexistent_id = -1; | 5565 int nonexistent_id = -1; |
| 5566 EXPECT_EQ(root.get(), | 5566 EXPECT_EQ(root.get(), |
| 5567 LayerTreeHostCommon::FindLayerInSubtree(root.get(), root->id())); | 5567 LayerTreeHostCommon::FindLayerInSubtree(root.get(), root->id())); |
| 5568 EXPECT_EQ(child.get(), | 5568 EXPECT_EQ(child.get(), |
| 5569 LayerTreeHostCommon::FindLayerInSubtree(root.get(), child->id())); | 5569 LayerTreeHostCommon::FindLayerInSubtree(root.get(), child->id())); |
| 5570 EXPECT_EQ( | 5570 EXPECT_EQ( |
| 5571 grand_child.get(), | 5571 grand_child.get(), |
| 5572 LayerTreeHostCommon::FindLayerInSubtree(root.get(), grand_child->id())); | 5572 LayerTreeHostCommon::FindLayerInSubtree(root.get(), grand_child->id())); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5606 gfx::Point3F(), | 5606 gfx::Point3F(), |
| 5607 gfx::PointF(), | 5607 gfx::PointF(), |
| 5608 gfx::Size(10, 10), | 5608 gfx::Size(10, 10), |
| 5609 true, | 5609 true, |
| 5610 false); | 5610 false); |
| 5611 | 5611 |
| 5612 root->AddChild(child); | 5612 root->AddChild(child); |
| 5613 child->AddChild(grand_child); | 5613 child->AddChild(grand_child); |
| 5614 child->SetOpacity(0.5f); | 5614 child->SetOpacity(0.5f); |
| 5615 | 5615 |
| 5616 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 5616 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 5617 host->SetRootLayer(root); | 5617 host->SetRootLayer(root); |
| 5618 | 5618 |
| 5619 ExecuteCalculateDrawProperties(root.get()); | 5619 ExecuteCalculateDrawProperties(root.get()); |
| 5620 | 5620 |
| 5621 EXPECT_FALSE(child->render_surface()); | 5621 EXPECT_FALSE(child->render_surface()); |
| 5622 } | 5622 } |
| 5623 | 5623 |
| 5624 TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) { | 5624 TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) { |
| 5625 FakeImplProxy proxy; | 5625 FakeImplProxy proxy; |
| 5626 TestSharedBitmapManager shared_bitmap_manager; | 5626 TestSharedBitmapManager shared_bitmap_manager; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5699 SetLayerPropertiesForTesting(grand_child_.get(), | 5699 SetLayerPropertiesForTesting(grand_child_.get(), |
| 5700 identity_matrix, | 5700 identity_matrix, |
| 5701 gfx::Point3F(), | 5701 gfx::Point3F(), |
| 5702 gfx::PointF(), | 5702 gfx::PointF(), |
| 5703 gfx::Size(1, 1), | 5703 gfx::Size(1, 1), |
| 5704 true, | 5704 true, |
| 5705 false); | 5705 false); |
| 5706 | 5706 |
| 5707 child_->SetForceRenderSurface(std::tr1::get<1>(GetParam())); | 5707 child_->SetForceRenderSurface(std::tr1::get<1>(GetParam())); |
| 5708 | 5708 |
| 5709 host_ = FakeLayerTreeHost::Create(); | 5709 host_ = CreateFakeLayerTreeHost(); |
| 5710 host_->SetRootLayer(root_); | 5710 host_->SetRootLayer(root_); |
| 5711 } | 5711 } |
| 5712 | 5712 |
| 5713 bool can_use_lcd_text_; | 5713 bool can_use_lcd_text_; |
| 5714 scoped_ptr<FakeLayerTreeHost> host_; | 5714 scoped_ptr<FakeLayerTreeHost> host_; |
| 5715 scoped_refptr<Layer> root_; | 5715 scoped_refptr<Layer> root_; |
| 5716 scoped_refptr<Layer> child_; | 5716 scoped_refptr<Layer> child_; |
| 5717 scoped_refptr<Layer> grand_child_; | 5717 scoped_refptr<Layer> grand_child_; |
| 5718 }; | 5718 }; |
| 5719 | 5719 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5855 gfx::PointF(), | 5855 gfx::PointF(), |
| 5856 gfx::Size(30, 30), | 5856 gfx::Size(30, 30), |
| 5857 true, | 5857 true, |
| 5858 false); | 5858 false); |
| 5859 grand_child->SetIsDrawable(true); | 5859 grand_child->SetIsDrawable(true); |
| 5860 grand_child->SetHideLayerAndSubtree(true); | 5860 grand_child->SetHideLayerAndSubtree(true); |
| 5861 | 5861 |
| 5862 child->AddChild(grand_child); | 5862 child->AddChild(grand_child); |
| 5863 root->AddChild(child); | 5863 root->AddChild(child); |
| 5864 | 5864 |
| 5865 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 5865 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 5866 host->SetRootLayer(root); | 5866 host->SetRootLayer(root); |
| 5867 | 5867 |
| 5868 RenderSurfaceLayerList render_surface_layer_list; | 5868 RenderSurfaceLayerList render_surface_layer_list; |
| 5869 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 5869 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
| 5870 root.get(), root->bounds(), &render_surface_layer_list); | 5870 root.get(), root->bounds(), &render_surface_layer_list); |
| 5871 inputs.can_adjust_raster_scales = true; | 5871 inputs.can_adjust_raster_scales = true; |
| 5872 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 5872 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 5873 | 5873 |
| 5874 // We should have one render surface and two layers. The grand child has | 5874 // We should have one render surface and two layers. The grand child has |
| 5875 // hidden itself. | 5875 // hidden itself. |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5969 gfx::Point3F(), | 5969 gfx::Point3F(), |
| 5970 gfx::PointF(), | 5970 gfx::PointF(), |
| 5971 gfx::Size(30, 30), | 5971 gfx::Size(30, 30), |
| 5972 true, | 5972 true, |
| 5973 false); | 5973 false); |
| 5974 grand_child->SetIsDrawable(true); | 5974 grand_child->SetIsDrawable(true); |
| 5975 | 5975 |
| 5976 child->AddChild(grand_child); | 5976 child->AddChild(grand_child); |
| 5977 root->AddChild(child); | 5977 root->AddChild(child); |
| 5978 | 5978 |
| 5979 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 5979 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 5980 host->SetRootLayer(root); | 5980 host->SetRootLayer(root); |
| 5981 | 5981 |
| 5982 RenderSurfaceLayerList render_surface_layer_list; | 5982 RenderSurfaceLayerList render_surface_layer_list; |
| 5983 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 5983 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
| 5984 root.get(), root->bounds(), &render_surface_layer_list); | 5984 root.get(), root->bounds(), &render_surface_layer_list); |
| 5985 inputs.can_adjust_raster_scales = true; | 5985 inputs.can_adjust_raster_scales = true; |
| 5986 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 5986 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 5987 | 5987 |
| 5988 // We should have one render surface and one layers. The child has | 5988 // We should have one render surface and one layers. The child has |
| 5989 // hidden itself and the grand child. | 5989 // hidden itself and the grand child. |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6127 false); | 6127 false); |
| 6128 copy_grand_parent_sibling_after->SetIsDrawable(true); | 6128 copy_grand_parent_sibling_after->SetIsDrawable(true); |
| 6129 | 6129 |
| 6130 copy_layer->AddChild(copy_child); | 6130 copy_layer->AddChild(copy_child); |
| 6131 copy_parent->AddChild(copy_layer); | 6131 copy_parent->AddChild(copy_layer); |
| 6132 copy_grand_parent->AddChild(copy_parent); | 6132 copy_grand_parent->AddChild(copy_parent); |
| 6133 root->AddChild(copy_grand_parent_sibling_before); | 6133 root->AddChild(copy_grand_parent_sibling_before); |
| 6134 root->AddChild(copy_grand_parent); | 6134 root->AddChild(copy_grand_parent); |
| 6135 root->AddChild(copy_grand_parent_sibling_after); | 6135 root->AddChild(copy_grand_parent_sibling_after); |
| 6136 | 6136 |
| 6137 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 6137 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 6138 host->SetRootLayer(root); | 6138 host->SetRootLayer(root); |
| 6139 | 6139 |
| 6140 // Hide the copy_grand_parent and its subtree. But make a copy request in that | 6140 // Hide the copy_grand_parent and its subtree. But make a copy request in that |
| 6141 // hidden subtree on copy_layer. | 6141 // hidden subtree on copy_layer. |
| 6142 copy_grand_parent->SetHideLayerAndSubtree(true); | 6142 copy_grand_parent->SetHideLayerAndSubtree(true); |
| 6143 copy_grand_parent_sibling_before->SetHideLayerAndSubtree(true); | 6143 copy_grand_parent_sibling_before->SetHideLayerAndSubtree(true); |
| 6144 copy_grand_parent_sibling_after->SetHideLayerAndSubtree(true); | 6144 copy_grand_parent_sibling_after->SetHideLayerAndSubtree(true); |
| 6145 copy_layer->RequestCopyOfOutput(CopyOutputRequest::CreateRequest( | 6145 copy_layer->RequestCopyOfOutput(CopyOutputRequest::CreateRequest( |
| 6146 base::Bind(&EmptyCopyOutputCallback))); | 6146 base::Bind(&EmptyCopyOutputCallback))); |
| 6147 EXPECT_TRUE(copy_layer->HasCopyRequest()); | 6147 EXPECT_TRUE(copy_layer->HasCopyRequest()); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6241 gfx::PointF(), | 6241 gfx::PointF(), |
| 6242 gfx::Size(20, 20), | 6242 gfx::Size(20, 20), |
| 6243 true, | 6243 true, |
| 6244 false); | 6244 false); |
| 6245 copy_child->SetIsDrawable(true); | 6245 copy_child->SetIsDrawable(true); |
| 6246 | 6246 |
| 6247 copy_layer->AddChild(copy_child); | 6247 copy_layer->AddChild(copy_child); |
| 6248 copy_parent->AddChild(copy_layer); | 6248 copy_parent->AddChild(copy_layer); |
| 6249 root->AddChild(copy_parent); | 6249 root->AddChild(copy_parent); |
| 6250 | 6250 |
| 6251 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 6251 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 6252 host->SetRootLayer(root); | 6252 host->SetRootLayer(root); |
| 6253 | 6253 |
| 6254 copy_layer->RequestCopyOfOutput(CopyOutputRequest::CreateRequest( | 6254 copy_layer->RequestCopyOfOutput(CopyOutputRequest::CreateRequest( |
| 6255 base::Bind(&EmptyCopyOutputCallback))); | 6255 base::Bind(&EmptyCopyOutputCallback))); |
| 6256 EXPECT_TRUE(copy_layer->HasCopyRequest()); | 6256 EXPECT_TRUE(copy_layer->HasCopyRequest()); |
| 6257 | 6257 |
| 6258 RenderSurfaceLayerList render_surface_layer_list; | 6258 RenderSurfaceLayerList render_surface_layer_list; |
| 6259 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 6259 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
| 6260 root.get(), root->bounds(), &render_surface_layer_list); | 6260 root.get(), root->bounds(), &render_surface_layer_list); |
| 6261 inputs.can_adjust_raster_scales = true; | 6261 inputs.can_adjust_raster_scales = true; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6305 gfx::Point3F(), | 6305 gfx::Point3F(), |
| 6306 gfx::PointF(), | 6306 gfx::PointF(), |
| 6307 gfx::Size(50, 50), | 6307 gfx::Size(50, 50), |
| 6308 true, | 6308 true, |
| 6309 false); | 6309 false); |
| 6310 surface_child->SetIsDrawable(true); | 6310 surface_child->SetIsDrawable(true); |
| 6311 | 6311 |
| 6312 surface->AddChild(surface_child); | 6312 surface->AddChild(surface_child); |
| 6313 root->AddChild(surface); | 6313 root->AddChild(surface); |
| 6314 | 6314 |
| 6315 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 6315 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 6316 host->SetRootLayer(root); | 6316 host->SetRootLayer(root); |
| 6317 | 6317 |
| 6318 RenderSurfaceLayerList render_surface_layer_list; | 6318 RenderSurfaceLayerList render_surface_layer_list; |
| 6319 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 6319 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
| 6320 root.get(), root->bounds(), &render_surface_layer_list); | 6320 root.get(), root->bounds(), &render_surface_layer_list); |
| 6321 inputs.can_adjust_raster_scales = true; | 6321 inputs.can_adjust_raster_scales = true; |
| 6322 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 6322 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 6323 | 6323 |
| 6324 // The visible_content_rect for the |surface_child| should not be clipped by | 6324 // The visible_content_rect for the |surface_child| should not be clipped by |
| 6325 // the viewport. | 6325 // the viewport. |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6392 true, | 6392 true, |
| 6393 false); | 6393 false); |
| 6394 SetLayerPropertiesForTesting(clip_child.get(), | 6394 SetLayerPropertiesForTesting(clip_child.get(), |
| 6395 identity_transform, | 6395 identity_transform, |
| 6396 gfx::Point3F(), | 6396 gfx::Point3F(), |
| 6397 gfx::PointF(1.f, 1.f), | 6397 gfx::PointF(1.f, 1.f), |
| 6398 gfx::Size(10, 10), | 6398 gfx::Size(10, 10), |
| 6399 true, | 6399 true, |
| 6400 false); | 6400 false); |
| 6401 | 6401 |
| 6402 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 6402 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 6403 host->SetRootLayer(root); | 6403 host->SetRootLayer(root); |
| 6404 | 6404 |
| 6405 ExecuteCalculateDrawProperties(root.get()); | 6405 ExecuteCalculateDrawProperties(root.get()); |
| 6406 | 6406 |
| 6407 ASSERT_TRUE(root->render_surface()); | 6407 ASSERT_TRUE(root->render_surface()); |
| 6408 ASSERT_TRUE(render_surface->render_surface()); | 6408 ASSERT_TRUE(render_surface->render_surface()); |
| 6409 | 6409 |
| 6410 // Ensure that we've inherited our clip parent's clip and weren't affected | 6410 // Ensure that we've inherited our clip parent's clip and weren't affected |
| 6411 // by the intervening clip layer. | 6411 // by the intervening clip layer. |
| 6412 ASSERT_EQ(gfx::Rect(1, 1, 20, 20).ToString(), | 6412 ASSERT_EQ(gfx::Rect(1, 1, 20, 20).ToString(), |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6503 true, | 6503 true, |
| 6504 false); | 6504 false); |
| 6505 SetLayerPropertiesForTesting(clip_child.get(), | 6505 SetLayerPropertiesForTesting(clip_child.get(), |
| 6506 identity_transform, | 6506 identity_transform, |
| 6507 gfx::Point3F(), | 6507 gfx::Point3F(), |
| 6508 gfx::PointF(-10.f, -10.f), | 6508 gfx::PointF(-10.f, -10.f), |
| 6509 gfx::Size(60, 60), | 6509 gfx::Size(60, 60), |
| 6510 true, | 6510 true, |
| 6511 false); | 6511 false); |
| 6512 | 6512 |
| 6513 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 6513 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 6514 host->SetRootLayer(root); | 6514 host->SetRootLayer(root); |
| 6515 | 6515 |
| 6516 ExecuteCalculateDrawProperties(root.get()); | 6516 ExecuteCalculateDrawProperties(root.get()); |
| 6517 | 6517 |
| 6518 EXPECT_TRUE(root->render_surface()); | 6518 EXPECT_TRUE(root->render_surface()); |
| 6519 EXPECT_TRUE(render_surface1->render_surface()); | 6519 EXPECT_TRUE(render_surface1->render_surface()); |
| 6520 EXPECT_TRUE(render_surface2->render_surface()); | 6520 EXPECT_TRUE(render_surface2->render_surface()); |
| 6521 | 6521 |
| 6522 // Since the render surfaces could have expanded, they should not clip (their | 6522 // Since the render surfaces could have expanded, they should not clip (their |
| 6523 // bounds would no longer be reliable). We should resort to layer clipping | 6523 // bounds would no longer be reliable). We should resort to layer clipping |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6632 true, | 6632 true, |
| 6633 false); | 6633 false); |
| 6634 SetLayerPropertiesForTesting(clip_child.get(), | 6634 SetLayerPropertiesForTesting(clip_child.get(), |
| 6635 identity_transform, | 6635 identity_transform, |
| 6636 gfx::Point3F(), | 6636 gfx::Point3F(), |
| 6637 gfx::PointF(-10.f, -10.f), | 6637 gfx::PointF(-10.f, -10.f), |
| 6638 gfx::Size(60, 60), | 6638 gfx::Size(60, 60), |
| 6639 true, | 6639 true, |
| 6640 false); | 6640 false); |
| 6641 | 6641 |
| 6642 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 6642 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 6643 host->SetRootLayer(root); | 6643 host->SetRootLayer(root); |
| 6644 | 6644 |
| 6645 ExecuteCalculateDrawProperties(root.get()); | 6645 ExecuteCalculateDrawProperties(root.get()); |
| 6646 | 6646 |
| 6647 EXPECT_TRUE(root->render_surface()); | 6647 EXPECT_TRUE(root->render_surface()); |
| 6648 EXPECT_TRUE(render_surface1->render_surface()); | 6648 EXPECT_TRUE(render_surface1->render_surface()); |
| 6649 EXPECT_TRUE(render_surface2->render_surface()); | 6649 EXPECT_TRUE(render_surface2->render_surface()); |
| 6650 | 6650 |
| 6651 // Since the render surfaces could have expanded, they should not clip (their | 6651 // Since the render surfaces could have expanded, they should not clip (their |
| 6652 // bounds would no longer be reliable). We should resort to layer clipping | 6652 // bounds would no longer be reliable). We should resort to layer clipping |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6741 true, | 6741 true, |
| 6742 false); | 6742 false); |
| 6743 SetLayerPropertiesForTesting(child.get(), | 6743 SetLayerPropertiesForTesting(child.get(), |
| 6744 identity_transform, | 6744 identity_transform, |
| 6745 gfx::Point3F(), | 6745 gfx::Point3F(), |
| 6746 gfx::PointF(), | 6746 gfx::PointF(), |
| 6747 gfx::Size(60, 60), | 6747 gfx::Size(60, 60), |
| 6748 true, | 6748 true, |
| 6749 false); | 6749 false); |
| 6750 | 6750 |
| 6751 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 6751 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 6752 host->SetRootLayer(root); | 6752 host->SetRootLayer(root); |
| 6753 | 6753 |
| 6754 ExecuteCalculateDrawProperties(root.get()); | 6754 ExecuteCalculateDrawProperties(root.get()); |
| 6755 | 6755 |
| 6756 EXPECT_TRUE(root->render_surface()); | 6756 EXPECT_TRUE(root->render_surface()); |
| 6757 | 6757 |
| 6758 // Neither the clip child nor its descendant should have inherited the clip | 6758 // Neither the clip child nor its descendant should have inherited the clip |
| 6759 // from |intervening|. | 6759 // from |intervening|. |
| 6760 EXPECT_EQ(gfx::Rect(0, 0, 40, 40).ToString(), | 6760 EXPECT_EQ(gfx::Rect(0, 0, 40, 40).ToString(), |
| 6761 clip_child->clip_rect().ToString()); | 6761 clip_child->clip_rect().ToString()); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6838 identity_transform, | 6838 identity_transform, |
| 6839 gfx::Point3F(), | 6839 gfx::Point3F(), |
| 6840 gfx::PointF(), | 6840 gfx::PointF(), |
| 6841 gfx::Size(5, 5), | 6841 gfx::Size(5, 5), |
| 6842 true, | 6842 true, |
| 6843 false); | 6843 false); |
| 6844 | 6844 |
| 6845 render_surface1->SetForceRenderSurface(true); | 6845 render_surface1->SetForceRenderSurface(true); |
| 6846 render_surface2->SetForceRenderSurface(true); | 6846 render_surface2->SetForceRenderSurface(true); |
| 6847 | 6847 |
| 6848 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 6848 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 6849 host->SetRootLayer(root); | 6849 host->SetRootLayer(root); |
| 6850 | 6850 |
| 6851 ExecuteCalculateDrawProperties(root.get()); | 6851 ExecuteCalculateDrawProperties(root.get()); |
| 6852 | 6852 |
| 6853 EXPECT_TRUE(root->render_surface()); | 6853 EXPECT_TRUE(root->render_surface()); |
| 6854 EXPECT_TRUE(render_surface1->render_surface()); | 6854 EXPECT_TRUE(render_surface1->render_surface()); |
| 6855 EXPECT_TRUE(render_surface2->render_surface()); | 6855 EXPECT_TRUE(render_surface2->render_surface()); |
| 6856 | 6856 |
| 6857 EXPECT_EQ(gfx::Rect(0, 0, 5, 5).ToString(), | 6857 EXPECT_EQ(gfx::Rect(0, 0, 5, 5).ToString(), |
| 6858 render_surface1->clip_rect().ToString()); | 6858 render_surface1->clip_rect().ToString()); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6994 gfx::PointF(), | 6994 gfx::PointF(), |
| 6995 gfx::Size(20, 20), | 6995 gfx::Size(20, 20), |
| 6996 true, | 6996 true, |
| 6997 false); | 6997 false); |
| 6998 | 6998 |
| 6999 root->SetShouldFlattenTransform(false); | 6999 root->SetShouldFlattenTransform(false); |
| 7000 root->Set3dSortingContextId(1); | 7000 root->Set3dSortingContextId(1); |
| 7001 render_surface->SetDoubleSided(false); | 7001 render_surface->SetDoubleSided(false); |
| 7002 render_surface->SetForceRenderSurface(true); | 7002 render_surface->SetForceRenderSurface(true); |
| 7003 | 7003 |
| 7004 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 7004 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 7005 host->SetRootLayer(root); | 7005 host->SetRootLayer(root); |
| 7006 | 7006 |
| 7007 ExecuteCalculateDrawProperties(root.get()); | 7007 ExecuteCalculateDrawProperties(root.get()); |
| 7008 | 7008 |
| 7009 EXPECT_EQ(2u, render_surface_layer_list()->size()); | 7009 EXPECT_EQ(2u, render_surface_layer_list()->size()); |
| 7010 EXPECT_EQ(1u, | 7010 EXPECT_EQ(1u, |
| 7011 render_surface_layer_list()->at(0) | 7011 render_surface_layer_list()->at(0) |
| 7012 ->render_surface()->layer_list().size()); | 7012 ->render_surface()->layer_list().size()); |
| 7013 EXPECT_EQ(1u, | 7013 EXPECT_EQ(1u, |
| 7014 render_surface_layer_list()->at(1) | 7014 render_surface_layer_list()->at(1) |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7085 true, | 7085 true, |
| 7086 false); | 7086 false); |
| 7087 SetLayerPropertiesForTesting(scroll_child.get(), | 7087 SetLayerPropertiesForTesting(scroll_child.get(), |
| 7088 identity_transform, | 7088 identity_transform, |
| 7089 gfx::Point3F(), | 7089 gfx::Point3F(), |
| 7090 gfx::PointF(), | 7090 gfx::PointF(), |
| 7091 gfx::Size(50, 50), | 7091 gfx::Size(50, 50), |
| 7092 true, | 7092 true, |
| 7093 false); | 7093 false); |
| 7094 | 7094 |
| 7095 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 7095 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 7096 host->SetRootLayer(root); | 7096 host->SetRootLayer(root); |
| 7097 | 7097 |
| 7098 ExecuteCalculateDrawProperties(root.get()); | 7098 ExecuteCalculateDrawProperties(root.get()); |
| 7099 | 7099 |
| 7100 EXPECT_TRUE(root->render_surface()); | 7100 EXPECT_TRUE(root->render_surface()); |
| 7101 | 7101 |
| 7102 EXPECT_EQ(gfx::Rect(0, 0, 30, 30).ToString(), | 7102 EXPECT_EQ(gfx::Rect(0, 0, 30, 30).ToString(), |
| 7103 scroll_child->clip_rect().ToString()); | 7103 scroll_child->clip_rect().ToString()); |
| 7104 EXPECT_TRUE(scroll_child->is_clipped()); | 7104 EXPECT_TRUE(scroll_child->is_clipped()); |
| 7105 } | 7105 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 7134 parent->SetForceRenderSurface(true); | 7134 parent->SetForceRenderSurface(true); |
| 7135 SetLayerPropertiesForTesting(child.get(), | 7135 SetLayerPropertiesForTesting(child.get(), |
| 7136 identity_transform, | 7136 identity_transform, |
| 7137 gfx::Point3F(), | 7137 gfx::Point3F(), |
| 7138 gfx::PointF(), | 7138 gfx::PointF(), |
| 7139 gfx::Size(20, 20), | 7139 gfx::Size(20, 20), |
| 7140 true, | 7140 true, |
| 7141 true); | 7141 true); |
| 7142 child->SetForceRenderSurface(true); | 7142 child->SetForceRenderSurface(true); |
| 7143 | 7143 |
| 7144 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 7144 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 7145 host->SetRootLayer(root); | 7145 host->SetRootLayer(root); |
| 7146 | 7146 |
| 7147 ExecuteCalculateDrawProperties(root.get()); | 7147 ExecuteCalculateDrawProperties(root.get()); |
| 7148 | 7148 |
| 7149 EXPECT_EQ(3u, render_surface_layer_list()->size()); | 7149 EXPECT_EQ(3u, render_surface_layer_list()->size()); |
| 7150 | 7150 |
| 7151 gfx::Transform singular_transform; | 7151 gfx::Transform singular_transform; |
| 7152 singular_transform.Scale3d( | 7152 singular_transform.Scale3d( |
| 7153 SkDoubleToMScalar(1.0), SkDoubleToMScalar(1.0), SkDoubleToMScalar(0.0)); | 7153 SkDoubleToMScalar(1.0), SkDoubleToMScalar(1.0), SkDoubleToMScalar(0.0)); |
| 7154 | 7154 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7226 true, | 7226 true, |
| 7227 false); | 7227 false); |
| 7228 SetLayerPropertiesForTesting(scroll_child.get(), | 7228 SetLayerPropertiesForTesting(scroll_child.get(), |
| 7229 identity_transform, | 7229 identity_transform, |
| 7230 gfx::Point3F(), | 7230 gfx::Point3F(), |
| 7231 gfx::PointF(), | 7231 gfx::PointF(), |
| 7232 gfx::Size(50, 50), | 7232 gfx::Size(50, 50), |
| 7233 true, | 7233 true, |
| 7234 false); | 7234 false); |
| 7235 | 7235 |
| 7236 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 7236 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 7237 host->SetRootLayer(root); | 7237 host->SetRootLayer(root); |
| 7238 | 7238 |
| 7239 ExecuteCalculateDrawProperties(root.get()); | 7239 ExecuteCalculateDrawProperties(root.get()); |
| 7240 | 7240 |
| 7241 EXPECT_TRUE(root->render_surface()); | 7241 EXPECT_TRUE(root->render_surface()); |
| 7242 | 7242 |
| 7243 EXPECT_EQ(gfx::Rect(0, 0, 30, 30).ToString(), | 7243 EXPECT_EQ(gfx::Rect(0, 0, 30, 30).ToString(), |
| 7244 scroll_child->clip_rect().ToString()); | 7244 scroll_child->clip_rect().ToString()); |
| 7245 EXPECT_TRUE(scroll_child->is_clipped()); | 7245 EXPECT_TRUE(scroll_child->is_clipped()); |
| 7246 } | 7246 } |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7339 true, | 7339 true, |
| 7340 false); | 7340 false); |
| 7341 SetLayerPropertiesForTesting(scroll_child.get(), | 7341 SetLayerPropertiesForTesting(scroll_child.get(), |
| 7342 identity_transform, | 7342 identity_transform, |
| 7343 gfx::Point3F(), | 7343 gfx::Point3F(), |
| 7344 gfx::PointF(), | 7344 gfx::PointF(), |
| 7345 gfx::Size(50, 50), | 7345 gfx::Size(50, 50), |
| 7346 true, | 7346 true, |
| 7347 false); | 7347 false); |
| 7348 | 7348 |
| 7349 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 7349 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 7350 host->SetRootLayer(root); | 7350 host->SetRootLayer(root); |
| 7351 | 7351 |
| 7352 ExecuteCalculateDrawProperties(root.get()); | 7352 ExecuteCalculateDrawProperties(root.get()); |
| 7353 | 7353 |
| 7354 EXPECT_TRUE(root->render_surface()); | 7354 EXPECT_TRUE(root->render_surface()); |
| 7355 | 7355 |
| 7356 EXPECT_EQ(gfx::Rect(0, 0, 20, 20).ToString(), | 7356 EXPECT_EQ(gfx::Rect(0, 0, 20, 20).ToString(), |
| 7357 scroll_child->clip_rect().ToString()); | 7357 scroll_child->clip_rect().ToString()); |
| 7358 EXPECT_TRUE(scroll_child->is_clipped()); | 7358 EXPECT_TRUE(scroll_child->is_clipped()); |
| 7359 | 7359 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7488 true, | 7488 true, |
| 7489 false); | 7489 false); |
| 7490 SetLayerPropertiesForTesting(scroll_child.get(), | 7490 SetLayerPropertiesForTesting(scroll_child.get(), |
| 7491 identity_transform, | 7491 identity_transform, |
| 7492 gfx::Point3F(), | 7492 gfx::Point3F(), |
| 7493 gfx::PointF(), | 7493 gfx::PointF(), |
| 7494 gfx::Size(50, 50), | 7494 gfx::Size(50, 50), |
| 7495 true, | 7495 true, |
| 7496 false); | 7496 false); |
| 7497 | 7497 |
| 7498 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 7498 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 7499 host->SetRootLayer(root); | 7499 host->SetRootLayer(root); |
| 7500 | 7500 |
| 7501 RenderSurfaceLayerList render_surface_layer_list; | 7501 RenderSurfaceLayerList render_surface_layer_list; |
| 7502 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 7502 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
| 7503 root.get(), | 7503 root.get(), |
| 7504 root->bounds(), | 7504 root->bounds(), |
| 7505 identity_transform, | 7505 identity_transform, |
| 7506 &render_surface_layer_list); | 7506 &render_surface_layer_list); |
| 7507 | 7507 |
| 7508 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 7508 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| (...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8586 gfx::PointF(), | 8586 gfx::PointF(), |
| 8587 gfx::Size(768 / 2, 10000), | 8587 gfx::Size(768 / 2, 10000), |
| 8588 true, | 8588 true, |
| 8589 false); | 8589 false); |
| 8590 content->SetIsDrawable(true); | 8590 content->SetIsDrawable(true); |
| 8591 content->SetForceRenderSurface(true); | 8591 content->SetForceRenderSurface(true); |
| 8592 | 8592 |
| 8593 root->AddChild(clip); | 8593 root->AddChild(clip); |
| 8594 clip->AddChild(content); | 8594 clip->AddChild(content); |
| 8595 | 8595 |
| 8596 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 8596 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); |
| 8597 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&client); |
| 8597 host->SetRootLayer(root); | 8598 host->SetRootLayer(root); |
| 8598 | 8599 |
| 8599 gfx::Size device_viewport_size(768, 582); | 8600 gfx::Size device_viewport_size(768, 582); |
| 8600 RenderSurfaceLayerList render_surface_layer_list; | 8601 RenderSurfaceLayerList render_surface_layer_list; |
| 8601 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 8602 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
| 8602 host->root_layer(), device_viewport_size, &render_surface_layer_list); | 8603 host->root_layer(), device_viewport_size, &render_surface_layer_list); |
| 8603 inputs.device_scale_factor = 2.f; | 8604 inputs.device_scale_factor = 2.f; |
| 8604 inputs.page_scale_factor = 1.f; | 8605 inputs.page_scale_factor = 1.f; |
| 8605 inputs.page_scale_application_layer = NULL; | 8606 inputs.page_scale_application_layer = NULL; |
| 8606 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 8607 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 8607 | 8608 |
| 8608 // Layers in the root render surface have their visible content rect clipped | 8609 // Layers in the root render surface have their visible content rect clipped |
| 8609 // by the viewport. | 8610 // by the viewport. |
| 8610 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), root->visible_content_rect()); | 8611 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), root->visible_content_rect()); |
| 8611 | 8612 |
| 8612 // Layers drawing to a child render surface should still have their visible | 8613 // Layers drawing to a child render surface should still have their visible |
| 8613 // content rect clipped by the viewport. | 8614 // content rect clipped by the viewport. |
| 8614 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), content->visible_content_rect()); | 8615 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), content->visible_content_rect()); |
| 8615 } | 8616 } |
| 8616 | 8617 |
| 8617 } // namespace | 8618 } // namespace |
| 8618 } // namespace cc | 8619 } // namespace cc |
| OLD | NEW |