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 22 matching lines...) Expand all Loading... |
33 #include "cc/test/fake_content_layer_client.h" | 33 #include "cc/test/fake_content_layer_client.h" |
34 #include "cc/test/fake_impl_task_runner_provider.h" | 34 #include "cc/test/fake_impl_task_runner_provider.h" |
35 #include "cc/test/fake_layer_tree_host.h" | 35 #include "cc/test/fake_layer_tree_host.h" |
36 #include "cc/test/fake_layer_tree_host_impl.h" | 36 #include "cc/test/fake_layer_tree_host_impl.h" |
37 #include "cc/test/fake_output_surface.h" | 37 #include "cc/test/fake_output_surface.h" |
38 #include "cc/test/fake_picture_layer.h" | 38 #include "cc/test/fake_picture_layer.h" |
39 #include "cc/test/fake_picture_layer_impl.h" | 39 #include "cc/test/fake_picture_layer_impl.h" |
40 #include "cc/test/geometry_test_utils.h" | 40 #include "cc/test/geometry_test_utils.h" |
41 #include "cc/test/layer_tree_host_common_test.h" | 41 #include "cc/test/layer_tree_host_common_test.h" |
42 #include "cc/test/test_task_graph_runner.h" | 42 #include "cc/test/test_task_graph_runner.h" |
| 43 #include "cc/trees/clip_node.h" |
43 #include "cc/trees/draw_property_utils.h" | 44 #include "cc/trees/draw_property_utils.h" |
| 45 #include "cc/trees/effect_node.h" |
44 #include "cc/trees/layer_tree_impl.h" | 46 #include "cc/trees/layer_tree_impl.h" |
| 47 #include "cc/trees/scroll_node.h" |
45 #include "cc/trees/single_thread_proxy.h" | 48 #include "cc/trees/single_thread_proxy.h" |
46 #include "cc/trees/task_runner_provider.h" | 49 #include "cc/trees/task_runner_provider.h" |
| 50 #include "cc/trees/transform_node.h" |
47 #include "testing/gmock/include/gmock/gmock.h" | 51 #include "testing/gmock/include/gmock/gmock.h" |
48 #include "testing/gtest/include/gtest/gtest.h" | 52 #include "testing/gtest/include/gtest/gtest.h" |
49 #include "third_party/skia/include/effects/SkOffsetImageFilter.h" | 53 #include "third_party/skia/include/effects/SkOffsetImageFilter.h" |
50 #include "ui/gfx/geometry/quad_f.h" | 54 #include "ui/gfx/geometry/quad_f.h" |
51 #include "ui/gfx/geometry/vector2d_conversions.h" | 55 #include "ui/gfx/geometry/vector2d_conversions.h" |
52 #include "ui/gfx/transform.h" | 56 #include "ui/gfx/transform.h" |
53 | 57 |
54 namespace cc { | 58 namespace cc { |
55 namespace { | 59 namespace { |
56 | 60 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 gfx::PointF(10, 10), gfx::Size(100, 100), true, | 186 gfx::PointF(10, 10), gfx::Size(100, 100), true, |
183 false); | 187 false); |
184 child->test_properties()->opacity = 0.f; | 188 child->test_properties()->opacity = 0.f; |
185 ExecuteCalculateDrawProperties(parent); | 189 ExecuteCalculateDrawProperties(parent); |
186 EffectTree& effect_tree = | 190 EffectTree& effect_tree = |
187 parent->layer_tree_impl()->property_trees()->effect_tree; | 191 parent->layer_tree_impl()->property_trees()->effect_tree; |
188 EffectNode* node = effect_tree.Node(child->effect_tree_index()); | 192 EffectNode* node = effect_tree.Node(child->effect_tree_index()); |
189 const int transform_tree_size = parent->layer_tree_impl() | 193 const int transform_tree_size = parent->layer_tree_impl() |
190 ->property_trees() | 194 ->property_trees() |
191 ->transform_tree.next_available_id(); | 195 ->transform_tree.next_available_id(); |
192 EXPECT_LT(node->data.transform_id, transform_tree_size); | 196 EXPECT_LT(node->transform_id, transform_tree_size); |
193 } | 197 } |
194 | 198 |
195 TEST_F(LayerTreeHostCommonTest, TransformsForSingleLayer) { | 199 TEST_F(LayerTreeHostCommonTest, TransformsForSingleLayer) { |
196 gfx::Transform identity_matrix; | 200 gfx::Transform identity_matrix; |
197 LayerImpl* root = root_layer_for_testing(); | 201 LayerImpl* root = root_layer_for_testing(); |
198 LayerImpl* layer = AddChild<LayerImpl>(root); | 202 LayerImpl* layer = AddChild<LayerImpl>(root); |
199 | 203 |
200 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(), | 204 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(), |
201 gfx::PointF(), gfx::Size(1, 2), true, false); | 205 gfx::PointF(), gfx::Size(1, 2), true, false); |
202 | 206 |
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1366 } | 1370 } |
1367 // The layer is fully transparent, but has a background filter, so it | 1371 // The layer is fully transparent, but has a background filter, so it |
1368 // shouldn't be skipped and should be drawn. | 1372 // shouldn't be skipped and should be drawn. |
1369 ASSERT_TRUE(parent->render_surface()); | 1373 ASSERT_TRUE(parent->render_surface()); |
1370 EXPECT_EQ(1U, parent->render_surface()->layer_list().size()); | 1374 EXPECT_EQ(1U, parent->render_surface()->layer_list().size()); |
1371 EXPECT_EQ(gfx::RectF(0, 0, 10, 10), | 1375 EXPECT_EQ(gfx::RectF(0, 0, 10, 10), |
1372 parent->render_surface()->DrawableContentRect()); | 1376 parent->render_surface()->DrawableContentRect()); |
1373 EffectTree& effect_tree = | 1377 EffectTree& effect_tree = |
1374 parent->layer_tree_impl()->property_trees()->effect_tree; | 1378 parent->layer_tree_impl()->property_trees()->effect_tree; |
1375 EffectNode* node = effect_tree.Node(render_surface1->effect_tree_index()); | 1379 EffectNode* node = effect_tree.Node(render_surface1->effect_tree_index()); |
1376 EXPECT_TRUE(node->data.is_drawn); | 1380 EXPECT_TRUE(node->is_drawn); |
1377 | 1381 |
1378 // When parent is transparent, the layer should not be drawn. | 1382 // When parent is transparent, the layer should not be drawn. |
1379 parent->OnOpacityAnimated(0.f); | 1383 parent->OnOpacityAnimated(0.f); |
1380 render_surface1->OnOpacityAnimated(1.f); | 1384 render_surface1->OnOpacityAnimated(1.f); |
1381 render_surface1->set_visible_layer_rect(gfx::Rect()); | 1385 render_surface1->set_visible_layer_rect(gfx::Rect()); |
1382 { | 1386 { |
1383 LayerImplList render_surface_layer_list; | 1387 LayerImplList render_surface_layer_list; |
1384 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 1388 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
1385 parent, parent->bounds(), &render_surface_layer_list); | 1389 parent, parent->bounds(), &render_surface_layer_list); |
1386 inputs.can_adjust_raster_scales = true; | 1390 inputs.can_adjust_raster_scales = true; |
1387 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); | 1391 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); |
1388 } | 1392 } |
1389 | 1393 |
1390 node = effect_tree.Node(render_surface1->effect_tree_index()); | 1394 node = effect_tree.Node(render_surface1->effect_tree_index()); |
1391 EXPECT_FALSE(node->data.is_drawn); | 1395 EXPECT_FALSE(node->is_drawn); |
1392 EXPECT_EQ(gfx::Rect(), render_surface1->visible_layer_rect()); | 1396 EXPECT_EQ(gfx::Rect(), render_surface1->visible_layer_rect()); |
1393 } | 1397 } |
1394 | 1398 |
1395 TEST_F(LayerTreeHostCommonTest, RenderSurfaceListForFilter) { | 1399 TEST_F(LayerTreeHostCommonTest, RenderSurfaceListForFilter) { |
1396 LayerImpl* root = root_layer_for_testing(); | 1400 LayerImpl* root = root_layer_for_testing(); |
1397 LayerImpl* parent = AddChild<LayerImpl>(root); | 1401 LayerImpl* parent = AddChild<LayerImpl>(root); |
1398 LayerImpl* child1 = AddChild<LayerImpl>(parent); | 1402 LayerImpl* child1 = AddChild<LayerImpl>(parent); |
1399 LayerImpl* child2 = AddChild<LayerImpl>(parent); | 1403 LayerImpl* child2 = AddChild<LayerImpl>(parent); |
1400 child1->SetDrawsContent(true); | 1404 child1->SetDrawsContent(true); |
1401 child2->SetDrawsContent(true); | 1405 child2->SetDrawsContent(true); |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1700 false); | 1704 false); |
1701 | 1705 |
1702 grand_child->test_properties()->should_flatten_transform = false; | 1706 grand_child->test_properties()->should_flatten_transform = false; |
1703 | 1707 |
1704 // Only grand_child should preserve 3d. | 1708 // Only grand_child should preserve 3d. |
1705 EXPECT_TRUE(root->test_properties()->should_flatten_transform); | 1709 EXPECT_TRUE(root->test_properties()->should_flatten_transform); |
1706 EXPECT_TRUE(parent->test_properties()->should_flatten_transform); | 1710 EXPECT_TRUE(parent->test_properties()->should_flatten_transform); |
1707 EXPECT_TRUE(child->test_properties()->should_flatten_transform); | 1711 EXPECT_TRUE(child->test_properties()->should_flatten_transform); |
1708 EXPECT_FALSE(grand_child->test_properties()->should_flatten_transform); | 1712 EXPECT_FALSE(grand_child->test_properties()->should_flatten_transform); |
1709 | 1713 |
1710 gfx::Transform expected_child_draw_transform = identity_matrix; | |
1711 gfx::Transform expected_grand_child_draw_transform = identity_matrix; | |
1712 | |
1713 gfx::Transform flattened_rotation_about_y = rotation_about_y_axis; | 1714 gfx::Transform flattened_rotation_about_y = rotation_about_y_axis; |
1714 flattened_rotation_about_y.FlattenTo2d(); | 1715 flattened_rotation_about_y.FlattenTo2d(); |
1715 | 1716 |
1716 ExecuteCalculateDrawProperties(root); | 1717 ExecuteCalculateDrawProperties(root); |
1717 | 1718 |
1718 EXPECT_TRUE(parent->render_surface()); | 1719 EXPECT_TRUE(parent->render_surface()); |
1719 EXPECT_FALSE(child->render_surface()); | 1720 EXPECT_FALSE(child->render_surface()); |
1720 EXPECT_FALSE(grand_child->render_surface()); | 1721 EXPECT_FALSE(grand_child->render_surface()); |
1721 | 1722 |
1722 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, child->DrawTransform()); | 1723 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, child->DrawTransform()); |
(...skipping 1945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3668 gfx::PointF(), gfx::Size(100, 100), false, true, | 3669 gfx::PointF(), gfx::Size(100, 100), false, true, |
3669 false); | 3670 false); |
3670 | 3671 |
3671 ExecuteCalculateDrawProperties(root); | 3672 ExecuteCalculateDrawProperties(root); |
3672 | 3673 |
3673 // Though all layers have invertible transforms, matrix multiplication using | 3674 // Though all layers have invertible transforms, matrix multiplication using |
3674 // floating-point math makes the draw transform uninvertible. | 3675 // floating-point math makes the draw transform uninvertible. |
3675 EXPECT_FALSE(root->layer_tree_impl() | 3676 EXPECT_FALSE(root->layer_tree_impl() |
3676 ->property_trees() | 3677 ->property_trees() |
3677 ->transform_tree.Node(grand_child->transform_tree_index()) | 3678 ->transform_tree.Node(grand_child->transform_tree_index()) |
3678 ->data.ancestors_are_invertible); | 3679 ->ancestors_are_invertible); |
3679 | 3680 |
3680 // CalcDrawProps skips a subtree when a layer's screen space transform is | 3681 // CalcDrawProps skips a subtree when a layer's screen space transform is |
3681 // uninvertible | 3682 // uninvertible |
3682 EXPECT_EQ(gfx::Rect(), grand_child->visible_layer_rect()); | 3683 EXPECT_EQ(gfx::Rect(), grand_child->visible_layer_rect()); |
3683 } | 3684 } |
3684 | 3685 |
3685 TEST_F(LayerTreeHostCommonTest, | 3686 TEST_F(LayerTreeHostCommonTest, |
3686 OcclusionForLayerWithUninvertibleDrawTransform) { | 3687 OcclusionForLayerWithUninvertibleDrawTransform) { |
3687 FakeImplTaskRunnerProvider task_runner_provider; | 3688 FakeImplTaskRunnerProvider task_runner_provider; |
3688 TestSharedBitmapManager shared_bitmap_manager; | 3689 TestSharedBitmapManager shared_bitmap_manager; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3741 ->children[0] | 3742 ->children[0] |
3742 ->test_properties() | 3743 ->test_properties() |
3743 ->children[0]; | 3744 ->children[0]; |
3744 | 3745 |
3745 // Though all layers have invertible transforms, matrix multiplication using | 3746 // Though all layers have invertible transforms, matrix multiplication using |
3746 // floating-point math makes the draw transform uninvertible. | 3747 // floating-point math makes the draw transform uninvertible. |
3747 EXPECT_FALSE( | 3748 EXPECT_FALSE( |
3748 host_impl.active_tree() | 3749 host_impl.active_tree() |
3749 ->property_trees() | 3750 ->property_trees() |
3750 ->transform_tree.Node(grand_child_ptr->transform_tree_index()) | 3751 ->transform_tree.Node(grand_child_ptr->transform_tree_index()) |
3751 ->data.ancestors_are_invertible); | 3752 ->ancestors_are_invertible); |
3752 | 3753 |
3753 // Since |grand_child| has an uninvertible screen space transform, it is | 3754 // Since |grand_child| has an uninvertible screen space transform, it is |
3754 // skipped so | 3755 // skipped so |
3755 // that we are not computing its occlusion_in_content_space. | 3756 // that we are not computing its occlusion_in_content_space. |
3756 gfx::Rect layer_bounds = gfx::Rect(); | 3757 gfx::Rect layer_bounds = gfx::Rect(); |
3757 EXPECT_EQ( | 3758 EXPECT_EQ( |
3758 layer_bounds, | 3759 layer_bounds, |
3759 grand_child_ptr->draw_properties() | 3760 grand_child_ptr->draw_properties() |
3760 .occlusion_in_content_space.GetUnoccludedContentRect(layer_bounds)); | 3761 .occlusion_in_content_space.GetUnoccludedContentRect(layer_bounds)); |
3761 } | 3762 } |
(...skipping 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4986 gfx::Transform expected_screen_space_transform; | 4987 gfx::Transform expected_screen_space_transform; |
4987 expected_screen_space_transform.Scale(device_scale_factor, | 4988 expected_screen_space_transform.Scale(device_scale_factor, |
4988 device_scale_factor); | 4989 device_scale_factor); |
4989 expected_screen_space_transform.Translate(child->position().x(), | 4990 expected_screen_space_transform.Translate(child->position().x(), |
4990 child->position().y()); | 4991 child->position().y()); |
4991 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_screen_space_transform, | 4992 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_screen_space_transform, |
4992 child->ScreenSpaceTransform()); | 4993 child->ScreenSpaceTransform()); |
4993 | 4994 |
4994 gfx::Transform expected_duplicate_child_draw_transform = | 4995 gfx::Transform expected_duplicate_child_draw_transform = |
4995 child->DrawTransform(); | 4996 child->DrawTransform(); |
4996 EXPECT_TRANSFORMATION_MATRIX_EQ(child->DrawTransform(), | 4997 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_duplicate_child_draw_transform, |
4997 duplicate_child_non_owner->DrawTransform()); | 4998 duplicate_child_non_owner->DrawTransform()); |
4998 EXPECT_TRANSFORMATION_MATRIX_EQ( | 4999 EXPECT_TRANSFORMATION_MATRIX_EQ( |
4999 child->ScreenSpaceTransform(), | 5000 child->ScreenSpaceTransform(), |
5000 duplicate_child_non_owner->ScreenSpaceTransform()); | 5001 duplicate_child_non_owner->ScreenSpaceTransform()); |
5001 EXPECT_EQ(child->drawable_content_rect(), | 5002 EXPECT_EQ(child->drawable_content_rect(), |
5002 duplicate_child_non_owner->drawable_content_rect()); | 5003 duplicate_child_non_owner->drawable_content_rect()); |
5003 EXPECT_EQ(child->bounds(), duplicate_child_non_owner->bounds()); | 5004 EXPECT_EQ(child->bounds(), duplicate_child_non_owner->bounds()); |
5004 | 5005 |
5005 gfx::Transform expected_render_surface_draw_transform; | 5006 gfx::Transform expected_render_surface_draw_transform; |
5006 expected_render_surface_draw_transform.Translate( | 5007 expected_render_surface_draw_transform.Translate( |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5200 LayerImplList render_surface_layer_list2; | 5201 LayerImplList render_surface_layer_list2; |
5201 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs2( | 5202 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs2( |
5202 root_layer, root_layer->bounds(), &render_surface_layer_list2); | 5203 root_layer, root_layer->bounds(), &render_surface_layer_list2); |
5203 inputs2.can_adjust_raster_scales = true; | 5204 inputs2.can_adjust_raster_scales = true; |
5204 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs2); | 5205 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs2); |
5205 | 5206 |
5206 LayerImpl* child_ptr = root_layer->layer_tree_impl()->LayerById(2); | 5207 LayerImpl* child_ptr = root_layer->layer_tree_impl()->LayerById(2); |
5207 EffectTree& tree = | 5208 EffectTree& tree = |
5208 root_layer->layer_tree_impl()->property_trees()->effect_tree; | 5209 root_layer->layer_tree_impl()->property_trees()->effect_tree; |
5209 EffectNode* node = tree.Node(child_ptr->effect_tree_index()); | 5210 EffectNode* node = tree.Node(child_ptr->effect_tree_index()); |
5210 EXPECT_FALSE(node->data.is_drawn); | 5211 EXPECT_FALSE(node->is_drawn); |
5211 | 5212 |
5212 // A layer should be drawn and it should contribute to drawn surface when | 5213 // A layer should be drawn and it should contribute to drawn surface when |
5213 // it has animating opacity even if it has opacity 0. | 5214 // it has animating opacity even if it has opacity 0. |
5214 root_layer->test_properties()->opacity = 1.0f; | 5215 root_layer->test_properties()->opacity = 1.0f; |
5215 child_ptr->test_properties()->opacity = 0.0f; | 5216 child_ptr->test_properties()->opacity = 0.0f; |
5216 root_layer->layer_tree_impl()->property_trees()->needs_rebuild = true; | 5217 root_layer->layer_tree_impl()->property_trees()->needs_rebuild = true; |
5217 LayerImplList render_surface_layer_list3; | 5218 LayerImplList render_surface_layer_list3; |
5218 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs3( | 5219 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs3( |
5219 root_layer, root_layer->bounds(), &render_surface_layer_list3); | 5220 root_layer, root_layer->bounds(), &render_surface_layer_list3); |
5220 inputs3.can_adjust_raster_scales = true; | 5221 inputs3.can_adjust_raster_scales = true; |
5221 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs3); | 5222 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs3); |
5222 | 5223 |
5223 child_ptr = root_layer->layer_tree_impl()->LayerById(2); | 5224 child_ptr = root_layer->layer_tree_impl()->LayerById(2); |
5224 tree = root_layer->layer_tree_impl()->property_trees()->effect_tree; | 5225 tree = root_layer->layer_tree_impl()->property_trees()->effect_tree; |
5225 node = tree.Node(child_ptr->effect_tree_index()); | 5226 node = tree.Node(child_ptr->effect_tree_index()); |
5226 EXPECT_TRUE(node->data.is_drawn); | 5227 EXPECT_TRUE(node->is_drawn); |
5227 EXPECT_TRUE(tree.ContributesToDrawnSurface(child_ptr->effect_tree_index())); | 5228 EXPECT_TRUE(tree.ContributesToDrawnSurface(child_ptr->effect_tree_index())); |
5228 | 5229 |
5229 // But if the opacity of the layer remains 0 after activation, it should not | 5230 // But if the opacity of the layer remains 0 after activation, it should not |
5230 // be drawn. | 5231 // be drawn. |
5231 host_impl.ActivateSyncTree(); | 5232 host_impl.ActivateSyncTree(); |
5232 LayerImpl* active_root = host_impl.active_tree()->LayerById(root_layer->id()); | 5233 LayerImpl* active_root = host_impl.active_tree()->LayerById(root_layer->id()); |
5233 LayerImpl* active_child = host_impl.active_tree()->LayerById(child_ptr->id()); | 5234 LayerImpl* active_child = host_impl.active_tree()->LayerById(child_ptr->id()); |
5234 | 5235 |
5235 EffectTree& active_effect_tree = | 5236 EffectTree& active_effect_tree = |
5236 host_impl.active_tree()->property_trees()->effect_tree; | 5237 host_impl.active_tree()->property_trees()->effect_tree; |
5237 EXPECT_TRUE(active_effect_tree.needs_update()); | 5238 EXPECT_TRUE(active_effect_tree.needs_update()); |
5238 | 5239 |
5239 ExecuteCalculateDrawProperties(active_root); | 5240 ExecuteCalculateDrawProperties(active_root); |
5240 | 5241 |
5241 node = active_effect_tree.Node(active_child->effect_tree_index()); | 5242 node = active_effect_tree.Node(active_child->effect_tree_index()); |
5242 EXPECT_FALSE(node->data.is_drawn); | 5243 EXPECT_FALSE(node->is_drawn); |
5243 EXPECT_FALSE(active_effect_tree.ContributesToDrawnSurface( | 5244 EXPECT_FALSE(active_effect_tree.ContributesToDrawnSurface( |
5244 active_child->effect_tree_index())); | 5245 active_child->effect_tree_index())); |
5245 } | 5246 } |
5246 | 5247 |
5247 using LCDTextTestParam = std::tr1::tuple<bool, bool, bool>; | 5248 using LCDTextTestParam = std::tr1::tuple<bool, bool, bool>; |
5248 class LCDTextTest : public LayerTreeHostCommonTestBase, | 5249 class LCDTextTest : public LayerTreeHostCommonTestBase, |
5249 public testing::TestWithParam<LCDTextTestParam> { | 5250 public testing::TestWithParam<LCDTextTestParam> { |
5250 public: | 5251 public: |
5251 LCDTextTest() | 5252 LCDTextTest() |
5252 : LayerTreeHostCommonTestBase(LCDTextTestLayerTreeSettings()), | 5253 : LayerTreeHostCommonTestBase(LCDTextTestLayerTreeSettings()), |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5716 EXPECT_EQ(copy_child_layer->id(), | 5717 EXPECT_EQ(copy_child_layer->id(), |
5717 copy_layer->render_surface()->layer_list().at(1)->id()); | 5718 copy_layer->render_surface()->layer_list().at(1)->id()); |
5718 | 5719 |
5719 // copy_grand_parent, copy_parent shouldn't be drawn because they are hidden, | 5720 // copy_grand_parent, copy_parent shouldn't be drawn because they are hidden, |
5720 // but the copy_layer and copy_child should be drawn for the copy request. | 5721 // but the copy_layer and copy_child should be drawn for the copy request. |
5721 // copy grand child should not be drawn as its hidden even in the copy | 5722 // copy grand child should not be drawn as its hidden even in the copy |
5722 // request. | 5723 // request. |
5723 EffectTree& tree = | 5724 EffectTree& tree = |
5724 root_layer->layer_tree_impl()->property_trees()->effect_tree; | 5725 root_layer->layer_tree_impl()->property_trees()->effect_tree; |
5725 EffectNode* node = tree.Node(copy_grand_parent_layer->effect_tree_index()); | 5726 EffectNode* node = tree.Node(copy_grand_parent_layer->effect_tree_index()); |
5726 EXPECT_FALSE(node->data.is_drawn); | 5727 EXPECT_FALSE(node->is_drawn); |
5727 node = tree.Node(copy_parent_layer->effect_tree_index()); | 5728 node = tree.Node(copy_parent_layer->effect_tree_index()); |
5728 EXPECT_FALSE(node->data.is_drawn); | 5729 EXPECT_FALSE(node->is_drawn); |
5729 node = tree.Node(copy_layer->effect_tree_index()); | 5730 node = tree.Node(copy_layer->effect_tree_index()); |
5730 EXPECT_TRUE(node->data.is_drawn); | 5731 EXPECT_TRUE(node->is_drawn); |
5731 node = tree.Node(copy_child_layer->effect_tree_index()); | 5732 node = tree.Node(copy_child_layer->effect_tree_index()); |
5732 EXPECT_TRUE(node->data.is_drawn); | 5733 EXPECT_TRUE(node->is_drawn); |
5733 node = tree.Node(copy_grand_child_layer->effect_tree_index()); | 5734 node = tree.Node(copy_grand_child_layer->effect_tree_index()); |
5734 EXPECT_FALSE(node->data.is_drawn); | 5735 EXPECT_FALSE(node->is_drawn); |
5735 | 5736 |
5736 // Though copy_layer is drawn, it shouldn't contribute to drawn surface as its | 5737 // Though copy_layer is drawn, it shouldn't contribute to drawn surface as its |
5737 // actually hidden. | 5738 // actually hidden. |
5738 EXPECT_FALSE(copy_layer->render_surface()->contributes_to_drawn_surface()); | 5739 EXPECT_FALSE(copy_layer->render_surface()->contributes_to_drawn_surface()); |
5739 } | 5740 } |
5740 | 5741 |
5741 TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) { | 5742 TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) { |
5742 FakeImplTaskRunnerProvider task_runner_provider; | 5743 FakeImplTaskRunnerProvider task_runner_provider; |
5743 TestSharedBitmapManager shared_bitmap_manager; | 5744 TestSharedBitmapManager shared_bitmap_manager; |
5744 TestTaskGraphRunner task_graph_runner; | 5745 TestTaskGraphRunner task_graph_runner; |
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6643 false, true, true); | 6644 false, true, true); |
6644 | 6645 |
6645 render_surface1->test_properties()->double_sided = false; | 6646 render_surface1->test_properties()->double_sided = false; |
6646 render_surface2->test_properties()->double_sided = false; | 6647 render_surface2->test_properties()->double_sided = false; |
6647 | 6648 |
6648 ExecuteCalculateDrawProperties(root); | 6649 ExecuteCalculateDrawProperties(root); |
6649 | 6650 |
6650 const EffectTree& tree = | 6651 const EffectTree& tree = |
6651 root->layer_tree_impl()->property_trees()->effect_tree; | 6652 root->layer_tree_impl()->property_trees()->effect_tree; |
6652 EXPECT_TRUE(tree.Node(render_surface1->effect_tree_index()) | 6653 EXPECT_TRUE(tree.Node(render_surface1->effect_tree_index()) |
6653 ->data.hidden_by_backface_visibility); | 6654 ->hidden_by_backface_visibility); |
6654 EXPECT_TRUE(tree.Node(render_surface2->effect_tree_index()) | 6655 EXPECT_TRUE(tree.Node(render_surface2->effect_tree_index()) |
6655 ->data.hidden_by_backface_visibility); | 6656 ->hidden_by_backface_visibility); |
6656 | 6657 |
6657 back_facing->OnTransformAnimated(identity_transform); | 6658 back_facing->OnTransformAnimated(identity_transform); |
6658 render_surface2->OnTransformAnimated(rotate_about_y); | 6659 render_surface2->OnTransformAnimated(rotate_about_y); |
6659 ExecuteCalculateDrawProperties(root); | 6660 ExecuteCalculateDrawProperties(root); |
6660 EXPECT_FALSE(tree.Node(render_surface1->effect_tree_index()) | 6661 EXPECT_FALSE(tree.Node(render_surface1->effect_tree_index()) |
6661 ->data.hidden_by_backface_visibility); | 6662 ->hidden_by_backface_visibility); |
6662 EXPECT_TRUE(tree.Node(render_surface2->effect_tree_index()) | 6663 EXPECT_TRUE(tree.Node(render_surface2->effect_tree_index()) |
6663 ->data.hidden_by_backface_visibility); | 6664 ->hidden_by_backface_visibility); |
6664 | 6665 |
6665 render_surface1->OnTransformAnimated(rotate_about_y); | 6666 render_surface1->OnTransformAnimated(rotate_about_y); |
6666 ExecuteCalculateDrawProperties(root); | 6667 ExecuteCalculateDrawProperties(root); |
6667 EXPECT_TRUE(tree.Node(render_surface1->effect_tree_index()) | 6668 EXPECT_TRUE(tree.Node(render_surface1->effect_tree_index()) |
6668 ->data.hidden_by_backface_visibility); | 6669 ->hidden_by_backface_visibility); |
6669 EXPECT_TRUE(tree.Node(render_surface2->effect_tree_index()) | 6670 EXPECT_TRUE(tree.Node(render_surface2->effect_tree_index()) |
6670 ->data.hidden_by_backface_visibility); | 6671 ->hidden_by_backface_visibility); |
6671 } | 6672 } |
6672 | 6673 |
6673 TEST_F(LayerTreeHostCommonTest, ClippedByScrollParent) { | 6674 TEST_F(LayerTreeHostCommonTest, ClippedByScrollParent) { |
6674 // Checks that the simple case (being clipped by a scroll parent that would | 6675 // Checks that the simple case (being clipped by a scroll parent that would |
6675 // have been processed before you anyhow) results in the right clips. | 6676 // have been processed before you anyhow) results in the right clips. |
6676 // | 6677 // |
6677 // + root | 6678 // + root |
6678 // + scroll_parent_border | 6679 // + scroll_parent_border |
6679 // | + scroll_parent_clip | 6680 // | + scroll_parent_clip |
6680 // | + scroll_parent | 6681 // | + scroll_parent |
(...skipping 2644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9325 EXPECT_EQ(transform_node->owner_id, significant_transform->id()); | 9326 EXPECT_EQ(transform_node->owner_id, significant_transform->id()); |
9326 | 9327 |
9327 EXPECT_TRUE(root->has_render_surface()); | 9328 EXPECT_TRUE(root->has_render_surface()); |
9328 EXPECT_FALSE(significant_transform->has_render_surface()); | 9329 EXPECT_FALSE(significant_transform->has_render_surface()); |
9329 EXPECT_TRUE(layer_clips_subtree->has_render_surface()); | 9330 EXPECT_TRUE(layer_clips_subtree->has_render_surface()); |
9330 EXPECT_TRUE(render_surface->has_render_surface()); | 9331 EXPECT_TRUE(render_surface->has_render_surface()); |
9331 EXPECT_FALSE(test_layer->has_render_surface()); | 9332 EXPECT_FALSE(test_layer->has_render_surface()); |
9332 | 9333 |
9333 ClipTree& clip_tree = root->layer_tree_impl()->property_trees()->clip_tree; | 9334 ClipTree& clip_tree = root->layer_tree_impl()->property_trees()->clip_tree; |
9334 ClipNode* clip_node = clip_tree.Node(render_surface->clip_tree_index()); | 9335 ClipNode* clip_node = clip_tree.Node(render_surface->clip_tree_index()); |
9335 EXPECT_FALSE(clip_node->data.applies_local_clip); | 9336 EXPECT_FALSE(clip_node->applies_local_clip); |
9336 EXPECT_EQ(gfx::Rect(20, 20), test_layer->visible_layer_rect()); | 9337 EXPECT_EQ(gfx::Rect(20, 20), test_layer->visible_layer_rect()); |
9337 } | 9338 } |
9338 | 9339 |
9339 TEST_F(LayerTreeHostCommonTest, TransformOfParentClipNodeAncestorOfTarget) { | 9340 TEST_F(LayerTreeHostCommonTest, TransformOfParentClipNodeAncestorOfTarget) { |
9340 // Ensure that when parent clip node's transform is an ancestor of current | 9341 // Ensure that when parent clip node's transform is an ancestor of current |
9341 // clip node's target, clip is 'projected' from parent space to current | 9342 // clip node's target, clip is 'projected' from parent space to current |
9342 // target space and visible rects are calculated correctly. | 9343 // target space and visible rects are calculated correctly. |
9343 LayerImpl* root = root_layer_for_testing(); | 9344 LayerImpl* root = root_layer_for_testing(); |
9344 LayerImpl* clip_layer = AddChild<LayerImpl>(root); | 9345 LayerImpl* clip_layer = AddChild<LayerImpl>(root); |
9345 LayerImpl* target_layer = AddChild<LayerImpl>(clip_layer); | 9346 LayerImpl* target_layer = AddChild<LayerImpl>(clip_layer); |
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9973 // We want layer between the two targets to create a clip node and transform | 9974 // We want layer between the two targets to create a clip node and transform |
9974 // node but it shouldn't create a render surface. | 9975 // node but it shouldn't create a render surface. |
9975 between_targets->SetMasksToBounds(true); | 9976 between_targets->SetMasksToBounds(true); |
9976 between_targets->Set3dSortingContextId(2); | 9977 between_targets->Set3dSortingContextId(2); |
9977 | 9978 |
9978 ExecuteCalculateDrawProperties(root); | 9979 ExecuteCalculateDrawProperties(root); |
9979 | 9980 |
9980 TransformTree& tree = | 9981 TransformTree& tree = |
9981 root->layer_tree_impl()->property_trees()->transform_tree; | 9982 root->layer_tree_impl()->property_trees()->transform_tree; |
9982 TransformNode* node = tree.Node(render_surface1->transform_tree_index()); | 9983 TransformNode* node = tree.Node(render_surface1->transform_tree_index()); |
9983 EXPECT_EQ(node->data.sublayer_scale, gfx::Vector2dF(2.f, 2.f)); | 9984 EXPECT_EQ(node->sublayer_scale, gfx::Vector2dF(2.f, 2.f)); |
9984 | 9985 |
9985 node = tree.Node(between_targets->transform_tree_index()); | 9986 node = tree.Node(between_targets->transform_tree_index()); |
9986 EXPECT_EQ(node->data.sublayer_scale, gfx::Vector2dF(1.f, 1.f)); | 9987 EXPECT_EQ(node->sublayer_scale, gfx::Vector2dF(1.f, 1.f)); |
9987 | 9988 |
9988 node = tree.Node(render_surface2->transform_tree_index()); | 9989 node = tree.Node(render_surface2->transform_tree_index()); |
9989 EXPECT_EQ(node->data.sublayer_scale, gfx::Vector2dF(2.f, 2.f)); | 9990 EXPECT_EQ(node->sublayer_scale, gfx::Vector2dF(2.f, 2.f)); |
9990 | 9991 |
9991 EXPECT_EQ(gfx::Rect(15, 15), test_layer->visible_layer_rect()); | 9992 EXPECT_EQ(gfx::Rect(15, 15), test_layer->visible_layer_rect()); |
9992 } | 9993 } |
9993 | 9994 |
9994 TEST_F(LayerTreeHostCommonTest, LargeTransformTest) { | 9995 TEST_F(LayerTreeHostCommonTest, LargeTransformTest) { |
9995 LayerImpl* root = root_layer_for_testing(); | 9996 LayerImpl* root = root_layer_for_testing(); |
9996 LayerImpl* render_surface1 = AddChild<LayerImpl>(root); | 9997 LayerImpl* render_surface1 = AddChild<LayerImpl>(root); |
9997 LayerImpl* child = AddChild<LayerImpl>(render_surface1); | 9998 LayerImpl* child = AddChild<LayerImpl>(render_surface1); |
9998 | 9999 |
9999 const gfx::Transform identity_matrix; | 10000 const gfx::Transform identity_matrix; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10119 animation->set_fill_mode(Animation::FillMode::NONE); | 10120 animation->set_fill_mode(Animation::FillMode::NONE); |
10120 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); | 10121 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); |
10121 Animation* animation_ptr = animation.get(); | 10122 Animation* animation_ptr = animation.get(); |
10122 AddAnimationToElementWithExistingPlayer(animated->element_id(), timeline(), | 10123 AddAnimationToElementWithExistingPlayer(animated->element_id(), timeline(), |
10123 std::move(animation)); | 10124 std::move(animation)); |
10124 | 10125 |
10125 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 10126 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
10126 | 10127 |
10127 EffectTree& tree = root->layer_tree_host()->property_trees()->effect_tree; | 10128 EffectTree& tree = root->layer_tree_host()->property_trees()->effect_tree; |
10128 EffectNode* node = tree.Node(animated->effect_tree_index()); | 10129 EffectNode* node = tree.Node(animated->effect_tree_index()); |
10129 EXPECT_FALSE(node->data.is_currently_animating_opacity); | 10130 EXPECT_FALSE(node->is_currently_animating_opacity); |
10130 EXPECT_TRUE(node->data.has_potential_opacity_animation); | 10131 EXPECT_TRUE(node->has_potential_opacity_animation); |
10131 | 10132 |
10132 animation_ptr->set_time_offset(base::TimeDelta::FromMilliseconds(0)); | 10133 animation_ptr->set_time_offset(base::TimeDelta::FromMilliseconds(0)); |
10133 root->layer_tree_host()->AnimateLayers( | 10134 root->layer_tree_host()->AnimateLayers( |
10134 base::TimeTicks::FromInternalValue(std::numeric_limits<int64_t>::max())); | 10135 base::TimeTicks::FromInternalValue(std::numeric_limits<int64_t>::max())); |
10135 node = tree.Node(animated->effect_tree_index()); | 10136 node = tree.Node(animated->effect_tree_index()); |
10136 EXPECT_TRUE(node->data.is_currently_animating_opacity); | 10137 EXPECT_TRUE(node->is_currently_animating_opacity); |
10137 EXPECT_TRUE(node->data.has_potential_opacity_animation); | 10138 EXPECT_TRUE(node->has_potential_opacity_animation); |
10138 | 10139 |
10139 player->AbortAnimations(TargetProperty::OPACITY, false /*needs_completion*/); | 10140 player->AbortAnimations(TargetProperty::OPACITY, false /*needs_completion*/); |
10140 node = tree.Node(animated->effect_tree_index()); | 10141 node = tree.Node(animated->effect_tree_index()); |
10141 EXPECT_FALSE(node->data.is_currently_animating_opacity); | 10142 EXPECT_FALSE(node->is_currently_animating_opacity); |
10142 EXPECT_FALSE(node->data.has_potential_opacity_animation); | 10143 EXPECT_FALSE(node->has_potential_opacity_animation); |
10143 } | 10144 } |
10144 | 10145 |
10145 TEST_F(LayerTreeHostCommonTest, TransformAnimationsTrackingTest) { | 10146 TEST_F(LayerTreeHostCommonTest, TransformAnimationsTrackingTest) { |
10146 const gfx::Transform identity_matrix; | 10147 const gfx::Transform identity_matrix; |
10147 scoped_refptr<Layer> root = Layer::Create(); | 10148 scoped_refptr<Layer> root = Layer::Create(); |
10148 scoped_refptr<LayerWithForcedDrawsContent> animated = | 10149 scoped_refptr<LayerWithForcedDrawsContent> animated = |
10149 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 10150 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
10150 root->AddChild(animated); | 10151 root->AddChild(animated); |
10151 | 10152 |
10152 host()->SetRootLayer(root); | 10153 host()->SetRootLayer(root); |
(...skipping 30 matching lines...) Expand all Loading... |
10183 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); | 10184 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); |
10184 Animation* animation_ptr = animation.get(); | 10185 Animation* animation_ptr = animation.get(); |
10185 AddAnimationToElementWithExistingPlayer(animated->element_id(), timeline(), | 10186 AddAnimationToElementWithExistingPlayer(animated->element_id(), timeline(), |
10186 std::move(animation)); | 10187 std::move(animation)); |
10187 | 10188 |
10188 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 10189 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
10189 | 10190 |
10190 TransformTree& tree = | 10191 TransformTree& tree = |
10191 root->layer_tree_host()->property_trees()->transform_tree; | 10192 root->layer_tree_host()->property_trees()->transform_tree; |
10192 TransformNode* node = tree.Node(animated->transform_tree_index()); | 10193 TransformNode* node = tree.Node(animated->transform_tree_index()); |
10193 EXPECT_FALSE(node->data.is_currently_animating); | 10194 EXPECT_FALSE(node->is_currently_animating); |
10194 EXPECT_TRUE(node->data.has_potential_animation); | 10195 EXPECT_TRUE(node->has_potential_animation); |
10195 | 10196 |
10196 animation_ptr->set_time_offset(base::TimeDelta::FromMilliseconds(0)); | 10197 animation_ptr->set_time_offset(base::TimeDelta::FromMilliseconds(0)); |
10197 root->layer_tree_host()->AnimateLayers( | 10198 root->layer_tree_host()->AnimateLayers( |
10198 base::TimeTicks::FromInternalValue(std::numeric_limits<int64_t>::max())); | 10199 base::TimeTicks::FromInternalValue(std::numeric_limits<int64_t>::max())); |
10199 node = tree.Node(animated->transform_tree_index()); | 10200 node = tree.Node(animated->transform_tree_index()); |
10200 EXPECT_TRUE(node->data.is_currently_animating); | 10201 EXPECT_TRUE(node->is_currently_animating); |
10201 EXPECT_TRUE(node->data.has_potential_animation); | 10202 EXPECT_TRUE(node->has_potential_animation); |
10202 | 10203 |
10203 player->AbortAnimations(TargetProperty::TRANSFORM, | 10204 player->AbortAnimations(TargetProperty::TRANSFORM, |
10204 false /*needs_completion*/); | 10205 false /*needs_completion*/); |
10205 node = tree.Node(animated->transform_tree_index()); | 10206 node = tree.Node(animated->transform_tree_index()); |
10206 EXPECT_FALSE(node->data.is_currently_animating); | 10207 EXPECT_FALSE(node->is_currently_animating); |
10207 EXPECT_FALSE(node->data.has_potential_animation); | 10208 EXPECT_FALSE(node->has_potential_animation); |
10208 } | 10209 } |
10209 | 10210 |
10210 TEST_F(LayerTreeHostCommonTest, SerializeScrollUpdateInfo) { | 10211 TEST_F(LayerTreeHostCommonTest, SerializeScrollUpdateInfo) { |
10211 LayerTreeHostCommon::ScrollUpdateInfo scroll; | 10212 LayerTreeHostCommon::ScrollUpdateInfo scroll; |
10212 scroll.layer_id = 2; | 10213 scroll.layer_id = 2; |
10213 scroll.scroll_delta = gfx::Vector2d(5, 10); | 10214 scroll.scroll_delta = gfx::Vector2d(5, 10); |
10214 | 10215 |
10215 proto::ScrollUpdateInfo proto; | 10216 proto::ScrollUpdateInfo proto; |
10216 scroll.ToProtobuf(&proto); | 10217 scroll.ToProtobuf(&proto); |
10217 LayerTreeHostCommon::ScrollUpdateInfo new_scroll; | 10218 LayerTreeHostCommon::ScrollUpdateInfo new_scroll; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10334 // Property tree root | 10335 // Property tree root |
10335 ScrollTree& scroll_tree = host()->property_trees()->scroll_tree; | 10336 ScrollTree& scroll_tree = host()->property_trees()->scroll_tree; |
10336 PropertyTrees property_trees; | 10337 PropertyTrees property_trees; |
10337 property_trees.is_main_thread = true; | 10338 property_trees.is_main_thread = true; |
10338 property_trees.is_active = false; | 10339 property_trees.is_active = false; |
10339 ScrollTree& expected_scroll_tree = property_trees.scroll_tree; | 10340 ScrollTree& expected_scroll_tree = property_trees.scroll_tree; |
10340 ScrollNode* property_tree_root = expected_scroll_tree.Node(0); | 10341 ScrollNode* property_tree_root = expected_scroll_tree.Node(0); |
10341 property_tree_root->id = kRootPropertyTreeNodeId; | 10342 property_tree_root->id = kRootPropertyTreeNodeId; |
10342 property_tree_root->parent_id = kInvalidPropertyTreeNodeId; | 10343 property_tree_root->parent_id = kInvalidPropertyTreeNodeId; |
10343 property_tree_root->owner_id = kInvalidPropertyTreeNodeId; | 10344 property_tree_root->owner_id = kInvalidPropertyTreeNodeId; |
10344 property_tree_root->data.scrollable = false; | 10345 property_tree_root->scrollable = false; |
10345 property_tree_root->data.main_thread_scrolling_reasons = | 10346 property_tree_root->main_thread_scrolling_reasons = |
10346 MainThreadScrollingReason::kNotScrollingOnMain; | 10347 MainThreadScrollingReason::kNotScrollingOnMain; |
10347 property_tree_root->data.contains_non_fast_scrollable_region = false; | 10348 property_tree_root->contains_non_fast_scrollable_region = false; |
10348 property_tree_root->data.transform_id = kRootPropertyTreeNodeId; | 10349 property_tree_root->transform_id = kRootPropertyTreeNodeId; |
10349 | 10350 |
10350 // The node owned by root1 | 10351 // The node owned by root1 |
10351 ScrollNode scroll_root1; | 10352 ScrollNode scroll_root1; |
10352 scroll_root1.id = 1; | 10353 scroll_root1.id = 1; |
10353 scroll_root1.owner_id = root1->id(); | 10354 scroll_root1.owner_id = root1->id(); |
10354 scroll_root1.data.user_scrollable_horizontal = true; | 10355 scroll_root1.user_scrollable_horizontal = true; |
10355 scroll_root1.data.user_scrollable_vertical = true; | 10356 scroll_root1.user_scrollable_vertical = true; |
10356 scroll_root1.data.transform_id = root1->transform_tree_index(); | 10357 scroll_root1.transform_id = root1->transform_tree_index(); |
10357 expected_scroll_tree.Insert(scroll_root1, 0); | 10358 expected_scroll_tree.Insert(scroll_root1, 0); |
10358 | 10359 |
10359 // The node owned by parent2 | 10360 // The node owned by parent2 |
10360 ScrollNode scroll_parent2; | 10361 ScrollNode scroll_parent2; |
10361 scroll_parent2.id = 2; | 10362 scroll_parent2.id = 2; |
10362 scroll_parent2.owner_id = parent2->id(); | 10363 scroll_parent2.owner_id = parent2->id(); |
10363 scroll_parent2.data.scrollable = true; | 10364 scroll_parent2.scrollable = true; |
10364 scroll_parent2.data.main_thread_scrolling_reasons = | 10365 scroll_parent2.main_thread_scrolling_reasons = |
10365 parent2->main_thread_scrolling_reasons(); | 10366 parent2->main_thread_scrolling_reasons(); |
10366 scroll_parent2.data.scroll_clip_layer_bounds = root1->bounds(); | 10367 scroll_parent2.scroll_clip_layer_bounds = root1->bounds(); |
10367 scroll_parent2.data.bounds = parent2->bounds(); | 10368 scroll_parent2.bounds = parent2->bounds(); |
10368 scroll_parent2.data.max_scroll_offset_affected_by_page_scale = true; | 10369 scroll_parent2.max_scroll_offset_affected_by_page_scale = true; |
10369 scroll_parent2.data.is_inner_viewport_scroll_layer = true; | 10370 scroll_parent2.is_inner_viewport_scroll_layer = true; |
10370 scroll_parent2.data.user_scrollable_horizontal = true; | 10371 scroll_parent2.user_scrollable_horizontal = true; |
10371 scroll_parent2.data.user_scrollable_vertical = true; | 10372 scroll_parent2.user_scrollable_vertical = true; |
10372 scroll_parent2.data.transform_id = parent2->transform_tree_index(); | 10373 scroll_parent2.transform_id = parent2->transform_tree_index(); |
10373 expected_scroll_tree.Insert(scroll_parent2, 1); | 10374 expected_scroll_tree.Insert(scroll_parent2, 1); |
10374 | 10375 |
10375 // The node owned by child6 | 10376 // The node owned by child6 |
10376 ScrollNode scroll_child6; | 10377 ScrollNode scroll_child6; |
10377 scroll_child6.id = 3; | 10378 scroll_child6.id = 3; |
10378 scroll_child6.owner_id = child6->id(); | 10379 scroll_child6.owner_id = child6->id(); |
10379 scroll_child6.data.main_thread_scrolling_reasons = | 10380 scroll_child6.main_thread_scrolling_reasons = |
10380 child6->main_thread_scrolling_reasons(); | 10381 child6->main_thread_scrolling_reasons(); |
10381 scroll_child6.data.should_flatten = true; | 10382 scroll_child6.should_flatten = true; |
10382 scroll_child6.data.user_scrollable_horizontal = true; | 10383 scroll_child6.user_scrollable_horizontal = true; |
10383 scroll_child6.data.user_scrollable_vertical = true; | 10384 scroll_child6.user_scrollable_vertical = true; |
10384 scroll_child6.data.transform_id = child6->transform_tree_index(); | 10385 scroll_child6.transform_id = child6->transform_tree_index(); |
10385 expected_scroll_tree.Insert(scroll_child6, 2); | 10386 expected_scroll_tree.Insert(scroll_child6, 2); |
10386 | 10387 |
10387 // The node owned by child7, child7 also owns a transform node | 10388 // The node owned by child7, child7 also owns a transform node |
10388 ScrollNode scroll_child7; | 10389 ScrollNode scroll_child7; |
10389 scroll_child7.id = 4; | 10390 scroll_child7.id = 4; |
10390 scroll_child7.owner_id = child7->id(); | 10391 scroll_child7.owner_id = child7->id(); |
10391 scroll_child7.data.scrollable = true; | 10392 scroll_child7.scrollable = true; |
10392 scroll_child7.data.scroll_clip_layer_bounds = parent3->bounds(); | 10393 scroll_child7.scroll_clip_layer_bounds = parent3->bounds(); |
10393 scroll_child7.data.bounds = child7->bounds(); | 10394 scroll_child7.bounds = child7->bounds(); |
10394 scroll_child7.data.user_scrollable_horizontal = true; | 10395 scroll_child7.user_scrollable_horizontal = true; |
10395 scroll_child7.data.user_scrollable_vertical = true; | 10396 scroll_child7.user_scrollable_vertical = true; |
10396 scroll_child7.data.transform_id = child7->transform_tree_index(); | 10397 scroll_child7.transform_id = child7->transform_tree_index(); |
10397 expected_scroll_tree.Insert(scroll_child7, 1); | 10398 expected_scroll_tree.Insert(scroll_child7, 1); |
10398 | 10399 |
10399 // The node owned by grand_child11, grand_child11 also owns a transform node | 10400 // The node owned by grand_child11, grand_child11 also owns a transform node |
10400 ScrollNode scroll_grand_child11; | 10401 ScrollNode scroll_grand_child11; |
10401 scroll_grand_child11.id = 5; | 10402 scroll_grand_child11.id = 5; |
10402 scroll_grand_child11.owner_id = grand_child11->id(); | 10403 scroll_grand_child11.owner_id = grand_child11->id(); |
10403 scroll_grand_child11.data.scrollable = true; | 10404 scroll_grand_child11.scrollable = true; |
10404 scroll_grand_child11.data.user_scrollable_horizontal = true; | 10405 scroll_grand_child11.user_scrollable_horizontal = true; |
10405 scroll_grand_child11.data.user_scrollable_vertical = true; | 10406 scroll_grand_child11.user_scrollable_vertical = true; |
10406 scroll_grand_child11.data.transform_id = | 10407 scroll_grand_child11.transform_id = grand_child11->transform_tree_index(); |
10407 grand_child11->transform_tree_index(); | |
10408 expected_scroll_tree.Insert(scroll_grand_child11, 4); | 10408 expected_scroll_tree.Insert(scroll_grand_child11, 4); |
10409 | 10409 |
10410 // The node owned by parent5 | 10410 // The node owned by parent5 |
10411 ScrollNode scroll_parent5; | 10411 ScrollNode scroll_parent5; |
10412 scroll_parent5.id = 8; | 10412 scroll_parent5.id = 8; |
10413 scroll_parent5.owner_id = parent5->id(); | 10413 scroll_parent5.owner_id = parent5->id(); |
10414 scroll_parent5.data.contains_non_fast_scrollable_region = true; | 10414 scroll_parent5.contains_non_fast_scrollable_region = true; |
10415 scroll_parent5.data.bounds = gfx::Size(10, 10); | 10415 scroll_parent5.bounds = gfx::Size(10, 10); |
10416 scroll_parent5.data.should_flatten = true; | 10416 scroll_parent5.should_flatten = true; |
10417 scroll_parent5.data.user_scrollable_horizontal = true; | 10417 scroll_parent5.user_scrollable_horizontal = true; |
10418 scroll_parent5.data.user_scrollable_vertical = true; | 10418 scroll_parent5.user_scrollable_vertical = true; |
10419 scroll_parent5.data.transform_id = parent5->transform_tree_index(); | 10419 scroll_parent5.transform_id = parent5->transform_tree_index(); |
10420 expected_scroll_tree.Insert(scroll_parent5, 1); | 10420 expected_scroll_tree.Insert(scroll_parent5, 1); |
10421 | 10421 |
10422 expected_scroll_tree.SetScrollOffset(parent2->id(), gfx::ScrollOffset(0, 0)); | 10422 expected_scroll_tree.SetScrollOffset(parent2->id(), gfx::ScrollOffset(0, 0)); |
10423 expected_scroll_tree.SetScrollOffset(child7->id(), gfx::ScrollOffset(0, 0)); | 10423 expected_scroll_tree.SetScrollOffset(child7->id(), gfx::ScrollOffset(0, 0)); |
10424 expected_scroll_tree.SetScrollOffset(grand_child11->id(), | 10424 expected_scroll_tree.SetScrollOffset(grand_child11->id(), |
10425 gfx::ScrollOffset(0, 0)); | 10425 gfx::ScrollOffset(0, 0)); |
10426 expected_scroll_tree.set_needs_update(false); | 10426 expected_scroll_tree.set_needs_update(false); |
10427 | 10427 |
10428 EXPECT_EQ(expected_scroll_tree, scroll_tree); | 10428 EXPECT_EQ(expected_scroll_tree, scroll_tree); |
10429 | 10429 |
10430 // Check other layers' scroll_tree_index | 10430 // Check other layers' scroll_tree_index |
10431 EXPECT_EQ(scroll_root1.id, page_scale_layer->scroll_tree_index()); | 10431 EXPECT_EQ(scroll_root1.id, page_scale_layer->scroll_tree_index()); |
10432 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); | 10432 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); |
10433 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); | 10433 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); |
10434 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); | 10434 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); |
10435 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); | 10435 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); |
10436 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); | 10436 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); |
10437 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); | 10437 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); |
10438 } | 10438 } |
10439 | 10439 |
10440 } // namespace | 10440 } // namespace |
10441 } // namespace cc | 10441 } // namespace cc |
OLD | NEW |