| 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 template <class LayerType> | 167 template <class LayerType> |
| 168 void ExecuteCalculateDrawProperties(LayerType* root_layer, | 168 void ExecuteCalculateDrawProperties(LayerType* root_layer, |
| 169 float device_scale_factor) { | 169 float device_scale_factor) { |
| 170 LayerType* page_scale_application_layer = nullptr; | 170 LayerType* page_scale_application_layer = nullptr; |
| 171 ExecuteCalculateDrawProperties(root_layer, device_scale_factor, 1.f, | 171 ExecuteCalculateDrawProperties(root_layer, device_scale_factor, 1.f, |
| 172 page_scale_application_layer); | 172 page_scale_application_layer); |
| 173 } | 173 } |
| 174 | 174 |
| 175 const LayerList* GetUpdateLayerList() { return &update_layer_list_; } | 175 const LayerList* GetUpdateLayerList() { return &update_layer_list_; } |
| 176 | 176 |
| 177 void ExecuteCalculateDrawPropertiesWithPropertyTrees(Layer* root_layer) { | 177 void ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(Layer* root_layer) { |
| 178 DCHECK(root_layer->GetLayerTree()); | 178 DCHECK(root_layer->GetLayerTree()); |
| 179 PropertyTreeBuilder::PreCalculateMetaInformation(root_layer); | 179 PropertyTreeBuilder::PreCalculateMetaInformation(root_layer); |
| 180 | 180 |
| 181 bool can_render_to_separate_surface = true; | 181 bool can_render_to_separate_surface = true; |
| 182 | 182 |
| 183 const Layer* page_scale_layer = | 183 const Layer* page_scale_layer = |
| 184 root_layer->GetLayerTree()->page_scale_layer(); | 184 root_layer->GetLayerTree()->page_scale_layer(); |
| 185 Layer* inner_viewport_scroll_layer = | 185 Layer* inner_viewport_scroll_layer = |
| 186 root_layer->GetLayerTree()->inner_viewport_scroll_layer(); | 186 root_layer->GetLayerTree()->inner_viewport_scroll_layer(); |
| 187 Layer* outer_viewport_scroll_layer = | 187 Layer* outer_viewport_scroll_layer = |
| (...skipping 15 matching lines...) Expand all Loading... |
| 203 outer_viewport_scroll_layer, overscroll_elasticity_layer, | 203 outer_viewport_scroll_layer, overscroll_elasticity_layer, |
| 204 elastic_overscroll, page_scale_factor, device_scale_factor, | 204 elastic_overscroll, page_scale_factor, device_scale_factor, |
| 205 gfx::Rect(device_viewport_size), gfx::Transform(), property_trees); | 205 gfx::Rect(device_viewport_size), gfx::Transform(), property_trees); |
| 206 draw_property_utils::UpdatePropertyTrees(property_trees, | 206 draw_property_utils::UpdatePropertyTrees(property_trees, |
| 207 can_render_to_separate_surface); | 207 can_render_to_separate_surface); |
| 208 draw_property_utils::FindLayersThatNeedUpdates( | 208 draw_property_utils::FindLayersThatNeedUpdates( |
| 209 root_layer->GetLayerTree(), property_trees->transform_tree, | 209 root_layer->GetLayerTree(), property_trees->transform_tree, |
| 210 property_trees->effect_tree, &update_layer_list_); | 210 property_trees->effect_tree, &update_layer_list_); |
| 211 } | 211 } |
| 212 | 212 |
| 213 void ExecuteCalculateDrawPropertiesWithPropertyTrees(LayerImpl* root_layer) { | 213 void ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList( |
| 214 LayerImpl* root_layer, |
| 215 bool skip_verify_visible_rect_calculations = false) { |
| 214 DCHECK(root_layer->layer_tree_impl()); | 216 DCHECK(root_layer->layer_tree_impl()); |
| 215 PropertyTreeBuilder::PreCalculateMetaInformationForTesting(root_layer); | 217 PropertyTreeBuilder::PreCalculateMetaInformationForTesting(root_layer); |
| 216 | 218 |
| 217 bool can_render_to_separate_surface = true; | 219 bool can_render_to_separate_surface = true; |
| 218 | 220 |
| 219 LayerImpl* page_scale_layer = nullptr; | 221 LayerImpl* page_scale_layer = nullptr; |
| 220 LayerImpl* inner_viewport_scroll_layer = | 222 LayerImpl* inner_viewport_scroll_layer = |
| 221 root_layer->layer_tree_impl()->InnerViewportScrollLayer(); | 223 root_layer->layer_tree_impl()->InnerViewportScrollLayer(); |
| 222 LayerImpl* outer_viewport_scroll_layer = | 224 LayerImpl* outer_viewport_scroll_layer = |
| 223 root_layer->layer_tree_impl()->OuterViewportScrollLayer(); | 225 root_layer->layer_tree_impl()->OuterViewportScrollLayer(); |
| 224 LayerImpl* overscroll_elasticity_layer = | 226 LayerImpl* overscroll_elasticity_layer = |
| 225 root_layer->layer_tree_impl()->OverscrollElasticityLayer(); | 227 root_layer->layer_tree_impl()->OverscrollElasticityLayer(); |
| 226 gfx::Vector2dF elastic_overscroll = | 228 gfx::Vector2dF elastic_overscroll = |
| 227 root_layer->layer_tree_impl()->elastic_overscroll()->Current( | 229 root_layer->layer_tree_impl()->elastic_overscroll()->Current( |
| 228 root_layer->layer_tree_impl()->IsActiveTree()); | 230 root_layer->layer_tree_impl()->IsActiveTree()); |
| 229 float page_scale_factor = 1.f; | 231 float page_scale_factor = 1.f; |
| 230 float device_scale_factor = 1.f; | 232 float device_scale_factor = 1.f; |
| 231 gfx::Size device_viewport_size = | 233 gfx::Size device_viewport_size = |
| 232 gfx::Size(root_layer->bounds().width() * device_scale_factor, | 234 gfx::Size(root_layer->bounds().width() * device_scale_factor, |
| 233 root_layer->bounds().height() * device_scale_factor); | 235 root_layer->bounds().height() * device_scale_factor); |
| 234 update_layer_list_impl_.reset(new LayerImplList); | 236 update_layer_list_impl_.reset(new LayerImplList); |
| 235 root_layer->layer_tree_impl()->BuildLayerListForTesting(); | 237 root_layer->layer_tree_impl()->BuildLayerListForTesting(); |
| 236 bool verify_visible_rect_calculations = true; | 238 PropertyTrees* property_trees = |
| 239 root_layer->layer_tree_impl()->property_trees(); |
| 237 draw_property_utils::BuildPropertyTreesAndComputeVisibleRects( | 240 draw_property_utils::BuildPropertyTreesAndComputeVisibleRects( |
| 238 root_layer, page_scale_layer, inner_viewport_scroll_layer, | 241 root_layer, page_scale_layer, inner_viewport_scroll_layer, |
| 239 outer_viewport_scroll_layer, overscroll_elasticity_layer, | 242 outer_viewport_scroll_layer, overscroll_elasticity_layer, |
| 240 elastic_overscroll, page_scale_factor, device_scale_factor, | 243 elastic_overscroll, page_scale_factor, device_scale_factor, |
| 241 gfx::Rect(device_viewport_size), gfx::Transform(), | 244 gfx::Rect(device_viewport_size), gfx::Transform(), |
| 242 can_render_to_separate_surface, verify_visible_rect_calculations, | 245 can_render_to_separate_surface, property_trees, |
| 243 root_layer->layer_tree_impl()->property_trees(), | |
| 244 update_layer_list_impl_.get()); | 246 update_layer_list_impl_.get()); |
| 247 draw_property_utils::VerifyClipTreeCalculations(*update_layer_list_impl_, |
| 248 property_trees); |
| 249 if (!skip_verify_visible_rect_calculations) |
| 250 draw_property_utils::VerifyVisibleRectsCalculations( |
| 251 *update_layer_list_impl_, property_trees); |
| 245 } | 252 } |
| 246 | 253 |
| 247 void ExecuteCalculateDrawPropertiesWithoutSeparateSurfaces( | 254 void ExecuteCalculateDrawPropertiesWithoutSeparateSurfaces( |
| 248 LayerImpl* root_layer) { | 255 LayerImpl* root_layer) { |
| 249 gfx::Size device_viewport_size = | 256 gfx::Size device_viewport_size = |
| 250 gfx::Size(root_layer->bounds().width(), root_layer->bounds().height()); | 257 gfx::Size(root_layer->bounds().width(), root_layer->bounds().height()); |
| 251 render_surface_layer_list_impl_.reset(new LayerImplList); | 258 render_surface_layer_list_impl_.reset(new LayerImplList); |
| 252 | 259 |
| 253 DCHECK(!root_layer->bounds().IsEmpty()); | 260 DCHECK(!root_layer->bounds().IsEmpty()); |
| 254 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 261 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
| (...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1182 gfx::Transform grand_child_transform; | 1189 gfx::Transform grand_child_transform; |
| 1183 grand_child_transform.RotateAboutYAxis(90.0); | 1190 grand_child_transform.RotateAboutYAxis(90.0); |
| 1184 | 1191 |
| 1185 root->SetBounds(gfx::Size(200, 200)); | 1192 root->SetBounds(gfx::Size(200, 200)); |
| 1186 child->test_properties()->transform = child_transform; | 1193 child->test_properties()->transform = child_transform; |
| 1187 child->SetBounds(gfx::Size(10, 10)); | 1194 child->SetBounds(gfx::Size(10, 10)); |
| 1188 grand_child->test_properties()->transform = grand_child_transform; | 1195 grand_child->test_properties()->transform = grand_child_transform; |
| 1189 grand_child->SetBounds(gfx::Size(100, 100)); | 1196 grand_child->SetBounds(gfx::Size(100, 100)); |
| 1190 grand_child->test_properties()->should_flatten_transform = false; | 1197 grand_child->test_properties()->should_flatten_transform = false; |
| 1191 grand_child->SetDrawsContent(true); | 1198 grand_child->SetDrawsContent(true); |
| 1192 ExecuteCalculateDrawProperties(root); | 1199 float device_scale_factor = 1.f; |
| 1200 float page_scale_factor = 1.f; |
| 1201 LayerImpl* page_scale_layer = nullptr; |
| 1202 // Visible rects computed by combining clips in target space and root space |
| 1203 // don't match because of rotation transforms. So, we skip |
| 1204 // verify_visible_rect_calculations. |
| 1205 bool skip_verify_visible_rect_calculations = true; |
| 1206 ExecuteCalculateDrawProperties(root, device_scale_factor, page_scale_factor, |
| 1207 page_scale_layer, |
| 1208 skip_verify_visible_rect_calculations); |
| 1193 | 1209 |
| 1194 // Mapping grand_child's bounds to target space produces a non-empty rect | 1210 // Mapping grand_child's bounds to target space produces a non-empty rect |
| 1195 // that is fully contained within the target's bounds, so grand_child should | 1211 // that is fully contained within the target's bounds, so grand_child should |
| 1196 // be considered fully visible. | 1212 // be considered fully visible. |
| 1197 EXPECT_EQ(gfx::Rect(grand_child->bounds()), | 1213 EXPECT_EQ(gfx::Rect(grand_child->bounds()), |
| 1198 grand_child->visible_layer_rect()); | 1214 grand_child->visible_layer_rect()); |
| 1199 } | 1215 } |
| 1200 | 1216 |
| 1201 TEST_F(LayerTreeHostCommonTest, TransformsForDegenerateIntermediateLayer) { | 1217 TEST_F(LayerTreeHostCommonTest, TransformsForDegenerateIntermediateLayer) { |
| 1202 // A layer that is empty in one axis, but not the other, was accidentally | 1218 // A layer that is empty in one axis, but not the other, was accidentally |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1716 LayerImpl* render_surface1 = AddChildToRoot<LayerImpl>(); | 1732 LayerImpl* render_surface1 = AddChildToRoot<LayerImpl>(); |
| 1717 LayerImpl* child = AddChild<LayerImpl>(render_surface1); | 1733 LayerImpl* child = AddChild<LayerImpl>(render_surface1); |
| 1718 | 1734 |
| 1719 root->SetBounds(gfx::Size(10, 10)); | 1735 root->SetBounds(gfx::Size(10, 10)); |
| 1720 render_surface1->SetBounds(gfx::Size(10, 10)); | 1736 render_surface1->SetBounds(gfx::Size(10, 10)); |
| 1721 render_surface1->test_properties()->force_render_surface = true; | 1737 render_surface1->test_properties()->force_render_surface = true; |
| 1722 child->SetBounds(gfx::Size(10, 10)); | 1738 child->SetBounds(gfx::Size(10, 10)); |
| 1723 child->SetDrawsContent(true); | 1739 child->SetDrawsContent(true); |
| 1724 | 1740 |
| 1725 { | 1741 { |
| 1726 ExecuteCalculateDrawPropertiesWithPropertyTrees(root); | 1742 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root); |
| 1727 | 1743 |
| 1728 // The root layer always creates a render surface | 1744 // The root layer always creates a render surface |
| 1729 EXPECT_TRUE(root->has_render_surface()); | 1745 EXPECT_TRUE(root->has_render_surface()); |
| 1730 EXPECT_TRUE(render_surface1->has_render_surface()); | 1746 EXPECT_TRUE(render_surface1->has_render_surface()); |
| 1731 } | 1747 } |
| 1732 | 1748 |
| 1733 { | 1749 { |
| 1734 render_surface1->test_properties()->force_render_surface = false; | 1750 render_surface1->test_properties()->force_render_surface = false; |
| 1735 render_surface1->layer_tree_impl()->property_trees()->needs_rebuild = true; | 1751 render_surface1->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 1736 ExecuteCalculateDrawPropertiesWithPropertyTrees(root); | 1752 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root); |
| 1737 EXPECT_TRUE(root->has_render_surface()); | 1753 EXPECT_TRUE(root->has_render_surface()); |
| 1738 EXPECT_FALSE(render_surface1->has_render_surface()); | 1754 EXPECT_FALSE(render_surface1->has_render_surface()); |
| 1739 } | 1755 } |
| 1740 } | 1756 } |
| 1741 | 1757 |
| 1742 TEST_F(LayerTreeHostCommonTest, RenderSurfacesFlattenScreenSpaceTransform) { | 1758 TEST_F(LayerTreeHostCommonTest, RenderSurfacesFlattenScreenSpaceTransform) { |
| 1743 // Render surfaces act as a flattening point for their subtree, so should | 1759 // Render surfaces act as a flattening point for their subtree, so should |
| 1744 // always flatten the target-to-screen space transform seen by descendants. | 1760 // always flatten the target-to-screen space transform seen by descendants. |
| 1745 LayerImpl* root = root_layer_for_testing(); | 1761 LayerImpl* root = root_layer_for_testing(); |
| 1746 LayerImpl* parent = AddChild<LayerImpl>(root); | 1762 LayerImpl* parent = AddChild<LayerImpl>(root); |
| (...skipping 2448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4195 back_facing_child->test_properties()->transform = backface_matrix; | 4211 back_facing_child->test_properties()->transform = backface_matrix; |
| 4196 back_facing_surface->test_properties()->transform = backface_matrix; | 4212 back_facing_surface->test_properties()->transform = backface_matrix; |
| 4197 back_facing_child_of_front_facing_surface->test_properties()->transform = | 4213 back_facing_child_of_front_facing_surface->test_properties()->transform = |
| 4198 backface_matrix; | 4214 backface_matrix; |
| 4199 back_facing_child_of_back_facing_surface->test_properties()->transform = | 4215 back_facing_child_of_back_facing_surface->test_properties()->transform = |
| 4200 backface_matrix; | 4216 backface_matrix; |
| 4201 | 4217 |
| 4202 // Note: No layers preserve 3d. According to current W3C CSS gfx::Transforms | 4218 // Note: No layers preserve 3d. According to current W3C CSS gfx::Transforms |
| 4203 // spec, these layers should blindly use their own local transforms to | 4219 // spec, these layers should blindly use their own local transforms to |
| 4204 // determine back-face culling. | 4220 // determine back-face culling. |
| 4205 ExecuteCalculateDrawPropertiesWithPropertyTrees(root); | 4221 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root); |
| 4206 | 4222 |
| 4207 // Verify which render surfaces were created. | 4223 // Verify which render surfaces were created. |
| 4208 EXPECT_FALSE(front_facing_child->has_render_surface()); | 4224 EXPECT_FALSE(front_facing_child->has_render_surface()); |
| 4209 EXPECT_FALSE(back_facing_child->has_render_surface()); | 4225 EXPECT_FALSE(back_facing_child->has_render_surface()); |
| 4210 EXPECT_TRUE(front_facing_surface->has_render_surface()); | 4226 EXPECT_TRUE(front_facing_surface->has_render_surface()); |
| 4211 EXPECT_TRUE(back_facing_surface->has_render_surface()); | 4227 EXPECT_TRUE(back_facing_surface->has_render_surface()); |
| 4212 EXPECT_FALSE( | 4228 EXPECT_FALSE( |
| 4213 front_facing_child_of_front_facing_surface->has_render_surface()); | 4229 front_facing_child_of_front_facing_surface->has_render_surface()); |
| 4214 EXPECT_FALSE(back_facing_child_of_front_facing_surface->has_render_surface()); | 4230 EXPECT_FALSE(back_facing_child_of_front_facing_surface->has_render_surface()); |
| 4215 EXPECT_FALSE(front_facing_child_of_back_facing_surface->has_render_surface()); | 4231 EXPECT_FALSE(front_facing_child_of_back_facing_surface->has_render_surface()); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4304 // and (b) the layer's transform style is preserve-3d. | 4320 // and (b) the layer's transform style is preserve-3d. |
| 4305 front_facing_surface->test_properties()->should_flatten_transform = false; | 4321 front_facing_surface->test_properties()->should_flatten_transform = false; |
| 4306 front_facing_surface->Set3dSortingContextId(1); | 4322 front_facing_surface->Set3dSortingContextId(1); |
| 4307 back_facing_surface->test_properties()->should_flatten_transform = false; | 4323 back_facing_surface->test_properties()->should_flatten_transform = false; |
| 4308 back_facing_surface->Set3dSortingContextId(1); | 4324 back_facing_surface->Set3dSortingContextId(1); |
| 4309 front_facing_child_of_front_facing_surface->Set3dSortingContextId(1); | 4325 front_facing_child_of_front_facing_surface->Set3dSortingContextId(1); |
| 4310 back_facing_child_of_front_facing_surface->Set3dSortingContextId(1); | 4326 back_facing_child_of_front_facing_surface->Set3dSortingContextId(1); |
| 4311 front_facing_child_of_back_facing_surface->Set3dSortingContextId(1); | 4327 front_facing_child_of_back_facing_surface->Set3dSortingContextId(1); |
| 4312 back_facing_child_of_back_facing_surface->Set3dSortingContextId(1); | 4328 back_facing_child_of_back_facing_surface->Set3dSortingContextId(1); |
| 4313 | 4329 |
| 4314 ExecuteCalculateDrawPropertiesWithPropertyTrees(root); | 4330 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root); |
| 4315 | 4331 |
| 4316 // Verify which render surfaces were created and used. | 4332 // Verify which render surfaces were created and used. |
| 4317 EXPECT_FALSE(front_facing_child->has_render_surface()); | 4333 EXPECT_FALSE(front_facing_child->has_render_surface()); |
| 4318 EXPECT_FALSE(back_facing_child->has_render_surface()); | 4334 EXPECT_FALSE(back_facing_child->has_render_surface()); |
| 4319 EXPECT_TRUE(front_facing_surface->has_render_surface()); | 4335 EXPECT_TRUE(front_facing_surface->has_render_surface()); |
| 4320 // We expect that a has_render_surface was created but not used. | 4336 // We expect that a has_render_surface was created but not used. |
| 4321 EXPECT_TRUE(back_facing_surface->has_render_surface()); | 4337 EXPECT_TRUE(back_facing_surface->has_render_surface()); |
| 4322 EXPECT_FALSE( | 4338 EXPECT_FALSE( |
| 4323 front_facing_child_of_front_facing_surface->has_render_surface()); | 4339 front_facing_child_of_front_facing_surface->has_render_surface()); |
| 4324 EXPECT_FALSE(back_facing_child_of_front_facing_surface->has_render_surface()); | 4340 EXPECT_FALSE(back_facing_child_of_front_facing_surface->has_render_surface()); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4380 child->test_properties()->transform = backface_matrix; | 4396 child->test_properties()->transform = backface_matrix; |
| 4381 animating_surface->SetBounds(gfx::Size(100, 100)); | 4397 animating_surface->SetBounds(gfx::Size(100, 100)); |
| 4382 animating_surface->test_properties()->transform = backface_matrix; | 4398 animating_surface->test_properties()->transform = backface_matrix; |
| 4383 animating_surface->test_properties()->force_render_surface = true; | 4399 animating_surface->test_properties()->force_render_surface = true; |
| 4384 child_of_animating_surface->SetBounds(gfx::Size(100, 100)); | 4400 child_of_animating_surface->SetBounds(gfx::Size(100, 100)); |
| 4385 child_of_animating_surface->test_properties()->transform = backface_matrix; | 4401 child_of_animating_surface->test_properties()->transform = backface_matrix; |
| 4386 animating_child->SetBounds(gfx::Size(100, 100)); | 4402 animating_child->SetBounds(gfx::Size(100, 100)); |
| 4387 animating_child->test_properties()->transform = backface_matrix; | 4403 animating_child->test_properties()->transform = backface_matrix; |
| 4388 child2->SetBounds(gfx::Size(100, 100)); | 4404 child2->SetBounds(gfx::Size(100, 100)); |
| 4389 | 4405 |
| 4390 ExecuteCalculateDrawPropertiesWithPropertyTrees(root); | 4406 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root); |
| 4391 | 4407 |
| 4392 EXPECT_FALSE(child->has_render_surface()); | 4408 EXPECT_FALSE(child->has_render_surface()); |
| 4393 EXPECT_TRUE(animating_surface->has_render_surface()); | 4409 EXPECT_TRUE(animating_surface->has_render_surface()); |
| 4394 EXPECT_FALSE(child_of_animating_surface->has_render_surface()); | 4410 EXPECT_FALSE(child_of_animating_surface->has_render_surface()); |
| 4395 EXPECT_FALSE(animating_child->has_render_surface()); | 4411 EXPECT_FALSE(animating_child->has_render_surface()); |
| 4396 EXPECT_FALSE(child2->has_render_surface()); | 4412 EXPECT_FALSE(child2->has_render_surface()); |
| 4397 | 4413 |
| 4398 EXPECT_EQ(1u, update_layer_list_impl()->size()); | 4414 EXPECT_EQ(1u, update_layer_list_impl()->size()); |
| 4399 | 4415 |
| 4400 // The back facing layers are culled from the layer list, and have an empty | 4416 // The back facing layers are culled from the layer list, and have an empty |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4439 front_facing_surface->test_properties()->force_render_surface = true; | 4455 front_facing_surface->test_properties()->force_render_surface = true; |
| 4440 back_facing_surface->SetBounds(gfx::Size(100, 100)); | 4456 back_facing_surface->SetBounds(gfx::Size(100, 100)); |
| 4441 back_facing_surface->test_properties()->transform = backface_matrix; | 4457 back_facing_surface->test_properties()->transform = backface_matrix; |
| 4442 back_facing_surface->test_properties()->force_render_surface = true; | 4458 back_facing_surface->test_properties()->force_render_surface = true; |
| 4443 child1->SetBounds(gfx::Size(100, 100)); | 4459 child1->SetBounds(gfx::Size(100, 100)); |
| 4444 child2->SetBounds(gfx::Size(100, 100)); | 4460 child2->SetBounds(gfx::Size(100, 100)); |
| 4445 | 4461 |
| 4446 front_facing_surface->Set3dSortingContextId(1); | 4462 front_facing_surface->Set3dSortingContextId(1); |
| 4447 back_facing_surface->Set3dSortingContextId(1); | 4463 back_facing_surface->Set3dSortingContextId(1); |
| 4448 | 4464 |
| 4449 ExecuteCalculateDrawPropertiesWithPropertyTrees(root); | 4465 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root); |
| 4450 | 4466 |
| 4451 // Verify which render surfaces were created and used. | 4467 // Verify which render surfaces were created and used. |
| 4452 EXPECT_TRUE(front_facing_surface->has_render_surface()); | 4468 EXPECT_TRUE(front_facing_surface->has_render_surface()); |
| 4453 | 4469 |
| 4454 // We expect the render surface to have been created, but remain unused. | 4470 // We expect the render surface to have been created, but remain unused. |
| 4455 EXPECT_TRUE(back_facing_surface->has_render_surface()); | 4471 EXPECT_TRUE(back_facing_surface->has_render_surface()); |
| 4456 EXPECT_FALSE(child1->has_render_surface()); | 4472 EXPECT_FALSE(child1->has_render_surface()); |
| 4457 EXPECT_FALSE(child2->has_render_surface()); | 4473 EXPECT_FALSE(child2->has_render_surface()); |
| 4458 | 4474 |
| 4459 EXPECT_EQ(2u, update_layer_list_impl()->size()); | 4475 EXPECT_EQ(2u, update_layer_list_impl()->size()); |
| (...skipping 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5961 child1->SetBounds(bounds); | 5977 child1->SetBounds(bounds); |
| 5962 child1->SetDrawsContent(true); | 5978 child1->SetDrawsContent(true); |
| 5963 child1->Set3dSortingContextId(1); | 5979 child1->Set3dSortingContextId(1); |
| 5964 child1->test_properties()->should_flatten_transform = false; | 5980 child1->test_properties()->should_flatten_transform = false; |
| 5965 child2->SetBounds(bounds); | 5981 child2->SetBounds(bounds); |
| 5966 child2->SetDrawsContent(true); | 5982 child2->SetDrawsContent(true); |
| 5967 child2->Set3dSortingContextId(1); | 5983 child2->Set3dSortingContextId(1); |
| 5968 child3->SetBounds(bounds); | 5984 child3->SetBounds(bounds); |
| 5969 child3->SetDrawsContent(true); | 5985 child3->SetDrawsContent(true); |
| 5970 child3->Set3dSortingContextId(1); | 5986 child3->Set3dSortingContextId(1); |
| 5971 ExecuteCalculateDrawPropertiesWithPropertyTrees(root); | 5987 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root); |
| 5972 | 5988 |
| 5973 // Verify which render surfaces were created. | 5989 // Verify which render surfaces were created. |
| 5974 EXPECT_TRUE(root->has_render_surface()); | 5990 EXPECT_TRUE(root->has_render_surface()); |
| 5975 EXPECT_FALSE(child1->has_render_surface()); | 5991 EXPECT_FALSE(child1->has_render_surface()); |
| 5976 EXPECT_TRUE(child2->has_render_surface()); | 5992 EXPECT_TRUE(child2->has_render_surface()); |
| 5977 EXPECT_FALSE(child3->has_render_surface()); | 5993 EXPECT_FALSE(child3->has_render_surface()); |
| 5978 } | 5994 } |
| 5979 | 5995 |
| 5980 TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) { | 5996 TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) { |
| 5981 FakeImplTaskRunnerProvider task_runner_provider; | 5997 FakeImplTaskRunnerProvider task_runner_provider; |
| (...skipping 1901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7883 inner_viewport_scroll_layer->AddChild(fixed_to_inner); | 7899 inner_viewport_scroll_layer->AddChild(fixed_to_inner); |
| 7884 outer_viewport_scroll_layer->AddChild(fixed_to_outer); | 7900 outer_viewport_scroll_layer->AddChild(fixed_to_outer); |
| 7885 | 7901 |
| 7886 LayerPositionConstraint fixed_to_right; | 7902 LayerPositionConstraint fixed_to_right; |
| 7887 fixed_to_right.set_is_fixed_position(true); | 7903 fixed_to_right.set_is_fixed_position(true); |
| 7888 fixed_to_right.set_is_fixed_to_right_edge(true); | 7904 fixed_to_right.set_is_fixed_to_right_edge(true); |
| 7889 | 7905 |
| 7890 fixed_to_inner->SetPositionConstraint(fixed_to_right); | 7906 fixed_to_inner->SetPositionConstraint(fixed_to_right); |
| 7891 fixed_to_outer->SetPositionConstraint(fixed_to_right); | 7907 fixed_to_outer->SetPositionConstraint(fixed_to_right); |
| 7892 | 7908 |
| 7893 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 7909 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get()); |
| 7894 | 7910 |
| 7895 TransformTree& transform_tree = host()->property_trees()->transform_tree; | 7911 TransformTree& transform_tree = host()->property_trees()->transform_tree; |
| 7896 EXPECT_TRUE(transform_tree.HasNodesAffectedByInnerViewportBoundsDelta()); | 7912 EXPECT_TRUE(transform_tree.HasNodesAffectedByInnerViewportBoundsDelta()); |
| 7897 EXPECT_TRUE(transform_tree.HasNodesAffectedByOuterViewportBoundsDelta()); | 7913 EXPECT_TRUE(transform_tree.HasNodesAffectedByOuterViewportBoundsDelta()); |
| 7898 | 7914 |
| 7899 LayerPositionConstraint fixed_to_left; | 7915 LayerPositionConstraint fixed_to_left; |
| 7900 fixed_to_left.set_is_fixed_position(true); | 7916 fixed_to_left.set_is_fixed_position(true); |
| 7901 fixed_to_inner->SetPositionConstraint(fixed_to_left); | 7917 fixed_to_inner->SetPositionConstraint(fixed_to_left); |
| 7902 | 7918 |
| 7903 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 7919 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get()); |
| 7904 EXPECT_FALSE(transform_tree.HasNodesAffectedByInnerViewportBoundsDelta()); | 7920 EXPECT_FALSE(transform_tree.HasNodesAffectedByInnerViewportBoundsDelta()); |
| 7905 EXPECT_TRUE(transform_tree.HasNodesAffectedByOuterViewportBoundsDelta()); | 7921 EXPECT_TRUE(transform_tree.HasNodesAffectedByOuterViewportBoundsDelta()); |
| 7906 | 7922 |
| 7907 fixed_to_outer->SetPositionConstraint(fixed_to_left); | 7923 fixed_to_outer->SetPositionConstraint(fixed_to_left); |
| 7908 | 7924 |
| 7909 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 7925 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get()); |
| 7910 EXPECT_FALSE(transform_tree.HasNodesAffectedByInnerViewportBoundsDelta()); | 7926 EXPECT_FALSE(transform_tree.HasNodesAffectedByInnerViewportBoundsDelta()); |
| 7911 EXPECT_FALSE(transform_tree.HasNodesAffectedByOuterViewportBoundsDelta()); | 7927 EXPECT_FALSE(transform_tree.HasNodesAffectedByOuterViewportBoundsDelta()); |
| 7912 } | 7928 } |
| 7913 | 7929 |
| 7914 TEST_F(LayerTreeHostCommonTest, VisibleContentRectForAnimatedLayer) { | 7930 TEST_F(LayerTreeHostCommonTest, VisibleContentRectForAnimatedLayer) { |
| 7915 host_impl()->CreatePendingTree(); | 7931 host_impl()->CreatePendingTree(); |
| 7916 std::unique_ptr<LayerImpl> pending_root = | 7932 std::unique_ptr<LayerImpl> pending_root = |
| 7917 LayerImpl::Create(host_impl()->pending_tree(), 1); | 7933 LayerImpl::Create(host_impl()->pending_tree(), 1); |
| 7918 LayerImpl* root = pending_root.get(); | 7934 LayerImpl* root = pending_root.get(); |
| 7919 host_impl()->pending_tree()->SetRootLayerForTesting(std::move(pending_root)); | 7935 host_impl()->pending_tree()->SetRootLayerForTesting(std::move(pending_root)); |
| 7920 std::unique_ptr<LayerImpl> animated_ptr = | 7936 std::unique_ptr<LayerImpl> animated_ptr = |
| 7921 LayerImpl::Create(host_impl()->pending_tree(), 2); | 7937 LayerImpl::Create(host_impl()->pending_tree(), 2); |
| 7922 LayerImpl* animated = animated_ptr.get(); | 7938 LayerImpl* animated = animated_ptr.get(); |
| 7923 root->test_properties()->AddChild(std::move(animated_ptr)); | 7939 root->test_properties()->AddChild(std::move(animated_ptr)); |
| 7924 | 7940 |
| 7925 animated->SetDrawsContent(true); | 7941 animated->SetDrawsContent(true); |
| 7926 host_impl()->pending_tree()->SetElementIdsForTesting(); | 7942 host_impl()->pending_tree()->SetElementIdsForTesting(); |
| 7927 | 7943 |
| 7928 root->SetBounds(gfx::Size(100, 100)); | 7944 root->SetBounds(gfx::Size(100, 100)); |
| 7929 root->SetMasksToBounds(true); | 7945 root->SetMasksToBounds(true); |
| 7930 root->test_properties()->force_render_surface = true; | 7946 root->test_properties()->force_render_surface = true; |
| 7931 animated->test_properties()->opacity = 0.f; | 7947 animated->test_properties()->opacity = 0.f; |
| 7932 animated->SetBounds(gfx::Size(20, 20)); | 7948 animated->SetBounds(gfx::Size(20, 20)); |
| 7933 | 7949 |
| 7934 AddOpacityTransitionToElementWithPlayer( | 7950 AddOpacityTransitionToElementWithPlayer( |
| 7935 animated->element_id(), timeline_impl(), 10.0, 0.f, 1.f, false); | 7951 animated->element_id(), timeline_impl(), 10.0, 0.f, 1.f, false); |
| 7936 animated->test_properties()->opacity_can_animate = true; | 7952 animated->test_properties()->opacity_can_animate = true; |
| 7937 root->layer_tree_impl()->property_trees()->needs_rebuild = true; | 7953 root->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 7938 ExecuteCalculateDrawPropertiesWithPropertyTrees(root); | 7954 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root); |
| 7939 | 7955 |
| 7940 EXPECT_FALSE(animated->visible_layer_rect().IsEmpty()); | 7956 EXPECT_FALSE(animated->visible_layer_rect().IsEmpty()); |
| 7941 } | 7957 } |
| 7942 | 7958 |
| 7943 TEST_F(LayerTreeHostCommonTest, | 7959 TEST_F(LayerTreeHostCommonTest, |
| 7944 VisibleContentRectForAnimatedLayerWithSingularTransform) { | 7960 VisibleContentRectForAnimatedLayerWithSingularTransform) { |
| 7945 LayerImpl* root = root_layer_for_testing(); | 7961 LayerImpl* root = root_layer_for_testing(); |
| 7946 LayerImpl* clip = AddChild<LayerImpl>(root); | 7962 LayerImpl* clip = AddChild<LayerImpl>(root); |
| 7947 LayerImpl* animated = AddChild<LayerImpl>(clip); | 7963 LayerImpl* animated = AddChild<LayerImpl>(clip); |
| 7948 LayerImpl* surface = AddChild<LayerImpl>(animated); | 7964 LayerImpl* surface = AddChild<LayerImpl>(animated); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 7966 surface->test_properties()->force_render_surface = true; | 7982 surface->test_properties()->force_render_surface = true; |
| 7967 descendant_of_animation->SetBounds(gfx::Size(200, 200)); | 7983 descendant_of_animation->SetBounds(gfx::Size(200, 200)); |
| 7968 | 7984 |
| 7969 TransformOperations start_transform_operations; | 7985 TransformOperations start_transform_operations; |
| 7970 start_transform_operations.AppendMatrix(uninvertible_matrix); | 7986 start_transform_operations.AppendMatrix(uninvertible_matrix); |
| 7971 TransformOperations end_transform_operations; | 7987 TransformOperations end_transform_operations; |
| 7972 | 7988 |
| 7973 AddAnimatedTransformToElementWithPlayer( | 7989 AddAnimatedTransformToElementWithPlayer( |
| 7974 animated->element_id(), timeline_impl(), 10.0, start_transform_operations, | 7990 animated->element_id(), timeline_impl(), 10.0, start_transform_operations, |
| 7975 end_transform_operations); | 7991 end_transform_operations); |
| 7976 ExecuteCalculateDrawPropertiesWithPropertyTrees(root); | 7992 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root); |
| 7977 | 7993 |
| 7978 // The animated layer has a singular transform and maps to a non-empty rect in | 7994 // The animated layer has a singular transform and maps to a non-empty rect in |
| 7979 // clipped target space, so is treated as fully visible. | 7995 // clipped target space, so is treated as fully visible. |
| 7980 EXPECT_EQ(gfx::Rect(120, 120), animated->visible_layer_rect()); | 7996 EXPECT_EQ(gfx::Rect(120, 120), animated->visible_layer_rect()); |
| 7981 | 7997 |
| 7982 // The singular transform on |animated| is flattened when inherited by | 7998 // The singular transform on |animated| is flattened when inherited by |
| 7983 // |surface|, and this happens to make it invertible. | 7999 // |surface|, and this happens to make it invertible. |
| 7984 EXPECT_EQ(gfx::Rect(2, 2), surface->visible_layer_rect()); | 8000 EXPECT_EQ(gfx::Rect(2, 2), surface->visible_layer_rect()); |
| 7985 EXPECT_EQ(gfx::Rect(2, 2), descendant_of_animation->visible_layer_rect()); | 8001 EXPECT_EQ(gfx::Rect(2, 2), descendant_of_animation->visible_layer_rect()); |
| 7986 | 8002 |
| 7987 gfx::Transform zero_matrix; | 8003 gfx::Transform zero_matrix; |
| 7988 zero_matrix.Scale3d(0.f, 0.f, 0.f); | 8004 zero_matrix.Scale3d(0.f, 0.f, 0.f); |
| 7989 root->layer_tree_impl()->property_trees()->transform_tree.OnTransformAnimated( | 8005 root->layer_tree_impl()->property_trees()->transform_tree.OnTransformAnimated( |
| 7990 zero_matrix, animated->transform_tree_index(), root->layer_tree_impl()); | 8006 zero_matrix, animated->transform_tree_index(), root->layer_tree_impl()); |
| 7991 ExecuteCalculateDrawPropertiesWithPropertyTrees(root); | 8007 // While computing visible rects by combining clips in screen space, we set |
| 8008 // the entire layer as visible if the screen space transform is singular. This |
| 8009 // is not always true when we combine clips in target space because if the |
| 8010 // intersection of combined_clip in taret space with layer_rect projected to |
| 8011 // target space is empty, we set it to an empty rect. |
| 8012 bool skip_verify_visible_rect_calculations = true; |
| 8013 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList( |
| 8014 root, skip_verify_visible_rect_calculations); |
| 7992 | 8015 |
| 7993 // The animated layer maps to the empty rect in clipped target space, so is | 8016 // The animated layer maps to the empty rect in clipped target space, so is |
| 7994 // treated as having an empty visible rect. | 8017 // treated as having an empty visible rect. |
| 7995 EXPECT_EQ(gfx::Rect(), animated->visible_layer_rect()); | 8018 EXPECT_EQ(gfx::Rect(), animated->visible_layer_rect()); |
| 7996 | 8019 |
| 8020 // The animated layer will be treated as fully visible when we combine clips |
| 8021 // in screen space. |
| 8022 gfx::Rect visible_rect = draw_property_utils::ComputeLayerVisibleRectDynamic( |
| 8023 root->layer_tree_impl()->property_trees(), animated); |
| 8024 EXPECT_EQ(gfx::Rect(120, 120), visible_rect); |
| 8025 |
| 7997 // This time, flattening does not make |animated|'s transform invertible. This | 8026 // This time, flattening does not make |animated|'s transform invertible. This |
| 7998 // means the clip cannot be projected into |surface|'s space, so we treat | 8027 // means the clip cannot be projected into |surface|'s space, so we treat |
| 7999 // |surface| and layers that draw into it as having empty visible rect. | 8028 // |surface| and layers that draw into it as having empty visible rect. |
| 8000 EXPECT_EQ(gfx::Rect(), surface->visible_layer_rect()); | 8029 EXPECT_EQ(gfx::Rect(), surface->visible_layer_rect()); |
| 8001 EXPECT_EQ(gfx::Rect(), descendant_of_animation->visible_layer_rect()); | 8030 EXPECT_EQ(gfx::Rect(), descendant_of_animation->visible_layer_rect()); |
| 8002 } | 8031 } |
| 8003 | 8032 |
| 8004 // Verify that having animated opacity but current opacity 1 still creates | 8033 // Verify that having animated opacity but current opacity 1 still creates |
| 8005 // a render surface. | 8034 // a render surface. |
| 8006 TEST_F(LayerTreeHostCommonTest, AnimatedOpacityCreatesRenderSurface) { | 8035 TEST_F(LayerTreeHostCommonTest, AnimatedOpacityCreatesRenderSurface) { |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8220 | 8249 |
| 8221 translate.Translate(10, 10); | 8250 translate.Translate(10, 10); |
| 8222 rotate.Rotate(45); | 8251 rotate.Rotate(45); |
| 8223 | 8252 |
| 8224 scoped_refptr<Layer> root = Layer::Create(); | 8253 scoped_refptr<Layer> root = Layer::Create(); |
| 8225 root->SetBounds(gfx::Size(800, 800)); | 8254 root->SetBounds(gfx::Size(800, 800)); |
| 8226 root->SetIsContainerForFixedPositionLayers(true); | 8255 root->SetIsContainerForFixedPositionLayers(true); |
| 8227 | 8256 |
| 8228 host()->SetRootLayer(root); | 8257 host()->SetRootLayer(root); |
| 8229 | 8258 |
| 8230 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8259 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get()); |
| 8231 EXPECT_FALSE(host()->property_trees()->needs_rebuild); | 8260 EXPECT_FALSE(host()->property_trees()->needs_rebuild); |
| 8232 | 8261 |
| 8233 root->SetTransform(translate); | 8262 root->SetTransform(translate); |
| 8234 EXPECT_FALSE(host()->property_trees()->needs_rebuild); | 8263 EXPECT_FALSE(host()->property_trees()->needs_rebuild); |
| 8235 | 8264 |
| 8236 root->SetTransform(rotate); | 8265 root->SetTransform(rotate); |
| 8237 EXPECT_TRUE(host()->property_trees()->needs_rebuild); | 8266 EXPECT_TRUE(host()->property_trees()->needs_rebuild); |
| 8238 } | 8267 } |
| 8239 | 8268 |
| 8240 TEST_F(LayerTreeHostCommonTest, ChangeTransformOrigin) { | 8269 TEST_F(LayerTreeHostCommonTest, ChangeTransformOrigin) { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8310 root->AddChild(child2); | 8339 root->AddChild(child2); |
| 8311 child1->AddChild(grandchild); | 8340 child1->AddChild(grandchild); |
| 8312 grandchild->AddChild(greatgrandchild); | 8341 grandchild->AddChild(greatgrandchild); |
| 8313 host()->SetRootLayer(root); | 8342 host()->SetRootLayer(root); |
| 8314 | 8343 |
| 8315 child1->RequestCopyOfOutput( | 8344 child1->RequestCopyOfOutput( |
| 8316 CopyOutputRequest::CreateBitmapRequest(base::Bind(&CopyOutputCallback))); | 8345 CopyOutputRequest::CreateBitmapRequest(base::Bind(&CopyOutputCallback))); |
| 8317 greatgrandchild->RequestCopyOfOutput( | 8346 greatgrandchild->RequestCopyOfOutput( |
| 8318 CopyOutputRequest::CreateBitmapRequest(base::Bind(&CopyOutputCallback))); | 8347 CopyOutputRequest::CreateBitmapRequest(base::Bind(&CopyOutputCallback))); |
| 8319 child2->SetOpacity(0.f); | 8348 child2->SetOpacity(0.f); |
| 8320 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8349 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get()); |
| 8321 | 8350 |
| 8322 EXPECT_EQ(root->num_copy_requests_in_target_subtree(), 2); | 8351 EXPECT_EQ(root->num_copy_requests_in_target_subtree(), 2); |
| 8323 EXPECT_EQ(child1->num_copy_requests_in_target_subtree(), 2); | 8352 EXPECT_EQ(child1->num_copy_requests_in_target_subtree(), 2); |
| 8324 EXPECT_EQ(child2->num_copy_requests_in_target_subtree(), 0); | 8353 EXPECT_EQ(child2->num_copy_requests_in_target_subtree(), 0); |
| 8325 EXPECT_EQ(grandchild->num_copy_requests_in_target_subtree(), 2); | 8354 EXPECT_EQ(grandchild->num_copy_requests_in_target_subtree(), 2); |
| 8326 EXPECT_EQ(greatgrandchild->num_copy_requests_in_target_subtree(), 1); | 8355 EXPECT_EQ(greatgrandchild->num_copy_requests_in_target_subtree(), 1); |
| 8327 } | 8356 } |
| 8328 | 8357 |
| 8329 TEST_F(LayerTreeHostCommonTest, SkippingSubtreeMain) { | 8358 TEST_F(LayerTreeHostCommonTest, SkippingSubtreeMain) { |
| 8330 scoped_refptr<Layer> root = Layer::Create(); | 8359 scoped_refptr<Layer> root = Layer::Create(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 8342 grandchild->SetBounds(gfx::Size(10, 10)); | 8371 grandchild->SetBounds(gfx::Size(10, 10)); |
| 8343 greatgrandchild->SetBounds(gfx::Size(10, 10)); | 8372 greatgrandchild->SetBounds(gfx::Size(10, 10)); |
| 8344 | 8373 |
| 8345 root->AddChild(child); | 8374 root->AddChild(child); |
| 8346 child->AddChild(grandchild); | 8375 child->AddChild(grandchild); |
| 8347 grandchild->AddChild(greatgrandchild); | 8376 grandchild->AddChild(greatgrandchild); |
| 8348 host()->SetRootLayer(root); | 8377 host()->SetRootLayer(root); |
| 8349 host()->GetLayerTree()->SetElementIdsForTesting(); | 8378 host()->GetLayerTree()->SetElementIdsForTesting(); |
| 8350 | 8379 |
| 8351 // Check the non-skipped case. | 8380 // Check the non-skipped case. |
| 8352 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8381 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get()); |
| 8353 const LayerList* update_list = GetUpdateLayerList(); | 8382 const LayerList* update_list = GetUpdateLayerList(); |
| 8354 EXPECT_TRUE(VerifyLayerInList(grandchild, update_list)); | 8383 EXPECT_TRUE(VerifyLayerInList(grandchild, update_list)); |
| 8355 | 8384 |
| 8356 // Now we will reset the visible rect from property trees for the grandchild, | 8385 // Now we will reset the visible rect from property trees for the grandchild, |
| 8357 // and we will configure |child| in several ways that should force the subtree | 8386 // and we will configure |child| in several ways that should force the subtree |
| 8358 // to be skipped. The visible content rect for |grandchild| should, therefore, | 8387 // to be skipped. The visible content rect for |grandchild| should, therefore, |
| 8359 // remain empty. | 8388 // remain empty. |
| 8360 gfx::Transform singular; | 8389 gfx::Transform singular; |
| 8361 singular.matrix().set(0, 0, 0); | 8390 singular.matrix().set(0, 0, 0); |
| 8362 | 8391 |
| 8363 child->SetTransform(singular); | 8392 child->SetTransform(singular); |
| 8364 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8393 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get()); |
| 8365 update_list = GetUpdateLayerList(); | 8394 update_list = GetUpdateLayerList(); |
| 8366 EXPECT_FALSE(VerifyLayerInList(grandchild, update_list)); | 8395 EXPECT_FALSE(VerifyLayerInList(grandchild, update_list)); |
| 8367 child->SetTransform(gfx::Transform()); | 8396 child->SetTransform(gfx::Transform()); |
| 8368 | 8397 |
| 8369 child->SetHideLayerAndSubtree(true); | 8398 child->SetHideLayerAndSubtree(true); |
| 8370 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8399 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get()); |
| 8371 update_list = GetUpdateLayerList(); | 8400 update_list = GetUpdateLayerList(); |
| 8372 EXPECT_FALSE(VerifyLayerInList(grandchild, update_list)); | 8401 EXPECT_FALSE(VerifyLayerInList(grandchild, update_list)); |
| 8373 child->SetHideLayerAndSubtree(false); | 8402 child->SetHideLayerAndSubtree(false); |
| 8374 | 8403 |
| 8375 gfx::Transform zero_z_scale; | 8404 gfx::Transform zero_z_scale; |
| 8376 zero_z_scale.Scale3d(1, 1, 0); | 8405 zero_z_scale.Scale3d(1, 1, 0); |
| 8377 child->SetTransform(zero_z_scale); | 8406 child->SetTransform(zero_z_scale); |
| 8378 | 8407 |
| 8379 // Add a transform animation with a start delay. Now, even though |child| has | 8408 // Add a transform animation with a start delay. Now, even though |child| has |
| 8380 // a singular transform, the subtree should still get processed. | 8409 // a singular transform, the subtree should still get processed. |
| 8381 int animation_id = 0; | 8410 int animation_id = 0; |
| 8382 std::unique_ptr<Animation> animation = Animation::Create( | 8411 std::unique_ptr<Animation> animation = Animation::Create( |
| 8383 std::unique_ptr<AnimationCurve>(new FakeTransformTransition(1.0)), | 8412 std::unique_ptr<AnimationCurve>(new FakeTransformTransition(1.0)), |
| 8384 animation_id, 1, TargetProperty::TRANSFORM); | 8413 animation_id, 1, TargetProperty::TRANSFORM); |
| 8385 animation->set_fill_mode(Animation::FillMode::NONE); | 8414 animation->set_fill_mode(Animation::FillMode::NONE); |
| 8386 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); | 8415 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); |
| 8387 AddAnimationToElementWithPlayer(child->element_id(), timeline(), | 8416 AddAnimationToElementWithPlayer(child->element_id(), timeline(), |
| 8388 std::move(animation)); | 8417 std::move(animation)); |
| 8389 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8418 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get()); |
| 8390 update_list = GetUpdateLayerList(); | 8419 update_list = GetUpdateLayerList(); |
| 8391 EXPECT_TRUE(VerifyLayerInList(grandchild, update_list)); | 8420 EXPECT_TRUE(VerifyLayerInList(grandchild, update_list)); |
| 8392 | 8421 |
| 8393 RemoveAnimationFromElementWithExistingPlayer(child->element_id(), timeline(), | 8422 RemoveAnimationFromElementWithExistingPlayer(child->element_id(), timeline(), |
| 8394 animation_id); | 8423 animation_id); |
| 8395 child->SetTransform(gfx::Transform()); | 8424 child->SetTransform(gfx::Transform()); |
| 8396 child->SetOpacity(0.f); | 8425 child->SetOpacity(0.f); |
| 8397 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8426 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get()); |
| 8398 update_list = GetUpdateLayerList(); | 8427 update_list = GetUpdateLayerList(); |
| 8399 EXPECT_FALSE(VerifyLayerInList(grandchild, update_list)); | 8428 EXPECT_FALSE(VerifyLayerInList(grandchild, update_list)); |
| 8400 | 8429 |
| 8401 // Now, even though child has zero opacity, we will configure |grandchild| and | 8430 // Now, even though child has zero opacity, we will configure |grandchild| and |
| 8402 // |greatgrandchild| in several ways that should force the subtree to be | 8431 // |greatgrandchild| in several ways that should force the subtree to be |
| 8403 // processed anyhow. | 8432 // processed anyhow. |
| 8404 grandchild->RequestCopyOfOutput( | 8433 grandchild->RequestCopyOfOutput( |
| 8405 CopyOutputRequest::CreateBitmapRequest(base::Bind(&CopyOutputCallback))); | 8434 CopyOutputRequest::CreateBitmapRequest(base::Bind(&CopyOutputCallback))); |
| 8406 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8435 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get()); |
| 8407 update_list = GetUpdateLayerList(); | 8436 update_list = GetUpdateLayerList(); |
| 8408 EXPECT_TRUE(VerifyLayerInList(grandchild, update_list)); | 8437 EXPECT_TRUE(VerifyLayerInList(grandchild, update_list)); |
| 8409 | 8438 |
| 8410 // Add an opacity animation with a start delay. | 8439 // Add an opacity animation with a start delay. |
| 8411 animation_id = 1; | 8440 animation_id = 1; |
| 8412 animation = Animation::Create( | 8441 animation = Animation::Create( |
| 8413 std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), | 8442 std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), |
| 8414 animation_id, 1, TargetProperty::OPACITY); | 8443 animation_id, 1, TargetProperty::OPACITY); |
| 8415 animation->set_fill_mode(Animation::FillMode::NONE); | 8444 animation->set_fill_mode(Animation::FillMode::NONE); |
| 8416 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); | 8445 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); |
| 8417 AddAnimationToElementWithExistingPlayer(child->element_id(), timeline(), | 8446 AddAnimationToElementWithExistingPlayer(child->element_id(), timeline(), |
| 8418 std::move(animation)); | 8447 std::move(animation)); |
| 8419 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8448 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get()); |
| 8420 update_list = GetUpdateLayerList(); | 8449 update_list = GetUpdateLayerList(); |
| 8421 EXPECT_TRUE(VerifyLayerInList(grandchild, update_list)); | 8450 EXPECT_TRUE(VerifyLayerInList(grandchild, update_list)); |
| 8422 } | 8451 } |
| 8423 | 8452 |
| 8424 TEST_F(LayerTreeHostCommonTest, SkippingLayerImpl) { | 8453 TEST_F(LayerTreeHostCommonTest, SkippingLayerImpl) { |
| 8425 FakeImplTaskRunnerProvider task_runner_provider; | 8454 FakeImplTaskRunnerProvider task_runner_provider; |
| 8426 TestSharedBitmapManager shared_bitmap_manager; | 8455 TestSharedBitmapManager shared_bitmap_manager; |
| 8427 TestTaskGraphRunner task_graph_runner; | 8456 TestTaskGraphRunner task_graph_runner; |
| 8428 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, | 8457 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, |
| 8429 &task_graph_runner); | 8458 &task_graph_runner); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 8449 LayerImpl* child_ptr = child.get(); | 8478 LayerImpl* child_ptr = child.get(); |
| 8450 LayerImpl* grandchild_ptr = grandchild.get(); | 8479 LayerImpl* grandchild_ptr = grandchild.get(); |
| 8451 | 8480 |
| 8452 child->test_properties()->AddChild(std::move(grandchild)); | 8481 child->test_properties()->AddChild(std::move(grandchild)); |
| 8453 root->test_properties()->AddChild(std::move(child)); | 8482 root->test_properties()->AddChild(std::move(child)); |
| 8454 host_impl.active_tree()->SetRootLayerForTesting(std::move(root)); | 8483 host_impl.active_tree()->SetRootLayerForTesting(std::move(root)); |
| 8455 | 8484 |
| 8456 host_impl.active_tree()->SetElementIdsForTesting(); | 8485 host_impl.active_tree()->SetElementIdsForTesting(); |
| 8457 | 8486 |
| 8458 // Check the non-skipped case. | 8487 // Check the non-skipped case. |
| 8459 // ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); | 8488 // ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root_ptr); |
| 8460 // EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); | 8489 // EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); |
| 8461 | 8490 |
| 8462 // Now we will reset the visible rect from property trees for the grandchild, | 8491 // Now we will reset the visible rect from property trees for the grandchild, |
| 8463 // and we will configure |child| in several ways that should force the subtree | 8492 // and we will configure |child| in several ways that should force the subtree |
| 8464 // to be skipped. The visible content rect for |grandchild| should, therefore, | 8493 // to be skipped. The visible content rect for |grandchild| should, therefore, |
| 8465 // remain empty. | 8494 // remain empty. |
| 8466 grandchild_ptr->set_visible_layer_rect(gfx::Rect()); | 8495 grandchild_ptr->set_visible_layer_rect(gfx::Rect()); |
| 8467 | 8496 |
| 8468 gfx::Transform singular; | 8497 gfx::Transform singular; |
| 8469 singular.matrix().set(0, 0, 0); | 8498 singular.matrix().set(0, 0, 0); |
| 8470 // This line is used to make the results of skipping and not skipping layers | 8499 // This line is used to make the results of skipping and not skipping layers |
| 8471 // different. | 8500 // different. |
| 8472 singular.matrix().set(0, 1, 1); | 8501 singular.matrix().set(0, 1, 1); |
| 8473 | 8502 |
| 8474 gfx::Transform rotate; | 8503 gfx::Transform rotate; |
| 8475 rotate.Rotate(90); | 8504 rotate.Rotate(90); |
| 8476 | 8505 |
| 8477 gfx::Transform rotate_back_and_translate; | 8506 gfx::Transform rotate_back_and_translate; |
| 8478 rotate_back_and_translate.RotateAboutYAxis(180); | 8507 rotate_back_and_translate.RotateAboutYAxis(180); |
| 8479 rotate_back_and_translate.Translate(-10, 0); | 8508 rotate_back_and_translate.Translate(-10, 0); |
| 8480 | 8509 |
| 8481 child_ptr->test_properties()->transform = singular; | 8510 child_ptr->test_properties()->transform = singular; |
| 8482 host_impl.active_tree()->property_trees()->needs_rebuild = true; | 8511 host_impl.active_tree()->property_trees()->needs_rebuild = true; |
| 8483 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); | 8512 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root_ptr); |
| 8484 EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect()); | 8513 EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect()); |
| 8485 child_ptr->test_properties()->transform = gfx::Transform(); | 8514 child_ptr->test_properties()->transform = gfx::Transform(); |
| 8486 | 8515 |
| 8487 child_ptr->test_properties()->hide_layer_and_subtree = true; | 8516 child_ptr->test_properties()->hide_layer_and_subtree = true; |
| 8488 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); | 8517 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root_ptr); |
| 8489 EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect()); | 8518 EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect()); |
| 8490 child_ptr->test_properties()->hide_layer_and_subtree = false; | 8519 child_ptr->test_properties()->hide_layer_and_subtree = false; |
| 8491 | 8520 |
| 8492 child_ptr->layer_tree_impl()->property_trees()->effect_tree.OnOpacityAnimated( | 8521 child_ptr->layer_tree_impl()->property_trees()->effect_tree.OnOpacityAnimated( |
| 8493 0.f, child_ptr->effect_tree_index(), child_ptr->layer_tree_impl()); | 8522 0.f, child_ptr->effect_tree_index(), child_ptr->layer_tree_impl()); |
| 8494 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); | 8523 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root_ptr); |
| 8495 EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect()); | 8524 EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect()); |
| 8496 child_ptr->test_properties()->opacity = 1.f; | 8525 child_ptr->test_properties()->opacity = 1.f; |
| 8497 | 8526 |
| 8498 root_ptr->test_properties()->transform = singular; | 8527 root_ptr->test_properties()->transform = singular; |
| 8499 // Force transform tree to have a node for child, so that ancestor's | 8528 // Force transform tree to have a node for child, so that ancestor's |
| 8500 // invertible transform can be tested. | 8529 // invertible transform can be tested. |
| 8501 child_ptr->test_properties()->transform = rotate; | 8530 child_ptr->test_properties()->transform = rotate; |
| 8502 host_impl.active_tree()->property_trees()->needs_rebuild = true; | 8531 host_impl.active_tree()->property_trees()->needs_rebuild = true; |
| 8503 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); | 8532 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root_ptr); |
| 8504 EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect()); | 8533 EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect()); |
| 8505 root_ptr->test_properties()->transform = gfx::Transform(); | 8534 root_ptr->test_properties()->transform = gfx::Transform(); |
| 8506 child_ptr->test_properties()->transform = gfx::Transform(); | 8535 child_ptr->test_properties()->transform = gfx::Transform(); |
| 8507 | 8536 |
| 8508 root_ptr->test_properties()->opacity = 0.f; | 8537 root_ptr->test_properties()->opacity = 0.f; |
| 8509 child_ptr->test_properties()->opacity = 0.7f; | 8538 child_ptr->test_properties()->opacity = 0.7f; |
| 8510 host_impl.active_tree()->property_trees()->needs_rebuild = true; | 8539 host_impl.active_tree()->property_trees()->needs_rebuild = true; |
| 8511 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); | 8540 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root_ptr); |
| 8512 EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect()); | 8541 EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect()); |
| 8513 root_ptr->test_properties()->opacity = 1.f; | 8542 root_ptr->test_properties()->opacity = 1.f; |
| 8514 | 8543 |
| 8515 child_ptr->test_properties()->opacity = 0.f; | 8544 child_ptr->test_properties()->opacity = 0.f; |
| 8516 // Now, even though child has zero opacity, we will configure |grandchild| and | 8545 // Now, even though child has zero opacity, we will configure |grandchild| and |
| 8517 // |greatgrandchild| in several ways that should force the subtree to be | 8546 // |greatgrandchild| in several ways that should force the subtree to be |
| 8518 // processed anyhow. | 8547 // processed anyhow. |
| 8519 grandchild_ptr->test_properties()->copy_requests.push_back( | 8548 grandchild_ptr->test_properties()->copy_requests.push_back( |
| 8520 CopyOutputRequest::CreateEmptyRequest()); | 8549 CopyOutputRequest::CreateEmptyRequest()); |
| 8521 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true; | 8550 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 8522 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); | 8551 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root_ptr); |
| 8523 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); | 8552 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); |
| 8524 | 8553 |
| 8525 host_impl.active_tree()->property_trees()->effect_tree.ClearCopyRequests(); | 8554 host_impl.active_tree()->property_trees()->effect_tree.ClearCopyRequests(); |
| 8526 child_ptr->test_properties()->opacity = 1.f; | 8555 child_ptr->test_properties()->opacity = 1.f; |
| 8527 | 8556 |
| 8528 // A double sided render surface with backface visible should not be skipped | 8557 // A double sided render surface with backface visible should not be skipped |
| 8529 grandchild_ptr->set_visible_layer_rect(gfx::Rect()); | 8558 grandchild_ptr->set_visible_layer_rect(gfx::Rect()); |
| 8530 child_ptr->SetHasRenderSurface(true); | 8559 child_ptr->SetHasRenderSurface(true); |
| 8531 child_ptr->test_properties()->double_sided = true; | 8560 child_ptr->test_properties()->double_sided = true; |
| 8532 child_ptr->test_properties()->transform = rotate_back_and_translate; | 8561 child_ptr->test_properties()->transform = rotate_back_and_translate; |
| 8533 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true; | 8562 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 8534 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); | 8563 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root_ptr); |
| 8535 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); | 8564 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); |
| 8536 child_ptr->test_properties()->transform = gfx::Transform(); | 8565 child_ptr->test_properties()->transform = gfx::Transform(); |
| 8537 | 8566 |
| 8538 std::unique_ptr<KeyframedTransformAnimationCurve> curve( | 8567 std::unique_ptr<KeyframedTransformAnimationCurve> curve( |
| 8539 KeyframedTransformAnimationCurve::Create()); | 8568 KeyframedTransformAnimationCurve::Create()); |
| 8540 TransformOperations start; | 8569 TransformOperations start; |
| 8541 start.AppendTranslate(1.f, 2.f, 3.f); | 8570 start.AppendTranslate(1.f, 2.f, 3.f); |
| 8542 gfx::Transform transform; | 8571 gfx::Transform transform; |
| 8543 transform.Scale3d(1.0, 2.0, 3.0); | 8572 transform.Scale3d(1.0, 2.0, 3.0); |
| 8544 TransformOperations operation; | 8573 TransformOperations operation; |
| 8545 operation.AppendMatrix(transform); | 8574 operation.AppendMatrix(transform); |
| 8546 curve->AddKeyframe( | 8575 curve->AddKeyframe( |
| 8547 TransformKeyframe::Create(base::TimeDelta(), start, nullptr)); | 8576 TransformKeyframe::Create(base::TimeDelta(), start, nullptr)); |
| 8548 curve->AddKeyframe(TransformKeyframe::Create( | 8577 curve->AddKeyframe(TransformKeyframe::Create( |
| 8549 base::TimeDelta::FromSecondsD(1.0), operation, nullptr)); | 8578 base::TimeDelta::FromSecondsD(1.0), operation, nullptr)); |
| 8550 std::unique_ptr<Animation> transform_animation( | 8579 std::unique_ptr<Animation> transform_animation( |
| 8551 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM)); | 8580 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM)); |
| 8552 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); | 8581 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); |
| 8553 host_impl.active_tree()->animation_host()->RegisterPlayerForElement( | 8582 host_impl.active_tree()->animation_host()->RegisterPlayerForElement( |
| 8554 root_ptr->element_id(), player.get()); | 8583 root_ptr->element_id(), player.get()); |
| 8555 host_impl.active_tree() | 8584 host_impl.active_tree() |
| 8556 ->animation_host() | 8585 ->animation_host() |
| 8557 ->GetElementAnimationsForElementId(root_ptr->element_id()) | 8586 ->GetElementAnimationsForElementId(root_ptr->element_id()) |
| 8558 ->AddAnimation(std::move(transform_animation)); | 8587 ->AddAnimation(std::move(transform_animation)); |
| 8559 grandchild_ptr->set_visible_layer_rect(gfx::Rect()); | 8588 grandchild_ptr->set_visible_layer_rect(gfx::Rect()); |
| 8560 child_ptr->SetScrollClipLayer(root_ptr->id()); | 8589 child_ptr->SetScrollClipLayer(root_ptr->id()); |
| 8561 root_ptr->test_properties()->transform = singular; | 8590 root_ptr->test_properties()->transform = singular; |
| 8562 child_ptr->test_properties()->transform = singular; | 8591 child_ptr->test_properties()->transform = singular; |
| 8563 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true; | 8592 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 8564 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); | 8593 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root_ptr); |
| 8565 EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect()); | 8594 EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect()); |
| 8566 | 8595 |
| 8567 host_impl.active_tree()->animation_host()->UnregisterPlayerForElement( | 8596 host_impl.active_tree()->animation_host()->UnregisterPlayerForElement( |
| 8568 root_ptr->element_id(), player.get()); | 8597 root_ptr->element_id(), player.get()); |
| 8569 } | 8598 } |
| 8570 | 8599 |
| 8571 TEST_F(LayerTreeHostCommonTest, LayerSkippingInSubtreeOfSingularTransform) { | 8600 TEST_F(LayerTreeHostCommonTest, LayerSkippingInSubtreeOfSingularTransform) { |
| 8572 LayerImpl* root = root_layer_for_testing(); | 8601 LayerImpl* root = root_layer_for_testing(); |
| 8573 LayerImpl* child = AddChild<LayerImpl>(root); | 8602 LayerImpl* child = AddChild<LayerImpl>(root); |
| 8574 LayerImpl* grand_child = AddChild<LayerImpl>(child); | 8603 LayerImpl* grand_child = AddChild<LayerImpl>(child); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8645 LayerImpl* root_ptr = root.get(); | 8674 LayerImpl* root_ptr = root.get(); |
| 8646 LayerImpl* grandchild_ptr = grandchild.get(); | 8675 LayerImpl* grandchild_ptr = grandchild.get(); |
| 8647 | 8676 |
| 8648 child->test_properties()->AddChild(std::move(grandchild)); | 8677 child->test_properties()->AddChild(std::move(grandchild)); |
| 8649 root->test_properties()->AddChild(std::move(child)); | 8678 root->test_properties()->AddChild(std::move(child)); |
| 8650 | 8679 |
| 8651 host_impl.pending_tree()->SetRootLayerForTesting(std::move(root)); | 8680 host_impl.pending_tree()->SetRootLayerForTesting(std::move(root)); |
| 8652 host_impl.pending_tree()->SetElementIdsForTesting(); | 8681 host_impl.pending_tree()->SetElementIdsForTesting(); |
| 8653 | 8682 |
| 8654 // Check the non-skipped case. | 8683 // Check the non-skipped case. |
| 8655 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); | 8684 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root_ptr); |
| 8656 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); | 8685 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); |
| 8657 | 8686 |
| 8658 std::unique_ptr<KeyframedFloatAnimationCurve> curve( | 8687 std::unique_ptr<KeyframedFloatAnimationCurve> curve( |
| 8659 KeyframedFloatAnimationCurve::Create()); | 8688 KeyframedFloatAnimationCurve::Create()); |
| 8660 std::unique_ptr<TimingFunction> func = | 8689 std::unique_ptr<TimingFunction> func = |
| 8661 CubicBezierTimingFunction::CreatePreset( | 8690 CubicBezierTimingFunction::CreatePreset( |
| 8662 CubicBezierTimingFunction::EaseType::EASE); | 8691 CubicBezierTimingFunction::EaseType::EASE); |
| 8663 curve->AddKeyframe( | 8692 curve->AddKeyframe( |
| 8664 FloatKeyframe::Create(base::TimeDelta(), 0.9f, std::move(func))); | 8693 FloatKeyframe::Create(base::TimeDelta(), 0.9f, std::move(func))); |
| 8665 curve->AddKeyframe( | 8694 curve->AddKeyframe( |
| 8666 FloatKeyframe::Create(base::TimeDelta::FromSecondsD(1.0), 0.3f, nullptr)); | 8695 FloatKeyframe::Create(base::TimeDelta::FromSecondsD(1.0), 0.3f, nullptr)); |
| 8667 std::unique_ptr<Animation> animation( | 8696 std::unique_ptr<Animation> animation( |
| 8668 Animation::Create(std::move(curve), 3, 3, TargetProperty::OPACITY)); | 8697 Animation::Create(std::move(curve), 3, 3, TargetProperty::OPACITY)); |
| 8669 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); | 8698 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); |
| 8670 host_impl.active_tree()->animation_host()->RegisterPlayerForElement( | 8699 host_impl.active_tree()->animation_host()->RegisterPlayerForElement( |
| 8671 root_ptr->element_id(), player.get()); | 8700 root_ptr->element_id(), player.get()); |
| 8672 host_impl.active_tree() | 8701 host_impl.active_tree() |
| 8673 ->animation_host() | 8702 ->animation_host() |
| 8674 ->GetElementAnimationsForElementId(root_ptr->element_id()) | 8703 ->GetElementAnimationsForElementId(root_ptr->element_id()) |
| 8675 ->AddAnimation(std::move(animation)); | 8704 ->AddAnimation(std::move(animation)); |
| 8676 root_ptr->test_properties()->opacity = 0.f; | 8705 root_ptr->test_properties()->opacity = 0.f; |
| 8677 grandchild_ptr->set_visible_layer_rect(gfx::Rect()); | 8706 grandchild_ptr->set_visible_layer_rect(gfx::Rect()); |
| 8678 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true; | 8707 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 8679 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); | 8708 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root_ptr); |
| 8680 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); | 8709 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); |
| 8681 | 8710 |
| 8682 host_impl.active_tree()->animation_host()->UnregisterPlayerForElement( | 8711 host_impl.active_tree()->animation_host()->UnregisterPlayerForElement( |
| 8683 root_ptr->element_id(), player.get()); | 8712 root_ptr->element_id(), player.get()); |
| 8684 } | 8713 } |
| 8685 | 8714 |
| 8686 TEST_F(LayerTreeHostCommonTest, SkippingLayer) { | 8715 TEST_F(LayerTreeHostCommonTest, SkippingLayer) { |
| 8687 LayerImpl* root = root_layer_for_testing(); | 8716 LayerImpl* root = root_layer_for_testing(); |
| 8688 LayerImpl* child = AddChild<LayerImpl>(root); | 8717 LayerImpl* child = AddChild<LayerImpl>(root); |
| 8689 | 8718 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8735 child->SetBounds(gfx::Size(100, 100)); | 8764 child->SetBounds(gfx::Size(100, 100)); |
| 8736 child->SetClipParent(root.get()); | 8765 child->SetClipParent(root.get()); |
| 8737 | 8766 |
| 8738 root->AddChild(parent); | 8767 root->AddChild(parent); |
| 8739 parent->AddChild(child); | 8768 parent->AddChild(child); |
| 8740 host()->SetRootLayer(root); | 8769 host()->SetRootLayer(root); |
| 8741 | 8770 |
| 8742 child->RequestCopyOfOutput( | 8771 child->RequestCopyOfOutput( |
| 8743 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback))); | 8772 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback))); |
| 8744 | 8773 |
| 8745 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8774 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get()); |
| 8746 EXPECT_EQ(parent->num_unclipped_descendants(), 1u); | 8775 EXPECT_EQ(parent->num_unclipped_descendants(), 1u); |
| 8747 | 8776 |
| 8748 EXPECT_GT(root->num_copy_requests_in_target_subtree(), 0); | 8777 EXPECT_GT(root->num_copy_requests_in_target_subtree(), 0); |
| 8749 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8778 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get()); |
| 8750 EXPECT_GT(root->num_copy_requests_in_target_subtree(), 0); | 8779 EXPECT_GT(root->num_copy_requests_in_target_subtree(), 0); |
| 8751 } | 8780 } |
| 8752 | 8781 |
| 8753 TEST_F(LayerTreeHostCommonTest, ResetPropertyTreeIndices) { | 8782 TEST_F(LayerTreeHostCommonTest, ResetPropertyTreeIndices) { |
| 8754 scoped_refptr<Layer> root = Layer::Create(); | 8783 scoped_refptr<Layer> root = Layer::Create(); |
| 8755 root->SetBounds(gfx::Size(800, 800)); | 8784 root->SetBounds(gfx::Size(800, 800)); |
| 8756 | 8785 |
| 8757 gfx::Transform translate_z; | 8786 gfx::Transform translate_z; |
| 8758 translate_z.Translate3d(0, 0, 10); | 8787 translate_z.Translate3d(0, 0, 10); |
| 8759 | 8788 |
| 8760 scoped_refptr<Layer> child = Layer::Create(); | 8789 scoped_refptr<Layer> child = Layer::Create(); |
| 8761 child->SetTransform(translate_z); | 8790 child->SetTransform(translate_z); |
| 8762 child->SetBounds(gfx::Size(100, 100)); | 8791 child->SetBounds(gfx::Size(100, 100)); |
| 8763 | 8792 |
| 8764 root->AddChild(child); | 8793 root->AddChild(child); |
| 8765 | 8794 |
| 8766 host()->SetRootLayer(root); | 8795 host()->SetRootLayer(root); |
| 8767 | 8796 |
| 8768 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8797 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get()); |
| 8769 EXPECT_NE(-1, child->transform_tree_index()); | 8798 EXPECT_NE(-1, child->transform_tree_index()); |
| 8770 | 8799 |
| 8771 child->RemoveFromParent(); | 8800 child->RemoveFromParent(); |
| 8772 | 8801 |
| 8773 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8802 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get()); |
| 8774 EXPECT_EQ(-1, child->transform_tree_index()); | 8803 EXPECT_EQ(-1, child->transform_tree_index()); |
| 8775 } | 8804 } |
| 8776 | 8805 |
| 8777 TEST_F(LayerTreeHostCommonTest, RenderSurfaceClipsSubtree) { | 8806 TEST_F(LayerTreeHostCommonTest, RenderSurfaceClipsSubtree) { |
| 8778 // Ensure that a Clip Node is added when a render surface applies clip. | 8807 // Ensure that a Clip Node is added when a render surface applies clip. |
| 8779 LayerImpl* root = root_layer_for_testing(); | 8808 LayerImpl* root = root_layer_for_testing(); |
| 8780 LayerImpl* significant_transform = AddChildToRoot<LayerImpl>(); | 8809 LayerImpl* significant_transform = AddChildToRoot<LayerImpl>(); |
| 8781 LayerImpl* layer_clips_subtree = AddChild<LayerImpl>(significant_transform); | 8810 LayerImpl* layer_clips_subtree = AddChild<LayerImpl>(significant_transform); |
| 8782 LayerImpl* render_surface = AddChild<LayerImpl>(layer_clips_subtree); | 8811 LayerImpl* render_surface = AddChild<LayerImpl>(layer_clips_subtree); |
| 8783 LayerImpl* test_layer = AddChild<LayerImpl>(render_surface); | 8812 LayerImpl* test_layer = AddChild<LayerImpl>(render_surface); |
| (...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9467 | 9496 |
| 9468 TEST_F(LayerTreeHostCommonTest, PropertyTreesRebuildWithOpacityChanges) { | 9497 TEST_F(LayerTreeHostCommonTest, PropertyTreesRebuildWithOpacityChanges) { |
| 9469 scoped_refptr<Layer> root = Layer::Create(); | 9498 scoped_refptr<Layer> root = Layer::Create(); |
| 9470 scoped_refptr<LayerWithForcedDrawsContent> child = | 9499 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 9471 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 9500 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 9472 root->AddChild(child); | 9501 root->AddChild(child); |
| 9473 host()->SetRootLayer(root); | 9502 host()->SetRootLayer(root); |
| 9474 | 9503 |
| 9475 root->SetBounds(gfx::Size(100, 100)); | 9504 root->SetBounds(gfx::Size(100, 100)); |
| 9476 child->SetBounds(gfx::Size(20, 20)); | 9505 child->SetBounds(gfx::Size(20, 20)); |
| 9477 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 9506 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get()); |
| 9478 | 9507 |
| 9479 // Changing the opacity from 1 to non-1 value should trigger rebuild of | 9508 // Changing the opacity from 1 to non-1 value should trigger rebuild of |
| 9480 // property trees as a new effect node will be created. | 9509 // property trees as a new effect node will be created. |
| 9481 child->SetOpacity(0.5f); | 9510 child->SetOpacity(0.5f); |
| 9482 PropertyTrees* property_trees = host()->property_trees(); | 9511 PropertyTrees* property_trees = host()->property_trees(); |
| 9483 EXPECT_TRUE(property_trees->needs_rebuild); | 9512 EXPECT_TRUE(property_trees->needs_rebuild); |
| 9484 | 9513 |
| 9485 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 9514 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get()); |
| 9486 EXPECT_NE(property_trees->effect_id_to_index_map.find(child->id()), | 9515 EXPECT_NE(property_trees->effect_id_to_index_map.find(child->id()), |
| 9487 property_trees->effect_id_to_index_map.end()); | 9516 property_trees->effect_id_to_index_map.end()); |
| 9488 | 9517 |
| 9489 // child already has an effect node. Changing its opacity shouldn't trigger | 9518 // child already has an effect node. Changing its opacity shouldn't trigger |
| 9490 // a property trees rebuild. | 9519 // a property trees rebuild. |
| 9491 child->SetOpacity(0.8f); | 9520 child->SetOpacity(0.8f); |
| 9492 property_trees = host()->property_trees(); | 9521 property_trees = host()->property_trees(); |
| 9493 EXPECT_FALSE(property_trees->needs_rebuild); | 9522 EXPECT_FALSE(property_trees->needs_rebuild); |
| 9494 | 9523 |
| 9495 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 9524 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get()); |
| 9496 EXPECT_NE(property_trees->effect_id_to_index_map.find(child->id()), | 9525 EXPECT_NE(property_trees->effect_id_to_index_map.find(child->id()), |
| 9497 property_trees->effect_id_to_index_map.end()); | 9526 property_trees->effect_id_to_index_map.end()); |
| 9498 | 9527 |
| 9499 // Changing the opacity from non-1 value to 1 should trigger a rebuild of | 9528 // Changing the opacity from non-1 value to 1 should trigger a rebuild of |
| 9500 // property trees as the effect node may no longer be needed. | 9529 // property trees as the effect node may no longer be needed. |
| 9501 child->SetOpacity(1.f); | 9530 child->SetOpacity(1.f); |
| 9502 property_trees = host()->property_trees(); | 9531 property_trees = host()->property_trees(); |
| 9503 EXPECT_TRUE(property_trees->needs_rebuild); | 9532 EXPECT_TRUE(property_trees->needs_rebuild); |
| 9504 | 9533 |
| 9505 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 9534 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get()); |
| 9506 EXPECT_EQ(property_trees->effect_id_to_index_map.find(child->id()), | 9535 EXPECT_EQ(property_trees->effect_id_to_index_map.find(child->id()), |
| 9507 property_trees->effect_id_to_index_map.end()); | 9536 property_trees->effect_id_to_index_map.end()); |
| 9508 } | 9537 } |
| 9509 | 9538 |
| 9510 TEST_F(LayerTreeHostCommonTest, OpacityAnimationsTrackingTest) { | 9539 TEST_F(LayerTreeHostCommonTest, OpacityAnimationsTrackingTest) { |
| 9511 scoped_refptr<Layer> root = Layer::Create(); | 9540 scoped_refptr<Layer> root = Layer::Create(); |
| 9512 scoped_refptr<LayerWithForcedDrawsContent> animated = | 9541 scoped_refptr<LayerWithForcedDrawsContent> animated = |
| 9513 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 9542 make_scoped_refptr(new LayerWithForcedDrawsContent()); |
| 9514 root->AddChild(animated); | 9543 root->AddChild(animated); |
| 9515 host()->SetRootLayer(root); | 9544 host()->SetRootLayer(root); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 9529 int animation_id = 0; | 9558 int animation_id = 0; |
| 9530 std::unique_ptr<Animation> animation = Animation::Create( | 9559 std::unique_ptr<Animation> animation = Animation::Create( |
| 9531 std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), | 9560 std::unique_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), |
| 9532 animation_id, 1, TargetProperty::OPACITY); | 9561 animation_id, 1, TargetProperty::OPACITY); |
| 9533 animation->set_fill_mode(Animation::FillMode::NONE); | 9562 animation->set_fill_mode(Animation::FillMode::NONE); |
| 9534 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); | 9563 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); |
| 9535 Animation* animation_ptr = animation.get(); | 9564 Animation* animation_ptr = animation.get(); |
| 9536 AddAnimationToElementWithExistingPlayer(animated->element_id(), timeline(), | 9565 AddAnimationToElementWithExistingPlayer(animated->element_id(), timeline(), |
| 9537 std::move(animation)); | 9566 std::move(animation)); |
| 9538 | 9567 |
| 9539 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 9568 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get()); |
| 9540 | 9569 |
| 9541 EffectTree& tree = root->GetLayerTree()->property_trees()->effect_tree; | 9570 EffectTree& tree = root->GetLayerTree()->property_trees()->effect_tree; |
| 9542 EffectNode* node = tree.Node(animated->effect_tree_index()); | 9571 EffectNode* node = tree.Node(animated->effect_tree_index()); |
| 9543 EXPECT_FALSE(node->is_currently_animating_opacity); | 9572 EXPECT_FALSE(node->is_currently_animating_opacity); |
| 9544 EXPECT_TRUE(node->has_potential_opacity_animation); | 9573 EXPECT_TRUE(node->has_potential_opacity_animation); |
| 9545 | 9574 |
| 9546 animation_ptr->set_time_offset(base::TimeDelta::FromMilliseconds(0)); | 9575 animation_ptr->set_time_offset(base::TimeDelta::FromMilliseconds(0)); |
| 9547 host()->AnimateLayers( | 9576 host()->AnimateLayers( |
| 9548 base::TimeTicks::FromInternalValue(std::numeric_limits<int64_t>::max())); | 9577 base::TimeTicks::FromInternalValue(std::numeric_limits<int64_t>::max())); |
| 9549 node = tree.Node(animated->effect_tree_index()); | 9578 node = tree.Node(animated->effect_tree_index()); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9586 curve->AddKeyframe(TransformKeyframe::Create( | 9615 curve->AddKeyframe(TransformKeyframe::Create( |
| 9587 base::TimeDelta::FromSecondsD(1.0), operation, nullptr)); | 9616 base::TimeDelta::FromSecondsD(1.0), operation, nullptr)); |
| 9588 std::unique_ptr<Animation> animation( | 9617 std::unique_ptr<Animation> animation( |
| 9589 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM)); | 9618 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM)); |
| 9590 animation->set_fill_mode(Animation::FillMode::NONE); | 9619 animation->set_fill_mode(Animation::FillMode::NONE); |
| 9591 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); | 9620 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); |
| 9592 Animation* animation_ptr = animation.get(); | 9621 Animation* animation_ptr = animation.get(); |
| 9593 AddAnimationToElementWithExistingPlayer(animated->element_id(), timeline(), | 9622 AddAnimationToElementWithExistingPlayer(animated->element_id(), timeline(), |
| 9594 std::move(animation)); | 9623 std::move(animation)); |
| 9595 | 9624 |
| 9596 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 9625 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root.get()); |
| 9597 | 9626 |
| 9598 TransformTree& tree = root->GetLayerTree()->property_trees()->transform_tree; | 9627 TransformTree& tree = root->GetLayerTree()->property_trees()->transform_tree; |
| 9599 TransformNode* node = tree.Node(animated->transform_tree_index()); | 9628 TransformNode* node = tree.Node(animated->transform_tree_index()); |
| 9600 EXPECT_FALSE(node->is_currently_animating); | 9629 EXPECT_FALSE(node->is_currently_animating); |
| 9601 EXPECT_TRUE(node->has_potential_animation); | 9630 EXPECT_TRUE(node->has_potential_animation); |
| 9602 | 9631 |
| 9603 animation_ptr->set_time_offset(base::TimeDelta::FromMilliseconds(0)); | 9632 animation_ptr->set_time_offset(base::TimeDelta::FromMilliseconds(0)); |
| 9604 host()->AnimateLayers( | 9633 host()->AnimateLayers( |
| 9605 base::TimeTicks::FromInternalValue(std::numeric_limits<int64_t>::max())); | 9634 base::TimeTicks::FromInternalValue(std::numeric_limits<int64_t>::max())); |
| 9606 node = tree.Node(animated->transform_tree_index()); | 9635 node = tree.Node(animated->transform_tree_index()); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9727 child7->SetScrollClipLayerId(parent3->id()); | 9756 child7->SetScrollClipLayerId(parent3->id()); |
| 9728 | 9757 |
| 9729 child8->SetScrollParent(child7.get()); | 9758 child8->SetScrollParent(child7.get()); |
| 9730 grand_child11->SetScrollClipLayerId(parent3->id()); | 9759 grand_child11->SetScrollClipLayerId(parent3->id()); |
| 9731 | 9760 |
| 9732 parent5->SetNonFastScrollableRegion(gfx::Rect(0, 0, 50, 50)); | 9761 parent5->SetNonFastScrollableRegion(gfx::Rect(0, 0, 50, 50)); |
| 9733 parent5->SetBounds(gfx::Size(10, 10)); | 9762 parent5->SetBounds(gfx::Size(10, 10)); |
| 9734 | 9763 |
| 9735 host()->GetLayerTree()->RegisterViewportLayers(nullptr, page_scale_layer, | 9764 host()->GetLayerTree()->RegisterViewportLayers(nullptr, page_scale_layer, |
| 9736 parent2, nullptr); | 9765 parent2, nullptr); |
| 9737 ExecuteCalculateDrawPropertiesWithPropertyTrees(root1.get()); | 9766 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root1.get()); |
| 9738 | 9767 |
| 9739 const int kInvalidPropertyTreeNodeId = -1; | 9768 const int kInvalidPropertyTreeNodeId = -1; |
| 9740 const int kRootPropertyTreeNodeId = 0; | 9769 const int kRootPropertyTreeNodeId = 0; |
| 9741 | 9770 |
| 9742 // Property tree root | 9771 // Property tree root |
| 9743 ScrollTree& scroll_tree = host()->property_trees()->scroll_tree; | 9772 ScrollTree& scroll_tree = host()->property_trees()->scroll_tree; |
| 9744 PropertyTrees property_trees; | 9773 PropertyTrees property_trees; |
| 9745 property_trees.is_main_thread = true; | 9774 property_trees.is_main_thread = true; |
| 9746 property_trees.is_active = false; | 9775 property_trees.is_active = false; |
| 9747 ScrollTree& expected_scroll_tree = property_trees.scroll_tree; | 9776 ScrollTree& expected_scroll_tree = property_trees.scroll_tree; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9839 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); | 9868 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); |
| 9840 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); | 9869 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); |
| 9841 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); | 9870 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); |
| 9842 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); | 9871 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); |
| 9843 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); | 9872 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); |
| 9844 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); | 9873 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); |
| 9845 } | 9874 } |
| 9846 | 9875 |
| 9847 } // namespace | 9876 } // namespace |
| 9848 } // namespace cc | 9877 } // namespace cc |
| OLD | NEW |