Index: cc/layer_tree_host_common_unittest.cc |
diff --git a/cc/layer_tree_host_common_unittest.cc b/cc/layer_tree_host_common_unittest.cc |
index 456ea52f1fafac554620061135916567e46636b6..d73b91ac827da2b8c554ebad19193542c0d49645 100644 |
--- a/cc/layer_tree_host_common_unittest.cc |
+++ b/cc/layer_tree_host_common_unittest.cc |
@@ -341,6 +341,7 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSingleRenderSurface) |
// Child is set up so that a new render surface should be created. |
child->setOpacity(0.5); |
+ child->setForceRenderSurface(true); |
WebTransformationMatrix parentLayerTransform; |
parentLayerTransform.scale3d(1, 0.9, 1); |
@@ -1369,6 +1370,7 @@ TEST(LayerTreeHostCommonTest, verifyClipRectCullsRenderSurfaces) |
child->setMasksToBounds(true); |
child->setOpacity(0.4f); |
+ child->setForceRenderSurface(true); |
grandChild->setOpacity(0.5); |
greatGrandChild->setOpacity(0.4f); |
@@ -1415,7 +1417,9 @@ TEST(LayerTreeHostCommonTest, verifyClipRectCullsSurfaceWithoutVisibleContent) |
parent->setMasksToBounds(true); |
child->setOpacity(0.4f); |
+ child->setForceRenderSurface(true); |
grandChild->setOpacity(0.4f); |
+ grandChild->setForceRenderSurface(true); |
std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
int dummyMaxTextureSize = 512; |
@@ -1643,10 +1647,15 @@ TEST(LayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces) |
// Force everyone to be a render surface. |
child->setOpacity(0.4f); |
+ child->setForceRenderSurface(true); |
grandChild1->setOpacity(0.5); |
+ grandChild1->setForceRenderSurface(true); |
grandChild2->setOpacity(0.5); |
+ grandChild2->setForceRenderSurface(true); |
grandChild3->setOpacity(0.5); |
+ grandChild3->setForceRenderSurface(true); |
grandChild4->setOpacity(0.5); |
+ grandChild4->setForceRenderSurface(true); |
std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
int dummyMaxTextureSize = 512; |
@@ -4625,5 +4634,25 @@ TEST(LayerTreeHostCommonTest, verifySubtreeSearch) |
EXPECT_EQ(0, LayerTreeHostCommon::findLayerInSubtree(root.get(), nonexistentId)); |
} |
+TEST(LayerTreeHostCommonTest, verifyTransparentChildRenderSurfaceCreation) |
+{ |
+ scoped_refptr<Layer> root = Layer::create(); |
+ scoped_refptr<Layer> child = Layer::create(); |
+ scoped_refptr<LayerWithForcedDrawsContent> grandChild = make_scoped_refptr(new LayerWithForcedDrawsContent()); |
+ |
+ const WebTransformationMatrix identityMatrix; |
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(100, 100), false); |
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false); |
+ setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false); |
+ |
+ root->addChild(child); |
+ child->addChild(grandChild); |
+ child->setOpacity(0.5f); |
+ |
+ executeCalculateDrawTransformsAndVisibility(root.get()); |
+ |
+ EXPECT_FALSE(child->renderSurface()); |
+} |
+ |
} // namespace |
} // namespace cc |