| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/trees/layer_tree_host_common.h" | 5 #include "cc/trees/layer_tree_host_common.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "cc/animation/layer_animation_controller.h" | 9 #include "cc/animation/layer_animation_controller.h" |
| 10 #include "cc/animation/transform_operations.h" | 10 #include "cc/animation/transform_operations.h" |
| (...skipping 2860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2871 true, | 2871 true, |
| 2872 false); | 2872 false); |
| 2873 SetLayerPropertiesForTesting(child.get(), | 2873 SetLayerPropertiesForTesting(child.get(), |
| 2874 identity_matrix, | 2874 identity_matrix, |
| 2875 gfx::Point3F(), | 2875 gfx::Point3F(), |
| 2876 gfx::PointF(5.f, 5.f), | 2876 gfx::PointF(5.f, 5.f), |
| 2877 gfx::Size(50, 50), | 2877 gfx::Size(50, 50), |
| 2878 true, | 2878 true, |
| 2879 false); | 2879 false); |
| 2880 | 2880 |
| 2881 int initial_sequence_number = child->draw_properties().sequence_number; | 2881 child->draw_properties().sorted_for_recursion = true; |
| 2882 | 2882 |
| 2883 TransformOperations start_transform_operations; | 2883 TransformOperations start_transform_operations; |
| 2884 start_transform_operations.AppendScale(1.f, 0.f, 0.f); | 2884 start_transform_operations.AppendScale(1.f, 0.f, 0.f); |
| 2885 | 2885 |
| 2886 TransformOperations end_transform_operations; | 2886 TransformOperations end_transform_operations; |
| 2887 end_transform_operations.AppendScale(1.f, 1.f, 0.f); | 2887 end_transform_operations.AppendScale(1.f, 1.f, 0.f); |
| 2888 | 2888 |
| 2889 AddAnimatedTransformToLayer( | 2889 AddAnimatedTransformToLayer( |
| 2890 root.get(), 10.0, start_transform_operations, end_transform_operations); | 2890 root.get(), 10.0, start_transform_operations, end_transform_operations); |
| 2891 | 2891 |
| 2892 EXPECT_TRUE(root->TransformIsAnimating()); | 2892 EXPECT_TRUE(root->TransformIsAnimating()); |
| 2893 | 2893 |
| 2894 ExecuteCalculateDrawProperties(root.get()); | 2894 ExecuteCalculateDrawProperties(root.get()); |
| 2895 | 2895 |
| 2896 EXPECT_NE(initial_sequence_number, child->draw_properties().sequence_number); | 2896 EXPECT_FALSE(child->draw_properties().sorted_for_recursion); |
| 2897 } | 2897 } |
| 2898 | 2898 |
| 2899 TEST_F(LayerTreeHostCommonTest, | 2899 TEST_F(LayerTreeHostCommonTest, |
| 2900 SingularNonAnimatingTransformDoesNotPreventClearingDrawProperties) { | 2900 SingularNonAnimatingTransformDoesNotPreventClearingDrawProperties) { |
| 2901 scoped_refptr<Layer> root = Layer::Create(); | 2901 scoped_refptr<Layer> root = Layer::Create(); |
| 2902 | 2902 |
| 2903 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); | 2903 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); |
| 2904 host->SetRootLayer(root); | 2904 host->SetRootLayer(root); |
| 2905 | 2905 |
| 2906 gfx::Transform identity_matrix; | 2906 gfx::Transform identity_matrix; |
| 2907 gfx::Transform uninvertible_matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); | 2907 gfx::Transform uninvertible_matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); |
| 2908 ASSERT_FALSE(uninvertible_matrix.IsInvertible()); | 2908 ASSERT_FALSE(uninvertible_matrix.IsInvertible()); |
| 2909 | 2909 |
| 2910 SetLayerPropertiesForTesting(root.get(), | 2910 SetLayerPropertiesForTesting(root.get(), |
| 2911 uninvertible_matrix, | 2911 uninvertible_matrix, |
| 2912 gfx::Point3F(), | 2912 gfx::Point3F(), |
| 2913 gfx::PointF(), | 2913 gfx::PointF(), |
| 2914 gfx::Size(100, 100), | 2914 gfx::Size(100, 100), |
| 2915 true, | 2915 true, |
| 2916 false); | 2916 false); |
| 2917 | 2917 |
| 2918 int initial_sequence_number = root->draw_properties().sequence_number; | 2918 root->draw_properties().sorted_for_recursion = true; |
| 2919 | 2919 |
| 2920 EXPECT_FALSE(root->TransformIsAnimating()); | 2920 EXPECT_FALSE(root->TransformIsAnimating()); |
| 2921 | 2921 |
| 2922 ExecuteCalculateDrawProperties(root.get()); | 2922 ExecuteCalculateDrawProperties(root.get()); |
| 2923 | 2923 |
| 2924 EXPECT_NE(initial_sequence_number, root->draw_properties().sequence_number); | 2924 EXPECT_FALSE(root->draw_properties().sorted_for_recursion); |
| 2925 } | 2925 } |
| 2926 | 2926 |
| 2927 TEST_F(LayerTreeHostCommonTest, | 2927 TEST_F(LayerTreeHostCommonTest, |
| 2928 DrawableAndVisibleContentRectsForLayersInClippedRenderSurface) { | 2928 DrawableAndVisibleContentRectsForLayersInClippedRenderSurface) { |
| 2929 scoped_refptr<Layer> root = Layer::Create(); | 2929 scoped_refptr<Layer> root = Layer::Create(); |
| 2930 scoped_refptr<Layer> render_surface1 = Layer::Create(); | 2930 scoped_refptr<Layer> render_surface1 = Layer::Create(); |
| 2931 scoped_refptr<LayerWithForcedDrawsContent> child1 = | 2931 scoped_refptr<LayerWithForcedDrawsContent> child1 = |
| 2932 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2932 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 2933 scoped_refptr<LayerWithForcedDrawsContent> child2 = | 2933 scoped_refptr<LayerWithForcedDrawsContent> child2 = |
| 2934 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2934 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| (...skipping 4583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7518 // right clip, our render_surface_layer_list's order should be unaffected. | 7518 // right clip, our render_surface_layer_list's order should be unaffected. |
| 7519 EXPECT_EQ(3u, render_surface_layer_list.size()); | 7519 EXPECT_EQ(3u, render_surface_layer_list.size()); |
| 7520 EXPECT_EQ(root.get(), render_surface_layer_list.at(0)); | 7520 EXPECT_EQ(root.get(), render_surface_layer_list.at(0)); |
| 7521 EXPECT_EQ(render_surface2.get(), render_surface_layer_list.at(1)); | 7521 EXPECT_EQ(render_surface2.get(), render_surface_layer_list.at(1)); |
| 7522 EXPECT_EQ(render_surface1.get(), render_surface_layer_list.at(2)); | 7522 EXPECT_EQ(render_surface1.get(), render_surface_layer_list.at(2)); |
| 7523 EXPECT_TRUE(render_surface_layer_list.at(0)->render_surface()); | 7523 EXPECT_TRUE(render_surface_layer_list.at(0)->render_surface()); |
| 7524 EXPECT_TRUE(render_surface_layer_list.at(1)->render_surface()); | 7524 EXPECT_TRUE(render_surface_layer_list.at(1)->render_surface()); |
| 7525 EXPECT_TRUE(render_surface_layer_list.at(2)->render_surface()); | 7525 EXPECT_TRUE(render_surface_layer_list.at(2)->render_surface()); |
| 7526 } | 7526 } |
| 7527 | 7527 |
| 7528 TEST_F(LayerTreeHostCommonTest, ScrollChildIsGrandchildOfLCA) { | |
| 7529 // A previously unhandled case for layer sorting was when the scroll child was | |
| 7530 // a grand child of the lowest common ancestor of the scroll child and parent. | |
| 7531 // For example, | |
| 7532 // | |
| 7533 // + root | |
| 7534 // + top_content | |
| 7535 // + scroll_child | |
| 7536 // + bottom_content | |
| 7537 // + scroll_parent_border | |
| 7538 // + scroll_parent_clip | |
| 7539 // + scroll_parent | |
| 7540 // | |
| 7541 FakeImplProxy proxy; | |
| 7542 TestSharedBitmapManager shared_bitmap_manager; | |
| 7543 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); | |
| 7544 host_impl.CreatePendingTree(); | |
| 7545 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); | |
| 7546 scoped_ptr<LayerImpl> scroll_parent_border = | |
| 7547 LayerImpl::Create(host_impl.active_tree(), 2); | |
| 7548 scoped_ptr<LayerImpl> scroll_parent_clip = | |
| 7549 LayerImpl::Create(host_impl.active_tree(), 3); | |
| 7550 scoped_ptr<LayerImpl> scroll_parent = | |
| 7551 LayerImpl::Create(host_impl.active_tree(), 4); | |
| 7552 scoped_ptr<LayerImpl> scroll_child = | |
| 7553 LayerImpl::Create(host_impl.active_tree(), 5); | |
| 7554 scoped_ptr<LayerImpl> bottom_content = | |
| 7555 LayerImpl::Create(host_impl.active_tree(), 6); | |
| 7556 scoped_ptr<LayerImpl> top_content = | |
| 7557 LayerImpl::Create(host_impl.active_tree(), 7); | |
| 7558 | |
| 7559 scroll_parent_clip->SetMasksToBounds(true); | |
| 7560 | |
| 7561 scroll_child->SetScrollParent(scroll_parent.get()); | |
| 7562 scoped_ptr<std::set<LayerImpl*> > scroll_children(new std::set<LayerImpl*>); | |
| 7563 scroll_children->insert(scroll_child.get()); | |
| 7564 scroll_parent->SetScrollChildren(scroll_children.release()); | |
| 7565 | |
| 7566 scroll_child->SetDrawsContent(true); | |
| 7567 scroll_parent->SetDrawsContent(true); | |
| 7568 top_content->SetDrawsContent(true); | |
| 7569 bottom_content->SetDrawsContent(true); | |
| 7570 | |
| 7571 gfx::Transform identity_transform; | |
| 7572 gfx::Transform top_transform; | |
| 7573 top_transform.Translate3d(0.0, 0.0, 5.0); | |
| 7574 gfx::Transform bottom_transform; | |
| 7575 bottom_transform.Translate3d(0.0, 0.0, 3.0); | |
| 7576 | |
| 7577 SetLayerPropertiesForTesting(root.get(), | |
| 7578 identity_transform, | |
| 7579 gfx::Point3F(), | |
| 7580 gfx::PointF(), | |
| 7581 gfx::Size(50, 50), | |
| 7582 true, | |
| 7583 false); | |
| 7584 SetLayerPropertiesForTesting(scroll_parent_border.get(), | |
| 7585 identity_transform, | |
| 7586 gfx::Point3F(), | |
| 7587 gfx::PointF(), | |
| 7588 gfx::Size(40, 40), | |
| 7589 true, | |
| 7590 false); | |
| 7591 SetLayerPropertiesForTesting(scroll_parent_clip.get(), | |
| 7592 identity_transform, | |
| 7593 gfx::Point3F(), | |
| 7594 gfx::PointF(), | |
| 7595 gfx::Size(30, 30), | |
| 7596 true, | |
| 7597 false); | |
| 7598 SetLayerPropertiesForTesting(scroll_parent.get(), | |
| 7599 identity_transform, | |
| 7600 gfx::Point3F(), | |
| 7601 gfx::PointF(), | |
| 7602 gfx::Size(50, 50), | |
| 7603 true, | |
| 7604 false); | |
| 7605 SetLayerPropertiesForTesting(scroll_child.get(), | |
| 7606 identity_transform, | |
| 7607 gfx::Point3F(), | |
| 7608 gfx::PointF(), | |
| 7609 gfx::Size(50, 50), | |
| 7610 true, | |
| 7611 false); | |
| 7612 SetLayerPropertiesForTesting(top_content.get(), | |
| 7613 top_transform, | |
| 7614 gfx::Point3F(), | |
| 7615 gfx::PointF(), | |
| 7616 gfx::Size(50, 50), | |
| 7617 false, | |
| 7618 true); | |
| 7619 SetLayerPropertiesForTesting(bottom_content.get(), | |
| 7620 bottom_transform, | |
| 7621 gfx::Point3F(), | |
| 7622 gfx::PointF(), | |
| 7623 gfx::Size(50, 50), | |
| 7624 false, | |
| 7625 true); | |
| 7626 | |
| 7627 scroll_child->SetShouldFlattenTransform(false); | |
| 7628 scroll_child->Set3dSortingContextId(1); | |
| 7629 | |
| 7630 scroll_child->AddChild(bottom_content.Pass()); | |
| 7631 | |
| 7632 top_content->AddChild(scroll_child.Pass()); | |
| 7633 root->AddChild(top_content.Pass()); | |
| 7634 | |
| 7635 scroll_parent_clip->AddChild(scroll_parent.Pass()); | |
| 7636 scroll_parent_border->AddChild(scroll_parent_clip.Pass()); | |
| 7637 root->AddChild(scroll_parent_border.Pass()); | |
| 7638 | |
| 7639 LayerImplList render_surface_layer_list; | |
| 7640 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | |
| 7641 root.get(), root->bounds(), &render_surface_layer_list); | |
| 7642 | |
| 7643 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | |
| 7644 | |
| 7645 EXPECT_TRUE(root->render_surface()); | |
| 7646 | |
| 7647 EXPECT_EQ(4u, root->render_surface()->layer_list().size()); | |
| 7648 EXPECT_EQ(7, root->render_surface()->layer_list().at(0)->id()); | |
| 7649 EXPECT_EQ(5, root->render_surface()->layer_list().at(1)->id()); | |
| 7650 EXPECT_EQ(6, root->render_surface()->layer_list().at(2)->id()); | |
| 7651 EXPECT_EQ(4, root->render_surface()->layer_list().at(3)->id()); | |
| 7652 | |
| 7653 // Explicitly check that the sort weights of the two descendancs of the lowest | |
| 7654 // common ancestor of the scroll parent and child are ordered correctly. | |
| 7655 EXPECT_EQ(7, root->child_at(0)->id()); | |
| 7656 EXPECT_EQ(2, root->child_at(1)->id()); | |
| 7657 EXPECT_LT(root->child_at(1)->draw_properties().sort_weight, | |
| 7658 root->child_at(0)->draw_properties().sort_weight); | |
| 7659 } | |
| 7660 | |
| 7661 TEST_F(LayerTreeHostCommonTest, ScrollWeightSetMultipleTimes) { | |
| 7662 // This is a case where we have to reset a previously set weight. | |
| 7663 // scroll_parent_1_border will get a negative weight because the child is | |
| 7664 // visited first. When we reach scroll child 2, we'll have to go back and | |
| 7665 // "fix" the weight for scroll_parent_2_border so that it sorts before | |
| 7666 // scroll_parent_1_border. | |
| 7667 // | |
| 7668 // + root | |
| 7669 // + scroll_parent_2_border | |
| 7670 // | + scroll_parent_2_clip | |
| 7671 // | + scroll_parent_2 | |
| 7672 // | | |
| 7673 // + top_content | |
| 7674 // | + scroll_child_1 | |
| 7675 // | + bottom_content | |
| 7676 // | | |
| 7677 // + scroll_parent_1_border | |
| 7678 // + scroll_parent_1_clip | |
| 7679 // + scroll_child_2 | |
| 7680 // + scroll_parent_1 | |
| 7681 // | |
| 7682 FakeImplProxy proxy; | |
| 7683 TestSharedBitmapManager shared_bitmap_manager; | |
| 7684 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); | |
| 7685 host_impl.CreatePendingTree(); | |
| 7686 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); | |
| 7687 | |
| 7688 scoped_ptr<LayerImpl> scroll_parent_1_border = | |
| 7689 LayerImpl::Create(host_impl.active_tree(), 2); | |
| 7690 scoped_ptr<LayerImpl> scroll_parent_1_clip = | |
| 7691 LayerImpl::Create(host_impl.active_tree(), 3); | |
| 7692 scoped_ptr<LayerImpl> scroll_parent_1 = | |
| 7693 LayerImpl::Create(host_impl.active_tree(), 4); | |
| 7694 | |
| 7695 scoped_ptr<LayerImpl> scroll_child_1 = | |
| 7696 LayerImpl::Create(host_impl.active_tree(), 5); | |
| 7697 | |
| 7698 scoped_ptr<LayerImpl> scroll_parent_2_border = | |
| 7699 LayerImpl::Create(host_impl.active_tree(), 6); | |
| 7700 scoped_ptr<LayerImpl> scroll_parent_2_clip = | |
| 7701 LayerImpl::Create(host_impl.active_tree(), 7); | |
| 7702 scoped_ptr<LayerImpl> scroll_parent_2 = | |
| 7703 LayerImpl::Create(host_impl.active_tree(), 8); | |
| 7704 | |
| 7705 scoped_ptr<LayerImpl> scroll_child_2 = | |
| 7706 LayerImpl::Create(host_impl.active_tree(), 9); | |
| 7707 | |
| 7708 scoped_ptr<LayerImpl> bottom_content = | |
| 7709 LayerImpl::Create(host_impl.active_tree(), 10); | |
| 7710 scoped_ptr<LayerImpl> top_content = | |
| 7711 LayerImpl::Create(host_impl.active_tree(), 11); | |
| 7712 | |
| 7713 scroll_parent_1_clip->SetMasksToBounds(true); | |
| 7714 scroll_parent_2_clip->SetMasksToBounds(true); | |
| 7715 | |
| 7716 scroll_child_1->SetScrollParent(scroll_parent_1.get()); | |
| 7717 scroll_child_2->SetScrollParent(scroll_parent_2.get()); | |
| 7718 | |
| 7719 scoped_ptr<std::set<LayerImpl*> > scroll_children_1(new std::set<LayerImpl*>); | |
| 7720 scroll_children_1->insert(scroll_child_1.get()); | |
| 7721 scroll_parent_1->SetScrollChildren(scroll_children_1.release()); | |
| 7722 | |
| 7723 scoped_ptr<std::set<LayerImpl*> > scroll_children_2(new std::set<LayerImpl*>); | |
| 7724 scroll_children_2->insert(scroll_child_2.get()); | |
| 7725 scroll_parent_2->SetScrollChildren(scroll_children_2.release()); | |
| 7726 | |
| 7727 scroll_child_1->SetDrawsContent(true); | |
| 7728 scroll_child_2->SetDrawsContent(true); | |
| 7729 scroll_parent_1->SetDrawsContent(true); | |
| 7730 scroll_parent_2->SetDrawsContent(true); | |
| 7731 | |
| 7732 top_content->SetDrawsContent(true); | |
| 7733 bottom_content->SetDrawsContent(true); | |
| 7734 | |
| 7735 gfx::Transform identity_transform; | |
| 7736 gfx::Transform top_transform; | |
| 7737 top_transform.Translate3d(0.0, 0.0, 5.0); | |
| 7738 gfx::Transform bottom_transform; | |
| 7739 bottom_transform.Translate3d(0.0, 0.0, 3.0); | |
| 7740 | |
| 7741 SetLayerPropertiesForTesting(root.get(), | |
| 7742 identity_transform, | |
| 7743 gfx::Point3F(), | |
| 7744 gfx::PointF(), | |
| 7745 gfx::Size(50, 50), | |
| 7746 true, | |
| 7747 false); | |
| 7748 SetLayerPropertiesForTesting(scroll_parent_1_border.get(), | |
| 7749 identity_transform, | |
| 7750 gfx::Point3F(), | |
| 7751 gfx::PointF(), | |
| 7752 gfx::Size(40, 40), | |
| 7753 true, | |
| 7754 false); | |
| 7755 SetLayerPropertiesForTesting(scroll_parent_1_clip.get(), | |
| 7756 identity_transform, | |
| 7757 gfx::Point3F(), | |
| 7758 gfx::PointF(), | |
| 7759 gfx::Size(30, 30), | |
| 7760 true, | |
| 7761 false); | |
| 7762 SetLayerPropertiesForTesting(scroll_parent_1.get(), | |
| 7763 identity_transform, | |
| 7764 gfx::Point3F(), | |
| 7765 gfx::PointF(), | |
| 7766 gfx::Size(50, 50), | |
| 7767 true, | |
| 7768 false); | |
| 7769 SetLayerPropertiesForTesting(scroll_parent_2_border.get(), | |
| 7770 identity_transform, | |
| 7771 gfx::Point3F(), | |
| 7772 gfx::PointF(), | |
| 7773 gfx::Size(40, 40), | |
| 7774 true, | |
| 7775 false); | |
| 7776 SetLayerPropertiesForTesting(scroll_parent_2_clip.get(), | |
| 7777 identity_transform, | |
| 7778 gfx::Point3F(), | |
| 7779 gfx::PointF(), | |
| 7780 gfx::Size(30, 30), | |
| 7781 true, | |
| 7782 false); | |
| 7783 SetLayerPropertiesForTesting(scroll_parent_2.get(), | |
| 7784 identity_transform, | |
| 7785 gfx::Point3F(), | |
| 7786 gfx::PointF(), | |
| 7787 gfx::Size(50, 50), | |
| 7788 true, | |
| 7789 false); | |
| 7790 SetLayerPropertiesForTesting(scroll_child_1.get(), | |
| 7791 identity_transform, | |
| 7792 gfx::Point3F(), | |
| 7793 gfx::PointF(), | |
| 7794 gfx::Size(50, 50), | |
| 7795 true, | |
| 7796 false); | |
| 7797 SetLayerPropertiesForTesting(scroll_child_2.get(), | |
| 7798 identity_transform, | |
| 7799 gfx::Point3F(), | |
| 7800 gfx::PointF(), | |
| 7801 gfx::Size(50, 50), | |
| 7802 true, | |
| 7803 false); | |
| 7804 SetLayerPropertiesForTesting(top_content.get(), | |
| 7805 top_transform, | |
| 7806 gfx::Point3F(), | |
| 7807 gfx::PointF(), | |
| 7808 gfx::Size(50, 50), | |
| 7809 false, | |
| 7810 true); | |
| 7811 SetLayerPropertiesForTesting(bottom_content.get(), | |
| 7812 bottom_transform, | |
| 7813 gfx::Point3F(), | |
| 7814 gfx::PointF(), | |
| 7815 gfx::Size(50, 50), | |
| 7816 false, | |
| 7817 true); | |
| 7818 | |
| 7819 scroll_child_1->SetShouldFlattenTransform(false); | |
| 7820 scroll_child_1->Set3dSortingContextId(1); | |
| 7821 | |
| 7822 scroll_child_2->SetShouldFlattenTransform(false); | |
| 7823 scroll_child_2->Set3dSortingContextId(1); | |
| 7824 | |
| 7825 scroll_parent_2_clip->AddChild(scroll_parent_2.Pass()); | |
| 7826 scroll_parent_2_border->AddChild(scroll_parent_2_clip.Pass()); | |
| 7827 root->AddChild(scroll_parent_2_border.Pass()); | |
| 7828 | |
| 7829 scroll_child_1->AddChild(bottom_content.Pass()); | |
| 7830 top_content->AddChild(scroll_child_1.Pass()); | |
| 7831 root->AddChild(top_content.Pass()); | |
| 7832 | |
| 7833 scroll_parent_1_clip->AddChild(scroll_child_2.Pass()); | |
| 7834 scroll_parent_1_clip->AddChild(scroll_parent_1.Pass()); | |
| 7835 scroll_parent_1_border->AddChild(scroll_parent_1_clip.Pass()); | |
| 7836 root->AddChild(scroll_parent_1_border.Pass()); | |
| 7837 | |
| 7838 LayerImplList render_surface_layer_list; | |
| 7839 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | |
| 7840 root.get(), root->bounds(), &render_surface_layer_list); | |
| 7841 | |
| 7842 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | |
| 7843 | |
| 7844 EXPECT_TRUE(root->render_surface()); | |
| 7845 | |
| 7846 EXPECT_GT(0, root->child_at(0)->draw_properties().sort_weight); | |
| 7847 EXPECT_GT(0, root->child_at(2)->draw_properties().sort_weight); | |
| 7848 EXPECT_LT(root->child_at(0)->draw_properties().sort_weight, | |
| 7849 root->child_at(2)->draw_properties().sort_weight); | |
| 7850 EXPECT_TRUE(root->draw_properties().children_need_sorting); | |
| 7851 } | |
| 7852 | |
| 7853 TEST_F(LayerTreeHostCommonTest, DoNotClobberSorting) { | 7528 TEST_F(LayerTreeHostCommonTest, DoNotClobberSorting) { |
| 7854 // We rearrange layer list contributions if we have to visit children out of | 7529 // We rearrange layer list contributions if we have to visit children out of |
| 7855 // order, but it should be a 'stable' rearrangement. That is, the layer list | 7530 // order, but it should be a 'stable' rearrangement. That is, the layer list |
| 7856 // additions for a single layer should not be reordered, though their position | 7531 // additions for a single layer should not be reordered, though their position |
| 7857 // wrt to the contributions due to a sibling may vary. | 7532 // wrt to the contributions due to a sibling may vary. |
| 7858 // | 7533 // |
| 7859 // + root | 7534 // + root |
| 7860 // + scroll_child | 7535 // + scroll_child |
| 7861 // + top_content | 7536 // + top_content |
| 7862 // + bottom_content | 7537 // + bottom_content |
| (...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8879 EXPECT_FLOAT_EQ(4.f, | 8554 EXPECT_FLOAT_EQ(4.f, |
| 8880 child1_layer->replica_layer() | 8555 child1_layer->replica_layer() |
| 8881 ->mask_layer() | 8556 ->mask_layer() |
| 8882 ->draw_properties() | 8557 ->draw_properties() |
| 8883 .device_scale_factor); | 8558 .device_scale_factor); |
| 8884 EXPECT_FLOAT_EQ(4.f, child2_layer->draw_properties().device_scale_factor); | 8559 EXPECT_FLOAT_EQ(4.f, child2_layer->draw_properties().device_scale_factor); |
| 8885 } | 8560 } |
| 8886 | 8561 |
| 8887 } // namespace | 8562 } // namespace |
| 8888 } // namespace cc | 8563 } // namespace cc |
| OLD | NEW |