| Index: cc/trees/layer_tree_impl_unittest.cc
|
| diff --git a/cc/trees/layer_tree_impl_unittest.cc b/cc/trees/layer_tree_impl_unittest.cc
|
| index ee02d66e888b9f3dfcfda6ebbb497283a3273341..73ee85624f85fdb2d2b2156913b4ca7e3c575d28 100644
|
| --- a/cc/trees/layer_tree_impl_unittest.cc
|
| +++ b/cc/trees/layer_tree_impl_unittest.cc
|
| @@ -68,12 +68,8 @@ TEST_F(LayerTreeImplTest, HitTestingForSingleLayer) {
|
| std::unique_ptr<LayerImpl> root =
|
| LayerImpl::Create(host_impl().active_tree(), 12345);
|
|
|
| - gfx::Transform identity_matrix;
|
| - gfx::Point3F transform_origin;
|
| - gfx::PointF position;
|
| gfx::Size bounds(100, 100);
|
| - SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
|
| - position, bounds, true, false, true);
|
| + root->SetBounds(bounds);
|
| root->SetDrawsContent(true);
|
|
|
| host_impl().SetViewportSize(root->bounds());
|
| @@ -128,12 +124,8 @@ TEST_F(LayerTreeImplTest, UpdateViewportAndHitTest) {
|
| std::unique_ptr<LayerImpl> root =
|
| LayerImpl::Create(host_impl->active_tree(), 12345);
|
|
|
| - gfx::Transform identity_matrix;
|
| - gfx::Point3F transform_origin;
|
| - gfx::PointF position;
|
| gfx::Size bounds(100, 100);
|
| - SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
|
| - position, bounds, true, false, true);
|
| + root->SetBounds(bounds);
|
| root->SetDrawsContent(true);
|
|
|
| host_impl->SetViewportSize(root->bounds());
|
| @@ -164,24 +156,16 @@ TEST_F(LayerTreeImplTest, HitTestingForSingleLayerAndHud) {
|
| std::unique_ptr<HeadsUpDisplayLayerImpl> hud =
|
| HeadsUpDisplayLayerImpl::Create(host_impl().active_tree(), 11111);
|
|
|
| - gfx::Transform identity_matrix;
|
| - gfx::Point3F transform_origin;
|
| - gfx::PointF position;
|
| - gfx::Size bounds(100, 100);
|
| - SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
|
| - position, bounds, true, false, true);
|
| + root->SetBounds(gfx::Size(100, 100));
|
| root->SetDrawsContent(true);
|
|
|
| // Create hud and add it as a child of root.
|
| - gfx::Size hud_bounds(200, 200);
|
| - SetLayerPropertiesForTesting(hud.get(), identity_matrix, transform_origin,
|
| - position, hud_bounds, true, false, false);
|
| + hud->SetBounds(gfx::Size(200, 200));
|
| hud->SetDrawsContent(true);
|
|
|
| + host_impl().SetViewportSize(hud->bounds());
|
| host_impl().active_tree()->set_hud_layer(hud.get());
|
| root->test_properties()->AddChild(std::move(hud));
|
| -
|
| - host_impl().SetViewportSize(hud_bounds);
|
| host_impl().active_tree()->SetRootLayerForTesting(std::move(root));
|
| host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
|
|
|
| @@ -226,13 +210,8 @@ TEST_F(LayerTreeImplTest, HitTestingForUninvertibleTransform) {
|
| uninvertible_transform.matrix().set(3, 3, 0.0);
|
| ASSERT_FALSE(uninvertible_transform.IsInvertible());
|
|
|
| - gfx::Transform identity_matrix;
|
| - gfx::Point3F transform_origin;
|
| - gfx::PointF position;
|
| - gfx::Size bounds(100, 100);
|
| - SetLayerPropertiesForTesting(root.get(), uninvertible_transform,
|
| - transform_origin, position, bounds, true, false,
|
| - true);
|
| + root->SetTransform(uninvertible_transform);
|
| + root->SetBounds(gfx::Size(100, 100));
|
| root->SetDrawsContent(true);
|
|
|
| host_impl().SetViewportSize(root->bounds());
|
| @@ -286,14 +265,10 @@ TEST_F(LayerTreeImplTest, HitTestingForSinglePositionedLayer) {
|
| std::unique_ptr<LayerImpl> root =
|
| LayerImpl::Create(host_impl().active_tree(), 12345);
|
|
|
| - gfx::Transform identity_matrix;
|
| - gfx::Point3F transform_origin;
|
| - // this layer is positioned, and hit testing should correctly know where the
|
| + // This layer is positioned, and hit testing should correctly know where the
|
| // layer is located.
|
| - gfx::PointF position(50.f, 50.f);
|
| - gfx::Size bounds(100, 100);
|
| - SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
|
| - position, bounds, true, false, true);
|
| + root->SetPosition(gfx::PointF(50.f, 50.f));
|
| + root->SetBounds(gfx::Size(100, 100));
|
| root->SetDrawsContent(true);
|
|
|
| host_impl().SetViewportSize(root->bounds());
|
| @@ -335,17 +310,13 @@ TEST_F(LayerTreeImplTest, HitTestingForSingleRotatedLayer) {
|
| std::unique_ptr<LayerImpl> root =
|
| LayerImpl::Create(host_impl().active_tree(), 12345);
|
|
|
| - gfx::Transform identity_matrix;
|
| gfx::Transform rotation45_degrees_about_center;
|
| rotation45_degrees_about_center.Translate(50.0, 50.0);
|
| rotation45_degrees_about_center.RotateAboutZAxis(45.0);
|
| rotation45_degrees_about_center.Translate(-50.0, -50.0);
|
| - gfx::Point3F transform_origin;
|
| - gfx::PointF position;
|
| - gfx::Size bounds(100, 100);
|
| - SetLayerPropertiesForTesting(root.get(), rotation45_degrees_about_center,
|
| - transform_origin, position, bounds, true, false,
|
| - true);
|
| +
|
| + root->SetTransform(rotation45_degrees_about_center);
|
| + root->SetBounds(gfx::Size(100, 100));
|
| root->SetDrawsContent(true);
|
|
|
| host_impl().SetViewportSize(root->bounds());
|
| @@ -392,40 +363,33 @@ TEST_F(LayerTreeImplTest, HitTestingForSingleRotatedLayer) {
|
| TEST_F(LayerTreeImplTest, HitTestingClipNodeDifferentTransformAndTargetIds) {
|
| // Tests hit testing on a layer whose clip node has different transform and
|
| // target id.
|
| - gfx::Transform identity_matrix;
|
| std::unique_ptr<LayerImpl> root =
|
| LayerImpl::Create(host_impl().active_tree(), 1);
|
| - SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(),
|
| - gfx::PointF(), gfx::Size(500, 500), true, false,
|
| - true);
|
| + root->SetBounds(gfx::Size(500, 500));
|
| +
|
| gfx::Transform translation;
|
| translation.Translate(100, 100);
|
| std::unique_ptr<LayerImpl> render_surface =
|
| LayerImpl::Create(host_impl().active_tree(), 2);
|
| - SetLayerPropertiesForTesting(render_surface.get(), translation,
|
| - gfx::Point3F(), gfx::PointF(),
|
| - gfx::Size(100, 100), true, false, true);
|
| + render_surface->SetTransform(translation);
|
| + render_surface->SetBounds(gfx::Size(100, 100));
|
| + render_surface->test_properties()->force_render_surface = true;
|
|
|
| gfx::Transform scale_matrix;
|
| scale_matrix.Scale(2, 2);
|
| std::unique_ptr<LayerImpl> scale =
|
| LayerImpl::Create(host_impl().active_tree(), 3);
|
| - SetLayerPropertiesForTesting(scale.get(), scale_matrix, gfx::Point3F(),
|
| - gfx::PointF(), gfx::Size(50, 50), true, false,
|
| - false);
|
| + scale->SetTransform(scale_matrix);
|
| + scale->SetBounds(gfx::Size(50, 50));
|
|
|
| std::unique_ptr<LayerImpl> clip =
|
| LayerImpl::Create(host_impl().active_tree(), 4);
|
| - SetLayerPropertiesForTesting(clip.get(), identity_matrix, gfx::Point3F(),
|
| - gfx::PointF(), gfx::Size(25, 25), true, false,
|
| - false);
|
| + clip->SetBounds(gfx::Size(25, 25));
|
| clip->SetMasksToBounds(true);
|
|
|
| std::unique_ptr<LayerImpl> test =
|
| LayerImpl::Create(host_impl().active_tree(), 5);
|
| - SetLayerPropertiesForTesting(test.get(), identity_matrix, gfx::Point3F(),
|
| - gfx::PointF(), gfx::Size(100, 100), true, false,
|
| - false);
|
| + test->SetBounds(gfx::Size(100, 100));
|
| test->SetDrawsContent(true);
|
|
|
| clip->test_properties()->AddChild(std::move(test));
|
| @@ -458,21 +422,15 @@ TEST_F(LayerTreeImplTest, HitTestingSiblings) {
|
| gfx::Transform identity_matrix;
|
| std::unique_ptr<LayerImpl> root =
|
| LayerImpl::Create(host_impl().active_tree(), 1);
|
| - SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(),
|
| - gfx::PointF(), gfx::Size(100, 100), true, false,
|
| - true);
|
| + root->SetBounds(gfx::Size(100, 100));
|
| std::unique_ptr<LayerImpl> child1 =
|
| LayerImpl::Create(host_impl().active_tree(), 2);
|
| - SetLayerPropertiesForTesting(child1.get(), identity_matrix, gfx::Point3F(),
|
| - gfx::PointF(), gfx::Size(25, 25), true, false,
|
| - false);
|
| + child1->SetBounds(gfx::Size(25, 25));
|
| child1->SetMasksToBounds(true);
|
| child1->SetDrawsContent(true);
|
| std::unique_ptr<LayerImpl> child2 =
|
| LayerImpl::Create(host_impl().active_tree(), 3);
|
| - SetLayerPropertiesForTesting(child2.get(), identity_matrix, gfx::Point3F(),
|
| - gfx::PointF(), gfx::Size(75, 75), true, false,
|
| - false);
|
| + child2->SetBounds(gfx::Size(75, 75));
|
| child2->SetMasksToBounds(true);
|
| child2->SetDrawsContent(true);
|
| root->test_properties()->AddChild(std::move(child1));
|
| @@ -497,15 +455,14 @@ TEST_F(LayerTreeImplTest, HitTestingPointOutsideMaxTextureSize) {
|
|
|
| std::unique_ptr<LayerImpl> root =
|
| LayerImpl::Create(host_impl().active_tree(), 1);
|
| - SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(),
|
| - gfx::PointF(), bounds, true, false, true);
|
| + root->SetBounds(bounds);
|
|
|
| std::unique_ptr<LayerImpl> surface =
|
| LayerImpl::Create(host_impl().active_tree(), 2);
|
| - SetLayerPropertiesForTesting(surface.get(), identity_matrix, gfx::Point3F(),
|
| - gfx::PointF(), bounds, true, false, true);
|
| + surface->SetBounds(bounds);
|
| surface->SetMasksToBounds(true);
|
| surface->SetDrawsContent(true);
|
| + surface->test_properties()->force_render_surface = true;
|
|
|
| root->test_properties()->AddChild(std::move(surface));
|
| host_impl().SetViewportSize(root->bounds());
|
| @@ -527,8 +484,6 @@ TEST_F(LayerTreeImplTest, HitTestingForSinglePerspectiveLayer) {
|
| std::unique_ptr<LayerImpl> root =
|
| LayerImpl::Create(host_impl().active_tree(), 12345);
|
|
|
| - gfx::Transform identity_matrix;
|
| -
|
| // perspective_projection_about_center * translation_by_z is designed so that
|
| // the 100 x 100 layer becomes 50 x 50, and remains centered at (50, 50).
|
| gfx::Transform perspective_projection_about_center;
|
| @@ -538,12 +493,8 @@ TEST_F(LayerTreeImplTest, HitTestingForSinglePerspectiveLayer) {
|
| gfx::Transform translation_by_z;
|
| translation_by_z.Translate3d(0.0, 0.0, -1.0);
|
|
|
| - gfx::Point3F transform_origin;
|
| - gfx::PointF position;
|
| - gfx::Size bounds(100, 100);
|
| - SetLayerPropertiesForTesting(
|
| - root.get(), perspective_projection_about_center * translation_by_z,
|
| - transform_origin, position, bounds, true, false, true);
|
| + root->SetTransform(perspective_projection_about_center * translation_by_z);
|
| + root->SetBounds(gfx::Size(100, 100));
|
| root->SetDrawsContent(true);
|
|
|
| host_impl().SetViewportSize(root->bounds());
|
| @@ -585,32 +536,22 @@ TEST_F(LayerTreeImplTest, HitTestingForSimpleClippedLayer) {
|
| // Test that hit-testing will only work for the visible portion of a layer,
|
| // and not the entire layer bounds. Here we just test the simple axis-aligned
|
| // case.
|
| - gfx::Transform identity_matrix;
|
| - gfx::Point3F transform_origin;
|
| -
|
| std::unique_ptr<LayerImpl> root =
|
| LayerImpl::Create(host_impl().active_tree(), 1);
|
| - SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
|
| - gfx::PointF(), gfx::Size(100, 100), true, false,
|
| - true);
|
| + root->SetBounds(gfx::Size(100, 100));
|
| {
|
| std::unique_ptr<LayerImpl> clipping_layer =
|
| LayerImpl::Create(host_impl().active_tree(), 123);
|
| // this layer is positioned, and hit testing should correctly know where the
|
| // layer is located.
|
| - gfx::PointF position(25.f, 25.f);
|
| - gfx::Size bounds(50, 50);
|
| - SetLayerPropertiesForTesting(clipping_layer.get(), identity_matrix,
|
| - transform_origin, position, bounds, true,
|
| - false, false);
|
| + clipping_layer->SetPosition(gfx::PointF(25.f, 25.f));
|
| + clipping_layer->SetBounds(gfx::Size(50, 50));
|
| clipping_layer->SetMasksToBounds(true);
|
|
|
| std::unique_ptr<LayerImpl> child =
|
| LayerImpl::Create(host_impl().active_tree(), 456);
|
| - position = gfx::PointF(-50.f, -50.f);
|
| - bounds = gfx::Size(300, 300);
|
| - SetLayerPropertiesForTesting(child.get(), identity_matrix, transform_origin,
|
| - position, bounds, true, false, false);
|
| + child->SetPosition(gfx::PointF(-50.f, -50.f));
|
| + child->SetBounds(gfx::Size(300, 300));
|
| child->SetDrawsContent(true);
|
| clipping_layer->test_properties()->AddChild(std::move(child));
|
| root->test_properties()->AddChild(std::move(clipping_layer));
|
| @@ -669,12 +610,7 @@ TEST_F(LayerTreeImplTest, HitTestingForMultiClippedRotatedLayer) {
|
| LayerImpl::Create(host_impl().active_tree(), 123);
|
| LayerImpl* root_layer = root.get();
|
|
|
| - gfx::Transform identity_matrix;
|
| - gfx::Point3F transform_origin;
|
| - gfx::PointF position;
|
| - gfx::Size bounds(100, 100);
|
| - SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
|
| - position, bounds, true, false, true);
|
| + root->SetBounds(gfx::Size(100, 100));
|
| root->SetMasksToBounds(true);
|
| {
|
| std::unique_ptr<LayerImpl> child =
|
| @@ -684,23 +620,18 @@ TEST_F(LayerTreeImplTest, HitTestingForMultiClippedRotatedLayer) {
|
| std::unique_ptr<LayerImpl> rotated_leaf =
|
| LayerImpl::Create(host_impl().active_tree(), 2468);
|
|
|
| - position = gfx::PointF(10.f, 10.f);
|
| - bounds = gfx::Size(80, 80);
|
| - SetLayerPropertiesForTesting(child.get(), identity_matrix, transform_origin,
|
| - position, bounds, true, false, false);
|
| + child->SetPosition(gfx::PointF(10.f, 10.f));
|
| + child->SetBounds(gfx::Size(80, 80));
|
| child->SetMasksToBounds(true);
|
|
|
| gfx::Transform rotation45_degrees_about_corner;
|
| rotation45_degrees_about_corner.RotateAboutZAxis(45.0);
|
|
|
| - // remember, positioned with respect to its parent which is already at 10,
|
| - // 10
|
| - position = gfx::PointF();
|
| - bounds =
|
| - gfx::Size(200, 200); // to ensure it covers at least sqrt(2) * 100.
|
| - SetLayerPropertiesForTesting(
|
| - grand_child.get(), rotation45_degrees_about_corner, transform_origin,
|
| - position, bounds, true, false, false);
|
| + // This is positioned with respect to its parent which is already at
|
| + // position (10, 10).
|
| + // The size is to ensure it covers at least sqrt(2) * 100.
|
| + grand_child->SetBounds(gfx::Size(200, 200));
|
| + grand_child->SetTransform(rotation45_degrees_about_corner);
|
| grand_child->SetMasksToBounds(true);
|
|
|
| // Rotates about the center of the layer
|
| @@ -712,11 +643,8 @@ TEST_F(LayerTreeImplTest, HitTestingForMultiClippedRotatedLayer) {
|
| rotated_leaf_transform.Translate(50.0, 50.0);
|
| rotated_leaf_transform.RotateAboutZAxis(45.0);
|
| rotated_leaf_transform.Translate(-50.0, -50.0);
|
| - position = gfx::PointF();
|
| - bounds = gfx::Size(100, 100);
|
| - SetLayerPropertiesForTesting(rotated_leaf.get(), rotated_leaf_transform,
|
| - transform_origin, position, bounds, true,
|
| - false, false);
|
| + rotated_leaf->SetBounds(gfx::Size(100, 100));
|
| + rotated_leaf->SetTransform(rotated_leaf_transform);
|
| rotated_leaf->SetDrawsContent(true);
|
|
|
| grand_child->test_properties()->AddChild(std::move(rotated_leaf));
|
| @@ -784,19 +712,14 @@ TEST_F(LayerTreeImplTest, HitTestingForNonClippingIntermediateLayer) {
|
|
|
| std::unique_ptr<LayerImpl> root =
|
| LayerImpl::Create(host_impl().active_tree(), 1);
|
| - SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
|
| - gfx::PointF(), gfx::Size(100, 100), true, false,
|
| - true);
|
| + root->SetBounds(gfx::Size(100, 100));
|
| {
|
| std::unique_ptr<LayerImpl> intermediate_layer =
|
| LayerImpl::Create(host_impl().active_tree(), 123);
|
| // this layer is positioned, and hit testing should correctly know where the
|
| // layer is located.
|
| - gfx::PointF position(10.f, 10.f);
|
| - gfx::Size bounds(50, 50);
|
| - SetLayerPropertiesForTesting(intermediate_layer.get(), identity_matrix,
|
| - transform_origin, position, bounds, true,
|
| - false, false);
|
| + intermediate_layer->SetPosition(gfx::PointF(10.f, 10.f));
|
| + intermediate_layer->SetBounds(gfx::Size(50, 50));
|
| // Sanity check the intermediate layer should not clip.
|
| ASSERT_FALSE(intermediate_layer->masks_to_bounds());
|
| ASSERT_FALSE(intermediate_layer->test_properties()->mask_layer);
|
| @@ -806,10 +729,8 @@ TEST_F(LayerTreeImplTest, HitTestingForNonClippingIntermediateLayer) {
|
| // would not be able to hit it successfully.
|
| std::unique_ptr<LayerImpl> child =
|
| LayerImpl::Create(host_impl().active_tree(), 456);
|
| - position = gfx::PointF(60.f, 60.f); // 70, 70 in screen space
|
| - bounds = gfx::Size(20, 20);
|
| - SetLayerPropertiesForTesting(child.get(), identity_matrix, transform_origin,
|
| - position, bounds, true, false, false);
|
| + child->SetPosition(gfx::PointF(60.f, 60.f)); // 70, 70 in screen space
|
| + child->SetBounds(gfx::Size(20, 20));
|
| child->SetDrawsContent(true);
|
| intermediate_layer->test_properties()->AddChild(std::move(child));
|
| root->test_properties()->AddChild(std::move(intermediate_layer));
|
| @@ -854,12 +775,7 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayers) {
|
| LayerImpl::Create(host_impl().active_tree(), 1);
|
| LayerImpl* root_layer = root.get();
|
|
|
| - gfx::Transform identity_matrix;
|
| - gfx::Point3F transform_origin;
|
| - gfx::PointF position;
|
| - gfx::Size bounds(100, 100);
|
| - SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
|
| - position, bounds, true, false, true);
|
| + root->SetBounds(gfx::Size(100, 100));
|
| root->SetDrawsContent(true);
|
| {
|
| // child 1 and child2 are initialized to overlap between x=50 and x=60.
|
| @@ -875,28 +791,19 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayers) {
|
| std::unique_ptr<LayerImpl> grand_child1 =
|
| LayerImpl::Create(host_impl().active_tree(), 4);
|
|
|
| - position = gfx::PointF(10.f, 10.f);
|
| - bounds = gfx::Size(50, 50);
|
| - SetLayerPropertiesForTesting(child1.get(), identity_matrix,
|
| - transform_origin, position, bounds, true,
|
| - false, false);
|
| + child1->SetPosition(gfx::PointF(10.f, 10.f));
|
| + child1->SetBounds(gfx::Size(50, 50));
|
| child1->SetDrawsContent(true);
|
|
|
| - position = gfx::PointF(50.f, 10.f);
|
| - bounds = gfx::Size(50, 50);
|
| - SetLayerPropertiesForTesting(child2.get(), identity_matrix,
|
| - transform_origin, position, bounds, true,
|
| - false, false);
|
| + child2->SetPosition(gfx::PointF(50.f, 10.f));
|
| + child2->SetBounds(gfx::Size(50, 50));
|
| child2->SetDrawsContent(true);
|
|
|
| // Remember that grand_child is positioned with respect to its parent (i.e.
|
| // child1). In screen space, the intended position is (10, 50), with size
|
| // 100 x 50.
|
| - position = gfx::PointF(0.f, 40.f);
|
| - bounds = gfx::Size(100, 50);
|
| - SetLayerPropertiesForTesting(grand_child1.get(), identity_matrix,
|
| - transform_origin, position, bounds, true,
|
| - false, false);
|
| + grand_child1->SetPosition(gfx::PointF(0.f, 40.f));
|
| + grand_child1->SetBounds(gfx::Size(100, 50));
|
| grand_child1->SetDrawsContent(true);
|
|
|
| child1->test_properties()->AddChild(std::move(grand_child1));
|
| @@ -991,32 +898,29 @@ int LayerTreeImplTest::HitTestSimpleTree(int root_id,
|
| std::unique_ptr<LayerImpl> right_child =
|
| LayerImpl::Create(host_impl().active_tree(), right_child_id);
|
|
|
| - gfx::Point3F transform_origin;
|
| - gfx::PointF position;
|
| gfx::Size bounds(100, 100);
|
| {
|
| gfx::Transform translate_z;
|
| translate_z.Translate3d(0, 0, root_depth);
|
| - SetLayerPropertiesForTesting(root.get(), translate_z, transform_origin,
|
| - position, bounds, false, false, true);
|
| + root->SetTransform(translate_z);
|
| + root->SetBounds(bounds);
|
| root->SetDrawsContent(true);
|
| root->Set3dSortingContextId(root_sorting_context);
|
| }
|
| {
|
| gfx::Transform translate_z;
|
| translate_z.Translate3d(0, 0, left_child_depth);
|
| - SetLayerPropertiesForTesting(left_child.get(), translate_z,
|
| - transform_origin, position, bounds, false,
|
| - false, false);
|
| + left_child->SetTransform(translate_z);
|
| + left_child->SetBounds(bounds);
|
| left_child->SetDrawsContent(true);
|
| left_child->Set3dSortingContextId(left_child_sorting_context);
|
| + left_child->test_properties()->should_flatten_transform = false;
|
| }
|
| {
|
| gfx::Transform translate_z;
|
| translate_z.Translate3d(0, 0, right_child_depth);
|
| - SetLayerPropertiesForTesting(right_child.get(), translate_z,
|
| - transform_origin, position, bounds, false,
|
| - false, false);
|
| + right_child->SetTransform(translate_z);
|
| + right_child->SetBounds(bounds);
|
| right_child->SetDrawsContent(true);
|
| right_child->Set3dSortingContextId(right_child_sorting_context);
|
| }
|
| @@ -1077,12 +981,7 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayersAtVaryingDepths) {
|
| std::unique_ptr<LayerImpl> root =
|
| LayerImpl::Create(host_impl().active_tree(), 1);
|
|
|
| - gfx::Transform identity_matrix;
|
| - gfx::Point3F transform_origin;
|
| - gfx::PointF position;
|
| - gfx::Size bounds(100, 100);
|
| - SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
|
| - position, bounds, true, false, true);
|
| + root->SetBounds(gfx::Size(100, 100));
|
| root->SetDrawsContent(true);
|
| root->test_properties()->should_flatten_transform = false;
|
| root->Set3dSortingContextId(1);
|
| @@ -1100,21 +999,17 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayersAtVaryingDepths) {
|
| std::unique_ptr<LayerImpl> grand_child1 =
|
| LayerImpl::Create(host_impl().active_tree(), 4);
|
|
|
| - position = gfx::PointF(10.f, 10.f);
|
| - bounds = gfx::Size(50, 50);
|
| - SetLayerPropertiesForTesting(child1.get(), identity_matrix,
|
| - transform_origin, position, bounds, true,
|
| - false, false);
|
| + child1->SetPosition(gfx::PointF(10.f, 10.f));
|
| + child1->SetBounds(gfx::Size(50, 50));
|
| child1->SetDrawsContent(true);
|
| child1->test_properties()->should_flatten_transform = false;
|
| child1->Set3dSortingContextId(1);
|
|
|
| - position = gfx::PointF(50.f, 10.f);
|
| - bounds = gfx::Size(50, 50);
|
| + child2->SetPosition(gfx::PointF(50.f, 10.f));
|
| + child2->SetBounds(gfx::Size(50, 50));
|
| gfx::Transform translate_z;
|
| translate_z.Translate3d(0, 0, 10.f);
|
| - SetLayerPropertiesForTesting(child2.get(), translate_z, transform_origin,
|
| - position, bounds, true, false, false);
|
| + child2->SetTransform(translate_z);
|
| child2->SetDrawsContent(true);
|
| child2->test_properties()->should_flatten_transform = false;
|
| child2->Set3dSortingContextId(1);
|
| @@ -1122,11 +1017,8 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayersAtVaryingDepths) {
|
| // Remember that grand_child is positioned with respect to its parent (i.e.
|
| // child1). In screen space, the intended position is (10, 50), with size
|
| // 100 x 50.
|
| - position = gfx::PointF(0.f, 40.f);
|
| - bounds = gfx::Size(100, 50);
|
| - SetLayerPropertiesForTesting(grand_child1.get(), identity_matrix,
|
| - transform_origin, position, bounds, true,
|
| - false, false);
|
| + grand_child1->SetPosition(gfx::PointF(0.f, 40.f));
|
| + grand_child1->SetBounds(gfx::Size(100, 50));
|
| grand_child1->SetDrawsContent(true);
|
| grand_child1->test_properties()->should_flatten_transform = false;
|
|
|
| @@ -1201,12 +1093,8 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayersAtVaryingDepths) {
|
| TEST_F(LayerTreeImplTest, HitTestingRespectsClipParents) {
|
| std::unique_ptr<LayerImpl> root =
|
| LayerImpl::Create(host_impl().active_tree(), 1);
|
| - gfx::Transform identity_matrix;
|
| - gfx::Point3F transform_origin;
|
| - gfx::PointF position;
|
| - gfx::Size bounds(100, 100);
|
| - SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
|
| - position, bounds, true, false, true);
|
| +
|
| + root->SetBounds(gfx::Size(100, 100));
|
| root->SetDrawsContent(true);
|
| {
|
| std::unique_ptr<LayerImpl> child =
|
| @@ -1214,18 +1102,13 @@ TEST_F(LayerTreeImplTest, HitTestingRespectsClipParents) {
|
| std::unique_ptr<LayerImpl> grand_child =
|
| LayerImpl::Create(host_impl().active_tree(), 4);
|
|
|
| - position = gfx::PointF(10.f, 10.f);
|
| - bounds = gfx::Size(1, 1);
|
| - SetLayerPropertiesForTesting(child.get(), identity_matrix, transform_origin,
|
| - position, bounds, true, false, false);
|
| + child->SetPosition(gfx::PointF(10.f, 10.f));
|
| + child->SetBounds(gfx::Size(1, 1));
|
| child->SetDrawsContent(true);
|
| child->SetMasksToBounds(true);
|
|
|
| - position = gfx::PointF(0.f, 40.f);
|
| - bounds = gfx::Size(100, 50);
|
| - SetLayerPropertiesForTesting(grand_child.get(), identity_matrix,
|
| - transform_origin, position, bounds, true,
|
| - false, false);
|
| + grand_child->SetPosition(gfx::PointF(0.f, 40.f));
|
| + grand_child->SetBounds(gfx::Size(100, 50));
|
| grand_child->SetDrawsContent(true);
|
| grand_child->SetHasRenderSurface(true);
|
|
|
| @@ -1254,12 +1137,7 @@ TEST_F(LayerTreeImplTest, HitTestingRespectsClipParents) {
|
| TEST_F(LayerTreeImplTest, HitTestingRespectsScrollParents) {
|
| std::unique_ptr<LayerImpl> root =
|
| LayerImpl::Create(host_impl().active_tree(), 1);
|
| - gfx::Transform identity_matrix;
|
| - gfx::Point3F transform_origin;
|
| - gfx::PointF position;
|
| - gfx::Size bounds(100, 100);
|
| - SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
|
| - position, bounds, true, false, true);
|
| + root->SetBounds(gfx::Size(100, 100));
|
| root->SetDrawsContent(true);
|
| {
|
| std::unique_ptr<LayerImpl> child =
|
| @@ -1269,31 +1147,22 @@ TEST_F(LayerTreeImplTest, HitTestingRespectsScrollParents) {
|
| std::unique_ptr<LayerImpl> grand_child =
|
| LayerImpl::Create(host_impl().active_tree(), 4);
|
|
|
| - position = gfx::PointF(10.f, 10.f);
|
| - bounds = gfx::Size(1, 1);
|
| - SetLayerPropertiesForTesting(child.get(), identity_matrix, transform_origin,
|
| - position, bounds, true, false, false);
|
| + child->SetPosition(gfx::PointF(10.f, 10.f));
|
| + child->SetBounds(gfx::Size(1, 1));
|
| child->SetDrawsContent(true);
|
| child->SetMasksToBounds(true);
|
|
|
| - position = gfx::PointF();
|
| - bounds = gfx::Size(200, 200);
|
| - SetLayerPropertiesForTesting(scroll_child.get(), identity_matrix,
|
| - transform_origin, position, bounds, true,
|
| - false, false);
|
| + scroll_child->SetBounds(gfx::Size(200, 200));
|
| scroll_child->SetDrawsContent(true);
|
|
|
| // This should cause scroll child and its descendants to be affected by
|
| // |child|'s clip.
|
| scroll_child->test_properties()->scroll_parent = child.get();
|
| - std::unique_ptr<std::set<LayerImpl*>> scroll_children(
|
| - new std::set<LayerImpl*>);
|
| - scroll_children->insert(scroll_child.get());
|
| - child->test_properties()->scroll_children.reset(scroll_children.release());
|
| + child->test_properties()->scroll_children =
|
| + base::MakeUnique<std::set<LayerImpl*>>();
|
| + child->test_properties()->scroll_children->insert(scroll_child.get());
|
|
|
| - SetLayerPropertiesForTesting(grand_child.get(), identity_matrix,
|
| - transform_origin, position, bounds, true,
|
| - false, false);
|
| + grand_child->SetBounds(gfx::Size(200, 200));
|
| grand_child->SetDrawsContent(true);
|
| grand_child->SetHasRenderSurface(true);
|
|
|
| @@ -1323,12 +1192,7 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayerLists) {
|
| LayerImpl::Create(host_impl().active_tree(), 1);
|
| LayerImpl* root_layer = root.get();
|
|
|
| - gfx::Transform identity_matrix;
|
| - gfx::Point3F transform_origin;
|
| - gfx::PointF position;
|
| - gfx::Size bounds(100, 100);
|
| - SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
|
| - position, bounds, true, false, true);
|
| + root->SetBounds(gfx::Size(100, 100));
|
| root->SetDrawsContent(true);
|
| {
|
| // child 1 and child2 are initialized to overlap between x=50 and x=60.
|
| @@ -1344,30 +1208,21 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayerLists) {
|
| std::unique_ptr<LayerImpl> grand_child1 =
|
| LayerImpl::Create(host_impl().active_tree(), 4);
|
|
|
| - position = gfx::PointF(10.f, 10.f);
|
| - bounds = gfx::Size(50, 50);
|
| - SetLayerPropertiesForTesting(child1.get(), identity_matrix,
|
| - transform_origin, position, bounds, true,
|
| - false, false);
|
| + child1->SetPosition(gfx::PointF(10.f, 10.f));
|
| + child1->SetBounds(gfx::Size(50, 50));
|
| child1->SetDrawsContent(true);
|
| child1->test_properties()->force_render_surface = true;
|
|
|
| - position = gfx::PointF(50.f, 10.f);
|
| - bounds = gfx::Size(50, 50);
|
| - SetLayerPropertiesForTesting(child2.get(), identity_matrix,
|
| - transform_origin, position, bounds, true,
|
| - false, false);
|
| + child2->SetPosition(gfx::PointF(50.f, 10.f));
|
| + child2->SetBounds(gfx::Size(50, 50));
|
| child2->SetDrawsContent(true);
|
| child2->test_properties()->force_render_surface = true;
|
|
|
| // Remember that grand_child is positioned with respect to its parent (i.e.
|
| // child1). In screen space, the intended position is (10, 50), with size
|
| // 100 x 50.
|
| - position = gfx::PointF(0.f, 40.f);
|
| - bounds = gfx::Size(100, 50);
|
| - SetLayerPropertiesForTesting(grand_child1.get(), identity_matrix,
|
| - transform_origin, position, bounds, true,
|
| - false, false);
|
| + grand_child1->SetPosition(gfx::PointF(0.f, 40.f));
|
| + grand_child1->SetBounds(gfx::Size(100, 50));
|
| grand_child1->SetDrawsContent(true);
|
| grand_child1->test_properties()->force_render_surface = true;
|
|
|
| @@ -1458,13 +1313,9 @@ TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerRegionsForSingleLayer) {
|
| std::unique_ptr<LayerImpl> root =
|
| LayerImpl::Create(host_impl().active_tree(), 12345);
|
|
|
| - gfx::Transform identity_matrix;
|
| Region touch_handler_region(gfx::Rect(10, 10, 50, 50));
|
| - gfx::Point3F transform_origin;
|
| - gfx::PointF position;
|
| - gfx::Size bounds(100, 100);
|
| - SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
|
| - position, bounds, true, false, true);
|
| +
|
| + root->SetBounds(gfx::Size(100, 100));
|
| root->SetDrawsContent(true);
|
|
|
| host_impl().SetViewportSize(root->bounds());
|
| @@ -1543,14 +1394,10 @@ TEST_F(LayerTreeImplTest,
|
| uninvertible_transform.matrix().set(3, 3, 0.0);
|
| ASSERT_FALSE(uninvertible_transform.IsInvertible());
|
|
|
| - gfx::Transform identity_matrix;
|
| Region touch_handler_region(gfx::Rect(10, 10, 50, 50));
|
| - gfx::Point3F transform_origin;
|
| - gfx::PointF position;
|
| - gfx::Size bounds(100, 100);
|
| - SetLayerPropertiesForTesting(root.get(), uninvertible_transform,
|
| - transform_origin, position, bounds, true, false,
|
| - true);
|
| +
|
| + root->SetTransform(uninvertible_transform);
|
| + root->SetBounds(gfx::Size(100, 100));
|
| root->SetDrawsContent(true);
|
| root->SetTouchEventHandlerRegion(touch_handler_region);
|
|
|
| @@ -1615,15 +1462,11 @@ TEST_F(LayerTreeImplTest,
|
| std::unique_ptr<LayerImpl> root =
|
| LayerImpl::Create(host_impl().active_tree(), 12345);
|
|
|
| - gfx::Transform identity_matrix;
|
| Region touch_handler_region(gfx::Rect(10, 10, 50, 50));
|
| - gfx::Point3F transform_origin;
|
| - // this layer is positioned, and hit testing should correctly know where the
|
| + // This layer is positioned, and hit testing should correctly know where the
|
| // layer is located.
|
| - gfx::PointF position(50.f, 50.f);
|
| - gfx::Size bounds(100, 100);
|
| - SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
|
| - position, bounds, true, false, true);
|
| + root->SetPosition(gfx::PointF(50.f, 50.f));
|
| + root->SetBounds(gfx::Size(100, 100));
|
| root->SetDrawsContent(true);
|
| root->SetTouchEventHandlerRegion(touch_handler_region);
|
|
|
| @@ -1683,22 +1526,16 @@ TEST_F(LayerTreeImplTest,
|
| std::unique_ptr<LayerImpl> root =
|
| LayerImpl::Create(host_impl().active_tree(), 1);
|
|
|
| - gfx::Transform identity_matrix;
|
| - gfx::Point3F transform_origin;
|
| // Set the bounds of the root layer big enough to fit the child when scaled.
|
| - SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
|
| - gfx::PointF(), gfx::Size(100, 100), true, false,
|
| - true);
|
| + root->SetBounds(gfx::Size(100, 100));
|
| {
|
| Region touch_handler_region(gfx::Rect(10, 10, 30, 30));
|
| gfx::PointF position(25.f, 25.f);
|
| gfx::Size bounds(50, 50);
|
| std::unique_ptr<LayerImpl> test_layer =
|
| LayerImpl::Create(host_impl().active_tree(), 12345);
|
| - SetLayerPropertiesForTesting(test_layer.get(), identity_matrix,
|
| - transform_origin, position, bounds, true,
|
| - false, false);
|
| -
|
| + test_layer->SetPosition(gfx::PointF(25.f, 25.f));
|
| + test_layer->SetBounds(gfx::Size(50, 50));
|
| test_layer->SetDrawsContent(true);
|
| test_layer->SetTouchEventHandlerRegion(touch_handler_region);
|
| root->test_properties()->AddChild(std::move(test_layer));
|
| @@ -1830,33 +1667,24 @@ TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerRegionsForSimpleClippedLayer) {
|
| // Test that hit-checking will only work for the visible portion of a layer,
|
| // and not the entire layer bounds. Here we just test the simple axis-aligned
|
| // case.
|
| - gfx::Transform identity_matrix;
|
| - gfx::Point3F transform_origin;
|
| -
|
| std::unique_ptr<LayerImpl> root =
|
| LayerImpl::Create(host_impl().active_tree(), 1);
|
| - SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
|
| - gfx::PointF(), gfx::Size(100, 100), true, false,
|
| - true);
|
| + root->SetBounds(gfx::Size(100, 100));
|
| {
|
| std::unique_ptr<LayerImpl> clipping_layer =
|
| LayerImpl::Create(host_impl().active_tree(), 123);
|
| // this layer is positioned, and hit testing should correctly know where the
|
| // layer is located.
|
| - gfx::PointF position(25.f, 25.f);
|
| - gfx::Size bounds(50, 50);
|
| - SetLayerPropertiesForTesting(clipping_layer.get(), identity_matrix,
|
| - transform_origin, position, bounds, true,
|
| - false, false);
|
| + clipping_layer->SetPosition(gfx::PointF(25.f, 25.f));
|
| + clipping_layer->SetBounds(gfx::Size(50, 50));
|
| clipping_layer->SetMasksToBounds(true);
|
|
|
| + Region touch_handler_region(gfx::Rect(10, 10, 50, 50));
|
| +
|
| std::unique_ptr<LayerImpl> child =
|
| LayerImpl::Create(host_impl().active_tree(), 456);
|
| - Region touch_handler_region(gfx::Rect(10, 10, 50, 50));
|
| - position = gfx::PointF(-50.f, -50.f);
|
| - bounds = gfx::Size(300, 300);
|
| - SetLayerPropertiesForTesting(child.get(), identity_matrix, transform_origin,
|
| - position, bounds, true, false, false);
|
| + child->SetPosition(gfx::PointF(-50.f, -50.f));
|
| + child->SetBounds(gfx::Size(300, 300));
|
| child->SetDrawsContent(true);
|
| child->SetTouchEventHandlerRegion(touch_handler_region);
|
| clipping_layer->test_properties()->AddChild(std::move(child));
|
| @@ -1919,37 +1747,27 @@ TEST_F(LayerTreeImplTest,
|
| // scaling the points accordingly.
|
| std::unique_ptr<LayerImpl> root =
|
| LayerImpl::Create(host_impl().active_tree(), 1);
|
| -
|
| - gfx::Transform identity_matrix;
|
| - gfx::Point3F transform_origin;
|
| // Set the bounds of the root layer big enough to fit the child when scaled.
|
| - SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
|
| - gfx::PointF(), gfx::Size(100, 100), true, false,
|
| - true);
|
| + root->SetBounds(gfx::Size(100, 100));
|
| std::unique_ptr<LayerImpl> surface =
|
| LayerImpl::Create(host_impl().active_tree(), 2);
|
| - SetLayerPropertiesForTesting(surface.get(), identity_matrix, transform_origin,
|
| - gfx::PointF(), gfx::Size(100, 100), true, false,
|
| - true);
|
| + surface->SetBounds(gfx::Size(100, 100));
|
| + surface->test_properties()->force_render_surface = true;
|
| {
|
| std::unique_ptr<LayerImpl> clipping_layer =
|
| LayerImpl::Create(host_impl().active_tree(), 123);
|
| // This layer is positioned, and hit testing should correctly know where the
|
| // layer is located.
|
| - gfx::PointF position(25.f, 20.f);
|
| - gfx::Size bounds(50, 50);
|
| - SetLayerPropertiesForTesting(clipping_layer.get(), identity_matrix,
|
| - transform_origin, position, bounds, true,
|
| - false, false);
|
| + clipping_layer->SetPosition(gfx::PointF(25.f, 20.f));
|
| + clipping_layer->SetBounds(gfx::Size(50, 50));
|
| clipping_layer->SetMasksToBounds(true);
|
|
|
| + Region touch_handler_region(gfx::Rect(0, 0, 300, 300));
|
| +
|
| std::unique_ptr<LayerImpl> child =
|
| LayerImpl::Create(host_impl().active_tree(), 456);
|
| - Region touch_handler_region(gfx::Rect(0, 0, 300, 300));
|
| - position = gfx::PointF(-50.f, -50.f);
|
| - bounds = gfx::Size(300, 300);
|
| - SetLayerPropertiesForTesting(child.get(), identity_matrix, transform_origin,
|
| - position, bounds, true, false, false);
|
| + child->SetPosition(gfx::PointF(-50.f, -50.f));
|
| + child->SetBounds(gfx::Size(300, 300));
|
| child->SetDrawsContent(true);
|
| child->SetTouchEventHandlerRegion(touch_handler_region);
|
| clipping_layer->test_properties()->AddChild(std::move(child));
|
| @@ -2006,19 +1824,13 @@ TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerOverlappingRegions) {
|
|
|
| std::unique_ptr<LayerImpl> root =
|
| LayerImpl::Create(host_impl().active_tree(), 1);
|
| - SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
|
| - gfx::PointF(), gfx::Size(100, 100), true, false,
|
| - true);
|
| + root->SetBounds(gfx::Size(100, 100));
|
| {
|
| std::unique_ptr<LayerImpl> touch_layer =
|
| LayerImpl::Create(host_impl().active_tree(), 123);
|
| // this layer is positioned, and hit testing should correctly know where the
|
| // layer is located.
|
| - gfx::PointF position;
|
| - gfx::Size bounds(50, 50);
|
| - SetLayerPropertiesForTesting(touch_layer.get(), identity_matrix,
|
| - transform_origin, position, bounds, true,
|
| - false, false);
|
| + touch_layer->SetBounds(gfx::Size(50, 50));
|
| touch_layer->SetDrawsContent(true);
|
| touch_layer->SetTouchEventHandlerRegion(gfx::Rect(0, 0, 50, 50));
|
| root->test_properties()->AddChild(std::move(touch_layer));
|
| @@ -2029,11 +1841,8 @@ TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerOverlappingRegions) {
|
| LayerImpl::Create(host_impl().active_tree(), 1234);
|
| // this layer is positioned, and hit testing should correctly know where the
|
| // layer is located.
|
| - gfx::PointF position(0, 25);
|
| - gfx::Size bounds(50, 50);
|
| - SetLayerPropertiesForTesting(notouch_layer.get(), identity_matrix,
|
| - transform_origin, position, bounds, true,
|
| - false, false);
|
| + notouch_layer->SetPosition(gfx::PointF(0, 25));
|
| + notouch_layer->SetBounds(gfx::Size(50, 50));
|
| notouch_layer->SetDrawsContent(true);
|
| root->test_properties()->AddChild(std::move(notouch_layer));
|
| }
|
| @@ -2085,23 +1894,13 @@ TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerOverlappingRegions) {
|
| TEST_F(LayerTreeImplTest, HitTestingTouchHandlerRegionsForLayerThatIsNotDrawn) {
|
| std::unique_ptr<LayerImpl> root =
|
| LayerImpl::Create(host_impl().active_tree(), 1);
|
| -
|
| - gfx::Transform identity_matrix;
|
| - gfx::Point3F transform_origin;
|
| - SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
|
| - gfx::PointF(), gfx::Size(100, 100), true, false,
|
| - true);
|
| + root->SetBounds(gfx::Size(100, 100));
|
| root->SetDrawsContent(true);
|
| {
|
| Region touch_handler_region(gfx::Rect(10, 10, 30, 30));
|
| - gfx::PointF position;
|
| - gfx::Size bounds(50, 50);
|
| std::unique_ptr<LayerImpl> test_layer =
|
| LayerImpl::Create(host_impl().active_tree(), 12345);
|
| - SetLayerPropertiesForTesting(test_layer.get(), identity_matrix,
|
| - transform_origin, position, bounds, true,
|
| - false, false);
|
| -
|
| + test_layer->SetBounds(gfx::Size(50, 50));
|
| test_layer->SetDrawsContent(false);
|
| test_layer->SetTouchEventHandlerRegion(touch_handler_region);
|
| root->test_properties()->AddChild(std::move(test_layer));
|
| @@ -2174,13 +1973,7 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForSingleLayer) {
|
| int root_layer_id = 12345;
|
| std::unique_ptr<LayerImpl> root =
|
| LayerImpl::Create(host_impl().active_tree(), root_layer_id);
|
| -
|
| - gfx::Transform identity_matrix;
|
| - gfx::Point3F transform_origin;
|
| - gfx::PointF position;
|
| - gfx::Size bounds(100, 100);
|
| - SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
|
| - position, bounds, true, false, true);
|
| + root->SetBounds(gfx::Size(100, 100));
|
| root->SetDrawsContent(true);
|
|
|
| host_impl().SetViewportSize(root->bounds());
|
| @@ -2255,33 +2048,20 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForPartialOccludedLayers) {
|
| std::unique_ptr<LayerImpl> root =
|
| LayerImpl::Create(host_impl().active_tree(), root_layer_id);
|
| root->SetDrawsContent(true);
|
| -
|
| - gfx::Transform identity_matrix;
|
| - gfx::Point3F transform_origin;
|
| - gfx::PointF position;
|
| - gfx::Size bounds(100, 100);
|
| - SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
|
| - position, bounds, true, false, true);
|
| + root->SetBounds(gfx::Size(100, 100));
|
|
|
| gfx::Vector2dF clipping_offset(10, 10);
|
| {
|
| std::unique_ptr<LayerImpl> clipping_layer =
|
| LayerImpl::Create(host_impl().active_tree(), clip_layer_id);
|
| // The clipping layer should occlude the right selection bound.
|
| - gfx::PointF position = gfx::PointF() + clipping_offset;
|
| - gfx::Size bounds(50, 50);
|
| - SetLayerPropertiesForTesting(clipping_layer.get(), identity_matrix,
|
| - transform_origin, position, bounds, true,
|
| - false, false);
|
| + clipping_layer->SetPosition(gfx::PointF() + clipping_offset);
|
| + clipping_layer->SetBounds(gfx::Size(50, 50));
|
| clipping_layer->SetMasksToBounds(true);
|
|
|
| std::unique_ptr<LayerImpl> clipped_layer =
|
| LayerImpl::Create(host_impl().active_tree(), clipped_layer_id);
|
| - position = gfx::PointF();
|
| - bounds = gfx::Size(100, 100);
|
| - SetLayerPropertiesForTesting(clipped_layer.get(), identity_matrix,
|
| - transform_origin, position, bounds, true,
|
| - false, false);
|
| + clipped_layer->SetBounds(gfx::Size(100, 100));
|
| clipped_layer->SetDrawsContent(true);
|
| clipping_layer->test_properties()->AddChild(std::move(clipped_layer));
|
| root->test_properties()->AddChild(std::move(clipping_layer));
|
| @@ -2353,23 +2133,14 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForScaledLayers) {
|
| std::unique_ptr<LayerImpl> root =
|
| LayerImpl::Create(host_impl().active_tree(), root_layer_id);
|
| root->SetDrawsContent(true);
|
| -
|
| - gfx::Transform identity_matrix;
|
| - gfx::Point3F transform_origin;
|
| - gfx::PointF position;
|
| - gfx::Size bounds(100, 100);
|
| - SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
|
| - position, bounds, true, false, true);
|
| + root->SetBounds(gfx::Size(100, 100));
|
|
|
| gfx::Vector2dF sub_layer_offset(10, 0);
|
| {
|
| std::unique_ptr<LayerImpl> sub_layer =
|
| LayerImpl::Create(host_impl().active_tree(), sub_layer_id);
|
| - gfx::PointF position = gfx::PointF() + sub_layer_offset;
|
| - gfx::Size bounds(50, 50);
|
| - SetLayerPropertiesForTesting(sub_layer.get(), identity_matrix,
|
| - transform_origin, position, bounds, true,
|
| - false, false);
|
| + sub_layer->SetPosition(gfx::PointF() + sub_layer_offset);
|
| + sub_layer->SetBounds(gfx::Size(50, 50));
|
| sub_layer->SetDrawsContent(true);
|
| root->test_properties()->AddChild(std::move(sub_layer));
|
| }
|
| @@ -2438,13 +2209,7 @@ TEST_F(LayerTreeImplTest, SelectionBoundsWithLargeTransforms) {
|
|
|
| std::unique_ptr<LayerImpl> root =
|
| LayerImpl::Create(host_impl().active_tree(), root_id);
|
| - gfx::Size bounds(100, 100);
|
| - gfx::Transform identity_matrix;
|
| - gfx::Point3F transform_origin;
|
| - gfx::PointF position;
|
| -
|
| - SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
|
| - position, bounds, true, false, true);
|
| + root->SetBounds(gfx::Size(100, 100));
|
|
|
| gfx::Transform large_transform;
|
| large_transform.Scale(SkDoubleToMScalar(1e37), SkDoubleToMScalar(1e37));
|
| @@ -2453,14 +2218,13 @@ TEST_F(LayerTreeImplTest, SelectionBoundsWithLargeTransforms) {
|
| {
|
| std::unique_ptr<LayerImpl> child =
|
| LayerImpl::Create(host_impl().active_tree(), child_id);
|
| - SetLayerPropertiesForTesting(child.get(), large_transform, transform_origin,
|
| - position, bounds, true, false, false);
|
| + child->SetTransform(large_transform);
|
| + child->SetBounds(gfx::Size(100, 100));
|
|
|
| std::unique_ptr<LayerImpl> grand_child =
|
| LayerImpl::Create(host_impl().active_tree(), grand_child_id);
|
| - SetLayerPropertiesForTesting(grand_child.get(), large_transform,
|
| - transform_origin, position, bounds, true,
|
| - false, false);
|
| + grand_child->SetTransform(large_transform);
|
| + grand_child->SetBounds(gfx::Size(100, 100));
|
| grand_child->SetDrawsContent(true);
|
|
|
| child->test_properties()->AddChild(std::move(grand_child));
|
| @@ -2532,30 +2296,25 @@ TEST_F(LayerTreeImplTest, HitTestingCorrectLayerWheelListener) {
|
| std::unique_ptr<LayerImpl> right_child =
|
| LayerImpl::Create(host_impl().active_tree(), 3);
|
|
|
| - gfx::Point3F transform_origin;
|
| - gfx::PointF position;
|
| - gfx::Size bounds(100, 100);
|
| {
|
| gfx::Transform translate_z;
|
| translate_z.Translate3d(0, 0, 10);
|
| - SetLayerPropertiesForTesting(root.get(), translate_z, transform_origin,
|
| - position, bounds, false, false, true);
|
| + root->SetTransform(translate_z);
|
| + root->SetBounds(gfx::Size(100, 100));
|
| root->SetDrawsContent(true);
|
| }
|
| {
|
| gfx::Transform translate_z;
|
| translate_z.Translate3d(0, 0, 10);
|
| - SetLayerPropertiesForTesting(left_child.get(), translate_z,
|
| - transform_origin, position, bounds, false,
|
| - false, false);
|
| + left_child->SetTransform(translate_z);
|
| + left_child->SetBounds(gfx::Size(100, 100));
|
| left_child->SetDrawsContent(true);
|
| }
|
| {
|
| gfx::Transform translate_z;
|
| translate_z.Translate3d(0, 0, 10);
|
| - SetLayerPropertiesForTesting(right_child.get(), translate_z,
|
| - transform_origin, position, bounds, false,
|
| - false, false);
|
| + right_child->SetTransform(translate_z);
|
| + right_child->SetBounds(gfx::Size(100, 100));
|
| }
|
|
|
| root->test_properties()->AddChild(std::move(left_child));
|
|
|