| 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 | 9 |
| 10 #include "cc/animation/layer_animation_controller.h" | 10 #include "cc/animation/layer_animation_controller.h" |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 LayerImpl::Create(host_impl.active_tree(), 1)); | 317 LayerImpl::Create(host_impl.active_tree(), 1)); |
| 318 LayerImpl* sublayer = sublayer_scoped_ptr.get(); | 318 LayerImpl* sublayer = sublayer_scoped_ptr.get(); |
| 319 sublayer->SetContentsScale(kPageScale * kDeviceScale, | 319 sublayer->SetContentsScale(kPageScale * kDeviceScale, |
| 320 kPageScale * kDeviceScale); | 320 kPageScale * kDeviceScale); |
| 321 SetLayerPropertiesForTesting(sublayer, | 321 SetLayerPropertiesForTesting(sublayer, |
| 322 identity_matrix, | 322 identity_matrix, |
| 323 gfx::Point3F(), | 323 gfx::Point3F(), |
| 324 gfx::PointF(), | 324 gfx::PointF(), |
| 325 gfx::Size(500, 500), | 325 gfx::Size(500, 500), |
| 326 true, | 326 true, |
| 327 false, |
| 327 false); | 328 false); |
| 328 | 329 |
| 329 scoped_ptr<LayerImpl> scroll_layer_scoped_ptr( | 330 scoped_ptr<LayerImpl> scroll_layer_scoped_ptr( |
| 330 LayerImpl::Create(host_impl.active_tree(), 2)); | 331 LayerImpl::Create(host_impl.active_tree(), 2)); |
| 331 LayerImpl* scroll_layer = scroll_layer_scoped_ptr.get(); | 332 LayerImpl* scroll_layer = scroll_layer_scoped_ptr.get(); |
| 332 SetLayerPropertiesForTesting(scroll_layer, | 333 SetLayerPropertiesForTesting(scroll_layer, |
| 333 identity_matrix, | 334 identity_matrix, |
| 334 gfx::Point3F(), | 335 gfx::Point3F(), |
| 335 gfx::PointF(), | 336 gfx::PointF(), |
| 336 gfx::Size(10, 20), | 337 gfx::Size(10, 20), |
| 337 true, | 338 true, |
| 339 false, |
| 338 false); | 340 false); |
| 339 scoped_ptr<LayerImpl> clip_layer_scoped_ptr( | 341 scoped_ptr<LayerImpl> clip_layer_scoped_ptr( |
| 340 LayerImpl::Create(host_impl.active_tree(), 4)); | 342 LayerImpl::Create(host_impl.active_tree(), 4)); |
| 341 LayerImpl* clip_layer = clip_layer_scoped_ptr.get(); | 343 LayerImpl* clip_layer = clip_layer_scoped_ptr.get(); |
| 342 | 344 |
| 343 scroll_layer->SetScrollClipLayer(clip_layer->id()); | 345 scroll_layer->SetScrollClipLayer(clip_layer->id()); |
| 344 clip_layer->SetBounds( | 346 clip_layer->SetBounds( |
| 345 gfx::Size(scroll_layer->bounds().width() + kMaxScrollOffset.x(), | 347 gfx::Size(scroll_layer->bounds().width() + kMaxScrollOffset.x(), |
| 346 scroll_layer->bounds().height() + kMaxScrollOffset.y())); | 348 scroll_layer->bounds().height() + kMaxScrollOffset.y())); |
| 347 scroll_layer->SetScrollClipLayer(clip_layer->id()); | 349 scroll_layer->SetScrollClipLayer(clip_layer->id()); |
| 348 scroll_layer->SetScrollDelta(kScrollDelta); | 350 scroll_layer->SetScrollDelta(kScrollDelta); |
| 349 gfx::Transform impl_transform; | 351 gfx::Transform impl_transform; |
| 350 scroll_layer->AddChild(sublayer_scoped_ptr.Pass()); | 352 scroll_layer->AddChild(sublayer_scoped_ptr.Pass()); |
| 351 LayerImpl* scroll_layer_raw_ptr = scroll_layer_scoped_ptr.get(); | 353 LayerImpl* scroll_layer_raw_ptr = scroll_layer_scoped_ptr.get(); |
| 352 clip_layer->AddChild(scroll_layer_scoped_ptr.Pass()); | 354 clip_layer->AddChild(scroll_layer_scoped_ptr.Pass()); |
| 353 scroll_layer_raw_ptr->SetScrollOffset(kScrollOffset); | 355 scroll_layer_raw_ptr->SetScrollOffset(kScrollOffset); |
| 354 | 356 |
| 355 scoped_ptr<LayerImpl> root(LayerImpl::Create(host_impl.active_tree(), 3)); | 357 scoped_ptr<LayerImpl> root(LayerImpl::Create(host_impl.active_tree(), 3)); |
| 356 SetLayerPropertiesForTesting(root.get(), | 358 SetLayerPropertiesForTesting(root.get(), |
| 357 identity_matrix, | 359 identity_matrix, |
| 358 gfx::Point3F(), | 360 gfx::Point3F(), |
| 359 gfx::PointF(), | 361 gfx::PointF(), |
| 360 gfx::Size(3, 4), | 362 gfx::Size(3, 4), |
| 361 true, | 363 true, |
| 364 false, |
| 362 false); | 365 false); |
| 363 root->AddChild(clip_layer_scoped_ptr.Pass()); | 366 root->AddChild(clip_layer_scoped_ptr.Pass()); |
| 367 root->SetHasRenderSurface(true); |
| 364 | 368 |
| 365 ExecuteCalculateDrawProperties( | 369 ExecuteCalculateDrawProperties( |
| 366 root.get(), kDeviceScale, kPageScale, scroll_layer->parent()); | 370 root.get(), kDeviceScale, kPageScale, scroll_layer->parent()); |
| 367 gfx::Transform expected_transform = identity_matrix; | 371 gfx::Transform expected_transform = identity_matrix; |
| 368 gfx::PointF sub_layer_screen_position = kScrollLayerPosition - kScrollDelta; | 372 gfx::PointF sub_layer_screen_position = kScrollLayerPosition - kScrollDelta; |
| 369 sub_layer_screen_position.Scale(kPageScale * kDeviceScale); | 373 sub_layer_screen_position.Scale(kPageScale * kDeviceScale); |
| 370 expected_transform.Translate(MathUtil::Round(sub_layer_screen_position.x()), | 374 expected_transform.Translate(MathUtil::Round(sub_layer_screen_position.x()), |
| 371 MathUtil::Round(sub_layer_screen_position.y())); | 375 MathUtil::Round(sub_layer_screen_position.y())); |
| 372 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform, | 376 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform, |
| 373 sublayer->draw_transform()); | 377 sublayer->draw_transform()); |
| 374 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform, | 378 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform, |
| 375 sublayer->screen_space_transform()); | 379 sublayer->screen_space_transform()); |
| 376 | 380 |
| 377 gfx::Transform arbitrary_translate; | 381 gfx::Transform arbitrary_translate; |
| 378 const float kTranslateX = 10.6f; | 382 const float kTranslateX = 10.6f; |
| 379 const float kTranslateY = 20.6f; | 383 const float kTranslateY = 20.6f; |
| 380 arbitrary_translate.Translate(kTranslateX, kTranslateY); | 384 arbitrary_translate.Translate(kTranslateX, kTranslateY); |
| 381 SetLayerPropertiesForTesting(scroll_layer, | 385 SetLayerPropertiesForTesting(scroll_layer, |
| 382 arbitrary_translate, | 386 arbitrary_translate, |
| 383 gfx::Point3F(), | 387 gfx::Point3F(), |
| 384 gfx::PointF(), | 388 gfx::PointF(), |
| 385 gfx::Size(10, 20), | 389 gfx::Size(10, 20), |
| 386 true, | 390 true, |
| 391 false, |
| 387 false); | 392 false); |
| 388 ExecuteCalculateDrawProperties( | 393 ExecuteCalculateDrawProperties( |
| 389 root.get(), kDeviceScale, kPageScale, scroll_layer->parent()); | 394 root.get(), kDeviceScale, kPageScale, scroll_layer->parent()); |
| 390 expected_transform.MakeIdentity(); | 395 expected_transform.MakeIdentity(); |
| 391 expected_transform.Translate( | 396 expected_transform.Translate( |
| 392 MathUtil::Round(kTranslateX * kPageScale * kDeviceScale + | 397 MathUtil::Round(kTranslateX * kPageScale * kDeviceScale + |
| 393 sub_layer_screen_position.x()), | 398 sub_layer_screen_position.x()), |
| 394 MathUtil::Round(kTranslateY * kPageScale * kDeviceScale + | 399 MathUtil::Round(kTranslateY * kPageScale * kDeviceScale + |
| 395 sub_layer_screen_position.y())); | 400 sub_layer_screen_position.y())); |
| 396 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform, | 401 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform, |
| (...skipping 3350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3747 gfx::Size(100, 100), | 3752 gfx::Size(100, 100), |
| 3748 true, | 3753 true, |
| 3749 true); | 3754 true); |
| 3750 | 3755 |
| 3751 RenderSurfaceLayerList render_surface_layer_list; | 3756 RenderSurfaceLayerList render_surface_layer_list; |
| 3752 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 3757 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
| 3753 parent.get(), parent->bounds(), &render_surface_layer_list); | 3758 parent.get(), parent->bounds(), &render_surface_layer_list); |
| 3754 inputs.can_adjust_raster_scales = true; | 3759 inputs.can_adjust_raster_scales = true; |
| 3755 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 3760 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 3756 | 3761 |
| 3757 // Verify which render surfaces were created. | 3762 // Verify which render surfaces were created and used. |
| 3758 EXPECT_FALSE(front_facing_child->render_surface()); | 3763 EXPECT_FALSE(front_facing_child->render_surface()); |
| 3759 EXPECT_FALSE(back_facing_child->render_surface()); | 3764 EXPECT_FALSE(back_facing_child->render_surface()); |
| 3760 EXPECT_TRUE(front_facing_surface->render_surface()); | 3765 EXPECT_TRUE(front_facing_surface->render_surface()); |
| 3761 EXPECT_FALSE(back_facing_surface->render_surface()); | 3766 EXPECT_NE(back_facing_surface->render_target(), back_facing_surface); |
| 3767 // We expect that a render_surface was created but not used. |
| 3768 EXPECT_TRUE(back_facing_surface->render_surface()); |
| 3762 EXPECT_FALSE(front_facing_child_of_front_facing_surface->render_surface()); | 3769 EXPECT_FALSE(front_facing_child_of_front_facing_surface->render_surface()); |
| 3763 EXPECT_FALSE(back_facing_child_of_front_facing_surface->render_surface()); | 3770 EXPECT_FALSE(back_facing_child_of_front_facing_surface->render_surface()); |
| 3764 EXPECT_FALSE(front_facing_child_of_back_facing_surface->render_surface()); | 3771 EXPECT_FALSE(front_facing_child_of_back_facing_surface->render_surface()); |
| 3765 EXPECT_FALSE(back_facing_child_of_back_facing_surface->render_surface()); | 3772 EXPECT_FALSE(back_facing_child_of_back_facing_surface->render_surface()); |
| 3766 | 3773 |
| 3767 // Verify the render_surface_layer_list. The back-facing surface should be | 3774 // Verify the render_surface_layer_list. The back-facing surface should be |
| 3768 // culled. | 3775 // culled. |
| 3769 ASSERT_EQ(2u, render_surface_layer_list.size()); | 3776 ASSERT_EQ(2u, render_surface_layer_list.size()); |
| 3770 EXPECT_EQ(parent->id(), render_surface_layer_list.at(0)->id()); | 3777 EXPECT_EQ(parent->id(), render_surface_layer_list.at(0)->id()); |
| 3771 EXPECT_EQ(front_facing_surface->id(), render_surface_layer_list.at(1)->id()); | 3778 EXPECT_EQ(front_facing_surface->id(), render_surface_layer_list.at(1)->id()); |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4015 | 4022 |
| 4016 front_facing_surface->Set3dSortingContextId(1); | 4023 front_facing_surface->Set3dSortingContextId(1); |
| 4017 back_facing_surface->Set3dSortingContextId(1); | 4024 back_facing_surface->Set3dSortingContextId(1); |
| 4018 | 4025 |
| 4019 RenderSurfaceLayerList render_surface_layer_list; | 4026 RenderSurfaceLayerList render_surface_layer_list; |
| 4020 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 4027 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
| 4021 parent.get(), parent->bounds(), &render_surface_layer_list); | 4028 parent.get(), parent->bounds(), &render_surface_layer_list); |
| 4022 inputs.can_adjust_raster_scales = true; | 4029 inputs.can_adjust_raster_scales = true; |
| 4023 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 4030 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 4024 | 4031 |
| 4025 // Verify which render surfaces were created. | 4032 // Verify which render surfaces were created and used. |
| 4026 EXPECT_TRUE(front_facing_surface->render_surface()); | 4033 EXPECT_TRUE(front_facing_surface->render_surface()); |
| 4027 EXPECT_FALSE( | 4034 |
| 4028 back_facing_surface->render_surface()); // because it should be culled | 4035 // We expect the render surface to have been created, but remain unused. |
| 4036 EXPECT_TRUE(back_facing_surface->render_surface()); |
| 4037 EXPECT_NE(back_facing_surface->render_target(), |
| 4038 back_facing_surface); // because it should be culled |
| 4029 EXPECT_FALSE(child1->render_surface()); | 4039 EXPECT_FALSE(child1->render_surface()); |
| 4030 EXPECT_FALSE(child2->render_surface()); | 4040 EXPECT_FALSE(child2->render_surface()); |
| 4031 | 4041 |
| 4032 // Verify the render_surface_layer_list. The back-facing surface should be | 4042 // Verify the render_surface_layer_list. The back-facing surface should be |
| 4033 // culled. | 4043 // culled. |
| 4034 ASSERT_EQ(2u, render_surface_layer_list.size()); | 4044 ASSERT_EQ(2u, render_surface_layer_list.size()); |
| 4035 EXPECT_EQ(parent->id(), render_surface_layer_list.at(0)->id()); | 4045 EXPECT_EQ(parent->id(), render_surface_layer_list.at(0)->id()); |
| 4036 EXPECT_EQ(front_facing_surface->id(), render_surface_layer_list.at(1)->id()); | 4046 EXPECT_EQ(front_facing_surface->id(), render_surface_layer_list.at(1)->id()); |
| 4037 | 4047 |
| 4038 // Verify root surface's layer list. | 4048 // Verify root surface's layer list. |
| (...skipping 1566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5605 host_impl.CreatePendingTree(); | 5615 host_impl.CreatePendingTree(); |
| 5606 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); | 5616 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); |
| 5607 | 5617 |
| 5608 const gfx::Transform identity_matrix; | 5618 const gfx::Transform identity_matrix; |
| 5609 SetLayerPropertiesForTesting(root.get(), | 5619 SetLayerPropertiesForTesting(root.get(), |
| 5610 identity_matrix, | 5620 identity_matrix, |
| 5611 gfx::Point3F(), | 5621 gfx::Point3F(), |
| 5612 gfx::PointF(), | 5622 gfx::PointF(), |
| 5613 gfx::Size(100, 100), | 5623 gfx::Size(100, 100), |
| 5614 true, | 5624 true, |
| 5625 false, |
| 5615 false); | 5626 false); |
| 5616 root->SetDrawsContent(true); | 5627 root->SetDrawsContent(true); |
| 5617 | 5628 |
| 5618 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2); | 5629 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2); |
| 5619 SetLayerPropertiesForTesting(child.get(), | 5630 SetLayerPropertiesForTesting(child.get(), |
| 5620 identity_matrix, | 5631 identity_matrix, |
| 5621 gfx::Point3F(), | 5632 gfx::Point3F(), |
| 5622 gfx::PointF(), | 5633 gfx::PointF(), |
| 5623 gfx::Size(50, 50), | 5634 gfx::Size(50, 50), |
| 5624 true, | 5635 true, |
| 5636 false, |
| 5625 false); | 5637 false); |
| 5626 child->SetDrawsContent(true); | 5638 child->SetDrawsContent(true); |
| 5627 child->SetOpacity(0.0f); | 5639 child->SetOpacity(0.0f); |
| 5628 | 5640 |
| 5629 // Add opacity animation. | 5641 // Add opacity animation. |
| 5630 AddOpacityTransitionToController( | 5642 AddOpacityTransitionToController( |
| 5631 child->layer_animation_controller(), 10.0, 0.0f, 1.0f, false); | 5643 child->layer_animation_controller(), 10.0, 0.0f, 1.0f, false); |
| 5632 | 5644 |
| 5633 root->AddChild(child.Pass()); | 5645 root->AddChild(child.Pass()); |
| 5646 root->SetHasRenderSurface(true); |
| 5634 | 5647 |
| 5635 LayerImplList render_surface_layer_list; | 5648 LayerImplList render_surface_layer_list; |
| 5636 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 5649 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
| 5637 root.get(), root->bounds(), &render_surface_layer_list); | 5650 root.get(), root->bounds(), &render_surface_layer_list); |
| 5638 inputs.can_adjust_raster_scales = true; | 5651 inputs.can_adjust_raster_scales = true; |
| 5639 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 5652 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 5640 | 5653 |
| 5641 // We should have one render surface and two layers. The child | 5654 // We should have one render surface and two layers. The child |
| 5642 // layer should be included even though it is transparent. | 5655 // layer should be included even though it is transparent. |
| 5643 ASSERT_EQ(1u, render_surface_layer_list.size()); | 5656 ASSERT_EQ(1u, render_surface_layer_list.size()); |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5863 host_impl.CreatePendingTree(); | 5876 host_impl.CreatePendingTree(); |
| 5864 const gfx::Transform identity_matrix; | 5877 const gfx::Transform identity_matrix; |
| 5865 | 5878 |
| 5866 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); | 5879 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); |
| 5867 SetLayerPropertiesForTesting(root.get(), | 5880 SetLayerPropertiesForTesting(root.get(), |
| 5868 identity_matrix, | 5881 identity_matrix, |
| 5869 gfx::Point3F(), | 5882 gfx::Point3F(), |
| 5870 gfx::PointF(), | 5883 gfx::PointF(), |
| 5871 gfx::Size(50, 50), | 5884 gfx::Size(50, 50), |
| 5872 true, | 5885 true, |
| 5886 false, |
| 5873 false); | 5887 false); |
| 5874 root->SetDrawsContent(true); | 5888 root->SetDrawsContent(true); |
| 5875 | 5889 |
| 5876 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2); | 5890 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2); |
| 5877 SetLayerPropertiesForTesting(child.get(), | 5891 SetLayerPropertiesForTesting(child.get(), |
| 5878 identity_matrix, | 5892 identity_matrix, |
| 5879 gfx::Point3F(), | 5893 gfx::Point3F(), |
| 5880 gfx::PointF(), | 5894 gfx::PointF(), |
| 5881 gfx::Size(40, 40), | 5895 gfx::Size(40, 40), |
| 5882 true, | 5896 true, |
| 5897 false, |
| 5883 false); | 5898 false); |
| 5884 child->SetDrawsContent(true); | 5899 child->SetDrawsContent(true); |
| 5885 | 5900 |
| 5886 scoped_ptr<LayerImpl> grand_child = | 5901 scoped_ptr<LayerImpl> grand_child = |
| 5887 LayerImpl::Create(host_impl.pending_tree(), 3); | 5902 LayerImpl::Create(host_impl.pending_tree(), 3); |
| 5888 SetLayerPropertiesForTesting(grand_child.get(), | 5903 SetLayerPropertiesForTesting(grand_child.get(), |
| 5889 identity_matrix, | 5904 identity_matrix, |
| 5890 gfx::Point3F(), | 5905 gfx::Point3F(), |
| 5891 gfx::PointF(), | 5906 gfx::PointF(), |
| 5892 gfx::Size(30, 30), | 5907 gfx::Size(30, 30), |
| 5893 true, | 5908 true, |
| 5909 false, |
| 5894 false); | 5910 false); |
| 5895 grand_child->SetDrawsContent(true); | 5911 grand_child->SetDrawsContent(true); |
| 5896 grand_child->SetHideLayerAndSubtree(true); | 5912 grand_child->SetHideLayerAndSubtree(true); |
| 5897 | 5913 |
| 5898 child->AddChild(grand_child.Pass()); | 5914 child->AddChild(grand_child.Pass()); |
| 5899 root->AddChild(child.Pass()); | 5915 root->AddChild(child.Pass()); |
| 5916 root->SetHasRenderSurface(true); |
| 5900 | 5917 |
| 5901 LayerImplList render_surface_layer_list; | 5918 LayerImplList render_surface_layer_list; |
| 5902 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 5919 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
| 5903 root.get(), root->bounds(), &render_surface_layer_list); | 5920 root.get(), root->bounds(), &render_surface_layer_list); |
| 5904 inputs.can_adjust_raster_scales = true; | 5921 inputs.can_adjust_raster_scales = true; |
| 5905 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 5922 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 5906 | 5923 |
| 5907 // We should have one render surface and two layers. The grand child has | 5924 // We should have one render surface and two layers. The grand child has |
| 5908 // hidden itself. | 5925 // hidden itself. |
| 5909 ASSERT_EQ(1u, render_surface_layer_list.size()); | 5926 ASSERT_EQ(1u, render_surface_layer_list.size()); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5976 host_impl.CreatePendingTree(); | 5993 host_impl.CreatePendingTree(); |
| 5977 const gfx::Transform identity_matrix; | 5994 const gfx::Transform identity_matrix; |
| 5978 | 5995 |
| 5979 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); | 5996 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); |
| 5980 SetLayerPropertiesForTesting(root.get(), | 5997 SetLayerPropertiesForTesting(root.get(), |
| 5981 identity_matrix, | 5998 identity_matrix, |
| 5982 gfx::Point3F(), | 5999 gfx::Point3F(), |
| 5983 gfx::PointF(), | 6000 gfx::PointF(), |
| 5984 gfx::Size(50, 50), | 6001 gfx::Size(50, 50), |
| 5985 true, | 6002 true, |
| 5986 false); | 6003 false, |
| 6004 true); |
| 5987 root->SetDrawsContent(true); | 6005 root->SetDrawsContent(true); |
| 5988 | 6006 |
| 5989 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2); | 6007 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2); |
| 5990 SetLayerPropertiesForTesting(child.get(), | 6008 SetLayerPropertiesForTesting(child.get(), |
| 5991 identity_matrix, | 6009 identity_matrix, |
| 5992 gfx::Point3F(), | 6010 gfx::Point3F(), |
| 5993 gfx::PointF(), | 6011 gfx::PointF(), |
| 5994 gfx::Size(40, 40), | 6012 gfx::Size(40, 40), |
| 5995 true, | 6013 true, |
| 6014 false, |
| 5996 false); | 6015 false); |
| 5997 child->SetDrawsContent(true); | 6016 child->SetDrawsContent(true); |
| 5998 child->SetHideLayerAndSubtree(true); | 6017 child->SetHideLayerAndSubtree(true); |
| 5999 | 6018 |
| 6000 scoped_ptr<LayerImpl> grand_child = | 6019 scoped_ptr<LayerImpl> grand_child = |
| 6001 LayerImpl::Create(host_impl.pending_tree(), 3); | 6020 LayerImpl::Create(host_impl.pending_tree(), 3); |
| 6002 SetLayerPropertiesForTesting(grand_child.get(), | 6021 SetLayerPropertiesForTesting(grand_child.get(), |
| 6003 identity_matrix, | 6022 identity_matrix, |
| 6004 gfx::Point3F(), | 6023 gfx::Point3F(), |
| 6005 gfx::PointF(), | 6024 gfx::PointF(), |
| 6006 gfx::Size(30, 30), | 6025 gfx::Size(30, 30), |
| 6007 true, | 6026 true, |
| 6027 false, |
| 6008 false); | 6028 false); |
| 6009 grand_child->SetDrawsContent(true); | 6029 grand_child->SetDrawsContent(true); |
| 6010 | 6030 |
| 6011 child->AddChild(grand_child.Pass()); | 6031 child->AddChild(grand_child.Pass()); |
| 6012 root->AddChild(child.Pass()); | 6032 root->AddChild(child.Pass()); |
| 6013 | 6033 |
| 6014 LayerImplList render_surface_layer_list; | 6034 LayerImplList render_surface_layer_list; |
| 6015 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 6035 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
| 6016 root.get(), root->bounds(), &render_surface_layer_list); | 6036 root.get(), root->bounds(), &render_surface_layer_list); |
| 6017 inputs.can_adjust_raster_scales = true; | 6037 inputs.can_adjust_raster_scales = true; |
| (...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6875 gfx::Transform identity_matrix; | 6895 gfx::Transform identity_matrix; |
| 6876 gfx::Point3F transform_origin; | 6896 gfx::Point3F transform_origin; |
| 6877 gfx::PointF position; | 6897 gfx::PointF position; |
| 6878 gfx::Size bounds(100, 100); | 6898 gfx::Size bounds(100, 100); |
| 6879 SetLayerPropertiesForTesting(root.get(), | 6899 SetLayerPropertiesForTesting(root.get(), |
| 6880 identity_matrix, | 6900 identity_matrix, |
| 6881 transform_origin, | 6901 transform_origin, |
| 6882 position, | 6902 position, |
| 6883 bounds, | 6903 bounds, |
| 6884 true, | 6904 true, |
| 6885 false); | 6905 false, |
| 6906 true); |
| 6886 root->SetDrawsContent(true); | 6907 root->SetDrawsContent(true); |
| 6887 | 6908 |
| 6888 // This layer structure normally forces render surface due to preserves3d | 6909 // This layer structure normally forces render surface due to preserves3d |
| 6889 // behavior. | 6910 // behavior. |
| 6890 SetLayerPropertiesForTesting(child1.get(), | 6911 SetLayerPropertiesForTesting(child1.get(), |
| 6891 identity_matrix, | 6912 identity_matrix, |
| 6892 transform_origin, | 6913 transform_origin, |
| 6893 position, | 6914 position, |
| 6894 bounds, | 6915 bounds, |
| 6895 false, | 6916 false, |
| 6917 true, |
| 6896 true); | 6918 true); |
| 6897 child1->SetDrawsContent(true); | 6919 child1->SetDrawsContent(true); |
| 6898 SetLayerPropertiesForTesting(child2.get(), | 6920 SetLayerPropertiesForTesting(child2.get(), |
| 6899 identity_matrix, | 6921 identity_matrix, |
| 6900 transform_origin, | 6922 transform_origin, |
| 6901 position, | 6923 position, |
| 6902 bounds, | 6924 bounds, |
| 6903 true, | 6925 true, |
| 6926 false, |
| 6904 false); | 6927 false); |
| 6905 child2->SetDrawsContent(true); | 6928 child2->SetDrawsContent(true); |
| 6906 SetLayerPropertiesForTesting(child3.get(), | 6929 SetLayerPropertiesForTesting(child3.get(), |
| 6907 identity_matrix, | 6930 identity_matrix, |
| 6908 transform_origin, | 6931 transform_origin, |
| 6909 position, | 6932 position, |
| 6910 bounds, | 6933 bounds, |
| 6911 true, | 6934 true, |
| 6935 false, |
| 6912 false); | 6936 false); |
| 6913 child3->SetDrawsContent(true); | 6937 child3->SetDrawsContent(true); |
| 6914 | 6938 |
| 6915 child2->Set3dSortingContextId(1); | 6939 child2->Set3dSortingContextId(1); |
| 6916 child3->Set3dSortingContextId(1); | 6940 child3->Set3dSortingContextId(1); |
| 6917 | 6941 |
| 6918 child2->AddChild(child3.Pass()); | 6942 child2->AddChild(child3.Pass()); |
| 6919 child1->AddChild(child2.Pass()); | 6943 child1->AddChild(child2.Pass()); |
| 6920 root->AddChild(child1.Pass()); | 6944 root->AddChild(child1.Pass()); |
| 6921 | 6945 |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7550 top_transform.Translate3d(0.0, 0.0, 5.0); | 7574 top_transform.Translate3d(0.0, 0.0, 5.0); |
| 7551 gfx::Transform bottom_transform; | 7575 gfx::Transform bottom_transform; |
| 7552 bottom_transform.Translate3d(0.0, 0.0, 3.0); | 7576 bottom_transform.Translate3d(0.0, 0.0, 3.0); |
| 7553 | 7577 |
| 7554 SetLayerPropertiesForTesting(root.get(), | 7578 SetLayerPropertiesForTesting(root.get(), |
| 7555 identity_transform, | 7579 identity_transform, |
| 7556 gfx::Point3F(), | 7580 gfx::Point3F(), |
| 7557 gfx::PointF(), | 7581 gfx::PointF(), |
| 7558 gfx::Size(50, 50), | 7582 gfx::Size(50, 50), |
| 7559 true, | 7583 true, |
| 7560 false); | 7584 false, |
| 7585 true); |
| 7561 SetLayerPropertiesForTesting(scroll_parent_border.get(), | 7586 SetLayerPropertiesForTesting(scroll_parent_border.get(), |
| 7562 identity_transform, | 7587 identity_transform, |
| 7563 gfx::Point3F(), | 7588 gfx::Point3F(), |
| 7564 gfx::PointF(), | 7589 gfx::PointF(), |
| 7565 gfx::Size(40, 40), | 7590 gfx::Size(40, 40), |
| 7566 true, | 7591 true, |
| 7592 false, |
| 7567 false); | 7593 false); |
| 7568 SetLayerPropertiesForTesting(scroll_parent_clip.get(), | 7594 SetLayerPropertiesForTesting(scroll_parent_clip.get(), |
| 7569 identity_transform, | 7595 identity_transform, |
| 7570 gfx::Point3F(), | 7596 gfx::Point3F(), |
| 7571 gfx::PointF(), | 7597 gfx::PointF(), |
| 7572 gfx::Size(30, 30), | 7598 gfx::Size(30, 30), |
| 7573 true, | 7599 true, |
| 7600 false, |
| 7574 false); | 7601 false); |
| 7575 SetLayerPropertiesForTesting(scroll_parent.get(), | 7602 SetLayerPropertiesForTesting(scroll_parent.get(), |
| 7576 identity_transform, | 7603 identity_transform, |
| 7577 gfx::Point3F(), | 7604 gfx::Point3F(), |
| 7578 gfx::PointF(), | 7605 gfx::PointF(), |
| 7579 gfx::Size(50, 50), | 7606 gfx::Size(50, 50), |
| 7580 true, | 7607 true, |
| 7608 false, |
| 7581 false); | 7609 false); |
| 7582 SetLayerPropertiesForTesting(scroll_child.get(), | 7610 SetLayerPropertiesForTesting(scroll_child.get(), |
| 7583 identity_transform, | 7611 identity_transform, |
| 7584 gfx::Point3F(), | 7612 gfx::Point3F(), |
| 7585 gfx::PointF(), | 7613 gfx::PointF(), |
| 7586 gfx::Size(50, 50), | 7614 gfx::Size(50, 50), |
| 7587 true, | 7615 true, |
| 7616 false, |
| 7588 false); | 7617 false); |
| 7589 SetLayerPropertiesForTesting(top_content.get(), | 7618 SetLayerPropertiesForTesting(top_content.get(), |
| 7590 top_transform, | 7619 top_transform, |
| 7591 gfx::Point3F(), | 7620 gfx::Point3F(), |
| 7592 gfx::PointF(), | 7621 gfx::PointF(), |
| 7593 gfx::Size(50, 50), | 7622 gfx::Size(50, 50), |
| 7594 false, | 7623 false, |
| 7624 true, |
| 7595 true); | 7625 true); |
| 7596 SetLayerPropertiesForTesting(bottom_content.get(), | 7626 SetLayerPropertiesForTesting(bottom_content.get(), |
| 7597 bottom_transform, | 7627 bottom_transform, |
| 7598 gfx::Point3F(), | 7628 gfx::Point3F(), |
| 7599 gfx::PointF(), | 7629 gfx::PointF(), |
| 7600 gfx::Size(50, 50), | 7630 gfx::Size(50, 50), |
| 7601 false, | 7631 false, |
| 7632 true, |
| 7602 true); | 7633 true); |
| 7603 | 7634 |
| 7604 scroll_child->SetShouldFlattenTransform(false); | 7635 scroll_child->SetShouldFlattenTransform(false); |
| 7605 scroll_child->Set3dSortingContextId(1); | 7636 scroll_child->Set3dSortingContextId(1); |
| 7606 | 7637 |
| 7607 scroll_child->AddChild(top_content.Pass()); | 7638 scroll_child->AddChild(top_content.Pass()); |
| 7608 scroll_child->AddChild(bottom_content.Pass()); | 7639 scroll_child->AddChild(bottom_content.Pass()); |
| 7609 root->AddChild(scroll_child.Pass()); | 7640 root->AddChild(scroll_child.Pass()); |
| 7610 | 7641 |
| 7611 scroll_parent_clip->AddChild(scroll_parent.Pass()); | 7642 scroll_parent_clip->AddChild(scroll_parent.Pass()); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7668 gfx::Transform container_transform; | 7699 gfx::Transform container_transform; |
| 7669 container_transform.Translate3d(10.0, 20.0, 0.0); | 7700 container_transform.Translate3d(10.0, 20.0, 0.0); |
| 7670 gfx::Vector2dF container_offset = container_transform.To2dTranslation(); | 7701 gfx::Vector2dF container_offset = container_transform.To2dTranslation(); |
| 7671 | 7702 |
| 7672 SetLayerPropertiesForTesting(root.get(), | 7703 SetLayerPropertiesForTesting(root.get(), |
| 7673 identity_transform, | 7704 identity_transform, |
| 7674 gfx::Point3F(), | 7705 gfx::Point3F(), |
| 7675 gfx::PointF(), | 7706 gfx::PointF(), |
| 7676 gfx::Size(50, 50), | 7707 gfx::Size(50, 50), |
| 7677 true, | 7708 true, |
| 7678 false); | 7709 false, |
| 7710 true); |
| 7679 SetLayerPropertiesForTesting(container.get(), | 7711 SetLayerPropertiesForTesting(container.get(), |
| 7680 container_transform, | 7712 container_transform, |
| 7681 gfx::Point3F(), | 7713 gfx::Point3F(), |
| 7682 gfx::PointF(), | 7714 gfx::PointF(), |
| 7683 gfx::Size(40, 40), | 7715 gfx::Size(40, 40), |
| 7684 true, | 7716 true, |
| 7717 false, |
| 7685 false); | 7718 false); |
| 7686 SetLayerPropertiesForTesting(scroller.get(), | 7719 SetLayerPropertiesForTesting(scroller.get(), |
| 7687 identity_transform, | 7720 identity_transform, |
| 7688 gfx::Point3F(), | 7721 gfx::Point3F(), |
| 7689 gfx::PointF(), | 7722 gfx::PointF(), |
| 7690 gfx::Size(30, 30), | 7723 gfx::Size(30, 30), |
| 7691 true, | 7724 true, |
| 7725 false, |
| 7692 false); | 7726 false); |
| 7693 SetLayerPropertiesForTesting(fixed.get(), | 7727 SetLayerPropertiesForTesting(fixed.get(), |
| 7694 identity_transform, | 7728 identity_transform, |
| 7695 gfx::Point3F(), | 7729 gfx::Point3F(), |
| 7696 gfx::PointF(), | 7730 gfx::PointF(), |
| 7697 gfx::Size(50, 50), | 7731 gfx::Size(50, 50), |
| 7698 true, | 7732 true, |
| 7733 false, |
| 7699 false); | 7734 false); |
| 7700 | 7735 |
| 7701 scroller->AddChild(fixed.Pass()); | 7736 scroller->AddChild(fixed.Pass()); |
| 7702 container->AddChild(scroller.Pass()); | 7737 container->AddChild(scroller.Pass()); |
| 7703 root->AddChild(container.Pass()); | 7738 root->AddChild(container.Pass()); |
| 7704 | 7739 |
| 7705 // Rounded to integers already. | 7740 // Rounded to integers already. |
| 7706 { | 7741 { |
| 7707 gfx::Vector2dF scroll_delta(3.0, 5.0); | 7742 gfx::Vector2dF scroll_delta(3.0, 5.0); |
| 7708 scroll_layer->SetScrollDelta(scroll_delta); | 7743 scroll_layer->SetScrollDelta(scroll_delta); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7832 child->AddChild(grand_child.Pass()); | 7867 child->AddChild(grand_child.Pass()); |
| 7833 parent->AddChild(child.Pass()); | 7868 parent->AddChild(child.Pass()); |
| 7834 grand_parent->AddChild(parent.Pass()); | 7869 grand_parent->AddChild(parent.Pass()); |
| 7835 | 7870 |
| 7836 SetLayerPropertiesForTesting(grand_parent.get(), | 7871 SetLayerPropertiesForTesting(grand_parent.get(), |
| 7837 identity_matrix, | 7872 identity_matrix, |
| 7838 gfx::Point3F(), | 7873 gfx::Point3F(), |
| 7839 gfx::PointF(), | 7874 gfx::PointF(), |
| 7840 gfx::Size(1, 2), | 7875 gfx::Size(1, 2), |
| 7841 true, | 7876 true, |
| 7842 false); | 7877 false, |
| 7878 true); |
| 7843 SetLayerPropertiesForTesting(parent_raw, | 7879 SetLayerPropertiesForTesting(parent_raw, |
| 7844 identity_matrix, | 7880 identity_matrix, |
| 7845 gfx::Point3F(), | 7881 gfx::Point3F(), |
| 7846 gfx::PointF(), | 7882 gfx::PointF(), |
| 7847 gfx::Size(1, 2), | 7883 gfx::Size(1, 2), |
| 7848 true, | 7884 true, |
| 7885 false, |
| 7849 false); | 7886 false); |
| 7850 SetLayerPropertiesForTesting(child_raw, | 7887 SetLayerPropertiesForTesting(child_raw, |
| 7851 identity_matrix, | 7888 identity_matrix, |
| 7852 gfx::Point3F(), | 7889 gfx::Point3F(), |
| 7853 gfx::PointF(), | 7890 gfx::PointF(), |
| 7854 gfx::Size(1, 2), | 7891 gfx::Size(1, 2), |
| 7855 true, | 7892 true, |
| 7893 false, |
| 7856 false); | 7894 false); |
| 7895 |
| 7857 SetLayerPropertiesForTesting(grand_child_raw, | 7896 SetLayerPropertiesForTesting(grand_child_raw, |
| 7858 identity_matrix, | 7897 identity_matrix, |
| 7859 gfx::Point3F(), | 7898 gfx::Point3F(), |
| 7860 gfx::PointF(), | 7899 gfx::PointF(), |
| 7861 gfx::Size(1, 2), | 7900 gfx::Size(1, 2), |
| 7862 true, | 7901 true, |
| 7902 false, |
| 7863 false); | 7903 false); |
| 7864 | 7904 |
| 7865 ExecuteCalculateDrawProperties(grand_parent.get()); | 7905 ExecuteCalculateDrawProperties(grand_parent.get()); |
| 7866 | 7906 |
| 7867 // No layers have animations. | 7907 // No layers have animations. |
| 7868 EXPECT_EQ(0.f, | 7908 EXPECT_EQ(0.f, |
| 7869 grand_parent->draw_properties().maximum_animation_contents_scale); | 7909 grand_parent->draw_properties().maximum_animation_contents_scale); |
| 7870 EXPECT_EQ(0.f, | 7910 EXPECT_EQ(0.f, |
| 7871 parent_raw->draw_properties().maximum_animation_contents_scale); | 7911 parent_raw->draw_properties().maximum_animation_contents_scale); |
| 7872 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale); | 7912 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale); |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8068 child->AddChild(grand_child2.Pass()); | 8108 child->AddChild(grand_child2.Pass()); |
| 8069 parent->AddChild(child.Pass()); | 8109 parent->AddChild(child.Pass()); |
| 8070 grand_parent->AddChild(parent.Pass()); | 8110 grand_parent->AddChild(parent.Pass()); |
| 8071 | 8111 |
| 8072 SetLayerPropertiesForTesting(grand_parent_raw, | 8112 SetLayerPropertiesForTesting(grand_parent_raw, |
| 8073 identity_matrix, | 8113 identity_matrix, |
| 8074 gfx::Point3F(), | 8114 gfx::Point3F(), |
| 8075 gfx::PointF(), | 8115 gfx::PointF(), |
| 8076 gfx::Size(1, 2), | 8116 gfx::Size(1, 2), |
| 8077 true, | 8117 true, |
| 8078 false); | 8118 false, |
| 8119 true); |
| 8079 SetLayerPropertiesForTesting(parent_raw, | 8120 SetLayerPropertiesForTesting(parent_raw, |
| 8080 identity_matrix, | 8121 identity_matrix, |
| 8081 gfx::Point3F(), | 8122 gfx::Point3F(), |
| 8082 gfx::PointF(), | 8123 gfx::PointF(), |
| 8083 gfx::Size(1, 2), | 8124 gfx::Size(1, 2), |
| 8084 true, | 8125 true, |
| 8126 false, |
| 8085 false); | 8127 false); |
| 8128 |
| 8086 SetLayerPropertiesForTesting(child_raw, | 8129 SetLayerPropertiesForTesting(child_raw, |
| 8087 identity_matrix, | 8130 identity_matrix, |
| 8088 gfx::Point3F(), | 8131 gfx::Point3F(), |
| 8089 gfx::PointF(), | 8132 gfx::PointF(), |
| 8090 gfx::Size(1, 2), | 8133 gfx::Size(1, 2), |
| 8091 true, | 8134 true, |
| 8135 false, |
| 8092 false); | 8136 false); |
| 8137 |
| 8093 SetLayerPropertiesForTesting(grand_child1_raw, | 8138 SetLayerPropertiesForTesting(grand_child1_raw, |
| 8094 identity_matrix, | 8139 identity_matrix, |
| 8095 gfx::Point3F(), | 8140 gfx::Point3F(), |
| 8096 gfx::PointF(), | 8141 gfx::PointF(), |
| 8097 gfx::Size(1, 2), | 8142 gfx::Size(1, 2), |
| 8098 true, | 8143 true, |
| 8144 false, |
| 8099 false); | 8145 false); |
| 8146 |
| 8100 SetLayerPropertiesForTesting(grand_child2_raw, | 8147 SetLayerPropertiesForTesting(grand_child2_raw, |
| 8101 identity_matrix, | 8148 identity_matrix, |
| 8102 gfx::Point3F(), | 8149 gfx::Point3F(), |
| 8103 gfx::PointF(), | 8150 gfx::PointF(), |
| 8104 gfx::Size(1, 2), | 8151 gfx::Size(1, 2), |
| 8105 true, | 8152 true, |
| 8153 false, |
| 8106 false); | 8154 false); |
| 8107 | 8155 |
| 8108 // Start with nothing being drawn. | 8156 // Start with nothing being drawn. |
| 8109 ExecuteCalculateDrawProperties(grand_parent_raw); | 8157 ExecuteCalculateDrawProperties(grand_parent_raw); |
| 8110 int member_id = render_surface_layer_list_count(); | 8158 int member_id = render_surface_layer_list_count(); |
| 8111 | 8159 |
| 8112 EXPECT_NE(member_id, membership_id(grand_parent_raw)); | 8160 EXPECT_NE(member_id, membership_id(grand_parent_raw)); |
| 8113 EXPECT_NE(member_id, membership_id(parent_raw)); | 8161 EXPECT_NE(member_id, membership_id(parent_raw)); |
| 8114 EXPECT_NE(member_id, membership_id(child_raw)); | 8162 EXPECT_NE(member_id, membership_id(child_raw)); |
| 8115 EXPECT_NE(member_id, membership_id(grand_child1_raw)); | 8163 EXPECT_NE(member_id, membership_id(grand_child1_raw)); |
| 8116 EXPECT_NE(member_id, membership_id(grand_child2_raw)); | 8164 EXPECT_NE(member_id, membership_id(grand_child2_raw)); |
| 8117 | 8165 |
| 8118 std::set<LayerImpl*> expected; | 8166 std::set<LayerImpl*> expected; |
| 8119 std::set<LayerImpl*> actual; | 8167 std::set<LayerImpl*> actual; |
| 8120 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); | 8168 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); |
| 8121 EXPECT_EQ(expected, actual); | 8169 EXPECT_EQ(expected, actual); |
| 8122 | 8170 |
| 8123 // If we force render surface, but none of the layers are in the layer list, | 8171 // If we force render surface, but none of the layers are in the layer list, |
| 8124 // then this layer should not appear in RSLL. | 8172 // then this layer should not appear in RSLL. |
| 8125 grand_child1_raw->SetForceRenderSurface(true); | 8173 grand_child1_raw->SetHasRenderSurface(true); |
| 8126 | 8174 |
| 8127 ExecuteCalculateDrawProperties(grand_parent_raw); | 8175 ExecuteCalculateDrawProperties(grand_parent_raw); |
| 8128 member_id = render_surface_layer_list_count(); | 8176 member_id = render_surface_layer_list_count(); |
| 8129 | 8177 |
| 8130 EXPECT_NE(member_id, membership_id(grand_parent_raw)); | 8178 EXPECT_NE(member_id, membership_id(grand_parent_raw)); |
| 8131 EXPECT_NE(member_id, membership_id(parent_raw)); | 8179 EXPECT_NE(member_id, membership_id(parent_raw)); |
| 8132 EXPECT_NE(member_id, membership_id(child_raw)); | 8180 EXPECT_NE(member_id, membership_id(child_raw)); |
| 8133 EXPECT_NE(member_id, membership_id(grand_child1_raw)); | 8181 EXPECT_NE(member_id, membership_id(grand_child1_raw)); |
| 8134 EXPECT_NE(member_id, membership_id(grand_child2_raw)); | 8182 EXPECT_NE(member_id, membership_id(grand_child2_raw)); |
| 8135 | 8183 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 8154 expected.clear(); | 8202 expected.clear(); |
| 8155 expected.insert(grand_child1_raw); | 8203 expected.insert(grand_child1_raw); |
| 8156 | 8204 |
| 8157 actual.clear(); | 8205 actual.clear(); |
| 8158 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); | 8206 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); |
| 8159 EXPECT_EQ(expected, actual); | 8207 EXPECT_EQ(expected, actual); |
| 8160 | 8208 |
| 8161 // Now child is forced to have a render surface, and one if its children draws | 8209 // Now child is forced to have a render surface, and one if its children draws |
| 8162 // content. | 8210 // content. |
| 8163 grand_child1_raw->SetDrawsContent(false); | 8211 grand_child1_raw->SetDrawsContent(false); |
| 8164 grand_child1_raw->SetForceRenderSurface(false); | 8212 grand_child1_raw->SetHasRenderSurface(false); |
| 8165 child_raw->SetForceRenderSurface(true); | 8213 child_raw->SetHasRenderSurface(true); |
| 8166 grand_child2_raw->SetDrawsContent(true); | 8214 grand_child2_raw->SetDrawsContent(true); |
| 8167 | 8215 |
| 8168 ExecuteCalculateDrawProperties(grand_parent_raw); | 8216 ExecuteCalculateDrawProperties(grand_parent_raw); |
| 8169 member_id = render_surface_layer_list_count(); | 8217 member_id = render_surface_layer_list_count(); |
| 8170 | 8218 |
| 8171 EXPECT_NE(member_id, membership_id(grand_parent_raw)); | 8219 EXPECT_NE(member_id, membership_id(grand_parent_raw)); |
| 8172 EXPECT_NE(member_id, membership_id(parent_raw)); | 8220 EXPECT_NE(member_id, membership_id(parent_raw)); |
| 8173 EXPECT_NE(member_id, membership_id(child_raw)); | 8221 EXPECT_NE(member_id, membership_id(child_raw)); |
| 8174 EXPECT_NE(member_id, membership_id(grand_child1_raw)); | 8222 EXPECT_NE(member_id, membership_id(grand_child1_raw)); |
| 8175 EXPECT_EQ(member_id, membership_id(grand_child2_raw)); | 8223 EXPECT_EQ(member_id, membership_id(grand_child2_raw)); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8322 scale_transform_child2; | 8370 scale_transform_child2; |
| 8323 scale_transform_child1.Scale(2, 3); | 8371 scale_transform_child1.Scale(2, 3); |
| 8324 scale_transform_child2.Scale(4, 5); | 8372 scale_transform_child2.Scale(4, 5); |
| 8325 | 8373 |
| 8326 SetLayerPropertiesForTesting(root_layer, | 8374 SetLayerPropertiesForTesting(root_layer, |
| 8327 identity_matrix, | 8375 identity_matrix, |
| 8328 gfx::Point3F(), | 8376 gfx::Point3F(), |
| 8329 gfx::PointF(), | 8377 gfx::PointF(), |
| 8330 gfx::Size(1, 1), | 8378 gfx::Size(1, 1), |
| 8331 true, | 8379 true, |
| 8332 false); | 8380 false, |
| 8381 true); |
| 8333 SetLayerPropertiesForTesting(child1_layer, | 8382 SetLayerPropertiesForTesting(child1_layer, |
| 8334 scale_transform_child1, | 8383 scale_transform_child1, |
| 8335 gfx::Point3F(), | 8384 gfx::Point3F(), |
| 8336 gfx::PointF(), | 8385 gfx::PointF(), |
| 8337 gfx::Size(), | 8386 gfx::Size(), |
| 8338 true, | 8387 true, |
| 8388 false, |
| 8339 false); | 8389 false); |
| 8340 | 8390 |
| 8341 child1_layer->SetMaskLayer( | 8391 child1_layer->SetMaskLayer( |
| 8342 LayerImpl::Create(host_impl.active_tree(), 4).Pass()); | 8392 LayerImpl::Create(host_impl.active_tree(), 4).Pass()); |
| 8343 | 8393 |
| 8344 scoped_ptr<LayerImpl> replica_layer = | 8394 scoped_ptr<LayerImpl> replica_layer = |
| 8345 LayerImpl::Create(host_impl.active_tree(), 5); | 8395 LayerImpl::Create(host_impl.active_tree(), 5); |
| 8346 replica_layer->SetMaskLayer(LayerImpl::Create(host_impl.active_tree(), 6)); | 8396 replica_layer->SetMaskLayer(LayerImpl::Create(host_impl.active_tree(), 6)); |
| 8347 child1_layer->SetReplicaLayer(replica_layer.Pass()); | 8397 child1_layer->SetReplicaLayer(replica_layer.Pass()); |
| 8348 | 8398 |
| 8349 ExecuteCalculateDrawProperties(root_layer); | 8399 ExecuteCalculateDrawProperties(root_layer); |
| 8350 | 8400 |
| 8351 TransformOperations scale; | 8401 TransformOperations scale; |
| 8352 scale.AppendScale(5.f, 8.f, 3.f); | 8402 scale.AppendScale(5.f, 8.f, 3.f); |
| 8353 | 8403 |
| 8354 AddAnimatedTransformToLayer(child2_layer, 1.0, TransformOperations(), scale); | 8404 AddAnimatedTransformToLayer(child2_layer, 1.0, TransformOperations(), scale); |
| 8355 SetLayerPropertiesForTesting(child2_layer, | 8405 SetLayerPropertiesForTesting(child2_layer, |
| 8356 scale_transform_child2, | 8406 scale_transform_child2, |
| 8357 gfx::Point3F(), | 8407 gfx::Point3F(), |
| 8358 gfx::PointF(), | 8408 gfx::PointF(), |
| 8359 gfx::Size(), | 8409 gfx::Size(), |
| 8360 true, | 8410 true, |
| 8411 false, |
| 8361 false); | 8412 false); |
| 8362 | 8413 |
| 8363 ExecuteCalculateDrawProperties(root_layer); | 8414 ExecuteCalculateDrawProperties(root_layer); |
| 8364 | 8415 |
| 8365 EXPECT_FLOAT_EQ(1.f, root_layer->draw_properties().ideal_contents_scale); | 8416 EXPECT_FLOAT_EQ(1.f, root_layer->draw_properties().ideal_contents_scale); |
| 8366 EXPECT_FLOAT_EQ(3.f, child1_layer->draw_properties().ideal_contents_scale); | 8417 EXPECT_FLOAT_EQ(3.f, child1_layer->draw_properties().ideal_contents_scale); |
| 8367 EXPECT_FLOAT_EQ( | 8418 EXPECT_FLOAT_EQ( |
| 8368 3.f, child1_layer->mask_layer()->draw_properties().ideal_contents_scale); | 8419 3.f, child1_layer->mask_layer()->draw_properties().ideal_contents_scale); |
| 8369 EXPECT_FLOAT_EQ(3.f, | 8420 EXPECT_FLOAT_EQ(3.f, |
| 8370 child1_layer->replica_layer() | 8421 child1_layer->replica_layer() |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8587 // by the viewport. | 8638 // by the viewport. |
| 8588 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), root->visible_content_rect()); | 8639 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), root->visible_content_rect()); |
| 8589 | 8640 |
| 8590 // Layers drawing to a child render surface should still have their visible | 8641 // Layers drawing to a child render surface should still have their visible |
| 8591 // content rect clipped by the viewport. | 8642 // content rect clipped by the viewport. |
| 8592 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), content->visible_content_rect()); | 8643 EXPECT_EQ(gfx::Rect(768 / 2, 582 / 2), content->visible_content_rect()); |
| 8593 } | 8644 } |
| 8594 | 8645 |
| 8595 } // namespace | 8646 } // namespace |
| 8596 } // namespace cc | 8647 } // namespace cc |
| OLD | NEW |