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

Unified Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 1159983010: Record root layer's position in its TransformNode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typo Created 5 years, 6 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') | 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 17800febec0a0e9b982a87786896a734e3603fa3..e6a942d247ba93829bd661bf1189abdd19169d54 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -2676,6 +2676,30 @@ TEST_F(LayerTreeHostCommonTest, VisibleRectForPerspectiveUnprojection) {
EXPECT_EQ(expected, actual);
}
+TEST_F(LayerTreeHostCommonTest,
+ VisibleRectsForPositionedRootLayerClippedByViewport) {
+ scoped_refptr<Layer> root =
+ make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings()));
+ scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
+ host->SetRootLayer(root);
+
+ gfx::Transform identity_matrix;
+ // Root layer is positioned at (60, 70). The default device viewport size
+ // is (0, 0, 100x100) in target space. So the root layer's visible rect
+ // will be clipped by the viewport to be (0, 0, 40x30) in layer's space.
+ SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(),
+ gfx::PointF(60, 70), gfx::Size(100, 100), true,
+ false);
+ ExecuteCalculateDrawProperties(root.get());
+
+ EXPECT_EQ(gfx::Rect(0, 0, 100, 100),
+ root->render_surface()->DrawableContentRect());
+ // In target space, not clipped.
+ EXPECT_EQ(gfx::Rect(60, 70, 100, 100), root->drawable_content_rect());
+ // In layer space, clipped.
+ EXPECT_EQ(gfx::Rect(0, 0, 40, 30), root->visible_content_rect());
+}
+
TEST_F(LayerTreeHostCommonTest, DrawableAndVisibleContentRectsForSimpleLayers) {
scoped_refptr<Layer> root = Layer::Create(layer_settings());
scoped_refptr<LayerWithForcedDrawsContent> child1 =
« no previous file with comments | « no previous file | cc/trees/property_tree_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698