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/test/fake_impl_proxy.h" | 9 #include "cc/test/fake_impl_proxy.h" |
10 #include "cc/test/fake_layer_tree_host_impl.h" | 10 #include "cc/test/fake_layer_tree_host_impl.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 gfx::Transform identity_matrix; | 49 gfx::Transform identity_matrix; |
50 gfx::Point3F transform_origin; | 50 gfx::Point3F transform_origin; |
51 gfx::PointF position; | 51 gfx::PointF position; |
52 gfx::Size bounds(100, 100); | 52 gfx::Size bounds(100, 100); |
53 SetLayerPropertiesForTesting(root.get(), | 53 SetLayerPropertiesForTesting(root.get(), |
54 identity_matrix, | 54 identity_matrix, |
55 transform_origin, | 55 transform_origin, |
56 position, | 56 position, |
57 bounds, | 57 bounds, |
58 true, | 58 true, |
59 false); | 59 false, |
| 60 true); |
60 root->SetDrawsContent(true); | 61 root->SetDrawsContent(true); |
61 | 62 |
62 host_impl().SetViewportSize(root->bounds()); | 63 host_impl().SetViewportSize(root->bounds()); |
63 host_impl().active_tree()->SetRootLayer(root.Pass()); | 64 host_impl().active_tree()->SetRootLayer(root.Pass()); |
64 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 65 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
65 | 66 |
66 // Sanity check the scenario we just created. | 67 // Sanity check the scenario we just created. |
67 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 68 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
68 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); | 69 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); |
69 | 70 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 gfx::Transform identity_matrix; | 102 gfx::Transform identity_matrix; |
102 gfx::Point3F transform_origin; | 103 gfx::Point3F transform_origin; |
103 gfx::PointF position; | 104 gfx::PointF position; |
104 gfx::Size bounds(100, 100); | 105 gfx::Size bounds(100, 100); |
105 SetLayerPropertiesForTesting(root.get(), | 106 SetLayerPropertiesForTesting(root.get(), |
106 identity_matrix, | 107 identity_matrix, |
107 transform_origin, | 108 transform_origin, |
108 position, | 109 position, |
109 bounds, | 110 bounds, |
110 true, | 111 true, |
111 false); | 112 false, |
| 113 true); |
112 root->SetDrawsContent(true); | 114 root->SetDrawsContent(true); |
113 | 115 |
114 // Create hud and add it as a child of root. | 116 // Create hud and add it as a child of root. |
115 gfx::Size hud_bounds(200, 200); | 117 gfx::Size hud_bounds(200, 200); |
116 SetLayerPropertiesForTesting(hud.get(), | 118 SetLayerPropertiesForTesting(hud.get(), |
117 identity_matrix, | 119 identity_matrix, |
118 transform_origin, | 120 transform_origin, |
119 position, | 121 position, |
120 hud_bounds, | 122 hud_bounds, |
121 true, | 123 true, |
| 124 false, |
122 false); | 125 false); |
123 hud->SetDrawsContent(true); | 126 hud->SetDrawsContent(true); |
124 | 127 |
125 host_impl().active_tree()->set_hud_layer(hud.get()); | 128 host_impl().active_tree()->set_hud_layer(hud.get()); |
126 root->AddChild(hud.Pass()); | 129 root->AddChild(hud.Pass()); |
127 | 130 |
128 host_impl().SetViewportSize(hud_bounds); | 131 host_impl().SetViewportSize(hud_bounds); |
129 host_impl().active_tree()->SetRootLayer(root.Pass()); | 132 host_impl().active_tree()->SetRootLayer(root.Pass()); |
130 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 133 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
131 | 134 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 gfx::Transform identity_matrix; | 176 gfx::Transform identity_matrix; |
174 gfx::Point3F transform_origin; | 177 gfx::Point3F transform_origin; |
175 gfx::PointF position; | 178 gfx::PointF position; |
176 gfx::Size bounds(100, 100); | 179 gfx::Size bounds(100, 100); |
177 SetLayerPropertiesForTesting(root.get(), | 180 SetLayerPropertiesForTesting(root.get(), |
178 uninvertible_transform, | 181 uninvertible_transform, |
179 transform_origin, | 182 transform_origin, |
180 position, | 183 position, |
181 bounds, | 184 bounds, |
182 true, | 185 true, |
183 false); | 186 false, |
| 187 true); |
184 root->SetDrawsContent(true); | 188 root->SetDrawsContent(true); |
185 | 189 |
186 host_impl().SetViewportSize(root->bounds()); | 190 host_impl().SetViewportSize(root->bounds()); |
187 host_impl().active_tree()->SetRootLayer(root.Pass()); | 191 host_impl().active_tree()->SetRootLayer(root.Pass()); |
188 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 192 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
189 // Sanity check the scenario we just created. | 193 // Sanity check the scenario we just created. |
190 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 194 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
191 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); | 195 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); |
192 ASSERT_FALSE(root_layer()->screen_space_transform().IsInvertible()); | 196 ASSERT_FALSE(root_layer()->screen_space_transform().IsInvertible()); |
193 | 197 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 // this layer is positioned, and hit testing should correctly know where the | 243 // this layer is positioned, and hit testing should correctly know where the |
240 // layer is located. | 244 // layer is located. |
241 gfx::PointF position(50.f, 50.f); | 245 gfx::PointF position(50.f, 50.f); |
242 gfx::Size bounds(100, 100); | 246 gfx::Size bounds(100, 100); |
243 SetLayerPropertiesForTesting(root.get(), | 247 SetLayerPropertiesForTesting(root.get(), |
244 identity_matrix, | 248 identity_matrix, |
245 transform_origin, | 249 transform_origin, |
246 position, | 250 position, |
247 bounds, | 251 bounds, |
248 true, | 252 true, |
249 false); | 253 false, |
| 254 true); |
250 root->SetDrawsContent(true); | 255 root->SetDrawsContent(true); |
251 | 256 |
252 host_impl().SetViewportSize(root->bounds()); | 257 host_impl().SetViewportSize(root->bounds()); |
253 host_impl().active_tree()->SetRootLayer(root.Pass()); | 258 host_impl().active_tree()->SetRootLayer(root.Pass()); |
254 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 259 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
255 | 260 |
256 // Sanity check the scenario we just created. | 261 // Sanity check the scenario we just created. |
257 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 262 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
258 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); | 263 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); |
259 | 264 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 rotation45_degrees_about_center.Translate(-50.0, -50.0); | 300 rotation45_degrees_about_center.Translate(-50.0, -50.0); |
296 gfx::Point3F transform_origin; | 301 gfx::Point3F transform_origin; |
297 gfx::PointF position; | 302 gfx::PointF position; |
298 gfx::Size bounds(100, 100); | 303 gfx::Size bounds(100, 100); |
299 SetLayerPropertiesForTesting(root.get(), | 304 SetLayerPropertiesForTesting(root.get(), |
300 rotation45_degrees_about_center, | 305 rotation45_degrees_about_center, |
301 transform_origin, | 306 transform_origin, |
302 position, | 307 position, |
303 bounds, | 308 bounds, |
304 true, | 309 true, |
305 false); | 310 false, |
| 311 true); |
306 root->SetDrawsContent(true); | 312 root->SetDrawsContent(true); |
307 | 313 |
308 host_impl().SetViewportSize(root->bounds()); | 314 host_impl().SetViewportSize(root->bounds()); |
309 host_impl().active_tree()->SetRootLayer(root.Pass()); | 315 host_impl().active_tree()->SetRootLayer(root.Pass()); |
310 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 316 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
311 | 317 |
312 // Sanity check the scenario we just created. | 318 // Sanity check the scenario we just created. |
313 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 319 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
314 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); | 320 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); |
315 | 321 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 gfx::Point3F transform_origin; | 370 gfx::Point3F transform_origin; |
365 gfx::PointF position; | 371 gfx::PointF position; |
366 gfx::Size bounds(100, 100); | 372 gfx::Size bounds(100, 100); |
367 SetLayerPropertiesForTesting( | 373 SetLayerPropertiesForTesting( |
368 root.get(), | 374 root.get(), |
369 perspective_projection_about_center * translation_by_z, | 375 perspective_projection_about_center * translation_by_z, |
370 transform_origin, | 376 transform_origin, |
371 position, | 377 position, |
372 bounds, | 378 bounds, |
373 true, | 379 true, |
374 false); | 380 false, |
| 381 true); |
375 root->SetDrawsContent(true); | 382 root->SetDrawsContent(true); |
376 | 383 |
377 host_impl().SetViewportSize(root->bounds()); | 384 host_impl().SetViewportSize(root->bounds()); |
378 host_impl().active_tree()->SetRootLayer(root.Pass()); | 385 host_impl().active_tree()->SetRootLayer(root.Pass()); |
379 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 386 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
380 | 387 |
381 // Sanity check the scenario we just created. | 388 // Sanity check the scenario we just created. |
382 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 389 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
383 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); | 390 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); |
384 | 391 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 | 432 |
426 gfx::Transform identity_matrix; | 433 gfx::Transform identity_matrix; |
427 gfx::Point3F transform_origin; | 434 gfx::Point3F transform_origin; |
428 | 435 |
429 SetLayerPropertiesForTesting(root.get(), | 436 SetLayerPropertiesForTesting(root.get(), |
430 identity_matrix, | 437 identity_matrix, |
431 transform_origin, | 438 transform_origin, |
432 gfx::PointF(), | 439 gfx::PointF(), |
433 gfx::Size(100, 100), | 440 gfx::Size(100, 100), |
434 true, | 441 true, |
435 false); | 442 false, |
| 443 true); |
436 { | 444 { |
437 gfx::PointF position(25.f, 25.f); | 445 gfx::PointF position(25.f, 25.f); |
438 gfx::Size bounds(50, 50); | 446 gfx::Size bounds(50, 50); |
439 scoped_ptr<LayerImpl> test_layer = | 447 scoped_ptr<LayerImpl> test_layer = |
440 LayerImpl::Create(host_impl().active_tree(), 12345); | 448 LayerImpl::Create(host_impl().active_tree(), 12345); |
441 SetLayerPropertiesForTesting(test_layer.get(), | 449 SetLayerPropertiesForTesting(test_layer.get(), |
442 identity_matrix, | 450 identity_matrix, |
443 transform_origin, | 451 transform_origin, |
444 position, | 452 position, |
445 bounds, | 453 bounds, |
446 true, | 454 true, |
| 455 false, |
447 false); | 456 false); |
448 | 457 |
449 // override content bounds and contents scale | 458 // override content bounds and contents scale |
450 test_layer->SetContentBounds(gfx::Size(100, 100)); | 459 test_layer->SetContentBounds(gfx::Size(100, 100)); |
451 test_layer->SetContentsScale(2, 2); | 460 test_layer->SetContentsScale(2, 2); |
452 | 461 |
453 test_layer->SetDrawsContent(true); | 462 test_layer->SetDrawsContent(true); |
454 root->AddChild(test_layer.Pass()); | 463 root->AddChild(test_layer.Pass()); |
455 } | 464 } |
456 | 465 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 gfx::Transform identity_matrix; | 514 gfx::Transform identity_matrix; |
506 gfx::Point3F transform_origin; | 515 gfx::Point3F transform_origin; |
507 | 516 |
508 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); | 517 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); |
509 SetLayerPropertiesForTesting(root.get(), | 518 SetLayerPropertiesForTesting(root.get(), |
510 identity_matrix, | 519 identity_matrix, |
511 transform_origin, | 520 transform_origin, |
512 gfx::PointF(), | 521 gfx::PointF(), |
513 gfx::Size(100, 100), | 522 gfx::Size(100, 100), |
514 true, | 523 true, |
515 false); | 524 false, |
| 525 true); |
516 { | 526 { |
517 scoped_ptr<LayerImpl> clipping_layer = | 527 scoped_ptr<LayerImpl> clipping_layer = |
518 LayerImpl::Create(host_impl().active_tree(), 123); | 528 LayerImpl::Create(host_impl().active_tree(), 123); |
519 // this layer is positioned, and hit testing should correctly know where the | 529 // this layer is positioned, and hit testing should correctly know where the |
520 // layer is located. | 530 // layer is located. |
521 gfx::PointF position(25.f, 25.f); | 531 gfx::PointF position(25.f, 25.f); |
522 gfx::Size bounds(50, 50); | 532 gfx::Size bounds(50, 50); |
523 SetLayerPropertiesForTesting(clipping_layer.get(), | 533 SetLayerPropertiesForTesting(clipping_layer.get(), |
524 identity_matrix, | 534 identity_matrix, |
525 transform_origin, | 535 transform_origin, |
526 position, | 536 position, |
527 bounds, | 537 bounds, |
528 true, | 538 true, |
| 539 false, |
529 false); | 540 false); |
530 clipping_layer->SetMasksToBounds(true); | 541 clipping_layer->SetMasksToBounds(true); |
531 | 542 |
532 scoped_ptr<LayerImpl> child = | 543 scoped_ptr<LayerImpl> child = |
533 LayerImpl::Create(host_impl().active_tree(), 456); | 544 LayerImpl::Create(host_impl().active_tree(), 456); |
534 position = gfx::PointF(-50.f, -50.f); | 545 position = gfx::PointF(-50.f, -50.f); |
535 bounds = gfx::Size(300, 300); | 546 bounds = gfx::Size(300, 300); |
536 SetLayerPropertiesForTesting(child.get(), | 547 SetLayerPropertiesForTesting(child.get(), |
537 identity_matrix, | 548 identity_matrix, |
538 transform_origin, | 549 transform_origin, |
539 position, | 550 position, |
540 bounds, | 551 bounds, |
541 true, | 552 true, |
| 553 false, |
542 false); | 554 false); |
543 child->SetDrawsContent(true); | 555 child->SetDrawsContent(true); |
544 clipping_layer->AddChild(child.Pass()); | 556 clipping_layer->AddChild(child.Pass()); |
545 root->AddChild(clipping_layer.Pass()); | 557 root->AddChild(clipping_layer.Pass()); |
546 } | 558 } |
547 | 559 |
548 host_impl().SetViewportSize(root->bounds()); | 560 host_impl().SetViewportSize(root->bounds()); |
549 host_impl().active_tree()->SetRootLayer(root.Pass()); | 561 host_impl().active_tree()->SetRootLayer(root.Pass()); |
550 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 562 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
551 | 563 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 gfx::Transform identity_matrix; | 612 gfx::Transform identity_matrix; |
601 gfx::Point3F transform_origin; | 613 gfx::Point3F transform_origin; |
602 gfx::PointF position; | 614 gfx::PointF position; |
603 gfx::Size bounds(100, 100); | 615 gfx::Size bounds(100, 100); |
604 SetLayerPropertiesForTesting(root.get(), | 616 SetLayerPropertiesForTesting(root.get(), |
605 identity_matrix, | 617 identity_matrix, |
606 transform_origin, | 618 transform_origin, |
607 position, | 619 position, |
608 bounds, | 620 bounds, |
609 true, | 621 true, |
610 false); | 622 false, |
| 623 true); |
611 root->SetMasksToBounds(true); | 624 root->SetMasksToBounds(true); |
612 { | 625 { |
613 scoped_ptr<LayerImpl> child = | 626 scoped_ptr<LayerImpl> child = |
614 LayerImpl::Create(host_impl().active_tree(), 456); | 627 LayerImpl::Create(host_impl().active_tree(), 456); |
615 scoped_ptr<LayerImpl> grand_child = | 628 scoped_ptr<LayerImpl> grand_child = |
616 LayerImpl::Create(host_impl().active_tree(), 789); | 629 LayerImpl::Create(host_impl().active_tree(), 789); |
617 scoped_ptr<LayerImpl> rotated_leaf = | 630 scoped_ptr<LayerImpl> rotated_leaf = |
618 LayerImpl::Create(host_impl().active_tree(), 2468); | 631 LayerImpl::Create(host_impl().active_tree(), 2468); |
619 | 632 |
620 position = gfx::PointF(10.f, 10.f); | 633 position = gfx::PointF(10.f, 10.f); |
621 bounds = gfx::Size(80, 80); | 634 bounds = gfx::Size(80, 80); |
622 SetLayerPropertiesForTesting(child.get(), | 635 SetLayerPropertiesForTesting(child.get(), |
623 identity_matrix, | 636 identity_matrix, |
624 transform_origin, | 637 transform_origin, |
625 position, | 638 position, |
626 bounds, | 639 bounds, |
627 true, | 640 true, |
| 641 false, |
628 false); | 642 false); |
629 child->SetMasksToBounds(true); | 643 child->SetMasksToBounds(true); |
630 | 644 |
631 gfx::Transform rotation45_degrees_about_corner; | 645 gfx::Transform rotation45_degrees_about_corner; |
632 rotation45_degrees_about_corner.RotateAboutZAxis(45.0); | 646 rotation45_degrees_about_corner.RotateAboutZAxis(45.0); |
633 | 647 |
634 // remember, positioned with respect to its parent which is already at 10, | 648 // remember, positioned with respect to its parent which is already at 10, |
635 // 10 | 649 // 10 |
636 position = gfx::PointF(); | 650 position = gfx::PointF(); |
637 bounds = | 651 bounds = |
638 gfx::Size(200, 200); // to ensure it covers at least sqrt(2) * 100. | 652 gfx::Size(200, 200); // to ensure it covers at least sqrt(2) * 100. |
639 SetLayerPropertiesForTesting(grand_child.get(), | 653 SetLayerPropertiesForTesting(grand_child.get(), |
640 rotation45_degrees_about_corner, | 654 rotation45_degrees_about_corner, |
641 transform_origin, | 655 transform_origin, |
642 position, | 656 position, |
643 bounds, | 657 bounds, |
644 true, | 658 true, |
| 659 false, |
645 false); | 660 false); |
646 grand_child->SetMasksToBounds(true); | 661 grand_child->SetMasksToBounds(true); |
647 | 662 |
648 // Rotates about the center of the layer | 663 // Rotates about the center of the layer |
649 gfx::Transform rotated_leaf_transform; | 664 gfx::Transform rotated_leaf_transform; |
650 rotated_leaf_transform.Translate( | 665 rotated_leaf_transform.Translate( |
651 -10.0, -10.0); // cancel out the grand_parent's position | 666 -10.0, -10.0); // cancel out the grand_parent's position |
652 rotated_leaf_transform.RotateAboutZAxis( | 667 rotated_leaf_transform.RotateAboutZAxis( |
653 -45.0); // cancel out the corner 45-degree rotation of the parent. | 668 -45.0); // cancel out the corner 45-degree rotation of the parent. |
654 rotated_leaf_transform.Translate(50.0, 50.0); | 669 rotated_leaf_transform.Translate(50.0, 50.0); |
655 rotated_leaf_transform.RotateAboutZAxis(45.0); | 670 rotated_leaf_transform.RotateAboutZAxis(45.0); |
656 rotated_leaf_transform.Translate(-50.0, -50.0); | 671 rotated_leaf_transform.Translate(-50.0, -50.0); |
657 position = gfx::PointF(); | 672 position = gfx::PointF(); |
658 bounds = gfx::Size(100, 100); | 673 bounds = gfx::Size(100, 100); |
659 SetLayerPropertiesForTesting(rotated_leaf.get(), | 674 SetLayerPropertiesForTesting(rotated_leaf.get(), |
660 rotated_leaf_transform, | 675 rotated_leaf_transform, |
661 transform_origin, | 676 transform_origin, |
662 position, | 677 position, |
663 bounds, | 678 bounds, |
664 true, | 679 true, |
| 680 false, |
665 false); | 681 false); |
666 rotated_leaf->SetDrawsContent(true); | 682 rotated_leaf->SetDrawsContent(true); |
667 | 683 |
668 grand_child->AddChild(rotated_leaf.Pass()); | 684 grand_child->AddChild(rotated_leaf.Pass()); |
669 child->AddChild(grand_child.Pass()); | 685 child->AddChild(grand_child.Pass()); |
670 root->AddChild(child.Pass()); | 686 root->AddChild(child.Pass()); |
671 } | 687 } |
672 | 688 |
673 host_impl().SetViewportSize(root->bounds()); | 689 host_impl().SetViewportSize(root->bounds()); |
674 host_impl().active_tree()->SetRootLayer(root.Pass()); | 690 host_impl().active_tree()->SetRootLayer(root.Pass()); |
675 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 691 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
676 | 692 |
677 // Sanity check the scenario we just created. | |
678 // The grand_child is expected to create a render surface because it | |
679 // MasksToBounds and is not axis aligned. | |
680 ASSERT_EQ(2u, RenderSurfaceLayerList().size()); | |
681 ASSERT_EQ( | |
682 1u, | |
683 RenderSurfaceLayerList().at(0)->render_surface()->layer_list().size()); | |
684 ASSERT_EQ(789, | |
685 RenderSurfaceLayerList() | |
686 .at(0) | |
687 ->render_surface() | |
688 ->layer_list() | |
689 .at(0) | |
690 ->id()); // grand_child's surface. | |
691 ASSERT_EQ( | |
692 1u, | |
693 RenderSurfaceLayerList().at(1)->render_surface()->layer_list().size()); | |
694 ASSERT_EQ( | |
695 2468, | |
696 RenderSurfaceLayerList()[1]->render_surface()->layer_list().at(0)->id()); | |
697 | |
698 // (11, 89) is close to the the bottom left corner within the clip, but it is | 693 // (11, 89) is close to the the bottom left corner within the clip, but it is |
699 // not inside the layer. | 694 // not inside the layer. |
700 gfx::Point test_point(11, 89); | 695 gfx::Point test_point(11, 89); |
701 LayerImpl* result_layer = | 696 LayerImpl* result_layer = |
702 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); | 697 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); |
703 EXPECT_FALSE(result_layer); | 698 EXPECT_FALSE(result_layer); |
704 | 699 |
705 // Closer inwards from the bottom left will overlap the layer. | 700 // Closer inwards from the bottom left will overlap the layer. |
706 test_point = gfx::Point(25, 75); | 701 test_point = gfx::Point(25, 75); |
707 result_layer = | 702 result_layer = |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 gfx::Transform identity_matrix; | 743 gfx::Transform identity_matrix; |
749 gfx::Point3F transform_origin; | 744 gfx::Point3F transform_origin; |
750 | 745 |
751 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); | 746 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); |
752 SetLayerPropertiesForTesting(root.get(), | 747 SetLayerPropertiesForTesting(root.get(), |
753 identity_matrix, | 748 identity_matrix, |
754 transform_origin, | 749 transform_origin, |
755 gfx::PointF(), | 750 gfx::PointF(), |
756 gfx::Size(100, 100), | 751 gfx::Size(100, 100), |
757 true, | 752 true, |
758 false); | 753 false, |
| 754 true); |
759 { | 755 { |
760 scoped_ptr<LayerImpl> intermediate_layer = | 756 scoped_ptr<LayerImpl> intermediate_layer = |
761 LayerImpl::Create(host_impl().active_tree(), 123); | 757 LayerImpl::Create(host_impl().active_tree(), 123); |
762 // this layer is positioned, and hit testing should correctly know where the | 758 // this layer is positioned, and hit testing should correctly know where the |
763 // layer is located. | 759 // layer is located. |
764 gfx::PointF position(10.f, 10.f); | 760 gfx::PointF position(10.f, 10.f); |
765 gfx::Size bounds(50, 50); | 761 gfx::Size bounds(50, 50); |
766 SetLayerPropertiesForTesting(intermediate_layer.get(), | 762 SetLayerPropertiesForTesting(intermediate_layer.get(), |
767 identity_matrix, | 763 identity_matrix, |
768 transform_origin, | 764 transform_origin, |
769 position, | 765 position, |
770 bounds, | 766 bounds, |
771 true, | 767 true, |
| 768 false, |
772 false); | 769 false); |
773 // Sanity check the intermediate layer should not clip. | 770 // Sanity check the intermediate layer should not clip. |
774 ASSERT_FALSE(intermediate_layer->masks_to_bounds()); | 771 ASSERT_FALSE(intermediate_layer->masks_to_bounds()); |
775 ASSERT_FALSE(intermediate_layer->mask_layer()); | 772 ASSERT_FALSE(intermediate_layer->mask_layer()); |
776 | 773 |
777 // The child of the intermediate_layer is translated so that it does not | 774 // The child of the intermediate_layer is translated so that it does not |
778 // overlap intermediate_layer at all. If child is incorrectly clipped, we | 775 // overlap intermediate_layer at all. If child is incorrectly clipped, we |
779 // would not be able to hit it successfully. | 776 // would not be able to hit it successfully. |
780 scoped_ptr<LayerImpl> child = | 777 scoped_ptr<LayerImpl> child = |
781 LayerImpl::Create(host_impl().active_tree(), 456); | 778 LayerImpl::Create(host_impl().active_tree(), 456); |
782 position = gfx::PointF(60.f, 60.f); // 70, 70 in screen space | 779 position = gfx::PointF(60.f, 60.f); // 70, 70 in screen space |
783 bounds = gfx::Size(20, 20); | 780 bounds = gfx::Size(20, 20); |
784 SetLayerPropertiesForTesting(child.get(), | 781 SetLayerPropertiesForTesting(child.get(), |
785 identity_matrix, | 782 identity_matrix, |
786 transform_origin, | 783 transform_origin, |
787 position, | 784 position, |
788 bounds, | 785 bounds, |
789 true, | 786 true, |
| 787 false, |
790 false); | 788 false); |
791 child->SetDrawsContent(true); | 789 child->SetDrawsContent(true); |
792 intermediate_layer->AddChild(child.Pass()); | 790 intermediate_layer->AddChild(child.Pass()); |
793 root->AddChild(intermediate_layer.Pass()); | 791 root->AddChild(intermediate_layer.Pass()); |
794 } | 792 } |
795 | 793 |
796 host_impl().SetViewportSize(root->bounds()); | 794 host_impl().SetViewportSize(root->bounds()); |
797 host_impl().active_tree()->SetRootLayer(root.Pass()); | 795 host_impl().active_tree()->SetRootLayer(root.Pass()); |
798 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 796 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
799 | 797 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 gfx::Transform identity_matrix; | 831 gfx::Transform identity_matrix; |
834 gfx::Point3F transform_origin; | 832 gfx::Point3F transform_origin; |
835 gfx::PointF position; | 833 gfx::PointF position; |
836 gfx::Size bounds(100, 100); | 834 gfx::Size bounds(100, 100); |
837 SetLayerPropertiesForTesting(root.get(), | 835 SetLayerPropertiesForTesting(root.get(), |
838 identity_matrix, | 836 identity_matrix, |
839 transform_origin, | 837 transform_origin, |
840 position, | 838 position, |
841 bounds, | 839 bounds, |
842 true, | 840 true, |
843 false); | 841 false, |
| 842 true); |
844 root->SetDrawsContent(true); | 843 root->SetDrawsContent(true); |
845 { | 844 { |
846 // child 1 and child2 are initialized to overlap between x=50 and x=60. | 845 // child 1 and child2 are initialized to overlap between x=50 and x=60. |
847 // grand_child is set to overlap both child1 and child2 between y=50 and | 846 // grand_child is set to overlap both child1 and child2 between y=50 and |
848 // y=60. The expected stacking order is: (front) child2, (second) | 847 // y=60. The expected stacking order is: (front) child2, (second) |
849 // grand_child, (third) child1, and (back) the root layer behind all other | 848 // grand_child, (third) child1, and (back) the root layer behind all other |
850 // layers. | 849 // layers. |
851 | 850 |
852 scoped_ptr<LayerImpl> child1 = | 851 scoped_ptr<LayerImpl> child1 = |
853 LayerImpl::Create(host_impl().active_tree(), 2); | 852 LayerImpl::Create(host_impl().active_tree(), 2); |
854 scoped_ptr<LayerImpl> child2 = | 853 scoped_ptr<LayerImpl> child2 = |
855 LayerImpl::Create(host_impl().active_tree(), 3); | 854 LayerImpl::Create(host_impl().active_tree(), 3); |
856 scoped_ptr<LayerImpl> grand_child1 = | 855 scoped_ptr<LayerImpl> grand_child1 = |
857 LayerImpl::Create(host_impl().active_tree(), 4); | 856 LayerImpl::Create(host_impl().active_tree(), 4); |
858 | 857 |
859 position = gfx::PointF(10.f, 10.f); | 858 position = gfx::PointF(10.f, 10.f); |
860 bounds = gfx::Size(50, 50); | 859 bounds = gfx::Size(50, 50); |
861 SetLayerPropertiesForTesting(child1.get(), | 860 SetLayerPropertiesForTesting(child1.get(), |
862 identity_matrix, | 861 identity_matrix, |
863 transform_origin, | 862 transform_origin, |
864 position, | 863 position, |
865 bounds, | 864 bounds, |
866 true, | 865 true, |
| 866 false, |
867 false); | 867 false); |
868 child1->SetDrawsContent(true); | 868 child1->SetDrawsContent(true); |
869 | 869 |
870 position = gfx::PointF(50.f, 10.f); | 870 position = gfx::PointF(50.f, 10.f); |
871 bounds = gfx::Size(50, 50); | 871 bounds = gfx::Size(50, 50); |
872 SetLayerPropertiesForTesting(child2.get(), | 872 SetLayerPropertiesForTesting(child2.get(), |
873 identity_matrix, | 873 identity_matrix, |
874 transform_origin, | 874 transform_origin, |
875 position, | 875 position, |
876 bounds, | 876 bounds, |
877 true, | 877 true, |
| 878 false, |
878 false); | 879 false); |
879 child2->SetDrawsContent(true); | 880 child2->SetDrawsContent(true); |
880 | 881 |
881 // Remember that grand_child is positioned with respect to its parent (i.e. | 882 // Remember that grand_child is positioned with respect to its parent (i.e. |
882 // child1). In screen space, the intended position is (10, 50), with size | 883 // child1). In screen space, the intended position is (10, 50), with size |
883 // 100 x 50. | 884 // 100 x 50. |
884 position = gfx::PointF(0.f, 40.f); | 885 position = gfx::PointF(0.f, 40.f); |
885 bounds = gfx::Size(100, 50); | 886 bounds = gfx::Size(100, 50); |
886 SetLayerPropertiesForTesting(grand_child1.get(), | 887 SetLayerPropertiesForTesting(grand_child1.get(), |
887 identity_matrix, | 888 identity_matrix, |
888 transform_origin, | 889 transform_origin, |
889 position, | 890 position, |
890 bounds, | 891 bounds, |
891 true, | 892 true, |
| 893 false, |
892 false); | 894 false); |
893 grand_child1->SetDrawsContent(true); | 895 grand_child1->SetDrawsContent(true); |
894 | 896 |
895 child1->AddChild(grand_child1.Pass()); | 897 child1->AddChild(grand_child1.Pass()); |
896 root->AddChild(child1.Pass()); | 898 root->AddChild(child1.Pass()); |
897 root->AddChild(child2.Pass()); | 899 root->AddChild(child2.Pass()); |
898 } | 900 } |
899 | 901 |
900 LayerImpl* child1 = root->children()[0]; | 902 LayerImpl* child1 = root->children()[0]; |
901 LayerImpl* child2 = root->children()[1]; | 903 LayerImpl* child2 = root->children()[1]; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
972 gfx::Transform identity_matrix; | 974 gfx::Transform identity_matrix; |
973 gfx::Point3F transform_origin; | 975 gfx::Point3F transform_origin; |
974 gfx::PointF position; | 976 gfx::PointF position; |
975 gfx::Size bounds(100, 100); | 977 gfx::Size bounds(100, 100); |
976 SetLayerPropertiesForTesting(root.get(), | 978 SetLayerPropertiesForTesting(root.get(), |
977 identity_matrix, | 979 identity_matrix, |
978 transform_origin, | 980 transform_origin, |
979 position, | 981 position, |
980 bounds, | 982 bounds, |
981 true, | 983 true, |
982 false); | 984 false, |
| 985 true); |
983 root->SetDrawsContent(true); | 986 root->SetDrawsContent(true); |
984 root->SetShouldFlattenTransform(false); | 987 root->SetShouldFlattenTransform(false); |
985 root->Set3dSortingContextId(1); | 988 root->Set3dSortingContextId(1); |
986 { | 989 { |
987 // child 1 and child2 are initialized to overlap between x=50 and x=60. | 990 // child 1 and child2 are initialized to overlap between x=50 and x=60. |
988 // grand_child is set to overlap both child1 and child2 between y=50 and | 991 // grand_child is set to overlap both child1 and child2 between y=50 and |
989 // y=60. The expected stacking order is: (front) child2, (second) | 992 // y=60. The expected stacking order is: (front) child2, (second) |
990 // grand_child, (third) child1, and (back) the root layer behind all other | 993 // grand_child, (third) child1, and (back) the root layer behind all other |
991 // layers. | 994 // layers. |
992 | 995 |
993 scoped_ptr<LayerImpl> child1 = | 996 scoped_ptr<LayerImpl> child1 = |
994 LayerImpl::Create(host_impl().active_tree(), 2); | 997 LayerImpl::Create(host_impl().active_tree(), 2); |
995 scoped_ptr<LayerImpl> child2 = | 998 scoped_ptr<LayerImpl> child2 = |
996 LayerImpl::Create(host_impl().active_tree(), 3); | 999 LayerImpl::Create(host_impl().active_tree(), 3); |
997 scoped_ptr<LayerImpl> grand_child1 = | 1000 scoped_ptr<LayerImpl> grand_child1 = |
998 LayerImpl::Create(host_impl().active_tree(), 4); | 1001 LayerImpl::Create(host_impl().active_tree(), 4); |
999 | 1002 |
1000 position = gfx::PointF(10.f, 10.f); | 1003 position = gfx::PointF(10.f, 10.f); |
1001 bounds = gfx::Size(50, 50); | 1004 bounds = gfx::Size(50, 50); |
1002 SetLayerPropertiesForTesting(child1.get(), | 1005 SetLayerPropertiesForTesting(child1.get(), |
1003 identity_matrix, | 1006 identity_matrix, |
1004 transform_origin, | 1007 transform_origin, |
1005 position, | 1008 position, |
1006 bounds, | 1009 bounds, |
1007 true, | 1010 true, |
| 1011 false, |
1008 false); | 1012 false); |
1009 child1->SetDrawsContent(true); | 1013 child1->SetDrawsContent(true); |
1010 child1->SetShouldFlattenTransform(false); | 1014 child1->SetShouldFlattenTransform(false); |
1011 child1->Set3dSortingContextId(1); | 1015 child1->Set3dSortingContextId(1); |
1012 | 1016 |
1013 position = gfx::PointF(50.f, 10.f); | 1017 position = gfx::PointF(50.f, 10.f); |
1014 bounds = gfx::Size(50, 50); | 1018 bounds = gfx::Size(50, 50); |
1015 gfx::Transform translate_z; | 1019 gfx::Transform translate_z; |
1016 translate_z.Translate3d(0, 0, -10.f); | 1020 translate_z.Translate3d(0, 0, -10.f); |
1017 SetLayerPropertiesForTesting(child2.get(), | 1021 SetLayerPropertiesForTesting(child2.get(), |
1018 translate_z, | 1022 translate_z, |
1019 transform_origin, | 1023 transform_origin, |
1020 position, | 1024 position, |
1021 bounds, | 1025 bounds, |
1022 true, | 1026 true, |
| 1027 false, |
1023 false); | 1028 false); |
1024 child2->SetDrawsContent(true); | 1029 child2->SetDrawsContent(true); |
1025 child2->SetShouldFlattenTransform(false); | 1030 child2->SetShouldFlattenTransform(false); |
1026 child2->Set3dSortingContextId(1); | 1031 child2->Set3dSortingContextId(1); |
1027 | 1032 |
1028 // Remember that grand_child is positioned with respect to its parent (i.e. | 1033 // Remember that grand_child is positioned with respect to its parent (i.e. |
1029 // child1). In screen space, the intended position is (10, 50), with size | 1034 // child1). In screen space, the intended position is (10, 50), with size |
1030 // 100 x 50. | 1035 // 100 x 50. |
1031 position = gfx::PointF(0.f, 40.f); | 1036 position = gfx::PointF(0.f, 40.f); |
1032 bounds = gfx::Size(100, 50); | 1037 bounds = gfx::Size(100, 50); |
1033 SetLayerPropertiesForTesting(grand_child1.get(), | 1038 SetLayerPropertiesForTesting(grand_child1.get(), |
1034 identity_matrix, | 1039 identity_matrix, |
1035 transform_origin, | 1040 transform_origin, |
1036 position, | 1041 position, |
1037 bounds, | 1042 bounds, |
1038 true, | 1043 true, |
| 1044 false, |
1039 false); | 1045 false); |
1040 grand_child1->SetDrawsContent(true); | 1046 grand_child1->SetDrawsContent(true); |
1041 grand_child1->SetShouldFlattenTransform(false); | 1047 grand_child1->SetShouldFlattenTransform(false); |
1042 | 1048 |
1043 child1->AddChild(grand_child1.Pass()); | 1049 child1->AddChild(grand_child1.Pass()); |
1044 root->AddChild(child1.Pass()); | 1050 root->AddChild(child1.Pass()); |
1045 root->AddChild(child2.Pass()); | 1051 root->AddChild(child2.Pass()); |
1046 } | 1052 } |
1047 | 1053 |
1048 LayerImpl* child1 = root->children()[0]; | 1054 LayerImpl* child1 = root->children()[0]; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1121 gfx::Transform identity_matrix; | 1127 gfx::Transform identity_matrix; |
1122 gfx::Point3F transform_origin; | 1128 gfx::Point3F transform_origin; |
1123 gfx::PointF position; | 1129 gfx::PointF position; |
1124 gfx::Size bounds(100, 100); | 1130 gfx::Size bounds(100, 100); |
1125 SetLayerPropertiesForTesting(root.get(), | 1131 SetLayerPropertiesForTesting(root.get(), |
1126 identity_matrix, | 1132 identity_matrix, |
1127 transform_origin, | 1133 transform_origin, |
1128 position, | 1134 position, |
1129 bounds, | 1135 bounds, |
1130 true, | 1136 true, |
1131 false); | 1137 false, |
| 1138 true); |
1132 root->SetDrawsContent(true); | 1139 root->SetDrawsContent(true); |
1133 { | 1140 { |
1134 scoped_ptr<LayerImpl> child = | 1141 scoped_ptr<LayerImpl> child = |
1135 LayerImpl::Create(host_impl().active_tree(), 2); | 1142 LayerImpl::Create(host_impl().active_tree(), 2); |
1136 scoped_ptr<LayerImpl> grand_child = | 1143 scoped_ptr<LayerImpl> grand_child = |
1137 LayerImpl::Create(host_impl().active_tree(), 4); | 1144 LayerImpl::Create(host_impl().active_tree(), 4); |
1138 | 1145 |
1139 position = gfx::PointF(10.f, 10.f); | 1146 position = gfx::PointF(10.f, 10.f); |
1140 bounds = gfx::Size(1, 1); | 1147 bounds = gfx::Size(1, 1); |
1141 SetLayerPropertiesForTesting(child.get(), | 1148 SetLayerPropertiesForTesting(child.get(), |
1142 identity_matrix, | 1149 identity_matrix, |
1143 transform_origin, | 1150 transform_origin, |
1144 position, | 1151 position, |
1145 bounds, | 1152 bounds, |
1146 true, | 1153 true, |
| 1154 false, |
1147 false); | 1155 false); |
1148 child->SetDrawsContent(true); | 1156 child->SetDrawsContent(true); |
1149 child->SetMasksToBounds(true); | 1157 child->SetMasksToBounds(true); |
1150 | 1158 |
1151 position = gfx::PointF(0.f, 40.f); | 1159 position = gfx::PointF(0.f, 40.f); |
1152 bounds = gfx::Size(100, 50); | 1160 bounds = gfx::Size(100, 50); |
1153 SetLayerPropertiesForTesting(grand_child.get(), | 1161 SetLayerPropertiesForTesting(grand_child.get(), |
1154 identity_matrix, | 1162 identity_matrix, |
1155 transform_origin, | 1163 transform_origin, |
1156 position, | 1164 position, |
1157 bounds, | 1165 bounds, |
1158 true, | 1166 true, |
| 1167 false, |
1159 false); | 1168 false); |
1160 grand_child->SetDrawsContent(true); | 1169 grand_child->SetDrawsContent(true); |
1161 grand_child->SetForceRenderSurface(true); | 1170 grand_child->SetHasRenderSurface(true); |
1162 | 1171 |
1163 // This should let |grand_child| "escape" |child|'s clip. | 1172 // This should let |grand_child| "escape" |child|'s clip. |
1164 grand_child->SetClipParent(root.get()); | 1173 grand_child->SetClipParent(root.get()); |
1165 | 1174 |
1166 child->AddChild(grand_child.Pass()); | 1175 child->AddChild(grand_child.Pass()); |
1167 root->AddChild(child.Pass()); | 1176 root->AddChild(child.Pass()); |
1168 } | 1177 } |
1169 | 1178 |
1170 host_impl().SetViewportSize(root->bounds()); | 1179 host_impl().SetViewportSize(root->bounds()); |
1171 host_impl().active_tree()->SetRootLayer(root.Pass()); | 1180 host_impl().active_tree()->SetRootLayer(root.Pass()); |
(...skipping 11 matching lines...) Expand all Loading... |
1183 gfx::Transform identity_matrix; | 1192 gfx::Transform identity_matrix; |
1184 gfx::Point3F transform_origin; | 1193 gfx::Point3F transform_origin; |
1185 gfx::PointF position; | 1194 gfx::PointF position; |
1186 gfx::Size bounds(100, 100); | 1195 gfx::Size bounds(100, 100); |
1187 SetLayerPropertiesForTesting(root.get(), | 1196 SetLayerPropertiesForTesting(root.get(), |
1188 identity_matrix, | 1197 identity_matrix, |
1189 transform_origin, | 1198 transform_origin, |
1190 position, | 1199 position, |
1191 bounds, | 1200 bounds, |
1192 true, | 1201 true, |
1193 false); | 1202 false, |
| 1203 true); |
1194 root->SetDrawsContent(true); | 1204 root->SetDrawsContent(true); |
1195 { | 1205 { |
1196 scoped_ptr<LayerImpl> child = | 1206 scoped_ptr<LayerImpl> child = |
1197 LayerImpl::Create(host_impl().active_tree(), 2); | 1207 LayerImpl::Create(host_impl().active_tree(), 2); |
1198 scoped_ptr<LayerImpl> scroll_child = | 1208 scoped_ptr<LayerImpl> scroll_child = |
1199 LayerImpl::Create(host_impl().active_tree(), 3); | 1209 LayerImpl::Create(host_impl().active_tree(), 3); |
1200 scoped_ptr<LayerImpl> grand_child = | 1210 scoped_ptr<LayerImpl> grand_child = |
1201 LayerImpl::Create(host_impl().active_tree(), 4); | 1211 LayerImpl::Create(host_impl().active_tree(), 4); |
1202 | 1212 |
1203 position = gfx::PointF(10.f, 10.f); | 1213 position = gfx::PointF(10.f, 10.f); |
1204 bounds = gfx::Size(1, 1); | 1214 bounds = gfx::Size(1, 1); |
1205 SetLayerPropertiesForTesting(child.get(), | 1215 SetLayerPropertiesForTesting(child.get(), |
1206 identity_matrix, | 1216 identity_matrix, |
1207 transform_origin, | 1217 transform_origin, |
1208 position, | 1218 position, |
1209 bounds, | 1219 bounds, |
1210 true, | 1220 true, |
| 1221 false, |
1211 false); | 1222 false); |
1212 child->SetDrawsContent(true); | 1223 child->SetDrawsContent(true); |
1213 child->SetMasksToBounds(true); | 1224 child->SetMasksToBounds(true); |
1214 | 1225 |
1215 position = gfx::PointF(); | 1226 position = gfx::PointF(); |
1216 bounds = gfx::Size(200, 200); | 1227 bounds = gfx::Size(200, 200); |
1217 SetLayerPropertiesForTesting(scroll_child.get(), | 1228 SetLayerPropertiesForTesting(scroll_child.get(), |
1218 identity_matrix, | 1229 identity_matrix, |
1219 transform_origin, | 1230 transform_origin, |
1220 position, | 1231 position, |
1221 bounds, | 1232 bounds, |
1222 true, | 1233 true, |
| 1234 false, |
1223 false); | 1235 false); |
1224 scroll_child->SetDrawsContent(true); | 1236 scroll_child->SetDrawsContent(true); |
1225 | 1237 |
1226 // This should cause scroll child and its descendants to be affected by | 1238 // This should cause scroll child and its descendants to be affected by |
1227 // |child|'s clip. | 1239 // |child|'s clip. |
1228 scroll_child->SetScrollParent(child.get()); | 1240 scroll_child->SetScrollParent(child.get()); |
1229 | 1241 |
1230 SetLayerPropertiesForTesting(grand_child.get(), | 1242 SetLayerPropertiesForTesting(grand_child.get(), |
1231 identity_matrix, | 1243 identity_matrix, |
1232 transform_origin, | 1244 transform_origin, |
1233 position, | 1245 position, |
1234 bounds, | 1246 bounds, |
1235 true, | 1247 true, |
| 1248 false, |
1236 false); | 1249 false); |
1237 grand_child->SetDrawsContent(true); | 1250 grand_child->SetDrawsContent(true); |
1238 grand_child->SetForceRenderSurface(true); | 1251 grand_child->SetHasRenderSurface(true); |
1239 | 1252 |
1240 scroll_child->AddChild(grand_child.Pass()); | 1253 scroll_child->AddChild(grand_child.Pass()); |
1241 root->AddChild(scroll_child.Pass()); | 1254 root->AddChild(scroll_child.Pass()); |
1242 root->AddChild(child.Pass()); | 1255 root->AddChild(child.Pass()); |
1243 } | 1256 } |
1244 | 1257 |
1245 host_impl().SetViewportSize(root->bounds()); | 1258 host_impl().SetViewportSize(root->bounds()); |
1246 host_impl().active_tree()->SetRootLayer(root.Pass()); | 1259 host_impl().active_tree()->SetRootLayer(root.Pass()); |
1247 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 1260 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
1248 | 1261 |
(...skipping 15 matching lines...) Expand all Loading... |
1264 gfx::Transform identity_matrix; | 1277 gfx::Transform identity_matrix; |
1265 gfx::Point3F transform_origin; | 1278 gfx::Point3F transform_origin; |
1266 gfx::PointF position; | 1279 gfx::PointF position; |
1267 gfx::Size bounds(100, 100); | 1280 gfx::Size bounds(100, 100); |
1268 SetLayerPropertiesForTesting(root.get(), | 1281 SetLayerPropertiesForTesting(root.get(), |
1269 identity_matrix, | 1282 identity_matrix, |
1270 transform_origin, | 1283 transform_origin, |
1271 position, | 1284 position, |
1272 bounds, | 1285 bounds, |
1273 true, | 1286 true, |
1274 false); | 1287 false, |
| 1288 true); |
1275 root->SetDrawsContent(true); | 1289 root->SetDrawsContent(true); |
1276 { | 1290 { |
1277 // child 1 and child2 are initialized to overlap between x=50 and x=60. | 1291 // child 1 and child2 are initialized to overlap between x=50 and x=60. |
1278 // grand_child is set to overlap both child1 and child2 between y=50 and | 1292 // grand_child is set to overlap both child1 and child2 between y=50 and |
1279 // y=60. The expected stacking order is: (front) child2, (second) | 1293 // y=60. The expected stacking order is: (front) child2, (second) |
1280 // grand_child, (third) child1, and (back) the root layer behind all other | 1294 // grand_child, (third) child1, and (back) the root layer behind all other |
1281 // layers. | 1295 // layers. |
1282 | 1296 |
1283 scoped_ptr<LayerImpl> child1 = | 1297 scoped_ptr<LayerImpl> child1 = |
1284 LayerImpl::Create(host_impl().active_tree(), 2); | 1298 LayerImpl::Create(host_impl().active_tree(), 2); |
1285 scoped_ptr<LayerImpl> child2 = | 1299 scoped_ptr<LayerImpl> child2 = |
1286 LayerImpl::Create(host_impl().active_tree(), 3); | 1300 LayerImpl::Create(host_impl().active_tree(), 3); |
1287 scoped_ptr<LayerImpl> grand_child1 = | 1301 scoped_ptr<LayerImpl> grand_child1 = |
1288 LayerImpl::Create(host_impl().active_tree(), 4); | 1302 LayerImpl::Create(host_impl().active_tree(), 4); |
1289 | 1303 |
1290 position = gfx::PointF(10.f, 10.f); | 1304 position = gfx::PointF(10.f, 10.f); |
1291 bounds = gfx::Size(50, 50); | 1305 bounds = gfx::Size(50, 50); |
1292 SetLayerPropertiesForTesting(child1.get(), | 1306 SetLayerPropertiesForTesting(child1.get(), |
1293 identity_matrix, | 1307 identity_matrix, |
1294 transform_origin, | 1308 transform_origin, |
1295 position, | 1309 position, |
1296 bounds, | 1310 bounds, |
1297 true, | 1311 true, |
| 1312 false, |
1298 false); | 1313 false); |
1299 child1->SetDrawsContent(true); | 1314 child1->SetDrawsContent(true); |
1300 child1->SetForceRenderSurface(true); | 1315 child1->SetHasRenderSurface(true); |
1301 | 1316 |
1302 position = gfx::PointF(50.f, 10.f); | 1317 position = gfx::PointF(50.f, 10.f); |
1303 bounds = gfx::Size(50, 50); | 1318 bounds = gfx::Size(50, 50); |
1304 SetLayerPropertiesForTesting(child2.get(), | 1319 SetLayerPropertiesForTesting(child2.get(), |
1305 identity_matrix, | 1320 identity_matrix, |
1306 transform_origin, | 1321 transform_origin, |
1307 position, | 1322 position, |
1308 bounds, | 1323 bounds, |
1309 true, | 1324 true, |
| 1325 false, |
1310 false); | 1326 false); |
1311 child2->SetDrawsContent(true); | 1327 child2->SetDrawsContent(true); |
1312 child2->SetForceRenderSurface(true); | 1328 child2->SetHasRenderSurface(true); |
1313 | 1329 |
1314 // Remember that grand_child is positioned with respect to its parent (i.e. | 1330 // Remember that grand_child is positioned with respect to its parent (i.e. |
1315 // child1). In screen space, the intended position is (10, 50), with size | 1331 // child1). In screen space, the intended position is (10, 50), with size |
1316 // 100 x 50. | 1332 // 100 x 50. |
1317 position = gfx::PointF(0.f, 40.f); | 1333 position = gfx::PointF(0.f, 40.f); |
1318 bounds = gfx::Size(100, 50); | 1334 bounds = gfx::Size(100, 50); |
1319 SetLayerPropertiesForTesting(grand_child1.get(), | 1335 SetLayerPropertiesForTesting(grand_child1.get(), |
1320 identity_matrix, | 1336 identity_matrix, |
1321 transform_origin, | 1337 transform_origin, |
1322 position, | 1338 position, |
1323 bounds, | 1339 bounds, |
1324 true, | 1340 true, |
| 1341 false, |
1325 false); | 1342 false); |
1326 grand_child1->SetDrawsContent(true); | 1343 grand_child1->SetDrawsContent(true); |
1327 grand_child1->SetForceRenderSurface(true); | 1344 grand_child1->SetHasRenderSurface(true); |
1328 | 1345 |
1329 child1->AddChild(grand_child1.Pass()); | 1346 child1->AddChild(grand_child1.Pass()); |
1330 root->AddChild(child1.Pass()); | 1347 root->AddChild(child1.Pass()); |
1331 root->AddChild(child2.Pass()); | 1348 root->AddChild(child2.Pass()); |
1332 } | 1349 } |
1333 | 1350 |
1334 LayerImpl* child1 = root->children()[0]; | 1351 LayerImpl* child1 = root->children()[0]; |
1335 LayerImpl* child2 = root->children()[1]; | 1352 LayerImpl* child2 = root->children()[1]; |
1336 LayerImpl* grand_child1 = child1->children()[0]; | 1353 LayerImpl* grand_child1 = child1->children()[0]; |
1337 | 1354 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1415 Region touch_handler_region(gfx::Rect(10, 10, 50, 50)); | 1432 Region touch_handler_region(gfx::Rect(10, 10, 50, 50)); |
1416 gfx::Point3F transform_origin; | 1433 gfx::Point3F transform_origin; |
1417 gfx::PointF position; | 1434 gfx::PointF position; |
1418 gfx::Size bounds(100, 100); | 1435 gfx::Size bounds(100, 100); |
1419 SetLayerPropertiesForTesting(root.get(), | 1436 SetLayerPropertiesForTesting(root.get(), |
1420 identity_matrix, | 1437 identity_matrix, |
1421 transform_origin, | 1438 transform_origin, |
1422 position, | 1439 position, |
1423 bounds, | 1440 bounds, |
1424 true, | 1441 true, |
1425 false); | 1442 false, |
| 1443 true); |
1426 root->SetDrawsContent(true); | 1444 root->SetDrawsContent(true); |
1427 | 1445 |
1428 host_impl().SetViewportSize(root->bounds()); | 1446 host_impl().SetViewportSize(root->bounds()); |
1429 host_impl().active_tree()->SetRootLayer(root.Pass()); | 1447 host_impl().active_tree()->SetRootLayer(root.Pass()); |
1430 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 1448 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
1431 | 1449 |
1432 // Sanity check the scenario we just created. | 1450 // Sanity check the scenario we just created. |
1433 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 1451 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
1434 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); | 1452 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); |
1435 | 1453 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1503 Region touch_handler_region(gfx::Rect(10, 10, 50, 50)); | 1521 Region touch_handler_region(gfx::Rect(10, 10, 50, 50)); |
1504 gfx::Point3F transform_origin; | 1522 gfx::Point3F transform_origin; |
1505 gfx::PointF position; | 1523 gfx::PointF position; |
1506 gfx::Size bounds(100, 100); | 1524 gfx::Size bounds(100, 100); |
1507 SetLayerPropertiesForTesting(root.get(), | 1525 SetLayerPropertiesForTesting(root.get(), |
1508 uninvertible_transform, | 1526 uninvertible_transform, |
1509 transform_origin, | 1527 transform_origin, |
1510 position, | 1528 position, |
1511 bounds, | 1529 bounds, |
1512 true, | 1530 true, |
1513 false); | 1531 false, |
| 1532 true); |
1514 root->SetDrawsContent(true); | 1533 root->SetDrawsContent(true); |
1515 root->SetTouchEventHandlerRegion(touch_handler_region); | 1534 root->SetTouchEventHandlerRegion(touch_handler_region); |
1516 | 1535 |
1517 host_impl().SetViewportSize(root->bounds()); | 1536 host_impl().SetViewportSize(root->bounds()); |
1518 host_impl().active_tree()->SetRootLayer(root.Pass()); | 1537 host_impl().active_tree()->SetRootLayer(root.Pass()); |
1519 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 1538 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
1520 | 1539 |
1521 // Sanity check the scenario we just created. | 1540 // Sanity check the scenario we just created. |
1522 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 1541 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
1523 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); | 1542 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1581 // this layer is positioned, and hit testing should correctly know where the | 1600 // this layer is positioned, and hit testing should correctly know where the |
1582 // layer is located. | 1601 // layer is located. |
1583 gfx::PointF position(50.f, 50.f); | 1602 gfx::PointF position(50.f, 50.f); |
1584 gfx::Size bounds(100, 100); | 1603 gfx::Size bounds(100, 100); |
1585 SetLayerPropertiesForTesting(root.get(), | 1604 SetLayerPropertiesForTesting(root.get(), |
1586 identity_matrix, | 1605 identity_matrix, |
1587 transform_origin, | 1606 transform_origin, |
1588 position, | 1607 position, |
1589 bounds, | 1608 bounds, |
1590 true, | 1609 true, |
1591 false); | 1610 false, |
| 1611 true); |
1592 root->SetDrawsContent(true); | 1612 root->SetDrawsContent(true); |
1593 root->SetTouchEventHandlerRegion(touch_handler_region); | 1613 root->SetTouchEventHandlerRegion(touch_handler_region); |
1594 | 1614 |
1595 host_impl().SetViewportSize(root->bounds()); | 1615 host_impl().SetViewportSize(root->bounds()); |
1596 host_impl().active_tree()->SetRootLayer(root.Pass()); | 1616 host_impl().active_tree()->SetRootLayer(root.Pass()); |
1597 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 1617 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
1598 | 1618 |
1599 // Sanity check the scenario we just created. | 1619 // Sanity check the scenario we just created. |
1600 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 1620 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
1601 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); | 1621 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1657 | 1677 |
1658 gfx::Transform identity_matrix; | 1678 gfx::Transform identity_matrix; |
1659 gfx::Point3F transform_origin; | 1679 gfx::Point3F transform_origin; |
1660 | 1680 |
1661 SetLayerPropertiesForTesting(root.get(), | 1681 SetLayerPropertiesForTesting(root.get(), |
1662 identity_matrix, | 1682 identity_matrix, |
1663 transform_origin, | 1683 transform_origin, |
1664 gfx::PointF(), | 1684 gfx::PointF(), |
1665 gfx::Size(100, 100), | 1685 gfx::Size(100, 100), |
1666 true, | 1686 true, |
1667 false); | 1687 false, |
| 1688 true); |
1668 { | 1689 { |
1669 Region touch_handler_region(gfx::Rect(10, 10, 30, 30)); | 1690 Region touch_handler_region(gfx::Rect(10, 10, 30, 30)); |
1670 gfx::PointF position(25.f, 25.f); | 1691 gfx::PointF position(25.f, 25.f); |
1671 gfx::Size bounds(50, 50); | 1692 gfx::Size bounds(50, 50); |
1672 scoped_ptr<LayerImpl> test_layer = | 1693 scoped_ptr<LayerImpl> test_layer = |
1673 LayerImpl::Create(host_impl().active_tree(), 12345); | 1694 LayerImpl::Create(host_impl().active_tree(), 12345); |
1674 SetLayerPropertiesForTesting(test_layer.get(), | 1695 SetLayerPropertiesForTesting(test_layer.get(), |
1675 identity_matrix, | 1696 identity_matrix, |
1676 transform_origin, | 1697 transform_origin, |
1677 position, | 1698 position, |
1678 bounds, | 1699 bounds, |
1679 true, | 1700 true, |
| 1701 false, |
1680 false); | 1702 false); |
1681 | 1703 |
1682 // override content bounds and contents scale | 1704 // override content bounds and contents scale |
1683 test_layer->SetContentBounds(gfx::Size(100, 100)); | 1705 test_layer->SetContentBounds(gfx::Size(100, 100)); |
1684 test_layer->SetContentsScale(2, 2); | 1706 test_layer->SetContentsScale(2, 2); |
1685 | 1707 |
1686 test_layer->SetDrawsContent(true); | 1708 test_layer->SetDrawsContent(true); |
1687 test_layer->SetTouchEventHandlerRegion(touch_handler_region); | 1709 test_layer->SetTouchEventHandlerRegion(touch_handler_region); |
1688 root->AddChild(test_layer.Pass()); | 1710 root->AddChild(test_layer.Pass()); |
1689 } | 1711 } |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1761 | 1783 |
1762 gfx::Transform identity_matrix; | 1784 gfx::Transform identity_matrix; |
1763 gfx::Point3F transform_origin; | 1785 gfx::Point3F transform_origin; |
1764 // Set the bounds of the root layer big enough to fit the child when scaled. | 1786 // Set the bounds of the root layer big enough to fit the child when scaled. |
1765 SetLayerPropertiesForTesting(root.get(), | 1787 SetLayerPropertiesForTesting(root.get(), |
1766 identity_matrix, | 1788 identity_matrix, |
1767 transform_origin, | 1789 transform_origin, |
1768 gfx::PointF(), | 1790 gfx::PointF(), |
1769 gfx::Size(100, 100), | 1791 gfx::Size(100, 100), |
1770 true, | 1792 true, |
1771 false); | 1793 false, |
| 1794 true); |
1772 { | 1795 { |
1773 Region touch_handler_region(gfx::Rect(10, 10, 30, 30)); | 1796 Region touch_handler_region(gfx::Rect(10, 10, 30, 30)); |
1774 gfx::PointF position(25.f, 25.f); | 1797 gfx::PointF position(25.f, 25.f); |
1775 gfx::Size bounds(50, 50); | 1798 gfx::Size bounds(50, 50); |
1776 scoped_ptr<LayerImpl> test_layer = | 1799 scoped_ptr<LayerImpl> test_layer = |
1777 LayerImpl::Create(host_impl().active_tree(), 12345); | 1800 LayerImpl::Create(host_impl().active_tree(), 12345); |
1778 SetLayerPropertiesForTesting(test_layer.get(), | 1801 SetLayerPropertiesForTesting(test_layer.get(), |
1779 identity_matrix, | 1802 identity_matrix, |
1780 transform_origin, | 1803 transform_origin, |
1781 position, | 1804 position, |
1782 bounds, | 1805 bounds, |
1783 true, | 1806 true, |
| 1807 false, |
1784 false); | 1808 false); |
1785 | 1809 |
1786 test_layer->SetDrawsContent(true); | 1810 test_layer->SetDrawsContent(true); |
1787 test_layer->SetTouchEventHandlerRegion(touch_handler_region); | 1811 test_layer->SetTouchEventHandlerRegion(touch_handler_region); |
1788 root->AddChild(test_layer.Pass()); | 1812 root->AddChild(test_layer.Pass()); |
1789 } | 1813 } |
1790 | 1814 |
1791 float device_scale_factor = 3.f; | 1815 float device_scale_factor = 3.f; |
1792 float page_scale_factor = 5.f; | 1816 float page_scale_factor = 5.f; |
1793 gfx::Size scaled_bounds_for_root = gfx::ToCeiledSize( | 1817 gfx::Size scaled_bounds_for_root = gfx::ToCeiledSize( |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1885 gfx::Transform identity_matrix; | 1909 gfx::Transform identity_matrix; |
1886 gfx::Point3F transform_origin; | 1910 gfx::Point3F transform_origin; |
1887 | 1911 |
1888 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); | 1912 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); |
1889 SetLayerPropertiesForTesting(root.get(), | 1913 SetLayerPropertiesForTesting(root.get(), |
1890 identity_matrix, | 1914 identity_matrix, |
1891 transform_origin, | 1915 transform_origin, |
1892 gfx::PointF(), | 1916 gfx::PointF(), |
1893 gfx::Size(100, 100), | 1917 gfx::Size(100, 100), |
1894 true, | 1918 true, |
1895 false); | 1919 false, |
| 1920 true); |
1896 { | 1921 { |
1897 scoped_ptr<LayerImpl> clipping_layer = | 1922 scoped_ptr<LayerImpl> clipping_layer = |
1898 LayerImpl::Create(host_impl().active_tree(), 123); | 1923 LayerImpl::Create(host_impl().active_tree(), 123); |
1899 // this layer is positioned, and hit testing should correctly know where the | 1924 // this layer is positioned, and hit testing should correctly know where the |
1900 // layer is located. | 1925 // layer is located. |
1901 gfx::PointF position(25.f, 25.f); | 1926 gfx::PointF position(25.f, 25.f); |
1902 gfx::Size bounds(50, 50); | 1927 gfx::Size bounds(50, 50); |
1903 SetLayerPropertiesForTesting(clipping_layer.get(), | 1928 SetLayerPropertiesForTesting(clipping_layer.get(), |
1904 identity_matrix, | 1929 identity_matrix, |
1905 transform_origin, | 1930 transform_origin, |
1906 position, | 1931 position, |
1907 bounds, | 1932 bounds, |
1908 true, | 1933 true, |
| 1934 false, |
1909 false); | 1935 false); |
1910 clipping_layer->SetMasksToBounds(true); | 1936 clipping_layer->SetMasksToBounds(true); |
1911 | 1937 |
1912 scoped_ptr<LayerImpl> child = | 1938 scoped_ptr<LayerImpl> child = |
1913 LayerImpl::Create(host_impl().active_tree(), 456); | 1939 LayerImpl::Create(host_impl().active_tree(), 456); |
1914 Region touch_handler_region(gfx::Rect(10, 10, 50, 50)); | 1940 Region touch_handler_region(gfx::Rect(10, 10, 50, 50)); |
1915 position = gfx::PointF(-50.f, -50.f); | 1941 position = gfx::PointF(-50.f, -50.f); |
1916 bounds = gfx::Size(300, 300); | 1942 bounds = gfx::Size(300, 300); |
1917 SetLayerPropertiesForTesting(child.get(), | 1943 SetLayerPropertiesForTesting(child.get(), |
1918 identity_matrix, | 1944 identity_matrix, |
1919 transform_origin, | 1945 transform_origin, |
1920 position, | 1946 position, |
1921 bounds, | 1947 bounds, |
1922 true, | 1948 true, |
| 1949 false, |
1923 false); | 1950 false); |
1924 child->SetDrawsContent(true); | 1951 child->SetDrawsContent(true); |
1925 child->SetTouchEventHandlerRegion(touch_handler_region); | 1952 child->SetTouchEventHandlerRegion(touch_handler_region); |
1926 clipping_layer->AddChild(child.Pass()); | 1953 clipping_layer->AddChild(child.Pass()); |
1927 root->AddChild(clipping_layer.Pass()); | 1954 root->AddChild(clipping_layer.Pass()); |
1928 } | 1955 } |
1929 | 1956 |
1930 host_impl().SetViewportSize(root->bounds()); | 1957 host_impl().SetViewportSize(root->bounds()); |
1931 host_impl().active_tree()->SetRootLayer(root.Pass()); | 1958 host_impl().active_tree()->SetRootLayer(root.Pass()); |
1932 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 1959 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1980 gfx::Transform identity_matrix; | 2007 gfx::Transform identity_matrix; |
1981 gfx::Point3F transform_origin; | 2008 gfx::Point3F transform_origin; |
1982 | 2009 |
1983 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); | 2010 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); |
1984 SetLayerPropertiesForTesting(root.get(), | 2011 SetLayerPropertiesForTesting(root.get(), |
1985 identity_matrix, | 2012 identity_matrix, |
1986 transform_origin, | 2013 transform_origin, |
1987 gfx::PointF(), | 2014 gfx::PointF(), |
1988 gfx::Size(100, 100), | 2015 gfx::Size(100, 100), |
1989 true, | 2016 true, |
1990 false); | 2017 false, |
| 2018 true); |
1991 { | 2019 { |
1992 scoped_ptr<LayerImpl> touch_layer = | 2020 scoped_ptr<LayerImpl> touch_layer = |
1993 LayerImpl::Create(host_impl().active_tree(), 123); | 2021 LayerImpl::Create(host_impl().active_tree(), 123); |
1994 // this layer is positioned, and hit testing should correctly know where the | 2022 // this layer is positioned, and hit testing should correctly know where the |
1995 // layer is located. | 2023 // layer is located. |
1996 gfx::PointF position; | 2024 gfx::PointF position; |
1997 gfx::Size bounds(50, 50); | 2025 gfx::Size bounds(50, 50); |
1998 SetLayerPropertiesForTesting(touch_layer.get(), | 2026 SetLayerPropertiesForTesting(touch_layer.get(), |
1999 identity_matrix, | 2027 identity_matrix, |
2000 transform_origin, | 2028 transform_origin, |
2001 position, | 2029 position, |
2002 bounds, | 2030 bounds, |
2003 true, | 2031 true, |
| 2032 false, |
2004 false); | 2033 false); |
2005 touch_layer->SetDrawsContent(true); | 2034 touch_layer->SetDrawsContent(true); |
2006 touch_layer->SetTouchEventHandlerRegion(gfx::Rect(0, 0, 50, 50)); | 2035 touch_layer->SetTouchEventHandlerRegion(gfx::Rect(0, 0, 50, 50)); |
2007 root->AddChild(touch_layer.Pass()); | 2036 root->AddChild(touch_layer.Pass()); |
2008 } | 2037 } |
2009 | 2038 |
2010 { | 2039 { |
2011 scoped_ptr<LayerImpl> notouch_layer = | 2040 scoped_ptr<LayerImpl> notouch_layer = |
2012 LayerImpl::Create(host_impl().active_tree(), 1234); | 2041 LayerImpl::Create(host_impl().active_tree(), 1234); |
2013 // this layer is positioned, and hit testing should correctly know where the | 2042 // this layer is positioned, and hit testing should correctly know where the |
2014 // layer is located. | 2043 // layer is located. |
2015 gfx::PointF position(0, 25); | 2044 gfx::PointF position(0, 25); |
2016 gfx::Size bounds(50, 50); | 2045 gfx::Size bounds(50, 50); |
2017 SetLayerPropertiesForTesting(notouch_layer.get(), | 2046 SetLayerPropertiesForTesting(notouch_layer.get(), |
2018 identity_matrix, | 2047 identity_matrix, |
2019 transform_origin, | 2048 transform_origin, |
2020 position, | 2049 position, |
2021 bounds, | 2050 bounds, |
2022 true, | 2051 true, |
| 2052 false, |
2023 false); | 2053 false); |
2024 notouch_layer->SetDrawsContent(true); | 2054 notouch_layer->SetDrawsContent(true); |
2025 root->AddChild(notouch_layer.Pass()); | 2055 root->AddChild(notouch_layer.Pass()); |
2026 } | 2056 } |
2027 | 2057 |
2028 host_impl().SetViewportSize(root->bounds()); | 2058 host_impl().SetViewportSize(root->bounds()); |
2029 host_impl().active_tree()->SetRootLayer(root.Pass()); | 2059 host_impl().active_tree()->SetRootLayer(root.Pass()); |
2030 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 2060 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
2031 | 2061 |
2032 // Sanity check the scenario we just created. | 2062 // Sanity check the scenario we just created. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2077 gfx::Transform identity_matrix; | 2107 gfx::Transform identity_matrix; |
2078 gfx::Point3F transform_origin; | 2108 gfx::Point3F transform_origin; |
2079 gfx::PointF position; | 2109 gfx::PointF position; |
2080 gfx::Size bounds(100, 100); | 2110 gfx::Size bounds(100, 100); |
2081 SetLayerPropertiesForTesting(root.get(), | 2111 SetLayerPropertiesForTesting(root.get(), |
2082 identity_matrix, | 2112 identity_matrix, |
2083 transform_origin, | 2113 transform_origin, |
2084 position, | 2114 position, |
2085 bounds, | 2115 bounds, |
2086 true, | 2116 true, |
2087 false); | 2117 false, |
| 2118 true); |
2088 root->SetDrawsContent(true); | 2119 root->SetDrawsContent(true); |
2089 | 2120 |
2090 host_impl().SetViewportSize(root->bounds()); | 2121 host_impl().SetViewportSize(root->bounds()); |
2091 host_impl().active_tree()->SetRootLayer(root.Pass()); | 2122 host_impl().active_tree()->SetRootLayer(root.Pass()); |
2092 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 2123 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
2093 | 2124 |
2094 // Sanity check the scenario we just created. | 2125 // Sanity check the scenario we just created. |
2095 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 2126 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
2096 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); | 2127 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); |
2097 | 2128 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2153 gfx::Transform identity_matrix; | 2184 gfx::Transform identity_matrix; |
2154 gfx::Point3F transform_origin; | 2185 gfx::Point3F transform_origin; |
2155 gfx::PointF position; | 2186 gfx::PointF position; |
2156 gfx::Size bounds(100, 100); | 2187 gfx::Size bounds(100, 100); |
2157 SetLayerPropertiesForTesting(root.get(), | 2188 SetLayerPropertiesForTesting(root.get(), |
2158 identity_matrix, | 2189 identity_matrix, |
2159 transform_origin, | 2190 transform_origin, |
2160 position, | 2191 position, |
2161 bounds, | 2192 bounds, |
2162 true, | 2193 true, |
2163 false); | 2194 false, |
| 2195 true); |
2164 | 2196 |
2165 gfx::Vector2dF clipping_offset(10, 10); | 2197 gfx::Vector2dF clipping_offset(10, 10); |
2166 { | 2198 { |
2167 scoped_ptr<LayerImpl> clipping_layer = | 2199 scoped_ptr<LayerImpl> clipping_layer = |
2168 LayerImpl::Create(host_impl().active_tree(), clip_layer_id); | 2200 LayerImpl::Create(host_impl().active_tree(), clip_layer_id); |
2169 // The clipping layer should occlude the right selection bound. | 2201 // The clipping layer should occlude the right selection bound. |
2170 gfx::PointF position = gfx::PointF() + clipping_offset; | 2202 gfx::PointF position = gfx::PointF() + clipping_offset; |
2171 gfx::Size bounds(50, 50); | 2203 gfx::Size bounds(50, 50); |
2172 SetLayerPropertiesForTesting(clipping_layer.get(), | 2204 SetLayerPropertiesForTesting(clipping_layer.get(), |
2173 identity_matrix, | 2205 identity_matrix, |
2174 transform_origin, | 2206 transform_origin, |
2175 position, | 2207 position, |
2176 bounds, | 2208 bounds, |
2177 true, | 2209 true, |
| 2210 false, |
2178 false); | 2211 false); |
2179 clipping_layer->SetMasksToBounds(true); | 2212 clipping_layer->SetMasksToBounds(true); |
2180 | 2213 |
2181 scoped_ptr<LayerImpl> clipped_layer = | 2214 scoped_ptr<LayerImpl> clipped_layer = |
2182 LayerImpl::Create(host_impl().active_tree(), clipped_layer_id); | 2215 LayerImpl::Create(host_impl().active_tree(), clipped_layer_id); |
2183 position = gfx::PointF(); | 2216 position = gfx::PointF(); |
2184 bounds = gfx::Size(100, 100); | 2217 bounds = gfx::Size(100, 100); |
2185 SetLayerPropertiesForTesting(clipped_layer.get(), | 2218 SetLayerPropertiesForTesting(clipped_layer.get(), |
2186 identity_matrix, | 2219 identity_matrix, |
2187 transform_origin, | 2220 transform_origin, |
2188 position, | 2221 position, |
2189 bounds, | 2222 bounds, |
2190 true, | 2223 true, |
| 2224 false, |
2191 false); | 2225 false); |
2192 clipped_layer->SetDrawsContent(true); | 2226 clipped_layer->SetDrawsContent(true); |
2193 clipping_layer->AddChild(clipped_layer.Pass()); | 2227 clipping_layer->AddChild(clipped_layer.Pass()); |
2194 root->AddChild(clipping_layer.Pass()); | 2228 root->AddChild(clipping_layer.Pass()); |
2195 } | 2229 } |
2196 | 2230 |
2197 host_impl().SetViewportSize(root->bounds()); | 2231 host_impl().SetViewportSize(root->bounds()); |
2198 host_impl().active_tree()->SetRootLayer(root.Pass()); | 2232 host_impl().active_tree()->SetRootLayer(root.Pass()); |
2199 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 2233 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
2200 | 2234 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2265 gfx::Transform identity_matrix; | 2299 gfx::Transform identity_matrix; |
2266 gfx::Point3F transform_origin; | 2300 gfx::Point3F transform_origin; |
2267 gfx::PointF position; | 2301 gfx::PointF position; |
2268 gfx::Size bounds(100, 100); | 2302 gfx::Size bounds(100, 100); |
2269 SetLayerPropertiesForTesting(root.get(), | 2303 SetLayerPropertiesForTesting(root.get(), |
2270 identity_matrix, | 2304 identity_matrix, |
2271 transform_origin, | 2305 transform_origin, |
2272 position, | 2306 position, |
2273 bounds, | 2307 bounds, |
2274 true, | 2308 true, |
2275 false); | 2309 false, |
| 2310 true); |
2276 | 2311 |
2277 gfx::Vector2dF sub_layer_offset(10, 0); | 2312 gfx::Vector2dF sub_layer_offset(10, 0); |
2278 { | 2313 { |
2279 scoped_ptr<LayerImpl> sub_layer = | 2314 scoped_ptr<LayerImpl> sub_layer = |
2280 LayerImpl::Create(host_impl().active_tree(), sub_layer_id); | 2315 LayerImpl::Create(host_impl().active_tree(), sub_layer_id); |
2281 gfx::PointF position = gfx::PointF() + sub_layer_offset; | 2316 gfx::PointF position = gfx::PointF() + sub_layer_offset; |
2282 gfx::Size bounds(50, 50); | 2317 gfx::Size bounds(50, 50); |
2283 SetLayerPropertiesForTesting(sub_layer.get(), | 2318 SetLayerPropertiesForTesting(sub_layer.get(), |
2284 identity_matrix, | 2319 identity_matrix, |
2285 transform_origin, | 2320 transform_origin, |
2286 position, | 2321 position, |
2287 bounds, | 2322 bounds, |
2288 true, | 2323 true, |
| 2324 false, |
2289 false); | 2325 false); |
2290 sub_layer->SetDrawsContent(true); | 2326 sub_layer->SetDrawsContent(true); |
2291 root->AddChild(sub_layer.Pass()); | 2327 root->AddChild(sub_layer.Pass()); |
2292 } | 2328 } |
2293 | 2329 |
2294 float device_scale_factor = 3.f; | 2330 float device_scale_factor = 3.f; |
2295 float page_scale_factor = 5.f; | 2331 float page_scale_factor = 5.f; |
2296 gfx::Size scaled_bounds_for_root = gfx::ToCeiledSize( | 2332 gfx::Size scaled_bounds_for_root = gfx::ToCeiledSize( |
2297 gfx::ScaleSize(root->bounds(), device_scale_factor * page_scale_factor)); | 2333 gfx::ScaleSize(root->bounds(), device_scale_factor * page_scale_factor)); |
2298 host_impl().SetViewportSize(scaled_bounds_for_root); | 2334 host_impl().SetViewportSize(scaled_bounds_for_root); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2356 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers()); | 2392 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers()); |
2357 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); | 2393 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); |
2358 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2)); | 2394 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2)); |
2359 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3)); | 2395 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3)); |
2360 root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4)); | 2396 root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4)); |
2361 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers()); | 2397 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers()); |
2362 } | 2398 } |
2363 | 2399 |
2364 } // namespace | 2400 } // namespace |
2365 } // namespace cc | 2401 } // namespace cc |
OLD | NEW |