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 082d14fc2c1978e232432c893a07d16b3d55e09a..d7c70e0cdaf5557fb491a11a51fa36ed8287bef2 100644 |
| --- a/cc/trees/layer_tree_host_common_unittest.cc |
| +++ b/cc/trees/layer_tree_host_common_unittest.cc |
| @@ -8943,5 +8943,54 @@ TEST_F(LayerTreeHostCommonTest, OnlyApplyFixedPositioningOnce) { |
| EXPECT_EQ(expected, fixed->visible_rect_from_property_trees()); |
| } |
| +TEST_F(LayerTreeHostCommonTest, |
| + PropertyTreesAccountForScrollCompensationAdjustment) { |
| + gfx::Transform identity; |
| + gfx::Transform translate_z; |
| + translate_z.Translate3d(0, 0, 10); |
| + |
| + scoped_refptr<Layer> root = Layer::Create(); |
| + SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| + gfx::PointF(), gfx::Size(800, 800), true, false); |
| + root->SetIsContainerForFixedPositionLayers(true); |
| + |
| + scoped_refptr<Layer> frame_clip = Layer::Create(); |
| + SetLayerPropertiesForTesting(frame_clip.get(), translate_z, gfx::Point3F(), |
| + gfx::PointF(500, 100), gfx::Size(100, 100), true, |
| + false); |
| + frame_clip->SetMasksToBounds(true); |
| + |
| + scoped_refptr<LayerWithForcedDrawsContent> scroller = |
| + make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| + SetLayerPropertiesForTesting(scroller.get(), identity, gfx::Point3F(), |
| + gfx::PointF(), gfx::Size(1000, 1000), true, |
| + false); |
| + |
| + scroller->SetScrollCompensationAdjustment(gfx::Vector2dF(0.0, -0.5f)); |
|
ajuma
2015/03/26 18:03:25
Does blink usually send negative values for scroll
Ian Vollick
2015/03/30 17:51:25
You're right, this is wrong. Blink sends the fract
|
| + scroller->SetScrollOffset(gfx::ScrollOffset(0.0, 0.5)); |
| + scroller->SetScrollClipLayerId(frame_clip->id()); |
| + |
| + scoped_refptr<LayerWithForcedDrawsContent> fixed = |
| + make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| + SetLayerPropertiesForTesting(fixed.get(), identity, gfx::Point3F(), |
| + gfx::PointF(), gfx::Size(50, 50), true, false); |
| + |
| + LayerPositionConstraint constraint; |
| + constraint.set_is_fixed_position(true); |
| + fixed->SetPositionConstraint(constraint); |
| + |
| + root->AddChild(frame_clip); |
| + frame_clip->AddChild(scroller); |
| + scroller->AddChild(fixed); |
| + |
| + scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| + host->SetRootLayer(root); |
| + |
| + ExecuteCalculateDrawProperties(root.get()); |
| + |
| + gfx::Rect expected(0, 1, 50, 49); |
| + EXPECT_EQ(expected, fixed->visible_rect_from_property_trees()); |
| +} |
| + |
| } // namespace |
| } // namespace cc |