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

Unified Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 1106013002: cc: Fix property tree position updates when rebuilding is skipped (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test Created 5 years, 8 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.h » ('j') | no next file with comments »
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 e484b4240b3270a4079a2e20192f43d6233072c8..ba266f3e6065d2c57c2140fddc067a6e87a61c47 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -9221,5 +9221,42 @@ TEST_F(LayerTreeHostCommonTest, ChangeTransformOrigin) {
EXPECT_EQ(gfx::Rect(5, 5, 5, 5), child->visible_rect_from_property_trees());
}
+TEST_F(LayerTreeHostCommonTest, UpdateScrollChildPosition) {
+ scoped_refptr<Layer> root = Layer::Create();
+ scoped_refptr<LayerWithForcedDrawsContent> scroll_parent =
+ make_scoped_refptr(new LayerWithForcedDrawsContent);
+ scoped_refptr<LayerWithForcedDrawsContent> scroll_child =
+ make_scoped_refptr(new LayerWithForcedDrawsContent);
+
+ root->AddChild(scroll_child);
+ root->AddChild(scroll_parent);
+ scroll_child->SetScrollParent(scroll_parent.get());
+ scroll_parent->SetScrollClipLayerId(root->id());
+
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
+ host->SetRootLayer(root);
+
+ gfx::Transform identity_transform;
+ gfx::Transform scale;
+ scale.Scale(2.f, 2.f);
+ SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(50, 50), true, false);
+ SetLayerPropertiesForTesting(scroll_child.get(), scale, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(40, 40), true, false);
+ SetLayerPropertiesForTesting(scroll_parent.get(), identity_transform,
+ gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30),
+ true, false);
+
+ ExecuteCalculateDrawProperties(root.get());
+ EXPECT_EQ(gfx::Rect(25, 25),
+ scroll_child->visible_rect_from_property_trees());
+
+ scroll_child->SetPosition(gfx::PointF(0, -10.f));
+ scroll_parent->SetScrollOffset(gfx::ScrollOffset(0.f, 10.f));
+ ExecuteCalculateDrawProperties(root.get());
+ EXPECT_EQ(gfx::Rect(0, 5, 25, 25),
+ scroll_child->visible_rect_from_property_trees());
+}
+
} // namespace
} // namespace cc
« no previous file with comments | « no previous file | cc/trees/property_tree.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698