| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 gfx::Transform identity_matrix; | 66 gfx::Transform identity_matrix; |
| 67 gfx::Point3F transform_origin; | 67 gfx::Point3F transform_origin; |
| 68 gfx::PointF position; | 68 gfx::PointF position; |
| 69 gfx::Size bounds(100, 100); | 69 gfx::Size bounds(100, 100); |
| 70 SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin, | 70 SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin, |
| 71 position, bounds, true, false, true); | 71 position, bounds, true, false, true); |
| 72 root->SetDrawsContent(true); | 72 root->SetDrawsContent(true); |
| 73 | 73 |
| 74 host_impl().SetViewportSize(root->bounds()); | 74 host_impl().SetViewportSize(root->bounds()); |
| 75 host_impl().active_tree()->SetRootLayer(root.Pass()); | 75 host_impl().active_tree()->SetRootLayer(std::move(root)); |
| 76 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 76 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 77 | 77 |
| 78 // Sanity check the scenario we just created. | 78 // Sanity check the scenario we just created. |
| 79 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 79 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
| 80 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); | 80 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); |
| 81 | 81 |
| 82 // Hit testing for a point outside the layer should return a null pointer. | 82 // Hit testing for a point outside the layer should return a null pointer. |
| 83 gfx::PointF test_point(101.f, 101.f); | 83 gfx::PointF test_point(101.f, 101.f); |
| 84 LayerImpl* result_layer = | 84 LayerImpl* result_layer = |
| 85 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); | 85 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 123 |
| 124 gfx::Transform identity_matrix; | 124 gfx::Transform identity_matrix; |
| 125 gfx::Point3F transform_origin; | 125 gfx::Point3F transform_origin; |
| 126 gfx::PointF position; | 126 gfx::PointF position; |
| 127 gfx::Size bounds(100, 100); | 127 gfx::Size bounds(100, 100); |
| 128 SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin, | 128 SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin, |
| 129 position, bounds, true, false, true); | 129 position, bounds, true, false, true); |
| 130 root->SetDrawsContent(true); | 130 root->SetDrawsContent(true); |
| 131 | 131 |
| 132 host_impl->SetViewportSize(root->bounds()); | 132 host_impl->SetViewportSize(root->bounds()); |
| 133 host_impl->active_tree()->SetRootLayer(root.Pass()); | 133 host_impl->active_tree()->SetRootLayer(std::move(root)); |
| 134 host_impl->UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 134 host_impl->UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 135 EXPECT_EQ( | 135 EXPECT_EQ( |
| 136 gfx::RectF(gfx::SizeF(bounds)), | 136 gfx::RectF(gfx::SizeF(bounds)), |
| 137 host_impl->active_tree()->property_trees()->clip_tree.ViewportClip()); | 137 host_impl->active_tree()->property_trees()->clip_tree.ViewportClip()); |
| 138 EXPECT_EQ(gfx::Rect(bounds), | 138 EXPECT_EQ(gfx::Rect(bounds), |
| 139 host_impl->RootLayer()->visible_rect_from_property_trees()); | 139 host_impl->RootLayer()->visible_rect_from_property_trees()); |
| 140 | 140 |
| 141 gfx::Size new_bounds(50, 50); | 141 gfx::Size new_bounds(50, 50); |
| 142 host_impl->SetViewportSize(new_bounds); | 142 host_impl->SetViewportSize(new_bounds); |
| 143 gfx::PointF test_point(51.f, 51.f); | 143 gfx::PointF test_point(51.f, 51.f); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 163 position, bounds, true, false, true); | 163 position, bounds, true, false, true); |
| 164 root->SetDrawsContent(true); | 164 root->SetDrawsContent(true); |
| 165 | 165 |
| 166 // Create hud and add it as a child of root. | 166 // Create hud and add it as a child of root. |
| 167 gfx::Size hud_bounds(200, 200); | 167 gfx::Size hud_bounds(200, 200); |
| 168 SetLayerPropertiesForTesting(hud.get(), identity_matrix, transform_origin, | 168 SetLayerPropertiesForTesting(hud.get(), identity_matrix, transform_origin, |
| 169 position, hud_bounds, true, false, false); | 169 position, hud_bounds, true, false, false); |
| 170 hud->SetDrawsContent(true); | 170 hud->SetDrawsContent(true); |
| 171 | 171 |
| 172 host_impl().active_tree()->set_hud_layer(hud.get()); | 172 host_impl().active_tree()->set_hud_layer(hud.get()); |
| 173 root->AddChild(hud.Pass()); | 173 root->AddChild(std::move(hud)); |
| 174 | 174 |
| 175 host_impl().SetViewportSize(hud_bounds); | 175 host_impl().SetViewportSize(hud_bounds); |
| 176 host_impl().active_tree()->SetRootLayer(root.Pass()); | 176 host_impl().active_tree()->SetRootLayer(std::move(root)); |
| 177 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 177 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 178 | 178 |
| 179 // Sanity check the scenario we just created. | 179 // Sanity check the scenario we just created. |
| 180 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 180 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
| 181 ASSERT_EQ(2u, root_layer()->render_surface()->layer_list().size()); | 181 ASSERT_EQ(2u, root_layer()->render_surface()->layer_list().size()); |
| 182 | 182 |
| 183 // Hit testing for a point inside HUD, but outside root should return null | 183 // Hit testing for a point inside HUD, but outside root should return null |
| 184 gfx::PointF test_point(101.f, 101.f); | 184 gfx::PointF test_point(101.f, 101.f); |
| 185 LayerImpl* result_layer = | 185 LayerImpl* result_layer = |
| 186 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); | 186 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 gfx::Transform identity_matrix; | 220 gfx::Transform identity_matrix; |
| 221 gfx::Point3F transform_origin; | 221 gfx::Point3F transform_origin; |
| 222 gfx::PointF position; | 222 gfx::PointF position; |
| 223 gfx::Size bounds(100, 100); | 223 gfx::Size bounds(100, 100); |
| 224 SetLayerPropertiesForTesting(root.get(), uninvertible_transform, | 224 SetLayerPropertiesForTesting(root.get(), uninvertible_transform, |
| 225 transform_origin, position, bounds, true, false, | 225 transform_origin, position, bounds, true, false, |
| 226 true); | 226 true); |
| 227 root->SetDrawsContent(true); | 227 root->SetDrawsContent(true); |
| 228 | 228 |
| 229 host_impl().SetViewportSize(root->bounds()); | 229 host_impl().SetViewportSize(root->bounds()); |
| 230 host_impl().active_tree()->SetRootLayer(root.Pass()); | 230 host_impl().active_tree()->SetRootLayer(std::move(root)); |
| 231 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 231 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 232 // Sanity check the scenario we just created. | 232 // Sanity check the scenario we just created. |
| 233 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 233 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
| 234 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); | 234 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); |
| 235 ASSERT_FALSE(root_layer()->screen_space_transform().IsInvertible()); | 235 ASSERT_FALSE(root_layer()->screen_space_transform().IsInvertible()); |
| 236 | 236 |
| 237 // Hit testing any point should not hit the layer. If the invertible matrix is | 237 // Hit testing any point should not hit the layer. If the invertible matrix is |
| 238 // accidentally ignored and treated like an identity, then the hit testing | 238 // accidentally ignored and treated like an identity, then the hit testing |
| 239 // will incorrectly hit the layer when it shouldn't. | 239 // will incorrectly hit the layer when it shouldn't. |
| 240 gfx::PointF test_point(1.f, 1.f); | 240 gfx::PointF test_point(1.f, 1.f); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 gfx::Point3F transform_origin; | 281 gfx::Point3F transform_origin; |
| 282 // this layer is positioned, and hit testing should correctly know where the | 282 // this layer is positioned, and hit testing should correctly know where the |
| 283 // layer is located. | 283 // layer is located. |
| 284 gfx::PointF position(50.f, 50.f); | 284 gfx::PointF position(50.f, 50.f); |
| 285 gfx::Size bounds(100, 100); | 285 gfx::Size bounds(100, 100); |
| 286 SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin, | 286 SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin, |
| 287 position, bounds, true, false, true); | 287 position, bounds, true, false, true); |
| 288 root->SetDrawsContent(true); | 288 root->SetDrawsContent(true); |
| 289 | 289 |
| 290 host_impl().SetViewportSize(root->bounds()); | 290 host_impl().SetViewportSize(root->bounds()); |
| 291 host_impl().active_tree()->SetRootLayer(root.Pass()); | 291 host_impl().active_tree()->SetRootLayer(std::move(root)); |
| 292 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 292 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 293 | 293 |
| 294 // Sanity check the scenario we just created. | 294 // Sanity check the scenario we just created. |
| 295 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 295 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
| 296 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); | 296 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); |
| 297 | 297 |
| 298 // Hit testing for a point outside the layer should return a null pointer. | 298 // Hit testing for a point outside the layer should return a null pointer. |
| 299 gfx::PointF test_point(49.f, 49.f); | 299 gfx::PointF test_point(49.f, 49.f); |
| 300 LayerImpl* result_layer = | 300 LayerImpl* result_layer = |
| 301 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); | 301 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 rotation45_degrees_about_center.Translate(-50.0, -50.0); | 333 rotation45_degrees_about_center.Translate(-50.0, -50.0); |
| 334 gfx::Point3F transform_origin; | 334 gfx::Point3F transform_origin; |
| 335 gfx::PointF position; | 335 gfx::PointF position; |
| 336 gfx::Size bounds(100, 100); | 336 gfx::Size bounds(100, 100); |
| 337 SetLayerPropertiesForTesting(root.get(), rotation45_degrees_about_center, | 337 SetLayerPropertiesForTesting(root.get(), rotation45_degrees_about_center, |
| 338 transform_origin, position, bounds, true, false, | 338 transform_origin, position, bounds, true, false, |
| 339 true); | 339 true); |
| 340 root->SetDrawsContent(true); | 340 root->SetDrawsContent(true); |
| 341 | 341 |
| 342 host_impl().SetViewportSize(root->bounds()); | 342 host_impl().SetViewportSize(root->bounds()); |
| 343 host_impl().active_tree()->SetRootLayer(root.Pass()); | 343 host_impl().active_tree()->SetRootLayer(std::move(root)); |
| 344 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 344 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 345 | 345 |
| 346 // Sanity check the scenario we just created. | 346 // Sanity check the scenario we just created. |
| 347 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 347 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
| 348 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); | 348 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); |
| 349 | 349 |
| 350 // Hit testing for points outside the layer. | 350 // Hit testing for points outside the layer. |
| 351 // These corners would have been inside the un-transformed layer, but they | 351 // These corners would have been inside the un-transformed layer, but they |
| 352 // should not hit the correctly transformed layer. | 352 // should not hit the correctly transformed layer. |
| 353 gfx::PointF test_point(99.f, 99.f); | 353 gfx::PointF test_point(99.f, 99.f); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 | 397 |
| 398 gfx::Point3F transform_origin; | 398 gfx::Point3F transform_origin; |
| 399 gfx::PointF position; | 399 gfx::PointF position; |
| 400 gfx::Size bounds(100, 100); | 400 gfx::Size bounds(100, 100); |
| 401 SetLayerPropertiesForTesting( | 401 SetLayerPropertiesForTesting( |
| 402 root.get(), perspective_projection_about_center * translation_by_z, | 402 root.get(), perspective_projection_about_center * translation_by_z, |
| 403 transform_origin, position, bounds, true, false, true); | 403 transform_origin, position, bounds, true, false, true); |
| 404 root->SetDrawsContent(true); | 404 root->SetDrawsContent(true); |
| 405 | 405 |
| 406 host_impl().SetViewportSize(root->bounds()); | 406 host_impl().SetViewportSize(root->bounds()); |
| 407 host_impl().active_tree()->SetRootLayer(root.Pass()); | 407 host_impl().active_tree()->SetRootLayer(std::move(root)); |
| 408 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 408 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 409 | 409 |
| 410 // Sanity check the scenario we just created. | 410 // Sanity check the scenario we just created. |
| 411 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 411 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
| 412 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); | 412 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); |
| 413 | 413 |
| 414 // Hit testing for points outside the layer. | 414 // Hit testing for points outside the layer. |
| 415 // These corners would have been inside the un-transformed layer, but they | 415 // These corners would have been inside the un-transformed layer, but they |
| 416 // should not hit the correctly transformed layer. | 416 // should not hit the correctly transformed layer. |
| 417 gfx::PointF test_point(24.f, 24.f); | 417 gfx::PointF test_point(24.f, 24.f); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 false, false); | 461 false, false); |
| 462 clipping_layer->SetMasksToBounds(true); | 462 clipping_layer->SetMasksToBounds(true); |
| 463 | 463 |
| 464 scoped_ptr<LayerImpl> child = | 464 scoped_ptr<LayerImpl> child = |
| 465 LayerImpl::Create(host_impl().active_tree(), 456); | 465 LayerImpl::Create(host_impl().active_tree(), 456); |
| 466 position = gfx::PointF(-50.f, -50.f); | 466 position = gfx::PointF(-50.f, -50.f); |
| 467 bounds = gfx::Size(300, 300); | 467 bounds = gfx::Size(300, 300); |
| 468 SetLayerPropertiesForTesting(child.get(), identity_matrix, transform_origin, | 468 SetLayerPropertiesForTesting(child.get(), identity_matrix, transform_origin, |
| 469 position, bounds, true, false, false); | 469 position, bounds, true, false, false); |
| 470 child->SetDrawsContent(true); | 470 child->SetDrawsContent(true); |
| 471 clipping_layer->AddChild(child.Pass()); | 471 clipping_layer->AddChild(std::move(child)); |
| 472 root->AddChild(clipping_layer.Pass()); | 472 root->AddChild(std::move(clipping_layer)); |
| 473 } | 473 } |
| 474 | 474 |
| 475 host_impl().SetViewportSize(root->bounds()); | 475 host_impl().SetViewportSize(root->bounds()); |
| 476 host_impl().active_tree()->SetRootLayer(root.Pass()); | 476 host_impl().active_tree()->SetRootLayer(std::move(root)); |
| 477 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 477 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 478 | 478 |
| 479 // Sanity check the scenario we just created. | 479 // Sanity check the scenario we just created. |
| 480 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 480 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
| 481 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); | 481 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); |
| 482 ASSERT_EQ(456, root_layer()->render_surface()->layer_list().at(0)->id()); | 482 ASSERT_EQ(456, root_layer()->render_surface()->layer_list().at(0)->id()); |
| 483 | 483 |
| 484 // Hit testing for a point outside the layer should return a null pointer. | 484 // Hit testing for a point outside the layer should return a null pointer. |
| 485 // Despite the child layer being very large, it should be clipped to the root | 485 // Despite the child layer being very large, it should be clipped to the root |
| 486 // layer's bounds. | 486 // layer's bounds. |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 rotated_leaf_transform.Translate(50.0, 50.0); | 567 rotated_leaf_transform.Translate(50.0, 50.0); |
| 568 rotated_leaf_transform.RotateAboutZAxis(45.0); | 568 rotated_leaf_transform.RotateAboutZAxis(45.0); |
| 569 rotated_leaf_transform.Translate(-50.0, -50.0); | 569 rotated_leaf_transform.Translate(-50.0, -50.0); |
| 570 position = gfx::PointF(); | 570 position = gfx::PointF(); |
| 571 bounds = gfx::Size(100, 100); | 571 bounds = gfx::Size(100, 100); |
| 572 SetLayerPropertiesForTesting(rotated_leaf.get(), rotated_leaf_transform, | 572 SetLayerPropertiesForTesting(rotated_leaf.get(), rotated_leaf_transform, |
| 573 transform_origin, position, bounds, true, | 573 transform_origin, position, bounds, true, |
| 574 false, false); | 574 false, false); |
| 575 rotated_leaf->SetDrawsContent(true); | 575 rotated_leaf->SetDrawsContent(true); |
| 576 | 576 |
| 577 grand_child->AddChild(rotated_leaf.Pass()); | 577 grand_child->AddChild(std::move(rotated_leaf)); |
| 578 child->AddChild(grand_child.Pass()); | 578 child->AddChild(std::move(grand_child)); |
| 579 root->AddChild(child.Pass()); | 579 root->AddChild(std::move(child)); |
| 580 } | 580 } |
| 581 | 581 |
| 582 host_impl().SetViewportSize(root->bounds()); | 582 host_impl().SetViewportSize(root->bounds()); |
| 583 host_impl().active_tree()->SetRootLayer(root.Pass()); | 583 host_impl().active_tree()->SetRootLayer(std::move(root)); |
| 584 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 584 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 585 | 585 |
| 586 // (11, 89) is close to the the bottom left corner within the clip, but it is | 586 // (11, 89) is close to the the bottom left corner within the clip, but it is |
| 587 // not inside the layer. | 587 // not inside the layer. |
| 588 gfx::PointF test_point(11.f, 89.f); | 588 gfx::PointF test_point(11.f, 89.f); |
| 589 LayerImpl* result_layer = | 589 LayerImpl* result_layer = |
| 590 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); | 590 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); |
| 591 EXPECT_FALSE(result_layer); | 591 EXPECT_FALSE(result_layer); |
| 592 | 592 |
| 593 // Closer inwards from the bottom left will overlap the layer. | 593 // Closer inwards from the bottom left will overlap the layer. |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 // The child of the intermediate_layer is translated so that it does not | 657 // The child of the intermediate_layer is translated so that it does not |
| 658 // overlap intermediate_layer at all. If child is incorrectly clipped, we | 658 // overlap intermediate_layer at all. If child is incorrectly clipped, we |
| 659 // would not be able to hit it successfully. | 659 // would not be able to hit it successfully. |
| 660 scoped_ptr<LayerImpl> child = | 660 scoped_ptr<LayerImpl> child = |
| 661 LayerImpl::Create(host_impl().active_tree(), 456); | 661 LayerImpl::Create(host_impl().active_tree(), 456); |
| 662 position = gfx::PointF(60.f, 60.f); // 70, 70 in screen space | 662 position = gfx::PointF(60.f, 60.f); // 70, 70 in screen space |
| 663 bounds = gfx::Size(20, 20); | 663 bounds = gfx::Size(20, 20); |
| 664 SetLayerPropertiesForTesting(child.get(), identity_matrix, transform_origin, | 664 SetLayerPropertiesForTesting(child.get(), identity_matrix, transform_origin, |
| 665 position, bounds, true, false, false); | 665 position, bounds, true, false, false); |
| 666 child->SetDrawsContent(true); | 666 child->SetDrawsContent(true); |
| 667 intermediate_layer->AddChild(child.Pass()); | 667 intermediate_layer->AddChild(std::move(child)); |
| 668 root->AddChild(intermediate_layer.Pass()); | 668 root->AddChild(std::move(intermediate_layer)); |
| 669 } | 669 } |
| 670 | 670 |
| 671 host_impl().SetViewportSize(root->bounds()); | 671 host_impl().SetViewportSize(root->bounds()); |
| 672 host_impl().active_tree()->SetRootLayer(root.Pass()); | 672 host_impl().active_tree()->SetRootLayer(std::move(root)); |
| 673 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 673 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 674 | 674 |
| 675 // Sanity check the scenario we just created. | 675 // Sanity check the scenario we just created. |
| 676 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 676 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
| 677 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); | 677 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); |
| 678 ASSERT_EQ(456, root_layer()->render_surface()->layer_list().at(0)->id()); | 678 ASSERT_EQ(456, root_layer()->render_surface()->layer_list().at(0)->id()); |
| 679 | 679 |
| 680 // Hit testing for a point outside the layer should return a null pointer. | 680 // Hit testing for a point outside the layer should return a null pointer. |
| 681 gfx::PointF test_point(69.f, 69.f); | 681 gfx::PointF test_point(69.f, 69.f); |
| 682 LayerImpl* result_layer = | 682 LayerImpl* result_layer = |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 // Remember that grand_child is positioned with respect to its parent (i.e. | 743 // Remember that grand_child is positioned with respect to its parent (i.e. |
| 744 // child1). In screen space, the intended position is (10, 50), with size | 744 // child1). In screen space, the intended position is (10, 50), with size |
| 745 // 100 x 50. | 745 // 100 x 50. |
| 746 position = gfx::PointF(0.f, 40.f); | 746 position = gfx::PointF(0.f, 40.f); |
| 747 bounds = gfx::Size(100, 50); | 747 bounds = gfx::Size(100, 50); |
| 748 SetLayerPropertiesForTesting(grand_child1.get(), identity_matrix, | 748 SetLayerPropertiesForTesting(grand_child1.get(), identity_matrix, |
| 749 transform_origin, position, bounds, true, | 749 transform_origin, position, bounds, true, |
| 750 false, false); | 750 false, false); |
| 751 grand_child1->SetDrawsContent(true); | 751 grand_child1->SetDrawsContent(true); |
| 752 | 752 |
| 753 child1->AddChild(grand_child1.Pass()); | 753 child1->AddChild(std::move(grand_child1)); |
| 754 root->AddChild(child1.Pass()); | 754 root->AddChild(std::move(child1)); |
| 755 root->AddChild(child2.Pass()); | 755 root->AddChild(std::move(child2)); |
| 756 } | 756 } |
| 757 | 757 |
| 758 LayerImpl* child1 = root->children()[0].get(); | 758 LayerImpl* child1 = root->children()[0].get(); |
| 759 LayerImpl* child2 = root->children()[1].get(); | 759 LayerImpl* child2 = root->children()[1].get(); |
| 760 LayerImpl* grand_child1 = child1->children()[0].get(); | 760 LayerImpl* grand_child1 = child1->children()[0].get(); |
| 761 | 761 |
| 762 host_impl().SetViewportSize(root->bounds()); | 762 host_impl().SetViewportSize(root->bounds()); |
| 763 host_impl().active_tree()->SetRootLayer(root.Pass()); | 763 host_impl().active_tree()->SetRootLayer(std::move(root)); |
| 764 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 764 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 765 | 765 |
| 766 // Sanity check the scenario we just created. | 766 // Sanity check the scenario we just created. |
| 767 ASSERT_TRUE(child1); | 767 ASSERT_TRUE(child1); |
| 768 ASSERT_TRUE(child2); | 768 ASSERT_TRUE(child2); |
| 769 ASSERT_TRUE(grand_child1); | 769 ASSERT_TRUE(grand_child1); |
| 770 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 770 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
| 771 | 771 |
| 772 RenderSurfaceImpl* root_render_surface = root_layer()->render_surface(); | 772 RenderSurfaceImpl* root_render_surface = root_layer()->render_surface(); |
| 773 ASSERT_EQ(4u, root_render_surface->layer_list().size()); | 773 ASSERT_EQ(4u, root_render_surface->layer_list().size()); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 { | 863 { |
| 864 gfx::Transform translate_z; | 864 gfx::Transform translate_z; |
| 865 translate_z.Translate3d(0, 0, right_child_depth); | 865 translate_z.Translate3d(0, 0, right_child_depth); |
| 866 SetLayerPropertiesForTesting(right_child.get(), translate_z, | 866 SetLayerPropertiesForTesting(right_child.get(), translate_z, |
| 867 transform_origin, position, bounds, false, | 867 transform_origin, position, bounds, false, |
| 868 false, false); | 868 false, false); |
| 869 right_child->SetDrawsContent(true); | 869 right_child->SetDrawsContent(true); |
| 870 right_child->Set3dSortingContextId(right_child_sorting_context); | 870 right_child->Set3dSortingContextId(right_child_sorting_context); |
| 871 } | 871 } |
| 872 | 872 |
| 873 root->AddChild(left_child.Pass()); | 873 root->AddChild(std::move(left_child)); |
| 874 root->AddChild(right_child.Pass()); | 874 root->AddChild(std::move(right_child)); |
| 875 | 875 |
| 876 host_impl().SetViewportSize(root->bounds()); | 876 host_impl().SetViewportSize(root->bounds()); |
| 877 host_impl().active_tree()->SetRootLayer(root.Pass()); | 877 host_impl().active_tree()->SetRootLayer(std::move(root)); |
| 878 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 878 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 879 CHECK_EQ(1u, RenderSurfaceLayerList().size()); | 879 CHECK_EQ(1u, RenderSurfaceLayerList().size()); |
| 880 | 880 |
| 881 gfx::PointF test_point = gfx::PointF(1.f, 1.f); | 881 gfx::PointF test_point = gfx::PointF(1.f, 1.f); |
| 882 LayerImpl* result_layer = | 882 LayerImpl* result_layer = |
| 883 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); | 883 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); |
| 884 | 884 |
| 885 CHECK(result_layer); | 885 CHECK(result_layer); |
| 886 return result_layer->id(); | 886 return result_layer->id(); |
| 887 } | 887 } |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 // child1). In screen space, the intended position is (10, 50), with size | 971 // child1). In screen space, the intended position is (10, 50), with size |
| 972 // 100 x 50. | 972 // 100 x 50. |
| 973 position = gfx::PointF(0.f, 40.f); | 973 position = gfx::PointF(0.f, 40.f); |
| 974 bounds = gfx::Size(100, 50); | 974 bounds = gfx::Size(100, 50); |
| 975 SetLayerPropertiesForTesting(grand_child1.get(), identity_matrix, | 975 SetLayerPropertiesForTesting(grand_child1.get(), identity_matrix, |
| 976 transform_origin, position, bounds, true, | 976 transform_origin, position, bounds, true, |
| 977 false, false); | 977 false, false); |
| 978 grand_child1->SetDrawsContent(true); | 978 grand_child1->SetDrawsContent(true); |
| 979 grand_child1->SetShouldFlattenTransform(false); | 979 grand_child1->SetShouldFlattenTransform(false); |
| 980 | 980 |
| 981 child1->AddChild(grand_child1.Pass()); | 981 child1->AddChild(std::move(grand_child1)); |
| 982 root->AddChild(child1.Pass()); | 982 root->AddChild(std::move(child1)); |
| 983 root->AddChild(child2.Pass()); | 983 root->AddChild(std::move(child2)); |
| 984 } | 984 } |
| 985 | 985 |
| 986 LayerImpl* child1 = root->children()[0].get(); | 986 LayerImpl* child1 = root->children()[0].get(); |
| 987 LayerImpl* child2 = root->children()[1].get(); | 987 LayerImpl* child2 = root->children()[1].get(); |
| 988 LayerImpl* grand_child1 = child1->children()[0].get(); | 988 LayerImpl* grand_child1 = child1->children()[0].get(); |
| 989 | 989 |
| 990 host_impl().SetViewportSize(root->bounds()); | 990 host_impl().SetViewportSize(root->bounds()); |
| 991 host_impl().active_tree()->SetRootLayer(root.Pass()); | 991 host_impl().active_tree()->SetRootLayer(std::move(root)); |
| 992 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 992 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 993 | 993 |
| 994 // Sanity check the scenario we just created. | 994 // Sanity check the scenario we just created. |
| 995 ASSERT_TRUE(child1); | 995 ASSERT_TRUE(child1); |
| 996 ASSERT_TRUE(child2); | 996 ASSERT_TRUE(child2); |
| 997 ASSERT_TRUE(grand_child1); | 997 ASSERT_TRUE(grand_child1); |
| 998 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 998 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
| 999 | 999 |
| 1000 // Nothing overlaps the root_layer at (1, 1), so hit testing there should find | 1000 // Nothing overlaps the root_layer at (1, 1), so hit testing there should find |
| 1001 // the root layer. | 1001 // the root layer. |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1072 bounds = gfx::Size(100, 50); | 1072 bounds = gfx::Size(100, 50); |
| 1073 SetLayerPropertiesForTesting(grand_child.get(), identity_matrix, | 1073 SetLayerPropertiesForTesting(grand_child.get(), identity_matrix, |
| 1074 transform_origin, position, bounds, true, | 1074 transform_origin, position, bounds, true, |
| 1075 false, false); | 1075 false, false); |
| 1076 grand_child->SetDrawsContent(true); | 1076 grand_child->SetDrawsContent(true); |
| 1077 grand_child->SetHasRenderSurface(true); | 1077 grand_child->SetHasRenderSurface(true); |
| 1078 | 1078 |
| 1079 // This should let |grand_child| "escape" |child|'s clip. | 1079 // This should let |grand_child| "escape" |child|'s clip. |
| 1080 grand_child->SetClipParent(root.get()); | 1080 grand_child->SetClipParent(root.get()); |
| 1081 | 1081 |
| 1082 child->AddChild(grand_child.Pass()); | 1082 child->AddChild(std::move(grand_child)); |
| 1083 root->AddChild(child.Pass()); | 1083 root->AddChild(std::move(child)); |
| 1084 } | 1084 } |
| 1085 | 1085 |
| 1086 host_impl().SetViewportSize(root->bounds()); | 1086 host_impl().SetViewportSize(root->bounds()); |
| 1087 host_impl().active_tree()->SetRootLayer(root.Pass()); | 1087 host_impl().active_tree()->SetRootLayer(std::move(root)); |
| 1088 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 1088 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 1089 | 1089 |
| 1090 gfx::PointF test_point(12.f, 52.f); | 1090 gfx::PointF test_point(12.f, 52.f); |
| 1091 LayerImpl* result_layer = | 1091 LayerImpl* result_layer = |
| 1092 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); | 1092 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); |
| 1093 ASSERT_TRUE(result_layer); | 1093 ASSERT_TRUE(result_layer); |
| 1094 EXPECT_EQ(4, result_layer->id()); | 1094 EXPECT_EQ(4, result_layer->id()); |
| 1095 } | 1095 } |
| 1096 | 1096 |
| 1097 TEST_F(LayerTreeImplTest, HitTestingRespectsScrollParents) { | 1097 TEST_F(LayerTreeImplTest, HitTestingRespectsScrollParents) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1131 scoped_ptr<std::set<LayerImpl*>> scroll_children(new std::set<LayerImpl*>); | 1131 scoped_ptr<std::set<LayerImpl*>> scroll_children(new std::set<LayerImpl*>); |
| 1132 scroll_children->insert(scroll_child.get()); | 1132 scroll_children->insert(scroll_child.get()); |
| 1133 child->SetScrollChildren(scroll_children.release()); | 1133 child->SetScrollChildren(scroll_children.release()); |
| 1134 | 1134 |
| 1135 SetLayerPropertiesForTesting(grand_child.get(), identity_matrix, | 1135 SetLayerPropertiesForTesting(grand_child.get(), identity_matrix, |
| 1136 transform_origin, position, bounds, true, | 1136 transform_origin, position, bounds, true, |
| 1137 false, false); | 1137 false, false); |
| 1138 grand_child->SetDrawsContent(true); | 1138 grand_child->SetDrawsContent(true); |
| 1139 grand_child->SetHasRenderSurface(true); | 1139 grand_child->SetHasRenderSurface(true); |
| 1140 | 1140 |
| 1141 scroll_child->AddChild(grand_child.Pass()); | 1141 scroll_child->AddChild(std::move(grand_child)); |
| 1142 root->AddChild(scroll_child.Pass()); | 1142 root->AddChild(std::move(scroll_child)); |
| 1143 root->AddChild(child.Pass()); | 1143 root->AddChild(std::move(child)); |
| 1144 } | 1144 } |
| 1145 | 1145 |
| 1146 host_impl().SetViewportSize(root->bounds()); | 1146 host_impl().SetViewportSize(root->bounds()); |
| 1147 host_impl().active_tree()->SetRootLayer(root.Pass()); | 1147 host_impl().active_tree()->SetRootLayer(std::move(root)); |
| 1148 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 1148 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 1149 | 1149 |
| 1150 gfx::PointF test_point(12.f, 52.f); | 1150 gfx::PointF test_point(12.f, 52.f); |
| 1151 LayerImpl* result_layer = | 1151 LayerImpl* result_layer = |
| 1152 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); | 1152 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); |
| 1153 // The |test_point| should have been clipped away by |child|, the scroll | 1153 // The |test_point| should have been clipped away by |child|, the scroll |
| 1154 // parent, so the only thing that should be hit is |root|. | 1154 // parent, so the only thing that should be hit is |root|. |
| 1155 ASSERT_TRUE(result_layer); | 1155 ASSERT_TRUE(result_layer); |
| 1156 ASSERT_EQ(1, result_layer->id()); | 1156 ASSERT_EQ(1, result_layer->id()); |
| 1157 } | 1157 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1203 // child1). In screen space, the intended position is (10, 50), with size | 1203 // child1). In screen space, the intended position is (10, 50), with size |
| 1204 // 100 x 50. | 1204 // 100 x 50. |
| 1205 position = gfx::PointF(0.f, 40.f); | 1205 position = gfx::PointF(0.f, 40.f); |
| 1206 bounds = gfx::Size(100, 50); | 1206 bounds = gfx::Size(100, 50); |
| 1207 SetLayerPropertiesForTesting(grand_child1.get(), identity_matrix, | 1207 SetLayerPropertiesForTesting(grand_child1.get(), identity_matrix, |
| 1208 transform_origin, position, bounds, true, | 1208 transform_origin, position, bounds, true, |
| 1209 false, false); | 1209 false, false); |
| 1210 grand_child1->SetDrawsContent(true); | 1210 grand_child1->SetDrawsContent(true); |
| 1211 grand_child1->SetHasRenderSurface(true); | 1211 grand_child1->SetHasRenderSurface(true); |
| 1212 | 1212 |
| 1213 child1->AddChild(grand_child1.Pass()); | 1213 child1->AddChild(std::move(grand_child1)); |
| 1214 root->AddChild(child1.Pass()); | 1214 root->AddChild(std::move(child1)); |
| 1215 root->AddChild(child2.Pass()); | 1215 root->AddChild(std::move(child2)); |
| 1216 } | 1216 } |
| 1217 | 1217 |
| 1218 LayerImpl* child1 = root->children()[0].get(); | 1218 LayerImpl* child1 = root->children()[0].get(); |
| 1219 LayerImpl* child2 = root->children()[1].get(); | 1219 LayerImpl* child2 = root->children()[1].get(); |
| 1220 LayerImpl* grand_child1 = child1->children()[0].get(); | 1220 LayerImpl* grand_child1 = child1->children()[0].get(); |
| 1221 | 1221 |
| 1222 host_impl().SetViewportSize(root->bounds()); | 1222 host_impl().SetViewportSize(root->bounds()); |
| 1223 host_impl().active_tree()->SetRootLayer(root.Pass()); | 1223 host_impl().active_tree()->SetRootLayer(std::move(root)); |
| 1224 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 1224 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 1225 | 1225 |
| 1226 // Sanity check the scenario we just created. | 1226 // Sanity check the scenario we just created. |
| 1227 ASSERT_TRUE(child1); | 1227 ASSERT_TRUE(child1); |
| 1228 ASSERT_TRUE(child2); | 1228 ASSERT_TRUE(child2); |
| 1229 ASSERT_TRUE(grand_child1); | 1229 ASSERT_TRUE(grand_child1); |
| 1230 ASSERT_TRUE(child1->render_surface()); | 1230 ASSERT_TRUE(child1->render_surface()); |
| 1231 ASSERT_TRUE(child2->render_surface()); | 1231 ASSERT_TRUE(child2->render_surface()); |
| 1232 ASSERT_TRUE(grand_child1->render_surface()); | 1232 ASSERT_TRUE(grand_child1->render_surface()); |
| 1233 ASSERT_EQ(4u, RenderSurfaceLayerList().size()); | 1233 ASSERT_EQ(4u, RenderSurfaceLayerList().size()); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1298 gfx::Transform identity_matrix; | 1298 gfx::Transform identity_matrix; |
| 1299 Region touch_handler_region(gfx::Rect(10, 10, 50, 50)); | 1299 Region touch_handler_region(gfx::Rect(10, 10, 50, 50)); |
| 1300 gfx::Point3F transform_origin; | 1300 gfx::Point3F transform_origin; |
| 1301 gfx::PointF position; | 1301 gfx::PointF position; |
| 1302 gfx::Size bounds(100, 100); | 1302 gfx::Size bounds(100, 100); |
| 1303 SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin, | 1303 SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin, |
| 1304 position, bounds, true, false, true); | 1304 position, bounds, true, false, true); |
| 1305 root->SetDrawsContent(true); | 1305 root->SetDrawsContent(true); |
| 1306 | 1306 |
| 1307 host_impl().SetViewportSize(root->bounds()); | 1307 host_impl().SetViewportSize(root->bounds()); |
| 1308 host_impl().active_tree()->SetRootLayer(root.Pass()); | 1308 host_impl().active_tree()->SetRootLayer(std::move(root)); |
| 1309 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 1309 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 1310 | 1310 |
| 1311 // Sanity check the scenario we just created. | 1311 // Sanity check the scenario we just created. |
| 1312 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 1312 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
| 1313 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); | 1313 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); |
| 1314 | 1314 |
| 1315 // Hit checking for any point should return a null pointer for a layer without | 1315 // Hit checking for any point should return a null pointer for a layer without |
| 1316 // any touch event handler regions. | 1316 // any touch event handler regions. |
| 1317 gfx::PointF test_point(11.f, 11.f); | 1317 gfx::PointF test_point(11.f, 11.f); |
| 1318 LayerImpl* result_layer = | 1318 LayerImpl* result_layer = |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1383 gfx::Point3F transform_origin; | 1383 gfx::Point3F transform_origin; |
| 1384 gfx::PointF position; | 1384 gfx::PointF position; |
| 1385 gfx::Size bounds(100, 100); | 1385 gfx::Size bounds(100, 100); |
| 1386 SetLayerPropertiesForTesting(root.get(), uninvertible_transform, | 1386 SetLayerPropertiesForTesting(root.get(), uninvertible_transform, |
| 1387 transform_origin, position, bounds, true, false, | 1387 transform_origin, position, bounds, true, false, |
| 1388 true); | 1388 true); |
| 1389 root->SetDrawsContent(true); | 1389 root->SetDrawsContent(true); |
| 1390 root->SetTouchEventHandlerRegion(touch_handler_region); | 1390 root->SetTouchEventHandlerRegion(touch_handler_region); |
| 1391 | 1391 |
| 1392 host_impl().SetViewportSize(root->bounds()); | 1392 host_impl().SetViewportSize(root->bounds()); |
| 1393 host_impl().active_tree()->SetRootLayer(root.Pass()); | 1393 host_impl().active_tree()->SetRootLayer(std::move(root)); |
| 1394 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 1394 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 1395 | 1395 |
| 1396 // Sanity check the scenario we just created. | 1396 // Sanity check the scenario we just created. |
| 1397 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 1397 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
| 1398 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); | 1398 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); |
| 1399 ASSERT_FALSE(root_layer()->screen_space_transform().IsInvertible()); | 1399 ASSERT_FALSE(root_layer()->screen_space_transform().IsInvertible()); |
| 1400 | 1400 |
| 1401 // Hit checking any point should not hit the touch handler region on the | 1401 // Hit checking any point should not hit the touch handler region on the |
| 1402 // layer. If the invertible matrix is accidentally ignored and treated like an | 1402 // layer. If the invertible matrix is accidentally ignored and treated like an |
| 1403 // identity, then the hit testing will incorrectly hit the layer when it | 1403 // identity, then the hit testing will incorrectly hit the layer when it |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1456 // this layer is positioned, and hit testing should correctly know where the | 1456 // this layer is positioned, and hit testing should correctly know where the |
| 1457 // layer is located. | 1457 // layer is located. |
| 1458 gfx::PointF position(50.f, 50.f); | 1458 gfx::PointF position(50.f, 50.f); |
| 1459 gfx::Size bounds(100, 100); | 1459 gfx::Size bounds(100, 100); |
| 1460 SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin, | 1460 SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin, |
| 1461 position, bounds, true, false, true); | 1461 position, bounds, true, false, true); |
| 1462 root->SetDrawsContent(true); | 1462 root->SetDrawsContent(true); |
| 1463 root->SetTouchEventHandlerRegion(touch_handler_region); | 1463 root->SetTouchEventHandlerRegion(touch_handler_region); |
| 1464 | 1464 |
| 1465 host_impl().SetViewportSize(root->bounds()); | 1465 host_impl().SetViewportSize(root->bounds()); |
| 1466 host_impl().active_tree()->SetRootLayer(root.Pass()); | 1466 host_impl().active_tree()->SetRootLayer(std::move(root)); |
| 1467 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 1467 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 1468 | 1468 |
| 1469 // Sanity check the scenario we just created. | 1469 // Sanity check the scenario we just created. |
| 1470 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 1470 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
| 1471 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); | 1471 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); |
| 1472 | 1472 |
| 1473 // Hit checking for a point outside the layer should return a null pointer. | 1473 // Hit checking for a point outside the layer should return a null pointer. |
| 1474 gfx::PointF test_point(49.f, 49.f); | 1474 gfx::PointF test_point(49.f, 49.f); |
| 1475 LayerImpl* result_layer = | 1475 LayerImpl* result_layer = |
| 1476 host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion( | 1476 host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion( |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1528 gfx::PointF position(25.f, 25.f); | 1528 gfx::PointF position(25.f, 25.f); |
| 1529 gfx::Size bounds(50, 50); | 1529 gfx::Size bounds(50, 50); |
| 1530 scoped_ptr<LayerImpl> test_layer = | 1530 scoped_ptr<LayerImpl> test_layer = |
| 1531 LayerImpl::Create(host_impl().active_tree(), 12345); | 1531 LayerImpl::Create(host_impl().active_tree(), 12345); |
| 1532 SetLayerPropertiesForTesting(test_layer.get(), identity_matrix, | 1532 SetLayerPropertiesForTesting(test_layer.get(), identity_matrix, |
| 1533 transform_origin, position, bounds, true, | 1533 transform_origin, position, bounds, true, |
| 1534 false, false); | 1534 false, false); |
| 1535 | 1535 |
| 1536 test_layer->SetDrawsContent(true); | 1536 test_layer->SetDrawsContent(true); |
| 1537 test_layer->SetTouchEventHandlerRegion(touch_handler_region); | 1537 test_layer->SetTouchEventHandlerRegion(touch_handler_region); |
| 1538 root->AddChild(test_layer.Pass()); | 1538 root->AddChild(std::move(test_layer)); |
| 1539 } | 1539 } |
| 1540 | 1540 |
| 1541 float device_scale_factor = 3.f; | 1541 float device_scale_factor = 3.f; |
| 1542 float page_scale_factor = 5.f; | 1542 float page_scale_factor = 5.f; |
| 1543 float max_page_scale_factor = 10.f; | 1543 float max_page_scale_factor = 10.f; |
| 1544 gfx::Size scaled_bounds_for_root = gfx::ScaleToCeiledSize( | 1544 gfx::Size scaled_bounds_for_root = gfx::ScaleToCeiledSize( |
| 1545 root->bounds(), device_scale_factor * page_scale_factor); | 1545 root->bounds(), device_scale_factor * page_scale_factor); |
| 1546 host_impl().SetViewportSize(scaled_bounds_for_root); | 1546 host_impl().SetViewportSize(scaled_bounds_for_root); |
| 1547 | 1547 |
| 1548 host_impl().active_tree()->SetDeviceScaleFactor(device_scale_factor); | 1548 host_impl().active_tree()->SetDeviceScaleFactor(device_scale_factor); |
| 1549 host_impl().active_tree()->PushPageScaleFromMainThread( | 1549 host_impl().active_tree()->PushPageScaleFromMainThread( |
| 1550 page_scale_factor, page_scale_factor, max_page_scale_factor); | 1550 page_scale_factor, page_scale_factor, max_page_scale_factor); |
| 1551 host_impl().active_tree()->SetPageScaleOnActiveTree(page_scale_factor); | 1551 host_impl().active_tree()->SetPageScaleOnActiveTree(page_scale_factor); |
| 1552 host_impl().active_tree()->SetRootLayer(root.Pass()); | 1552 host_impl().active_tree()->SetRootLayer(std::move(root)); |
| 1553 host_impl().active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 1, | 1553 host_impl().active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 1, |
| 1554 Layer::INVALID_ID); | 1554 Layer::INVALID_ID); |
| 1555 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 1555 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 1556 | 1556 |
| 1557 // Sanity check the scenario we just created. | 1557 // Sanity check the scenario we just created. |
| 1558 // The visible content rect for test_layer is actually 100x100, even though | 1558 // The visible content rect for test_layer is actually 100x100, even though |
| 1559 // its layout size is 50x50, positioned at 25x25. | 1559 // its layout size is 50x50, positioned at 25x25. |
| 1560 LayerImpl* test_layer = | 1560 LayerImpl* test_layer = |
| 1561 host_impl().active_tree()->root_layer()->children()[0].get(); | 1561 host_impl().active_tree()->root_layer()->children()[0].get(); |
| 1562 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 1562 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1681 | 1681 |
| 1682 scoped_ptr<LayerImpl> child = | 1682 scoped_ptr<LayerImpl> child = |
| 1683 LayerImpl::Create(host_impl().active_tree(), 456); | 1683 LayerImpl::Create(host_impl().active_tree(), 456); |
| 1684 Region touch_handler_region(gfx::Rect(10, 10, 50, 50)); | 1684 Region touch_handler_region(gfx::Rect(10, 10, 50, 50)); |
| 1685 position = gfx::PointF(-50.f, -50.f); | 1685 position = gfx::PointF(-50.f, -50.f); |
| 1686 bounds = gfx::Size(300, 300); | 1686 bounds = gfx::Size(300, 300); |
| 1687 SetLayerPropertiesForTesting(child.get(), identity_matrix, transform_origin, | 1687 SetLayerPropertiesForTesting(child.get(), identity_matrix, transform_origin, |
| 1688 position, bounds, true, false, false); | 1688 position, bounds, true, false, false); |
| 1689 child->SetDrawsContent(true); | 1689 child->SetDrawsContent(true); |
| 1690 child->SetTouchEventHandlerRegion(touch_handler_region); | 1690 child->SetTouchEventHandlerRegion(touch_handler_region); |
| 1691 clipping_layer->AddChild(child.Pass()); | 1691 clipping_layer->AddChild(std::move(child)); |
| 1692 root->AddChild(clipping_layer.Pass()); | 1692 root->AddChild(std::move(clipping_layer)); |
| 1693 } | 1693 } |
| 1694 | 1694 |
| 1695 host_impl().SetViewportSize(root->bounds()); | 1695 host_impl().SetViewportSize(root->bounds()); |
| 1696 host_impl().active_tree()->SetRootLayer(root.Pass()); | 1696 host_impl().active_tree()->SetRootLayer(std::move(root)); |
| 1697 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 1697 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 1698 | 1698 |
| 1699 // Sanity check the scenario we just created. | 1699 // Sanity check the scenario we just created. |
| 1700 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 1700 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
| 1701 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); | 1701 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); |
| 1702 ASSERT_EQ(456, root_layer()->render_surface()->layer_list().at(0)->id()); | 1702 ASSERT_EQ(456, root_layer()->render_surface()->layer_list().at(0)->id()); |
| 1703 | 1703 |
| 1704 // Hit checking for a point outside the layer should return a null pointer. | 1704 // Hit checking for a point outside the layer should return a null pointer. |
| 1705 // Despite the child layer being very large, it should be clipped to the root | 1705 // Despite the child layer being very large, it should be clipped to the root |
| 1706 // layer's bounds. | 1706 // layer's bounds. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1754 LayerImpl::Create(host_impl().active_tree(), 123); | 1754 LayerImpl::Create(host_impl().active_tree(), 123); |
| 1755 // this layer is positioned, and hit testing should correctly know where the | 1755 // this layer is positioned, and hit testing should correctly know where the |
| 1756 // layer is located. | 1756 // layer is located. |
| 1757 gfx::PointF position; | 1757 gfx::PointF position; |
| 1758 gfx::Size bounds(50, 50); | 1758 gfx::Size bounds(50, 50); |
| 1759 SetLayerPropertiesForTesting(touch_layer.get(), identity_matrix, | 1759 SetLayerPropertiesForTesting(touch_layer.get(), identity_matrix, |
| 1760 transform_origin, position, bounds, true, | 1760 transform_origin, position, bounds, true, |
| 1761 false, false); | 1761 false, false); |
| 1762 touch_layer->SetDrawsContent(true); | 1762 touch_layer->SetDrawsContent(true); |
| 1763 touch_layer->SetTouchEventHandlerRegion(gfx::Rect(0, 0, 50, 50)); | 1763 touch_layer->SetTouchEventHandlerRegion(gfx::Rect(0, 0, 50, 50)); |
| 1764 root->AddChild(touch_layer.Pass()); | 1764 root->AddChild(std::move(touch_layer)); |
| 1765 } | 1765 } |
| 1766 | 1766 |
| 1767 { | 1767 { |
| 1768 scoped_ptr<LayerImpl> notouch_layer = | 1768 scoped_ptr<LayerImpl> notouch_layer = |
| 1769 LayerImpl::Create(host_impl().active_tree(), 1234); | 1769 LayerImpl::Create(host_impl().active_tree(), 1234); |
| 1770 // this layer is positioned, and hit testing should correctly know where the | 1770 // this layer is positioned, and hit testing should correctly know where the |
| 1771 // layer is located. | 1771 // layer is located. |
| 1772 gfx::PointF position(0, 25); | 1772 gfx::PointF position(0, 25); |
| 1773 gfx::Size bounds(50, 50); | 1773 gfx::Size bounds(50, 50); |
| 1774 SetLayerPropertiesForTesting(notouch_layer.get(), identity_matrix, | 1774 SetLayerPropertiesForTesting(notouch_layer.get(), identity_matrix, |
| 1775 transform_origin, position, bounds, true, | 1775 transform_origin, position, bounds, true, |
| 1776 false, false); | 1776 false, false); |
| 1777 notouch_layer->SetDrawsContent(true); | 1777 notouch_layer->SetDrawsContent(true); |
| 1778 root->AddChild(notouch_layer.Pass()); | 1778 root->AddChild(std::move(notouch_layer)); |
| 1779 } | 1779 } |
| 1780 | 1780 |
| 1781 host_impl().SetViewportSize(root->bounds()); | 1781 host_impl().SetViewportSize(root->bounds()); |
| 1782 host_impl().active_tree()->SetRootLayer(root.Pass()); | 1782 host_impl().active_tree()->SetRootLayer(std::move(root)); |
| 1783 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 1783 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 1784 | 1784 |
| 1785 // Sanity check the scenario we just created. | 1785 // Sanity check the scenario we just created. |
| 1786 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 1786 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
| 1787 ASSERT_EQ(2u, root_layer()->render_surface()->layer_list().size()); | 1787 ASSERT_EQ(2u, root_layer()->render_surface()->layer_list().size()); |
| 1788 ASSERT_EQ(123, root_layer()->render_surface()->layer_list().at(0)->id()); | 1788 ASSERT_EQ(123, root_layer()->render_surface()->layer_list().at(0)->id()); |
| 1789 ASSERT_EQ(1234, root_layer()->render_surface()->layer_list().at(1)->id()); | 1789 ASSERT_EQ(1234, root_layer()->render_surface()->layer_list().at(1)->id()); |
| 1790 | 1790 |
| 1791 gfx::PointF test_point(35.f, 35.f); | 1791 gfx::PointF test_point(35.f, 35.f); |
| 1792 LayerImpl* result_layer = | 1792 LayerImpl* result_layer = |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1836 gfx::PointF position; | 1836 gfx::PointF position; |
| 1837 gfx::Size bounds(50, 50); | 1837 gfx::Size bounds(50, 50); |
| 1838 scoped_ptr<LayerImpl> test_layer = | 1838 scoped_ptr<LayerImpl> test_layer = |
| 1839 LayerImpl::Create(host_impl().active_tree(), 12345); | 1839 LayerImpl::Create(host_impl().active_tree(), 12345); |
| 1840 SetLayerPropertiesForTesting(test_layer.get(), identity_matrix, | 1840 SetLayerPropertiesForTesting(test_layer.get(), identity_matrix, |
| 1841 transform_origin, position, bounds, true, | 1841 transform_origin, position, bounds, true, |
| 1842 false, false); | 1842 false, false); |
| 1843 | 1843 |
| 1844 test_layer->SetDrawsContent(false); | 1844 test_layer->SetDrawsContent(false); |
| 1845 test_layer->SetTouchEventHandlerRegion(touch_handler_region); | 1845 test_layer->SetTouchEventHandlerRegion(touch_handler_region); |
| 1846 root->AddChild(test_layer.Pass()); | 1846 root->AddChild(std::move(test_layer)); |
| 1847 } | 1847 } |
| 1848 host_impl().SetViewportSize(root->bounds()); | 1848 host_impl().SetViewportSize(root->bounds()); |
| 1849 host_impl().active_tree()->SetRootLayer(root.Pass()); | 1849 host_impl().active_tree()->SetRootLayer(std::move(root)); |
| 1850 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 1850 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 1851 | 1851 |
| 1852 LayerImpl* test_layer = | 1852 LayerImpl* test_layer = |
| 1853 host_impl().active_tree()->root_layer()->children()[0].get(); | 1853 host_impl().active_tree()->root_layer()->children()[0].get(); |
| 1854 // As test_layer doesn't draw content, the layer list of root's render surface | 1854 // As test_layer doesn't draw content, the layer list of root's render surface |
| 1855 // should contain only the root layer. | 1855 // should contain only the root layer. |
| 1856 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 1856 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
| 1857 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); | 1857 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); |
| 1858 | 1858 |
| 1859 // Hit testing for a point outside the test layer should return null pointer. | 1859 // Hit testing for a point outside the test layer should return null pointer. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1908 | 1908 |
| 1909 gfx::Transform identity_matrix; | 1909 gfx::Transform identity_matrix; |
| 1910 gfx::Point3F transform_origin; | 1910 gfx::Point3F transform_origin; |
| 1911 gfx::PointF position; | 1911 gfx::PointF position; |
| 1912 gfx::Size bounds(100, 100); | 1912 gfx::Size bounds(100, 100); |
| 1913 SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin, | 1913 SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin, |
| 1914 position, bounds, true, false, true); | 1914 position, bounds, true, false, true); |
| 1915 root->SetDrawsContent(true); | 1915 root->SetDrawsContent(true); |
| 1916 | 1916 |
| 1917 host_impl().SetViewportSize(root->bounds()); | 1917 host_impl().SetViewportSize(root->bounds()); |
| 1918 host_impl().active_tree()->SetRootLayer(root.Pass()); | 1918 host_impl().active_tree()->SetRootLayer(std::move(root)); |
| 1919 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 1919 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 1920 | 1920 |
| 1921 // Sanity check the scenario we just created. | 1921 // Sanity check the scenario we just created. |
| 1922 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 1922 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
| 1923 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); | 1923 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); |
| 1924 | 1924 |
| 1925 LayerSelection input; | 1925 LayerSelection input; |
| 1926 | 1926 |
| 1927 input.start.type = SELECTION_BOUND_LEFT; | 1927 input.start.type = SELECTION_BOUND_LEFT; |
| 1928 input.start.edge_top = gfx::Point(10, 10); | 1928 input.start.edge_top = gfx::Point(10, 10); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2006 clipping_layer->SetMasksToBounds(true); | 2006 clipping_layer->SetMasksToBounds(true); |
| 2007 | 2007 |
| 2008 scoped_ptr<LayerImpl> clipped_layer = | 2008 scoped_ptr<LayerImpl> clipped_layer = |
| 2009 LayerImpl::Create(host_impl().active_tree(), clipped_layer_id); | 2009 LayerImpl::Create(host_impl().active_tree(), clipped_layer_id); |
| 2010 position = gfx::PointF(); | 2010 position = gfx::PointF(); |
| 2011 bounds = gfx::Size(100, 100); | 2011 bounds = gfx::Size(100, 100); |
| 2012 SetLayerPropertiesForTesting(clipped_layer.get(), identity_matrix, | 2012 SetLayerPropertiesForTesting(clipped_layer.get(), identity_matrix, |
| 2013 transform_origin, position, bounds, true, | 2013 transform_origin, position, bounds, true, |
| 2014 false, false); | 2014 false, false); |
| 2015 clipped_layer->SetDrawsContent(true); | 2015 clipped_layer->SetDrawsContent(true); |
| 2016 clipping_layer->AddChild(clipped_layer.Pass()); | 2016 clipping_layer->AddChild(std::move(clipped_layer)); |
| 2017 root->AddChild(clipping_layer.Pass()); | 2017 root->AddChild(std::move(clipping_layer)); |
| 2018 } | 2018 } |
| 2019 | 2019 |
| 2020 host_impl().SetViewportSize(root->bounds()); | 2020 host_impl().SetViewportSize(root->bounds()); |
| 2021 host_impl().active_tree()->SetRootLayer(root.Pass()); | 2021 host_impl().active_tree()->SetRootLayer(std::move(root)); |
| 2022 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 2022 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 2023 | 2023 |
| 2024 // Sanity check the scenario we just created. | 2024 // Sanity check the scenario we just created. |
| 2025 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 2025 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
| 2026 | 2026 |
| 2027 LayerSelection input; | 2027 LayerSelection input; |
| 2028 input.start.type = SELECTION_BOUND_LEFT; | 2028 input.start.type = SELECTION_BOUND_LEFT; |
| 2029 input.start.edge_top = gfx::Point(25, 10); | 2029 input.start.edge_top = gfx::Point(25, 10); |
| 2030 input.start.edge_bottom = gfx::Point(25, 30); | 2030 input.start.edge_bottom = gfx::Point(25, 30); |
| 2031 input.start.layer_id = clipped_layer_id; | 2031 input.start.layer_id = clipped_layer_id; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2094 gfx::Vector2dF sub_layer_offset(10, 0); | 2094 gfx::Vector2dF sub_layer_offset(10, 0); |
| 2095 { | 2095 { |
| 2096 scoped_ptr<LayerImpl> sub_layer = | 2096 scoped_ptr<LayerImpl> sub_layer = |
| 2097 LayerImpl::Create(host_impl().active_tree(), sub_layer_id); | 2097 LayerImpl::Create(host_impl().active_tree(), sub_layer_id); |
| 2098 gfx::PointF position = gfx::PointF() + sub_layer_offset; | 2098 gfx::PointF position = gfx::PointF() + sub_layer_offset; |
| 2099 gfx::Size bounds(50, 50); | 2099 gfx::Size bounds(50, 50); |
| 2100 SetLayerPropertiesForTesting(sub_layer.get(), identity_matrix, | 2100 SetLayerPropertiesForTesting(sub_layer.get(), identity_matrix, |
| 2101 transform_origin, position, bounds, true, | 2101 transform_origin, position, bounds, true, |
| 2102 false, false); | 2102 false, false); |
| 2103 sub_layer->SetDrawsContent(true); | 2103 sub_layer->SetDrawsContent(true); |
| 2104 root->AddChild(sub_layer.Pass()); | 2104 root->AddChild(std::move(sub_layer)); |
| 2105 } | 2105 } |
| 2106 | 2106 |
| 2107 float device_scale_factor = 3.f; | 2107 float device_scale_factor = 3.f; |
| 2108 float page_scale_factor = 5.f; | 2108 float page_scale_factor = 5.f; |
| 2109 gfx::Size scaled_bounds_for_root = gfx::ScaleToCeiledSize( | 2109 gfx::Size scaled_bounds_for_root = gfx::ScaleToCeiledSize( |
| 2110 root->bounds(), device_scale_factor * page_scale_factor); | 2110 root->bounds(), device_scale_factor * page_scale_factor); |
| 2111 host_impl().SetViewportSize(scaled_bounds_for_root); | 2111 host_impl().SetViewportSize(scaled_bounds_for_root); |
| 2112 | 2112 |
| 2113 host_impl().active_tree()->SetDeviceScaleFactor(device_scale_factor); | 2113 host_impl().active_tree()->SetDeviceScaleFactor(device_scale_factor); |
| 2114 host_impl().active_tree()->PushPageScaleFromMainThread( | 2114 host_impl().active_tree()->PushPageScaleFromMainThread( |
| 2115 page_scale_factor, page_scale_factor, page_scale_factor); | 2115 page_scale_factor, page_scale_factor, page_scale_factor); |
| 2116 host_impl().active_tree()->SetPageScaleOnActiveTree(page_scale_factor); | 2116 host_impl().active_tree()->SetPageScaleOnActiveTree(page_scale_factor); |
| 2117 host_impl().active_tree()->SetRootLayer(root.Pass()); | 2117 host_impl().active_tree()->SetRootLayer(std::move(root)); |
| 2118 host_impl().active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 1, | 2118 host_impl().active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 1, |
| 2119 Layer::INVALID_ID); | 2119 Layer::INVALID_ID); |
| 2120 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 2120 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 2121 | 2121 |
| 2122 // Sanity check the scenario we just created. | 2122 // Sanity check the scenario we just created. |
| 2123 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 2123 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
| 2124 | 2124 |
| 2125 LayerSelection input; | 2125 LayerSelection input; |
| 2126 input.start.type = SELECTION_BOUND_LEFT; | 2126 input.start.type = SELECTION_BOUND_LEFT; |
| 2127 input.start.edge_top = gfx::Point(10, 10); | 2127 input.start.edge_top = gfx::Point(10, 10); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2184 SetLayerPropertiesForTesting(child.get(), large_transform, transform_origin, | 2184 SetLayerPropertiesForTesting(child.get(), large_transform, transform_origin, |
| 2185 position, bounds, true, false, false); | 2185 position, bounds, true, false, false); |
| 2186 | 2186 |
| 2187 scoped_ptr<LayerImpl> grand_child = | 2187 scoped_ptr<LayerImpl> grand_child = |
| 2188 LayerImpl::Create(host_impl().active_tree(), grand_child_id); | 2188 LayerImpl::Create(host_impl().active_tree(), grand_child_id); |
| 2189 SetLayerPropertiesForTesting(grand_child.get(), large_transform, | 2189 SetLayerPropertiesForTesting(grand_child.get(), large_transform, |
| 2190 transform_origin, position, bounds, true, | 2190 transform_origin, position, bounds, true, |
| 2191 false, false); | 2191 false, false); |
| 2192 grand_child->SetDrawsContent(true); | 2192 grand_child->SetDrawsContent(true); |
| 2193 | 2193 |
| 2194 child->AddChild(grand_child.Pass()); | 2194 child->AddChild(std::move(grand_child)); |
| 2195 root->AddChild(child.Pass()); | 2195 root->AddChild(std::move(child)); |
| 2196 } | 2196 } |
| 2197 | 2197 |
| 2198 host_impl().SetViewportSize(root->bounds()); | 2198 host_impl().SetViewportSize(root->bounds()); |
| 2199 host_impl().active_tree()->SetRootLayer(root.Pass()); | 2199 host_impl().active_tree()->SetRootLayer(std::move(root)); |
| 2200 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 2200 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 2201 | 2201 |
| 2202 LayerSelection input; | 2202 LayerSelection input; |
| 2203 | 2203 |
| 2204 input.start.type = SELECTION_BOUND_LEFT; | 2204 input.start.type = SELECTION_BOUND_LEFT; |
| 2205 input.start.edge_top = gfx::Point(10, 10); | 2205 input.start.edge_top = gfx::Point(10, 10); |
| 2206 input.start.edge_bottom = gfx::Point(10, 20); | 2206 input.start.edge_bottom = gfx::Point(10, 20); |
| 2207 input.start.layer_id = grand_child_id; | 2207 input.start.layer_id = grand_child_id; |
| 2208 | 2208 |
| 2209 input.end.type = SELECTION_BOUND_RIGHT; | 2209 input.end.type = SELECTION_BOUND_RIGHT; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 2232 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers()); | 2232 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers()); |
| 2233 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); | 2233 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); |
| 2234 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2)); | 2234 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2)); |
| 2235 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3)); | 2235 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3)); |
| 2236 root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4)); | 2236 root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4)); |
| 2237 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers()); | 2237 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers()); |
| 2238 } | 2238 } |
| 2239 | 2239 |
| 2240 } // namespace | 2240 } // namespace |
| 2241 } // namespace cc | 2241 } // namespace cc |
| OLD | NEW |