| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5248 inputs3.can_adjust_raster_scales = true; | 5246 inputs3.can_adjust_raster_scales = true; |
| 5249 LayerTreeHostCommon::CalculateDrawProperties(&inputs3); | 5247 LayerTreeHostCommon::CalculateDrawProperties(&inputs3); |
| 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 { | |
| 5259 public: | |
| 5260 LayerTreeSettingsForLCDTextTest() { | |
| 5261 use_compositor_animation_timelines = true; | |
| 5262 } | |
| 5263 }; | |
| 5264 | |
| 5265 using LCDTextTestParam = std::tr1::tuple<bool, bool, bool>; | 5256 using LCDTextTestParam = std::tr1::tuple<bool, bool, bool>; |
| 5266 class LCDTextTest : public LayerTreeHostCommonTestBase, | 5257 class LCDTextTest : public LayerTreeHostCommonTestBase, |
| 5267 public testing::TestWithParam<LCDTextTestParam> { | 5258 public testing::TestWithParam<LCDTextTestParam> { |
| 5268 public: | 5259 public: |
| 5269 LCDTextTest() | 5260 LCDTextTest() |
| 5270 : LayerTreeHostCommonTestBase(LayerTreeSettingsForLCDTextTest()), | 5261 : LayerTreeHostCommonTestBase(LayerTreeSettings()), |
| 5271 host_impl_(LayerTreeSettingsForLCDTextTest(), | 5262 host_impl_(&task_runner_provider_, |
| 5272 &task_runner_provider_, | |
| 5273 &shared_bitmap_manager_, | 5263 &shared_bitmap_manager_, |
| 5274 &task_graph_runner_), | 5264 &task_graph_runner_), |
| 5275 root_(nullptr), | 5265 root_(nullptr), |
| 5276 child_(nullptr), | 5266 child_(nullptr), |
| 5277 grand_child_(nullptr) {} | 5267 grand_child_(nullptr) {} |
| 5278 | 5268 |
| 5279 scoped_refptr<AnimationTimeline> timeline() { return timeline_; } | 5269 scoped_refptr<AnimationTimeline> timeline() { return timeline_; } |
| 5280 | 5270 |
| 5281 protected: | 5271 protected: |
| 5282 void SetUp() override { | 5272 void SetUp() override { |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5817 | 5807 |
| 5818 TEST_F(LayerTreeHostCommonTest, VisibleContentRectInsideSurface) { | 5808 TEST_F(LayerTreeHostCommonTest, VisibleContentRectInsideSurface) { |
| 5819 FakeImplTaskRunnerProvider task_runner_provider; | 5809 FakeImplTaskRunnerProvider task_runner_provider; |
| 5820 TestSharedBitmapManager shared_bitmap_manager; | 5810 TestSharedBitmapManager shared_bitmap_manager; |
| 5821 TestTaskGraphRunner task_graph_runner; | 5811 TestTaskGraphRunner task_graph_runner; |
| 5822 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, | 5812 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, |
| 5823 &task_graph_runner); | 5813 &task_graph_runner); |
| 5824 host_impl.CreatePendingTree(); | 5814 host_impl.CreatePendingTree(); |
| 5825 const gfx::Transform identity_matrix; | 5815 const gfx::Transform identity_matrix; |
| 5826 | 5816 |
| 5827 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 5817 scoped_refptr<Layer> root = Layer::Create(); |
| 5828 SetLayerPropertiesForTesting(root.get(), | 5818 SetLayerPropertiesForTesting(root.get(), |
| 5829 identity_matrix, | 5819 identity_matrix, |
| 5830 gfx::Point3F(), | 5820 gfx::Point3F(), |
| 5831 gfx::PointF(), | 5821 gfx::PointF(), |
| 5832 gfx::Size(50, 50), | 5822 gfx::Size(50, 50), |
| 5833 true, | 5823 true, |
| 5834 false); | 5824 false); |
| 5835 root->SetIsDrawable(true); | 5825 root->SetIsDrawable(true); |
| 5836 | 5826 |
| 5837 // The surface is moved slightly outside of the viewport. | 5827 // The surface is moved slightly outside of the viewport. |
| 5838 scoped_refptr<Layer> surface = Layer::Create(layer_settings()); | 5828 scoped_refptr<Layer> surface = Layer::Create(); |
| 5839 SetLayerPropertiesForTesting(surface.get(), | 5829 SetLayerPropertiesForTesting(surface.get(), |
| 5840 identity_matrix, | 5830 identity_matrix, |
| 5841 gfx::Point3F(), | 5831 gfx::Point3F(), |
| 5842 gfx::PointF(-10, -20), | 5832 gfx::PointF(-10, -20), |
| 5843 gfx::Size(), | 5833 gfx::Size(), |
| 5844 true, | 5834 true, |
| 5845 false); | 5835 false); |
| 5846 surface->SetForceRenderSurface(true); | 5836 surface->SetForceRenderSurface(true); |
| 5847 | 5837 |
| 5848 scoped_refptr<Layer> surface_child = Layer::Create(layer_settings()); | 5838 scoped_refptr<Layer> surface_child = Layer::Create(); |
| 5849 SetLayerPropertiesForTesting(surface_child.get(), | 5839 SetLayerPropertiesForTesting(surface_child.get(), |
| 5850 identity_matrix, | 5840 identity_matrix, |
| 5851 gfx::Point3F(), | 5841 gfx::Point3F(), |
| 5852 gfx::PointF(), | 5842 gfx::PointF(), |
| 5853 gfx::Size(50, 50), | 5843 gfx::Size(50, 50), |
| 5854 true, | 5844 true, |
| 5855 false); | 5845 false); |
| 5856 surface_child->SetIsDrawable(true); | 5846 surface_child->SetIsDrawable(true); |
| 5857 | 5847 |
| 5858 surface->AddChild(surface_child); | 5848 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 | 6968 // 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 | 6969 // 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 | 6970 // with respect to that intervening render surface, not with respect to its |
| 6981 // container's render target. | 6971 // container's render target. |
| 6982 // | 6972 // |
| 6983 // + root | 6973 // + root |
| 6984 // + render_surface | 6974 // + render_surface |
| 6985 // + fixed | 6975 // + fixed |
| 6986 // + child | 6976 // + child |
| 6987 // | 6977 // |
| 6988 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 6978 scoped_refptr<Layer> root = Layer::Create(); |
| 6989 scoped_refptr<LayerWithForcedDrawsContent> render_surface = | 6979 scoped_refptr<LayerWithForcedDrawsContent> render_surface = |
| 6990 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 6980 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 6991 scoped_refptr<LayerWithForcedDrawsContent> fixed = | 6981 scoped_refptr<LayerWithForcedDrawsContent> fixed = |
| 6992 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 6982 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 6993 scoped_refptr<LayerWithForcedDrawsContent> child = | 6983 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 6994 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 6984 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 6995 | 6985 |
| 6996 root->AddChild(render_surface); | 6986 root->AddChild(render_surface); |
| 6997 render_surface->AddChild(fixed); | 6987 render_surface->AddChild(fixed); |
| 6998 fixed->AddChild(child); | 6988 fixed->AddChild(child); |
| 6999 | 6989 |
| 7000 root->SetIsContainerForFixedPositionLayers(true); | 6990 root->SetIsContainerForFixedPositionLayers(true); |
| 7001 render_surface->SetForceRenderSurface(true); | 6991 render_surface->SetForceRenderSurface(true); |
| 7002 | 6992 |
| 7003 LayerPositionConstraint constraint; | 6993 LayerPositionConstraint constraint; |
| 7004 constraint.set_is_fixed_position(true); | 6994 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, | 8095 EXPECT_FLOAT_EQ(0.f, |
| 8106 child1_layer->replica_layer() | 8096 child1_layer->replica_layer() |
| 8107 ->mask_layer() | 8097 ->mask_layer() |
| 8108 ->draw_properties() | 8098 ->draw_properties() |
| 8109 .maximum_animation_contents_scale); | 8099 .maximum_animation_contents_scale); |
| 8110 EXPECT_FLOAT_EQ( | 8100 EXPECT_FLOAT_EQ( |
| 8111 96.f, child2_layer->draw_properties().maximum_animation_contents_scale); | 8101 96.f, child2_layer->draw_properties().maximum_animation_contents_scale); |
| 8112 } | 8102 } |
| 8113 | 8103 |
| 8114 TEST_F(LayerTreeHostCommonTest, VisibleContentRectInChildRenderSurface) { | 8104 TEST_F(LayerTreeHostCommonTest, VisibleContentRectInChildRenderSurface) { |
| 8115 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 8105 scoped_refptr<Layer> root = Layer::Create(); |
| 8116 SetLayerPropertiesForTesting(root.get(), | 8106 SetLayerPropertiesForTesting(root.get(), |
| 8117 gfx::Transform(), | 8107 gfx::Transform(), |
| 8118 gfx::Point3F(), | 8108 gfx::Point3F(), |
| 8119 gfx::PointF(), | 8109 gfx::PointF(), |
| 8120 gfx::Size(768 / 2, 3000), | 8110 gfx::Size(768 / 2, 3000), |
| 8121 true, | 8111 true, |
| 8122 false); | 8112 false); |
| 8123 root->SetIsDrawable(true); | 8113 root->SetIsDrawable(true); |
| 8124 | 8114 |
| 8125 scoped_refptr<Layer> clip = Layer::Create(layer_settings()); | 8115 scoped_refptr<Layer> clip = Layer::Create(); |
| 8126 SetLayerPropertiesForTesting(clip.get(), | 8116 SetLayerPropertiesForTesting(clip.get(), |
| 8127 gfx::Transform(), | 8117 gfx::Transform(), |
| 8128 gfx::Point3F(), | 8118 gfx::Point3F(), |
| 8129 gfx::PointF(), | 8119 gfx::PointF(), |
| 8130 gfx::Size(768 / 2, 10000), | 8120 gfx::Size(768 / 2, 10000), |
| 8131 true, | 8121 true, |
| 8132 false); | 8122 false); |
| 8133 clip->SetMasksToBounds(true); | 8123 clip->SetMasksToBounds(true); |
| 8134 | 8124 |
| 8135 scoped_refptr<Layer> content = Layer::Create(layer_settings()); | 8125 scoped_refptr<Layer> content = Layer::Create(); |
| 8136 SetLayerPropertiesForTesting(content.get(), | 8126 SetLayerPropertiesForTesting(content.get(), |
| 8137 gfx::Transform(), | 8127 gfx::Transform(), |
| 8138 gfx::Point3F(), | 8128 gfx::Point3F(), |
| 8139 gfx::PointF(), | 8129 gfx::PointF(), |
| 8140 gfx::Size(768 / 2, 10000), | 8130 gfx::Size(768 / 2, 10000), |
| 8141 true, | 8131 true, |
| 8142 false); | 8132 false); |
| 8143 content->SetIsDrawable(true); | 8133 content->SetIsDrawable(true); |
| 8144 content->SetForceRenderSurface(true); | 8134 content->SetForceRenderSurface(true); |
| 8145 | 8135 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8223 | 8213 |
| 8224 root->SetBoundsDelta(gfx::Vector2dF(0.0, 50.0)); | 8214 root->SetBoundsDelta(gfx::Vector2dF(0.0, 50.0)); |
| 8225 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 8215 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 8226 | 8216 |
| 8227 gfx::Rect affected_by_delta(0, 0, root_size.width(), | 8217 gfx::Rect affected_by_delta(0, 0, root_size.width(), |
| 8228 root_size.height() + 50); | 8218 root_size.height() + 50); |
| 8229 EXPECT_EQ(affected_by_delta, sublayer->visible_layer_rect()); | 8219 EXPECT_EQ(affected_by_delta, sublayer->visible_layer_rect()); |
| 8230 } | 8220 } |
| 8231 | 8221 |
| 8232 TEST_F(LayerTreeHostCommonTest, NodesAffectedByBoundsDeltaGetUpdated) { | 8222 TEST_F(LayerTreeHostCommonTest, NodesAffectedByBoundsDeltaGetUpdated) { |
| 8233 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 8223 scoped_refptr<Layer> root = Layer::Create(); |
| 8234 scoped_refptr<Layer> inner_viewport_container_layer = | 8224 scoped_refptr<Layer> inner_viewport_container_layer = Layer::Create(); |
| 8235 Layer::Create(layer_settings()); | 8225 scoped_refptr<Layer> inner_viewport_scroll_layer = Layer::Create(); |
| 8236 scoped_refptr<Layer> inner_viewport_scroll_layer = | 8226 scoped_refptr<Layer> outer_viewport_container_layer = Layer::Create(); |
| 8237 Layer::Create(layer_settings()); | 8227 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 | 8228 |
| 8243 root->AddChild(inner_viewport_container_layer); | 8229 root->AddChild(inner_viewport_container_layer); |
| 8244 inner_viewport_container_layer->AddChild(inner_viewport_scroll_layer); | 8230 inner_viewport_container_layer->AddChild(inner_viewport_scroll_layer); |
| 8245 inner_viewport_scroll_layer->AddChild(outer_viewport_container_layer); | 8231 inner_viewport_scroll_layer->AddChild(outer_viewport_container_layer); |
| 8246 outer_viewport_container_layer->AddChild(outer_viewport_scroll_layer); | 8232 outer_viewport_container_layer->AddChild(outer_viewport_scroll_layer); |
| 8247 | 8233 |
| 8248 inner_viewport_scroll_layer->SetScrollClipLayerId( | 8234 inner_viewport_scroll_layer->SetScrollClipLayerId( |
| 8249 inner_viewport_container_layer->id()); | 8235 inner_viewport_container_layer->id()); |
| 8250 outer_viewport_scroll_layer->SetScrollClipLayerId( | 8236 outer_viewport_scroll_layer->SetScrollClipLayerId( |
| 8251 outer_viewport_container_layer->id()); | 8237 outer_viewport_container_layer->id()); |
| 8252 | 8238 |
| 8253 inner_viewport_scroll_layer->SetIsContainerForFixedPositionLayers(true); | 8239 inner_viewport_scroll_layer->SetIsContainerForFixedPositionLayers(true); |
| 8254 outer_viewport_scroll_layer->SetIsContainerForFixedPositionLayers(true); | 8240 outer_viewport_scroll_layer->SetIsContainerForFixedPositionLayers(true); |
| 8255 | 8241 |
| 8256 host()->SetRootLayer(root); | 8242 host()->SetRootLayer(root); |
| 8257 host()->RegisterViewportLayers(nullptr, root, inner_viewport_scroll_layer, | 8243 host()->RegisterViewportLayers(nullptr, root, inner_viewport_scroll_layer, |
| 8258 outer_viewport_scroll_layer); | 8244 outer_viewport_scroll_layer); |
| 8259 | 8245 |
| 8260 scoped_refptr<Layer> fixed_to_inner = Layer::Create(layer_settings()); | 8246 scoped_refptr<Layer> fixed_to_inner = Layer::Create(); |
| 8261 scoped_refptr<Layer> fixed_to_outer = Layer::Create(layer_settings()); | 8247 scoped_refptr<Layer> fixed_to_outer = Layer::Create(); |
| 8262 | 8248 |
| 8263 inner_viewport_scroll_layer->AddChild(fixed_to_inner); | 8249 inner_viewport_scroll_layer->AddChild(fixed_to_inner); |
| 8264 outer_viewport_scroll_layer->AddChild(fixed_to_outer); | 8250 outer_viewport_scroll_layer->AddChild(fixed_to_outer); |
| 8265 | 8251 |
| 8266 LayerPositionConstraint fixed_to_right; | 8252 LayerPositionConstraint fixed_to_right; |
| 8267 fixed_to_right.set_is_fixed_position(true); | 8253 fixed_to_right.set_is_fixed_position(true); |
| 8268 fixed_to_right.set_is_fixed_to_right_edge(true); | 8254 fixed_to_right.set_is_fixed_to_right_edge(true); |
| 8269 | 8255 |
| 8270 fixed_to_inner->SetPositionConstraint(fixed_to_right); | 8256 fixed_to_inner->SetPositionConstraint(fixed_to_right); |
| 8271 fixed_to_outer->SetPositionConstraint(fixed_to_right); | 8257 fixed_to_outer->SetPositionConstraint(fixed_to_right); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 8286 | 8272 |
| 8287 fixed_to_outer->SetPositionConstraint(fixed_to_left); | 8273 fixed_to_outer->SetPositionConstraint(fixed_to_left); |
| 8288 | 8274 |
| 8289 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8275 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 8290 EXPECT_FALSE(transform_tree.HasNodesAffectedByInnerViewportBoundsDelta()); | 8276 EXPECT_FALSE(transform_tree.HasNodesAffectedByInnerViewportBoundsDelta()); |
| 8291 EXPECT_FALSE(transform_tree.HasNodesAffectedByOuterViewportBoundsDelta()); | 8277 EXPECT_FALSE(transform_tree.HasNodesAffectedByOuterViewportBoundsDelta()); |
| 8292 } | 8278 } |
| 8293 | 8279 |
| 8294 TEST_F(LayerTreeHostCommonTest, VisibleContentRectForAnimatedLayer) { | 8280 TEST_F(LayerTreeHostCommonTest, VisibleContentRectForAnimatedLayer) { |
| 8295 const gfx::Transform identity_matrix; | 8281 const gfx::Transform identity_matrix; |
| 8296 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 8282 scoped_refptr<Layer> root = Layer::Create(); |
| 8297 scoped_refptr<LayerWithForcedDrawsContent> animated = | 8283 scoped_refptr<LayerWithForcedDrawsContent> animated = |
| 8298 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8284 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8299 | 8285 |
| 8300 root->AddChild(animated); | 8286 root->AddChild(animated); |
| 8301 | 8287 |
| 8302 host()->SetRootLayer(root); | 8288 host()->SetRootLayer(root); |
| 8303 | 8289 |
| 8304 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), | 8290 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
| 8305 gfx::PointF(), gfx::Size(100, 100), true, false); | 8291 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 8306 SetLayerPropertiesForTesting(animated.get(), identity_matrix, gfx::Point3F(), | 8292 SetLayerPropertiesForTesting(animated.get(), identity_matrix, gfx::Point3F(), |
| 8307 gfx::PointF(), gfx::Size(20, 20), true, false); | 8293 gfx::PointF(), gfx::Size(20, 20), true, false); |
| 8308 | 8294 |
| 8309 root->SetMasksToBounds(true); | 8295 root->SetMasksToBounds(true); |
| 8310 root->SetForceRenderSurface(true); | 8296 root->SetForceRenderSurface(true); |
| 8311 animated->SetOpacity(0.f); | 8297 animated->SetOpacity(0.f); |
| 8312 | 8298 |
| 8313 AddOpacityTransitionToLayerWithPlayer(animated->id(), timeline(), 10.0, 0.f, | 8299 AddOpacityTransitionToLayerWithPlayer(animated->id(), timeline(), 10.0, 0.f, |
| 8314 1.f, false); | 8300 1.f, false); |
| 8315 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8301 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 8316 | 8302 |
| 8317 EXPECT_FALSE(animated->visible_layer_rect().IsEmpty()); | 8303 EXPECT_FALSE(animated->visible_layer_rect().IsEmpty()); |
| 8318 } | 8304 } |
| 8319 | 8305 |
| 8320 TEST_F(LayerTreeHostCommonTest, | 8306 TEST_F(LayerTreeHostCommonTest, |
| 8321 VisibleContentRectForAnimatedLayerWithSingularTransform) { | 8307 VisibleContentRectForAnimatedLayerWithSingularTransform) { |
| 8322 const gfx::Transform identity_matrix; | 8308 const gfx::Transform identity_matrix; |
| 8323 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 8309 scoped_refptr<Layer> root = Layer::Create(); |
| 8324 scoped_refptr<Layer> clip = Layer::Create(layer_settings()); | 8310 scoped_refptr<Layer> clip = Layer::Create(); |
| 8325 scoped_refptr<LayerWithForcedDrawsContent> animated = | 8311 scoped_refptr<LayerWithForcedDrawsContent> animated = |
| 8326 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8312 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8327 scoped_refptr<LayerWithForcedDrawsContent> surface = | 8313 scoped_refptr<LayerWithForcedDrawsContent> surface = |
| 8328 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8314 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8329 scoped_refptr<LayerWithForcedDrawsContent> descendant_of_animation = | 8315 scoped_refptr<LayerWithForcedDrawsContent> descendant_of_animation = |
| 8330 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8316 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8331 | 8317 |
| 8332 root->AddChild(clip); | 8318 root->AddChild(clip); |
| 8333 clip->AddChild(animated); | 8319 clip->AddChild(animated); |
| 8334 animated->AddChild(surface); | 8320 animated->AddChild(surface); |
| 8335 surface->AddChild(descendant_of_animation); | 8321 surface->AddChild(descendant_of_animation); |
| 8336 | 8322 |
| 8337 clip->SetMasksToBounds(true); | 8323 clip->SetMasksToBounds(true); |
| 8338 surface->SetForceRenderSurface(true); | 8324 surface->SetForceRenderSurface(true); |
| 8339 | 8325 |
| 8340 host()->SetRootLayer(root); | 8326 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 | 8373 // 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 | 8374 // 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. | 8375 // |surface| and layers that draw into it as having empty visible rect. |
| 8390 EXPECT_EQ(gfx::Rect(), surface->visible_layer_rect()); | 8376 EXPECT_EQ(gfx::Rect(), surface->visible_layer_rect()); |
| 8391 EXPECT_EQ(gfx::Rect(), descendant_of_animation->visible_layer_rect()); | 8377 EXPECT_EQ(gfx::Rect(), descendant_of_animation->visible_layer_rect()); |
| 8392 } | 8378 } |
| 8393 | 8379 |
| 8394 // Verify that having an animated filter (but no current filter, as these | 8380 // Verify that having an animated filter (but no current filter, as these |
| 8395 // are mutually exclusive) correctly creates a render surface. | 8381 // are mutually exclusive) correctly creates a render surface. |
| 8396 TEST_F(LayerTreeHostCommonTest, AnimatedFilterCreatesRenderSurface) { | 8382 TEST_F(LayerTreeHostCommonTest, AnimatedFilterCreatesRenderSurface) { |
| 8397 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 8383 scoped_refptr<Layer> root = Layer::Create(); |
| 8398 scoped_refptr<Layer> child = Layer::Create(layer_settings()); | 8384 scoped_refptr<Layer> child = Layer::Create(); |
| 8399 scoped_refptr<Layer> grandchild = Layer::Create(layer_settings()); | 8385 scoped_refptr<Layer> grandchild = Layer::Create(); |
| 8400 root->AddChild(child); | 8386 root->AddChild(child); |
| 8401 child->AddChild(grandchild); | 8387 child->AddChild(grandchild); |
| 8402 | 8388 |
| 8403 gfx::Transform identity_transform; | 8389 gfx::Transform identity_transform; |
| 8404 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), | 8390 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), |
| 8405 gfx::PointF(), gfx::Size(50, 50), true, false); | 8391 gfx::PointF(), gfx::Size(50, 50), true, false); |
| 8406 SetLayerPropertiesForTesting(child.get(), identity_transform, gfx::Point3F(), | 8392 SetLayerPropertiesForTesting(child.get(), identity_transform, gfx::Point3F(), |
| 8407 gfx::PointF(), gfx::Size(50, 50), true, false); | 8393 gfx::PointF(), gfx::Size(50, 50), true, false); |
| 8408 SetLayerPropertiesForTesting(grandchild.get(), identity_transform, | 8394 SetLayerPropertiesForTesting(grandchild.get(), identity_transform, |
| 8409 gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50), | 8395 gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50), |
| (...skipping 12 matching lines...) Expand all Loading... |
| 8422 EXPECT_TRUE(grandchild->filters().IsEmpty()); | 8408 EXPECT_TRUE(grandchild->filters().IsEmpty()); |
| 8423 | 8409 |
| 8424 EXPECT_FALSE(root->FilterIsAnimating()); | 8410 EXPECT_FALSE(root->FilterIsAnimating()); |
| 8425 EXPECT_TRUE(child->FilterIsAnimating()); | 8411 EXPECT_TRUE(child->FilterIsAnimating()); |
| 8426 EXPECT_FALSE(grandchild->FilterIsAnimating()); | 8412 EXPECT_FALSE(grandchild->FilterIsAnimating()); |
| 8427 } | 8413 } |
| 8428 | 8414 |
| 8429 // Verify that having a filter animation with a delayed start time creates a | 8415 // Verify that having a filter animation with a delayed start time creates a |
| 8430 // render surface. | 8416 // render surface. |
| 8431 TEST_F(LayerTreeHostCommonTest, DelayedFilterAnimationCreatesRenderSurface) { | 8417 TEST_F(LayerTreeHostCommonTest, DelayedFilterAnimationCreatesRenderSurface) { |
| 8432 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 8418 scoped_refptr<Layer> root = Layer::Create(); |
| 8433 scoped_refptr<Layer> child = Layer::Create(layer_settings()); | 8419 scoped_refptr<Layer> child = Layer::Create(); |
| 8434 scoped_refptr<Layer> grandchild = Layer::Create(layer_settings()); | 8420 scoped_refptr<Layer> grandchild = Layer::Create(); |
| 8435 root->AddChild(child); | 8421 root->AddChild(child); |
| 8436 child->AddChild(grandchild); | 8422 child->AddChild(grandchild); |
| 8437 | 8423 |
| 8438 gfx::Transform identity_transform; | 8424 gfx::Transform identity_transform; |
| 8439 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), | 8425 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), |
| 8440 gfx::PointF(), gfx::Size(50, 50), true, false); | 8426 gfx::PointF(), gfx::Size(50, 50), true, false); |
| 8441 SetLayerPropertiesForTesting(child.get(), identity_transform, gfx::Point3F(), | 8427 SetLayerPropertiesForTesting(child.get(), identity_transform, gfx::Point3F(), |
| 8442 gfx::PointF(), gfx::Size(50, 50), true, false); | 8428 gfx::PointF(), gfx::Size(50, 50), true, false); |
| 8443 SetLayerPropertiesForTesting(grandchild.get(), identity_transform, | 8429 SetLayerPropertiesForTesting(grandchild.get(), identity_transform, |
| 8444 gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50), | 8430 gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50), |
| (...skipping 30 matching lines...) Expand all Loading... |
| 8475 EXPECT_FALSE(root->HasPotentiallyRunningFilterAnimation()); | 8461 EXPECT_FALSE(root->HasPotentiallyRunningFilterAnimation()); |
| 8476 EXPECT_FALSE(child->FilterIsAnimating()); | 8462 EXPECT_FALSE(child->FilterIsAnimating()); |
| 8477 EXPECT_TRUE(child->HasPotentiallyRunningFilterAnimation()); | 8463 EXPECT_TRUE(child->HasPotentiallyRunningFilterAnimation()); |
| 8478 EXPECT_FALSE(grandchild->FilterIsAnimating()); | 8464 EXPECT_FALSE(grandchild->FilterIsAnimating()); |
| 8479 EXPECT_FALSE(grandchild->HasPotentiallyRunningFilterAnimation()); | 8465 EXPECT_FALSE(grandchild->HasPotentiallyRunningFilterAnimation()); |
| 8480 } | 8466 } |
| 8481 | 8467 |
| 8482 // Ensures that the property tree code accounts for offsets between fixed | 8468 // Ensures that the property tree code accounts for offsets between fixed |
| 8483 // position layers and their respective containers. | 8469 // position layers and their respective containers. |
| 8484 TEST_F(LayerTreeHostCommonTest, PropertyTreesAccountForFixedParentOffset) { | 8470 TEST_F(LayerTreeHostCommonTest, PropertyTreesAccountForFixedParentOffset) { |
| 8485 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 8471 scoped_refptr<Layer> root = Layer::Create(); |
| 8486 scoped_refptr<Layer> child = Layer::Create(layer_settings()); | 8472 scoped_refptr<Layer> child = Layer::Create(); |
| 8487 scoped_refptr<LayerWithForcedDrawsContent> grandchild = | 8473 scoped_refptr<LayerWithForcedDrawsContent> grandchild = |
| 8488 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8474 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8489 | 8475 |
| 8490 root->AddChild(child); | 8476 root->AddChild(child); |
| 8491 child->AddChild(grandchild); | 8477 child->AddChild(grandchild); |
| 8492 | 8478 |
| 8493 gfx::Transform identity_transform; | 8479 gfx::Transform identity_transform; |
| 8494 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), | 8480 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), |
| 8495 gfx::PointF(), gfx::Size(50, 50), true, false); | 8481 gfx::PointF(), gfx::Size(50, 50), true, false); |
| 8496 SetLayerPropertiesForTesting(child.get(), identity_transform, gfx::Point3F(), | 8482 SetLayerPropertiesForTesting(child.get(), identity_transform, gfx::Point3F(), |
| 8497 gfx::PointF(1000, 1000), gfx::Size(50, 50), true, | 8483 gfx::PointF(1000, 1000), gfx::Size(50, 50), true, |
| 8498 false); | 8484 false); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 8514 | 8500 |
| 8515 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), grandchild->visible_layer_rect()); | 8501 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), grandchild->visible_layer_rect()); |
| 8516 } | 8502 } |
| 8517 | 8503 |
| 8518 // Ensures that the property tree code accounts for offsets between fixed | 8504 // Ensures that the property tree code accounts for offsets between fixed |
| 8519 // position containers and their transform tree parents, when a fixed position | 8505 // 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 | 8506 // layer's container is its layer tree parent, but this parent doesn't have its |
| 8521 // own transform tree node. | 8507 // own transform tree node. |
| 8522 TEST_F(LayerTreeHostCommonTest, | 8508 TEST_F(LayerTreeHostCommonTest, |
| 8523 PropertyTreesAccountForFixedParentOffsetWhenContainerIsParent) { | 8509 PropertyTreesAccountForFixedParentOffsetWhenContainerIsParent) { |
| 8524 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 8510 scoped_refptr<Layer> root = Layer::Create(); |
| 8525 scoped_refptr<Layer> child = Layer::Create(layer_settings()); | 8511 scoped_refptr<Layer> child = Layer::Create(); |
| 8526 scoped_refptr<LayerWithForcedDrawsContent> grandchild = | 8512 scoped_refptr<LayerWithForcedDrawsContent> grandchild = |
| 8527 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8513 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8528 | 8514 |
| 8529 root->AddChild(child); | 8515 root->AddChild(child); |
| 8530 child->AddChild(grandchild); | 8516 child->AddChild(grandchild); |
| 8531 | 8517 |
| 8532 gfx::Transform identity_transform; | 8518 gfx::Transform identity_transform; |
| 8533 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), | 8519 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), |
| 8534 gfx::PointF(), gfx::Size(50, 50), true, false); | 8520 gfx::PointF(), gfx::Size(50, 50), true, false); |
| 8535 SetLayerPropertiesForTesting(child.get(), identity_transform, gfx::Point3F(), | 8521 SetLayerPropertiesForTesting(child.get(), identity_transform, gfx::Point3F(), |
| 8536 gfx::PointF(1000, 1000), gfx::Size(50, 50), true, | 8522 gfx::PointF(1000, 1000), gfx::Size(50, 50), true, |
| 8537 false); | 8523 false); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 8557 TEST_F(LayerTreeHostCommonTest, CombineClipsUsingContentTarget) { | 8543 TEST_F(LayerTreeHostCommonTest, CombineClipsUsingContentTarget) { |
| 8558 // In the following layer tree, the layer |box|'s render target is |surface|. | 8544 // 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| | 8545 // |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 | 8546 // in the space of its target (i.e., |surface|), not its target's target. This |
| 8561 // test ensures that happens. | 8547 // test ensures that happens. |
| 8562 | 8548 |
| 8563 gfx::Transform rotate; | 8549 gfx::Transform rotate; |
| 8564 rotate.Rotate(5); | 8550 rotate.Rotate(5); |
| 8565 gfx::Transform identity; | 8551 gfx::Transform identity; |
| 8566 | 8552 |
| 8567 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 8553 scoped_refptr<Layer> root = Layer::Create(); |
| 8568 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 8554 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 8569 gfx::PointF(), gfx::Size(2500, 1500), true, | 8555 gfx::PointF(), gfx::Size(2500, 1500), true, |
| 8570 false); | 8556 false); |
| 8571 | 8557 |
| 8572 scoped_refptr<Layer> frame_clip = Layer::Create(layer_settings()); | 8558 scoped_refptr<Layer> frame_clip = Layer::Create(); |
| 8573 SetLayerPropertiesForTesting(frame_clip.get(), identity, gfx::Point3F(), | 8559 SetLayerPropertiesForTesting(frame_clip.get(), identity, gfx::Point3F(), |
| 8574 gfx::PointF(), gfx::Size(2500, 1500), true, | 8560 gfx::PointF(), gfx::Size(2500, 1500), true, |
| 8575 false); | 8561 false); |
| 8576 frame_clip->SetMasksToBounds(true); | 8562 frame_clip->SetMasksToBounds(true); |
| 8577 | 8563 |
| 8578 scoped_refptr<Layer> rotated = Layer::Create(layer_settings()); | 8564 scoped_refptr<Layer> rotated = Layer::Create(); |
| 8579 SetLayerPropertiesForTesting(rotated.get(), rotate, | 8565 SetLayerPropertiesForTesting(rotated.get(), rotate, |
| 8580 gfx::Point3F(1250, 250, 0), gfx::PointF(), | 8566 gfx::Point3F(1250, 250, 0), gfx::PointF(), |
| 8581 gfx::Size(2500, 500), true, false); | 8567 gfx::Size(2500, 500), true, false); |
| 8582 | 8568 |
| 8583 scoped_refptr<Layer> surface = Layer::Create(layer_settings()); | 8569 scoped_refptr<Layer> surface = Layer::Create(); |
| 8584 SetLayerPropertiesForTesting(surface.get(), rotate, gfx::Point3F(), | 8570 SetLayerPropertiesForTesting(surface.get(), rotate, gfx::Point3F(), |
| 8585 gfx::PointF(), gfx::Size(2500, 500), true, | 8571 gfx::PointF(), gfx::Size(2500, 500), true, |
| 8586 false); | 8572 false); |
| 8587 surface->SetOpacity(0.5); | 8573 surface->SetOpacity(0.5); |
| 8588 | 8574 |
| 8589 scoped_refptr<LayerWithForcedDrawsContent> container = | 8575 scoped_refptr<LayerWithForcedDrawsContent> container = |
| 8590 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8576 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8591 SetLayerPropertiesForTesting(container.get(), identity, gfx::Point3F(), | 8577 SetLayerPropertiesForTesting(container.get(), identity, gfx::Point3F(), |
| 8592 gfx::PointF(), gfx::Size(300, 300), true, false); | 8578 gfx::PointF(), gfx::Size(300, 300), true, false); |
| 8593 | 8579 |
| 8594 scoped_refptr<LayerWithForcedDrawsContent> box = | 8580 scoped_refptr<LayerWithForcedDrawsContent> box = |
| 8595 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8581 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8596 SetLayerPropertiesForTesting(box.get(), identity, gfx::Point3F(), | 8582 SetLayerPropertiesForTesting(box.get(), identity, gfx::Point3F(), |
| 8597 gfx::PointF(), gfx::Size(100, 100), true, false); | 8583 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 8598 | 8584 |
| 8599 root->AddChild(frame_clip); | 8585 root->AddChild(frame_clip); |
| 8600 frame_clip->AddChild(rotated); | 8586 frame_clip->AddChild(rotated); |
| 8601 rotated->AddChild(surface); | 8587 rotated->AddChild(surface); |
| 8602 surface->AddChild(container); | 8588 surface->AddChild(container); |
| 8603 surface->AddChild(box); | 8589 surface->AddChild(box); |
| 8604 | 8590 |
| 8605 host()->SetRootLayer(root); | 8591 host()->SetRootLayer(root); |
| 8606 | 8592 |
| 8607 ExecuteCalculateDrawProperties(root.get()); | 8593 ExecuteCalculateDrawProperties(root.get()); |
| 8608 } | 8594 } |
| 8609 | 8595 |
| 8610 TEST_F(LayerTreeHostCommonTest, OnlyApplyFixedPositioningOnce) { | 8596 TEST_F(LayerTreeHostCommonTest, OnlyApplyFixedPositioningOnce) { |
| 8611 gfx::Transform identity; | 8597 gfx::Transform identity; |
| 8612 gfx::Transform translate_z; | 8598 gfx::Transform translate_z; |
| 8613 translate_z.Translate3d(0, 0, 10); | 8599 translate_z.Translate3d(0, 0, 10); |
| 8614 | 8600 |
| 8615 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 8601 scoped_refptr<Layer> root = Layer::Create(); |
| 8616 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 8602 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 8617 gfx::PointF(), gfx::Size(800, 800), true, false); | 8603 gfx::PointF(), gfx::Size(800, 800), true, false); |
| 8618 root->SetIsContainerForFixedPositionLayers(true); | 8604 root->SetIsContainerForFixedPositionLayers(true); |
| 8619 | 8605 |
| 8620 scoped_refptr<Layer> frame_clip = Layer::Create(layer_settings()); | 8606 scoped_refptr<Layer> frame_clip = Layer::Create(); |
| 8621 SetLayerPropertiesForTesting(frame_clip.get(), translate_z, gfx::Point3F(), | 8607 SetLayerPropertiesForTesting(frame_clip.get(), translate_z, gfx::Point3F(), |
| 8622 gfx::PointF(500, 100), gfx::Size(100, 100), true, | 8608 gfx::PointF(500, 100), gfx::Size(100, 100), true, |
| 8623 false); | 8609 false); |
| 8624 frame_clip->SetMasksToBounds(true); | 8610 frame_clip->SetMasksToBounds(true); |
| 8625 | 8611 |
| 8626 scoped_refptr<LayerWithForcedDrawsContent> fixed = | 8612 scoped_refptr<LayerWithForcedDrawsContent> fixed = |
| 8627 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8613 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8628 SetLayerPropertiesForTesting(fixed.get(), identity, gfx::Point3F(), | 8614 SetLayerPropertiesForTesting(fixed.get(), identity, gfx::Point3F(), |
| 8629 gfx::PointF(), gfx::Size(1000, 1000), true, | 8615 gfx::PointF(), gfx::Size(1000, 1000), true, |
| 8630 false); | 8616 false); |
| 8631 | 8617 |
| 8632 LayerPositionConstraint constraint; | 8618 LayerPositionConstraint constraint; |
| 8633 constraint.set_is_fixed_position(true); | 8619 constraint.set_is_fixed_position(true); |
| 8634 fixed->SetPositionConstraint(constraint); | 8620 fixed->SetPositionConstraint(constraint); |
| 8635 | 8621 |
| 8636 root->AddChild(frame_clip); | 8622 root->AddChild(frame_clip); |
| 8637 frame_clip->AddChild(fixed); | 8623 frame_clip->AddChild(fixed); |
| 8638 | 8624 |
| 8639 host()->SetRootLayer(root); | 8625 host()->SetRootLayer(root); |
| 8640 | 8626 |
| 8641 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8627 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 8642 | 8628 |
| 8643 gfx::Rect expected(0, 0, 100, 100); | 8629 gfx::Rect expected(0, 0, 100, 100); |
| 8644 EXPECT_EQ(expected, fixed->visible_layer_rect()); | 8630 EXPECT_EQ(expected, fixed->visible_layer_rect()); |
| 8645 } | 8631 } |
| 8646 | 8632 |
| 8647 TEST_F(LayerTreeHostCommonTest, | 8633 TEST_F(LayerTreeHostCommonTest, |
| 8648 PropertyTreesAccountForScrollCompensationAdjustment) { | 8634 PropertyTreesAccountForScrollCompensationAdjustment) { |
| 8649 gfx::Transform identity; | 8635 gfx::Transform identity; |
| 8650 gfx::Transform translate_z; | 8636 gfx::Transform translate_z; |
| 8651 translate_z.Translate3d(0, 0, 10); | 8637 translate_z.Translate3d(0, 0, 10); |
| 8652 | 8638 |
| 8653 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 8639 scoped_refptr<Layer> root = Layer::Create(); |
| 8654 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 8640 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 8655 gfx::PointF(), gfx::Size(800, 800), true, false); | 8641 gfx::PointF(), gfx::Size(800, 800), true, false); |
| 8656 root->SetIsContainerForFixedPositionLayers(true); | 8642 root->SetIsContainerForFixedPositionLayers(true); |
| 8657 | 8643 |
| 8658 scoped_refptr<Layer> frame_clip = Layer::Create(layer_settings()); | 8644 scoped_refptr<Layer> frame_clip = Layer::Create(); |
| 8659 SetLayerPropertiesForTesting(frame_clip.get(), translate_z, gfx::Point3F(), | 8645 SetLayerPropertiesForTesting(frame_clip.get(), translate_z, gfx::Point3F(), |
| 8660 gfx::PointF(500, 100), gfx::Size(100, 100), true, | 8646 gfx::PointF(500, 100), gfx::Size(100, 100), true, |
| 8661 false); | 8647 false); |
| 8662 frame_clip->SetMasksToBounds(true); | 8648 frame_clip->SetMasksToBounds(true); |
| 8663 | 8649 |
| 8664 scoped_refptr<LayerWithForcedDrawsContent> scroller = | 8650 scoped_refptr<LayerWithForcedDrawsContent> scroller = |
| 8665 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8651 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8666 SetLayerPropertiesForTesting(scroller.get(), identity, gfx::Point3F(), | 8652 SetLayerPropertiesForTesting(scroller.get(), identity, gfx::Point3F(), |
| 8667 gfx::PointF(), gfx::Size(1000, 1000), true, | 8653 gfx::PointF(), gfx::Size(1000, 1000), true, |
| 8668 false); | 8654 false); |
| 8669 | 8655 |
| 8670 scroller->SetScrollCompensationAdjustment(gfx::Vector2dF(0.3f, 0.7f)); | 8656 scroller->SetScrollCompensationAdjustment(gfx::Vector2dF(0.3f, 0.7f)); |
| 8671 scroller->SetScrollOffset(gfx::ScrollOffset(0.3, 0.7)); | 8657 scroller->SetScrollOffset(gfx::ScrollOffset(0.3, 0.7)); |
| 8672 scroller->SetScrollClipLayerId(frame_clip->id()); | 8658 scroller->SetScrollClipLayerId(frame_clip->id()); |
| 8673 | 8659 |
| 8674 scoped_refptr<LayerWithForcedDrawsContent> fixed = | 8660 scoped_refptr<LayerWithForcedDrawsContent> fixed = |
| 8675 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8661 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8676 SetLayerPropertiesForTesting(fixed.get(), identity, gfx::Point3F(), | 8662 SetLayerPropertiesForTesting(fixed.get(), identity, gfx::Point3F(), |
| 8677 gfx::PointF(), gfx::Size(50, 50), true, false); | 8663 gfx::PointF(), gfx::Size(50, 50), true, false); |
| 8678 | 8664 |
| 8679 LayerPositionConstraint constraint; | 8665 LayerPositionConstraint constraint; |
| 8680 constraint.set_is_fixed_position(true); | 8666 constraint.set_is_fixed_position(true); |
| 8681 fixed->SetPositionConstraint(constraint); | 8667 fixed->SetPositionConstraint(constraint); |
| 8682 | 8668 |
| 8683 scoped_refptr<LayerWithForcedDrawsContent> fixed_child = | 8669 scoped_refptr<LayerWithForcedDrawsContent> fixed_child = |
| 8684 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8670 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8685 SetLayerPropertiesForTesting(fixed_child.get(), identity, gfx::Point3F(), | 8671 SetLayerPropertiesForTesting(fixed_child.get(), identity, gfx::Point3F(), |
| 8686 gfx::PointF(), gfx::Size(10, 10), true, false); | 8672 gfx::PointF(), gfx::Size(10, 10), true, false); |
| 8687 | 8673 |
| 8688 fixed_child->SetPositionConstraint(constraint); | 8674 fixed_child->SetPositionConstraint(constraint); |
| 8689 | 8675 |
| 8690 root->AddChild(frame_clip); | 8676 root->AddChild(frame_clip); |
| 8691 frame_clip->AddChild(scroller); | 8677 frame_clip->AddChild(scroller); |
| 8692 scroller->AddChild(fixed); | 8678 scroller->AddChild(fixed); |
| 8693 fixed->AddChild(fixed_child); | 8679 fixed->AddChild(fixed_child); |
| 8694 | 8680 |
| 8695 host()->SetRootLayer(root); | 8681 host()->SetRootLayer(root); |
| 8696 | 8682 |
| 8697 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8683 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 8698 | 8684 |
| 8699 gfx::Rect expected(0, 0, 50, 50); | 8685 gfx::Rect expected(0, 0, 50, 50); |
| 8700 EXPECT_EQ(expected, fixed->visible_layer_rect()); | 8686 EXPECT_EQ(expected, fixed->visible_layer_rect()); |
| 8701 | 8687 |
| 8702 expected = gfx::Rect(0, 0, 10, 10); | 8688 expected = gfx::Rect(0, 0, 10, 10); |
| 8703 EXPECT_EQ(expected, fixed_child->visible_layer_rect()); | 8689 EXPECT_EQ(expected, fixed_child->visible_layer_rect()); |
| 8704 } | 8690 } |
| 8705 | 8691 |
| 8706 TEST_F(LayerTreeHostCommonTest, FixedClipsShouldBeAssociatedWithTheRightNode) { | 8692 TEST_F(LayerTreeHostCommonTest, FixedClipsShouldBeAssociatedWithTheRightNode) { |
| 8707 gfx::Transform identity; | 8693 gfx::Transform identity; |
| 8708 | 8694 |
| 8709 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 8695 scoped_refptr<Layer> root = Layer::Create(); |
| 8710 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 8696 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 8711 gfx::PointF(), gfx::Size(800, 800), true, false); | 8697 gfx::PointF(), gfx::Size(800, 800), true, false); |
| 8712 root->SetIsContainerForFixedPositionLayers(true); | 8698 root->SetIsContainerForFixedPositionLayers(true); |
| 8713 | 8699 |
| 8714 scoped_refptr<Layer> frame_clip = Layer::Create(layer_settings()); | 8700 scoped_refptr<Layer> frame_clip = Layer::Create(); |
| 8715 SetLayerPropertiesForTesting(frame_clip.get(), identity, gfx::Point3F(), | 8701 SetLayerPropertiesForTesting(frame_clip.get(), identity, gfx::Point3F(), |
| 8716 gfx::PointF(500, 100), gfx::Size(100, 100), true, | 8702 gfx::PointF(500, 100), gfx::Size(100, 100), true, |
| 8717 false); | 8703 false); |
| 8718 frame_clip->SetMasksToBounds(true); | 8704 frame_clip->SetMasksToBounds(true); |
| 8719 | 8705 |
| 8720 scoped_refptr<LayerWithForcedDrawsContent> scroller = | 8706 scoped_refptr<LayerWithForcedDrawsContent> scroller = |
| 8721 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8707 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8722 SetLayerPropertiesForTesting(scroller.get(), identity, gfx::Point3F(), | 8708 SetLayerPropertiesForTesting(scroller.get(), identity, gfx::Point3F(), |
| 8723 gfx::PointF(), gfx::Size(1000, 1000), true, | 8709 gfx::PointF(), gfx::Size(1000, 1000), true, |
| 8724 false); | 8710 false); |
| 8725 | 8711 |
| 8726 scroller->SetScrollOffset(gfx::ScrollOffset(100, 100)); | 8712 scroller->SetScrollOffset(gfx::ScrollOffset(100, 100)); |
| 8727 scroller->SetScrollClipLayerId(frame_clip->id()); | 8713 scroller->SetScrollClipLayerId(frame_clip->id()); |
| 8728 | 8714 |
| 8729 scoped_refptr<LayerWithForcedDrawsContent> fixed = | 8715 scoped_refptr<LayerWithForcedDrawsContent> fixed = |
| 8730 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8716 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8731 SetLayerPropertiesForTesting(fixed.get(), identity, gfx::Point3F(), | 8717 SetLayerPropertiesForTesting(fixed.get(), identity, gfx::Point3F(), |
| 8732 gfx::PointF(100, 100), gfx::Size(50, 50), true, | 8718 gfx::PointF(100, 100), gfx::Size(50, 50), true, |
| 8733 false); | 8719 false); |
| 8734 | 8720 |
| 8735 LayerPositionConstraint constraint; | 8721 LayerPositionConstraint constraint; |
| 8736 constraint.set_is_fixed_position(true); | 8722 constraint.set_is_fixed_position(true); |
| 8737 fixed->SetPositionConstraint(constraint); | 8723 fixed->SetPositionConstraint(constraint); |
| 8738 fixed->SetForceRenderSurface(true); | 8724 fixed->SetForceRenderSurface(true); |
| 8739 fixed->SetMasksToBounds(true); | 8725 fixed->SetMasksToBounds(true); |
| 8740 | 8726 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 8751 } | 8737 } |
| 8752 | 8738 |
| 8753 TEST_F(LayerTreeHostCommonTest, ChangingAxisAlignmentTriggersRebuild) { | 8739 TEST_F(LayerTreeHostCommonTest, ChangingAxisAlignmentTriggersRebuild) { |
| 8754 gfx::Transform identity; | 8740 gfx::Transform identity; |
| 8755 gfx::Transform translate; | 8741 gfx::Transform translate; |
| 8756 gfx::Transform rotate; | 8742 gfx::Transform rotate; |
| 8757 | 8743 |
| 8758 translate.Translate(10, 10); | 8744 translate.Translate(10, 10); |
| 8759 rotate.Rotate(45); | 8745 rotate.Rotate(45); |
| 8760 | 8746 |
| 8761 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 8747 scoped_refptr<Layer> root = Layer::Create(); |
| 8762 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 8748 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 8763 gfx::PointF(), gfx::Size(800, 800), true, false); | 8749 gfx::PointF(), gfx::Size(800, 800), true, false); |
| 8764 root->SetIsContainerForFixedPositionLayers(true); | 8750 root->SetIsContainerForFixedPositionLayers(true); |
| 8765 | 8751 |
| 8766 host()->SetRootLayer(root); | 8752 host()->SetRootLayer(root); |
| 8767 | 8753 |
| 8768 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8754 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 8769 EXPECT_FALSE(host()->property_trees()->needs_rebuild); | 8755 EXPECT_FALSE(host()->property_trees()->needs_rebuild); |
| 8770 | 8756 |
| 8771 root->SetTransform(translate); | 8757 root->SetTransform(translate); |
| 8772 EXPECT_FALSE(host()->property_trees()->needs_rebuild); | 8758 EXPECT_FALSE(host()->property_trees()->needs_rebuild); |
| 8773 | 8759 |
| 8774 root->SetTransform(rotate); | 8760 root->SetTransform(rotate); |
| 8775 EXPECT_TRUE(host()->property_trees()->needs_rebuild); | 8761 EXPECT_TRUE(host()->property_trees()->needs_rebuild); |
| 8776 } | 8762 } |
| 8777 | 8763 |
| 8778 TEST_F(LayerTreeHostCommonTest, ChangeTransformOrigin) { | 8764 TEST_F(LayerTreeHostCommonTest, ChangeTransformOrigin) { |
| 8779 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 8765 scoped_refptr<Layer> root = Layer::Create(); |
| 8780 scoped_refptr<LayerWithForcedDrawsContent> child = | 8766 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 8781 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8767 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8782 root->AddChild(child); | 8768 root->AddChild(child); |
| 8783 | 8769 |
| 8784 host()->SetRootLayer(root); | 8770 host()->SetRootLayer(root); |
| 8785 | 8771 |
| 8786 gfx::Transform identity_matrix; | 8772 gfx::Transform identity_matrix; |
| 8787 gfx::Transform scale_matrix; | 8773 gfx::Transform scale_matrix; |
| 8788 scale_matrix.Scale(2.f, 2.f); | 8774 scale_matrix.Scale(2.f, 2.f); |
| 8789 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), | 8775 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
| 8790 gfx::PointF(), gfx::Size(100, 100), true, false); | 8776 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 8791 SetLayerPropertiesForTesting(child.get(), scale_matrix, gfx::Point3F(), | 8777 SetLayerPropertiesForTesting(child.get(), scale_matrix, gfx::Point3F(), |
| 8792 gfx::PointF(), gfx::Size(10, 10), true, false); | 8778 gfx::PointF(), gfx::Size(10, 10), true, false); |
| 8793 | 8779 |
| 8794 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8780 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 8795 EXPECT_EQ(gfx::Rect(10, 10), child->visible_layer_rect()); | 8781 EXPECT_EQ(gfx::Rect(10, 10), child->visible_layer_rect()); |
| 8796 | 8782 |
| 8797 child->SetTransformOrigin(gfx::Point3F(10.f, 10.f, 10.f)); | 8783 child->SetTransformOrigin(gfx::Point3F(10.f, 10.f, 10.f)); |
| 8798 | 8784 |
| 8799 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8785 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 8800 EXPECT_EQ(gfx::Rect(5, 5, 5, 5), child->visible_layer_rect()); | 8786 EXPECT_EQ(gfx::Rect(5, 5, 5, 5), child->visible_layer_rect()); |
| 8801 } | 8787 } |
| 8802 | 8788 |
| 8803 TEST_F(LayerTreeHostCommonTest, UpdateScrollChildPosition) { | 8789 TEST_F(LayerTreeHostCommonTest, UpdateScrollChildPosition) { |
| 8804 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 8790 scoped_refptr<Layer> root = Layer::Create(); |
| 8805 scoped_refptr<LayerWithForcedDrawsContent> scroll_parent = | 8791 scoped_refptr<LayerWithForcedDrawsContent> scroll_parent = |
| 8806 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8792 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8807 scoped_refptr<LayerWithForcedDrawsContent> scroll_child = | 8793 scoped_refptr<LayerWithForcedDrawsContent> scroll_child = |
| 8808 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8794 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8809 | 8795 |
| 8810 root->AddChild(scroll_child); | 8796 root->AddChild(scroll_child); |
| 8811 root->AddChild(scroll_parent); | 8797 root->AddChild(scroll_parent); |
| 8812 scroll_child->SetScrollParent(scroll_parent.get()); | 8798 scroll_child->SetScrollParent(scroll_parent.get()); |
| 8813 scroll_parent->SetScrollClipLayerId(root->id()); | 8799 scroll_parent->SetScrollClipLayerId(root->id()); |
| 8814 | 8800 |
| 8815 host()->SetRootLayer(root); | 8801 host()->SetRootLayer(root); |
| 8816 | 8802 |
| 8817 gfx::Transform identity_transform; | 8803 gfx::Transform identity_transform; |
| 8818 gfx::Transform scale; | 8804 gfx::Transform scale; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 8838 } | 8824 } |
| 8839 | 8825 |
| 8840 TEST_F(LayerTreeHostCommonTest, NumCopyRequestsInTargetSubtree) { | 8826 TEST_F(LayerTreeHostCommonTest, NumCopyRequestsInTargetSubtree) { |
| 8841 // If the layer has a node in effect_tree, the return value of | 8827 // 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 | 8828 // 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 | 8829 // 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 | 8830 // 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 | 8831 // greater than or equal to the actual number of copy requests in the |
| 8846 // sub-layer_tree. | 8832 // sub-layer_tree. |
| 8847 | 8833 |
| 8848 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 8834 scoped_refptr<Layer> root = Layer::Create(); |
| 8849 scoped_refptr<Layer> child1 = Layer::Create(layer_settings()); | 8835 scoped_refptr<Layer> child1 = Layer::Create(); |
| 8850 scoped_refptr<Layer> child2 = Layer::Create(layer_settings()); | 8836 scoped_refptr<Layer> child2 = Layer::Create(); |
| 8851 scoped_refptr<Layer> grandchild = Layer::Create(layer_settings()); | 8837 scoped_refptr<Layer> grandchild = Layer::Create(); |
| 8852 scoped_refptr<Layer> greatgrandchild = Layer::Create(layer_settings()); | 8838 scoped_refptr<Layer> greatgrandchild = Layer::Create(); |
| 8853 | 8839 |
| 8854 root->AddChild(child1); | 8840 root->AddChild(child1); |
| 8855 root->AddChild(child2); | 8841 root->AddChild(child2); |
| 8856 child1->AddChild(grandchild); | 8842 child1->AddChild(grandchild); |
| 8857 grandchild->AddChild(greatgrandchild); | 8843 grandchild->AddChild(greatgrandchild); |
| 8858 host()->SetRootLayer(root); | 8844 host()->SetRootLayer(root); |
| 8859 | 8845 |
| 8860 child1->RequestCopyOfOutput( | 8846 child1->RequestCopyOfOutput( |
| 8861 CopyOutputRequest::CreateBitmapRequest(base::Bind(&CopyOutputCallback))); | 8847 CopyOutputRequest::CreateBitmapRequest(base::Bind(&CopyOutputCallback))); |
| 8862 greatgrandchild->RequestCopyOfOutput( | 8848 greatgrandchild->RequestCopyOfOutput( |
| 8863 CopyOutputRequest::CreateBitmapRequest(base::Bind(&CopyOutputCallback))); | 8849 CopyOutputRequest::CreateBitmapRequest(base::Bind(&CopyOutputCallback))); |
| 8864 child2->SetOpacity(0.f); | 8850 child2->SetOpacity(0.f); |
| 8865 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8851 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 8866 | 8852 |
| 8867 EXPECT_EQ(root->num_copy_requests_in_target_subtree(), 2); | 8853 EXPECT_EQ(root->num_copy_requests_in_target_subtree(), 2); |
| 8868 EXPECT_EQ(child1->num_copy_requests_in_target_subtree(), 2); | 8854 EXPECT_EQ(child1->num_copy_requests_in_target_subtree(), 2); |
| 8869 EXPECT_EQ(child2->num_copy_requests_in_target_subtree(), 0); | 8855 EXPECT_EQ(child2->num_copy_requests_in_target_subtree(), 0); |
| 8870 EXPECT_EQ(grandchild->num_copy_requests_in_target_subtree(), 2); | 8856 EXPECT_EQ(grandchild->num_copy_requests_in_target_subtree(), 2); |
| 8871 EXPECT_EQ(greatgrandchild->num_copy_requests_in_target_subtree(), 1); | 8857 EXPECT_EQ(greatgrandchild->num_copy_requests_in_target_subtree(), 1); |
| 8872 } | 8858 } |
| 8873 | 8859 |
| 8874 TEST_F(LayerTreeHostCommonTest, SkippingSubtreeMain) { | 8860 TEST_F(LayerTreeHostCommonTest, SkippingSubtreeMain) { |
| 8875 gfx::Transform identity; | 8861 gfx::Transform identity; |
| 8876 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 8862 scoped_refptr<Layer> root = Layer::Create(); |
| 8877 FakeContentLayerClient client; | 8863 FakeContentLayerClient client; |
| 8878 client.set_bounds(root->bounds()); | 8864 client.set_bounds(root->bounds()); |
| 8879 scoped_refptr<LayerWithForcedDrawsContent> child = | 8865 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 8880 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8866 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8881 scoped_refptr<LayerWithForcedDrawsContent> grandchild = | 8867 scoped_refptr<LayerWithForcedDrawsContent> grandchild = |
| 8882 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 8868 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 8883 scoped_refptr<FakePictureLayer> greatgrandchild( | 8869 scoped_refptr<FakePictureLayer> greatgrandchild( |
| 8884 FakePictureLayer::Create(layer_settings(), &client)); | 8870 FakePictureLayer::Create(&client)); |
| 8885 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 8871 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 8886 gfx::PointF(), gfx::Size(100, 100), true, false); | 8872 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 8887 SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(), | 8873 SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(), |
| 8888 gfx::PointF(), gfx::Size(10, 10), true, false); | 8874 gfx::PointF(), gfx::Size(10, 10), true, false); |
| 8889 SetLayerPropertiesForTesting(grandchild.get(), identity, gfx::Point3F(), | 8875 SetLayerPropertiesForTesting(grandchild.get(), identity, gfx::Point3F(), |
| 8890 gfx::PointF(), gfx::Size(10, 10), true, false); | 8876 gfx::PointF(), gfx::Size(10, 10), true, false); |
| 8891 SetLayerPropertiesForTesting(greatgrandchild.get(), identity, gfx::Point3F(), | 8877 SetLayerPropertiesForTesting(greatgrandchild.get(), identity, gfx::Point3F(), |
| 8892 gfx::PointF(), gfx::Size(10, 10), true, false); | 8878 gfx::PointF(), gfx::Size(10, 10), true, false); |
| 8893 | 8879 |
| 8894 root->AddChild(child); | 8880 root->AddChild(child); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9034 requests.push_back(CopyOutputRequest::CreateEmptyRequest()); | 9020 requests.push_back(CopyOutputRequest::CreateEmptyRequest()); |
| 9035 | 9021 |
| 9036 grandchild_ptr->PassCopyRequests(&requests); | 9022 grandchild_ptr->PassCopyRequests(&requests); |
| 9037 root.get()->layer_tree_impl()->property_trees()->needs_rebuild = true; | 9023 root.get()->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 9038 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 9024 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9039 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); | 9025 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); |
| 9040 } | 9026 } |
| 9041 | 9027 |
| 9042 TEST_F(LayerTreeHostCommonTest, SkippingLayer) { | 9028 TEST_F(LayerTreeHostCommonTest, SkippingLayer) { |
| 9043 gfx::Transform identity; | 9029 gfx::Transform identity; |
| 9044 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 9030 scoped_refptr<Layer> root = Layer::Create(); |
| 9045 FakeContentLayerClient client; | 9031 FakeContentLayerClient client; |
| 9046 client.set_bounds(root->bounds()); | 9032 client.set_bounds(root->bounds()); |
| 9047 scoped_refptr<LayerWithForcedDrawsContent> child = | 9033 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 9048 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); | 9034 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 9049 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 9035 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 9050 gfx::PointF(), gfx::Size(100, 100), true, false); | 9036 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 9051 SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(), | 9037 SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(), |
| 9052 gfx::PointF(), gfx::Size(10, 10), true, false); | 9038 gfx::PointF(), gfx::Size(10, 10), true, false); |
| 9053 root->AddChild(child); | 9039 root->AddChild(child); |
| 9054 | 9040 |
| 9055 host()->SetRootLayer(root); | 9041 host()->SetRootLayer(root); |
| 9056 | 9042 |
| 9057 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 9043 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9058 EXPECT_EQ(gfx::Rect(10, 10), child->visible_layer_rect()); | 9044 EXPECT_EQ(gfx::Rect(10, 10), child->visible_layer_rect()); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 9078 child->SetTransform(identity); | 9064 child->SetTransform(identity); |
| 9079 | 9065 |
| 9080 child->SetOpacity(0.f); | 9066 child->SetOpacity(0.f); |
| 9081 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 9067 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9082 EXPECT_EQ(gfx::Rect(0, 0), child->visible_layer_rect()); | 9068 EXPECT_EQ(gfx::Rect(0, 0), child->visible_layer_rect()); |
| 9083 } | 9069 } |
| 9084 | 9070 |
| 9085 TEST_F(LayerTreeHostCommonTest, LayerTreeRebuildTest) { | 9071 TEST_F(LayerTreeHostCommonTest, LayerTreeRebuildTest) { |
| 9086 // Ensure that the treewalk in LayerTreeHostCommom:: | 9072 // Ensure that the treewalk in LayerTreeHostCommom:: |
| 9087 // PreCalculateMetaInformation happens when its required. | 9073 // PreCalculateMetaInformation happens when its required. |
| 9088 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 9074 scoped_refptr<Layer> root = Layer::Create(); |
| 9089 scoped_refptr<Layer> parent = Layer::Create(layer_settings()); | 9075 scoped_refptr<Layer> parent = Layer::Create(); |
| 9090 scoped_refptr<Layer> child = Layer::Create(layer_settings()); | 9076 scoped_refptr<Layer> child = Layer::Create(); |
| 9091 | 9077 |
| 9092 root->AddChild(parent); | 9078 root->AddChild(parent); |
| 9093 parent->AddChild(child); | 9079 parent->AddChild(child); |
| 9094 | 9080 |
| 9095 child->SetClipParent(root.get()); | 9081 child->SetClipParent(root.get()); |
| 9096 | 9082 |
| 9097 gfx::Transform identity; | 9083 gfx::Transform identity; |
| 9098 | 9084 |
| 9099 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 9085 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 9100 gfx::PointF(), gfx::Size(100, 100), true, false); | 9086 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()); | 9124 child->SetTouchEventHandlerRegion(gfx::Rect()); |
| 9139 ExecuteCalculateDrawProperties(root); | 9125 ExecuteCalculateDrawProperties(root); |
| 9140 EXPECT_EQ(root->layer_or_descendant_has_touch_handler(), false); | 9126 EXPECT_EQ(root->layer_or_descendant_has_touch_handler(), false); |
| 9141 } | 9127 } |
| 9142 | 9128 |
| 9143 TEST_F(LayerTreeHostCommonTest, ResetPropertyTreeIndices) { | 9129 TEST_F(LayerTreeHostCommonTest, ResetPropertyTreeIndices) { |
| 9144 gfx::Transform identity; | 9130 gfx::Transform identity; |
| 9145 gfx::Transform translate_z; | 9131 gfx::Transform translate_z; |
| 9146 translate_z.Translate3d(0, 0, 10); | 9132 translate_z.Translate3d(0, 0, 10); |
| 9147 | 9133 |
| 9148 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 9134 scoped_refptr<Layer> root = Layer::Create(); |
| 9149 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 9135 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 9150 gfx::PointF(), gfx::Size(800, 800), true, false); | 9136 gfx::PointF(), gfx::Size(800, 800), true, false); |
| 9151 | 9137 |
| 9152 scoped_refptr<Layer> child = Layer::Create(layer_settings()); | 9138 scoped_refptr<Layer> child = Layer::Create(); |
| 9153 SetLayerPropertiesForTesting(child.get(), translate_z, gfx::Point3F(), | 9139 SetLayerPropertiesForTesting(child.get(), translate_z, gfx::Point3F(), |
| 9154 gfx::PointF(), gfx::Size(100, 100), true, false); | 9140 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 9155 | 9141 |
| 9156 root->AddChild(child); | 9142 root->AddChild(child); |
| 9157 | 9143 |
| 9158 host()->SetRootLayer(root); | 9144 host()->SetRootLayer(root); |
| 9159 | 9145 |
| 9160 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 9146 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9161 EXPECT_NE(-1, child->transform_tree_index()); | 9147 EXPECT_NE(-1, child->transform_tree_index()); |
| 9162 | 9148 |
| 9163 child->RemoveFromParent(); | 9149 child->RemoveFromParent(); |
| 9164 | 9150 |
| 9165 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 9151 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9166 EXPECT_EQ(-1, child->transform_tree_index()); | 9152 EXPECT_EQ(-1, child->transform_tree_index()); |
| 9167 } | 9153 } |
| 9168 | 9154 |
| 9169 TEST_F(LayerTreeHostCommonTest, ResetLayerDrawPropertiestest) { | 9155 TEST_F(LayerTreeHostCommonTest, ResetLayerDrawPropertiestest) { |
| 9170 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 9156 scoped_refptr<Layer> root = Layer::Create(); |
| 9171 scoped_refptr<Layer> child = Layer::Create(layer_settings()); | 9157 scoped_refptr<Layer> child = Layer::Create(); |
| 9172 | 9158 |
| 9173 root->AddChild(child); | 9159 root->AddChild(child); |
| 9174 gfx::Transform identity; | 9160 gfx::Transform identity; |
| 9175 | 9161 |
| 9176 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 9162 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 9177 gfx::PointF(), gfx::Size(100, 100), true, false); | 9163 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 9178 SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(), | 9164 SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(), |
| 9179 gfx::PointF(), gfx::Size(100, 100), true, false); | 9165 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 9180 | 9166 |
| 9181 host()->SetRootLayer(root); | 9167 host()->SetRootLayer(root); |
| (...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9917 // +----node---owner:5, id:6 | 9903 // +----node---owner:5, id:6 |
| 9918 // | 9904 // |
| 9919 // Extra check: | 9905 // Extra check: |
| 9920 // scroll_tree_index() of: | 9906 // scroll_tree_index() of: |
| 9921 // grand_child10:3 | 9907 // grand_child10:3 |
| 9922 // parent3:1 | 9908 // parent3:1 |
| 9923 // child8:4 | 9909 // child8:4 |
| 9924 // parent4:1 | 9910 // parent4:1 |
| 9925 // child9:1 | 9911 // child9:1 |
| 9926 // grand_child12:1 | 9912 // grand_child12:1 |
| 9927 scoped_refptr<Layer> root1 = Layer::Create(layer_settings()); | 9913 scoped_refptr<Layer> root1 = Layer::Create(); |
| 9928 scoped_refptr<Layer> page_scale_layer = Layer::Create(layer_settings()); | 9914 scoped_refptr<Layer> page_scale_layer = Layer::Create(); |
| 9929 scoped_refptr<Layer> parent2 = Layer::Create(layer_settings()); | 9915 scoped_refptr<Layer> parent2 = Layer::Create(); |
| 9930 scoped_refptr<Layer> parent3 = Layer::Create(layer_settings()); | 9916 scoped_refptr<Layer> parent3 = Layer::Create(); |
| 9931 scoped_refptr<Layer> parent4 = Layer::Create(layer_settings()); | 9917 scoped_refptr<Layer> parent4 = Layer::Create(); |
| 9932 scoped_refptr<Layer> parent5 = Layer::Create(layer_settings()); | 9918 scoped_refptr<Layer> parent5 = Layer::Create(); |
| 9933 scoped_refptr<Layer> child6 = Layer::Create(layer_settings()); | 9919 scoped_refptr<Layer> child6 = Layer::Create(); |
| 9934 scoped_refptr<Layer> child7 = Layer::Create(layer_settings()); | 9920 scoped_refptr<Layer> child7 = Layer::Create(); |
| 9935 scoped_refptr<Layer> child8 = Layer::Create(layer_settings()); | 9921 scoped_refptr<Layer> child8 = Layer::Create(); |
| 9936 scoped_refptr<Layer> child9 = Layer::Create(layer_settings()); | 9922 scoped_refptr<Layer> child9 = Layer::Create(); |
| 9937 scoped_refptr<Layer> grand_child10 = Layer::Create(layer_settings()); | 9923 scoped_refptr<Layer> grand_child10 = Layer::Create(); |
| 9938 scoped_refptr<Layer> grand_child11 = Layer::Create(layer_settings()); | 9924 scoped_refptr<Layer> grand_child11 = Layer::Create(); |
| 9939 scoped_refptr<Layer> grand_child12 = Layer::Create(layer_settings()); | 9925 scoped_refptr<Layer> grand_child12 = Layer::Create(); |
| 9940 | 9926 |
| 9941 root1->AddChild(page_scale_layer); | 9927 root1->AddChild(page_scale_layer); |
| 9942 page_scale_layer->AddChild(parent2); | 9928 page_scale_layer->AddChild(parent2); |
| 9943 page_scale_layer->AddChild(parent3); | 9929 page_scale_layer->AddChild(parent3); |
| 9944 page_scale_layer->AddChild(parent4); | 9930 page_scale_layer->AddChild(parent4); |
| 9945 page_scale_layer->AddChild(parent5); | 9931 page_scale_layer->AddChild(parent5); |
| 9946 parent2->AddChild(child6); | 9932 parent2->AddChild(child6); |
| 9947 parent3->AddChild(child7); | 9933 parent3->AddChild(child7); |
| 9948 parent3->AddChild(child8); | 9934 parent3->AddChild(child8); |
| 9949 parent4->AddChild(child9); | 9935 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()); | 10063 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); |
| 10078 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); | 10064 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); |
| 10079 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); | 10065 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); |
| 10080 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); | 10066 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); |
| 10081 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); | 10067 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); |
| 10082 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); | 10068 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); |
| 10083 } | 10069 } |
| 10084 | 10070 |
| 10085 } // namespace | 10071 } // namespace |
| 10086 } // namespace cc | 10072 } // namespace cc |
| OLD | NEW |