OLD | NEW |
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 <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 LayerImpl::Create(host_impl.active_tree(), 4)); | 305 LayerImpl::Create(host_impl.active_tree(), 4)); |
306 LayerImpl* clip_layer = clip_layer_scoped_ptr.get(); | 306 LayerImpl* clip_layer = clip_layer_scoped_ptr.get(); |
307 | 307 |
308 scroll_layer->SetScrollClipLayer(clip_layer->id()); | 308 scroll_layer->SetScrollClipLayer(clip_layer->id()); |
309 clip_layer->SetBounds( | 309 clip_layer->SetBounds( |
310 gfx::Size(scroll_layer->bounds().width() + kMaxScrollOffset.x(), | 310 gfx::Size(scroll_layer->bounds().width() + kMaxScrollOffset.x(), |
311 scroll_layer->bounds().height() + kMaxScrollOffset.y())); | 311 scroll_layer->bounds().height() + kMaxScrollOffset.y())); |
312 scroll_layer->SetScrollClipLayer(clip_layer->id()); | 312 scroll_layer->SetScrollClipLayer(clip_layer->id()); |
313 scroll_layer->SetScrollDelta(kScrollDelta); | 313 scroll_layer->SetScrollDelta(kScrollDelta); |
314 gfx::Transform impl_transform; | 314 gfx::Transform impl_transform; |
315 scroll_layer->AddChild(sublayer_scoped_ptr.Pass()); | 315 scroll_layer->AddChild(std::move(sublayer_scoped_ptr)); |
316 LayerImpl* scroll_layer_raw_ptr = scroll_layer_scoped_ptr.get(); | 316 LayerImpl* scroll_layer_raw_ptr = scroll_layer_scoped_ptr.get(); |
317 clip_layer->AddChild(scroll_layer_scoped_ptr.Pass()); | 317 clip_layer->AddChild(std::move(scroll_layer_scoped_ptr)); |
318 scroll_layer_raw_ptr->PushScrollOffsetFromMainThread(kScrollOffset); | 318 scroll_layer_raw_ptr->PushScrollOffsetFromMainThread(kScrollOffset); |
319 | 319 |
320 scoped_ptr<LayerImpl> root(LayerImpl::Create(host_impl.active_tree(), 3)); | 320 scoped_ptr<LayerImpl> root(LayerImpl::Create(host_impl.active_tree(), 3)); |
321 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), | 321 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
322 gfx::PointF(), gfx::Size(3, 4), true, false, | 322 gfx::PointF(), gfx::Size(3, 4), true, false, |
323 false); | 323 false); |
324 root->AddChild(clip_layer_scoped_ptr.Pass()); | 324 root->AddChild(std::move(clip_layer_scoped_ptr)); |
325 root->SetHasRenderSurface(true); | 325 root->SetHasRenderSurface(true); |
326 | 326 |
327 ExecuteCalculateDrawProperties( | 327 ExecuteCalculateDrawProperties( |
328 root.get(), kDeviceScale, kPageScale, scroll_layer->parent()); | 328 root.get(), kDeviceScale, kPageScale, scroll_layer->parent()); |
329 gfx::Transform expected_transform = identity_matrix; | 329 gfx::Transform expected_transform = identity_matrix; |
330 gfx::PointF sub_layer_screen_position = kScrollLayerPosition - kScrollDelta; | 330 gfx::PointF sub_layer_screen_position = kScrollLayerPosition - kScrollDelta; |
331 expected_transform.Translate(MathUtil::Round(sub_layer_screen_position.x() * | 331 expected_transform.Translate(MathUtil::Round(sub_layer_screen_position.x() * |
332 kPageScale * kDeviceScale), | 332 kPageScale * kDeviceScale), |
333 MathUtil::Round(sub_layer_screen_position.y() * | 333 MathUtil::Round(sub_layer_screen_position.y() * |
334 kPageScale * kDeviceScale)); | 334 kPageScale * kDeviceScale)); |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 gfx::Size(10, 12), true, false, false); | 628 gfx::Size(10, 12), true, false, false); |
629 SetLayerPropertiesForTesting(child, identity_matrix, gfx::Point3F(), | 629 SetLayerPropertiesForTesting(child, identity_matrix, gfx::Point3F(), |
630 gfx::PointF(), gfx::Size(16, 18), true, false, | 630 gfx::PointF(), gfx::Size(16, 18), true, false, |
631 true); | 631 true); |
632 SetLayerPropertiesForTesting(grand_child, identity_matrix, gfx::Point3F(), | 632 SetLayerPropertiesForTesting(grand_child, identity_matrix, gfx::Point3F(), |
633 gfx::PointF(-0.5f, -0.5f), gfx::Size(1, 1), true, | 633 gfx::PointF(-0.5f, -0.5f), gfx::Size(1, 1), true, |
634 false, false); | 634 false, false); |
635 SetLayerPropertiesForTesting(child_replica.get(), replica_layer_transform, | 635 SetLayerPropertiesForTesting(child_replica.get(), replica_layer_transform, |
636 gfx::Point3F(), gfx::PointF(), gfx::Size(), true, | 636 gfx::Point3F(), gfx::PointF(), gfx::Size(), true, |
637 false, false); | 637 false, false); |
638 child->SetReplicaLayer(child_replica.Pass()); | 638 child->SetReplicaLayer(std::move(child_replica)); |
639 | 639 |
640 ExecuteCalculateDrawProperties(root); | 640 ExecuteCalculateDrawProperties(root); |
641 | 641 |
642 // Render surface should have been created now. | 642 // Render surface should have been created now. |
643 ASSERT_TRUE(child->render_surface()); | 643 ASSERT_TRUE(child->render_surface()); |
644 ASSERT_EQ(child, child->render_target()); | 644 ASSERT_EQ(child, child->render_target()); |
645 | 645 |
646 EXPECT_TRANSFORMATION_MATRIX_EQ( | 646 EXPECT_TRANSFORMATION_MATRIX_EQ( |
647 replica_composite_transform, | 647 replica_composite_transform, |
648 child->render_target()->render_surface()->replica_draw_transform()); | 648 child->render_target()->render_surface()->replica_draw_transform()); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
768 SetLayerPropertiesForTesting(grand_child_of_rs2, layer_transform, | 768 SetLayerPropertiesForTesting(grand_child_of_rs2, layer_transform, |
769 gfx::Point3F(2.5f, 0.f, 0.f), gfx::PointF(), | 769 gfx::Point3F(2.5f, 0.f, 0.f), gfx::PointF(), |
770 gfx::Size(10, 10), true, false, false); | 770 gfx::Size(10, 10), true, false, false); |
771 SetLayerPropertiesForTesting(replica_of_rs1.get(), replica_layer_transform, | 771 SetLayerPropertiesForTesting(replica_of_rs1.get(), replica_layer_transform, |
772 gfx::Point3F(2.5f, 0.f, 0.f), gfx::PointF(), | 772 gfx::Point3F(2.5f, 0.f, 0.f), gfx::PointF(), |
773 gfx::Size(), true, false, false); | 773 gfx::Size(), true, false, false); |
774 SetLayerPropertiesForTesting(replica_of_rs2.get(), replica_layer_transform, | 774 SetLayerPropertiesForTesting(replica_of_rs2.get(), replica_layer_transform, |
775 gfx::Point3F(2.5f, 0.f, 0.f), gfx::PointF(), | 775 gfx::Point3F(2.5f, 0.f, 0.f), gfx::PointF(), |
776 gfx::Size(), true, false, false); | 776 gfx::Size(), true, false, false); |
777 | 777 |
778 render_surface1->SetReplicaLayer(replica_of_rs1.Pass()); | 778 render_surface1->SetReplicaLayer(std::move(replica_of_rs1)); |
779 render_surface2->SetReplicaLayer(replica_of_rs2.Pass()); | 779 render_surface2->SetReplicaLayer(std::move(replica_of_rs2)); |
780 ExecuteCalculateDrawProperties(root); | 780 ExecuteCalculateDrawProperties(root); |
781 | 781 |
782 // Only layers that are associated with render surfaces should have an actual | 782 // Only layers that are associated with render surfaces should have an actual |
783 // RenderSurface() value. | 783 // RenderSurface() value. |
784 ASSERT_TRUE(root->render_surface()); | 784 ASSERT_TRUE(root->render_surface()); |
785 ASSERT_FALSE(child_of_root->render_surface()); | 785 ASSERT_FALSE(child_of_root->render_surface()); |
786 ASSERT_FALSE(grand_child_of_root->render_surface()); | 786 ASSERT_FALSE(grand_child_of_root->render_surface()); |
787 | 787 |
788 ASSERT_TRUE(render_surface1->render_surface()); | 788 ASSERT_TRUE(render_surface1->render_surface()); |
789 ASSERT_FALSE(child_of_rs1->render_surface()); | 789 ASSERT_FALSE(child_of_rs1->render_surface()); |
(...skipping 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2403 SetLayerPropertiesForTesting(great_grand_child, identity, gfx::Point3F(), | 2403 SetLayerPropertiesForTesting(great_grand_child, identity, gfx::Point3F(), |
2404 gfx::PointF(), gfx::Size(10, 10), true, false, | 2404 gfx::PointF(), gfx::Size(10, 10), true, false, |
2405 false); | 2405 false); |
2406 | 2406 |
2407 // Add a transform animation with a start delay to |grand_child|. | 2407 // Add a transform animation with a start delay to |grand_child|. |
2408 scoped_ptr<Animation> animation = Animation::Create( | 2408 scoped_ptr<Animation> animation = Animation::Create( |
2409 scoped_ptr<AnimationCurve>(new FakeTransformTransition(1.0)).Pass(), 0, 1, | 2409 scoped_ptr<AnimationCurve>(new FakeTransformTransition(1.0)).Pass(), 0, 1, |
2410 Animation::TRANSFORM); | 2410 Animation::TRANSFORM); |
2411 animation->set_fill_mode(Animation::FILL_MODE_NONE); | 2411 animation->set_fill_mode(Animation::FILL_MODE_NONE); |
2412 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); | 2412 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); |
2413 grand_child->layer_animation_controller()->AddAnimation(animation.Pass()); | 2413 grand_child->layer_animation_controller()->AddAnimation(std::move(animation)); |
2414 | 2414 |
2415 ExecuteCalculateDrawProperties(parent); | 2415 ExecuteCalculateDrawProperties(parent); |
2416 | 2416 |
2417 EXPECT_FALSE(parent->screen_space_transform_is_animating()); | 2417 EXPECT_FALSE(parent->screen_space_transform_is_animating()); |
2418 EXPECT_FALSE(child->screen_space_transform_is_animating()); | 2418 EXPECT_FALSE(child->screen_space_transform_is_animating()); |
2419 | 2419 |
2420 EXPECT_FALSE(grand_child->TransformIsAnimating()); | 2420 EXPECT_FALSE(grand_child->TransformIsAnimating()); |
2421 EXPECT_TRUE(grand_child->HasPotentiallyRunningTransformAnimation()); | 2421 EXPECT_TRUE(grand_child->HasPotentiallyRunningTransformAnimation()); |
2422 EXPECT_TRUE(grand_child->screen_space_transform_is_animating()); | 2422 EXPECT_TRUE(grand_child->screen_space_transform_is_animating()); |
2423 EXPECT_TRUE(great_grand_child->screen_space_transform_is_animating()); | 2423 EXPECT_TRUE(great_grand_child->screen_space_transform_is_animating()); |
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3272 false, true, false); | 3272 false, true, false); |
3273 SetLayerPropertiesForTesting(grand_child.get(), rotation, gfx::Point3F(), | 3273 SetLayerPropertiesForTesting(grand_child.get(), rotation, gfx::Point3F(), |
3274 gfx::PointF(), gfx::Size(200, 200), false, true, | 3274 gfx::PointF(), gfx::Size(200, 200), false, true, |
3275 false); | 3275 false); |
3276 SetLayerPropertiesForTesting(occluding_child.get(), identity_matrix, | 3276 SetLayerPropertiesForTesting(occluding_child.get(), identity_matrix, |
3277 gfx::Point3F(), gfx::PointF(), | 3277 gfx::Point3F(), gfx::PointF(), |
3278 gfx::Size(200, 200), false, false, false); | 3278 gfx::Size(200, 200), false, false, false); |
3279 | 3279 |
3280 host_impl.SetViewportSize(root->bounds()); | 3280 host_impl.SetViewportSize(root->bounds()); |
3281 | 3281 |
3282 child->AddChild(grand_child.Pass()); | 3282 child->AddChild(std::move(grand_child)); |
3283 root->AddChild(child.Pass()); | 3283 root->AddChild(std::move(child)); |
3284 root->AddChild(occluding_child.Pass()); | 3284 root->AddChild(std::move(occluding_child)); |
3285 host_impl.active_tree()->SetRootLayer(root.Pass()); | 3285 host_impl.active_tree()->SetRootLayer(std::move(root)); |
3286 host_impl.SetVisible(true); | 3286 host_impl.SetVisible(true); |
3287 host_impl.InitializeRenderer(output_surface.get()); | 3287 host_impl.InitializeRenderer(output_surface.get()); |
3288 host_impl.active_tree()->BuildPropertyTreesForTesting(); | 3288 host_impl.active_tree()->BuildPropertyTreesForTesting(); |
3289 bool update_lcd_text = false; | 3289 bool update_lcd_text = false; |
3290 host_impl.active_tree()->UpdateDrawProperties(update_lcd_text); | 3290 host_impl.active_tree()->UpdateDrawProperties(update_lcd_text); |
3291 | 3291 |
3292 LayerImpl* grand_child_ptr = | 3292 LayerImpl* grand_child_ptr = |
3293 host_impl.active_tree()->root_layer()->children()[0]->children()[0].get(); | 3293 host_impl.active_tree()->root_layer()->children()[0]->children()[0].get(); |
3294 | 3294 |
3295 // Though all layers have invertible transforms, matrix multiplication using | 3295 // Though all layers have invertible transforms, matrix multiplication using |
(...skipping 1417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4713 true, true); | 4713 true, true); |
4714 | 4714 |
4715 gfx::Transform replica_transform; | 4715 gfx::Transform replica_transform; |
4716 replica_transform.Scale(1.0, -1.0); | 4716 replica_transform.Scale(1.0, -1.0); |
4717 | 4717 |
4718 scoped_ptr<LayerImpl> replica = | 4718 scoped_ptr<LayerImpl> replica = |
4719 LayerImpl::Create(host_impl()->active_tree(), 7); | 4719 LayerImpl::Create(host_impl()->active_tree(), 7); |
4720 SetLayerPropertiesForTesting(replica.get(), replica_transform, gfx::Point3F(), | 4720 SetLayerPropertiesForTesting(replica.get(), replica_transform, gfx::Point3F(), |
4721 gfx::PointF(2.f, 2.f), gfx::Size(10, 10), false, | 4721 gfx::PointF(2.f, 2.f), gfx::Size(10, 10), false, |
4722 true, false); | 4722 true, false); |
4723 child->SetReplicaLayer(replica.Pass()); | 4723 child->SetReplicaLayer(std::move(replica)); |
4724 | 4724 |
4725 // This layer should end up in the same surface as child, with the same draw | 4725 // This layer should end up in the same surface as child, with the same draw |
4726 // and screen space transforms. | 4726 // and screen space transforms. |
4727 LayerImpl* duplicate_child_non_owner = AddChild<LayerImpl>(child); | 4727 LayerImpl* duplicate_child_non_owner = AddChild<LayerImpl>(child); |
4728 duplicate_child_non_owner->SetDrawsContent(true); | 4728 duplicate_child_non_owner->SetDrawsContent(true); |
4729 SetLayerPropertiesForTesting(duplicate_child_non_owner, identity_matrix, | 4729 SetLayerPropertiesForTesting(duplicate_child_non_owner, identity_matrix, |
4730 gfx::Point3F(), gfx::PointF(), gfx::Size(10, 10), | 4730 gfx::Point3F(), gfx::PointF(), gfx::Size(10, 10), |
4731 false, true, false); | 4731 false, true, false); |
4732 | 4732 |
4733 float device_scale_factor = 1.5f; | 4733 float device_scale_factor = 1.5f; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4824 gfx::PointF(), gfx::Size(13, 11), false, true, | 4824 gfx::PointF(), gfx::Size(13, 11), false, true, |
4825 true); | 4825 true); |
4826 | 4826 |
4827 gfx::Transform replica_transform; | 4827 gfx::Transform replica_transform; |
4828 replica_transform.Scale(1.0, -1.0); | 4828 replica_transform.Scale(1.0, -1.0); |
4829 scoped_ptr<LayerImpl> replica = | 4829 scoped_ptr<LayerImpl> replica = |
4830 LayerImpl::Create(host_impl()->active_tree(), 7); | 4830 LayerImpl::Create(host_impl()->active_tree(), 7); |
4831 SetLayerPropertiesForTesting(replica.get(), replica_transform, gfx::Point3F(), | 4831 SetLayerPropertiesForTesting(replica.get(), replica_transform, gfx::Point3F(), |
4832 gfx::PointF(), gfx::Size(13, 11), false, true, | 4832 gfx::PointF(), gfx::Size(13, 11), false, true, |
4833 false); | 4833 false); |
4834 child->SetReplicaLayer(replica.Pass()); | 4834 child->SetReplicaLayer(std::move(replica)); |
4835 | 4835 |
4836 float device_scale_factor = 1.7f; | 4836 float device_scale_factor = 1.7f; |
4837 ExecuteCalculateDrawProperties(parent, device_scale_factor); | 4837 ExecuteCalculateDrawProperties(parent, device_scale_factor); |
4838 | 4838 |
4839 // We should have two render surfaces. The root's render surface and child's | 4839 // We should have two render surfaces. The root's render surface and child's |
4840 // render surface (it needs one because it has a replica layer). | 4840 // render surface (it needs one because it has a replica layer). |
4841 EXPECT_EQ(2u, render_surface_layer_list_impl()->size()); | 4841 EXPECT_EQ(2u, render_surface_layer_list_impl()->size()); |
4842 | 4842 |
4843 gfx::Transform identity_transform; | 4843 gfx::Transform identity_transform; |
4844 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_transform, | 4844 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_transform, |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4952 SetLayerPropertiesForTesting(child.get(), identity_matrix, gfx::Point3F(), | 4952 SetLayerPropertiesForTesting(child.get(), identity_matrix, gfx::Point3F(), |
4953 gfx::PointF(), gfx::Size(50, 50), true, false, | 4953 gfx::PointF(), gfx::Size(50, 50), true, false, |
4954 false); | 4954 false); |
4955 child->SetDrawsContent(true); | 4955 child->SetDrawsContent(true); |
4956 child->SetOpacity(0.0f); | 4956 child->SetOpacity(0.0f); |
4957 | 4957 |
4958 // Add opacity animation. | 4958 // Add opacity animation. |
4959 AddOpacityTransitionToController( | 4959 AddOpacityTransitionToController( |
4960 child->layer_animation_controller(), 10.0, 0.0f, 1.0f, false); | 4960 child->layer_animation_controller(), 10.0, 0.0f, 1.0f, false); |
4961 | 4961 |
4962 root->AddChild(child.Pass()); | 4962 root->AddChild(std::move(child)); |
4963 root->SetHasRenderSurface(true); | 4963 root->SetHasRenderSurface(true); |
4964 | 4964 |
4965 LayerImplList render_surface_layer_list; | 4965 LayerImplList render_surface_layer_list; |
4966 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 4966 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
4967 root.get(), root->bounds(), &render_surface_layer_list); | 4967 root.get(), root->bounds(), &render_surface_layer_list); |
4968 inputs.can_adjust_raster_scales = true; | 4968 inputs.can_adjust_raster_scales = true; |
4969 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 4969 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
4970 | 4970 |
4971 // We should have one render surface and two layers. The child | 4971 // We should have one render surface and two layers. The child |
4972 // layer should be included even though it is transparent. | 4972 // layer should be included even though it is transparent. |
(...skipping 24 matching lines...) Expand all Loading... |
4997 scoped_ptr<LayerImpl> child_ptr = | 4997 scoped_ptr<LayerImpl> child_ptr = |
4998 LayerImpl::Create(host_impl_.active_tree(), 2); | 4998 LayerImpl::Create(host_impl_.active_tree(), 2); |
4999 scoped_ptr<LayerImpl> grand_child_ptr = | 4999 scoped_ptr<LayerImpl> grand_child_ptr = |
5000 LayerImpl::Create(host_impl_.active_tree(), 3); | 5000 LayerImpl::Create(host_impl_.active_tree(), 3); |
5001 | 5001 |
5002 // Stash raw pointers to look at later. | 5002 // Stash raw pointers to look at later. |
5003 root_ = root_ptr.get(); | 5003 root_ = root_ptr.get(); |
5004 child_ = child_ptr.get(); | 5004 child_ = child_ptr.get(); |
5005 grand_child_ = grand_child_ptr.get(); | 5005 grand_child_ = grand_child_ptr.get(); |
5006 | 5006 |
5007 child_->AddChild(grand_child_ptr.Pass()); | 5007 child_->AddChild(std::move(grand_child_ptr)); |
5008 root_->AddChild(child_ptr.Pass()); | 5008 root_->AddChild(std::move(child_ptr)); |
5009 host_impl_.active_tree()->SetRootLayer(root_ptr.Pass()); | 5009 host_impl_.active_tree()->SetRootLayer(std::move(root_ptr)); |
5010 | 5010 |
5011 root_->SetContentsOpaque(true); | 5011 root_->SetContentsOpaque(true); |
5012 child_->SetContentsOpaque(true); | 5012 child_->SetContentsOpaque(true); |
5013 grand_child_->SetContentsOpaque(true); | 5013 grand_child_->SetContentsOpaque(true); |
5014 | 5014 |
5015 root_->SetDrawsContent(true); | 5015 root_->SetDrawsContent(true); |
5016 child_->SetDrawsContent(true); | 5016 child_->SetDrawsContent(true); |
5017 grand_child_->SetDrawsContent(true); | 5017 grand_child_->SetDrawsContent(true); |
5018 | 5018 |
5019 gfx::Transform identity_matrix; | 5019 gfx::Transform identity_matrix; |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5222 child->SetDrawsContent(true); | 5222 child->SetDrawsContent(true); |
5223 | 5223 |
5224 scoped_ptr<LayerImpl> grand_child = | 5224 scoped_ptr<LayerImpl> grand_child = |
5225 LayerImpl::Create(host_impl.pending_tree(), 3); | 5225 LayerImpl::Create(host_impl.pending_tree(), 3); |
5226 SetLayerPropertiesForTesting(grand_child.get(), identity_matrix, | 5226 SetLayerPropertiesForTesting(grand_child.get(), identity_matrix, |
5227 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30), | 5227 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30), |
5228 true, false, false); | 5228 true, false, false); |
5229 grand_child->SetDrawsContent(true); | 5229 grand_child->SetDrawsContent(true); |
5230 grand_child->SetHideLayerAndSubtree(true); | 5230 grand_child->SetHideLayerAndSubtree(true); |
5231 | 5231 |
5232 child->AddChild(grand_child.Pass()); | 5232 child->AddChild(std::move(grand_child)); |
5233 root->AddChild(child.Pass()); | 5233 root->AddChild(std::move(child)); |
5234 root->SetHasRenderSurface(true); | 5234 root->SetHasRenderSurface(true); |
5235 | 5235 |
5236 LayerImplList render_surface_layer_list; | 5236 LayerImplList render_surface_layer_list; |
5237 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 5237 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
5238 root.get(), root->bounds(), &render_surface_layer_list); | 5238 root.get(), root->bounds(), &render_surface_layer_list); |
5239 inputs.can_adjust_raster_scales = true; | 5239 inputs.can_adjust_raster_scales = true; |
5240 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 5240 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
5241 | 5241 |
5242 // We should have one render surface and two layers. The grand child has | 5242 // We should have one render surface and two layers. The grand child has |
5243 // hidden itself. | 5243 // hidden itself. |
(...skipping 25 matching lines...) Expand all Loading... |
5269 child->SetDrawsContent(true); | 5269 child->SetDrawsContent(true); |
5270 child->SetHideLayerAndSubtree(true); | 5270 child->SetHideLayerAndSubtree(true); |
5271 | 5271 |
5272 scoped_ptr<LayerImpl> grand_child = | 5272 scoped_ptr<LayerImpl> grand_child = |
5273 LayerImpl::Create(host_impl.pending_tree(), 3); | 5273 LayerImpl::Create(host_impl.pending_tree(), 3); |
5274 SetLayerPropertiesForTesting(grand_child.get(), identity_matrix, | 5274 SetLayerPropertiesForTesting(grand_child.get(), identity_matrix, |
5275 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30), | 5275 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30), |
5276 true, false, false); | 5276 true, false, false); |
5277 grand_child->SetDrawsContent(true); | 5277 grand_child->SetDrawsContent(true); |
5278 | 5278 |
5279 child->AddChild(grand_child.Pass()); | 5279 child->AddChild(std::move(grand_child)); |
5280 root->AddChild(child.Pass()); | 5280 root->AddChild(std::move(child)); |
5281 | 5281 |
5282 LayerImplList render_surface_layer_list; | 5282 LayerImplList render_surface_layer_list; |
5283 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 5283 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
5284 root.get(), root->bounds(), &render_surface_layer_list); | 5284 root.get(), root->bounds(), &render_surface_layer_list); |
5285 inputs.can_adjust_raster_scales = true; | 5285 inputs.can_adjust_raster_scales = true; |
5286 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 5286 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
5287 | 5287 |
5288 // We should have one render surface and one layers. The child has | 5288 // We should have one render surface and one layers. The child has |
5289 // hidden itself and the grand child. | 5289 // hidden itself and the grand child. |
5290 ASSERT_EQ(1u, render_surface_layer_list.size()); | 5290 ASSERT_EQ(1u, render_surface_layer_list.size()); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5352 | 5352 |
5353 scoped_ptr<LayerImpl> copy_grand_parent_sibling_after = | 5353 scoped_ptr<LayerImpl> copy_grand_parent_sibling_after = |
5354 LayerImpl::Create(host_impl.pending_tree(), 7); | 5354 LayerImpl::Create(host_impl.pending_tree(), 7); |
5355 SetLayerPropertiesForTesting(copy_grand_parent_sibling_after.get(), | 5355 SetLayerPropertiesForTesting(copy_grand_parent_sibling_after.get(), |
5356 identity_matrix, gfx::Point3F(), gfx::PointF(), | 5356 identity_matrix, gfx::Point3F(), gfx::PointF(), |
5357 gfx::Size(40, 40), true, false, false); | 5357 gfx::Size(40, 40), true, false, false); |
5358 copy_grand_parent_sibling_after->SetDrawsContent(true); | 5358 copy_grand_parent_sibling_after->SetDrawsContent(true); |
5359 LayerImpl* copy_grand_parent_sibling_after_layer = | 5359 LayerImpl* copy_grand_parent_sibling_after_layer = |
5360 copy_grand_parent_sibling_after.get(); | 5360 copy_grand_parent_sibling_after.get(); |
5361 | 5361 |
5362 copy_request->AddChild(copy_child.Pass()); | 5362 copy_request->AddChild(std::move(copy_child)); |
5363 copy_parent->AddChild(copy_request.Pass()); | 5363 copy_parent->AddChild(std::move(copy_request)); |
5364 copy_grand_parent->AddChild(copy_parent.Pass()); | 5364 copy_grand_parent->AddChild(std::move(copy_parent)); |
5365 root->AddChild(copy_grand_parent_sibling_before.Pass()); | 5365 root->AddChild(std::move(copy_grand_parent_sibling_before)); |
5366 root->AddChild(copy_grand_parent.Pass()); | 5366 root->AddChild(std::move(copy_grand_parent)); |
5367 root->AddChild(copy_grand_parent_sibling_after.Pass()); | 5367 root->AddChild(std::move(copy_grand_parent_sibling_after)); |
5368 | 5368 |
5369 // Hide the copy_grand_parent and its subtree. But make a copy request in that | 5369 // Hide the copy_grand_parent and its subtree. But make a copy request in that |
5370 // hidden subtree on copy_layer. | 5370 // hidden subtree on copy_layer. |
5371 copy_grand_parent_layer->SetHideLayerAndSubtree(true); | 5371 copy_grand_parent_layer->SetHideLayerAndSubtree(true); |
5372 copy_grand_parent_sibling_before_layer->SetHideLayerAndSubtree(true); | 5372 copy_grand_parent_sibling_before_layer->SetHideLayerAndSubtree(true); |
5373 copy_grand_parent_sibling_after_layer->SetHideLayerAndSubtree(true); | 5373 copy_grand_parent_sibling_after_layer->SetHideLayerAndSubtree(true); |
5374 | 5374 |
5375 std::vector<scoped_ptr<CopyOutputRequest>> copy_requests; | 5375 std::vector<scoped_ptr<CopyOutputRequest>> copy_requests; |
5376 copy_requests.push_back( | 5376 copy_requests.push_back( |
5377 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback))); | 5377 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback))); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5463 gfx::Point3F(), gfx::PointF(), gfx::Size(20, 20), | 5463 gfx::Point3F(), gfx::PointF(), gfx::Size(20, 20), |
5464 true, false, false); | 5464 true, false, false); |
5465 copy_child->SetDrawsContent(true); | 5465 copy_child->SetDrawsContent(true); |
5466 | 5466 |
5467 std::vector<scoped_ptr<CopyOutputRequest>> copy_requests; | 5467 std::vector<scoped_ptr<CopyOutputRequest>> copy_requests; |
5468 copy_requests.push_back( | 5468 copy_requests.push_back( |
5469 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback))); | 5469 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback))); |
5470 copy_layer->PassCopyRequests(©_requests); | 5470 copy_layer->PassCopyRequests(©_requests); |
5471 EXPECT_TRUE(copy_layer->HasCopyRequest()); | 5471 EXPECT_TRUE(copy_layer->HasCopyRequest()); |
5472 | 5472 |
5473 copy_layer->AddChild(copy_child.Pass()); | 5473 copy_layer->AddChild(std::move(copy_child)); |
5474 copy_parent->AddChild(copy_layer.Pass()); | 5474 copy_parent->AddChild(std::move(copy_layer)); |
5475 root->AddChild(copy_parent.Pass()); | 5475 root->AddChild(std::move(copy_parent)); |
5476 | 5476 |
5477 LayerImplList render_surface_layer_list; | 5477 LayerImplList render_surface_layer_list; |
5478 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 5478 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
5479 root.get(), root->bounds(), &render_surface_layer_list); | 5479 root.get(), root->bounds(), &render_surface_layer_list); |
5480 inputs.can_adjust_raster_scales = true; | 5480 inputs.can_adjust_raster_scales = true; |
5481 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 5481 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
5482 | 5482 |
5483 // We should have two render surface, as the others are clipped out. | 5483 // We should have two render surface, as the others are clipped out. |
5484 ASSERT_EQ(2u, render_surface_layer_list.size()); | 5484 ASSERT_EQ(2u, render_surface_layer_list.size()); |
5485 EXPECT_EQ(root->id(), render_surface_layer_list.at(0)->id()); | 5485 EXPECT_EQ(root->id(), render_surface_layer_list.at(0)->id()); |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5962 scoped_refptr<LayerWithForcedDrawsContent> child_1 = | 5962 scoped_refptr<LayerWithForcedDrawsContent> child_1 = |
5963 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 5963 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
5964 Layer* child1 = child_1.get(); | 5964 Layer* child1 = child_1.get(); |
5965 scoped_refptr<LayerWithForcedDrawsContent> child_2 = | 5965 scoped_refptr<LayerWithForcedDrawsContent> child_2 = |
5966 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 5966 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
5967 Layer* child2 = child_2.get(); | 5967 Layer* child2 = child_2.get(); |
5968 scoped_refptr<LayerWithForcedDrawsContent> child_3 = | 5968 scoped_refptr<LayerWithForcedDrawsContent> child_3 = |
5969 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 5969 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
5970 Layer* child3 = child_3.get(); | 5970 Layer* child3 = child_3.get(); |
5971 | 5971 |
5972 parent->AddChild(child_1.Pass()); | 5972 parent->AddChild(std::move(child_1)); |
5973 child1->AddChild(child_2.Pass()); | 5973 child1->AddChild(std::move(child_2)); |
5974 child2->AddChild(child_3.Pass()); | 5974 child2->AddChild(std::move(child_3)); |
5975 | 5975 |
5976 host()->SetRootLayer(root); | 5976 host()->SetRootLayer(root); |
5977 | 5977 |
5978 const gfx::Transform identity_matrix; | 5978 const gfx::Transform identity_matrix; |
5979 gfx::Point3F transform_origin; | 5979 gfx::Point3F transform_origin; |
5980 gfx::PointF position; | 5980 gfx::PointF position; |
5981 gfx::Size bounds(100, 100); | 5981 gfx::Size bounds(100, 100); |
5982 | 5982 |
5983 SetLayerPropertiesForTesting(root, identity_matrix, transform_origin, | 5983 SetLayerPropertiesForTesting(root, identity_matrix, transform_origin, |
5984 position, bounds, true, false); | 5984 position, bounds, true, false); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6032 SetLayerPropertiesForTesting(child2.get(), identity_matrix, transform_origin, | 6032 SetLayerPropertiesForTesting(child2.get(), identity_matrix, transform_origin, |
6033 position, bounds, true, false, true); | 6033 position, bounds, true, false, true); |
6034 child2->SetDrawsContent(true); | 6034 child2->SetDrawsContent(true); |
6035 SetLayerPropertiesForTesting(child3.get(), identity_matrix, transform_origin, | 6035 SetLayerPropertiesForTesting(child3.get(), identity_matrix, transform_origin, |
6036 position, bounds, true, false, false); | 6036 position, bounds, true, false, false); |
6037 child3->SetDrawsContent(true); | 6037 child3->SetDrawsContent(true); |
6038 | 6038 |
6039 child2->Set3dSortingContextId(1); | 6039 child2->Set3dSortingContextId(1); |
6040 child3->Set3dSortingContextId(1); | 6040 child3->Set3dSortingContextId(1); |
6041 | 6041 |
6042 child2->AddChild(child3.Pass()); | 6042 child2->AddChild(std::move(child3)); |
6043 child1->AddChild(child2.Pass()); | 6043 child1->AddChild(std::move(child2)); |
6044 root->AddChild(child1.Pass()); | 6044 root->AddChild(std::move(child1)); |
6045 | 6045 |
6046 { | 6046 { |
6047 LayerImplList render_surface_layer_list; | 6047 LayerImplList render_surface_layer_list; |
6048 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(root.get()); | 6048 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(root.get()); |
6049 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 6049 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
6050 root.get(), root->bounds(), &render_surface_layer_list); | 6050 root.get(), root->bounds(), &render_surface_layer_list); |
6051 inputs.can_render_to_separate_surface = true; | 6051 inputs.can_render_to_separate_surface = true; |
6052 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 6052 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
6053 | 6053 |
6054 EXPECT_EQ(2u, render_surface_layer_list.size()); | 6054 EXPECT_EQ(2u, render_surface_layer_list.size()); |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6644 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30), | 6644 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30), |
6645 true, false, false); | 6645 true, false, false); |
6646 SetLayerPropertiesForTesting(fixed.get(), identity_transform, gfx::Point3F(), | 6646 SetLayerPropertiesForTesting(fixed.get(), identity_transform, gfx::Point3F(), |
6647 gfx::PointF(), gfx::Size(50, 50), true, false, | 6647 gfx::PointF(), gfx::Size(50, 50), true, false, |
6648 false); | 6648 false); |
6649 | 6649 |
6650 root->SetDrawsContent(true); | 6650 root->SetDrawsContent(true); |
6651 container->SetDrawsContent(true); | 6651 container->SetDrawsContent(true); |
6652 scroller->SetDrawsContent(true); | 6652 scroller->SetDrawsContent(true); |
6653 fixed->SetDrawsContent(true); | 6653 fixed->SetDrawsContent(true); |
6654 scroller->AddChild(fixed.Pass()); | 6654 scroller->AddChild(std::move(fixed)); |
6655 container->AddChild(scroller.Pass()); | 6655 container->AddChild(std::move(scroller)); |
6656 root->AddChild(container.Pass()); | 6656 root->AddChild(std::move(container)); |
6657 | 6657 |
6658 // Rounded to integers already. | 6658 // Rounded to integers already. |
6659 { | 6659 { |
6660 gfx::Vector2dF scroll_delta(3.0, 5.0); | 6660 gfx::Vector2dF scroll_delta(3.0, 5.0); |
6661 scroll_layer->SetScrollDelta(scroll_delta); | 6661 scroll_layer->SetScrollDelta(scroll_delta); |
6662 | 6662 |
6663 LayerImplList render_surface_layer_list; | 6663 LayerImplList render_surface_layer_list; |
6664 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 6664 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
6665 root.get(), root->bounds(), &render_surface_layer_list); | 6665 root.get(), root->bounds(), &render_surface_layer_list); |
6666 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 6666 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6785 gfx::Vector2dF scroll_delta(0.1f, 0.4f); | 6785 gfx::Vector2dF scroll_delta(0.1f, 0.4f); |
6786 // Blink only uses the integer part of the scroll_offset for fixed | 6786 // Blink only uses the integer part of the scroll_offset for fixed |
6787 // position layer. | 6787 // position layer. |
6788 SetLayerPropertiesForTesting(fixed.get(), identity_transform, gfx::Point3F(), | 6788 SetLayerPropertiesForTesting(fixed.get(), identity_transform, gfx::Point3F(), |
6789 gfx::PointF(3.0f, 4.0f), gfx::Size(50, 50), true, | 6789 gfx::PointF(3.0f, 4.0f), gfx::Size(50, 50), true, |
6790 false, false); | 6790 false, false); |
6791 scroll_layer->PushScrollOffsetFromMainThread(scroll_offset); | 6791 scroll_layer->PushScrollOffsetFromMainThread(scroll_offset); |
6792 scroll_layer->SetScrollDelta(scroll_delta); | 6792 scroll_layer->SetScrollDelta(scroll_delta); |
6793 scroll_layer->SetScrollCompensationAdjustment(main_scroll_fractional_part); | 6793 scroll_layer->SetScrollCompensationAdjustment(main_scroll_fractional_part); |
6794 | 6794 |
6795 scroller->AddChild(fixed.Pass()); | 6795 scroller->AddChild(std::move(fixed)); |
6796 container->AddChild(scroller.Pass()); | 6796 container->AddChild(std::move(scroller)); |
6797 root->AddChild(container.Pass()); | 6797 root->AddChild(std::move(container)); |
6798 | 6798 |
6799 LayerImplList render_surface_layer_list; | 6799 LayerImplList render_surface_layer_list; |
6800 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 6800 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
6801 root.get(), root->bounds(), &render_surface_layer_list); | 6801 root.get(), root->bounds(), &render_surface_layer_list); |
6802 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 6802 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
6803 | 6803 |
6804 EXPECT_TRANSFORMATION_MATRIX_EQ( | 6804 EXPECT_TRANSFORMATION_MATRIX_EQ( |
6805 container_layer->draw_properties().screen_space_transform, | 6805 container_layer->draw_properties().screen_space_transform, |
6806 fixed_layer->draw_properties().screen_space_transform); | 6806 fixed_layer->draw_properties().screen_space_transform); |
6807 EXPECT_VECTOR_EQ( | 6807 EXPECT_VECTOR_EQ( |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6908 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 2); | 6908 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 2); |
6909 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> child = | 6909 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> child = |
6910 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 3); | 6910 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 3); |
6911 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> grand_child = | 6911 scoped_ptr<AnimationScaleFactorTrackingLayerImpl> grand_child = |
6912 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 4); | 6912 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 4); |
6913 | 6913 |
6914 AnimationScaleFactorTrackingLayerImpl* parent_raw = parent.get(); | 6914 AnimationScaleFactorTrackingLayerImpl* parent_raw = parent.get(); |
6915 AnimationScaleFactorTrackingLayerImpl* child_raw = child.get(); | 6915 AnimationScaleFactorTrackingLayerImpl* child_raw = child.get(); |
6916 AnimationScaleFactorTrackingLayerImpl* grand_child_raw = grand_child.get(); | 6916 AnimationScaleFactorTrackingLayerImpl* grand_child_raw = grand_child.get(); |
6917 | 6917 |
6918 child->AddChild(grand_child.Pass()); | 6918 child->AddChild(std::move(grand_child)); |
6919 parent->AddChild(child.Pass()); | 6919 parent->AddChild(std::move(child)); |
6920 grand_parent->AddChild(parent.Pass()); | 6920 grand_parent->AddChild(std::move(parent)); |
6921 | 6921 |
6922 SetLayerPropertiesForTesting(grand_parent.get(), identity_matrix, | 6922 SetLayerPropertiesForTesting(grand_parent.get(), identity_matrix, |
6923 gfx::Point3F(), gfx::PointF(), gfx::Size(1, 2), | 6923 gfx::Point3F(), gfx::PointF(), gfx::Size(1, 2), |
6924 true, false, true); | 6924 true, false, true); |
6925 SetLayerPropertiesForTesting(parent_raw, identity_matrix, gfx::Point3F(), | 6925 SetLayerPropertiesForTesting(parent_raw, identity_matrix, gfx::Point3F(), |
6926 gfx::PointF(), gfx::Size(1, 2), true, false, | 6926 gfx::PointF(), gfx::Size(1, 2), true, false, |
6927 false); | 6927 false); |
6928 SetLayerPropertiesForTesting(child_raw, identity_matrix, gfx::Point3F(), | 6928 SetLayerPropertiesForTesting(child_raw, identity_matrix, gfx::Point3F(), |
6929 gfx::PointF(), gfx::Size(1, 2), true, false, | 6929 gfx::PointF(), gfx::Size(1, 2), true, false, |
6930 false); | 6930 false); |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7237 LayerImpl::Create(host_impl.active_tree(), 7); | 7237 LayerImpl::Create(host_impl.active_tree(), 7); |
7238 scoped_ptr<LayerImpl> grand_child2 = | 7238 scoped_ptr<LayerImpl> grand_child2 = |
7239 LayerImpl::Create(host_impl.active_tree(), 9); | 7239 LayerImpl::Create(host_impl.active_tree(), 9); |
7240 | 7240 |
7241 LayerImpl* grand_parent_raw = grand_parent.get(); | 7241 LayerImpl* grand_parent_raw = grand_parent.get(); |
7242 LayerImpl* parent_raw = parent.get(); | 7242 LayerImpl* parent_raw = parent.get(); |
7243 LayerImpl* child_raw = child.get(); | 7243 LayerImpl* child_raw = child.get(); |
7244 LayerImpl* grand_child1_raw = grand_child1.get(); | 7244 LayerImpl* grand_child1_raw = grand_child1.get(); |
7245 LayerImpl* grand_child2_raw = grand_child2.get(); | 7245 LayerImpl* grand_child2_raw = grand_child2.get(); |
7246 | 7246 |
7247 child->AddChild(grand_child1.Pass()); | 7247 child->AddChild(std::move(grand_child1)); |
7248 child->AddChild(grand_child2.Pass()); | 7248 child->AddChild(std::move(grand_child2)); |
7249 parent->AddChild(child.Pass()); | 7249 parent->AddChild(std::move(child)); |
7250 grand_parent->AddChild(parent.Pass()); | 7250 grand_parent->AddChild(std::move(parent)); |
7251 | 7251 |
7252 SetLayerPropertiesForTesting(grand_parent_raw, identity_matrix, | 7252 SetLayerPropertiesForTesting(grand_parent_raw, identity_matrix, |
7253 gfx::Point3F(), gfx::PointF(), gfx::Size(1, 2), | 7253 gfx::Point3F(), gfx::PointF(), gfx::Size(1, 2), |
7254 true, false, true); | 7254 true, false, true); |
7255 SetLayerPropertiesForTesting(parent_raw, identity_matrix, gfx::Point3F(), | 7255 SetLayerPropertiesForTesting(parent_raw, identity_matrix, gfx::Point3F(), |
7256 gfx::PointF(), gfx::Size(1, 2), true, false, | 7256 gfx::PointF(), gfx::Size(1, 2), true, false, |
7257 false); | 7257 false); |
7258 | 7258 |
7259 SetLayerPropertiesForTesting(child_raw, identity_matrix, gfx::Point3F(), | 7259 SetLayerPropertiesForTesting(child_raw, identity_matrix, gfx::Point3F(), |
7260 gfx::PointF(), gfx::Size(1, 2), true, false, | 7260 gfx::PointF(), gfx::Size(1, 2), true, false, |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7369 expected.insert(child_raw->mask_layer()); | 7369 expected.insert(child_raw->mask_layer()); |
7370 | 7370 |
7371 actual.clear(); | 7371 actual.clear(); |
7372 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); | 7372 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); |
7373 EXPECT_EQ(expected, actual); | 7373 EXPECT_EQ(expected, actual); |
7374 | 7374 |
7375 // Add replica mask layer. | 7375 // Add replica mask layer. |
7376 scoped_ptr<LayerImpl> replica_layer = | 7376 scoped_ptr<LayerImpl> replica_layer = |
7377 LayerImpl::Create(host_impl.active_tree(), 20); | 7377 LayerImpl::Create(host_impl.active_tree(), 20); |
7378 replica_layer->SetMaskLayer(LayerImpl::Create(host_impl.active_tree(), 21)); | 7378 replica_layer->SetMaskLayer(LayerImpl::Create(host_impl.active_tree(), 21)); |
7379 child_raw->SetReplicaLayer(replica_layer.Pass()); | 7379 child_raw->SetReplicaLayer(std::move(replica_layer)); |
7380 child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; | 7380 child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; |
7381 | 7381 |
7382 ExecuteCalculateDrawProperties(grand_parent_raw); | 7382 ExecuteCalculateDrawProperties(grand_parent_raw); |
7383 member_id = render_surface_layer_list_count(); | 7383 member_id = render_surface_layer_list_count(); |
7384 | 7384 |
7385 EXPECT_NE(member_id, membership_id(grand_parent_raw)); | 7385 EXPECT_NE(member_id, membership_id(grand_parent_raw)); |
7386 EXPECT_NE(member_id, membership_id(parent_raw)); | 7386 EXPECT_NE(member_id, membership_id(parent_raw)); |
7387 EXPECT_NE(member_id, membership_id(child_raw)); | 7387 EXPECT_NE(member_id, membership_id(child_raw)); |
7388 EXPECT_EQ(member_id, membership_id(child_raw->mask_layer())); | 7388 EXPECT_EQ(member_id, membership_id(child_raw->mask_layer())); |
7389 EXPECT_EQ(member_id, membership_id(child_raw->replica_layer()->mask_layer())); | 7389 EXPECT_EQ(member_id, membership_id(child_raw->replica_layer()->mask_layer())); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7480 FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider, | 7480 FakeLayerTreeHostImpl host_impl(settings, &task_runner_provider, |
7481 &shared_bitmap_manager, &task_graph_runner); | 7481 &shared_bitmap_manager, &task_graph_runner); |
7482 | 7482 |
7483 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); | 7483 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); |
7484 LayerImpl* root_layer = root.get(); | 7484 LayerImpl* root_layer = root.get(); |
7485 scoped_ptr<LayerImpl> child1 = LayerImpl::Create(host_impl.active_tree(), 2); | 7485 scoped_ptr<LayerImpl> child1 = LayerImpl::Create(host_impl.active_tree(), 2); |
7486 LayerImpl* child1_layer = child1.get(); | 7486 LayerImpl* child1_layer = child1.get(); |
7487 scoped_ptr<LayerImpl> child2 = LayerImpl::Create(host_impl.active_tree(), 3); | 7487 scoped_ptr<LayerImpl> child2 = LayerImpl::Create(host_impl.active_tree(), 3); |
7488 LayerImpl* child2_layer = child2.get(); | 7488 LayerImpl* child2_layer = child2.get(); |
7489 | 7489 |
7490 root->AddChild(child1.Pass()); | 7490 root->AddChild(std::move(child1)); |
7491 root->AddChild(child2.Pass()); | 7491 root->AddChild(std::move(child2)); |
7492 root->SetHasRenderSurface(true); | 7492 root->SetHasRenderSurface(true); |
7493 root->SetDrawsContent(true); | 7493 root->SetDrawsContent(true); |
7494 | 7494 |
7495 gfx::Transform identity_matrix, scale_transform_child1, | 7495 gfx::Transform identity_matrix, scale_transform_child1, |
7496 scale_transform_child2; | 7496 scale_transform_child2; |
7497 scale_transform_child1.Scale(2, 3); | 7497 scale_transform_child1.Scale(2, 3); |
7498 scale_transform_child2.Scale(4, 5); | 7498 scale_transform_child2.Scale(4, 5); |
7499 | 7499 |
7500 SetLayerPropertiesForTesting(root_layer, identity_matrix, gfx::Point3F(), | 7500 SetLayerPropertiesForTesting(root_layer, identity_matrix, gfx::Point3F(), |
7501 gfx::PointF(), gfx::Size(1, 1), true, false, | 7501 gfx::PointF(), gfx::Size(1, 1), true, false, |
7502 true); | 7502 true); |
7503 SetLayerPropertiesForTesting(child1_layer, scale_transform_child1, | 7503 SetLayerPropertiesForTesting(child1_layer, scale_transform_child1, |
7504 gfx::Point3F(), gfx::PointF(), gfx::Size(1, 1), | 7504 gfx::Point3F(), gfx::PointF(), gfx::Size(1, 1), |
7505 true, false, false); | 7505 true, false, false); |
7506 | 7506 |
7507 child1_layer->SetMaskLayer( | 7507 child1_layer->SetMaskLayer( |
7508 LayerImpl::Create(host_impl.active_tree(), 4).Pass()); | 7508 LayerImpl::Create(host_impl.active_tree(), 4).Pass()); |
7509 child1_layer->SetDrawsContent(true); | 7509 child1_layer->SetDrawsContent(true); |
7510 | 7510 |
7511 scoped_ptr<LayerImpl> replica_layer = | 7511 scoped_ptr<LayerImpl> replica_layer = |
7512 LayerImpl::Create(host_impl.active_tree(), 5); | 7512 LayerImpl::Create(host_impl.active_tree(), 5); |
7513 replica_layer->SetHasRenderSurface(true); | 7513 replica_layer->SetHasRenderSurface(true); |
7514 replica_layer->SetMaskLayer(LayerImpl::Create(host_impl.active_tree(), 6)); | 7514 replica_layer->SetMaskLayer(LayerImpl::Create(host_impl.active_tree(), 6)); |
7515 child1_layer->SetReplicaLayer(replica_layer.Pass()); | 7515 child1_layer->SetReplicaLayer(std::move(replica_layer)); |
7516 child1_layer->SetHasRenderSurface(true); | 7516 child1_layer->SetHasRenderSurface(true); |
7517 | 7517 |
7518 ExecuteCalculateDrawProperties(root_layer); | 7518 ExecuteCalculateDrawProperties(root_layer); |
7519 | 7519 |
7520 TransformOperations scale; | 7520 TransformOperations scale; |
7521 scale.AppendScale(5.f, 8.f, 3.f); | 7521 scale.AppendScale(5.f, 8.f, 3.f); |
7522 | 7522 |
7523 AddAnimatedTransformToLayer(child2_layer, 1.0, TransformOperations(), scale); | 7523 AddAnimatedTransformToLayer(child2_layer, 1.0, TransformOperations(), scale); |
7524 SetLayerPropertiesForTesting(child2_layer, scale_transform_child2, | 7524 SetLayerPropertiesForTesting(child2_layer, scale_transform_child2, |
7525 gfx::Point3F(), gfx::PointF(), gfx::Size(1, 1), | 7525 gfx::Point3F(), gfx::PointF(), gfx::Size(1, 1), |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7967 KeyframedFilterAnimationCurve::Create()); | 7967 KeyframedFilterAnimationCurve::Create()); |
7968 FilterOperations start_filters; | 7968 FilterOperations start_filters; |
7969 start_filters.Append(FilterOperation::CreateBrightnessFilter(0.1f)); | 7969 start_filters.Append(FilterOperation::CreateBrightnessFilter(0.1f)); |
7970 FilterOperations end_filters; | 7970 FilterOperations end_filters; |
7971 end_filters.Append(FilterOperation::CreateBrightnessFilter(0.3f)); | 7971 end_filters.Append(FilterOperation::CreateBrightnessFilter(0.3f)); |
7972 curve->AddKeyframe( | 7972 curve->AddKeyframe( |
7973 FilterKeyframe::Create(base::TimeDelta(), start_filters, nullptr)); | 7973 FilterKeyframe::Create(base::TimeDelta(), start_filters, nullptr)); |
7974 curve->AddKeyframe(FilterKeyframe::Create( | 7974 curve->AddKeyframe(FilterKeyframe::Create( |
7975 base::TimeDelta::FromMilliseconds(100), end_filters, nullptr)); | 7975 base::TimeDelta::FromMilliseconds(100), end_filters, nullptr)); |
7976 scoped_ptr<Animation> animation = | 7976 scoped_ptr<Animation> animation = |
7977 Animation::Create(curve.Pass(), 0, 1, Animation::FILTER); | 7977 Animation::Create(std::move(curve), 0, 1, Animation::FILTER); |
7978 animation->set_fill_mode(Animation::FILL_MODE_NONE); | 7978 animation->set_fill_mode(Animation::FILL_MODE_NONE); |
7979 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); | 7979 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); |
7980 child->layer_animation_controller()->AddAnimation(animation.Pass()); | 7980 child->layer_animation_controller()->AddAnimation(std::move(animation)); |
7981 | 7981 |
7982 ExecuteCalculateDrawProperties(root.get()); | 7982 ExecuteCalculateDrawProperties(root.get()); |
7983 | 7983 |
7984 EXPECT_TRUE(root->has_render_surface()); | 7984 EXPECT_TRUE(root->has_render_surface()); |
7985 EXPECT_TRUE(child->has_render_surface()); | 7985 EXPECT_TRUE(child->has_render_surface()); |
7986 EXPECT_FALSE(grandchild->has_render_surface()); | 7986 EXPECT_FALSE(grandchild->has_render_surface()); |
7987 | 7987 |
7988 EXPECT_TRUE(root->filters().IsEmpty()); | 7988 EXPECT_TRUE(root->filters().IsEmpty()); |
7989 EXPECT_TRUE(child->filters().IsEmpty()); | 7989 EXPECT_TRUE(child->filters().IsEmpty()); |
7990 EXPECT_TRUE(grandchild->filters().IsEmpty()); | 7990 EXPECT_TRUE(grandchild->filters().IsEmpty()); |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8411 child->SetTransform(zero_z_scale); | 8411 child->SetTransform(zero_z_scale); |
8412 | 8412 |
8413 // Add a transform animation with a start delay. Now, even though |child| has | 8413 // Add a transform animation with a start delay. Now, even though |child| has |
8414 // a singular transform, the subtree should still get processed. | 8414 // a singular transform, the subtree should still get processed. |
8415 int animation_id = 0; | 8415 int animation_id = 0; |
8416 scoped_ptr<Animation> animation = Animation::Create( | 8416 scoped_ptr<Animation> animation = Animation::Create( |
8417 scoped_ptr<AnimationCurve>(new FakeTransformTransition(1.0)).Pass(), | 8417 scoped_ptr<AnimationCurve>(new FakeTransformTransition(1.0)).Pass(), |
8418 animation_id, 1, Animation::TRANSFORM); | 8418 animation_id, 1, Animation::TRANSFORM); |
8419 animation->set_fill_mode(Animation::FILL_MODE_NONE); | 8419 animation->set_fill_mode(Animation::FILL_MODE_NONE); |
8420 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); | 8420 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); |
8421 child->AddAnimation(animation.Pass()); | 8421 child->AddAnimation(std::move(animation)); |
8422 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8422 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
8423 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_rect_from_property_trees()); | 8423 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_rect_from_property_trees()); |
8424 grandchild->set_visible_rect_from_property_trees(gfx::Rect()); | 8424 grandchild->set_visible_rect_from_property_trees(gfx::Rect()); |
8425 | 8425 |
8426 child->RemoveAnimation(animation_id); | 8426 child->RemoveAnimation(animation_id); |
8427 child->SetTransform(identity); | 8427 child->SetTransform(identity); |
8428 child->SetOpacity(0.f); | 8428 child->SetOpacity(0.f); |
8429 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8429 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
8430 EXPECT_EQ(gfx::Rect(0, 0), grandchild->visible_rect_from_property_trees()); | 8430 EXPECT_EQ(gfx::Rect(0, 0), grandchild->visible_rect_from_property_trees()); |
8431 | 8431 |
8432 // Now, even though child has zero opacity, we will configure |grandchild| and | 8432 // Now, even though child has zero opacity, we will configure |grandchild| and |
8433 // |greatgrandchild| in several ways that should force the subtree to be | 8433 // |greatgrandchild| in several ways that should force the subtree to be |
8434 // processed anyhow. | 8434 // processed anyhow. |
8435 greatgrandchild->RequestCopyOfOutput( | 8435 greatgrandchild->RequestCopyOfOutput( |
8436 CopyOutputRequest::CreateBitmapRequest(base::Bind(&CopyOutputCallback))); | 8436 CopyOutputRequest::CreateBitmapRequest(base::Bind(&CopyOutputCallback))); |
8437 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8437 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
8438 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_rect_from_property_trees()); | 8438 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_rect_from_property_trees()); |
8439 grandchild->set_visible_rect_from_property_trees(gfx::Rect()); | 8439 grandchild->set_visible_rect_from_property_trees(gfx::Rect()); |
8440 | 8440 |
8441 // Add an opacity animation with a start delay. | 8441 // Add an opacity animation with a start delay. |
8442 animation_id = 1; | 8442 animation_id = 1; |
8443 animation = Animation::Create( | 8443 animation = Animation::Create( |
8444 scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)).Pass(), | 8444 scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)).Pass(), |
8445 animation_id, 1, Animation::OPACITY); | 8445 animation_id, 1, Animation::OPACITY); |
8446 animation->set_fill_mode(Animation::FILL_MODE_NONE); | 8446 animation->set_fill_mode(Animation::FILL_MODE_NONE); |
8447 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); | 8447 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); |
8448 child->AddAnimation(animation.Pass()); | 8448 child->AddAnimation(std::move(animation)); |
8449 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8449 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
8450 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_rect_from_property_trees()); | 8450 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_rect_from_property_trees()); |
8451 } | 8451 } |
8452 | 8452 |
8453 TEST_F(LayerTreeHostCommonTest, SkippingSubtreeImpl) { | 8453 TEST_F(LayerTreeHostCommonTest, SkippingSubtreeImpl) { |
8454 FakeImplTaskRunnerProvider task_runner_provider; | 8454 FakeImplTaskRunnerProvider task_runner_provider; |
8455 TestSharedBitmapManager shared_bitmap_manager; | 8455 TestSharedBitmapManager shared_bitmap_manager; |
8456 TestTaskGraphRunner task_graph_runner; | 8456 TestTaskGraphRunner task_graph_runner; |
8457 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, | 8457 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, |
8458 &task_graph_runner); | 8458 &task_graph_runner); |
(...skipping 21 matching lines...) Expand all Loading... |
8480 gfx::PointF(), gfx::Size(10, 10), true, false, | 8480 gfx::PointF(), gfx::Size(10, 10), true, false, |
8481 false); | 8481 false); |
8482 SetLayerPropertiesForTesting(greatgrandchild.get(), identity, gfx::Point3F(), | 8482 SetLayerPropertiesForTesting(greatgrandchild.get(), identity, gfx::Point3F(), |
8483 gfx::PointF(), gfx::Size(10, 10), true, false, | 8483 gfx::PointF(), gfx::Size(10, 10), true, false, |
8484 true); | 8484 true); |
8485 | 8485 |
8486 LayerImpl* child_ptr = child.get(); | 8486 LayerImpl* child_ptr = child.get(); |
8487 LayerImpl* grandchild_ptr = grandchild.get(); | 8487 LayerImpl* grandchild_ptr = grandchild.get(); |
8488 LayerImpl* greatgrandchild_ptr = greatgrandchild.get(); | 8488 LayerImpl* greatgrandchild_ptr = greatgrandchild.get(); |
8489 | 8489 |
8490 grandchild->AddChild(greatgrandchild.Pass()); | 8490 grandchild->AddChild(std::move(greatgrandchild)); |
8491 child->AddChild(grandchild.Pass()); | 8491 child->AddChild(std::move(grandchild)); |
8492 root->AddChild(child.Pass()); | 8492 root->AddChild(std::move(child)); |
8493 | 8493 |
8494 // Check the non-skipped case. | 8494 // Check the non-skipped case. |
8495 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8495 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
8496 EXPECT_EQ(gfx::Rect(10, 10), | 8496 EXPECT_EQ(gfx::Rect(10, 10), |
8497 grandchild_ptr->visible_rect_from_property_trees()); | 8497 grandchild_ptr->visible_rect_from_property_trees()); |
8498 | 8498 |
8499 // Now we will reset the visible rect from property trees for the grandchild, | 8499 // Now we will reset the visible rect from property trees for the grandchild, |
8500 // and we will configure |child| in several ways that should force the subtree | 8500 // and we will configure |child| in several ways that should force the subtree |
8501 // to be skipped. The visible content rect for |grandchild| should, therefore, | 8501 // to be skipped. The visible content rect for |grandchild| should, therefore, |
8502 // remain empty. | 8502 // remain empty. |
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9267 bool root_in_rsll = | 9267 bool root_in_rsll = |
9268 std::find(rsll->begin(), rsll->end(), root) != rsll->end(); | 9268 std::find(rsll->begin(), rsll->end(), root) != rsll->end(); |
9269 EXPECT_TRUE(root_in_rsll); | 9269 EXPECT_TRUE(root_in_rsll); |
9270 bool render_surface2_in_rsll = | 9270 bool render_surface2_in_rsll = |
9271 std::find(rsll->begin(), rsll->end(), render_surface2) != rsll->end(); | 9271 std::find(rsll->begin(), rsll->end(), render_surface2) != rsll->end(); |
9272 EXPECT_FALSE(render_surface2_in_rsll); | 9272 EXPECT_FALSE(render_surface2_in_rsll); |
9273 } | 9273 } |
9274 | 9274 |
9275 } // namespace | 9275 } // namespace |
9276 } // namespace cc | 9276 } // namespace cc |
OLD | NEW |