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

Side by Side Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 295193002: Get rid of graphics layer anchor points, and replace with transform origin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nit. Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | cc/trees/layer_tree_host_impl_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/trees/layer_tree_host_common.h" 5 #include "cc/trees/layer_tree_host_common.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "cc/animation/layer_animation_controller.h" 9 #include "cc/animation/layer_animation_controller.h"
10 #include "cc/animation/transform_operations.h" 10 #include "cc/animation/transform_operations.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 scoped_refptr<Layer> grand_child = Layer::Create(); 118 scoped_refptr<Layer> grand_child = Layer::Create();
119 parent->AddChild(child); 119 parent->AddChild(child);
120 child->AddChild(grand_child); 120 child->AddChild(grand_child);
121 121
122 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 122 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
123 host->SetRootLayer(parent); 123 host->SetRootLayer(parent);
124 124
125 gfx::Transform identity_matrix; 125 gfx::Transform identity_matrix;
126 SetLayerPropertiesForTesting(parent.get(), 126 SetLayerPropertiesForTesting(parent.get(),
127 identity_matrix, 127 identity_matrix,
128 gfx::PointF(), 128 gfx::Point3F(),
129 gfx::PointF(), 129 gfx::PointF(),
130 gfx::Size(100, 100), 130 gfx::Size(100, 100),
131 true, 131 true,
132 false); 132 false);
133 SetLayerPropertiesForTesting(child.get(), 133 SetLayerPropertiesForTesting(child.get(),
134 identity_matrix, 134 identity_matrix,
135 gfx::PointF(), 135 gfx::Point3F(),
136 gfx::PointF(), 136 gfx::PointF(),
137 gfx::Size(), 137 gfx::Size(),
138 true, 138 true,
139 false); 139 false);
140 SetLayerPropertiesForTesting(grand_child.get(), 140 SetLayerPropertiesForTesting(grand_child.get(),
141 identity_matrix, 141 identity_matrix,
142 gfx::PointF(), 142 gfx::Point3F(),
143 gfx::PointF(), 143 gfx::PointF(),
144 gfx::Size(), 144 gfx::Size(),
145 true, 145 true,
146 false); 146 false);
147 147
148 ExecuteCalculateDrawProperties(parent.get()); 148 ExecuteCalculateDrawProperties(parent.get());
149 149
150 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, child->draw_transform()); 150 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, child->draw_transform());
151 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, 151 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix,
152 child->screen_space_transform()); 152 child->screen_space_transform());
153 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, 153 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix,
154 grand_child->draw_transform()); 154 grand_child->draw_transform());
155 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, 155 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix,
156 grand_child->screen_space_transform()); 156 grand_child->screen_space_transform());
157 } 157 }
158 158
159 TEST_F(LayerTreeHostCommonTest, TransformsForSingleLayer) { 159 TEST_F(LayerTreeHostCommonTest, TransformsForSingleLayer) {
160 gfx::Transform identity_matrix; 160 gfx::Transform identity_matrix;
161 scoped_refptr<Layer> layer = Layer::Create(); 161 scoped_refptr<Layer> layer = Layer::Create();
162 162
163 scoped_refptr<Layer> root = Layer::Create(); 163 scoped_refptr<Layer> root = Layer::Create();
164 SetLayerPropertiesForTesting(root.get(), 164 SetLayerPropertiesForTesting(root.get(),
165 identity_matrix, 165 identity_matrix,
166 gfx::PointF(), 166 gfx::Point3F(),
167 gfx::PointF(), 167 gfx::PointF(),
168 gfx::Size(1, 2), 168 gfx::Size(1, 2),
169 true, 169 true,
170 false); 170 false);
171 root->AddChild(layer); 171 root->AddChild(layer);
172 172
173 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 173 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
174 host->SetRootLayer(root); 174 host->SetRootLayer(root);
175 175
176 // Case 2: Setting the bounds of the layer should not affect either the draw 176 // Case 2: Setting the bounds of the layer should not affect either the draw
177 // transform or the screenspace transform. 177 // transform or the screenspace transform.
178 gfx::Transform translation_to_center; 178 gfx::Transform translation_to_center;
179 translation_to_center.Translate(5.0, 6.0); 179 translation_to_center.Translate(5.0, 6.0);
180 SetLayerPropertiesForTesting(layer.get(), 180 SetLayerPropertiesForTesting(layer.get(),
181 identity_matrix, 181 identity_matrix,
182 gfx::PointF(), 182 gfx::Point3F(),
183 gfx::PointF(), 183 gfx::PointF(),
184 gfx::Size(10, 12), 184 gfx::Size(10, 12),
185 true, 185 true,
186 false); 186 false);
187 ExecuteCalculateDrawProperties(root.get()); 187 ExecuteCalculateDrawProperties(root.get());
188 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, layer->draw_transform()); 188 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, layer->draw_transform());
189 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, 189 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix,
190 layer->screen_space_transform()); 190 layer->screen_space_transform());
191 191
192 // Case 3: The anchor point by itself (without a layer transform) should have 192 // Case 3: The anchor point by itself (without a layer transform) should have
193 // no effect on the transforms. 193 // no effect on the transforms.
194 SetLayerPropertiesForTesting(layer.get(), 194 SetLayerPropertiesForTesting(layer.get(),
195 identity_matrix, 195 identity_matrix,
196 gfx::PointF(0.25f, 0.25f), 196 gfx::Point3F(2.5f, 3.0f, 0.f),
197 gfx::PointF(), 197 gfx::PointF(),
198 gfx::Size(10, 12), 198 gfx::Size(10, 12),
199 true, 199 true,
200 false); 200 false);
201 ExecuteCalculateDrawProperties(root.get()); 201 ExecuteCalculateDrawProperties(root.get());
202 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, layer->draw_transform()); 202 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, layer->draw_transform());
203 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, 203 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix,
204 layer->screen_space_transform()); 204 layer->screen_space_transform());
205 205
206 // Case 4: A change in actual position affects both the draw transform and 206 // Case 4: A change in actual position affects both the draw transform and
207 // screen space transform. 207 // screen space transform.
208 gfx::Transform position_transform; 208 gfx::Transform position_transform;
209 position_transform.Translate(0.f, 1.2f); 209 position_transform.Translate(0.f, 1.2f);
210 SetLayerPropertiesForTesting(layer.get(), 210 SetLayerPropertiesForTesting(layer.get(),
211 identity_matrix, 211 identity_matrix,
212 gfx::PointF(0.25f, 0.25f), 212 gfx::Point3F(2.5f, 3.0f, 0.f),
213 gfx::PointF(0.f, 1.2f), 213 gfx::PointF(0.f, 1.2f),
214 gfx::Size(10, 12), 214 gfx::Size(10, 12),
215 true, 215 true,
216 false); 216 false);
217 ExecuteCalculateDrawProperties(root.get()); 217 ExecuteCalculateDrawProperties(root.get());
218 EXPECT_TRANSFORMATION_MATRIX_EQ(position_transform, layer->draw_transform()); 218 EXPECT_TRANSFORMATION_MATRIX_EQ(position_transform, layer->draw_transform());
219 EXPECT_TRANSFORMATION_MATRIX_EQ(position_transform, 219 EXPECT_TRANSFORMATION_MATRIX_EQ(position_transform,
220 layer->screen_space_transform()); 220 layer->screen_space_transform());
221 221
222 // Case 5: In the correct sequence of transforms, the layer transform should 222 // Case 5: In the correct sequence of transforms, the layer transform should
223 // pre-multiply the translation_to_center. This is easily tested by using a 223 // pre-multiply the translation_to_center. This is easily tested by using a
224 // scale transform, because scale and translation are not commutative. 224 // scale transform, because scale and translation are not commutative.
225 gfx::Transform layer_transform; 225 gfx::Transform layer_transform;
226 layer_transform.Scale3d(2.0, 2.0, 1.0); 226 layer_transform.Scale3d(2.0, 2.0, 1.0);
227 SetLayerPropertiesForTesting(layer.get(), 227 SetLayerPropertiesForTesting(layer.get(),
228 layer_transform, 228 layer_transform,
229 gfx::PointF(), 229 gfx::Point3F(),
230 gfx::PointF(), 230 gfx::PointF(),
231 gfx::Size(10, 12), 231 gfx::Size(10, 12),
232 true, 232 true,
233 false); 233 false);
234 ExecuteCalculateDrawProperties(root.get()); 234 ExecuteCalculateDrawProperties(root.get());
235 EXPECT_TRANSFORMATION_MATRIX_EQ(layer_transform, layer->draw_transform()); 235 EXPECT_TRANSFORMATION_MATRIX_EQ(layer_transform, layer->draw_transform());
236 EXPECT_TRANSFORMATION_MATRIX_EQ(layer_transform, 236 EXPECT_TRANSFORMATION_MATRIX_EQ(layer_transform,
237 layer->screen_space_transform()); 237 layer->screen_space_transform());
238 238
239 // Case 6: The layer transform should occur with respect to the anchor point. 239 // Case 6: The layer transform should occur with respect to the anchor point.
240 gfx::Transform translation_to_anchor; 240 gfx::Transform translation_to_anchor;
241 translation_to_anchor.Translate(5.0, 0.0); 241 translation_to_anchor.Translate(5.0, 0.0);
242 gfx::Transform expected_result = 242 gfx::Transform expected_result =
243 translation_to_anchor * layer_transform * Inverse(translation_to_anchor); 243 translation_to_anchor * layer_transform * Inverse(translation_to_anchor);
244 SetLayerPropertiesForTesting(layer.get(), 244 SetLayerPropertiesForTesting(layer.get(),
245 layer_transform, 245 layer_transform,
246 gfx::PointF(0.5f, 0.f), 246 gfx::Point3F(5.0f, 0.f, 0.f),
247 gfx::PointF(), 247 gfx::PointF(),
248 gfx::Size(10, 12), 248 gfx::Size(10, 12),
249 true, 249 true,
250 false); 250 false);
251 ExecuteCalculateDrawProperties(root.get()); 251 ExecuteCalculateDrawProperties(root.get());
252 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_result, layer->draw_transform()); 252 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_result, layer->draw_transform());
253 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_result, 253 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_result,
254 layer->screen_space_transform()); 254 layer->screen_space_transform());
255 255
256 // Case 7: Verify that position pre-multiplies the layer transform. The 256 // Case 7: Verify that position pre-multiplies the layer transform. The
257 // current implementation of CalculateDrawProperties does this implicitly, but 257 // current implementation of CalculateDrawProperties does this implicitly, but
258 // it is still worth testing to detect accidental regressions. 258 // it is still worth testing to detect accidental regressions.
259 expected_result = position_transform * translation_to_anchor * 259 expected_result = position_transform * translation_to_anchor *
260 layer_transform * Inverse(translation_to_anchor); 260 layer_transform * Inverse(translation_to_anchor);
261 SetLayerPropertiesForTesting(layer.get(), 261 SetLayerPropertiesForTesting(layer.get(),
262 layer_transform, 262 layer_transform,
263 gfx::PointF(0.5f, 0.f), 263 gfx::Point3F(5.0f, 0.f, 0.f),
264 gfx::PointF(0.f, 1.2f), 264 gfx::PointF(0.f, 1.2f),
265 gfx::Size(10, 12), 265 gfx::Size(10, 12),
266 true, 266 true,
267 false); 267 false);
268 ExecuteCalculateDrawProperties(root.get()); 268 ExecuteCalculateDrawProperties(root.get());
269 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_result, layer->draw_transform()); 269 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_result, layer->draw_transform());
270 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_result, 270 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_result,
271 layer->screen_space_transform()); 271 layer->screen_space_transform());
272 } 272 }
273 273
(...skipping 11 matching lines...) Expand all
285 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); 285 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
286 286
287 gfx::Transform identity_matrix; 287 gfx::Transform identity_matrix;
288 scoped_ptr<LayerImpl> sublayer_scoped_ptr( 288 scoped_ptr<LayerImpl> sublayer_scoped_ptr(
289 LayerImpl::Create(host_impl.active_tree(), 1)); 289 LayerImpl::Create(host_impl.active_tree(), 1));
290 LayerImpl* sublayer = sublayer_scoped_ptr.get(); 290 LayerImpl* sublayer = sublayer_scoped_ptr.get();
291 sublayer->SetContentsScale(kPageScale * kDeviceScale, 291 sublayer->SetContentsScale(kPageScale * kDeviceScale,
292 kPageScale * kDeviceScale); 292 kPageScale * kDeviceScale);
293 SetLayerPropertiesForTesting(sublayer, 293 SetLayerPropertiesForTesting(sublayer,
294 identity_matrix, 294 identity_matrix,
295 gfx::Point(), 295 gfx::Point3F(),
296 gfx::PointF(), 296 gfx::PointF(),
297 gfx::Size(500, 500), 297 gfx::Size(500, 500),
298 true, 298 true,
299 false); 299 false);
300 300
301 scoped_ptr<LayerImpl> scroll_layer_scoped_ptr( 301 scoped_ptr<LayerImpl> scroll_layer_scoped_ptr(
302 LayerImpl::Create(host_impl.active_tree(), 2)); 302 LayerImpl::Create(host_impl.active_tree(), 2));
303 LayerImpl* scroll_layer = scroll_layer_scoped_ptr.get(); 303 LayerImpl* scroll_layer = scroll_layer_scoped_ptr.get();
304 SetLayerPropertiesForTesting(scroll_layer, 304 SetLayerPropertiesForTesting(scroll_layer,
305 identity_matrix, 305 identity_matrix,
306 gfx::PointF(), 306 gfx::Point3F(),
307 gfx::PointF(), 307 gfx::PointF(),
308 gfx::Size(10, 20), 308 gfx::Size(10, 20),
309 true, 309 true,
310 false); 310 false);
311 scoped_ptr<LayerImpl> clip_layer_scoped_ptr( 311 scoped_ptr<LayerImpl> clip_layer_scoped_ptr(
312 LayerImpl::Create(host_impl.active_tree(), 4)); 312 LayerImpl::Create(host_impl.active_tree(), 4));
313 LayerImpl* clip_layer = clip_layer_scoped_ptr.get(); 313 LayerImpl* clip_layer = clip_layer_scoped_ptr.get();
314 314
315 scroll_layer->SetScrollClipLayer(clip_layer->id()); 315 scroll_layer->SetScrollClipLayer(clip_layer->id());
316 clip_layer->SetBounds( 316 clip_layer->SetBounds(
317 gfx::Size(scroll_layer->bounds().width() + kMaxScrollOffset.x(), 317 gfx::Size(scroll_layer->bounds().width() + kMaxScrollOffset.x(),
318 scroll_layer->bounds().height() + kMaxScrollOffset.y())); 318 scroll_layer->bounds().height() + kMaxScrollOffset.y()));
319 scroll_layer->SetScrollClipLayer(clip_layer->id()); 319 scroll_layer->SetScrollClipLayer(clip_layer->id());
320 scroll_layer->SetScrollDelta(kScrollDelta); 320 scroll_layer->SetScrollDelta(kScrollDelta);
321 gfx::Transform impl_transform; 321 gfx::Transform impl_transform;
322 scroll_layer->AddChild(sublayer_scoped_ptr.Pass()); 322 scroll_layer->AddChild(sublayer_scoped_ptr.Pass());
323 LayerImpl* scroll_layer_raw_ptr = scroll_layer_scoped_ptr.get(); 323 LayerImpl* scroll_layer_raw_ptr = scroll_layer_scoped_ptr.get();
324 clip_layer->AddChild(scroll_layer_scoped_ptr.Pass()); 324 clip_layer->AddChild(scroll_layer_scoped_ptr.Pass());
325 scroll_layer_raw_ptr->SetScrollOffset(kScrollOffset); 325 scroll_layer_raw_ptr->SetScrollOffset(kScrollOffset);
326 326
327 scoped_ptr<LayerImpl> root(LayerImpl::Create(host_impl.active_tree(), 3)); 327 scoped_ptr<LayerImpl> root(LayerImpl::Create(host_impl.active_tree(), 3));
328 SetLayerPropertiesForTesting(root.get(), 328 SetLayerPropertiesForTesting(root.get(),
329 identity_matrix, 329 identity_matrix,
330 gfx::PointF(), 330 gfx::Point3F(),
331 gfx::PointF(), 331 gfx::PointF(),
332 gfx::Size(3, 4), 332 gfx::Size(3, 4),
333 true, 333 true,
334 false); 334 false);
335 root->AddChild(clip_layer_scoped_ptr.Pass()); 335 root->AddChild(clip_layer_scoped_ptr.Pass());
336 336
337 ExecuteCalculateDrawProperties( 337 ExecuteCalculateDrawProperties(
338 root.get(), kDeviceScale, kPageScale, scroll_layer->parent()); 338 root.get(), kDeviceScale, kPageScale, scroll_layer->parent());
339 gfx::Transform expected_transform = identity_matrix; 339 gfx::Transform expected_transform = identity_matrix;
340 gfx::PointF sub_layer_screen_position = kScrollLayerPosition - kScrollDelta; 340 gfx::PointF sub_layer_screen_position = kScrollLayerPosition - kScrollDelta;
341 sub_layer_screen_position.Scale(kPageScale * kDeviceScale); 341 sub_layer_screen_position.Scale(kPageScale * kDeviceScale);
342 expected_transform.Translate(MathUtil::Round(sub_layer_screen_position.x()), 342 expected_transform.Translate(MathUtil::Round(sub_layer_screen_position.x()),
343 MathUtil::Round(sub_layer_screen_position.y())); 343 MathUtil::Round(sub_layer_screen_position.y()));
344 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform, 344 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform,
345 sublayer->draw_transform()); 345 sublayer->draw_transform());
346 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform, 346 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform,
347 sublayer->screen_space_transform()); 347 sublayer->screen_space_transform());
348 348
349 gfx::Transform arbitrary_translate; 349 gfx::Transform arbitrary_translate;
350 const float kTranslateX = 10.6f; 350 const float kTranslateX = 10.6f;
351 const float kTranslateY = 20.6f; 351 const float kTranslateY = 20.6f;
352 arbitrary_translate.Translate(kTranslateX, kTranslateY); 352 arbitrary_translate.Translate(kTranslateX, kTranslateY);
353 SetLayerPropertiesForTesting(scroll_layer, 353 SetLayerPropertiesForTesting(scroll_layer,
354 arbitrary_translate, 354 arbitrary_translate,
355 gfx::PointF(), 355 gfx::Point3F(),
356 gfx::PointF(), 356 gfx::PointF(),
357 gfx::Size(10, 20), 357 gfx::Size(10, 20),
358 true, 358 true,
359 false); 359 false);
360 ExecuteCalculateDrawProperties( 360 ExecuteCalculateDrawProperties(
361 root.get(), kDeviceScale, kPageScale, scroll_layer->parent()); 361 root.get(), kDeviceScale, kPageScale, scroll_layer->parent());
362 expected_transform.MakeIdentity(); 362 expected_transform.MakeIdentity();
363 expected_transform.Translate( 363 expected_transform.Translate(
364 MathUtil::Round(kTranslateX * kPageScale * kDeviceScale + 364 MathUtil::Round(kTranslateX * kPageScale * kDeviceScale +
365 sub_layer_screen_position.x()), 365 sub_layer_screen_position.x()),
(...skipping 12 matching lines...) Expand all
378 root->AddChild(parent); 378 root->AddChild(parent);
379 parent->AddChild(child); 379 parent->AddChild(child);
380 child->AddChild(grand_child); 380 child->AddChild(grand_child);
381 381
382 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 382 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
383 host->SetRootLayer(root); 383 host->SetRootLayer(root);
384 384
385 // One-time setup of root layer 385 // One-time setup of root layer
386 SetLayerPropertiesForTesting(root.get(), 386 SetLayerPropertiesForTesting(root.get(),
387 identity_matrix, 387 identity_matrix,
388 gfx::PointF(), 388 gfx::Point3F(),
389 gfx::PointF(), 389 gfx::PointF(),
390 gfx::Size(1, 2), 390 gfx::Size(1, 2),
391 true, 391 true,
392 false); 392 false);
393 393
394 // Case 1: parent's anchor point should not affect child or grand_child. 394 // Case 1: parent's anchor point should not affect child or grand_child.
395 SetLayerPropertiesForTesting(parent.get(), 395 SetLayerPropertiesForTesting(parent.get(),
396 identity_matrix, 396 identity_matrix,
397 gfx::PointF(0.25f, 0.25f), 397 gfx::Point3F(2.5f, 3.0f, 0.f),
398 gfx::PointF(), 398 gfx::PointF(),
399 gfx::Size(10, 12), 399 gfx::Size(10, 12),
400 true, 400 true,
401 false); 401 false);
402 SetLayerPropertiesForTesting(child.get(), 402 SetLayerPropertiesForTesting(child.get(),
403 identity_matrix, 403 identity_matrix,
404 gfx::PointF(), 404 gfx::Point3F(),
405 gfx::PointF(), 405 gfx::PointF(),
406 gfx::Size(16, 18), 406 gfx::Size(16, 18),
407 true, 407 true,
408 false); 408 false);
409 SetLayerPropertiesForTesting(grand_child.get(), 409 SetLayerPropertiesForTesting(grand_child.get(),
410 identity_matrix, 410 identity_matrix,
411 gfx::PointF(), 411 gfx::Point3F(),
412 gfx::PointF(), 412 gfx::PointF(),
413 gfx::Size(76, 78), 413 gfx::Size(76, 78),
414 true, 414 true,
415 false); 415 false);
416 ExecuteCalculateDrawProperties(root.get()); 416 ExecuteCalculateDrawProperties(root.get());
417 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, child->draw_transform()); 417 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, child->draw_transform());
418 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, 418 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix,
419 child->screen_space_transform()); 419 child->screen_space_transform());
420 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, 420 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix,
421 grand_child->draw_transform()); 421 grand_child->draw_transform());
422 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, 422 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix,
423 grand_child->screen_space_transform()); 423 grand_child->screen_space_transform());
424 424
425 // Case 2: parent's position affects child and grand_child. 425 // Case 2: parent's position affects child and grand_child.
426 gfx::Transform parent_position_transform; 426 gfx::Transform parent_position_transform;
427 parent_position_transform.Translate(0.f, 1.2f); 427 parent_position_transform.Translate(0.f, 1.2f);
428 SetLayerPropertiesForTesting(parent.get(), 428 SetLayerPropertiesForTesting(parent.get(),
429 identity_matrix, 429 identity_matrix,
430 gfx::PointF(0.25f, 0.25f), 430 gfx::Point3F(2.5f, 3.0f, 0.f),
431 gfx::PointF(0.f, 1.2f), 431 gfx::PointF(0.f, 1.2f),
432 gfx::Size(10, 12), 432 gfx::Size(10, 12),
433 true, 433 true,
434 false); 434 false);
435 SetLayerPropertiesForTesting(child.get(), 435 SetLayerPropertiesForTesting(child.get(),
436 identity_matrix, 436 identity_matrix,
437 gfx::PointF(), 437 gfx::Point3F(),
438 gfx::PointF(), 438 gfx::PointF(),
439 gfx::Size(16, 18), 439 gfx::Size(16, 18),
440 true, 440 true,
441 false); 441 false);
442 SetLayerPropertiesForTesting(grand_child.get(), 442 SetLayerPropertiesForTesting(grand_child.get(),
443 identity_matrix, 443 identity_matrix,
444 gfx::PointF(), 444 gfx::Point3F(),
445 gfx::PointF(), 445 gfx::PointF(),
446 gfx::Size(76, 78), 446 gfx::Size(76, 78),
447 true, 447 true,
448 false); 448 false);
449 ExecuteCalculateDrawProperties(root.get()); 449 ExecuteCalculateDrawProperties(root.get());
450 EXPECT_TRANSFORMATION_MATRIX_EQ(parent_position_transform, 450 EXPECT_TRANSFORMATION_MATRIX_EQ(parent_position_transform,
451 child->draw_transform()); 451 child->draw_transform());
452 EXPECT_TRANSFORMATION_MATRIX_EQ(parent_position_transform, 452 EXPECT_TRANSFORMATION_MATRIX_EQ(parent_position_transform,
453 child->screen_space_transform()); 453 child->screen_space_transform());
454 EXPECT_TRANSFORMATION_MATRIX_EQ(parent_position_transform, 454 EXPECT_TRANSFORMATION_MATRIX_EQ(parent_position_transform,
455 grand_child->draw_transform()); 455 grand_child->draw_transform());
456 EXPECT_TRANSFORMATION_MATRIX_EQ(parent_position_transform, 456 EXPECT_TRANSFORMATION_MATRIX_EQ(parent_position_transform,
457 grand_child->screen_space_transform()); 457 grand_child->screen_space_transform());
458 458
459 // Case 3: parent's local transform affects child and grandchild 459 // Case 3: parent's local transform affects child and grandchild
460 gfx::Transform parent_layer_transform; 460 gfx::Transform parent_layer_transform;
461 parent_layer_transform.Scale3d(2.0, 2.0, 1.0); 461 parent_layer_transform.Scale3d(2.0, 2.0, 1.0);
462 gfx::Transform parent_translation_to_anchor; 462 gfx::Transform parent_translation_to_anchor;
463 parent_translation_to_anchor.Translate(2.5, 3.0); 463 parent_translation_to_anchor.Translate(2.5, 3.0);
464 gfx::Transform parent_composite_transform = 464 gfx::Transform parent_composite_transform =
465 parent_translation_to_anchor * parent_layer_transform * 465 parent_translation_to_anchor * parent_layer_transform *
466 Inverse(parent_translation_to_anchor); 466 Inverse(parent_translation_to_anchor);
467 SetLayerPropertiesForTesting(parent.get(), 467 SetLayerPropertiesForTesting(parent.get(),
468 parent_layer_transform, 468 parent_layer_transform,
469 gfx::PointF(0.25f, 0.25f), 469 gfx::Point3F(2.5f, 3.0f, 0.f),
470 gfx::PointF(), 470 gfx::PointF(),
471 gfx::Size(10, 12), 471 gfx::Size(10, 12),
472 true, 472 true,
473 false); 473 false);
474 SetLayerPropertiesForTesting(child.get(), 474 SetLayerPropertiesForTesting(child.get(),
475 identity_matrix, 475 identity_matrix,
476 gfx::PointF(), 476 gfx::Point3F(),
477 gfx::PointF(), 477 gfx::PointF(),
478 gfx::Size(16, 18), 478 gfx::Size(16, 18),
479 true, 479 true,
480 false); 480 false);
481 SetLayerPropertiesForTesting(grand_child.get(), 481 SetLayerPropertiesForTesting(grand_child.get(),
482 identity_matrix, 482 identity_matrix,
483 gfx::PointF(), 483 gfx::Point3F(),
484 gfx::PointF(), 484 gfx::PointF(),
485 gfx::Size(76, 78), 485 gfx::Size(76, 78),
486 true, 486 true,
487 false); 487 false);
488 ExecuteCalculateDrawProperties(root.get()); 488 ExecuteCalculateDrawProperties(root.get());
489 EXPECT_TRANSFORMATION_MATRIX_EQ(parent_composite_transform, 489 EXPECT_TRANSFORMATION_MATRIX_EQ(parent_composite_transform,
490 child->draw_transform()); 490 child->draw_transform());
491 EXPECT_TRANSFORMATION_MATRIX_EQ(parent_composite_transform, 491 EXPECT_TRANSFORMATION_MATRIX_EQ(parent_composite_transform,
492 child->screen_space_transform()); 492 child->screen_space_transform());
493 EXPECT_TRANSFORMATION_MATRIX_EQ(parent_composite_transform, 493 EXPECT_TRANSFORMATION_MATRIX_EQ(parent_composite_transform,
(...skipping 12 matching lines...) Expand all
506 parent->AddChild(child); 506 parent->AddChild(child);
507 child->AddChild(grand_child); 507 child->AddChild(grand_child);
508 508
509 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 509 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
510 host->SetRootLayer(root); 510 host->SetRootLayer(root);
511 511
512 // One-time setup of root layer 512 // One-time setup of root layer
513 gfx::Transform identity_matrix; 513 gfx::Transform identity_matrix;
514 SetLayerPropertiesForTesting(root.get(), 514 SetLayerPropertiesForTesting(root.get(),
515 identity_matrix, 515 identity_matrix,
516 gfx::PointF(), 516 gfx::Point3F(),
517 gfx::PointF(), 517 gfx::PointF(),
518 gfx::Size(1, 2), 518 gfx::Size(1, 2),
519 true, 519 true,
520 false); 520 false);
521 521
522 // Child is set up so that a new render surface should be created. 522 // Child is set up so that a new render surface should be created.
523 child->SetOpacity(0.5f); 523 child->SetOpacity(0.5f);
524 child->SetForceRenderSurface(true); 524 child->SetForceRenderSurface(true);
525 525
526 gfx::Transform parent_layer_transform; 526 gfx::Transform parent_layer_transform;
(...skipping 11 matching lines...) Expand all
538 surface_sublayer_transform.Scale(parent_composite_scale.x(), 538 surface_sublayer_transform.Scale(parent_composite_scale.x(),
539 parent_composite_scale.y()); 539 parent_composite_scale.y());
540 gfx::Transform surface_sublayer_composite_transform = 540 gfx::Transform surface_sublayer_composite_transform =
541 parent_composite_transform * Inverse(surface_sublayer_transform); 541 parent_composite_transform * Inverse(surface_sublayer_transform);
542 542
543 // Child's render surface should not exist yet. 543 // Child's render surface should not exist yet.
544 ASSERT_FALSE(child->render_surface()); 544 ASSERT_FALSE(child->render_surface());
545 545
546 SetLayerPropertiesForTesting(parent.get(), 546 SetLayerPropertiesForTesting(parent.get(),
547 parent_layer_transform, 547 parent_layer_transform,
548 gfx::PointF(0.25f, 0.25f), 548 gfx::Point3F(25.0f, 30.0f, 0.f),
549 gfx::PointF(), 549 gfx::PointF(),
550 gfx::Size(100, 120), 550 gfx::Size(100, 120),
551 true, 551 true,
552 false); 552 false);
553 SetLayerPropertiesForTesting(child.get(), 553 SetLayerPropertiesForTesting(child.get(),
554 identity_matrix, 554 identity_matrix,
555 gfx::PointF(), 555 gfx::Point3F(),
556 gfx::PointF(), 556 gfx::PointF(),
557 gfx::Size(16, 18), 557 gfx::Size(16, 18),
558 true, 558 true,
559 false); 559 false);
560 SetLayerPropertiesForTesting(grand_child.get(), 560 SetLayerPropertiesForTesting(grand_child.get(),
561 identity_matrix, 561 identity_matrix,
562 gfx::PointF(), 562 gfx::Point3F(),
563 gfx::PointF(), 563 gfx::PointF(),
564 gfx::Size(8, 10), 564 gfx::Size(8, 10),
565 true, 565 true,
566 false); 566 false);
567 ExecuteCalculateDrawProperties(root.get()); 567 ExecuteCalculateDrawProperties(root.get());
568 568
569 // Render surface should have been created now. 569 // Render surface should have been created now.
570 ASSERT_TRUE(child->render_surface()); 570 ASSERT_TRUE(child->render_surface());
571 ASSERT_EQ(child, child->render_target()); 571 ASSERT_EQ(child, child->render_target());
572 572
(...skipping 30 matching lines...) Expand all
603 child->AddChild(grand_child); 603 child->AddChild(grand_child);
604 child->SetReplicaLayer(child_replica.get()); 604 child->SetReplicaLayer(child_replica.get());
605 605
606 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 606 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
607 host->SetRootLayer(root); 607 host->SetRootLayer(root);
608 608
609 // One-time setup of root layer 609 // One-time setup of root layer
610 gfx::Transform identity_matrix; 610 gfx::Transform identity_matrix;
611 SetLayerPropertiesForTesting(root.get(), 611 SetLayerPropertiesForTesting(root.get(),
612 identity_matrix, 612 identity_matrix,
613 gfx::PointF(), 613 gfx::Point3F(),
614 gfx::PointF(), 614 gfx::PointF(),
615 gfx::Size(1, 2), 615 gfx::Size(1, 2),
616 true, 616 true,
617 false); 617 false);
618 618
619 // Child is set up so that a new render surface should be created. 619 // Child is set up so that a new render surface should be created.
620 child->SetOpacity(0.5f); 620 child->SetOpacity(0.5f);
621 621
622 gfx::Transform parent_layer_transform; 622 gfx::Transform parent_layer_transform;
623 parent_layer_transform.Scale3d(2.0, 2.0, 1.0); 623 parent_layer_transform.Scale3d(2.0, 2.0, 1.0);
(...skipping 12 matching lines...) Expand all
636 parent_composite_scale.y()); 636 parent_composite_scale.y());
637 gfx::Transform replica_composite_transform = 637 gfx::Transform replica_composite_transform =
638 parent_composite_transform * replica_layer_transform * 638 parent_composite_transform * replica_layer_transform *
639 Inverse(surface_sublayer_transform); 639 Inverse(surface_sublayer_transform);
640 640
641 // Child's render surface should not exist yet. 641 // Child's render surface should not exist yet.
642 ASSERT_FALSE(child->render_surface()); 642 ASSERT_FALSE(child->render_surface());
643 643
644 SetLayerPropertiesForTesting(parent.get(), 644 SetLayerPropertiesForTesting(parent.get(),
645 parent_layer_transform, 645 parent_layer_transform,
646 gfx::PointF(0.25f, 0.25f), 646 gfx::Point3F(2.5f, 3.0f, 0.f),
647 gfx::PointF(), 647 gfx::PointF(),
648 gfx::Size(10, 12), 648 gfx::Size(10, 12),
649 true, 649 true,
650 false); 650 false);
651 SetLayerPropertiesForTesting(child.get(), 651 SetLayerPropertiesForTesting(child.get(),
652 identity_matrix, 652 identity_matrix,
653 gfx::PointF(), 653 gfx::Point3F(),
654 gfx::PointF(), 654 gfx::PointF(),
655 gfx::Size(16, 18), 655 gfx::Size(16, 18),
656 true, 656 true,
657 false); 657 false);
658 SetLayerPropertiesForTesting(grand_child.get(), 658 SetLayerPropertiesForTesting(grand_child.get(),
659 identity_matrix, 659 identity_matrix,
660 gfx::PointF(), 660 gfx::Point3F(),
661 gfx::PointF(-0.5f, -0.5f), 661 gfx::PointF(-0.5f, -0.5f),
662 gfx::Size(1, 1), 662 gfx::Size(1, 1),
663 true, 663 true,
664 false); 664 false);
665 SetLayerPropertiesForTesting(child_replica.get(), 665 SetLayerPropertiesForTesting(child_replica.get(),
666 replica_layer_transform, 666 replica_layer_transform,
667 gfx::PointF(), 667 gfx::Point3F(),
668 gfx::PointF(), 668 gfx::PointF(),
669 gfx::Size(), 669 gfx::Size(),
670 true, 670 true,
671 false); 671 false);
672 ExecuteCalculateDrawProperties(root.get()); 672 ExecuteCalculateDrawProperties(root.get());
673 673
674 // Render surface should have been created now. 674 // Render surface should have been created now.
675 ASSERT_TRUE(child->render_surface()); 675 ASSERT_TRUE(child->render_surface());
676 ASSERT_EQ(child, child->render_target()); 676 ASSERT_EQ(child, child->render_target());
677 677
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 729
730 // In combination with descendant draws content, opacity != 1 forces the layer 730 // In combination with descendant draws content, opacity != 1 forces the layer
731 // to have a new render surface. 731 // to have a new render surface.
732 render_surface1->SetOpacity(0.5f); 732 render_surface1->SetOpacity(0.5f);
733 render_surface2->SetOpacity(0.33f); 733 render_surface2->SetOpacity(0.33f);
734 734
735 // One-time setup of root layer 735 // One-time setup of root layer
736 gfx::Transform identity_matrix; 736 gfx::Transform identity_matrix;
737 SetLayerPropertiesForTesting(root.get(), 737 SetLayerPropertiesForTesting(root.get(),
738 identity_matrix, 738 identity_matrix,
739 gfx::PointF(), 739 gfx::Point3F(),
740 gfx::PointF(), 740 gfx::PointF(),
741 gfx::Size(1, 2), 741 gfx::Size(1, 2),
742 true, 742 true,
743 false); 743 false);
744 744
745 // All layers in the tree are initialized with an anchor at .25 and a size of 745 // All layers in the tree are initialized with an anchor at .25 and a size of
746 // (10,10). matrix "A" is the composite layer transform used in all layers, 746 // (10,10). matrix "A" is the composite layer transform used in all layers,
747 // Matrix "R" is the composite replica transform used in all replica layers. 747 // Matrix "R" is the composite replica transform used in all replica layers.
748 gfx::Transform translation_to_anchor; 748 gfx::Transform translation_to_anchor;
749 translation_to_anchor.Translate(2.5, 0.0); 749 translation_to_anchor.Translate(2.5, 0.0);
(...skipping 26 matching lines...) Expand all
776 surface2_parent_transform_scale.y()); 776 surface2_parent_transform_scale.y());
777 777
778 // SS2 = transform given to the subtree of render_surface2 778 // SS2 = transform given to the subtree of render_surface2
779 gfx::Transform SS2 = surface2_sublayer_transform; 779 gfx::Transform SS2 = surface2_sublayer_transform;
780 // S2 = transform to move from render_surface2 pixels to the layer space of 780 // S2 = transform to move from render_surface2 pixels to the layer space of
781 // the owning layer 781 // the owning layer
782 gfx::Transform S2 = Inverse(surface2_sublayer_transform); 782 gfx::Transform S2 = Inverse(surface2_sublayer_transform);
783 783
784 SetLayerPropertiesForTesting(parent.get(), 784 SetLayerPropertiesForTesting(parent.get(),
785 layer_transform, 785 layer_transform,
786 gfx::PointF(0.25f, 0.f), 786 gfx::Point3F(2.5f, 0.f, 0.f),
787 gfx::PointF(), 787 gfx::PointF(),
788 gfx::Size(10, 10), 788 gfx::Size(10, 10),
789 true, 789 true,
790 false); 790 false);
791 SetLayerPropertiesForTesting(render_surface1.get(), 791 SetLayerPropertiesForTesting(render_surface1.get(),
792 layer_transform, 792 layer_transform,
793 gfx::PointF(0.25f, 0.f), 793 gfx::Point3F(2.5f, 0.f, 0.f),
794 gfx::PointF(), 794 gfx::PointF(),
795 gfx::Size(10, 10), 795 gfx::Size(10, 10),
796 true, 796 true,
797 false); 797 false);
798 SetLayerPropertiesForTesting(render_surface2.get(), 798 SetLayerPropertiesForTesting(render_surface2.get(),
799 layer_transform, 799 layer_transform,
800 gfx::PointF(0.25f, 0.f), 800 gfx::Point3F(2.5f, 0.f, 0.f),
801 gfx::PointF(), 801 gfx::PointF(),
802 gfx::Size(10, 10), 802 gfx::Size(10, 10),
803 true, 803 true,
804 false); 804 false);
805 SetLayerPropertiesForTesting(child_of_root.get(), 805 SetLayerPropertiesForTesting(child_of_root.get(),
806 layer_transform, 806 layer_transform,
807 gfx::PointF(0.25f, 0.f), 807 gfx::Point3F(2.5f, 0.f, 0.f),
808 gfx::PointF(), 808 gfx::PointF(),
809 gfx::Size(10, 10), 809 gfx::Size(10, 10),
810 true, 810 true,
811 false); 811 false);
812 SetLayerPropertiesForTesting(child_of_rs1.get(), 812 SetLayerPropertiesForTesting(child_of_rs1.get(),
813 layer_transform, 813 layer_transform,
814 gfx::PointF(0.25f, 0.f), 814 gfx::Point3F(2.5f, 0.f, 0.f),
815 gfx::PointF(), 815 gfx::PointF(),
816 gfx::Size(10, 10), 816 gfx::Size(10, 10),
817 true, 817 true,
818 false); 818 false);
819 SetLayerPropertiesForTesting(child_of_rs2.get(), 819 SetLayerPropertiesForTesting(child_of_rs2.get(),
820 layer_transform, 820 layer_transform,
821 gfx::PointF(0.25f, 0.f), 821 gfx::Point3F(2.5f, 0.f, 0.f),
822 gfx::PointF(), 822 gfx::PointF(),
823 gfx::Size(10, 10), 823 gfx::Size(10, 10),
824 true, 824 true,
825 false); 825 false);
826 SetLayerPropertiesForTesting(grand_child_of_root.get(), 826 SetLayerPropertiesForTesting(grand_child_of_root.get(),
827 layer_transform, 827 layer_transform,
828 gfx::PointF(0.25f, 0.f), 828 gfx::Point3F(2.5f, 0.f, 0.f),
829 gfx::PointF(), 829 gfx::PointF(),
830 gfx::Size(10, 10), 830 gfx::Size(10, 10),
831 true, 831 true,
832 false); 832 false);
833 SetLayerPropertiesForTesting(grand_child_of_rs1.get(), 833 SetLayerPropertiesForTesting(grand_child_of_rs1.get(),
834 layer_transform, 834 layer_transform,
835 gfx::PointF(0.25f, 0.f), 835 gfx::Point3F(2.5f, 0.f, 0.f),
836 gfx::PointF(), 836 gfx::PointF(),
837 gfx::Size(10, 10), 837 gfx::Size(10, 10),
838 true, 838 true,
839 false); 839 false);
840 SetLayerPropertiesForTesting(grand_child_of_rs2.get(), 840 SetLayerPropertiesForTesting(grand_child_of_rs2.get(),
841 layer_transform, 841 layer_transform,
842 gfx::PointF(0.25f, 0.f), 842 gfx::Point3F(2.5f, 0.f, 0.f),
843 gfx::PointF(), 843 gfx::PointF(),
844 gfx::Size(10, 10), 844 gfx::Size(10, 10),
845 true, 845 true,
846 false); 846 false);
847 SetLayerPropertiesForTesting(replica_of_rs1.get(), 847 SetLayerPropertiesForTesting(replica_of_rs1.get(),
848 replica_layer_transform, 848 replica_layer_transform,
849 gfx::PointF(0.25f, 0.f), 849 gfx::Point3F(2.5f, 0.f, 0.f),
850 gfx::PointF(), 850 gfx::PointF(),
851 gfx::Size(), 851 gfx::Size(),
852 true, 852 true,
853 false); 853 false);
854 SetLayerPropertiesForTesting(replica_of_rs2.get(), 854 SetLayerPropertiesForTesting(replica_of_rs2.get(),
855 replica_layer_transform, 855 replica_layer_transform,
856 gfx::PointF(0.25f, 0.f), 856 gfx::Point3F(2.5f, 0.f, 0.f),
857 gfx::PointF(), 857 gfx::PointF(),
858 gfx::Size(), 858 gfx::Size(),
859 true, 859 true,
860 false); 860 false);
861 861
862 ExecuteCalculateDrawProperties(root.get()); 862 ExecuteCalculateDrawProperties(root.get());
863 863
864 // Only layers that are associated with render surfaces should have an actual 864 // Only layers that are associated with render surfaces should have an actual
865 // RenderSurface() value. 865 // RenderSurface() value.
866 ASSERT_TRUE(root->render_surface()); 866 ASSERT_TRUE(root->render_surface());
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 scoped_refptr<Layer> child = Layer::Create(); 988 scoped_refptr<Layer> child = Layer::Create();
989 scoped_refptr<LayerWithForcedDrawsContent> grand_child = 989 scoped_refptr<LayerWithForcedDrawsContent> grand_child =
990 make_scoped_refptr(new LayerWithForcedDrawsContent()); 990 make_scoped_refptr(new LayerWithForcedDrawsContent());
991 991
992 gfx::Transform rotation_about_y_axis; 992 gfx::Transform rotation_about_y_axis;
993 rotation_about_y_axis.RotateAboutYAxis(30.0); 993 rotation_about_y_axis.RotateAboutYAxis(30.0);
994 994
995 const gfx::Transform identity_matrix; 995 const gfx::Transform identity_matrix;
996 SetLayerPropertiesForTesting(root.get(), 996 SetLayerPropertiesForTesting(root.get(),
997 identity_matrix, 997 identity_matrix,
998 gfx::PointF(), 998 gfx::Point3F(),
999 gfx::PointF(), 999 gfx::PointF(),
1000 gfx::Size(100, 100), 1000 gfx::Size(100, 100),
1001 true, 1001 true,
1002 false); 1002 false);
1003 SetLayerPropertiesForTesting(child.get(), 1003 SetLayerPropertiesForTesting(child.get(),
1004 rotation_about_y_axis, 1004 rotation_about_y_axis,
1005 gfx::PointF(), 1005 gfx::Point3F(),
1006 gfx::PointF(), 1006 gfx::PointF(),
1007 gfx::Size(10, 10), 1007 gfx::Size(10, 10),
1008 true, 1008 true,
1009 false); 1009 false);
1010 SetLayerPropertiesForTesting(grand_child.get(), 1010 SetLayerPropertiesForTesting(grand_child.get(),
1011 rotation_about_y_axis, 1011 rotation_about_y_axis,
1012 gfx::PointF(), 1012 gfx::Point3F(),
1013 gfx::PointF(), 1013 gfx::PointF(),
1014 gfx::Size(10, 10), 1014 gfx::Size(10, 10),
1015 true, 1015 true,
1016 false); 1016 false);
1017 1017
1018 root->AddChild(child); 1018 root->AddChild(child);
1019 child->AddChild(grand_child); 1019 child->AddChild(grand_child);
1020 child->SetForceRenderSurface(true); 1020 child->SetForceRenderSurface(true);
1021 1021
1022 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 1022 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 scoped_refptr<Layer> root = Layer::Create(); 1067 scoped_refptr<Layer> root = Layer::Create();
1068 scoped_refptr<Layer> child = Layer::Create(); 1068 scoped_refptr<Layer> child = Layer::Create();
1069 scoped_refptr<LayerWithForcedDrawsContent> grand_child = 1069 scoped_refptr<LayerWithForcedDrawsContent> grand_child =
1070 make_scoped_refptr(new LayerWithForcedDrawsContent()); 1070 make_scoped_refptr(new LayerWithForcedDrawsContent());
1071 1071
1072 // The child height is zero, but has non-zero width that should be accounted 1072 // The child height is zero, but has non-zero width that should be accounted
1073 // for while computing draw transforms. 1073 // for while computing draw transforms.
1074 const gfx::Transform identity_matrix; 1074 const gfx::Transform identity_matrix;
1075 SetLayerPropertiesForTesting(root.get(), 1075 SetLayerPropertiesForTesting(root.get(),
1076 identity_matrix, 1076 identity_matrix,
1077 gfx::PointF(), 1077 gfx::Point3F(),
1078 gfx::PointF(), 1078 gfx::PointF(),
1079 gfx::Size(100, 100), 1079 gfx::Size(100, 100),
1080 true, 1080 true,
1081 false); 1081 false);
1082 SetLayerPropertiesForTesting(child.get(), 1082 SetLayerPropertiesForTesting(child.get(),
1083 identity_matrix, 1083 identity_matrix,
1084 gfx::PointF(), 1084 gfx::Point3F(),
1085 gfx::PointF(), 1085 gfx::PointF(),
1086 gfx::Size(10, 0), 1086 gfx::Size(10, 0),
1087 true, 1087 true,
1088 false); 1088 false);
1089 SetLayerPropertiesForTesting(grand_child.get(), 1089 SetLayerPropertiesForTesting(grand_child.get(),
1090 identity_matrix, 1090 identity_matrix,
1091 gfx::PointF(), 1091 gfx::Point3F(),
1092 gfx::PointF(), 1092 gfx::PointF(),
1093 gfx::Size(10, 10), 1093 gfx::Size(10, 10),
1094 true, 1094 true,
1095 false); 1095 false);
1096 1096
1097 root->AddChild(child); 1097 root->AddChild(child);
1098 child->AddChild(grand_child); 1098 child->AddChild(grand_child);
1099 child->SetForceRenderSurface(true); 1099 child->SetForceRenderSurface(true);
1100 1100
1101 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 1101 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
(...skipping 19 matching lines...) Expand all
1121 scoped_refptr<LayerWithForcedDrawsContent> child = 1121 scoped_refptr<LayerWithForcedDrawsContent> child =
1122 new LayerWithForcedDrawsContent; 1122 new LayerWithForcedDrawsContent;
1123 child->SetScrollClipLayerId(root->id()); 1123 child->SetScrollClipLayerId(root->id());
1124 root->AddChild(child); 1124 root->AddChild(child);
1125 1125
1126 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 1126 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
1127 host->SetRootLayer(root); 1127 host->SetRootLayer(root);
1128 1128
1129 SetLayerPropertiesForTesting(root.get(), 1129 SetLayerPropertiesForTesting(root.get(),
1130 identity_matrix, 1130 identity_matrix,
1131 gfx::PointF(), 1131 gfx::Point3F(),
1132 gfx::PointF(), 1132 gfx::PointF(),
1133 gfx::Size(20, 20), 1133 gfx::Size(20, 20),
1134 true, 1134 true,
1135 false); 1135 false);
1136 SetLayerPropertiesForTesting(child.get(), 1136 SetLayerPropertiesForTesting(child.get(),
1137 identity_matrix, 1137 identity_matrix,
1138 gfx::PointF(), 1138 gfx::Point3F(),
1139 gfx::PointF(), 1139 gfx::PointF(),
1140 gfx::Size(20, 20), 1140 gfx::Size(20, 20),
1141 true, 1141 true,
1142 false); 1142 false);
1143 1143
1144 gfx::Transform translate; 1144 gfx::Transform translate;
1145 translate.Translate(50, 50); 1145 translate.Translate(50, 50);
1146 { 1146 {
1147 RenderSurfaceLayerList render_surface_layer_list; 1147 RenderSurfaceLayerList render_surface_layer_list;
1148 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( 1148 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs(
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 scoped_refptr<Layer> render_surface1 = Layer::Create(); 1268 scoped_refptr<Layer> render_surface1 = Layer::Create();
1269 scoped_refptr<LayerWithForcedDrawsContent> child = 1269 scoped_refptr<LayerWithForcedDrawsContent> child =
1270 make_scoped_refptr(new LayerWithForcedDrawsContent()); 1270 make_scoped_refptr(new LayerWithForcedDrawsContent());
1271 1271
1272 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 1272 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
1273 host->SetRootLayer(parent); 1273 host->SetRootLayer(parent);
1274 1274
1275 const gfx::Transform identity_matrix; 1275 const gfx::Transform identity_matrix;
1276 SetLayerPropertiesForTesting(parent.get(), 1276 SetLayerPropertiesForTesting(parent.get(),
1277 identity_matrix, 1277 identity_matrix,
1278 gfx::PointF(), 1278 gfx::Point3F(),
1279 gfx::PointF(), 1279 gfx::PointF(),
1280 gfx::Size(10, 10), 1280 gfx::Size(10, 10),
1281 true, 1281 true,
1282 false); 1282 false);
1283 SetLayerPropertiesForTesting(render_surface1.get(), 1283 SetLayerPropertiesForTesting(render_surface1.get(),
1284 identity_matrix, 1284 identity_matrix,
1285 gfx::PointF(), 1285 gfx::Point3F(),
1286 gfx::PointF(), 1286 gfx::PointF(),
1287 gfx::Size(10, 10), 1287 gfx::Size(10, 10),
1288 true, 1288 true,
1289 false); 1289 false);
1290 SetLayerPropertiesForTesting(child.get(), 1290 SetLayerPropertiesForTesting(child.get(),
1291 identity_matrix, 1291 identity_matrix,
1292 gfx::PointF(), 1292 gfx::Point3F(),
1293 gfx::PointF(30.f, 30.f), 1293 gfx::PointF(30.f, 30.f),
1294 gfx::Size(10, 10), 1294 gfx::Size(10, 10),
1295 true, 1295 true,
1296 false); 1296 false);
1297 1297
1298 parent->AddChild(render_surface1); 1298 parent->AddChild(render_surface1);
1299 parent->SetMasksToBounds(true); 1299 parent->SetMasksToBounds(true);
1300 render_surface1->AddChild(child); 1300 render_surface1->AddChild(child);
1301 render_surface1->SetForceRenderSurface(true); 1301 render_surface1->SetForceRenderSurface(true);
1302 1302
(...skipping 19 matching lines...) Expand all
1322 scoped_refptr<Layer> render_surface1 = Layer::Create(); 1322 scoped_refptr<Layer> render_surface1 = Layer::Create();
1323 scoped_refptr<LayerWithForcedDrawsContent> child = 1323 scoped_refptr<LayerWithForcedDrawsContent> child =
1324 make_scoped_refptr(new LayerWithForcedDrawsContent()); 1324 make_scoped_refptr(new LayerWithForcedDrawsContent());
1325 1325
1326 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 1326 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
1327 host->SetRootLayer(parent); 1327 host->SetRootLayer(parent);
1328 1328
1329 const gfx::Transform identity_matrix; 1329 const gfx::Transform identity_matrix;
1330 SetLayerPropertiesForTesting(render_surface1.get(), 1330 SetLayerPropertiesForTesting(render_surface1.get(),
1331 identity_matrix, 1331 identity_matrix,
1332 gfx::PointF(), 1332 gfx::Point3F(),
1333 gfx::PointF(), 1333 gfx::PointF(),
1334 gfx::Size(10, 10), 1334 gfx::Size(10, 10),
1335 true, 1335 true,
1336 false); 1336 false);
1337 SetLayerPropertiesForTesting(child.get(), 1337 SetLayerPropertiesForTesting(child.get(),
1338 identity_matrix, 1338 identity_matrix,
1339 gfx::PointF(), 1339 gfx::Point3F(),
1340 gfx::PointF(), 1340 gfx::PointF(),
1341 gfx::Size(10, 10), 1341 gfx::Size(10, 10),
1342 true, 1342 true,
1343 false); 1343 false);
1344 1344
1345 parent->AddChild(render_surface1); 1345 parent->AddChild(render_surface1);
1346 render_surface1->AddChild(child); 1346 render_surface1->AddChild(child);
1347 render_surface1->SetForceRenderSurface(true); 1347 render_surface1->SetForceRenderSurface(true);
1348 render_surface1->SetOpacity(0.f); 1348 render_surface1->SetOpacity(0.f);
1349 1349
(...skipping 19 matching lines...) Expand all
1369 scoped_refptr<LayerWithForcedDrawsContent> child = 1369 scoped_refptr<LayerWithForcedDrawsContent> child =
1370 make_scoped_refptr(new LayerWithForcedDrawsContent()); 1370 make_scoped_refptr(new LayerWithForcedDrawsContent());
1371 render_surface1->SetForceRenderSurface(true); 1371 render_surface1->SetForceRenderSurface(true);
1372 1372
1373 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 1373 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
1374 host->SetRootLayer(parent); 1374 host->SetRootLayer(parent);
1375 1375
1376 const gfx::Transform identity_matrix; 1376 const gfx::Transform identity_matrix;
1377 SetLayerPropertiesForTesting(parent.get(), 1377 SetLayerPropertiesForTesting(parent.get(),
1378 identity_matrix, 1378 identity_matrix,
1379 gfx::PointF(), 1379 gfx::Point3F(),
1380 gfx::PointF(), 1380 gfx::PointF(),
1381 gfx::Size(10, 10), 1381 gfx::Size(10, 10),
1382 true, 1382 true,
1383 false); 1383 false);
1384 SetLayerPropertiesForTesting(render_surface1.get(), 1384 SetLayerPropertiesForTesting(render_surface1.get(),
1385 identity_matrix, 1385 identity_matrix,
1386 gfx::PointF(), 1386 gfx::Point3F(),
1387 gfx::PointF(), 1387 gfx::PointF(),
1388 gfx::Size(10, 10), 1388 gfx::Size(10, 10),
1389 true, 1389 true,
1390 false); 1390 false);
1391 SetLayerPropertiesForTesting(child.get(), 1391 SetLayerPropertiesForTesting(child.get(),
1392 identity_matrix, 1392 identity_matrix,
1393 gfx::PointF(), 1393 gfx::Point3F(),
1394 gfx::PointF(), 1394 gfx::PointF(),
1395 gfx::Size(10, 10), 1395 gfx::Size(10, 10),
1396 true, 1396 true,
1397 false); 1397 false);
1398 1398
1399 parent->AddChild(render_surface1); 1399 parent->AddChild(render_surface1);
1400 render_surface1->AddChild(child); 1400 render_surface1->AddChild(child);
1401 1401
1402 // Sanity check before the actual test 1402 // Sanity check before the actual test
1403 EXPECT_FALSE(parent->render_surface()); 1403 EXPECT_FALSE(parent->render_surface());
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 host->SetRootLayer(parent); 1463 host->SetRootLayer(parent);
1464 1464
1465 // leaf_node1 ensures that parent and child are kept on the 1465 // leaf_node1 ensures that parent and child are kept on the
1466 // render_surface_layer_list, even though grand_child and great_grand_child 1466 // render_surface_layer_list, even though grand_child and great_grand_child
1467 // should be clipped. 1467 // should be clipped.
1468 child->AddChild(leaf_node1); 1468 child->AddChild(leaf_node1);
1469 great_grand_child->AddChild(leaf_node2); 1469 great_grand_child->AddChild(leaf_node2);
1470 1470
1471 SetLayerPropertiesForTesting(parent.get(), 1471 SetLayerPropertiesForTesting(parent.get(),
1472 identity_matrix, 1472 identity_matrix,
1473 gfx::PointF(), 1473 gfx::Point3F(),
1474 gfx::PointF(), 1474 gfx::PointF(),
1475 gfx::Size(500, 500), 1475 gfx::Size(500, 500),
1476 true, 1476 true,
1477 false); 1477 false);
1478 SetLayerPropertiesForTesting(child.get(), 1478 SetLayerPropertiesForTesting(child.get(),
1479 identity_matrix, 1479 identity_matrix,
1480 gfx::PointF(), 1480 gfx::Point3F(),
1481 gfx::PointF(), 1481 gfx::PointF(),
1482 gfx::Size(20, 20), 1482 gfx::Size(20, 20),
1483 true, 1483 true,
1484 false); 1484 false);
1485 SetLayerPropertiesForTesting(grand_child.get(), 1485 SetLayerPropertiesForTesting(grand_child.get(),
1486 identity_matrix, 1486 identity_matrix,
1487 gfx::PointF(), 1487 gfx::Point3F(),
1488 gfx::PointF(45.f, 45.f), 1488 gfx::PointF(45.f, 45.f),
1489 gfx::Size(10, 10), 1489 gfx::Size(10, 10),
1490 true, 1490 true,
1491 false); 1491 false);
1492 SetLayerPropertiesForTesting(great_grand_child.get(), 1492 SetLayerPropertiesForTesting(great_grand_child.get(),
1493 identity_matrix, 1493 identity_matrix,
1494 gfx::PointF(), 1494 gfx::Point3F(),
1495 gfx::PointF(), 1495 gfx::PointF(),
1496 gfx::Size(10, 10), 1496 gfx::Size(10, 10),
1497 true, 1497 true,
1498 false); 1498 false);
1499 SetLayerPropertiesForTesting(leaf_node1.get(), 1499 SetLayerPropertiesForTesting(leaf_node1.get(),
1500 identity_matrix, 1500 identity_matrix,
1501 gfx::PointF(), 1501 gfx::Point3F(),
1502 gfx::PointF(), 1502 gfx::PointF(),
1503 gfx::Size(500, 500), 1503 gfx::Size(500, 500),
1504 true, 1504 true,
1505 false); 1505 false);
1506 SetLayerPropertiesForTesting(leaf_node2.get(), 1506 SetLayerPropertiesForTesting(leaf_node2.get(),
1507 identity_matrix, 1507 identity_matrix,
1508 gfx::PointF(), 1508 gfx::Point3F(),
1509 gfx::PointF(), 1509 gfx::PointF(),
1510 gfx::Size(20, 20), 1510 gfx::Size(20, 20),
1511 true, 1511 true,
1512 false); 1512 false);
1513 1513
1514 child->SetMasksToBounds(true); 1514 child->SetMasksToBounds(true);
1515 child->SetOpacity(0.4f); 1515 child->SetOpacity(0.4f);
1516 child->SetForceRenderSurface(true); 1516 child->SetForceRenderSurface(true);
1517 grand_child->SetOpacity(0.5f); 1517 grand_child->SetOpacity(0.5f);
1518 great_grand_child->SetOpacity(0.4f); 1518 great_grand_child->SetOpacity(0.4f);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1555 make_scoped_refptr(new LayerWithForcedDrawsContent()); 1555 make_scoped_refptr(new LayerWithForcedDrawsContent());
1556 parent->AddChild(child); 1556 parent->AddChild(child);
1557 child->AddChild(grand_child); 1557 child->AddChild(grand_child);
1558 grand_child->AddChild(leaf_node); 1558 grand_child->AddChild(leaf_node);
1559 1559
1560 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 1560 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
1561 host->SetRootLayer(parent); 1561 host->SetRootLayer(parent);
1562 1562
1563 SetLayerPropertiesForTesting(parent.get(), 1563 SetLayerPropertiesForTesting(parent.get(),
1564 identity_matrix, 1564 identity_matrix,
1565 gfx::PointF(), 1565 gfx::Point3F(),
1566 gfx::PointF(), 1566 gfx::PointF(),
1567 gfx::Size(100, 100), 1567 gfx::Size(100, 100),
1568 true, 1568 true,
1569 false); 1569 false);
1570 SetLayerPropertiesForTesting(child.get(), 1570 SetLayerPropertiesForTesting(child.get(),
1571 identity_matrix, 1571 identity_matrix,
1572 gfx::PointF(), 1572 gfx::Point3F(),
1573 gfx::PointF(), 1573 gfx::PointF(),
1574 gfx::Size(20, 20), 1574 gfx::Size(20, 20),
1575 true, 1575 true,
1576 false); 1576 false);
1577 SetLayerPropertiesForTesting(grand_child.get(), 1577 SetLayerPropertiesForTesting(grand_child.get(),
1578 identity_matrix, 1578 identity_matrix,
1579 gfx::PointF(), 1579 gfx::Point3F(),
1580 gfx::PointF(200.f, 200.f), 1580 gfx::PointF(200.f, 200.f),
1581 gfx::Size(10, 10), 1581 gfx::Size(10, 10),
1582 true, 1582 true,
1583 false); 1583 false);
1584 SetLayerPropertiesForTesting(leaf_node.get(), 1584 SetLayerPropertiesForTesting(leaf_node.get(),
1585 identity_matrix, 1585 identity_matrix,
1586 gfx::PointF(), 1586 gfx::Point3F(),
1587 gfx::PointF(), 1587 gfx::PointF(),
1588 gfx::Size(10, 10), 1588 gfx::Size(10, 10),
1589 true, 1589 true,
1590 false); 1590 false);
1591 1591
1592 parent->SetMasksToBounds(true); 1592 parent->SetMasksToBounds(true);
1593 child->SetOpacity(0.4f); 1593 child->SetOpacity(0.4f);
1594 child->SetForceRenderSurface(true); 1594 child->SetForceRenderSurface(true);
1595 grand_child->SetOpacity(0.4f); 1595 grand_child->SetOpacity(0.4f);
1596 grand_child->SetForceRenderSurface(true); 1596 grand_child->SetForceRenderSurface(true);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1659 child2->AddChild(leaf_node2); 1659 child2->AddChild(leaf_node2);
1660 grand_child->AddChild(leaf_node1); 1660 grand_child->AddChild(leaf_node1);
1661 1661
1662 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 1662 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
1663 host->SetRootLayer(root); 1663 host->SetRootLayer(root);
1664 1664
1665 child2->SetForceRenderSurface(true); 1665 child2->SetForceRenderSurface(true);
1666 1666
1667 SetLayerPropertiesForTesting(root.get(), 1667 SetLayerPropertiesForTesting(root.get(),
1668 identity_matrix, 1668 identity_matrix,
1669 gfx::PointF(), 1669 gfx::Point3F(),
1670 gfx::PointF(), 1670 gfx::PointF(),
1671 gfx::Size(100, 100), 1671 gfx::Size(100, 100),
1672 true, 1672 true,
1673 false); 1673 false);
1674 SetLayerPropertiesForTesting(parent.get(), 1674 SetLayerPropertiesForTesting(parent.get(),
1675 identity_matrix, 1675 identity_matrix,
1676 gfx::PointF(), 1676 gfx::Point3F(),
1677 gfx::PointF(), 1677 gfx::PointF(),
1678 gfx::Size(100, 100), 1678 gfx::Size(100, 100),
1679 true, 1679 true,
1680 false); 1680 false);
1681 SetLayerPropertiesForTesting(child1.get(), 1681 SetLayerPropertiesForTesting(child1.get(),
1682 identity_matrix, 1682 identity_matrix,
1683 gfx::PointF(), 1683 gfx::Point3F(),
1684 gfx::PointF(), 1684 gfx::PointF(),
1685 gfx::Size(100, 100), 1685 gfx::Size(100, 100),
1686 true, 1686 true,
1687 false); 1687 false);
1688 SetLayerPropertiesForTesting(child2.get(), 1688 SetLayerPropertiesForTesting(child2.get(),
1689 identity_matrix, 1689 identity_matrix,
1690 gfx::PointF(), 1690 gfx::Point3F(),
1691 gfx::PointF(), 1691 gfx::PointF(),
1692 gfx::Size(100, 100), 1692 gfx::Size(100, 100),
1693 true, 1693 true,
1694 false); 1694 false);
1695 SetLayerPropertiesForTesting(grand_child.get(), 1695 SetLayerPropertiesForTesting(grand_child.get(),
1696 identity_matrix, 1696 identity_matrix,
1697 gfx::PointF(), 1697 gfx::Point3F(),
1698 gfx::PointF(), 1698 gfx::PointF(),
1699 gfx::Size(100, 100), 1699 gfx::Size(100, 100),
1700 true, 1700 true,
1701 false); 1701 false);
1702 SetLayerPropertiesForTesting(leaf_node1.get(), 1702 SetLayerPropertiesForTesting(leaf_node1.get(),
1703 identity_matrix, 1703 identity_matrix,
1704 gfx::PointF(), 1704 gfx::Point3F(),
1705 gfx::PointF(), 1705 gfx::PointF(),
1706 gfx::Size(100, 100), 1706 gfx::Size(100, 100),
1707 true, 1707 true,
1708 false); 1708 false);
1709 SetLayerPropertiesForTesting(leaf_node2.get(), 1709 SetLayerPropertiesForTesting(leaf_node2.get(),
1710 identity_matrix, 1710 identity_matrix,
1711 gfx::PointF(), 1711 gfx::Point3F(),
1712 gfx::PointF(), 1712 gfx::PointF(),
1713 gfx::Size(100, 100), 1713 gfx::Size(100, 100),
1714 true, 1714 true,
1715 false); 1715 false);
1716 1716
1717 // Case 1: nothing is clipped except the root render surface. 1717 // Case 1: nothing is clipped except the root render surface.
1718 { 1718 {
1719 RenderSurfaceLayerList render_surface_layer_list; 1719 RenderSurfaceLayerList render_surface_layer_list;
1720 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( 1720 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs(
1721 root.get(), parent->bounds(), &render_surface_layer_list); 1721 root.get(), parent->bounds(), &render_surface_layer_list);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1815 child->AddChild(grand_child1); 1815 child->AddChild(grand_child1);
1816 child->AddChild(grand_child2); 1816 child->AddChild(grand_child2);
1817 child->AddChild(grand_child3); 1817 child->AddChild(grand_child3);
1818 child->AddChild(grand_child4); 1818 child->AddChild(grand_child4);
1819 1819
1820 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 1820 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
1821 host->SetRootLayer(parent); 1821 host->SetRootLayer(parent);
1822 1822
1823 SetLayerPropertiesForTesting(parent.get(), 1823 SetLayerPropertiesForTesting(parent.get(),
1824 identity_matrix, 1824 identity_matrix,
1825 gfx::PointF(), 1825 gfx::Point3F(),
1826 gfx::PointF(), 1826 gfx::PointF(),
1827 gfx::Size(500, 500), 1827 gfx::Size(500, 500),
1828 true, 1828 true,
1829 false); 1829 false);
1830 SetLayerPropertiesForTesting(child.get(), 1830 SetLayerPropertiesForTesting(child.get(),
1831 identity_matrix, 1831 identity_matrix,
1832 gfx::PointF(), 1832 gfx::Point3F(),
1833 gfx::PointF(), 1833 gfx::PointF(),
1834 gfx::Size(20, 20), 1834 gfx::Size(20, 20),
1835 true, 1835 true,
1836 false); 1836 false);
1837 SetLayerPropertiesForTesting(grand_child1.get(), 1837 SetLayerPropertiesForTesting(grand_child1.get(),
1838 identity_matrix, 1838 identity_matrix,
1839 gfx::PointF(), 1839 gfx::Point3F(),
1840 gfx::PointF(5.f, 5.f), 1840 gfx::PointF(5.f, 5.f),
1841 gfx::Size(10, 10), 1841 gfx::Size(10, 10),
1842 true, 1842 true,
1843 false); 1843 false);
1844 SetLayerPropertiesForTesting(grand_child2.get(), 1844 SetLayerPropertiesForTesting(grand_child2.get(),
1845 identity_matrix, 1845 identity_matrix,
1846 gfx::PointF(), 1846 gfx::Point3F(),
1847 gfx::PointF(15.f, 15.f), 1847 gfx::PointF(15.f, 15.f),
1848 gfx::Size(10, 10), 1848 gfx::Size(10, 10),
1849 true, 1849 true,
1850 false); 1850 false);
1851 SetLayerPropertiesForTesting(grand_child3.get(), 1851 SetLayerPropertiesForTesting(grand_child3.get(),
1852 identity_matrix, 1852 identity_matrix,
1853 gfx::PointF(), 1853 gfx::Point3F(),
1854 gfx::PointF(15.f, 15.f), 1854 gfx::PointF(15.f, 15.f),
1855 gfx::Size(10, 10), 1855 gfx::Size(10, 10),
1856 true, 1856 true,
1857 false); 1857 false);
1858 SetLayerPropertiesForTesting(grand_child4.get(), 1858 SetLayerPropertiesForTesting(grand_child4.get(),
1859 identity_matrix, 1859 identity_matrix,
1860 gfx::PointF(), 1860 gfx::Point3F(),
1861 gfx::PointF(45.f, 45.f), 1861 gfx::PointF(45.f, 45.f),
1862 gfx::Size(10, 10), 1862 gfx::Size(10, 10),
1863 true, 1863 true,
1864 false); 1864 false);
1865 1865
1866 child->SetMasksToBounds(true); 1866 child->SetMasksToBounds(true);
1867 grand_child3->SetMasksToBounds(true); 1867 grand_child3->SetMasksToBounds(true);
1868 1868
1869 // Force everyone to be a render surface. 1869 // Force everyone to be a render surface.
1870 child->SetOpacity(0.4f); 1870 child->SetOpacity(0.4f);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1923 1923
1924 // the leaf nodes ensure that these grand_children become render surfaces for 1924 // the leaf nodes ensure that these grand_children become render surfaces for
1925 // this test. 1925 // this test.
1926 grand_child1->AddChild(leaf_node1); 1926 grand_child1->AddChild(leaf_node1);
1927 grand_child2->AddChild(leaf_node2); 1927 grand_child2->AddChild(leaf_node2);
1928 grand_child3->AddChild(leaf_node3); 1928 grand_child3->AddChild(leaf_node3);
1929 grand_child4->AddChild(leaf_node4); 1929 grand_child4->AddChild(leaf_node4);
1930 1930
1931 SetLayerPropertiesForTesting(parent.get(), 1931 SetLayerPropertiesForTesting(parent.get(),
1932 identity_matrix, 1932 identity_matrix,
1933 gfx::PointF(), 1933 gfx::Point3F(),
1934 gfx::PointF(), 1934 gfx::PointF(),
1935 gfx::Size(500, 500), 1935 gfx::Size(500, 500),
1936 true, 1936 true,
1937 false); 1937 false);
1938 SetLayerPropertiesForTesting(child.get(), 1938 SetLayerPropertiesForTesting(child.get(),
1939 identity_matrix, 1939 identity_matrix,
1940 gfx::PointF(), 1940 gfx::Point3F(),
1941 gfx::PointF(), 1941 gfx::PointF(),
1942 gfx::Size(20, 20), 1942 gfx::Size(20, 20),
1943 true, 1943 true,
1944 false); 1944 false);
1945 SetLayerPropertiesForTesting(grand_child1.get(), 1945 SetLayerPropertiesForTesting(grand_child1.get(),
1946 identity_matrix, 1946 identity_matrix,
1947 gfx::PointF(), 1947 gfx::Point3F(),
1948 gfx::PointF(5.f, 5.f), 1948 gfx::PointF(5.f, 5.f),
1949 gfx::Size(10, 10), 1949 gfx::Size(10, 10),
1950 true, 1950 true,
1951 false); 1951 false);
1952 SetLayerPropertiesForTesting(grand_child2.get(), 1952 SetLayerPropertiesForTesting(grand_child2.get(),
1953 identity_matrix, 1953 identity_matrix,
1954 gfx::PointF(), 1954 gfx::Point3F(),
1955 gfx::PointF(15.f, 15.f), 1955 gfx::PointF(15.f, 15.f),
1956 gfx::Size(10, 10), 1956 gfx::Size(10, 10),
1957 true, 1957 true,
1958 false); 1958 false);
1959 SetLayerPropertiesForTesting(grand_child3.get(), 1959 SetLayerPropertiesForTesting(grand_child3.get(),
1960 identity_matrix, 1960 identity_matrix,
1961 gfx::PointF(), 1961 gfx::Point3F(),
1962 gfx::PointF(15.f, 15.f), 1962 gfx::PointF(15.f, 15.f),
1963 gfx::Size(10, 10), 1963 gfx::Size(10, 10),
1964 true, 1964 true,
1965 false); 1965 false);
1966 SetLayerPropertiesForTesting(grand_child4.get(), 1966 SetLayerPropertiesForTesting(grand_child4.get(),
1967 identity_matrix, 1967 identity_matrix,
1968 gfx::PointF(), 1968 gfx::Point3F(),
1969 gfx::PointF(45.f, 45.f), 1969 gfx::PointF(45.f, 45.f),
1970 gfx::Size(10, 10), 1970 gfx::Size(10, 10),
1971 true, 1971 true,
1972 false); 1972 false);
1973 SetLayerPropertiesForTesting(leaf_node1.get(), 1973 SetLayerPropertiesForTesting(leaf_node1.get(),
1974 identity_matrix, 1974 identity_matrix,
1975 gfx::PointF(), 1975 gfx::Point3F(),
1976 gfx::PointF(), 1976 gfx::PointF(),
1977 gfx::Size(10, 10), 1977 gfx::Size(10, 10),
1978 true, 1978 true,
1979 false); 1979 false);
1980 SetLayerPropertiesForTesting(leaf_node2.get(), 1980 SetLayerPropertiesForTesting(leaf_node2.get(),
1981 identity_matrix, 1981 identity_matrix,
1982 gfx::PointF(), 1982 gfx::Point3F(),
1983 gfx::PointF(), 1983 gfx::PointF(),
1984 gfx::Size(10, 10), 1984 gfx::Size(10, 10),
1985 true, 1985 true,
1986 false); 1986 false);
1987 SetLayerPropertiesForTesting(leaf_node3.get(), 1987 SetLayerPropertiesForTesting(leaf_node3.get(),
1988 identity_matrix, 1988 identity_matrix,
1989 gfx::PointF(), 1989 gfx::Point3F(),
1990 gfx::PointF(), 1990 gfx::PointF(),
1991 gfx::Size(10, 10), 1991 gfx::Size(10, 10),
1992 true, 1992 true,
1993 false); 1993 false);
1994 SetLayerPropertiesForTesting(leaf_node4.get(), 1994 SetLayerPropertiesForTesting(leaf_node4.get(),
1995 identity_matrix, 1995 identity_matrix,
1996 gfx::PointF(), 1996 gfx::Point3F(),
1997 gfx::PointF(), 1997 gfx::PointF(),
1998 gfx::Size(10, 10), 1998 gfx::Size(10, 10),
1999 true, 1999 true,
2000 false); 2000 false);
2001 2001
2002 child->SetMasksToBounds(true); 2002 child->SetMasksToBounds(true);
2003 grand_child3->SetMasksToBounds(true); 2003 grand_child3->SetMasksToBounds(true);
2004 grand_child4->SetMasksToBounds(true); 2004 grand_child4->SetMasksToBounds(true);
2005 2005
2006 // Force everyone to be a render surface. 2006 // Force everyone to be a render surface.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
2060 2060
2061 // Make our render surfaces. 2061 // Make our render surfaces.
2062 render_surface1->SetForceRenderSurface(true); 2062 render_surface1->SetForceRenderSurface(true);
2063 render_surface2->SetForceRenderSurface(true); 2063 render_surface2->SetForceRenderSurface(true);
2064 2064
2065 gfx::Transform layer_transform; 2065 gfx::Transform layer_transform;
2066 layer_transform.Translate(1.0, 1.0); 2066 layer_transform.Translate(1.0, 1.0);
2067 2067
2068 SetLayerPropertiesForTesting(parent.get(), 2068 SetLayerPropertiesForTesting(parent.get(),
2069 layer_transform, 2069 layer_transform,
2070 gfx::PointF(0.25f, 0.f), 2070 gfx::Point3F(0.25f, 0.f, 0.f),
2071 gfx::PointF(2.5f, 0.f), 2071 gfx::PointF(2.5f, 0.f),
2072 gfx::Size(10, 10), 2072 gfx::Size(10, 10),
2073 true, 2073 true,
2074 false); 2074 false);
2075 SetLayerPropertiesForTesting(render_surface1.get(), 2075 SetLayerPropertiesForTesting(render_surface1.get(),
2076 layer_transform, 2076 layer_transform,
2077 gfx::PointF(0.25f, 0.f), 2077 gfx::Point3F(0.25f, 0.f, 0.f),
2078 gfx::PointF(2.5f, 0.f), 2078 gfx::PointF(2.5f, 0.f),
2079 gfx::Size(10, 10), 2079 gfx::Size(10, 10),
2080 true, 2080 true,
2081 false); 2081 false);
2082 SetLayerPropertiesForTesting(render_surface2.get(), 2082 SetLayerPropertiesForTesting(render_surface2.get(),
2083 layer_transform, 2083 layer_transform,
2084 gfx::PointF(0.25f, 0.f), 2084 gfx::Point3F(0.25f, 0.f, 0.f),
2085 gfx::PointF(2.5f, 0.f), 2085 gfx::PointF(2.5f, 0.f),
2086 gfx::Size(10, 10), 2086 gfx::Size(10, 10),
2087 true, 2087 true,
2088 false); 2088 false);
2089 SetLayerPropertiesForTesting(child_of_root.get(), 2089 SetLayerPropertiesForTesting(child_of_root.get(),
2090 layer_transform, 2090 layer_transform,
2091 gfx::PointF(0.25f, 0.f), 2091 gfx::Point3F(0.25f, 0.f, 0.f),
2092 gfx::PointF(2.5f, 0.f), 2092 gfx::PointF(2.5f, 0.f),
2093 gfx::Size(10, 10), 2093 gfx::Size(10, 10),
2094 true, 2094 true,
2095 false); 2095 false);
2096 SetLayerPropertiesForTesting(child_of_rs1.get(), 2096 SetLayerPropertiesForTesting(child_of_rs1.get(),
2097 layer_transform, 2097 layer_transform,
2098 gfx::PointF(0.25f, 0.f), 2098 gfx::Point3F(0.25f, 0.f, 0.f),
2099 gfx::PointF(2.5f, 0.f), 2099 gfx::PointF(2.5f, 0.f),
2100 gfx::Size(10, 10), 2100 gfx::Size(10, 10),
2101 true, 2101 true,
2102 false); 2102 false);
2103 SetLayerPropertiesForTesting(child_of_rs2.get(), 2103 SetLayerPropertiesForTesting(child_of_rs2.get(),
2104 layer_transform, 2104 layer_transform,
2105 gfx::PointF(0.25f, 0.f), 2105 gfx::Point3F(0.25f, 0.f, 0.f),
2106 gfx::PointF(2.5f, 0.f), 2106 gfx::PointF(2.5f, 0.f),
2107 gfx::Size(10, 10), 2107 gfx::Size(10, 10),
2108 true, 2108 true,
2109 false); 2109 false);
2110 SetLayerPropertiesForTesting(grand_child_of_root.get(), 2110 SetLayerPropertiesForTesting(grand_child_of_root.get(),
2111 layer_transform, 2111 layer_transform,
2112 gfx::PointF(0.25f, 0.f), 2112 gfx::Point3F(0.25f, 0.f, 0.f),
2113 gfx::PointF(2.5f, 0.f), 2113 gfx::PointF(2.5f, 0.f),
2114 gfx::Size(10, 10), 2114 gfx::Size(10, 10),
2115 true, 2115 true,
2116 false); 2116 false);
2117 SetLayerPropertiesForTesting(grand_child_of_rs1.get(), 2117 SetLayerPropertiesForTesting(grand_child_of_rs1.get(),
2118 layer_transform, 2118 layer_transform,
2119 gfx::PointF(0.25f, 0.f), 2119 gfx::Point3F(0.25f, 0.f, 0.f),
2120 gfx::PointF(2.5f, 0.f), 2120 gfx::PointF(2.5f, 0.f),
2121 gfx::Size(10, 10), 2121 gfx::Size(10, 10),
2122 true, 2122 true,
2123 false); 2123 false);
2124 SetLayerPropertiesForTesting(grand_child_of_rs2.get(), 2124 SetLayerPropertiesForTesting(grand_child_of_rs2.get(),
2125 layer_transform, 2125 layer_transform,
2126 gfx::PointF(0.25f, 0.f), 2126 gfx::Point3F(0.25f, 0.f, 0.f),
2127 gfx::PointF(2.5f, 0.f), 2127 gfx::PointF(2.5f, 0.f),
2128 gfx::Size(10, 10), 2128 gfx::Size(10, 10),
2129 true, 2129 true,
2130 false); 2130 false);
2131 2131
2132 // Put an animated opacity on the render surface. 2132 // Put an animated opacity on the render surface.
2133 AddOpacityTransitionToController( 2133 AddOpacityTransitionToController(
2134 render_surface1->layer_animation_controller(), 10.0, 1.f, 0.f, false); 2134 render_surface1->layer_animation_controller(), 10.0, 1.f, 0.f, false);
2135 2135
2136 // Also put an animated opacity on a layer without descendants. 2136 // Also put an animated opacity on a layer without descendants.
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
2542 root->AddChild(child1); 2542 root->AddChild(child1);
2543 root->AddChild(child2); 2543 root->AddChild(child2);
2544 root->AddChild(child3); 2544 root->AddChild(child3);
2545 2545
2546 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 2546 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
2547 host->SetRootLayer(root); 2547 host->SetRootLayer(root);
2548 2548
2549 gfx::Transform identity_matrix; 2549 gfx::Transform identity_matrix;
2550 SetLayerPropertiesForTesting(root.get(), 2550 SetLayerPropertiesForTesting(root.get(),
2551 identity_matrix, 2551 identity_matrix,
2552 gfx::PointF(), 2552 gfx::Point3F(),
2553 gfx::PointF(), 2553 gfx::PointF(),
2554 gfx::Size(100, 100), 2554 gfx::Size(100, 100),
2555 true, 2555 true,
2556 false); 2556 false);
2557 SetLayerPropertiesForTesting(child1.get(), 2557 SetLayerPropertiesForTesting(child1.get(),
2558 identity_matrix, 2558 identity_matrix,
2559 gfx::PointF(), 2559 gfx::Point3F(),
2560 gfx::PointF(), 2560 gfx::PointF(),
2561 gfx::Size(50, 50), 2561 gfx::Size(50, 50),
2562 true, 2562 true,
2563 false); 2563 false);
2564 SetLayerPropertiesForTesting(child2.get(), 2564 SetLayerPropertiesForTesting(child2.get(),
2565 identity_matrix, 2565 identity_matrix,
2566 gfx::PointF(), 2566 gfx::Point3F(),
2567 gfx::PointF(75.f, 75.f), 2567 gfx::PointF(75.f, 75.f),
2568 gfx::Size(50, 50), 2568 gfx::Size(50, 50),
2569 true, 2569 true,
2570 false); 2570 false);
2571 SetLayerPropertiesForTesting(child3.get(), 2571 SetLayerPropertiesForTesting(child3.get(),
2572 identity_matrix, 2572 identity_matrix,
2573 gfx::PointF(), 2573 gfx::Point3F(),
2574 gfx::PointF(125.f, 125.f), 2574 gfx::PointF(125.f, 125.f),
2575 gfx::Size(50, 50), 2575 gfx::Size(50, 50),
2576 true, 2576 true,
2577 false); 2577 false);
2578 2578
2579 ExecuteCalculateDrawProperties(root.get()); 2579 ExecuteCalculateDrawProperties(root.get());
2580 2580
2581 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), 2581 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100),
2582 root->render_surface()->DrawableContentRect()); 2582 root->render_surface()->DrawableContentRect());
2583 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->drawable_content_rect()); 2583 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->drawable_content_rect());
(...skipping 26 matching lines...) Expand all
2610 child->AddChild(grand_child1); 2610 child->AddChild(grand_child1);
2611 child->AddChild(grand_child2); 2611 child->AddChild(grand_child2);
2612 child->AddChild(grand_child3); 2612 child->AddChild(grand_child3);
2613 2613
2614 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 2614 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
2615 host->SetRootLayer(root); 2615 host->SetRootLayer(root);
2616 2616
2617 gfx::Transform identity_matrix; 2617 gfx::Transform identity_matrix;
2618 SetLayerPropertiesForTesting(root.get(), 2618 SetLayerPropertiesForTesting(root.get(),
2619 identity_matrix, 2619 identity_matrix,
2620 gfx::PointF(), 2620 gfx::Point3F(),
2621 gfx::PointF(), 2621 gfx::PointF(),
2622 gfx::Size(100, 100), 2622 gfx::Size(100, 100),
2623 true, 2623 true,
2624 false); 2624 false);
2625 SetLayerPropertiesForTesting(child.get(), 2625 SetLayerPropertiesForTesting(child.get(),
2626 identity_matrix, 2626 identity_matrix,
2627 gfx::PointF(), 2627 gfx::Point3F(),
2628 gfx::PointF(), 2628 gfx::PointF(),
2629 gfx::Size(100, 100), 2629 gfx::Size(100, 100),
2630 true, 2630 true,
2631 false); 2631 false);
2632 SetLayerPropertiesForTesting(grand_child1.get(), 2632 SetLayerPropertiesForTesting(grand_child1.get(),
2633 identity_matrix, 2633 identity_matrix,
2634 gfx::PointF(), 2634 gfx::Point3F(),
2635 gfx::PointF(5.f, 5.f), 2635 gfx::PointF(5.f, 5.f),
2636 gfx::Size(50, 50), 2636 gfx::Size(50, 50),
2637 true, 2637 true,
2638 false); 2638 false);
2639 SetLayerPropertiesForTesting(grand_child2.get(), 2639 SetLayerPropertiesForTesting(grand_child2.get(),
2640 identity_matrix, 2640 identity_matrix,
2641 gfx::PointF(), 2641 gfx::Point3F(),
2642 gfx::PointF(75.f, 75.f), 2642 gfx::PointF(75.f, 75.f),
2643 gfx::Size(50, 50), 2643 gfx::Size(50, 50),
2644 true, 2644 true,
2645 false); 2645 false);
2646 SetLayerPropertiesForTesting(grand_child3.get(), 2646 SetLayerPropertiesForTesting(grand_child3.get(),
2647 identity_matrix, 2647 identity_matrix,
2648 gfx::PointF(), 2648 gfx::Point3F(),
2649 gfx::PointF(125.f, 125.f), 2649 gfx::PointF(125.f, 125.f),
2650 gfx::Size(50, 50), 2650 gfx::Size(50, 50),
2651 true, 2651 true,
2652 false); 2652 false);
2653 2653
2654 child->SetMasksToBounds(true); 2654 child->SetMasksToBounds(true);
2655 ExecuteCalculateDrawProperties(root.get()); 2655 ExecuteCalculateDrawProperties(root.get());
2656 2656
2657 ASSERT_FALSE(child->render_surface()); 2657 ASSERT_FALSE(child->render_surface());
2658 2658
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2691 render_surface1->AddChild(child1); 2691 render_surface1->AddChild(child1);
2692 render_surface1->AddChild(child2); 2692 render_surface1->AddChild(child2);
2693 render_surface1->AddChild(child3); 2693 render_surface1->AddChild(child3);
2694 2694
2695 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 2695 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
2696 host->SetRootLayer(root); 2696 host->SetRootLayer(root);
2697 2697
2698 gfx::Transform identity_matrix; 2698 gfx::Transform identity_matrix;
2699 SetLayerPropertiesForTesting(root.get(), 2699 SetLayerPropertiesForTesting(root.get(),
2700 identity_matrix, 2700 identity_matrix,
2701 gfx::PointF(), 2701 gfx::Point3F(),
2702 gfx::PointF(), 2702 gfx::PointF(),
2703 gfx::Size(100, 100), 2703 gfx::Size(100, 100),
2704 true, 2704 true,
2705 false); 2705 false);
2706 SetLayerPropertiesForTesting(render_surface1.get(), 2706 SetLayerPropertiesForTesting(render_surface1.get(),
2707 identity_matrix, 2707 identity_matrix,
2708 gfx::PointF(), 2708 gfx::Point3F(),
2709 gfx::PointF(), 2709 gfx::PointF(),
2710 gfx::Size(3, 4), 2710 gfx::Size(3, 4),
2711 true, 2711 true,
2712 false); 2712 false);
2713 SetLayerPropertiesForTesting(child1.get(), 2713 SetLayerPropertiesForTesting(child1.get(),
2714 identity_matrix, 2714 identity_matrix,
2715 gfx::PointF(), 2715 gfx::Point3F(),
2716 gfx::PointF(5.f, 5.f), 2716 gfx::PointF(5.f, 5.f),
2717 gfx::Size(50, 50), 2717 gfx::Size(50, 50),
2718 true, 2718 true,
2719 false); 2719 false);
2720 SetLayerPropertiesForTesting(child2.get(), 2720 SetLayerPropertiesForTesting(child2.get(),
2721 identity_matrix, 2721 identity_matrix,
2722 gfx::PointF(), 2722 gfx::Point3F(),
2723 gfx::PointF(75.f, 75.f), 2723 gfx::PointF(75.f, 75.f),
2724 gfx::Size(50, 50), 2724 gfx::Size(50, 50),
2725 true, 2725 true,
2726 false); 2726 false);
2727 SetLayerPropertiesForTesting(child3.get(), 2727 SetLayerPropertiesForTesting(child3.get(),
2728 identity_matrix, 2728 identity_matrix,
2729 gfx::PointF(), 2729 gfx::Point3F(),
2730 gfx::PointF(125.f, 125.f), 2730 gfx::PointF(125.f, 125.f),
2731 gfx::Size(50, 50), 2731 gfx::Size(50, 50),
2732 true, 2732 true,
2733 false); 2733 false);
2734 2734
2735 render_surface1->SetForceRenderSurface(true); 2735 render_surface1->SetForceRenderSurface(true);
2736 ExecuteCalculateDrawProperties(root.get()); 2736 ExecuteCalculateDrawProperties(root.get());
2737 2737
2738 ASSERT_TRUE(render_surface1->render_surface()); 2738 ASSERT_TRUE(render_surface1->render_surface());
2739 2739
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2771 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 2771 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
2772 host->SetRootLayer(root); 2772 host->SetRootLayer(root);
2773 2773
2774 // Case 1: a truly degenerate matrix 2774 // Case 1: a truly degenerate matrix
2775 gfx::Transform identity_matrix; 2775 gfx::Transform identity_matrix;
2776 gfx::Transform uninvertible_matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); 2776 gfx::Transform uninvertible_matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
2777 ASSERT_FALSE(uninvertible_matrix.IsInvertible()); 2777 ASSERT_FALSE(uninvertible_matrix.IsInvertible());
2778 2778
2779 SetLayerPropertiesForTesting(root.get(), 2779 SetLayerPropertiesForTesting(root.get(),
2780 identity_matrix, 2780 identity_matrix,
2781 gfx::PointF(), 2781 gfx::Point3F(),
2782 gfx::PointF(), 2782 gfx::PointF(),
2783 gfx::Size(100, 100), 2783 gfx::Size(100, 100),
2784 true, 2784 true,
2785 false); 2785 false);
2786 SetLayerPropertiesForTesting(child.get(), 2786 SetLayerPropertiesForTesting(child.get(),
2787 uninvertible_matrix, 2787 uninvertible_matrix,
2788 gfx::PointF(), 2788 gfx::Point3F(),
2789 gfx::PointF(5.f, 5.f), 2789 gfx::PointF(5.f, 5.f),
2790 gfx::Size(50, 50), 2790 gfx::Size(50, 50),
2791 true, 2791 true,
2792 false); 2792 false);
2793 2793
2794 ExecuteCalculateDrawProperties(root.get()); 2794 ExecuteCalculateDrawProperties(root.get());
2795 2795
2796 EXPECT_TRUE(child->visible_content_rect().IsEmpty()); 2796 EXPECT_TRUE(child->visible_content_rect().IsEmpty());
2797 EXPECT_TRUE(child->drawable_content_rect().IsEmpty()); 2797 EXPECT_TRUE(child->drawable_content_rect().IsEmpty());
2798 2798
2799 // Case 2: a matrix with flattened z, uninvertible and not visible according 2799 // Case 2: a matrix with flattened z, uninvertible and not visible according
2800 // to the CSS spec. 2800 // to the CSS spec.
2801 uninvertible_matrix.MakeIdentity(); 2801 uninvertible_matrix.MakeIdentity();
2802 uninvertible_matrix.matrix().set(2, 2, 0.0); 2802 uninvertible_matrix.matrix().set(2, 2, 0.0);
2803 ASSERT_FALSE(uninvertible_matrix.IsInvertible()); 2803 ASSERT_FALSE(uninvertible_matrix.IsInvertible());
2804 2804
2805 SetLayerPropertiesForTesting(child.get(), 2805 SetLayerPropertiesForTesting(child.get(),
2806 uninvertible_matrix, 2806 uninvertible_matrix,
2807 gfx::PointF(), 2807 gfx::Point3F(),
2808 gfx::PointF(5.f, 5.f), 2808 gfx::PointF(5.f, 5.f),
2809 gfx::Size(50, 50), 2809 gfx::Size(50, 50),
2810 true, 2810 true,
2811 false); 2811 false);
2812 2812
2813 ExecuteCalculateDrawProperties(root.get()); 2813 ExecuteCalculateDrawProperties(root.get());
2814 2814
2815 EXPECT_TRUE(child->visible_content_rect().IsEmpty()); 2815 EXPECT_TRUE(child->visible_content_rect().IsEmpty());
2816 EXPECT_TRUE(child->drawable_content_rect().IsEmpty()); 2816 EXPECT_TRUE(child->drawable_content_rect().IsEmpty());
2817 2817
2818 // Case 3: a matrix with flattened z, also uninvertible and not visible. 2818 // Case 3: a matrix with flattened z, also uninvertible and not visible.
2819 uninvertible_matrix.MakeIdentity(); 2819 uninvertible_matrix.MakeIdentity();
2820 uninvertible_matrix.Translate(500.0, 0.0); 2820 uninvertible_matrix.Translate(500.0, 0.0);
2821 uninvertible_matrix.matrix().set(2, 2, 0.0); 2821 uninvertible_matrix.matrix().set(2, 2, 0.0);
2822 ASSERT_FALSE(uninvertible_matrix.IsInvertible()); 2822 ASSERT_FALSE(uninvertible_matrix.IsInvertible());
2823 2823
2824 SetLayerPropertiesForTesting(child.get(), 2824 SetLayerPropertiesForTesting(child.get(),
2825 uninvertible_matrix, 2825 uninvertible_matrix,
2826 gfx::PointF(), 2826 gfx::Point3F(),
2827 gfx::PointF(5.f, 5.f), 2827 gfx::PointF(5.f, 5.f),
2828 gfx::Size(50, 50), 2828 gfx::Size(50, 50),
2829 true, 2829 true,
2830 false); 2830 false);
2831 2831
2832 ExecuteCalculateDrawProperties(root.get()); 2832 ExecuteCalculateDrawProperties(root.get());
2833 2833
2834 EXPECT_TRUE(child->visible_content_rect().IsEmpty()); 2834 EXPECT_TRUE(child->visible_content_rect().IsEmpty());
2835 EXPECT_TRUE(child->drawable_content_rect().IsEmpty()); 2835 EXPECT_TRUE(child->drawable_content_rect().IsEmpty());
2836 } 2836 }
2837 2837
2838 TEST_F(LayerTreeHostCommonTest, 2838 TEST_F(LayerTreeHostCommonTest,
2839 SingularTransformDoesNotPreventClearingDrawProperties) { 2839 SingularTransformDoesNotPreventClearingDrawProperties) {
2840 scoped_refptr<Layer> root = Layer::Create(); 2840 scoped_refptr<Layer> root = Layer::Create();
2841 scoped_refptr<LayerWithForcedDrawsContent> child = 2841 scoped_refptr<LayerWithForcedDrawsContent> child =
2842 make_scoped_refptr(new LayerWithForcedDrawsContent()); 2842 make_scoped_refptr(new LayerWithForcedDrawsContent());
2843 root->AddChild(child); 2843 root->AddChild(child);
2844 2844
2845 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 2845 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
2846 host->SetRootLayer(root); 2846 host->SetRootLayer(root);
2847 2847
2848 gfx::Transform identity_matrix; 2848 gfx::Transform identity_matrix;
2849 gfx::Transform uninvertible_matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); 2849 gfx::Transform uninvertible_matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
2850 ASSERT_FALSE(uninvertible_matrix.IsInvertible()); 2850 ASSERT_FALSE(uninvertible_matrix.IsInvertible());
2851 2851
2852 SetLayerPropertiesForTesting(root.get(), 2852 SetLayerPropertiesForTesting(root.get(),
2853 uninvertible_matrix, 2853 uninvertible_matrix,
2854 gfx::PointF(), 2854 gfx::Point3F(),
2855 gfx::PointF(), 2855 gfx::PointF(),
2856 gfx::Size(100, 100), 2856 gfx::Size(100, 100),
2857 true, 2857 true,
2858 false); 2858 false);
2859 SetLayerPropertiesForTesting(child.get(), 2859 SetLayerPropertiesForTesting(child.get(),
2860 identity_matrix, 2860 identity_matrix,
2861 gfx::PointF(), 2861 gfx::Point3F(),
2862 gfx::PointF(5.f, 5.f), 2862 gfx::PointF(5.f, 5.f),
2863 gfx::Size(50, 50), 2863 gfx::Size(50, 50),
2864 true, 2864 true,
2865 false); 2865 false);
2866 2866
2867 child->draw_properties().sorted_for_recursion = true; 2867 child->draw_properties().sorted_for_recursion = true;
2868 2868
2869 TransformOperations start_transform_operations; 2869 TransformOperations start_transform_operations;
2870 start_transform_operations.AppendScale(1.f, 0.f, 0.f); 2870 start_transform_operations.AppendScale(1.f, 0.f, 0.f);
2871 2871
(...skipping 16 matching lines...) Expand all
2888 2888
2889 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 2889 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
2890 host->SetRootLayer(root); 2890 host->SetRootLayer(root);
2891 2891
2892 gfx::Transform identity_matrix; 2892 gfx::Transform identity_matrix;
2893 gfx::Transform uninvertible_matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); 2893 gfx::Transform uninvertible_matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
2894 ASSERT_FALSE(uninvertible_matrix.IsInvertible()); 2894 ASSERT_FALSE(uninvertible_matrix.IsInvertible());
2895 2895
2896 SetLayerPropertiesForTesting(root.get(), 2896 SetLayerPropertiesForTesting(root.get(),
2897 uninvertible_matrix, 2897 uninvertible_matrix,
2898 gfx::PointF(), 2898 gfx::Point3F(),
2899 gfx::PointF(), 2899 gfx::PointF(),
2900 gfx::Size(100, 100), 2900 gfx::Size(100, 100),
2901 true, 2901 true,
2902 false); 2902 false);
2903 2903
2904 root->draw_properties().sorted_for_recursion = true; 2904 root->draw_properties().sorted_for_recursion = true;
2905 2905
2906 EXPECT_FALSE(root->TransformIsAnimating()); 2906 EXPECT_FALSE(root->TransformIsAnimating());
2907 2907
2908 ExecuteCalculateDrawProperties(root.get()); 2908 ExecuteCalculateDrawProperties(root.get());
(...skipping 15 matching lines...) Expand all
2924 render_surface1->AddChild(child1); 2924 render_surface1->AddChild(child1);
2925 render_surface1->AddChild(child2); 2925 render_surface1->AddChild(child2);
2926 render_surface1->AddChild(child3); 2926 render_surface1->AddChild(child3);
2927 2927
2928 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 2928 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
2929 host->SetRootLayer(root); 2929 host->SetRootLayer(root);
2930 2930
2931 gfx::Transform identity_matrix; 2931 gfx::Transform identity_matrix;
2932 SetLayerPropertiesForTesting(root.get(), 2932 SetLayerPropertiesForTesting(root.get(),
2933 identity_matrix, 2933 identity_matrix,
2934 gfx::PointF(), 2934 gfx::Point3F(),
2935 gfx::PointF(), 2935 gfx::PointF(),
2936 gfx::Size(100, 100), 2936 gfx::Size(100, 100),
2937 true, 2937 true,
2938 false); 2938 false);
2939 SetLayerPropertiesForTesting(render_surface1.get(), 2939 SetLayerPropertiesForTesting(render_surface1.get(),
2940 identity_matrix, 2940 identity_matrix,
2941 gfx::PointF(), 2941 gfx::Point3F(),
2942 gfx::PointF(), 2942 gfx::PointF(),
2943 gfx::Size(3, 4), 2943 gfx::Size(3, 4),
2944 true, 2944 true,
2945 false); 2945 false);
2946 SetLayerPropertiesForTesting(child1.get(), 2946 SetLayerPropertiesForTesting(child1.get(),
2947 identity_matrix, 2947 identity_matrix,
2948 gfx::PointF(), 2948 gfx::Point3F(),
2949 gfx::PointF(5.f, 5.f), 2949 gfx::PointF(5.f, 5.f),
2950 gfx::Size(50, 50), 2950 gfx::Size(50, 50),
2951 true, 2951 true,
2952 false); 2952 false);
2953 SetLayerPropertiesForTesting(child2.get(), 2953 SetLayerPropertiesForTesting(child2.get(),
2954 identity_matrix, 2954 identity_matrix,
2955 gfx::PointF(), 2955 gfx::Point3F(),
2956 gfx::PointF(75.f, 75.f), 2956 gfx::PointF(75.f, 75.f),
2957 gfx::Size(50, 50), 2957 gfx::Size(50, 50),
2958 true, 2958 true,
2959 false); 2959 false);
2960 SetLayerPropertiesForTesting(child3.get(), 2960 SetLayerPropertiesForTesting(child3.get(),
2961 identity_matrix, 2961 identity_matrix,
2962 gfx::PointF(), 2962 gfx::Point3F(),
2963 gfx::PointF(125.f, 125.f), 2963 gfx::PointF(125.f, 125.f),
2964 gfx::Size(50, 50), 2964 gfx::Size(50, 50),
2965 true, 2965 true,
2966 false); 2966 false);
2967 2967
2968 root->SetMasksToBounds(true); 2968 root->SetMasksToBounds(true);
2969 render_surface1->SetForceRenderSurface(true); 2969 render_surface1->SetForceRenderSurface(true);
2970 ExecuteCalculateDrawProperties(root.get()); 2970 ExecuteCalculateDrawProperties(root.get());
2971 2971
2972 ASSERT_TRUE(render_surface1->render_surface()); 2972 ASSERT_TRUE(render_surface1->render_surface());
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
3014 render_surface2->AddChild(child1); 3014 render_surface2->AddChild(child1);
3015 render_surface2->AddChild(child2); 3015 render_surface2->AddChild(child2);
3016 render_surface2->AddChild(child3); 3016 render_surface2->AddChild(child3);
3017 3017
3018 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 3018 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
3019 host->SetRootLayer(root); 3019 host->SetRootLayer(root);
3020 3020
3021 gfx::Transform identity_matrix; 3021 gfx::Transform identity_matrix;
3022 SetLayerPropertiesForTesting(root.get(), 3022 SetLayerPropertiesForTesting(root.get(),
3023 identity_matrix, 3023 identity_matrix,
3024 gfx::PointF(), 3024 gfx::Point3F(),
3025 gfx::PointF(), 3025 gfx::PointF(),
3026 gfx::Size(100, 100), 3026 gfx::Size(100, 100),
3027 true, 3027 true,
3028 false); 3028 false);
3029 SetLayerPropertiesForTesting(render_surface1.get(), 3029 SetLayerPropertiesForTesting(render_surface1.get(),
3030 identity_matrix, 3030 identity_matrix,
3031 gfx::PointF(), 3031 gfx::Point3F(),
3032 gfx::PointF(), 3032 gfx::PointF(),
3033 gfx::Size(3, 4), 3033 gfx::Size(3, 4),
3034 true, 3034 true,
3035 false); 3035 false);
3036 SetLayerPropertiesForTesting(render_surface2.get(), 3036 SetLayerPropertiesForTesting(render_surface2.get(),
3037 identity_matrix, 3037 identity_matrix,
3038 gfx::PointF(), 3038 gfx::Point3F(),
3039 gfx::PointF(), 3039 gfx::PointF(),
3040 gfx::Size(7, 13), 3040 gfx::Size(7, 13),
3041 true, 3041 true,
3042 false); 3042 false);
3043 SetLayerPropertiesForTesting(child1.get(), 3043 SetLayerPropertiesForTesting(child1.get(),
3044 identity_matrix, 3044 identity_matrix,
3045 gfx::PointF(), 3045 gfx::Point3F(),
3046 gfx::PointF(5.f, 5.f), 3046 gfx::PointF(5.f, 5.f),
3047 gfx::Size(50, 50), 3047 gfx::Size(50, 50),
3048 true, 3048 true,
3049 false); 3049 false);
3050 SetLayerPropertiesForTesting(child2.get(), 3050 SetLayerPropertiesForTesting(child2.get(),
3051 identity_matrix, 3051 identity_matrix,
3052 gfx::PointF(), 3052 gfx::Point3F(),
3053 gfx::PointF(75.f, 75.f), 3053 gfx::PointF(75.f, 75.f),
3054 gfx::Size(50, 50), 3054 gfx::Size(50, 50),
3055 true, 3055 true,
3056 false); 3056 false);
3057 SetLayerPropertiesForTesting(child3.get(), 3057 SetLayerPropertiesForTesting(child3.get(),
3058 identity_matrix, 3058 identity_matrix,
3059 gfx::PointF(), 3059 gfx::Point3F(),
3060 gfx::PointF(125.f, 125.f), 3060 gfx::PointF(125.f, 125.f),
3061 gfx::Size(50, 50), 3061 gfx::Size(50, 50),
3062 true, 3062 true,
3063 false); 3063 false);
3064 3064
3065 root->SetMasksToBounds(true); 3065 root->SetMasksToBounds(true);
3066 render_surface1->SetForceRenderSurface(true); 3066 render_surface1->SetForceRenderSurface(true);
3067 render_surface2->SetForceRenderSurface(true); 3067 render_surface2->SetForceRenderSurface(true);
3068 ExecuteCalculateDrawProperties(root.get()); 3068 ExecuteCalculateDrawProperties(root.get());
3069 3069
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
3116 render_surface1->AddChild(child1); 3116 render_surface1->AddChild(child1);
3117 3117
3118 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 3118 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
3119 host->SetRootLayer(root); 3119 host->SetRootLayer(root);
3120 3120
3121 gfx::Transform identity_matrix; 3121 gfx::Transform identity_matrix;
3122 gfx::Transform child_rotation; 3122 gfx::Transform child_rotation;
3123 child_rotation.Rotate(45.0); 3123 child_rotation.Rotate(45.0);
3124 SetLayerPropertiesForTesting(root.get(), 3124 SetLayerPropertiesForTesting(root.get(),
3125 identity_matrix, 3125 identity_matrix,
3126 gfx::PointF(), 3126 gfx::Point3F(),
3127 gfx::PointF(), 3127 gfx::PointF(),
3128 gfx::Size(100, 100), 3128 gfx::Size(100, 100),
3129 true, 3129 true,
3130 false); 3130 false);
3131 SetLayerPropertiesForTesting(render_surface1.get(), 3131 SetLayerPropertiesForTesting(render_surface1.get(),
3132 identity_matrix, 3132 identity_matrix,
3133 gfx::PointF(), 3133 gfx::Point3F(),
3134 gfx::PointF(), 3134 gfx::PointF(),
3135 gfx::Size(3, 4), 3135 gfx::Size(3, 4),
3136 true, 3136 true,
3137 false); 3137 false);
3138 SetLayerPropertiesForTesting(child1.get(), 3138 SetLayerPropertiesForTesting(child1.get(),
3139 child_rotation, 3139 child_rotation,
3140 gfx::PointF(0.5f, 0.5f), 3140 gfx::Point3F(25, 25, 0.f),
3141 gfx::PointF(25.f, 25.f), 3141 gfx::PointF(25.f, 25.f),
3142 gfx::Size(50, 50), 3142 gfx::Size(50, 50),
3143 true, 3143 true,
3144 false); 3144 false);
3145 3145
3146 render_surface1->SetForceRenderSurface(true); 3146 render_surface1->SetForceRenderSurface(true);
3147 ExecuteCalculateDrawProperties(root.get()); 3147 ExecuteCalculateDrawProperties(root.get());
3148 3148
3149 ASSERT_TRUE(render_surface1->render_surface()); 3149 ASSERT_TRUE(render_surface1->render_surface());
3150 3150
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
3187 render_surface1->AddChild(child1); 3187 render_surface1->AddChild(child1);
3188 3188
3189 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 3189 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
3190 host->SetRootLayer(root); 3190 host->SetRootLayer(root);
3191 3191
3192 gfx::Transform identity_matrix; 3192 gfx::Transform identity_matrix;
3193 gfx::Transform child_rotation; 3193 gfx::Transform child_rotation;
3194 child_rotation.Rotate(45.0); 3194 child_rotation.Rotate(45.0);
3195 SetLayerPropertiesForTesting(root.get(), 3195 SetLayerPropertiesForTesting(root.get(),
3196 identity_matrix, 3196 identity_matrix,
3197 gfx::PointF(), 3197 gfx::Point3F(),
3198 gfx::PointF(), 3198 gfx::PointF(),
3199 gfx::Size(50, 50), 3199 gfx::Size(50, 50),
3200 true, 3200 true,
3201 false); 3201 false);
3202 SetLayerPropertiesForTesting(render_surface1.get(), 3202 SetLayerPropertiesForTesting(render_surface1.get(),
3203 identity_matrix, 3203 identity_matrix,
3204 gfx::PointF(), 3204 gfx::Point3F(),
3205 gfx::PointF(), 3205 gfx::PointF(),
3206 gfx::Size(3, 4), 3206 gfx::Size(3, 4),
3207 true, 3207 true,
3208 false); 3208 false);
3209
3209 SetLayerPropertiesForTesting(child1.get(), 3210 SetLayerPropertiesForTesting(child1.get(),
3210 child_rotation, 3211 child_rotation,
3211 gfx::PointF(0.5f, 0.5f), 3212 gfx::Point3F(25, 25, 0.f),
3212 gfx::PointF(25.f, 25.f), 3213 gfx::PointF(25.f, 25.f),
3213 gfx::Size(50, 50), 3214 gfx::Size(50, 50),
3214 true, 3215 true,
3215 false); 3216 false);
3216 3217
3217 root->SetMasksToBounds(true); 3218 root->SetMasksToBounds(true);
3218 render_surface1->SetForceRenderSurface(true); 3219 render_surface1->SetForceRenderSurface(true);
3219 ExecuteCalculateDrawProperties(root.get()); 3220 ExecuteCalculateDrawProperties(root.get());
3220 3221
3221 ASSERT_TRUE(render_surface1->render_surface()); 3222 ASSERT_TRUE(render_surface1->render_surface());
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
3259 render_surface2->AddChild(child1); 3260 render_surface2->AddChild(child1);
3260 render_surface2->AddChild(child2); 3261 render_surface2->AddChild(child2);
3261 render_surface2->AddChild(child3); 3262 render_surface2->AddChild(child3);
3262 3263
3263 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 3264 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
3264 host->SetRootLayer(root); 3265 host->SetRootLayer(root);
3265 3266
3266 gfx::Transform identity_matrix; 3267 gfx::Transform identity_matrix;
3267 SetLayerPropertiesForTesting(root.get(), 3268 SetLayerPropertiesForTesting(root.get(),
3268 identity_matrix, 3269 identity_matrix,
3269 gfx::PointF(), 3270 gfx::Point3F(),
3270 gfx::PointF(), 3271 gfx::PointF(),
3271 gfx::Size(100, 100), 3272 gfx::Size(100, 100),
3272 true, 3273 true,
3273 false); 3274 false);
3274 SetLayerPropertiesForTesting(render_surface1.get(), 3275 SetLayerPropertiesForTesting(render_surface1.get(),
3275 identity_matrix, 3276 identity_matrix,
3276 gfx::PointF(), 3277 gfx::Point3F(),
3277 gfx::PointF(5.f, 5.f), 3278 gfx::PointF(5.f, 5.f),
3278 gfx::Size(3, 4), 3279 gfx::Size(3, 4),
3279 true, 3280 true,
3280 false); 3281 false);
3281 SetLayerPropertiesForTesting(render_surface2.get(), 3282 SetLayerPropertiesForTesting(render_surface2.get(),
3282 identity_matrix, 3283 identity_matrix,
3283 gfx::PointF(), 3284 gfx::Point3F(),
3284 gfx::PointF(5.f, 5.f), 3285 gfx::PointF(5.f, 5.f),
3285 gfx::Size(7, 13), 3286 gfx::Size(7, 13),
3286 true, 3287 true,
3287 false); 3288 false);
3288 SetLayerPropertiesForTesting(child1.get(), 3289 SetLayerPropertiesForTesting(child1.get(),
3289 identity_matrix, 3290 identity_matrix,
3290 gfx::PointF(), 3291 gfx::Point3F(),
3291 gfx::PointF(5.f, 5.f), 3292 gfx::PointF(5.f, 5.f),
3292 gfx::Size(50, 50), 3293 gfx::Size(50, 50),
3293 true, 3294 true,
3294 false); 3295 false);
3295 SetLayerPropertiesForTesting(child2.get(), 3296 SetLayerPropertiesForTesting(child2.get(),
3296 identity_matrix, 3297 identity_matrix,
3297 gfx::PointF(), 3298 gfx::Point3F(),
3298 gfx::PointF(75.f, 75.f), 3299 gfx::PointF(75.f, 75.f),
3299 gfx::Size(50, 50), 3300 gfx::Size(50, 50),
3300 true, 3301 true,
3301 false); 3302 false);
3302 SetLayerPropertiesForTesting(child3.get(), 3303 SetLayerPropertiesForTesting(child3.get(),
3303 identity_matrix, 3304 identity_matrix,
3304 gfx::PointF(), 3305 gfx::Point3F(),
3305 gfx::PointF(125.f, 125.f), 3306 gfx::PointF(125.f, 125.f),
3306 gfx::Size(50, 50), 3307 gfx::Size(50, 50),
3307 true, 3308 true,
3308 false); 3309 false);
3309 3310
3310 float device_scale_factor = 2.f; 3311 float device_scale_factor = 2.f;
3311 3312
3312 root->SetMasksToBounds(true); 3313 root->SetMasksToBounds(true);
3313 render_surface1->SetForceRenderSurface(true); 3314 render_surface1->SetForceRenderSurface(true);
3314 render_surface2->SetForceRenderSurface(true); 3315 render_surface2->SetForceRenderSurface(true);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
3407 3408
3408 // Having a descendant and opacity will force these to have render surfaces. 3409 // Having a descendant and opacity will force these to have render surfaces.
3409 front_facing_surface->SetOpacity(0.5f); 3410 front_facing_surface->SetOpacity(0.5f);
3410 back_facing_surface->SetOpacity(0.5f); 3411 back_facing_surface->SetOpacity(0.5f);
3411 3412
3412 // Nothing preserves 3d. According to current W3C CSS gfx::Transforms spec, 3413 // Nothing preserves 3d. According to current W3C CSS gfx::Transforms spec,
3413 // these layers should blindly use their own local transforms to determine 3414 // these layers should blindly use their own local transforms to determine
3414 // back-face culling. 3415 // back-face culling.
3415 SetLayerPropertiesForTesting(parent.get(), 3416 SetLayerPropertiesForTesting(parent.get(),
3416 identity_matrix, 3417 identity_matrix,
3417 gfx::PointF(), 3418 gfx::Point3F(),
3418 gfx::PointF(), 3419 gfx::PointF(),
3419 gfx::Size(100, 100), 3420 gfx::Size(100, 100),
3420 true, 3421 true,
3421 false); 3422 false);
3422 SetLayerPropertiesForTesting(front_facing_child.get(), 3423 SetLayerPropertiesForTesting(front_facing_child.get(),
3423 identity_matrix, 3424 identity_matrix,
3424 gfx::PointF(), 3425 gfx::Point3F(),
3425 gfx::PointF(), 3426 gfx::PointF(),
3426 gfx::Size(100, 100), 3427 gfx::Size(100, 100),
3427 true, 3428 true,
3428 false); 3429 false);
3429 SetLayerPropertiesForTesting(back_facing_child.get(), 3430 SetLayerPropertiesForTesting(back_facing_child.get(),
3430 backface_matrix, 3431 backface_matrix,
3431 gfx::PointF(), 3432 gfx::Point3F(),
3432 gfx::PointF(), 3433 gfx::PointF(),
3433 gfx::Size(100, 100), 3434 gfx::Size(100, 100),
3434 true, 3435 true,
3435 false); 3436 false);
3436 SetLayerPropertiesForTesting(front_facing_surface.get(), 3437 SetLayerPropertiesForTesting(front_facing_surface.get(),
3437 identity_matrix, 3438 identity_matrix,
3438 gfx::PointF(), 3439 gfx::Point3F(),
3439 gfx::PointF(), 3440 gfx::PointF(),
3440 gfx::Size(100, 100), 3441 gfx::Size(100, 100),
3441 true, 3442 true,
3442 false); 3443 false);
3443 SetLayerPropertiesForTesting(back_facing_surface.get(), 3444 SetLayerPropertiesForTesting(back_facing_surface.get(),
3444 backface_matrix, 3445 backface_matrix,
3445 gfx::PointF(), 3446 gfx::Point3F(),
3446 gfx::PointF(), 3447 gfx::PointF(),
3447 gfx::Size(100, 100), 3448 gfx::Size(100, 100),
3448 true, 3449 true,
3449 false); 3450 false);
3450 SetLayerPropertiesForTesting(front_facing_child_of_front_facing_surface.get(), 3451 SetLayerPropertiesForTesting(front_facing_child_of_front_facing_surface.get(),
3451 identity_matrix, 3452 identity_matrix,
3452 gfx::PointF(), 3453 gfx::Point3F(),
3453 gfx::PointF(), 3454 gfx::PointF(),
3454 gfx::Size(100, 100), 3455 gfx::Size(100, 100),
3455 true, 3456 true,
3456 false); 3457 false);
3457 SetLayerPropertiesForTesting(back_facing_child_of_front_facing_surface.get(), 3458 SetLayerPropertiesForTesting(back_facing_child_of_front_facing_surface.get(),
3458 backface_matrix, 3459 backface_matrix,
3459 gfx::PointF(), 3460 gfx::Point3F(),
3460 gfx::PointF(), 3461 gfx::PointF(),
3461 gfx::Size(100, 100), 3462 gfx::Size(100, 100),
3462 true, 3463 true,
3463 false); 3464 false);
3464 SetLayerPropertiesForTesting(front_facing_child_of_back_facing_surface.get(), 3465 SetLayerPropertiesForTesting(front_facing_child_of_back_facing_surface.get(),
3465 identity_matrix, 3466 identity_matrix,
3466 gfx::PointF(), 3467 gfx::Point3F(),
3467 gfx::PointF(), 3468 gfx::PointF(),
3468 gfx::Size(100, 100), 3469 gfx::Size(100, 100),
3469 true, 3470 true,
3470 false); 3471 false);
3471 SetLayerPropertiesForTesting(back_facing_child_of_back_facing_surface.get(), 3472 SetLayerPropertiesForTesting(back_facing_child_of_back_facing_surface.get(),
3472 backface_matrix, 3473 backface_matrix,
3473 gfx::PointF(), 3474 gfx::Point3F(),
3474 gfx::PointF(), 3475 gfx::PointF(),
3475 gfx::Size(100, 100), 3476 gfx::Size(100, 100),
3476 true, 3477 true,
3477 false); 3478 false);
3478 3479
3479 RenderSurfaceLayerList render_surface_layer_list; 3480 RenderSurfaceLayerList render_surface_layer_list;
3480 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( 3481 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs(
3481 parent.get(), parent->bounds(), &render_surface_layer_list); 3482 parent.get(), parent->bounds(), &render_surface_layer_list);
3482 inputs.can_adjust_raster_scales = true; 3483 inputs.can_adjust_raster_scales = true;
3483 LayerTreeHostCommon::CalculateDrawProperties(&inputs); 3484 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
3617 front_facing_surface->SetReplicaLayer(dummy_replica_layer1.get()); 3618 front_facing_surface->SetReplicaLayer(dummy_replica_layer1.get());
3618 back_facing_surface->SetReplicaLayer(dummy_replica_layer2.get()); 3619 back_facing_surface->SetReplicaLayer(dummy_replica_layer2.get());
3619 3620
3620 // Each surface creates its own new 3d rendering context (as defined by W3C 3621 // Each surface creates its own new 3d rendering context (as defined by W3C
3621 // spec). According to current W3C CSS gfx::Transforms spec, layers in a 3d 3622 // spec). According to current W3C CSS gfx::Transforms spec, layers in a 3d
3622 // rendering context should use the transform with respect to that context. 3623 // rendering context should use the transform with respect to that context.
3623 // This 3d rendering context occurs when (a) parent's transform style is flat 3624 // This 3d rendering context occurs when (a) parent's transform style is flat
3624 // and (b) the layer's transform style is preserve-3d. 3625 // and (b) the layer's transform style is preserve-3d.
3625 SetLayerPropertiesForTesting(parent.get(), 3626 SetLayerPropertiesForTesting(parent.get(),
3626 identity_matrix, 3627 identity_matrix,
3627 gfx::PointF(), 3628 gfx::Point3F(),
3628 gfx::PointF(), 3629 gfx::PointF(),
3629 gfx::Size(100, 100), 3630 gfx::Size(100, 100),
3630 true, 3631 true,
3631 false); // parent transform style is flat. 3632 false); // parent transform style is flat.
3632 SetLayerPropertiesForTesting(front_facing_child.get(), 3633 SetLayerPropertiesForTesting(front_facing_child.get(),
3633 identity_matrix, 3634 identity_matrix,
3634 gfx::PointF(), 3635 gfx::Point3F(),
3635 gfx::PointF(), 3636 gfx::PointF(),
3636 gfx::Size(100, 100), 3637 gfx::Size(100, 100),
3637 true, 3638 true,
3638 false); 3639 false);
3639 SetLayerPropertiesForTesting(back_facing_child.get(), 3640 SetLayerPropertiesForTesting(back_facing_child.get(),
3640 backface_matrix, 3641 backface_matrix,
3641 gfx::PointF(), 3642 gfx::Point3F(),
3642 gfx::PointF(), 3643 gfx::PointF(),
3643 gfx::Size(100, 100), 3644 gfx::Size(100, 100),
3644 true, 3645 true,
3645 false); 3646 false);
3646 // surface transform style is preserve-3d. 3647 // surface transform style is preserve-3d.
3647 SetLayerPropertiesForTesting(front_facing_surface.get(), 3648 SetLayerPropertiesForTesting(front_facing_surface.get(),
3648 identity_matrix, 3649 identity_matrix,
3649 gfx::PointF(), 3650 gfx::Point3F(),
3650 gfx::PointF(), 3651 gfx::PointF(),
3651 gfx::Size(100, 100), 3652 gfx::Size(100, 100),
3652 false, 3653 false,
3653 true); 3654 true);
3654 // surface transform style is preserve-3d. 3655 // surface transform style is preserve-3d.
3655 SetLayerPropertiesForTesting(back_facing_surface.get(), 3656 SetLayerPropertiesForTesting(back_facing_surface.get(),
3656 backface_matrix, 3657 backface_matrix,
3657 gfx::PointF(), 3658 gfx::Point3F(),
3658 gfx::PointF(), 3659 gfx::PointF(),
3659 gfx::Size(100, 100), 3660 gfx::Size(100, 100),
3660 false, 3661 false,
3661 true); 3662 true);
3662 SetLayerPropertiesForTesting(front_facing_child_of_front_facing_surface.get(), 3663 SetLayerPropertiesForTesting(front_facing_child_of_front_facing_surface.get(),
3663 identity_matrix, 3664 identity_matrix,
3664 gfx::PointF(), 3665 gfx::Point3F(),
3665 gfx::PointF(), 3666 gfx::PointF(),
3666 gfx::Size(100, 100), 3667 gfx::Size(100, 100),
3667 true, 3668 true,
3668 true); 3669 true);
3669 SetLayerPropertiesForTesting(back_facing_child_of_front_facing_surface.get(), 3670 SetLayerPropertiesForTesting(back_facing_child_of_front_facing_surface.get(),
3670 backface_matrix, 3671 backface_matrix,
3671 gfx::PointF(), 3672 gfx::Point3F(),
3672 gfx::PointF(), 3673 gfx::PointF(),
3673 gfx::Size(100, 100), 3674 gfx::Size(100, 100),
3674 true, 3675 true,
3675 true); 3676 true);
3676 SetLayerPropertiesForTesting(front_facing_child_of_back_facing_surface.get(), 3677 SetLayerPropertiesForTesting(front_facing_child_of_back_facing_surface.get(),
3677 identity_matrix, 3678 identity_matrix,
3678 gfx::PointF(), 3679 gfx::Point3F(),
3679 gfx::PointF(), 3680 gfx::PointF(),
3680 gfx::Size(100, 100), 3681 gfx::Size(100, 100),
3681 true, 3682 true,
3682 true); 3683 true);
3683 SetLayerPropertiesForTesting(back_facing_child_of_back_facing_surface.get(), 3684 SetLayerPropertiesForTesting(back_facing_child_of_back_facing_surface.get(),
3684 backface_matrix, 3685 backface_matrix,
3685 gfx::PointF(), 3686 gfx::Point3F(),
3686 gfx::PointF(), 3687 gfx::PointF(),
3687 gfx::Size(100, 100), 3688 gfx::Size(100, 100),
3688 true, 3689 true,
3689 true); 3690 true);
3690 3691
3691 RenderSurfaceLayerList render_surface_layer_list; 3692 RenderSurfaceLayerList render_surface_layer_list;
3692 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( 3693 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs(
3693 parent.get(), parent->bounds(), &render_surface_layer_list); 3694 parent.get(), parent->bounds(), &render_surface_layer_list);
3694 inputs.can_adjust_raster_scales = true; 3695 inputs.can_adjust_raster_scales = true;
3695 LayerTreeHostCommon::CalculateDrawProperties(&inputs); 3696 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
3779 3780
3780 // Animate the transform on the render surface. 3781 // Animate the transform on the render surface.
3781 AddAnimatedTransformToController( 3782 AddAnimatedTransformToController(
3782 animating_surface->layer_animation_controller(), 10.0, 30, 0); 3783 animating_surface->layer_animation_controller(), 10.0, 30, 0);
3783 // This is just an animating layer, not a surface. 3784 // This is just an animating layer, not a surface.
3784 AddAnimatedTransformToController( 3785 AddAnimatedTransformToController(
3785 animating_child->layer_animation_controller(), 10.0, 30, 0); 3786 animating_child->layer_animation_controller(), 10.0, 30, 0);
3786 3787
3787 SetLayerPropertiesForTesting(parent.get(), 3788 SetLayerPropertiesForTesting(parent.get(),
3788 identity_matrix, 3789 identity_matrix,
3789 gfx::PointF(), 3790 gfx::Point3F(),
3790 gfx::PointF(), 3791 gfx::PointF(),
3791 gfx::Size(100, 100), 3792 gfx::Size(100, 100),
3792 true, 3793 true,
3793 false); 3794 false);
3794 SetLayerPropertiesForTesting(child.get(), 3795 SetLayerPropertiesForTesting(child.get(),
3795 backface_matrix, 3796 backface_matrix,
3796 gfx::PointF(), 3797 gfx::Point3F(),
3797 gfx::PointF(), 3798 gfx::PointF(),
3798 gfx::Size(100, 100), 3799 gfx::Size(100, 100),
3799 true, 3800 true,
3800 false); 3801 false);
3801 SetLayerPropertiesForTesting(animating_surface.get(), 3802 SetLayerPropertiesForTesting(animating_surface.get(),
3802 backface_matrix, 3803 backface_matrix,
3803 gfx::PointF(), 3804 gfx::Point3F(),
3804 gfx::PointF(), 3805 gfx::PointF(),
3805 gfx::Size(100, 100), 3806 gfx::Size(100, 100),
3806 true, 3807 true,
3807 false); 3808 false);
3808 SetLayerPropertiesForTesting(child_of_animating_surface.get(), 3809 SetLayerPropertiesForTesting(child_of_animating_surface.get(),
3809 backface_matrix, 3810 backface_matrix,
3810 gfx::PointF(), 3811 gfx::Point3F(),
3811 gfx::PointF(), 3812 gfx::PointF(),
3812 gfx::Size(100, 100), 3813 gfx::Size(100, 100),
3813 true, 3814 true,
3814 false); 3815 false);
3815 SetLayerPropertiesForTesting(animating_child.get(), 3816 SetLayerPropertiesForTesting(animating_child.get(),
3816 backface_matrix, 3817 backface_matrix,
3817 gfx::PointF(), 3818 gfx::Point3F(),
3818 gfx::PointF(), 3819 gfx::PointF(),
3819 gfx::Size(100, 100), 3820 gfx::Size(100, 100),
3820 true, 3821 true,
3821 false); 3822 false);
3822 SetLayerPropertiesForTesting(child2.get(), 3823 SetLayerPropertiesForTesting(child2.get(),
3823 identity_matrix, 3824 identity_matrix,
3824 gfx::PointF(), 3825 gfx::Point3F(),
3825 gfx::PointF(), 3826 gfx::PointF(),
3826 gfx::Size(100, 100), 3827 gfx::Size(100, 100),
3827 true, 3828 true,
3828 false); 3829 false);
3829 3830
3830 RenderSurfaceLayerList render_surface_layer_list; 3831 RenderSurfaceLayerList render_surface_layer_list;
3831 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( 3832 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs(
3832 parent.get(), parent->bounds(), &render_surface_layer_list); 3833 parent.get(), parent->bounds(), &render_surface_layer_list);
3833 inputs.can_adjust_raster_scales = true; 3834 inputs.can_adjust_raster_scales = true;
3834 LayerTreeHostCommon::CalculateDrawProperties(&inputs); 3835 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
3912 front_facing_surface->SetDoubleSided(false); 3913 front_facing_surface->SetDoubleSided(false);
3913 back_facing_surface->SetDoubleSided(false); 3914 back_facing_surface->SetDoubleSided(false);
3914 3915
3915 gfx::Transform backface_matrix; 3916 gfx::Transform backface_matrix;
3916 backface_matrix.Translate(50.0, 50.0); 3917 backface_matrix.Translate(50.0, 50.0);
3917 backface_matrix.RotateAboutYAxis(180.0); 3918 backface_matrix.RotateAboutYAxis(180.0);
3918 backface_matrix.Translate(-50.0, -50.0); 3919 backface_matrix.Translate(-50.0, -50.0);
3919 3920
3920 SetLayerPropertiesForTesting(parent.get(), 3921 SetLayerPropertiesForTesting(parent.get(),
3921 identity_matrix, 3922 identity_matrix,
3922 gfx::PointF(), 3923 gfx::Point3F(),
3923 gfx::PointF(), 3924 gfx::PointF(),
3924 gfx::Size(100, 100), 3925 gfx::Size(100, 100),
3925 false, 3926 false,
3926 true); // parent transform style is preserve3d. 3927 true); // parent transform style is preserve3d.
3927 SetLayerPropertiesForTesting(front_facing_surface.get(), 3928 SetLayerPropertiesForTesting(front_facing_surface.get(),
3928 identity_matrix, 3929 identity_matrix,
3929 gfx::PointF(), 3930 gfx::Point3F(),
3930 gfx::PointF(), 3931 gfx::PointF(),
3931 gfx::Size(100, 100), 3932 gfx::Size(100, 100),
3932 true, 3933 true,
3933 true); // surface transform style is flat. 3934 true); // surface transform style is flat.
3934 SetLayerPropertiesForTesting(back_facing_surface.get(), 3935 SetLayerPropertiesForTesting(back_facing_surface.get(),
3935 backface_matrix, 3936 backface_matrix,
3936 gfx::PointF(), 3937 gfx::Point3F(),
3937 gfx::PointF(), 3938 gfx::PointF(),
3938 gfx::Size(100, 100), 3939 gfx::Size(100, 100),
3939 true, 3940 true,
3940 true); // surface transform style is flat. 3941 true); // surface transform style is flat.
3941 SetLayerPropertiesForTesting(child1.get(), 3942 SetLayerPropertiesForTesting(child1.get(),
3942 identity_matrix, 3943 identity_matrix,
3943 gfx::PointF(), 3944 gfx::Point3F(),
3944 gfx::PointF(), 3945 gfx::PointF(),
3945 gfx::Size(100, 100), 3946 gfx::Size(100, 100),
3946 true, 3947 true,
3947 false); 3948 false);
3948 SetLayerPropertiesForTesting(child2.get(), 3949 SetLayerPropertiesForTesting(child2.get(),
3949 identity_matrix, 3950 identity_matrix,
3950 gfx::PointF(), 3951 gfx::Point3F(),
3951 gfx::PointF(), 3952 gfx::PointF(),
3952 gfx::Size(100, 100), 3953 gfx::Size(100, 100),
3953 true, 3954 true,
3954 false); 3955 false);
3955 3956
3956 front_facing_surface->SetIs3dSorted(true); 3957 front_facing_surface->SetIs3dSorted(true);
3957 back_facing_surface->SetIs3dSorted(true); 3958 back_facing_surface->SetIs3dSorted(true);
3958 3959
3959 RenderSurfaceLayerList render_surface_layer_list; 3960 RenderSurfaceLayerList render_surface_layer_list;
3960 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( 3961 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs(
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
4035 } 4036 }
4036 4037
4037 TEST_F(LayerTreeHostCommonTest, LayerTransformsInHighDPI) { 4038 TEST_F(LayerTreeHostCommonTest, LayerTransformsInHighDPI) {
4038 // Verify draw and screen space transforms of layers not in a surface. 4039 // Verify draw and screen space transforms of layers not in a surface.
4039 MockContentLayerClient delegate; 4040 MockContentLayerClient delegate;
4040 gfx::Transform identity_matrix; 4041 gfx::Transform identity_matrix;
4041 4042
4042 scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate); 4043 scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate);
4043 SetLayerPropertiesForTesting(parent.get(), 4044 SetLayerPropertiesForTesting(parent.get(),
4044 identity_matrix, 4045 identity_matrix,
4045 gfx::PointF(), 4046 gfx::Point3F(),
4046 gfx::PointF(), 4047 gfx::PointF(),
4047 gfx::Size(100, 100), 4048 gfx::Size(100, 100),
4048 false, 4049 false,
4049 true); 4050 true);
4050 4051
4051 scoped_refptr<ContentLayer> child = CreateDrawableContentLayer(&delegate); 4052 scoped_refptr<ContentLayer> child = CreateDrawableContentLayer(&delegate);
4052 SetLayerPropertiesForTesting(child.get(), 4053 SetLayerPropertiesForTesting(child.get(),
4053 identity_matrix, 4054 identity_matrix,
4054 gfx::PointF(), 4055 gfx::Point3F(),
4055 gfx::PointF(2.f, 2.f), 4056 gfx::PointF(2.f, 2.f),
4056 gfx::Size(10, 10), 4057 gfx::Size(10, 10),
4057 false, 4058 false,
4058 true); 4059 true);
4059 4060
4060 scoped_refptr<ContentLayer> child_empty = 4061 scoped_refptr<ContentLayer> child_empty =
4061 CreateDrawableContentLayer(&delegate); 4062 CreateDrawableContentLayer(&delegate);
4062 SetLayerPropertiesForTesting(child_empty.get(), 4063 SetLayerPropertiesForTesting(child_empty.get(),
4063 identity_matrix, 4064 identity_matrix,
4064 gfx::PointF(), 4065 gfx::Point3F(),
4065 gfx::PointF(2.f, 2.f), 4066 gfx::PointF(2.f, 2.f),
4066 gfx::Size(), 4067 gfx::Size(),
4067 false, 4068 false,
4068 true); 4069 true);
4069 4070
4070 scoped_refptr<NoScaleContentLayer> child_no_scale = 4071 scoped_refptr<NoScaleContentLayer> child_no_scale =
4071 CreateNoScaleDrawableContentLayer(&delegate); 4072 CreateNoScaleDrawableContentLayer(&delegate);
4072 SetLayerPropertiesForTesting(child_no_scale.get(), 4073 SetLayerPropertiesForTesting(child_no_scale.get(),
4073 identity_matrix, 4074 identity_matrix,
4074 gfx::PointF(), 4075 gfx::Point3F(),
4075 gfx::PointF(2.f, 2.f), 4076 gfx::PointF(2.f, 2.f),
4076 gfx::Size(10, 10), 4077 gfx::Size(10, 10),
4077 false, 4078 false,
4078 true); 4079 true);
4079 4080
4080 parent->AddChild(child); 4081 parent->AddChild(child);
4081 parent->AddChild(child_empty); 4082 parent->AddChild(child_empty);
4082 parent->AddChild(child_no_scale); 4083 parent->AddChild(child_no_scale);
4083 4084
4084 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 4085 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
4179 perspective_matrix.ApplyPerspectiveDepth(2.0); 4180 perspective_matrix.ApplyPerspectiveDepth(2.0);
4180 4181
4181 gfx::Transform scale_small_matrix; 4182 gfx::Transform scale_small_matrix;
4182 scale_small_matrix.Scale(SK_MScalar1 / 10.f, SK_MScalar1 / 12.f); 4183 scale_small_matrix.Scale(SK_MScalar1 / 10.f, SK_MScalar1 / 12.f);
4183 4184
4184 scoped_refptr<Layer> root = Layer::Create(); 4185 scoped_refptr<Layer> root = Layer::Create();
4185 4186
4186 scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate); 4187 scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate);
4187 SetLayerPropertiesForTesting(parent.get(), 4188 SetLayerPropertiesForTesting(parent.get(),
4188 identity_matrix, 4189 identity_matrix,
4189 gfx::PointF(), 4190 gfx::Point3F(),
4190 gfx::PointF(), 4191 gfx::PointF(),
4191 gfx::Size(100, 100), 4192 gfx::Size(100, 100),
4192 false, 4193 false,
4193 true); 4194 true);
4194 4195
4195 scoped_refptr<ContentLayer> perspective_surface = 4196 scoped_refptr<ContentLayer> perspective_surface =
4196 CreateDrawableContentLayer(&delegate); 4197 CreateDrawableContentLayer(&delegate);
4197 SetLayerPropertiesForTesting(perspective_surface.get(), 4198 SetLayerPropertiesForTesting(perspective_surface.get(),
4198 perspective_matrix * scale_small_matrix, 4199 perspective_matrix * scale_small_matrix,
4199 gfx::PointF(), 4200 gfx::Point3F(),
4200 gfx::PointF(2.f, 2.f), 4201 gfx::PointF(2.f, 2.f),
4201 gfx::Size(10, 10), 4202 gfx::Size(10, 10),
4202 false, 4203 false,
4203 true); 4204 true);
4204 4205
4205 scoped_refptr<ContentLayer> scale_surface = 4206 scoped_refptr<ContentLayer> scale_surface =
4206 CreateDrawableContentLayer(&delegate); 4207 CreateDrawableContentLayer(&delegate);
4207 SetLayerPropertiesForTesting(scale_surface.get(), 4208 SetLayerPropertiesForTesting(scale_surface.get(),
4208 scale_small_matrix, 4209 scale_small_matrix,
4209 gfx::PointF(), 4210 gfx::Point3F(),
4210 gfx::PointF(2.f, 2.f), 4211 gfx::PointF(2.f, 2.f),
4211 gfx::Size(10, 10), 4212 gfx::Size(10, 10),
4212 false, 4213 false,
4213 true); 4214 true);
4214 4215
4215 perspective_surface->SetForceRenderSurface(true); 4216 perspective_surface->SetForceRenderSurface(true);
4216 scale_surface->SetForceRenderSurface(true); 4217 scale_surface->SetForceRenderSurface(true);
4217 4218
4218 parent->AddChild(perspective_surface); 4219 parent->AddChild(perspective_surface);
4219 parent->AddChild(scale_surface); 4220 parent->AddChild(scale_surface);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
4283 4284
4284 TEST_F(LayerTreeHostCommonTest, 4285 TEST_F(LayerTreeHostCommonTest,
4285 LayerTransformsInHighDPIAccurateScaleZeroChildPosition) { 4286 LayerTransformsInHighDPIAccurateScaleZeroChildPosition) {
4286 // Verify draw and screen space transforms of layers not in a surface. 4287 // Verify draw and screen space transforms of layers not in a surface.
4287 MockContentLayerClient delegate; 4288 MockContentLayerClient delegate;
4288 gfx::Transform identity_matrix; 4289 gfx::Transform identity_matrix;
4289 4290
4290 scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate); 4291 scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate);
4291 SetLayerPropertiesForTesting(parent.get(), 4292 SetLayerPropertiesForTesting(parent.get(),
4292 identity_matrix, 4293 identity_matrix,
4293 gfx::PointF(), 4294 gfx::Point3F(),
4294 gfx::PointF(), 4295 gfx::PointF(),
4295 gfx::Size(133, 133), 4296 gfx::Size(133, 133),
4296 false, 4297 false,
4297 true); 4298 true);
4298 4299
4299 scoped_refptr<ContentLayer> child = CreateDrawableContentLayer(&delegate); 4300 scoped_refptr<ContentLayer> child = CreateDrawableContentLayer(&delegate);
4300 SetLayerPropertiesForTesting(child.get(), 4301 SetLayerPropertiesForTesting(child.get(),
4301 identity_matrix, 4302 identity_matrix,
4302 gfx::PointF(), 4303 gfx::Point3F(),
4303 gfx::PointF(), 4304 gfx::PointF(),
4304 gfx::Size(13, 13), 4305 gfx::Size(13, 13),
4305 false, 4306 false,
4306 true); 4307 true);
4307 4308
4308 scoped_refptr<NoScaleContentLayer> child_no_scale = 4309 scoped_refptr<NoScaleContentLayer> child_no_scale =
4309 CreateNoScaleDrawableContentLayer(&delegate); 4310 CreateNoScaleDrawableContentLayer(&delegate);
4310 SetLayerPropertiesForTesting(child_no_scale.get(), 4311 SetLayerPropertiesForTesting(child_no_scale.get(),
4311 identity_matrix, 4312 identity_matrix,
4312 gfx::PointF(), 4313 gfx::Point3F(),
4313 gfx::PointF(), 4314 gfx::PointF(),
4314 gfx::Size(13, 13), 4315 gfx::Size(13, 13),
4315 false, 4316 false,
4316 true); 4317 true);
4317 4318
4318 parent->AddChild(child); 4319 parent->AddChild(child);
4319 parent->AddChild(child_no_scale); 4320 parent->AddChild(child_no_scale);
4320 4321
4321 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 4322 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
4322 host->SetRootLayer(parent); 4323 host->SetRootLayer(parent);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
4407 gfx::Transform child_scale_matrix; 4408 gfx::Transform child_scale_matrix;
4408 SkMScalar initial_child_scale = 1.25; 4409 SkMScalar initial_child_scale = 1.25;
4409 child_scale_matrix.Scale(initial_child_scale, initial_child_scale); 4410 child_scale_matrix.Scale(initial_child_scale, initial_child_scale);
4410 4411
4411 scoped_refptr<Layer> root = Layer::Create(); 4412 scoped_refptr<Layer> root = Layer::Create();
4412 root->SetBounds(gfx::Size(100, 100)); 4413 root->SetBounds(gfx::Size(100, 100));
4413 4414
4414 scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate); 4415 scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate);
4415 SetLayerPropertiesForTesting(parent.get(), 4416 SetLayerPropertiesForTesting(parent.get(),
4416 parent_scale_matrix, 4417 parent_scale_matrix,
4417 gfx::PointF(), 4418 gfx::Point3F(),
4418 gfx::PointF(), 4419 gfx::PointF(),
4419 gfx::Size(100, 100), 4420 gfx::Size(100, 100),
4420 false, 4421 false,
4421 true); 4422 true);
4422 4423
4423 scoped_refptr<ContentLayer> child_scale = 4424 scoped_refptr<ContentLayer> child_scale =
4424 CreateDrawableContentLayer(&delegate); 4425 CreateDrawableContentLayer(&delegate);
4425 SetLayerPropertiesForTesting(child_scale.get(), 4426 SetLayerPropertiesForTesting(child_scale.get(),
4426 child_scale_matrix, 4427 child_scale_matrix,
4427 gfx::PointF(), 4428 gfx::Point3F(),
4428 gfx::PointF(2.f, 2.f), 4429 gfx::PointF(2.f, 2.f),
4429 gfx::Size(10, 10), 4430 gfx::Size(10, 10),
4430 false, 4431 false,
4431 true); 4432 true);
4432 4433
4433 scoped_refptr<ContentLayer> child_empty = 4434 scoped_refptr<ContentLayer> child_empty =
4434 CreateDrawableContentLayer(&delegate); 4435 CreateDrawableContentLayer(&delegate);
4435 SetLayerPropertiesForTesting(child_empty.get(), 4436 SetLayerPropertiesForTesting(child_empty.get(),
4436 child_scale_matrix, 4437 child_scale_matrix,
4437 gfx::PointF(), 4438 gfx::Point3F(),
4438 gfx::PointF(2.f, 2.f), 4439 gfx::PointF(2.f, 2.f),
4439 gfx::Size(), 4440 gfx::Size(),
4440 false, 4441 false,
4441 true); 4442 true);
4442 4443
4443 scoped_refptr<NoScaleContentLayer> child_no_scale = 4444 scoped_refptr<NoScaleContentLayer> child_no_scale =
4444 CreateNoScaleDrawableContentLayer(&delegate); 4445 CreateNoScaleDrawableContentLayer(&delegate);
4445 SetLayerPropertiesForTesting(child_no_scale.get(), 4446 SetLayerPropertiesForTesting(child_no_scale.get(),
4446 child_scale_matrix, 4447 child_scale_matrix,
4447 gfx::PointF(), 4448 gfx::Point3F(),
4448 gfx::PointF(12.f, 12.f), 4449 gfx::PointF(12.f, 12.f),
4449 gfx::Size(10, 10), 4450 gfx::Size(10, 10),
4450 false, 4451 false,
4451 true); 4452 true);
4452 4453
4453 root->AddChild(parent); 4454 root->AddChild(parent);
4454 4455
4455 parent->AddChild(child_scale); 4456 parent->AddChild(child_scale);
4456 parent->AddChild(child_empty); 4457 parent->AddChild(child_empty);
4457 parent->AddChild(child_no_scale); 4458 parent->AddChild(child_no_scale);
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
4591 gfx::Transform child_scale_matrix; 4592 gfx::Transform child_scale_matrix;
4592 SkMScalar initial_child_scale = 1.25; 4593 SkMScalar initial_child_scale = 1.25;
4593 child_scale_matrix.Scale(initial_child_scale, initial_child_scale); 4594 child_scale_matrix.Scale(initial_child_scale, initial_child_scale);
4594 4595
4595 scoped_refptr<Layer> root = Layer::Create(); 4596 scoped_refptr<Layer> root = Layer::Create();
4596 root->SetBounds(gfx::Size(100, 100)); 4597 root->SetBounds(gfx::Size(100, 100));
4597 4598
4598 scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate); 4599 scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate);
4599 SetLayerPropertiesForTesting(parent.get(), 4600 SetLayerPropertiesForTesting(parent.get(),
4600 parent_scale_matrix, 4601 parent_scale_matrix,
4601 gfx::PointF(), 4602 gfx::Point3F(),
4602 gfx::PointF(), 4603 gfx::PointF(),
4603 gfx::Size(100, 100), 4604 gfx::Size(100, 100),
4604 false, 4605 false,
4605 true); 4606 true);
4606 4607
4607 scoped_refptr<ContentLayer> child_scale = 4608 scoped_refptr<ContentLayer> child_scale =
4608 CreateDrawableContentLayer(&delegate); 4609 CreateDrawableContentLayer(&delegate);
4609 SetLayerPropertiesForTesting(child_scale.get(), 4610 SetLayerPropertiesForTesting(child_scale.get(),
4610 child_scale_matrix, 4611 child_scale_matrix,
4611 gfx::PointF(), 4612 gfx::Point3F(),
4612 gfx::PointF(2.f, 2.f), 4613 gfx::PointF(2.f, 2.f),
4613 gfx::Size(10, 10), 4614 gfx::Size(10, 10),
4614 false, 4615 false,
4615 true); 4616 true);
4616 4617
4617 scoped_refptr<ContentLayer> child_empty = 4618 scoped_refptr<ContentLayer> child_empty =
4618 CreateDrawableContentLayer(&delegate); 4619 CreateDrawableContentLayer(&delegate);
4619 SetLayerPropertiesForTesting(child_empty.get(), 4620 SetLayerPropertiesForTesting(child_empty.get(),
4620 child_scale_matrix, 4621 child_scale_matrix,
4621 gfx::PointF(), 4622 gfx::Point3F(),
4622 gfx::PointF(2.f, 2.f), 4623 gfx::PointF(2.f, 2.f),
4623 gfx::Size(), 4624 gfx::Size(),
4624 false, 4625 false,
4625 true); 4626 true);
4626 4627
4627 scoped_refptr<NoScaleContentLayer> child_no_scale = 4628 scoped_refptr<NoScaleContentLayer> child_no_scale =
4628 CreateNoScaleDrawableContentLayer(&delegate); 4629 CreateNoScaleDrawableContentLayer(&delegate);
4629 SetLayerPropertiesForTesting(child_no_scale.get(), 4630 SetLayerPropertiesForTesting(child_no_scale.get(),
4630 child_scale_matrix, 4631 child_scale_matrix,
4631 gfx::PointF(), 4632 gfx::Point3F(),
4632 gfx::PointF(12.f, 12.f), 4633 gfx::PointF(12.f, 12.f),
4633 gfx::Size(10, 10), 4634 gfx::Size(10, 10),
4634 false, 4635 false,
4635 true); 4636 true);
4636 4637
4637 root->AddChild(parent); 4638 root->AddChild(parent);
4638 4639
4639 parent->AddChild(child_scale); 4640 parent->AddChild(child_scale);
4640 parent->AddChild(child_empty); 4641 parent->AddChild(child_empty);
4641 parent->AddChild(child_no_scale); 4642 parent->AddChild(child_no_scale);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
4695 gfx::Transform child_scale_matrix; 4696 gfx::Transform child_scale_matrix;
4696 SkMScalar initial_child_scale = 0.25; 4697 SkMScalar initial_child_scale = 0.25;
4697 child_scale_matrix.Scale(initial_child_scale, initial_child_scale); 4698 child_scale_matrix.Scale(initial_child_scale, initial_child_scale);
4698 4699
4699 scoped_refptr<Layer> root = Layer::Create(); 4700 scoped_refptr<Layer> root = Layer::Create();
4700 root->SetBounds(gfx::Size(100, 100)); 4701 root->SetBounds(gfx::Size(100, 100));
4701 4702
4702 scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate); 4703 scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate);
4703 SetLayerPropertiesForTesting(parent.get(), 4704 SetLayerPropertiesForTesting(parent.get(),
4704 parent_scale_matrix, 4705 parent_scale_matrix,
4705 gfx::PointF(), 4706 gfx::Point3F(),
4706 gfx::PointF(), 4707 gfx::PointF(),
4707 gfx::Size(100, 100), 4708 gfx::Size(100, 100),
4708 false, 4709 false,
4709 true); 4710 true);
4710 4711
4711 scoped_refptr<ContentLayer> child_scale = 4712 scoped_refptr<ContentLayer> child_scale =
4712 CreateDrawableContentLayer(&delegate); 4713 CreateDrawableContentLayer(&delegate);
4713 SetLayerPropertiesForTesting(child_scale.get(), 4714 SetLayerPropertiesForTesting(child_scale.get(),
4714 child_scale_matrix, 4715 child_scale_matrix,
4715 gfx::PointF(), 4716 gfx::Point3F(),
4716 gfx::PointF(2.f, 2.f), 4717 gfx::PointF(2.f, 2.f),
4717 gfx::Size(10, 10), 4718 gfx::Size(10, 10),
4718 false, 4719 false,
4719 true); 4720 true);
4720 4721
4721 root->AddChild(parent); 4722 root->AddChild(parent);
4722 4723
4723 parent->AddChild(child_scale); 4724 parent->AddChild(child_scale);
4724 4725
4725 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 4726 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
4784 gfx::Transform child_scale_matrix; 4785 gfx::Transform child_scale_matrix;
4785 SkMScalar initial_child_scale = 3.0; 4786 SkMScalar initial_child_scale = 3.0;
4786 child_scale_matrix.Scale(initial_child_scale, initial_child_scale); 4787 child_scale_matrix.Scale(initial_child_scale, initial_child_scale);
4787 4788
4788 scoped_refptr<Layer> root = Layer::Create(); 4789 scoped_refptr<Layer> root = Layer::Create();
4789 root->SetBounds(gfx::Size(100, 100)); 4790 root->SetBounds(gfx::Size(100, 100));
4790 4791
4791 scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate); 4792 scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate);
4792 SetLayerPropertiesForTesting(parent.get(), 4793 SetLayerPropertiesForTesting(parent.get(),
4793 parent_scale_matrix, 4794 parent_scale_matrix,
4794 gfx::PointF(), 4795 gfx::Point3F(),
4795 gfx::PointF(), 4796 gfx::PointF(),
4796 gfx::Size(100, 100), 4797 gfx::Size(100, 100),
4797 false, 4798 false,
4798 true); 4799 true);
4799 4800
4800 scoped_refptr<ContentLayer> surface_scale = 4801 scoped_refptr<ContentLayer> surface_scale =
4801 CreateDrawableContentLayer(&delegate); 4802 CreateDrawableContentLayer(&delegate);
4802 SetLayerPropertiesForTesting(surface_scale.get(), 4803 SetLayerPropertiesForTesting(surface_scale.get(),
4803 child_scale_matrix, 4804 child_scale_matrix,
4804 gfx::PointF(), 4805 gfx::Point3F(),
4805 gfx::PointF(2.f, 2.f), 4806 gfx::PointF(2.f, 2.f),
4806 gfx::Size(10, 10), 4807 gfx::Size(10, 10),
4807 false, 4808 false,
4808 true); 4809 true);
4809 4810
4810 scoped_refptr<ContentLayer> surface_scale_child_scale = 4811 scoped_refptr<ContentLayer> surface_scale_child_scale =
4811 CreateDrawableContentLayer(&delegate); 4812 CreateDrawableContentLayer(&delegate);
4812 SetLayerPropertiesForTesting(surface_scale_child_scale.get(), 4813 SetLayerPropertiesForTesting(surface_scale_child_scale.get(),
4813 child_scale_matrix, 4814 child_scale_matrix,
4814 gfx::PointF(), 4815 gfx::Point3F(),
4815 gfx::PointF(), 4816 gfx::PointF(),
4816 gfx::Size(10, 10), 4817 gfx::Size(10, 10),
4817 false, 4818 false,
4818 true); 4819 true);
4819 4820
4820 scoped_refptr<NoScaleContentLayer> surface_scale_child_no_scale = 4821 scoped_refptr<NoScaleContentLayer> surface_scale_child_no_scale =
4821 CreateNoScaleDrawableContentLayer(&delegate); 4822 CreateNoScaleDrawableContentLayer(&delegate);
4822 SetLayerPropertiesForTesting(surface_scale_child_no_scale.get(), 4823 SetLayerPropertiesForTesting(surface_scale_child_no_scale.get(),
4823 child_scale_matrix, 4824 child_scale_matrix,
4824 gfx::PointF(), 4825 gfx::Point3F(),
4825 gfx::PointF(), 4826 gfx::PointF(),
4826 gfx::Size(10, 10), 4827 gfx::Size(10, 10),
4827 false, 4828 false,
4828 true); 4829 true);
4829 4830
4830 scoped_refptr<NoScaleContentLayer> surface_no_scale = 4831 scoped_refptr<NoScaleContentLayer> surface_no_scale =
4831 CreateNoScaleDrawableContentLayer(&delegate); 4832 CreateNoScaleDrawableContentLayer(&delegate);
4832 SetLayerPropertiesForTesting(surface_no_scale.get(), 4833 SetLayerPropertiesForTesting(surface_no_scale.get(),
4833 child_scale_matrix, 4834 child_scale_matrix,
4834 gfx::PointF(), 4835 gfx::Point3F(),
4835 gfx::PointF(12.f, 12.f), 4836 gfx::PointF(12.f, 12.f),
4836 gfx::Size(10, 10), 4837 gfx::Size(10, 10),
4837 false, 4838 false,
4838 true); 4839 true);
4839 4840
4840 scoped_refptr<ContentLayer> surface_no_scale_child_scale = 4841 scoped_refptr<ContentLayer> surface_no_scale_child_scale =
4841 CreateDrawableContentLayer(&delegate); 4842 CreateDrawableContentLayer(&delegate);
4842 SetLayerPropertiesForTesting(surface_no_scale_child_scale.get(), 4843 SetLayerPropertiesForTesting(surface_no_scale_child_scale.get(),
4843 child_scale_matrix, 4844 child_scale_matrix,
4844 gfx::PointF(), 4845 gfx::Point3F(),
4845 gfx::PointF(), 4846 gfx::PointF(),
4846 gfx::Size(10, 10), 4847 gfx::Size(10, 10),
4847 false, 4848 false,
4848 true); 4849 true);
4849 4850
4850 scoped_refptr<NoScaleContentLayer> surface_no_scale_child_no_scale = 4851 scoped_refptr<NoScaleContentLayer> surface_no_scale_child_no_scale =
4851 CreateNoScaleDrawableContentLayer(&delegate); 4852 CreateNoScaleDrawableContentLayer(&delegate);
4852 SetLayerPropertiesForTesting(surface_no_scale_child_no_scale.get(), 4853 SetLayerPropertiesForTesting(surface_no_scale_child_no_scale.get(),
4853 child_scale_matrix, 4854 child_scale_matrix,
4854 gfx::PointF(), 4855 gfx::Point3F(),
4855 gfx::PointF(), 4856 gfx::PointF(),
4856 gfx::Size(10, 10), 4857 gfx::Size(10, 10),
4857 false, 4858 false,
4858 true); 4859 true);
4859 4860
4860 root->AddChild(parent); 4861 root->AddChild(parent);
4861 4862
4862 parent->AddChild(surface_scale); 4863 parent->AddChild(surface_scale);
4863 parent->AddChild(surface_no_scale); 4864 parent->AddChild(surface_no_scale);
4864 4865
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
4985 gfx::Transform child_scale_matrix; 4986 gfx::Transform child_scale_matrix;
4986 SkMScalar initial_child_scale = 3.0; 4987 SkMScalar initial_child_scale = 3.0;
4987 child_scale_matrix.Scale(initial_child_scale, initial_child_scale); 4988 child_scale_matrix.Scale(initial_child_scale, initial_child_scale);
4988 4989
4989 scoped_refptr<Layer> root = Layer::Create(); 4990 scoped_refptr<Layer> root = Layer::Create();
4990 root->SetBounds(gfx::Size(100, 100)); 4991 root->SetBounds(gfx::Size(100, 100));
4991 4992
4992 scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate); 4993 scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate);
4993 SetLayerPropertiesForTesting(parent.get(), 4994 SetLayerPropertiesForTesting(parent.get(),
4994 parent_scale_matrix, 4995 parent_scale_matrix,
4995 gfx::PointF(), 4996 gfx::Point3F(),
4996 gfx::PointF(), 4997 gfx::PointF(),
4997 gfx::Size(100, 100), 4998 gfx::Size(100, 100),
4998 false, 4999 false,
4999 true); 5000 true);
5000 5001
5001 scoped_refptr<ContentLayer> surface_scale = 5002 scoped_refptr<ContentLayer> surface_scale =
5002 CreateDrawableContentLayer(&delegate); 5003 CreateDrawableContentLayer(&delegate);
5003 SetLayerPropertiesForTesting(surface_scale.get(), 5004 SetLayerPropertiesForTesting(surface_scale.get(),
5004 child_scale_matrix, 5005 child_scale_matrix,
5005 gfx::PointF(), 5006 gfx::Point3F(),
5006 gfx::PointF(2.f, 2.f), 5007 gfx::PointF(2.f, 2.f),
5007 gfx::Size(10, 10), 5008 gfx::Size(10, 10),
5008 false, 5009 false,
5009 true); 5010 true);
5010 5011
5011 scoped_refptr<ContentLayer> surface_scale_child_scale = 5012 scoped_refptr<ContentLayer> surface_scale_child_scale =
5012 CreateDrawableContentLayer(&delegate); 5013 CreateDrawableContentLayer(&delegate);
5013 SetLayerPropertiesForTesting(surface_scale_child_scale.get(), 5014 SetLayerPropertiesForTesting(surface_scale_child_scale.get(),
5014 child_scale_matrix, 5015 child_scale_matrix,
5015 gfx::PointF(), 5016 gfx::Point3F(),
5016 gfx::PointF(), 5017 gfx::PointF(),
5017 gfx::Size(10, 10), 5018 gfx::Size(10, 10),
5018 false, 5019 false,
5019 true); 5020 true);
5020 5021
5021 scoped_refptr<NoScaleContentLayer> surface_scale_child_no_scale = 5022 scoped_refptr<NoScaleContentLayer> surface_scale_child_no_scale =
5022 CreateNoScaleDrawableContentLayer(&delegate); 5023 CreateNoScaleDrawableContentLayer(&delegate);
5023 SetLayerPropertiesForTesting(surface_scale_child_no_scale.get(), 5024 SetLayerPropertiesForTesting(surface_scale_child_no_scale.get(),
5024 child_scale_matrix, 5025 child_scale_matrix,
5025 gfx::PointF(), 5026 gfx::Point3F(),
5026 gfx::PointF(), 5027 gfx::PointF(),
5027 gfx::Size(10, 10), 5028 gfx::Size(10, 10),
5028 false, 5029 false,
5029 true); 5030 true);
5030 5031
5031 scoped_refptr<NoScaleContentLayer> surface_no_scale = 5032 scoped_refptr<NoScaleContentLayer> surface_no_scale =
5032 CreateNoScaleDrawableContentLayer(&delegate); 5033 CreateNoScaleDrawableContentLayer(&delegate);
5033 SetLayerPropertiesForTesting(surface_no_scale.get(), 5034 SetLayerPropertiesForTesting(surface_no_scale.get(),
5034 child_scale_matrix, 5035 child_scale_matrix,
5035 gfx::PointF(), 5036 gfx::Point3F(),
5036 gfx::PointF(12.f, 12.f), 5037 gfx::PointF(12.f, 12.f),
5037 gfx::Size(10, 10), 5038 gfx::Size(10, 10),
5038 false, 5039 false,
5039 true); 5040 true);
5040 5041
5041 scoped_refptr<ContentLayer> surface_no_scale_child_scale = 5042 scoped_refptr<ContentLayer> surface_no_scale_child_scale =
5042 CreateDrawableContentLayer(&delegate); 5043 CreateDrawableContentLayer(&delegate);
5043 SetLayerPropertiesForTesting(surface_no_scale_child_scale.get(), 5044 SetLayerPropertiesForTesting(surface_no_scale_child_scale.get(),
5044 child_scale_matrix, 5045 child_scale_matrix,
5045 gfx::PointF(), 5046 gfx::Point3F(),
5046 gfx::PointF(), 5047 gfx::PointF(),
5047 gfx::Size(10, 10), 5048 gfx::Size(10, 10),
5048 false, 5049 false,
5049 true); 5050 true);
5050 5051
5051 scoped_refptr<NoScaleContentLayer> surface_no_scale_child_no_scale = 5052 scoped_refptr<NoScaleContentLayer> surface_no_scale_child_no_scale =
5052 CreateNoScaleDrawableContentLayer(&delegate); 5053 CreateNoScaleDrawableContentLayer(&delegate);
5053 SetLayerPropertiesForTesting(surface_no_scale_child_no_scale.get(), 5054 SetLayerPropertiesForTesting(surface_no_scale_child_no_scale.get(),
5054 child_scale_matrix, 5055 child_scale_matrix,
5055 gfx::PointF(), 5056 gfx::Point3F(),
5056 gfx::PointF(), 5057 gfx::PointF(),
5057 gfx::Size(10, 10), 5058 gfx::Size(10, 10),
5058 false, 5059 false,
5059 true); 5060 true);
5060 5061
5061 root->AddChild(parent); 5062 root->AddChild(parent);
5062 5063
5063 parent->AddChild(surface_scale); 5064 parent->AddChild(surface_scale);
5064 parent->AddChild(surface_no_scale); 5065 parent->AddChild(surface_no_scale);
5065 5066
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
5187 gfx::Transform child_scale_matrix; 5188 gfx::Transform child_scale_matrix;
5188 SkMScalar initial_child_scale = 1.25; 5189 SkMScalar initial_child_scale = 1.25;
5189 child_scale_matrix.Scale(initial_child_scale, initial_child_scale); 5190 child_scale_matrix.Scale(initial_child_scale, initial_child_scale);
5190 5191
5191 scoped_refptr<Layer> root = Layer::Create(); 5192 scoped_refptr<Layer> root = Layer::Create();
5192 root->SetBounds(gfx::Size(100, 100)); 5193 root->SetBounds(gfx::Size(100, 100));
5193 5194
5194 scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate); 5195 scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate);
5195 SetLayerPropertiesForTesting(parent.get(), 5196 SetLayerPropertiesForTesting(parent.get(),
5196 parent_scale_matrix, 5197 parent_scale_matrix,
5197 gfx::PointF(), 5198 gfx::Point3F(),
5198 gfx::PointF(), 5199 gfx::PointF(),
5199 gfx::Size(100, 100), 5200 gfx::Size(100, 100),
5200 false, 5201 false,
5201 true); 5202 true);
5202 5203
5203 scoped_refptr<ContentLayer> child_scale = 5204 scoped_refptr<ContentLayer> child_scale =
5204 CreateDrawableContentLayer(&delegate); 5205 CreateDrawableContentLayer(&delegate);
5205 SetLayerPropertiesForTesting(child_scale.get(), 5206 SetLayerPropertiesForTesting(child_scale.get(),
5206 child_scale_matrix, 5207 child_scale_matrix,
5207 gfx::PointF(), 5208 gfx::Point3F(),
5208 gfx::PointF(2.f, 2.f), 5209 gfx::PointF(2.f, 2.f),
5209 gfx::Size(10, 10), 5210 gfx::Size(10, 10),
5210 false, 5211 false,
5211 true); 5212 true);
5212 5213
5213 root->AddChild(parent); 5214 root->AddChild(parent);
5214 5215
5215 parent->AddChild(child_scale); 5216 parent->AddChild(child_scale);
5216 5217
5217 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 5218 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
5258 scoped_refptr<Layer> root = Layer::Create(); 5259 scoped_refptr<Layer> root = Layer::Create();
5259 scoped_refptr<Layer> child = CreateDrawableContentLayer(&delegate); 5260 scoped_refptr<Layer> child = CreateDrawableContentLayer(&delegate);
5260 root->AddChild(child); 5261 root->AddChild(child);
5261 5262
5262 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 5263 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
5263 host->SetRootLayer(root); 5264 host->SetRootLayer(root);
5264 5265
5265 gfx::Transform identity_matrix; 5266 gfx::Transform identity_matrix;
5266 SetLayerPropertiesForTesting(root.get(), 5267 SetLayerPropertiesForTesting(root.get(),
5267 identity_matrix, 5268 identity_matrix,
5268 gfx::PointF(), 5269 gfx::Point3F(),
5269 gfx::PointF(), 5270 gfx::PointF(),
5270 gfx::Size(100, 100), 5271 gfx::Size(100, 100),
5271 true, 5272 true,
5272 false); 5273 false);
5273 SetLayerPropertiesForTesting(child.get(), 5274 SetLayerPropertiesForTesting(child.get(),
5274 identity_matrix, 5275 identity_matrix,
5275 gfx::PointF(), 5276 gfx::Point3F(),
5276 gfx::PointF(), 5277 gfx::PointF(),
5277 gfx::Size(100, 100), 5278 gfx::Size(100, 100),
5278 true, 5279 true,
5279 false); 5280 false);
5280 5281
5281 root->reset_needs_push_properties_for_testing(); 5282 root->reset_needs_push_properties_for_testing();
5282 child->reset_needs_push_properties_for_testing(); 5283 child->reset_needs_push_properties_for_testing();
5283 5284
5284 // This will change both layers' content bounds. 5285 // This will change both layers' content bounds.
5285 ExecuteCalculateDrawProperties(root.get()); 5286 ExecuteCalculateDrawProperties(root.get());
(...skipping 18 matching lines...) Expand all
5304 EXPECT_FALSE(child->needs_push_properties()); 5305 EXPECT_FALSE(child->needs_push_properties());
5305 } 5306 }
5306 5307
5307 TEST_F(LayerTreeHostCommonTest, RenderSurfaceTransformsInHighDPI) { 5308 TEST_F(LayerTreeHostCommonTest, RenderSurfaceTransformsInHighDPI) {
5308 MockContentLayerClient delegate; 5309 MockContentLayerClient delegate;
5309 gfx::Transform identity_matrix; 5310 gfx::Transform identity_matrix;
5310 5311
5311 scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate); 5312 scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate);
5312 SetLayerPropertiesForTesting(parent.get(), 5313 SetLayerPropertiesForTesting(parent.get(),
5313 identity_matrix, 5314 identity_matrix,
5314 gfx::PointF(), 5315 gfx::Point3F(),
5315 gfx::PointF(), 5316 gfx::PointF(),
5316 gfx::Size(30, 30), 5317 gfx::Size(30, 30),
5317 false, 5318 false,
5318 true); 5319 true);
5319 5320
5320 scoped_refptr<ContentLayer> child = CreateDrawableContentLayer(&delegate); 5321 scoped_refptr<ContentLayer> child = CreateDrawableContentLayer(&delegate);
5321 SetLayerPropertiesForTesting(child.get(), 5322 SetLayerPropertiesForTesting(child.get(),
5322 identity_matrix, 5323 identity_matrix,
5323 gfx::PointF(), 5324 gfx::Point3F(),
5324 gfx::PointF(2.f, 2.f), 5325 gfx::PointF(2.f, 2.f),
5325 gfx::Size(10, 10), 5326 gfx::Size(10, 10),
5326 false, 5327 false,
5327 true); 5328 true);
5328 5329
5329 gfx::Transform replica_transform; 5330 gfx::Transform replica_transform;
5330 replica_transform.Scale(1.0, -1.0); 5331 replica_transform.Scale(1.0, -1.0);
5331 scoped_refptr<ContentLayer> replica = CreateDrawableContentLayer(&delegate); 5332 scoped_refptr<ContentLayer> replica = CreateDrawableContentLayer(&delegate);
5332 SetLayerPropertiesForTesting(replica.get(), 5333 SetLayerPropertiesForTesting(replica.get(),
5333 replica_transform, 5334 replica_transform,
5334 gfx::PointF(), 5335 gfx::Point3F(),
5335 gfx::PointF(2.f, 2.f), 5336 gfx::PointF(2.f, 2.f),
5336 gfx::Size(10, 10), 5337 gfx::Size(10, 10),
5337 false, 5338 false,
5338 true); 5339 true);
5339 5340
5340 // This layer should end up in the same surface as child, with the same draw 5341 // This layer should end up in the same surface as child, with the same draw
5341 // and screen space transforms. 5342 // and screen space transforms.
5342 scoped_refptr<ContentLayer> duplicate_child_non_owner = 5343 scoped_refptr<ContentLayer> duplicate_child_non_owner =
5343 CreateDrawableContentLayer(&delegate); 5344 CreateDrawableContentLayer(&delegate);
5344 SetLayerPropertiesForTesting(duplicate_child_non_owner.get(), 5345 SetLayerPropertiesForTesting(duplicate_child_non_owner.get(),
5345 identity_matrix, 5346 identity_matrix,
5346 gfx::PointF(), 5347 gfx::Point3F(),
5347 gfx::PointF(), 5348 gfx::PointF(),
5348 gfx::Size(10, 10), 5349 gfx::Size(10, 10),
5349 false, 5350 false,
5350 true); 5351 true);
5351 5352
5352 parent->AddChild(child); 5353 parent->AddChild(child);
5353 child->AddChild(duplicate_child_non_owner); 5354 child->AddChild(duplicate_child_non_owner);
5354 child->SetReplicaLayer(replica.get()); 5355 child->SetReplicaLayer(replica.get());
5355 5356
5356 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 5357 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
5439 } 5440 }
5440 5441
5441 TEST_F(LayerTreeHostCommonTest, 5442 TEST_F(LayerTreeHostCommonTest,
5442 RenderSurfaceTransformsInHighDPIAccurateScaleZeroPosition) { 5443 RenderSurfaceTransformsInHighDPIAccurateScaleZeroPosition) {
5443 MockContentLayerClient delegate; 5444 MockContentLayerClient delegate;
5444 gfx::Transform identity_matrix; 5445 gfx::Transform identity_matrix;
5445 5446
5446 scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate); 5447 scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate);
5447 SetLayerPropertiesForTesting(parent.get(), 5448 SetLayerPropertiesForTesting(parent.get(),
5448 identity_matrix, 5449 identity_matrix,
5449 gfx::PointF(), 5450 gfx::Point3F(),
5450 gfx::PointF(), 5451 gfx::PointF(),
5451 gfx::Size(33, 31), 5452 gfx::Size(33, 31),
5452 false, 5453 false,
5453 true); 5454 true);
5454 5455
5455 scoped_refptr<ContentLayer> child = CreateDrawableContentLayer(&delegate); 5456 scoped_refptr<ContentLayer> child = CreateDrawableContentLayer(&delegate);
5456 SetLayerPropertiesForTesting(child.get(), 5457 SetLayerPropertiesForTesting(child.get(),
5457 identity_matrix, 5458 identity_matrix,
5458 gfx::PointF(), 5459 gfx::Point3F(),
5459 gfx::PointF(), 5460 gfx::PointF(),
5460 gfx::Size(13, 11), 5461 gfx::Size(13, 11),
5461 false, 5462 false,
5462 true); 5463 true);
5463 5464
5464 gfx::Transform replica_transform; 5465 gfx::Transform replica_transform;
5465 replica_transform.Scale(1.0, -1.0); 5466 replica_transform.Scale(1.0, -1.0);
5466 scoped_refptr<ContentLayer> replica = CreateDrawableContentLayer(&delegate); 5467 scoped_refptr<ContentLayer> replica = CreateDrawableContentLayer(&delegate);
5467 SetLayerPropertiesForTesting(replica.get(), 5468 SetLayerPropertiesForTesting(replica.get(),
5468 replica_transform, 5469 replica_transform,
5469 gfx::PointF(), 5470 gfx::Point3F(),
5470 gfx::PointF(), 5471 gfx::PointF(),
5471 gfx::Size(13, 11), 5472 gfx::Size(13, 11),
5472 false, 5473 false,
5473 true); 5474 true);
5474 5475
5475 // This layer should end up in the same surface as child, with the same draw 5476 // This layer should end up in the same surface as child, with the same draw
5476 // and screen space transforms. 5477 // and screen space transforms.
5477 scoped_refptr<ContentLayer> duplicate_child_non_owner = 5478 scoped_refptr<ContentLayer> duplicate_child_non_owner =
5478 CreateDrawableContentLayer(&delegate); 5479 CreateDrawableContentLayer(&delegate);
5479 SetLayerPropertiesForTesting(duplicate_child_non_owner.get(), 5480 SetLayerPropertiesForTesting(duplicate_child_non_owner.get(),
5480 identity_matrix, 5481 identity_matrix,
5481 gfx::PointF(), 5482 gfx::Point3F(),
5482 gfx::PointF(), 5483 gfx::PointF(),
5483 gfx::Size(13, 11), 5484 gfx::Size(13, 11),
5484 false, 5485 false,
5485 true); 5486 true);
5486 5487
5487 parent->AddChild(child); 5488 parent->AddChild(child);
5488 child->AddChild(duplicate_child_non_owner); 5489 child->AddChild(duplicate_child_non_owner);
5489 child->SetReplicaLayer(replica.get()); 5490 child->SetReplicaLayer(replica.get());
5490 5491
5491 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 5492 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
5576 5577
5577 TEST_F(LayerTreeHostCommonTest, TransparentChildRenderSurfaceCreation) { 5578 TEST_F(LayerTreeHostCommonTest, TransparentChildRenderSurfaceCreation) {
5578 scoped_refptr<Layer> root = Layer::Create(); 5579 scoped_refptr<Layer> root = Layer::Create();
5579 scoped_refptr<Layer> child = Layer::Create(); 5580 scoped_refptr<Layer> child = Layer::Create();
5580 scoped_refptr<LayerWithForcedDrawsContent> grand_child = 5581 scoped_refptr<LayerWithForcedDrawsContent> grand_child =
5581 make_scoped_refptr(new LayerWithForcedDrawsContent()); 5582 make_scoped_refptr(new LayerWithForcedDrawsContent());
5582 5583
5583 const gfx::Transform identity_matrix; 5584 const gfx::Transform identity_matrix;
5584 SetLayerPropertiesForTesting(root.get(), 5585 SetLayerPropertiesForTesting(root.get(),
5585 identity_matrix, 5586 identity_matrix,
5586 gfx::PointF(), 5587 gfx::Point3F(),
5587 gfx::PointF(), 5588 gfx::PointF(),
5588 gfx::Size(100, 100), 5589 gfx::Size(100, 100),
5589 true, 5590 true,
5590 false); 5591 false);
5591 SetLayerPropertiesForTesting(child.get(), 5592 SetLayerPropertiesForTesting(child.get(),
5592 identity_matrix, 5593 identity_matrix,
5593 gfx::PointF(), 5594 gfx::Point3F(),
5594 gfx::PointF(), 5595 gfx::PointF(),
5595 gfx::Size(10, 10), 5596 gfx::Size(10, 10),
5596 true, 5597 true,
5597 false); 5598 false);
5598 SetLayerPropertiesForTesting(grand_child.get(), 5599 SetLayerPropertiesForTesting(grand_child.get(),
5599 identity_matrix, 5600 identity_matrix,
5600 gfx::PointF(), 5601 gfx::Point3F(),
5601 gfx::PointF(), 5602 gfx::PointF(),
5602 gfx::Size(10, 10), 5603 gfx::Size(10, 10),
5603 true, 5604 true,
5604 false); 5605 false);
5605 5606
5606 root->AddChild(child); 5607 root->AddChild(child);
5607 child->AddChild(grand_child); 5608 child->AddChild(grand_child);
5608 child->SetOpacity(0.5f); 5609 child->SetOpacity(0.5f);
5609 5610
5610 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 5611 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
5611 host->SetRootLayer(root); 5612 host->SetRootLayer(root);
5612 5613
5613 ExecuteCalculateDrawProperties(root.get()); 5614 ExecuteCalculateDrawProperties(root.get());
5614 5615
5615 EXPECT_FALSE(child->render_surface()); 5616 EXPECT_FALSE(child->render_surface());
5616 } 5617 }
5617 5618
5618 TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) { 5619 TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) {
5619 FakeImplProxy proxy; 5620 FakeImplProxy proxy;
5620 TestSharedBitmapManager shared_bitmap_manager; 5621 TestSharedBitmapManager shared_bitmap_manager;
5621 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); 5622 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
5622 host_impl.CreatePendingTree(); 5623 host_impl.CreatePendingTree();
5623 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); 5624 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1);
5624 5625
5625 const gfx::Transform identity_matrix; 5626 const gfx::Transform identity_matrix;
5626 SetLayerPropertiesForTesting(root.get(), 5627 SetLayerPropertiesForTesting(root.get(),
5627 identity_matrix, 5628 identity_matrix,
5628 gfx::PointF(), 5629 gfx::Point3F(),
5629 gfx::PointF(), 5630 gfx::PointF(),
5630 gfx::Size(100, 100), 5631 gfx::Size(100, 100),
5631 true, 5632 true,
5632 false); 5633 false);
5633 root->SetDrawsContent(true); 5634 root->SetDrawsContent(true);
5634 5635
5635 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2); 5636 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2);
5636 SetLayerPropertiesForTesting(child.get(), 5637 SetLayerPropertiesForTesting(child.get(),
5637 identity_matrix, 5638 identity_matrix,
5638 gfx::PointF(), 5639 gfx::Point3F(),
5639 gfx::PointF(), 5640 gfx::PointF(),
5640 gfx::Size(50, 50), 5641 gfx::Size(50, 50),
5641 true, 5642 true,
5642 false); 5643 false);
5643 child->SetDrawsContent(true); 5644 child->SetDrawsContent(true);
5644 child->SetOpacity(0.0f); 5645 child->SetOpacity(0.0f);
5645 5646
5646 // Add opacity animation. 5647 // Add opacity animation.
5647 AddOpacityTransitionToController( 5648 AddOpacityTransitionToController(
5648 child->layer_animation_controller(), 10.0, 0.0f, 1.0f, false); 5649 child->layer_animation_controller(), 10.0, 0.0f, 1.0f, false);
(...skipping 22 matching lines...) Expand all
5671 5672
5672 root_ = Layer::Create(); 5673 root_ = Layer::Create();
5673 child_ = Layer::Create(); 5674 child_ = Layer::Create();
5674 grand_child_ = Layer::Create(); 5675 grand_child_ = Layer::Create();
5675 child_->AddChild(grand_child_.get()); 5676 child_->AddChild(grand_child_.get());
5676 root_->AddChild(child_.get()); 5677 root_->AddChild(child_.get());
5677 5678
5678 gfx::Transform identity_matrix; 5679 gfx::Transform identity_matrix;
5679 SetLayerPropertiesForTesting(root_.get(), 5680 SetLayerPropertiesForTesting(root_.get(),
5680 identity_matrix, 5681 identity_matrix,
5681 gfx::PointF(), 5682 gfx::Point3F(),
5682 gfx::PointF(), 5683 gfx::PointF(),
5683 gfx::Size(1, 1), 5684 gfx::Size(1, 1),
5684 true, 5685 true,
5685 false); 5686 false);
5686 SetLayerPropertiesForTesting(child_.get(), 5687 SetLayerPropertiesForTesting(child_.get(),
5687 identity_matrix, 5688 identity_matrix,
5688 gfx::PointF(), 5689 gfx::Point3F(),
5689 gfx::PointF(), 5690 gfx::PointF(),
5690 gfx::Size(1, 1), 5691 gfx::Size(1, 1),
5691 true, 5692 true,
5692 false); 5693 false);
5693 SetLayerPropertiesForTesting(grand_child_.get(), 5694 SetLayerPropertiesForTesting(grand_child_.get(),
5694 identity_matrix, 5695 identity_matrix,
5695 gfx::PointF(), 5696 gfx::Point3F(),
5696 gfx::PointF(), 5697 gfx::PointF(),
5697 gfx::Size(1, 1), 5698 gfx::Size(1, 1),
5698 true, 5699 true,
5699 false); 5700 false);
5700 5701
5701 child_->SetForceRenderSurface(std::tr1::get<1>(GetParam())); 5702 child_->SetForceRenderSurface(std::tr1::get<1>(GetParam()));
5702 5703
5703 host_ = FakeLayerTreeHost::Create(); 5704 host_ = FakeLayerTreeHost::Create();
5704 host_->SetRootLayer(root_); 5705 host_->SetRootLayer(root_);
5705 } 5706 }
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
5818 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayer) { 5819 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayer) {
5819 FakeImplProxy proxy; 5820 FakeImplProxy proxy;
5820 TestSharedBitmapManager shared_bitmap_manager; 5821 TestSharedBitmapManager shared_bitmap_manager;
5821 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); 5822 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
5822 host_impl.CreatePendingTree(); 5823 host_impl.CreatePendingTree();
5823 const gfx::Transform identity_matrix; 5824 const gfx::Transform identity_matrix;
5824 5825
5825 scoped_refptr<Layer> root = Layer::Create(); 5826 scoped_refptr<Layer> root = Layer::Create();
5826 SetLayerPropertiesForTesting(root.get(), 5827 SetLayerPropertiesForTesting(root.get(),
5827 identity_matrix, 5828 identity_matrix,
5828 gfx::PointF(), 5829 gfx::Point3F(),
5829 gfx::PointF(), 5830 gfx::PointF(),
5830 gfx::Size(50, 50), 5831 gfx::Size(50, 50),
5831 true, 5832 true,
5832 false); 5833 false);
5833 root->SetIsDrawable(true); 5834 root->SetIsDrawable(true);
5834 5835
5835 scoped_refptr<Layer> child = Layer::Create(); 5836 scoped_refptr<Layer> child = Layer::Create();
5836 SetLayerPropertiesForTesting(child.get(), 5837 SetLayerPropertiesForTesting(child.get(),
5837 identity_matrix, 5838 identity_matrix,
5838 gfx::PointF(), 5839 gfx::Point3F(),
5839 gfx::PointF(), 5840 gfx::PointF(),
5840 gfx::Size(40, 40), 5841 gfx::Size(40, 40),
5841 true, 5842 true,
5842 false); 5843 false);
5843 child->SetIsDrawable(true); 5844 child->SetIsDrawable(true);
5844 5845
5845 scoped_refptr<Layer> grand_child = Layer::Create(); 5846 scoped_refptr<Layer> grand_child = Layer::Create();
5846 SetLayerPropertiesForTesting(grand_child.get(), 5847 SetLayerPropertiesForTesting(grand_child.get(),
5847 identity_matrix, 5848 identity_matrix,
5848 gfx::PointF(), 5849 gfx::Point3F(),
5849 gfx::PointF(), 5850 gfx::PointF(),
5850 gfx::Size(30, 30), 5851 gfx::Size(30, 30),
5851 true, 5852 true,
5852 false); 5853 false);
5853 grand_child->SetIsDrawable(true); 5854 grand_child->SetIsDrawable(true);
5854 grand_child->SetHideLayerAndSubtree(true); 5855 grand_child->SetHideLayerAndSubtree(true);
5855 5856
5856 child->AddChild(grand_child); 5857 child->AddChild(grand_child);
5857 root->AddChild(child); 5858 root->AddChild(child);
5858 5859
(...skipping 17 matching lines...) Expand all
5876 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayerImpl) { 5877 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayerImpl) {
5877 FakeImplProxy proxy; 5878 FakeImplProxy proxy;
5878 TestSharedBitmapManager shared_bitmap_manager; 5879 TestSharedBitmapManager shared_bitmap_manager;
5879 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); 5880 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
5880 host_impl.CreatePendingTree(); 5881 host_impl.CreatePendingTree();
5881 const gfx::Transform identity_matrix; 5882 const gfx::Transform identity_matrix;
5882 5883
5883 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); 5884 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1);
5884 SetLayerPropertiesForTesting(root.get(), 5885 SetLayerPropertiesForTesting(root.get(),
5885 identity_matrix, 5886 identity_matrix,
5886 gfx::PointF(), 5887 gfx::Point3F(),
5887 gfx::PointF(), 5888 gfx::PointF(),
5888 gfx::Size(50, 50), 5889 gfx::Size(50, 50),
5889 true, 5890 true,
5890 false); 5891 false);
5891 root->SetDrawsContent(true); 5892 root->SetDrawsContent(true);
5892 5893
5893 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2); 5894 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2);
5894 SetLayerPropertiesForTesting(child.get(), 5895 SetLayerPropertiesForTesting(child.get(),
5895 identity_matrix, 5896 identity_matrix,
5896 gfx::PointF(), 5897 gfx::Point3F(),
5897 gfx::PointF(), 5898 gfx::PointF(),
5898 gfx::Size(40, 40), 5899 gfx::Size(40, 40),
5899 true, 5900 true,
5900 false); 5901 false);
5901 child->SetDrawsContent(true); 5902 child->SetDrawsContent(true);
5902 5903
5903 scoped_ptr<LayerImpl> grand_child = 5904 scoped_ptr<LayerImpl> grand_child =
5904 LayerImpl::Create(host_impl.pending_tree(), 3); 5905 LayerImpl::Create(host_impl.pending_tree(), 3);
5905 SetLayerPropertiesForTesting(grand_child.get(), 5906 SetLayerPropertiesForTesting(grand_child.get(),
5906 identity_matrix, 5907 identity_matrix,
5907 gfx::PointF(), 5908 gfx::Point3F(),
5908 gfx::PointF(), 5909 gfx::PointF(),
5909 gfx::Size(30, 30), 5910 gfx::Size(30, 30),
5910 true, 5911 true,
5911 false); 5912 false);
5912 grand_child->SetDrawsContent(true); 5913 grand_child->SetDrawsContent(true);
5913 grand_child->SetHideLayerAndSubtree(true); 5914 grand_child->SetHideLayerAndSubtree(true);
5914 5915
5915 child->AddChild(grand_child.Pass()); 5916 child->AddChild(grand_child.Pass());
5916 root->AddChild(child.Pass()); 5917 root->AddChild(child.Pass());
5917 5918
(...skipping 14 matching lines...) Expand all
5932 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayers) { 5933 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayers) {
5933 FakeImplProxy proxy; 5934 FakeImplProxy proxy;
5934 TestSharedBitmapManager shared_bitmap_manager; 5935 TestSharedBitmapManager shared_bitmap_manager;
5935 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); 5936 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
5936 host_impl.CreatePendingTree(); 5937 host_impl.CreatePendingTree();
5937 const gfx::Transform identity_matrix; 5938 const gfx::Transform identity_matrix;
5938 5939
5939 scoped_refptr<Layer> root = Layer::Create(); 5940 scoped_refptr<Layer> root = Layer::Create();
5940 SetLayerPropertiesForTesting(root.get(), 5941 SetLayerPropertiesForTesting(root.get(),
5941 identity_matrix, 5942 identity_matrix,
5942 gfx::PointF(), 5943 gfx::Point3F(),
5943 gfx::PointF(), 5944 gfx::PointF(),
5944 gfx::Size(50, 50), 5945 gfx::Size(50, 50),
5945 true, 5946 true,
5946 false); 5947 false);
5947 root->SetIsDrawable(true); 5948 root->SetIsDrawable(true);
5948 5949
5949 scoped_refptr<Layer> child = Layer::Create(); 5950 scoped_refptr<Layer> child = Layer::Create();
5950 SetLayerPropertiesForTesting(child.get(), 5951 SetLayerPropertiesForTesting(child.get(),
5951 identity_matrix, 5952 identity_matrix,
5952 gfx::PointF(), 5953 gfx::Point3F(),
5953 gfx::PointF(), 5954 gfx::PointF(),
5954 gfx::Size(40, 40), 5955 gfx::Size(40, 40),
5955 true, 5956 true,
5956 false); 5957 false);
5957 child->SetIsDrawable(true); 5958 child->SetIsDrawable(true);
5958 child->SetHideLayerAndSubtree(true); 5959 child->SetHideLayerAndSubtree(true);
5959 5960
5960 scoped_refptr<Layer> grand_child = Layer::Create(); 5961 scoped_refptr<Layer> grand_child = Layer::Create();
5961 SetLayerPropertiesForTesting(grand_child.get(), 5962 SetLayerPropertiesForTesting(grand_child.get(),
5962 identity_matrix, 5963 identity_matrix,
5963 gfx::PointF(), 5964 gfx::Point3F(),
5964 gfx::PointF(), 5965 gfx::PointF(),
5965 gfx::Size(30, 30), 5966 gfx::Size(30, 30),
5966 true, 5967 true,
5967 false); 5968 false);
5968 grand_child->SetIsDrawable(true); 5969 grand_child->SetIsDrawable(true);
5969 5970
5970 child->AddChild(grand_child); 5971 child->AddChild(grand_child);
5971 root->AddChild(child); 5972 root->AddChild(child);
5972 5973
5973 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 5974 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
(...skipping 15 matching lines...) Expand all
5989 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayersImpl) { 5990 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayersImpl) {
5990 FakeImplProxy proxy; 5991 FakeImplProxy proxy;
5991 TestSharedBitmapManager shared_bitmap_manager; 5992 TestSharedBitmapManager shared_bitmap_manager;
5992 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); 5993 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
5993 host_impl.CreatePendingTree(); 5994 host_impl.CreatePendingTree();
5994 const gfx::Transform identity_matrix; 5995 const gfx::Transform identity_matrix;
5995 5996
5996 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1); 5997 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1);
5997 SetLayerPropertiesForTesting(root.get(), 5998 SetLayerPropertiesForTesting(root.get(),
5998 identity_matrix, 5999 identity_matrix,
5999 gfx::PointF(), 6000 gfx::Point3F(),
6000 gfx::PointF(), 6001 gfx::PointF(),
6001 gfx::Size(50, 50), 6002 gfx::Size(50, 50),
6002 true, 6003 true,
6003 false); 6004 false);
6004 root->SetDrawsContent(true); 6005 root->SetDrawsContent(true);
6005 6006
6006 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2); 6007 scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2);
6007 SetLayerPropertiesForTesting(child.get(), 6008 SetLayerPropertiesForTesting(child.get(),
6008 identity_matrix, 6009 identity_matrix,
6009 gfx::PointF(), 6010 gfx::Point3F(),
6010 gfx::PointF(), 6011 gfx::PointF(),
6011 gfx::Size(40, 40), 6012 gfx::Size(40, 40),
6012 true, 6013 true,
6013 false); 6014 false);
6014 child->SetDrawsContent(true); 6015 child->SetDrawsContent(true);
6015 child->SetHideLayerAndSubtree(true); 6016 child->SetHideLayerAndSubtree(true);
6016 6017
6017 scoped_ptr<LayerImpl> grand_child = 6018 scoped_ptr<LayerImpl> grand_child =
6018 LayerImpl::Create(host_impl.pending_tree(), 3); 6019 LayerImpl::Create(host_impl.pending_tree(), 3);
6019 SetLayerPropertiesForTesting(grand_child.get(), 6020 SetLayerPropertiesForTesting(grand_child.get(),
6020 identity_matrix, 6021 identity_matrix,
6021 gfx::PointF(), 6022 gfx::Point3F(),
6022 gfx::PointF(), 6023 gfx::PointF(),
6023 gfx::Size(30, 30), 6024 gfx::Size(30, 30),
6024 true, 6025 true,
6025 false); 6026 false);
6026 grand_child->SetDrawsContent(true); 6027 grand_child->SetDrawsContent(true);
6027 6028
6028 child->AddChild(grand_child.Pass()); 6029 child->AddChild(grand_child.Pass());
6029 root->AddChild(child.Pass()); 6030 root->AddChild(child.Pass());
6030 6031
6031 LayerImplList render_surface_layer_list; 6032 LayerImplList render_surface_layer_list;
(...skipping 14 matching lines...) Expand all
6046 TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) { 6047 TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) {
6047 FakeImplProxy proxy; 6048 FakeImplProxy proxy;
6048 TestSharedBitmapManager shared_bitmap_manager; 6049 TestSharedBitmapManager shared_bitmap_manager;
6049 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); 6050 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
6050 host_impl.CreatePendingTree(); 6051 host_impl.CreatePendingTree();
6051 const gfx::Transform identity_matrix; 6052 const gfx::Transform identity_matrix;
6052 6053
6053 scoped_refptr<Layer> root = Layer::Create(); 6054 scoped_refptr<Layer> root = Layer::Create();
6054 SetLayerPropertiesForTesting(root.get(), 6055 SetLayerPropertiesForTesting(root.get(),
6055 identity_matrix, 6056 identity_matrix,
6056 gfx::PointF(), 6057 gfx::Point3F(),
6057 gfx::PointF(), 6058 gfx::PointF(),
6058 gfx::Size(50, 50), 6059 gfx::Size(50, 50),
6059 true, 6060 true,
6060 false); 6061 false);
6061 root->SetIsDrawable(true); 6062 root->SetIsDrawable(true);
6062 6063
6063 scoped_refptr<Layer> copy_grand_parent = Layer::Create(); 6064 scoped_refptr<Layer> copy_grand_parent = Layer::Create();
6064 SetLayerPropertiesForTesting(copy_grand_parent.get(), 6065 SetLayerPropertiesForTesting(copy_grand_parent.get(),
6065 identity_matrix, 6066 identity_matrix,
6066 gfx::PointF(), 6067 gfx::Point3F(),
6067 gfx::PointF(), 6068 gfx::PointF(),
6068 gfx::Size(40, 40), 6069 gfx::Size(40, 40),
6069 true, 6070 true,
6070 false); 6071 false);
6071 copy_grand_parent->SetIsDrawable(true); 6072 copy_grand_parent->SetIsDrawable(true);
6072 6073
6073 scoped_refptr<Layer> copy_parent = Layer::Create(); 6074 scoped_refptr<Layer> copy_parent = Layer::Create();
6074 SetLayerPropertiesForTesting(copy_parent.get(), 6075 SetLayerPropertiesForTesting(copy_parent.get(),
6075 identity_matrix, 6076 identity_matrix,
6076 gfx::PointF(), 6077 gfx::Point3F(),
6077 gfx::PointF(), 6078 gfx::PointF(),
6078 gfx::Size(30, 30), 6079 gfx::Size(30, 30),
6079 true, 6080 true,
6080 false); 6081 false);
6081 copy_parent->SetIsDrawable(true); 6082 copy_parent->SetIsDrawable(true);
6082 copy_parent->SetForceRenderSurface(true); 6083 copy_parent->SetForceRenderSurface(true);
6083 6084
6084 scoped_refptr<Layer> copy_layer = Layer::Create(); 6085 scoped_refptr<Layer> copy_layer = Layer::Create();
6085 SetLayerPropertiesForTesting(copy_layer.get(), 6086 SetLayerPropertiesForTesting(copy_layer.get(),
6086 identity_matrix, 6087 identity_matrix,
6087 gfx::PointF(), 6088 gfx::Point3F(),
6088 gfx::PointF(), 6089 gfx::PointF(),
6089 gfx::Size(20, 20), 6090 gfx::Size(20, 20),
6090 true, 6091 true,
6091 false); 6092 false);
6092 copy_layer->SetIsDrawable(true); 6093 copy_layer->SetIsDrawable(true);
6093 6094
6094 scoped_refptr<Layer> copy_child = Layer::Create(); 6095 scoped_refptr<Layer> copy_child = Layer::Create();
6095 SetLayerPropertiesForTesting(copy_child.get(), 6096 SetLayerPropertiesForTesting(copy_child.get(),
6096 identity_matrix, 6097 identity_matrix,
6097 gfx::PointF(), 6098 gfx::Point3F(),
6098 gfx::PointF(), 6099 gfx::PointF(),
6099 gfx::Size(20, 20), 6100 gfx::Size(20, 20),
6100 true, 6101 true,
6101 false); 6102 false);
6102 copy_child->SetIsDrawable(true); 6103 copy_child->SetIsDrawable(true);
6103 6104
6104 scoped_refptr<Layer> copy_grand_parent_sibling_before = Layer::Create(); 6105 scoped_refptr<Layer> copy_grand_parent_sibling_before = Layer::Create();
6105 SetLayerPropertiesForTesting(copy_grand_parent_sibling_before.get(), 6106 SetLayerPropertiesForTesting(copy_grand_parent_sibling_before.get(),
6106 identity_matrix, 6107 identity_matrix,
6107 gfx::PointF(), 6108 gfx::Point3F(),
6108 gfx::PointF(), 6109 gfx::PointF(),
6109 gfx::Size(40, 40), 6110 gfx::Size(40, 40),
6110 true, 6111 true,
6111 false); 6112 false);
6112 copy_grand_parent_sibling_before->SetIsDrawable(true); 6113 copy_grand_parent_sibling_before->SetIsDrawable(true);
6113 6114
6114 scoped_refptr<Layer> copy_grand_parent_sibling_after = Layer::Create(); 6115 scoped_refptr<Layer> copy_grand_parent_sibling_after = Layer::Create();
6115 SetLayerPropertiesForTesting(copy_grand_parent_sibling_after.get(), 6116 SetLayerPropertiesForTesting(copy_grand_parent_sibling_after.get(),
6116 identity_matrix, 6117 identity_matrix,
6117 gfx::PointF(), 6118 gfx::Point3F(),
6118 gfx::PointF(), 6119 gfx::PointF(),
6119 gfx::Size(40, 40), 6120 gfx::Size(40, 40),
6120 true, 6121 true,
6121 false); 6122 false);
6122 copy_grand_parent_sibling_after->SetIsDrawable(true); 6123 copy_grand_parent_sibling_after->SetIsDrawable(true);
6123 6124
6124 copy_layer->AddChild(copy_child); 6125 copy_layer->AddChild(copy_child);
6125 copy_parent->AddChild(copy_layer); 6126 copy_parent->AddChild(copy_layer);
6126 copy_grand_parent->AddChild(copy_parent); 6127 copy_grand_parent->AddChild(copy_parent);
6127 root->AddChild(copy_grand_parent_sibling_before); 6128 root->AddChild(copy_grand_parent_sibling_before);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
6193 TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) { 6194 TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) {
6194 FakeImplProxy proxy; 6195 FakeImplProxy proxy;
6195 TestSharedBitmapManager shared_bitmap_manager; 6196 TestSharedBitmapManager shared_bitmap_manager;
6196 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); 6197 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
6197 host_impl.CreatePendingTree(); 6198 host_impl.CreatePendingTree();
6198 const gfx::Transform identity_matrix; 6199 const gfx::Transform identity_matrix;
6199 6200
6200 scoped_refptr<Layer> root = Layer::Create(); 6201 scoped_refptr<Layer> root = Layer::Create();
6201 SetLayerPropertiesForTesting(root.get(), 6202 SetLayerPropertiesForTesting(root.get(),
6202 identity_matrix, 6203 identity_matrix,
6203 gfx::PointF(), 6204 gfx::Point3F(),
6204 gfx::PointF(), 6205 gfx::PointF(),
6205 gfx::Size(50, 50), 6206 gfx::Size(50, 50),
6206 true, 6207 true,
6207 false); 6208 false);
6208 root->SetIsDrawable(true); 6209 root->SetIsDrawable(true);
6209 6210
6210 scoped_refptr<Layer> copy_parent = Layer::Create(); 6211 scoped_refptr<Layer> copy_parent = Layer::Create();
6211 SetLayerPropertiesForTesting(copy_parent.get(), 6212 SetLayerPropertiesForTesting(copy_parent.get(),
6212 identity_matrix, 6213 identity_matrix,
6213 gfx::PointF(), 6214 gfx::Point3F(),
6214 gfx::PointF(), 6215 gfx::PointF(),
6215 gfx::Size(), 6216 gfx::Size(),
6216 true, 6217 true,
6217 false); 6218 false);
6218 copy_parent->SetIsDrawable(true); 6219 copy_parent->SetIsDrawable(true);
6219 copy_parent->SetMasksToBounds(true); 6220 copy_parent->SetMasksToBounds(true);
6220 6221
6221 scoped_refptr<Layer> copy_layer = Layer::Create(); 6222 scoped_refptr<Layer> copy_layer = Layer::Create();
6222 SetLayerPropertiesForTesting(copy_layer.get(), 6223 SetLayerPropertiesForTesting(copy_layer.get(),
6223 identity_matrix, 6224 identity_matrix,
6224 gfx::PointF(), 6225 gfx::Point3F(),
6225 gfx::PointF(), 6226 gfx::PointF(),
6226 gfx::Size(30, 30), 6227 gfx::Size(30, 30),
6227 true, 6228 true,
6228 false); 6229 false);
6229 copy_layer->SetIsDrawable(true); 6230 copy_layer->SetIsDrawable(true);
6230 6231
6231 scoped_refptr<Layer> copy_child = Layer::Create(); 6232 scoped_refptr<Layer> copy_child = Layer::Create();
6232 SetLayerPropertiesForTesting(copy_child.get(), 6233 SetLayerPropertiesForTesting(copy_child.get(),
6233 identity_matrix, 6234 identity_matrix,
6234 gfx::PointF(), 6235 gfx::Point3F(),
6235 gfx::PointF(), 6236 gfx::PointF(),
6236 gfx::Size(20, 20), 6237 gfx::Size(20, 20),
6237 true, 6238 true,
6238 false); 6239 false);
6239 copy_child->SetIsDrawable(true); 6240 copy_child->SetIsDrawable(true);
6240 6241
6241 copy_layer->AddChild(copy_child); 6242 copy_layer->AddChild(copy_child);
6242 copy_parent->AddChild(copy_layer); 6243 copy_parent->AddChild(copy_layer);
6243 root->AddChild(copy_parent); 6244 root->AddChild(copy_parent);
6244 6245
(...skipping 23 matching lines...) Expand all
6268 TEST_F(LayerTreeHostCommonTest, VisibleContentRectInsideSurface) { 6269 TEST_F(LayerTreeHostCommonTest, VisibleContentRectInsideSurface) {
6269 FakeImplProxy proxy; 6270 FakeImplProxy proxy;
6270 TestSharedBitmapManager shared_bitmap_manager; 6271 TestSharedBitmapManager shared_bitmap_manager;
6271 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); 6272 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
6272 host_impl.CreatePendingTree(); 6273 host_impl.CreatePendingTree();
6273 const gfx::Transform identity_matrix; 6274 const gfx::Transform identity_matrix;
6274 6275
6275 scoped_refptr<Layer> root = Layer::Create(); 6276 scoped_refptr<Layer> root = Layer::Create();
6276 SetLayerPropertiesForTesting(root.get(), 6277 SetLayerPropertiesForTesting(root.get(),
6277 identity_matrix, 6278 identity_matrix,
6278 gfx::PointF(), 6279 gfx::Point3F(),
6279 gfx::PointF(), 6280 gfx::PointF(),
6280 gfx::Size(50, 50), 6281 gfx::Size(50, 50),
6281 true, 6282 true,
6282 false); 6283 false);
6283 root->SetIsDrawable(true); 6284 root->SetIsDrawable(true);
6284 6285
6285 // The surface is moved slightly outside of the viewport. 6286 // The surface is moved slightly outside of the viewport.
6286 scoped_refptr<Layer> surface = Layer::Create(); 6287 scoped_refptr<Layer> surface = Layer::Create();
6287 SetLayerPropertiesForTesting(surface.get(), 6288 SetLayerPropertiesForTesting(surface.get(),
6288 identity_matrix, 6289 identity_matrix,
6289 gfx::PointF(), 6290 gfx::Point3F(),
6290 gfx::PointF(-10, -20), 6291 gfx::PointF(-10, -20),
6291 gfx::Size(), 6292 gfx::Size(),
6292 true, 6293 true,
6293 false); 6294 false);
6294 surface->SetForceRenderSurface(true); 6295 surface->SetForceRenderSurface(true);
6295 6296
6296 scoped_refptr<Layer> surface_child = Layer::Create(); 6297 scoped_refptr<Layer> surface_child = Layer::Create();
6297 SetLayerPropertiesForTesting(surface_child.get(), 6298 SetLayerPropertiesForTesting(surface_child.get(),
6298 identity_matrix, 6299 identity_matrix,
6299 gfx::PointF(), 6300 gfx::Point3F(),
6300 gfx::PointF(), 6301 gfx::PointF(),
6301 gfx::Size(50, 50), 6302 gfx::Size(50, 50),
6302 true, 6303 true,
6303 false); 6304 false);
6304 surface_child->SetIsDrawable(true); 6305 surface_child->SetIsDrawable(true);
6305 6306
6306 surface->AddChild(surface_child); 6307 surface->AddChild(surface_child);
6307 root->AddChild(surface); 6308 root->AddChild(surface);
6308 6309
6309 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 6310 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
6352 6353
6353 render_surface->SetForceRenderSurface(true); 6354 render_surface->SetForceRenderSurface(true);
6354 6355
6355 gfx::Transform scale_transform; 6356 gfx::Transform scale_transform;
6356 scale_transform.Scale(2, 2); 6357 scale_transform.Scale(2, 2);
6357 6358
6358 gfx::Transform identity_transform; 6359 gfx::Transform identity_transform;
6359 6360
6360 SetLayerPropertiesForTesting(root.get(), 6361 SetLayerPropertiesForTesting(root.get(),
6361 identity_transform, 6362 identity_transform,
6362 gfx::PointF(), 6363 gfx::Point3F(),
6363 gfx::PointF(), 6364 gfx::PointF(),
6364 gfx::Size(50, 50), 6365 gfx::Size(50, 50),
6365 true, 6366 true,
6366 false); 6367 false);
6367 SetLayerPropertiesForTesting(render_surface.get(), 6368 SetLayerPropertiesForTesting(render_surface.get(),
6368 identity_transform, 6369 identity_transform,
6369 gfx::PointF(), 6370 gfx::Point3F(),
6370 gfx::PointF(), 6371 gfx::PointF(),
6371 gfx::Size(10, 10), 6372 gfx::Size(10, 10),
6372 true, 6373 true,
6373 false); 6374 false);
6374 SetLayerPropertiesForTesting(clip_parent.get(), 6375 SetLayerPropertiesForTesting(clip_parent.get(),
6375 scale_transform, 6376 scale_transform,
6376 gfx::PointF(), 6377 gfx::Point3F(),
6377 gfx::PointF(1.f, 1.f), 6378 gfx::PointF(1.f, 1.f),
6378 gfx::Size(10, 10), 6379 gfx::Size(10, 10),
6379 true, 6380 true,
6380 false); 6381 false);
6381 SetLayerPropertiesForTesting(intervening.get(), 6382 SetLayerPropertiesForTesting(intervening.get(),
6382 identity_transform, 6383 identity_transform,
6383 gfx::PointF(), 6384 gfx::Point3F(),
6384 gfx::PointF(1.f, 1.f), 6385 gfx::PointF(1.f, 1.f),
6385 gfx::Size(5, 5), 6386 gfx::Size(5, 5),
6386 true, 6387 true,
6387 false); 6388 false);
6388 SetLayerPropertiesForTesting(clip_child.get(), 6389 SetLayerPropertiesForTesting(clip_child.get(),
6389 identity_transform, 6390 identity_transform,
6390 gfx::PointF(), 6391 gfx::Point3F(),
6391 gfx::PointF(1.f, 1.f), 6392 gfx::PointF(1.f, 1.f),
6392 gfx::Size(10, 10), 6393 gfx::Size(10, 10),
6393 true, 6394 true,
6394 false); 6395 false);
6395 6396
6396 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 6397 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
6397 host->SetRootLayer(root); 6398 host->SetRootLayer(root);
6398 6399
6399 ExecuteCalculateDrawProperties(root.get()); 6400 ExecuteCalculateDrawProperties(root.get());
6400 6401
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
6456 6457
6457 render_surface1->SetForceRenderSurface(true); 6458 render_surface1->SetForceRenderSurface(true);
6458 render_surface2->SetForceRenderSurface(true); 6459 render_surface2->SetForceRenderSurface(true);
6459 6460
6460 gfx::Transform translation_transform; 6461 gfx::Transform translation_transform;
6461 translation_transform.Translate(2, 2); 6462 translation_transform.Translate(2, 2);
6462 6463
6463 gfx::Transform identity_transform; 6464 gfx::Transform identity_transform;
6464 SetLayerPropertiesForTesting(root.get(), 6465 SetLayerPropertiesForTesting(root.get(),
6465 identity_transform, 6466 identity_transform,
6466 gfx::PointF(), 6467 gfx::Point3F(),
6467 gfx::PointF(), 6468 gfx::PointF(),
6468 gfx::Size(50, 50), 6469 gfx::Size(50, 50),
6469 true, 6470 true,
6470 false); 6471 false);
6471 SetLayerPropertiesForTesting(clip_parent.get(), 6472 SetLayerPropertiesForTesting(clip_parent.get(),
6472 translation_transform, 6473 translation_transform,
6473 gfx::PointF(), 6474 gfx::Point3F(),
6474 gfx::PointF(1.f, 1.f), 6475 gfx::PointF(1.f, 1.f),
6475 gfx::Size(40, 40), 6476 gfx::Size(40, 40),
6476 true, 6477 true,
6477 false); 6478 false);
6478 SetLayerPropertiesForTesting(render_surface1.get(), 6479 SetLayerPropertiesForTesting(render_surface1.get(),
6479 identity_transform, 6480 identity_transform,
6480 gfx::PointF(), 6481 gfx::Point3F(),
6481 gfx::PointF(), 6482 gfx::PointF(),
6482 gfx::Size(10, 10), 6483 gfx::Size(10, 10),
6483 true, 6484 true,
6484 false); 6485 false);
6485 SetLayerPropertiesForTesting(intervening.get(), 6486 SetLayerPropertiesForTesting(intervening.get(),
6486 identity_transform, 6487 identity_transform,
6487 gfx::PointF(), 6488 gfx::Point3F(),
6488 gfx::PointF(1.f, 1.f), 6489 gfx::PointF(1.f, 1.f),
6489 gfx::Size(5, 5), 6490 gfx::Size(5, 5),
6490 true, 6491 true,
6491 false); 6492 false);
6492 SetLayerPropertiesForTesting(render_surface2.get(), 6493 SetLayerPropertiesForTesting(render_surface2.get(),
6493 identity_transform, 6494 identity_transform,
6494 gfx::PointF(), 6495 gfx::Point3F(),
6495 gfx::PointF(), 6496 gfx::PointF(),
6496 gfx::Size(10, 10), 6497 gfx::Size(10, 10),
6497 true, 6498 true,
6498 false); 6499 false);
6499 SetLayerPropertiesForTesting(clip_child.get(), 6500 SetLayerPropertiesForTesting(clip_child.get(),
6500 identity_transform, 6501 identity_transform,
6501 gfx::PointF(), 6502 gfx::Point3F(),
6502 gfx::PointF(-10.f, -10.f), 6503 gfx::PointF(-10.f, -10.f),
6503 gfx::Size(60, 60), 6504 gfx::Size(60, 60),
6504 true, 6505 true,
6505 false); 6506 false);
6506 6507
6507 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 6508 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
6508 host->SetRootLayer(root); 6509 host->SetRootLayer(root);
6509 6510
6510 ExecuteCalculateDrawProperties(root.get()); 6511 ExecuteCalculateDrawProperties(root.get());
6511 6512
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
6585 6586
6586 render_surface1->SetForceRenderSurface(true); 6587 render_surface1->SetForceRenderSurface(true);
6587 render_surface2->SetForceRenderSurface(true); 6588 render_surface2->SetForceRenderSurface(true);
6588 6589
6589 gfx::Transform translation_transform; 6590 gfx::Transform translation_transform;
6590 translation_transform.Translate(2, 2); 6591 translation_transform.Translate(2, 2);
6591 6592
6592 gfx::Transform identity_transform; 6593 gfx::Transform identity_transform;
6593 SetLayerPropertiesForTesting(root.get(), 6594 SetLayerPropertiesForTesting(root.get(),
6594 identity_transform, 6595 identity_transform,
6595 gfx::PointF(), 6596 gfx::Point3F(),
6596 gfx::PointF(), 6597 gfx::PointF(),
6597 gfx::Size(50, 50), 6598 gfx::Size(50, 50),
6598 true, 6599 true,
6599 false); 6600 false);
6600 SetLayerPropertiesForTesting(clip_parent.get(), 6601 SetLayerPropertiesForTesting(clip_parent.get(),
6601 translation_transform, 6602 translation_transform,
6602 gfx::PointF(), 6603 gfx::Point3F(),
6603 gfx::PointF(1.f, 1.f), 6604 gfx::PointF(1.f, 1.f),
6604 gfx::Size(40, 40), 6605 gfx::Size(40, 40),
6605 true, 6606 true,
6606 false); 6607 false);
6607 SetLayerPropertiesForTesting(render_surface1.get(), 6608 SetLayerPropertiesForTesting(render_surface1.get(),
6608 identity_transform, 6609 identity_transform,
6609 gfx::PointF(), 6610 gfx::Point3F(),
6610 gfx::PointF(), 6611 gfx::PointF(),
6611 gfx::Size(10, 10), 6612 gfx::Size(10, 10),
6612 true, 6613 true,
6613 false); 6614 false);
6614 SetLayerPropertiesForTesting(intervening.get(), 6615 SetLayerPropertiesForTesting(intervening.get(),
6615 identity_transform, 6616 identity_transform,
6616 gfx::PointF(), 6617 gfx::Point3F(),
6617 gfx::PointF(1.f, 1.f), 6618 gfx::PointF(1.f, 1.f),
6618 gfx::Size(5, 5), 6619 gfx::Size(5, 5),
6619 true, 6620 true,
6620 false); 6621 false);
6621 SetLayerPropertiesForTesting(render_surface2.get(), 6622 SetLayerPropertiesForTesting(render_surface2.get(),
6622 identity_transform, 6623 identity_transform,
6623 gfx::PointF(), 6624 gfx::Point3F(),
6624 gfx::PointF(), 6625 gfx::PointF(),
6625 gfx::Size(10, 10), 6626 gfx::Size(10, 10),
6626 true, 6627 true,
6627 false); 6628 false);
6628 SetLayerPropertiesForTesting(clip_child.get(), 6629 SetLayerPropertiesForTesting(clip_child.get(),
6629 identity_transform, 6630 identity_transform,
6630 gfx::PointF(), 6631 gfx::Point3F(),
6631 gfx::PointF(-10.f, -10.f), 6632 gfx::PointF(-10.f, -10.f),
6632 gfx::Size(60, 60), 6633 gfx::Size(60, 60),
6633 true, 6634 true,
6634 false); 6635 false);
6635 6636
6636 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 6637 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
6637 host->SetRootLayer(root); 6638 host->SetRootLayer(root);
6638 6639
6639 ExecuteCalculateDrawProperties(root.get()); 6640 ExecuteCalculateDrawProperties(root.get());
6640 6641
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
6701 clip_child->AddChild(child); 6702 clip_child->AddChild(child);
6702 6703
6703 clip_child->SetClipParent(clip_parent.get()); 6704 clip_child->SetClipParent(clip_parent.get());
6704 6705
6705 intervening->SetMasksToBounds(true); 6706 intervening->SetMasksToBounds(true);
6706 clip_parent->SetMasksToBounds(true); 6707 clip_parent->SetMasksToBounds(true);
6707 6708
6708 gfx::Transform identity_transform; 6709 gfx::Transform identity_transform;
6709 SetLayerPropertiesForTesting(root.get(), 6710 SetLayerPropertiesForTesting(root.get(),
6710 identity_transform, 6711 identity_transform,
6711 gfx::PointF(), 6712 gfx::Point3F(),
6712 gfx::PointF(), 6713 gfx::PointF(),
6713 gfx::Size(50, 50), 6714 gfx::Size(50, 50),
6714 true, 6715 true,
6715 false); 6716 false);
6716 SetLayerPropertiesForTesting(clip_parent.get(), 6717 SetLayerPropertiesForTesting(clip_parent.get(),
6717 identity_transform, 6718 identity_transform,
6718 gfx::PointF(), 6719 gfx::Point3F(),
6719 gfx::PointF(), 6720 gfx::PointF(),
6720 gfx::Size(40, 40), 6721 gfx::Size(40, 40),
6721 true, 6722 true,
6722 false); 6723 false);
6723 SetLayerPropertiesForTesting(intervening.get(), 6724 SetLayerPropertiesForTesting(intervening.get(),
6724 identity_transform, 6725 identity_transform,
6725 gfx::PointF(), 6726 gfx::Point3F(),
6726 gfx::PointF(), 6727 gfx::PointF(),
6727 gfx::Size(5, 5), 6728 gfx::Size(5, 5),
6728 true, 6729 true,
6729 false); 6730 false);
6730 SetLayerPropertiesForTesting(clip_child.get(), 6731 SetLayerPropertiesForTesting(clip_child.get(),
6731 identity_transform, 6732 identity_transform,
6732 gfx::PointF(), 6733 gfx::Point3F(),
6733 gfx::PointF(), 6734 gfx::PointF(),
6734 gfx::Size(60, 60), 6735 gfx::Size(60, 60),
6735 true, 6736 true,
6736 false); 6737 false);
6737 SetLayerPropertiesForTesting(child.get(), 6738 SetLayerPropertiesForTesting(child.get(),
6738 identity_transform, 6739 identity_transform,
6739 gfx::PointF(), 6740 gfx::Point3F(),
6740 gfx::PointF(), 6741 gfx::PointF(),
6741 gfx::Size(60, 60), 6742 gfx::Size(60, 60),
6742 true, 6743 true,
6743 false); 6744 false);
6744 6745
6745 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 6746 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
6746 host->SetRootLayer(root); 6747 host->SetRootLayer(root);
6747 6748
6748 ExecuteCalculateDrawProperties(root.get()); 6749 ExecuteCalculateDrawProperties(root.get());
6749 6750
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
6788 render_surface2->AddChild(non_clip_child); 6789 render_surface2->AddChild(non_clip_child);
6789 6790
6790 clip_child->SetClipParent(clip_parent.get()); 6791 clip_child->SetClipParent(clip_parent.get());
6791 6792
6792 clip_parent->SetMasksToBounds(true); 6793 clip_parent->SetMasksToBounds(true);
6793 render_surface1->SetMasksToBounds(true); 6794 render_surface1->SetMasksToBounds(true);
6794 6795
6795 gfx::Transform identity_transform; 6796 gfx::Transform identity_transform;
6796 SetLayerPropertiesForTesting(root.get(), 6797 SetLayerPropertiesForTesting(root.get(),
6797 identity_transform, 6798 identity_transform,
6798 gfx::PointF(), 6799 gfx::Point3F(),
6799 gfx::PointF(), 6800 gfx::PointF(),
6800 gfx::Size(15, 15), 6801 gfx::Size(15, 15),
6801 true, 6802 true,
6802 false); 6803 false);
6803 SetLayerPropertiesForTesting(clip_parent.get(), 6804 SetLayerPropertiesForTesting(clip_parent.get(),
6804 identity_transform, 6805 identity_transform,
6805 gfx::PointF(), 6806 gfx::Point3F(),
6806 gfx::PointF(), 6807 gfx::PointF(),
6807 gfx::Size(10, 10), 6808 gfx::Size(10, 10),
6808 true, 6809 true,
6809 false); 6810 false);
6810 SetLayerPropertiesForTesting(render_surface1.get(), 6811 SetLayerPropertiesForTesting(render_surface1.get(),
6811 identity_transform, 6812 identity_transform,
6812 gfx::PointF(), 6813 gfx::Point3F(),
6813 gfx::PointF(5, 5), 6814 gfx::PointF(5, 5),
6814 gfx::Size(5, 5), 6815 gfx::Size(5, 5),
6815 true, 6816 true,
6816 false); 6817 false);
6817 SetLayerPropertiesForTesting(render_surface2.get(), 6818 SetLayerPropertiesForTesting(render_surface2.get(),
6818 identity_transform, 6819 identity_transform,
6819 gfx::PointF(), 6820 gfx::Point3F(),
6820 gfx::PointF(), 6821 gfx::PointF(),
6821 gfx::Size(5, 5), 6822 gfx::Size(5, 5),
6822 true, 6823 true,
6823 false); 6824 false);
6824 SetLayerPropertiesForTesting(clip_child.get(), 6825 SetLayerPropertiesForTesting(clip_child.get(),
6825 identity_transform, 6826 identity_transform,
6826 gfx::PointF(), 6827 gfx::Point3F(),
6827 gfx::PointF(-1, 1), 6828 gfx::PointF(-1, 1),
6828 gfx::Size(10, 10), 6829 gfx::Size(10, 10),
6829 true, 6830 true,
6830 false); 6831 false);
6831 SetLayerPropertiesForTesting(non_clip_child.get(), 6832 SetLayerPropertiesForTesting(non_clip_child.get(),
6832 identity_transform, 6833 identity_transform,
6833 gfx::PointF(), 6834 gfx::Point3F(),
6834 gfx::PointF(), 6835 gfx::PointF(),
6835 gfx::Size(5, 5), 6836 gfx::Size(5, 5),
6836 true, 6837 true,
6837 false); 6838 false);
6838 6839
6839 render_surface1->SetForceRenderSurface(true); 6840 render_surface1->SetForceRenderSurface(true);
6840 render_surface2->SetForceRenderSurface(true); 6841 render_surface2->SetForceRenderSurface(true);
6841 6842
6842 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 6843 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
6843 host->SetRootLayer(root); 6844 host->SetRootLayer(root);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
6883 scoped_ptr<LayerImpl> root = 6884 scoped_ptr<LayerImpl> root =
6884 LayerImpl::Create(host_impl.active_tree(), 12345); 6885 LayerImpl::Create(host_impl.active_tree(), 12345);
6885 scoped_ptr<LayerImpl> child1 = 6886 scoped_ptr<LayerImpl> child1 =
6886 LayerImpl::Create(host_impl.active_tree(), 123456); 6887 LayerImpl::Create(host_impl.active_tree(), 123456);
6887 scoped_ptr<LayerImpl> child2 = 6888 scoped_ptr<LayerImpl> child2 =
6888 LayerImpl::Create(host_impl.active_tree(), 1234567); 6889 LayerImpl::Create(host_impl.active_tree(), 1234567);
6889 scoped_ptr<LayerImpl> child3 = 6890 scoped_ptr<LayerImpl> child3 =
6890 LayerImpl::Create(host_impl.active_tree(), 12345678); 6891 LayerImpl::Create(host_impl.active_tree(), 12345678);
6891 6892
6892 gfx::Transform identity_matrix; 6893 gfx::Transform identity_matrix;
6893 gfx::PointF anchor; 6894 gfx::Point3F transform_origin;
6894 gfx::PointF position; 6895 gfx::PointF position;
6895 gfx::Size bounds(100, 100); 6896 gfx::Size bounds(100, 100);
6896 SetLayerPropertiesForTesting(root.get(), 6897 SetLayerPropertiesForTesting(root.get(),
6897 identity_matrix, 6898 identity_matrix,
6898 anchor, 6899 transform_origin,
6899 position, 6900 position,
6900 bounds, 6901 bounds,
6901 true, 6902 true,
6902 false); 6903 false);
6903 root->SetDrawsContent(true); 6904 root->SetDrawsContent(true);
6904 6905
6905 // This layer structure normally forces render surface due to preserves3d 6906 // This layer structure normally forces render surface due to preserves3d
6906 // behavior. 6907 // behavior.
6907 SetLayerPropertiesForTesting(child1.get(), 6908 SetLayerPropertiesForTesting(child1.get(),
6908 identity_matrix, 6909 identity_matrix,
6909 anchor, 6910 transform_origin,
6910 position, 6911 position,
6911 bounds, 6912 bounds,
6912 false, 6913 false,
6913 true); 6914 true);
6914 child1->SetDrawsContent(true); 6915 child1->SetDrawsContent(true);
6915 SetLayerPropertiesForTesting(child2.get(), 6916 SetLayerPropertiesForTesting(child2.get(),
6916 identity_matrix, 6917 identity_matrix,
6917 anchor, 6918 transform_origin,
6918 position, 6919 position,
6919 bounds, 6920 bounds,
6920 true, 6921 true,
6921 false); 6922 false);
6922 child2->SetDrawsContent(true); 6923 child2->SetDrawsContent(true);
6923 SetLayerPropertiesForTesting(child3.get(), 6924 SetLayerPropertiesForTesting(child3.get(),
6924 identity_matrix, 6925 identity_matrix,
6925 anchor, 6926 transform_origin,
6926 position, 6927 position,
6927 bounds, 6928 bounds,
6928 true, 6929 true,
6929 false); 6930 false);
6930 child3->SetDrawsContent(true); 6931 child3->SetDrawsContent(true);
6931 6932
6932 child2->SetIs3dSorted(true); 6933 child2->SetIs3dSorted(true);
6933 child3->SetIs3dSorted(true); 6934 child3->SetIs3dSorted(true);
6934 6935
6935 child2->AddChild(child3.Pass()); 6936 child2->AddChild(child3.Pass());
(...skipping 26 matching lines...) Expand all
6962 scoped_refptr<Layer> render_surface = Layer::Create(); 6963 scoped_refptr<Layer> render_surface = Layer::Create();
6963 scoped_refptr<LayerWithForcedDrawsContent> child = 6964 scoped_refptr<LayerWithForcedDrawsContent> child =
6964 make_scoped_refptr(new LayerWithForcedDrawsContent); 6965 make_scoped_refptr(new LayerWithForcedDrawsContent);
6965 6966
6966 root->AddChild(render_surface); 6967 root->AddChild(render_surface);
6967 render_surface->AddChild(child); 6968 render_surface->AddChild(child);
6968 6969
6969 gfx::Transform identity_transform; 6970 gfx::Transform identity_transform;
6970 SetLayerPropertiesForTesting(root.get(), 6971 SetLayerPropertiesForTesting(root.get(),
6971 identity_transform, 6972 identity_transform,
6972 gfx::PointF(), 6973 gfx::Point3F(),
6973 gfx::PointF(), 6974 gfx::PointF(),
6974 gfx::Size(50, 50), 6975 gfx::Size(50, 50),
6975 true, 6976 true,
6976 false); 6977 false);
6977 SetLayerPropertiesForTesting(render_surface.get(), 6978 SetLayerPropertiesForTesting(render_surface.get(),
6978 identity_transform, 6979 identity_transform,
6979 gfx::PointF(), 6980 gfx::Point3F(),
6980 gfx::PointF(), 6981 gfx::PointF(),
6981 gfx::Size(30, 30), 6982 gfx::Size(30, 30),
6982 false, 6983 false,
6983 true); 6984 true);
6984 SetLayerPropertiesForTesting(child.get(), 6985 SetLayerPropertiesForTesting(child.get(),
6985 identity_transform, 6986 identity_transform,
6986 gfx::PointF(), 6987 gfx::Point3F(),
6987 gfx::PointF(), 6988 gfx::PointF(),
6988 gfx::Size(20, 20), 6989 gfx::Size(20, 20),
6989 true, 6990 true,
6990 false); 6991 false);
6991 6992
6992 root->SetShouldFlattenTransform(false); 6993 root->SetShouldFlattenTransform(false);
6993 root->SetIs3dSorted(true); 6994 root->SetIs3dSorted(true);
6994 render_surface->SetDoubleSided(false); 6995 render_surface->SetDoubleSided(false);
6995 render_surface->SetForceRenderSurface(true); 6996 render_surface->SetForceRenderSurface(true);
6996 6997
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
7044 scroll_parent_border->AddChild(scroll_parent_clip); 7045 scroll_parent_border->AddChild(scroll_parent_clip);
7045 scroll_parent_clip->AddChild(scroll_parent); 7046 scroll_parent_clip->AddChild(scroll_parent);
7046 7047
7047 scroll_parent_clip->SetMasksToBounds(true); 7048 scroll_parent_clip->SetMasksToBounds(true);
7048 7049
7049 scroll_child->SetScrollParent(scroll_parent.get()); 7050 scroll_child->SetScrollParent(scroll_parent.get());
7050 7051
7051 gfx::Transform identity_transform; 7052 gfx::Transform identity_transform;
7052 SetLayerPropertiesForTesting(root.get(), 7053 SetLayerPropertiesForTesting(root.get(),
7053 identity_transform, 7054 identity_transform,
7054 gfx::PointF(), 7055 gfx::Point3F(),
7055 gfx::PointF(), 7056 gfx::PointF(),
7056 gfx::Size(50, 50), 7057 gfx::Size(50, 50),
7057 true, 7058 true,
7058 false); 7059 false);
7059 SetLayerPropertiesForTesting(scroll_parent_border.get(), 7060 SetLayerPropertiesForTesting(scroll_parent_border.get(),
7060 identity_transform, 7061 identity_transform,
7061 gfx::PointF(), 7062 gfx::Point3F(),
7062 gfx::PointF(), 7063 gfx::PointF(),
7063 gfx::Size(40, 40), 7064 gfx::Size(40, 40),
7064 true, 7065 true,
7065 false); 7066 false);
7066 SetLayerPropertiesForTesting(scroll_parent_clip.get(), 7067 SetLayerPropertiesForTesting(scroll_parent_clip.get(),
7067 identity_transform, 7068 identity_transform,
7068 gfx::PointF(), 7069 gfx::Point3F(),
7069 gfx::PointF(), 7070 gfx::PointF(),
7070 gfx::Size(30, 30), 7071 gfx::Size(30, 30),
7071 true, 7072 true,
7072 false); 7073 false);
7073 SetLayerPropertiesForTesting(scroll_parent.get(), 7074 SetLayerPropertiesForTesting(scroll_parent.get(),
7074 identity_transform, 7075 identity_transform,
7075 gfx::PointF(), 7076 gfx::Point3F(),
7076 gfx::PointF(), 7077 gfx::PointF(),
7077 gfx::Size(50, 50), 7078 gfx::Size(50, 50),
7078 true, 7079 true,
7079 false); 7080 false);
7080 SetLayerPropertiesForTesting(scroll_child.get(), 7081 SetLayerPropertiesForTesting(scroll_child.get(),
7081 identity_transform, 7082 identity_transform,
7082 gfx::PointF(), 7083 gfx::Point3F(),
7083 gfx::PointF(), 7084 gfx::PointF(),
7084 gfx::Size(50, 50), 7085 gfx::Size(50, 50),
7085 true, 7086 true,
7086 false); 7087 false);
7087 7088
7088 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 7089 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
7089 host->SetRootLayer(root); 7090 host->SetRootLayer(root);
7090 7091
7091 ExecuteCalculateDrawProperties(root.get()); 7092 ExecuteCalculateDrawProperties(root.get());
7092 7093
(...skipping 11 matching lines...) Expand all
7104 make_scoped_refptr(new LayerWithForcedDrawsContent); 7105 make_scoped_refptr(new LayerWithForcedDrawsContent);
7105 scoped_refptr<LayerWithForcedDrawsContent> child = 7106 scoped_refptr<LayerWithForcedDrawsContent> child =
7106 make_scoped_refptr(new LayerWithForcedDrawsContent); 7107 make_scoped_refptr(new LayerWithForcedDrawsContent);
7107 7108
7108 root->AddChild(parent); 7109 root->AddChild(parent);
7109 parent->AddChild(child); 7110 parent->AddChild(child);
7110 7111
7111 gfx::Transform identity_transform; 7112 gfx::Transform identity_transform;
7112 SetLayerPropertiesForTesting(root.get(), 7113 SetLayerPropertiesForTesting(root.get(),
7113 identity_transform, 7114 identity_transform,
7114 gfx::PointF(), 7115 gfx::Point3F(),
7115 gfx::PointF(), 7116 gfx::PointF(),
7116 gfx::Size(50, 50), 7117 gfx::Size(50, 50),
7117 true, 7118 true,
7118 true); 7119 true);
7119 root->SetForceRenderSurface(true); 7120 root->SetForceRenderSurface(true);
7120 SetLayerPropertiesForTesting(parent.get(), 7121 SetLayerPropertiesForTesting(parent.get(),
7121 identity_transform, 7122 identity_transform,
7122 gfx::PointF(), 7123 gfx::Point3F(),
7123 gfx::PointF(), 7124 gfx::PointF(),
7124 gfx::Size(30, 30), 7125 gfx::Size(30, 30),
7125 true, 7126 true,
7126 true); 7127 true);
7127 parent->SetForceRenderSurface(true); 7128 parent->SetForceRenderSurface(true);
7128 SetLayerPropertiesForTesting(child.get(), 7129 SetLayerPropertiesForTesting(child.get(),
7129 identity_transform, 7130 identity_transform,
7130 gfx::PointF(), 7131 gfx::Point3F(),
7131 gfx::PointF(), 7132 gfx::PointF(),
7132 gfx::Size(20, 20), 7133 gfx::Size(20, 20),
7133 true, 7134 true,
7134 true); 7135 true);
7135 child->SetForceRenderSurface(true); 7136 child->SetForceRenderSurface(true);
7136 7137
7137 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 7138 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
7138 host->SetRootLayer(root); 7139 host->SetRootLayer(root);
7139 7140
7140 ExecuteCalculateDrawProperties(root.get()); 7141 ExecuteCalculateDrawProperties(root.get());
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
7185 7186
7186 root->AddChild(scroll_child); 7187 root->AddChild(scroll_child);
7187 7188
7188 scroll_parent_clip->SetMasksToBounds(true); 7189 scroll_parent_clip->SetMasksToBounds(true);
7189 7190
7190 scroll_child->SetScrollParent(scroll_parent.get()); 7191 scroll_child->SetScrollParent(scroll_parent.get());
7191 7192
7192 gfx::Transform identity_transform; 7193 gfx::Transform identity_transform;
7193 SetLayerPropertiesForTesting(root.get(), 7194 SetLayerPropertiesForTesting(root.get(),
7194 identity_transform, 7195 identity_transform,
7195 gfx::PointF(), 7196 gfx::Point3F(),
7196 gfx::PointF(), 7197 gfx::PointF(),
7197 gfx::Size(50, 50), 7198 gfx::Size(50, 50),
7198 true, 7199 true,
7199 false); 7200 false);
7200 SetLayerPropertiesForTesting(scroll_parent_border.get(), 7201 SetLayerPropertiesForTesting(scroll_parent_border.get(),
7201 identity_transform, 7202 identity_transform,
7202 gfx::PointF(), 7203 gfx::Point3F(),
7203 gfx::PointF(), 7204 gfx::PointF(),
7204 gfx::Size(40, 40), 7205 gfx::Size(40, 40),
7205 true, 7206 true,
7206 false); 7207 false);
7207 SetLayerPropertiesForTesting(scroll_parent_clip.get(), 7208 SetLayerPropertiesForTesting(scroll_parent_clip.get(),
7208 identity_transform, 7209 identity_transform,
7209 gfx::PointF(), 7210 gfx::Point3F(),
7210 gfx::PointF(), 7211 gfx::PointF(),
7211 gfx::Size(30, 30), 7212 gfx::Size(30, 30),
7212 true, 7213 true,
7213 false); 7214 false);
7214 SetLayerPropertiesForTesting(scroll_parent.get(), 7215 SetLayerPropertiesForTesting(scroll_parent.get(),
7215 identity_transform, 7216 identity_transform,
7216 gfx::PointF(), 7217 gfx::Point3F(),
7217 gfx::PointF(), 7218 gfx::PointF(),
7218 gfx::Size(50, 50), 7219 gfx::Size(50, 50),
7219 true, 7220 true,
7220 false); 7221 false);
7221 SetLayerPropertiesForTesting(scroll_child.get(), 7222 SetLayerPropertiesForTesting(scroll_child.get(),
7222 identity_transform, 7223 identity_transform,
7223 gfx::PointF(), 7224 gfx::Point3F(),
7224 gfx::PointF(), 7225 gfx::PointF(),
7225 gfx::Size(50, 50), 7226 gfx::Size(50, 50),
7226 true, 7227 true,
7227 false); 7228 false);
7228 7229
7229 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 7230 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
7230 host->SetRootLayer(root); 7231 host->SetRootLayer(root);
7231 7232
7232 ExecuteCalculateDrawProperties(root.get()); 7233 ExecuteCalculateDrawProperties(root.get());
7233 7234
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
7277 7278
7278 scroll_parent_clip->SetMasksToBounds(true); 7279 scroll_parent_clip->SetMasksToBounds(true);
7279 scroll_grandparent_clip->SetMasksToBounds(true); 7280 scroll_grandparent_clip->SetMasksToBounds(true);
7280 7281
7281 scroll_child->SetScrollParent(scroll_parent.get()); 7282 scroll_child->SetScrollParent(scroll_parent.get());
7282 scroll_parent_border->SetScrollParent(scroll_grandparent.get()); 7283 scroll_parent_border->SetScrollParent(scroll_grandparent.get());
7283 7284
7284 gfx::Transform identity_transform; 7285 gfx::Transform identity_transform;
7285 SetLayerPropertiesForTesting(root.get(), 7286 SetLayerPropertiesForTesting(root.get(),
7286 identity_transform, 7287 identity_transform,
7287 gfx::PointF(), 7288 gfx::Point3F(),
7288 gfx::PointF(), 7289 gfx::PointF(),
7289 gfx::Size(50, 50), 7290 gfx::Size(50, 50),
7290 true, 7291 true,
7291 false); 7292 false);
7292 SetLayerPropertiesForTesting(scroll_grandparent_border.get(), 7293 SetLayerPropertiesForTesting(scroll_grandparent_border.get(),
7293 identity_transform, 7294 identity_transform,
7294 gfx::PointF(), 7295 gfx::Point3F(),
7295 gfx::PointF(), 7296 gfx::PointF(),
7296 gfx::Size(40, 40), 7297 gfx::Size(40, 40),
7297 true, 7298 true,
7298 false); 7299 false);
7299 SetLayerPropertiesForTesting(scroll_grandparent_clip.get(), 7300 SetLayerPropertiesForTesting(scroll_grandparent_clip.get(),
7300 identity_transform, 7301 identity_transform,
7301 gfx::PointF(), 7302 gfx::Point3F(),
7302 gfx::PointF(), 7303 gfx::PointF(),
7303 gfx::Size(20, 20), 7304 gfx::Size(20, 20),
7304 true, 7305 true,
7305 false); 7306 false);
7306 SetLayerPropertiesForTesting(scroll_grandparent.get(), 7307 SetLayerPropertiesForTesting(scroll_grandparent.get(),
7307 identity_transform, 7308 identity_transform,
7308 gfx::PointF(), 7309 gfx::Point3F(),
7309 gfx::PointF(), 7310 gfx::PointF(),
7310 gfx::Size(50, 50), 7311 gfx::Size(50, 50),
7311 true, 7312 true,
7312 false); 7313 false);
7313 SetLayerPropertiesForTesting(scroll_parent_border.get(), 7314 SetLayerPropertiesForTesting(scroll_parent_border.get(),
7314 identity_transform, 7315 identity_transform,
7315 gfx::PointF(), 7316 gfx::Point3F(),
7316 gfx::PointF(), 7317 gfx::PointF(),
7317 gfx::Size(40, 40), 7318 gfx::Size(40, 40),
7318 true, 7319 true,
7319 false); 7320 false);
7320 SetLayerPropertiesForTesting(scroll_parent_clip.get(), 7321 SetLayerPropertiesForTesting(scroll_parent_clip.get(),
7321 identity_transform, 7322 identity_transform,
7322 gfx::PointF(), 7323 gfx::Point3F(),
7323 gfx::PointF(), 7324 gfx::PointF(),
7324 gfx::Size(30, 30), 7325 gfx::Size(30, 30),
7325 true, 7326 true,
7326 false); 7327 false);
7327 SetLayerPropertiesForTesting(scroll_parent.get(), 7328 SetLayerPropertiesForTesting(scroll_parent.get(),
7328 identity_transform, 7329 identity_transform,
7329 gfx::PointF(), 7330 gfx::Point3F(),
7330 gfx::PointF(), 7331 gfx::PointF(),
7331 gfx::Size(50, 50), 7332 gfx::Size(50, 50),
7332 true, 7333 true,
7333 false); 7334 false);
7334 SetLayerPropertiesForTesting(scroll_child.get(), 7335 SetLayerPropertiesForTesting(scroll_child.get(),
7335 identity_transform, 7336 identity_transform,
7336 gfx::PointF(), 7337 gfx::Point3F(),
7337 gfx::PointF(), 7338 gfx::PointF(),
7338 gfx::Size(50, 50), 7339 gfx::Size(50, 50),
7339 true, 7340 true,
7340 false); 7341 false);
7341 7342
7342 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 7343 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
7343 host->SetRootLayer(root); 7344 host->SetRootLayer(root);
7344 7345
7345 ExecuteCalculateDrawProperties(root.get()); 7346 ExecuteCalculateDrawProperties(root.get());
7346 7347
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
7412 7413
7413 scroll_child->SetScrollParent(scroll_parent.get()); 7414 scroll_child->SetScrollParent(scroll_parent.get());
7414 scroll_parent_border->SetScrollParent(scroll_grandparent.get()); 7415 scroll_parent_border->SetScrollParent(scroll_grandparent.get());
7415 7416
7416 render_surface1->SetForceRenderSurface(true); 7417 render_surface1->SetForceRenderSurface(true);
7417 render_surface2->SetForceRenderSurface(true); 7418 render_surface2->SetForceRenderSurface(true);
7418 7419
7419 gfx::Transform identity_transform; 7420 gfx::Transform identity_transform;
7420 SetLayerPropertiesForTesting(root.get(), 7421 SetLayerPropertiesForTesting(root.get(),
7421 identity_transform, 7422 identity_transform,
7422 gfx::PointF(), 7423 gfx::Point3F(),
7423 gfx::PointF(), 7424 gfx::PointF(),
7424 gfx::Size(50, 50), 7425 gfx::Size(50, 50),
7425 true, 7426 true,
7426 false); 7427 false);
7427 SetLayerPropertiesForTesting(scroll_grandparent_border.get(), 7428 SetLayerPropertiesForTesting(scroll_grandparent_border.get(),
7428 identity_transform, 7429 identity_transform,
7429 gfx::PointF(), 7430 gfx::Point3F(),
7430 gfx::PointF(), 7431 gfx::PointF(),
7431 gfx::Size(40, 40), 7432 gfx::Size(40, 40),
7432 true, 7433 true,
7433 false); 7434 false);
7434 SetLayerPropertiesForTesting(scroll_grandparent_clip.get(), 7435 SetLayerPropertiesForTesting(scroll_grandparent_clip.get(),
7435 identity_transform, 7436 identity_transform,
7436 gfx::PointF(), 7437 gfx::Point3F(),
7437 gfx::PointF(), 7438 gfx::PointF(),
7438 gfx::Size(20, 20), 7439 gfx::Size(20, 20),
7439 true, 7440 true,
7440 false); 7441 false);
7441 SetLayerPropertiesForTesting(scroll_grandparent.get(), 7442 SetLayerPropertiesForTesting(scroll_grandparent.get(),
7442 identity_transform, 7443 identity_transform,
7443 gfx::PointF(), 7444 gfx::Point3F(),
7444 gfx::PointF(), 7445 gfx::PointF(),
7445 gfx::Size(50, 50), 7446 gfx::Size(50, 50),
7446 true, 7447 true,
7447 false); 7448 false);
7448 SetLayerPropertiesForTesting(render_surface1.get(), 7449 SetLayerPropertiesForTesting(render_surface1.get(),
7449 identity_transform, 7450 identity_transform,
7450 gfx::PointF(), 7451 gfx::Point3F(),
7451 gfx::PointF(), 7452 gfx::PointF(),
7452 gfx::Size(50, 50), 7453 gfx::Size(50, 50),
7453 true, 7454 true,
7454 false); 7455 false);
7455 SetLayerPropertiesForTesting(scroll_parent_border.get(), 7456 SetLayerPropertiesForTesting(scroll_parent_border.get(),
7456 identity_transform, 7457 identity_transform,
7457 gfx::PointF(), 7458 gfx::Point3F(),
7458 gfx::PointF(), 7459 gfx::PointF(),
7459 gfx::Size(40, 40), 7460 gfx::Size(40, 40),
7460 true, 7461 true,
7461 false); 7462 false);
7462 SetLayerPropertiesForTesting(scroll_parent_clip.get(), 7463 SetLayerPropertiesForTesting(scroll_parent_clip.get(),
7463 identity_transform, 7464 identity_transform,
7464 gfx::PointF(), 7465 gfx::Point3F(),
7465 gfx::PointF(), 7466 gfx::PointF(),
7466 gfx::Size(30, 30), 7467 gfx::Size(30, 30),
7467 true, 7468 true,
7468 false); 7469 false);
7469 SetLayerPropertiesForTesting(scroll_parent.get(), 7470 SetLayerPropertiesForTesting(scroll_parent.get(),
7470 identity_transform, 7471 identity_transform,
7471 gfx::PointF(), 7472 gfx::Point3F(),
7472 gfx::PointF(), 7473 gfx::PointF(),
7473 gfx::Size(50, 50), 7474 gfx::Size(50, 50),
7474 true, 7475 true,
7475 false); 7476 false);
7476 SetLayerPropertiesForTesting(render_surface2.get(), 7477 SetLayerPropertiesForTesting(render_surface2.get(),
7477 identity_transform, 7478 identity_transform,
7478 gfx::PointF(), 7479 gfx::Point3F(),
7479 gfx::PointF(), 7480 gfx::PointF(),
7480 gfx::Size(50, 50), 7481 gfx::Size(50, 50),
7481 true, 7482 true,
7482 false); 7483 false);
7483 SetLayerPropertiesForTesting(scroll_child.get(), 7484 SetLayerPropertiesForTesting(scroll_child.get(),
7484 identity_transform, 7485 identity_transform,
7485 gfx::PointF(), 7486 gfx::Point3F(),
7486 gfx::PointF(), 7487 gfx::PointF(),
7487 gfx::Size(50, 50), 7488 gfx::Size(50, 50),
7488 true, 7489 true,
7489 false); 7490 false);
7490 7491
7491 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 7492 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create();
7492 host->SetRootLayer(root); 7493 host->SetRootLayer(root);
7493 7494
7494 RenderSurfaceLayerList render_surface_layer_list; 7495 RenderSurfaceLayerList render_surface_layer_list;
7495 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( 7496 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs(
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
7562 bottom_content->SetDrawsContent(true); 7563 bottom_content->SetDrawsContent(true);
7563 7564
7564 gfx::Transform identity_transform; 7565 gfx::Transform identity_transform;
7565 gfx::Transform top_transform; 7566 gfx::Transform top_transform;
7566 top_transform.Translate3d(0.0, 0.0, 5.0); 7567 top_transform.Translate3d(0.0, 0.0, 5.0);
7567 gfx::Transform bottom_transform; 7568 gfx::Transform bottom_transform;
7568 bottom_transform.Translate3d(0.0, 0.0, 3.0); 7569 bottom_transform.Translate3d(0.0, 0.0, 3.0);
7569 7570
7570 SetLayerPropertiesForTesting(root.get(), 7571 SetLayerPropertiesForTesting(root.get(),
7571 identity_transform, 7572 identity_transform,
7572 gfx::PointF(), 7573 gfx::Point3F(),
7573 gfx::PointF(), 7574 gfx::PointF(),
7574 gfx::Size(50, 50), 7575 gfx::Size(50, 50),
7575 true, 7576 true,
7576 false); 7577 false);
7577 SetLayerPropertiesForTesting(scroll_parent_border.get(), 7578 SetLayerPropertiesForTesting(scroll_parent_border.get(),
7578 identity_transform, 7579 identity_transform,
7579 gfx::PointF(), 7580 gfx::Point3F(),
7580 gfx::PointF(), 7581 gfx::PointF(),
7581 gfx::Size(40, 40), 7582 gfx::Size(40, 40),
7582 true, 7583 true,
7583 false); 7584 false);
7584 SetLayerPropertiesForTesting(scroll_parent_clip.get(), 7585 SetLayerPropertiesForTesting(scroll_parent_clip.get(),
7585 identity_transform, 7586 identity_transform,
7586 gfx::PointF(), 7587 gfx::Point3F(),
7587 gfx::PointF(), 7588 gfx::PointF(),
7588 gfx::Size(30, 30), 7589 gfx::Size(30, 30),
7589 true, 7590 true,
7590 false); 7591 false);
7591 SetLayerPropertiesForTesting(scroll_parent.get(), 7592 SetLayerPropertiesForTesting(scroll_parent.get(),
7592 identity_transform, 7593 identity_transform,
7593 gfx::PointF(), 7594 gfx::Point3F(),
7594 gfx::PointF(), 7595 gfx::PointF(),
7595 gfx::Size(50, 50), 7596 gfx::Size(50, 50),
7596 true, 7597 true,
7597 false); 7598 false);
7598 SetLayerPropertiesForTesting(scroll_child.get(), 7599 SetLayerPropertiesForTesting(scroll_child.get(),
7599 identity_transform, 7600 identity_transform,
7600 gfx::PointF(), 7601 gfx::Point3F(),
7601 gfx::PointF(), 7602 gfx::PointF(),
7602 gfx::Size(50, 50), 7603 gfx::Size(50, 50),
7603 true, 7604 true,
7604 false); 7605 false);
7605 SetLayerPropertiesForTesting(top_content.get(), 7606 SetLayerPropertiesForTesting(top_content.get(),
7606 top_transform, 7607 top_transform,
7607 gfx::PointF(), 7608 gfx::Point3F(),
7608 gfx::PointF(), 7609 gfx::PointF(),
7609 gfx::Size(50, 50), 7610 gfx::Size(50, 50),
7610 false, 7611 false,
7611 true); 7612 true);
7612 SetLayerPropertiesForTesting(bottom_content.get(), 7613 SetLayerPropertiesForTesting(bottom_content.get(),
7613 bottom_transform, 7614 bottom_transform,
7614 gfx::PointF(), 7615 gfx::Point3F(),
7615 gfx::PointF(), 7616 gfx::PointF(),
7616 gfx::Size(50, 50), 7617 gfx::Size(50, 50),
7617 false, 7618 false,
7618 true); 7619 true);
7619 7620
7620 scroll_child->SetShouldFlattenTransform(false); 7621 scroll_child->SetShouldFlattenTransform(false);
7621 scroll_child->SetIs3dSorted(true); 7622 scroll_child->SetIs3dSorted(true);
7622 7623
7623 scroll_child->AddChild(top_content.Pass()); 7624 scroll_child->AddChild(top_content.Pass());
7624 scroll_child->AddChild(bottom_content.Pass()); 7625 scroll_child->AddChild(bottom_content.Pass());
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
7680 7681
7681 scroller->SetScrollClipLayer(container->id()); 7682 scroller->SetScrollClipLayer(container->id());
7682 7683
7683 gfx::Transform identity_transform; 7684 gfx::Transform identity_transform;
7684 gfx::Transform container_transform; 7685 gfx::Transform container_transform;
7685 container_transform.Translate3d(10.0, 20.0, 0.0); 7686 container_transform.Translate3d(10.0, 20.0, 0.0);
7686 gfx::Vector2dF container_offset = container_transform.To2dTranslation(); 7687 gfx::Vector2dF container_offset = container_transform.To2dTranslation();
7687 7688
7688 SetLayerPropertiesForTesting(root.get(), 7689 SetLayerPropertiesForTesting(root.get(),
7689 identity_transform, 7690 identity_transform,
7690 gfx::PointF(), 7691 gfx::Point3F(),
7691 gfx::PointF(), 7692 gfx::PointF(),
7692 gfx::Size(50, 50), 7693 gfx::Size(50, 50),
7693 true, 7694 true,
7694 false); 7695 false);
7695 SetLayerPropertiesForTesting(container.get(), 7696 SetLayerPropertiesForTesting(container.get(),
7696 container_transform, 7697 container_transform,
7697 gfx::PointF(), 7698 gfx::Point3F(),
7698 gfx::PointF(), 7699 gfx::PointF(),
7699 gfx::Size(40, 40), 7700 gfx::Size(40, 40),
7700 true, 7701 true,
7701 false); 7702 false);
7702 SetLayerPropertiesForTesting(scroller.get(), 7703 SetLayerPropertiesForTesting(scroller.get(),
7703 identity_transform, 7704 identity_transform,
7704 gfx::PointF(), 7705 gfx::Point3F(),
7705 gfx::PointF(), 7706 gfx::PointF(),
7706 gfx::Size(30, 30), 7707 gfx::Size(30, 30),
7707 true, 7708 true,
7708 false); 7709 false);
7709 SetLayerPropertiesForTesting(fixed.get(), 7710 SetLayerPropertiesForTesting(fixed.get(),
7710 identity_transform, 7711 identity_transform,
7711 gfx::PointF(), 7712 gfx::Point3F(),
7712 gfx::PointF(), 7713 gfx::PointF(),
7713 gfx::Size(50, 50), 7714 gfx::Size(50, 50),
7714 true, 7715 true,
7715 false); 7716 false);
7716 7717
7717 scroller->AddChild(fixed.Pass()); 7718 scroller->AddChild(fixed.Pass());
7718 container->AddChild(scroller.Pass()); 7719 container->AddChild(scroller.Pass());
7719 root->AddChild(container.Pass()); 7720 root->AddChild(container.Pass());
7720 7721
7721 // Rounded to integers already. 7722 // Rounded to integers already.
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
7869 AnimationScaleFactorTrackingLayerImpl* parent_raw = parent.get(); 7870 AnimationScaleFactorTrackingLayerImpl* parent_raw = parent.get();
7870 AnimationScaleFactorTrackingLayerImpl* child_raw = child.get(); 7871 AnimationScaleFactorTrackingLayerImpl* child_raw = child.get();
7871 AnimationScaleFactorTrackingLayerImpl* grand_child_raw = grand_child.get(); 7872 AnimationScaleFactorTrackingLayerImpl* grand_child_raw = grand_child.get();
7872 7873
7873 child->AddChild(grand_child.PassAs<LayerImpl>()); 7874 child->AddChild(grand_child.PassAs<LayerImpl>());
7874 parent->AddChild(child.PassAs<LayerImpl>()); 7875 parent->AddChild(child.PassAs<LayerImpl>());
7875 grand_parent->AddChild(parent.PassAs<LayerImpl>()); 7876 grand_parent->AddChild(parent.PassAs<LayerImpl>());
7876 7877
7877 SetLayerPropertiesForTesting(grand_parent.get(), 7878 SetLayerPropertiesForTesting(grand_parent.get(),
7878 identity_matrix, 7879 identity_matrix,
7879 gfx::PointF(), 7880 gfx::Point3F(),
7880 gfx::PointF(), 7881 gfx::PointF(),
7881 gfx::Size(1, 2), 7882 gfx::Size(1, 2),
7882 true, 7883 true,
7883 false); 7884 false);
7884 SetLayerPropertiesForTesting(parent_raw, 7885 SetLayerPropertiesForTesting(parent_raw,
7885 identity_matrix, 7886 identity_matrix,
7886 gfx::PointF(), 7887 gfx::Point3F(),
7887 gfx::PointF(), 7888 gfx::PointF(),
7888 gfx::Size(1, 2), 7889 gfx::Size(1, 2),
7889 true, 7890 true,
7890 false); 7891 false);
7891 SetLayerPropertiesForTesting(child_raw, 7892 SetLayerPropertiesForTesting(child_raw,
7892 identity_matrix, 7893 identity_matrix,
7893 gfx::PointF(), 7894 gfx::Point3F(),
7894 gfx::PointF(), 7895 gfx::PointF(),
7895 gfx::Size(1, 2), 7896 gfx::Size(1, 2),
7896 true, 7897 true,
7897 false); 7898 false);
7898 SetLayerPropertiesForTesting(grand_child_raw, 7899 SetLayerPropertiesForTesting(grand_child_raw,
7899 identity_matrix, 7900 identity_matrix,
7900 gfx::PointF(), 7901 gfx::Point3F(),
7901 gfx::PointF(), 7902 gfx::PointF(),
7902 gfx::Size(1, 2), 7903 gfx::Size(1, 2),
7903 true, 7904 true,
7904 false); 7905 false);
7905 7906
7906 ExecuteCalculateDrawProperties(grand_parent.get()); 7907 ExecuteCalculateDrawProperties(grand_parent.get());
7907 7908
7908 // No layers have animations. 7909 // No layers have animations.
7909 EXPECT_EQ(0.f, grand_parent->last_maximum_animation_contents_scale()); 7910 EXPECT_EQ(0.f, grand_parent->last_maximum_animation_contents_scale());
7910 EXPECT_EQ(0.f, parent_raw->last_maximum_animation_contents_scale()); 7911 EXPECT_EQ(0.f, parent_raw->last_maximum_animation_contents_scale());
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
8073 LayerImpl* grand_child1_raw = grand_child1.get(); 8074 LayerImpl* grand_child1_raw = grand_child1.get();
8074 LayerImpl* grand_child2_raw = grand_child2.get(); 8075 LayerImpl* grand_child2_raw = grand_child2.get();
8075 8076
8076 child->AddChild(grand_child1.Pass()); 8077 child->AddChild(grand_child1.Pass());
8077 child->AddChild(grand_child2.Pass()); 8078 child->AddChild(grand_child2.Pass());
8078 parent->AddChild(child.Pass()); 8079 parent->AddChild(child.Pass());
8079 grand_parent->AddChild(parent.Pass()); 8080 grand_parent->AddChild(parent.Pass());
8080 8081
8081 SetLayerPropertiesForTesting(grand_parent_raw, 8082 SetLayerPropertiesForTesting(grand_parent_raw,
8082 identity_matrix, 8083 identity_matrix,
8083 gfx::PointF(), 8084 gfx::Point3F(),
8084 gfx::PointF(), 8085 gfx::PointF(),
8085 gfx::Size(1, 2), 8086 gfx::Size(1, 2),
8086 true, 8087 true,
8087 false); 8088 false);
8088 SetLayerPropertiesForTesting(parent_raw, 8089 SetLayerPropertiesForTesting(parent_raw,
8089 identity_matrix, 8090 identity_matrix,
8090 gfx::PointF(), 8091 gfx::Point3F(),
8091 gfx::PointF(), 8092 gfx::PointF(),
8092 gfx::Size(1, 2), 8093 gfx::Size(1, 2),
8093 true, 8094 true,
8094 false); 8095 false);
8095 SetLayerPropertiesForTesting(child_raw, 8096 SetLayerPropertiesForTesting(child_raw,
8096 identity_matrix, 8097 identity_matrix,
8097 gfx::PointF(), 8098 gfx::Point3F(),
8098 gfx::PointF(), 8099 gfx::PointF(),
8099 gfx::Size(1, 2), 8100 gfx::Size(1, 2),
8100 true, 8101 true,
8101 false); 8102 false);
8102 SetLayerPropertiesForTesting(grand_child1_raw, 8103 SetLayerPropertiesForTesting(grand_child1_raw,
8103 identity_matrix, 8104 identity_matrix,
8104 gfx::PointF(), 8105 gfx::Point3F(),
8105 gfx::PointF(), 8106 gfx::PointF(),
8106 gfx::Size(1, 2), 8107 gfx::Size(1, 2),
8107 true, 8108 true,
8108 false); 8109 false);
8109 SetLayerPropertiesForTesting(grand_child2_raw, 8110 SetLayerPropertiesForTesting(grand_child2_raw,
8110 identity_matrix, 8111 identity_matrix,
8111 gfx::PointF(), 8112 gfx::Point3F(),
8112 gfx::PointF(), 8113 gfx::PointF(),
8113 gfx::Size(1, 2), 8114 gfx::Size(1, 2),
8114 true, 8115 true,
8115 false); 8116 false);
8116 8117
8117 // Start with nothing being drawn. 8118 // Start with nothing being drawn.
8118 ExecuteCalculateDrawProperties(grand_parent_raw); 8119 ExecuteCalculateDrawProperties(grand_parent_raw);
8119 int member_id = render_surface_layer_list_count(); 8120 int member_id = render_surface_layer_list_count();
8120 8121
8121 EXPECT_NE(member_id, membership_id(grand_parent_raw)); 8122 EXPECT_NE(member_id, membership_id(grand_parent_raw));
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
8306 expected.insert(child_raw); 8307 expected.insert(child_raw);
8307 expected.insert(grand_child1_raw); 8308 expected.insert(grand_child1_raw);
8308 expected.insert(grand_child2_raw); 8309 expected.insert(grand_child2_raw);
8309 8310
8310 actual.clear(); 8311 actual.clear();
8311 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); 8312 GatherDrawnLayers(render_surface_layer_list_impl(), &actual);
8312 EXPECT_EQ(expected, actual); 8313 EXPECT_EQ(expected, actual);
8313 } 8314 }
8314 } // namespace 8315 } // namespace
8315 } // namespace cc 8316 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698