| 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 root->SetMasksToBounds(true); | 222 root->SetMasksToBounds(true); |
| 223 host_impl.active_tree()->property_trees()->needs_rebuild = true; | 223 host_impl.active_tree()->property_trees()->needs_rebuild = true; |
| 224 host_impl.active_tree()->BuildPropertyTreesForTesting(); | 224 host_impl.active_tree()->BuildPropertyTreesForTesting(); |
| 225 | 225 |
| 226 // Changing these properties does not cause the layer to be marked as changed | 226 // Changing these properties does not cause the layer to be marked as changed |
| 227 // but does cause the layer to need to push properties. | 227 // but does cause the layer to need to push properties. |
| 228 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( | 228 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( |
| 229 root->SetElementId(2)); | 229 root->SetElementId(2)); |
| 230 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( | 230 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( |
| 231 root->SetMutableProperties(MutableProperty::kOpacity)); | 231 root->SetMutableProperties(MutableProperty::kOpacity)); |
| 232 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( | |
| 233 root->SetScrollParent(scroll_parent.get())); | |
| 234 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( | |
| 235 root->SetScrollChildren(scroll_children)); | |
| 236 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( | |
| 237 root->SetClipParent(clip_parent.get())); | |
| 238 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( | |
| 239 root->SetClipChildren(clip_children)); | |
| 240 | 232 |
| 241 // After setting all these properties already, setting to the exact same | 233 // After setting all these properties already, setting to the exact same |
| 242 // values again should not cause any change. | 234 // values again should not cause any change. |
| 243 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetMasksToBounds(true)); | 235 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetMasksToBounds(true)); |
| 244 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( | 236 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( |
| 245 root->SetPosition(arbitrary_point_f)); | 237 root->SetPosition(arbitrary_point_f)); |
| 246 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->Set3dSortingContextId(1)); | 238 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->Set3dSortingContextId(1)); |
| 247 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( | 239 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( |
| 248 root->SetTransform(arbitrary_transform)); | 240 root->SetTransform(arbitrary_transform)); |
| 249 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetContentsOpaque(true)); | 241 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetContentsOpaque(true)); |
| 250 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetOpacity(arbitrary_number)); | 242 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetOpacity(arbitrary_number)); |
| 251 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( | 243 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( |
| 252 root->SetBlendMode(arbitrary_blend_mode)); | 244 root->SetBlendMode(arbitrary_blend_mode)); |
| 253 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetDrawsContent(true)); | 245 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetDrawsContent(true)); |
| 254 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetBounds(bounds_size)); | 246 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetBounds(bounds_size)); |
| 255 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( | |
| 256 root->SetScrollParent(scroll_parent.get())); | |
| 257 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( | |
| 258 root->SetScrollChildren(scroll_children)); | |
| 259 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( | |
| 260 root->SetClipParent(clip_parent.get())); | |
| 261 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( | |
| 262 root->SetClipChildren(clip_children)); | |
| 263 } | 247 } |
| 264 | 248 |
| 265 TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) { | 249 TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) { |
| 266 FakeImplTaskRunnerProvider task_runner_provider; | 250 FakeImplTaskRunnerProvider task_runner_provider; |
| 267 TestSharedBitmapManager shared_bitmap_manager; | 251 TestSharedBitmapManager shared_bitmap_manager; |
| 268 TestTaskGraphRunner task_graph_runner; | 252 TestTaskGraphRunner task_graph_runner; |
| 269 std::unique_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d(); | 253 std::unique_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d(); |
| 270 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, | 254 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, |
| 271 &task_graph_runner); | 255 &task_graph_runner); |
| 272 host_impl.SetVisible(true); | 256 host_impl.SetVisible(true); |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 | 590 |
| 607 pending_layer->PushPropertiesTo(layer()); | 591 pending_layer->PushPropertiesTo(layer()); |
| 608 | 592 |
| 609 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); | 593 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); |
| 610 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(), | 594 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(), |
| 611 pending_layer->CurrentScrollOffset()); | 595 pending_layer->CurrentScrollOffset()); |
| 612 } | 596 } |
| 613 | 597 |
| 614 } // namespace | 598 } // namespace |
| 615 } // namespace cc | 599 } // namespace cc |
| OLD | NEW |