| Index: cc/trees/layer_tree_host_common_unittest.cc
|
| diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
|
| index feed1ed02008e049efb5f85f9d0c3f10ba7914b7..a9085574bf66eeccb36e8ea0711e936c3eeecc0a 100644
|
| --- a/cc/trees/layer_tree_host_common_unittest.cc
|
| +++ b/cc/trees/layer_tree_host_common_unittest.cc
|
| @@ -309,6 +309,7 @@ TEST_F(LayerTreeHostCommonTest, TransformsAboutScrollOffset) {
|
| gfx::PointF(),
|
| gfx::Size(500, 500),
|
| true,
|
| + false,
|
| false);
|
|
|
| scoped_ptr<LayerImpl> scroll_layer_scoped_ptr(
|
| @@ -320,6 +321,7 @@ TEST_F(LayerTreeHostCommonTest, TransformsAboutScrollOffset) {
|
| gfx::PointF(),
|
| gfx::Size(10, 20),
|
| true,
|
| + false,
|
| false);
|
| scoped_ptr<LayerImpl> clip_layer_scoped_ptr(
|
| LayerImpl::Create(host_impl.active_tree(), 4));
|
| @@ -344,8 +346,10 @@ TEST_F(LayerTreeHostCommonTest, TransformsAboutScrollOffset) {
|
| gfx::PointF(),
|
| gfx::Size(3, 4),
|
| true,
|
| + false,
|
| false);
|
| root->AddChild(clip_layer_scoped_ptr.Pass());
|
| + root->SetHasRenderSurface(true);
|
|
|
| ExecuteCalculateDrawProperties(
|
| root.get(), kDeviceScale, kPageScale, scroll_layer->parent());
|
| @@ -369,6 +373,7 @@ TEST_F(LayerTreeHostCommonTest, TransformsAboutScrollOffset) {
|
| gfx::PointF(),
|
| gfx::Size(10, 20),
|
| true,
|
| + false,
|
| false);
|
| ExecuteCalculateDrawProperties(
|
| root.get(), kDeviceScale, kPageScale, scroll_layer->parent());
|
| @@ -3709,11 +3714,13 @@ TEST_F(LayerTreeHostCommonTest, BackFaceCullingWithPreserves3d) {
|
| inputs.can_adjust_raster_scales = true;
|
| LayerTreeHostCommon::CalculateDrawProperties(&inputs);
|
|
|
| - // Verify which render surfaces were created.
|
| + // Verify which render surfaces were created and used.
|
| EXPECT_FALSE(front_facing_child->render_surface());
|
| EXPECT_FALSE(back_facing_child->render_surface());
|
| EXPECT_TRUE(front_facing_surface->render_surface());
|
| - EXPECT_FALSE(back_facing_surface->render_surface());
|
| + EXPECT_NE(back_facing_surface->render_target(), back_facing_surface);
|
| + // We expect that a render_surface was creatd but not used.
|
| + EXPECT_TRUE(back_facing_surface->render_surface());
|
| EXPECT_FALSE(front_facing_child_of_front_facing_surface->render_surface());
|
| EXPECT_FALSE(back_facing_child_of_front_facing_surface->render_surface());
|
| EXPECT_FALSE(front_facing_child_of_back_facing_surface->render_surface());
|
| @@ -3977,10 +3984,13 @@ TEST_F(LayerTreeHostCommonTest,
|
| inputs.can_adjust_raster_scales = true;
|
| LayerTreeHostCommon::CalculateDrawProperties(&inputs);
|
|
|
| - // Verify which render surfaces were created.
|
| + // Verify which render surfaces were created and used.
|
| EXPECT_TRUE(front_facing_surface->render_surface());
|
| - EXPECT_FALSE(
|
| - back_facing_surface->render_surface()); // because it should be culled
|
| +
|
| + // We expect the render surface to have been created, but remain unused.
|
| + EXPECT_TRUE(back_facing_surface->render_surface());
|
| + EXPECT_NE(back_facing_surface->render_target(),
|
| + back_facing_surface); // because it should be culled
|
| EXPECT_FALSE(child1->render_surface());
|
| EXPECT_FALSE(child2->render_surface());
|
|
|
| @@ -5636,6 +5646,7 @@ TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) {
|
| gfx::PointF(),
|
| gfx::Size(100, 100),
|
| true,
|
| + false,
|
| false);
|
| root->SetDrawsContent(true);
|
|
|
| @@ -5646,6 +5657,7 @@ TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) {
|
| gfx::PointF(),
|
| gfx::Size(50, 50),
|
| true,
|
| + false,
|
| false);
|
| child->SetDrawsContent(true);
|
| child->SetOpacity(0.0f);
|
| @@ -5655,6 +5667,7 @@ TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) {
|
| child->layer_animation_controller(), 10.0, 0.0f, 1.0f, false);
|
|
|
| root->AddChild(child.Pass());
|
| + root->SetHasRenderSurface(true);
|
|
|
| LayerImplList render_surface_layer_list;
|
| LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
|
| @@ -5894,6 +5907,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayerImpl) {
|
| gfx::PointF(),
|
| gfx::Size(50, 50),
|
| true,
|
| + false,
|
| false);
|
| root->SetDrawsContent(true);
|
|
|
| @@ -5904,6 +5918,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayerImpl) {
|
| gfx::PointF(),
|
| gfx::Size(40, 40),
|
| true,
|
| + false,
|
| false);
|
| child->SetDrawsContent(true);
|
|
|
| @@ -5915,12 +5930,14 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayerImpl) {
|
| gfx::PointF(),
|
| gfx::Size(30, 30),
|
| true,
|
| + false,
|
| false);
|
| grand_child->SetDrawsContent(true);
|
| grand_child->SetHideLayerAndSubtree(true);
|
|
|
| child->AddChild(grand_child.Pass());
|
| root->AddChild(child.Pass());
|
| + root->SetHasRenderSurface(true);
|
|
|
| LayerImplList render_surface_layer_list;
|
| LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
|
| @@ -6007,7 +6024,8 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayersImpl) {
|
| gfx::PointF(),
|
| gfx::Size(50, 50),
|
| true,
|
| - false);
|
| + false,
|
| + true);
|
| root->SetDrawsContent(true);
|
|
|
| scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2);
|
| @@ -6017,6 +6035,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayersImpl) {
|
| gfx::PointF(),
|
| gfx::Size(40, 40),
|
| true,
|
| + false,
|
| false);
|
| child->SetDrawsContent(true);
|
| child->SetHideLayerAndSubtree(true);
|
| @@ -6029,6 +6048,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayersImpl) {
|
| gfx::PointF(),
|
| gfx::Size(30, 30),
|
| true,
|
| + false,
|
| false);
|
| grand_child->SetDrawsContent(true);
|
|
|
| @@ -6886,15 +6906,13 @@ TEST_F(LayerTreeHostCommonTest,
|
| TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) {
|
| FakeImplProxy proxy;
|
| TestSharedBitmapManager shared_bitmap_manager;
|
| - FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
|
| - scoped_ptr<LayerImpl> root =
|
| - LayerImpl::Create(host_impl.active_tree(), 12345);
|
| - scoped_ptr<LayerImpl> child1 =
|
| - LayerImpl::Create(host_impl.active_tree(), 123456);
|
| - scoped_ptr<LayerImpl> child2 =
|
| - LayerImpl::Create(host_impl.active_tree(), 1234567);
|
| - scoped_ptr<LayerImpl> child3 =
|
| - LayerImpl::Create(host_impl.active_tree(), 12345678);
|
| + scoped_ptr<LayerTreeHost> host =
|
| + FakeLayerTreeHost::Create().PassAs<LayerTreeHost>();
|
| + scoped_refptr<Layer> root = Layer::Create();
|
| + root->SetLayerTreeHost(host.get());
|
| + scoped_refptr<Layer> child1 = Layer::Create();
|
| + scoped_refptr<Layer> child2 = Layer::Create();
|
| + scoped_refptr<Layer> child3 = Layer::Create();
|
|
|
| gfx::Transform identity_matrix;
|
| gfx::Point3F transform_origin;
|
| @@ -6907,7 +6925,7 @@ TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) {
|
| bounds,
|
| true,
|
| false);
|
| - root->SetDrawsContent(true);
|
| + root->SetIsDrawable(true);
|
|
|
| // This layer structure normally forces render surface due to preserves3d
|
| // behavior.
|
| @@ -6918,7 +6936,7 @@ TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) {
|
| bounds,
|
| false,
|
| true);
|
| - child1->SetDrawsContent(true);
|
| + child1->SetIsDrawable(true);
|
| SetLayerPropertiesForTesting(child2.get(),
|
| identity_matrix,
|
| transform_origin,
|
| @@ -6926,7 +6944,7 @@ TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) {
|
| bounds,
|
| true,
|
| false);
|
| - child2->SetDrawsContent(true);
|
| + child2->SetIsDrawable(true);
|
| SetLayerPropertiesForTesting(child3.get(),
|
| identity_matrix,
|
| transform_origin,
|
| @@ -6934,19 +6952,18 @@ TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) {
|
| bounds,
|
| true,
|
| false);
|
| - child3->SetDrawsContent(true);
|
| + child3->SetIsDrawable(true);
|
|
|
| child2->Set3dSortingContextId(1);
|
| child3->Set3dSortingContextId(1);
|
|
|
| - child2->AddChild(child3.Pass());
|
| - child1->AddChild(child2.Pass());
|
| - root->AddChild(child1.Pass());
|
| + child2->AddChild(child3.get());
|
| + child1->AddChild(child2.get());
|
| + root->AddChild(child1.get());
|
|
|
| {
|
| - LayerImplList render_surface_layer_list;
|
| - FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(root.get());
|
| - LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
|
| + RenderSurfaceLayerList render_surface_layer_list;
|
| + LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs(
|
| root.get(), root->bounds(), &render_surface_layer_list);
|
| inputs.can_render_to_separate_surface = true;
|
| LayerTreeHostCommon::CalculateDrawProperties(&inputs);
|
| @@ -6955,14 +6972,15 @@ TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) {
|
| }
|
|
|
| {
|
| - LayerImplList render_surface_layer_list;
|
| - LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
|
| + RenderSurfaceLayerList render_surface_layer_list;
|
| + LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs(
|
| root.get(), root->bounds(), &render_surface_layer_list);
|
| inputs.can_render_to_separate_surface = false;
|
| LayerTreeHostCommon::CalculateDrawProperties(&inputs);
|
|
|
| EXPECT_EQ(1u, render_surface_layer_list.size());
|
| }
|
| + root->SetLayerTreeHost(NULL);
|
| }
|
|
|
| TEST_F(LayerTreeHostCommonTest, DoNotIncludeBackfaceInvisibleSurfaces) {
|
| @@ -7581,13 +7599,15 @@ TEST_F(LayerTreeHostCommonTest, DoNotClobberSorting) {
|
| gfx::PointF(),
|
| gfx::Size(50, 50),
|
| true,
|
| - false);
|
| + false,
|
| + true);
|
| SetLayerPropertiesForTesting(scroll_parent_border.get(),
|
| identity_transform,
|
| gfx::Point3F(),
|
| gfx::PointF(),
|
| gfx::Size(40, 40),
|
| true,
|
| + false,
|
| false);
|
| SetLayerPropertiesForTesting(scroll_parent_clip.get(),
|
| identity_transform,
|
| @@ -7595,6 +7615,7 @@ TEST_F(LayerTreeHostCommonTest, DoNotClobberSorting) {
|
| gfx::PointF(),
|
| gfx::Size(30, 30),
|
| true,
|
| + false,
|
| false);
|
| SetLayerPropertiesForTesting(scroll_parent.get(),
|
| identity_transform,
|
| @@ -7602,6 +7623,7 @@ TEST_F(LayerTreeHostCommonTest, DoNotClobberSorting) {
|
| gfx::PointF(),
|
| gfx::Size(50, 50),
|
| true,
|
| + false,
|
| false);
|
| SetLayerPropertiesForTesting(scroll_child.get(),
|
| identity_transform,
|
| @@ -7609,6 +7631,7 @@ TEST_F(LayerTreeHostCommonTest, DoNotClobberSorting) {
|
| gfx::PointF(),
|
| gfx::Size(50, 50),
|
| true,
|
| + false,
|
| false);
|
| SetLayerPropertiesForTesting(top_content.get(),
|
| top_transform,
|
| @@ -7616,6 +7639,7 @@ TEST_F(LayerTreeHostCommonTest, DoNotClobberSorting) {
|
| gfx::PointF(),
|
| gfx::Size(50, 50),
|
| false,
|
| + true,
|
| true);
|
| SetLayerPropertiesForTesting(bottom_content.get(),
|
| bottom_transform,
|
| @@ -7623,6 +7647,7 @@ TEST_F(LayerTreeHostCommonTest, DoNotClobberSorting) {
|
| gfx::PointF(),
|
| gfx::Size(50, 50),
|
| false,
|
| + true,
|
| true);
|
|
|
| scroll_child->SetShouldFlattenTransform(false);
|
| @@ -7699,13 +7724,15 @@ TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) {
|
| gfx::PointF(),
|
| gfx::Size(50, 50),
|
| true,
|
| - false);
|
| + false,
|
| + true);
|
| SetLayerPropertiesForTesting(container.get(),
|
| container_transform,
|
| gfx::Point3F(),
|
| gfx::PointF(),
|
| gfx::Size(40, 40),
|
| true,
|
| + false,
|
| false);
|
| SetLayerPropertiesForTesting(scroller.get(),
|
| identity_transform,
|
| @@ -7713,6 +7740,7 @@ TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) {
|
| gfx::PointF(),
|
| gfx::Size(30, 30),
|
| true,
|
| + false,
|
| false);
|
| SetLayerPropertiesForTesting(fixed.get(),
|
| identity_transform,
|
| @@ -7720,6 +7748,7 @@ TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) {
|
| gfx::PointF(),
|
| gfx::Size(50, 50),
|
| true,
|
| + false,
|
| false);
|
|
|
| scroller->AddChild(fixed.Pass());
|
| @@ -7863,13 +7892,15 @@ TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) {
|
| gfx::PointF(),
|
| gfx::Size(1, 2),
|
| true,
|
| - false);
|
| + false,
|
| + true);
|
| SetLayerPropertiesForTesting(parent_raw,
|
| identity_matrix,
|
| gfx::Point3F(),
|
| gfx::PointF(),
|
| gfx::Size(1, 2),
|
| true,
|
| + false,
|
| false);
|
| SetLayerPropertiesForTesting(child_raw,
|
| identity_matrix,
|
| @@ -7877,13 +7908,16 @@ TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) {
|
| gfx::PointF(),
|
| gfx::Size(1, 2),
|
| true,
|
| + false,
|
| false);
|
| +
|
| SetLayerPropertiesForTesting(grand_child_raw,
|
| identity_matrix,
|
| gfx::Point3F(),
|
| gfx::PointF(),
|
| gfx::Size(1, 2),
|
| true,
|
| + false,
|
| false);
|
|
|
| ExecuteCalculateDrawProperties(grand_parent.get());
|
| @@ -8099,34 +8133,42 @@ TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) {
|
| gfx::PointF(),
|
| gfx::Size(1, 2),
|
| true,
|
| - false);
|
| + false,
|
| + true);
|
| SetLayerPropertiesForTesting(parent_raw,
|
| identity_matrix,
|
| gfx::Point3F(),
|
| gfx::PointF(),
|
| gfx::Size(1, 2),
|
| true,
|
| + false,
|
| false);
|
| +
|
| SetLayerPropertiesForTesting(child_raw,
|
| identity_matrix,
|
| gfx::Point3F(),
|
| gfx::PointF(),
|
| gfx::Size(1, 2),
|
| true,
|
| + false,
|
| false);
|
| +
|
| SetLayerPropertiesForTesting(grand_child1_raw,
|
| identity_matrix,
|
| gfx::Point3F(),
|
| gfx::PointF(),
|
| gfx::Size(1, 2),
|
| true,
|
| + false,
|
| false);
|
| +
|
| SetLayerPropertiesForTesting(grand_child2_raw,
|
| identity_matrix,
|
| gfx::Point3F(),
|
| gfx::PointF(),
|
| gfx::Size(1, 2),
|
| true,
|
| + false,
|
| false);
|
|
|
| // Start with nothing being drawn.
|
| @@ -8146,7 +8188,7 @@ TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) {
|
|
|
| // If we force render surface, but none of the layers are in the layer list,
|
| // then this layer should not appear in RSLL.
|
| - grand_child1_raw->SetForceRenderSurface(true);
|
| + grand_child1_raw->SetHasRenderSurface(true);
|
|
|
| ExecuteCalculateDrawProperties(grand_parent_raw);
|
| member_id = render_surface_layer_list_count();
|
| @@ -8185,8 +8227,8 @@ TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) {
|
| // Now child is forced to have a render surface, and one if its children draws
|
| // content.
|
| grand_child1_raw->SetDrawsContent(false);
|
| - grand_child1_raw->SetForceRenderSurface(false);
|
| - child_raw->SetForceRenderSurface(true);
|
| + grand_child1_raw->SetHasRenderSurface(false);
|
| + child_raw->SetHasRenderSurface(true);
|
| grand_child2_raw->SetDrawsContent(true);
|
|
|
| ExecuteCalculateDrawProperties(grand_parent_raw);
|
| @@ -8353,13 +8395,15 @@ TEST_F(LayerTreeHostCommonTest, DrawPropertyScales) {
|
| gfx::PointF(),
|
| gfx::Size(1, 1),
|
| true,
|
| - false);
|
| + false,
|
| + true);
|
| SetLayerPropertiesForTesting(child1_layer,
|
| scale_transform_child1,
|
| gfx::Point3F(),
|
| gfx::PointF(),
|
| gfx::Size(),
|
| true,
|
| + false,
|
| false);
|
|
|
| child1_layer->SetMaskLayer(
|
| @@ -8382,6 +8426,7 @@ TEST_F(LayerTreeHostCommonTest, DrawPropertyScales) {
|
| gfx::PointF(),
|
| gfx::Size(),
|
| true,
|
| + false,
|
| false);
|
|
|
| ExecuteCalculateDrawProperties(root_layer);
|
|
|