| 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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 | 339 |
| 340 scoped_ptr<LayerImpl> root(LayerImpl::Create(host_impl.active_tree(), 3)); | 340 scoped_ptr<LayerImpl> root(LayerImpl::Create(host_impl.active_tree(), 3)); |
| 341 SetLayerPropertiesForTesting(root.get(), | 341 SetLayerPropertiesForTesting(root.get(), |
| 342 identity_matrix, | 342 identity_matrix, |
| 343 gfx::Point3F(), | 343 gfx::Point3F(), |
| 344 gfx::PointF(), | 344 gfx::PointF(), |
| 345 gfx::Size(3, 4), | 345 gfx::Size(3, 4), |
| 346 true, | 346 true, |
| 347 false); | 347 false); |
| 348 root->AddChild(clip_layer_scoped_ptr.Pass()); | 348 root->AddChild(clip_layer_scoped_ptr.Pass()); |
| 349 root->CreateRenderSurface(); |
| 349 | 350 |
| 350 ExecuteCalculateDrawProperties( | 351 ExecuteCalculateDrawProperties( |
| 351 root.get(), kDeviceScale, kPageScale, scroll_layer->parent()); | 352 root.get(), kDeviceScale, kPageScale, scroll_layer->parent()); |
| 352 gfx::Transform expected_transform = identity_matrix; | 353 gfx::Transform expected_transform = identity_matrix; |
| 353 gfx::PointF sub_layer_screen_position = kScrollLayerPosition - kScrollDelta; | 354 gfx::PointF sub_layer_screen_position = kScrollLayerPosition - kScrollDelta; |
| 354 sub_layer_screen_position.Scale(kPageScale * kDeviceScale); | 355 sub_layer_screen_position.Scale(kPageScale * kDeviceScale); |
| 355 expected_transform.Translate(MathUtil::Round(sub_layer_screen_position.x()), | 356 expected_transform.Translate(MathUtil::Round(sub_layer_screen_position.x()), |
| 356 MathUtil::Round(sub_layer_screen_position.y())); | 357 MathUtil::Round(sub_layer_screen_position.y())); |
| 357 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform, | 358 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform, |
| 358 sublayer->draw_transform()); | 359 sublayer->draw_transform()); |
| (...skipping 5289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5648 true, | 5649 true, |
| 5649 false); | 5650 false); |
| 5650 child->SetDrawsContent(true); | 5651 child->SetDrawsContent(true); |
| 5651 child->SetOpacity(0.0f); | 5652 child->SetOpacity(0.0f); |
| 5652 | 5653 |
| 5653 // Add opacity animation. | 5654 // Add opacity animation. |
| 5654 AddOpacityTransitionToController( | 5655 AddOpacityTransitionToController( |
| 5655 child->layer_animation_controller(), 10.0, 0.0f, 1.0f, false); | 5656 child->layer_animation_controller(), 10.0, 0.0f, 1.0f, false); |
| 5656 | 5657 |
| 5657 root->AddChild(child.Pass()); | 5658 root->AddChild(child.Pass()); |
| 5659 root->CreateRenderSurface(); |
| 5658 | 5660 |
| 5659 LayerImplList render_surface_layer_list; | 5661 LayerImplList render_surface_layer_list; |
| 5660 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 5662 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
| 5661 root.get(), root->bounds(), &render_surface_layer_list); | 5663 root.get(), root->bounds(), &render_surface_layer_list); |
| 5662 inputs.can_adjust_raster_scales = true; | 5664 inputs.can_adjust_raster_scales = true; |
| 5663 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 5665 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 5664 | 5666 |
| 5665 // We should have one render surface and two layers. The child | 5667 // We should have one render surface and two layers. The child |
| 5666 // layer should be included even though it is transparent. | 5668 // layer should be included even though it is transparent. |
| 5667 ASSERT_EQ(1u, render_surface_layer_list.size()); | 5669 ASSERT_EQ(1u, render_surface_layer_list.size()); |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5914 gfx::Point3F(), | 5916 gfx::Point3F(), |
| 5915 gfx::PointF(), | 5917 gfx::PointF(), |
| 5916 gfx::Size(30, 30), | 5918 gfx::Size(30, 30), |
| 5917 true, | 5919 true, |
| 5918 false); | 5920 false); |
| 5919 grand_child->SetDrawsContent(true); | 5921 grand_child->SetDrawsContent(true); |
| 5920 grand_child->SetHideLayerAndSubtree(true); | 5922 grand_child->SetHideLayerAndSubtree(true); |
| 5921 | 5923 |
| 5922 child->AddChild(grand_child.Pass()); | 5924 child->AddChild(grand_child.Pass()); |
| 5923 root->AddChild(child.Pass()); | 5925 root->AddChild(child.Pass()); |
| 5926 root->CreateRenderSurface(); |
| 5924 | 5927 |
| 5925 LayerImplList render_surface_layer_list; | 5928 LayerImplList render_surface_layer_list; |
| 5926 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 5929 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
| 5927 root.get(), root->bounds(), &render_surface_layer_list); | 5930 root.get(), root->bounds(), &render_surface_layer_list); |
| 5928 inputs.can_adjust_raster_scales = true; | 5931 inputs.can_adjust_raster_scales = true; |
| 5929 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 5932 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 5930 | 5933 |
| 5931 // We should have one render surface and two layers. The grand child has | 5934 // We should have one render surface and two layers. The grand child has |
| 5932 // hidden itself. | 5935 // hidden itself. |
| 5933 ASSERT_EQ(1u, render_surface_layer_list.size()); | 5936 ASSERT_EQ(1u, render_surface_layer_list.size()); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6027 identity_matrix, | 6030 identity_matrix, |
| 6028 gfx::Point3F(), | 6031 gfx::Point3F(), |
| 6029 gfx::PointF(), | 6032 gfx::PointF(), |
| 6030 gfx::Size(30, 30), | 6033 gfx::Size(30, 30), |
| 6031 true, | 6034 true, |
| 6032 false); | 6035 false); |
| 6033 grand_child->SetDrawsContent(true); | 6036 grand_child->SetDrawsContent(true); |
| 6034 | 6037 |
| 6035 child->AddChild(grand_child.Pass()); | 6038 child->AddChild(grand_child.Pass()); |
| 6036 root->AddChild(child.Pass()); | 6039 root->AddChild(child.Pass()); |
| 6040 root->CreateRenderSurface(); |
| 6037 | 6041 |
| 6038 LayerImplList render_surface_layer_list; | 6042 LayerImplList render_surface_layer_list; |
| 6039 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 6043 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
| 6040 root.get(), root->bounds(), &render_surface_layer_list); | 6044 root.get(), root->bounds(), &render_surface_layer_list); |
| 6041 inputs.can_adjust_raster_scales = true; | 6045 inputs.can_adjust_raster_scales = true; |
| 6042 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 6046 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 6043 | 6047 |
| 6044 // We should have one render surface and one layers. The child has | 6048 // We should have one render surface and one layers. The child has |
| 6045 // hidden itself and the grand child. | 6049 // hidden itself and the grand child. |
| 6046 ASSERT_EQ(1u, render_surface_layer_list.size()); | 6050 ASSERT_EQ(1u, render_surface_layer_list.size()); |
| (...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6879 render_surface2->render_surface()->content_rect().ToString()); | 6883 render_surface2->render_surface()->content_rect().ToString()); |
| 6880 | 6884 |
| 6881 // Sanity check our num_unclipped_descendants values. | 6885 // Sanity check our num_unclipped_descendants values. |
| 6882 EXPECT_EQ(1, render_surface1->num_unclipped_descendants()); | 6886 EXPECT_EQ(1, render_surface1->num_unclipped_descendants()); |
| 6883 EXPECT_EQ(0, render_surface2->num_unclipped_descendants()); | 6887 EXPECT_EQ(0, render_surface2->num_unclipped_descendants()); |
| 6884 } | 6888 } |
| 6885 | 6889 |
| 6886 TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) { | 6890 TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) { |
| 6887 FakeImplProxy proxy; | 6891 FakeImplProxy proxy; |
| 6888 TestSharedBitmapManager shared_bitmap_manager; | 6892 TestSharedBitmapManager shared_bitmap_manager; |
| 6889 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); | 6893 scoped_ptr<LayerTreeHost> host = |
| 6890 scoped_ptr<LayerImpl> root = | 6894 FakeLayerTreeHost::Create().PassAs<LayerTreeHost>(); |
| 6891 LayerImpl::Create(host_impl.active_tree(), 12345); | 6895 scoped_refptr<Layer> root = Layer::Create(); |
| 6892 scoped_ptr<LayerImpl> child1 = | 6896 root->SetLayerTreeHost(host.get()); |
| 6893 LayerImpl::Create(host_impl.active_tree(), 123456); | 6897 scoped_refptr<Layer> child1 = Layer::Create(); |
| 6894 scoped_ptr<LayerImpl> child2 = | 6898 scoped_refptr<Layer> child2 = Layer::Create(); |
| 6895 LayerImpl::Create(host_impl.active_tree(), 1234567); | 6899 scoped_refptr<Layer> child3 = Layer::Create(); |
| 6896 scoped_ptr<LayerImpl> child3 = | |
| 6897 LayerImpl::Create(host_impl.active_tree(), 12345678); | |
| 6898 | 6900 |
| 6899 gfx::Transform identity_matrix; | 6901 gfx::Transform identity_matrix; |
| 6900 gfx::Point3F transform_origin; | 6902 gfx::Point3F transform_origin; |
| 6901 gfx::PointF position; | 6903 gfx::PointF position; |
| 6902 gfx::Size bounds(100, 100); | 6904 gfx::Size bounds(100, 100); |
| 6903 SetLayerPropertiesForTesting(root.get(), | 6905 SetLayerPropertiesForTesting(root.get(), |
| 6904 identity_matrix, | 6906 identity_matrix, |
| 6905 transform_origin, | 6907 transform_origin, |
| 6906 position, | 6908 position, |
| 6907 bounds, | 6909 bounds, |
| 6908 true, | 6910 true, |
| 6909 false); | 6911 false); |
| 6910 root->SetDrawsContent(true); | 6912 root->SetIsDrawable(true); |
| 6911 | 6913 |
| 6912 // This layer structure normally forces render surface due to preserves3d | 6914 // This layer structure normally forces render surface due to preserves3d |
| 6913 // behavior. | 6915 // behavior. |
| 6914 SetLayerPropertiesForTesting(child1.get(), | 6916 SetLayerPropertiesForTesting(child1.get(), |
| 6915 identity_matrix, | 6917 identity_matrix, |
| 6916 transform_origin, | 6918 transform_origin, |
| 6917 position, | 6919 position, |
| 6918 bounds, | 6920 bounds, |
| 6919 false, | 6921 false, |
| 6920 true); | 6922 true); |
| 6921 child1->SetDrawsContent(true); | 6923 child1->SetIsDrawable(true); |
| 6922 SetLayerPropertiesForTesting(child2.get(), | 6924 SetLayerPropertiesForTesting(child2.get(), |
| 6923 identity_matrix, | 6925 identity_matrix, |
| 6924 transform_origin, | 6926 transform_origin, |
| 6925 position, | 6927 position, |
| 6926 bounds, | 6928 bounds, |
| 6927 true, | 6929 true, |
| 6928 false); | 6930 false); |
| 6929 child2->SetDrawsContent(true); | 6931 child2->SetIsDrawable(true); |
| 6930 SetLayerPropertiesForTesting(child3.get(), | 6932 SetLayerPropertiesForTesting(child3.get(), |
| 6931 identity_matrix, | 6933 identity_matrix, |
| 6932 transform_origin, | 6934 transform_origin, |
| 6933 position, | 6935 position, |
| 6934 bounds, | 6936 bounds, |
| 6935 true, | 6937 true, |
| 6936 false); | 6938 false); |
| 6937 child3->SetDrawsContent(true); | 6939 child3->SetIsDrawable(true); |
| 6938 | 6940 |
| 6939 child2->Set3dSortingContextId(1); | 6941 child2->Set3dSortingContextId(1); |
| 6940 child3->Set3dSortingContextId(1); | 6942 child3->Set3dSortingContextId(1); |
| 6941 | 6943 |
| 6942 child2->AddChild(child3.Pass()); | 6944 child2->AddChild(child3.get()); |
| 6943 child1->AddChild(child2.Pass()); | 6945 child1->AddChild(child2.get()); |
| 6944 root->AddChild(child1.Pass()); | 6946 root->AddChild(child1.get()); |
| 6945 | 6947 |
| 6946 { | 6948 { |
| 6947 LayerImplList render_surface_layer_list; | 6949 RenderSurfaceLayerList render_surface_layer_list; |
| 6948 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(root.get()); | 6950 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
| 6949 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | |
| 6950 root.get(), root->bounds(), &render_surface_layer_list); | 6951 root.get(), root->bounds(), &render_surface_layer_list); |
| 6951 inputs.can_render_to_separate_surface = true; | 6952 inputs.can_render_to_separate_surface = true; |
| 6952 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 6953 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 6953 | 6954 |
| 6954 EXPECT_EQ(2u, render_surface_layer_list.size()); | 6955 EXPECT_EQ(2u, render_surface_layer_list.size()); |
| 6955 } | 6956 } |
| 6956 | 6957 |
| 6957 { | 6958 { |
| 6958 LayerImplList render_surface_layer_list; | 6959 RenderSurfaceLayerList render_surface_layer_list; |
| 6959 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 6960 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
| 6960 root.get(), root->bounds(), &render_surface_layer_list); | 6961 root.get(), root->bounds(), &render_surface_layer_list); |
| 6961 inputs.can_render_to_separate_surface = false; | 6962 inputs.can_render_to_separate_surface = false; |
| 6962 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 6963 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 6963 | 6964 |
| 6964 EXPECT_EQ(1u, render_surface_layer_list.size()); | 6965 EXPECT_EQ(1u, render_surface_layer_list.size()); |
| 6965 } | 6966 } |
| 6967 root->SetLayerTreeHost(NULL); |
| 6966 } | 6968 } |
| 6967 | 6969 |
| 6968 TEST_F(LayerTreeHostCommonTest, DoNotIncludeBackfaceInvisibleSurfaces) { | 6970 TEST_F(LayerTreeHostCommonTest, DoNotIncludeBackfaceInvisibleSurfaces) { |
| 6969 scoped_refptr<Layer> root = Layer::Create(); | 6971 scoped_refptr<Layer> root = Layer::Create(); |
| 6970 scoped_refptr<Layer> render_surface = Layer::Create(); | 6972 scoped_refptr<Layer> render_surface = Layer::Create(); |
| 6971 scoped_refptr<LayerWithForcedDrawsContent> child = | 6973 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 6972 make_scoped_refptr(new LayerWithForcedDrawsContent); | 6974 make_scoped_refptr(new LayerWithForcedDrawsContent); |
| 6973 | 6975 |
| 6974 root->AddChild(render_surface); | 6976 root->AddChild(render_surface); |
| 6975 render_surface->AddChild(child); | 6977 render_surface->AddChild(child); |
| (...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7574 top_transform.Translate3d(0.0, 0.0, 5.0); | 7576 top_transform.Translate3d(0.0, 0.0, 5.0); |
| 7575 gfx::Transform bottom_transform; | 7577 gfx::Transform bottom_transform; |
| 7576 bottom_transform.Translate3d(0.0, 0.0, 3.0); | 7578 bottom_transform.Translate3d(0.0, 0.0, 3.0); |
| 7577 | 7579 |
| 7578 SetLayerPropertiesForTesting(root.get(), | 7580 SetLayerPropertiesForTesting(root.get(), |
| 7579 identity_transform, | 7581 identity_transform, |
| 7580 gfx::Point3F(), | 7582 gfx::Point3F(), |
| 7581 gfx::PointF(), | 7583 gfx::PointF(), |
| 7582 gfx::Size(50, 50), | 7584 gfx::Size(50, 50), |
| 7583 true, | 7585 true, |
| 7584 false); | 7586 false, |
| 7587 true); |
| 7585 SetLayerPropertiesForTesting(scroll_parent_border.get(), | 7588 SetLayerPropertiesForTesting(scroll_parent_border.get(), |
| 7586 identity_transform, | 7589 identity_transform, |
| 7587 gfx::Point3F(), | 7590 gfx::Point3F(), |
| 7588 gfx::PointF(), | 7591 gfx::PointF(), |
| 7589 gfx::Size(40, 40), | 7592 gfx::Size(40, 40), |
| 7590 true, | 7593 true, |
| 7594 false, |
| 7591 false); | 7595 false); |
| 7592 SetLayerPropertiesForTesting(scroll_parent_clip.get(), | 7596 SetLayerPropertiesForTesting(scroll_parent_clip.get(), |
| 7593 identity_transform, | 7597 identity_transform, |
| 7594 gfx::Point3F(), | 7598 gfx::Point3F(), |
| 7595 gfx::PointF(), | 7599 gfx::PointF(), |
| 7596 gfx::Size(30, 30), | 7600 gfx::Size(30, 30), |
| 7597 true, | 7601 true, |
| 7598 false); | 7602 false); |
| 7599 SetLayerPropertiesForTesting(scroll_parent.get(), | 7603 SetLayerPropertiesForTesting(scroll_parent.get(), |
| 7600 identity_transform, | 7604 identity_transform, |
| 7601 gfx::Point3F(), | 7605 gfx::Point3F(), |
| 7602 gfx::PointF(), | 7606 gfx::PointF(), |
| 7603 gfx::Size(50, 50), | 7607 gfx::Size(50, 50), |
| 7604 true, | 7608 true, |
| 7605 false); | 7609 true); |
| 7606 SetLayerPropertiesForTesting(scroll_child.get(), | 7610 SetLayerPropertiesForTesting(scroll_child.get(), |
| 7607 identity_transform, | 7611 identity_transform, |
| 7608 gfx::Point3F(), | 7612 gfx::Point3F(), |
| 7609 gfx::PointF(), | 7613 gfx::PointF(), |
| 7610 gfx::Size(50, 50), | 7614 gfx::Size(50, 50), |
| 7611 true, | 7615 true, |
| 7612 false); | 7616 false); |
| 7613 SetLayerPropertiesForTesting(top_content.get(), | 7617 SetLayerPropertiesForTesting(top_content.get(), |
| 7614 top_transform, | 7618 top_transform, |
| 7615 gfx::Point3F(), | 7619 gfx::Point3F(), |
| 7616 gfx::PointF(), | 7620 gfx::PointF(), |
| 7617 gfx::Size(50, 50), | 7621 gfx::Size(50, 50), |
| 7618 false, | 7622 false, |
| 7623 true, |
| 7619 true); | 7624 true); |
| 7620 SetLayerPropertiesForTesting(bottom_content.get(), | 7625 SetLayerPropertiesForTesting(bottom_content.get(), |
| 7621 bottom_transform, | 7626 bottom_transform, |
| 7622 gfx::Point3F(), | 7627 gfx::Point3F(), |
| 7623 gfx::PointF(), | 7628 gfx::PointF(), |
| 7624 gfx::Size(50, 50), | 7629 gfx::Size(50, 50), |
| 7625 false, | 7630 false, |
| 7631 true, |
| 7626 true); | 7632 true); |
| 7627 | 7633 |
| 7628 scroll_child->SetShouldFlattenTransform(false); | 7634 scroll_child->SetShouldFlattenTransform(false); |
| 7629 scroll_child->Set3dSortingContextId(1); | 7635 scroll_child->Set3dSortingContextId(1); |
| 7630 | 7636 |
| 7631 scroll_child->AddChild(top_content.Pass()); | 7637 scroll_child->AddChild(top_content.Pass()); |
| 7632 scroll_child->AddChild(bottom_content.Pass()); | 7638 scroll_child->AddChild(bottom_content.Pass()); |
| 7633 root->AddChild(scroll_child.Pass()); | 7639 root->AddChild(scroll_child.Pass()); |
| 7634 | 7640 |
| 7635 scroll_parent_clip->AddChild(scroll_parent.Pass()); | 7641 scroll_parent_clip->AddChild(scroll_parent.Pass()); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7692 gfx::Transform container_transform; | 7698 gfx::Transform container_transform; |
| 7693 container_transform.Translate3d(10.0, 20.0, 0.0); | 7699 container_transform.Translate3d(10.0, 20.0, 0.0); |
| 7694 gfx::Vector2dF container_offset = container_transform.To2dTranslation(); | 7700 gfx::Vector2dF container_offset = container_transform.To2dTranslation(); |
| 7695 | 7701 |
| 7696 SetLayerPropertiesForTesting(root.get(), | 7702 SetLayerPropertiesForTesting(root.get(), |
| 7697 identity_transform, | 7703 identity_transform, |
| 7698 gfx::Point3F(), | 7704 gfx::Point3F(), |
| 7699 gfx::PointF(), | 7705 gfx::PointF(), |
| 7700 gfx::Size(50, 50), | 7706 gfx::Size(50, 50), |
| 7701 true, | 7707 true, |
| 7702 false); | 7708 false, |
| 7709 true); |
| 7703 SetLayerPropertiesForTesting(container.get(), | 7710 SetLayerPropertiesForTesting(container.get(), |
| 7704 container_transform, | 7711 container_transform, |
| 7705 gfx::Point3F(), | 7712 gfx::Point3F(), |
| 7706 gfx::PointF(), | 7713 gfx::PointF(), |
| 7707 gfx::Size(40, 40), | 7714 gfx::Size(40, 40), |
| 7708 true, | 7715 true, |
| 7709 false); | 7716 false); |
| 7710 SetLayerPropertiesForTesting(scroller.get(), | 7717 SetLayerPropertiesForTesting(scroller.get(), |
| 7711 identity_transform, | 7718 identity_transform, |
| 7712 gfx::Point3F(), | 7719 gfx::Point3F(), |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7856 child->AddChild(grand_child.PassAs<LayerImpl>()); | 7863 child->AddChild(grand_child.PassAs<LayerImpl>()); |
| 7857 parent->AddChild(child.PassAs<LayerImpl>()); | 7864 parent->AddChild(child.PassAs<LayerImpl>()); |
| 7858 grand_parent->AddChild(parent.PassAs<LayerImpl>()); | 7865 grand_parent->AddChild(parent.PassAs<LayerImpl>()); |
| 7859 | 7866 |
| 7860 SetLayerPropertiesForTesting(grand_parent.get(), | 7867 SetLayerPropertiesForTesting(grand_parent.get(), |
| 7861 identity_matrix, | 7868 identity_matrix, |
| 7862 gfx::Point3F(), | 7869 gfx::Point3F(), |
| 7863 gfx::PointF(), | 7870 gfx::PointF(), |
| 7864 gfx::Size(1, 2), | 7871 gfx::Size(1, 2), |
| 7865 true, | 7872 true, |
| 7866 false); | 7873 false, |
| 7874 true); |
| 7867 SetLayerPropertiesForTesting(parent_raw, | 7875 SetLayerPropertiesForTesting(parent_raw, |
| 7868 identity_matrix, | 7876 identity_matrix, |
| 7869 gfx::Point3F(), | 7877 gfx::Point3F(), |
| 7870 gfx::PointF(), | 7878 gfx::PointF(), |
| 7871 gfx::Size(1, 2), | 7879 gfx::Size(1, 2), |
| 7872 true, | 7880 true, |
| 7873 false); | 7881 false); |
| 7874 SetLayerPropertiesForTesting(child_raw, | 7882 SetLayerPropertiesForTesting(child_raw, |
| 7875 identity_matrix, | 7883 identity_matrix, |
| 7876 gfx::Point3F(), | 7884 gfx::Point3F(), |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8092 child->AddChild(grand_child2.Pass()); | 8100 child->AddChild(grand_child2.Pass()); |
| 8093 parent->AddChild(child.Pass()); | 8101 parent->AddChild(child.Pass()); |
| 8094 grand_parent->AddChild(parent.Pass()); | 8102 grand_parent->AddChild(parent.Pass()); |
| 8095 | 8103 |
| 8096 SetLayerPropertiesForTesting(grand_parent_raw, | 8104 SetLayerPropertiesForTesting(grand_parent_raw, |
| 8097 identity_matrix, | 8105 identity_matrix, |
| 8098 gfx::Point3F(), | 8106 gfx::Point3F(), |
| 8099 gfx::PointF(), | 8107 gfx::PointF(), |
| 8100 gfx::Size(1, 2), | 8108 gfx::Size(1, 2), |
| 8101 true, | 8109 true, |
| 8102 false); | 8110 false, |
| 8111 true); |
| 8103 SetLayerPropertiesForTesting(parent_raw, | 8112 SetLayerPropertiesForTesting(parent_raw, |
| 8104 identity_matrix, | 8113 identity_matrix, |
| 8105 gfx::Point3F(), | 8114 gfx::Point3F(), |
| 8106 gfx::PointF(), | 8115 gfx::PointF(), |
| 8107 gfx::Size(1, 2), | 8116 gfx::Size(1, 2), |
| 8108 true, | 8117 true, |
| 8109 false); | 8118 false); |
| 8110 SetLayerPropertiesForTesting(child_raw, | 8119 SetLayerPropertiesForTesting(child_raw, |
| 8111 identity_matrix, | 8120 identity_matrix, |
| 8112 gfx::Point3F(), | 8121 gfx::Point3F(), |
| (...skipping 26 matching lines...) Expand all Loading... |
| 8139 EXPECT_NE(member_id, membership_id(grand_child1_raw)); | 8148 EXPECT_NE(member_id, membership_id(grand_child1_raw)); |
| 8140 EXPECT_NE(member_id, membership_id(grand_child2_raw)); | 8149 EXPECT_NE(member_id, membership_id(grand_child2_raw)); |
| 8141 | 8150 |
| 8142 std::set<LayerImpl*> expected; | 8151 std::set<LayerImpl*> expected; |
| 8143 std::set<LayerImpl*> actual; | 8152 std::set<LayerImpl*> actual; |
| 8144 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); | 8153 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); |
| 8145 EXPECT_EQ(expected, actual); | 8154 EXPECT_EQ(expected, actual); |
| 8146 | 8155 |
| 8147 // If we force render surface, but none of the layers are in the layer list, | 8156 // If we force render surface, but none of the layers are in the layer list, |
| 8148 // then this layer should not appear in RSLL. | 8157 // then this layer should not appear in RSLL. |
| 8149 grand_child1_raw->SetForceRenderSurface(true); | 8158 grand_child1_raw->CreateRenderSurface(); |
| 8150 | 8159 |
| 8151 ExecuteCalculateDrawProperties(grand_parent_raw); | 8160 ExecuteCalculateDrawProperties(grand_parent_raw); |
| 8152 member_id = render_surface_layer_list_count(); | 8161 member_id = render_surface_layer_list_count(); |
| 8153 | 8162 |
| 8154 EXPECT_NE(member_id, membership_id(grand_parent_raw)); | 8163 EXPECT_NE(member_id, membership_id(grand_parent_raw)); |
| 8155 EXPECT_NE(member_id, membership_id(parent_raw)); | 8164 EXPECT_NE(member_id, membership_id(parent_raw)); |
| 8156 EXPECT_NE(member_id, membership_id(child_raw)); | 8165 EXPECT_NE(member_id, membership_id(child_raw)); |
| 8157 EXPECT_NE(member_id, membership_id(grand_child1_raw)); | 8166 EXPECT_NE(member_id, membership_id(grand_child1_raw)); |
| 8158 EXPECT_NE(member_id, membership_id(grand_child2_raw)); | 8167 EXPECT_NE(member_id, membership_id(grand_child2_raw)); |
| 8159 | 8168 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 8178 expected.clear(); | 8187 expected.clear(); |
| 8179 expected.insert(grand_child1_raw); | 8188 expected.insert(grand_child1_raw); |
| 8180 | 8189 |
| 8181 actual.clear(); | 8190 actual.clear(); |
| 8182 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); | 8191 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); |
| 8183 EXPECT_EQ(expected, actual); | 8192 EXPECT_EQ(expected, actual); |
| 8184 | 8193 |
| 8185 // Now child is forced to have a render surface, and one if its children draws | 8194 // Now child is forced to have a render surface, and one if its children draws |
| 8186 // content. | 8195 // content. |
| 8187 grand_child1_raw->SetDrawsContent(false); | 8196 grand_child1_raw->SetDrawsContent(false); |
| 8188 grand_child1_raw->SetForceRenderSurface(false); | 8197 grand_child1_raw->ClearRenderSurface(); |
| 8189 child_raw->SetForceRenderSurface(true); | 8198 child_raw->CreateRenderSurface(); |
| 8190 grand_child2_raw->SetDrawsContent(true); | 8199 grand_child2_raw->SetDrawsContent(true); |
| 8191 | 8200 |
| 8192 ExecuteCalculateDrawProperties(grand_parent_raw); | 8201 ExecuteCalculateDrawProperties(grand_parent_raw); |
| 8193 member_id = render_surface_layer_list_count(); | 8202 member_id = render_surface_layer_list_count(); |
| 8194 | 8203 |
| 8195 EXPECT_NE(member_id, membership_id(grand_parent_raw)); | 8204 EXPECT_NE(member_id, membership_id(grand_parent_raw)); |
| 8196 EXPECT_NE(member_id, membership_id(parent_raw)); | 8205 EXPECT_NE(member_id, membership_id(parent_raw)); |
| 8197 EXPECT_NE(member_id, membership_id(child_raw)); | 8206 EXPECT_NE(member_id, membership_id(child_raw)); |
| 8198 EXPECT_NE(member_id, membership_id(grand_child1_raw)); | 8207 EXPECT_NE(member_id, membership_id(grand_child1_raw)); |
| 8199 EXPECT_EQ(member_id, membership_id(grand_child2_raw)); | 8208 EXPECT_EQ(member_id, membership_id(grand_child2_raw)); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8346 scale_transform_child2; | 8355 scale_transform_child2; |
| 8347 scale_transform_child1.Scale(2, 3); | 8356 scale_transform_child1.Scale(2, 3); |
| 8348 scale_transform_child2.Scale(4, 5); | 8357 scale_transform_child2.Scale(4, 5); |
| 8349 | 8358 |
| 8350 SetLayerPropertiesForTesting(root_layer, | 8359 SetLayerPropertiesForTesting(root_layer, |
| 8351 identity_matrix, | 8360 identity_matrix, |
| 8352 gfx::Point3F(), | 8361 gfx::Point3F(), |
| 8353 gfx::PointF(), | 8362 gfx::PointF(), |
| 8354 gfx::Size(1, 1), | 8363 gfx::Size(1, 1), |
| 8355 true, | 8364 true, |
| 8356 false); | 8365 false, |
| 8366 true); |
| 8357 SetLayerPropertiesForTesting(child1_layer, | 8367 SetLayerPropertiesForTesting(child1_layer, |
| 8358 scale_transform_child1, | 8368 scale_transform_child1, |
| 8359 gfx::Point3F(), | 8369 gfx::Point3F(), |
| 8360 gfx::PointF(), | 8370 gfx::PointF(), |
| 8361 gfx::Size(), | 8371 gfx::Size(), |
| 8362 true, | 8372 true, |
| 8363 false); | 8373 false); |
| 8364 | 8374 |
| 8365 child1_layer->SetMaskLayer( | 8375 child1_layer->SetMaskLayer( |
| 8366 LayerImpl::Create(host_impl.active_tree(), 4).Pass()); | 8376 LayerImpl::Create(host_impl.active_tree(), 4).Pass()); |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8554 EXPECT_FLOAT_EQ(4.f, | 8564 EXPECT_FLOAT_EQ(4.f, |
| 8555 child1_layer->replica_layer() | 8565 child1_layer->replica_layer() |
| 8556 ->mask_layer() | 8566 ->mask_layer() |
| 8557 ->draw_properties() | 8567 ->draw_properties() |
| 8558 .device_scale_factor); | 8568 .device_scale_factor); |
| 8559 EXPECT_FLOAT_EQ(4.f, child2_layer->draw_properties().device_scale_factor); | 8569 EXPECT_FLOAT_EQ(4.f, child2_layer->draw_properties().device_scale_factor); |
| 8560 } | 8570 } |
| 8561 | 8571 |
| 8562 } // namespace | 8572 } // namespace |
| 8563 } // namespace cc | 8573 } // namespace cc |
| OLD | NEW |