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

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

Issue 2067783002: cc: Calculate visible rect inside non root copy request (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rectF
Patch Set: rebase Created 4 years, 6 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
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 5751 matching lines...) Expand 10 before | Expand all | Expand 10 after
5762 ASSERT_EQ(2u, render_surface_layer_list.size()); 5762 ASSERT_EQ(2u, render_surface_layer_list.size());
5763 EXPECT_EQ(root_layer->id(), render_surface_layer_list.at(0)->id()); 5763 EXPECT_EQ(root_layer->id(), render_surface_layer_list.at(0)->id());
5764 5764
5765 // The root render surface should only have 2 contributing layer, since the 5765 // The root render surface should only have 2 contributing layer, since the
5766 // other layers are empty/clipped away. 5766 // other layers are empty/clipped away.
5767 ASSERT_EQ(2u, root_layer->render_surface()->layer_list().size()); 5767 ASSERT_EQ(2u, root_layer->render_surface()->layer_list().size());
5768 EXPECT_EQ(root_layer->id(), 5768 EXPECT_EQ(root_layer->id(),
5769 root_layer->render_surface()->layer_list().at(0)->id()); 5769 root_layer->render_surface()->layer_list().at(0)->id());
5770 } 5770 }
5771 5771
5772 TEST_F(LayerTreeHostCommonTest, VisibleRectInNonRootCopyRequest) {
5773 FakeImplTaskRunnerProvider task_runner_provider;
5774 TestSharedBitmapManager shared_bitmap_manager;
5775 TestTaskGraphRunner task_graph_runner;
5776 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
5777 &task_graph_runner);
5778 host_impl.CreatePendingTree();
ajuma 2016/06/14 15:09:53 Is this needed? It looks like the test is only usi
weiliangc 2016/06/15 12:27:57 Removed.
5779 const gfx::Transform identity_matrix;
5780
5781 LayerImpl* root = root_layer();
5782 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(),
5783 gfx::PointF(), gfx::Size(50, 50), true, false,
5784 true);
5785 root->SetDrawsContent(true);
5786 root->SetMasksToBounds(true);
5787
5788 LayerImpl* copy_layer = AddChild<LayerImpl>(root);
5789 SetLayerPropertiesForTesting(copy_layer, identity_matrix, gfx::Point3F(),
5790 gfx::PointF(), gfx::Size(100, 100), true, false,
5791 true);
5792 copy_layer->SetDrawsContent(true);
ajuma 2016/06/14 15:25:17 It be worth including a test where the copy_layer
weiliangc 2016/06/15 12:27:57 Done.
5793
5794 LayerImpl* copy_child = AddChild<LayerImpl>(copy_layer);
5795 SetLayerPropertiesForTesting(copy_child, identity_matrix, gfx::Point3F(),
5796 gfx::PointF(40, 40), gfx::Size(20, 20), true,
5797 false, false);
5798 copy_child->SetDrawsContent(true);
5799
5800 LayerImpl* copy_clip = AddChild<LayerImpl>(copy_layer);
5801 SetLayerPropertiesForTesting(copy_clip, identity_matrix, gfx::Point3F(),
5802 gfx::PointF(), gfx::Size(55, 55), true, false,
5803 false);
5804 copy_clip->SetMasksToBounds(true);
5805
5806 LayerImpl* copy_clipped_child = AddChild<LayerImpl>(copy_clip);
5807 SetLayerPropertiesForTesting(copy_clipped_child, identity_matrix,
5808 gfx::Point3F(), gfx::PointF(40, 40),
5809 gfx::Size(20, 20), true, false, false);
5810 copy_clipped_child->SetDrawsContent(true);
5811
5812 LayerImpl* copy_surface = AddChild<LayerImpl>(copy_clip);
5813 SetLayerPropertiesForTesting(copy_surface, identity_matrix, gfx::Point3F(),
5814 gfx::PointF(45, 45), gfx::Size(20, 20), true,
5815 false, true);
5816 copy_surface->SetDrawsContent(true);
5817
5818 copy_layer->test_properties()->copy_requests.push_back(
5819 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback)));
5820
5821 ExecuteCalculateDrawProperties(root);
5822
5823 EXPECT_EQ(gfx::Rect(100, 100), copy_layer->visible_layer_rect());
5824 EXPECT_EQ(gfx::Rect(20, 20), copy_child->visible_layer_rect());
5825 EXPECT_EQ(gfx::Rect(15, 15), copy_clipped_child->visible_layer_rect());
5826 EXPECT_EQ(gfx::Rect(10, 10), copy_surface->visible_layer_rect());
5827 }
5828
5772 TEST_F(LayerTreeHostCommonTest, VisibleContentRectInsideSurface) { 5829 TEST_F(LayerTreeHostCommonTest, VisibleContentRectInsideSurface) {
5773 LayerImpl* root = root_layer(); 5830 LayerImpl* root = root_layer();
5774 LayerImpl* surface = AddChild<LayerImpl>(root); 5831 LayerImpl* surface = AddChild<LayerImpl>(root);
5775 LayerImpl* surface_child = AddChild<LayerImpl>(surface); 5832 LayerImpl* surface_child = AddChild<LayerImpl>(surface);
5776 5833
5777 const gfx::Transform identity_matrix; 5834 const gfx::Transform identity_matrix;
5778 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(), 5835 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(),
5779 gfx::PointF(), gfx::Size(50, 50), true, false, 5836 gfx::PointF(), gfx::Size(50, 50), true, false,
5780 true); 5837 true);
5781 SetLayerPropertiesForTesting(surface, identity_matrix, gfx::Point3F(), 5838 SetLayerPropertiesForTesting(surface, identity_matrix, gfx::Point3F(),
(...skipping 4479 matching lines...) Expand 10 before | Expand all | Expand 10 after
10261 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); 10318 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index());
10262 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); 10319 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index());
10263 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); 10320 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index());
10264 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); 10321 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index());
10265 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); 10322 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index());
10266 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); 10323 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index());
10267 } 10324 }
10268 10325
10269 } // namespace 10326 } // namespace
10270 } // namespace cc 10327 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698