| 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 // SetBoundsDelta changes subtree only when masks_to_bounds is true and it | 181 // SetBoundsDelta changes subtree only when masks_to_bounds is true and it |
| 182 // doesn't set needs_push_properties as it is always called on active tree. | 182 // doesn't set needs_push_properties as it is always called on active tree. |
| 183 root->SetMasksToBounds(true); | 183 root->SetMasksToBounds(true); |
| 184 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetBoundsDelta(arbitrary_vector2d); | 184 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetBoundsDelta(arbitrary_vector2d); |
| 185 root->SetNeedsPushProperties()); | 185 root->SetNeedsPushProperties()); |
| 186 | 186 |
| 187 // Changing these properties only affects the layer itself. | 187 // Changing these properties only affects the layer itself. |
| 188 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetDrawsContent(true)); | 188 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetDrawsContent(true)); |
| 189 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED( | 189 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED( |
| 190 root->SetBackgroundColor(arbitrary_color)); | 190 root->SetBackgroundColor(arbitrary_color)); |
| 191 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED( | |
| 192 root->SetBackgroundFilters(arbitrary_filters)); | |
| 193 | 191 |
| 194 // Special case: check that SetBounds changes behavior depending on | 192 // Special case: check that SetBounds changes behavior depending on |
| 195 // masksToBounds. | 193 // masksToBounds. |
| 196 gfx::Size bounds_size(135, 246); | 194 gfx::Size bounds_size(135, 246); |
| 197 root->SetMasksToBounds(false); | 195 root->SetMasksToBounds(false); |
| 198 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetBounds(bounds_size)); | 196 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetBounds(bounds_size)); |
| 199 host_impl.active_tree()->property_trees()->needs_rebuild = true; | 197 host_impl.active_tree()->property_trees()->needs_rebuild = true; |
| 200 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); | 198 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); |
| 201 | 199 |
| 202 root->SetMasksToBounds(true); | 200 root->SetMasksToBounds(true); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 layer->NoteLayerPropertyChanged()); | 305 layer->NoteLayerPropertyChanged()); |
| 308 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetContentsOpaque(true); | 306 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetContentsOpaque(true); |
| 309 layer->NoteLayerPropertyChanged()); | 307 layer->NoteLayerPropertyChanged()); |
| 310 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer2->SetPosition(arbitrary_point_f); | 308 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer2->SetPosition(arbitrary_point_f); |
| 311 layer->NoteLayerPropertyChanged()); | 309 layer->NoteLayerPropertyChanged()); |
| 312 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->Set3dSortingContextId(1); | 310 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->Set3dSortingContextId(1); |
| 313 layer->NoteLayerPropertyChanged()); | 311 layer->NoteLayerPropertyChanged()); |
| 314 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( | 312 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( |
| 315 layer->SetBackgroundColor(arbitrary_color)); | 313 layer->SetBackgroundColor(arbitrary_color)); |
| 316 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( | 314 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( |
| 317 layer->SetBackgroundFilters(arbitrary_filters)); | |
| 318 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( | |
| 319 layer->OnOpacityAnimated(arbitrary_number)); | 315 layer->OnOpacityAnimated(arbitrary_number)); |
| 320 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBlendMode(arbitrary_blend_mode); | 316 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBlendMode(arbitrary_blend_mode); |
| 321 layer->NoteLayerPropertyChanged()); | 317 layer->NoteLayerPropertyChanged()); |
| 322 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( | 318 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( |
| 323 layer->OnTransformAnimated(arbitrary_transform)); | 319 layer->OnTransformAnimated(arbitrary_transform)); |
| 324 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size); | 320 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size); |
| 325 layer->NoteLayerPropertyChanged()); | 321 layer->NoteLayerPropertyChanged()); |
| 326 | 322 |
| 327 // Unrelated functions, set to the same values, no needs update. | 323 // Unrelated functions, set to the same values, no needs update. |
| 328 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetFilters(arbitrary_filters)); | 324 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetFilters(arbitrary_filters)); |
| 329 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetMasksToBounds(true)); | 325 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetMasksToBounds(true)); |
| 330 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetContentsOpaque(true)); | 326 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetContentsOpaque(true)); |
| 331 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( | 327 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( |
| 332 layer2->SetPosition(arbitrary_point_f)); | 328 layer2->SetPosition(arbitrary_point_f)); |
| 333 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->Set3dSortingContextId(1)); | 329 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->Set3dSortingContextId(1)); |
| 334 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetDrawsContent(true)); | 330 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetDrawsContent(true)); |
| 335 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( | 331 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( |
| 336 layer->SetBackgroundColor(arbitrary_color)); | 332 layer->SetBackgroundColor(arbitrary_color)); |
| 337 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( | 333 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( |
| 338 layer->SetBackgroundFilters(arbitrary_filters)); | |
| 339 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( | |
| 340 layer->SetBlendMode(arbitrary_blend_mode)); | 334 layer->SetBlendMode(arbitrary_blend_mode)); |
| 341 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( | 335 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( |
| 342 layer->SetTransform(arbitrary_transform)); | 336 layer->SetTransform(arbitrary_transform)); |
| 343 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size)); | 337 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size)); |
| 344 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetElementId(2)); | 338 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetElementId(2)); |
| 345 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( | 339 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( |
| 346 layer->SetMutableProperties(MutableProperty::kTransform)); | 340 layer->SetMutableProperties(MutableProperty::kTransform)); |
| 347 } | 341 } |
| 348 | 342 |
| 349 TEST(LayerImplTest, SafeOpaqueBackgroundColor) { | 343 TEST(LayerImplTest, SafeOpaqueBackgroundColor) { |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 | 556 |
| 563 pending_layer->PushPropertiesTo(layer()); | 557 pending_layer->PushPropertiesTo(layer()); |
| 564 | 558 |
| 565 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); | 559 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); |
| 566 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(), | 560 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(), |
| 567 pending_layer->CurrentScrollOffset()); | 561 pending_layer->CurrentScrollOffset()); |
| 568 } | 562 } |
| 569 | 563 |
| 570 } // namespace | 564 } // namespace |
| 571 } // namespace cc | 565 } // namespace cc |
| OLD | NEW |