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

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

Issue 1912893002: cc : Stop pushing properties not used by LayerImpl to LayerImpl. (2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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_test_properties.h ('k') | cc/layers/layer_iterator_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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 LayerImpl::Create(host_impl.active_tree(), 2); 134 LayerImpl::Create(host_impl.active_tree(), 2);
135 LayerImpl* root = root_ptr.get(); 135 LayerImpl* root = root_ptr.get();
136 root_clip_ptr->AddChild(std::move(root_ptr)); 136 root_clip_ptr->AddChild(std::move(root_ptr));
137 host_impl.active_tree()->SetRootLayer(std::move(root_clip_ptr)); 137 host_impl.active_tree()->SetRootLayer(std::move(root_clip_ptr));
138 std::unique_ptr<LayerImpl> scroll_parent = 138 std::unique_ptr<LayerImpl> scroll_parent =
139 LayerImpl::Create(host_impl.active_tree(), 3); 139 LayerImpl::Create(host_impl.active_tree(), 3);
140 LayerImpl* scroll_child = LayerImpl::Create(host_impl.active_tree(), 4).get(); 140 LayerImpl* scroll_child = LayerImpl::Create(host_impl.active_tree(), 4).get();
141 std::set<LayerImpl*>* scroll_children = new std::set<LayerImpl*>(); 141 std::set<LayerImpl*>* scroll_children = new std::set<LayerImpl*>();
142 scroll_children->insert(scroll_child); 142 scroll_children->insert(scroll_child);
143 scroll_children->insert(root); 143 scroll_children->insert(root);
144 root->SetForceRenderSurface(true); 144 root->test_properties()->force_render_surface = true;
145 145
146 std::unique_ptr<LayerImpl> clip_parent = 146 std::unique_ptr<LayerImpl> clip_parent =
147 LayerImpl::Create(host_impl.active_tree(), 5); 147 LayerImpl::Create(host_impl.active_tree(), 5);
148 LayerImpl* clip_child = LayerImpl::Create(host_impl.active_tree(), 6).get(); 148 LayerImpl* clip_child = LayerImpl::Create(host_impl.active_tree(), 6).get();
149 std::set<LayerImpl*>* clip_children = new std::set<LayerImpl*>(); 149 std::set<LayerImpl*>* clip_children = new std::set<LayerImpl*>();
150 clip_children->insert(clip_child); 150 clip_children->insert(clip_child);
151 clip_children->insert(root); 151 clip_children->insert(root);
152 root->layer_tree_impl()->ResetAllChangeTracking( 152 root->layer_tree_impl()->ResetAllChangeTracking(
153 PropertyTrees::ResetFlags::ALL_TREES); 153 PropertyTrees::ResetFlags::ALL_TREES);
154 154
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 // After setting all these properties already, setting to the exact same 245 // After setting all these properties already, setting to the exact same
246 // values again should not cause any change. 246 // values again should not cause any change.
247 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetMasksToBounds(true)); 247 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetMasksToBounds(true));
248 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( 248 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
249 root->SetPosition(arbitrary_point_f)); 249 root->SetPosition(arbitrary_point_f));
250 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( 250 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
251 root->SetShouldFlattenTransform(false)); 251 root->SetShouldFlattenTransform(false));
252 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->Set3dSortingContextId(1)); 252 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->Set3dSortingContextId(1));
253 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( 253 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
254 root->SetTransform(arbitrary_transform)); 254 root->SetTransform(arbitrary_transform));
255 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
256 root->SetDoubleSided(false)); // constructor initializes it to "true".
257 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetContentsOpaque(true)); 255 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetContentsOpaque(true));
258 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetOpacity(arbitrary_number)); 256 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetOpacity(arbitrary_number));
259 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( 257 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
260 root->SetBlendMode(arbitrary_blend_mode)); 258 root->SetBlendMode(arbitrary_blend_mode));
261 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( 259 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
262 root->SetIsRootForIsolatedGroup(true)); 260 root->SetIsRootForIsolatedGroup(true));
263 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetDrawsContent(true)); 261 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetDrawsContent(true));
264 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetBounds(bounds_size)); 262 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetBounds(bounds_size));
265 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( 263 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
266 root->SetScrollParent(scroll_parent.get())); 264 root->SetScrollParent(scroll_parent.get()));
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetDrawsContent(true)); 316 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetDrawsContent(true));
319 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer2->SetDrawsContent(true)); 317 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer2->SetDrawsContent(true));
320 // Render surface functions should not trigger update draw properties, because 318 // Render surface functions should not trigger update draw properties, because
321 // creating render surface is part of update draw properties. 319 // creating render surface is part of update draw properties.
322 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetHasRenderSurface(true)); 320 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetHasRenderSurface(true));
323 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetHasRenderSurface(false)); 321 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetHasRenderSurface(false));
324 // Create a render surface, because we must have a render surface if we have 322 // Create a render surface, because we must have a render surface if we have
325 // filters. 323 // filters.
326 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetHasRenderSurface(true)); 324 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetHasRenderSurface(true));
327 325
328 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetForceRenderSurface(true));
329 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetForceRenderSurface(true));
330 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetForceRenderSurface(false));
331 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetForceRenderSurface(false));
332
333 // Related filter functions. 326 // Related filter functions.
334 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( 327 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(
335 root->OnFilterAnimated(arbitrary_filters)); 328 root->OnFilterAnimated(arbitrary_filters));
336 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 329 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
337 root->OnFilterAnimated(arbitrary_filters)); 330 root->OnFilterAnimated(arbitrary_filters));
338 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( 331 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(
339 root->OnFilterAnimated(FilterOperations())); 332 root->OnFilterAnimated(FilterOperations()));
340 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( 333 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(
341 root->OnFilterAnimated(arbitrary_filters)); 334 root->OnFilterAnimated(arbitrary_filters));
342 335
(...skipping 26 matching lines...) Expand all
369 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( 362 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(
370 layer->SetReplicaLayer(LayerImpl::Create(host_impl.active_tree(), 5)); 363 layer->SetReplicaLayer(LayerImpl::Create(host_impl.active_tree(), 5));
371 layer->NoteLayerPropertyChanged()); 364 layer->NoteLayerPropertyChanged());
372 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer2->SetPosition(arbitrary_point_f); 365 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer2->SetPosition(arbitrary_point_f);
373 layer->NoteLayerPropertyChanged()); 366 layer->NoteLayerPropertyChanged());
374 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetShouldFlattenTransform(false); 367 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetShouldFlattenTransform(false);
375 layer->NoteLayerPropertyChanged()); 368 layer->NoteLayerPropertyChanged());
376 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->Set3dSortingContextId(1); 369 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->Set3dSortingContextId(1);
377 layer->NoteLayerPropertyChanged()); 370 layer->NoteLayerPropertyChanged());
378 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( 371 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(
379 layer->SetDoubleSided(false); // constructor initializes it to "true".
380 layer->NoteLayerPropertyChanged());
381 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(
382 layer->SetBackgroundColor(arbitrary_color)); 372 layer->SetBackgroundColor(arbitrary_color));
383 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( 373 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(
384 layer->SetBackgroundFilters(arbitrary_filters)); 374 layer->SetBackgroundFilters(arbitrary_filters));
385 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( 375 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(
386 layer->OnOpacityAnimated(arbitrary_number)); 376 layer->OnOpacityAnimated(arbitrary_number));
387 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBlendMode(arbitrary_blend_mode); 377 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBlendMode(arbitrary_blend_mode);
388 layer->NoteLayerPropertyChanged()); 378 layer->NoteLayerPropertyChanged());
389 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( 379 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(
390 layer->OnTransformAnimated(arbitrary_transform)); 380 layer->OnTransformAnimated(arbitrary_transform));
391 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size); 381 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size);
392 layer->NoteLayerPropertyChanged()); 382 layer->NoteLayerPropertyChanged());
393 383
394 // Unrelated functions, set to the same values, no needs update. 384 // Unrelated functions, set to the same values, no needs update.
395 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 385 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
396 layer->SetIsRootForIsolatedGroup(true)); 386 layer->SetIsRootForIsolatedGroup(true));
397 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetFilters(arbitrary_filters)); 387 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetFilters(arbitrary_filters));
398 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetMasksToBounds(true)); 388 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetMasksToBounds(true));
399 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetContentsOpaque(true)); 389 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetContentsOpaque(true));
400 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 390 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
401 layer2->SetPosition(arbitrary_point_f)); 391 layer2->SetPosition(arbitrary_point_f));
402 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->Set3dSortingContextId(1)); 392 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->Set3dSortingContextId(1));
403 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
404 layer->SetDoubleSided(false)); // constructor initializes it to "true".
405 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetDrawsContent(true)); 393 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetDrawsContent(true));
406 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 394 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
407 layer->SetBackgroundColor(arbitrary_color)); 395 layer->SetBackgroundColor(arbitrary_color));
408 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 396 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
409 layer->SetBackgroundFilters(arbitrary_filters)); 397 layer->SetBackgroundFilters(arbitrary_filters));
410 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetOpacity(arbitrary_number)); 398 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetOpacity(arbitrary_number));
411 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 399 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
412 layer->SetBlendMode(arbitrary_blend_mode)); 400 layer->SetBlendMode(arbitrary_blend_mode));
413 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 401 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
414 layer->SetIsRootForIsolatedGroup(true)); 402 layer->SetIsRootForIsolatedGroup(true));
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 653
666 pending_layer->PushPropertiesTo(layer()); 654 pending_layer->PushPropertiesTo(layer());
667 655
668 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); 656 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset());
669 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(), 657 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(),
670 pending_layer->CurrentScrollOffset()); 658 pending_layer->CurrentScrollOffset());
671 } 659 }
672 660
673 } // namespace 661 } // namespace
674 } // namespace cc 662 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl_test_properties.h ('k') | cc/layers/layer_iterator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698