| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/trees/layer_tree_host_common.h" | 5 #include "cc/trees/layer_tree_host_common.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "cc/animation/layer_animation_controller.h" | 10 #include "cc/animation/layer_animation_controller.h" |
| (...skipping 2822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2833 grand_child_scale_matrix.Scale(0.246f, 0.246f); | 2833 grand_child_scale_matrix.Scale(0.246f, 0.246f); |
| 2834 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), | 2834 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
| 2835 gfx::PointF(), gfx::Size(100, 100), true, false); | 2835 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 2836 SetLayerPropertiesForTesting(child.get(), child_scale_matrix, gfx::Point3F(), | 2836 SetLayerPropertiesForTesting(child.get(), child_scale_matrix, gfx::Point3F(), |
| 2837 gfx::PointF(), gfx::Size(10, 10), true, false); | 2837 gfx::PointF(), gfx::Size(10, 10), true, false); |
| 2838 SetLayerPropertiesForTesting(grand_child.get(), grand_child_scale_matrix, | 2838 SetLayerPropertiesForTesting(grand_child.get(), grand_child_scale_matrix, |
| 2839 gfx::Point3F(), gfx::PointF(), | 2839 gfx::Point3F(), gfx::PointF(), |
| 2840 gfx::Size(100, 100), true, false); | 2840 gfx::Size(100, 100), true, false); |
| 2841 | 2841 |
| 2842 child->SetMasksToBounds(true); | 2842 child->SetMasksToBounds(true); |
| 2843 ExecuteCalculateDrawProperties(root.get()); | 2843 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 2844 | 2844 |
| 2845 // The visible rect is expanded to integer coordinates in target space before | 2845 // The visible rect is expanded to integer coordinates in target space before |
| 2846 // being projected back to layer space, where it is once again expanded to | 2846 // being projected back to layer space, where it is once again expanded to |
| 2847 // integer coordinates. | 2847 // integer coordinates. |
| 2848 EXPECT_EQ(gfx::Rect(49, 49), grand_child->visible_rect_from_property_trees()); | 2848 EXPECT_EQ(gfx::Rect(49, 49), grand_child->visible_rect_from_property_trees()); |
| 2849 } | 2849 } |
| 2850 | 2850 |
| 2851 TEST_F(LayerTreeHostCommonTest, | 2851 TEST_F(LayerTreeHostCommonTest, |
| 2852 DrawableAndVisibleContentRectsForLayersInUnclippedRenderSurface) { | 2852 DrawableAndVisibleContentRectsForLayersInUnclippedRenderSurface) { |
| 2853 scoped_refptr<Layer> root = Layer::Create(); | 2853 scoped_refptr<Layer> root = Layer::Create(); |
| (...skipping 6010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8864 SetLayerPropertiesForTesting(animated.get(), identity_matrix, gfx::Point3F(), | 8864 SetLayerPropertiesForTesting(animated.get(), identity_matrix, gfx::Point3F(), |
| 8865 gfx::PointF(), gfx::Size(20, 20), true, false); | 8865 gfx::PointF(), gfx::Size(20, 20), true, false); |
| 8866 | 8866 |
| 8867 root->SetMasksToBounds(true); | 8867 root->SetMasksToBounds(true); |
| 8868 root->SetForceRenderSurface(true); | 8868 root->SetForceRenderSurface(true); |
| 8869 animated->SetOpacity(0.f); | 8869 animated->SetOpacity(0.f); |
| 8870 | 8870 |
| 8871 AddOpacityTransitionToController(animated->layer_animation_controller(), 10.0, | 8871 AddOpacityTransitionToController(animated->layer_animation_controller(), 10.0, |
| 8872 0.f, 1.f, false); | 8872 0.f, 1.f, false); |
| 8873 | 8873 |
| 8874 ExecuteCalculateDrawProperties(root.get()); | 8874 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 8875 | 8875 |
| 8876 EXPECT_FALSE(animated->visible_rect_from_property_trees().IsEmpty()); | 8876 EXPECT_FALSE(animated->visible_rect_from_property_trees().IsEmpty()); |
| 8877 } | 8877 } |
| 8878 | 8878 |
| 8879 TEST_F(LayerTreeHostCommonTest, | 8879 TEST_F(LayerTreeHostCommonTest, |
| 8880 VisibleContentRectForAnimatedLayerWithSingularTransform) { | 8880 VisibleContentRectForAnimatedLayerWithSingularTransform) { |
| 8881 const gfx::Transform identity_matrix; | 8881 const gfx::Transform identity_matrix; |
| 8882 scoped_refptr<Layer> root = Layer::Create(); | 8882 scoped_refptr<Layer> root = Layer::Create(); |
| 8883 scoped_refptr<Layer> clip = Layer::Create(); | 8883 scoped_refptr<Layer> clip = Layer::Create(); |
| 8884 scoped_refptr<LayerWithForcedDrawsContent> animated = | 8884 scoped_refptr<LayerWithForcedDrawsContent> animated = |
| (...skipping 30 matching lines...) Expand all Loading... |
| 8915 gfx::Point3F(), gfx::PointF(), | 8915 gfx::Point3F(), gfx::PointF(), |
| 8916 gfx::Size(200, 200), true, false); | 8916 gfx::Size(200, 200), true, false); |
| 8917 | 8917 |
| 8918 TransformOperations start_transform_operations; | 8918 TransformOperations start_transform_operations; |
| 8919 start_transform_operations.AppendMatrix(uninvertible_matrix); | 8919 start_transform_operations.AppendMatrix(uninvertible_matrix); |
| 8920 TransformOperations end_transform_operations; | 8920 TransformOperations end_transform_operations; |
| 8921 | 8921 |
| 8922 AddAnimatedTransformToLayer(animated.get(), 10.0, start_transform_operations, | 8922 AddAnimatedTransformToLayer(animated.get(), 10.0, start_transform_operations, |
| 8923 end_transform_operations); | 8923 end_transform_operations); |
| 8924 | 8924 |
| 8925 ExecuteCalculateDrawProperties(root.get()); | 8925 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 8926 | 8926 |
| 8927 // The animated layer has a singular transform and maps to a non-empty rect in | 8927 // The animated layer has a singular transform and maps to a non-empty rect in |
| 8928 // clipped target space, so is treated as fully visible. | 8928 // clipped target space, so is treated as fully visible. |
| 8929 EXPECT_EQ(gfx::Rect(120, 120), animated->visible_rect_from_property_trees()); | 8929 EXPECT_EQ(gfx::Rect(120, 120), animated->visible_rect_from_property_trees()); |
| 8930 | 8930 |
| 8931 // The singular transform on |animated| is flattened when inherited by | 8931 // The singular transform on |animated| is flattened when inherited by |
| 8932 // |surface|, and this happens to make it invertible. | 8932 // |surface|, and this happens to make it invertible. |
| 8933 EXPECT_EQ(gfx::Rect(2, 2), surface->visible_rect_from_property_trees()); | 8933 EXPECT_EQ(gfx::Rect(2, 2), surface->visible_rect_from_property_trees()); |
| 8934 EXPECT_EQ(gfx::Rect(2, 2), | 8934 EXPECT_EQ(gfx::Rect(2, 2), |
| 8935 descendant_of_animation->visible_rect_from_property_trees()); | 8935 descendant_of_animation->visible_rect_from_property_trees()); |
| 8936 | 8936 |
| 8937 gfx::Transform zero_matrix; | 8937 gfx::Transform zero_matrix; |
| 8938 zero_matrix.Scale3d(0.f, 0.f, 0.f); | 8938 zero_matrix.Scale3d(0.f, 0.f, 0.f); |
| 8939 SetLayerPropertiesForTesting(animated.get(), zero_matrix, gfx::Point3F(), | 8939 SetLayerPropertiesForTesting(animated.get(), zero_matrix, gfx::Point3F(), |
| 8940 gfx::PointF(), gfx::Size(120, 120), true, false); | 8940 gfx::PointF(), gfx::Size(120, 120), true, false); |
| 8941 | 8941 |
| 8942 ExecuteCalculateDrawProperties(root.get()); | 8942 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 8943 | 8943 |
| 8944 // The animated layer maps to the empty rect in clipped target space, so is | 8944 // The animated layer maps to the empty rect in clipped target space, so is |
| 8945 // treated as having an empty visible rect. | 8945 // treated as having an empty visible rect. |
| 8946 EXPECT_EQ(gfx::Rect(), animated->visible_rect_from_property_trees()); | 8946 EXPECT_EQ(gfx::Rect(), animated->visible_rect_from_property_trees()); |
| 8947 | 8947 |
| 8948 // This time, flattening does not make |animated|'s transform invertible. This | 8948 // This time, flattening does not make |animated|'s transform invertible. This |
| 8949 // means the clip cannot be projected into |surface|'s space, so we treat | 8949 // means the clip cannot be projected into |surface|'s space, so we treat |
| 8950 // |surface| and layers that draw into it as fully visible. | 8950 // |surface| and layers that draw into it as fully visible. |
| 8951 EXPECT_EQ(gfx::Rect(100, 100), surface->visible_rect_from_property_trees()); | 8951 EXPECT_EQ(gfx::Rect(100, 100), surface->visible_rect_from_property_trees()); |
| 8952 EXPECT_EQ(gfx::Rect(200, 200), | 8952 EXPECT_EQ(gfx::Rect(200, 200), |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9015 root->SetIsContainerForFixedPositionLayers(true); | 9015 root->SetIsContainerForFixedPositionLayers(true); |
| 9016 LayerPositionConstraint constraint; | 9016 LayerPositionConstraint constraint; |
| 9017 constraint.set_is_fixed_position(true); | 9017 constraint.set_is_fixed_position(true); |
| 9018 grandchild->SetPositionConstraint(constraint); | 9018 grandchild->SetPositionConstraint(constraint); |
| 9019 | 9019 |
| 9020 root->SetIsContainerForFixedPositionLayers(true); | 9020 root->SetIsContainerForFixedPositionLayers(true); |
| 9021 | 9021 |
| 9022 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 9022 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 9023 host->SetRootLayer(root); | 9023 host->SetRootLayer(root); |
| 9024 | 9024 |
| 9025 ExecuteCalculateDrawProperties(root.get()); | 9025 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9026 | 9026 |
| 9027 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), | 9027 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), |
| 9028 grandchild->visible_rect_from_property_trees()); | 9028 grandchild->visible_rect_from_property_trees()); |
| 9029 } | 9029 } |
| 9030 | 9030 |
| 9031 TEST_F(LayerTreeHostCommonTest, CombineClipsUsingContentTarget) { | 9031 TEST_F(LayerTreeHostCommonTest, CombineClipsUsingContentTarget) { |
| 9032 // In the following layer tree, the layer |box|'s render target is |surface|. | 9032 // In the following layer tree, the layer |box|'s render target is |surface|. |
| 9033 // |surface| also creates a transform node. We want to combine clips for |box| | 9033 // |surface| also creates a transform node. We want to combine clips for |box| |
| 9034 // in the space of its target (i.e., |surface|), not its target's target. This | 9034 // in the space of its target (i.e., |surface|), not its target's target. This |
| 9035 // test ensures that happens. | 9035 // test ensures that happens. |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9107 LayerPositionConstraint constraint; | 9107 LayerPositionConstraint constraint; |
| 9108 constraint.set_is_fixed_position(true); | 9108 constraint.set_is_fixed_position(true); |
| 9109 fixed->SetPositionConstraint(constraint); | 9109 fixed->SetPositionConstraint(constraint); |
| 9110 | 9110 |
| 9111 root->AddChild(frame_clip); | 9111 root->AddChild(frame_clip); |
| 9112 frame_clip->AddChild(fixed); | 9112 frame_clip->AddChild(fixed); |
| 9113 | 9113 |
| 9114 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 9114 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 9115 host->SetRootLayer(root); | 9115 host->SetRootLayer(root); |
| 9116 | 9116 |
| 9117 ExecuteCalculateDrawProperties(root.get()); | 9117 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9118 | 9118 |
| 9119 gfx::Rect expected(0, 0, 100, 100); | 9119 gfx::Rect expected(0, 0, 100, 100); |
| 9120 EXPECT_EQ(expected, fixed->visible_rect_from_property_trees()); | 9120 EXPECT_EQ(expected, fixed->visible_rect_from_property_trees()); |
| 9121 } | 9121 } |
| 9122 | 9122 |
| 9123 TEST_F(LayerTreeHostCommonTest, | 9123 TEST_F(LayerTreeHostCommonTest, |
| 9124 PropertyTreesAccountForScrollCompensationAdjustment) { | 9124 PropertyTreesAccountForScrollCompensationAdjustment) { |
| 9125 gfx::Transform identity; | 9125 gfx::Transform identity; |
| 9126 gfx::Transform translate_z; | 9126 gfx::Transform translate_z; |
| 9127 translate_z.Translate3d(0, 0, 10); | 9127 translate_z.Translate3d(0, 0, 10); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9164 fixed_child->SetPositionConstraint(constraint); | 9164 fixed_child->SetPositionConstraint(constraint); |
| 9165 | 9165 |
| 9166 root->AddChild(frame_clip); | 9166 root->AddChild(frame_clip); |
| 9167 frame_clip->AddChild(scroller); | 9167 frame_clip->AddChild(scroller); |
| 9168 scroller->AddChild(fixed); | 9168 scroller->AddChild(fixed); |
| 9169 fixed->AddChild(fixed_child); | 9169 fixed->AddChild(fixed_child); |
| 9170 | 9170 |
| 9171 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 9171 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 9172 host->SetRootLayer(root); | 9172 host->SetRootLayer(root); |
| 9173 | 9173 |
| 9174 ExecuteCalculateDrawProperties(root.get()); | 9174 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9175 | 9175 |
| 9176 gfx::Rect expected(0, 0, 50, 50); | 9176 gfx::Rect expected(0, 0, 50, 50); |
| 9177 EXPECT_EQ(expected, fixed->visible_rect_from_property_trees()); | 9177 EXPECT_EQ(expected, fixed->visible_rect_from_property_trees()); |
| 9178 | 9178 |
| 9179 expected = gfx::Rect(0, 0, 10, 10); | 9179 expected = gfx::Rect(0, 0, 10, 10); |
| 9180 EXPECT_EQ(expected, fixed_child->visible_rect_from_property_trees()); | 9180 EXPECT_EQ(expected, fixed_child->visible_rect_from_property_trees()); |
| 9181 } | 9181 } |
| 9182 | 9182 |
| 9183 TEST_F(LayerTreeHostCommonTest, FixedClipsShouldBeAssociatedWithTheRightNode) { | 9183 TEST_F(LayerTreeHostCommonTest, FixedClipsShouldBeAssociatedWithTheRightNode) { |
| 9184 gfx::Transform identity; | 9184 gfx::Transform identity; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 9215 fixed->SetForceRenderSurface(true); | 9215 fixed->SetForceRenderSurface(true); |
| 9216 fixed->SetMasksToBounds(true); | 9216 fixed->SetMasksToBounds(true); |
| 9217 | 9217 |
| 9218 root->AddChild(frame_clip); | 9218 root->AddChild(frame_clip); |
| 9219 frame_clip->AddChild(scroller); | 9219 frame_clip->AddChild(scroller); |
| 9220 scroller->AddChild(fixed); | 9220 scroller->AddChild(fixed); |
| 9221 | 9221 |
| 9222 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 9222 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 9223 host->SetRootLayer(root); | 9223 host->SetRootLayer(root); |
| 9224 | 9224 |
| 9225 ExecuteCalculateDrawProperties(root.get()); | 9225 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9226 | 9226 |
| 9227 gfx::Rect expected(0, 0, 50, 50); | 9227 gfx::Rect expected(0, 0, 50, 50); |
| 9228 EXPECT_EQ(expected, fixed->visible_rect_from_property_trees()); | 9228 EXPECT_EQ(expected, fixed->visible_rect_from_property_trees()); |
| 9229 } | 9229 } |
| 9230 | 9230 |
| 9231 TEST_F(LayerTreeHostCommonTest, ChangingAxisAlignmentTriggersRebuild) { | 9231 TEST_F(LayerTreeHostCommonTest, ChangingAxisAlignmentTriggersRebuild) { |
| 9232 gfx::Transform identity; | 9232 gfx::Transform identity; |
| 9233 gfx::Transform translate; | 9233 gfx::Transform translate; |
| 9234 gfx::Transform rotate; | 9234 gfx::Transform rotate; |
| 9235 | 9235 |
| 9236 translate.Translate(10, 10); | 9236 translate.Translate(10, 10); |
| 9237 rotate.Rotate(45); | 9237 rotate.Rotate(45); |
| 9238 | 9238 |
| 9239 scoped_refptr<Layer> root = Layer::Create(); | 9239 scoped_refptr<Layer> root = Layer::Create(); |
| 9240 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 9240 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 9241 gfx::PointF(), gfx::Size(800, 800), true, false); | 9241 gfx::PointF(), gfx::Size(800, 800), true, false); |
| 9242 root->SetIsContainerForFixedPositionLayers(true); | 9242 root->SetIsContainerForFixedPositionLayers(true); |
| 9243 | 9243 |
| 9244 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 9244 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 9245 host->SetRootLayer(root); | 9245 host->SetRootLayer(root); |
| 9246 | 9246 |
| 9247 ExecuteCalculateDrawProperties(root.get()); | 9247 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9248 EXPECT_FALSE(host->property_trees()->needs_rebuild); |
| 9248 | 9249 |
| 9249 root->SetTransform(translate); | 9250 root->SetTransform(translate); |
| 9250 EXPECT_FALSE(host->property_trees()->needs_rebuild); | 9251 EXPECT_FALSE(host->property_trees()->needs_rebuild); |
| 9251 | 9252 |
| 9252 root->SetTransform(rotate); | 9253 root->SetTransform(rotate); |
| 9253 EXPECT_TRUE(host->property_trees()->needs_rebuild); | 9254 EXPECT_TRUE(host->property_trees()->needs_rebuild); |
| 9254 } | 9255 } |
| 9255 | 9256 |
| 9256 TEST_F(LayerTreeHostCommonTest, ChangeTransformOrigin) { | 9257 TEST_F(LayerTreeHostCommonTest, ChangeTransformOrigin) { |
| 9257 scoped_refptr<Layer> root = Layer::Create(); | 9258 scoped_refptr<Layer> root = Layer::Create(); |
| 9258 scoped_refptr<LayerWithForcedDrawsContent> child = | 9259 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 9259 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 9260 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 9260 root->AddChild(child); | 9261 root->AddChild(child); |
| 9261 | 9262 |
| 9262 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 9263 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 9263 host->SetRootLayer(root); | 9264 host->SetRootLayer(root); |
| 9264 | 9265 |
| 9265 gfx::Transform identity_matrix; | 9266 gfx::Transform identity_matrix; |
| 9266 gfx::Transform scale_matrix; | 9267 gfx::Transform scale_matrix; |
| 9267 scale_matrix.Scale(2.f, 2.f); | 9268 scale_matrix.Scale(2.f, 2.f); |
| 9268 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), | 9269 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
| 9269 gfx::PointF(), gfx::Size(100, 100), true, false); | 9270 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 9270 SetLayerPropertiesForTesting(child.get(), scale_matrix, gfx::Point3F(), | 9271 SetLayerPropertiesForTesting(child.get(), scale_matrix, gfx::Point3F(), |
| 9271 gfx::PointF(), gfx::Size(10, 10), true, false); | 9272 gfx::PointF(), gfx::Size(10, 10), true, false); |
| 9272 | 9273 |
| 9273 ExecuteCalculateDrawProperties(root.get()); | 9274 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9274 EXPECT_EQ(gfx::Rect(10, 10), child->visible_rect_from_property_trees()); | 9275 EXPECT_EQ(gfx::Rect(10, 10), child->visible_rect_from_property_trees()); |
| 9275 | 9276 |
| 9276 child->SetTransformOrigin(gfx::Point3F(10.f, 10.f, 10.f)); | 9277 child->SetTransformOrigin(gfx::Point3F(10.f, 10.f, 10.f)); |
| 9277 | 9278 |
| 9278 ExecuteCalculateDrawProperties(root.get()); | 9279 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9279 EXPECT_EQ(gfx::Rect(5, 5, 5, 5), child->visible_rect_from_property_trees()); | 9280 EXPECT_EQ(gfx::Rect(5, 5, 5, 5), child->visible_rect_from_property_trees()); |
| 9280 } | 9281 } |
| 9281 | 9282 |
| 9282 TEST_F(LayerTreeHostCommonTest, UpdateScrollChildPosition) { | 9283 TEST_F(LayerTreeHostCommonTest, UpdateScrollChildPosition) { |
| 9283 scoped_refptr<Layer> root = Layer::Create(); | 9284 scoped_refptr<Layer> root = Layer::Create(); |
| 9284 scoped_refptr<LayerWithForcedDrawsContent> scroll_parent = | 9285 scoped_refptr<LayerWithForcedDrawsContent> scroll_parent = |
| 9285 make_scoped_refptr(new LayerWithForcedDrawsContent); | 9286 make_scoped_refptr(new LayerWithForcedDrawsContent); |
| 9286 scoped_refptr<LayerWithForcedDrawsContent> scroll_child = | 9287 scoped_refptr<LayerWithForcedDrawsContent> scroll_child = |
| 9287 make_scoped_refptr(new LayerWithForcedDrawsContent); | 9288 make_scoped_refptr(new LayerWithForcedDrawsContent); |
| 9288 | 9289 |
| 9289 root->AddChild(scroll_child); | 9290 root->AddChild(scroll_child); |
| 9290 root->AddChild(scroll_parent); | 9291 root->AddChild(scroll_parent); |
| 9291 scroll_child->SetScrollParent(scroll_parent.get()); | 9292 scroll_child->SetScrollParent(scroll_parent.get()); |
| 9292 scroll_parent->SetScrollClipLayerId(root->id()); | 9293 scroll_parent->SetScrollClipLayerId(root->id()); |
| 9293 | 9294 |
| 9294 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 9295 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 9295 host->SetRootLayer(root); | 9296 host->SetRootLayer(root); |
| 9296 | 9297 |
| 9297 gfx::Transform identity_transform; | 9298 gfx::Transform identity_transform; |
| 9298 gfx::Transform scale; | 9299 gfx::Transform scale; |
| 9299 scale.Scale(2.f, 2.f); | 9300 scale.Scale(2.f, 2.f); |
| 9300 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), | 9301 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), |
| 9301 gfx::PointF(), gfx::Size(50, 50), true, false); | 9302 gfx::PointF(), gfx::Size(50, 50), true, false); |
| 9302 SetLayerPropertiesForTesting(scroll_child.get(), scale, gfx::Point3F(), | 9303 SetLayerPropertiesForTesting(scroll_child.get(), scale, gfx::Point3F(), |
| 9303 gfx::PointF(), gfx::Size(40, 40), true, false); | 9304 gfx::PointF(), gfx::Size(40, 40), true, false); |
| 9304 SetLayerPropertiesForTesting(scroll_parent.get(), identity_transform, | 9305 SetLayerPropertiesForTesting(scroll_parent.get(), identity_transform, |
| 9305 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30), | 9306 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30), |
| 9306 true, false); | 9307 true, false); |
| 9307 | 9308 |
| 9308 ExecuteCalculateDrawProperties(root.get()); | 9309 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9309 EXPECT_EQ(gfx::Rect(25, 25), | 9310 EXPECT_EQ(gfx::Rect(25, 25), |
| 9310 scroll_child->visible_rect_from_property_trees()); | 9311 scroll_child->visible_rect_from_property_trees()); |
| 9311 | 9312 |
| 9312 scroll_child->SetPosition(gfx::PointF(0, -10.f)); | 9313 scroll_child->SetPosition(gfx::PointF(0, -10.f)); |
| 9313 scroll_parent->SetScrollOffset(gfx::ScrollOffset(0.f, 10.f)); | 9314 scroll_parent->SetScrollOffset(gfx::ScrollOffset(0.f, 10.f)); |
| 9314 ExecuteCalculateDrawProperties(root.get()); | 9315 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9315 EXPECT_EQ(gfx::Rect(0, 5, 25, 25), | 9316 EXPECT_EQ(gfx::Rect(0, 5, 25, 25), |
| 9316 scroll_child->visible_rect_from_property_trees()); | 9317 scroll_child->visible_rect_from_property_trees()); |
| 9317 } | 9318 } |
| 9318 | 9319 |
| 9319 static void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) { | 9320 static void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) { |
| 9320 } | 9321 } |
| 9321 | 9322 |
| 9322 TEST_F(LayerTreeHostCommonTest, SkippingSubtreeMain) { | 9323 TEST_F(LayerTreeHostCommonTest, SkippingSubtreeMain) { |
| 9323 gfx::Transform identity; | 9324 gfx::Transform identity; |
| 9324 FakeContentLayerClient client; | 9325 FakeContentLayerClient client; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 9339 gfx::PointF(), gfx::Size(10, 10), true, false); | 9340 gfx::PointF(), gfx::Size(10, 10), true, false); |
| 9340 | 9341 |
| 9341 root->AddChild(child); | 9342 root->AddChild(child); |
| 9342 child->AddChild(grandchild); | 9343 child->AddChild(grandchild); |
| 9343 grandchild->AddChild(greatgrandchild); | 9344 grandchild->AddChild(greatgrandchild); |
| 9344 | 9345 |
| 9345 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 9346 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 9346 host->SetRootLayer(root); | 9347 host->SetRootLayer(root); |
| 9347 | 9348 |
| 9348 // Check the non-skipped case. | 9349 // Check the non-skipped case. |
| 9349 ExecuteCalculateDrawProperties(root.get()); | 9350 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9350 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_rect_from_property_trees()); | 9351 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_rect_from_property_trees()); |
| 9351 | 9352 |
| 9352 // Now we will reset the visible rect from property trees for the grandchild, | 9353 // Now we will reset the visible rect from property trees for the grandchild, |
| 9353 // and we will configure |child| in several ways that should force the subtree | 9354 // and we will configure |child| in several ways that should force the subtree |
| 9354 // to be skipped. The visible content rect for |grandchild| should, therefore, | 9355 // to be skipped. The visible content rect for |grandchild| should, therefore, |
| 9355 // remain empty. | 9356 // remain empty. |
| 9356 grandchild->set_visible_rect_from_property_trees(gfx::Rect()); | 9357 grandchild->set_visible_rect_from_property_trees(gfx::Rect()); |
| 9357 gfx::Transform singular; | 9358 gfx::Transform singular; |
| 9358 singular.matrix().set(0, 0, 0); | 9359 singular.matrix().set(0, 0, 0); |
| 9359 | 9360 |
| 9360 child->SetTransform(singular); | 9361 child->SetTransform(singular); |
| 9361 ExecuteCalculateDrawProperties(root.get()); | 9362 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9362 EXPECT_EQ(gfx::Rect(0, 0), grandchild->visible_rect_from_property_trees()); | 9363 EXPECT_EQ(gfx::Rect(0, 0), grandchild->visible_rect_from_property_trees()); |
| 9363 child->SetTransform(identity); | 9364 child->SetTransform(identity); |
| 9364 | 9365 |
| 9365 child->SetHideLayerAndSubtree(true); | 9366 child->SetHideLayerAndSubtree(true); |
| 9366 ExecuteCalculateDrawProperties(root.get()); | 9367 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9367 EXPECT_EQ(gfx::Rect(0, 0), grandchild->visible_rect_from_property_trees()); | 9368 EXPECT_EQ(gfx::Rect(0, 0), grandchild->visible_rect_from_property_trees()); |
| 9368 child->SetHideLayerAndSubtree(false); | 9369 child->SetHideLayerAndSubtree(false); |
| 9369 | 9370 |
| 9370 child->SetOpacity(0.f); | 9371 child->SetOpacity(0.f); |
| 9371 ExecuteCalculateDrawProperties(root.get()); | 9372 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9372 EXPECT_EQ(gfx::Rect(0, 0), grandchild->visible_rect_from_property_trees()); | 9373 EXPECT_EQ(gfx::Rect(0, 0), grandchild->visible_rect_from_property_trees()); |
| 9373 | 9374 |
| 9374 // Now, even though child has zero opacity, we will configure |grandchild| and | 9375 // Now, even though child has zero opacity, we will configure |grandchild| and |
| 9375 // |greatgrandchild| in several ways that should force the subtree to be | 9376 // |greatgrandchild| in several ways that should force the subtree to be |
| 9376 // processed anyhow. | 9377 // processed anyhow. |
| 9377 grandchild->SetTouchEventHandlerRegion(Region(gfx::Rect(0, 0, 10, 10))); | 9378 grandchild->SetTouchEventHandlerRegion(Region(gfx::Rect(0, 0, 10, 10))); |
| 9378 ExecuteCalculateDrawProperties(root.get()); | 9379 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9379 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_rect_from_property_trees()); | 9380 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_rect_from_property_trees()); |
| 9380 grandchild->set_visible_rect_from_property_trees(gfx::Rect()); | 9381 grandchild->set_visible_rect_from_property_trees(gfx::Rect()); |
| 9381 grandchild->SetTouchEventHandlerRegion(Region()); | 9382 grandchild->SetTouchEventHandlerRegion(Region()); |
| 9382 ExecuteCalculateDrawProperties(root.get()); | 9383 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9383 EXPECT_EQ(gfx::Rect(0, 0), grandchild->visible_rect_from_property_trees()); | 9384 EXPECT_EQ(gfx::Rect(0, 0), grandchild->visible_rect_from_property_trees()); |
| 9384 grandchild->set_visible_rect_from_property_trees(gfx::Rect()); | 9385 grandchild->set_visible_rect_from_property_trees(gfx::Rect()); |
| 9385 | 9386 |
| 9386 greatgrandchild->RequestCopyOfOutput( | 9387 greatgrandchild->RequestCopyOfOutput( |
| 9387 CopyOutputRequest::CreateBitmapRequest(base::Bind(&CopyOutputCallback))); | 9388 CopyOutputRequest::CreateBitmapRequest(base::Bind(&CopyOutputCallback))); |
| 9388 ExecuteCalculateDrawProperties(root.get()); | 9389 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9389 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_rect_from_property_trees()); | 9390 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_rect_from_property_trees()); |
| 9390 } | 9391 } |
| 9391 | 9392 |
| 9392 TEST_F(LayerTreeHostCommonTest, SkippingSubtreeImpl) { | 9393 TEST_F(LayerTreeHostCommonTest, SkippingSubtreeImpl) { |
| 9393 FakeImplProxy proxy; | 9394 FakeImplProxy proxy; |
| 9394 TestSharedBitmapManager shared_bitmap_manager; | 9395 TestSharedBitmapManager shared_bitmap_manager; |
| 9395 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); | 9396 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); |
| 9396 | 9397 |
| 9397 gfx::Transform identity; | 9398 gfx::Transform identity; |
| 9398 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); | 9399 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 9422 | 9423 |
| 9423 LayerImpl* child_ptr = child.get(); | 9424 LayerImpl* child_ptr = child.get(); |
| 9424 LayerImpl* grandchild_ptr = grandchild.get(); | 9425 LayerImpl* grandchild_ptr = grandchild.get(); |
| 9425 LayerImpl* greatgrandchild_ptr = greatgrandchild.get(); | 9426 LayerImpl* greatgrandchild_ptr = greatgrandchild.get(); |
| 9426 | 9427 |
| 9427 grandchild->AddChild(greatgrandchild.Pass()); | 9428 grandchild->AddChild(greatgrandchild.Pass()); |
| 9428 child->AddChild(grandchild.Pass()); | 9429 child->AddChild(grandchild.Pass()); |
| 9429 root->AddChild(child.Pass()); | 9430 root->AddChild(child.Pass()); |
| 9430 | 9431 |
| 9431 // Check the non-skipped case. | 9432 // Check the non-skipped case. |
| 9432 ExecuteCalculateDrawProperties(root.get()); | 9433 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9433 EXPECT_EQ(gfx::Rect(10, 10), | 9434 EXPECT_EQ(gfx::Rect(10, 10), |
| 9434 grandchild_ptr->visible_rect_from_property_trees()); | 9435 grandchild_ptr->visible_rect_from_property_trees()); |
| 9435 | 9436 |
| 9436 // Now we will reset the visible rect from property trees for the grandchild, | 9437 // Now we will reset the visible rect from property trees for the grandchild, |
| 9437 // and we will configure |child| in several ways that should force the subtree | 9438 // and we will configure |child| in several ways that should force the subtree |
| 9438 // to be skipped. The visible content rect for |grandchild| should, therefore, | 9439 // to be skipped. The visible content rect for |grandchild| should, therefore, |
| 9439 // remain empty. | 9440 // remain empty. |
| 9440 grandchild_ptr->set_visible_rect_from_property_trees(gfx::Rect()); | 9441 grandchild_ptr->set_visible_rect_from_property_trees(gfx::Rect()); |
| 9441 gfx::Transform singular; | 9442 gfx::Transform singular; |
| 9442 singular.matrix().set(0, 0, 0); | 9443 singular.matrix().set(0, 0, 0); |
| 9443 | 9444 |
| 9444 child_ptr->SetTransform(singular); | 9445 child_ptr->SetTransform(singular); |
| 9445 ExecuteCalculateDrawProperties(root.get()); | 9446 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9446 EXPECT_EQ(gfx::Rect(0, 0), | 9447 EXPECT_EQ(gfx::Rect(0, 0), |
| 9447 grandchild_ptr->visible_rect_from_property_trees()); | 9448 grandchild_ptr->visible_rect_from_property_trees()); |
| 9448 child_ptr->SetTransform(identity); | 9449 child_ptr->SetTransform(identity); |
| 9449 | 9450 |
| 9450 child_ptr->SetHideLayerAndSubtree(true); | 9451 child_ptr->SetHideLayerAndSubtree(true); |
| 9451 ExecuteCalculateDrawProperties(root.get()); | 9452 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9452 EXPECT_EQ(gfx::Rect(0, 0), | 9453 EXPECT_EQ(gfx::Rect(0, 0), |
| 9453 grandchild_ptr->visible_rect_from_property_trees()); | 9454 grandchild_ptr->visible_rect_from_property_trees()); |
| 9454 child_ptr->SetHideLayerAndSubtree(false); | 9455 child_ptr->SetHideLayerAndSubtree(false); |
| 9455 | 9456 |
| 9456 child_ptr->SetOpacity(0.f); | 9457 child_ptr->SetOpacity(0.f); |
| 9457 ExecuteCalculateDrawProperties(root.get()); | 9458 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9458 EXPECT_EQ(gfx::Rect(0, 0), | 9459 EXPECT_EQ(gfx::Rect(0, 0), |
| 9459 grandchild_ptr->visible_rect_from_property_trees()); | 9460 grandchild_ptr->visible_rect_from_property_trees()); |
| 9460 | 9461 |
| 9461 // Now, even though child has zero opacity, we will configure |grandchild| and | 9462 // Now, even though child has zero opacity, we will configure |grandchild| and |
| 9462 // |greatgrandchild| in several ways that should force the subtree to be | 9463 // |greatgrandchild| in several ways that should force the subtree to be |
| 9463 // processed anyhow. | 9464 // processed anyhow. |
| 9464 grandchild_ptr->SetTouchEventHandlerRegion(Region(gfx::Rect(0, 0, 10, 10))); | 9465 grandchild_ptr->SetTouchEventHandlerRegion(Region(gfx::Rect(0, 0, 10, 10))); |
| 9465 ExecuteCalculateDrawProperties(root.get()); | 9466 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9466 EXPECT_EQ(gfx::Rect(10, 10), | 9467 EXPECT_EQ(gfx::Rect(10, 10), |
| 9467 grandchild_ptr->visible_rect_from_property_trees()); | 9468 grandchild_ptr->visible_rect_from_property_trees()); |
| 9468 grandchild_ptr->set_visible_rect_from_property_trees(gfx::Rect()); | 9469 grandchild_ptr->set_visible_rect_from_property_trees(gfx::Rect()); |
| 9469 grandchild_ptr->SetTouchEventHandlerRegion(Region()); | 9470 grandchild_ptr->SetTouchEventHandlerRegion(Region()); |
| 9470 ExecuteCalculateDrawProperties(root.get()); | 9471 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9471 EXPECT_EQ(gfx::Rect(0, 0), | 9472 EXPECT_EQ(gfx::Rect(0, 0), |
| 9472 grandchild_ptr->visible_rect_from_property_trees()); | 9473 grandchild_ptr->visible_rect_from_property_trees()); |
| 9473 grandchild_ptr->set_visible_rect_from_property_trees(gfx::Rect()); | 9474 grandchild_ptr->set_visible_rect_from_property_trees(gfx::Rect()); |
| 9474 | 9475 |
| 9475 ScopedPtrVector<CopyOutputRequest> requests; | 9476 ScopedPtrVector<CopyOutputRequest> requests; |
| 9476 requests.push_back(CopyOutputRequest::CreateEmptyRequest()); | 9477 requests.push_back(CopyOutputRequest::CreateEmptyRequest()); |
| 9477 | 9478 |
| 9478 greatgrandchild_ptr->PassCopyRequests(&requests); | 9479 greatgrandchild_ptr->PassCopyRequests(&requests); |
| 9479 ExecuteCalculateDrawProperties(root.get()); | 9480 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9480 EXPECT_EQ(gfx::Rect(10, 10), | 9481 EXPECT_EQ(gfx::Rect(10, 10), |
| 9481 grandchild_ptr->visible_rect_from_property_trees()); | 9482 grandchild_ptr->visible_rect_from_property_trees()); |
| 9482 } | 9483 } |
| 9483 | 9484 |
| 9484 TEST_F(LayerTreeHostCommonTest, SkippingLayer) { | 9485 TEST_F(LayerTreeHostCommonTest, SkippingLayer) { |
| 9485 gfx::Transform identity; | 9486 gfx::Transform identity; |
| 9486 FakeContentLayerClient client; | 9487 FakeContentLayerClient client; |
| 9487 scoped_refptr<Layer> root = Layer::Create(); | 9488 scoped_refptr<Layer> root = Layer::Create(); |
| 9488 scoped_refptr<LayerWithForcedDrawsContent> child = | 9489 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 9489 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 9490 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 9490 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 9491 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 9491 gfx::PointF(), gfx::Size(100, 100), true, false); | 9492 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 9492 SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(), | 9493 SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(), |
| 9493 gfx::PointF(), gfx::Size(10, 10), true, false); | 9494 gfx::PointF(), gfx::Size(10, 10), true, false); |
| 9494 root->AddChild(child); | 9495 root->AddChild(child); |
| 9495 | 9496 |
| 9496 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 9497 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 9497 host->SetRootLayer(root); | 9498 host->SetRootLayer(root); |
| 9498 | 9499 |
| 9499 ExecuteCalculateDrawProperties(root.get()); | 9500 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9500 EXPECT_EQ(gfx::Rect(10, 10), child->visible_rect_from_property_trees()); | 9501 EXPECT_EQ(gfx::Rect(10, 10), child->visible_rect_from_property_trees()); |
| 9501 child->set_visible_rect_from_property_trees(gfx::Rect()); | 9502 child->set_visible_rect_from_property_trees(gfx::Rect()); |
| 9502 | 9503 |
| 9503 child->SetHideLayerAndSubtree(true); | 9504 child->SetHideLayerAndSubtree(true); |
| 9504 ExecuteCalculateDrawProperties(root.get()); | 9505 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9505 EXPECT_EQ(gfx::Rect(0, 0), child->visible_rect_from_property_trees()); | 9506 EXPECT_EQ(gfx::Rect(0, 0), child->visible_rect_from_property_trees()); |
| 9506 child->SetHideLayerAndSubtree(false); | 9507 child->SetHideLayerAndSubtree(false); |
| 9507 | 9508 |
| 9508 child->SetBounds(gfx::Size()); | 9509 child->SetBounds(gfx::Size()); |
| 9509 ExecuteCalculateDrawProperties(root.get()); | 9510 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9510 EXPECT_EQ(gfx::Rect(0, 0), child->visible_rect_from_property_trees()); | 9511 EXPECT_EQ(gfx::Rect(0, 0), child->visible_rect_from_property_trees()); |
| 9511 child->SetBounds(gfx::Size(10, 10)); | 9512 child->SetBounds(gfx::Size(10, 10)); |
| 9512 | 9513 |
| 9513 gfx::Transform rotate; | 9514 gfx::Transform rotate; |
| 9514 child->SetDoubleSided(false); | 9515 child->SetDoubleSided(false); |
| 9515 rotate.RotateAboutXAxis(180.f); | 9516 rotate.RotateAboutXAxis(180.f); |
| 9516 child->SetTransform(rotate); | 9517 child->SetTransform(rotate); |
| 9517 ExecuteCalculateDrawProperties(root.get()); | 9518 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9518 EXPECT_EQ(gfx::Rect(0, 0), child->visible_rect_from_property_trees()); | 9519 EXPECT_EQ(gfx::Rect(0, 0), child->visible_rect_from_property_trees()); |
| 9519 child->SetDoubleSided(true); | 9520 child->SetDoubleSided(true); |
| 9520 child->SetTransform(identity); | 9521 child->SetTransform(identity); |
| 9521 | 9522 |
| 9522 child->SetOpacity(0.f); | 9523 child->SetOpacity(0.f); |
| 9523 ExecuteCalculateDrawProperties(root.get()); | 9524 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9524 EXPECT_EQ(gfx::Rect(0, 0), child->visible_rect_from_property_trees()); | 9525 EXPECT_EQ(gfx::Rect(0, 0), child->visible_rect_from_property_trees()); |
| 9525 } | 9526 } |
| 9526 | 9527 |
| 9527 TEST_F(LayerTreeHostCommonTest, LayerTreeRebuildTest) { | 9528 TEST_F(LayerTreeHostCommonTest, LayerTreeRebuildTest) { |
| 9528 // Ensure that the treewalk in LayerTreeHostCommom:: | 9529 // Ensure that the treewalk in LayerTreeHostCommom:: |
| 9529 // PreCalculateMetaInformation happens when its required. | 9530 // PreCalculateMetaInformation happens when its required. |
| 9530 scoped_refptr<Layer> root = Layer::Create(); | 9531 scoped_refptr<Layer> root = Layer::Create(); |
| 9531 scoped_refptr<Layer> parent = Layer::Create(); | 9532 scoped_refptr<Layer> parent = Layer::Create(); |
| 9532 scoped_refptr<Layer> child = Layer::Create(); | 9533 scoped_refptr<Layer> child = Layer::Create(); |
| 9533 | 9534 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9591 | 9592 |
| 9592 EXPECT_EQ(root->num_layer_or_descendants_with_input_handler(), 0); | 9593 EXPECT_EQ(root->num_layer_or_descendants_with_input_handler(), 0); |
| 9593 ExecuteCalculateDrawProperties(root.get()); | 9594 ExecuteCalculateDrawProperties(root.get()); |
| 9594 EXPECT_EQ(root->num_layer_or_descendants_with_input_handler(), 1); | 9595 EXPECT_EQ(root->num_layer_or_descendants_with_input_handler(), 1); |
| 9595 child->SetHaveWheelEventHandlers(false); | 9596 child->SetHaveWheelEventHandlers(false); |
| 9596 EXPECT_EQ(root->num_layer_or_descendants_with_input_handler(), 0); | 9597 EXPECT_EQ(root->num_layer_or_descendants_with_input_handler(), 0); |
| 9597 } | 9598 } |
| 9598 | 9599 |
| 9599 } // namespace | 9600 } // namespace |
| 9600 } // namespace cc | 9601 } // namespace cc |
| OLD | NEW |