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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 host_impl.active_tree()->property_trees()->needs_rebuild = true; | 197 host_impl.active_tree()->property_trees()->needs_rebuild = true; |
198 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); | 198 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); |
199 | 199 |
200 root->SetMasksToBounds(true); | 200 root->SetMasksToBounds(true); |
201 host_impl.active_tree()->property_trees()->needs_rebuild = true; | 201 host_impl.active_tree()->property_trees()->needs_rebuild = true; |
202 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); | 202 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); |
203 | 203 |
204 // Changing these properties does not cause the layer to be marked as changed | 204 // Changing these properties does not cause the layer to be marked as changed |
205 // but does cause the layer to need to push properties. | 205 // but does cause the layer to need to push properties. |
206 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( | 206 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( |
207 root->SetElementId(2); root->SetNeedsPushProperties()); | 207 root->SetElementId(ElementId(2, 0))); |
208 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( | 208 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( |
209 root->SetMutableProperties(MutableProperty::kOpacity); | 209 root->SetMutableProperties(MutableProperty::kOpacity); |
210 root->SetNeedsPushProperties()); | 210 root->SetNeedsPushProperties()); |
211 | 211 |
212 // After setting all these properties already, setting to the exact same | 212 // After setting all these properties already, setting to the exact same |
213 // values again should not cause any change. | 213 // values again should not cause any change. |
214 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetMasksToBounds(true)); | 214 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetMasksToBounds(true)); |
215 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( | 215 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( |
216 root->SetPosition(arbitrary_point_f)); | 216 root->SetPosition(arbitrary_point_f)); |
217 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->Set3dSortingContextId(1)); | 217 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->Set3dSortingContextId(1)); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 layer2->SetPosition(arbitrary_point_f)); | 329 layer2->SetPosition(arbitrary_point_f)); |
330 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->Set3dSortingContextId(1)); | 330 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->Set3dSortingContextId(1)); |
331 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetDrawsContent(true)); | 331 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetDrawsContent(true)); |
332 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( | 332 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( |
333 layer->SetBackgroundColor(arbitrary_color)); | 333 layer->SetBackgroundColor(arbitrary_color)); |
334 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( | 334 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( |
335 layer->SetBlendMode(arbitrary_blend_mode)); | 335 layer->SetBlendMode(arbitrary_blend_mode)); |
336 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( | 336 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( |
337 layer->SetTransform(arbitrary_transform)); | 337 layer->SetTransform(arbitrary_transform)); |
338 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size)); | 338 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size)); |
339 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetElementId(2)); | 339 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetElementId(ElementId(2, 0))); |
340 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( | 340 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( |
341 layer->SetMutableProperties(MutableProperty::kTransform)); | 341 layer->SetMutableProperties(MutableProperty::kTransform)); |
342 } | 342 } |
343 | 343 |
344 TEST(LayerImplTest, SafeOpaqueBackgroundColor) { | 344 TEST(LayerImplTest, SafeOpaqueBackgroundColor) { |
345 FakeImplTaskRunnerProvider task_runner_provider; | 345 FakeImplTaskRunnerProvider task_runner_provider; |
346 TestSharedBitmapManager shared_bitmap_manager; | 346 TestSharedBitmapManager shared_bitmap_manager; |
347 TestTaskGraphRunner task_graph_runner; | 347 TestTaskGraphRunner task_graph_runner; |
348 std::unique_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d(); | 348 std::unique_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d(); |
349 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, | 349 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 | 560 |
561 pending_layer->PushPropertiesTo(layer()); | 561 pending_layer->PushPropertiesTo(layer()); |
562 | 562 |
563 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); | 563 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); |
564 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(), | 564 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(), |
565 pending_layer->CurrentScrollOffset()); | 565 pending_layer->CurrentScrollOffset()); |
566 } | 566 } |
567 | 567 |
568 } // namespace | 568 } // namespace |
569 } // namespace cc | 569 } // namespace cc |
OLD | NEW |