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

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

Issue 1855373003: cc : Use same layer skipping functions in DrawPropertyUtils and LTHC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 <set> 10 #include <set>
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 143
144 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, child->draw_transform()); 144 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, child->draw_transform());
145 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, 145 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix,
146 child->screen_space_transform()); 146 child->screen_space_transform());
147 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, 147 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix,
148 grand_child->draw_transform()); 148 grand_child->draw_transform());
149 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, 149 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix,
150 grand_child->screen_space_transform()); 150 grand_child->screen_space_transform());
151 } 151 }
152 152
153 TEST_F(LayerTreeHostCommonTest,
154 ScreenSpaceTransformOfSkippedLayersWithHandlers) {
155 // Even for layers that are skipped, we need to compute the correct screen
156 // space transform because it is used during hit testing.
157 LayerImpl* parent = root_layer();
158 LayerImpl* child = AddChild<LayerImpl>(parent);
159 LayerImpl* grand_child = AddChild<LayerImpl>(child);
160 child->SetDrawsContent(true);
161 grand_child->SetDrawsContent(true);
162
163 gfx::Transform identity_matrix;
164 SetLayerPropertiesForTesting(parent, identity_matrix, gfx::Point3F(),
165 gfx::PointF(), gfx::Size(100, 100), true, false);
166 SetLayerPropertiesForTesting(child, identity_matrix, gfx::Point3F(),
167 gfx::PointF(10, 10), gfx::Size(100, 100), true,
168 false);
169 // This will cause the subtree to be skipped.
170 child->SetOpacity(0.f);
171 SetLayerPropertiesForTesting(grand_child, identity_matrix, gfx::Point3F(),
172 gfx::PointF(10, 10), gfx::Size(100, 100), true,
173 false);
174 grand_child->SetTouchEventHandlerRegion(gfx::Rect(0, 0, 100, 100));
175
176 ExecuteCalculateDrawProperties(parent);
177
178 EXPECT_TRUE(child->has_render_surface());
179 EXPECT_FALSE(grand_child->has_render_surface());
180 // Check that we've computed draw properties for the subtree rooted at
181 // |child|.
182 EXPECT_FALSE(child->render_surface()->screen_space_transform().IsIdentity());
183 EXPECT_FALSE(grand_child->ScreenSpaceTransform().IsIdentity());
184 }
185
186 TEST_F(LayerTreeHostCommonTest, EffectTreeTransformIdTest) { 153 TEST_F(LayerTreeHostCommonTest, EffectTreeTransformIdTest) {
187 // Tests that effect tree node gets a valid transform id when a layer 154 // Tests that effect tree node gets a valid transform id when a layer
188 // has opacity but doesn't create a render surface. 155 // has opacity but doesn't create a render surface.
189 LayerImpl* parent = root_layer(); 156 LayerImpl* parent = root_layer();
190 LayerImpl* child = AddChild<LayerImpl>(parent); 157 LayerImpl* child = AddChild<LayerImpl>(parent);
191 child->SetDrawsContent(true); 158 child->SetDrawsContent(true);
192 159
193 gfx::Transform identity_matrix; 160 gfx::Transform identity_matrix;
194 SetLayerPropertiesForTesting(parent, identity_matrix, gfx::Point3F(), 161 SetLayerPropertiesForTesting(parent, identity_matrix, gfx::Point3F(),
195 gfx::PointF(), gfx::Size(100, 100), true, false); 162 gfx::PointF(), gfx::Size(100, 100), true, false);
(...skipping 9849 matching lines...) Expand 10 before | Expand all | Expand 10 after
10045 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); 10012 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index());
10046 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); 10013 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index());
10047 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); 10014 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index());
10048 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); 10015 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index());
10049 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); 10016 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index());
10050 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); 10017 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index());
10051 } 10018 }
10052 10019
10053 } // namespace 10020 } // namespace
10054 } // namespace cc 10021 } // namespace cc
OLDNEW
« cc/trees/layer_tree_host_common.cc ('K') | « cc/trees/layer_tree_host_common.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698