| 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 host_impl.active_tree()->property_trees()->needs_rebuild = true; | 200 host_impl.active_tree()->property_trees()->needs_rebuild = true; |
| 201 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); | 201 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); |
| 202 | 202 |
| 203 root->SetMasksToBounds(true); | 203 root->SetMasksToBounds(true); |
| 204 host_impl.active_tree()->property_trees()->needs_rebuild = true; | 204 host_impl.active_tree()->property_trees()->needs_rebuild = true; |
| 205 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); | 205 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); |
| 206 | 206 |
| 207 // Changing these properties does not cause the layer to be marked as changed | 207 // Changing these properties does not cause the layer to be marked as changed |
| 208 // but does cause the layer to need to push properties. | 208 // but does cause the layer to need to push properties. |
| 209 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( | 209 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( |
| 210 root->SetElementId(ElementId(2, 0))); | 210 root->SetElementId(2)); |
| 211 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( | 211 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( |
| 212 root->SetMutableProperties(MutableProperty::kOpacity)); | 212 root->SetMutableProperties(MutableProperty::kOpacity)); |
| 213 | 213 |
| 214 // After setting all these properties already, setting to the exact same | 214 // After setting all these properties already, setting to the exact same |
| 215 // values again should not cause any change. | 215 // values again should not cause any change. |
| 216 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetMasksToBounds(true)); | 216 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetMasksToBounds(true)); |
| 217 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( | 217 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( |
| 218 root->SetPosition(arbitrary_point_f)); | 218 root->SetPosition(arbitrary_point_f)); |
| 219 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->Set3dSortingContextId(1)); | 219 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->Set3dSortingContextId(1)); |
| 220 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( | 220 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetDrawsContent(true)); | 345 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetDrawsContent(true)); |
| 346 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( | 346 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( |
| 347 layer->SetBackgroundColor(arbitrary_color)); | 347 layer->SetBackgroundColor(arbitrary_color)); |
| 348 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( | 348 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( |
| 349 layer->SetBackgroundFilters(arbitrary_filters)); | 349 layer->SetBackgroundFilters(arbitrary_filters)); |
| 350 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( | 350 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( |
| 351 layer->SetBlendMode(arbitrary_blend_mode)); | 351 layer->SetBlendMode(arbitrary_blend_mode)); |
| 352 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( | 352 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( |
| 353 layer->SetTransform(arbitrary_transform)); | 353 layer->SetTransform(arbitrary_transform)); |
| 354 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size)); | 354 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size)); |
| 355 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetElementId(ElementId(2, 0))); | 355 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetElementId(2)); |
| 356 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( | 356 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( |
| 357 layer->SetMutableProperties(MutableProperty::kTransform)); | 357 layer->SetMutableProperties(MutableProperty::kTransform)); |
| 358 } | 358 } |
| 359 | 359 |
| 360 TEST(LayerImplTest, SafeOpaqueBackgroundColor) { | 360 TEST(LayerImplTest, SafeOpaqueBackgroundColor) { |
| 361 FakeImplTaskRunnerProvider task_runner_provider; | 361 FakeImplTaskRunnerProvider task_runner_provider; |
| 362 TestSharedBitmapManager shared_bitmap_manager; | 362 TestSharedBitmapManager shared_bitmap_manager; |
| 363 TestTaskGraphRunner task_graph_runner; | 363 TestTaskGraphRunner task_graph_runner; |
| 364 std::unique_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d(); | 364 std::unique_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d(); |
| 365 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, | 365 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 | 570 |
| 571 pending_layer->PushPropertiesTo(layer()); | 571 pending_layer->PushPropertiesTo(layer()); |
| 572 | 572 |
| 573 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); | 573 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); |
| 574 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(), | 574 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(), |
| 575 pending_layer->CurrentScrollOffset()); | 575 pending_layer->CurrentScrollOffset()); |
| 576 } | 576 } |
| 577 | 577 |
| 578 } // namespace | 578 } // namespace |
| 579 } // namespace cc | 579 } // namespace cc |
| OLD | NEW |