| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_impl.h" | 5 #include "cc/trees/layer_tree_impl.h" |
| 6 | 6 |
| 7 #include "cc/layers/heads_up_display_layer_impl.h" | 7 #include "cc/layers/heads_up_display_layer_impl.h" |
| 8 #include "cc/layers/layer.h" | 8 #include "cc/layers/layer.h" |
| 9 #include "cc/layers/solid_color_scrollbar_layer_impl.h" | 9 #include "cc/layers/solid_color_scrollbar_layer_impl.h" |
| 10 #include "cc/test/fake_impl_task_runner_provider.h" | 10 #include "cc/test/fake_impl_task_runner_provider.h" |
| (...skipping 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1211 | 1211 |
| 1212 position = gfx::PointF(0.f, 40.f); | 1212 position = gfx::PointF(0.f, 40.f); |
| 1213 bounds = gfx::Size(100, 50); | 1213 bounds = gfx::Size(100, 50); |
| 1214 SetLayerPropertiesForTesting(grand_child.get(), identity_matrix, | 1214 SetLayerPropertiesForTesting(grand_child.get(), identity_matrix, |
| 1215 transform_origin, position, bounds, true, | 1215 transform_origin, position, bounds, true, |
| 1216 false, false); | 1216 false, false); |
| 1217 grand_child->SetDrawsContent(true); | 1217 grand_child->SetDrawsContent(true); |
| 1218 grand_child->SetHasRenderSurface(true); | 1218 grand_child->SetHasRenderSurface(true); |
| 1219 | 1219 |
| 1220 // This should let |grand_child| "escape" |child|'s clip. | 1220 // This should let |grand_child| "escape" |child|'s clip. |
| 1221 grand_child->SetClipParent(root.get()); | 1221 grand_child->test_properties()->clip_parent = root.get(); |
| 1222 std::unique_ptr<std::set<LayerImpl*>> clip_children( | 1222 std::unique_ptr<std::set<LayerImpl*>> clip_children( |
| 1223 new std::set<LayerImpl*>); | 1223 new std::set<LayerImpl*>); |
| 1224 clip_children->insert(grand_child.get()); | 1224 clip_children->insert(grand_child.get()); |
| 1225 root->SetClipChildren(clip_children.release()); | 1225 root->test_properties()->clip_children.reset(clip_children.release()); |
| 1226 | 1226 |
| 1227 child->AddChild(std::move(grand_child)); | 1227 child->AddChild(std::move(grand_child)); |
| 1228 root->AddChild(std::move(child)); | 1228 root->AddChild(std::move(child)); |
| 1229 } | 1229 } |
| 1230 | 1230 |
| 1231 host_impl().SetViewportSize(root->bounds()); | 1231 host_impl().SetViewportSize(root->bounds()); |
| 1232 host_impl().active_tree()->SetRootLayer(std::move(root)); | 1232 host_impl().active_tree()->SetRootLayer(std::move(root)); |
| 1233 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 1233 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 1234 | 1234 |
| 1235 gfx::PointF test_point(12.f, 52.f); | 1235 gfx::PointF test_point(12.f, 52.f); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1266 | 1266 |
| 1267 position = gfx::PointF(); | 1267 position = gfx::PointF(); |
| 1268 bounds = gfx::Size(200, 200); | 1268 bounds = gfx::Size(200, 200); |
| 1269 SetLayerPropertiesForTesting(scroll_child.get(), identity_matrix, | 1269 SetLayerPropertiesForTesting(scroll_child.get(), identity_matrix, |
| 1270 transform_origin, position, bounds, true, | 1270 transform_origin, position, bounds, true, |
| 1271 false, false); | 1271 false, false); |
| 1272 scroll_child->SetDrawsContent(true); | 1272 scroll_child->SetDrawsContent(true); |
| 1273 | 1273 |
| 1274 // This should cause scroll child and its descendants to be affected by | 1274 // This should cause scroll child and its descendants to be affected by |
| 1275 // |child|'s clip. | 1275 // |child|'s clip. |
| 1276 scroll_child->SetScrollParent(child.get()); | 1276 scroll_child->test_properties()->scroll_parent = child.get(); |
| 1277 std::unique_ptr<std::set<LayerImpl*>> scroll_children( | 1277 std::unique_ptr<std::set<LayerImpl*>> scroll_children( |
| 1278 new std::set<LayerImpl*>); | 1278 new std::set<LayerImpl*>); |
| 1279 scroll_children->insert(scroll_child.get()); | 1279 scroll_children->insert(scroll_child.get()); |
| 1280 child->SetScrollChildren(scroll_children.release()); | 1280 child->test_properties()->scroll_children.reset(scroll_children.release()); |
| 1281 | 1281 |
| 1282 SetLayerPropertiesForTesting(grand_child.get(), identity_matrix, | 1282 SetLayerPropertiesForTesting(grand_child.get(), identity_matrix, |
| 1283 transform_origin, position, bounds, true, | 1283 transform_origin, position, bounds, true, |
| 1284 false, false); | 1284 false, false); |
| 1285 grand_child->SetDrawsContent(true); | 1285 grand_child->SetDrawsContent(true); |
| 1286 grand_child->SetHasRenderSurface(true); | 1286 grand_child->SetHasRenderSurface(true); |
| 1287 | 1287 |
| 1288 scroll_child->AddChild(std::move(grand_child)); | 1288 scroll_child->AddChild(std::move(grand_child)); |
| 1289 root->AddChild(std::move(scroll_child)); | 1289 root->AddChild(std::move(scroll_child)); |
| 1290 root->AddChild(std::move(child)); | 1290 root->AddChild(std::move(child)); |
| (...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2541 gfx::PointF test_point = gfx::PointF(1.f, 1.f); | 2541 gfx::PointF test_point = gfx::PointF(1.f, 1.f); |
| 2542 LayerImpl* result_layer = | 2542 LayerImpl* result_layer = |
| 2543 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); | 2543 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); |
| 2544 | 2544 |
| 2545 CHECK(result_layer); | 2545 CHECK(result_layer); |
| 2546 EXPECT_EQ(2, result_layer->id()); | 2546 EXPECT_EQ(2, result_layer->id()); |
| 2547 } | 2547 } |
| 2548 | 2548 |
| 2549 } // namespace | 2549 } // namespace |
| 2550 } // namespace cc | 2550 } // namespace cc |
| OLD | NEW |