OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/trees/layer_tree_host_common.h" | 5 #include "cc/trees/layer_tree_host_common.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 3428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3439 perspective.ApplyPerspectiveDepth(SkDoubleToMScalar(1e-12)); | 3439 perspective.ApplyPerspectiveDepth(SkDoubleToMScalar(1e-12)); |
3440 | 3440 |
3441 gfx::Transform rotation; | 3441 gfx::Transform rotation; |
3442 rotation.RotateAboutYAxis(45.0); | 3442 rotation.RotateAboutYAxis(45.0); |
3443 | 3443 |
3444 root->SetBounds(gfx::Size(100, 100)); | 3444 root->SetBounds(gfx::Size(100, 100)); |
3445 child->test_properties()->transform = perspective; | 3445 child->test_properties()->transform = perspective; |
3446 child->SetPosition(gfx::PointF(10.f, 10.f)); | 3446 child->SetPosition(gfx::PointF(10.f, 10.f)); |
3447 child->SetBounds(gfx::Size(100, 100)); | 3447 child->SetBounds(gfx::Size(100, 100)); |
3448 child->SetDrawsContent(true); | 3448 child->SetDrawsContent(true); |
3449 child->Set3dSortingContextId(1); | 3449 child->test_properties()->sorting_context_id = 1; |
3450 child->test_properties()->should_flatten_transform = false; | 3450 child->test_properties()->should_flatten_transform = false; |
3451 grand_child->test_properties()->transform = rotation; | 3451 grand_child->test_properties()->transform = rotation; |
3452 grand_child->SetBounds(gfx::Size(100, 100)); | 3452 grand_child->SetBounds(gfx::Size(100, 100)); |
3453 grand_child->SetDrawsContent(true); | 3453 grand_child->SetDrawsContent(true); |
3454 grand_child->Set3dSortingContextId(1); | 3454 child->test_properties()->sorting_context_id = 1; |
3455 grand_child->test_properties()->should_flatten_transform = false; | 3455 grand_child->test_properties()->should_flatten_transform = false; |
| 3456 grand_child->test_properties()->sorting_context_id = 1; |
3456 ExecuteCalculateDrawProperties(root); | 3457 ExecuteCalculateDrawProperties(root); |
3457 | 3458 |
3458 // Though all layers have invertible transforms, matrix multiplication using | 3459 // Though all layers have invertible transforms, matrix multiplication using |
3459 // floating-point math makes the draw transform uninvertible. | 3460 // floating-point math makes the draw transform uninvertible. |
3460 EXPECT_FALSE(root->layer_tree_impl() | 3461 EXPECT_FALSE(root->layer_tree_impl() |
3461 ->property_trees() | 3462 ->property_trees() |
3462 ->transform_tree.Node(grand_child->transform_tree_index()) | 3463 ->transform_tree.Node(grand_child->transform_tree_index()) |
3463 ->ancestors_are_invertible); | 3464 ->ancestors_are_invertible); |
3464 | 3465 |
3465 // CalcDrawProps skips a subtree when a layer's screen space transform is | 3466 // CalcDrawProps skips a subtree when a layer's screen space transform is |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3604 perspective.ApplyPerspectiveDepth(SkDoubleToMScalar(1e-12)); | 3605 perspective.ApplyPerspectiveDepth(SkDoubleToMScalar(1e-12)); |
3605 | 3606 |
3606 gfx::Transform rotation; | 3607 gfx::Transform rotation; |
3607 rotation.RotateAboutYAxis(45.0); | 3608 rotation.RotateAboutYAxis(45.0); |
3608 | 3609 |
3609 root->SetBounds(gfx::Size(1000, 1000)); | 3610 root->SetBounds(gfx::Size(1000, 1000)); |
3610 child->test_properties()->transform = perspective; | 3611 child->test_properties()->transform = perspective; |
3611 child->SetPosition(gfx::PointF(10.f, 10.f)); | 3612 child->SetPosition(gfx::PointF(10.f, 10.f)); |
3612 child->SetBounds(gfx::Size(300, 300)); | 3613 child->SetBounds(gfx::Size(300, 300)); |
3613 child->test_properties()->should_flatten_transform = false; | 3614 child->test_properties()->should_flatten_transform = false; |
3614 child->Set3dSortingContextId(1); | 3615 child->test_properties()->sorting_context_id = 1; |
3615 grand_child->test_properties()->transform = rotation; | 3616 grand_child->test_properties()->transform = rotation; |
3616 grand_child->SetBounds(gfx::Size(200, 200)); | 3617 grand_child->SetBounds(gfx::Size(200, 200)); |
3617 grand_child->test_properties()->should_flatten_transform = false; | 3618 grand_child->test_properties()->should_flatten_transform = false; |
3618 grand_child->Set3dSortingContextId(1); | 3619 grand_child->test_properties()->sorting_context_id = 1; |
3619 occluding_child->SetBounds(gfx::Size(200, 200)); | 3620 occluding_child->SetBounds(gfx::Size(200, 200)); |
3620 occluding_child->test_properties()->should_flatten_transform = false; | 3621 occluding_child->test_properties()->should_flatten_transform = false; |
3621 | 3622 |
3622 child->SetDrawsContent(true); | 3623 child->SetDrawsContent(true); |
3623 grand_child->SetDrawsContent(true); | 3624 grand_child->SetDrawsContent(true); |
3624 occluding_child->SetDrawsContent(true); | 3625 occluding_child->SetDrawsContent(true); |
3625 occluding_child->SetContentsOpaque(true); | 3626 occluding_child->SetContentsOpaque(true); |
3626 | 3627 |
3627 host_impl.SetViewportSize(root->bounds()); | 3628 host_impl.SetViewportSize(root->bounds()); |
3628 | 3629 |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4288 backface_matrix; | 4289 backface_matrix; |
4289 back_facing_child_of_back_facing_surface->test_properties()->transform = | 4290 back_facing_child_of_back_facing_surface->test_properties()->transform = |
4290 backface_matrix; | 4291 backface_matrix; |
4291 | 4292 |
4292 // Each surface creates its own new 3d rendering context (as defined by W3C | 4293 // Each surface creates its own new 3d rendering context (as defined by W3C |
4293 // spec). According to current W3C CSS gfx::Transforms spec, layers in a 3d | 4294 // spec). According to current W3C CSS gfx::Transforms spec, layers in a 3d |
4294 // rendering context should use the transform with respect to that context. | 4295 // rendering context should use the transform with respect to that context. |
4295 // This 3d rendering context occurs when (a) parent's transform style is flat | 4296 // This 3d rendering context occurs when (a) parent's transform style is flat |
4296 // and (b) the layer's transform style is preserve-3d. | 4297 // and (b) the layer's transform style is preserve-3d. |
4297 front_facing_surface->test_properties()->should_flatten_transform = false; | 4298 front_facing_surface->test_properties()->should_flatten_transform = false; |
4298 front_facing_surface->Set3dSortingContextId(1); | 4299 front_facing_surface->test_properties()->sorting_context_id = 1; |
4299 back_facing_surface->test_properties()->should_flatten_transform = false; | 4300 back_facing_surface->test_properties()->should_flatten_transform = false; |
4300 back_facing_surface->Set3dSortingContextId(1); | 4301 back_facing_surface->test_properties()->sorting_context_id = 1; |
4301 front_facing_child_of_front_facing_surface->Set3dSortingContextId(1); | 4302 front_facing_child_of_front_facing_surface->test_properties() |
4302 back_facing_child_of_front_facing_surface->Set3dSortingContextId(1); | 4303 ->sorting_context_id = 1; |
4303 front_facing_child_of_back_facing_surface->Set3dSortingContextId(1); | 4304 back_facing_child_of_front_facing_surface->test_properties() |
4304 back_facing_child_of_back_facing_surface->Set3dSortingContextId(1); | 4305 ->sorting_context_id = 1; |
| 4306 front_facing_child_of_back_facing_surface->test_properties() |
| 4307 ->sorting_context_id = 1; |
| 4308 back_facing_child_of_back_facing_surface->test_properties() |
| 4309 ->sorting_context_id = 1; |
4305 | 4310 |
4306 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root); | 4311 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root); |
4307 | 4312 |
4308 // Verify which render surfaces were created and used. | 4313 // Verify which render surfaces were created and used. |
4309 EXPECT_FALSE(front_facing_child->has_render_surface()); | 4314 EXPECT_FALSE(front_facing_child->has_render_surface()); |
4310 EXPECT_FALSE(back_facing_child->has_render_surface()); | 4315 EXPECT_FALSE(back_facing_child->has_render_surface()); |
4311 EXPECT_TRUE(front_facing_surface->has_render_surface()); | 4316 EXPECT_TRUE(front_facing_surface->has_render_surface()); |
4312 // We expect that a has_render_surface was created but not used. | 4317 // We expect that a has_render_surface was created but not used. |
4313 EXPECT_TRUE(back_facing_surface->has_render_surface()); | 4318 EXPECT_TRUE(back_facing_surface->has_render_surface()); |
4314 EXPECT_FALSE( | 4319 EXPECT_FALSE( |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4428 | 4433 |
4429 root->SetBounds(gfx::Size(100, 100)); | 4434 root->SetBounds(gfx::Size(100, 100)); |
4430 front_facing_surface->SetBounds(gfx::Size(100, 100)); | 4435 front_facing_surface->SetBounds(gfx::Size(100, 100)); |
4431 front_facing_surface->test_properties()->force_render_surface = true; | 4436 front_facing_surface->test_properties()->force_render_surface = true; |
4432 back_facing_surface->SetBounds(gfx::Size(100, 100)); | 4437 back_facing_surface->SetBounds(gfx::Size(100, 100)); |
4433 back_facing_surface->test_properties()->transform = backface_matrix; | 4438 back_facing_surface->test_properties()->transform = backface_matrix; |
4434 back_facing_surface->test_properties()->force_render_surface = true; | 4439 back_facing_surface->test_properties()->force_render_surface = true; |
4435 child1->SetBounds(gfx::Size(100, 100)); | 4440 child1->SetBounds(gfx::Size(100, 100)); |
4436 child2->SetBounds(gfx::Size(100, 100)); | 4441 child2->SetBounds(gfx::Size(100, 100)); |
4437 | 4442 |
4438 front_facing_surface->Set3dSortingContextId(1); | 4443 front_facing_surface->test_properties()->sorting_context_id = 1; |
4439 back_facing_surface->Set3dSortingContextId(1); | 4444 back_facing_surface->test_properties()->sorting_context_id = 1; |
4440 | 4445 |
4441 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root); | 4446 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root); |
4442 | 4447 |
4443 // Verify which render surfaces were created and used. | 4448 // Verify which render surfaces were created and used. |
4444 EXPECT_TRUE(front_facing_surface->has_render_surface()); | 4449 EXPECT_TRUE(front_facing_surface->has_render_surface()); |
4445 | 4450 |
4446 // We expect the render surface to have been created, but remain unused. | 4451 // We expect the render surface to have been created, but remain unused. |
4447 EXPECT_TRUE(back_facing_surface->has_render_surface()); | 4452 EXPECT_TRUE(back_facing_surface->has_render_surface()); |
4448 EXPECT_FALSE(child1->has_render_surface()); | 4453 EXPECT_FALSE(child1->has_render_surface()); |
4449 EXPECT_FALSE(child2->has_render_surface()); | 4454 EXPECT_FALSE(child2->has_render_surface()); |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4708 // Animating layers compute ideal scale in the same way as when | 4713 // Animating layers compute ideal scale in the same way as when |
4709 // they are static. | 4714 // they are static. |
4710 EXPECT_FLOAT_EQ(initial_child_scale * initial_parent_scale, | 4715 EXPECT_FLOAT_EQ(initial_child_scale * initial_parent_scale, |
4711 child_scale->GetIdealContentsScale()); | 4716 child_scale->GetIdealContentsScale()); |
4712 } | 4717 } |
4713 | 4718 |
4714 TEST_F(LayerTreeHostCommonTest, RenderSurfaceTransformsInHighDPI) { | 4719 TEST_F(LayerTreeHostCommonTest, RenderSurfaceTransformsInHighDPI) { |
4715 LayerImpl* parent = root_layer_for_testing(); | 4720 LayerImpl* parent = root_layer_for_testing(); |
4716 parent->SetBounds(gfx::Size(30, 30)); | 4721 parent->SetBounds(gfx::Size(30, 30)); |
4717 parent->SetDrawsContent(true); | 4722 parent->SetDrawsContent(true); |
4718 parent->Set3dSortingContextId(1); | |
4719 parent->test_properties()->should_flatten_transform = false; | 4723 parent->test_properties()->should_flatten_transform = false; |
| 4724 parent->test_properties()->sorting_context_id = 1; |
4720 | 4725 |
4721 LayerImpl* child = AddChildToRoot<LayerImpl>(); | 4726 LayerImpl* child = AddChildToRoot<LayerImpl>(); |
4722 child->SetBounds(gfx::Size(10, 10)); | 4727 child->SetBounds(gfx::Size(10, 10)); |
4723 child->SetPosition(gfx::PointF(2.f, 2.f)); | 4728 child->SetPosition(gfx::PointF(2.f, 2.f)); |
4724 child->SetDrawsContent(true); | 4729 child->SetDrawsContent(true); |
4725 child->test_properties()->force_render_surface = true; | 4730 child->test_properties()->force_render_surface = true; |
4726 | 4731 |
4727 // This layer should end up in the same surface as child, with the same draw | 4732 // This layer should end up in the same surface as child, with the same draw |
4728 // and screen space transforms. | 4733 // and screen space transforms. |
4729 LayerImpl* duplicate_child_non_owner = AddChild<LayerImpl>(child); | 4734 LayerImpl* duplicate_child_non_owner = AddChild<LayerImpl>(child); |
(...skipping 1151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5881 LayerImpl* child1 = AddChildToRoot<LayerImpl>(); | 5886 LayerImpl* child1 = AddChildToRoot<LayerImpl>(); |
5882 LayerImpl* child2 = AddChild<LayerImpl>(child1); | 5887 LayerImpl* child2 = AddChild<LayerImpl>(child1); |
5883 LayerImpl* child3 = AddChild<LayerImpl>(child2); | 5888 LayerImpl* child3 = AddChild<LayerImpl>(child2); |
5884 root->SetDrawsContent(true); | 5889 root->SetDrawsContent(true); |
5885 | 5890 |
5886 gfx::Size bounds(100, 100); | 5891 gfx::Size bounds(100, 100); |
5887 | 5892 |
5888 root->SetBounds(bounds); | 5893 root->SetBounds(bounds); |
5889 child1->SetBounds(bounds); | 5894 child1->SetBounds(bounds); |
5890 child1->SetDrawsContent(true); | 5895 child1->SetDrawsContent(true); |
5891 child1->Set3dSortingContextId(1); | |
5892 child1->test_properties()->should_flatten_transform = false; | 5896 child1->test_properties()->should_flatten_transform = false; |
| 5897 child1->test_properties()->sorting_context_id = 1; |
5893 child2->SetBounds(bounds); | 5898 child2->SetBounds(bounds); |
5894 child2->SetDrawsContent(true); | 5899 child2->SetDrawsContent(true); |
5895 child2->Set3dSortingContextId(1); | 5900 child2->test_properties()->sorting_context_id = 1; |
5896 child3->SetBounds(bounds); | 5901 child3->SetBounds(bounds); |
5897 child3->SetDrawsContent(true); | 5902 child3->SetDrawsContent(true); |
5898 child3->Set3dSortingContextId(1); | 5903 child3->test_properties()->sorting_context_id = 1; |
5899 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root); | 5904 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root); |
5900 | 5905 |
5901 // Verify which render surfaces were created. | 5906 // Verify which render surfaces were created. |
5902 EXPECT_TRUE(root->has_render_surface()); | 5907 EXPECT_TRUE(root->has_render_surface()); |
5903 EXPECT_FALSE(child1->has_render_surface()); | 5908 EXPECT_FALSE(child1->has_render_surface()); |
5904 EXPECT_TRUE(child2->has_render_surface()); | 5909 EXPECT_TRUE(child2->has_render_surface()); |
5905 EXPECT_FALSE(child3->has_render_surface()); | 5910 EXPECT_FALSE(child3->has_render_surface()); |
5906 } | 5911 } |
5907 | 5912 |
5908 TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) { | 5913 TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) { |
(...skipping 12 matching lines...) Expand all Loading... |
5921 | 5926 |
5922 gfx::Size bounds(100, 100); | 5927 gfx::Size bounds(100, 100); |
5923 | 5928 |
5924 root->SetBounds(bounds); | 5929 root->SetBounds(bounds); |
5925 root->SetDrawsContent(true); | 5930 root->SetDrawsContent(true); |
5926 | 5931 |
5927 // This layer structure normally forces render surface due to preserves3d | 5932 // This layer structure normally forces render surface due to preserves3d |
5928 // behavior. | 5933 // behavior. |
5929 child1->SetBounds(bounds); | 5934 child1->SetBounds(bounds); |
5930 child1->SetDrawsContent(true); | 5935 child1->SetDrawsContent(true); |
5931 child1->Set3dSortingContextId(1); | |
5932 child1->test_properties()->should_flatten_transform = false; | 5936 child1->test_properties()->should_flatten_transform = false; |
| 5937 child1->test_properties()->sorting_context_id = 1; |
5933 child2->SetBounds(bounds); | 5938 child2->SetBounds(bounds); |
5934 child2->SetDrawsContent(true); | 5939 child2->SetDrawsContent(true); |
5935 child2->Set3dSortingContextId(1); | 5940 child2->test_properties()->sorting_context_id = 1; |
5936 child3->SetBounds(bounds); | 5941 child3->SetBounds(bounds); |
5937 child3->SetDrawsContent(true); | 5942 child3->SetDrawsContent(true); |
5938 child3->Set3dSortingContextId(1); | 5943 child3->test_properties()->sorting_context_id = 1; |
5939 | 5944 |
5940 child2->test_properties()->AddChild(std::move(child3)); | 5945 child2->test_properties()->AddChild(std::move(child3)); |
5941 child1->test_properties()->AddChild(std::move(child2)); | 5946 child1->test_properties()->AddChild(std::move(child2)); |
5942 root->test_properties()->AddChild(std::move(child1)); | 5947 root->test_properties()->AddChild(std::move(child1)); |
5943 LayerImpl* root_layer = root.get(); | 5948 LayerImpl* root_layer = root.get(); |
5944 root_layer->layer_tree_impl()->SetRootLayerForTesting(std::move(root)); | 5949 root_layer->layer_tree_impl()->SetRootLayerForTesting(std::move(root)); |
5945 | 5950 |
5946 { | 5951 { |
5947 LayerImplList render_surface_layer_list; | 5952 LayerImplList render_surface_layer_list; |
5948 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(root_layer); | 5953 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(root_layer); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6102 // As there are no 3d rendering contexts, all layers should use their local | 6107 // As there are no 3d rendering contexts, all layers should use their local |
6103 // transform for backface visibility. | 6108 // transform for backface visibility. |
6104 EXPECT_TRUE(root->use_local_transform_for_backface_visibility()); | 6109 EXPECT_TRUE(root->use_local_transform_for_backface_visibility()); |
6105 EXPECT_TRUE(child->use_local_transform_for_backface_visibility()); | 6110 EXPECT_TRUE(child->use_local_transform_for_backface_visibility()); |
6106 EXPECT_TRUE(grand_child->use_local_transform_for_backface_visibility()); | 6111 EXPECT_TRUE(grand_child->use_local_transform_for_backface_visibility()); |
6107 | 6112 |
6108 gfx::Transform rotation_transform; | 6113 gfx::Transform rotation_transform; |
6109 rotation_transform.RotateAboutXAxis(180.0); | 6114 rotation_transform.RotateAboutXAxis(180.0); |
6110 | 6115 |
6111 child->test_properties()->transform = rotation_transform; | 6116 child->test_properties()->transform = rotation_transform; |
6112 child->Set3dSortingContextId(1); | 6117 child->test_properties()->sorting_context_id = 1; |
6113 grand_child->Set3dSortingContextId(1); | 6118 grand_child->test_properties()->sorting_context_id = 1; |
6114 child->layer_tree_impl()->property_trees()->needs_rebuild = true; | 6119 child->layer_tree_impl()->property_trees()->needs_rebuild = true; |
6115 | 6120 |
6116 ExecuteCalculateDrawProperties(root); | 6121 ExecuteCalculateDrawProperties(root); |
6117 EXPECT_EQ(1u, render_surface_layer_list_impl()->size()); | 6122 EXPECT_EQ(1u, render_surface_layer_list_impl()->size()); |
6118 EXPECT_EQ(0u, render_surface_layer_list_impl() | 6123 EXPECT_EQ(0u, render_surface_layer_list_impl() |
6119 ->at(0) | 6124 ->at(0) |
6120 ->render_surface() | 6125 ->render_surface() |
6121 ->layer_list() | 6126 ->layer_list() |
6122 .size()); | 6127 .size()); |
6123 | 6128 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6163 TEST_F(LayerTreeHostCommonTest, TransformAnimationUpdatesBackfaceVisibility) { | 6168 TEST_F(LayerTreeHostCommonTest, TransformAnimationUpdatesBackfaceVisibility) { |
6164 LayerImpl* root = root_layer_for_testing(); | 6169 LayerImpl* root = root_layer_for_testing(); |
6165 LayerImpl* back_facing = AddChild<LayerImpl>(root); | 6170 LayerImpl* back_facing = AddChild<LayerImpl>(root); |
6166 LayerImpl* render_surface1 = AddChild<LayerImpl>(back_facing); | 6171 LayerImpl* render_surface1 = AddChild<LayerImpl>(back_facing); |
6167 LayerImpl* render_surface2 = AddChild<LayerImpl>(back_facing); | 6172 LayerImpl* render_surface2 = AddChild<LayerImpl>(back_facing); |
6168 | 6173 |
6169 gfx::Transform rotate_about_y; | 6174 gfx::Transform rotate_about_y; |
6170 rotate_about_y.RotateAboutYAxis(180.0); | 6175 rotate_about_y.RotateAboutYAxis(180.0); |
6171 | 6176 |
6172 root->SetBounds(gfx::Size(50, 50)); | 6177 root->SetBounds(gfx::Size(50, 50)); |
6173 root->Set3dSortingContextId(1); | |
6174 root->test_properties()->should_flatten_transform = false; | 6178 root->test_properties()->should_flatten_transform = false; |
| 6179 root->test_properties()->sorting_context_id = 1; |
6175 back_facing->test_properties()->transform = rotate_about_y; | 6180 back_facing->test_properties()->transform = rotate_about_y; |
6176 back_facing->SetBounds(gfx::Size(50, 50)); | 6181 back_facing->SetBounds(gfx::Size(50, 50)); |
6177 back_facing->Set3dSortingContextId(1); | |
6178 back_facing->test_properties()->should_flatten_transform = false; | 6182 back_facing->test_properties()->should_flatten_transform = false; |
| 6183 back_facing->test_properties()->sorting_context_id = 1; |
6179 render_surface1->SetBounds(gfx::Size(30, 30)); | 6184 render_surface1->SetBounds(gfx::Size(30, 30)); |
6180 render_surface1->Set3dSortingContextId(1); | |
6181 render_surface1->test_properties()->should_flatten_transform = false; | 6185 render_surface1->test_properties()->should_flatten_transform = false; |
6182 render_surface1->test_properties()->double_sided = false; | 6186 render_surface1->test_properties()->double_sided = false; |
6183 render_surface1->test_properties()->force_render_surface = true; | 6187 render_surface1->test_properties()->force_render_surface = true; |
| 6188 render_surface1->test_properties()->sorting_context_id = 1; |
6184 render_surface2->SetBounds(gfx::Size(30, 30)); | 6189 render_surface2->SetBounds(gfx::Size(30, 30)); |
6185 render_surface2->Set3dSortingContextId(1); | |
6186 render_surface2->test_properties()->should_flatten_transform = false; | 6190 render_surface2->test_properties()->should_flatten_transform = false; |
6187 render_surface2->test_properties()->double_sided = false; | 6191 render_surface2->test_properties()->double_sided = false; |
6188 render_surface2->test_properties()->force_render_surface = true; | 6192 render_surface2->test_properties()->force_render_surface = true; |
| 6193 render_surface2->test_properties()->sorting_context_id = 1; |
6189 ExecuteCalculateDrawProperties(root); | 6194 ExecuteCalculateDrawProperties(root); |
6190 | 6195 |
6191 const EffectTree& tree = | 6196 const EffectTree& tree = |
6192 root->layer_tree_impl()->property_trees()->effect_tree; | 6197 root->layer_tree_impl()->property_trees()->effect_tree; |
6193 EXPECT_TRUE(tree.Node(render_surface1->effect_tree_index()) | 6198 EXPECT_TRUE(tree.Node(render_surface1->effect_tree_index()) |
6194 ->hidden_by_backface_visibility); | 6199 ->hidden_by_backface_visibility); |
6195 EXPECT_TRUE(tree.Node(render_surface2->effect_tree_index()) | 6200 EXPECT_TRUE(tree.Node(render_surface2->effect_tree_index()) |
6196 ->hidden_by_backface_visibility); | 6201 ->hidden_by_backface_visibility); |
6197 | 6202 |
6198 root->layer_tree_impl()->property_trees()->transform_tree.OnTransformAnimated( | 6203 root->layer_tree_impl()->property_trees()->transform_tree.OnTransformAnimated( |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6346 child_of_scroll_child->transform_tree_index())); | 6351 child_of_scroll_child->transform_tree_index())); |
6347 } | 6352 } |
6348 | 6353 |
6349 TEST_F(LayerTreeHostCommonTest, SingularTransformSubtreesDoNotDraw) { | 6354 TEST_F(LayerTreeHostCommonTest, SingularTransformSubtreesDoNotDraw) { |
6350 LayerImpl* root = root_layer_for_testing(); | 6355 LayerImpl* root = root_layer_for_testing(); |
6351 LayerImpl* parent = AddChildToRoot<LayerImpl>(); | 6356 LayerImpl* parent = AddChildToRoot<LayerImpl>(); |
6352 LayerImpl* child = AddChild<LayerImpl>(parent); | 6357 LayerImpl* child = AddChild<LayerImpl>(parent); |
6353 | 6358 |
6354 root->SetBounds(gfx::Size(50, 50)); | 6359 root->SetBounds(gfx::Size(50, 50)); |
6355 root->SetDrawsContent(true); | 6360 root->SetDrawsContent(true); |
6356 root->Set3dSortingContextId(1); | 6361 root->test_properties()->sorting_context_id = 1; |
6357 parent->SetBounds(gfx::Size(30, 30)); | 6362 parent->SetBounds(gfx::Size(30, 30)); |
6358 parent->SetDrawsContent(true); | 6363 parent->SetDrawsContent(true); |
6359 parent->Set3dSortingContextId(1); | |
6360 parent->test_properties()->force_render_surface = true; | 6364 parent->test_properties()->force_render_surface = true; |
| 6365 parent->test_properties()->sorting_context_id = 1; |
6361 child->SetBounds(gfx::Size(20, 20)); | 6366 child->SetBounds(gfx::Size(20, 20)); |
6362 child->SetDrawsContent(true); | 6367 child->SetDrawsContent(true); |
6363 child->Set3dSortingContextId(1); | |
6364 child->test_properties()->force_render_surface = true; | 6368 child->test_properties()->force_render_surface = true; |
| 6369 child->test_properties()->sorting_context_id = 1; |
6365 ExecuteCalculateDrawProperties(root); | 6370 ExecuteCalculateDrawProperties(root); |
6366 | 6371 |
6367 EXPECT_EQ(3u, render_surface_layer_list_impl()->size()); | 6372 EXPECT_EQ(3u, render_surface_layer_list_impl()->size()); |
6368 | 6373 |
6369 gfx::Transform singular_transform; | 6374 gfx::Transform singular_transform; |
6370 singular_transform.Scale3d( | 6375 singular_transform.Scale3d( |
6371 SkDoubleToMScalar(1.0), SkDoubleToMScalar(1.0), SkDoubleToMScalar(0.0)); | 6376 SkDoubleToMScalar(1.0), SkDoubleToMScalar(1.0), SkDoubleToMScalar(0.0)); |
6372 | 6377 |
6373 child->test_properties()->transform = singular_transform; | 6378 child->test_properties()->transform = singular_transform; |
6374 | 6379 |
(...skipping 4203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10578 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); | 10583 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); |
10579 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); | 10584 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); |
10580 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); | 10585 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); |
10581 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); | 10586 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); |
10582 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); | 10587 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); |
10583 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); | 10588 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); |
10584 } | 10589 } |
10585 | 10590 |
10586 } // namespace | 10591 } // namespace |
10587 } // namespace cc | 10592 } // namespace cc |
OLD | NEW |