Chromium Code Reviews| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 163 root->SetUpdateRect(arbitrary_rect)); | 163 root->SetUpdateRect(arbitrary_rect)); |
| 164 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetBounds(arbitrary_size)); | 164 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetBounds(arbitrary_size)); |
| 165 host_impl.active_tree()->property_trees()->needs_rebuild = true; | 165 host_impl.active_tree()->property_trees()->needs_rebuild = true; |
| 166 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); | 166 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); |
| 167 | 167 |
| 168 // Changing these properties affects the entire subtree of layers. | 168 // Changing these properties affects the entire subtree of layers. |
| 169 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->OnFilterAnimated(arbitrary_filters)); | 169 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->OnFilterAnimated(arbitrary_filters)); |
| 170 EXECUTE_AND_VERIFY_SUBTREE_CHANGED( | 170 EXECUTE_AND_VERIFY_SUBTREE_CHANGED( |
| 171 root->OnFilterAnimated(FilterOperations())); | 171 root->OnFilterAnimated(FilterOperations())); |
| 172 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->OnOpacityAnimated(arbitrary_number)); | 172 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->OnOpacityAnimated(arbitrary_number)); |
| 173 EXECUTE_AND_VERIFY_SUBTREE_CHANGED( | |
| 174 root->OnTransformAnimated(arbitrary_transform)); | |
|
ajuma
2016/08/17 13:27:46
Animating transform should still cause damage. Doe
jaydasika
2016/08/17 19:40:00
Done.
| |
| 175 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->ScrollBy(arbitrary_vector2d); | 173 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->ScrollBy(arbitrary_vector2d); |
| 176 root->SetNeedsPushProperties()); | 174 root->SetNeedsPushProperties()); |
| 177 // SetBoundsDelta changes subtree only when masks_to_bounds is true and it | 175 // SetBoundsDelta changes subtree only when masks_to_bounds is true and it |
| 178 // doesn't set needs_push_properties as it is always called on active tree. | 176 // doesn't set needs_push_properties as it is always called on active tree. |
| 179 root->SetMasksToBounds(true); | 177 root->SetMasksToBounds(true); |
| 180 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetBoundsDelta(arbitrary_vector2d); | 178 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetBoundsDelta(arbitrary_vector2d); |
| 181 root->SetNeedsPushProperties()); | 179 root->SetNeedsPushProperties()); |
| 182 | 180 |
| 183 // Changing these properties only affects the layer itself. | 181 // Changing these properties only affects the layer itself. |
| 184 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetDrawsContent(true)); | 182 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetDrawsContent(true)); |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 204 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( | 202 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( |
| 205 root->SetMutableProperties(MutableProperty::kOpacity); | 203 root->SetMutableProperties(MutableProperty::kOpacity); |
| 206 root->SetNeedsPushProperties()); | 204 root->SetNeedsPushProperties()); |
| 207 | 205 |
| 208 // After setting all these properties already, setting to the exact same | 206 // After setting all these properties already, setting to the exact same |
| 209 // values again should not cause any change. | 207 // values again should not cause any change. |
| 210 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetMasksToBounds(true)); | 208 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetMasksToBounds(true)); |
| 211 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( | 209 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( |
| 212 root->SetPosition(arbitrary_point_f)); | 210 root->SetPosition(arbitrary_point_f)); |
| 213 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->Set3dSortingContextId(1)); | 211 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->Set3dSortingContextId(1)); |
| 214 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( | |
| 215 root->SetTransform(arbitrary_transform)); | |
| 216 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetContentsOpaque(true)); | 212 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetContentsOpaque(true)); |
| 217 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetDrawsContent(true)); | 213 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetDrawsContent(true)); |
| 218 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetBounds(bounds_size)); | 214 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetBounds(bounds_size)); |
| 219 } | 215 } |
| 220 | 216 |
| 221 TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) { | 217 TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) { |
| 222 FakeImplTaskRunnerProvider task_runner_provider; | 218 FakeImplTaskRunnerProvider task_runner_provider; |
| 223 TestSharedBitmapManager shared_bitmap_manager; | 219 TestSharedBitmapManager shared_bitmap_manager; |
| 224 TestTaskGraphRunner task_graph_runner; | 220 TestTaskGraphRunner task_graph_runner; |
| 225 std::unique_ptr<OutputSurface> output_surface = | 221 std::unique_ptr<OutputSurface> output_surface = |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 320 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( | 316 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( |
| 321 layer->OnFilterAnimated(arbitrary_filters)); | 317 layer->OnFilterAnimated(arbitrary_filters)); |
| 322 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetMasksToBounds(true)); | 318 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetMasksToBounds(true)); |
| 323 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetContentsOpaque(true)); | 319 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetContentsOpaque(true)); |
| 324 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( | 320 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( |
| 325 layer2->SetPosition(arbitrary_point_f)); | 321 layer2->SetPosition(arbitrary_point_f)); |
| 326 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->Set3dSortingContextId(1)); | 322 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->Set3dSortingContextId(1)); |
| 327 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetDrawsContent(true)); | 323 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetDrawsContent(true)); |
| 328 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( | 324 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( |
| 329 layer->SetBackgroundColor(arbitrary_color)); | 325 layer->SetBackgroundColor(arbitrary_color)); |
| 330 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( | |
| 331 layer->SetTransform(arbitrary_transform)); | |
| 332 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size)); | 326 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size)); |
| 333 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetElementId(ElementId(2, 0))); | 327 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetElementId(ElementId(2, 0))); |
| 334 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( | 328 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( |
| 335 layer->SetMutableProperties(MutableProperty::kTransform)); | 329 layer->SetMutableProperties(MutableProperty::kTransform)); |
| 336 } | 330 } |
| 337 | 331 |
| 338 TEST(LayerImplTest, SafeOpaqueBackgroundColor) { | 332 TEST(LayerImplTest, SafeOpaqueBackgroundColor) { |
| 339 FakeImplTaskRunnerProvider task_runner_provider; | 333 FakeImplTaskRunnerProvider task_runner_provider; |
| 340 TestSharedBitmapManager shared_bitmap_manager; | 334 TestSharedBitmapManager shared_bitmap_manager; |
| 341 TestTaskGraphRunner task_graph_runner; | 335 TestTaskGraphRunner task_graph_runner; |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 556 | 550 |
| 557 pending_layer->PushPropertiesTo(layer()); | 551 pending_layer->PushPropertiesTo(layer()); |
| 558 | 552 |
| 559 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); | 553 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); |
| 560 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(), | 554 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(), |
| 561 pending_layer->CurrentScrollOffset()); | 555 pending_layer->CurrentScrollOffset()); |
| 562 } | 556 } |
| 563 | 557 |
| 564 } // namespace | 558 } // namespace |
| 565 } // namespace cc | 559 } // namespace cc |
| OLD | NEW |