| 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 <memory> | 10 #include <memory> |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 } | 162 } |
| 163 | 163 |
| 164 template <class LayerType> | 164 template <class LayerType> |
| 165 void ExecuteCalculateDrawProperties(LayerType* root_layer, | 165 void ExecuteCalculateDrawProperties(LayerType* root_layer, |
| 166 float device_scale_factor) { | 166 float device_scale_factor) { |
| 167 LayerType* page_scale_application_layer = nullptr; | 167 LayerType* page_scale_application_layer = nullptr; |
| 168 ExecuteCalculateDrawProperties(root_layer, device_scale_factor, 1.f, | 168 ExecuteCalculateDrawProperties(root_layer, device_scale_factor, 1.f, |
| 169 page_scale_application_layer); | 169 page_scale_application_layer); |
| 170 } | 170 } |
| 171 | 171 |
| 172 const LayerList* GetUpdateLayerList() { return &update_layer_list_; } |
| 173 |
| 172 void ExecuteCalculateDrawPropertiesWithPropertyTrees(Layer* root_layer) { | 174 void ExecuteCalculateDrawPropertiesWithPropertyTrees(Layer* root_layer) { |
| 173 DCHECK(root_layer->layer_tree_host()); | 175 DCHECK(root_layer->layer_tree_host()); |
| 174 PropertyTreeBuilder::PreCalculateMetaInformation(root_layer); | 176 PropertyTreeBuilder::PreCalculateMetaInformation(root_layer); |
| 175 | 177 |
| 176 bool can_render_to_separate_surface = true; | 178 bool can_render_to_separate_surface = true; |
| 177 | 179 |
| 178 const Layer* page_scale_layer = | 180 const Layer* page_scale_layer = |
| 179 root_layer->layer_tree_host()->page_scale_layer(); | 181 root_layer->layer_tree_host()->page_scale_layer(); |
| 180 Layer* inner_viewport_scroll_layer = | 182 Layer* inner_viewport_scroll_layer = |
| 181 root_layer->layer_tree_host()->inner_viewport_scroll_layer(); | 183 root_layer->layer_tree_host()->inner_viewport_scroll_layer(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 196 PropertyTreeBuilder::BuildPropertyTrees( | 198 PropertyTreeBuilder::BuildPropertyTrees( |
| 197 root_layer, page_scale_layer, inner_viewport_scroll_layer, | 199 root_layer, page_scale_layer, inner_viewport_scroll_layer, |
| 198 outer_viewport_scroll_layer, overscroll_elasticity_layer, | 200 outer_viewport_scroll_layer, overscroll_elasticity_layer, |
| 199 elastic_overscroll, page_scale_factor, device_scale_factor, | 201 elastic_overscroll, page_scale_factor, device_scale_factor, |
| 200 gfx::Rect(device_viewport_size), gfx::Transform(), property_trees); | 202 gfx::Rect(device_viewport_size), gfx::Transform(), property_trees); |
| 201 draw_property_utils::UpdatePropertyTrees(property_trees, | 203 draw_property_utils::UpdatePropertyTrees(property_trees, |
| 202 can_render_to_separate_surface); | 204 can_render_to_separate_surface); |
| 203 draw_property_utils::FindLayersThatNeedUpdates( | 205 draw_property_utils::FindLayersThatNeedUpdates( |
| 204 root_layer->layer_tree_host(), property_trees->transform_tree, | 206 root_layer->layer_tree_host(), property_trees->transform_tree, |
| 205 property_trees->effect_tree, &update_layer_list_); | 207 property_trees->effect_tree, &update_layer_list_); |
| 206 draw_property_utils::ComputeVisibleRectsForTesting( | |
| 207 property_trees, can_render_to_separate_surface, &update_layer_list_); | |
| 208 } | 208 } |
| 209 | 209 |
| 210 void ExecuteCalculateDrawPropertiesWithPropertyTrees(LayerImpl* root_layer) { | 210 void ExecuteCalculateDrawPropertiesWithPropertyTrees(LayerImpl* root_layer) { |
| 211 DCHECK(root_layer->layer_tree_impl()); | 211 DCHECK(root_layer->layer_tree_impl()); |
| 212 PropertyTreeBuilder::PreCalculateMetaInformationForTesting(root_layer); | 212 PropertyTreeBuilder::PreCalculateMetaInformationForTesting(root_layer); |
| 213 | 213 |
| 214 bool can_render_to_separate_surface = true; | 214 bool can_render_to_separate_surface = true; |
| 215 | 215 |
| 216 LayerImpl* page_scale_layer = nullptr; | 216 LayerImpl* page_scale_layer = nullptr; |
| 217 LayerImpl* inner_viewport_scroll_layer = | 217 LayerImpl* inner_viewport_scroll_layer = |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 } | 273 } |
| 274 | 274 |
| 275 const LayerImplList* render_surface_layer_list_impl() const { | 275 const LayerImplList* render_surface_layer_list_impl() const { |
| 276 return render_surface_layer_list_impl_.get(); | 276 return render_surface_layer_list_impl_.get(); |
| 277 } | 277 } |
| 278 const LayerImplList* update_layer_list_impl() const { | 278 const LayerImplList* update_layer_list_impl() const { |
| 279 return update_layer_list_impl_.get(); | 279 return update_layer_list_impl_.get(); |
| 280 } | 280 } |
| 281 const LayerList& update_layer_list() const { return update_layer_list_; } | 281 const LayerList& update_layer_list() const { return update_layer_list_; } |
| 282 | 282 |
| 283 bool VerifyLayerInList(scoped_refptr<Layer> layer, |
| 284 const LayerList* layer_list) { |
| 285 return std::find(layer_list->begin(), layer_list->end(), layer) != |
| 286 layer_list->end(); |
| 287 } |
| 288 |
| 283 private: | 289 private: |
| 284 std::unique_ptr<std::vector<LayerImpl*>> render_surface_layer_list_impl_; | 290 std::unique_ptr<std::vector<LayerImpl*>> render_surface_layer_list_impl_; |
| 285 LayerList update_layer_list_; | 291 LayerList update_layer_list_; |
| 286 std::unique_ptr<LayerImplList> update_layer_list_impl_; | 292 std::unique_ptr<LayerImplList> update_layer_list_impl_; |
| 287 }; | 293 }; |
| 288 | 294 |
| 289 class LayerTreeHostCommonTest : public LayerTreeHostCommonTestBase, | 295 class LayerTreeHostCommonTest : public LayerTreeHostCommonTestBase, |
| 290 public testing::Test {}; | 296 public testing::Test {}; |
| 291 | 297 |
| 292 class LayerWithForcedDrawsContent : public Layer { | 298 class LayerWithForcedDrawsContent : public Layer { |
| (...skipping 7549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7842 EXPECT_TRUE(transform_tree.HasNodesAffectedByOuterViewportBoundsDelta()); | 7848 EXPECT_TRUE(transform_tree.HasNodesAffectedByOuterViewportBoundsDelta()); |
| 7843 | 7849 |
| 7844 fixed_to_outer->SetPositionConstraint(fixed_to_left); | 7850 fixed_to_outer->SetPositionConstraint(fixed_to_left); |
| 7845 | 7851 |
| 7846 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 7852 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 7847 EXPECT_FALSE(transform_tree.HasNodesAffectedByInnerViewportBoundsDelta()); | 7853 EXPECT_FALSE(transform_tree.HasNodesAffectedByInnerViewportBoundsDelta()); |
| 7848 EXPECT_FALSE(transform_tree.HasNodesAffectedByOuterViewportBoundsDelta()); | 7854 EXPECT_FALSE(transform_tree.HasNodesAffectedByOuterViewportBoundsDelta()); |
| 7849 } | 7855 } |
| 7850 | 7856 |
| 7851 TEST_F(LayerTreeHostCommonTest, VisibleContentRectForAnimatedLayer) { | 7857 TEST_F(LayerTreeHostCommonTest, VisibleContentRectForAnimatedLayer) { |
| 7852 scoped_refptr<Layer> root = Layer::Create(); | 7858 host_impl()->CreatePendingTree(); |
| 7853 scoped_refptr<LayerWithForcedDrawsContent> animated = | 7859 std::unique_ptr<LayerImpl> pending_root = |
| 7854 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 7860 LayerImpl::Create(host_impl()->pending_tree(), 1); |
| 7861 LayerImpl* root = pending_root.get(); |
| 7862 host_impl()->pending_tree()->SetRootLayerForTesting(std::move(pending_root)); |
| 7863 std::unique_ptr<LayerImpl> animated_ptr = |
| 7864 LayerImpl::Create(host_impl()->pending_tree(), 2); |
| 7865 LayerImpl* animated = animated_ptr.get(); |
| 7866 root->test_properties()->AddChild(std::move(animated_ptr)); |
| 7855 | 7867 |
| 7856 root->AddChild(animated); | 7868 animated->SetDrawsContent(true); |
| 7857 host()->SetRootLayer(root); | 7869 host_impl()->pending_tree()->SetElementIdsForTesting(); |
| 7858 host()->SetElementIdsForTesting(); | |
| 7859 | 7870 |
| 7860 root->SetBounds(gfx::Size(100, 100)); | 7871 root->SetBounds(gfx::Size(100, 100)); |
| 7861 root->SetMasksToBounds(true); | 7872 root->SetMasksToBounds(true); |
| 7862 root->SetForceRenderSurfaceForTesting(true); | 7873 root->test_properties()->force_render_surface = true; |
| 7863 animated->SetOpacity(0.f); | 7874 animated->test_properties()->opacity = 0.f; |
| 7864 animated->SetBounds(gfx::Size(20, 20)); | 7875 animated->SetBounds(gfx::Size(20, 20)); |
| 7865 | 7876 |
| 7866 AddOpacityTransitionToElementWithPlayer(animated->element_id(), timeline(), | 7877 AddOpacityTransitionToElementWithPlayer( |
| 7867 10.0, 0.f, 1.f, false); | 7878 animated->element_id(), timeline_impl(), 10.0, 0.f, 1.f, false); |
| 7868 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 7879 animated->test_properties()->opacity_can_animate = true; |
| 7880 root->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 7881 ExecuteCalculateDrawPropertiesWithPropertyTrees(root); |
| 7869 | 7882 |
| 7870 EXPECT_FALSE(animated->visible_layer_rect_for_testing().IsEmpty()); | 7883 EXPECT_FALSE(animated->visible_layer_rect().IsEmpty()); |
| 7871 } | 7884 } |
| 7872 | 7885 |
| 7873 TEST_F(LayerTreeHostCommonTest, | 7886 TEST_F(LayerTreeHostCommonTest, |
| 7874 VisibleContentRectForAnimatedLayerWithSingularTransform) { | 7887 VisibleContentRectForAnimatedLayerWithSingularTransform) { |
| 7875 scoped_refptr<Layer> root = Layer::Create(); | 7888 LayerImpl* root = root_layer_for_testing(); |
| 7876 scoped_refptr<Layer> clip = Layer::Create(); | 7889 LayerImpl* clip = AddChild<LayerImpl>(root); |
| 7877 scoped_refptr<LayerWithForcedDrawsContent> animated = | 7890 LayerImpl* animated = AddChild<LayerImpl>(clip); |
| 7878 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 7891 LayerImpl* surface = AddChild<LayerImpl>(animated); |
| 7879 scoped_refptr<LayerWithForcedDrawsContent> surface = | 7892 LayerImpl* descendant_of_animation = AddChild<LayerImpl>(surface); |
| 7880 make_scoped_refptr(new LayerWithForcedDrawsContent()); | |
| 7881 scoped_refptr<LayerWithForcedDrawsContent> descendant_of_animation = | |
| 7882 make_scoped_refptr(new LayerWithForcedDrawsContent()); | |
| 7883 | 7893 |
| 7884 root->AddChild(clip); | 7894 SetElementIdsForTesting(); |
| 7885 clip->AddChild(animated); | |
| 7886 animated->AddChild(surface); | |
| 7887 surface->AddChild(descendant_of_animation); | |
| 7888 | 7895 |
| 7889 host()->SetRootLayer(root); | 7896 animated->SetDrawsContent(true); |
| 7890 host()->SetElementIdsForTesting(); | 7897 surface->SetDrawsContent(true); |
| 7898 descendant_of_animation->SetDrawsContent(true); |
| 7891 | 7899 |
| 7892 gfx::Transform uninvertible_matrix; | 7900 gfx::Transform uninvertible_matrix; |
| 7893 uninvertible_matrix.Scale3d(6.f, 6.f, 0.f); | 7901 uninvertible_matrix.Scale3d(6.f, 6.f, 0.f); |
| 7894 | 7902 |
| 7895 root->SetBounds(gfx::Size(100, 100)); | 7903 root->SetBounds(gfx::Size(100, 100)); |
| 7896 clip->SetBounds(gfx::Size(10, 10)); | 7904 clip->SetBounds(gfx::Size(10, 10)); |
| 7897 clip->SetMasksToBounds(true); | 7905 clip->SetMasksToBounds(true); |
| 7898 animated->SetTransform(uninvertible_matrix); | 7906 animated->SetTransform(uninvertible_matrix); |
| 7899 animated->SetBounds(gfx::Size(120, 120)); | 7907 animated->SetBounds(gfx::Size(120, 120)); |
| 7900 surface->SetBounds(gfx::Size(100, 100)); | 7908 surface->SetBounds(gfx::Size(100, 100)); |
| 7901 surface->SetForceRenderSurfaceForTesting(true); | 7909 surface->test_properties()->force_render_surface = true; |
| 7902 descendant_of_animation->SetBounds(gfx::Size(200, 200)); | 7910 descendant_of_animation->SetBounds(gfx::Size(200, 200)); |
| 7903 | 7911 |
| 7904 TransformOperations start_transform_operations; | 7912 TransformOperations start_transform_operations; |
| 7905 start_transform_operations.AppendMatrix(uninvertible_matrix); | 7913 start_transform_operations.AppendMatrix(uninvertible_matrix); |
| 7906 TransformOperations end_transform_operations; | 7914 TransformOperations end_transform_operations; |
| 7907 | 7915 |
| 7908 SetElementIdsForTesting(); | 7916 AddAnimatedTransformToElementWithPlayer( |
| 7909 AddAnimatedTransformToElementWithPlayer(animated->element_id(), timeline(), | 7917 animated->element_id(), timeline_impl(), 10.0, start_transform_operations, |
| 7910 10.0, start_transform_operations, | 7918 end_transform_operations); |
| 7911 end_transform_operations); | 7919 ExecuteCalculateDrawPropertiesWithPropertyTrees(root); |
| 7912 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | |
| 7913 | 7920 |
| 7914 // The animated layer has a singular transform and maps to a non-empty rect in | 7921 // The animated layer has a singular transform and maps to a non-empty rect in |
| 7915 // clipped target space, so is treated as fully visible. | 7922 // clipped target space, so is treated as fully visible. |
| 7916 EXPECT_EQ(gfx::Rect(120, 120), animated->visible_layer_rect_for_testing()); | 7923 EXPECT_EQ(gfx::Rect(120, 120), animated->visible_layer_rect()); |
| 7917 | 7924 |
| 7918 // The singular transform on |animated| is flattened when inherited by | 7925 // The singular transform on |animated| is flattened when inherited by |
| 7919 // |surface|, and this happens to make it invertible. | 7926 // |surface|, and this happens to make it invertible. |
| 7920 EXPECT_EQ(gfx::Rect(2, 2), surface->visible_layer_rect_for_testing()); | 7927 EXPECT_EQ(gfx::Rect(2, 2), surface->visible_layer_rect()); |
| 7921 EXPECT_EQ(gfx::Rect(2, 2), | 7928 EXPECT_EQ(gfx::Rect(2, 2), descendant_of_animation->visible_layer_rect()); |
| 7922 descendant_of_animation->visible_layer_rect_for_testing()); | |
| 7923 | 7929 |
| 7924 gfx::Transform zero_matrix; | 7930 gfx::Transform zero_matrix; |
| 7925 zero_matrix.Scale3d(0.f, 0.f, 0.f); | 7931 zero_matrix.Scale3d(0.f, 0.f, 0.f); |
| 7926 animated->SetTransform(zero_matrix); | 7932 animated->OnTransformAnimated(zero_matrix); |
| 7927 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 7933 ExecuteCalculateDrawPropertiesWithPropertyTrees(root); |
| 7928 | 7934 |
| 7929 // The animated layer maps to the empty rect in clipped target space, so is | 7935 // The animated layer maps to the empty rect in clipped target space, so is |
| 7930 // treated as having an empty visible rect. | 7936 // treated as having an empty visible rect. |
| 7931 EXPECT_EQ(gfx::Rect(), animated->visible_layer_rect_for_testing()); | 7937 EXPECT_EQ(gfx::Rect(), animated->visible_layer_rect()); |
| 7932 | 7938 |
| 7933 // This time, flattening does not make |animated|'s transform invertible. This | 7939 // This time, flattening does not make |animated|'s transform invertible. This |
| 7934 // means the clip cannot be projected into |surface|'s space, so we treat | 7940 // means the clip cannot be projected into |surface|'s space, so we treat |
| 7935 // |surface| and layers that draw into it as having empty visible rect. | 7941 // |surface| and layers that draw into it as having empty visible rect. |
| 7936 EXPECT_EQ(gfx::Rect(), surface->visible_layer_rect_for_testing()); | 7942 EXPECT_EQ(gfx::Rect(), surface->visible_layer_rect()); |
| 7937 EXPECT_EQ(gfx::Rect(), | 7943 EXPECT_EQ(gfx::Rect(), descendant_of_animation->visible_layer_rect()); |
| 7938 descendant_of_animation->visible_layer_rect_for_testing()); | |
| 7939 } | 7944 } |
| 7940 | 7945 |
| 7941 // Verify that having animated opacity but current opacity 1 still creates | 7946 // Verify that having animated opacity but current opacity 1 still creates |
| 7942 // a render surface. | 7947 // a render surface. |
| 7943 TEST_F(LayerTreeHostCommonTest, AnimatedOpacityCreatesRenderSurface) { | 7948 TEST_F(LayerTreeHostCommonTest, AnimatedOpacityCreatesRenderSurface) { |
| 7944 LayerImpl* root = root_layer_for_testing(); | 7949 LayerImpl* root = root_layer_for_testing(); |
| 7945 LayerImpl* child = AddChild<LayerImpl>(root); | 7950 LayerImpl* child = AddChild<LayerImpl>(root); |
| 7946 LayerImpl* grandchild = AddChild<LayerImpl>(child); | 7951 LayerImpl* grandchild = AddChild<LayerImpl>(child); |
| 7947 | 7952 |
| 7948 root->SetBounds(gfx::Size(50, 50)); | 7953 root->SetBounds(gfx::Size(50, 50)); |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8280 greatgrandchild->SetBounds(gfx::Size(10, 10)); | 8285 greatgrandchild->SetBounds(gfx::Size(10, 10)); |
| 8281 | 8286 |
| 8282 root->AddChild(child); | 8287 root->AddChild(child); |
| 8283 child->AddChild(grandchild); | 8288 child->AddChild(grandchild); |
| 8284 grandchild->AddChild(greatgrandchild); | 8289 grandchild->AddChild(greatgrandchild); |
| 8285 host()->SetRootLayer(root); | 8290 host()->SetRootLayer(root); |
| 8286 host()->SetElementIdsForTesting(); | 8291 host()->SetElementIdsForTesting(); |
| 8287 | 8292 |
| 8288 // Check the non-skipped case. | 8293 // Check the non-skipped case. |
| 8289 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8294 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 8290 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing()); | 8295 const LayerList* update_list = GetUpdateLayerList(); |
| 8296 EXPECT_TRUE(VerifyLayerInList(grandchild, update_list)); |
| 8291 | 8297 |
| 8292 // Now we will reset the visible rect from property trees for the grandchild, | 8298 // Now we will reset the visible rect from property trees for the grandchild, |
| 8293 // and we will configure |child| in several ways that should force the subtree | 8299 // and we will configure |child| in several ways that should force the subtree |
| 8294 // to be skipped. The visible content rect for |grandchild| should, therefore, | 8300 // to be skipped. The visible content rect for |grandchild| should, therefore, |
| 8295 // remain empty. | 8301 // remain empty. |
| 8296 grandchild->set_visible_layer_rect(gfx::Rect()); | |
| 8297 gfx::Transform singular; | 8302 gfx::Transform singular; |
| 8298 singular.matrix().set(0, 0, 0); | 8303 singular.matrix().set(0, 0, 0); |
| 8299 | 8304 |
| 8300 child->SetTransform(singular); | 8305 child->SetTransform(singular); |
| 8301 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8306 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 8302 EXPECT_EQ(gfx::Rect(0, 0), grandchild->visible_layer_rect_for_testing()); | 8307 update_list = GetUpdateLayerList(); |
| 8308 EXPECT_FALSE(VerifyLayerInList(grandchild, update_list)); |
| 8303 child->SetTransform(gfx::Transform()); | 8309 child->SetTransform(gfx::Transform()); |
| 8304 | 8310 |
| 8305 child->SetHideLayerAndSubtree(true); | 8311 child->SetHideLayerAndSubtree(true); |
| 8306 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8312 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 8307 EXPECT_EQ(gfx::Rect(0, 0), grandchild->visible_layer_rect_for_testing()); | 8313 update_list = GetUpdateLayerList(); |
| 8314 EXPECT_FALSE(VerifyLayerInList(grandchild, update_list)); |
| 8308 child->SetHideLayerAndSubtree(false); | 8315 child->SetHideLayerAndSubtree(false); |
| 8309 | 8316 |
| 8310 gfx::Transform zero_z_scale; | 8317 gfx::Transform zero_z_scale; |
| 8311 zero_z_scale.Scale3d(1, 1, 0); | 8318 zero_z_scale.Scale3d(1, 1, 0); |
| 8312 child->SetTransform(zero_z_scale); | 8319 child->SetTransform(zero_z_scale); |
| 8313 | 8320 |
| 8314 // Add a transform animation with a start delay. Now, even though |child| has | 8321 // Add a transform animation with a start delay. Now, even though |child| has |
| 8315 // a singular transform, the subtree should still get processed. | 8322 // a singular transform, the subtree should still get processed. |
| 8316 int animation_id = 0; | 8323 int animation_id = 0; |
| 8317 std::unique_ptr<Animation> animation = Animation::Create( | 8324 std::unique_ptr<Animation> animation = Animation::Create( |
| 8318 std::unique_ptr<AnimationCurve>(new FakeTransformTransition(1.0)), | 8325 std::unique_ptr<AnimationCurve>(new FakeTransformTransition(1.0)), |
| 8319 animation_id, 1, TargetProperty::TRANSFORM); | 8326 animation_id, 1, TargetProperty::TRANSFORM); |
| 8320 animation->set_fill_mode(Animation::FillMode::NONE); | 8327 animation->set_fill_mode(Animation::FillMode::NONE); |
| 8321 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); | 8328 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); |
| 8322 AddAnimationToElementWithPlayer(child->element_id(), timeline(), | 8329 AddAnimationToElementWithPlayer(child->element_id(), timeline(), |
| 8323 std::move(animation)); | 8330 std::move(animation)); |
| 8324 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8331 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 8325 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing()); | 8332 update_list = GetUpdateLayerList(); |
| 8326 grandchild->set_visible_layer_rect(gfx::Rect()); | 8333 EXPECT_TRUE(VerifyLayerInList(grandchild, update_list)); |
| 8327 | 8334 |
| 8328 RemoveAnimationFromElementWithExistingPlayer(child->element_id(), timeline(), | 8335 RemoveAnimationFromElementWithExistingPlayer(child->element_id(), timeline(), |
| 8329 animation_id); | 8336 animation_id); |
| 8330 child->SetTransform(gfx::Transform()); | 8337 child->SetTransform(gfx::Transform()); |
| 8331 child->SetOpacity(0.f); | 8338 child->SetOpacity(0.f); |
| 8332 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8339 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 8333 EXPECT_EQ(gfx::Rect(0, 0), grandchild->visible_layer_rect_for_testing()); | 8340 update_list = GetUpdateLayerList(); |
| 8341 EXPECT_FALSE(VerifyLayerInList(grandchild, update_list)); |
| 8334 | 8342 |
| 8335 // Now, even though child has zero opacity, we will configure |grandchild| and | 8343 // Now, even though child has zero opacity, we will configure |grandchild| and |
| 8336 // |greatgrandchild| in several ways that should force the subtree to be | 8344 // |greatgrandchild| in several ways that should force the subtree to be |
| 8337 // processed anyhow. | 8345 // processed anyhow. |
| 8338 grandchild->RequestCopyOfOutput( | 8346 grandchild->RequestCopyOfOutput( |
| 8339 CopyOutputRequest::CreateBitmapRequest(base::Bind(&CopyOutputCallback))); | 8347 CopyOutputRequest::CreateBitmapRequest(base::Bind(&CopyOutputCallback))); |
| 8340 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8348 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 8341 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing()); | 8349 update_list = GetUpdateLayerList(); |
| 8342 greatgrandchild->set_visible_layer_rect(gfx::Rect()); | 8350 EXPECT_TRUE(VerifyLayerInList(grandchild, update_list)); |
| 8343 | 8351 |
| 8344 // Add an opacity animation with a start delay. | 8352 // Add an opacity animation with a start delay. |
| 8345 animation_id = 1; | 8353 animation_id = 1; |
| 8346 animation = Animation::Create( | 8354 animation = Animation::Create( |
| 8347 std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), | 8355 std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), |
| 8348 animation_id, 1, TargetProperty::OPACITY); | 8356 animation_id, 1, TargetProperty::OPACITY); |
| 8349 animation->set_fill_mode(Animation::FillMode::NONE); | 8357 animation->set_fill_mode(Animation::FillMode::NONE); |
| 8350 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); | 8358 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); |
| 8351 AddAnimationToElementWithExistingPlayer(child->element_id(), timeline(), | 8359 AddAnimationToElementWithExistingPlayer(child->element_id(), timeline(), |
| 8352 std::move(animation)); | 8360 std::move(animation)); |
| 8353 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8361 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 8354 EXPECT_EQ(gfx::Rect(10, 10), grandchild->visible_layer_rect_for_testing()); | 8362 update_list = GetUpdateLayerList(); |
| 8363 EXPECT_TRUE(VerifyLayerInList(grandchild, update_list)); |
| 8355 } | 8364 } |
| 8356 | 8365 |
| 8357 TEST_F(LayerTreeHostCommonTest, SkippingLayerImpl) { | 8366 TEST_F(LayerTreeHostCommonTest, SkippingLayerImpl) { |
| 8358 FakeImplTaskRunnerProvider task_runner_provider; | 8367 FakeImplTaskRunnerProvider task_runner_provider; |
| 8359 TestSharedBitmapManager shared_bitmap_manager; | 8368 TestSharedBitmapManager shared_bitmap_manager; |
| 8360 TestTaskGraphRunner task_graph_runner; | 8369 TestTaskGraphRunner task_graph_runner; |
| 8361 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, | 8370 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, |
| 8362 &task_graph_runner); | 8371 &task_graph_runner); |
| 8363 | 8372 |
| 8364 std::unique_ptr<LayerImpl> root = | 8373 std::unique_ptr<LayerImpl> root = |
| (...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9712 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); | 9721 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); |
| 9713 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); | 9722 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); |
| 9714 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); | 9723 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); |
| 9715 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); | 9724 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); |
| 9716 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); | 9725 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); |
| 9717 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); | 9726 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); |
| 9718 } | 9727 } |
| 9719 | 9728 |
| 9720 } // namespace | 9729 } // namespace |
| 9721 } // namespace cc | 9730 } // namespace cc |
| OLD | NEW |