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

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

Issue 2123793002: cc: Don't always rebuild property trees in LayerImplTests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « no previous file | no next file » | 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 EXPECT_FALSE( \ 75 EXPECT_FALSE( \
76 root->layer_tree_impl()->LayerNeedsPushPropertiesForTesting(child)); \ 76 root->layer_tree_impl()->LayerNeedsPushPropertiesForTesting(child)); \
77 EXPECT_FALSE(root->layer_tree_impl()->LayerNeedsPushPropertiesForTesting( \ 77 EXPECT_FALSE(root->layer_tree_impl()->LayerNeedsPushPropertiesForTesting( \
78 grand_child)); \ 78 grand_child)); \
79 EXPECT_TRUE(root->LayerPropertyChanged()); \ 79 EXPECT_TRUE(root->LayerPropertyChanged()); \
80 EXPECT_FALSE(child->LayerPropertyChanged()); \ 80 EXPECT_FALSE(child->LayerPropertyChanged()); \
81 EXPECT_FALSE(grand_child->LayerPropertyChanged()); 81 EXPECT_FALSE(grand_child->LayerPropertyChanged());
82 82
83 #define VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(code_to_test) \ 83 #define VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(code_to_test) \
84 root->layer_tree_impl()->ResetAllChangeTracking(); \ 84 root->layer_tree_impl()->ResetAllChangeTracking(); \
85 host_impl.active_tree()->property_trees()->needs_rebuild = true; \
86 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); \
87 host_impl.ForcePrepareToDraw(); \ 85 host_impl.ForcePrepareToDraw(); \
88 EXPECT_FALSE(host_impl.active_tree()->needs_update_draw_properties()); \ 86 EXPECT_FALSE(host_impl.active_tree()->needs_update_draw_properties()); \
89 code_to_test; \ 87 code_to_test; \
90 EXPECT_TRUE(host_impl.active_tree()->needs_update_draw_properties()); 88 EXPECT_TRUE(host_impl.active_tree()->needs_update_draw_properties());
91 89
92 #define VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(code_to_test) \ 90 #define VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(code_to_test) \
93 root->layer_tree_impl()->ResetAllChangeTracking(); \ 91 root->layer_tree_impl()->ResetAllChangeTracking(); \
94 host_impl.active_tree()->property_trees()->needs_rebuild = true; \
95 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); \
96 host_impl.ForcePrepareToDraw(); \ 92 host_impl.ForcePrepareToDraw(); \
97 EXPECT_FALSE(host_impl.active_tree()->needs_update_draw_properties()); \ 93 EXPECT_FALSE(host_impl.active_tree()->needs_update_draw_properties()); \
98 code_to_test; \ 94 code_to_test; \
99 EXPECT_FALSE(host_impl.active_tree()->needs_update_draw_properties()); 95 EXPECT_FALSE(host_impl.active_tree()->needs_update_draw_properties());
100 96
101 static gfx::Vector2dF ScrollDelta(LayerImpl* layer_impl) { 97 static gfx::Vector2dF ScrollDelta(LayerImpl* layer_impl) {
102 gfx::ScrollOffset delta = 98 gfx::ScrollOffset delta =
103 layer_impl->layer_tree_impl() 99 layer_impl->layer_tree_impl()
104 ->property_trees() 100 ->property_trees()
105 ->scroll_tree.GetScrollOffsetDeltaForTesting(layer_impl->id()); 101 ->scroll_tree.GetScrollOffsetDeltaForTesting(layer_impl->id());
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 275 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
280 root->OnFilterAnimated(arbitrary_filters)); 276 root->OnFilterAnimated(arbitrary_filters));
281 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( 277 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(
282 root->OnFilterAnimated(FilterOperations())); 278 root->OnFilterAnimated(FilterOperations()));
283 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( 279 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(
284 root->OnFilterAnimated(arbitrary_filters)); 280 root->OnFilterAnimated(arbitrary_filters));
285 281
286 // Related scrolling functions. 282 // Related scrolling functions.
287 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(large_size)); 283 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(large_size));
288 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(large_size)); 284 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(large_size));
285 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting();
289 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->ScrollBy(arbitrary_vector2d)); 286 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->ScrollBy(arbitrary_vector2d));
290 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->ScrollBy(gfx::Vector2d())); 287 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->ScrollBy(gfx::Vector2d()));
291 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( 288 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(
292 layer->layer_tree_impl()->DidUpdateScrollOffset( 289 layer->layer_tree_impl()->DidUpdateScrollOffset(
293 layer->id(), layer->transform_tree_index())); 290 layer->id(), layer->transform_tree_index()));
294 layer->layer_tree_impl() 291 layer->layer_tree_impl()
295 ->property_trees() 292 ->property_trees()
296 ->scroll_tree.SetScrollOffsetDeltaForTesting(layer->id(), 293 ->scroll_tree.SetScrollOffsetDeltaForTesting(layer->id(),
297 gfx::Vector2dF()); 294 gfx::Vector2dF());
298 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetCurrentScrollOffset( 295 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetCurrentScrollOffset(
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 558
562 pending_layer->PushPropertiesTo(layer()); 559 pending_layer->PushPropertiesTo(layer());
563 560
564 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); 561 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset());
565 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(), 562 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(),
566 pending_layer->CurrentScrollOffset()); 563 pending_layer->CurrentScrollOffset());
567 } 564 }
568 565
569 } // namespace 566 } // namespace
570 } // namespace cc 567 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698