Chromium Code Reviews| 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 6f05035428a285c7fc1f13411b77b6a52f067b07..b6c3f67ffd0a78e82f18a6cf998bb2d6ccc4830f 100644 |
| --- a/cc/trees/layer_tree_host_common_unittest.cc |
| +++ b/cc/trees/layer_tree_host_common_unittest.cc |
| @@ -8812,5 +8812,42 @@ TEST_F(LayerTreeHostCommonTest, AnimatedFilterCreatesRenderSurface) { |
| EXPECT_FALSE(grandchild->FilterIsAnimating()); |
| } |
| +// Ensures that the property tree code accounts for offsets between fixed |
| +// position layers and their respective containers. |
| +TEST_F(LayerTreeHostCommonTest, PropertyTreesAccountForFixedParentOffset) { |
| + scoped_refptr<Layer> root = Layer::Create(); |
| + scoped_refptr<Layer> child = Layer::Create(); |
| + scoped_refptr<LayerWithForcedDrawsContent> grandchild = |
| + make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| + |
| + root->AddChild(child); |
| + child->AddChild(grandchild); |
| + |
| + gfx::Transform identity_transform; |
| + SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), |
| + gfx::PointF(), gfx::Size(50, 50), true, false); |
| + SetLayerPropertiesForTesting(child.get(), identity_transform, gfx::Point3F(), |
| + gfx::PointF(1000, 1000), gfx::Size(50, 50), true, |
| + false); |
| + SetLayerPropertiesForTesting(grandchild.get(), identity_transform, |
| + gfx::Point3F(), gfx::PointF(-1000, -1000), |
| + gfx::Size(50, 50), true, false); |
| + |
| + root->SetMasksToBounds(true); |
| + root->SetIsContainerForFixedPositionLayers(true); |
| + LayerPositionConstraint constraint; |
| + constraint.set_is_fixed_position(true); |
| + grandchild->SetPositionConstraint(constraint); |
| + |
| + root->SetIsContainerForFixedPositionLayers(true); |
| + |
| + scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| + host->SetRootLayer(root); |
| + |
| + // Property tree verification will fail if position of child is not accounted |
|
enne (OOO)
2015/03/02 01:12:26
Verification will not persist in the future. Mayb
Ian Vollick
2015/03/02 01:28:00
Great point -- if we were to switch to property tr
|
| + // for in the tree building. |
| + ExecuteCalculateDrawProperties(root.get()); |
| +} |
| + |
| } // namespace |
| } // namespace cc |