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 3691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3702 SetLayerPropertiesForTesting(occluding_child.get(), identity_matrix, | 3702 SetLayerPropertiesForTesting(occluding_child.get(), identity_matrix, |
3703 gfx::Point3F(), gfx::PointF(), | 3703 gfx::Point3F(), gfx::PointF(), |
3704 gfx::Size(200, 200), false, false, false); | 3704 gfx::Size(200, 200), false, false, false); |
3705 | 3705 |
3706 host_impl.SetViewportSize(root->bounds()); | 3706 host_impl.SetViewportSize(root->bounds()); |
3707 | 3707 |
3708 child->test_properties()->AddChild(std::move(grand_child)); | 3708 child->test_properties()->AddChild(std::move(grand_child)); |
3709 root->test_properties()->AddChild(std::move(child)); | 3709 root->test_properties()->AddChild(std::move(child)); |
3710 root->test_properties()->AddChild(std::move(occluding_child)); | 3710 root->test_properties()->AddChild(std::move(occluding_child)); |
3711 host_impl.active_tree()->SetRootLayer(std::move(root)); | 3711 host_impl.active_tree()->SetRootLayer(std::move(root)); |
| 3712 host_impl.active_tree()->BuildLayerListForTesting(); |
3712 host_impl.SetVisible(true); | 3713 host_impl.SetVisible(true); |
3713 host_impl.InitializeRenderer(output_surface.get()); | 3714 host_impl.InitializeRenderer(output_surface.get()); |
3714 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); | 3715 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); |
3715 bool update_lcd_text = false; | 3716 bool update_lcd_text = false; |
3716 host_impl.active_tree()->UpdateDrawProperties(update_lcd_text); | 3717 host_impl.active_tree()->UpdateDrawProperties(update_lcd_text); |
3717 | 3718 |
3718 LayerImpl* grand_child_ptr = host_impl.active_tree() | 3719 LayerImpl* grand_child_ptr = host_impl.active_tree() |
3719 ->root_layer() | 3720 ->root_layer() |
3720 ->test_properties() | 3721 ->test_properties() |
3721 ->children[0] | 3722 ->children[0] |
(...skipping 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5258 LayerImpl::Create(host_impl_.active_tree(), 3); | 5259 LayerImpl::Create(host_impl_.active_tree(), 3); |
5259 | 5260 |
5260 // Stash raw pointers to look at later. | 5261 // Stash raw pointers to look at later. |
5261 root_ = root_ptr.get(); | 5262 root_ = root_ptr.get(); |
5262 child_ = child_ptr.get(); | 5263 child_ = child_ptr.get(); |
5263 grand_child_ = grand_child_ptr.get(); | 5264 grand_child_ = grand_child_ptr.get(); |
5264 | 5265 |
5265 child_->test_properties()->AddChild(std::move(grand_child_ptr)); | 5266 child_->test_properties()->AddChild(std::move(grand_child_ptr)); |
5266 root_->test_properties()->AddChild(std::move(child_ptr)); | 5267 root_->test_properties()->AddChild(std::move(child_ptr)); |
5267 host_impl_.active_tree()->SetRootLayer(std::move(root_ptr)); | 5268 host_impl_.active_tree()->SetRootLayer(std::move(root_ptr)); |
| 5269 host_impl_.active_tree()->BuildLayerListForTesting(); |
5268 | 5270 |
5269 root_->SetContentsOpaque(true); | 5271 root_->SetContentsOpaque(true); |
5270 child_->SetContentsOpaque(true); | 5272 child_->SetContentsOpaque(true); |
5271 grand_child_->SetContentsOpaque(true); | 5273 grand_child_->SetContentsOpaque(true); |
5272 | 5274 |
5273 root_->SetDrawsContent(true); | 5275 root_->SetDrawsContent(true); |
5274 child_->SetDrawsContent(true); | 5276 child_->SetDrawsContent(true); |
5275 grand_child_->SetDrawsContent(true); | 5277 grand_child_->SetDrawsContent(true); |
5276 | 5278 |
5277 gfx::Transform identity_matrix; | 5279 gfx::Transform identity_matrix; |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5472 SetLayerPropertiesForTesting(grand_child.get(), identity_matrix, | 5474 SetLayerPropertiesForTesting(grand_child.get(), identity_matrix, |
5473 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30), | 5475 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30), |
5474 true, false, false); | 5476 true, false, false); |
5475 grand_child->SetDrawsContent(true); | 5477 grand_child->SetDrawsContent(true); |
5476 grand_child->test_properties()->hide_layer_and_subtree = true; | 5478 grand_child->test_properties()->hide_layer_and_subtree = true; |
5477 | 5479 |
5478 child->test_properties()->AddChild(std::move(grand_child)); | 5480 child->test_properties()->AddChild(std::move(grand_child)); |
5479 root->test_properties()->AddChild(std::move(child)); | 5481 root->test_properties()->AddChild(std::move(child)); |
5480 root->SetHasRenderSurface(true); | 5482 root->SetHasRenderSurface(true); |
5481 host_impl.pending_tree()->SetRootLayer(std::move(root)); | 5483 host_impl.pending_tree()->SetRootLayer(std::move(root)); |
| 5484 host_impl.pending_tree()->BuildLayerListForTesting(); |
5482 | 5485 |
5483 LayerImplList render_surface_layer_list; | 5486 LayerImplList render_surface_layer_list; |
5484 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 5487 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
5485 root_layer, root_layer->bounds(), &render_surface_layer_list); | 5488 root_layer, root_layer->bounds(), &render_surface_layer_list); |
5486 inputs.can_adjust_raster_scales = true; | 5489 inputs.can_adjust_raster_scales = true; |
5487 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); | 5490 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); |
5488 | 5491 |
5489 // We should have one render surface and two layers. The grand child has | 5492 // We should have one render surface and two layers. The grand child has |
5490 // hidden itself. | 5493 // hidden itself. |
5491 ASSERT_EQ(1u, render_surface_layer_list.size()); | 5494 ASSERT_EQ(1u, render_surface_layer_list.size()); |
(...skipping 30 matching lines...) Expand all Loading... |
5522 std::unique_ptr<LayerImpl> grand_child = | 5525 std::unique_ptr<LayerImpl> grand_child = |
5523 LayerImpl::Create(host_impl.pending_tree(), 3); | 5526 LayerImpl::Create(host_impl.pending_tree(), 3); |
5524 SetLayerPropertiesForTesting(grand_child.get(), identity_matrix, | 5527 SetLayerPropertiesForTesting(grand_child.get(), identity_matrix, |
5525 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30), | 5528 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30), |
5526 true, false, false); | 5529 true, false, false); |
5527 grand_child->SetDrawsContent(true); | 5530 grand_child->SetDrawsContent(true); |
5528 | 5531 |
5529 child->test_properties()->AddChild(std::move(grand_child)); | 5532 child->test_properties()->AddChild(std::move(grand_child)); |
5530 root->test_properties()->AddChild(std::move(child)); | 5533 root->test_properties()->AddChild(std::move(child)); |
5531 host_impl.pending_tree()->SetRootLayer(std::move(root)); | 5534 host_impl.pending_tree()->SetRootLayer(std::move(root)); |
| 5535 host_impl.pending_tree()->BuildLayerListForTesting(); |
5532 | 5536 |
5533 LayerImplList render_surface_layer_list; | 5537 LayerImplList render_surface_layer_list; |
5534 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 5538 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
5535 root_layer, root_layer->bounds(), &render_surface_layer_list); | 5539 root_layer, root_layer->bounds(), &render_surface_layer_list); |
5536 inputs.can_adjust_raster_scales = true; | 5540 inputs.can_adjust_raster_scales = true; |
5537 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); | 5541 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); |
5538 | 5542 |
5539 // We should have one render surface and one layers. The child has | 5543 // We should have one render surface and one layers. The child has |
5540 // hidden itself and the grand child. | 5544 // hidden itself and the grand child. |
5541 ASSERT_EQ(1u, render_surface_layer_list.size()); | 5545 ASSERT_EQ(1u, render_surface_layer_list.size()); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5622 | 5626 |
5623 copy_child->test_properties()->AddChild(std::move(copy_grand_child)); | 5627 copy_child->test_properties()->AddChild(std::move(copy_grand_child)); |
5624 copy_request->test_properties()->AddChild(std::move(copy_child)); | 5628 copy_request->test_properties()->AddChild(std::move(copy_child)); |
5625 copy_parent->test_properties()->AddChild(std::move(copy_request)); | 5629 copy_parent->test_properties()->AddChild(std::move(copy_request)); |
5626 copy_grand_parent->test_properties()->AddChild(std::move(copy_parent)); | 5630 copy_grand_parent->test_properties()->AddChild(std::move(copy_parent)); |
5627 root->test_properties()->AddChild( | 5631 root->test_properties()->AddChild( |
5628 std::move(copy_grand_parent_sibling_before)); | 5632 std::move(copy_grand_parent_sibling_before)); |
5629 root->test_properties()->AddChild(std::move(copy_grand_parent)); | 5633 root->test_properties()->AddChild(std::move(copy_grand_parent)); |
5630 root->test_properties()->AddChild(std::move(copy_grand_parent_sibling_after)); | 5634 root->test_properties()->AddChild(std::move(copy_grand_parent_sibling_after)); |
5631 host_impl.pending_tree()->SetRootLayer(std::move(root)); | 5635 host_impl.pending_tree()->SetRootLayer(std::move(root)); |
| 5636 host_impl.pending_tree()->BuildLayerListForTesting(); |
5632 | 5637 |
5633 // Hide the copy_grand_parent and its subtree. But make a copy request in that | 5638 // Hide the copy_grand_parent and its subtree. But make a copy request in that |
5634 // hidden subtree on copy_layer. Also hide the copy grand child and its | 5639 // hidden subtree on copy_layer. Also hide the copy grand child and its |
5635 // subtree. | 5640 // subtree. |
5636 copy_grand_parent_layer->test_properties()->hide_layer_and_subtree = true; | 5641 copy_grand_parent_layer->test_properties()->hide_layer_and_subtree = true; |
5637 copy_grand_parent_sibling_before_layer->test_properties() | 5642 copy_grand_parent_sibling_before_layer->test_properties() |
5638 ->hide_layer_and_subtree = true; | 5643 ->hide_layer_and_subtree = true; |
5639 copy_grand_parent_sibling_after_layer->test_properties() | 5644 copy_grand_parent_sibling_after_layer->test_properties() |
5640 ->hide_layer_and_subtree = true; | 5645 ->hide_layer_and_subtree = true; |
5641 copy_grand_child_layer->test_properties()->hide_layer_and_subtree = true; | 5646 copy_grand_child_layer->test_properties()->hide_layer_and_subtree = true; |
(...skipping 4684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10326 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); | 10331 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); |
10327 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); | 10332 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); |
10328 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); | 10333 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); |
10329 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); | 10334 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); |
10330 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); | 10335 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); |
10331 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); | 10336 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); |
10332 } | 10337 } |
10333 | 10338 |
10334 } // namespace | 10339 } // namespace |
10335 } // namespace cc | 10340 } // namespace cc |
OLD | NEW |