Chromium Code Reviews| 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, DrawnChildrenRequiresScreenSpaceTransform) { | |
| 160 // Sanity check: For layers positioned at zero, with zero size, | |
| 161 // and with identity transforms, then the draw transform, | |
| 162 // screen space transform, and the hierarchy passed on to children | |
| 163 // layers should also be identity transforms. | |
| 164 | |
| 165 scoped_refptr<Layer> parent = Layer::Create(); | |
| 166 scoped_refptr<Layer> child = Layer::Create(); | |
| 167 scoped_refptr<Layer> grand_child = Layer::Create(); | |
| 168 parent->AddChild(child); | |
| 169 child->AddChild(grand_child); | |
| 170 | |
| 171 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | |
| 172 host->SetRootLayer(parent); | |
| 173 | |
| 174 gfx::Transform identity_matrix; | |
| 175 SetLayerPropertiesForTesting(parent.get(), | |
| 176 identity_matrix, | |
| 177 gfx::Point3F(), | |
| 178 gfx::PointF(), | |
| 179 gfx::Size(100, 100), | |
| 180 true, | |
| 181 false); | |
| 182 SetLayerPropertiesForTesting(child.get(), | |
| 183 identity_matrix, | |
| 184 gfx::Point3F(), | |
| 185 gfx::PointF(10, 10), | |
| 186 gfx::Size(100, 100), | |
| 187 true, | |
| 188 false); | |
| 189 child->SetIsDrawable(false); | |
| 190 SetLayerPropertiesForTesting(grand_child.get(), | |
| 191 identity_matrix, | |
| 192 gfx::Point3F(), | |
| 193 gfx::PointF(), | |
| 194 gfx::Size(100, 100), | |
| 195 true, | |
| 196 false); | |
| 197 | |
| 198 ExecuteCalculateDrawProperties(parent.get()); | |
| 199 | |
| 200 EXPECT_FALSE(child->screen_space_transform().IsIdentity()); | |
|
danakj
2014/06/11 22:15:06
Can you verify content_bounds() as well since you
Ian Vollick
2014/06/11 23:50:37
I've added a check for non-empty content bounds, t
| |
| 201 } | |
| 202 | |
| 159 TEST_F(LayerTreeHostCommonTest, TransformsForSingleLayer) { | 203 TEST_F(LayerTreeHostCommonTest, TransformsForSingleLayer) { |
| 160 gfx::Transform identity_matrix; | 204 gfx::Transform identity_matrix; |
| 161 scoped_refptr<Layer> layer = Layer::Create(); | 205 scoped_refptr<Layer> layer = Layer::Create(); |
| 162 | 206 |
| 163 scoped_refptr<Layer> root = Layer::Create(); | 207 scoped_refptr<Layer> root = Layer::Create(); |
| 164 SetLayerPropertiesForTesting(root.get(), | 208 SetLayerPropertiesForTesting(root.get(), |
| 165 identity_matrix, | 209 identity_matrix, |
| 166 gfx::Point3F(), | 210 gfx::Point3F(), |
| 167 gfx::PointF(), | 211 gfx::PointF(), |
| 168 gfx::Size(1, 2), | 212 gfx::Size(1, 2), |
| (...skipping 8138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8307 expected.insert(child_raw); | 8351 expected.insert(child_raw); |
| 8308 expected.insert(grand_child1_raw); | 8352 expected.insert(grand_child1_raw); |
| 8309 expected.insert(grand_child2_raw); | 8353 expected.insert(grand_child2_raw); |
| 8310 | 8354 |
| 8311 actual.clear(); | 8355 actual.clear(); |
| 8312 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); | 8356 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); |
| 8313 EXPECT_EQ(expected, actual); | 8357 EXPECT_EQ(expected, actual); |
| 8314 } | 8358 } |
| 8315 } // namespace | 8359 } // namespace |
| 8316 } // namespace cc | 8360 } // namespace cc |
| OLD | NEW |