OLD | NEW |
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 <set> | 7 #include <set> |
8 | 8 |
9 #include "cc/animation/layer_animation_controller.h" | 9 #include "cc/animation/layer_animation_controller.h" |
10 #include "cc/animation/transform_operations.h" | 10 #include "cc/animation/transform_operations.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 | 149 |
150 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, child->draw_transform()); | 150 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, child->draw_transform()); |
151 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, | 151 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, |
152 child->screen_space_transform()); | 152 child->screen_space_transform()); |
153 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, | 153 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, |
154 grand_child->draw_transform()); | 154 grand_child->draw_transform()); |
155 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, | 155 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, |
156 grand_child->screen_space_transform()); | 156 grand_child->screen_space_transform()); |
157 } | 157 } |
158 | 158 |
| 159 TEST_F(LayerTreeHostCommonTest, DoNotSkipLayersWithHandlers) { |
| 160 scoped_refptr<Layer> parent = Layer::Create(); |
| 161 scoped_refptr<Layer> child = Layer::Create(); |
| 162 scoped_refptr<Layer> grand_child = Layer::Create(); |
| 163 parent->AddChild(child); |
| 164 child->AddChild(grand_child); |
| 165 |
| 166 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); |
| 167 host->SetRootLayer(parent); |
| 168 |
| 169 gfx::Transform identity_matrix; |
| 170 SetLayerPropertiesForTesting(parent.get(), |
| 171 identity_matrix, |
| 172 gfx::Point3F(), |
| 173 gfx::PointF(), |
| 174 gfx::Size(100, 100), |
| 175 true, |
| 176 false); |
| 177 SetLayerPropertiesForTesting(child.get(), |
| 178 identity_matrix, |
| 179 gfx::Point3F(), |
| 180 gfx::PointF(10, 10), |
| 181 gfx::Size(100, 100), |
| 182 true, |
| 183 false); |
| 184 // This would have previously caused us to skip our subtree, but this would be |
| 185 // wrong; we need up-to-date draw properties to do hit testing on the layers |
| 186 // with handlers. |
| 187 child->SetOpacity(0.f); |
| 188 SetLayerPropertiesForTesting(grand_child.get(), |
| 189 identity_matrix, |
| 190 gfx::Point3F(), |
| 191 gfx::PointF(10, 10), |
| 192 gfx::Size(100, 100), |
| 193 true, |
| 194 false); |
| 195 grand_child->SetTouchEventHandlerRegion(gfx::Rect(0, 0, 100, 100)); |
| 196 |
| 197 ExecuteCalculateDrawProperties(parent.get()); |
| 198 |
| 199 // Check that we've computed draw properties for the subtree rooted at |
| 200 // |child|. |
| 201 EXPECT_FALSE(child->draw_transform().IsIdentity()); |
| 202 EXPECT_FALSE(grand_child->draw_transform().IsIdentity()); |
| 203 } |
| 204 |
159 TEST_F(LayerTreeHostCommonTest, TransformsForSingleLayer) { | 205 TEST_F(LayerTreeHostCommonTest, TransformsForSingleLayer) { |
160 gfx::Transform identity_matrix; | 206 gfx::Transform identity_matrix; |
161 scoped_refptr<Layer> layer = Layer::Create(); | 207 scoped_refptr<Layer> layer = Layer::Create(); |
162 | 208 |
163 scoped_refptr<Layer> root = Layer::Create(); | 209 scoped_refptr<Layer> root = Layer::Create(); |
164 SetLayerPropertiesForTesting(root.get(), | 210 SetLayerPropertiesForTesting(root.get(), |
165 identity_matrix, | 211 identity_matrix, |
166 gfx::Point3F(), | 212 gfx::Point3F(), |
167 gfx::PointF(), | 213 gfx::PointF(), |
168 gfx::Size(1, 2), | 214 gfx::Size(1, 2), |
(...skipping 8138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8307 expected.insert(child_raw); | 8353 expected.insert(child_raw); |
8308 expected.insert(grand_child1_raw); | 8354 expected.insert(grand_child1_raw); |
8309 expected.insert(grand_child2_raw); | 8355 expected.insert(grand_child2_raw); |
8310 | 8356 |
8311 actual.clear(); | 8357 actual.clear(); |
8312 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); | 8358 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); |
8313 EXPECT_EQ(expected, actual); | 8359 EXPECT_EQ(expected, actual); |
8314 } | 8360 } |
8315 } // namespace | 8361 } // namespace |
8316 } // namespace cc | 8362 } // namespace cc |
OLD | NEW |