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/layers/painted_scrollbar_layer_impl.h" | 7 #include "cc/layers/painted_scrollbar_layer_impl.h" |
8 #include "cc/layers/solid_color_scrollbar_layer_impl.h" | 8 #include "cc/layers/solid_color_scrollbar_layer_impl.h" |
9 #include "cc/output/filter_operation.h" | 9 #include "cc/output/filter_operation.h" |
10 #include "cc/output/filter_operations.h" | 10 #include "cc/output/filter_operations.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 root->SetElementId(ElementId(2, 0))); | 226 root->SetElementId(ElementId(2, 0))); |
227 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( | 227 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( |
228 root->SetMutableProperties(MutableProperty::kOpacity); | 228 root->SetMutableProperties(MutableProperty::kOpacity); |
229 root->SetNeedsPushProperties()); | 229 root->SetNeedsPushProperties()); |
230 | 230 |
231 // After setting all these properties already, setting to the exact same | 231 // After setting all these properties already, setting to the exact same |
232 // values again should not cause any change. | 232 // values again should not cause any change. |
233 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetMasksToBounds(true)); | 233 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetMasksToBounds(true)); |
234 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( | 234 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( |
235 root->SetPosition(arbitrary_point_f)); | 235 root->SetPosition(arbitrary_point_f)); |
236 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->Set3dSortingContextId(1)); | |
237 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetContentsOpaque(true)); | 236 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetContentsOpaque(true)); |
238 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetDrawsContent(true)); | 237 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetDrawsContent(true)); |
239 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetBounds(bounds_size)); | 238 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetBounds(bounds_size)); |
240 } | 239 } |
241 | 240 |
242 TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) { | 241 TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) { |
243 FakeImplTaskRunnerProvider task_runner_provider; | 242 FakeImplTaskRunnerProvider task_runner_provider; |
244 TestTaskGraphRunner task_graph_runner; | 243 TestTaskGraphRunner task_graph_runner; |
245 std::unique_ptr<CompositorFrameSink> compositor_frame_sink = | 244 std::unique_ptr<CompositorFrameSink> compositor_frame_sink = |
246 FakeCompositorFrameSink::Create3d(); | 245 FakeCompositorFrameSink::Create3d(); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 gfx::ScrollOffset(arbitrary_vector2d.x(), arbitrary_vector2d.y()))); | 321 gfx::ScrollOffset(arbitrary_vector2d.x(), arbitrary_vector2d.y()))); |
323 | 322 |
324 // Unrelated functions, always set to new values, always set needs update. | 323 // Unrelated functions, always set to new values, always set needs update. |
325 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); | 324 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); |
326 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetMasksToBounds(true); | 325 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetMasksToBounds(true); |
327 layer->NoteLayerPropertyChanged()); | 326 layer->NoteLayerPropertyChanged()); |
328 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetContentsOpaque(true); | 327 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetContentsOpaque(true); |
329 layer->NoteLayerPropertyChanged()); | 328 layer->NoteLayerPropertyChanged()); |
330 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer2->SetPosition(arbitrary_point_f); | 329 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer2->SetPosition(arbitrary_point_f); |
331 layer->NoteLayerPropertyChanged()); | 330 layer->NoteLayerPropertyChanged()); |
332 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->Set3dSortingContextId(1); | |
333 layer->NoteLayerPropertyChanged()); | |
334 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( | 331 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( |
335 layer->SetBackgroundColor(arbitrary_color)); | 332 layer->SetBackgroundColor(arbitrary_color)); |
336 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( | 333 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( |
337 host_impl.active_tree()->property_trees()->effect_tree.OnOpacityAnimated( | 334 host_impl.active_tree()->property_trees()->effect_tree.OnOpacityAnimated( |
338 arbitrary_number, layer->effect_tree_index(), | 335 arbitrary_number, layer->effect_tree_index(), |
339 host_impl.active_tree())); | 336 host_impl.active_tree())); |
340 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( | 337 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( |
341 host_impl.active_tree() | 338 host_impl.active_tree() |
342 ->property_trees() | 339 ->property_trees() |
343 ->transform_tree.OnTransformAnimated(arbitrary_transform, | 340 ->transform_tree.OnTransformAnimated(arbitrary_transform, |
344 layer->transform_tree_index(), | 341 layer->transform_tree_index(), |
345 host_impl.active_tree())); | 342 host_impl.active_tree())); |
346 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size); | 343 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size); |
347 layer->NoteLayerPropertyChanged()); | 344 layer->NoteLayerPropertyChanged()); |
348 | 345 |
349 // Unrelated functions, set to the same values, no needs update. | 346 // Unrelated functions, set to the same values, no needs update. |
350 layer->test_properties()->filters = arbitrary_filters; | 347 layer->test_properties()->filters = arbitrary_filters; |
351 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); | 348 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); |
352 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( | 349 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( |
353 host_impl.active_tree()->property_trees()->effect_tree.OnFilterAnimated( | 350 host_impl.active_tree()->property_trees()->effect_tree.OnFilterAnimated( |
354 arbitrary_filters, layer->effect_tree_index(), | 351 arbitrary_filters, layer->effect_tree_index(), |
355 host_impl.active_tree())); | 352 host_impl.active_tree())); |
356 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetMasksToBounds(true)); | 353 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetMasksToBounds(true)); |
357 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetContentsOpaque(true)); | 354 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetContentsOpaque(true)); |
358 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( | 355 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( |
359 layer2->SetPosition(arbitrary_point_f)); | 356 layer2->SetPosition(arbitrary_point_f)); |
360 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->Set3dSortingContextId(1)); | |
361 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetDrawsContent(true)); | 357 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetDrawsContent(true)); |
362 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( | 358 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( |
363 layer->SetBackgroundColor(arbitrary_color)); | 359 layer->SetBackgroundColor(arbitrary_color)); |
364 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size)); | 360 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size)); |
365 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetElementId(ElementId(2, 0))); | 361 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetElementId(ElementId(2, 0))); |
366 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( | 362 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( |
367 layer->SetMutableProperties(MutableProperty::kTransform)); | 363 layer->SetMutableProperties(MutableProperty::kTransform)); |
368 } | 364 } |
369 | 365 |
370 TEST(LayerImplTest, SafeOpaqueBackgroundColor) { | 366 TEST(LayerImplTest, SafeOpaqueBackgroundColor) { |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 | 579 |
584 pending_layer->PushPropertiesTo(layer()); | 580 pending_layer->PushPropertiesTo(layer()); |
585 | 581 |
586 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); | 582 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); |
587 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(), | 583 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(), |
588 pending_layer->CurrentScrollOffset()); | 584 pending_layer->CurrentScrollOffset()); |
589 } | 585 } |
590 | 586 |
591 } // namespace | 587 } // namespace |
592 } // namespace cc | 588 } // namespace cc |
OLD | NEW |