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

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

Issue 23455060: mix-blend-mode implementation for accelerated layers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 7 years, 1 month 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
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/output/filter_operation.h" 7 #include "cc/output/filter_operation.h"
8 #include "cc/output/filter_operations.h" 8 #include "cc/output/filter_operations.h"
9 #include "cc/test/fake_impl_proxy.h" 9 #include "cc/test/fake_impl_proxy.h"
10 #include "cc/test/fake_layer_tree_host_impl.h" 10 #include "cc/test/fake_layer_tree_host_impl.h"
(...skipping 22 matching lines...) Expand all
33 EXPECT_FALSE(child->LayerPropertyChanged()); \ 33 EXPECT_FALSE(child->LayerPropertyChanged()); \
34 EXPECT_FALSE(grand_child->LayerPropertyChanged()); 34 EXPECT_FALSE(grand_child->LayerPropertyChanged());
35 35
36 #define EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(code_to_test) \ 36 #define EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(code_to_test) \
37 root->ResetAllChangeTrackingForSubtree(); \ 37 root->ResetAllChangeTrackingForSubtree(); \
38 code_to_test; \ 38 code_to_test; \
39 EXPECT_TRUE(root->LayerPropertyChanged()); \ 39 EXPECT_TRUE(root->LayerPropertyChanged()); \
40 EXPECT_FALSE(child->LayerPropertyChanged()); \ 40 EXPECT_FALSE(child->LayerPropertyChanged()); \
41 EXPECT_FALSE(grand_child->LayerPropertyChanged()); 41 EXPECT_FALSE(grand_child->LayerPropertyChanged());
42 42
43 #define EXECUTE_AND_VERIFY_ONLY_DESCENDANTS_CHANGED(code_to_test) \
44 root->ResetAllChangeTrackingForSubtree(); \
45 code_to_test; \
46 EXPECT_FALSE(root->LayerPropertyChanged()); \
47 EXPECT_TRUE(child->LayerPropertyChanged()); \
48 EXPECT_TRUE(grand_child->LayerPropertyChanged());
49
43 #define VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(code_to_test) \ 50 #define VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(code_to_test) \
44 root->ResetAllChangeTrackingForSubtree(); \ 51 root->ResetAllChangeTrackingForSubtree(); \
45 host_impl.ForcePrepareToDraw(); \ 52 host_impl.ForcePrepareToDraw(); \
46 EXPECT_FALSE(host_impl.active_tree()->needs_update_draw_properties()); \ 53 EXPECT_FALSE(host_impl.active_tree()->needs_update_draw_properties()); \
47 code_to_test; \ 54 code_to_test; \
48 EXPECT_TRUE(host_impl.active_tree()->needs_update_draw_properties()); 55 EXPECT_TRUE(host_impl.active_tree()->needs_update_draw_properties());
49 56
50 #define VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(code_to_test) \ 57 #define VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(code_to_test) \
51 root->ResetAllChangeTrackingForSubtree(); \ 58 root->ResetAllChangeTrackingForSubtree(); \
52 host_impl.ForcePrepareToDraw(); \ 59 host_impl.ForcePrepareToDraw(); \
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 gfx::Point arbitrary_point = gfx::Point(333, 444); 91 gfx::Point arbitrary_point = gfx::Point(333, 444);
85 gfx::Vector2d arbitrary_vector2d = gfx::Vector2d(111, 222); 92 gfx::Vector2d arbitrary_vector2d = gfx::Vector2d(111, 222);
86 gfx::Rect arbitrary_rect = gfx::Rect(arbitrary_point, arbitrary_size); 93 gfx::Rect arbitrary_rect = gfx::Rect(arbitrary_point, arbitrary_size);
87 gfx::RectF arbitrary_rect_f = 94 gfx::RectF arbitrary_rect_f =
88 gfx::RectF(arbitrary_point_f, gfx::SizeF(1.234f, 5.678f)); 95 gfx::RectF(arbitrary_point_f, gfx::SizeF(1.234f, 5.678f));
89 SkColor arbitrary_color = SkColorSetRGB(10, 20, 30); 96 SkColor arbitrary_color = SkColorSetRGB(10, 20, 30);
90 gfx::Transform arbitrary_transform; 97 gfx::Transform arbitrary_transform;
91 arbitrary_transform.Scale3d(0.1f, 0.2f, 0.3f); 98 arbitrary_transform.Scale3d(0.1f, 0.2f, 0.3f);
92 FilterOperations arbitrary_filters; 99 FilterOperations arbitrary_filters;
93 arbitrary_filters.Append(FilterOperation::CreateOpacityFilter(0.5f)); 100 arbitrary_filters.Append(FilterOperation::CreateOpacityFilter(0.5f));
101 SkXfermode::Mode arbitrary_blend_mode = SkXfermode::kMultiply_Mode;
94 102
95 // These properties are internal, and should not be considered "change" when 103 // These properties are internal, and should not be considered "change" when
96 // they are used. 104 // they are used.
97 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( 105 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
98 root->set_update_rect(arbitrary_rect_f)); 106 root->set_update_rect(arbitrary_rect_f));
99 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( 107 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
100 root->SetMaxScrollOffset(arbitrary_vector2d)); 108 root->SetMaxScrollOffset(arbitrary_vector2d));
101 109
102 // Changing these properties affects the entire subtree of layers. 110 // Changing these properties affects the entire subtree of layers.
103 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetAnchorPoint(arbitrary_point_f)); 111 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetAnchorPoint(arbitrary_point_f));
104 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetAnchorPointZ(arbitrary_number)); 112 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetAnchorPointZ(arbitrary_number));
105 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetFilters(arbitrary_filters)); 113 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetFilters(arbitrary_filters));
106 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetFilters(FilterOperations())); 114 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetFilters(FilterOperations()));
107 EXECUTE_AND_VERIFY_SUBTREE_CHANGED( 115 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(
108 root->SetMaskLayer(LayerImpl::Create(host_impl.active_tree(), 4))); 116 root->SetMaskLayer(LayerImpl::Create(host_impl.active_tree(), 4)));
109 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetMasksToBounds(true)); 117 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetMasksToBounds(true));
110 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetContentsOpaque(true)); 118 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetContentsOpaque(true));
111 EXECUTE_AND_VERIFY_SUBTREE_CHANGED( 119 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(
112 root->SetReplicaLayer(LayerImpl::Create(host_impl.active_tree(), 5))); 120 root->SetReplicaLayer(LayerImpl::Create(host_impl.active_tree(), 5)));
113 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetPosition(arbitrary_point_f)); 121 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetPosition(arbitrary_point_f));
114 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetPreserves3d(true)); 122 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetPreserves3d(true));
115 EXECUTE_AND_VERIFY_SUBTREE_CHANGED( 123 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(
116 root->SetDoubleSided(false)); // constructor initializes it to "true". 124 root->SetDoubleSided(false)); // constructor initializes it to "true".
117 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->ScrollBy(arbitrary_vector2d)); 125 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->ScrollBy(arbitrary_vector2d));
118 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetScrollDelta(gfx::Vector2d())); 126 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetScrollDelta(gfx::Vector2d()));
119 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetScrollOffset(arbitrary_vector2d)); 127 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetScrollOffset(arbitrary_vector2d));
120 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetHideLayerAndSubtree(true)); 128 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetHideLayerAndSubtree(true));
121 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetOpacity(arbitrary_number)); 129 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetOpacity(arbitrary_number));
130 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetBlendMode(arbitrary_blend_mode));
122 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetTransform(arbitrary_transform)); 131 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetTransform(arbitrary_transform));
123 132
124 // Changing these properties only affects the layer itself. 133 // Changing these properties only affects the layer itself.
125 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetContentBounds(arbitrary_size)); 134 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetContentBounds(arbitrary_size));
126 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED( 135 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(
127 root->SetContentsScale(arbitrary_number, arbitrary_number)); 136 root->SetContentsScale(arbitrary_number, arbitrary_number));
128 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetDrawsContent(true)); 137 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetDrawsContent(true));
129 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED( 138 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(
130 root->SetBackgroundColor(arbitrary_color)); 139 root->SetBackgroundColor(arbitrary_color));
131 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED( 140 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(
132 root->SetBackgroundFilters(arbitrary_filters)); 141 root->SetBackgroundFilters(arbitrary_filters));
133 142
134 // Special case: check that sublayer transform changes all layer's 143 // Changing these properties affects all layer's descendants,
135 // descendants, but not the layer itself. 144 // but not the layer itself.
136 root->ResetAllChangeTrackingForSubtree(); 145 EXECUTE_AND_VERIFY_ONLY_DESCENDANTS_CHANGED(
137 root->SetSublayerTransform(arbitrary_transform); 146 root->SetSublayerTransform(arbitrary_transform));
138 EXPECT_FALSE(root->LayerPropertyChanged()); 147 EXECUTE_AND_VERIFY_ONLY_DESCENDANTS_CHANGED(
139 EXPECT_TRUE(child->LayerPropertyChanged()); 148 root->SetIsRootForIsolatedGroup(true));
140 EXPECT_TRUE(grand_child->LayerPropertyChanged());
141 149
142 // Special case: check that SetBounds changes behavior depending on 150 // Special case: check that SetBounds changes behavior depending on
143 // masksToBounds. 151 // masksToBounds.
144 root->SetMasksToBounds(false); 152 root->SetMasksToBounds(false);
145 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetBounds(gfx::Size(135, 246))); 153 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetBounds(gfx::Size(135, 246)));
146 root->SetMasksToBounds(true); 154 root->SetMasksToBounds(true);
147 // Should be a different size than previous call, to ensure it marks tree 155 // Should be a different size than previous call, to ensure it marks tree
148 // changed. 156 // changed.
149 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetBounds(arbitrary_size)); 157 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetBounds(arbitrary_size));
150 158
(...skipping 14 matching lines...) Expand all
165 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( 173 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
166 root->SetScrollDelta(gfx::Vector2d())); 174 root->SetScrollDelta(gfx::Vector2d()));
167 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( 175 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
168 root->SetScrollOffset(arbitrary_vector2d)); 176 root->SetScrollOffset(arbitrary_vector2d));
169 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( 177 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
170 root->SetContentBounds(arbitrary_size)); 178 root->SetContentBounds(arbitrary_size));
171 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( 179 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
172 root->SetContentsScale(arbitrary_number, arbitrary_number)); 180 root->SetContentsScale(arbitrary_number, arbitrary_number));
173 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetContentsOpaque(true)); 181 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetContentsOpaque(true));
174 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetOpacity(arbitrary_number)); 182 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetOpacity(arbitrary_number));
183 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
184 root->SetBlendMode(arbitrary_blend_mode));
185 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
186 root->SetIsRootForIsolatedGroup(true));
175 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetDrawsContent(true)); 187 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetDrawsContent(true));
176 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( 188 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
177 root->SetSublayerTransform(arbitrary_transform)); 189 root->SetSublayerTransform(arbitrary_transform));
178 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetBounds(arbitrary_size)); 190 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetBounds(arbitrary_size));
179 } 191 }
180 192
181 TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) { 193 TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) {
182 FakeImplProxy proxy; 194 FakeImplProxy proxy;
183 FakeLayerTreeHostImpl host_impl(&proxy); 195 FakeLayerTreeHostImpl host_impl(&proxy);
184 EXPECT_TRUE(host_impl.InitializeRenderer(CreateFakeOutputSurface())); 196 EXPECT_TRUE(host_impl.InitializeRenderer(CreateFakeOutputSurface()));
185 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); 197 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
186 root->SetScrollable(true); 198 root->SetScrollable(true);
187 199
188 gfx::PointF arbitrary_point_f = gfx::PointF(0.125f, 0.25f); 200 gfx::PointF arbitrary_point_f = gfx::PointF(0.125f, 0.25f);
189 float arbitrary_number = 0.352f; 201 float arbitrary_number = 0.352f;
190 gfx::Size arbitrary_size = gfx::Size(111, 222); 202 gfx::Size arbitrary_size = gfx::Size(111, 222);
191 gfx::Point arbitrary_point = gfx::Point(333, 444); 203 gfx::Point arbitrary_point = gfx::Point(333, 444);
192 gfx::Vector2d arbitrary_vector2d = gfx::Vector2d(111, 222); 204 gfx::Vector2d arbitrary_vector2d = gfx::Vector2d(111, 222);
193 gfx::Vector2d large_vector2d = gfx::Vector2d(1000, 1000); 205 gfx::Vector2d large_vector2d = gfx::Vector2d(1000, 1000);
194 gfx::Rect arbitrary_rect = gfx::Rect(arbitrary_point, arbitrary_size); 206 gfx::Rect arbitrary_rect = gfx::Rect(arbitrary_point, arbitrary_size);
195 gfx::RectF arbitrary_rect_f = 207 gfx::RectF arbitrary_rect_f =
196 gfx::RectF(arbitrary_point_f, gfx::SizeF(1.234f, 5.678f)); 208 gfx::RectF(arbitrary_point_f, gfx::SizeF(1.234f, 5.678f));
197 SkColor arbitrary_color = SkColorSetRGB(10, 20, 30); 209 SkColor arbitrary_color = SkColorSetRGB(10, 20, 30);
198 gfx::Transform arbitrary_transform; 210 gfx::Transform arbitrary_transform;
199 arbitrary_transform.Scale3d(0.1f, 0.2f, 0.3f); 211 arbitrary_transform.Scale3d(0.1f, 0.2f, 0.3f);
200 FilterOperations arbitrary_filters; 212 FilterOperations arbitrary_filters;
201 arbitrary_filters.Append(FilterOperation::CreateOpacityFilter(0.5f)); 213 arbitrary_filters.Append(FilterOperation::CreateOpacityFilter(0.5f));
214 SkXfermode::Mode arbitrary_blend_mode = SkXfermode::kMultiply_Mode;
202 215
203 // Related filter functions. 216 // Related filter functions.
204 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetFilters(arbitrary_filters)); 217 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetFilters(arbitrary_filters));
205 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetFilters(arbitrary_filters)); 218 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetFilters(arbitrary_filters));
206 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetFilters(FilterOperations())); 219 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetFilters(FilterOperations()));
207 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetFilters(arbitrary_filters)); 220 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetFilters(arbitrary_filters));
208 221
209 // Related scrolling functions. 222 // Related scrolling functions.
210 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetMaxScrollOffset(large_vector2d)); 223 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetMaxScrollOffset(large_vector2d));
211 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 224 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
(...skipping 24 matching lines...) Expand all
236 root->SetDoubleSided(false)); // constructor initializes it to "true". 249 root->SetDoubleSided(false)); // constructor initializes it to "true".
237 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetContentBounds(arbitrary_size)); 250 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetContentBounds(arbitrary_size));
238 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( 251 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(
239 root->SetContentsScale(arbitrary_number, arbitrary_number)); 252 root->SetContentsScale(arbitrary_number, arbitrary_number));
240 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetDrawsContent(true)); 253 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetDrawsContent(true));
241 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( 254 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(
242 root->SetBackgroundColor(arbitrary_color)); 255 root->SetBackgroundColor(arbitrary_color));
243 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( 256 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(
244 root->SetBackgroundFilters(arbitrary_filters)); 257 root->SetBackgroundFilters(arbitrary_filters));
245 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetOpacity(arbitrary_number)); 258 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetOpacity(arbitrary_number));
259 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetBlendMode(arbitrary_blend_mode));
260 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetIsRootForIsolatedGroup(true));
246 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetTransform(arbitrary_transform)); 261 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetTransform(arbitrary_transform));
247 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( 262 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(
248 root->SetSublayerTransform(arbitrary_transform)); 263 root->SetSublayerTransform(arbitrary_transform));
249 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetBounds(arbitrary_size)); 264 VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetBounds(arbitrary_size));
250 265
251 // Unrelated functions, set to the same values, no needs update. 266 // Unrelated functions, set to the same values, no needs update.
252 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 267 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
253 root->SetAnchorPointZ(arbitrary_number)); 268 root->SetAnchorPointZ(arbitrary_number));
254 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetFilters(arbitrary_filters)); 269 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetFilters(arbitrary_filters));
255 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetMasksToBounds(true)); 270 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetMasksToBounds(true));
256 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetContentsOpaque(true)); 271 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetContentsOpaque(true));
257 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetPosition(arbitrary_point_f)); 272 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetPosition(arbitrary_point_f));
258 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetPreserves3d(true)); 273 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetPreserves3d(true));
259 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 274 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
260 root->SetDoubleSided(false)); // constructor initializes it to "true". 275 root->SetDoubleSided(false)); // constructor initializes it to "true".
261 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 276 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
262 root->SetContentBounds(arbitrary_size)); 277 root->SetContentBounds(arbitrary_size));
263 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 278 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
264 root->SetContentsScale(arbitrary_number, arbitrary_number)); 279 root->SetContentsScale(arbitrary_number, arbitrary_number));
265 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetDrawsContent(true)); 280 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetDrawsContent(true));
266 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 281 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
267 root->SetBackgroundColor(arbitrary_color)); 282 root->SetBackgroundColor(arbitrary_color));
268 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 283 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
269 root->SetBackgroundFilters(arbitrary_filters)); 284 root->SetBackgroundFilters(arbitrary_filters));
270 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetOpacity(arbitrary_number)); 285 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetOpacity(arbitrary_number));
271 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 286 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
287 root->SetBlendMode(arbitrary_blend_mode));
288 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetIsRootForIsolatedGroup(true));
289 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
272 root->SetTransform(arbitrary_transform)); 290 root->SetTransform(arbitrary_transform));
273 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 291 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
274 root->SetSublayerTransform(arbitrary_transform)); 292 root->SetSublayerTransform(arbitrary_transform));
275 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetBounds(arbitrary_size)); 293 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetBounds(arbitrary_size));
276 } 294 }
277 295
278 TEST(LayerImplTest, SafeOpaqueBackgroundColor) { 296 TEST(LayerImplTest, SafeOpaqueBackgroundColor) {
279 FakeImplProxy proxy; 297 FakeImplProxy proxy;
280 FakeLayerTreeHostImpl host_impl(&proxy); 298 FakeLayerTreeHostImpl host_impl(&proxy);
281 EXPECT_TRUE(host_impl.InitializeRenderer(CreateFakeOutputSurface())); 299 EXPECT_TRUE(host_impl.InitializeRenderer(CreateFakeOutputSurface()));
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 layer()->SetMaxScrollOffset(max_scroll_offset); 574 layer()->SetMaxScrollOffset(max_scroll_offset);
557 layer()->SetScrollOffset(scroll_offset); 575 layer()->SetScrollOffset(scroll_offset);
558 gfx::Vector2dF unscrolled = layer()->ScrollBy(scroll_delta); 576 gfx::Vector2dF unscrolled = layer()->ScrollBy(scroll_delta);
559 577
560 EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 8.5f), unscrolled); 578 EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 8.5f), unscrolled);
561 EXPECT_VECTOR_EQ(gfx::Vector2dF(30.5f, 5), layer()->TotalScrollOffset()); 579 EXPECT_VECTOR_EQ(gfx::Vector2dF(30.5f, 5), layer()->TotalScrollOffset());
562 } 580 }
563 581
564 } // namespace 582 } // namespace
565 } // namespace cc 583 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698