Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: cc/layers/layer_impl_unittest.cc

Issue 1973083002: Use element id's for animations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | cc/layers/layer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | cc/layers/layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698