| 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/layers/layer_impl.h" | 5 #include "cc/layers/layer_impl.h" |
| 6 | 6 |
| 7 #include "cc/animation/mutable_properties.h" | 7 #include "cc/animation/mutable_properties.h" |
| 8 #include "cc/layers/painted_scrollbar_layer_impl.h" | 8 #include "cc/layers/painted_scrollbar_layer_impl.h" |
| 9 #include "cc/layers/solid_color_scrollbar_layer_impl.h" | 9 #include "cc/layers/solid_color_scrollbar_layer_impl.h" |
| 10 #include "cc/output/filter_operation.h" | 10 #include "cc/output/filter_operation.h" |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 | 173 |
| 174 // These properties are internal, and should not be considered "change" when | 174 // These properties are internal, and should not be considered "change" when |
| 175 // they are used. | 175 // they are used. |
| 176 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( | 176 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( |
| 177 root->SetUpdateRect(arbitrary_rect)); | 177 root->SetUpdateRect(arbitrary_rect)); |
| 178 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetBounds(arbitrary_size)); | 178 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetBounds(arbitrary_size)); |
| 179 host_impl.active_tree()->property_trees()->needs_rebuild = true; | 179 host_impl.active_tree()->property_trees()->needs_rebuild = true; |
| 180 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); | 180 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); |
| 181 | 181 |
| 182 // Changing these properties affects the entire subtree of layers. | 182 // Changing these properties affects the entire subtree of layers. |
| 183 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->OnFilterAnimated(arbitrary_filters)); | 183 EXECUTE_AND_VERIFY_NO_NEED_TO_PUSH_PROPERTIES_AND_SUBTREE_CHANGED( |
| 184 EXECUTE_AND_VERIFY_SUBTREE_CHANGED( | 184 host_impl.active_tree()->property_trees()->effect_tree.OnFilterAnimated( |
| 185 root->OnFilterAnimated(FilterOperations())); | 185 arbitrary_filters, root->effect_tree_index(), |
| 186 host_impl.active_tree())); |
| 187 EXECUTE_AND_VERIFY_NO_NEED_TO_PUSH_PROPERTIES_AND_SUBTREE_CHANGED( |
| 188 host_impl.active_tree()->property_trees()->effect_tree.OnFilterAnimated( |
| 189 FilterOperations(), root->effect_tree_index(), |
| 190 host_impl.active_tree())); |
| 186 EXECUTE_AND_VERIFY_NO_NEED_TO_PUSH_PROPERTIES_AND_SUBTREE_CHANGED( | 191 EXECUTE_AND_VERIFY_NO_NEED_TO_PUSH_PROPERTIES_AND_SUBTREE_CHANGED( |
| 187 host_impl.active_tree()->property_trees()->effect_tree.OnOpacityAnimated( | 192 host_impl.active_tree()->property_trees()->effect_tree.OnOpacityAnimated( |
| 188 arbitrary_number, root->effect_tree_index(), | 193 arbitrary_number, root->effect_tree_index(), |
| 189 host_impl.active_tree())); | 194 host_impl.active_tree())); |
| 190 EXECUTE_AND_VERIFY_NO_NEED_TO_PUSH_PROPERTIES_AND_SUBTREE_CHANGED( | 195 EXECUTE_AND_VERIFY_NO_NEED_TO_PUSH_PROPERTIES_AND_SUBTREE_CHANGED( |
| 191 root->OnTransformAnimated(arbitrary_transform)); | 196 root->OnTransformAnimated(arbitrary_transform)); |
| 192 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->ScrollBy(arbitrary_vector2d); | 197 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->ScrollBy(arbitrary_vector2d); |
| 193 root->SetNeedsPushProperties()); | 198 root->SetNeedsPushProperties()); |
| 194 // SetBoundsDelta changes subtree only when masks_to_bounds is true and it | 199 // SetBoundsDelta changes subtree only when masks_to_bounds is true and it |
| 195 // doesn't set needs_push_properties as it is always called on active tree. | 200 // doesn't set needs_push_properties as it is always called on active tree. |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 // Render surface functions should not trigger update draw properties, because | 282 // Render surface functions should not trigger update draw properties, because |
| 278 // creating render surface is part of update draw properties. | 283 // creating render surface is part of update draw properties. |
| 279 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetHasRenderSurface(true)); | 284 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetHasRenderSurface(true)); |
| 280 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetHasRenderSurface(false)); | 285 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetHasRenderSurface(false)); |
| 281 // Create a render surface, because we must have a render surface if we have | 286 // Create a render surface, because we must have a render surface if we have |
| 282 // filters. | 287 // filters. |
| 283 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetHasRenderSurface(true)); | 288 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetHasRenderSurface(true)); |
| 284 | 289 |
| 285 // Related filter functions. | 290 // Related filter functions. |
| 286 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( | 291 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( |
| 287 root->OnFilterAnimated(arbitrary_filters)); | 292 host_impl.active_tree()->property_trees()->effect_tree.OnFilterAnimated( |
| 293 arbitrary_filters, root->effect_tree_index(), |
| 294 host_impl.active_tree())); |
| 288 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( | 295 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( |
| 289 root->OnFilterAnimated(arbitrary_filters)); | 296 host_impl.active_tree()->property_trees()->effect_tree.OnFilterAnimated( |
| 297 arbitrary_filters, root->effect_tree_index(), |
| 298 host_impl.active_tree())); |
| 290 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( | 299 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( |
| 291 root->OnFilterAnimated(FilterOperations())); | 300 host_impl.active_tree()->property_trees()->effect_tree.OnFilterAnimated( |
| 301 FilterOperations(), root->effect_tree_index(), |
| 302 host_impl.active_tree())); |
| 292 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( | 303 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( |
| 293 root->OnFilterAnimated(arbitrary_filters)); | 304 host_impl.active_tree()->property_trees()->effect_tree.OnFilterAnimated( |
| 305 arbitrary_filters, root->effect_tree_index(), |
| 306 host_impl.active_tree())); |
| 294 | 307 |
| 295 // Related scrolling functions. | 308 // Related scrolling functions. |
| 296 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(large_size)); | 309 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(large_size)); |
| 297 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(large_size)); | 310 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(large_size)); |
| 298 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); | 311 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); |
| 299 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->ScrollBy(arbitrary_vector2d)); | 312 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->ScrollBy(arbitrary_vector2d)); |
| 300 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->ScrollBy(gfx::Vector2d())); | 313 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->ScrollBy(gfx::Vector2d())); |
| 301 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( | 314 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( |
| 302 layer->layer_tree_impl()->DidUpdateScrollOffset( | 315 layer->layer_tree_impl()->DidUpdateScrollOffset( |
| 303 layer->id(), layer->transform_tree_index())); | 316 layer->id(), layer->transform_tree_index())); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 328 host_impl.active_tree())); | 341 host_impl.active_tree())); |
| 329 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( | 342 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( |
| 330 layer->OnTransformAnimated(arbitrary_transform)); | 343 layer->OnTransformAnimated(arbitrary_transform)); |
| 331 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size); | 344 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size); |
| 332 layer->NoteLayerPropertyChanged()); | 345 layer->NoteLayerPropertyChanged()); |
| 333 | 346 |
| 334 // Unrelated functions, set to the same values, no needs update. | 347 // Unrelated functions, set to the same values, no needs update. |
| 335 layer->test_properties()->filters = arbitrary_filters; | 348 layer->test_properties()->filters = arbitrary_filters; |
| 336 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); | 349 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); |
| 337 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( | 350 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( |
| 338 layer->OnFilterAnimated(arbitrary_filters)); | 351 host_impl.active_tree()->property_trees()->effect_tree.OnFilterAnimated( |
| 352 arbitrary_filters, layer->effect_tree_index(), |
| 353 host_impl.active_tree())); |
| 339 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetMasksToBounds(true)); | 354 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetMasksToBounds(true)); |
| 340 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetContentsOpaque(true)); | 355 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetContentsOpaque(true)); |
| 341 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( | 356 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( |
| 342 layer2->SetPosition(arbitrary_point_f)); | 357 layer2->SetPosition(arbitrary_point_f)); |
| 343 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->Set3dSortingContextId(1)); | 358 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->Set3dSortingContextId(1)); |
| 344 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetDrawsContent(true)); | 359 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetDrawsContent(true)); |
| 345 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( | 360 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( |
| 346 layer->SetBackgroundColor(arbitrary_color)); | 361 layer->SetBackgroundColor(arbitrary_color)); |
| 347 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size)); | 362 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size)); |
| 348 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetElementId(ElementId(2, 0))); | 363 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetElementId(ElementId(2, 0))); |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 | 586 |
| 572 pending_layer->PushPropertiesTo(layer()); | 587 pending_layer->PushPropertiesTo(layer()); |
| 573 | 588 |
| 574 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); | 589 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); |
| 575 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(), | 590 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(), |
| 576 pending_layer->CurrentScrollOffset()); | 591 pending_layer->CurrentScrollOffset()); |
| 577 } | 592 } |
| 578 | 593 |
| 579 } // namespace | 594 } // namespace |
| 580 } // namespace cc | 595 } // namespace cc |
| OLD | NEW |