| 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 aa9c7f04c2d43b7a48ea37eddb3d29838c0a43f6..34cbfbddc309a27779a4eb82dd5cde02332eb86b 100644
|
| --- a/cc/trees/layer_tree_host_common_unittest.cc
|
| +++ b/cc/trees/layer_tree_host_common_unittest.cc
|
| @@ -99,6 +99,7 @@ void ExecuteCalculateDrawProperties(Layer* root_layer,
|
| LayerTreeHostCommon::CalculateDrawProperties(
|
| root_layer,
|
| device_viewport_size,
|
| + gfx::Transform(),
|
| device_scale_factor,
|
| page_scale_factor,
|
| page_scale_application_layer,
|
| @@ -126,6 +127,7 @@ void ExecuteCalculateDrawProperties(LayerImpl* root_layer,
|
| LayerTreeHostCommon::CalculateDrawProperties(
|
| root_layer,
|
| device_viewport_size,
|
| + gfx::Transform(),
|
| device_scale_factor,
|
| page_scale_factor,
|
| page_scale_application_layer,
|
| @@ -1484,6 +1486,96 @@ TEST(LayerTreeHostCommonTest, TransformsForDegenerateIntermediateLayer) {
|
| grand_child->draw_transform());
|
| }
|
|
|
| +TEST(LayerTreeHostCommonTest, TransformAboveRootLayer) {
|
| + // Transformations applied at the root of the tree should be forwarded
|
| + // to child layers instead of applied to the root RenderSurface.
|
| + const gfx::Transform identity_matrix;
|
| + scoped_refptr<Layer> root = Layer::Create();
|
| + scoped_refptr<Layer> child = Layer::Create();
|
| +
|
| + root->AddChild(child);
|
| +
|
| + SetLayerPropertiesForTesting(root.get(),
|
| + identity_matrix,
|
| + identity_matrix,
|
| + gfx::PointF(),
|
| + gfx::PointF(),
|
| + gfx::Size(20, 20),
|
| + false);
|
| + SetLayerPropertiesForTesting(child.get(),
|
| + identity_matrix,
|
| + identity_matrix,
|
| + gfx::PointF(),
|
| + gfx::PointF(),
|
| + gfx::Size(20, 20),
|
| + false);
|
| +
|
| + LayerList render_surface_layer_list;
|
| + int dummy_max_texture_size = 512;
|
| +
|
| + gfx::Transform translate;
|
| + translate.Translate(50, 50);
|
| + LayerTreeHostCommon::CalculateDrawProperties(root.get(),
|
| + root->bounds(),
|
| + translate,
|
| + 1.f,
|
| + 1.f,
|
| + NULL,
|
| + dummy_max_texture_size,
|
| + false,
|
| + true, // can_adjust_raster_scale
|
| + &render_surface_layer_list);
|
| + EXPECT_EQ(translate, child->draw_properties().target_space_transform);
|
| + EXPECT_EQ(identity_matrix, root->render_surface()->draw_transform());
|
| +
|
| + gfx::Transform scale;
|
| + scale.Scale(2, 2);
|
| + LayerTreeHostCommon::CalculateDrawProperties(root.get(),
|
| + root->bounds(),
|
| + scale,
|
| + 1.f,
|
| + 1.f,
|
| + NULL,
|
| + dummy_max_texture_size,
|
| + false,
|
| + true, // can_adjust_raster_scale
|
| + &render_surface_layer_list);
|
| + EXPECT_EQ(scale, child->draw_properties().target_space_transform);
|
| + EXPECT_EQ(identity_matrix, root->render_surface()->draw_transform());
|
| +
|
| + gfx::Transform rotate;
|
| + rotate.Rotate(2);
|
| + LayerTreeHostCommon::CalculateDrawProperties(root.get(),
|
| + root->bounds(),
|
| + rotate,
|
| + 1.f,
|
| + 1.f,
|
| + NULL,
|
| + dummy_max_texture_size,
|
| + false,
|
| + true, // can_adjust_raster_scale
|
| + &render_surface_layer_list);
|
| + EXPECT_EQ(rotate, child->draw_properties().target_space_transform);
|
| + EXPECT_EQ(identity_matrix, root->render_surface()->draw_transform());
|
| +
|
| + gfx::Transform composite;
|
| + composite.ConcatTransform(translate);
|
| + composite.ConcatTransform(scale);
|
| + composite.ConcatTransform(rotate);
|
| + LayerTreeHostCommon::CalculateDrawProperties(root.get(),
|
| + root->bounds(),
|
| + composite,
|
| + 1.f,
|
| + 1.f,
|
| + NULL,
|
| + dummy_max_texture_size,
|
| + false,
|
| + true, // can_adjust_raster_scale
|
| + &render_surface_layer_list);
|
| + EXPECT_EQ(composite, child->draw_properties().target_space_transform);
|
| + EXPECT_EQ(identity_matrix, root->render_surface()->draw_transform());
|
| +}
|
| +
|
| TEST(LayerTreeHostCommonTest,
|
| RenderSurfaceListForRenderSurfaceWithClippedLayer) {
|
| scoped_refptr<Layer> parent = Layer::Create();
|
| @@ -1523,6 +1615,7 @@ TEST(LayerTreeHostCommonTest,
|
| int dummy_max_texture_size = 512;
|
| LayerTreeHostCommon::CalculateDrawProperties(parent.get(),
|
| parent->bounds(),
|
| + gfx::Transform(),
|
| 1.f,
|
| 1.f,
|
| NULL,
|
| @@ -1572,6 +1665,7 @@ TEST(LayerTreeHostCommonTest, RenderSurfaceListForTransparentChild) {
|
| int dummy_max_texture_size = 512;
|
| LayerTreeHostCommon::CalculateDrawProperties(parent.get(),
|
| parent->bounds(),
|
| + gfx::Transform(),
|
| 1.f,
|
| 1.f,
|
| NULL,
|
| @@ -1631,6 +1725,7 @@ TEST(LayerTreeHostCommonTest, ForceRenderSurface) {
|
| int dummy_max_texture_size = 512;
|
| LayerTreeHostCommon::CalculateDrawProperties(parent.get(),
|
| parent->bounds(),
|
| + gfx::Transform(),
|
| 1.f,
|
| 1.f,
|
| NULL,
|
| @@ -1648,6 +1743,7 @@ TEST(LayerTreeHostCommonTest, ForceRenderSurface) {
|
| render_surface1->SetForceRenderSurface(false);
|
| LayerTreeHostCommon::CalculateDrawProperties(parent.get(),
|
| parent->bounds(),
|
| + gfx::Transform(),
|
| 1.f,
|
| 1.f,
|
| NULL,
|
| @@ -1749,6 +1845,7 @@ TEST(LayerTreeHostCommonTest, ClipRectCullsRenderSurfaces) {
|
| int dummy_max_texture_size = 512;
|
| LayerTreeHostCommon::CalculateDrawProperties(parent.get(),
|
| parent->bounds(),
|
| + gfx::Transform(),
|
| 1.f,
|
| 1.f,
|
| NULL,
|
| @@ -1830,6 +1927,7 @@ TEST(LayerTreeHostCommonTest, ClipRectCullsSurfaceWithoutVisibleContent) {
|
| int dummy_max_texture_size = 512;
|
| LayerTreeHostCommon::CalculateDrawProperties(parent.get(),
|
| parent->bounds(),
|
| + gfx::Transform(),
|
| 1.f,
|
| 1.f,
|
| NULL,
|
| @@ -1854,6 +1952,7 @@ TEST(LayerTreeHostCommonTest, ClipRectCullsSurfaceWithoutVisibleContent) {
|
|
|
| LayerTreeHostCommon::CalculateDrawProperties(parent.get(),
|
| parent->bounds(),
|
| + gfx::Transform(),
|
| 1.f,
|
| 1.f,
|
| NULL,
|
| @@ -1958,6 +2057,7 @@ TEST(LayerTreeHostCommonTest, IsClippedIsSetCorrectly) {
|
| int dummy_max_texture_size = 512;
|
| LayerTreeHostCommon::CalculateDrawProperties(root.get(),
|
| parent->bounds(),
|
| + gfx::Transform(),
|
| 1.f,
|
| 1.f,
|
| NULL,
|
| @@ -1987,6 +2087,7 @@ TEST(LayerTreeHostCommonTest, IsClippedIsSetCorrectly) {
|
| parent->SetMasksToBounds(true);
|
| LayerTreeHostCommon::CalculateDrawProperties(root.get(),
|
| parent->bounds(),
|
| + gfx::Transform(),
|
| 1.f,
|
| 1.f,
|
| NULL,
|
| @@ -2015,6 +2116,7 @@ TEST(LayerTreeHostCommonTest, IsClippedIsSetCorrectly) {
|
| child2->SetMasksToBounds(true);
|
| LayerTreeHostCommon::CalculateDrawProperties(root.get(),
|
| parent->bounds(),
|
| + gfx::Transform(),
|
| 1.f,
|
| 1.f,
|
| NULL,
|
| @@ -2123,6 +2225,7 @@ TEST(LayerTreeHostCommonTest, drawable_content_rectForLayers) {
|
| int dummy_max_texture_size = 512;
|
| LayerTreeHostCommon::CalculateDrawProperties(parent.get(),
|
| parent->bounds(),
|
| + gfx::Transform(),
|
| 1.f,
|
| 1.f,
|
| NULL,
|
| @@ -2268,6 +2371,7 @@ TEST(LayerTreeHostCommonTest, ClipRectIsPropagatedCorrectlyToSurfaces) {
|
| int dummy_max_texture_size = 512;
|
| LayerTreeHostCommon::CalculateDrawProperties(parent.get(),
|
| parent->bounds(),
|
| + gfx::Transform(),
|
| 1.f,
|
| 1.f,
|
| NULL,
|
| @@ -3598,6 +3702,7 @@ TEST(LayerTreeHostCommonTest, BackFaceCullingWithoutPreserves3d) {
|
| int dummy_max_texture_size = 512;
|
| LayerTreeHostCommon::CalculateDrawProperties(parent.get(),
|
| parent->bounds(),
|
| + gfx::Transform(),
|
| 1.f,
|
| 1.f,
|
| NULL,
|
| @@ -3792,6 +3897,7 @@ TEST(LayerTreeHostCommonTest, BackFaceCullingWithPreserves3d) {
|
| int dummy_max_texture_size = 512;
|
| LayerTreeHostCommon::CalculateDrawProperties(parent.get(),
|
| parent->bounds(),
|
| + gfx::Transform(),
|
| 1.f,
|
| 1.f,
|
| NULL,
|
| @@ -3932,6 +4038,7 @@ TEST(LayerTreeHostCommonTest, BackFaceCullingWithAnimatingTransforms) {
|
| int dummy_max_texture_size = 512;
|
| LayerTreeHostCommon::CalculateDrawProperties(parent.get(),
|
| parent->bounds(),
|
| + gfx::Transform(),
|
| 1.f,
|
| 1.f,
|
| NULL,
|
| @@ -4060,6 +4167,7 @@ TEST(LayerTreeHostCommonTest,
|
| int dummy_max_texture_size = 512;
|
| LayerTreeHostCommon::CalculateDrawProperties(parent.get(),
|
| parent->bounds(),
|
| + gfx::Transform(),
|
| 1.f,
|
| 1.f,
|
| NULL,
|
| @@ -4138,6 +4246,7 @@ TEST(LayerTreeHostCommonTest, HitTestingForSingleLayer) {
|
| int dummy_max_texture_size = 512;
|
| LayerTreeHostCommon::CalculateDrawProperties(root.get(),
|
| root->bounds(),
|
| + gfx::Transform(),
|
| 1.f,
|
| 1.f,
|
| NULL,
|
| @@ -4214,6 +4323,7 @@ TEST(LayerTreeHostCommonTest, HitTestingForSingleLayerAndHud) {
|
| int dummy_max_texture_size = 512;
|
| LayerTreeHostCommon::CalculateDrawProperties(root.get(),
|
| hud_bounds,
|
| + gfx::Transform(),
|
| 1.f,
|
| 1.f,
|
| NULL,
|
| @@ -4282,6 +4392,7 @@ TEST(LayerTreeHostCommonTest, HitTestingForUninvertibleTransform) {
|
| int dummy_max_texture_size = 512;
|
| LayerTreeHostCommon::CalculateDrawProperties(root.get(),
|
| root->bounds(),
|
| + gfx::Transform(),
|
| 1.f,
|
| 1.f,
|
| NULL,
|
| @@ -4359,6 +4470,7 @@ TEST(LayerTreeHostCommonTest, HitTestingForSinglePositionedLayer) {
|
| int dummy_max_texture_size = 512;
|
| LayerTreeHostCommon::CalculateDrawProperties(root.get(),
|
| root->bounds(),
|
| + gfx::Transform(),
|
| 1.f,
|
| 1.f,
|
| NULL,
|
| @@ -4425,6 +4537,7 @@ TEST(LayerTreeHostCommonTest, HitTestingForSingleRotatedLayer) {
|
| int dummy_max_texture_size = 512;
|
| LayerTreeHostCommon::CalculateDrawProperties(root.get(),
|
| root->bounds(),
|
| + gfx::Transform(),
|
| 1.f,
|
| 1.f,
|
| NULL,
|
| @@ -4504,6 +4617,7 @@ TEST(LayerTreeHostCommonTest, HitTestingForSinglePerspectiveLayer) {
|
| int dummy_max_texture_size = 512;
|
| LayerTreeHostCommon::CalculateDrawProperties(root.get(),
|
| root->bounds(),
|
| + gfx::Transform(),
|
| 1.f,
|
| 1.f,
|
| NULL,
|
| @@ -4594,6 +4708,7 @@ TEST(LayerTreeHostCommonTest, HitTestingForSingleLayerWithScaledContents) {
|
| int dummy_max_texture_size = 512;
|
| LayerTreeHostCommon::CalculateDrawProperties(root.get(),
|
| root->bounds(),
|
| + gfx::Transform(),
|
| 1.f,
|
| 1.f,
|
| NULL,
|
| @@ -4695,6 +4810,7 @@ TEST(LayerTreeHostCommonTest, HitTestingForSimpleClippedLayer) {
|
| int dummy_max_texture_size = 512;
|
| LayerTreeHostCommon::CalculateDrawProperties(root.get(),
|
| root->bounds(),
|
| + gfx::Transform(),
|
| 1.f,
|
| 1.f,
|
| NULL,
|
| @@ -4829,6 +4945,7 @@ TEST(LayerTreeHostCommonTest, HitTestingForMultiClippedRotatedLayer) {
|
| int dummy_max_texture_size = 512;
|
| LayerTreeHostCommon::CalculateDrawProperties(root.get(),
|
| root->bounds(),
|
| + gfx::Transform(),
|
| 1.f,
|
| 1.f,
|
| NULL,
|
| @@ -4956,6 +5073,7 @@ TEST(LayerTreeHostCommonTest, HitTestingForNonClippingIntermediateLayer) {
|
| int dummy_max_texture_size = 512;
|
| LayerTreeHostCommon::CalculateDrawProperties(root.get(),
|
| root->bounds(),
|
| + gfx::Transform(),
|
| 1.f,
|
| 1.f,
|
| NULL,
|
| @@ -5074,6 +5192,7 @@ TEST(LayerTreeHostCommonTest, HitTestingForMultipleLayers) {
|
| int dummy_max_texture_size = 512;
|
| LayerTreeHostCommon::CalculateDrawProperties(root.get(),
|
| root->bounds(),
|
| + gfx::Transform(),
|
| 1.f,
|
| 1.f,
|
| NULL,
|
| @@ -5228,6 +5347,7 @@ TEST(LayerTreeHostCommonTest, HitTestingForMultipleLayerLists) {
|
| int dummy_max_texture_size = 512;
|
| LayerTreeHostCommon::CalculateDrawProperties(root.get(),
|
| root->bounds(),
|
| + gfx::Transform(),
|
| 1.f,
|
| 1.f,
|
| NULL,
|
| @@ -5346,6 +5466,7 @@ TEST(LayerTreeHostCommonTest, HitCheckingTouchHandlerRegionsForSingleLayer) {
|
| int dummy_max_texture_size = 512;
|
| LayerTreeHostCommon::CalculateDrawProperties(root.get(),
|
| root->bounds(),
|
| + gfx::Transform(),
|
| 1.f,
|
| 1.f,
|
| NULL,
|
| @@ -5444,6 +5565,7 @@ TEST(LayerTreeHostCommonTest,
|
| int dummy_max_texture_size = 512;
|
| LayerTreeHostCommon::CalculateDrawProperties(root.get(),
|
| root->bounds(),
|
| + gfx::Transform(),
|
| 1.f,
|
| 1.f,
|
| NULL,
|
| @@ -5532,6 +5654,7 @@ TEST(LayerTreeHostCommonTest,
|
| int dummy_max_texture_size = 512;
|
| LayerTreeHostCommon::CalculateDrawProperties(root.get(),
|
| root->bounds(),
|
| + gfx::Transform(),
|
| 1.f,
|
| 1.f,
|
| NULL,
|
| @@ -5638,6 +5761,7 @@ TEST(LayerTreeHostCommonTest,
|
| int dummy_max_texture_size = 512;
|
| LayerTreeHostCommon::CalculateDrawProperties(root.get(),
|
| root->bounds(),
|
| + gfx::Transform(),
|
| 1.f,
|
| 1.f,
|
| NULL,
|
| @@ -5751,6 +5875,7 @@ TEST(LayerTreeHostCommonTest,
|
| gfx::ScaleSize(root->bounds(), device_scale_factor * page_scale_factor));
|
| LayerTreeHostCommon::CalculateDrawProperties(root.get(),
|
| scaled_bounds_for_root,
|
| + gfx::Transform(),
|
| device_scale_factor,
|
| page_scale_factor,
|
| root.get(),
|
| @@ -5891,6 +6016,7 @@ TEST(LayerTreeHostCommonTest,
|
| int dummy_max_texture_size = 512;
|
| LayerTreeHostCommon::CalculateDrawProperties(root.get(),
|
| root->bounds(),
|
| + gfx::Transform(),
|
| 1.f,
|
| 1.f,
|
| NULL,
|
| @@ -6036,6 +6162,7 @@ TEST(LayerTreeHostCommonTest, LayerTransformsInHighDPI) {
|
|
|
| LayerTreeHostCommon::CalculateDrawProperties(parent.get(),
|
| parent->bounds(),
|
| + gfx::Transform(),
|
| device_scale_factor,
|
| page_scale_factor,
|
| parent.get(),
|
| @@ -6173,6 +6300,7 @@ TEST(LayerTreeHostCommonTest, SurfaceLayerTransformsInHighDPI) {
|
|
|
| LayerTreeHostCommon::CalculateDrawProperties(parent.get(),
|
| parent->bounds(),
|
| + gfx::Transform(),
|
| device_scale_factor,
|
| page_scale_factor,
|
| parent.get(),
|
| @@ -6273,6 +6401,7 @@ TEST(LayerTreeHostCommonTest,
|
|
|
| LayerTreeHostCommon::CalculateDrawProperties(parent.get(),
|
| parent->bounds(),
|
| + gfx::Transform(),
|
| device_scale_factor,
|
| page_scale_factor,
|
| parent.get(),
|
| @@ -6412,6 +6541,7 @@ TEST(LayerTreeHostCommonTest, ContentsScale) {
|
|
|
| LayerTreeHostCommon::CalculateDrawProperties(root.get(),
|
| root->bounds(),
|
| + gfx::Transform(),
|
| device_scale_factor,
|
| page_scale_factor,
|
| parent.get(),
|
| @@ -6454,6 +6584,7 @@ TEST(LayerTreeHostCommonTest, ContentsScale) {
|
| render_surface_layer_list.clear();
|
| LayerTreeHostCommon::CalculateDrawProperties(root.get(),
|
| root->bounds(),
|
| + gfx::Transform(),
|
| device_scale_factor,
|
| page_scale_factor,
|
| parent.get(),
|
| @@ -6482,6 +6613,7 @@ TEST(LayerTreeHostCommonTest, ContentsScale) {
|
| render_surface_layer_list.clear();
|
| LayerTreeHostCommon::CalculateDrawProperties(root.get(),
|
| root->bounds(),
|
| + gfx::Transform(),
|
| device_scale_factor,
|
| page_scale_factor,
|
| parent.get(),
|
| @@ -6507,6 +6639,7 @@ TEST(LayerTreeHostCommonTest, ContentsScale) {
|
| render_surface_layer_list.clear();
|
| LayerTreeHostCommon::CalculateDrawProperties(root.get(),
|
| root->bounds(),
|
| + gfx::Transform(),
|
| device_scale_factor,
|
| page_scale_factor,
|
| parent.get(),
|
| @@ -6595,6 +6728,7 @@ TEST(LayerTreeHostCommonTest,
|
| LayerTreeHostCommon::CalculateDrawProperties(
|
| root.get(),
|
| root->bounds(),
|
| + gfx::Transform(),
|
| device_scale_factor,
|
| page_scale_factor,
|
| parent.get(),
|
| @@ -6678,6 +6812,7 @@ TEST(LayerTreeHostCommonTest, SmallContentsScale) {
|
|
|
| LayerTreeHostCommon::CalculateDrawProperties(root.get(),
|
| root->bounds(),
|
| + gfx::Transform(),
|
| device_scale_factor,
|
| page_scale_factor,
|
| parent.get(),
|
| @@ -6703,6 +6838,7 @@ TEST(LayerTreeHostCommonTest, SmallContentsScale) {
|
| render_surface_layer_list.clear();
|
| LayerTreeHostCommon::CalculateDrawProperties(root.get(),
|
| root->bounds(),
|
| + gfx::Transform(),
|
| device_scale_factor,
|
| page_scale_factor,
|
| parent.get(),
|
| @@ -6824,6 +6960,7 @@ TEST(LayerTreeHostCommonTest, ContentsScaleForSurfaces) {
|
|
|
| LayerTreeHostCommon::CalculateDrawProperties(root.get(),
|
| root->bounds(),
|
| + gfx::Transform(),
|
| device_scale_factor,
|
| page_scale_factor,
|
| parent.get(),
|
| @@ -7039,6 +7176,7 @@ TEST(LayerTreeHostCommonTest,
|
| LayerTreeHostCommon::CalculateDrawProperties(
|
| root.get(),
|
| root->bounds(),
|
| + gfx::Transform(),
|
| device_scale_factor,
|
| page_scale_factor,
|
| parent.get(),
|
| @@ -7192,6 +7330,7 @@ TEST(LayerTreeHostCommonTest, ContentsScaleForAnimatingLayer) {
|
|
|
| LayerTreeHostCommon::CalculateDrawProperties(root.get(),
|
| root->bounds(),
|
| + gfx::Transform(),
|
| 1.f,
|
| 1.f,
|
| NULL,
|
| @@ -7210,6 +7349,7 @@ TEST(LayerTreeHostCommonTest, ContentsScaleForAnimatingLayer) {
|
|
|
| LayerTreeHostCommon::CalculateDrawProperties(root.get(),
|
| root->bounds(),
|
| + gfx::Transform(),
|
| 1.f,
|
| 1.f,
|
| NULL,
|
| @@ -7280,6 +7420,7 @@ TEST(LayerTreeHostCommonTest, RenderSurfaceTransformsInHighDPI) {
|
| float device_scale_factor = 1.5f;
|
| LayerTreeHostCommon::CalculateDrawProperties(parent.get(),
|
| parent->bounds(),
|
| + gfx::Transform(),
|
| device_scale_factor,
|
| 1.f,
|
| NULL,
|
| @@ -7417,6 +7558,7 @@ TEST(LayerTreeHostCommonTest,
|
| float device_scale_factor = 1.7f;
|
| LayerTreeHostCommon::CalculateDrawProperties(parent.get(),
|
| parent->bounds(),
|
| + gfx::Transform(),
|
| device_scale_factor,
|
| 1.f,
|
| NULL,
|
| @@ -7571,6 +7713,7 @@ TEST(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) {
|
| int dummy_max_texture_size = 512;
|
| LayerTreeHostCommon::CalculateDrawProperties(root.get(),
|
| root->bounds(),
|
| + gfx::Transform(),
|
| 1.f,
|
| 1.f,
|
| NULL,
|
|
|