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

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

Issue 2764343006: cc : Make visible rect independant of render surface's is_clipped value (Closed)
Patch Set: remove fully visible path Created 3 years, 9 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') | third_party/WebKit/LayoutTests/TestExpectations » ('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 3955 matching lines...) Expand 10 before | Expand all | Expand 10 after
3966 render_surface2->test_properties()->force_render_surface = true; 3966 render_surface2->test_properties()->force_render_surface = true;
3967 render_surface2->SetDrawsContent(true); 3967 render_surface2->SetDrawsContent(true);
3968 3968
3969 child1->SetMasksToBounds(true); 3969 child1->SetMasksToBounds(true);
3970 child2->SetMasksToBounds(true); 3970 child2->SetMasksToBounds(true);
3971 ExecuteCalculateDrawProperties(root); 3971 ExecuteCalculateDrawProperties(root);
3972 EXPECT_EQ(gfx::Rect(100, 100), child1->visible_layer_rect()); 3972 EXPECT_EQ(gfx::Rect(100, 100), child1->visible_layer_rect());
3973 EXPECT_EQ(gfx::Rect(100, 100), render_surface2->visible_layer_rect()); 3973 EXPECT_EQ(gfx::Rect(100, 100), render_surface2->visible_layer_rect());
3974 } 3974 }
3975 3975
3976 TEST_F(LayerTreeHostCommonTest, VisibleRectOfUnclippedRenderSurface) {
3977 LayerImpl* root = root_layer_for_testing();
3978 LayerImpl* clip = AddChildToRoot<LayerImpl>();
3979 LayerImpl* render_surface1 = AddChild<LayerImpl>(clip);
3980 LayerImpl* render_surface2 = AddChild<LayerImpl>(render_surface1);
3981
3982 root->SetBounds(gfx::Size(100, 100));
3983 clip->SetBounds(gfx::Size(50, 50));
3984 clip->SetMasksToBounds(true);
3985 render_surface1->SetBounds(gfx::Size(100, 100));
3986 render_surface1->test_properties()->force_render_surface = true;
3987 render_surface2->SetBounds(gfx::Size(100, 100));
3988 render_surface2->test_properties()->force_render_surface = true;
3989 render_surface2->SetDrawsContent(true);
3990
3991 ExecuteCalculateDrawProperties(root);
3992 // The clip should be handled by render_surface1 and render_surface2 should
3993 // be unclipped and its visible rect should be clipped only by viewport clip.
3994 EXPECT_FALSE(render_surface2->is_clipped());
3995 EXPECT_EQ(gfx::Rect(100, 100), render_surface2->visible_layer_rect());
3996 }
3997
3998 TEST_F(LayerTreeHostCommonTest, 3976 TEST_F(LayerTreeHostCommonTest,
3999 VisibleRectsWhenClipChildIsBetweenTwoRenderSurfaces) { 3977 VisibleRectsWhenClipChildIsBetweenTwoRenderSurfaces) {
4000 LayerImpl* root = root_layer_for_testing(); 3978 LayerImpl* root = root_layer_for_testing();
4001 LayerImpl* clip_parent = AddChildToRoot<LayerImpl>(); 3979 LayerImpl* clip_parent = AddChildToRoot<LayerImpl>();
4002 LayerImpl* render_surface1 = AddChild<LayerImpl>(clip_parent); 3980 LayerImpl* render_surface1 = AddChild<LayerImpl>(clip_parent);
4003 LayerImpl* clip_child = AddChild<LayerImpl>(render_surface1); 3981 LayerImpl* clip_child = AddChild<LayerImpl>(render_surface1);
4004 LayerImpl* render_surface2 = AddChild<LayerImpl>(clip_child); 3982 LayerImpl* render_surface2 = AddChild<LayerImpl>(clip_child);
4005 3983
4006 root->SetBounds(gfx::Size(100, 100)); 3984 root->SetBounds(gfx::Size(100, 100));
4007 3985
(...skipping 6719 matching lines...) Expand 10 before | Expand all | Expand 10 after
10727 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); 10705 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index());
10728 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); 10706 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index());
10729 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); 10707 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index());
10730 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); 10708 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index());
10731 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); 10709 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index());
10732 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); 10710 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index());
10733 } 10711 }
10734 10712
10735 } // namespace 10713 } // namespace
10736 } // namespace cc 10714 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/draw_property_utils.cc ('k') | third_party/WebKit/LayoutTests/TestExpectations » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698