Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 1947683007: cc : Add subtree is hidden bool to effect tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/draw_property_utils.cc ('k') | cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 5502 matching lines...) Expand 10 before | Expand all | Expand 10 after
5513 gfx::PointF(), gfx::Size(40, 40), true, false, 5513 gfx::PointF(), gfx::Size(40, 40), true, false,
5514 false); 5514 false);
5515 child->SetDrawsContent(true); 5515 child->SetDrawsContent(true);
5516 5516
5517 std::unique_ptr<LayerImpl> grand_child = 5517 std::unique_ptr<LayerImpl> grand_child =
5518 LayerImpl::Create(host_impl.pending_tree(), 3); 5518 LayerImpl::Create(host_impl.pending_tree(), 3);
5519 SetLayerPropertiesForTesting(grand_child.get(), identity_matrix, 5519 SetLayerPropertiesForTesting(grand_child.get(), identity_matrix,
5520 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30), 5520 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30),
5521 true, false, false); 5521 true, false, false);
5522 grand_child->SetDrawsContent(true); 5522 grand_child->SetDrawsContent(true);
5523 grand_child->SetHideLayerAndSubtree(true); 5523 grand_child->test_properties()->hide_layer_and_subtree = true;
5524 5524
5525 child->AddChild(std::move(grand_child)); 5525 child->AddChild(std::move(grand_child));
5526 root->AddChild(std::move(child)); 5526 root->AddChild(std::move(child));
5527 root->SetHasRenderSurface(true); 5527 root->SetHasRenderSurface(true);
5528 host_impl.pending_tree()->SetRootLayer(std::move(root)); 5528 host_impl.pending_tree()->SetRootLayer(std::move(root));
5529 5529
5530 LayerImplList render_surface_layer_list; 5530 LayerImplList render_surface_layer_list;
5531 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( 5531 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
5532 root_layer, root_layer->bounds(), &render_surface_layer_list); 5532 root_layer, root_layer->bounds(), &render_surface_layer_list);
5533 inputs.can_adjust_raster_scales = true; 5533 inputs.can_adjust_raster_scales = true;
(...skipping 23 matching lines...) Expand all
5557 true); 5557 true);
5558 root->SetDrawsContent(true); 5558 root->SetDrawsContent(true);
5559 LayerImpl* root_layer = root.get(); 5559 LayerImpl* root_layer = root.get();
5560 5560
5561 std::unique_ptr<LayerImpl> child = 5561 std::unique_ptr<LayerImpl> child =
5562 LayerImpl::Create(host_impl.pending_tree(), 2); 5562 LayerImpl::Create(host_impl.pending_tree(), 2);
5563 SetLayerPropertiesForTesting(child.get(), identity_matrix, gfx::Point3F(), 5563 SetLayerPropertiesForTesting(child.get(), identity_matrix, gfx::Point3F(),
5564 gfx::PointF(), gfx::Size(40, 40), true, false, 5564 gfx::PointF(), gfx::Size(40, 40), true, false,
5565 false); 5565 false);
5566 child->SetDrawsContent(true); 5566 child->SetDrawsContent(true);
5567 child->SetHideLayerAndSubtree(true); 5567 child->test_properties()->hide_layer_and_subtree = true;
5568 5568
5569 std::unique_ptr<LayerImpl> grand_child = 5569 std::unique_ptr<LayerImpl> grand_child =
5570 LayerImpl::Create(host_impl.pending_tree(), 3); 5570 LayerImpl::Create(host_impl.pending_tree(), 3);
5571 SetLayerPropertiesForTesting(grand_child.get(), identity_matrix, 5571 SetLayerPropertiesForTesting(grand_child.get(), identity_matrix,
5572 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30), 5572 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30),
5573 true, false, false); 5573 true, false, false);
5574 grand_child->SetDrawsContent(true); 5574 grand_child->SetDrawsContent(true);
5575 5575
5576 child->AddChild(std::move(grand_child)); 5576 child->AddChild(std::move(grand_child));
5577 root->AddChild(std::move(child)); 5577 root->AddChild(std::move(child));
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
5672 copy_parent->AddChild(std::move(copy_request)); 5672 copy_parent->AddChild(std::move(copy_request));
5673 copy_grand_parent->AddChild(std::move(copy_parent)); 5673 copy_grand_parent->AddChild(std::move(copy_parent));
5674 root->AddChild(std::move(copy_grand_parent_sibling_before)); 5674 root->AddChild(std::move(copy_grand_parent_sibling_before));
5675 root->AddChild(std::move(copy_grand_parent)); 5675 root->AddChild(std::move(copy_grand_parent));
5676 root->AddChild(std::move(copy_grand_parent_sibling_after)); 5676 root->AddChild(std::move(copy_grand_parent_sibling_after));
5677 host_impl.pending_tree()->SetRootLayer(std::move(root)); 5677 host_impl.pending_tree()->SetRootLayer(std::move(root));
5678 5678
5679 // Hide the copy_grand_parent and its subtree. But make a copy request in that 5679 // Hide the copy_grand_parent and its subtree. But make a copy request in that
5680 // hidden subtree on copy_layer. Also hide the copy grand child and its 5680 // hidden subtree on copy_layer. Also hide the copy grand child and its
5681 // subtree. 5681 // subtree.
5682 copy_grand_parent_layer->SetHideLayerAndSubtree(true); 5682 copy_grand_parent_layer->test_properties()->hide_layer_and_subtree = true;
5683 copy_grand_parent_sibling_before_layer->SetHideLayerAndSubtree(true); 5683 copy_grand_parent_sibling_before_layer->test_properties()
5684 copy_grand_parent_sibling_after_layer->SetHideLayerAndSubtree(true); 5684 ->hide_layer_and_subtree = true;
5685 copy_grand_child_layer->SetHideLayerAndSubtree(true); 5685 copy_grand_parent_sibling_after_layer->test_properties()
5686 ->hide_layer_and_subtree = true;
5687 copy_grand_child_layer->test_properties()->hide_layer_and_subtree = true;
5686 5688
5687 std::vector<std::unique_ptr<CopyOutputRequest>> copy_requests; 5689 std::vector<std::unique_ptr<CopyOutputRequest>> copy_requests;
5688 copy_requests.push_back( 5690 copy_requests.push_back(
5689 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback))); 5691 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback)));
5690 copy_layer->PassCopyRequests(&copy_requests); 5692 copy_layer->PassCopyRequests(&copy_requests);
5691 EXPECT_TRUE(copy_layer->HasCopyRequest()); 5693 EXPECT_TRUE(copy_layer->HasCopyRequest());
5692 5694
5693 LayerImplList render_surface_layer_list; 5695 LayerImplList render_surface_layer_list;
5694 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( 5696 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
5695 root_layer, root_layer->bounds(), &render_surface_layer_list); 5697 root_layer, root_layer->bounds(), &render_surface_layer_list);
(...skipping 3117 matching lines...) Expand 10 before | Expand all | Expand 10 after
8813 gfx::Transform rotate_back_and_translate; 8815 gfx::Transform rotate_back_and_translate;
8814 rotate_back_and_translate.RotateAboutYAxis(180); 8816 rotate_back_and_translate.RotateAboutYAxis(180);
8815 rotate_back_and_translate.Translate(-10, 0); 8817 rotate_back_and_translate.Translate(-10, 0);
8816 8818
8817 child_ptr->SetTransform(singular); 8819 child_ptr->SetTransform(singular);
8818 host_impl.active_tree()->property_trees()->needs_rebuild = true; 8820 host_impl.active_tree()->property_trees()->needs_rebuild = true;
8819 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); 8821 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr);
8820 EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect()); 8822 EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect());
8821 child_ptr->SetTransform(identity); 8823 child_ptr->SetTransform(identity);
8822 8824
8823 child_ptr->SetHideLayerAndSubtree(true); 8825 child_ptr->test_properties()->hide_layer_and_subtree = true;
8824 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); 8826 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr);
8825 EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect()); 8827 EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect());
8826 child_ptr->SetHideLayerAndSubtree(false); 8828 child_ptr->test_properties()->hide_layer_and_subtree = false;
8827 8829
8828 child_ptr->SetOpacity(0.f); 8830 child_ptr->SetOpacity(0.f);
8829 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); 8831 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr);
8830 EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect()); 8832 EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect());
8831 child_ptr->SetOpacity(1.f); 8833 child_ptr->SetOpacity(1.f);
8832 8834
8833 root_ptr->SetTransform(singular); 8835 root_ptr->SetTransform(singular);
8834 // Force transform tree to have a node for child, so that ancestor's 8836 // Force transform tree to have a node for child, so that ancestor's
8835 // invertible transform can be tested. 8837 // invertible transform can be tested.
8836 child_ptr->SetTransform(rotate); 8838 child_ptr->SetTransform(rotate);
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
9037 SetLayerPropertiesForTesting(root, identity, gfx::Point3F(), gfx::PointF(), 9039 SetLayerPropertiesForTesting(root, identity, gfx::Point3F(), gfx::PointF(),
9038 gfx::Size(100, 100), true, false, true); 9040 gfx::Size(100, 100), true, false, true);
9039 SetLayerPropertiesForTesting(child, identity, gfx::Point3F(), gfx::PointF(), 9041 SetLayerPropertiesForTesting(child, identity, gfx::Point3F(), gfx::PointF(),
9040 gfx::Size(10, 10), true, false, false); 9042 gfx::Size(10, 10), true, false, false);
9041 child->SetDrawsContent(true); 9043 child->SetDrawsContent(true);
9042 9044
9043 ExecuteCalculateDrawProperties(root); 9045 ExecuteCalculateDrawProperties(root);
9044 EXPECT_EQ(gfx::Rect(10, 10), child->visible_layer_rect()); 9046 EXPECT_EQ(gfx::Rect(10, 10), child->visible_layer_rect());
9045 child->set_visible_layer_rect(gfx::Rect()); 9047 child->set_visible_layer_rect(gfx::Rect());
9046 9048
9047 child->SetHideLayerAndSubtree(true); 9049 child->test_properties()->hide_layer_and_subtree = true;
9048 root->layer_tree_impl()->property_trees()->needs_rebuild = true; 9050 root->layer_tree_impl()->property_trees()->needs_rebuild = true;
9049 ExecuteCalculateDrawProperties(root); 9051 ExecuteCalculateDrawProperties(root);
9050 EXPECT_EQ(gfx::Rect(0, 0), child->visible_layer_rect()); 9052 EXPECT_EQ(gfx::Rect(0, 0), child->visible_layer_rect());
9051 child->SetHideLayerAndSubtree(false); 9053 child->test_properties()->hide_layer_and_subtree = false;
9052 9054
9053 child->SetBounds(gfx::Size()); 9055 child->SetBounds(gfx::Size());
9054 root->layer_tree_impl()->property_trees()->needs_rebuild = true; 9056 root->layer_tree_impl()->property_trees()->needs_rebuild = true;
9055 ExecuteCalculateDrawProperties(root); 9057 ExecuteCalculateDrawProperties(root);
9056 EXPECT_EQ(gfx::Rect(0, 0), child->visible_layer_rect()); 9058 EXPECT_EQ(gfx::Rect(0, 0), child->visible_layer_rect());
9057 child->SetBounds(gfx::Size(10, 10)); 9059 child->SetBounds(gfx::Size(10, 10));
9058 9060
9059 gfx::Transform rotate; 9061 gfx::Transform rotate;
9060 child->test_properties()->double_sided = false; 9062 child->test_properties()->double_sided = false;
9061 rotate.RotateAboutXAxis(180.f); 9063 rotate.RotateAboutXAxis(180.f);
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
9666 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(), 9668 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(),
9667 gfx::PointF(), gfx::Size(30, 30), true, false, 9669 gfx::PointF(), gfx::Size(30, 30), true, false,
9668 true); 9670 true);
9669 SetLayerPropertiesForTesting(hidden, identity_matrix, gfx::Point3F(), 9671 SetLayerPropertiesForTesting(hidden, identity_matrix, gfx::Point3F(),
9670 gfx::PointF(10, 10), gfx::Size(30, 30), true, 9672 gfx::PointF(10, 10), gfx::Size(30, 30), true,
9671 false, true); 9673 false, true);
9672 SetLayerPropertiesForTesting(test, identity_matrix, gfx::Point3F(), 9674 SetLayerPropertiesForTesting(test, identity_matrix, gfx::Point3F(),
9673 gfx::PointF(), gfx::Size(30, 30), true, false, 9675 gfx::PointF(), gfx::Size(30, 30), true, false,
9674 true); 9676 true);
9675 9677
9676 hidden->SetHideLayerAndSubtree(true); 9678 hidden->test_properties()->hide_layer_and_subtree = true;
9677 ExecuteCalculateDrawProperties(root); 9679 ExecuteCalculateDrawProperties(root);
9678 EXPECT_TRUE(test->IsHidden()); 9680 EXPECT_TRUE(test->IsHidden());
9679 9681
9680 hidden->SetHideLayerAndSubtree(false); 9682 hidden->test_properties()->hide_layer_and_subtree = false;
9681 root->layer_tree_impl()->property_trees()->needs_rebuild = true; 9683 root->layer_tree_impl()->property_trees()->needs_rebuild = true;
9682 ExecuteCalculateDrawProperties(root); 9684 ExecuteCalculateDrawProperties(root);
9683 EXPECT_FALSE(test->IsHidden()); 9685 EXPECT_FALSE(test->IsHidden());
9684 } 9686 }
9685 9687
9686 TEST_F(LayerTreeHostCommonTest, TwoUnclippedRenderSurfaces) { 9688 TEST_F(LayerTreeHostCommonTest, TwoUnclippedRenderSurfaces) {
9687 LayerImpl* root = root_layer(); 9689 LayerImpl* root = root_layer();
9688 LayerImpl* render_surface1 = AddChild<LayerImpl>(root); 9690 LayerImpl* render_surface1 = AddChild<LayerImpl>(root);
9689 LayerImpl* render_surface2 = AddChild<LayerImpl>(render_surface1); 9691 LayerImpl* render_surface2 = AddChild<LayerImpl>(render_surface1);
9690 LayerImpl* clip_child = AddChild<LayerImpl>(render_surface2); 9692 LayerImpl* clip_child = AddChild<LayerImpl>(render_surface2);
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
10070 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); 10072 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index());
10071 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); 10073 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index());
10072 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); 10074 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index());
10073 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); 10075 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index());
10074 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); 10076 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index());
10075 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); 10077 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index());
10076 } 10078 }
10077 10079
10078 } // namespace 10080 } // namespace
10079 } // namespace cc 10081 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/draw_property_utils.cc ('k') | cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698