| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 #include "testing/gtest/include/gtest/gtest.h" | 46 #include "testing/gtest/include/gtest/gtest.h" |
| 47 #include "ui/gfx/geometry/quad_f.h" | 47 #include "ui/gfx/geometry/quad_f.h" |
| 48 #include "ui/gfx/geometry/vector2d_conversions.h" | 48 #include "ui/gfx/geometry/vector2d_conversions.h" |
| 49 #include "ui/gfx/transform.h" | 49 #include "ui/gfx/transform.h" |
| 50 | 50 |
| 51 namespace cc { | 51 namespace cc { |
| 52 namespace { | 52 namespace { |
| 53 | 53 |
| 54 class LayerWithForcedDrawsContent : public Layer { | 54 class LayerWithForcedDrawsContent : public Layer { |
| 55 public: | 55 public: |
| 56 explicit LayerWithForcedDrawsContent(const LayerSettings& settings) | 56 LayerWithForcedDrawsContent() {} |
| 57 : Layer(settings) {} | |
| 58 | 57 |
| 59 bool DrawsContent() const override; | 58 bool DrawsContent() const override; |
| 60 | 59 |
| 61 private: | 60 private: |
| 62 ~LayerWithForcedDrawsContent() override {} | 61 ~LayerWithForcedDrawsContent() override {} |
| 63 }; | 62 }; |
| 64 | 63 |
| 65 bool LayerWithForcedDrawsContent::DrawsContent() const { return true; } | 64 bool LayerWithForcedDrawsContent::DrawsContent() const { return true; } |
| 66 | 65 |
| 67 class MockContentLayerClient : public ContentLayerClient { | 66 class MockContentLayerClient : public ContentLayerClient { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 86 | 85 |
| 87 #define EXPECT_IDEAL_SCALE_EQ(expected, layer) \ | 86 #define EXPECT_IDEAL_SCALE_EQ(expected, layer) \ |
| 88 do { \ | 87 do { \ |
| 89 EXPECT_FLOAT_EQ(expected, layer->GetIdealContentsScale()); \ | 88 EXPECT_FLOAT_EQ(expected, layer->GetIdealContentsScale()); \ |
| 90 } while (false) | 89 } while (false) |
| 91 | 90 |
| 92 class LayerTreeSettingsScaleContent : public LayerTreeSettings { | 91 class LayerTreeSettingsScaleContent : public LayerTreeSettings { |
| 93 public: | 92 public: |
| 94 LayerTreeSettingsScaleContent() { | 93 LayerTreeSettingsScaleContent() { |
| 95 layer_transforms_should_scale_layer_contents = true; | 94 layer_transforms_should_scale_layer_contents = true; |
| 96 use_compositor_animation_timelines = true; | |
| 97 } | 95 } |
| 98 }; | 96 }; |
| 99 | 97 |
| 100 class LayerTreeHostCommonScalingTest : public LayerTreeHostCommonTest { | 98 class LayerTreeHostCommonScalingTest : public LayerTreeHostCommonTest { |
| 101 public: | 99 public: |
| 102 LayerTreeHostCommonScalingTest() | 100 LayerTreeHostCommonScalingTest() |
| 103 : LayerTreeHostCommonTest(LayerTreeSettingsScaleContent()) {} | 101 : LayerTreeHostCommonTest(LayerTreeSettingsScaleContent()) {} |
| 104 }; | 102 }; |
| 105 | 103 |
| 106 TEST_F(LayerTreeHostCommonTest, TransformsForNoOpLayer) { | 104 TEST_F(LayerTreeHostCommonTest, TransformsForNoOpLayer) { |
| 107 // Sanity check: For layers positioned at zero, with zero size, | 105 // Sanity check: For layers positioned at zero, with zero size, |
| 108 // and with identity transforms, then the draw transform, | 106 // and with identity transforms, then the draw transform, |
| 109 // screen space transform, and the hierarchy passed on to children | 107 // screen space transform, and the hierarchy passed on to children |
| 110 // layers should also be identity transforms. | 108 // layers should also be identity transforms. |
| 111 | 109 |
| 112 scoped_refptr<Layer> parent = Layer::Create(layer_settings()); | 110 scoped_refptr<Layer> parent = Layer::Create(); |
| 113 scoped_refptr<Layer> child = Layer::Create(layer_settings()); | 111 scoped_refptr<Layer> child = Layer::Create(); |
| 114 scoped_refptr<Layer> grand_child = Layer::Create(layer_settings()); | 112 scoped_refptr<Layer> grand_child = Layer::Create(); |
| 115 parent->AddChild(child); | 113 parent->AddChild(child); |
| 116 child->AddChild(grand_child); | 114 child->AddChild(grand_child); |
| 117 | 115 |
| 118 host()->SetRootLayer(parent); | 116 host()->SetRootLayer(parent); |
| 119 | 117 |
| 120 gfx::Transform identity_matrix; | 118 gfx::Transform identity_matrix; |
| 121 SetLayerPropertiesForTesting(parent.get(), | 119 SetLayerPropertiesForTesting(parent.get(), |
| 122 identity_matrix, | 120 identity_matrix, |
| 123 gfx::Point3F(), | 121 gfx::Point3F(), |
| 124 gfx::PointF(), | 122 gfx::PointF(), |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 parent->layer_tree_impl()->property_trees()->effect_tree; | 201 parent->layer_tree_impl()->property_trees()->effect_tree; |
| 204 EffectNode* node = effect_tree.Node(child->effect_tree_index()); | 202 EffectNode* node = effect_tree.Node(child->effect_tree_index()); |
| 205 const int transform_tree_size = parent->layer_tree_impl() | 203 const int transform_tree_size = parent->layer_tree_impl() |
| 206 ->property_trees() | 204 ->property_trees() |
| 207 ->transform_tree.next_available_id(); | 205 ->transform_tree.next_available_id(); |
| 208 EXPECT_LT(node->data.transform_id, transform_tree_size); | 206 EXPECT_LT(node->data.transform_id, transform_tree_size); |
| 209 } | 207 } |
| 210 | 208 |
| 211 TEST_F(LayerTreeHostCommonTest, TransformsForSingleLayer) { | 209 TEST_F(LayerTreeHostCommonTest, TransformsForSingleLayer) { |
| 212 gfx::Transform identity_matrix; | 210 gfx::Transform identity_matrix; |
| 213 scoped_refptr<Layer> layer = Layer::Create(layer_settings()); | 211 scoped_refptr<Layer> layer = Layer::Create(); |
| 214 | 212 |
| 215 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 213 scoped_refptr<Layer> root = Layer::Create(); |
| 216 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), | 214 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
| 217 gfx::PointF(), gfx::Size(1, 2), true, false); | 215 gfx::PointF(), gfx::Size(1, 2), true, false); |
| 218 root->AddChild(layer); | 216 root->AddChild(layer); |
| 219 | 217 |
| 220 host()->SetRootLayer(root); | 218 host()->SetRootLayer(root); |
| 221 | 219 |
| 222 TransformTree& tree = host()->property_trees()->transform_tree; | 220 TransformTree& tree = host()->property_trees()->transform_tree; |
| 223 | 221 |
| 224 // Case 2: Setting the bounds of the layer should not affect either the draw | 222 // Case 2: Setting the bounds of the layer should not affect either the draw |
| 225 // transform or the screenspace transform. | 223 // transform or the screenspace transform. |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 sub_layer_screen_position.y() * kPageScale * | 394 sub_layer_screen_position.y() * kPageScale * |
| 397 kDeviceScale)); | 395 kDeviceScale)); |
| 398 expected_transform.Scale(kPageScale * kDeviceScale, | 396 expected_transform.Scale(kPageScale * kDeviceScale, |
| 399 kPageScale * kDeviceScale); | 397 kPageScale * kDeviceScale); |
| 400 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform, | 398 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform, |
| 401 sublayer->DrawTransform()); | 399 sublayer->DrawTransform()); |
| 402 } | 400 } |
| 403 | 401 |
| 404 TEST_F(LayerTreeHostCommonTest, TransformsForSimpleHierarchy) { | 402 TEST_F(LayerTreeHostCommonTest, TransformsForSimpleHierarchy) { |
| 405 gfx::Transform identity_matrix; | 403 gfx::Transform identity_matrix; |
| 406 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 404 scoped_refptr<Layer> root = Layer::Create(); |
| 407 scoped_refptr<Layer> parent = Layer::Create(layer_settings()); | 405 scoped_refptr<Layer> parent = Layer::Create(); |
| 408 scoped_refptr<Layer> child = Layer::Create(layer_settings()); | 406 scoped_refptr<Layer> child = Layer::Create(); |
| 409 scoped_refptr<Layer> grand_child = Layer::Create(layer_settings()); | 407 scoped_refptr<Layer> grand_child = Layer::Create(); |
| 410 root->AddChild(parent); | 408 root->AddChild(parent); |
| 411 parent->AddChild(child); | 409 parent->AddChild(child); |
| 412 child->AddChild(grand_child); | 410 child->AddChild(grand_child); |
| 413 | 411 |
| 414 host()->SetRootLayer(root); | 412 host()->SetRootLayer(root); |
| 415 | 413 |
| 416 // One-time setup of root layer | 414 // One-time setup of root layer |
| 417 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), | 415 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
| 418 gfx::PointF(), gfx::Size(1, 2), true, false); | 416 gfx::PointF(), gfx::Size(1, 2), true, false); |
| 419 | 417 |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 999 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_grand_child_screen_space_transform, | 997 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_grand_child_screen_space_transform, |
| 1000 grand_child->ScreenSpaceTransform()); | 998 grand_child->ScreenSpaceTransform()); |
| 1001 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_great_grand_child_draw_transform, | 999 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_great_grand_child_draw_transform, |
| 1002 great_grand_child->DrawTransform()); | 1000 great_grand_child->DrawTransform()); |
| 1003 EXPECT_TRANSFORMATION_MATRIX_EQ( | 1001 EXPECT_TRANSFORMATION_MATRIX_EQ( |
| 1004 expected_great_grand_child_screen_space_transform, | 1002 expected_great_grand_child_screen_space_transform, |
| 1005 great_grand_child->ScreenSpaceTransform()); | 1003 great_grand_child->ScreenSpaceTransform()); |
| 1006 } | 1004 } |
| 1007 | 1005 |
| 1008 TEST_F(LayerTreeHostCommonTest, LayerFullyContainedWithinClipInTargetSpace) { | 1006 TEST_F(LayerTreeHostCommonTest, LayerFullyContainedWithinClipInTargetSpace) { |
| 1009 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 1007 scoped_refptr<Layer> root = Layer::Create(); |
| 1010 scoped_refptr<Layer> child = Layer::Create(layer_settings()); | 1008 scoped_refptr<Layer> child = Layer::Create(); |
| 1011 scoped_refptr<LayerWithForcedDrawsContent> grand_child = | 1009 scoped_refptr<LayerWithForcedDrawsContent> grand_child = |
| 1012 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 1010 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 1013 | 1011 |
| 1014 gfx::Transform child_transform; | 1012 gfx::Transform child_transform; |
| 1015 child_transform.Translate(50.0, 50.0); | 1013 child_transform.Translate(50.0, 50.0); |
| 1016 child_transform.RotateAboutZAxis(30.0); | 1014 child_transform.RotateAboutZAxis(30.0); |
| 1017 | 1015 |
| 1018 gfx::Transform grand_child_transform; | 1016 gfx::Transform grand_child_transform; |
| 1019 grand_child_transform.RotateAboutYAxis(90.0); | 1017 grand_child_transform.RotateAboutYAxis(90.0); |
| 1020 | 1018 |
| 1021 const gfx::Transform identity_matrix; | 1019 const gfx::Transform identity_matrix; |
| 1022 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), | 1020 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
| (...skipping 2035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3058 EXPECT_EQ(gfx::Rect(0, 0, 25, 25), grand_child2->visible_layer_rect()); | 3056 EXPECT_EQ(gfx::Rect(0, 0, 25, 25), grand_child2->visible_layer_rect()); |
| 3059 EXPECT_TRUE(grand_child3->visible_layer_rect().IsEmpty()); | 3057 EXPECT_TRUE(grand_child3->visible_layer_rect().IsEmpty()); |
| 3060 | 3058 |
| 3061 // All grandchild DrawableContentRects should also be clipped by child. | 3059 // All grandchild DrawableContentRects should also be clipped by child. |
| 3062 EXPECT_EQ(gfx::Rect(5, 5, 50, 50), grand_child1->drawable_content_rect()); | 3060 EXPECT_EQ(gfx::Rect(5, 5, 50, 50), grand_child1->drawable_content_rect()); |
| 3063 EXPECT_EQ(gfx::Rect(75, 75, 25, 25), grand_child2->drawable_content_rect()); | 3061 EXPECT_EQ(gfx::Rect(75, 75, 25, 25), grand_child2->drawable_content_rect()); |
| 3064 EXPECT_TRUE(grand_child3->drawable_content_rect().IsEmpty()); | 3062 EXPECT_TRUE(grand_child3->drawable_content_rect().IsEmpty()); |
| 3065 } | 3063 } |
| 3066 | 3064 |
| 3067 TEST_F(LayerTreeHostCommonTest, VisibleContentRectWithClippingAndScaling) { | 3065 TEST_F(LayerTreeHostCommonTest, VisibleContentRectWithClippingAndScaling) { |
| 3068 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 3066 scoped_refptr<Layer> root = Layer::Create(); |
| 3069 scoped_refptr<Layer> child = Layer::Create(layer_settings()); | 3067 scoped_refptr<Layer> child = Layer::Create(); |
| 3070 scoped_refptr<LayerWithForcedDrawsContent> grand_child = | 3068 scoped_refptr<LayerWithForcedDrawsContent> grand_child = |
| 3071 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 3069 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 3072 root->AddChild(child); | 3070 root->AddChild(child); |
| 3073 child->AddChild(grand_child); | 3071 child->AddChild(grand_child); |
| 3074 | 3072 |
| 3075 host()->SetRootLayer(root); | 3073 host()->SetRootLayer(root); |
| 3076 | 3074 |
| 3077 gfx::Transform identity_matrix; | 3075 gfx::Transform identity_matrix; |
| 3078 gfx::Transform child_scale_matrix; | 3076 gfx::Transform child_scale_matrix; |
| 3079 child_scale_matrix.Scale(0.25f, 0.25f); | 3077 child_scale_matrix.Scale(0.25f, 0.25f); |
| 3080 gfx::Transform grand_child_scale_matrix; | 3078 gfx::Transform grand_child_scale_matrix; |
| 3081 grand_child_scale_matrix.Scale(0.246f, 0.246f); | 3079 grand_child_scale_matrix.Scale(0.246f, 0.246f); |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3553 // hence potentially occludes it). | 3551 // hence potentially occludes it). |
| 3554 gfx::Rect layer_bounds = gfx::Rect(grand_child_ptr->bounds()); | 3552 gfx::Rect layer_bounds = gfx::Rect(grand_child_ptr->bounds()); |
| 3555 EXPECT_EQ( | 3553 EXPECT_EQ( |
| 3556 layer_bounds, | 3554 layer_bounds, |
| 3557 grand_child_ptr->draw_properties() | 3555 grand_child_ptr->draw_properties() |
| 3558 .occlusion_in_content_space.GetUnoccludedContentRect(layer_bounds)); | 3556 .occlusion_in_content_space.GetUnoccludedContentRect(layer_bounds)); |
| 3559 } | 3557 } |
| 3560 | 3558 |
| 3561 TEST_F(LayerTreeHostCommonTest, | 3559 TEST_F(LayerTreeHostCommonTest, |
| 3562 SingularTransformDoesNotPreventClearingDrawProperties) { | 3560 SingularTransformDoesNotPreventClearingDrawProperties) { |
| 3563 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 3561 scoped_refptr<Layer> root = Layer::Create(); |
| 3564 scoped_refptr<LayerWithForcedDrawsContent> child = | 3562 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 3565 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 3563 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 3566 root->AddChild(child); | 3564 root->AddChild(child); |
| 3567 | 3565 |
| 3568 host()->SetRootLayer(root); | 3566 host()->SetRootLayer(root); |
| 3569 | 3567 |
| 3570 gfx::Transform identity_matrix; | 3568 gfx::Transform identity_matrix; |
| 3571 gfx::Transform uninvertible_matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); | 3569 gfx::Transform uninvertible_matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); |
| 3572 ASSERT_FALSE(uninvertible_matrix.IsInvertible()); | 3570 ASSERT_FALSE(uninvertible_matrix.IsInvertible()); |
| 3573 | 3571 |
| 3574 SetLayerPropertiesForTesting(root.get(), | 3572 SetLayerPropertiesForTesting(root.get(), |
| 3575 uninvertible_matrix, | 3573 uninvertible_matrix, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 3599 end_transform_operations); | 3597 end_transform_operations); |
| 3600 EXPECT_TRUE(root->TransformIsAnimating()); | 3598 EXPECT_TRUE(root->TransformIsAnimating()); |
| 3601 | 3599 |
| 3602 ExecuteCalculateDrawProperties(root.get()); | 3600 ExecuteCalculateDrawProperties(root.get()); |
| 3603 | 3601 |
| 3604 EXPECT_FALSE(child->sorted_for_recursion()); | 3602 EXPECT_FALSE(child->sorted_for_recursion()); |
| 3605 } | 3603 } |
| 3606 | 3604 |
| 3607 TEST_F(LayerTreeHostCommonTest, | 3605 TEST_F(LayerTreeHostCommonTest, |
| 3608 SingularNonAnimatingTransformDoesNotPreventClearingDrawProperties) { | 3606 SingularNonAnimatingTransformDoesNotPreventClearingDrawProperties) { |
| 3609 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 3607 scoped_refptr<Layer> root = Layer::Create(); |
| 3610 | 3608 |
| 3611 host()->SetRootLayer(root); | 3609 host()->SetRootLayer(root); |
| 3612 | 3610 |
| 3613 gfx::Transform identity_matrix; | 3611 gfx::Transform identity_matrix; |
| 3614 gfx::Transform uninvertible_matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); | 3612 gfx::Transform uninvertible_matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); |
| 3615 ASSERT_FALSE(uninvertible_matrix.IsInvertible()); | 3613 ASSERT_FALSE(uninvertible_matrix.IsInvertible()); |
| 3616 | 3614 |
| 3617 SetLayerPropertiesForTesting(root.get(), | 3615 SetLayerPropertiesForTesting(root.get(), |
| 3618 uninvertible_matrix, | 3616 uninvertible_matrix, |
| 3619 gfx::Point3F(), | 3617 gfx::Point3F(), |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4203 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), child2->visible_layer_rect()); | 4201 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), child2->visible_layer_rect()); |
| 4204 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), child3->visible_layer_rect()); | 4202 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), child3->visible_layer_rect()); |
| 4205 } | 4203 } |
| 4206 | 4204 |
| 4207 TEST_F(LayerTreeHostCommonTest, BackFaceCullingWithoutPreserves3d) { | 4205 TEST_F(LayerTreeHostCommonTest, BackFaceCullingWithoutPreserves3d) { |
| 4208 // Verify the behavior of back-face culling when there are no preserve-3d | 4206 // Verify the behavior of back-face culling when there are no preserve-3d |
| 4209 // layers. Note that 3d transforms still apply in this case, but they are | 4207 // layers. Note that 3d transforms still apply in this case, but they are |
| 4210 // "flattened" to each parent layer according to current W3C spec. | 4208 // "flattened" to each parent layer according to current W3C spec. |
| 4211 | 4209 |
| 4212 const gfx::Transform identity_matrix; | 4210 const gfx::Transform identity_matrix; |
| 4213 scoped_refptr<Layer> parent = Layer::Create(layer_settings()); | 4211 scoped_refptr<Layer> parent = Layer::Create(); |
| 4214 scoped_refptr<LayerWithForcedDrawsContent> front_facing_child = | 4212 scoped_refptr<LayerWithForcedDrawsContent> front_facing_child = |
| 4215 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 4213 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 4216 scoped_refptr<LayerWithForcedDrawsContent> back_facing_child = | 4214 scoped_refptr<LayerWithForcedDrawsContent> back_facing_child = |
| 4217 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 4215 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 4218 scoped_refptr<LayerWithForcedDrawsContent> front_facing_surface = | 4216 scoped_refptr<LayerWithForcedDrawsContent> front_facing_surface = |
| 4219 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 4217 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 4220 scoped_refptr<LayerWithForcedDrawsContent> back_facing_surface = | 4218 scoped_refptr<LayerWithForcedDrawsContent> back_facing_surface = |
| 4221 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 4219 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 4222 scoped_refptr<LayerWithForcedDrawsContent> | 4220 scoped_refptr<LayerWithForcedDrawsContent> |
| 4223 front_facing_child_of_front_facing_surface = | 4221 front_facing_child_of_front_facing_surface = |
| 4224 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 4222 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 4225 scoped_refptr<LayerWithForcedDrawsContent> | 4223 scoped_refptr<LayerWithForcedDrawsContent> |
| 4226 back_facing_child_of_front_facing_surface = | 4224 back_facing_child_of_front_facing_surface = |
| 4227 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 4225 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 4228 scoped_refptr<LayerWithForcedDrawsContent> | 4226 scoped_refptr<LayerWithForcedDrawsContent> |
| 4229 front_facing_child_of_back_facing_surface = | 4227 front_facing_child_of_back_facing_surface = |
| 4230 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 4228 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 4231 scoped_refptr<LayerWithForcedDrawsContent> | 4229 scoped_refptr<LayerWithForcedDrawsContent> |
| 4232 back_facing_child_of_back_facing_surface = | 4230 back_facing_child_of_back_facing_surface = |
| 4233 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 4231 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 4234 | 4232 |
| 4235 parent->AddChild(front_facing_child); | 4233 parent->AddChild(front_facing_child); |
| 4236 parent->AddChild(back_facing_child); | 4234 parent->AddChild(back_facing_child); |
| 4237 parent->AddChild(front_facing_surface); | 4235 parent->AddChild(front_facing_surface); |
| 4238 parent->AddChild(back_facing_surface); | 4236 parent->AddChild(back_facing_surface); |
| 4239 front_facing_surface->AddChild(front_facing_child_of_front_facing_surface); | 4237 front_facing_surface->AddChild(front_facing_child_of_front_facing_surface); |
| 4240 front_facing_surface->AddChild(back_facing_child_of_front_facing_surface); | 4238 front_facing_surface->AddChild(back_facing_child_of_front_facing_surface); |
| 4241 back_facing_surface->AddChild(front_facing_child_of_back_facing_surface); | 4239 back_facing_surface->AddChild(front_facing_child_of_back_facing_surface); |
| 4242 back_facing_surface->AddChild(back_facing_child_of_back_facing_surface); | 4240 back_facing_surface->AddChild(back_facing_child_of_back_facing_surface); |
| 4243 | 4241 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4462 } | 4460 } |
| 4463 | 4461 |
| 4464 TEST_F(LayerTreeHostCommonTest, BackFaceCullingWithAnimatingTransforms) { | 4462 TEST_F(LayerTreeHostCommonTest, BackFaceCullingWithAnimatingTransforms) { |
| 4465 // Verify that layers are appropriately culled when their back face is showing | 4463 // Verify that layers are appropriately culled when their back face is showing |
| 4466 // and they are not double sided, while animations are going on. | 4464 // and they are not double sided, while animations are going on. |
| 4467 // | 4465 // |
| 4468 // Layers that are animating do not get culled on the main thread, as their | 4466 // Layers that are animating do not get culled on the main thread, as their |
| 4469 // transforms should be treated as "unknown" so we can not be sure that their | 4467 // transforms should be treated as "unknown" so we can not be sure that their |
| 4470 // back face is really showing. | 4468 // back face is really showing. |
| 4471 const gfx::Transform identity_matrix; | 4469 const gfx::Transform identity_matrix; |
| 4472 scoped_refptr<Layer> parent = Layer::Create(layer_settings()); | 4470 scoped_refptr<Layer> parent = Layer::Create(); |
| 4473 scoped_refptr<LayerWithForcedDrawsContent> child = | 4471 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 4474 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 4472 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 4475 scoped_refptr<LayerWithForcedDrawsContent> animating_surface = | 4473 scoped_refptr<LayerWithForcedDrawsContent> animating_surface = |
| 4476 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 4474 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 4477 scoped_refptr<LayerWithForcedDrawsContent> child_of_animating_surface = | 4475 scoped_refptr<LayerWithForcedDrawsContent> child_of_animating_surface = |
| 4478 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 4476 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 4479 scoped_refptr<LayerWithForcedDrawsContent> animating_child = | 4477 scoped_refptr<LayerWithForcedDrawsContent> animating_child = |
| 4480 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 4478 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 4481 scoped_refptr<LayerWithForcedDrawsContent> child2 = | 4479 scoped_refptr<LayerWithForcedDrawsContent> child2 = |
| 4482 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 4480 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 4483 | 4481 |
| 4484 parent->AddChild(child); | 4482 parent->AddChild(child); |
| 4485 parent->AddChild(animating_surface); | 4483 parent->AddChild(animating_surface); |
| 4486 animating_surface->AddChild(child_of_animating_surface); | 4484 animating_surface->AddChild(child_of_animating_surface); |
| 4487 parent->AddChild(animating_child); | 4485 parent->AddChild(animating_child); |
| 4488 parent->AddChild(child2); | 4486 parent->AddChild(child2); |
| 4489 | 4487 |
| 4490 host()->SetRootLayer(parent); | 4488 host()->SetRootLayer(parent); |
| 4491 | 4489 |
| 4492 // Nothing is double-sided | 4490 // Nothing is double-sided |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4588 EXPECT_EQ(child_of_animating_surface->visible_layer_rect(), | 4586 EXPECT_EQ(child_of_animating_surface->visible_layer_rect(), |
| 4589 gfx::Rect(child_of_animating_surface->bounds())); | 4587 gfx::Rect(child_of_animating_surface->bounds())); |
| 4590 } | 4588 } |
| 4591 | 4589 |
| 4592 TEST_F(LayerTreeHostCommonTest, | 4590 TEST_F(LayerTreeHostCommonTest, |
| 4593 BackFaceCullingWithPreserves3dForFlatteningSurface) { | 4591 BackFaceCullingWithPreserves3dForFlatteningSurface) { |
| 4594 // Verify the behavior of back-face culling for a render surface that is | 4592 // Verify the behavior of back-face culling for a render surface that is |
| 4595 // created when it flattens its subtree, and its parent has preserves-3d. | 4593 // created when it flattens its subtree, and its parent has preserves-3d. |
| 4596 | 4594 |
| 4597 const gfx::Transform identity_matrix; | 4595 const gfx::Transform identity_matrix; |
| 4598 scoped_refptr<Layer> parent = Layer::Create(layer_settings()); | 4596 scoped_refptr<Layer> parent = Layer::Create(); |
| 4599 scoped_refptr<LayerWithForcedDrawsContent> front_facing_surface = | 4597 scoped_refptr<LayerWithForcedDrawsContent> front_facing_surface = |
| 4600 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 4598 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 4601 scoped_refptr<LayerWithForcedDrawsContent> back_facing_surface = | 4599 scoped_refptr<LayerWithForcedDrawsContent> back_facing_surface = |
| 4602 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 4600 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 4603 scoped_refptr<LayerWithForcedDrawsContent> child1 = | 4601 scoped_refptr<LayerWithForcedDrawsContent> child1 = |
| 4604 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 4602 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 4605 scoped_refptr<LayerWithForcedDrawsContent> child2 = | 4603 scoped_refptr<LayerWithForcedDrawsContent> child2 = |
| 4606 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 4604 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 4607 | 4605 |
| 4608 parent->AddChild(front_facing_surface); | 4606 parent->AddChild(front_facing_surface); |
| 4609 parent->AddChild(back_facing_surface); | 4607 parent->AddChild(back_facing_surface); |
| 4610 front_facing_surface->AddChild(child1); | 4608 front_facing_surface->AddChild(child1); |
| 4611 back_facing_surface->AddChild(child2); | 4609 back_facing_surface->AddChild(child2); |
| 4612 | 4610 |
| 4613 host()->SetRootLayer(parent); | 4611 host()->SetRootLayer(parent); |
| 4614 | 4612 |
| 4615 // RenderSurfaces are not double-sided | 4613 // RenderSurfaces are not double-sided |
| 4616 front_facing_surface->SetDoubleSided(false); | 4614 front_facing_surface->SetDoubleSided(false); |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5094 child->render_surface()->replica_draw_transform()); | 5092 child->render_surface()->replica_draw_transform()); |
| 5095 | 5093 |
| 5096 gfx::Transform expected_replica_screen_space_transform; | 5094 gfx::Transform expected_replica_screen_space_transform; |
| 5097 expected_replica_screen_space_transform.matrix().set(1, 1, -1.0); | 5095 expected_replica_screen_space_transform.matrix().set(1, 1, -1.0); |
| 5098 EXPECT_TRANSFORMATION_MATRIX_EQ( | 5096 EXPECT_TRANSFORMATION_MATRIX_EQ( |
| 5099 expected_replica_screen_space_transform, | 5097 expected_replica_screen_space_transform, |
| 5100 child->render_surface()->replica_screen_space_transform()); | 5098 child->render_surface()->replica_screen_space_transform()); |
| 5101 } | 5099 } |
| 5102 | 5100 |
| 5103 TEST_F(LayerTreeHostCommonTest, SubtreeSearch) { | 5101 TEST_F(LayerTreeHostCommonTest, SubtreeSearch) { |
| 5104 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 5102 scoped_refptr<Layer> root = Layer::Create(); |
| 5105 scoped_refptr<Layer> child = Layer::Create(layer_settings()); | 5103 scoped_refptr<Layer> child = Layer::Create(); |
| 5106 scoped_refptr<Layer> grand_child = Layer::Create(layer_settings()); | 5104 scoped_refptr<Layer> grand_child = Layer::Create(); |
| 5107 scoped_refptr<Layer> mask_layer = Layer::Create(layer_settings()); | 5105 scoped_refptr<Layer> mask_layer = Layer::Create(); |
| 5108 scoped_refptr<Layer> replica_layer = Layer::Create(layer_settings()); | 5106 scoped_refptr<Layer> replica_layer = Layer::Create(); |
| 5109 | 5107 |
| 5110 grand_child->SetReplicaLayer(replica_layer.get()); | 5108 grand_child->SetReplicaLayer(replica_layer.get()); |
| 5111 child->AddChild(grand_child.get()); | 5109 child->AddChild(grand_child.get()); |
| 5112 child->SetMaskLayer(mask_layer.get()); | 5110 child->SetMaskLayer(mask_layer.get()); |
| 5113 root->AddChild(child.get()); | 5111 root->AddChild(child.get()); |
| 5114 | 5112 |
| 5115 host()->SetRootLayer(root); | 5113 host()->SetRootLayer(root); |
| 5116 | 5114 |
| 5117 int nonexistent_id = -1; | 5115 int nonexistent_id = -1; |
| 5118 EXPECT_EQ(root.get(), | 5116 EXPECT_EQ(root.get(), |
| 5119 LayerTreeHostCommon::FindLayerInSubtree(root.get(), root->id())); | 5117 LayerTreeHostCommon::FindLayerInSubtree(root.get(), root->id())); |
| 5120 EXPECT_EQ(child.get(), | 5118 EXPECT_EQ(child.get(), |
| 5121 LayerTreeHostCommon::FindLayerInSubtree(root.get(), child->id())); | 5119 LayerTreeHostCommon::FindLayerInSubtree(root.get(), child->id())); |
| 5122 EXPECT_EQ( | 5120 EXPECT_EQ( |
| 5123 grand_child.get(), | 5121 grand_child.get(), |
| 5124 LayerTreeHostCommon::FindLayerInSubtree(root.get(), grand_child->id())); | 5122 LayerTreeHostCommon::FindLayerInSubtree(root.get(), grand_child->id())); |
| 5125 EXPECT_EQ( | 5123 EXPECT_EQ( |
| 5126 mask_layer.get(), | 5124 mask_layer.get(), |
| 5127 LayerTreeHostCommon::FindLayerInSubtree(root.get(), mask_layer->id())); | 5125 LayerTreeHostCommon::FindLayerInSubtree(root.get(), mask_layer->id())); |
| 5128 EXPECT_EQ( | 5126 EXPECT_EQ( |
| 5129 replica_layer.get(), | 5127 replica_layer.get(), |
| 5130 LayerTreeHostCommon::FindLayerInSubtree(root.get(), replica_layer->id())); | 5128 LayerTreeHostCommon::FindLayerInSubtree(root.get(), replica_layer->id())); |
| 5131 EXPECT_EQ( | 5129 EXPECT_EQ( |
| 5132 0, LayerTreeHostCommon::FindLayerInSubtree(root.get(), nonexistent_id)); | 5130 0, LayerTreeHostCommon::FindLayerInSubtree(root.get(), nonexistent_id)); |
| 5133 } | 5131 } |
| 5134 | 5132 |
| 5135 TEST_F(LayerTreeHostCommonTest, TransparentChildRenderSurfaceCreation) { | 5133 TEST_F(LayerTreeHostCommonTest, TransparentChildRenderSurfaceCreation) { |
| 5136 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 5134 scoped_refptr<Layer> root = Layer::Create(); |
| 5137 scoped_refptr<Layer> child = Layer::Create(layer_settings()); | 5135 scoped_refptr<Layer> child = Layer::Create(); |
| 5138 scoped_refptr<LayerWithForcedDrawsContent> grand_child = | 5136 scoped_refptr<LayerWithForcedDrawsContent> grand_child = |
| 5139 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 5137 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 5140 | 5138 |
| 5141 const gfx::Transform identity_matrix; | 5139 const gfx::Transform identity_matrix; |
| 5142 SetLayerPropertiesForTesting(root.get(), | 5140 SetLayerPropertiesForTesting(root.get(), |
| 5143 identity_matrix, | 5141 identity_matrix, |
| 5144 gfx::Point3F(), | 5142 gfx::Point3F(), |
| 5145 gfx::PointF(), | 5143 gfx::PointF(), |
| 5146 gfx::Size(100, 100), | 5144 gfx::Size(100, 100), |
| 5147 true, | 5145 true, |
| 5148 false); | 5146 false); |
| 5149 SetLayerPropertiesForTesting(child.get(), | 5147 SetLayerPropertiesForTesting(child.get(), |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5250 | 5248 |
| 5251 child_ptr = root->layer_tree_impl()->LayerById(2); | 5249 child_ptr = root->layer_tree_impl()->LayerById(2); |
| 5252 tree = root->layer_tree_impl()->property_trees()->effect_tree; | 5250 tree = root->layer_tree_impl()->property_trees()->effect_tree; |
| 5253 node = tree.Node(child_ptr->effect_tree_index()); | 5251 node = tree.Node(child_ptr->effect_tree_index()); |
| 5254 EXPECT_TRUE(node->data.is_drawn); | 5252 EXPECT_TRUE(node->data.is_drawn); |
| 5255 EXPECT_TRUE(tree.ContributesToDrawnSurface(child_ptr->effect_tree_index())); | 5253 EXPECT_TRUE(tree.ContributesToDrawnSurface(child_ptr->effect_tree_index())); |
| 5256 } | 5254 } |
| 5257 | 5255 |
| 5258 class LayerTreeSettingsForLCDTextTest : public LayerTreeSettings { | 5256 class LayerTreeSettingsForLCDTextTest : public LayerTreeSettings { |
| 5259 public: | 5257 public: |
| 5260 LayerTreeSettingsForLCDTextTest() { | 5258 LayerTreeSettingsForLCDTextTest() {} |
| 5261 use_compositor_animation_timelines = true; | |
| 5262 } | |
| 5263 }; | 5259 }; |
| 5264 | 5260 |
| 5265 using LCDTextTestParam = std::tr1::tuple<bool, bool, bool>; | 5261 using LCDTextTestParam = std::tr1::tuple<bool, bool, bool>; |
| 5266 class LCDTextTest : public LayerTreeHostCommonTestBase, | 5262 class LCDTextTest : public LayerTreeHostCommonTestBase, |
| 5267 public testing::TestWithParam<LCDTextTestParam> { | 5263 public testing::TestWithParam<LCDTextTestParam> { |
| 5268 public: | 5264 public: |
| 5269 LCDTextTest() | 5265 LCDTextTest() |
| 5270 : LayerTreeHostCommonTestBase(LayerTreeSettingsForLCDTextTest()), | 5266 : LayerTreeHostCommonTestBase(LayerTreeSettingsForLCDTextTest()), |
| 5271 host_impl_(LayerTreeSettingsForLCDTextTest(), | 5267 host_impl_(LayerTreeSettingsForLCDTextTest(), |
| 5272 &task_runner_provider_, | 5268 &task_runner_provider_, |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5817 | 5813 |
| 5818 TEST_F(LayerTreeHostCommonTest, VisibleContentRectInsideSurface) { | 5814 TEST_F(LayerTreeHostCommonTest, VisibleContentRectInsideSurface) { |
| 5819 FakeImplTaskRunnerProvider task_runner_provider; | 5815 FakeImplTaskRunnerProvider task_runner_provider; |
| 5820 TestSharedBitmapManager shared_bitmap_manager; | 5816 TestSharedBitmapManager shared_bitmap_manager; |
| 5821 TestTaskGraphRunner task_graph_runner; | 5817 TestTaskGraphRunner task_graph_runner; |
| 5822 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, | 5818 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, |
| 5823 &task_graph_runner); | 5819 &task_graph_runner); |
| 5824 host_impl.CreatePendingTree(); | 5820 host_impl.CreatePendingTree(); |
| 5825 const gfx::Transform identity_matrix; | 5821 const gfx::Transform identity_matrix; |
| 5826 | 5822 |
| 5827 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 5823 scoped_refptr<Layer> root = Layer::Create(); |
| 5828 SetLayerPropertiesForTesting(root.get(), | 5824 SetLayerPropertiesForTesting(root.get(), |
| 5829 identity_matrix, | 5825 identity_matrix, |
| 5830 gfx::Point3F(), | 5826 gfx::Point3F(), |
| 5831 gfx::PointF(), | 5827 gfx::PointF(), |
| 5832 gfx::Size(50, 50), | 5828 gfx::Size(50, 50), |
| 5833 true, | 5829 true, |
| 5834 false); | 5830 false); |
| 5835 root->SetIsDrawable(true); | 5831 root->SetIsDrawable(true); |
| 5836 | 5832 |
| 5837 // The surface is moved slightly outside of the viewport. | 5833 // The surface is moved slightly outside of the viewport. |
| 5838 scoped_refptr<Layer> surface = Layer::Create(layer_settings()); | 5834 scoped_refptr<Layer> surface = Layer::Create(); |
| 5839 SetLayerPropertiesForTesting(surface.get(), | 5835 SetLayerPropertiesForTesting(surface.get(), |
| 5840 identity_matrix, | 5836 identity_matrix, |
| 5841 gfx::Point3F(), | 5837 gfx::Point3F(), |
| 5842 gfx::PointF(-10, -20), | 5838 gfx::PointF(-10, -20), |
| 5843 gfx::Size(), | 5839 gfx::Size(), |
| 5844 true, | 5840 true, |
| 5845 false); | 5841 false); |
| 5846 surface->SetForceRenderSurface(true); | 5842 surface->SetForceRenderSurface(true); |
| 5847 | 5843 |
| 5848 scoped_refptr<Layer> surface_child = Layer::Create(layer_settings()); | 5844 scoped_refptr<Layer> surface_child = Layer::Create(); |
| 5849 SetLayerPropertiesForTesting(surface_child.get(), | 5845 SetLayerPropertiesForTesting(surface_child.get(), |
| 5850 identity_matrix, | 5846 identity_matrix, |
| 5851 gfx::Point3F(), | 5847 gfx::Point3F(), |
| 5852 gfx::PointF(), | 5848 gfx::PointF(), |
| 5853 gfx::Size(50, 50), | 5849 gfx::Size(50, 50), |
| 5854 true, | 5850 true, |
| 5855 false); | 5851 false); |
| 5856 surface_child->SetIsDrawable(true); | 5852 surface_child->SetIsDrawable(true); |
| 5857 | 5853 |
| 5858 surface->AddChild(surface_child); | 5854 surface->AddChild(surface_child); |
| (...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6978 // Ensures that when we have a render surface between a fixed position layer | 6974 // Ensures that when we have a render surface between a fixed position layer |
| 6979 // and its container, we compute the fixed position layer's draw transform | 6975 // and its container, we compute the fixed position layer's draw transform |
| 6980 // with respect to that intervening render surface, not with respect to its | 6976 // with respect to that intervening render surface, not with respect to its |
| 6981 // container's render target. | 6977 // container's render target. |
| 6982 // | 6978 // |
| 6983 // + root | 6979 // + root |
| 6984 // + render_surface | 6980 // + render_surface |
| 6985 // + fixed | 6981 // + fixed |
| 6986 // + child | 6982 // + child |
| 6987 // | 6983 // |
| 6988 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 6984 scoped_refptr<Layer> root = Layer::Create(); |
| 6989 scoped_refptr<LayerWithForcedDrawsContent> render_surface = | 6985 scoped_refptr<LayerWithForcedDrawsContent> render_surface = |
| 6990 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 6986 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 6991 scoped_refptr<LayerWithForcedDrawsContent> fixed = | 6987 scoped_refptr<LayerWithForcedDrawsContent> fixed = |
| 6992 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 6988 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 6993 scoped_refptr<LayerWithForcedDrawsContent> child = | 6989 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 6994 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 6990 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 6995 | 6991 |
| 6996 root->AddChild(render_surface); | 6992 root->AddChild(render_surface); |
| 6997 render_surface->AddChild(fixed); | 6993 render_surface->AddChild(fixed); |
| 6998 fixed->AddChild(child); | 6994 fixed->AddChild(child); |
| 6999 | 6995 |
| 7000 root->SetIsContainerForFixedPositionLayers(true); | 6996 root->SetIsContainerForFixedPositionLayers(true); |
| 7001 render_surface->SetForceRenderSurface(true); | 6997 render_surface->SetForceRenderSurface(true); |
| 7002 | 6998 |
| 7003 LayerPositionConstraint constraint; | 6999 LayerPositionConstraint constraint; |
| 7004 constraint.set_is_fixed_position(true); | 7000 constraint.set_is_fixed_position(true); |
| (...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8105 EXPECT_FLOAT_EQ(0.f, | 8101 EXPECT_FLOAT_EQ(0.f, |
| 8106 child1_layer->replica_layer() | 8102 child1_layer->replica_layer() |
| 8107 ->mask_layer() | 8103 ->mask_layer() |
| 8108 ->draw_properties() | 8104 ->draw_properties() |
| 8109 .maximum_animation_contents_scale); | 8105 .maximum_animation_contents_scale); |
| 8110 EXPECT_FLOAT_EQ( | 8106 EXPECT_FLOAT_EQ( |
| 8111 96.f, child2_layer->draw_properties().maximum_animation_contents_scale); | 8107 96.f, child2_layer->draw_properties().maximum_animation_contents_scale); |
| 8112 } | 8108 } |
| 8113 | 8109 |
| 8114 TEST_F(LayerTreeHostCommonTest, VisibleContentRectInChildRenderSurface) { | 8110 TEST_F(LayerTreeHostCommonTest, VisibleContentRectInChildRenderSurface) { |
| 8115 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 8111 scoped_refptr<Layer> root = Layer::Create(); |
| 8116 SetLayerPropertiesForTesting(root.get(), | 8112 SetLayerPropertiesForTesting(root.get(), |
| 8117 gfx::Transform(), | 8113 gfx::Transform(), |
| 8118 gfx::Point3F(), | 8114 gfx::Point3F(), |
| 8119 gfx::PointF(), | 8115 gfx::PointF(), |
| 8120 gfx::Size(768 / 2, 3000), | 8116 gfx::Size(768 / 2, 3000), |
| 8121 true, | 8117 true, |
| 8122 false); | 8118 false); |
| 8123 root->SetIsDrawable(true); | 8119 root->SetIsDrawable(true); |
| 8124 | 8120 |
| 8125 scoped_refptr<Layer> clip = Layer::Create(layer_settings()); | 8121 scoped_refptr<Layer> clip = Layer::Create(); |
| 8126 SetLayerPropertiesForTesting(clip.get(), | 8122 SetLayerPropertiesForTesting(clip.get(), |
| 8127 gfx::Transform(), | 8123 gfx::Transform(), |
| 8128 gfx::Point3F(), | 8124 gfx::Point3F(), |
| 8129 gfx::PointF(), | 8125 gfx::PointF(), |
| 8130 gfx::Size(768 / 2, 10000), | 8126 gfx::Size(768 / 2, 10000), |
| 8131 true, | 8127 true, |
| 8132 false); | 8128 false); |
| 8133 clip->SetMasksToBounds(true); | 8129 clip->SetMasksToBounds(true); |
| 8134 | 8130 |
| 8135 scoped_refptr<Layer> content = Layer::Create(layer_settings()); | 8131 scoped_refptr<Layer> content = Layer::Create(); |
| 8136 SetLayerPropertiesForTesting(content.get(), | 8132 SetLayerPropertiesForTesting(content.get(), |
| 8137 gfx::Transform(), | 8133 gfx::Transform(), |
| 8138 gfx::Point3F(), | 8134 gfx::Point3F(), |
| 8139 gfx::PointF(), | 8135 gfx::PointF(), |
| 8140 gfx::Size(768 / 2, 10000), | 8136 gfx::Size(768 / 2, 10000), |
| 8141 true, | 8137 true, |
| 8142 false); | 8138 false); |
| 8143 content->SetIsDrawable(true); | 8139 content->SetIsDrawable(true); |
| 8144 content->SetForceRenderSurface(true); | 8140 content->SetForceRenderSurface(true); |
| 8145 | 8141 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8223 | 8219 |
| 8224 root->SetBoundsDelta(gfx::Vector2dF(0.0, 50.0)); | 8220 root->SetBoundsDelta(gfx::Vector2dF(0.0, 50.0)); |
| 8225 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 8221 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 8226 | 8222 |
| 8227 gfx::Rect affected_by_delta(0, 0, root_size.width(), | 8223 gfx::Rect affected_by_delta(0, 0, root_size.width(), |
| 8228 root_size.height() + 50); | 8224 root_size.height() + 50); |
| 8229 EXPECT_EQ(affected_by_delta, sublayer->visible_layer_rect()); | 8225 EXPECT_EQ(affected_by_delta, sublayer->visible_layer_rect()); |
| 8230 } | 8226 } |
| 8231 | 8227 |
| 8232 TEST_F(LayerTreeHostCommonTest, NodesAffectedByBoundsDeltaGetUpdated) { | 8228 TEST_F(LayerTreeHostCommonTest, NodesAffectedByBoundsDeltaGetUpdated) { |
| 8233 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 8229 scoped_refptr<Layer> root = Layer::Create(); |
| 8234 scoped_refptr<Layer> inner_viewport_container_layer = | 8230 scoped_refptr<Layer> inner_viewport_container_layer = Layer::Create(); |
| 8235 Layer::Create(layer_settings()); | 8231 scoped_refptr<Layer> inner_viewport_scroll_layer = Layer::Create(); |
| 8236 scoped_refptr<Layer> inner_viewport_scroll_layer = | 8232 scoped_refptr<Layer> outer_viewport_container_layer = Layer::Create(); |
| 8237 Layer::Create(layer_settings()); | 8233 scoped_refptr<Layer> outer_viewport_scroll_layer = Layer::Create(); |
| 8238 scoped_refptr<Layer> outer_viewport_container_layer = | |
| 8239 Layer::Create(layer_settings()); | |
| 8240 scoped_refptr<Layer> outer_viewport_scroll_layer = | |
| 8241 Layer::Create(layer_settings()); | |
| 8242 | 8234 |
| 8243 root->AddChild(inner_viewport_container_layer); | 8235 root->AddChild(inner_viewport_container_layer); |
| 8244 inner_viewport_container_layer->AddChild(inner_viewport_scroll_layer); | 8236 inner_viewport_container_layer->AddChild(inner_viewport_scroll_layer); |
| 8245 inner_viewport_scroll_layer->AddChild(outer_viewport_container_layer); | 8237 inner_viewport_scroll_layer->AddChild(outer_viewport_container_layer); |
| 8246 outer_viewport_container_layer->AddChild(outer_viewport_scroll_layer); | 8238 outer_viewport_container_layer->AddChild(outer_viewport_scroll_layer); |
| 8247 | 8239 |
| 8248 inner_viewport_scroll_layer->SetScrollClipLayerId( | 8240 inner_viewport_scroll_layer->SetScrollClipLayerId( |
| 8249 inner_viewport_container_layer->id()); | 8241 inner_viewport_container_layer->id()); |
| 8250 outer_viewport_scroll_layer->SetScrollClipLayerId( | 8242 outer_viewport_scroll_layer->SetScrollClipLayerId( |
| 8251 outer_viewport_container_layer->id()); | 8243 outer_viewport_container_layer->id()); |
| 8252 | 8244 |
| 8253 inner_viewport_scroll_layer->SetIsContainerForFixedPositionLayers(true); | 8245 inner_viewport_scroll_layer->SetIsContainerForFixedPositionLayers(true); |
| 8254 outer_viewport_scroll_layer->SetIsContainerForFixedPositionLayers(true); | 8246 outer_viewport_scroll_layer->SetIsContainerForFixedPositionLayers(true); |
| 8255 | 8247 |
| 8256 host()->SetRootLayer(root); | 8248 host()->SetRootLayer(root); |
| 8257 host()->RegisterViewportLayers(nullptr, root, inner_viewport_scroll_layer, | 8249 host()->RegisterViewportLayers(nullptr, root, inner_viewport_scroll_layer, |
| 8258 outer_viewport_scroll_layer); | 8250 outer_viewport_scroll_layer); |
| 8259 | 8251 |
| 8260 scoped_refptr<Layer> fixed_to_inner = Layer::Create(layer_settings()); | 8252 scoped_refptr<Layer> fixed_to_inner = Layer::Create(); |
| 8261 scoped_refptr<Layer> fixed_to_outer = Layer::Create(layer_settings()); | 8253 scoped_refptr<Layer> fixed_to_outer = Layer::Create(); |
| 8262 | 8254 |
| 8263 inner_viewport_scroll_layer->AddChild(fixed_to_inner); | 8255 inner_viewport_scroll_layer->AddChild(fixed_to_inner); |
| 8264 outer_viewport_scroll_layer->AddChild(fixed_to_outer); | 8256 outer_viewport_scroll_layer->AddChild(fixed_to_outer); |
| 8265 | 8257 |
| 8266 LayerPositionConstraint fixed_to_right; | 8258 LayerPositionConstraint fixed_to_right; |
| 8267 fixed_to_right.set_is_fixed_position(true); | 8259 fixed_to_right.set_is_fixed_position(true); |
| 8268 fixed_to_right.set_is_fixed_to_right_edge(true); | 8260 fixed_to_right.set_is_fixed_to_right_edge(true); |
| 8269 | 8261 |
| 8270 fixed_to_inner->SetPositionConstraint(fixed_to_right); | 8262 fixed_to_inner->SetPositionConstraint(fixed_to_right); |
| 8271 fixed_to_outer->SetPositionConstraint(fixed_to_right); | 8263 fixed_to_outer->SetPositionConstraint(fixed_to_right); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 8286 | 8278 |
| 8287 fixed_to_outer->SetPositionConstraint(fixed_to_left); | 8279 fixed_to_outer->SetPositionConstraint(fixed_to_left); |
| 8288 | 8280 |
| 8289 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8281 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 8290 EXPECT_FALSE(transform_tree.HasNodesAffectedByInnerViewportBoundsDelta()); | 8282 EXPECT_FALSE(transform_tree.HasNodesAffectedByInnerViewportBoundsDelta()); |
| 8291 EXPECT_FALSE(transform_tree.HasNodesAffectedByOuterViewportBoundsDelta()); | 8283 EXPECT_FALSE(transform_tree.HasNodesAffectedByOuterViewportBoundsDelta()); |
| 8292 } | 8284 } |
| 8293 | 8285 |
| 8294 TEST_F(LayerTreeHostCommonTest, VisibleContentRectForAnimatedLayer) { | 8286 TEST_F(LayerTreeHostCommonTest, VisibleContentRectForAnimatedLayer) { |
| 8295 const gfx::Transform identity_matrix; | 8287 const gfx::Transform identity_matrix; |
| 8296 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 8288 scoped_refptr<Layer> root = Layer::Create(); |
| 8297 scoped_refptr<LayerWithForcedDrawsContent> animated = | 8289 scoped_refptr<LayerWithForcedDrawsContent> animated = |
| 8298 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8290 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8299 | 8291 |
| 8300 root->AddChild(animated); | 8292 root->AddChild(animated); |
| 8301 | 8293 |
| 8302 host()->SetRootLayer(root); | 8294 host()->SetRootLayer(root); |
| 8303 | 8295 |
| 8304 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), | 8296 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
| 8305 gfx::PointF(), gfx::Size(100, 100), true, false); | 8297 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 8306 SetLayerPropertiesForTesting(animated.get(), identity_matrix, gfx::Point3F(), | 8298 SetLayerPropertiesForTesting(animated.get(), identity_matrix, gfx::Point3F(), |
| 8307 gfx::PointF(), gfx::Size(20, 20), true, false); | 8299 gfx::PointF(), gfx::Size(20, 20), true, false); |
| 8308 | 8300 |
| 8309 root->SetMasksToBounds(true); | 8301 root->SetMasksToBounds(true); |
| 8310 root->SetForceRenderSurface(true); | 8302 root->SetForceRenderSurface(true); |
| 8311 animated->SetOpacity(0.f); | 8303 animated->SetOpacity(0.f); |
| 8312 | 8304 |
| 8313 AddOpacityTransitionToLayerWithPlayer(animated->id(), timeline(), 10.0, 0.f, | 8305 AddOpacityTransitionToLayerWithPlayer(animated->id(), timeline(), 10.0, 0.f, |
| 8314 1.f, false); | 8306 1.f, false); |
| 8315 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8307 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 8316 | 8308 |
| 8317 EXPECT_FALSE(animated->visible_layer_rect().IsEmpty()); | 8309 EXPECT_FALSE(animated->visible_layer_rect().IsEmpty()); |
| 8318 } | 8310 } |
| 8319 | 8311 |
| 8320 TEST_F(LayerTreeHostCommonTest, | 8312 TEST_F(LayerTreeHostCommonTest, |
| 8321 VisibleContentRectForAnimatedLayerWithSingularTransform) { | 8313 VisibleContentRectForAnimatedLayerWithSingularTransform) { |
| 8322 const gfx::Transform identity_matrix; | 8314 const gfx::Transform identity_matrix; |
| 8323 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 8315 scoped_refptr<Layer> root = Layer::Create(); |
| 8324 scoped_refptr<Layer> clip = Layer::Create(layer_settings()); | 8316 scoped_refptr<Layer> clip = Layer::Create(); |
| 8325 scoped_refptr<LayerWithForcedDrawsContent> animated = | 8317 scoped_refptr<LayerWithForcedDrawsContent> animated = |
| 8326 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8318 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8327 scoped_refptr<LayerWithForcedDrawsContent> surface = | 8319 scoped_refptr<LayerWithForcedDrawsContent> surface = |
| 8328 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8320 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8329 scoped_refptr<LayerWithForcedDrawsContent> descendant_of_animation = | 8321 scoped_refptr<LayerWithForcedDrawsContent> descendant_of_animation = |
| 8330 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8322 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8331 | 8323 |
| 8332 root->AddChild(clip); | 8324 root->AddChild(clip); |
| 8333 clip->AddChild(animated); | 8325 clip->AddChild(animated); |
| 8334 animated->AddChild(surface); | 8326 animated->AddChild(surface); |
| 8335 surface->AddChild(descendant_of_animation); | 8327 surface->AddChild(descendant_of_animation); |
| 8336 | 8328 |
| 8337 clip->SetMasksToBounds(true); | 8329 clip->SetMasksToBounds(true); |
| 8338 surface->SetForceRenderSurface(true); | 8330 surface->SetForceRenderSurface(true); |
| 8339 | 8331 |
| 8340 host()->SetRootLayer(root); | 8332 host()->SetRootLayer(root); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8387 // This time, flattening does not make |animated|'s transform invertible. This | 8379 // This time, flattening does not make |animated|'s transform invertible. This |
| 8388 // means the clip cannot be projected into |surface|'s space, so we treat | 8380 // means the clip cannot be projected into |surface|'s space, so we treat |
| 8389 // |surface| and layers that draw into it as having empty visible rect. | 8381 // |surface| and layers that draw into it as having empty visible rect. |
| 8390 EXPECT_EQ(gfx::Rect(), surface->visible_layer_rect()); | 8382 EXPECT_EQ(gfx::Rect(), surface->visible_layer_rect()); |
| 8391 EXPECT_EQ(gfx::Rect(), descendant_of_animation->visible_layer_rect()); | 8383 EXPECT_EQ(gfx::Rect(), descendant_of_animation->visible_layer_rect()); |
| 8392 } | 8384 } |
| 8393 | 8385 |
| 8394 // Verify that having an animated filter (but no current filter, as these | 8386 // Verify that having an animated filter (but no current filter, as these |
| 8395 // are mutually exclusive) correctly creates a render surface. | 8387 // are mutually exclusive) correctly creates a render surface. |
| 8396 TEST_F(LayerTreeHostCommonTest, AnimatedFilterCreatesRenderSurface) { | 8388 TEST_F(LayerTreeHostCommonTest, AnimatedFilterCreatesRenderSurface) { |
| 8397 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 8389 scoped_refptr<Layer> root = Layer::Create(); |
| 8398 scoped_refptr<Layer> child = Layer::Create(layer_settings()); | 8390 scoped_refptr<Layer> child = Layer::Create(); |
| 8399 scoped_refptr<Layer> grandchild = Layer::Create(layer_settings()); | 8391 scoped_refptr<Layer> grandchild = Layer::Create(); |
| 8400 root->AddChild(child); | 8392 root->AddChild(child); |
| 8401 child->AddChild(grandchild); | 8393 child->AddChild(grandchild); |
| 8402 | 8394 |
| 8403 gfx::Transform identity_transform; | 8395 gfx::Transform identity_transform; |
| 8404 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), | 8396 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), |
| 8405 gfx::PointF(), gfx::Size(50, 50), true, false); | 8397 gfx::PointF(), gfx::Size(50, 50), true, false); |
| 8406 SetLayerPropertiesForTesting(child.get(), identity_transform, gfx::Point3F(), | 8398 SetLayerPropertiesForTesting(child.get(), identity_transform, gfx::Point3F(), |
| 8407 gfx::PointF(), gfx::Size(50, 50), true, false); | 8399 gfx::PointF(), gfx::Size(50, 50), true, false); |
| 8408 SetLayerPropertiesForTesting(grandchild.get(), identity_transform, | 8400 SetLayerPropertiesForTesting(grandchild.get(), identity_transform, |
| 8409 gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50), | 8401 gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50), |
| (...skipping 12 matching lines...) Expand all Loading... |
| 8422 EXPECT_TRUE(grandchild->filters().IsEmpty()); | 8414 EXPECT_TRUE(grandchild->filters().IsEmpty()); |
| 8423 | 8415 |
| 8424 EXPECT_FALSE(root->FilterIsAnimating()); | 8416 EXPECT_FALSE(root->FilterIsAnimating()); |
| 8425 EXPECT_TRUE(child->FilterIsAnimating()); | 8417 EXPECT_TRUE(child->FilterIsAnimating()); |
| 8426 EXPECT_FALSE(grandchild->FilterIsAnimating()); | 8418 EXPECT_FALSE(grandchild->FilterIsAnimating()); |
| 8427 } | 8419 } |
| 8428 | 8420 |
| 8429 // Verify that having a filter animation with a delayed start time creates a | 8421 // Verify that having a filter animation with a delayed start time creates a |
| 8430 // render surface. | 8422 // render surface. |
| 8431 TEST_F(LayerTreeHostCommonTest, DelayedFilterAnimationCreatesRenderSurface) { | 8423 TEST_F(LayerTreeHostCommonTest, DelayedFilterAnimationCreatesRenderSurface) { |
| 8432 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 8424 scoped_refptr<Layer> root = Layer::Create(); |
| 8433 scoped_refptr<Layer> child = Layer::Create(layer_settings()); | 8425 scoped_refptr<Layer> child = Layer::Create(); |
| 8434 scoped_refptr<Layer> grandchild = Layer::Create(layer_settings()); | 8426 scoped_refptr<Layer> grandchild = Layer::Create(); |
| 8435 root->AddChild(child); | 8427 root->AddChild(child); |
| 8436 child->AddChild(grandchild); | 8428 child->AddChild(grandchild); |
| 8437 | 8429 |
| 8438 gfx::Transform identity_transform; | 8430 gfx::Transform identity_transform; |
| 8439 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), | 8431 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), |
| 8440 gfx::PointF(), gfx::Size(50, 50), true, false); | 8432 gfx::PointF(), gfx::Size(50, 50), true, false); |
| 8441 SetLayerPropertiesForTesting(child.get(), identity_transform, gfx::Point3F(), | 8433 SetLayerPropertiesForTesting(child.get(), identity_transform, gfx::Point3F(), |
| 8442 gfx::PointF(), gfx::Size(50, 50), true, false); | 8434 gfx::PointF(), gfx::Size(50, 50), true, false); |
| 8443 SetLayerPropertiesForTesting(grandchild.get(), identity_transform, | 8435 SetLayerPropertiesForTesting(grandchild.get(), identity_transform, |
| 8444 gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50), | 8436 gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50), |
| (...skipping 30 matching lines...) Expand all Loading... |
| 8475 EXPECT_FALSE(root->HasPotentiallyRunningFilterAnimation()); | 8467 EXPECT_FALSE(root->HasPotentiallyRunningFilterAnimation()); |
| 8476 EXPECT_FALSE(child->FilterIsAnimating()); | 8468 EXPECT_FALSE(child->FilterIsAnimating()); |
| 8477 EXPECT_TRUE(child->HasPotentiallyRunningFilterAnimation()); | 8469 EXPECT_TRUE(child->HasPotentiallyRunningFilterAnimation()); |
| 8478 EXPECT_FALSE(grandchild->FilterIsAnimating()); | 8470 EXPECT_FALSE(grandchild->FilterIsAnimating()); |
| 8479 EXPECT_FALSE(grandchild->HasPotentiallyRunningFilterAnimation()); | 8471 EXPECT_FALSE(grandchild->HasPotentiallyRunningFilterAnimation()); |
| 8480 } | 8472 } |
| 8481 | 8473 |
| 8482 // Ensures that the property tree code accounts for offsets between fixed | 8474 // Ensures that the property tree code accounts for offsets between fixed |
| 8483 // position layers and their respective containers. | 8475 // position layers and their respective containers. |
| 8484 TEST_F(LayerTreeHostCommonTest, PropertyTreesAccountForFixedParentOffset) { | 8476 TEST_F(LayerTreeHostCommonTest, PropertyTreesAccountForFixedParentOffset) { |
| 8485 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 8477 scoped_refptr<Layer> root = Layer::Create(); |
| 8486 scoped_refptr<Layer> child = Layer::Create(layer_settings()); | 8478 scoped_refptr<Layer> child = Layer::Create(); |
| 8487 scoped_refptr<LayerWithForcedDrawsContent> grandchild = | 8479 scoped_refptr<LayerWithForcedDrawsContent> grandchild = |
| 8488 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8480 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8489 | 8481 |
| 8490 root->AddChild(child); | 8482 root->AddChild(child); |
| 8491 child->AddChild(grandchild); | 8483 child->AddChild(grandchild); |
| 8492 | 8484 |
| 8493 gfx::Transform identity_transform; | 8485 gfx::Transform identity_transform; |
| 8494 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), | 8486 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), |
| 8495 gfx::PointF(), gfx::Size(50, 50), true, false); | 8487 gfx::PointF(), gfx::Size(50, 50), true, false); |
| 8496 SetLayerPropertiesForTesting(child.get(), identity_transform, gfx::Point3F(), | 8488 SetLayerPropertiesForTesting(child.get(), identity_transform, gfx::Point3F(), |
| 8497 gfx::PointF(1000, 1000), gfx::Size(50, 50), true, | 8489 gfx::PointF(1000, 1000), gfx::Size(50, 50), true, |
| 8498 false); | 8490 false); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 8514 | 8506 |
| 8515 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), grandchild->visible_layer_rect()); | 8507 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), grandchild->visible_layer_rect()); |
| 8516 } | 8508 } |
| 8517 | 8509 |
| 8518 // Ensures that the property tree code accounts for offsets between fixed | 8510 // Ensures that the property tree code accounts for offsets between fixed |
| 8519 // position containers and their transform tree parents, when a fixed position | 8511 // position containers and their transform tree parents, when a fixed position |
| 8520 // layer's container is its layer tree parent, but this parent doesn't have its | 8512 // layer's container is its layer tree parent, but this parent doesn't have its |
| 8521 // own transform tree node. | 8513 // own transform tree node. |
| 8522 TEST_F(LayerTreeHostCommonTest, | 8514 TEST_F(LayerTreeHostCommonTest, |
| 8523 PropertyTreesAccountForFixedParentOffsetWhenContainerIsParent) { | 8515 PropertyTreesAccountForFixedParentOffsetWhenContainerIsParent) { |
| 8524 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 8516 scoped_refptr<Layer> root = Layer::Create(); |
| 8525 scoped_refptr<Layer> child = Layer::Create(layer_settings()); | 8517 scoped_refptr<Layer> child = Layer::Create(); |
| 8526 scoped_refptr<LayerWithForcedDrawsContent> grandchild = | 8518 scoped_refptr<LayerWithForcedDrawsContent> grandchild = |
| 8527 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8519 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8528 | 8520 |
| 8529 root->AddChild(child); | 8521 root->AddChild(child); |
| 8530 child->AddChild(grandchild); | 8522 child->AddChild(grandchild); |
| 8531 | 8523 |
| 8532 gfx::Transform identity_transform; | 8524 gfx::Transform identity_transform; |
| 8533 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), | 8525 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), |
| 8534 gfx::PointF(), gfx::Size(50, 50), true, false); | 8526 gfx::PointF(), gfx::Size(50, 50), true, false); |
| 8535 SetLayerPropertiesForTesting(child.get(), identity_transform, gfx::Point3F(), | 8527 SetLayerPropertiesForTesting(child.get(), identity_transform, gfx::Point3F(), |
| 8536 gfx::PointF(1000, 1000), gfx::Size(50, 50), true, | 8528 gfx::PointF(1000, 1000), gfx::Size(50, 50), true, |
| 8537 false); | 8529 false); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 8557 TEST_F(LayerTreeHostCommonTest, CombineClipsUsingContentTarget) { | 8549 TEST_F(LayerTreeHostCommonTest, CombineClipsUsingContentTarget) { |
| 8558 // In the following layer tree, the layer |box|'s render target is |surface|. | 8550 // In the following layer tree, the layer |box|'s render target is |surface|. |
| 8559 // |surface| also creates a transform node. We want to combine clips for |box| | 8551 // |surface| also creates a transform node. We want to combine clips for |box| |
| 8560 // in the space of its target (i.e., |surface|), not its target's target. This | 8552 // in the space of its target (i.e., |surface|), not its target's target. This |
| 8561 // test ensures that happens. | 8553 // test ensures that happens. |
| 8562 | 8554 |
| 8563 gfx::Transform rotate; | 8555 gfx::Transform rotate; |
| 8564 rotate.Rotate(5); | 8556 rotate.Rotate(5); |
| 8565 gfx::Transform identity; | 8557 gfx::Transform identity; |
| 8566 | 8558 |
| 8567 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 8559 scoped_refptr<Layer> root = Layer::Create(); |
| 8568 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 8560 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 8569 gfx::PointF(), gfx::Size(2500, 1500), true, | 8561 gfx::PointF(), gfx::Size(2500, 1500), true, |
| 8570 false); | 8562 false); |
| 8571 | 8563 |
| 8572 scoped_refptr<Layer> frame_clip = Layer::Create(layer_settings()); | 8564 scoped_refptr<Layer> frame_clip = Layer::Create(); |
| 8573 SetLayerPropertiesForTesting(frame_clip.get(), identity, gfx::Point3F(), | 8565 SetLayerPropertiesForTesting(frame_clip.get(), identity, gfx::Point3F(), |
| 8574 gfx::PointF(), gfx::Size(2500, 1500), true, | 8566 gfx::PointF(), gfx::Size(2500, 1500), true, |
| 8575 false); | 8567 false); |
| 8576 frame_clip->SetMasksToBounds(true); | 8568 frame_clip->SetMasksToBounds(true); |
| 8577 | 8569 |
| 8578 scoped_refptr<Layer> rotated = Layer::Create(layer_settings()); | 8570 scoped_refptr<Layer> rotated = Layer::Create(); |
| 8579 SetLayerPropertiesForTesting(rotated.get(), rotate, | 8571 SetLayerPropertiesForTesting(rotated.get(), rotate, |
| 8580 gfx::Point3F(1250, 250, 0), gfx::PointF(), | 8572 gfx::Point3F(1250, 250, 0), gfx::PointF(), |
| 8581 gfx::Size(2500, 500), true, false); | 8573 gfx::Size(2500, 500), true, false); |
| 8582 | 8574 |
| 8583 scoped_refptr<Layer> surface = Layer::Create(layer_settings()); | 8575 scoped_refptr<Layer> surface = Layer::Create(); |
| 8584 SetLayerPropertiesForTesting(surface.get(), rotate, gfx::Point3F(), | 8576 SetLayerPropertiesForTesting(surface.get(), rotate, gfx::Point3F(), |
| 8585 gfx::PointF(), gfx::Size(2500, 500), true, | 8577 gfx::PointF(), gfx::Size(2500, 500), true, |
| 8586 false); | 8578 false); |
| 8587 surface->SetOpacity(0.5); | 8579 surface->SetOpacity(0.5); |
| 8588 | 8580 |
| 8589 scoped_refptr<LayerWithForcedDrawsContent> container = | 8581 scoped_refptr<LayerWithForcedDrawsContent> container = |
| 8590 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8582 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8591 SetLayerPropertiesForTesting(container.get(), identity, gfx::Point3F(), | 8583 SetLayerPropertiesForTesting(container.get(), identity, gfx::Point3F(), |
| 8592 gfx::PointF(), gfx::Size(300, 300), true, false); | 8584 gfx::PointF(), gfx::Size(300, 300), true, false); |
| 8593 | 8585 |
| 8594 scoped_refptr<LayerWithForcedDrawsContent> box = | 8586 scoped_refptr<LayerWithForcedDrawsContent> box = |
| 8595 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8587 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8596 SetLayerPropertiesForTesting(box.get(), identity, gfx::Point3F(), | 8588 SetLayerPropertiesForTesting(box.get(), identity, gfx::Point3F(), |
| 8597 gfx::PointF(), gfx::Size(100, 100), true, false); | 8589 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 8598 | 8590 |
| 8599 root->AddChild(frame_clip); | 8591 root->AddChild(frame_clip); |
| 8600 frame_clip->AddChild(rotated); | 8592 frame_clip->AddChild(rotated); |
| 8601 rotated->AddChild(surface); | 8593 rotated->AddChild(surface); |
| 8602 surface->AddChild(container); | 8594 surface->AddChild(container); |
| 8603 surface->AddChild(box); | 8595 surface->AddChild(box); |
| 8604 | 8596 |
| 8605 host()->SetRootLayer(root); | 8597 host()->SetRootLayer(root); |
| 8606 | 8598 |
| 8607 ExecuteCalculateDrawProperties(root.get()); | 8599 ExecuteCalculateDrawProperties(root.get()); |
| 8608 } | 8600 } |
| 8609 | 8601 |
| 8610 TEST_F(LayerTreeHostCommonTest, OnlyApplyFixedPositioningOnce) { | 8602 TEST_F(LayerTreeHostCommonTest, OnlyApplyFixedPositioningOnce) { |
| 8611 gfx::Transform identity; | 8603 gfx::Transform identity; |
| 8612 gfx::Transform translate_z; | 8604 gfx::Transform translate_z; |
| 8613 translate_z.Translate3d(0, 0, 10); | 8605 translate_z.Translate3d(0, 0, 10); |
| 8614 | 8606 |
| 8615 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 8607 scoped_refptr<Layer> root = Layer::Create(); |
| 8616 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 8608 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 8617 gfx::PointF(), gfx::Size(800, 800), true, false); | 8609 gfx::PointF(), gfx::Size(800, 800), true, false); |
| 8618 root->SetIsContainerForFixedPositionLayers(true); | 8610 root->SetIsContainerForFixedPositionLayers(true); |
| 8619 | 8611 |
| 8620 scoped_refptr<Layer> frame_clip = Layer::Create(layer_settings()); | 8612 scoped_refptr<Layer> frame_clip = Layer::Create(); |
| 8621 SetLayerPropertiesForTesting(frame_clip.get(), translate_z, gfx::Point3F(), | 8613 SetLayerPropertiesForTesting(frame_clip.get(), translate_z, gfx::Point3F(), |
| 8622 gfx::PointF(500, 100), gfx::Size(100, 100), true, | 8614 gfx::PointF(500, 100), gfx::Size(100, 100), true, |
| 8623 false); | 8615 false); |
| 8624 frame_clip->SetMasksToBounds(true); | 8616 frame_clip->SetMasksToBounds(true); |
| 8625 | 8617 |
| 8626 scoped_refptr<LayerWithForcedDrawsContent> fixed = | 8618 scoped_refptr<LayerWithForcedDrawsContent> fixed = |
| 8627 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8619 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8628 SetLayerPropertiesForTesting(fixed.get(), identity, gfx::Point3F(), | 8620 SetLayerPropertiesForTesting(fixed.get(), identity, gfx::Point3F(), |
| 8629 gfx::PointF(), gfx::Size(1000, 1000), true, | 8621 gfx::PointF(), gfx::Size(1000, 1000), true, |
| 8630 false); | 8622 false); |
| 8631 | 8623 |
| 8632 LayerPositionConstraint constraint; | 8624 LayerPositionConstraint constraint; |
| 8633 constraint.set_is_fixed_position(true); | 8625 constraint.set_is_fixed_position(true); |
| 8634 fixed->SetPositionConstraint(constraint); | 8626 fixed->SetPositionConstraint(constraint); |
| 8635 | 8627 |
| 8636 root->AddChild(frame_clip); | 8628 root->AddChild(frame_clip); |
| 8637 frame_clip->AddChild(fixed); | 8629 frame_clip->AddChild(fixed); |
| 8638 | 8630 |
| 8639 host()->SetRootLayer(root); | 8631 host()->SetRootLayer(root); |
| 8640 | 8632 |
| 8641 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8633 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 8642 | 8634 |
| 8643 gfx::Rect expected(0, 0, 100, 100); | 8635 gfx::Rect expected(0, 0, 100, 100); |
| 8644 EXPECT_EQ(expected, fixed->visible_layer_rect()); | 8636 EXPECT_EQ(expected, fixed->visible_layer_rect()); |
| 8645 } | 8637 } |
| 8646 | 8638 |
| 8647 TEST_F(LayerTreeHostCommonTest, | 8639 TEST_F(LayerTreeHostCommonTest, |
| 8648 PropertyTreesAccountForScrollCompensationAdjustment) { | 8640 PropertyTreesAccountForScrollCompensationAdjustment) { |
| 8649 gfx::Transform identity; | 8641 gfx::Transform identity; |
| 8650 gfx::Transform translate_z; | 8642 gfx::Transform translate_z; |
| 8651 translate_z.Translate3d(0, 0, 10); | 8643 translate_z.Translate3d(0, 0, 10); |
| 8652 | 8644 |
| 8653 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 8645 scoped_refptr<Layer> root = Layer::Create(); |
| 8654 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 8646 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 8655 gfx::PointF(), gfx::Size(800, 800), true, false); | 8647 gfx::PointF(), gfx::Size(800, 800), true, false); |
| 8656 root->SetIsContainerForFixedPositionLayers(true); | 8648 root->SetIsContainerForFixedPositionLayers(true); |
| 8657 | 8649 |
| 8658 scoped_refptr<Layer> frame_clip = Layer::Create(layer_settings()); | 8650 scoped_refptr<Layer> frame_clip = Layer::Create(); |
| 8659 SetLayerPropertiesForTesting(frame_clip.get(), translate_z, gfx::Point3F(), | 8651 SetLayerPropertiesForTesting(frame_clip.get(), translate_z, gfx::Point3F(), |
| 8660 gfx::PointF(500, 100), gfx::Size(100, 100), true, | 8652 gfx::PointF(500, 100), gfx::Size(100, 100), true, |
| 8661 false); | 8653 false); |
| 8662 frame_clip->SetMasksToBounds(true); | 8654 frame_clip->SetMasksToBounds(true); |
| 8663 | 8655 |
| 8664 scoped_refptr<LayerWithForcedDrawsContent> scroller = | 8656 scoped_refptr<LayerWithForcedDrawsContent> scroller = |
| 8665 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8657 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8666 SetLayerPropertiesForTesting(scroller.get(), identity, gfx::Point3F(), | 8658 SetLayerPropertiesForTesting(scroller.get(), identity, gfx::Point3F(), |
| 8667 gfx::PointF(), gfx::Size(1000, 1000), true, | 8659 gfx::PointF(), gfx::Size(1000, 1000), true, |
| 8668 false); | 8660 false); |
| 8669 | 8661 |
| 8670 scroller->SetScrollCompensationAdjustment(gfx::Vector2dF(0.3f, 0.7f)); | 8662 scroller->SetScrollCompensationAdjustment(gfx::Vector2dF(0.3f, 0.7f)); |
| 8671 scroller->SetScrollOffset(gfx::ScrollOffset(0.3, 0.7)); | 8663 scroller->SetScrollOffset(gfx::ScrollOffset(0.3, 0.7)); |
| 8672 scroller->SetScrollClipLayerId(frame_clip->id()); | 8664 scroller->SetScrollClipLayerId(frame_clip->id()); |
| 8673 | 8665 |
| 8674 scoped_refptr<LayerWithForcedDrawsContent> fixed = | 8666 scoped_refptr<LayerWithForcedDrawsContent> fixed = |
| 8675 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8667 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8676 SetLayerPropertiesForTesting(fixed.get(), identity, gfx::Point3F(), | 8668 SetLayerPropertiesForTesting(fixed.get(), identity, gfx::Point3F(), |
| 8677 gfx::PointF(), gfx::Size(50, 50), true, false); | 8669 gfx::PointF(), gfx::Size(50, 50), true, false); |
| 8678 | 8670 |
| 8679 LayerPositionConstraint constraint; | 8671 LayerPositionConstraint constraint; |
| 8680 constraint.set_is_fixed_position(true); | 8672 constraint.set_is_fixed_position(true); |
| 8681 fixed->SetPositionConstraint(constraint); | 8673 fixed->SetPositionConstraint(constraint); |
| 8682 | 8674 |
| 8683 scoped_refptr<LayerWithForcedDrawsContent> fixed_child = | 8675 scoped_refptr<LayerWithForcedDrawsContent> fixed_child = |
| 8684 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8676 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8685 SetLayerPropertiesForTesting(fixed_child.get(), identity, gfx::Point3F(), | 8677 SetLayerPropertiesForTesting(fixed_child.get(), identity, gfx::Point3F(), |
| 8686 gfx::PointF(), gfx::Size(10, 10), true, false); | 8678 gfx::PointF(), gfx::Size(10, 10), true, false); |
| 8687 | 8679 |
| 8688 fixed_child->SetPositionConstraint(constraint); | 8680 fixed_child->SetPositionConstraint(constraint); |
| 8689 | 8681 |
| 8690 root->AddChild(frame_clip); | 8682 root->AddChild(frame_clip); |
| 8691 frame_clip->AddChild(scroller); | 8683 frame_clip->AddChild(scroller); |
| 8692 scroller->AddChild(fixed); | 8684 scroller->AddChild(fixed); |
| 8693 fixed->AddChild(fixed_child); | 8685 fixed->AddChild(fixed_child); |
| 8694 | 8686 |
| 8695 host()->SetRootLayer(root); | 8687 host()->SetRootLayer(root); |
| 8696 | 8688 |
| 8697 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8689 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 8698 | 8690 |
| 8699 gfx::Rect expected(0, 0, 50, 50); | 8691 gfx::Rect expected(0, 0, 50, 50); |
| 8700 EXPECT_EQ(expected, fixed->visible_layer_rect()); | 8692 EXPECT_EQ(expected, fixed->visible_layer_rect()); |
| 8701 | 8693 |
| 8702 expected = gfx::Rect(0, 0, 10, 10); | 8694 expected = gfx::Rect(0, 0, 10, 10); |
| 8703 EXPECT_EQ(expected, fixed_child->visible_layer_rect()); | 8695 EXPECT_EQ(expected, fixed_child->visible_layer_rect()); |
| 8704 } | 8696 } |
| 8705 | 8697 |
| 8706 TEST_F(LayerTreeHostCommonTest, FixedClipsShouldBeAssociatedWithTheRightNode) { | 8698 TEST_F(LayerTreeHostCommonTest, FixedClipsShouldBeAssociatedWithTheRightNode) { |
| 8707 gfx::Transform identity; | 8699 gfx::Transform identity; |
| 8708 | 8700 |
| 8709 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 8701 scoped_refptr<Layer> root = Layer::Create(); |
| 8710 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 8702 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 8711 gfx::PointF(), gfx::Size(800, 800), true, false); | 8703 gfx::PointF(), gfx::Size(800, 800), true, false); |
| 8712 root->SetIsContainerForFixedPositionLayers(true); | 8704 root->SetIsContainerForFixedPositionLayers(true); |
| 8713 | 8705 |
| 8714 scoped_refptr<Layer> frame_clip = Layer::Create(layer_settings()); | 8706 scoped_refptr<Layer> frame_clip = Layer::Create(); |
| 8715 SetLayerPropertiesForTesting(frame_clip.get(), identity, gfx::Point3F(), | 8707 SetLayerPropertiesForTesting(frame_clip.get(), identity, gfx::Point3F(), |
| 8716 gfx::PointF(500, 100), gfx::Size(100, 100), true, | 8708 gfx::PointF(500, 100), gfx::Size(100, 100), true, |
| 8717 false); | 8709 false); |
| 8718 frame_clip->SetMasksToBounds(true); | 8710 frame_clip->SetMasksToBounds(true); |
| 8719 | 8711 |
| 8720 scoped_refptr<LayerWithForcedDrawsContent> scroller = | 8712 scoped_refptr<LayerWithForcedDrawsContent> scroller = |
| 8721 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8713 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8722 SetLayerPropertiesForTesting(scroller.get(), identity, gfx::Point3F(), | 8714 SetLayerPropertiesForTesting(scroller.get(), identity, gfx::Point3F(), |
| 8723 gfx::PointF(), gfx::Size(1000, 1000), true, | 8715 gfx::PointF(), gfx::Size(1000, 1000), true, |
| 8724 false); | 8716 false); |
| 8725 | 8717 |
| 8726 scroller->SetScrollOffset(gfx::ScrollOffset(100, 100)); | 8718 scroller->SetScrollOffset(gfx::ScrollOffset(100, 100)); |
| 8727 scroller->SetScrollClipLayerId(frame_clip->id()); | 8719 scroller->SetScrollClipLayerId(frame_clip->id()); |
| 8728 | 8720 |
| 8729 scoped_refptr<LayerWithForcedDrawsContent> fixed = | 8721 scoped_refptr<LayerWithForcedDrawsContent> fixed = |
| 8730 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8722 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8731 SetLayerPropertiesForTesting(fixed.get(), identity, gfx::Point3F(), | 8723 SetLayerPropertiesForTesting(fixed.get(), identity, gfx::Point3F(), |
| 8732 gfx::PointF(100, 100), gfx::Size(50, 50), true, | 8724 gfx::PointF(100, 100), gfx::Size(50, 50), true, |
| 8733 false); | 8725 false); |
| 8734 | 8726 |
| 8735 LayerPositionConstraint constraint; | 8727 LayerPositionConstraint constraint; |
| 8736 constraint.set_is_fixed_position(true); | 8728 constraint.set_is_fixed_position(true); |
| 8737 fixed->SetPositionConstraint(constraint); | 8729 fixed->SetPositionConstraint(constraint); |
| 8738 fixed->SetForceRenderSurface(true); | 8730 fixed->SetForceRenderSurface(true); |
| 8739 fixed->SetMasksToBounds(true); | 8731 fixed->SetMasksToBounds(true); |
| 8740 | 8732 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 8751 } | 8743 } |
| 8752 | 8744 |
| 8753 TEST_F(LayerTreeHostCommonTest, ChangingAxisAlignmentTriggersRebuild) { | 8745 TEST_F(LayerTreeHostCommonTest, ChangingAxisAlignmentTriggersRebuild) { |
| 8754 gfx::Transform identity; | 8746 gfx::Transform identity; |
| 8755 gfx::Transform translate; | 8747 gfx::Transform translate; |
| 8756 gfx::Transform rotate; | 8748 gfx::Transform rotate; |
| 8757 | 8749 |
| 8758 translate.Translate(10, 10); | 8750 translate.Translate(10, 10); |
| 8759 rotate.Rotate(45); | 8751 rotate.Rotate(45); |
| 8760 | 8752 |
| 8761 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 8753 scoped_refptr<Layer> root = Layer::Create(); |
| 8762 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 8754 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 8763 gfx::PointF(), gfx::Size(800, 800), true, false); | 8755 gfx::PointF(), gfx::Size(800, 800), true, false); |
| 8764 root->SetIsContainerForFixedPositionLayers(true); | 8756 root->SetIsContainerForFixedPositionLayers(true); |
| 8765 | 8757 |
| 8766 host()->SetRootLayer(root); | 8758 host()->SetRootLayer(root); |
| 8767 | 8759 |
| 8768 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8760 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 8769 EXPECT_FALSE(host()->property_trees()->needs_rebuild); | 8761 EXPECT_FALSE(host()->property_trees()->needs_rebuild); |
| 8770 | 8762 |
| 8771 root->SetTransform(translate); | 8763 root->SetTransform(translate); |
| 8772 EXPECT_FALSE(host()->property_trees()->needs_rebuild); | 8764 EXPECT_FALSE(host()->property_trees()->needs_rebuild); |
| 8773 | 8765 |
| 8774 root->SetTransform(rotate); | 8766 root->SetTransform(rotate); |
| 8775 EXPECT_TRUE(host()->property_trees()->needs_rebuild); | 8767 EXPECT_TRUE(host()->property_trees()->needs_rebuild); |
| 8776 } | 8768 } |
| 8777 | 8769 |
| 8778 TEST_F(LayerTreeHostCommonTest, ChangeTransformOrigin) { | 8770 TEST_F(LayerTreeHostCommonTest, ChangeTransformOrigin) { |
| 8779 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 8771 scoped_refptr<Layer> root = Layer::Create(); |
| 8780 scoped_refptr<LayerWithForcedDrawsContent> child = | 8772 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 8781 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8773 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8782 root->AddChild(child); | 8774 root->AddChild(child); |
| 8783 | 8775 |
| 8784 host()->SetRootLayer(root); | 8776 host()->SetRootLayer(root); |
| 8785 | 8777 |
| 8786 gfx::Transform identity_matrix; | 8778 gfx::Transform identity_matrix; |
| 8787 gfx::Transform scale_matrix; | 8779 gfx::Transform scale_matrix; |
| 8788 scale_matrix.Scale(2.f, 2.f); | 8780 scale_matrix.Scale(2.f, 2.f); |
| 8789 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), | 8781 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
| 8790 gfx::PointF(), gfx::Size(100, 100), true, false); | 8782 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 8791 SetLayerPropertiesForTesting(child.get(), scale_matrix, gfx::Point3F(), | 8783 SetLayerPropertiesForTesting(child.get(), scale_matrix, gfx::Point3F(), |
| 8792 gfx::PointF(), gfx::Size(10, 10), true, false); | 8784 gfx::PointF(), gfx::Size(10, 10), true, false); |
| 8793 | 8785 |
| 8794 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8786 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 8795 EXPECT_EQ(gfx::Rect(10, 10), child->visible_layer_rect()); | 8787 EXPECT_EQ(gfx::Rect(10, 10), child->visible_layer_rect()); |
| 8796 | 8788 |
| 8797 child->SetTransformOrigin(gfx::Point3F(10.f, 10.f, 10.f)); | 8789 child->SetTransformOrigin(gfx::Point3F(10.f, 10.f, 10.f)); |
| 8798 | 8790 |
| 8799 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8791 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 8800 EXPECT_EQ(gfx::Rect(5, 5, 5, 5), child->visible_layer_rect()); | 8792 EXPECT_EQ(gfx::Rect(5, 5, 5, 5), child->visible_layer_rect()); |
| 8801 } | 8793 } |
| 8802 | 8794 |
| 8803 TEST_F(LayerTreeHostCommonTest, UpdateScrollChildPosition) { | 8795 TEST_F(LayerTreeHostCommonTest, UpdateScrollChildPosition) { |
| 8804 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 8796 scoped_refptr<Layer> root = Layer::Create(); |
| 8805 scoped_refptr<LayerWithForcedDrawsContent> scroll_parent = | 8797 scoped_refptr<LayerWithForcedDrawsContent> scroll_parent = |
| 8806 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8798 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8807 scoped_refptr<LayerWithForcedDrawsContent> scroll_child = | 8799 scoped_refptr<LayerWithForcedDrawsContent> scroll_child = |
| 8808 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8800 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8809 | 8801 |
| 8810 root->AddChild(scroll_child); | 8802 root->AddChild(scroll_child); |
| 8811 root->AddChild(scroll_parent); | 8803 root->AddChild(scroll_parent); |
| 8812 scroll_child->SetScrollParent(scroll_parent.get()); | 8804 scroll_child->SetScrollParent(scroll_parent.get()); |
| 8813 scroll_parent->SetScrollClipLayerId(root->id()); | 8805 scroll_parent->SetScrollClipLayerId(root->id()); |
| 8814 | 8806 |
| 8815 host()->SetRootLayer(root); | 8807 host()->SetRootLayer(root); |
| 8816 | 8808 |
| 8817 gfx::Transform identity_transform; | 8809 gfx::Transform identity_transform; |
| 8818 gfx::Transform scale; | 8810 gfx::Transform scale; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 8838 } | 8830 } |
| 8839 | 8831 |
| 8840 TEST_F(LayerTreeHostCommonTest, NumCopyRequestsInTargetSubtree) { | 8832 TEST_F(LayerTreeHostCommonTest, NumCopyRequestsInTargetSubtree) { |
| 8841 // If the layer has a node in effect_tree, the return value of | 8833 // If the layer has a node in effect_tree, the return value of |
| 8842 // num_copy_requests_in_target_subtree() must be equal to the actual number | 8834 // num_copy_requests_in_target_subtree() must be equal to the actual number |
| 8843 // of copy requests in the sub-layer_tree; Otherwise, the number is expected | 8835 // of copy requests in the sub-layer_tree; Otherwise, the number is expected |
| 8844 // to be the value of its nearest ancestor that owns an effect node and | 8836 // to be the value of its nearest ancestor that owns an effect node and |
| 8845 // greater than or equal to the actual number of copy requests in the | 8837 // greater than or equal to the actual number of copy requests in the |
| 8846 // sub-layer_tree. | 8838 // sub-layer_tree. |
| 8847 | 8839 |
| 8848 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 8840 scoped_refptr<Layer> root = Layer::Create(); |
| 8849 scoped_refptr<Layer> child1 = Layer::Create(layer_settings()); | 8841 scoped_refptr<Layer> child1 = Layer::Create(); |
| 8850 scoped_refptr<Layer> child2 = Layer::Create(layer_settings()); | 8842 scoped_refptr<Layer> child2 = Layer::Create(); |
| 8851 scoped_refptr<Layer> grandchild = Layer::Create(layer_settings()); | 8843 scoped_refptr<Layer> grandchild = Layer::Create(); |
| 8852 scoped_refptr<Layer> greatgrandchild = Layer::Create(layer_settings()); | 8844 scoped_refptr<Layer> greatgrandchild = Layer::Create(); |
| 8853 | 8845 |
| 8854 root->AddChild(child1); | 8846 root->AddChild(child1); |
| 8855 root->AddChild(child2); | 8847 root->AddChild(child2); |
| 8856 child1->AddChild(grandchild); | 8848 child1->AddChild(grandchild); |
| 8857 grandchild->AddChild(greatgrandchild); | 8849 grandchild->AddChild(greatgrandchild); |
| 8858 host()->SetRootLayer(root); | 8850 host()->SetRootLayer(root); |
| 8859 | 8851 |
| 8860 child1->RequestCopyOfOutput( | 8852 child1->RequestCopyOfOutput( |
| 8861 CopyOutputRequest::CreateBitmapRequest(base::Bind(&CopyOutputCallback))); | 8853 CopyOutputRequest::CreateBitmapRequest(base::Bind(&CopyOutputCallback))); |
| 8862 greatgrandchild->RequestCopyOfOutput( | 8854 greatgrandchild->RequestCopyOfOutput( |
| 8863 CopyOutputRequest::CreateBitmapRequest(base::Bind(&CopyOutputCallback))); | 8855 CopyOutputRequest::CreateBitmapRequest(base::Bind(&CopyOutputCallback))); |
| 8864 child2->SetOpacity(0.f); | 8856 child2->SetOpacity(0.f); |
| 8865 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8857 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 8866 | 8858 |
| 8867 EXPECT_EQ(root->num_copy_requests_in_target_subtree(), 2); | 8859 EXPECT_EQ(root->num_copy_requests_in_target_subtree(), 2); |
| 8868 EXPECT_EQ(child1->num_copy_requests_in_target_subtree(), 2); | 8860 EXPECT_EQ(child1->num_copy_requests_in_target_subtree(), 2); |
| 8869 EXPECT_EQ(child2->num_copy_requests_in_target_subtree(), 0); | 8861 EXPECT_EQ(child2->num_copy_requests_in_target_subtree(), 0); |
| 8870 EXPECT_EQ(grandchild->num_copy_requests_in_target_subtree(), 2); | 8862 EXPECT_EQ(grandchild->num_copy_requests_in_target_subtree(), 2); |
| 8871 EXPECT_EQ(greatgrandchild->num_copy_requests_in_target_subtree(), 1); | 8863 EXPECT_EQ(greatgrandchild->num_copy_requests_in_target_subtree(), 1); |
| 8872 } | 8864 } |
| 8873 | 8865 |
| 8874 TEST_F(LayerTreeHostCommonTest, SkippingSubtreeMain) { | 8866 TEST_F(LayerTreeHostCommonTest, SkippingSubtreeMain) { |
| 8875 gfx::Transform identity; | 8867 gfx::Transform identity; |
| 8876 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 8868 scoped_refptr<Layer> root = Layer::Create(); |
| 8877 FakeContentLayerClient client; | 8869 FakeContentLayerClient client; |
| 8878 client.set_bounds(root->bounds()); | 8870 client.set_bounds(root->bounds()); |
| 8879 scoped_refptr<LayerWithForcedDrawsContent> child = | 8871 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 8880 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8872 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8881 scoped_refptr<LayerWithForcedDrawsContent> grandchild = | 8873 scoped_refptr<LayerWithForcedDrawsContent> grandchild = |
| 8882 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8874 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8883 scoped_refptr<FakePictureLayer> greatgrandchild( | 8875 scoped_refptr<FakePictureLayer> greatgrandchild( |
| 8884 FakePictureLayer::Create(layer_settings(), &client)); | 8876 FakePictureLayer::Create(&client)); |
| 8885 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 8877 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 8886 gfx::PointF(), gfx::Size(100, 100), true, false); | 8878 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 8887 SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(), | 8879 SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(), |
| 8888 gfx::PointF(), gfx::Size(10, 10), true, false); | 8880 gfx::PointF(), gfx::Size(10, 10), true, false); |
| 8889 SetLayerPropertiesForTesting(grandchild.get(), identity, gfx::Point3F(), | 8881 SetLayerPropertiesForTesting(grandchild.get(), identity, gfx::Point3F(), |
| 8890 gfx::PointF(), gfx::Size(10, 10), true, false); | 8882 gfx::PointF(), gfx::Size(10, 10), true, false); |
| 8891 SetLayerPropertiesForTesting(greatgrandchild.get(), identity, gfx::Point3F(), | 8883 SetLayerPropertiesForTesting(greatgrandchild.get(), identity, gfx::Point3F(), |
| 8892 gfx::PointF(), gfx::Size(10, 10), true, false); | 8884 gfx::PointF(), gfx::Size(10, 10), true, false); |
| 8893 | 8885 |
| 8894 root->AddChild(child); | 8886 root->AddChild(child); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9034 requests.push_back(CopyOutputRequest::CreateEmptyRequest()); | 9026 requests.push_back(CopyOutputRequest::CreateEmptyRequest()); |
| 9035 | 9027 |
| 9036 grandchild_ptr->PassCopyRequests(&requests); | 9028 grandchild_ptr->PassCopyRequests(&requests); |
| 9037 root.get()->layer_tree_impl()->property_trees()->needs_rebuild = true; | 9029 root.get()->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 9038 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 9030 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9039 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); | 9031 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); |
| 9040 } | 9032 } |
| 9041 | 9033 |
| 9042 TEST_F(LayerTreeHostCommonTest, SkippingLayer) { | 9034 TEST_F(LayerTreeHostCommonTest, SkippingLayer) { |
| 9043 gfx::Transform identity; | 9035 gfx::Transform identity; |
| 9044 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 9036 scoped_refptr<Layer> root = Layer::Create(); |
| 9045 FakeContentLayerClient client; | 9037 FakeContentLayerClient client; |
| 9046 client.set_bounds(root->bounds()); | 9038 client.set_bounds(root->bounds()); |
| 9047 scoped_refptr<LayerWithForcedDrawsContent> child = | 9039 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 9048 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 9040 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 9049 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 9041 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 9050 gfx::PointF(), gfx::Size(100, 100), true, false); | 9042 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 9051 SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(), | 9043 SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(), |
| 9052 gfx::PointF(), gfx::Size(10, 10), true, false); | 9044 gfx::PointF(), gfx::Size(10, 10), true, false); |
| 9053 root->AddChild(child); | 9045 root->AddChild(child); |
| 9054 | 9046 |
| 9055 host()->SetRootLayer(root); | 9047 host()->SetRootLayer(root); |
| 9056 | 9048 |
| 9057 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 9049 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9058 EXPECT_EQ(gfx::Rect(10, 10), child->visible_layer_rect()); | 9050 EXPECT_EQ(gfx::Rect(10, 10), child->visible_layer_rect()); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 9078 child->SetTransform(identity); | 9070 child->SetTransform(identity); |
| 9079 | 9071 |
| 9080 child->SetOpacity(0.f); | 9072 child->SetOpacity(0.f); |
| 9081 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 9073 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9082 EXPECT_EQ(gfx::Rect(0, 0), child->visible_layer_rect()); | 9074 EXPECT_EQ(gfx::Rect(0, 0), child->visible_layer_rect()); |
| 9083 } | 9075 } |
| 9084 | 9076 |
| 9085 TEST_F(LayerTreeHostCommonTest, LayerTreeRebuildTest) { | 9077 TEST_F(LayerTreeHostCommonTest, LayerTreeRebuildTest) { |
| 9086 // Ensure that the treewalk in LayerTreeHostCommom:: | 9078 // Ensure that the treewalk in LayerTreeHostCommom:: |
| 9087 // PreCalculateMetaInformation happens when its required. | 9079 // PreCalculateMetaInformation happens when its required. |
| 9088 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 9080 scoped_refptr<Layer> root = Layer::Create(); |
| 9089 scoped_refptr<Layer> parent = Layer::Create(layer_settings()); | 9081 scoped_refptr<Layer> parent = Layer::Create(); |
| 9090 scoped_refptr<Layer> child = Layer::Create(layer_settings()); | 9082 scoped_refptr<Layer> child = Layer::Create(); |
| 9091 | 9083 |
| 9092 root->AddChild(parent); | 9084 root->AddChild(parent); |
| 9093 parent->AddChild(child); | 9085 parent->AddChild(child); |
| 9094 | 9086 |
| 9095 child->SetClipParent(root.get()); | 9087 child->SetClipParent(root.get()); |
| 9096 | 9088 |
| 9097 gfx::Transform identity; | 9089 gfx::Transform identity; |
| 9098 | 9090 |
| 9099 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 9091 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 9100 gfx::PointF(), gfx::Size(100, 100), true, false); | 9092 gfx::PointF(), gfx::Size(100, 100), true, false); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9138 child->SetTouchEventHandlerRegion(gfx::Rect()); | 9130 child->SetTouchEventHandlerRegion(gfx::Rect()); |
| 9139 ExecuteCalculateDrawProperties(root); | 9131 ExecuteCalculateDrawProperties(root); |
| 9140 EXPECT_EQ(root->layer_or_descendant_has_touch_handler(), false); | 9132 EXPECT_EQ(root->layer_or_descendant_has_touch_handler(), false); |
| 9141 } | 9133 } |
| 9142 | 9134 |
| 9143 TEST_F(LayerTreeHostCommonTest, ResetPropertyTreeIndices) { | 9135 TEST_F(LayerTreeHostCommonTest, ResetPropertyTreeIndices) { |
| 9144 gfx::Transform identity; | 9136 gfx::Transform identity; |
| 9145 gfx::Transform translate_z; | 9137 gfx::Transform translate_z; |
| 9146 translate_z.Translate3d(0, 0, 10); | 9138 translate_z.Translate3d(0, 0, 10); |
| 9147 | 9139 |
| 9148 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 9140 scoped_refptr<Layer> root = Layer::Create(); |
| 9149 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 9141 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 9150 gfx::PointF(), gfx::Size(800, 800), true, false); | 9142 gfx::PointF(), gfx::Size(800, 800), true, false); |
| 9151 | 9143 |
| 9152 scoped_refptr<Layer> child = Layer::Create(layer_settings()); | 9144 scoped_refptr<Layer> child = Layer::Create(); |
| 9153 SetLayerPropertiesForTesting(child.get(), translate_z, gfx::Point3F(), | 9145 SetLayerPropertiesForTesting(child.get(), translate_z, gfx::Point3F(), |
| 9154 gfx::PointF(), gfx::Size(100, 100), true, false); | 9146 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 9155 | 9147 |
| 9156 root->AddChild(child); | 9148 root->AddChild(child); |
| 9157 | 9149 |
| 9158 host()->SetRootLayer(root); | 9150 host()->SetRootLayer(root); |
| 9159 | 9151 |
| 9160 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 9152 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9161 EXPECT_NE(-1, child->transform_tree_index()); | 9153 EXPECT_NE(-1, child->transform_tree_index()); |
| 9162 | 9154 |
| 9163 child->RemoveFromParent(); | 9155 child->RemoveFromParent(); |
| 9164 | 9156 |
| 9165 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 9157 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9166 EXPECT_EQ(-1, child->transform_tree_index()); | 9158 EXPECT_EQ(-1, child->transform_tree_index()); |
| 9167 } | 9159 } |
| 9168 | 9160 |
| 9169 TEST_F(LayerTreeHostCommonTest, ResetLayerDrawPropertiestest) { | 9161 TEST_F(LayerTreeHostCommonTest, ResetLayerDrawPropertiestest) { |
| 9170 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 9162 scoped_refptr<Layer> root = Layer::Create(); |
| 9171 scoped_refptr<Layer> child = Layer::Create(layer_settings()); | 9163 scoped_refptr<Layer> child = Layer::Create(); |
| 9172 | 9164 |
| 9173 root->AddChild(child); | 9165 root->AddChild(child); |
| 9174 gfx::Transform identity; | 9166 gfx::Transform identity; |
| 9175 | 9167 |
| 9176 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 9168 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 9177 gfx::PointF(), gfx::Size(100, 100), true, false); | 9169 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 9178 SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(), | 9170 SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(), |
| 9179 gfx::PointF(), gfx::Size(100, 100), true, false); | 9171 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 9180 | 9172 |
| 9181 host()->SetRootLayer(root); | 9173 host()->SetRootLayer(root); |
| (...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9917 // +----node---owner:5, id:6 | 9909 // +----node---owner:5, id:6 |
| 9918 // | 9910 // |
| 9919 // Extra check: | 9911 // Extra check: |
| 9920 // scroll_tree_index() of: | 9912 // scroll_tree_index() of: |
| 9921 // grand_child10:3 | 9913 // grand_child10:3 |
| 9922 // parent3:1 | 9914 // parent3:1 |
| 9923 // child8:4 | 9915 // child8:4 |
| 9924 // parent4:1 | 9916 // parent4:1 |
| 9925 // child9:1 | 9917 // child9:1 |
| 9926 // grand_child12:1 | 9918 // grand_child12:1 |
| 9927 scoped_refptr<Layer> root1 = Layer::Create(layer_settings()); | 9919 scoped_refptr<Layer> root1 = Layer::Create(); |
| 9928 scoped_refptr<Layer> page_scale_layer = Layer::Create(layer_settings()); | 9920 scoped_refptr<Layer> page_scale_layer = Layer::Create(); |
| 9929 scoped_refptr<Layer> parent2 = Layer::Create(layer_settings()); | 9921 scoped_refptr<Layer> parent2 = Layer::Create(); |
| 9930 scoped_refptr<Layer> parent3 = Layer::Create(layer_settings()); | 9922 scoped_refptr<Layer> parent3 = Layer::Create(); |
| 9931 scoped_refptr<Layer> parent4 = Layer::Create(layer_settings()); | 9923 scoped_refptr<Layer> parent4 = Layer::Create(); |
| 9932 scoped_refptr<Layer> parent5 = Layer::Create(layer_settings()); | 9924 scoped_refptr<Layer> parent5 = Layer::Create(); |
| 9933 scoped_refptr<Layer> child6 = Layer::Create(layer_settings()); | 9925 scoped_refptr<Layer> child6 = Layer::Create(); |
| 9934 scoped_refptr<Layer> child7 = Layer::Create(layer_settings()); | 9926 scoped_refptr<Layer> child7 = Layer::Create(); |
| 9935 scoped_refptr<Layer> child8 = Layer::Create(layer_settings()); | 9927 scoped_refptr<Layer> child8 = Layer::Create(); |
| 9936 scoped_refptr<Layer> child9 = Layer::Create(layer_settings()); | 9928 scoped_refptr<Layer> child9 = Layer::Create(); |
| 9937 scoped_refptr<Layer> grand_child10 = Layer::Create(layer_settings()); | 9929 scoped_refptr<Layer> grand_child10 = Layer::Create(); |
| 9938 scoped_refptr<Layer> grand_child11 = Layer::Create(layer_settings()); | 9930 scoped_refptr<Layer> grand_child11 = Layer::Create(); |
| 9939 scoped_refptr<Layer> grand_child12 = Layer::Create(layer_settings()); | 9931 scoped_refptr<Layer> grand_child12 = Layer::Create(); |
| 9940 | 9932 |
| 9941 root1->AddChild(page_scale_layer); | 9933 root1->AddChild(page_scale_layer); |
| 9942 page_scale_layer->AddChild(parent2); | 9934 page_scale_layer->AddChild(parent2); |
| 9943 page_scale_layer->AddChild(parent3); | 9935 page_scale_layer->AddChild(parent3); |
| 9944 page_scale_layer->AddChild(parent4); | 9936 page_scale_layer->AddChild(parent4); |
| 9945 page_scale_layer->AddChild(parent5); | 9937 page_scale_layer->AddChild(parent5); |
| 9946 parent2->AddChild(child6); | 9938 parent2->AddChild(child6); |
| 9947 parent3->AddChild(child7); | 9939 parent3->AddChild(child7); |
| 9948 parent3->AddChild(child8); | 9940 parent3->AddChild(child8); |
| 9949 parent4->AddChild(child9); | 9941 parent4->AddChild(child9); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10077 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); | 10069 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); |
| 10078 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); | 10070 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); |
| 10079 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); | 10071 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); |
| 10080 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); | 10072 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); |
| 10081 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); | 10073 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); |
| 10082 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); | 10074 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); |
| 10083 } | 10075 } |
| 10084 | 10076 |
| 10085 } // namespace | 10077 } // namespace |
| 10086 } // namespace cc | 10078 } // namespace cc |
| OLD | NEW |