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

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

Issue 2117173002: cc: Don't skip clip rect calculation for copy request layers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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') | no next file » | 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 5813 matching lines...) Expand 10 before | Expand all | Expand 10 after
5824 5824
5825 LayerImpl* copy_surface = AddChild<LayerImpl>(copy_clip); 5825 LayerImpl* copy_surface = AddChild<LayerImpl>(copy_clip);
5826 SetLayerPropertiesForTesting(copy_surface, identity_matrix, gfx::Point3F(), 5826 SetLayerPropertiesForTesting(copy_surface, identity_matrix, gfx::Point3F(),
5827 gfx::PointF(45, 45), gfx::Size(20, 20), true, 5827 gfx::PointF(45, 45), gfx::Size(20, 20), true,
5828 false, true); 5828 false, true);
5829 copy_surface->SetDrawsContent(true); 5829 copy_surface->SetDrawsContent(true);
5830 5830
5831 copy_layer->test_properties()->copy_requests.push_back( 5831 copy_layer->test_properties()->copy_requests.push_back(
5832 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback))); 5832 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback)));
5833 5833
5834 DCHECK(!copy_layer->test_properties()->copy_requests.empty());
5834 ExecuteCalculateDrawProperties(root); 5835 ExecuteCalculateDrawProperties(root);
5836 DCHECK(copy_layer->test_properties()->copy_requests.empty());
5835 5837
5836 EXPECT_EQ(gfx::Rect(100, 100), copy_layer->visible_layer_rect()); 5838 EXPECT_EQ(gfx::Rect(100, 100), copy_layer->visible_layer_rect());
5837 EXPECT_EQ(gfx::Rect(20, 20), copy_child->visible_layer_rect()); 5839 EXPECT_EQ(gfx::Rect(20, 20), copy_child->visible_layer_rect());
5838 EXPECT_EQ(gfx::Rect(15, 15), copy_clipped_child->visible_layer_rect()); 5840 EXPECT_EQ(gfx::Rect(15, 15), copy_clipped_child->visible_layer_rect());
5839 EXPECT_EQ(gfx::Rect(10, 10), copy_surface->visible_layer_rect()); 5841 EXPECT_EQ(gfx::Rect(10, 10), copy_surface->visible_layer_rect());
5840 5842
5841 // Case 2: When the non root copy request layer is clipped. 5843 // Case 2: When the non root copy request layer is clipped.
5842 copy_layer->SetBounds(gfx::Size(50, 50)); 5844 copy_layer->SetBounds(gfx::Size(50, 50));
5843 copy_layer->SetMasksToBounds(true); 5845 copy_layer->SetMasksToBounds(true);
5846 copy_layer->test_properties()->copy_requests.push_back(
5847 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback)));
5844 root->layer_tree_impl()->property_trees()->needs_rebuild = true; 5848 root->layer_tree_impl()->property_trees()->needs_rebuild = true;
5845 5849
5850 DCHECK(!copy_layer->test_properties()->copy_requests.empty());
5846 ExecuteCalculateDrawProperties(root); 5851 ExecuteCalculateDrawProperties(root);
5852 DCHECK(copy_layer->test_properties()->copy_requests.empty());
5847 5853
5848 EXPECT_EQ(gfx::Rect(50, 50), copy_layer->visible_layer_rect()); 5854 EXPECT_EQ(gfx::Rect(50, 50), copy_layer->visible_layer_rect());
5849 EXPECT_EQ(gfx::Rect(10, 10), copy_child->visible_layer_rect()); 5855 EXPECT_EQ(gfx::Rect(10, 10), copy_child->visible_layer_rect());
5850 EXPECT_EQ(gfx::Rect(10, 10), copy_clipped_child->visible_layer_rect()); 5856 EXPECT_EQ(gfx::Rect(10, 10), copy_clipped_child->visible_layer_rect());
5851 EXPECT_EQ(gfx::Rect(5, 5), copy_surface->visible_layer_rect()); 5857 EXPECT_EQ(gfx::Rect(5, 5), copy_surface->visible_layer_rect());
5852 } 5858 }
5853 5859
5854 TEST_F(LayerTreeHostCommonTest, VisibleContentRectInsideSurface) { 5860 TEST_F(LayerTreeHostCommonTest, VisibleContentRectInsideSurface) {
5855 LayerImpl* root = root_layer_for_testing(); 5861 LayerImpl* root = root_layer_for_testing();
5856 LayerImpl* surface = AddChild<LayerImpl>(root); 5862 LayerImpl* surface = AddChild<LayerImpl>(root);
(...skipping 4492 matching lines...) Expand 10 before | Expand all | Expand 10 after
10349 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); 10355 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index());
10350 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); 10356 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index());
10351 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); 10357 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index());
10352 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); 10358 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index());
10353 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); 10359 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index());
10354 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); 10360 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index());
10355 } 10361 }
10356 10362
10357 } // namespace 10363 } // namespace
10358 } // namespace cc 10364 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/draw_property_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698