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 2267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3669 gfx::PointF(), gfx::Size(100, 100), false, true, | 3673 gfx::PointF(), gfx::Size(100, 100), false, true, |
3670 false); | 3674 false); |
3671 | 3675 |
3672 ExecuteCalculateDrawProperties(root); | 3676 ExecuteCalculateDrawProperties(root); |
3673 | 3677 |
3674 // Though all layers have invertible transforms, matrix multiplication using | 3678 // Though all layers have invertible transforms, matrix multiplication using |
3675 // floating-point math makes the draw transform uninvertible. | 3679 // floating-point math makes the draw transform uninvertible. |
3676 EXPECT_FALSE(root->layer_tree_impl() | 3680 EXPECT_FALSE(root->layer_tree_impl() |
3677 ->property_trees() | 3681 ->property_trees() |
3678 ->transform_tree.Node(grand_child->transform_tree_index()) | 3682 ->transform_tree.Node(grand_child->transform_tree_index()) |
3679 ->data.ancestors_are_invertible); | 3683 ->ancestors_are_invertible); |
3680 | 3684 |
3681 // CalcDrawProps skips a subtree when a layer's screen space transform is | 3685 // CalcDrawProps skips a subtree when a layer's screen space transform is |
3682 // uninvertible | 3686 // uninvertible |
3683 EXPECT_EQ(gfx::Rect(), grand_child->visible_layer_rect()); | 3687 EXPECT_EQ(gfx::Rect(), grand_child->visible_layer_rect()); |
3684 } | 3688 } |
3685 | 3689 |
3686 TEST_F(LayerTreeHostCommonTest, | 3690 TEST_F(LayerTreeHostCommonTest, |
3687 OcclusionForLayerWithUninvertibleDrawTransform) { | 3691 OcclusionForLayerWithUninvertibleDrawTransform) { |
3688 FakeImplTaskRunnerProvider task_runner_provider; | 3692 FakeImplTaskRunnerProvider task_runner_provider; |
3689 TestSharedBitmapManager shared_bitmap_manager; | 3693 TestSharedBitmapManager shared_bitmap_manager; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3742 ->children[0] | 3746 ->children[0] |
3743 ->test_properties() | 3747 ->test_properties() |
3744 ->children[0]; | 3748 ->children[0]; |
3745 | 3749 |
3746 // Though all layers have invertible transforms, matrix multiplication using | 3750 // Though all layers have invertible transforms, matrix multiplication using |
3747 // floating-point math makes the draw transform uninvertible. | 3751 // floating-point math makes the draw transform uninvertible. |
3748 EXPECT_FALSE( | 3752 EXPECT_FALSE( |
3749 host_impl.active_tree() | 3753 host_impl.active_tree() |
3750 ->property_trees() | 3754 ->property_trees() |
3751 ->transform_tree.Node(grand_child_ptr->transform_tree_index()) | 3755 ->transform_tree.Node(grand_child_ptr->transform_tree_index()) |
3752 ->data.ancestors_are_invertible); | 3756 ->ancestors_are_invertible); |
3753 | 3757 |
3754 // Since |grand_child| has an uninvertible screen space transform, it is | 3758 // Since |grand_child| has an uninvertible screen space transform, it is |
3755 // skipped so | 3759 // skipped so |
3756 // that we are not computing its occlusion_in_content_space. | 3760 // that we are not computing its occlusion_in_content_space. |
3757 gfx::Rect layer_bounds = gfx::Rect(); | 3761 gfx::Rect layer_bounds = gfx::Rect(); |
3758 EXPECT_EQ( | 3762 EXPECT_EQ( |
3759 layer_bounds, | 3763 layer_bounds, |
3760 grand_child_ptr->draw_properties() | 3764 grand_child_ptr->draw_properties() |
3761 .occlusion_in_content_space.GetUnoccludedContentRect(layer_bounds)); | 3765 .occlusion_in_content_space.GetUnoccludedContentRect(layer_bounds)); |
3762 } | 3766 } |
(...skipping 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4988 gfx::Transform expected_screen_space_transform; | 4992 gfx::Transform expected_screen_space_transform; |
4989 expected_screen_space_transform.Scale(device_scale_factor, | 4993 expected_screen_space_transform.Scale(device_scale_factor, |
4990 device_scale_factor); | 4994 device_scale_factor); |
4991 expected_screen_space_transform.Translate(child->position().x(), | 4995 expected_screen_space_transform.Translate(child->position().x(), |
4992 child->position().y()); | 4996 child->position().y()); |
4993 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_screen_space_transform, | 4997 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_screen_space_transform, |
4994 child->ScreenSpaceTransform()); | 4998 child->ScreenSpaceTransform()); |
4995 | 4999 |
4996 gfx::Transform expected_duplicate_child_draw_transform = | 5000 gfx::Transform expected_duplicate_child_draw_transform = |
4997 child->DrawTransform(); | 5001 child->DrawTransform(); |
4998 EXPECT_TRANSFORMATION_MATRIX_EQ(child->DrawTransform(), | 5002 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_duplicate_child_draw_transform, |
4999 duplicate_child_non_owner->DrawTransform()); | 5003 duplicate_child_non_owner->DrawTransform()); |
5000 EXPECT_TRANSFORMATION_MATRIX_EQ( | 5004 EXPECT_TRANSFORMATION_MATRIX_EQ( |
5001 child->ScreenSpaceTransform(), | 5005 child->ScreenSpaceTransform(), |
5002 duplicate_child_non_owner->ScreenSpaceTransform()); | 5006 duplicate_child_non_owner->ScreenSpaceTransform()); |
5003 EXPECT_EQ(child->drawable_content_rect(), | 5007 EXPECT_EQ(child->drawable_content_rect(), |
5004 duplicate_child_non_owner->drawable_content_rect()); | 5008 duplicate_child_non_owner->drawable_content_rect()); |
5005 EXPECT_EQ(child->bounds(), duplicate_child_non_owner->bounds()); | 5009 EXPECT_EQ(child->bounds(), duplicate_child_non_owner->bounds()); |
5006 | 5010 |
5007 gfx::Transform expected_render_surface_draw_transform; | 5011 gfx::Transform expected_render_surface_draw_transform; |
5008 expected_render_surface_draw_transform.Translate( | 5012 expected_render_surface_draw_transform.Translate( |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5202 LayerImplList render_surface_layer_list2; | 5206 LayerImplList render_surface_layer_list2; |
5203 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs2( | 5207 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs2( |
5204 root_layer, root_layer->bounds(), &render_surface_layer_list2); | 5208 root_layer, root_layer->bounds(), &render_surface_layer_list2); |
5205 inputs2.can_adjust_raster_scales = true; | 5209 inputs2.can_adjust_raster_scales = true; |
5206 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs2); | 5210 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs2); |
5207 | 5211 |
5208 LayerImpl* child_ptr = root_layer->layer_tree_impl()->LayerById(2); | 5212 LayerImpl* child_ptr = root_layer->layer_tree_impl()->LayerById(2); |
5209 EffectTree& tree = | 5213 EffectTree& tree = |
5210 root_layer->layer_tree_impl()->property_trees()->effect_tree; | 5214 root_layer->layer_tree_impl()->property_trees()->effect_tree; |
5211 EffectNode* node = tree.Node(child_ptr->effect_tree_index()); | 5215 EffectNode* node = tree.Node(child_ptr->effect_tree_index()); |
5212 EXPECT_FALSE(node->data.is_drawn); | 5216 EXPECT_FALSE(node->is_drawn); |
5213 | 5217 |
5214 // A layer should be drawn and it should contribute to drawn surface when | 5218 // A layer should be drawn and it should contribute to drawn surface when |
5215 // it has animating opacity even if it has opacity 0. | 5219 // it has animating opacity even if it has opacity 0. |
5216 root_layer->test_properties()->opacity = 1.0f; | 5220 root_layer->test_properties()->opacity = 1.0f; |
5217 child_ptr->test_properties()->opacity = 0.0f; | 5221 child_ptr->test_properties()->opacity = 0.0f; |
5218 root_layer->layer_tree_impl()->property_trees()->needs_rebuild = true; | 5222 root_layer->layer_tree_impl()->property_trees()->needs_rebuild = true; |
5219 LayerImplList render_surface_layer_list3; | 5223 LayerImplList render_surface_layer_list3; |
5220 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs3( | 5224 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs3( |
5221 root_layer, root_layer->bounds(), &render_surface_layer_list3); | 5225 root_layer, root_layer->bounds(), &render_surface_layer_list3); |
5222 inputs3.can_adjust_raster_scales = true; | 5226 inputs3.can_adjust_raster_scales = true; |
5223 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs3); | 5227 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs3); |
5224 | 5228 |
5225 child_ptr = root_layer->layer_tree_impl()->LayerById(2); | 5229 child_ptr = root_layer->layer_tree_impl()->LayerById(2); |
5226 tree = root_layer->layer_tree_impl()->property_trees()->effect_tree; | 5230 tree = root_layer->layer_tree_impl()->property_trees()->effect_tree; |
5227 node = tree.Node(child_ptr->effect_tree_index()); | 5231 node = tree.Node(child_ptr->effect_tree_index()); |
5228 EXPECT_TRUE(node->data.is_drawn); | 5232 EXPECT_TRUE(node->is_drawn); |
5229 EXPECT_TRUE(tree.ContributesToDrawnSurface(child_ptr->effect_tree_index())); | 5233 EXPECT_TRUE(tree.ContributesToDrawnSurface(child_ptr->effect_tree_index())); |
5230 | 5234 |
5231 // But if the opacity of the layer remains 0 after activation, it should not | 5235 // But if the opacity of the layer remains 0 after activation, it should not |
5232 // be drawn. | 5236 // be drawn. |
5233 host_impl.ActivateSyncTree(); | 5237 host_impl.ActivateSyncTree(); |
5234 host_impl.active_tree()->SetRootLayerFromLayerListForTesting(); | 5238 host_impl.active_tree()->SetRootLayerFromLayerListForTesting(); |
5235 LayerImpl* active_root = host_impl.active_tree()->root_layer_for_testing(); | 5239 LayerImpl* active_root = host_impl.active_tree()->root_layer_for_testing(); |
5236 LayerImpl* active_child = host_impl.active_tree()->LayerById(child_ptr->id()); | 5240 LayerImpl* active_child = host_impl.active_tree()->LayerById(child_ptr->id()); |
5237 | 5241 |
5238 EffectTree& active_effect_tree = | 5242 EffectTree& active_effect_tree = |
5239 host_impl.active_tree()->property_trees()->effect_tree; | 5243 host_impl.active_tree()->property_trees()->effect_tree; |
5240 EXPECT_TRUE(active_effect_tree.needs_update()); | 5244 EXPECT_TRUE(active_effect_tree.needs_update()); |
5241 | 5245 |
5242 ExecuteCalculateDrawProperties(active_root); | 5246 ExecuteCalculateDrawProperties(active_root); |
5243 | 5247 |
5244 node = active_effect_tree.Node(active_child->effect_tree_index()); | 5248 node = active_effect_tree.Node(active_child->effect_tree_index()); |
5245 EXPECT_FALSE(node->data.is_drawn); | 5249 EXPECT_FALSE(node->is_drawn); |
5246 EXPECT_FALSE(active_effect_tree.ContributesToDrawnSurface( | 5250 EXPECT_FALSE(active_effect_tree.ContributesToDrawnSurface( |
5247 active_child->effect_tree_index())); | 5251 active_child->effect_tree_index())); |
5248 } | 5252 } |
5249 | 5253 |
5250 using LCDTextTestParam = std::tr1::tuple<bool, bool, bool>; | 5254 using LCDTextTestParam = std::tr1::tuple<bool, bool, bool>; |
5251 class LCDTextTest : public LayerTreeHostCommonTestBase, | 5255 class LCDTextTest : public LayerTreeHostCommonTestBase, |
5252 public testing::TestWithParam<LCDTextTestParam> { | 5256 public testing::TestWithParam<LCDTextTestParam> { |
5253 public: | 5257 public: |
5254 LCDTextTest() | 5258 LCDTextTest() |
5255 : LayerTreeHostCommonTestBase(LCDTextTestLayerTreeSettings()), | 5259 : LayerTreeHostCommonTestBase(LCDTextTestLayerTreeSettings()), |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5719 EXPECT_EQ(copy_child_layer->id(), | 5723 EXPECT_EQ(copy_child_layer->id(), |
5720 copy_layer->render_surface()->layer_list().at(1)->id()); | 5724 copy_layer->render_surface()->layer_list().at(1)->id()); |
5721 | 5725 |
5722 // copy_grand_parent, copy_parent shouldn't be drawn because they are hidden, | 5726 // copy_grand_parent, copy_parent shouldn't be drawn because they are hidden, |
5723 // but the copy_layer and copy_child should be drawn for the copy request. | 5727 // but the copy_layer and copy_child should be drawn for the copy request. |
5724 // copy grand child should not be drawn as its hidden even in the copy | 5728 // copy grand child should not be drawn as its hidden even in the copy |
5725 // request. | 5729 // request. |
5726 EffectTree& tree = | 5730 EffectTree& tree = |
5727 root_layer->layer_tree_impl()->property_trees()->effect_tree; | 5731 root_layer->layer_tree_impl()->property_trees()->effect_tree; |
5728 EffectNode* node = tree.Node(copy_grand_parent_layer->effect_tree_index()); | 5732 EffectNode* node = tree.Node(copy_grand_parent_layer->effect_tree_index()); |
5729 EXPECT_FALSE(node->data.is_drawn); | 5733 EXPECT_FALSE(node->is_drawn); |
5730 node = tree.Node(copy_parent_layer->effect_tree_index()); | 5734 node = tree.Node(copy_parent_layer->effect_tree_index()); |
5731 EXPECT_FALSE(node->data.is_drawn); | 5735 EXPECT_FALSE(node->is_drawn); |
5732 node = tree.Node(copy_layer->effect_tree_index()); | 5736 node = tree.Node(copy_layer->effect_tree_index()); |
5733 EXPECT_TRUE(node->data.is_drawn); | 5737 EXPECT_TRUE(node->is_drawn); |
5734 node = tree.Node(copy_child_layer->effect_tree_index()); | 5738 node = tree.Node(copy_child_layer->effect_tree_index()); |
5735 EXPECT_TRUE(node->data.is_drawn); | 5739 EXPECT_TRUE(node->is_drawn); |
5736 node = tree.Node(copy_grand_child_layer->effect_tree_index()); | 5740 node = tree.Node(copy_grand_child_layer->effect_tree_index()); |
5737 EXPECT_FALSE(node->data.is_drawn); | 5741 EXPECT_FALSE(node->is_drawn); |
5738 | 5742 |
5739 // Though copy_layer is drawn, it shouldn't contribute to drawn surface as its | 5743 // Though copy_layer is drawn, it shouldn't contribute to drawn surface as its |
5740 // actually hidden. | 5744 // actually hidden. |
5741 EXPECT_FALSE(copy_layer->render_surface()->contributes_to_drawn_surface()); | 5745 EXPECT_FALSE(copy_layer->render_surface()->contributes_to_drawn_surface()); |
5742 } | 5746 } |
5743 | 5747 |
5744 TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) { | 5748 TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) { |
5745 FakeImplTaskRunnerProvider task_runner_provider; | 5749 FakeImplTaskRunnerProvider task_runner_provider; |
5746 TestSharedBitmapManager shared_bitmap_manager; | 5750 TestSharedBitmapManager shared_bitmap_manager; |
5747 TestTaskGraphRunner task_graph_runner; | 5751 TestTaskGraphRunner task_graph_runner; |
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6626 false, true, true); | 6630 false, true, true); |
6627 | 6631 |
6628 render_surface1->test_properties()->double_sided = false; | 6632 render_surface1->test_properties()->double_sided = false; |
6629 render_surface2->test_properties()->double_sided = false; | 6633 render_surface2->test_properties()->double_sided = false; |
6630 | 6634 |
6631 ExecuteCalculateDrawProperties(root); | 6635 ExecuteCalculateDrawProperties(root); |
6632 | 6636 |
6633 const EffectTree& tree = | 6637 const EffectTree& tree = |
6634 root->layer_tree_impl()->property_trees()->effect_tree; | 6638 root->layer_tree_impl()->property_trees()->effect_tree; |
6635 EXPECT_TRUE(tree.Node(render_surface1->effect_tree_index()) | 6639 EXPECT_TRUE(tree.Node(render_surface1->effect_tree_index()) |
6636 ->data.hidden_by_backface_visibility); | 6640 ->hidden_by_backface_visibility); |
6637 EXPECT_TRUE(tree.Node(render_surface2->effect_tree_index()) | 6641 EXPECT_TRUE(tree.Node(render_surface2->effect_tree_index()) |
6638 ->data.hidden_by_backface_visibility); | 6642 ->hidden_by_backface_visibility); |
6639 | 6643 |
6640 back_facing->OnTransformAnimated(identity_transform); | 6644 back_facing->OnTransformAnimated(identity_transform); |
6641 render_surface2->OnTransformAnimated(rotate_about_y); | 6645 render_surface2->OnTransformAnimated(rotate_about_y); |
6642 ExecuteCalculateDrawProperties(root); | 6646 ExecuteCalculateDrawProperties(root); |
6643 EXPECT_FALSE(tree.Node(render_surface1->effect_tree_index()) | 6647 EXPECT_FALSE(tree.Node(render_surface1->effect_tree_index()) |
6644 ->data.hidden_by_backface_visibility); | 6648 ->hidden_by_backface_visibility); |
6645 EXPECT_TRUE(tree.Node(render_surface2->effect_tree_index()) | 6649 EXPECT_TRUE(tree.Node(render_surface2->effect_tree_index()) |
6646 ->data.hidden_by_backface_visibility); | 6650 ->hidden_by_backface_visibility); |
6647 | 6651 |
6648 render_surface1->OnTransformAnimated(rotate_about_y); | 6652 render_surface1->OnTransformAnimated(rotate_about_y); |
6649 ExecuteCalculateDrawProperties(root); | 6653 ExecuteCalculateDrawProperties(root); |
6650 EXPECT_TRUE(tree.Node(render_surface1->effect_tree_index()) | 6654 EXPECT_TRUE(tree.Node(render_surface1->effect_tree_index()) |
6651 ->data.hidden_by_backface_visibility); | 6655 ->hidden_by_backface_visibility); |
6652 EXPECT_TRUE(tree.Node(render_surface2->effect_tree_index()) | 6656 EXPECT_TRUE(tree.Node(render_surface2->effect_tree_index()) |
6653 ->data.hidden_by_backface_visibility); | 6657 ->hidden_by_backface_visibility); |
6654 } | 6658 } |
6655 | 6659 |
6656 TEST_F(LayerTreeHostCommonTest, ClippedByScrollParent) { | 6660 TEST_F(LayerTreeHostCommonTest, ClippedByScrollParent) { |
6657 // Checks that the simple case (being clipped by a scroll parent that would | 6661 // Checks that the simple case (being clipped by a scroll parent that would |
6658 // have been processed before you anyhow) results in the right clips. | 6662 // have been processed before you anyhow) results in the right clips. |
6659 // | 6663 // |
6660 // + root | 6664 // + root |
6661 // + scroll_parent_border | 6665 // + scroll_parent_border |
6662 // | + scroll_parent_clip | 6666 // | + scroll_parent_clip |
6663 // | + scroll_parent | 6667 // | + scroll_parent |
(...skipping 2644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9308 EXPECT_EQ(transform_node->owner_id, significant_transform->id()); | 9312 EXPECT_EQ(transform_node->owner_id, significant_transform->id()); |
9309 | 9313 |
9310 EXPECT_TRUE(root->has_render_surface()); | 9314 EXPECT_TRUE(root->has_render_surface()); |
9311 EXPECT_FALSE(significant_transform->has_render_surface()); | 9315 EXPECT_FALSE(significant_transform->has_render_surface()); |
9312 EXPECT_TRUE(layer_clips_subtree->has_render_surface()); | 9316 EXPECT_TRUE(layer_clips_subtree->has_render_surface()); |
9313 EXPECT_TRUE(render_surface->has_render_surface()); | 9317 EXPECT_TRUE(render_surface->has_render_surface()); |
9314 EXPECT_FALSE(test_layer->has_render_surface()); | 9318 EXPECT_FALSE(test_layer->has_render_surface()); |
9315 | 9319 |
9316 ClipTree& clip_tree = root->layer_tree_impl()->property_trees()->clip_tree; | 9320 ClipTree& clip_tree = root->layer_tree_impl()->property_trees()->clip_tree; |
9317 ClipNode* clip_node = clip_tree.Node(render_surface->clip_tree_index()); | 9321 ClipNode* clip_node = clip_tree.Node(render_surface->clip_tree_index()); |
9318 EXPECT_FALSE(clip_node->data.applies_local_clip); | 9322 EXPECT_FALSE(clip_node->applies_local_clip); |
9319 EXPECT_EQ(gfx::Rect(20, 20), test_layer->visible_layer_rect()); | 9323 EXPECT_EQ(gfx::Rect(20, 20), test_layer->visible_layer_rect()); |
9320 } | 9324 } |
9321 | 9325 |
9322 TEST_F(LayerTreeHostCommonTest, TransformOfParentClipNodeAncestorOfTarget) { | 9326 TEST_F(LayerTreeHostCommonTest, TransformOfParentClipNodeAncestorOfTarget) { |
9323 // Ensure that when parent clip node's transform is an ancestor of current | 9327 // Ensure that when parent clip node's transform is an ancestor of current |
9324 // clip node's target, clip is 'projected' from parent space to current | 9328 // clip node's target, clip is 'projected' from parent space to current |
9325 // target space and visible rects are calculated correctly. | 9329 // target space and visible rects are calculated correctly. |
9326 LayerImpl* root = root_layer_for_testing(); | 9330 LayerImpl* root = root_layer_for_testing(); |
9327 LayerImpl* clip_layer = AddChild<LayerImpl>(root); | 9331 LayerImpl* clip_layer = AddChild<LayerImpl>(root); |
9328 LayerImpl* target_layer = AddChild<LayerImpl>(clip_layer); | 9332 LayerImpl* target_layer = AddChild<LayerImpl>(clip_layer); |
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9956 // We want layer between the two targets to create a clip node and transform | 9960 // We want layer between the two targets to create a clip node and transform |
9957 // node but it shouldn't create a render surface. | 9961 // node but it shouldn't create a render surface. |
9958 between_targets->SetMasksToBounds(true); | 9962 between_targets->SetMasksToBounds(true); |
9959 between_targets->Set3dSortingContextId(2); | 9963 between_targets->Set3dSortingContextId(2); |
9960 | 9964 |
9961 ExecuteCalculateDrawProperties(root); | 9965 ExecuteCalculateDrawProperties(root); |
9962 | 9966 |
9963 TransformTree& tree = | 9967 TransformTree& tree = |
9964 root->layer_tree_impl()->property_trees()->transform_tree; | 9968 root->layer_tree_impl()->property_trees()->transform_tree; |
9965 TransformNode* node = tree.Node(render_surface1->transform_tree_index()); | 9969 TransformNode* node = tree.Node(render_surface1->transform_tree_index()); |
9966 EXPECT_EQ(node->data.sublayer_scale, gfx::Vector2dF(2.f, 2.f)); | 9970 EXPECT_EQ(node->sublayer_scale, gfx::Vector2dF(2.f, 2.f)); |
9967 | 9971 |
9968 node = tree.Node(between_targets->transform_tree_index()); | 9972 node = tree.Node(between_targets->transform_tree_index()); |
9969 EXPECT_EQ(node->data.sublayer_scale, gfx::Vector2dF(1.f, 1.f)); | 9973 EXPECT_EQ(node->sublayer_scale, gfx::Vector2dF(1.f, 1.f)); |
9970 | 9974 |
9971 node = tree.Node(render_surface2->transform_tree_index()); | 9975 node = tree.Node(render_surface2->transform_tree_index()); |
9972 EXPECT_EQ(node->data.sublayer_scale, gfx::Vector2dF(2.f, 2.f)); | 9976 EXPECT_EQ(node->sublayer_scale, gfx::Vector2dF(2.f, 2.f)); |
9973 | 9977 |
9974 EXPECT_EQ(gfx::Rect(15, 15), test_layer->visible_layer_rect()); | 9978 EXPECT_EQ(gfx::Rect(15, 15), test_layer->visible_layer_rect()); |
9975 } | 9979 } |
9976 | 9980 |
9977 TEST_F(LayerTreeHostCommonTest, LargeTransformTest) { | 9981 TEST_F(LayerTreeHostCommonTest, LargeTransformTest) { |
9978 LayerImpl* root = root_layer_for_testing(); | 9982 LayerImpl* root = root_layer_for_testing(); |
9979 LayerImpl* render_surface1 = AddChild<LayerImpl>(root); | 9983 LayerImpl* render_surface1 = AddChild<LayerImpl>(root); |
9980 LayerImpl* child = AddChild<LayerImpl>(render_surface1); | 9984 LayerImpl* child = AddChild<LayerImpl>(render_surface1); |
9981 | 9985 |
9982 const gfx::Transform identity_matrix; | 9986 const gfx::Transform identity_matrix; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10102 animation->set_fill_mode(Animation::FillMode::NONE); | 10106 animation->set_fill_mode(Animation::FillMode::NONE); |
10103 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); | 10107 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); |
10104 Animation* animation_ptr = animation.get(); | 10108 Animation* animation_ptr = animation.get(); |
10105 AddAnimationToElementWithExistingPlayer(animated->element_id(), timeline(), | 10109 AddAnimationToElementWithExistingPlayer(animated->element_id(), timeline(), |
10106 std::move(animation)); | 10110 std::move(animation)); |
10107 | 10111 |
10108 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 10112 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
10109 | 10113 |
10110 EffectTree& tree = root->layer_tree_host()->property_trees()->effect_tree; | 10114 EffectTree& tree = root->layer_tree_host()->property_trees()->effect_tree; |
10111 EffectNode* node = tree.Node(animated->effect_tree_index()); | 10115 EffectNode* node = tree.Node(animated->effect_tree_index()); |
10112 EXPECT_FALSE(node->data.is_currently_animating_opacity); | 10116 EXPECT_FALSE(node->is_currently_animating_opacity); |
10113 EXPECT_TRUE(node->data.has_potential_opacity_animation); | 10117 EXPECT_TRUE(node->has_potential_opacity_animation); |
10114 | 10118 |
10115 animation_ptr->set_time_offset(base::TimeDelta::FromMilliseconds(0)); | 10119 animation_ptr->set_time_offset(base::TimeDelta::FromMilliseconds(0)); |
10116 root->layer_tree_host()->AnimateLayers( | 10120 root->layer_tree_host()->AnimateLayers( |
10117 base::TimeTicks::FromInternalValue(std::numeric_limits<int64_t>::max())); | 10121 base::TimeTicks::FromInternalValue(std::numeric_limits<int64_t>::max())); |
10118 node = tree.Node(animated->effect_tree_index()); | 10122 node = tree.Node(animated->effect_tree_index()); |
10119 EXPECT_TRUE(node->data.is_currently_animating_opacity); | 10123 EXPECT_TRUE(node->is_currently_animating_opacity); |
10120 EXPECT_TRUE(node->data.has_potential_opacity_animation); | 10124 EXPECT_TRUE(node->has_potential_opacity_animation); |
10121 | 10125 |
10122 player->AbortAnimations(TargetProperty::OPACITY, false /*needs_completion*/); | 10126 player->AbortAnimations(TargetProperty::OPACITY, false /*needs_completion*/); |
10123 node = tree.Node(animated->effect_tree_index()); | 10127 node = tree.Node(animated->effect_tree_index()); |
10124 EXPECT_FALSE(node->data.is_currently_animating_opacity); | 10128 EXPECT_FALSE(node->is_currently_animating_opacity); |
10125 EXPECT_FALSE(node->data.has_potential_opacity_animation); | 10129 EXPECT_FALSE(node->has_potential_opacity_animation); |
10126 } | 10130 } |
10127 | 10131 |
10128 TEST_F(LayerTreeHostCommonTest, TransformAnimationsTrackingTest) { | 10132 TEST_F(LayerTreeHostCommonTest, TransformAnimationsTrackingTest) { |
10129 const gfx::Transform identity_matrix; | 10133 const gfx::Transform identity_matrix; |
10130 scoped_refptr<Layer> root = Layer::Create(); | 10134 scoped_refptr<Layer> root = Layer::Create(); |
10131 scoped_refptr<LayerWithForcedDrawsContent> animated = | 10135 scoped_refptr<LayerWithForcedDrawsContent> animated = |
10132 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 10136 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
10133 root->AddChild(animated); | 10137 root->AddChild(animated); |
10134 | 10138 |
10135 host()->SetRootLayer(root); | 10139 host()->SetRootLayer(root); |
(...skipping 30 matching lines...) Expand all Loading... |
10166 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); | 10170 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); |
10167 Animation* animation_ptr = animation.get(); | 10171 Animation* animation_ptr = animation.get(); |
10168 AddAnimationToElementWithExistingPlayer(animated->element_id(), timeline(), | 10172 AddAnimationToElementWithExistingPlayer(animated->element_id(), timeline(), |
10169 std::move(animation)); | 10173 std::move(animation)); |
10170 | 10174 |
10171 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 10175 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
10172 | 10176 |
10173 TransformTree& tree = | 10177 TransformTree& tree = |
10174 root->layer_tree_host()->property_trees()->transform_tree; | 10178 root->layer_tree_host()->property_trees()->transform_tree; |
10175 TransformNode* node = tree.Node(animated->transform_tree_index()); | 10179 TransformNode* node = tree.Node(animated->transform_tree_index()); |
10176 EXPECT_FALSE(node->data.is_currently_animating); | 10180 EXPECT_FALSE(node->is_currently_animating); |
10177 EXPECT_TRUE(node->data.has_potential_animation); | 10181 EXPECT_TRUE(node->has_potential_animation); |
10178 | 10182 |
10179 animation_ptr->set_time_offset(base::TimeDelta::FromMilliseconds(0)); | 10183 animation_ptr->set_time_offset(base::TimeDelta::FromMilliseconds(0)); |
10180 root->layer_tree_host()->AnimateLayers( | 10184 root->layer_tree_host()->AnimateLayers( |
10181 base::TimeTicks::FromInternalValue(std::numeric_limits<int64_t>::max())); | 10185 base::TimeTicks::FromInternalValue(std::numeric_limits<int64_t>::max())); |
10182 node = tree.Node(animated->transform_tree_index()); | 10186 node = tree.Node(animated->transform_tree_index()); |
10183 EXPECT_TRUE(node->data.is_currently_animating); | 10187 EXPECT_TRUE(node->is_currently_animating); |
10184 EXPECT_TRUE(node->data.has_potential_animation); | 10188 EXPECT_TRUE(node->has_potential_animation); |
10185 | 10189 |
10186 player->AbortAnimations(TargetProperty::TRANSFORM, | 10190 player->AbortAnimations(TargetProperty::TRANSFORM, |
10187 false /*needs_completion*/); | 10191 false /*needs_completion*/); |
10188 node = tree.Node(animated->transform_tree_index()); | 10192 node = tree.Node(animated->transform_tree_index()); |
10189 EXPECT_FALSE(node->data.is_currently_animating); | 10193 EXPECT_FALSE(node->is_currently_animating); |
10190 EXPECT_FALSE(node->data.has_potential_animation); | 10194 EXPECT_FALSE(node->has_potential_animation); |
10191 } | 10195 } |
10192 | 10196 |
10193 TEST_F(LayerTreeHostCommonTest, SerializeScrollUpdateInfo) { | 10197 TEST_F(LayerTreeHostCommonTest, SerializeScrollUpdateInfo) { |
10194 LayerTreeHostCommon::ScrollUpdateInfo scroll; | 10198 LayerTreeHostCommon::ScrollUpdateInfo scroll; |
10195 scroll.layer_id = 2; | 10199 scroll.layer_id = 2; |
10196 scroll.scroll_delta = gfx::Vector2d(5, 10); | 10200 scroll.scroll_delta = gfx::Vector2d(5, 10); |
10197 | 10201 |
10198 proto::ScrollUpdateInfo proto; | 10202 proto::ScrollUpdateInfo proto; |
10199 scroll.ToProtobuf(&proto); | 10203 scroll.ToProtobuf(&proto); |
10200 LayerTreeHostCommon::ScrollUpdateInfo new_scroll; | 10204 LayerTreeHostCommon::ScrollUpdateInfo new_scroll; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10317 // Property tree root | 10321 // Property tree root |
10318 ScrollTree& scroll_tree = host()->property_trees()->scroll_tree; | 10322 ScrollTree& scroll_tree = host()->property_trees()->scroll_tree; |
10319 PropertyTrees property_trees; | 10323 PropertyTrees property_trees; |
10320 property_trees.is_main_thread = true; | 10324 property_trees.is_main_thread = true; |
10321 property_trees.is_active = false; | 10325 property_trees.is_active = false; |
10322 ScrollTree& expected_scroll_tree = property_trees.scroll_tree; | 10326 ScrollTree& expected_scroll_tree = property_trees.scroll_tree; |
10323 ScrollNode* property_tree_root = expected_scroll_tree.Node(0); | 10327 ScrollNode* property_tree_root = expected_scroll_tree.Node(0); |
10324 property_tree_root->id = kRootPropertyTreeNodeId; | 10328 property_tree_root->id = kRootPropertyTreeNodeId; |
10325 property_tree_root->parent_id = kInvalidPropertyTreeNodeId; | 10329 property_tree_root->parent_id = kInvalidPropertyTreeNodeId; |
10326 property_tree_root->owner_id = kInvalidPropertyTreeNodeId; | 10330 property_tree_root->owner_id = kInvalidPropertyTreeNodeId; |
10327 property_tree_root->data.scrollable = false; | 10331 property_tree_root->scrollable = false; |
10328 property_tree_root->data.main_thread_scrolling_reasons = | 10332 property_tree_root->main_thread_scrolling_reasons = |
10329 MainThreadScrollingReason::kNotScrollingOnMain; | 10333 MainThreadScrollingReason::kNotScrollingOnMain; |
10330 property_tree_root->data.contains_non_fast_scrollable_region = false; | 10334 property_tree_root->contains_non_fast_scrollable_region = false; |
10331 property_tree_root->data.transform_id = kRootPropertyTreeNodeId; | 10335 property_tree_root->transform_id = kRootPropertyTreeNodeId; |
10332 | 10336 |
10333 // The node owned by root1 | 10337 // The node owned by root1 |
10334 ScrollNode scroll_root1; | 10338 ScrollNode scroll_root1; |
10335 scroll_root1.id = 1; | 10339 scroll_root1.id = 1; |
10336 scroll_root1.owner_id = root1->id(); | 10340 scroll_root1.owner_id = root1->id(); |
10337 scroll_root1.data.user_scrollable_horizontal = true; | 10341 scroll_root1.user_scrollable_horizontal = true; |
10338 scroll_root1.data.user_scrollable_vertical = true; | 10342 scroll_root1.user_scrollable_vertical = true; |
10339 scroll_root1.data.transform_id = root1->transform_tree_index(); | 10343 scroll_root1.transform_id = root1->transform_tree_index(); |
10340 expected_scroll_tree.Insert(scroll_root1, 0); | 10344 expected_scroll_tree.Insert(scroll_root1, 0); |
10341 | 10345 |
10342 // The node owned by parent2 | 10346 // The node owned by parent2 |
10343 ScrollNode scroll_parent2; | 10347 ScrollNode scroll_parent2; |
10344 scroll_parent2.id = 2; | 10348 scroll_parent2.id = 2; |
10345 scroll_parent2.owner_id = parent2->id(); | 10349 scroll_parent2.owner_id = parent2->id(); |
10346 scroll_parent2.data.scrollable = true; | 10350 scroll_parent2.scrollable = true; |
10347 scroll_parent2.data.main_thread_scrolling_reasons = | 10351 scroll_parent2.main_thread_scrolling_reasons = |
10348 parent2->main_thread_scrolling_reasons(); | 10352 parent2->main_thread_scrolling_reasons(); |
10349 scroll_parent2.data.scroll_clip_layer_bounds = root1->bounds(); | 10353 scroll_parent2.scroll_clip_layer_bounds = root1->bounds(); |
10350 scroll_parent2.data.bounds = parent2->bounds(); | 10354 scroll_parent2.bounds = parent2->bounds(); |
10351 scroll_parent2.data.max_scroll_offset_affected_by_page_scale = true; | 10355 scroll_parent2.max_scroll_offset_affected_by_page_scale = true; |
10352 scroll_parent2.data.is_inner_viewport_scroll_layer = true; | 10356 scroll_parent2.is_inner_viewport_scroll_layer = true; |
10353 scroll_parent2.data.user_scrollable_horizontal = true; | 10357 scroll_parent2.user_scrollable_horizontal = true; |
10354 scroll_parent2.data.user_scrollable_vertical = true; | 10358 scroll_parent2.user_scrollable_vertical = true; |
10355 scroll_parent2.data.transform_id = parent2->transform_tree_index(); | 10359 scroll_parent2.transform_id = parent2->transform_tree_index(); |
10356 expected_scroll_tree.Insert(scroll_parent2, 1); | 10360 expected_scroll_tree.Insert(scroll_parent2, 1); |
10357 | 10361 |
10358 // The node owned by child6 | 10362 // The node owned by child6 |
10359 ScrollNode scroll_child6; | 10363 ScrollNode scroll_child6; |
10360 scroll_child6.id = 3; | 10364 scroll_child6.id = 3; |
10361 scroll_child6.owner_id = child6->id(); | 10365 scroll_child6.owner_id = child6->id(); |
10362 scroll_child6.data.main_thread_scrolling_reasons = | 10366 scroll_child6.main_thread_scrolling_reasons = |
10363 child6->main_thread_scrolling_reasons(); | 10367 child6->main_thread_scrolling_reasons(); |
10364 scroll_child6.data.should_flatten = true; | 10368 scroll_child6.should_flatten = true; |
10365 scroll_child6.data.user_scrollable_horizontal = true; | 10369 scroll_child6.user_scrollable_horizontal = true; |
10366 scroll_child6.data.user_scrollable_vertical = true; | 10370 scroll_child6.user_scrollable_vertical = true; |
10367 scroll_child6.data.transform_id = child6->transform_tree_index(); | 10371 scroll_child6.transform_id = child6->transform_tree_index(); |
10368 expected_scroll_tree.Insert(scroll_child6, 2); | 10372 expected_scroll_tree.Insert(scroll_child6, 2); |
10369 | 10373 |
10370 // The node owned by child7, child7 also owns a transform node | 10374 // The node owned by child7, child7 also owns a transform node |
10371 ScrollNode scroll_child7; | 10375 ScrollNode scroll_child7; |
10372 scroll_child7.id = 4; | 10376 scroll_child7.id = 4; |
10373 scroll_child7.owner_id = child7->id(); | 10377 scroll_child7.owner_id = child7->id(); |
10374 scroll_child7.data.scrollable = true; | 10378 scroll_child7.scrollable = true; |
10375 scroll_child7.data.scroll_clip_layer_bounds = parent3->bounds(); | 10379 scroll_child7.scroll_clip_layer_bounds = parent3->bounds(); |
10376 scroll_child7.data.bounds = child7->bounds(); | 10380 scroll_child7.bounds = child7->bounds(); |
10377 scroll_child7.data.user_scrollable_horizontal = true; | 10381 scroll_child7.user_scrollable_horizontal = true; |
10378 scroll_child7.data.user_scrollable_vertical = true; | 10382 scroll_child7.user_scrollable_vertical = true; |
10379 scroll_child7.data.transform_id = child7->transform_tree_index(); | 10383 scroll_child7.transform_id = child7->transform_tree_index(); |
10380 expected_scroll_tree.Insert(scroll_child7, 1); | 10384 expected_scroll_tree.Insert(scroll_child7, 1); |
10381 | 10385 |
10382 // The node owned by grand_child11, grand_child11 also owns a transform node | 10386 // The node owned by grand_child11, grand_child11 also owns a transform node |
10383 ScrollNode scroll_grand_child11; | 10387 ScrollNode scroll_grand_child11; |
10384 scroll_grand_child11.id = 5; | 10388 scroll_grand_child11.id = 5; |
10385 scroll_grand_child11.owner_id = grand_child11->id(); | 10389 scroll_grand_child11.owner_id = grand_child11->id(); |
10386 scroll_grand_child11.data.scrollable = true; | 10390 scroll_grand_child11.scrollable = true; |
10387 scroll_grand_child11.data.user_scrollable_horizontal = true; | 10391 scroll_grand_child11.user_scrollable_horizontal = true; |
10388 scroll_grand_child11.data.user_scrollable_vertical = true; | 10392 scroll_grand_child11.user_scrollable_vertical = true; |
10389 scroll_grand_child11.data.transform_id = | 10393 scroll_grand_child11.transform_id = grand_child11->transform_tree_index(); |
10390 grand_child11->transform_tree_index(); | |
10391 expected_scroll_tree.Insert(scroll_grand_child11, 4); | 10394 expected_scroll_tree.Insert(scroll_grand_child11, 4); |
10392 | 10395 |
10393 // The node owned by parent5 | 10396 // The node owned by parent5 |
10394 ScrollNode scroll_parent5; | 10397 ScrollNode scroll_parent5; |
10395 scroll_parent5.id = 8; | 10398 scroll_parent5.id = 8; |
10396 scroll_parent5.owner_id = parent5->id(); | 10399 scroll_parent5.owner_id = parent5->id(); |
10397 scroll_parent5.data.contains_non_fast_scrollable_region = true; | 10400 scroll_parent5.contains_non_fast_scrollable_region = true; |
10398 scroll_parent5.data.bounds = gfx::Size(10, 10); | 10401 scroll_parent5.bounds = gfx::Size(10, 10); |
10399 scroll_parent5.data.should_flatten = true; | 10402 scroll_parent5.should_flatten = true; |
10400 scroll_parent5.data.user_scrollable_horizontal = true; | 10403 scroll_parent5.user_scrollable_horizontal = true; |
10401 scroll_parent5.data.user_scrollable_vertical = true; | 10404 scroll_parent5.user_scrollable_vertical = true; |
10402 scroll_parent5.data.transform_id = parent5->transform_tree_index(); | 10405 scroll_parent5.transform_id = parent5->transform_tree_index(); |
10403 expected_scroll_tree.Insert(scroll_parent5, 1); | 10406 expected_scroll_tree.Insert(scroll_parent5, 1); |
10404 | 10407 |
10405 expected_scroll_tree.SetScrollOffset(parent2->id(), gfx::ScrollOffset(0, 0)); | 10408 expected_scroll_tree.SetScrollOffset(parent2->id(), gfx::ScrollOffset(0, 0)); |
10406 expected_scroll_tree.SetScrollOffset(child7->id(), gfx::ScrollOffset(0, 0)); | 10409 expected_scroll_tree.SetScrollOffset(child7->id(), gfx::ScrollOffset(0, 0)); |
10407 expected_scroll_tree.SetScrollOffset(grand_child11->id(), | 10410 expected_scroll_tree.SetScrollOffset(grand_child11->id(), |
10408 gfx::ScrollOffset(0, 0)); | 10411 gfx::ScrollOffset(0, 0)); |
10409 expected_scroll_tree.set_needs_update(false); | 10412 expected_scroll_tree.set_needs_update(false); |
10410 | 10413 |
10411 EXPECT_EQ(expected_scroll_tree, scroll_tree); | 10414 EXPECT_EQ(expected_scroll_tree, scroll_tree); |
10412 | 10415 |
10413 // Check other layers' scroll_tree_index | 10416 // Check other layers' scroll_tree_index |
10414 EXPECT_EQ(scroll_root1.id, page_scale_layer->scroll_tree_index()); | 10417 EXPECT_EQ(scroll_root1.id, page_scale_layer->scroll_tree_index()); |
10415 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); | 10418 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); |
10416 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); | 10419 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); |
10417 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); | 10420 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); |
10418 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); | 10421 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); |
10419 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); | 10422 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); |
10420 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); | 10423 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); |
10421 } | 10424 } |
10422 | 10425 |
10423 } // namespace | 10426 } // namespace |
10424 } // namespace cc | 10427 } // namespace cc |
OLD | NEW |