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/base/filter_operation.h" | 7 #include "cc/base/filter_operation.h" |
8 #include "cc/base/filter_operations.h" | 8 #include "cc/base/filter_operations.h" |
9 #include "cc/layers/painted_scrollbar_layer_impl.h" | 9 #include "cc/layers/painted_scrollbar_layer_impl.h" |
10 #include "cc/layers/solid_color_scrollbar_layer_impl.h" | 10 #include "cc/layers/solid_color_scrollbar_layer_impl.h" |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetBounds(bounds_size)); | 217 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetBounds(bounds_size)); |
218 host_impl.active_tree()->property_trees()->needs_rebuild = true; | 218 host_impl.active_tree()->property_trees()->needs_rebuild = true; |
219 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); | 219 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); |
220 | 220 |
221 root->SetMasksToBounds(true); | 221 root->SetMasksToBounds(true); |
222 host_impl.active_tree()->property_trees()->needs_rebuild = true; | 222 host_impl.active_tree()->property_trees()->needs_rebuild = true; |
223 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); | 223 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); |
224 | 224 |
225 // Changing these properties does not cause the layer to be marked as changed | 225 // Changing these properties does not cause the layer to be marked as changed |
226 // but does cause the layer to need to push properties. | 226 // but does cause the layer to need to push properties. |
| 227 ElementId element_id; |
| 228 element_id.id = 3; |
227 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( | 229 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( |
228 root->SetElementId(ElementId(2, 0))); | 230 root->SetElementId(element_id)); |
229 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( | 231 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( |
230 root->SetMutableProperties(MutableProperty::kOpacity); | 232 root->SetMutableProperties(MutableProperty::kOpacity); |
231 root->SetNeedsPushProperties()); | 233 root->SetNeedsPushProperties()); |
232 | 234 |
233 // After setting all these properties already, setting to the exact same | 235 // After setting all these properties already, setting to the exact same |
234 // values again should not cause any change. | 236 // values again should not cause any change. |
235 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetMasksToBounds(true)); | 237 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetMasksToBounds(true)); |
236 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( | 238 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( |
237 root->SetPosition(arbitrary_point_f)); | 239 root->SetPosition(arbitrary_point_f)); |
238 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetContentsOpaque(true)); | 240 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetContentsOpaque(true)); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 host_impl.active_tree()->SetFilterMutated(layer->element_id(), | 344 host_impl.active_tree()->SetFilterMutated(layer->element_id(), |
343 arbitrary_filters)); | 345 arbitrary_filters)); |
344 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetMasksToBounds(true)); | 346 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetMasksToBounds(true)); |
345 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetContentsOpaque(true)); | 347 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetContentsOpaque(true)); |
346 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( | 348 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( |
347 layer2->SetPosition(arbitrary_point_f)); | 349 layer2->SetPosition(arbitrary_point_f)); |
348 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetDrawsContent(true)); | 350 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetDrawsContent(true)); |
349 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( | 351 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( |
350 layer->SetBackgroundColor(arbitrary_color)); | 352 layer->SetBackgroundColor(arbitrary_color)); |
351 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size)); | 353 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size)); |
352 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetElementId(ElementId(2, 0))); | 354 ElementId element_id; |
| 355 element_id.id = 2; |
| 356 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetElementId(element_id)); |
353 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( | 357 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( |
354 layer->SetMutableProperties(MutableProperty::kTransform)); | 358 layer->SetMutableProperties(MutableProperty::kTransform)); |
355 } | 359 } |
356 | 360 |
357 TEST(LayerImplTest, SafeOpaqueBackgroundColor) { | 361 TEST(LayerImplTest, SafeOpaqueBackgroundColor) { |
358 FakeImplTaskRunnerProvider task_runner_provider; | 362 FakeImplTaskRunnerProvider task_runner_provider; |
359 TestTaskGraphRunner task_graph_runner; | 363 TestTaskGraphRunner task_graph_runner; |
360 std::unique_ptr<CompositorFrameSink> compositor_frame_sink = | 364 std::unique_ptr<CompositorFrameSink> compositor_frame_sink = |
361 FakeCompositorFrameSink::Create3d(); | 365 FakeCompositorFrameSink::Create3d(); |
362 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); | 366 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 | 573 |
570 pending_layer->PushPropertiesTo(layer()); | 574 pending_layer->PushPropertiesTo(layer()); |
571 | 575 |
572 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); | 576 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); |
573 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(), | 577 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(), |
574 pending_layer->CurrentScrollOffset()); | 578 pending_layer->CurrentScrollOffset()); |
575 } | 579 } |
576 | 580 |
577 } // namespace | 581 } // namespace |
578 } // namespace cc | 582 } // namespace cc |
OLD | NEW |