| 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 host_impl.active_tree() | 196 host_impl.active_tree() |
| 192 ->property_trees() | 197 ->property_trees() |
| 193 ->transform_tree.OnTransformAnimated(arbitrary_transform, | 198 ->transform_tree.OnTransformAnimated(arbitrary_transform, |
| 194 root->transform_tree_index(), | 199 root->transform_tree_index(), |
| 195 host_impl.active_tree())); | 200 host_impl.active_tree())); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 // Render surface functions should not trigger update draw properties, because | 286 // Render surface functions should not trigger update draw properties, because |
| 282 // creating render surface is part of update draw properties. | 287 // creating render surface is part of update draw properties. |
| 283 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetHasRenderSurface(true)); | 288 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetHasRenderSurface(true)); |
| 284 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetHasRenderSurface(false)); | 289 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetHasRenderSurface(false)); |
| 285 // Create a render surface, because we must have a render surface if we have | 290 // Create a render surface, because we must have a render surface if we have |
| 286 // filters. | 291 // filters. |
| 287 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetHasRenderSurface(true)); | 292 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetHasRenderSurface(true)); |
| 288 | 293 |
| 289 // Related filter functions. | 294 // Related filter functions. |
| 290 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( | 295 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( |
| 291 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())); |
| 292 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( | 299 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( |
| 293 root->OnFilterAnimated(arbitrary_filters)); | 300 host_impl.active_tree()->property_trees()->effect_tree.OnFilterAnimated( |
| 301 arbitrary_filters, root->effect_tree_index(), |
| 302 host_impl.active_tree())); |
| 294 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( | 303 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( |
| 295 root->OnFilterAnimated(FilterOperations())); | 304 host_impl.active_tree()->property_trees()->effect_tree.OnFilterAnimated( |
| 305 FilterOperations(), root->effect_tree_index(), |
| 306 host_impl.active_tree())); |
| 296 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( | 307 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( |
| 297 root->OnFilterAnimated(arbitrary_filters)); | 308 host_impl.active_tree()->property_trees()->effect_tree.OnFilterAnimated( |
| 309 arbitrary_filters, root->effect_tree_index(), |
| 310 host_impl.active_tree())); |
| 298 | 311 |
| 299 // Related scrolling functions. | 312 // Related scrolling functions. |
| 300 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(large_size)); | 313 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(large_size)); |
| 301 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(large_size)); | 314 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(large_size)); |
| 302 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); | 315 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); |
| 303 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->ScrollBy(arbitrary_vector2d)); | 316 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->ScrollBy(arbitrary_vector2d)); |
| 304 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->ScrollBy(gfx::Vector2d())); | 317 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->ScrollBy(gfx::Vector2d())); |
| 305 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( | 318 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( |
| 306 layer->layer_tree_impl()->DidUpdateScrollOffset( | 319 layer->layer_tree_impl()->DidUpdateScrollOffset( |
| 307 layer->id(), layer->transform_tree_index())); | 320 layer->id(), layer->transform_tree_index())); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 336 ->transform_tree.OnTransformAnimated(arbitrary_transform, | 349 ->transform_tree.OnTransformAnimated(arbitrary_transform, |
| 337 layer->transform_tree_index(), | 350 layer->transform_tree_index(), |
| 338 host_impl.active_tree())); | 351 host_impl.active_tree())); |
| 339 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size); | 352 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size); |
| 340 layer->NoteLayerPropertyChanged()); | 353 layer->NoteLayerPropertyChanged()); |
| 341 | 354 |
| 342 // Unrelated functions, set to the same values, no needs update. | 355 // Unrelated functions, set to the same values, no needs update. |
| 343 layer->test_properties()->filters = arbitrary_filters; | 356 layer->test_properties()->filters = arbitrary_filters; |
| 344 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); | 357 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); |
| 345 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( | 358 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( |
| 346 layer->OnFilterAnimated(arbitrary_filters)); | 359 host_impl.active_tree()->property_trees()->effect_tree.OnFilterAnimated( |
| 360 arbitrary_filters, layer->effect_tree_index(), |
| 361 host_impl.active_tree())); |
| 347 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetMasksToBounds(true)); | 362 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetMasksToBounds(true)); |
| 348 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetContentsOpaque(true)); | 363 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetContentsOpaque(true)); |
| 349 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( | 364 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( |
| 350 layer2->SetPosition(arbitrary_point_f)); | 365 layer2->SetPosition(arbitrary_point_f)); |
| 351 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->Set3dSortingContextId(1)); | 366 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->Set3dSortingContextId(1)); |
| 352 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetDrawsContent(true)); | 367 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetDrawsContent(true)); |
| 353 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( | 368 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( |
| 354 layer->SetBackgroundColor(arbitrary_color)); | 369 layer->SetBackgroundColor(arbitrary_color)); |
| 355 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size)); | 370 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size)); |
| 356 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetElementId(ElementId(2, 0))); | 371 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetElementId(ElementId(2, 0))); |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 | 594 |
| 580 pending_layer->PushPropertiesTo(layer()); | 595 pending_layer->PushPropertiesTo(layer()); |
| 581 | 596 |
| 582 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); | 597 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); |
| 583 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(), | 598 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(), |
| 584 pending_layer->CurrentScrollOffset()); | 599 pending_layer->CurrentScrollOffset()); |
| 585 } | 600 } |
| 586 | 601 |
| 587 } // namespace | 602 } // namespace |
| 588 } // namespace cc | 603 } // namespace cc |
| OLD | NEW |