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

Side by Side Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 1866203004: Convert //cc from scoped_ptr to std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptrcc: rebase Created 4 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 unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_host_common_perftest.cc ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host_common.h" 5 #include "cc/trees/layer_tree_host_common.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <set> 10 #include <set>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/memory/ptr_util.h"
13 #include "cc/animation/animation_host.h" 14 #include "cc/animation/animation_host.h"
14 #include "cc/animation/animation_id_provider.h" 15 #include "cc/animation/animation_id_provider.h"
15 #include "cc/animation/animation_player.h" 16 #include "cc/animation/animation_player.h"
16 #include "cc/animation/keyframed_animation_curve.h" 17 #include "cc/animation/keyframed_animation_curve.h"
17 #include "cc/animation/layer_animation_controller.h" 18 #include "cc/animation/layer_animation_controller.h"
18 #include "cc/animation/transform_operations.h" 19 #include "cc/animation/transform_operations.h"
19 #include "cc/base/math_util.h" 20 #include "cc/base/math_util.h"
20 #include "cc/input/main_thread_scrolling_reason.h" 21 #include "cc/input/main_thread_scrolling_reason.h"
21 #include "cc/layers/content_layer_client.h" 22 #include "cc/layers/content_layer_client.h"
22 #include "cc/layers/layer.h" 23 #include "cc/layers/layer.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 float page_scale = 0.888f; 260 float page_scale = 0.888f;
260 const float kDeviceScale = 1.666f; 261 const float kDeviceScale = 1.666f;
261 262
262 FakeImplTaskRunnerProvider task_runner_provider; 263 FakeImplTaskRunnerProvider task_runner_provider;
263 TestSharedBitmapManager shared_bitmap_manager; 264 TestSharedBitmapManager shared_bitmap_manager;
264 TestTaskGraphRunner task_graph_runner; 265 TestTaskGraphRunner task_graph_runner;
265 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 266 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
266 &task_graph_runner); 267 &task_graph_runner);
267 268
268 gfx::Transform identity_matrix; 269 gfx::Transform identity_matrix;
269 scoped_ptr<LayerImpl> sublayer_scoped_ptr( 270 std::unique_ptr<LayerImpl> sublayer_scoped_ptr(
270 LayerImpl::Create(host_impl.active_tree(), 1)); 271 LayerImpl::Create(host_impl.active_tree(), 1));
271 LayerImpl* sublayer = sublayer_scoped_ptr.get(); 272 LayerImpl* sublayer = sublayer_scoped_ptr.get();
272 sublayer->SetDrawsContent(true); 273 sublayer->SetDrawsContent(true);
273 SetLayerPropertiesForTesting(sublayer, identity_matrix, gfx::Point3F(), 274 SetLayerPropertiesForTesting(sublayer, identity_matrix, gfx::Point3F(),
274 gfx::PointF(), gfx::Size(500, 500), true, false, 275 gfx::PointF(), gfx::Size(500, 500), true, false,
275 false); 276 false);
276 277
277 scoped_ptr<LayerImpl> scroll_layer_scoped_ptr( 278 std::unique_ptr<LayerImpl> scroll_layer_scoped_ptr(
278 LayerImpl::Create(host_impl.active_tree(), 2)); 279 LayerImpl::Create(host_impl.active_tree(), 2));
279 LayerImpl* scroll_layer = scroll_layer_scoped_ptr.get(); 280 LayerImpl* scroll_layer = scroll_layer_scoped_ptr.get();
280 SetLayerPropertiesForTesting(scroll_layer, identity_matrix, gfx::Point3F(), 281 SetLayerPropertiesForTesting(scroll_layer, identity_matrix, gfx::Point3F(),
281 gfx::PointF(), gfx::Size(10, 20), true, false, 282 gfx::PointF(), gfx::Size(10, 20), true, false,
282 false); 283 false);
283 scoped_ptr<LayerImpl> clip_layer_scoped_ptr( 284 std::unique_ptr<LayerImpl> clip_layer_scoped_ptr(
284 LayerImpl::Create(host_impl.active_tree(), 4)); 285 LayerImpl::Create(host_impl.active_tree(), 4));
285 LayerImpl* clip_layer = clip_layer_scoped_ptr.get(); 286 LayerImpl* clip_layer = clip_layer_scoped_ptr.get();
286 287
287 scroll_layer->SetScrollClipLayer(clip_layer->id()); 288 scroll_layer->SetScrollClipLayer(clip_layer->id());
288 clip_layer->SetBounds( 289 clip_layer->SetBounds(
289 gfx::Size(scroll_layer->bounds().width() + kMaxScrollOffset.x(), 290 gfx::Size(scroll_layer->bounds().width() + kMaxScrollOffset.x(),
290 scroll_layer->bounds().height() + kMaxScrollOffset.y())); 291 scroll_layer->bounds().height() + kMaxScrollOffset.y()));
291 scroll_layer->SetScrollClipLayer(clip_layer->id()); 292 scroll_layer->SetScrollClipLayer(clip_layer->id());
292 SetScrollOffsetDelta(scroll_layer, kScrollDelta); 293 SetScrollOffsetDelta(scroll_layer, kScrollDelta);
293 gfx::Transform impl_transform; 294 gfx::Transform impl_transform;
294 scroll_layer->AddChild(std::move(sublayer_scoped_ptr)); 295 scroll_layer->AddChild(std::move(sublayer_scoped_ptr));
295 LayerImpl* scroll_layer_raw_ptr = scroll_layer_scoped_ptr.get(); 296 LayerImpl* scroll_layer_raw_ptr = scroll_layer_scoped_ptr.get();
296 clip_layer->AddChild(std::move(scroll_layer_scoped_ptr)); 297 clip_layer->AddChild(std::move(scroll_layer_scoped_ptr));
297 scroll_layer_raw_ptr->layer_tree_impl() 298 scroll_layer_raw_ptr->layer_tree_impl()
298 ->property_trees() 299 ->property_trees()
299 ->scroll_tree.UpdateScrollOffsetBaseForTesting(scroll_layer_raw_ptr->id(), 300 ->scroll_tree.UpdateScrollOffsetBaseForTesting(scroll_layer_raw_ptr->id(),
300 kScrollOffset); 301 kScrollOffset);
301 302
302 scoped_ptr<LayerImpl> root(LayerImpl::Create(host_impl.active_tree(), 3)); 303 std::unique_ptr<LayerImpl> root(
304 LayerImpl::Create(host_impl.active_tree(), 3));
303 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), 305 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(),
304 gfx::PointF(), gfx::Size(3, 4), true, false, 306 gfx::PointF(), gfx::Size(3, 4), true, false,
305 false); 307 false);
306 root->AddChild(std::move(clip_layer_scoped_ptr)); 308 root->AddChild(std::move(clip_layer_scoped_ptr));
307 root->SetHasRenderSurface(true); 309 root->SetHasRenderSurface(true);
308 LayerImpl* root_layer = root.get(); 310 LayerImpl* root_layer = root.get();
309 host_impl.active_tree()->SetRootLayer(std::move(root)); 311 host_impl.active_tree()->SetRootLayer(std::move(root));
310 312
311 ExecuteCalculateDrawProperties(root_layer, kDeviceScale, page_scale, 313 ExecuteCalculateDrawProperties(root_layer, kDeviceScale, page_scale,
312 scroll_layer->parent()); 314 scroll_layer->parent());
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_grand_child_screen_space_transform, 614 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_grand_child_screen_space_transform,
613 grand_child->ScreenSpaceTransform()); 615 grand_child->ScreenSpaceTransform());
614 } 616 }
615 617
616 TEST_F(LayerTreeHostCommonTest, TransformsForReplica) { 618 TEST_F(LayerTreeHostCommonTest, TransformsForReplica) {
617 LayerImpl* root = root_layer(); 619 LayerImpl* root = root_layer();
618 LayerImpl* parent = AddChildToRoot<LayerImpl>(); 620 LayerImpl* parent = AddChildToRoot<LayerImpl>();
619 LayerImpl* child = AddChild<LayerImpl>(parent); 621 LayerImpl* child = AddChild<LayerImpl>(parent);
620 LayerImpl* grand_child = AddChild<LayerImpl>(child); 622 LayerImpl* grand_child = AddChild<LayerImpl>(child);
621 grand_child->SetDrawsContent(true); 623 grand_child->SetDrawsContent(true);
622 scoped_ptr<LayerImpl> child_replica = 624 std::unique_ptr<LayerImpl> child_replica =
623 LayerImpl::Create(host_impl()->active_tree(), 100); 625 LayerImpl::Create(host_impl()->active_tree(), 100);
624 626
625 // One-time setup of root layer 627 // One-time setup of root layer
626 gfx::Transform identity_matrix; 628 gfx::Transform identity_matrix;
627 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(), 629 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(),
628 gfx::PointF(), gfx::Size(1, 2), true, false, 630 gfx::PointF(), gfx::Size(1, 2), true, false,
629 true); 631 true);
630 632
631 // Child is set up so that a new render surface should be created. 633 // Child is set up so that a new render surface should be created.
632 child->SetOpacity(0.5f); 634 child->SetOpacity(0.5f);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 child_of_rs1->SetDrawsContent(true); 711 child_of_rs1->SetDrawsContent(true);
710 LayerImpl* child_of_rs2 = AddChild<LayerImpl>(render_surface2); 712 LayerImpl* child_of_rs2 = AddChild<LayerImpl>(render_surface2);
711 child_of_rs2->SetDrawsContent(true); 713 child_of_rs2->SetDrawsContent(true);
712 LayerImpl* grand_child_of_root = AddChild<LayerImpl>(child_of_root); 714 LayerImpl* grand_child_of_root = AddChild<LayerImpl>(child_of_root);
713 grand_child_of_root->SetDrawsContent(true); 715 grand_child_of_root->SetDrawsContent(true);
714 LayerImpl* grand_child_of_rs1 = AddChild<LayerImpl>(child_of_rs1); 716 LayerImpl* grand_child_of_rs1 = AddChild<LayerImpl>(child_of_rs1);
715 grand_child_of_rs1->SetDrawsContent(true); 717 grand_child_of_rs1->SetDrawsContent(true);
716 LayerImpl* grand_child_of_rs2 = AddChild<LayerImpl>(child_of_rs2); 718 LayerImpl* grand_child_of_rs2 = AddChild<LayerImpl>(child_of_rs2);
717 grand_child_of_rs2->SetDrawsContent(true); 719 grand_child_of_rs2->SetDrawsContent(true);
718 720
719 scoped_ptr<LayerImpl> replica_of_rs1 = 721 std::unique_ptr<LayerImpl> replica_of_rs1 =
720 LayerImpl::Create(host_impl()->active_tree(), 101); 722 LayerImpl::Create(host_impl()->active_tree(), 101);
721 scoped_ptr<LayerImpl> replica_of_rs2 = 723 std::unique_ptr<LayerImpl> replica_of_rs2 =
722 LayerImpl::Create(host_impl()->active_tree(), 102); 724 LayerImpl::Create(host_impl()->active_tree(), 102);
723 725
724 // In combination with descendant draws content, opacity != 1 forces the layer 726 // In combination with descendant draws content, opacity != 1 forces the layer
725 // to have a new render surface. 727 // to have a new render surface.
726 render_surface1->SetOpacity(0.5f); 728 render_surface1->SetOpacity(0.5f);
727 render_surface2->SetOpacity(0.33f); 729 render_surface2->SetOpacity(0.33f);
728 730
729 // One-time setup of root layer 731 // One-time setup of root layer
730 gfx::Transform identity_matrix; 732 gfx::Transform identity_matrix;
731 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(), 733 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(),
(...skipping 1957 matching lines...) Expand 10 before | Expand all | Expand 10 after
2689 SetLayerPropertiesForTesting(child, identity, gfx::Point3F(), gfx::PointF(), 2691 SetLayerPropertiesForTesting(child, identity, gfx::Point3F(), gfx::PointF(),
2690 gfx::Size(10, 10), true, false, false); 2692 gfx::Size(10, 10), true, false, false);
2691 SetLayerPropertiesForTesting(grand_child, identity, gfx::Point3F(), 2693 SetLayerPropertiesForTesting(grand_child, identity, gfx::Point3F(),
2692 gfx::PointF(), gfx::Size(10, 10), true, false, 2694 gfx::PointF(), gfx::Size(10, 10), true, false,
2693 false); 2695 false);
2694 SetLayerPropertiesForTesting(great_grand_child, identity, gfx::Point3F(), 2696 SetLayerPropertiesForTesting(great_grand_child, identity, gfx::Point3F(),
2695 gfx::PointF(), gfx::Size(10, 10), true, false, 2697 gfx::PointF(), gfx::Size(10, 10), true, false,
2696 false); 2698 false);
2697 2699
2698 // Add a transform animation with a start delay to |grand_child|. 2700 // Add a transform animation with a start delay to |grand_child|.
2699 scoped_ptr<Animation> animation = Animation::Create( 2701 std::unique_ptr<Animation> animation = Animation::Create(
2700 scoped_ptr<AnimationCurve>(new FakeTransformTransition(1.0)), 0, 1, 2702 std::unique_ptr<AnimationCurve>(new FakeTransformTransition(1.0)), 0, 1,
2701 TargetProperty::TRANSFORM); 2703 TargetProperty::TRANSFORM);
2702 animation->set_fill_mode(Animation::FILL_MODE_NONE); 2704 animation->set_fill_mode(Animation::FILL_MODE_NONE);
2703 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); 2705 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000));
2704 AddAnimationToLayerWithPlayer(grand_child->id(), timeline_impl(), 2706 AddAnimationToLayerWithPlayer(grand_child->id(), timeline_impl(),
2705 std::move(animation)); 2707 std::move(animation));
2706 ExecuteCalculateDrawProperties(parent); 2708 ExecuteCalculateDrawProperties(parent);
2707 2709
2708 EXPECT_FALSE(parent->screen_space_transform_is_animating()); 2710 EXPECT_FALSE(parent->screen_space_transform_is_animating());
2709 EXPECT_FALSE(child->screen_space_transform_is_animating()); 2711 EXPECT_FALSE(child->screen_space_transform_is_animating());
2710 2712
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after
3534 // CalcDrawProps skips a subtree when a layer's screen space transform is 3536 // CalcDrawProps skips a subtree when a layer's screen space transform is
3535 // uninvertible 3537 // uninvertible
3536 EXPECT_EQ(gfx::Rect(), grand_child->visible_layer_rect()); 3538 EXPECT_EQ(gfx::Rect(), grand_child->visible_layer_rect());
3537 } 3539 }
3538 3540
3539 TEST_F(LayerTreeHostCommonTest, 3541 TEST_F(LayerTreeHostCommonTest,
3540 OcclusionForLayerWithUninvertibleDrawTransform) { 3542 OcclusionForLayerWithUninvertibleDrawTransform) {
3541 FakeImplTaskRunnerProvider task_runner_provider; 3543 FakeImplTaskRunnerProvider task_runner_provider;
3542 TestSharedBitmapManager shared_bitmap_manager; 3544 TestSharedBitmapManager shared_bitmap_manager;
3543 TestTaskGraphRunner task_graph_runner; 3545 TestTaskGraphRunner task_graph_runner;
3544 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d(); 3546 std::unique_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d();
3545 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 3547 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
3546 &task_graph_runner); 3548 &task_graph_runner);
3547 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); 3549 std::unique_ptr<LayerImpl> root =
3548 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.active_tree(), 2); 3550 LayerImpl::Create(host_impl.active_tree(), 1);
3549 scoped_ptr<LayerImpl> grand_child = 3551 std::unique_ptr<LayerImpl> child =
3552 LayerImpl::Create(host_impl.active_tree(), 2);
3553 std::unique_ptr<LayerImpl> grand_child =
3550 LayerImpl::Create(host_impl.active_tree(), 3); 3554 LayerImpl::Create(host_impl.active_tree(), 3);
3551 scoped_ptr<LayerImpl> occluding_child = 3555 std::unique_ptr<LayerImpl> occluding_child =
3552 LayerImpl::Create(host_impl.active_tree(), 4); 3556 LayerImpl::Create(host_impl.active_tree(), 4);
3553 child->SetDrawsContent(true); 3557 child->SetDrawsContent(true);
3554 grand_child->SetDrawsContent(true); 3558 grand_child->SetDrawsContent(true);
3555 occluding_child->SetDrawsContent(true); 3559 occluding_child->SetDrawsContent(true);
3556 occluding_child->SetContentsOpaque(true); 3560 occluding_child->SetContentsOpaque(true);
3557 3561
3558 gfx::Transform identity_matrix; 3562 gfx::Transform identity_matrix;
3559 gfx::Transform perspective; 3563 gfx::Transform perspective;
3560 perspective.ApplyPerspectiveDepth(SkDoubleToMScalar(1e-12)); 3564 perspective.ApplyPerspectiveDepth(SkDoubleToMScalar(1e-12));
3561 3565
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
3773 } 3777 }
3774 3778
3775 TEST_F(LayerTreeHostCommonTest, ClipChildWithSingularTransform) { 3779 TEST_F(LayerTreeHostCommonTest, ClipChildWithSingularTransform) {
3776 LayerImpl* root = root_layer(); 3780 LayerImpl* root = root_layer();
3777 LayerImpl* clip_parent = AddChildToRoot<LayerImpl>(); 3781 LayerImpl* clip_parent = AddChildToRoot<LayerImpl>();
3778 LayerImpl* intervening = AddChild<LayerImpl>(clip_parent); 3782 LayerImpl* intervening = AddChild<LayerImpl>(clip_parent);
3779 LayerImpl* clip_child = AddChild<LayerImpl>(intervening); 3783 LayerImpl* clip_child = AddChild<LayerImpl>(intervening);
3780 3784
3781 clip_child->SetDrawsContent(true); 3785 clip_child->SetDrawsContent(true);
3782 clip_child->SetClipParent(clip_parent); 3786 clip_child->SetClipParent(clip_parent);
3783 scoped_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>); 3787 std::unique_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>);
3784 clip_children->insert(clip_child); 3788 clip_children->insert(clip_child);
3785 clip_parent->SetClipChildren(clip_children.release()); 3789 clip_parent->SetClipChildren(clip_children.release());
3786 3790
3787 gfx::Transform identity_matrix; 3791 gfx::Transform identity_matrix;
3788 gfx::Transform singular_matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); 3792 gfx::Transform singular_matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
3789 ASSERT_FALSE(singular_matrix.IsInvertible()); 3793 ASSERT_FALSE(singular_matrix.IsInvertible());
3790 3794
3791 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(), 3795 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(),
3792 gfx::PointF(), gfx::Size(100, 100), true, false, 3796 gfx::PointF(), gfx::Size(100, 100), true, false,
3793 true); 3797 true);
(...skipping 16 matching lines...) Expand all
3810 LayerImpl* root = root_layer(); 3814 LayerImpl* root = root_layer();
3811 LayerImpl* clip_parent = AddChildToRoot<LayerImpl>(); 3815 LayerImpl* clip_parent = AddChildToRoot<LayerImpl>();
3812 LayerImpl* render_surface1 = AddChild<LayerImpl>(clip_parent); 3816 LayerImpl* render_surface1 = AddChild<LayerImpl>(clip_parent);
3813 LayerImpl* clip_child = AddChild<LayerImpl>(render_surface1); 3817 LayerImpl* clip_child = AddChild<LayerImpl>(render_surface1);
3814 LayerImpl* render_surface2 = AddChild<LayerImpl>(clip_child); 3818 LayerImpl* render_surface2 = AddChild<LayerImpl>(clip_child);
3815 3819
3816 render_surface1->SetDrawsContent(true); 3820 render_surface1->SetDrawsContent(true);
3817 render_surface2->SetDrawsContent(true); 3821 render_surface2->SetDrawsContent(true);
3818 clip_child->SetDrawsContent(true); 3822 clip_child->SetDrawsContent(true);
3819 clip_child->SetClipParent(clip_parent); 3823 clip_child->SetClipParent(clip_parent);
3820 scoped_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>); 3824 std::unique_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>);
3821 clip_children->insert(clip_child); 3825 clip_children->insert(clip_child);
3822 clip_parent->SetClipChildren(clip_children.release()); 3826 clip_parent->SetClipChildren(clip_children.release());
3823 3827
3824 gfx::Transform identity_matrix; 3828 gfx::Transform identity_matrix;
3825 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(), 3829 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(),
3826 gfx::PointF(), gfx::Size(100, 100), true, false, 3830 gfx::PointF(), gfx::Size(100, 100), true, false,
3827 true); 3831 true);
3828 SetLayerPropertiesForTesting(clip_parent, identity_matrix, gfx::Point3F(), 3832 SetLayerPropertiesForTesting(clip_parent, identity_matrix, gfx::Point3F(),
3829 gfx::PointF(), gfx::Size(50, 50), true, false, 3833 gfx::PointF(), gfx::Size(50, 50), true, false,
3830 false); 3834 false);
(...skipping 19 matching lines...) Expand all
3850 LayerImpl* root = root_layer(); 3854 LayerImpl* root = root_layer();
3851 LayerImpl* clip_parent = AddChildToRoot<LayerImpl>(); 3855 LayerImpl* clip_parent = AddChildToRoot<LayerImpl>();
3852 LayerImpl* render_surface1 = AddChild<LayerImpl>(clip_parent); 3856 LayerImpl* render_surface1 = AddChild<LayerImpl>(clip_parent);
3853 LayerImpl* clip_child = AddChild<LayerImpl>(render_surface1); 3857 LayerImpl* clip_child = AddChild<LayerImpl>(render_surface1);
3854 LayerImpl* render_surface2 = AddChild<LayerImpl>(clip_child); 3858 LayerImpl* render_surface2 = AddChild<LayerImpl>(clip_child);
3855 3859
3856 render_surface1->SetDrawsContent(true); 3860 render_surface1->SetDrawsContent(true);
3857 render_surface2->SetDrawsContent(true); 3861 render_surface2->SetDrawsContent(true);
3858 clip_child->SetDrawsContent(true); 3862 clip_child->SetDrawsContent(true);
3859 clip_child->SetClipParent(clip_parent); 3863 clip_child->SetClipParent(clip_parent);
3860 scoped_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>); 3864 std::unique_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>);
3861 clip_children->insert(clip_child); 3865 clip_children->insert(clip_child);
3862 clip_parent->SetClipChildren(clip_children.release()); 3866 clip_parent->SetClipChildren(clip_children.release());
3863 3867
3864 gfx::Transform identity_matrix; 3868 gfx::Transform identity_matrix;
3865 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(), 3869 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(),
3866 gfx::PointF(), gfx::Size(100, 100), true, false, 3870 gfx::PointF(), gfx::Size(100, 100), true, false,
3867 true); 3871 true);
3868 SetLayerPropertiesForTesting(clip_parent, identity_matrix, gfx::Point3F(), 3872 SetLayerPropertiesForTesting(clip_parent, identity_matrix, gfx::Point3F(),
3869 gfx::PointF(2.f, 2.f), gfx::Size(50, 50), true, 3873 gfx::PointF(2.f, 2.f), gfx::Size(50, 50), true,
3870 false, false); 3874 false, false);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
3920 LayerImpl* unclipped_surface = AddChildToRoot<LayerImpl>(); 3924 LayerImpl* unclipped_surface = AddChildToRoot<LayerImpl>();
3921 LayerImpl* clip_parent = AddChild<LayerImpl>(unclipped_surface); 3925 LayerImpl* clip_parent = AddChild<LayerImpl>(unclipped_surface);
3922 LayerImpl* unclipped_desc_surface = AddChild<LayerImpl>(clip_parent); 3926 LayerImpl* unclipped_desc_surface = AddChild<LayerImpl>(clip_parent);
3923 LayerImpl* clip_child = AddChild<LayerImpl>(unclipped_desc_surface); 3927 LayerImpl* clip_child = AddChild<LayerImpl>(unclipped_desc_surface);
3924 LayerImpl* clipped_surface = AddChild<LayerImpl>(clip_child); 3928 LayerImpl* clipped_surface = AddChild<LayerImpl>(clip_child);
3925 3929
3926 unclipped_surface->SetDrawsContent(true); 3930 unclipped_surface->SetDrawsContent(true);
3927 unclipped_desc_surface->SetDrawsContent(true); 3931 unclipped_desc_surface->SetDrawsContent(true);
3928 clipped_surface->SetDrawsContent(true); 3932 clipped_surface->SetDrawsContent(true);
3929 clip_child->SetClipParent(clip_parent); 3933 clip_child->SetClipParent(clip_parent);
3930 scoped_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>); 3934 std::unique_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>);
3931 clip_children->insert(clip_child); 3935 clip_children->insert(clip_child);
3932 clip_parent->SetClipChildren(clip_children.release()); 3936 clip_parent->SetClipChildren(clip_children.release());
3933 3937
3934 gfx::Transform identity_matrix; 3938 gfx::Transform identity_matrix;
3935 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(), 3939 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(),
3936 gfx::PointF(), gfx::Size(100, 100), true, false, 3940 gfx::PointF(), gfx::Size(100, 100), true, false,
3937 true); 3941 true);
3938 SetLayerPropertiesForTesting(unclipped_surface, identity_matrix, 3942 SetLayerPropertiesForTesting(unclipped_surface, identity_matrix,
3939 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30), 3943 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30),
3940 true, false, true); 3944 true, false, true);
(...skipping 25 matching lines...) Expand all
3966 LayerImpl* unclipped_surface = AddChildToRoot<LayerImpl>(); 3970 LayerImpl* unclipped_surface = AddChildToRoot<LayerImpl>();
3967 LayerImpl* clip_parent = AddChild<LayerImpl>(unclipped_surface); 3971 LayerImpl* clip_parent = AddChild<LayerImpl>(unclipped_surface);
3968 LayerImpl* unclipped_desc_surface = AddChild<LayerImpl>(clip_parent); 3972 LayerImpl* unclipped_desc_surface = AddChild<LayerImpl>(clip_parent);
3969 LayerImpl* clip_child = AddChild<LayerImpl>(unclipped_desc_surface); 3973 LayerImpl* clip_child = AddChild<LayerImpl>(unclipped_desc_surface);
3970 LayerImpl* clipped_surface = AddChild<LayerImpl>(clip_child); 3974 LayerImpl* clipped_surface = AddChild<LayerImpl>(clip_child);
3971 3975
3972 unclipped_surface->SetDrawsContent(true); 3976 unclipped_surface->SetDrawsContent(true);
3973 unclipped_desc_surface->SetDrawsContent(true); 3977 unclipped_desc_surface->SetDrawsContent(true);
3974 clipped_surface->SetDrawsContent(true); 3978 clipped_surface->SetDrawsContent(true);
3975 clip_child->SetClipParent(clip_parent); 3979 clip_child->SetClipParent(clip_parent);
3976 scoped_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>); 3980 std::unique_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>);
3977 clip_children->insert(clip_child); 3981 clip_children->insert(clip_child);
3978 clip_parent->SetClipChildren(clip_children.release()); 3982 clip_parent->SetClipChildren(clip_children.release());
3979 3983
3980 gfx::Transform identity_matrix; 3984 gfx::Transform identity_matrix;
3981 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(), 3985 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(),
3982 gfx::PointF(), gfx::Size(10, 10), true, false, 3986 gfx::PointF(), gfx::Size(10, 10), true, false,
3983 true); 3987 true);
3984 SetLayerPropertiesForTesting(unclipped_surface, identity_matrix, 3988 SetLayerPropertiesForTesting(unclipped_surface, identity_matrix,
3985 gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50), 3989 gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50),
3986 true, false, true); 3990 true, false, true);
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after
4924 4928
4925 LayerImpl* child = AddChildToRoot<LayerImpl>(); 4929 LayerImpl* child = AddChildToRoot<LayerImpl>();
4926 child->SetDrawsContent(true); 4930 child->SetDrawsContent(true);
4927 SetLayerPropertiesForTesting(child, identity_matrix, gfx::Point3F(), 4931 SetLayerPropertiesForTesting(child, identity_matrix, gfx::Point3F(),
4928 gfx::PointF(2.f, 2.f), gfx::Size(10, 10), false, 4932 gfx::PointF(2.f, 2.f), gfx::Size(10, 10), false,
4929 true, true); 4933 true, true);
4930 4934
4931 gfx::Transform replica_transform; 4935 gfx::Transform replica_transform;
4932 replica_transform.Scale(1.0, -1.0); 4936 replica_transform.Scale(1.0, -1.0);
4933 4937
4934 scoped_ptr<LayerImpl> replica = 4938 std::unique_ptr<LayerImpl> replica =
4935 LayerImpl::Create(host_impl()->active_tree(), 7); 4939 LayerImpl::Create(host_impl()->active_tree(), 7);
4936 SetLayerPropertiesForTesting(replica.get(), replica_transform, gfx::Point3F(), 4940 SetLayerPropertiesForTesting(replica.get(), replica_transform, gfx::Point3F(),
4937 gfx::PointF(2.f, 2.f), gfx::Size(10, 10), false, 4941 gfx::PointF(2.f, 2.f), gfx::Size(10, 10), false,
4938 true, false); 4942 true, false);
4939 // We need to set parent on replica layer for property tree building. 4943 // We need to set parent on replica layer for property tree building.
4940 replica->SetParent(child); 4944 replica->SetParent(child);
4941 child->SetReplicaLayer(std::move(replica)); 4945 child->SetReplicaLayer(std::move(replica));
4942 4946
4943 // This layer should end up in the same surface as child, with the same draw 4947 // This layer should end up in the same surface as child, with the same draw
4944 // and screen space transforms. 4948 // and screen space transforms.
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
5037 true); 5041 true);
5038 5042
5039 LayerImpl* child = AddChildToRoot<LayerImpl>(); 5043 LayerImpl* child = AddChildToRoot<LayerImpl>();
5040 child->SetDrawsContent(true); 5044 child->SetDrawsContent(true);
5041 SetLayerPropertiesForTesting(child, identity_matrix, gfx::Point3F(), 5045 SetLayerPropertiesForTesting(child, identity_matrix, gfx::Point3F(),
5042 gfx::PointF(), gfx::Size(13, 11), false, true, 5046 gfx::PointF(), gfx::Size(13, 11), false, true,
5043 true); 5047 true);
5044 5048
5045 gfx::Transform replica_transform; 5049 gfx::Transform replica_transform;
5046 replica_transform.Scale(1.0, -1.0); 5050 replica_transform.Scale(1.0, -1.0);
5047 scoped_ptr<LayerImpl> replica = 5051 std::unique_ptr<LayerImpl> replica =
5048 LayerImpl::Create(host_impl()->active_tree(), 7); 5052 LayerImpl::Create(host_impl()->active_tree(), 7);
5049 SetLayerPropertiesForTesting(replica.get(), replica_transform, gfx::Point3F(), 5053 SetLayerPropertiesForTesting(replica.get(), replica_transform, gfx::Point3F(),
5050 gfx::PointF(), gfx::Size(13, 11), false, true, 5054 gfx::PointF(), gfx::Size(13, 11), false, true,
5051 false); 5055 false);
5052 child->SetReplicaLayer(std::move(replica)); 5056 child->SetReplicaLayer(std::move(replica));
5053 5057
5054 float device_scale_factor = 1.7f; 5058 float device_scale_factor = 1.7f;
5055 ExecuteCalculateDrawProperties(parent, device_scale_factor); 5059 ExecuteCalculateDrawProperties(parent, device_scale_factor);
5056 5060
5057 // We should have two render surfaces. The root's render surface and child's 5061 // We should have two render surfaces. The root's render surface and child's
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
5142 EXPECT_FALSE(child->has_render_surface()); 5146 EXPECT_FALSE(child->has_render_surface());
5143 } 5147 }
5144 5148
5145 TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) { 5149 TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) {
5146 FakeImplTaskRunnerProvider task_runner_provider; 5150 FakeImplTaskRunnerProvider task_runner_provider;
5147 TestSharedBitmapManager shared_bitmap_manager; 5151 TestSharedBitmapManager shared_bitmap_manager;
5148 TestTaskGraphRunner task_graph_runner; 5152 TestTaskGraphRunner task_graph_runner;
5149 FakeLayerTreeHostImpl host_impl(host()->settings(), &task_runner_provider, 5153 FakeLayerTreeHostImpl host_impl(host()->settings(), &task_runner_provider,
5150 &shared_bitmap_manager, &task_graph_runner); 5154 &shared_bitmap_manager, &task_graph_runner);
5151 host_impl.CreatePendingTree(); 5155 host_impl.CreatePendingTree();
5152 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); 5156 std::unique_ptr<LayerImpl> root =
5157 LayerImpl::Create(host_impl.pending_tree(), 1);
5153 5158
5154 const gfx::Transform identity_matrix; 5159 const gfx::Transform identity_matrix;
5155 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), 5160 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(),
5156 gfx::PointF(), gfx::Size(100, 100), true, false, 5161 gfx::PointF(), gfx::Size(100, 100), true, false,
5157 false); 5162 false);
5158 root->SetDrawsContent(true); 5163 root->SetDrawsContent(true);
5159 5164
5160 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2); 5165 std::unique_ptr<LayerImpl> child =
5166 LayerImpl::Create(host_impl.pending_tree(), 2);
5161 SetLayerPropertiesForTesting(child.get(), identity_matrix, gfx::Point3F(), 5167 SetLayerPropertiesForTesting(child.get(), identity_matrix, gfx::Point3F(),
5162 gfx::PointF(), gfx::Size(50, 50), true, false, 5168 gfx::PointF(), gfx::Size(50, 50), true, false,
5163 false); 5169 false);
5164 child->SetDrawsContent(true); 5170 child->SetDrawsContent(true);
5165 child->SetOpacity(0.0f); 5171 child->SetOpacity(0.0f);
5166 5172
5167 // Add opacity animation. 5173 // Add opacity animation.
5168 scoped_refptr<AnimationTimeline> timeline = 5174 scoped_refptr<AnimationTimeline> timeline =
5169 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); 5175 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId());
5170 host_impl.animation_host()->AddAnimationTimeline(timeline); 5176 host_impl.animation_host()->AddAnimationTimeline(timeline);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
5245 5251
5246 protected: 5252 protected:
5247 void SetUp() override { 5253 void SetUp() override {
5248 timeline_ = 5254 timeline_ =
5249 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); 5255 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId());
5250 host_impl_.animation_host()->AddAnimationTimeline(timeline_); 5256 host_impl_.animation_host()->AddAnimationTimeline(timeline_);
5251 5257
5252 can_use_lcd_text_ = std::tr1::get<0>(GetParam()); 5258 can_use_lcd_text_ = std::tr1::get<0>(GetParam());
5253 layers_always_allowed_lcd_text_ = std::tr1::get<1>(GetParam()); 5259 layers_always_allowed_lcd_text_ = std::tr1::get<1>(GetParam());
5254 5260
5255 scoped_ptr<LayerImpl> root_ptr = 5261 std::unique_ptr<LayerImpl> root_ptr =
5256 LayerImpl::Create(host_impl_.active_tree(), 1); 5262 LayerImpl::Create(host_impl_.active_tree(), 1);
5257 scoped_ptr<LayerImpl> child_ptr = 5263 std::unique_ptr<LayerImpl> child_ptr =
5258 LayerImpl::Create(host_impl_.active_tree(), 2); 5264 LayerImpl::Create(host_impl_.active_tree(), 2);
5259 scoped_ptr<LayerImpl> grand_child_ptr = 5265 std::unique_ptr<LayerImpl> grand_child_ptr =
5260 LayerImpl::Create(host_impl_.active_tree(), 3); 5266 LayerImpl::Create(host_impl_.active_tree(), 3);
5261 5267
5262 // Stash raw pointers to look at later. 5268 // Stash raw pointers to look at later.
5263 root_ = root_ptr.get(); 5269 root_ = root_ptr.get();
5264 child_ = child_ptr.get(); 5270 child_ = child_ptr.get();
5265 grand_child_ = grand_child_ptr.get(); 5271 grand_child_ = grand_child_ptr.get();
5266 5272
5267 child_->AddChild(std::move(grand_child_ptr)); 5273 child_->AddChild(std::move(grand_child_ptr));
5268 root_->AddChild(std::move(child_ptr)); 5274 root_->AddChild(std::move(child_ptr));
5269 host_impl_.active_tree()->SetRootLayer(std::move(root_ptr)); 5275 host_impl_.active_tree()->SetRootLayer(std::move(root_ptr));
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
5461 5467
5462 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayerImpl) { 5468 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayerImpl) {
5463 FakeImplTaskRunnerProvider task_runner_provider; 5469 FakeImplTaskRunnerProvider task_runner_provider;
5464 TestSharedBitmapManager shared_bitmap_manager; 5470 TestSharedBitmapManager shared_bitmap_manager;
5465 TestTaskGraphRunner task_graph_runner; 5471 TestTaskGraphRunner task_graph_runner;
5466 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 5472 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
5467 &task_graph_runner); 5473 &task_graph_runner);
5468 host_impl.CreatePendingTree(); 5474 host_impl.CreatePendingTree();
5469 const gfx::Transform identity_matrix; 5475 const gfx::Transform identity_matrix;
5470 5476
5471 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); 5477 std::unique_ptr<LayerImpl> root =
5478 LayerImpl::Create(host_impl.pending_tree(), 1);
5472 LayerImpl* root_layer = root.get(); 5479 LayerImpl* root_layer = root.get();
5473 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), 5480 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(),
5474 gfx::PointF(), gfx::Size(50, 50), true, false, 5481 gfx::PointF(), gfx::Size(50, 50), true, false,
5475 false); 5482 false);
5476 root->SetDrawsContent(true); 5483 root->SetDrawsContent(true);
5477 5484
5478 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2); 5485 std::unique_ptr<LayerImpl> child =
5486 LayerImpl::Create(host_impl.pending_tree(), 2);
5479 SetLayerPropertiesForTesting(child.get(), identity_matrix, gfx::Point3F(), 5487 SetLayerPropertiesForTesting(child.get(), identity_matrix, gfx::Point3F(),
5480 gfx::PointF(), gfx::Size(40, 40), true, false, 5488 gfx::PointF(), gfx::Size(40, 40), true, false,
5481 false); 5489 false);
5482 child->SetDrawsContent(true); 5490 child->SetDrawsContent(true);
5483 5491
5484 scoped_ptr<LayerImpl> grand_child = 5492 std::unique_ptr<LayerImpl> grand_child =
5485 LayerImpl::Create(host_impl.pending_tree(), 3); 5493 LayerImpl::Create(host_impl.pending_tree(), 3);
5486 SetLayerPropertiesForTesting(grand_child.get(), identity_matrix, 5494 SetLayerPropertiesForTesting(grand_child.get(), identity_matrix,
5487 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30), 5495 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30),
5488 true, false, false); 5496 true, false, false);
5489 grand_child->SetDrawsContent(true); 5497 grand_child->SetDrawsContent(true);
5490 grand_child->SetHideLayerAndSubtree(true); 5498 grand_child->SetHideLayerAndSubtree(true);
5491 5499
5492 child->AddChild(std::move(grand_child)); 5500 child->AddChild(std::move(grand_child));
5493 root->AddChild(std::move(child)); 5501 root->AddChild(std::move(child));
5494 root->SetHasRenderSurface(true); 5502 root->SetHasRenderSurface(true);
(...skipping 17 matching lines...) Expand all
5512 5520
5513 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayersImpl) { 5521 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayersImpl) {
5514 FakeImplTaskRunnerProvider task_runner_provider; 5522 FakeImplTaskRunnerProvider task_runner_provider;
5515 TestSharedBitmapManager shared_bitmap_manager; 5523 TestSharedBitmapManager shared_bitmap_manager;
5516 TestTaskGraphRunner task_graph_runner; 5524 TestTaskGraphRunner task_graph_runner;
5517 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 5525 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
5518 &task_graph_runner); 5526 &task_graph_runner);
5519 host_impl.CreatePendingTree(); 5527 host_impl.CreatePendingTree();
5520 const gfx::Transform identity_matrix; 5528 const gfx::Transform identity_matrix;
5521 5529
5522 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); 5530 std::unique_ptr<LayerImpl> root =
5531 LayerImpl::Create(host_impl.pending_tree(), 1);
5523 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), 5532 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(),
5524 gfx::PointF(), gfx::Size(50, 50), true, false, 5533 gfx::PointF(), gfx::Size(50, 50), true, false,
5525 true); 5534 true);
5526 root->SetDrawsContent(true); 5535 root->SetDrawsContent(true);
5527 LayerImpl* root_layer = root.get(); 5536 LayerImpl* root_layer = root.get();
5528 5537
5529 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2); 5538 std::unique_ptr<LayerImpl> child =
5539 LayerImpl::Create(host_impl.pending_tree(), 2);
5530 SetLayerPropertiesForTesting(child.get(), identity_matrix, gfx::Point3F(), 5540 SetLayerPropertiesForTesting(child.get(), identity_matrix, gfx::Point3F(),
5531 gfx::PointF(), gfx::Size(40, 40), true, false, 5541 gfx::PointF(), gfx::Size(40, 40), true, false,
5532 false); 5542 false);
5533 child->SetDrawsContent(true); 5543 child->SetDrawsContent(true);
5534 child->SetHideLayerAndSubtree(true); 5544 child->SetHideLayerAndSubtree(true);
5535 5545
5536 scoped_ptr<LayerImpl> grand_child = 5546 std::unique_ptr<LayerImpl> grand_child =
5537 LayerImpl::Create(host_impl.pending_tree(), 3); 5547 LayerImpl::Create(host_impl.pending_tree(), 3);
5538 SetLayerPropertiesForTesting(grand_child.get(), identity_matrix, 5548 SetLayerPropertiesForTesting(grand_child.get(), identity_matrix,
5539 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30), 5549 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30),
5540 true, false, false); 5550 true, false, false);
5541 grand_child->SetDrawsContent(true); 5551 grand_child->SetDrawsContent(true);
5542 5552
5543 child->AddChild(std::move(grand_child)); 5553 child->AddChild(std::move(grand_child));
5544 root->AddChild(std::move(child)); 5554 root->AddChild(std::move(child));
5545 host_impl.pending_tree()->SetRootLayer(std::move(root)); 5555 host_impl.pending_tree()->SetRootLayer(std::move(root));
5546 5556
5547 LayerImplList render_surface_layer_list; 5557 LayerImplList render_surface_layer_list;
5548 root_layer->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting(); 5558 root_layer->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting();
5549 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( 5559 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
5550 root_layer, root_layer->bounds(), &render_surface_layer_list, 5560 root_layer, root_layer->bounds(), &render_surface_layer_list,
5551 root_layer->layer_tree_impl()->current_render_surface_list_id()); 5561 root_layer->layer_tree_impl()->current_render_surface_list_id());
5552 inputs.can_adjust_raster_scales = true; 5562 inputs.can_adjust_raster_scales = true;
5553 LayerTreeHostCommon::CalculateDrawProperties(&inputs); 5563 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
5554 5564
5555 // We should have one render surface and one layers. The child has 5565 // We should have one render surface and one layers. The child has
5556 // hidden itself and the grand child. 5566 // hidden itself and the grand child.
5557 ASSERT_EQ(1u, render_surface_layer_list.size()); 5567 ASSERT_EQ(1u, render_surface_layer_list.size());
5558 ASSERT_EQ(1u, root_layer->render_surface()->layer_list().size()); 5568 ASSERT_EQ(1u, root_layer->render_surface()->layer_list().size());
5559 EXPECT_EQ(1, root_layer->render_surface()->layer_list().at(0)->id()); 5569 EXPECT_EQ(1, root_layer->render_surface()->layer_list().at(0)->id());
5560 } 5570 }
5561 5571
5562 void EmptyCopyOutputCallback(scoped_ptr<CopyOutputResult> result) {} 5572 void EmptyCopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {}
5563 5573
5564 TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) { 5574 TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) {
5565 FakeImplTaskRunnerProvider task_runner_provider; 5575 FakeImplTaskRunnerProvider task_runner_provider;
5566 TestSharedBitmapManager shared_bitmap_manager; 5576 TestSharedBitmapManager shared_bitmap_manager;
5567 TestTaskGraphRunner task_graph_runner; 5577 TestTaskGraphRunner task_graph_runner;
5568 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 5578 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
5569 &task_graph_runner); 5579 &task_graph_runner);
5570 host_impl.CreatePendingTree(); 5580 host_impl.CreatePendingTree();
5571 const gfx::Transform identity_matrix; 5581 const gfx::Transform identity_matrix;
5572 5582
5573 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); 5583 std::unique_ptr<LayerImpl> root =
5584 LayerImpl::Create(host_impl.pending_tree(), 1);
5574 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), 5585 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(),
5575 gfx::PointF(), gfx::Size(50, 50), true, false, 5586 gfx::PointF(), gfx::Size(50, 50), true, false,
5576 true); 5587 true);
5577 root->SetDrawsContent(true); 5588 root->SetDrawsContent(true);
5578 LayerImpl* root_layer = root.get(); 5589 LayerImpl* root_layer = root.get();
5579 5590
5580 scoped_ptr<LayerImpl> copy_grand_parent = 5591 std::unique_ptr<LayerImpl> copy_grand_parent =
5581 LayerImpl::Create(host_impl.pending_tree(), 2); 5592 LayerImpl::Create(host_impl.pending_tree(), 2);
5582 SetLayerPropertiesForTesting(copy_grand_parent.get(), identity_matrix, 5593 SetLayerPropertiesForTesting(copy_grand_parent.get(), identity_matrix,
5583 gfx::Point3F(), gfx::PointF(), gfx::Size(40, 40), 5594 gfx::Point3F(), gfx::PointF(), gfx::Size(40, 40),
5584 true, false, false); 5595 true, false, false);
5585 copy_grand_parent->SetDrawsContent(true); 5596 copy_grand_parent->SetDrawsContent(true);
5586 LayerImpl* copy_grand_parent_layer = copy_grand_parent.get(); 5597 LayerImpl* copy_grand_parent_layer = copy_grand_parent.get();
5587 5598
5588 scoped_ptr<LayerImpl> copy_parent = 5599 std::unique_ptr<LayerImpl> copy_parent =
5589 LayerImpl::Create(host_impl.pending_tree(), 3); 5600 LayerImpl::Create(host_impl.pending_tree(), 3);
5590 SetLayerPropertiesForTesting(copy_parent.get(), identity_matrix, 5601 SetLayerPropertiesForTesting(copy_parent.get(), identity_matrix,
5591 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30), 5602 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30),
5592 true, false, true); 5603 true, false, true);
5593 copy_parent->SetDrawsContent(true); 5604 copy_parent->SetDrawsContent(true);
5594 LayerImpl* copy_parent_layer = copy_parent.get(); 5605 LayerImpl* copy_parent_layer = copy_parent.get();
5595 5606
5596 scoped_ptr<LayerImpl> copy_request = 5607 std::unique_ptr<LayerImpl> copy_request =
5597 LayerImpl::Create(host_impl.pending_tree(), 4); 5608 LayerImpl::Create(host_impl.pending_tree(), 4);
5598 SetLayerPropertiesForTesting(copy_request.get(), identity_matrix, 5609 SetLayerPropertiesForTesting(copy_request.get(), identity_matrix,
5599 gfx::Point3F(), gfx::PointF(), gfx::Size(20, 20), 5610 gfx::Point3F(), gfx::PointF(), gfx::Size(20, 20),
5600 true, false, true); 5611 true, false, true);
5601 copy_request->SetDrawsContent(true); 5612 copy_request->SetDrawsContent(true);
5602 LayerImpl* copy_layer = copy_request.get(); 5613 LayerImpl* copy_layer = copy_request.get();
5603 5614
5604 scoped_ptr<LayerImpl> copy_child = 5615 std::unique_ptr<LayerImpl> copy_child =
5605 LayerImpl::Create(host_impl.pending_tree(), 5); 5616 LayerImpl::Create(host_impl.pending_tree(), 5);
5606 SetLayerPropertiesForTesting(copy_child.get(), identity_matrix, 5617 SetLayerPropertiesForTesting(copy_child.get(), identity_matrix,
5607 gfx::Point3F(), gfx::PointF(), gfx::Size(20, 20), 5618 gfx::Point3F(), gfx::PointF(), gfx::Size(20, 20),
5608 true, false, false); 5619 true, false, false);
5609 copy_child->SetDrawsContent(true); 5620 copy_child->SetDrawsContent(true);
5610 LayerImpl* copy_child_layer = copy_child.get(); 5621 LayerImpl* copy_child_layer = copy_child.get();
5611 5622
5612 scoped_ptr<LayerImpl> copy_grand_child = 5623 std::unique_ptr<LayerImpl> copy_grand_child =
5613 LayerImpl::Create(host_impl.pending_tree(), 6); 5624 LayerImpl::Create(host_impl.pending_tree(), 6);
5614 SetLayerPropertiesForTesting(copy_grand_child.get(), identity_matrix, 5625 SetLayerPropertiesForTesting(copy_grand_child.get(), identity_matrix,
5615 gfx::Point3F(), gfx::PointF(), gfx::Size(20, 20), 5626 gfx::Point3F(), gfx::PointF(), gfx::Size(20, 20),
5616 true, false, false); 5627 true, false, false);
5617 copy_child->SetDrawsContent(true); 5628 copy_child->SetDrawsContent(true);
5618 LayerImpl* copy_grand_child_layer = copy_grand_child.get(); 5629 LayerImpl* copy_grand_child_layer = copy_grand_child.get();
5619 5630
5620 scoped_ptr<LayerImpl> copy_grand_parent_sibling_before = 5631 std::unique_ptr<LayerImpl> copy_grand_parent_sibling_before =
5621 LayerImpl::Create(host_impl.pending_tree(), 7); 5632 LayerImpl::Create(host_impl.pending_tree(), 7);
5622 SetLayerPropertiesForTesting(copy_grand_parent_sibling_before.get(), 5633 SetLayerPropertiesForTesting(copy_grand_parent_sibling_before.get(),
5623 identity_matrix, gfx::Point3F(), gfx::PointF(), 5634 identity_matrix, gfx::Point3F(), gfx::PointF(),
5624 gfx::Size(40, 40), true, false, false); 5635 gfx::Size(40, 40), true, false, false);
5625 copy_grand_parent_sibling_before->SetDrawsContent(true); 5636 copy_grand_parent_sibling_before->SetDrawsContent(true);
5626 LayerImpl* copy_grand_parent_sibling_before_layer = 5637 LayerImpl* copy_grand_parent_sibling_before_layer =
5627 copy_grand_parent_sibling_before.get(); 5638 copy_grand_parent_sibling_before.get();
5628 5639
5629 scoped_ptr<LayerImpl> copy_grand_parent_sibling_after = 5640 std::unique_ptr<LayerImpl> copy_grand_parent_sibling_after =
5630 LayerImpl::Create(host_impl.pending_tree(), 8); 5641 LayerImpl::Create(host_impl.pending_tree(), 8);
5631 SetLayerPropertiesForTesting(copy_grand_parent_sibling_after.get(), 5642 SetLayerPropertiesForTesting(copy_grand_parent_sibling_after.get(),
5632 identity_matrix, gfx::Point3F(), gfx::PointF(), 5643 identity_matrix, gfx::Point3F(), gfx::PointF(),
5633 gfx::Size(40, 40), true, false, false); 5644 gfx::Size(40, 40), true, false, false);
5634 copy_grand_parent_sibling_after->SetDrawsContent(true); 5645 copy_grand_parent_sibling_after->SetDrawsContent(true);
5635 LayerImpl* copy_grand_parent_sibling_after_layer = 5646 LayerImpl* copy_grand_parent_sibling_after_layer =
5636 copy_grand_parent_sibling_after.get(); 5647 copy_grand_parent_sibling_after.get();
5637 5648
5638 copy_child->AddChild(std::move(copy_grand_child)); 5649 copy_child->AddChild(std::move(copy_grand_child));
5639 copy_request->AddChild(std::move(copy_child)); 5650 copy_request->AddChild(std::move(copy_child));
5640 copy_parent->AddChild(std::move(copy_request)); 5651 copy_parent->AddChild(std::move(copy_request));
5641 copy_grand_parent->AddChild(std::move(copy_parent)); 5652 copy_grand_parent->AddChild(std::move(copy_parent));
5642 root->AddChild(std::move(copy_grand_parent_sibling_before)); 5653 root->AddChild(std::move(copy_grand_parent_sibling_before));
5643 root->AddChild(std::move(copy_grand_parent)); 5654 root->AddChild(std::move(copy_grand_parent));
5644 root->AddChild(std::move(copy_grand_parent_sibling_after)); 5655 root->AddChild(std::move(copy_grand_parent_sibling_after));
5645 host_impl.pending_tree()->SetRootLayer(std::move(root)); 5656 host_impl.pending_tree()->SetRootLayer(std::move(root));
5646 5657
5647 // Hide the copy_grand_parent and its subtree. But make a copy request in that 5658 // Hide the copy_grand_parent and its subtree. But make a copy request in that
5648 // hidden subtree on copy_layer. Also hide the copy grand child and its 5659 // hidden subtree on copy_layer. Also hide the copy grand child and its
5649 // subtree. 5660 // subtree.
5650 copy_grand_parent_layer->SetHideLayerAndSubtree(true); 5661 copy_grand_parent_layer->SetHideLayerAndSubtree(true);
5651 copy_grand_parent_sibling_before_layer->SetHideLayerAndSubtree(true); 5662 copy_grand_parent_sibling_before_layer->SetHideLayerAndSubtree(true);
5652 copy_grand_parent_sibling_after_layer->SetHideLayerAndSubtree(true); 5663 copy_grand_parent_sibling_after_layer->SetHideLayerAndSubtree(true);
5653 copy_grand_child_layer->SetHideLayerAndSubtree(true); 5664 copy_grand_child_layer->SetHideLayerAndSubtree(true);
5654 5665
5655 std::vector<scoped_ptr<CopyOutputRequest>> copy_requests; 5666 std::vector<std::unique_ptr<CopyOutputRequest>> copy_requests;
5656 copy_requests.push_back( 5667 copy_requests.push_back(
5657 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback))); 5668 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback)));
5658 copy_layer->PassCopyRequests(&copy_requests); 5669 copy_layer->PassCopyRequests(&copy_requests);
5659 EXPECT_TRUE(copy_layer->HasCopyRequest()); 5670 EXPECT_TRUE(copy_layer->HasCopyRequest());
5660 5671
5661 LayerImplList render_surface_layer_list; 5672 LayerImplList render_surface_layer_list;
5662 root_layer->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting(); 5673 root_layer->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting();
5663 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( 5674 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
5664 root_layer, root_layer->bounds(), &render_surface_layer_list, 5675 root_layer, root_layer->bounds(), &render_surface_layer_list,
5665 root_layer->layer_tree_impl()->current_render_surface_list_id()); 5676 root_layer->layer_tree_impl()->current_render_surface_list_id());
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
5725 5736
5726 TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) { 5737 TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) {
5727 FakeImplTaskRunnerProvider task_runner_provider; 5738 FakeImplTaskRunnerProvider task_runner_provider;
5728 TestSharedBitmapManager shared_bitmap_manager; 5739 TestSharedBitmapManager shared_bitmap_manager;
5729 TestTaskGraphRunner task_graph_runner; 5740 TestTaskGraphRunner task_graph_runner;
5730 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 5741 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
5731 &task_graph_runner); 5742 &task_graph_runner);
5732 host_impl.CreatePendingTree(); 5743 host_impl.CreatePendingTree();
5733 const gfx::Transform identity_matrix; 5744 const gfx::Transform identity_matrix;
5734 5745
5735 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); 5746 std::unique_ptr<LayerImpl> root =
5747 LayerImpl::Create(host_impl.pending_tree(), 1);
5736 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), 5748 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(),
5737 gfx::PointF(), gfx::Size(50, 50), true, false, 5749 gfx::PointF(), gfx::Size(50, 50), true, false,
5738 true); 5750 true);
5739 root->SetDrawsContent(true); 5751 root->SetDrawsContent(true);
5740 5752
5741 scoped_ptr<LayerImpl> copy_parent = 5753 std::unique_ptr<LayerImpl> copy_parent =
5742 LayerImpl::Create(host_impl.pending_tree(), 2); 5754 LayerImpl::Create(host_impl.pending_tree(), 2);
5743 SetLayerPropertiesForTesting(copy_parent.get(), identity_matrix, 5755 SetLayerPropertiesForTesting(copy_parent.get(), identity_matrix,
5744 gfx::Point3F(), gfx::PointF(), gfx::Size(), true, 5756 gfx::Point3F(), gfx::PointF(), gfx::Size(), true,
5745 false, false); 5757 false, false);
5746 copy_parent->SetDrawsContent(true); 5758 copy_parent->SetDrawsContent(true);
5747 copy_parent->SetMasksToBounds(true); 5759 copy_parent->SetMasksToBounds(true);
5748 5760
5749 scoped_ptr<LayerImpl> copy_layer = 5761 std::unique_ptr<LayerImpl> copy_layer =
5750 LayerImpl::Create(host_impl.pending_tree(), 3); 5762 LayerImpl::Create(host_impl.pending_tree(), 3);
5751 SetLayerPropertiesForTesting(copy_layer.get(), identity_matrix, 5763 SetLayerPropertiesForTesting(copy_layer.get(), identity_matrix,
5752 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30), 5764 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30),
5753 true, false, true); 5765 true, false, true);
5754 copy_layer->SetDrawsContent(true); 5766 copy_layer->SetDrawsContent(true);
5755 5767
5756 scoped_ptr<LayerImpl> copy_child = 5768 std::unique_ptr<LayerImpl> copy_child =
5757 LayerImpl::Create(host_impl.pending_tree(), 4); 5769 LayerImpl::Create(host_impl.pending_tree(), 4);
5758 SetLayerPropertiesForTesting(copy_child.get(), identity_matrix, 5770 SetLayerPropertiesForTesting(copy_child.get(), identity_matrix,
5759 gfx::Point3F(), gfx::PointF(), gfx::Size(20, 20), 5771 gfx::Point3F(), gfx::PointF(), gfx::Size(20, 20),
5760 true, false, false); 5772 true, false, false);
5761 copy_child->SetDrawsContent(true); 5773 copy_child->SetDrawsContent(true);
5762 5774
5763 std::vector<scoped_ptr<CopyOutputRequest>> copy_requests; 5775 std::vector<std::unique_ptr<CopyOutputRequest>> copy_requests;
5764 copy_requests.push_back( 5776 copy_requests.push_back(
5765 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback))); 5777 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback)));
5766 copy_layer->PassCopyRequests(&copy_requests); 5778 copy_layer->PassCopyRequests(&copy_requests);
5767 EXPECT_TRUE(copy_layer->HasCopyRequest()); 5779 EXPECT_TRUE(copy_layer->HasCopyRequest());
5768 5780
5769 copy_layer->AddChild(std::move(copy_child)); 5781 copy_layer->AddChild(std::move(copy_child));
5770 copy_parent->AddChild(std::move(copy_layer)); 5782 copy_parent->AddChild(std::move(copy_layer));
5771 root->AddChild(std::move(copy_parent)); 5783 root->AddChild(std::move(copy_parent));
5772 5784
5773 LayerImplList render_surface_layer_list; 5785 LayerImplList render_surface_layer_list;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
5830 // inherit the right clip rect. 5842 // inherit the right clip rect.
5831 LayerImpl* root = root_layer(); 5843 LayerImpl* root = root_layer();
5832 LayerImpl* render_surface = AddChildToRoot<LayerImpl>(); 5844 LayerImpl* render_surface = AddChildToRoot<LayerImpl>();
5833 LayerImpl* clip_parent = AddChild<LayerImpl>(render_surface); 5845 LayerImpl* clip_parent = AddChild<LayerImpl>(render_surface);
5834 clip_parent->SetDrawsContent(true); 5846 clip_parent->SetDrawsContent(true);
5835 LayerImpl* intervening = AddChild<LayerImpl>(clip_parent); 5847 LayerImpl* intervening = AddChild<LayerImpl>(clip_parent);
5836 intervening->SetDrawsContent(true); 5848 intervening->SetDrawsContent(true);
5837 LayerImpl* clip_child = AddChild<LayerImpl>(intervening); 5849 LayerImpl* clip_child = AddChild<LayerImpl>(intervening);
5838 clip_child->SetDrawsContent(true); 5850 clip_child->SetDrawsContent(true);
5839 clip_child->SetClipParent(clip_parent); 5851 clip_child->SetClipParent(clip_parent);
5840 scoped_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>); 5852 std::unique_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>);
5841 clip_children->insert(clip_child); 5853 clip_children->insert(clip_child);
5842 clip_parent->SetClipChildren(clip_children.release()); 5854 clip_parent->SetClipChildren(clip_children.release());
5843 5855
5844 intervening->SetMasksToBounds(true); 5856 intervening->SetMasksToBounds(true);
5845 clip_parent->SetMasksToBounds(true); 5857 clip_parent->SetMasksToBounds(true);
5846 5858
5847 gfx::Transform scale_transform; 5859 gfx::Transform scale_transform;
5848 scale_transform.Scale(2, 2); 5860 scale_transform.Scale(2, 2);
5849 5861
5850 gfx::Transform identity_transform; 5862 gfx::Transform identity_transform;
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
6080 // 6092 //
6081 LayerImpl* root = root_layer(); 6093 LayerImpl* root = root_layer();
6082 LayerImpl* clip_parent = AddChild<LayerImpl>(root); 6094 LayerImpl* clip_parent = AddChild<LayerImpl>(root);
6083 LayerImpl* intervening = AddChild<LayerImpl>(clip_parent); 6095 LayerImpl* intervening = AddChild<LayerImpl>(clip_parent);
6084 LayerImpl* clip_child = AddChild<LayerImpl>(intervening); 6096 LayerImpl* clip_child = AddChild<LayerImpl>(intervening);
6085 LayerImpl* child = AddChild<LayerImpl>(clip_child); 6097 LayerImpl* child = AddChild<LayerImpl>(clip_child);
6086 clip_child->SetDrawsContent(true); 6098 clip_child->SetDrawsContent(true);
6087 child->SetDrawsContent(true); 6099 child->SetDrawsContent(true);
6088 6100
6089 clip_child->SetClipParent(clip_parent); 6101 clip_child->SetClipParent(clip_parent);
6090 scoped_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>); 6102 std::unique_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>);
6091 clip_children->insert(clip_child); 6103 clip_children->insert(clip_child);
6092 clip_parent->SetClipChildren(clip_children.release()); 6104 clip_parent->SetClipChildren(clip_children.release());
6093 6105
6094 intervening->SetMasksToBounds(true); 6106 intervening->SetMasksToBounds(true);
6095 clip_parent->SetMasksToBounds(true); 6107 clip_parent->SetMasksToBounds(true);
6096 6108
6097 gfx::Transform identity_transform; 6109 gfx::Transform identity_transform;
6098 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(), 6110 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(),
6099 gfx::PointF(), gfx::Size(50, 50), true, false, 6111 gfx::PointF(), gfx::Size(50, 50), true, false,
6100 true); 6112 true);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
6141 LayerImpl* render_surface1 = AddChild<LayerImpl>(clip_parent); 6153 LayerImpl* render_surface1 = AddChild<LayerImpl>(clip_parent);
6142 render_surface1->SetDrawsContent(true); 6154 render_surface1->SetDrawsContent(true);
6143 LayerImpl* clip_child = AddChild<LayerImpl>(render_surface1); 6155 LayerImpl* clip_child = AddChild<LayerImpl>(render_surface1);
6144 clip_child->SetDrawsContent(true); 6156 clip_child->SetDrawsContent(true);
6145 LayerImpl* render_surface2 = AddChild<LayerImpl>(clip_parent); 6157 LayerImpl* render_surface2 = AddChild<LayerImpl>(clip_parent);
6146 render_surface2->SetDrawsContent(true); 6158 render_surface2->SetDrawsContent(true);
6147 LayerImpl* non_clip_child = AddChild<LayerImpl>(render_surface2); 6159 LayerImpl* non_clip_child = AddChild<LayerImpl>(render_surface2);
6148 non_clip_child->SetDrawsContent(true); 6160 non_clip_child->SetDrawsContent(true);
6149 6161
6150 clip_child->SetClipParent(clip_parent); 6162 clip_child->SetClipParent(clip_parent);
6151 scoped_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>); 6163 std::unique_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>);
6152 clip_children->insert(clip_child); 6164 clip_children->insert(clip_child);
6153 clip_parent->SetClipChildren(clip_children.release()); 6165 clip_parent->SetClipChildren(clip_children.release());
6154 6166
6155 clip_parent->SetMasksToBounds(true); 6167 clip_parent->SetMasksToBounds(true);
6156 render_surface1->SetMasksToBounds(true); 6168 render_surface1->SetMasksToBounds(true);
6157 6169
6158 gfx::Transform identity_transform; 6170 gfx::Transform identity_transform;
6159 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(), 6171 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(),
6160 gfx::PointF(), gfx::Size(15, 15), true, false, 6172 gfx::PointF(), gfx::Size(15, 15), true, false,
6161 true); 6173 true);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
6249 EXPECT_FALSE(child3->has_render_surface()); 6261 EXPECT_FALSE(child3->has_render_surface());
6250 } 6262 }
6251 6263
6252 TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) { 6264 TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) {
6253 FakeImplTaskRunnerProvider task_runner_provider; 6265 FakeImplTaskRunnerProvider task_runner_provider;
6254 TestSharedBitmapManager shared_bitmap_manager; 6266 TestSharedBitmapManager shared_bitmap_manager;
6255 TestTaskGraphRunner task_graph_runner; 6267 TestTaskGraphRunner task_graph_runner;
6256 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 6268 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
6257 &task_graph_runner); 6269 &task_graph_runner);
6258 6270
6259 scoped_ptr<LayerImpl> root = 6271 std::unique_ptr<LayerImpl> root =
6260 LayerImpl::Create(host_impl.active_tree(), 12345); 6272 LayerImpl::Create(host_impl.active_tree(), 12345);
6261 scoped_ptr<LayerImpl> child1 = 6273 std::unique_ptr<LayerImpl> child1 =
6262 LayerImpl::Create(host_impl.active_tree(), 123456); 6274 LayerImpl::Create(host_impl.active_tree(), 123456);
6263 scoped_ptr<LayerImpl> child2 = 6275 std::unique_ptr<LayerImpl> child2 =
6264 LayerImpl::Create(host_impl.active_tree(), 1234567); 6276 LayerImpl::Create(host_impl.active_tree(), 1234567);
6265 scoped_ptr<LayerImpl> child3 = 6277 std::unique_ptr<LayerImpl> child3 =
6266 LayerImpl::Create(host_impl.active_tree(), 12345678); 6278 LayerImpl::Create(host_impl.active_tree(), 12345678);
6267 6279
6268 gfx::Transform identity_matrix; 6280 gfx::Transform identity_matrix;
6269 gfx::Point3F transform_origin; 6281 gfx::Point3F transform_origin;
6270 gfx::PointF position; 6282 gfx::PointF position;
6271 gfx::Size bounds(100, 100); 6283 gfx::Size bounds(100, 100);
6272 SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin, 6284 SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
6273 position, bounds, true, false, true); 6285 position, bounds, true, false, true);
6274 root->SetDrawsContent(true); 6286 root->SetDrawsContent(true);
6275 6287
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
6544 LayerImpl* scroll_parent_border = AddChildToRoot<LayerImpl>(); 6556 LayerImpl* scroll_parent_border = AddChildToRoot<LayerImpl>();
6545 LayerImpl* scroll_parent_clip = AddChild<LayerImpl>(scroll_parent_border); 6557 LayerImpl* scroll_parent_clip = AddChild<LayerImpl>(scroll_parent_border);
6546 LayerImpl* scroll_parent = AddChild<LayerImpl>(scroll_parent_clip); 6558 LayerImpl* scroll_parent = AddChild<LayerImpl>(scroll_parent_clip);
6547 LayerImpl* scroll_child = AddChild<LayerImpl>(root); 6559 LayerImpl* scroll_child = AddChild<LayerImpl>(root);
6548 6560
6549 scroll_parent->SetDrawsContent(true); 6561 scroll_parent->SetDrawsContent(true);
6550 scroll_child->SetDrawsContent(true); 6562 scroll_child->SetDrawsContent(true);
6551 scroll_parent_clip->SetMasksToBounds(true); 6563 scroll_parent_clip->SetMasksToBounds(true);
6552 6564
6553 scroll_child->SetScrollParent(scroll_parent); 6565 scroll_child->SetScrollParent(scroll_parent);
6554 scoped_ptr<std::set<LayerImpl*>> scroll_children(new std::set<LayerImpl*>); 6566 std::unique_ptr<std::set<LayerImpl*>> scroll_children(
6567 new std::set<LayerImpl*>);
6555 scroll_children->insert(scroll_child); 6568 scroll_children->insert(scroll_child);
6556 scroll_parent->SetScrollChildren(scroll_children.release()); 6569 scroll_parent->SetScrollChildren(scroll_children.release());
6557 6570
6558 gfx::Transform identity_transform; 6571 gfx::Transform identity_transform;
6559 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(), 6572 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(),
6560 gfx::PointF(), gfx::Size(50, 50), true, false, 6573 gfx::PointF(), gfx::Size(50, 50), true, false,
6561 true); 6574 true);
6562 SetLayerPropertiesForTesting(scroll_parent_border, identity_transform, 6575 SetLayerPropertiesForTesting(scroll_parent_border, identity_transform,
6563 gfx::Point3F(), gfx::PointF(), gfx::Size(40, 40), 6576 gfx::Point3F(), gfx::PointF(), gfx::Size(40, 40),
6564 true, false, false); 6577 true, false, false);
(...skipping 21 matching lines...) Expand all
6586 LayerImpl* root = root_layer(); 6599 LayerImpl* root = root_layer();
6587 LayerImpl* scroll_child_target = AddChildToRoot<LayerImpl>(); 6600 LayerImpl* scroll_child_target = AddChildToRoot<LayerImpl>();
6588 LayerImpl* scroll_child = AddChild<LayerImpl>(scroll_child_target); 6601 LayerImpl* scroll_child = AddChild<LayerImpl>(scroll_child_target);
6589 LayerImpl* scroll_parent_target = AddChild<LayerImpl>(scroll_child_target); 6602 LayerImpl* scroll_parent_target = AddChild<LayerImpl>(scroll_child_target);
6590 LayerImpl* scroll_parent = AddChild<LayerImpl>(scroll_parent_target); 6603 LayerImpl* scroll_parent = AddChild<LayerImpl>(scroll_parent_target);
6591 6604
6592 scroll_parent->SetDrawsContent(true); 6605 scroll_parent->SetDrawsContent(true);
6593 scroll_child->SetDrawsContent(true); 6606 scroll_child->SetDrawsContent(true);
6594 6607
6595 scroll_child->SetScrollParent(scroll_parent); 6608 scroll_child->SetScrollParent(scroll_parent);
6596 scoped_ptr<std::set<LayerImpl*>> scroll_children(new std::set<LayerImpl*>); 6609 std::unique_ptr<std::set<LayerImpl*>> scroll_children(
6610 new std::set<LayerImpl*>);
6597 scroll_children->insert(scroll_child); 6611 scroll_children->insert(scroll_child);
6598 scroll_parent->SetScrollChildren(scroll_children.release()); 6612 scroll_parent->SetScrollChildren(scroll_children.release());
6599 6613
6600 gfx::Transform identity_transform; 6614 gfx::Transform identity_transform;
6601 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(), 6615 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(),
6602 gfx::PointF(), gfx::Size(50, 50), true, false, 6616 gfx::PointF(), gfx::Size(50, 50), true, false,
6603 true); 6617 true);
6604 SetLayerPropertiesForTesting(scroll_child_target, identity_transform, 6618 SetLayerPropertiesForTesting(scroll_child_target, identity_transform,
6605 gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50), 6619 gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50),
6606 true, false, true); 6620 true, false, true);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
6693 LayerImpl* scroll_parent_clip = AddChild<LayerImpl>(scroll_parent_border); 6707 LayerImpl* scroll_parent_clip = AddChild<LayerImpl>(scroll_parent_border);
6694 LayerImpl* scroll_parent = AddChild<LayerImpl>(scroll_parent_clip); 6708 LayerImpl* scroll_parent = AddChild<LayerImpl>(scroll_parent_clip);
6695 LayerImpl* scroll_child = AddChild<LayerImpl>(root); 6709 LayerImpl* scroll_child = AddChild<LayerImpl>(root);
6696 6710
6697 scroll_parent->SetDrawsContent(true); 6711 scroll_parent->SetDrawsContent(true);
6698 scroll_child->SetDrawsContent(true); 6712 scroll_child->SetDrawsContent(true);
6699 6713
6700 scroll_parent_clip->SetMasksToBounds(true); 6714 scroll_parent_clip->SetMasksToBounds(true);
6701 6715
6702 scroll_child->SetScrollParent(scroll_parent); 6716 scroll_child->SetScrollParent(scroll_parent);
6703 scoped_ptr<std::set<LayerImpl*>> scroll_children(new std::set<LayerImpl*>); 6717 std::unique_ptr<std::set<LayerImpl*>> scroll_children(
6718 new std::set<LayerImpl*>);
6704 scroll_children->insert(scroll_child); 6719 scroll_children->insert(scroll_child);
6705 scroll_parent->SetScrollChildren(scroll_children.release()); 6720 scroll_parent->SetScrollChildren(scroll_children.release());
6706 6721
6707 gfx::Transform identity_transform; 6722 gfx::Transform identity_transform;
6708 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(), 6723 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(),
6709 gfx::PointF(), gfx::Size(50, 50), true, false, 6724 gfx::PointF(), gfx::Size(50, 50), true, false,
6710 true); 6725 true);
6711 SetLayerPropertiesForTesting(scroll_parent_border, identity_transform, 6726 SetLayerPropertiesForTesting(scroll_parent_border, identity_transform,
6712 gfx::Point3F(), gfx::PointF(), gfx::Size(40, 40), 6727 gfx::Point3F(), gfx::PointF(), gfx::Size(40, 40),
6713 true, false, false); 6728 true, false, false);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
6753 LayerImpl* scroll_grandparent = AddChild<LayerImpl>(scroll_grandparent_clip); 6768 LayerImpl* scroll_grandparent = AddChild<LayerImpl>(scroll_grandparent_clip);
6754 6769
6755 scroll_parent->SetDrawsContent(true); 6770 scroll_parent->SetDrawsContent(true);
6756 scroll_grandparent->SetDrawsContent(true); 6771 scroll_grandparent->SetDrawsContent(true);
6757 scroll_child->SetDrawsContent(true); 6772 scroll_child->SetDrawsContent(true);
6758 6773
6759 scroll_parent_clip->SetMasksToBounds(true); 6774 scroll_parent_clip->SetMasksToBounds(true);
6760 scroll_grandparent_clip->SetMasksToBounds(true); 6775 scroll_grandparent_clip->SetMasksToBounds(true);
6761 6776
6762 scroll_child->SetScrollParent(scroll_parent); 6777 scroll_child->SetScrollParent(scroll_parent);
6763 scoped_ptr<std::set<LayerImpl*>> scroll_children(new std::set<LayerImpl*>); 6778 std::unique_ptr<std::set<LayerImpl*>> scroll_children(
6779 new std::set<LayerImpl*>);
6764 scroll_children->insert(scroll_child); 6780 scroll_children->insert(scroll_child);
6765 scroll_parent->SetScrollChildren(scroll_children.release()); 6781 scroll_parent->SetScrollChildren(scroll_children.release());
6766 6782
6767 scroll_parent_border->SetScrollParent(scroll_grandparent); 6783 scroll_parent_border->SetScrollParent(scroll_grandparent);
6768 scroll_children.reset(new std::set<LayerImpl*>); 6784 scroll_children.reset(new std::set<LayerImpl*>);
6769 scroll_children->insert(scroll_parent_border); 6785 scroll_children->insert(scroll_parent_border);
6770 scroll_grandparent->SetScrollChildren(scroll_children.release()); 6786 scroll_grandparent->SetScrollChildren(scroll_children.release());
6771 6787
6772 gfx::Transform identity_transform; 6788 gfx::Transform identity_transform;
6773 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(), 6789 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(),
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
6842 6858
6843 scroll_parent->SetDrawsContent(true); 6859 scroll_parent->SetDrawsContent(true);
6844 render_surface1->SetDrawsContent(true); 6860 render_surface1->SetDrawsContent(true);
6845 scroll_grandparent->SetDrawsContent(true); 6861 scroll_grandparent->SetDrawsContent(true);
6846 render_surface2->SetDrawsContent(true); 6862 render_surface2->SetDrawsContent(true);
6847 6863
6848 scroll_parent_clip->SetMasksToBounds(true); 6864 scroll_parent_clip->SetMasksToBounds(true);
6849 scroll_grandparent_clip->SetMasksToBounds(true); 6865 scroll_grandparent_clip->SetMasksToBounds(true);
6850 6866
6851 scroll_child->SetScrollParent(scroll_parent); 6867 scroll_child->SetScrollParent(scroll_parent);
6852 scoped_ptr<std::set<LayerImpl*>> scroll_children(new std::set<LayerImpl*>); 6868 std::unique_ptr<std::set<LayerImpl*>> scroll_children(
6869 new std::set<LayerImpl*>);
6853 scroll_children->insert(scroll_child); 6870 scroll_children->insert(scroll_child);
6854 scroll_parent->SetScrollChildren(scroll_children.release()); 6871 scroll_parent->SetScrollChildren(scroll_children.release());
6855 6872
6856 scroll_parent_border->SetScrollParent(scroll_grandparent); 6873 scroll_parent_border->SetScrollParent(scroll_grandparent);
6857 scroll_children.reset(new std::set<LayerImpl*>); 6874 scroll_children.reset(new std::set<LayerImpl*>);
6858 scroll_children->insert(scroll_parent_border); 6875 scroll_children->insert(scroll_parent_border);
6859 scroll_grandparent->SetScrollChildren(scroll_children.release()); 6876 scroll_grandparent->SetScrollChildren(scroll_children.release());
6860 6877
6861 gfx::Transform identity_transform; 6878 gfx::Transform identity_transform;
6862 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(), 6879 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(),
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
6981 // + container 6998 // + container
6982 // + scroller 6999 // + scroller
6983 // + fixed 7000 // + fixed
6984 // 7001 //
6985 FakeImplTaskRunnerProvider task_runner_provider; 7002 FakeImplTaskRunnerProvider task_runner_provider;
6986 TestSharedBitmapManager shared_bitmap_manager; 7003 TestSharedBitmapManager shared_bitmap_manager;
6987 TestTaskGraphRunner task_graph_runner; 7004 TestTaskGraphRunner task_graph_runner;
6988 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 7005 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
6989 &task_graph_runner); 7006 &task_graph_runner);
6990 host_impl.CreatePendingTree(); 7007 host_impl.CreatePendingTree();
6991 scoped_ptr<LayerImpl> root_ptr = 7008 std::unique_ptr<LayerImpl> root_ptr =
6992 LayerImpl::Create(host_impl.active_tree(), 1); 7009 LayerImpl::Create(host_impl.active_tree(), 1);
6993 LayerImpl* root = root_ptr.get(); 7010 LayerImpl* root = root_ptr.get();
6994 scoped_ptr<LayerImpl> container = 7011 std::unique_ptr<LayerImpl> container =
6995 LayerImpl::Create(host_impl.active_tree(), 2); 7012 LayerImpl::Create(host_impl.active_tree(), 2);
6996 LayerImpl* container_layer = container.get(); 7013 LayerImpl* container_layer = container.get();
6997 scoped_ptr<LayerImpl> scroller = 7014 std::unique_ptr<LayerImpl> scroller =
6998 LayerImpl::Create(host_impl.active_tree(), 3); 7015 LayerImpl::Create(host_impl.active_tree(), 3);
6999 LayerImpl* scroll_layer = scroller.get(); 7016 LayerImpl* scroll_layer = scroller.get();
7000 scoped_ptr<LayerImpl> fixed = LayerImpl::Create(host_impl.active_tree(), 4); 7017 std::unique_ptr<LayerImpl> fixed =
7018 LayerImpl::Create(host_impl.active_tree(), 4);
7001 LayerImpl* fixed_layer = fixed.get(); 7019 LayerImpl* fixed_layer = fixed.get();
7002 7020
7003 container->SetIsContainerForFixedPositionLayers(true); 7021 container->SetIsContainerForFixedPositionLayers(true);
7004 7022
7005 LayerPositionConstraint constraint; 7023 LayerPositionConstraint constraint;
7006 constraint.set_is_fixed_position(true); 7024 constraint.set_is_fixed_position(true);
7007 fixed->SetPositionConstraint(constraint); 7025 fixed->SetPositionConstraint(constraint);
7008 7026
7009 scroller->SetScrollClipLayer(container->id()); 7027 scroller->SetScrollClipLayer(container->id());
7010 7028
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
7171 7189
7172 ExecuteCalculateDrawProperties(root); 7190 ExecuteCalculateDrawProperties(root);
7173 7191
7174 gfx::Vector2dF expected_draw_transform_translation(-7.5f, -13.5f); 7192 gfx::Vector2dF expected_draw_transform_translation(-7.5f, -13.5f);
7175 EXPECT_VECTOR2DF_EQ(expected_draw_transform_translation, 7193 EXPECT_VECTOR2DF_EQ(expected_draw_transform_translation,
7176 scroller->DrawTransform().To2dTranslation()); 7194 scroller->DrawTransform().To2dTranslation());
7177 } 7195 }
7178 7196
7179 class AnimationScaleFactorTrackingLayerImpl : public LayerImpl { 7197 class AnimationScaleFactorTrackingLayerImpl : public LayerImpl {
7180 public: 7198 public:
7181 static scoped_ptr<AnimationScaleFactorTrackingLayerImpl> Create( 7199 static std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> Create(
7182 LayerTreeImpl* tree_impl, 7200 LayerTreeImpl* tree_impl,
7183 int id) { 7201 int id) {
7184 return make_scoped_ptr( 7202 return base::WrapUnique(
7185 new AnimationScaleFactorTrackingLayerImpl(tree_impl, id)); 7203 new AnimationScaleFactorTrackingLayerImpl(tree_impl, id));
7186 } 7204 }
7187 7205
7188 ~AnimationScaleFactorTrackingLayerImpl() override {} 7206 ~AnimationScaleFactorTrackingLayerImpl() override {}
7189 7207
7190 private: 7208 private:
7191 explicit AnimationScaleFactorTrackingLayerImpl(LayerTreeImpl* tree_impl, 7209 explicit AnimationScaleFactorTrackingLayerImpl(LayerTreeImpl* tree_impl,
7192 int id) 7210 int id)
7193 : LayerImpl(tree_impl, id) { 7211 : LayerImpl(tree_impl, id) {
7194 SetDrawsContent(true); 7212 SetDrawsContent(true);
7195 } 7213 }
7196 }; 7214 };
7197 7215
7198 TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) { 7216 TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) {
7199 FakeImplTaskRunnerProvider task_runner_provider; 7217 FakeImplTaskRunnerProvider task_runner_provider;
7200 TestSharedBitmapManager shared_bitmap_manager; 7218 TestSharedBitmapManager shared_bitmap_manager;
7201 TestTaskGraphRunner task_graph_runner; 7219 TestTaskGraphRunner task_graph_runner;
7202 LayerTreeSettings settings = host()->settings(); 7220 LayerTreeSettings settings = host()->settings();
7203 settings.layer_transforms_should_scale_layer_contents = true; 7221 settings.layer_transforms_should_scale_layer_contents = true;
7204 FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider, 7222 FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider,
7205 &shared_bitmap_manager, &task_graph_runner); 7223 &shared_bitmap_manager, &task_graph_runner);
7206 gfx::Transform identity_matrix; 7224 gfx::Transform identity_matrix;
7207 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> grand_parent = 7225 std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> grand_parent =
7208 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 1); 7226 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 1);
7209 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> parent = 7227 std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> parent =
7210 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 2); 7228 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 2);
7211 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> child = 7229 std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> child =
7212 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 3); 7230 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 3);
7213 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> grand_child = 7231 std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> grand_child =
7214 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 4); 7232 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 4);
7215 7233
7216 AnimationScaleFactorTrackingLayerImpl* parent_raw = parent.get(); 7234 AnimationScaleFactorTrackingLayerImpl* parent_raw = parent.get();
7217 AnimationScaleFactorTrackingLayerImpl* child_raw = child.get(); 7235 AnimationScaleFactorTrackingLayerImpl* child_raw = child.get();
7218 AnimationScaleFactorTrackingLayerImpl* grand_child_raw = grand_child.get(); 7236 AnimationScaleFactorTrackingLayerImpl* grand_child_raw = grand_child.get();
7219 AnimationScaleFactorTrackingLayerImpl* grand_parent_raw = grand_parent.get(); 7237 AnimationScaleFactorTrackingLayerImpl* grand_parent_raw = grand_parent.get();
7220 7238
7221 child->AddChild(std::move(grand_child)); 7239 child->AddChild(std::move(grand_child));
7222 parent->AddChild(std::move(child)); 7240 parent->AddChild(std::move(child));
7223 grand_parent->AddChild(std::move(parent)); 7241 grand_parent->AddChild(std::move(parent));
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
7554 } 7572 }
7555 7573
7556 TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) { 7574 TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) {
7557 FakeImplTaskRunnerProvider task_runner_provider; 7575 FakeImplTaskRunnerProvider task_runner_provider;
7558 TestSharedBitmapManager shared_bitmap_manager; 7576 TestSharedBitmapManager shared_bitmap_manager;
7559 TestTaskGraphRunner task_graph_runner; 7577 TestTaskGraphRunner task_graph_runner;
7560 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 7578 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
7561 &task_graph_runner); 7579 &task_graph_runner);
7562 gfx::Transform identity_matrix; 7580 gfx::Transform identity_matrix;
7563 7581
7564 scoped_ptr<LayerImpl> grand_parent = 7582 std::unique_ptr<LayerImpl> grand_parent =
7565 LayerImpl::Create(host_impl.active_tree(), 1); 7583 LayerImpl::Create(host_impl.active_tree(), 1);
7566 scoped_ptr<LayerImpl> parent = LayerImpl::Create(host_impl.active_tree(), 3); 7584 std::unique_ptr<LayerImpl> parent =
7567 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.active_tree(), 5); 7585 LayerImpl::Create(host_impl.active_tree(), 3);
7568 scoped_ptr<LayerImpl> grand_child1 = 7586 std::unique_ptr<LayerImpl> child =
7587 LayerImpl::Create(host_impl.active_tree(), 5);
7588 std::unique_ptr<LayerImpl> grand_child1 =
7569 LayerImpl::Create(host_impl.active_tree(), 7); 7589 LayerImpl::Create(host_impl.active_tree(), 7);
7570 scoped_ptr<LayerImpl> grand_child2 = 7590 std::unique_ptr<LayerImpl> grand_child2 =
7571 LayerImpl::Create(host_impl.active_tree(), 9); 7591 LayerImpl::Create(host_impl.active_tree(), 9);
7572 7592
7573 LayerImpl* grand_parent_raw = grand_parent.get(); 7593 LayerImpl* grand_parent_raw = grand_parent.get();
7574 LayerImpl* parent_raw = parent.get(); 7594 LayerImpl* parent_raw = parent.get();
7575 LayerImpl* child_raw = child.get(); 7595 LayerImpl* child_raw = child.get();
7576 LayerImpl* grand_child1_raw = grand_child1.get(); 7596 LayerImpl* grand_child1_raw = grand_child1.get();
7577 LayerImpl* grand_child2_raw = grand_child2.get(); 7597 LayerImpl* grand_child2_raw = grand_child2.get();
7578 7598
7579 child->AddChild(std::move(grand_child1)); 7599 child->AddChild(std::move(grand_child1));
7580 child->AddChild(std::move(grand_child2)); 7600 child->AddChild(std::move(grand_child2));
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
7699 7719
7700 expected.clear(); 7720 expected.clear();
7701 expected.insert(grand_child2_raw); 7721 expected.insert(grand_child2_raw);
7702 expected.insert(child_raw->mask_layer()); 7722 expected.insert(child_raw->mask_layer());
7703 7723
7704 actual.clear(); 7724 actual.clear();
7705 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); 7725 GatherDrawnLayers(render_surface_layer_list_impl(), &actual);
7706 EXPECT_EQ(expected, actual); 7726 EXPECT_EQ(expected, actual);
7707 7727
7708 // Add replica mask layer. 7728 // Add replica mask layer.
7709 scoped_ptr<LayerImpl> replica_layer = 7729 std::unique_ptr<LayerImpl> replica_layer =
7710 LayerImpl::Create(host_impl.active_tree(), 20); 7730 LayerImpl::Create(host_impl.active_tree(), 20);
7711 replica_layer->SetMaskLayer(LayerImpl::Create(host_impl.active_tree(), 21)); 7731 replica_layer->SetMaskLayer(LayerImpl::Create(host_impl.active_tree(), 21));
7712 child_raw->SetReplicaLayer(std::move(replica_layer)); 7732 child_raw->SetReplicaLayer(std::move(replica_layer));
7713 child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; 7733 child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true;
7714 7734
7715 ExecuteCalculateDrawProperties(grand_parent_raw); 7735 ExecuteCalculateDrawProperties(grand_parent_raw);
7716 member_id = render_surface_layer_list_count(); 7736 member_id = render_surface_layer_list_count();
7717 7737
7718 EXPECT_NE(member_id, membership_id(grand_parent_raw)); 7738 EXPECT_NE(member_id, membership_id(grand_parent_raw));
7719 EXPECT_NE(member_id, membership_id(parent_raw)); 7739 EXPECT_NE(member_id, membership_id(parent_raw));
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
7806 7826
7807 TEST_F(LayerTreeHostCommonTest, DrawPropertyScales) { 7827 TEST_F(LayerTreeHostCommonTest, DrawPropertyScales) {
7808 FakeImplTaskRunnerProvider task_runner_provider; 7828 FakeImplTaskRunnerProvider task_runner_provider;
7809 TestSharedBitmapManager shared_bitmap_manager; 7829 TestSharedBitmapManager shared_bitmap_manager;
7810 TestTaskGraphRunner task_graph_runner; 7830 TestTaskGraphRunner task_graph_runner;
7811 LayerTreeSettings settings = host()->settings(); 7831 LayerTreeSettings settings = host()->settings();
7812 settings.layer_transforms_should_scale_layer_contents = true; 7832 settings.layer_transforms_should_scale_layer_contents = true;
7813 FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider, 7833 FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider,
7814 &shared_bitmap_manager, &task_graph_runner); 7834 &shared_bitmap_manager, &task_graph_runner);
7815 7835
7816 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); 7836 std::unique_ptr<LayerImpl> root =
7837 LayerImpl::Create(host_impl.active_tree(), 1);
7817 LayerImpl* root_layer = root.get(); 7838 LayerImpl* root_layer = root.get();
7818 scoped_ptr<LayerImpl> child1 = LayerImpl::Create(host_impl.active_tree(), 2); 7839 std::unique_ptr<LayerImpl> child1 =
7840 LayerImpl::Create(host_impl.active_tree(), 2);
7819 LayerImpl* child1_layer = child1.get(); 7841 LayerImpl* child1_layer = child1.get();
7820 scoped_ptr<LayerImpl> child2 = LayerImpl::Create(host_impl.active_tree(), 3); 7842 std::unique_ptr<LayerImpl> child2 =
7843 LayerImpl::Create(host_impl.active_tree(), 3);
7821 LayerImpl* child2_layer = child2.get(); 7844 LayerImpl* child2_layer = child2.get();
7822 7845
7823 root->AddChild(std::move(child1)); 7846 root->AddChild(std::move(child1));
7824 root->AddChild(std::move(child2)); 7847 root->AddChild(std::move(child2));
7825 root->SetForceRenderSurface(true); 7848 root->SetForceRenderSurface(true);
7826 root->SetDrawsContent(true); 7849 root->SetDrawsContent(true);
7827 host_impl.active_tree()->SetRootLayer(std::move(root)); 7850 host_impl.active_tree()->SetRootLayer(std::move(root));
7828 7851
7829 gfx::Transform identity_matrix, scale_transform_child1, 7852 gfx::Transform identity_matrix, scale_transform_child1,
7830 scale_transform_child2; 7853 scale_transform_child2;
7831 scale_transform_child1.Scale(2, 3); 7854 scale_transform_child1.Scale(2, 3);
7832 scale_transform_child2.Scale(4, 5); 7855 scale_transform_child2.Scale(4, 5);
7833 7856
7834 SetLayerPropertiesForTesting(root_layer, identity_matrix, gfx::Point3F(), 7857 SetLayerPropertiesForTesting(root_layer, identity_matrix, gfx::Point3F(),
7835 gfx::PointF(), gfx::Size(1, 1), true, false, 7858 gfx::PointF(), gfx::Size(1, 1), true, false,
7836 true); 7859 true);
7837 SetLayerPropertiesForTesting(child1_layer, scale_transform_child1, 7860 SetLayerPropertiesForTesting(child1_layer, scale_transform_child1,
7838 gfx::Point3F(), gfx::PointF(), gfx::Size(1, 1), 7861 gfx::Point3F(), gfx::PointF(), gfx::Size(1, 1),
7839 true, false, false); 7862 true, false, false);
7840 7863
7841 child1_layer->SetMaskLayer(LayerImpl::Create(host_impl.active_tree(), 4)); 7864 child1_layer->SetMaskLayer(LayerImpl::Create(host_impl.active_tree(), 4));
7842 child1_layer->SetDrawsContent(true); 7865 child1_layer->SetDrawsContent(true);
7843 7866
7844 scoped_ptr<LayerImpl> replica_layer = 7867 std::unique_ptr<LayerImpl> replica_layer =
7845 LayerImpl::Create(host_impl.active_tree(), 5); 7868 LayerImpl::Create(host_impl.active_tree(), 5);
7846 replica_layer->SetMaskLayer(LayerImpl::Create(host_impl.active_tree(), 6)); 7869 replica_layer->SetMaskLayer(LayerImpl::Create(host_impl.active_tree(), 6));
7847 child1_layer->SetReplicaLayer(std::move(replica_layer)); 7870 child1_layer->SetReplicaLayer(std::move(replica_layer));
7848 child1_layer->SetHasRenderSurface(true); 7871 child1_layer->SetHasRenderSurface(true);
7849 7872
7850 ExecuteCalculateDrawProperties(root_layer); 7873 ExecuteCalculateDrawProperties(root_layer);
7851 7874
7852 TransformOperations scale; 7875 TransformOperations scale;
7853 scale.AppendScale(5.f, 8.f, 3.f); 7876 scale.AppendScale(5.f, 8.f, 3.f);
7854 7877
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
8276 gfx::Transform identity_transform; 8299 gfx::Transform identity_transform;
8277 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), 8300 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(),
8278 gfx::PointF(), gfx::Size(50, 50), true, false); 8301 gfx::PointF(), gfx::Size(50, 50), true, false);
8279 SetLayerPropertiesForTesting(child.get(), identity_transform, gfx::Point3F(), 8302 SetLayerPropertiesForTesting(child.get(), identity_transform, gfx::Point3F(),
8280 gfx::PointF(), gfx::Size(50, 50), true, false); 8303 gfx::PointF(), gfx::Size(50, 50), true, false);
8281 SetLayerPropertiesForTesting(grandchild.get(), identity_transform, 8304 SetLayerPropertiesForTesting(grandchild.get(), identity_transform,
8282 gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50), 8305 gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50),
8283 true, false); 8306 true, false);
8284 host()->SetRootLayer(root); 8307 host()->SetRootLayer(root);
8285 8308
8286 scoped_ptr<KeyframedFilterAnimationCurve> curve( 8309 std::unique_ptr<KeyframedFilterAnimationCurve> curve(
8287 KeyframedFilterAnimationCurve::Create()); 8310 KeyframedFilterAnimationCurve::Create());
8288 FilterOperations start_filters; 8311 FilterOperations start_filters;
8289 start_filters.Append(FilterOperation::CreateBrightnessFilter(0.1f)); 8312 start_filters.Append(FilterOperation::CreateBrightnessFilter(0.1f));
8290 FilterOperations end_filters; 8313 FilterOperations end_filters;
8291 end_filters.Append(FilterOperation::CreateBrightnessFilter(0.3f)); 8314 end_filters.Append(FilterOperation::CreateBrightnessFilter(0.3f));
8292 curve->AddKeyframe( 8315 curve->AddKeyframe(
8293 FilterKeyframe::Create(base::TimeDelta(), start_filters, nullptr)); 8316 FilterKeyframe::Create(base::TimeDelta(), start_filters, nullptr));
8294 curve->AddKeyframe(FilterKeyframe::Create( 8317 curve->AddKeyframe(FilterKeyframe::Create(
8295 base::TimeDelta::FromMilliseconds(100), end_filters, nullptr)); 8318 base::TimeDelta::FromMilliseconds(100), end_filters, nullptr));
8296 scoped_ptr<Animation> animation = 8319 std::unique_ptr<Animation> animation =
8297 Animation::Create(std::move(curve), 0, 1, TargetProperty::FILTER); 8320 Animation::Create(std::move(curve), 0, 1, TargetProperty::FILTER);
8298 animation->set_fill_mode(Animation::FILL_MODE_NONE); 8321 animation->set_fill_mode(Animation::FILL_MODE_NONE);
8299 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); 8322 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000));
8300 8323
8301 AddAnimationToLayerWithPlayer(child->id(), timeline(), std::move(animation)); 8324 AddAnimationToLayerWithPlayer(child->id(), timeline(), std::move(animation));
8302 ExecuteCalculateDrawProperties(root.get()); 8325 ExecuteCalculateDrawProperties(root.get());
8303 8326
8304 EXPECT_TRUE(root->has_render_surface()); 8327 EXPECT_TRUE(root->has_render_surface());
8305 EXPECT_TRUE(child->has_render_surface()); 8328 EXPECT_TRUE(child->has_render_surface());
8306 EXPECT_FALSE(grandchild->has_render_surface()); 8329 EXPECT_FALSE(grandchild->has_render_surface());
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
8561 EXPECT_EQ(gfx::Rect(5, 5, 5, 5), child->visible_layer_rect()); 8584 EXPECT_EQ(gfx::Rect(5, 5, 5, 5), child->visible_layer_rect());
8562 } 8585 }
8563 8586
8564 TEST_F(LayerTreeHostCommonTest, UpdateScrollChildPosition) { 8587 TEST_F(LayerTreeHostCommonTest, UpdateScrollChildPosition) {
8565 LayerImpl* root = root_layer(); 8588 LayerImpl* root = root_layer();
8566 LayerImpl* scroll_parent = AddChild<LayerImpl>(root); 8589 LayerImpl* scroll_parent = AddChild<LayerImpl>(root);
8567 LayerImpl* scroll_child = AddChild<LayerImpl>(scroll_parent); 8590 LayerImpl* scroll_child = AddChild<LayerImpl>(scroll_parent);
8568 8591
8569 scroll_child->SetDrawsContent(true); 8592 scroll_child->SetDrawsContent(true);
8570 scroll_child->SetScrollParent(scroll_parent); 8593 scroll_child->SetScrollParent(scroll_parent);
8571 scoped_ptr<std::set<LayerImpl*>> scroll_children(new std::set<LayerImpl*>); 8594 std::unique_ptr<std::set<LayerImpl*>> scroll_children(
8595 new std::set<LayerImpl*>);
8572 scroll_children->insert(scroll_child); 8596 scroll_children->insert(scroll_child);
8573 scroll_parent->SetScrollChildren(scroll_children.release()); 8597 scroll_parent->SetScrollChildren(scroll_children.release());
8574 scroll_parent->SetDrawsContent(true); 8598 scroll_parent->SetDrawsContent(true);
8575 8599
8576 gfx::Transform identity_transform; 8600 gfx::Transform identity_transform;
8577 gfx::Transform scale; 8601 gfx::Transform scale;
8578 scale.Scale(2.f, 2.f); 8602 scale.Scale(2.f, 2.f);
8579 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(), 8603 SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(),
8580 gfx::PointF(), gfx::Size(50, 50), true, false, 8604 gfx::PointF(), gfx::Size(50, 50), true, false,
8581 true); 8605 true);
8582 SetLayerPropertiesForTesting(scroll_child, scale, gfx::Point3F(), 8606 SetLayerPropertiesForTesting(scroll_child, scale, gfx::Point3F(),
8583 gfx::PointF(), gfx::Size(40, 40), true, false, 8607 gfx::PointF(), gfx::Size(40, 40), true, false,
8584 false); 8608 false);
8585 SetLayerPropertiesForTesting(scroll_parent, identity_transform, 8609 SetLayerPropertiesForTesting(scroll_parent, identity_transform,
8586 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30), 8610 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30),
8587 true, false, false); 8611 true, false, false);
8588 8612
8589 ExecuteCalculateDrawProperties(root); 8613 ExecuteCalculateDrawProperties(root);
8590 EXPECT_EQ(gfx::Rect(25, 25), scroll_child->visible_layer_rect()); 8614 EXPECT_EQ(gfx::Rect(25, 25), scroll_child->visible_layer_rect());
8591 8615
8592 scroll_child->SetPosition(gfx::PointF(0, -10.f)); 8616 scroll_child->SetPosition(gfx::PointF(0, -10.f));
8593 scroll_parent->SetCurrentScrollOffset(gfx::ScrollOffset(0.f, 10.f)); 8617 scroll_parent->SetCurrentScrollOffset(gfx::ScrollOffset(0.f, 10.f));
8594 root->layer_tree_impl()->property_trees()->needs_rebuild = true; 8618 root->layer_tree_impl()->property_trees()->needs_rebuild = true;
8595 ExecuteCalculateDrawProperties(root); 8619 ExecuteCalculateDrawProperties(root);
8596 EXPECT_EQ(gfx::Rect(0, 5, 25, 25), scroll_child->visible_layer_rect()); 8620 EXPECT_EQ(gfx::Rect(0, 5, 25, 25), scroll_child->visible_layer_rect());
8597 } 8621 }
8598 8622
8599 static void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) { 8623 static void CopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {}
8600 }
8601 8624
8602 TEST_F(LayerTreeHostCommonTest, NumCopyRequestsInTargetSubtree) { 8625 TEST_F(LayerTreeHostCommonTest, NumCopyRequestsInTargetSubtree) {
8603 // If the layer has a node in effect_tree, the return value of 8626 // If the layer has a node in effect_tree, the return value of
8604 // num_copy_requests_in_target_subtree() must be equal to the actual number 8627 // num_copy_requests_in_target_subtree() must be equal to the actual number
8605 // of copy requests in the sub-layer_tree; Otherwise, the number is expected 8628 // of copy requests in the sub-layer_tree; Otherwise, the number is expected
8606 // to be the value of its nearest ancestor that owns an effect node and 8629 // to be the value of its nearest ancestor that owns an effect node and
8607 // greater than or equal to the actual number of copy requests in the 8630 // greater than or equal to the actual number of copy requests in the
8608 // sub-layer_tree. 8631 // sub-layer_tree.
8609 8632
8610 scoped_refptr<Layer> root = Layer::Create(); 8633 scoped_refptr<Layer> root = Layer::Create();
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
8681 EXPECT_EQ(gfx::Rect(0, 0), grandchild->visible_layer_rect_for_testing()); 8704 EXPECT_EQ(gfx::Rect(0, 0), grandchild->visible_layer_rect_for_testing());
8682 child->SetHideLayerAndSubtree(false); 8705 child->SetHideLayerAndSubtree(false);
8683 8706
8684 gfx::Transform zero_z_scale; 8707 gfx::Transform zero_z_scale;
8685 zero_z_scale.Scale3d(1, 1, 0); 8708 zero_z_scale.Scale3d(1, 1, 0);
8686 child->SetTransform(zero_z_scale); 8709 child->SetTransform(zero_z_scale);
8687 8710
8688 // Add a transform animation with a start delay. Now, even though |child| has 8711 // Add a transform animation with a start delay. Now, even though |child| has
8689 // a singular transform, the subtree should still get processed. 8712 // a singular transform, the subtree should still get processed.
8690 int animation_id = 0; 8713 int animation_id = 0;
8691 scoped_ptr<Animation> animation = Animation::Create( 8714 std::unique_ptr<Animation> animation = Animation::Create(
8692 scoped_ptr<AnimationCurve>(new FakeTransformTransition(1.0)), 8715 std::unique_ptr<AnimationCurve>(new FakeTransformTransition(1.0)),
8693 animation_id, 1, TargetProperty::TRANSFORM); 8716 animation_id, 1, TargetProperty::TRANSFORM);
8694 animation->set_fill_mode(Animation::FILL_MODE_NONE); 8717 animation->set_fill_mode(Animation::FILL_MODE_NONE);
8695 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); 8718 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000));
8696 AddAnimationToLayerWithPlayer(child->id(), timeline(), std::move(animation)); 8719 AddAnimationToLayerWithPlayer(child->id(), timeline(), std::move(animation));
8697 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); 8720 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
8698 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing()); 8721 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing());
8699 grandchild->set_visible_layer_rect(gfx::Rect()); 8722 grandchild->set_visible_layer_rect(gfx::Rect());
8700 8723
8701 RemoveAnimationFromLayerWithExistingPlayer(child->id(), timeline(), 8724 RemoveAnimationFromLayerWithExistingPlayer(child->id(), timeline(),
8702 animation_id); 8725 animation_id);
8703 child->SetTransform(identity); 8726 child->SetTransform(identity);
8704 child->SetOpacity(0.f); 8727 child->SetOpacity(0.f);
8705 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); 8728 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
8706 EXPECT_EQ(gfx::Rect(0, 0), grandchild->visible_layer_rect_for_testing()); 8729 EXPECT_EQ(gfx::Rect(0, 0), grandchild->visible_layer_rect_for_testing());
8707 8730
8708 // Now, even though child has zero opacity, we will configure |grandchild| and 8731 // Now, even though child has zero opacity, we will configure |grandchild| and
8709 // |greatgrandchild| in several ways that should force the subtree to be 8732 // |greatgrandchild| in several ways that should force the subtree to be
8710 // processed anyhow. 8733 // processed anyhow.
8711 grandchild->RequestCopyOfOutput( 8734 grandchild->RequestCopyOfOutput(
8712 CopyOutputRequest::CreateBitmapRequest(base::Bind(&CopyOutputCallback))); 8735 CopyOutputRequest::CreateBitmapRequest(base::Bind(&CopyOutputCallback)));
8713 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); 8736 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
8714 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing()); 8737 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing());
8715 greatgrandchild->set_visible_layer_rect(gfx::Rect()); 8738 greatgrandchild->set_visible_layer_rect(gfx::Rect());
8716 8739
8717 // Add an opacity animation with a start delay. 8740 // Add an opacity animation with a start delay.
8718 animation_id = 1; 8741 animation_id = 1;
8719 animation = Animation::Create( 8742 animation = Animation::Create(
8720 scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), 8743 std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)),
8721 animation_id, 1, TargetProperty::OPACITY); 8744 animation_id, 1, TargetProperty::OPACITY);
8722 animation->set_fill_mode(Animation::FILL_MODE_NONE); 8745 animation->set_fill_mode(Animation::FILL_MODE_NONE);
8723 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); 8746 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000));
8724 AddAnimationToLayerWithExistingPlayer(child->id(), timeline(), 8747 AddAnimationToLayerWithExistingPlayer(child->id(), timeline(),
8725 std::move(animation)); 8748 std::move(animation));
8726 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); 8749 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
8727 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing()); 8750 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing());
8728 } 8751 }
8729 8752
8730 TEST_F(LayerTreeHostCommonTest, SkippingLayerImpl) { 8753 TEST_F(LayerTreeHostCommonTest, SkippingLayerImpl) {
8731 FakeImplTaskRunnerProvider task_runner_provider; 8754 FakeImplTaskRunnerProvider task_runner_provider;
8732 TestSharedBitmapManager shared_bitmap_manager; 8755 TestSharedBitmapManager shared_bitmap_manager;
8733 TestTaskGraphRunner task_graph_runner; 8756 TestTaskGraphRunner task_graph_runner;
8734 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 8757 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
8735 &task_graph_runner); 8758 &task_graph_runner);
8736 8759
8737 gfx::Transform identity; 8760 gfx::Transform identity;
8738 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); 8761 std::unique_ptr<LayerImpl> root =
8739 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.active_tree(), 2); 8762 LayerImpl::Create(host_impl.active_tree(), 1);
8740 scoped_ptr<LayerImpl> grandchild = 8763 std::unique_ptr<LayerImpl> child =
8764 LayerImpl::Create(host_impl.active_tree(), 2);
8765 std::unique_ptr<LayerImpl> grandchild =
8741 LayerImpl::Create(host_impl.active_tree(), 3); 8766 LayerImpl::Create(host_impl.active_tree(), 3);
8742 8767
8743 scoped_ptr<FakePictureLayerImpl> greatgrandchild( 8768 std::unique_ptr<FakePictureLayerImpl> greatgrandchild(
8744 FakePictureLayerImpl::Create(host_impl.active_tree(), 4)); 8769 FakePictureLayerImpl::Create(host_impl.active_tree(), 4));
8745 8770
8746 child->SetDrawsContent(true); 8771 child->SetDrawsContent(true);
8747 grandchild->SetDrawsContent(true); 8772 grandchild->SetDrawsContent(true);
8748 greatgrandchild->SetDrawsContent(true); 8773 greatgrandchild->SetDrawsContent(true);
8749 8774
8750 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), 8775 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(),
8751 gfx::PointF(), gfx::Size(100, 100), true, false, 8776 gfx::PointF(), gfx::Size(100, 100), true, false,
8752 true); 8777 true);
8753 SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(), 8778 SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(),
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
8818 child_ptr->SetOpacity(0.7f); 8843 child_ptr->SetOpacity(0.7f);
8819 host_impl.active_tree()->property_trees()->needs_rebuild = true; 8844 host_impl.active_tree()->property_trees()->needs_rebuild = true;
8820 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); 8845 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr);
8821 EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect()); 8846 EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect());
8822 root_ptr->SetOpacity(1.f); 8847 root_ptr->SetOpacity(1.f);
8823 8848
8824 child_ptr->SetOpacity(0.f); 8849 child_ptr->SetOpacity(0.f);
8825 // Now, even though child has zero opacity, we will configure |grandchild| and 8850 // Now, even though child has zero opacity, we will configure |grandchild| and
8826 // |greatgrandchild| in several ways that should force the subtree to be 8851 // |greatgrandchild| in several ways that should force the subtree to be
8827 // processed anyhow. 8852 // processed anyhow.
8828 std::vector<scoped_ptr<CopyOutputRequest>> requests; 8853 std::vector<std::unique_ptr<CopyOutputRequest>> requests;
8829 requests.push_back(CopyOutputRequest::CreateEmptyRequest()); 8854 requests.push_back(CopyOutputRequest::CreateEmptyRequest());
8830 8855
8831 grandchild_ptr->PassCopyRequests(&requests); 8856 grandchild_ptr->PassCopyRequests(&requests);
8832 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true; 8857 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true;
8833 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); 8858 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr);
8834 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); 8859 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect());
8835 requests.clear(); 8860 requests.clear();
8836 grandchild_ptr->PassCopyRequests(&requests); 8861 grandchild_ptr->PassCopyRequests(&requests);
8837 child_ptr->SetOpacity(1.f); 8862 child_ptr->SetOpacity(1.f);
8838 8863
8839 // A double sided render surface with backface visible should not be skipped 8864 // A double sided render surface with backface visible should not be skipped
8840 grandchild_ptr->set_visible_layer_rect(gfx::Rect()); 8865 grandchild_ptr->set_visible_layer_rect(gfx::Rect());
8841 child_ptr->SetHasRenderSurface(true); 8866 child_ptr->SetHasRenderSurface(true);
8842 child_ptr->SetDoubleSided(true); 8867 child_ptr->SetDoubleSided(true);
8843 child_ptr->SetTransform(rotate_back_and_translate); 8868 child_ptr->SetTransform(rotate_back_and_translate);
8844 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true; 8869 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true;
8845 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); 8870 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr);
8846 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); 8871 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect());
8847 child_ptr->SetTransform(identity); 8872 child_ptr->SetTransform(identity);
8848 8873
8849 scoped_ptr<KeyframedTransformAnimationCurve> curve( 8874 std::unique_ptr<KeyframedTransformAnimationCurve> curve(
8850 KeyframedTransformAnimationCurve::Create()); 8875 KeyframedTransformAnimationCurve::Create());
8851 TransformOperations start; 8876 TransformOperations start;
8852 start.AppendTranslate(1.f, 2.f, 3.f); 8877 start.AppendTranslate(1.f, 2.f, 3.f);
8853 gfx::Transform transform; 8878 gfx::Transform transform;
8854 transform.Scale3d(1.0, 2.0, 3.0); 8879 transform.Scale3d(1.0, 2.0, 3.0);
8855 TransformOperations operation; 8880 TransformOperations operation;
8856 operation.AppendMatrix(transform); 8881 operation.AppendMatrix(transform);
8857 curve->AddKeyframe( 8882 curve->AddKeyframe(
8858 TransformKeyframe::Create(base::TimeDelta(), start, nullptr)); 8883 TransformKeyframe::Create(base::TimeDelta(), start, nullptr));
8859 curve->AddKeyframe(TransformKeyframe::Create( 8884 curve->AddKeyframe(TransformKeyframe::Create(
8860 base::TimeDelta::FromSecondsD(1.0), operation, nullptr)); 8885 base::TimeDelta::FromSecondsD(1.0), operation, nullptr));
8861 scoped_ptr<Animation> transform_animation( 8886 std::unique_ptr<Animation> transform_animation(
8862 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM)); 8887 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM));
8863 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); 8888 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1));
8864 host_impl.active_tree()->animation_host()->RegisterPlayerForLayer( 8889 host_impl.active_tree()->animation_host()->RegisterPlayerForLayer(
8865 root_ptr->id(), player.get()); 8890 root_ptr->id(), player.get());
8866 host_impl.active_tree() 8891 host_impl.active_tree()
8867 ->animation_host() 8892 ->animation_host()
8868 ->GetControllerForLayerId(root_ptr->id()) 8893 ->GetControllerForLayerId(root_ptr->id())
8869 ->AddAnimation(std::move(transform_animation)); 8894 ->AddAnimation(std::move(transform_animation));
8870 grandchild_ptr->set_visible_layer_rect(gfx::Rect()); 8895 grandchild_ptr->set_visible_layer_rect(gfx::Rect());
8871 child_ptr->SetScrollClipLayer(root_ptr->id()); 8896 child_ptr->SetScrollClipLayer(root_ptr->id());
8872 root_ptr->SetTransform(singular); 8897 root_ptr->SetTransform(singular);
8873 child_ptr->SetTransform(singular); 8898 child_ptr->SetTransform(singular);
8874 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true; 8899 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true;
8875 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); 8900 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr);
8876 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); 8901 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect());
8877 8902
8878 host_impl.active_tree()->animation_host()->UnregisterPlayerForLayer( 8903 host_impl.active_tree()->animation_host()->UnregisterPlayerForLayer(
8879 root_ptr->id(), player.get()); 8904 root_ptr->id(), player.get());
8880 } 8905 }
8881 8906
8882 TEST_F(LayerTreeHostCommonTest, SkippingPendingLayerImpl) { 8907 TEST_F(LayerTreeHostCommonTest, SkippingPendingLayerImpl) {
8883 FakeImplTaskRunnerProvider task_runner_provider; 8908 FakeImplTaskRunnerProvider task_runner_provider;
8884 TestSharedBitmapManager shared_bitmap_manager; 8909 TestSharedBitmapManager shared_bitmap_manager;
8885 TestTaskGraphRunner task_graph_runner; 8910 TestTaskGraphRunner task_graph_runner;
8886 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 8911 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
8887 &task_graph_runner); 8912 &task_graph_runner);
8888 8913
8889 gfx::Transform identity; 8914 gfx::Transform identity;
8890 host_impl.CreatePendingTree(); 8915 host_impl.CreatePendingTree();
8891 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); 8916 std::unique_ptr<LayerImpl> root =
8892 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2); 8917 LayerImpl::Create(host_impl.pending_tree(), 1);
8893 scoped_ptr<LayerImpl> grandchild = 8918 std::unique_ptr<LayerImpl> child =
8919 LayerImpl::Create(host_impl.pending_tree(), 2);
8920 std::unique_ptr<LayerImpl> grandchild =
8894 LayerImpl::Create(host_impl.pending_tree(), 3); 8921 LayerImpl::Create(host_impl.pending_tree(), 3);
8895 8922
8896 scoped_ptr<FakePictureLayerImpl> greatgrandchild( 8923 std::unique_ptr<FakePictureLayerImpl> greatgrandchild(
8897 FakePictureLayerImpl::Create(host_impl.pending_tree(), 4)); 8924 FakePictureLayerImpl::Create(host_impl.pending_tree(), 4));
8898 8925
8899 child->SetDrawsContent(true); 8926 child->SetDrawsContent(true);
8900 grandchild->SetDrawsContent(true); 8927 grandchild->SetDrawsContent(true);
8901 greatgrandchild->SetDrawsContent(true); 8928 greatgrandchild->SetDrawsContent(true);
8902 8929
8903 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), 8930 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(),
8904 gfx::PointF(), gfx::Size(100, 100), true, false, 8931 gfx::PointF(), gfx::Size(100, 100), true, false,
8905 true); 8932 true);
8906 SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(), 8933 SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(),
8907 gfx::PointF(), gfx::Size(10, 10), true, false, 8934 gfx::PointF(), gfx::Size(10, 10), true, false,
8908 false); 8935 false);
8909 SetLayerPropertiesForTesting(grandchild.get(), identity, gfx::Point3F(), 8936 SetLayerPropertiesForTesting(grandchild.get(), identity, gfx::Point3F(),
8910 gfx::PointF(), gfx::Size(10, 10), true, false, 8937 gfx::PointF(), gfx::Size(10, 10), true, false,
8911 false); 8938 false);
8912 8939
8913 LayerImpl* root_ptr = root.get(); 8940 LayerImpl* root_ptr = root.get();
8914 LayerImpl* grandchild_ptr = grandchild.get(); 8941 LayerImpl* grandchild_ptr = grandchild.get();
8915 8942
8916 child->AddChild(std::move(grandchild)); 8943 child->AddChild(std::move(grandchild));
8917 root->AddChild(std::move(child)); 8944 root->AddChild(std::move(child));
8918 8945
8919 host_impl.pending_tree()->SetRootLayer(std::move(root)); 8946 host_impl.pending_tree()->SetRootLayer(std::move(root));
8920 8947
8921 // Check the non-skipped case. 8948 // Check the non-skipped case.
8922 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); 8949 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr);
8923 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); 8950 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect());
8924 8951
8925 scoped_ptr<KeyframedFloatAnimationCurve> curve( 8952 std::unique_ptr<KeyframedFloatAnimationCurve> curve(
8926 KeyframedFloatAnimationCurve::Create()); 8953 KeyframedFloatAnimationCurve::Create());
8927 scoped_ptr<TimingFunction> func = EaseTimingFunction::Create(); 8954 std::unique_ptr<TimingFunction> func = EaseTimingFunction::Create();
8928 curve->AddKeyframe( 8955 curve->AddKeyframe(
8929 FloatKeyframe::Create(base::TimeDelta(), 0.9f, std::move(func))); 8956 FloatKeyframe::Create(base::TimeDelta(), 0.9f, std::move(func)));
8930 curve->AddKeyframe( 8957 curve->AddKeyframe(
8931 FloatKeyframe::Create(base::TimeDelta::FromSecondsD(1.0), 0.3f, nullptr)); 8958 FloatKeyframe::Create(base::TimeDelta::FromSecondsD(1.0), 0.3f, nullptr));
8932 scoped_ptr<Animation> animation( 8959 std::unique_ptr<Animation> animation(
8933 Animation::Create(std::move(curve), 3, 3, TargetProperty::OPACITY)); 8960 Animation::Create(std::move(curve), 3, 3, TargetProperty::OPACITY));
8934 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); 8961 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1));
8935 host_impl.active_tree()->animation_host()->RegisterPlayerForLayer( 8962 host_impl.active_tree()->animation_host()->RegisterPlayerForLayer(
8936 root_ptr->id(), player.get()); 8963 root_ptr->id(), player.get());
8937 host_impl.active_tree() 8964 host_impl.active_tree()
8938 ->animation_host() 8965 ->animation_host()
8939 ->GetControllerForLayerId(root_ptr->id()) 8966 ->GetControllerForLayerId(root_ptr->id())
8940 ->AddAnimation(std::move(animation)); 8967 ->AddAnimation(std::move(animation));
8941 root_ptr->SetOpacity(0); 8968 root_ptr->SetOpacity(0);
8942 grandchild_ptr->set_visible_layer_rect(gfx::Rect()); 8969 grandchild_ptr->set_visible_layer_rect(gfx::Rect());
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
9179 AddChild<LayerImpl>(between_clip_parent_and_child); 9206 AddChild<LayerImpl>(between_clip_parent_and_child);
9180 LayerImpl* test_layer = AddChild<LayerImpl>(render_surface); 9207 LayerImpl* test_layer = AddChild<LayerImpl>(render_surface);
9181 9208
9182 const gfx::Transform identity_matrix; 9209 const gfx::Transform identity_matrix;
9183 gfx::Transform translate; 9210 gfx::Transform translate;
9184 translate.Translate(2.0, 2.0); 9211 translate.Translate(2.0, 2.0);
9185 9212
9186 clip_parent->SetMasksToBounds(true); 9213 clip_parent->SetMasksToBounds(true);
9187 test_layer->SetDrawsContent(true); 9214 test_layer->SetDrawsContent(true);
9188 render_surface->SetClipParent(clip_parent); 9215 render_surface->SetClipParent(clip_parent);
9189 scoped_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>); 9216 std::unique_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>);
9190 clip_children->insert(render_surface); 9217 clip_children->insert(render_surface);
9191 clip_parent->SetClipChildren(clip_children.release()); 9218 clip_parent->SetClipChildren(clip_children.release());
9192 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(), 9219 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(),
9193 gfx::PointF(), gfx::Size(30, 30), true, false, 9220 gfx::PointF(), gfx::Size(30, 30), true, false,
9194 true); 9221 true);
9195 SetLayerPropertiesForTesting(clip_parent, translate, gfx::Point3F(), 9222 SetLayerPropertiesForTesting(clip_parent, translate, gfx::Point3F(),
9196 gfx::PointF(), gfx::Size(30, 30), true, false, 9223 gfx::PointF(), gfx::Size(30, 30), true, false,
9197 false); 9224 false);
9198 SetLayerPropertiesForTesting(between_clip_parent_and_child, translate, 9225 SetLayerPropertiesForTesting(between_clip_parent_and_child, translate,
9199 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30), 9226 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30),
(...skipping 22 matching lines...) Expand all
9222 LayerImpl* clip_parent = AddChildToRoot<LayerImpl>(); 9249 LayerImpl* clip_parent = AddChildToRoot<LayerImpl>();
9223 LayerImpl* render_surface = AddChild<LayerImpl>(clip_parent); 9250 LayerImpl* render_surface = AddChild<LayerImpl>(clip_parent);
9224 LayerImpl* clip_child = AddChild<LayerImpl>(render_surface); 9251 LayerImpl* clip_child = AddChild<LayerImpl>(render_surface);
9225 LayerImpl* child = AddChild<LayerImpl>(render_surface); 9252 LayerImpl* child = AddChild<LayerImpl>(render_surface);
9226 9253
9227 const gfx::Transform identity_matrix; 9254 const gfx::Transform identity_matrix;
9228 9255
9229 clip_child->SetDrawsContent(true); 9256 clip_child->SetDrawsContent(true);
9230 child->SetDrawsContent(true); 9257 child->SetDrawsContent(true);
9231 clip_child->SetClipParent(clip_parent); 9258 clip_child->SetClipParent(clip_parent);
9232 scoped_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>); 9259 std::unique_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>);
9233 clip_children->insert(clip_child); 9260 clip_children->insert(clip_child);
9234 clip_parent->SetClipChildren(clip_children.release()); 9261 clip_parent->SetClipChildren(clip_children.release());
9235 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(), 9262 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(),
9236 gfx::PointF(), gfx::Size(30, 10), true, false, 9263 gfx::PointF(), gfx::Size(30, 10), true, false,
9237 true); 9264 true);
9238 SetLayerPropertiesForTesting(clip_parent, identity_matrix, gfx::Point3F(), 9265 SetLayerPropertiesForTesting(clip_parent, identity_matrix, gfx::Point3F(),
9239 gfx::PointF(), gfx::Size(30, 30), true, false, 9266 gfx::PointF(), gfx::Size(30, 30), true, false,
9240 false); 9267 false);
9241 SetLayerPropertiesForTesting(render_surface, identity_matrix, gfx::Point3F(), 9268 SetLayerPropertiesForTesting(render_surface, identity_matrix, gfx::Point3F(),
9242 gfx::PointF(), gfx::Size(10, 15), true, false, 9269 gfx::PointF(), gfx::Size(10, 15), true, false,
(...skipping 19 matching lines...) Expand all
9262 LayerImpl* test_layer2 = AddChild<LayerImpl>(clip_child); 9289 LayerImpl* test_layer2 = AddChild<LayerImpl>(clip_child);
9263 9290
9264 const gfx::Transform identity_matrix; 9291 const gfx::Transform identity_matrix;
9265 root->SetMasksToBounds(true); 9292 root->SetMasksToBounds(true);
9266 render_surface->SetMasksToBounds(true); 9293 render_surface->SetMasksToBounds(true);
9267 render_surface->SetDrawsContent(true); 9294 render_surface->SetDrawsContent(true);
9268 clip_child->SetDrawsContent(true); 9295 clip_child->SetDrawsContent(true);
9269 test_layer1->SetDrawsContent(true); 9296 test_layer1->SetDrawsContent(true);
9270 test_layer2->SetDrawsContent(true); 9297 test_layer2->SetDrawsContent(true);
9271 clip_child->SetClipParent(clip_parent); 9298 clip_child->SetClipParent(clip_parent);
9272 scoped_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>); 9299 std::unique_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>);
9273 clip_children->insert(clip_child); 9300 clip_children->insert(clip_child);
9274 clip_parent->SetClipChildren(clip_children.release()); 9301 clip_parent->SetClipChildren(clip_children.release());
9275 9302
9276 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(), 9303 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(),
9277 gfx::PointF(), gfx::Size(30, 30), true, false, 9304 gfx::PointF(), gfx::Size(30, 30), true, false,
9278 true); 9305 true);
9279 SetLayerPropertiesForTesting(clip_parent, identity_matrix, gfx::Point3F(), 9306 SetLayerPropertiesForTesting(clip_parent, identity_matrix, gfx::Point3F(),
9280 gfx::PointF(), gfx::Size(30, 30), true, false, 9307 gfx::PointF(), gfx::Size(30, 30), true, false,
9281 false); 9308 false);
9282 SetLayerPropertiesForTesting(render_surface, identity_matrix, gfx::Point3F(), 9309 SetLayerPropertiesForTesting(render_surface, identity_matrix, gfx::Point3F(),
(...skipping 22 matching lines...) Expand all
9305 LayerImpl* render_surface = AddChild<LayerImpl>(clip_parent); 9332 LayerImpl* render_surface = AddChild<LayerImpl>(clip_parent);
9306 LayerImpl* clip_child = AddChild<LayerImpl>(render_surface); 9333 LayerImpl* clip_child = AddChild<LayerImpl>(render_surface);
9307 9334
9308 const gfx::Transform identity_matrix; 9335 const gfx::Transform identity_matrix;
9309 clip_parent->SetDrawsContent(true); 9336 clip_parent->SetDrawsContent(true);
9310 render_surface->SetMasksToBounds(true); 9337 render_surface->SetMasksToBounds(true);
9311 render_surface->SetDrawsContent(true); 9338 render_surface->SetDrawsContent(true);
9312 clip_child->SetDrawsContent(true); 9339 clip_child->SetDrawsContent(true);
9313 9340
9314 clip_child->SetClipParent(clip_parent); 9341 clip_child->SetClipParent(clip_parent);
9315 scoped_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>); 9342 std::unique_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>);
9316 clip_children->insert(clip_child); 9343 clip_children->insert(clip_child);
9317 clip_parent->SetClipChildren(clip_children.release()); 9344 clip_parent->SetClipChildren(clip_children.release());
9318 9345
9319 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(), 9346 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(),
9320 gfx::PointF(), gfx::Size(50, 50), true, false, 9347 gfx::PointF(), gfx::Size(50, 50), true, false,
9321 true); 9348 true);
9322 SetLayerPropertiesForTesting(clip_parent, identity_matrix, gfx::Point3F(), 9349 SetLayerPropertiesForTesting(clip_parent, identity_matrix, gfx::Point3F(),
9323 gfx::PointF(), gfx::Size(50, 50), true, false, 9350 gfx::PointF(), gfx::Size(50, 50), true, false,
9324 false); 9351 false);
9325 SetLayerPropertiesForTesting(render_surface, identity_matrix, gfx::Point3F(), 9352 SetLayerPropertiesForTesting(render_surface, identity_matrix, gfx::Point3F(),
(...skipping 23 matching lines...) Expand all
9349 LayerImpl* unclipped_desc_surface2 = 9376 LayerImpl* unclipped_desc_surface2 =
9350 AddChild<LayerImpl>(unclipped_desc_surface); 9377 AddChild<LayerImpl>(unclipped_desc_surface);
9351 LayerImpl* clip_child = AddChild<LayerImpl>(unclipped_desc_surface2); 9378 LayerImpl* clip_child = AddChild<LayerImpl>(unclipped_desc_surface2);
9352 LayerImpl* clipped_surface = AddChild<LayerImpl>(clip_child); 9379 LayerImpl* clipped_surface = AddChild<LayerImpl>(clip_child);
9353 9380
9354 unclipped_surface->SetDrawsContent(true); 9381 unclipped_surface->SetDrawsContent(true);
9355 unclipped_desc_surface->SetDrawsContent(true); 9382 unclipped_desc_surface->SetDrawsContent(true);
9356 unclipped_desc_surface2->SetDrawsContent(true); 9383 unclipped_desc_surface2->SetDrawsContent(true);
9357 clipped_surface->SetDrawsContent(true); 9384 clipped_surface->SetDrawsContent(true);
9358 clip_child->SetClipParent(clip_parent); 9385 clip_child->SetClipParent(clip_parent);
9359 scoped_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>); 9386 std::unique_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>);
9360 clip_children->insert(clip_child); 9387 clip_children->insert(clip_child);
9361 clip_parent->SetClipChildren(clip_children.release()); 9388 clip_parent->SetClipChildren(clip_children.release());
9362 9389
9363 gfx::Transform identity_matrix; 9390 gfx::Transform identity_matrix;
9364 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(), 9391 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(),
9365 gfx::PointF(), gfx::Size(80, 80), true, false, 9392 gfx::PointF(), gfx::Size(80, 80), true, false,
9366 true); 9393 true);
9367 SetLayerPropertiesForTesting(unclipped_surface, identity_matrix, 9394 SetLayerPropertiesForTesting(unclipped_surface, identity_matrix,
9368 gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50), 9395 gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50),
9369 true, false, true); 9396 true, false, true);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
9403 LayerImpl* root = root_layer(); 9430 LayerImpl* root = root_layer();
9404 LayerImpl* surface = AddChildToRoot<LayerImpl>(); 9431 LayerImpl* surface = AddChildToRoot<LayerImpl>();
9405 LayerImpl* clip_layer = AddChild<LayerImpl>(surface); 9432 LayerImpl* clip_layer = AddChild<LayerImpl>(surface);
9406 LayerImpl* clip_parent = AddChild<LayerImpl>(clip_layer); 9433 LayerImpl* clip_parent = AddChild<LayerImpl>(clip_layer);
9407 LayerImpl* unclipped_desc_surface = AddChild<LayerImpl>(clip_parent); 9434 LayerImpl* unclipped_desc_surface = AddChild<LayerImpl>(clip_parent);
9408 LayerImpl* clip_child = AddChild<LayerImpl>(unclipped_desc_surface); 9435 LayerImpl* clip_child = AddChild<LayerImpl>(unclipped_desc_surface);
9409 9436
9410 clip_child->SetDrawsContent(true); 9437 clip_child->SetDrawsContent(true);
9411 unclipped_desc_surface->SetDrawsContent(true); 9438 unclipped_desc_surface->SetDrawsContent(true);
9412 clip_child->SetClipParent(clip_parent); 9439 clip_child->SetClipParent(clip_parent);
9413 scoped_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>); 9440 std::unique_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>);
9414 clip_children->insert(clip_child); 9441 clip_children->insert(clip_child);
9415 clip_parent->SetClipChildren(clip_children.release()); 9442 clip_parent->SetClipChildren(clip_children.release());
9416 9443
9417 gfx::Transform identity_matrix; 9444 gfx::Transform identity_matrix;
9418 gfx::Transform translate; 9445 gfx::Transform translate;
9419 translate.Translate(10, 10); 9446 translate.Translate(10, 10);
9420 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(), 9447 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(),
9421 gfx::PointF(), gfx::Size(100, 100), true, false, 9448 gfx::PointF(), gfx::Size(100, 100), true, false,
9422 true); 9449 true);
9423 SetLayerPropertiesForTesting(surface, identity_matrix, gfx::Point3F(), 9450 SetLayerPropertiesForTesting(surface, identity_matrix, gfx::Point3F(),
(...skipping 24 matching lines...) Expand all
9448 LayerImpl* root = root_layer(); 9475 LayerImpl* root = root_layer();
9449 LayerImpl* surface = AddChildToRoot<LayerImpl>(); 9476 LayerImpl* surface = AddChildToRoot<LayerImpl>();
9450 LayerImpl* clip_layer = AddChild<LayerImpl>(surface); 9477 LayerImpl* clip_layer = AddChild<LayerImpl>(surface);
9451 LayerImpl* clip_parent = AddChild<LayerImpl>(clip_layer); 9478 LayerImpl* clip_parent = AddChild<LayerImpl>(clip_layer);
9452 LayerImpl* unclipped_desc_surface = AddChild<LayerImpl>(clip_parent); 9479 LayerImpl* unclipped_desc_surface = AddChild<LayerImpl>(clip_parent);
9453 LayerImpl* clip_child = AddChild<LayerImpl>(unclipped_desc_surface); 9480 LayerImpl* clip_child = AddChild<LayerImpl>(unclipped_desc_surface);
9454 9481
9455 clip_child->SetDrawsContent(true); 9482 clip_child->SetDrawsContent(true);
9456 unclipped_desc_surface->SetDrawsContent(true); 9483 unclipped_desc_surface->SetDrawsContent(true);
9457 clip_child->SetClipParent(clip_parent); 9484 clip_child->SetClipParent(clip_parent);
9458 scoped_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>); 9485 std::unique_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>);
9459 clip_children->insert(clip_child); 9486 clip_children->insert(clip_child);
9460 clip_parent->SetClipChildren(clip_children.release()); 9487 clip_parent->SetClipChildren(clip_children.release());
9461 9488
9462 gfx::Transform identity_matrix; 9489 gfx::Transform identity_matrix;
9463 gfx::Transform scale; 9490 gfx::Transform scale;
9464 scale.Scale(2, 2); 9491 scale.Scale(2, 2);
9465 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(), 9492 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(),
9466 gfx::PointF(), gfx::Size(100, 100), true, false, 9493 gfx::PointF(), gfx::Size(100, 100), true, false,
9467 true); 9494 true);
9468 SetLayerPropertiesForTesting(surface, scale, gfx::Point3F(), gfx::PointF(), 9495 SetLayerPropertiesForTesting(surface, scale, gfx::Point3F(), gfx::PointF(),
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
9519 LayerImpl* clip_parent = AddChildToRoot<LayerImpl>(); 9546 LayerImpl* clip_parent = AddChildToRoot<LayerImpl>();
9520 LayerImpl* render_surface = AddChild<LayerImpl>(clip_parent); 9547 LayerImpl* render_surface = AddChild<LayerImpl>(clip_parent);
9521 LayerImpl* clip_child = AddChild<LayerImpl>(render_surface); 9548 LayerImpl* clip_child = AddChild<LayerImpl>(render_surface);
9522 9549
9523 const gfx::Transform identity_matrix; 9550 const gfx::Transform identity_matrix;
9524 clip_parent->SetMasksToBounds(true); 9551 clip_parent->SetMasksToBounds(true);
9525 render_surface->SetMasksToBounds(true); 9552 render_surface->SetMasksToBounds(true);
9526 render_surface->SetDrawsContent(true); 9553 render_surface->SetDrawsContent(true);
9527 clip_child->SetDrawsContent(true); 9554 clip_child->SetDrawsContent(true);
9528 clip_child->SetClipParent(clip_parent); 9555 clip_child->SetClipParent(clip_parent);
9529 scoped_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>); 9556 std::unique_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>);
9530 clip_children->insert(clip_child); 9557 clip_children->insert(clip_child);
9531 clip_parent->SetClipChildren(clip_children.release()); 9558 clip_parent->SetClipChildren(clip_children.release());
9532 9559
9533 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(), 9560 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(),
9534 gfx::PointF(), gfx::Size(30, 30), true, false, 9561 gfx::PointF(), gfx::Size(30, 30), true, false,
9535 true); 9562 true);
9536 SetLayerPropertiesForTesting(clip_parent, identity_matrix, gfx::Point3F(), 9563 SetLayerPropertiesForTesting(clip_parent, identity_matrix, gfx::Point3F(),
9537 gfx::PointF(10.f, 10.f), gfx::Size(40, 40), true, 9564 gfx::PointF(10.f, 10.f), gfx::Size(40, 40), true,
9538 false, false); 9565 false, false);
9539 SetLayerPropertiesForTesting(render_surface, identity_matrix, gfx::Point3F(), 9566 SetLayerPropertiesForTesting(render_surface, identity_matrix, gfx::Point3F(),
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
9603 } 9630 }
9604 9631
9605 TEST_F(LayerTreeHostCommonTest, TwoUnclippedRenderSurfaces) { 9632 TEST_F(LayerTreeHostCommonTest, TwoUnclippedRenderSurfaces) {
9606 LayerImpl* root = root_layer(); 9633 LayerImpl* root = root_layer();
9607 LayerImpl* render_surface1 = AddChild<LayerImpl>(root); 9634 LayerImpl* render_surface1 = AddChild<LayerImpl>(root);
9608 LayerImpl* render_surface2 = AddChild<LayerImpl>(render_surface1); 9635 LayerImpl* render_surface2 = AddChild<LayerImpl>(render_surface1);
9609 LayerImpl* clip_child = AddChild<LayerImpl>(render_surface2); 9636 LayerImpl* clip_child = AddChild<LayerImpl>(render_surface2);
9610 9637
9611 const gfx::Transform identity_matrix; 9638 const gfx::Transform identity_matrix;
9612 clip_child->SetClipParent(root); 9639 clip_child->SetClipParent(root);
9613 scoped_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>); 9640 std::unique_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>);
9614 clip_children->insert(clip_child); 9641 clip_children->insert(clip_child);
9615 root->SetClipChildren(clip_children.release()); 9642 root->SetClipChildren(clip_children.release());
9616 root->SetMasksToBounds(true); 9643 root->SetMasksToBounds(true);
9617 render_surface1->SetDrawsContent(true); 9644 render_surface1->SetDrawsContent(true);
9618 render_surface2->SetDrawsContent(true); 9645 render_surface2->SetDrawsContent(true);
9619 9646
9620 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(), 9647 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(),
9621 gfx::PointF(), gfx::Size(30, 30), true, false, 9648 gfx::PointF(), gfx::Size(30, 30), true, false,
9622 true); 9649 true);
9623 SetLayerPropertiesForTesting(render_surface1, identity_matrix, gfx::Point3F(), 9650 SetLayerPropertiesForTesting(render_surface1, identity_matrix, gfx::Point3F(),
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
9941 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); 9968 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index());
9942 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); 9969 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index());
9943 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); 9970 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index());
9944 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); 9971 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index());
9945 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); 9972 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index());
9946 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); 9973 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index());
9947 } 9974 }
9948 9975
9949 } // namespace 9976 } // namespace
9950 } // namespace cc 9977 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_common_perftest.cc ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698