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 b40f66db486ddf63d9191fe933b0d195e9deb456..697234fbf5ffc3177f4bbff5b3f00805ccbfe682 100644 |
--- a/cc/trees/layer_tree_host_common_unittest.cc |
+++ b/cc/trees/layer_tree_host_common_unittest.cc |
@@ -324,6 +324,7 @@ TEST_F(LayerTreeHostCommonTest, TransformsAboutScrollOffset) { |
gfx::PointF(), |
gfx::Size(500, 500), |
true, |
+ false, |
false); |
scoped_ptr<LayerImpl> scroll_layer_scoped_ptr( |
@@ -335,6 +336,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)); |
@@ -359,8 +361,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()); |
@@ -384,6 +388,7 @@ TEST_F(LayerTreeHostCommonTest, TransformsAboutScrollOffset) { |
gfx::PointF(), |
gfx::Size(10, 20), |
true, |
+ false, |
false); |
ExecuteCalculateDrawProperties( |
root.get(), kDeviceScale, kPageScale, scroll_layer->parent()); |
@@ -3754,11 +3759,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 created 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()); |
@@ -4022,10 +4029,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()); |
@@ -5612,6 +5622,7 @@ TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) { |
gfx::PointF(), |
gfx::Size(100, 100), |
true, |
+ false, |
false); |
root->SetDrawsContent(true); |
@@ -5622,6 +5633,7 @@ TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) { |
gfx::PointF(), |
gfx::Size(50, 50), |
true, |
+ false, |
false); |
child->SetDrawsContent(true); |
child->SetOpacity(0.0f); |
@@ -5631,6 +5643,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( |
@@ -5870,6 +5883,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayerImpl) { |
gfx::PointF(), |
gfx::Size(50, 50), |
true, |
+ false, |
false); |
root->SetDrawsContent(true); |
@@ -5880,6 +5894,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayerImpl) { |
gfx::PointF(), |
gfx::Size(40, 40), |
true, |
+ false, |
false); |
child->SetDrawsContent(true); |
@@ -5891,12 +5906,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( |
@@ -5983,7 +6000,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); |
@@ -5993,6 +6011,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayersImpl) { |
gfx::PointF(), |
gfx::Size(40, 40), |
true, |
+ false, |
false); |
child->SetDrawsContent(true); |
child->SetHideLayerAndSubtree(true); |
@@ -6005,6 +6024,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayersImpl) { |
gfx::PointF(), |
gfx::Size(30, 30), |
true, |
+ false, |
false); |
grand_child->SetDrawsContent(true); |
@@ -6882,7 +6902,8 @@ TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) { |
position, |
bounds, |
true, |
- false); |
+ false, |
+ true); |
root->SetDrawsContent(true); |
// This layer structure normally forces render surface due to preserves3d |
@@ -6893,6 +6914,7 @@ TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) { |
position, |
bounds, |
false, |
+ true, |
true); |
child1->SetDrawsContent(true); |
SetLayerPropertiesForTesting(child2.get(), |
@@ -6901,6 +6923,7 @@ TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) { |
position, |
bounds, |
true, |
+ false, |
false); |
child2->SetDrawsContent(true); |
SetLayerPropertiesForTesting(child3.get(), |
@@ -6909,6 +6932,7 @@ TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) { |
position, |
bounds, |
true, |
+ false, |
false); |
child3->SetDrawsContent(true); |
@@ -7557,13 +7581,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, |
@@ -7571,6 +7597,7 @@ TEST_F(LayerTreeHostCommonTest, DoNotClobberSorting) { |
gfx::PointF(), |
gfx::Size(30, 30), |
true, |
+ false, |
false); |
SetLayerPropertiesForTesting(scroll_parent.get(), |
identity_transform, |
@@ -7578,6 +7605,7 @@ TEST_F(LayerTreeHostCommonTest, DoNotClobberSorting) { |
gfx::PointF(), |
gfx::Size(50, 50), |
true, |
+ false, |
false); |
SetLayerPropertiesForTesting(scroll_child.get(), |
identity_transform, |
@@ -7585,6 +7613,7 @@ TEST_F(LayerTreeHostCommonTest, DoNotClobberSorting) { |
gfx::PointF(), |
gfx::Size(50, 50), |
true, |
+ false, |
false); |
SetLayerPropertiesForTesting(top_content.get(), |
top_transform, |
@@ -7592,6 +7621,7 @@ TEST_F(LayerTreeHostCommonTest, DoNotClobberSorting) { |
gfx::PointF(), |
gfx::Size(50, 50), |
false, |
+ true, |
true); |
SetLayerPropertiesForTesting(bottom_content.get(), |
bottom_transform, |
@@ -7599,6 +7629,7 @@ TEST_F(LayerTreeHostCommonTest, DoNotClobberSorting) { |
gfx::PointF(), |
gfx::Size(50, 50), |
false, |
+ true, |
true); |
scroll_child->SetShouldFlattenTransform(false); |
@@ -7675,13 +7706,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, |
@@ -7689,6 +7722,7 @@ TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) { |
gfx::PointF(), |
gfx::Size(30, 30), |
true, |
+ false, |
false); |
SetLayerPropertiesForTesting(fixed.get(), |
identity_transform, |
@@ -7696,6 +7730,7 @@ TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) { |
gfx::PointF(), |
gfx::Size(50, 50), |
true, |
+ false, |
false); |
scroller->AddChild(fixed.Pass()); |
@@ -7839,13 +7874,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, |
@@ -7853,13 +7890,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()); |
@@ -8075,34 +8115,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. |
@@ -8122,7 +8170,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(); |
@@ -8161,8 +8209,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); |
@@ -8329,13 +8377,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( |
@@ -8358,6 +8408,7 @@ TEST_F(LayerTreeHostCommonTest, DrawPropertyScales) { |
gfx::PointF(), |
gfx::Size(), |
true, |
+ false, |
false); |
ExecuteCalculateDrawProperties(root_layer); |