Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(319)

Unified Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 1021823006: Fix scroll position adjustment for fixed-position layers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed debug code. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | cc/trees/property_tree_builder.cc » ('j') | cc/trees/property_tree_builder.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | cc/trees/property_tree_builder.cc » ('j') | cc/trees/property_tree_builder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698