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