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

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

Issue 2084233002: cc: Move LayerImpl::AddChild and RemoveChild to LayerImplTestProperties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « cc/trees/damage_tracker_unittest.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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 LayerImpl::Create(host_impl.active_tree(), 4)); 321 LayerImpl::Create(host_impl.active_tree(), 4));
322 LayerImpl* clip_layer = clip_layer_scoped_ptr.get(); 322 LayerImpl* clip_layer = clip_layer_scoped_ptr.get();
323 323
324 scroll_layer->SetScrollClipLayer(clip_layer->id()); 324 scroll_layer->SetScrollClipLayer(clip_layer->id());
325 clip_layer->SetBounds( 325 clip_layer->SetBounds(
326 gfx::Size(scroll_layer->bounds().width() + kMaxScrollOffset.x(), 326 gfx::Size(scroll_layer->bounds().width() + kMaxScrollOffset.x(),
327 scroll_layer->bounds().height() + kMaxScrollOffset.y())); 327 scroll_layer->bounds().height() + kMaxScrollOffset.y()));
328 scroll_layer->SetScrollClipLayer(clip_layer->id()); 328 scroll_layer->SetScrollClipLayer(clip_layer->id());
329 SetScrollOffsetDelta(scroll_layer, kScrollDelta); 329 SetScrollOffsetDelta(scroll_layer, kScrollDelta);
330 gfx::Transform impl_transform; 330 gfx::Transform impl_transform;
331 scroll_layer->AddChild(std::move(sublayer_scoped_ptr)); 331 scroll_layer->test_properties()->AddChild(std::move(sublayer_scoped_ptr));
332 LayerImpl* scroll_layer_raw_ptr = scroll_layer_scoped_ptr.get(); 332 LayerImpl* scroll_layer_raw_ptr = scroll_layer_scoped_ptr.get();
333 clip_layer->AddChild(std::move(scroll_layer_scoped_ptr)); 333 clip_layer->test_properties()->AddChild(std::move(scroll_layer_scoped_ptr));
334 scroll_layer_raw_ptr->layer_tree_impl() 334 scroll_layer_raw_ptr->layer_tree_impl()
335 ->property_trees() 335 ->property_trees()
336 ->scroll_tree.UpdateScrollOffsetBaseForTesting(scroll_layer_raw_ptr->id(), 336 ->scroll_tree.UpdateScrollOffsetBaseForTesting(scroll_layer_raw_ptr->id(),
337 kScrollOffset); 337 kScrollOffset);
338 338
339 std::unique_ptr<LayerImpl> root( 339 std::unique_ptr<LayerImpl> root(
340 LayerImpl::Create(host_impl.active_tree(), 3)); 340 LayerImpl::Create(host_impl.active_tree(), 3));
341 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), 341 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(),
342 gfx::PointF(), gfx::Size(3, 4), true, false, 342 gfx::PointF(), gfx::Size(3, 4), true, false,
343 false); 343 false);
344 root->AddChild(std::move(clip_layer_scoped_ptr)); 344 root->test_properties()->AddChild(std::move(clip_layer_scoped_ptr));
345 root->SetHasRenderSurface(true); 345 root->SetHasRenderSurface(true);
346 LayerImpl* root_layer = root.get(); 346 LayerImpl* root_layer = root.get();
347 host_impl.active_tree()->SetRootLayer(std::move(root)); 347 host_impl.active_tree()->SetRootLayer(std::move(root));
348 348
349 ExecuteCalculateDrawProperties(root_layer, kDeviceScale, page_scale, 349 ExecuteCalculateDrawProperties(root_layer, kDeviceScale, page_scale,
350 scroll_layer->test_properties()->parent); 350 scroll_layer->test_properties()->parent);
351 gfx::Transform expected_transform = identity_matrix; 351 gfx::Transform expected_transform = identity_matrix;
352 gfx::PointF sub_layer_screen_position = kScrollLayerPosition - kScrollDelta; 352 gfx::PointF sub_layer_screen_position = kScrollLayerPosition - kScrollDelta;
353 expected_transform.Translate(MathUtil::Round(sub_layer_screen_position.x() * 353 expected_transform.Translate(MathUtil::Round(sub_layer_screen_position.x() *
354 page_scale * kDeviceScale), 354 page_scale * kDeviceScale),
(...skipping 3343 matching lines...) Expand 10 before | Expand all | Expand 10 after
3698 false, true, false); 3698 false, true, false);
3699 SetLayerPropertiesForTesting(grand_child.get(), rotation, gfx::Point3F(), 3699 SetLayerPropertiesForTesting(grand_child.get(), rotation, gfx::Point3F(),
3700 gfx::PointF(), gfx::Size(200, 200), false, true, 3700 gfx::PointF(), gfx::Size(200, 200), false, true,
3701 false); 3701 false);
3702 SetLayerPropertiesForTesting(occluding_child.get(), identity_matrix, 3702 SetLayerPropertiesForTesting(occluding_child.get(), identity_matrix,
3703 gfx::Point3F(), gfx::PointF(), 3703 gfx::Point3F(), gfx::PointF(),
3704 gfx::Size(200, 200), false, false, false); 3704 gfx::Size(200, 200), false, false, false);
3705 3705
3706 host_impl.SetViewportSize(root->bounds()); 3706 host_impl.SetViewportSize(root->bounds());
3707 3707
3708 child->AddChild(std::move(grand_child)); 3708 child->test_properties()->AddChild(std::move(grand_child));
3709 root->AddChild(std::move(child)); 3709 root->test_properties()->AddChild(std::move(child));
3710 root->AddChild(std::move(occluding_child)); 3710 root->test_properties()->AddChild(std::move(occluding_child));
3711 host_impl.active_tree()->SetRootLayer(std::move(root)); 3711 host_impl.active_tree()->SetRootLayer(std::move(root));
3712 host_impl.SetVisible(true); 3712 host_impl.SetVisible(true);
3713 host_impl.InitializeRenderer(output_surface.get()); 3713 host_impl.InitializeRenderer(output_surface.get());
3714 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); 3714 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting();
3715 bool update_lcd_text = false; 3715 bool update_lcd_text = false;
3716 host_impl.active_tree()->UpdateDrawProperties(update_lcd_text); 3716 host_impl.active_tree()->UpdateDrawProperties(update_lcd_text);
3717 3717
3718 LayerImpl* grand_child_ptr = host_impl.active_tree() 3718 LayerImpl* grand_child_ptr = host_impl.active_tree()
3719 ->root_layer() 3719 ->root_layer()
3720 ->test_properties() 3720 ->test_properties()
(...skipping 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after
5136 5136
5137 std::unique_ptr<LayerImpl> child = 5137 std::unique_ptr<LayerImpl> child =
5138 LayerImpl::Create(host_impl.pending_tree(), 2); 5138 LayerImpl::Create(host_impl.pending_tree(), 2);
5139 SetLayerPropertiesForTesting(child.get(), identity_matrix, gfx::Point3F(), 5139 SetLayerPropertiesForTesting(child.get(), identity_matrix, gfx::Point3F(),
5140 gfx::PointF(), gfx::Size(50, 50), true, false, 5140 gfx::PointF(), gfx::Size(50, 50), true, false,
5141 false); 5141 false);
5142 child->SetDrawsContent(true); 5142 child->SetDrawsContent(true);
5143 child->test_properties()->opacity = 0.0f; 5143 child->test_properties()->opacity = 0.0f;
5144 5144
5145 const int child_id = child->id(); 5145 const int child_id = child->id();
5146 root->AddChild(std::move(child)); 5146 root->test_properties()->AddChild(std::move(child));
5147 root->SetHasRenderSurface(true); 5147 root->SetHasRenderSurface(true);
5148 LayerImpl* root_layer = root.get(); 5148 LayerImpl* root_layer = root.get();
5149 host_impl.pending_tree()->SetRootLayer(std::move(root)); 5149 host_impl.pending_tree()->SetRootLayer(std::move(root));
5150 host_impl.pending_tree()->BuildLayerListAndPropertyTreesForTesting(); 5150 host_impl.pending_tree()->BuildLayerListAndPropertyTreesForTesting();
5151 // Add opacity animation. 5151 // Add opacity animation.
5152 scoped_refptr<AnimationTimeline> timeline = 5152 scoped_refptr<AnimationTimeline> timeline =
5153 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); 5153 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId());
5154 host_impl.animation_host()->AddAnimationTimeline(timeline); 5154 host_impl.animation_host()->AddAnimationTimeline(timeline);
5155 5155
5156 AddOpacityTransitionToLayerWithPlayer(child_id, timeline, 10.0, 0.0f, 1.0f, 5156 AddOpacityTransitionToLayerWithPlayer(child_id, timeline, 10.0, 0.0f, 1.0f,
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
5255 std::unique_ptr<LayerImpl> child_ptr = 5255 std::unique_ptr<LayerImpl> child_ptr =
5256 LayerImpl::Create(host_impl_.active_tree(), 2); 5256 LayerImpl::Create(host_impl_.active_tree(), 2);
5257 std::unique_ptr<LayerImpl> grand_child_ptr = 5257 std::unique_ptr<LayerImpl> grand_child_ptr =
5258 LayerImpl::Create(host_impl_.active_tree(), 3); 5258 LayerImpl::Create(host_impl_.active_tree(), 3);
5259 5259
5260 // Stash raw pointers to look at later. 5260 // Stash raw pointers to look at later.
5261 root_ = root_ptr.get(); 5261 root_ = root_ptr.get();
5262 child_ = child_ptr.get(); 5262 child_ = child_ptr.get();
5263 grand_child_ = grand_child_ptr.get(); 5263 grand_child_ = grand_child_ptr.get();
5264 5264
5265 child_->AddChild(std::move(grand_child_ptr)); 5265 child_->test_properties()->AddChild(std::move(grand_child_ptr));
5266 root_->AddChild(std::move(child_ptr)); 5266 root_->test_properties()->AddChild(std::move(child_ptr));
5267 host_impl_.active_tree()->SetRootLayer(std::move(root_ptr)); 5267 host_impl_.active_tree()->SetRootLayer(std::move(root_ptr));
5268 5268
5269 root_->SetContentsOpaque(true); 5269 root_->SetContentsOpaque(true);
5270 child_->SetContentsOpaque(true); 5270 child_->SetContentsOpaque(true);
5271 grand_child_->SetContentsOpaque(true); 5271 grand_child_->SetContentsOpaque(true);
5272 5272
5273 root_->SetDrawsContent(true); 5273 root_->SetDrawsContent(true);
5274 child_->SetDrawsContent(true); 5274 child_->SetDrawsContent(true);
5275 grand_child_->SetDrawsContent(true); 5275 grand_child_->SetDrawsContent(true);
5276 5276
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
5468 child->SetDrawsContent(true); 5468 child->SetDrawsContent(true);
5469 5469
5470 std::unique_ptr<LayerImpl> grand_child = 5470 std::unique_ptr<LayerImpl> grand_child =
5471 LayerImpl::Create(host_impl.pending_tree(), 3); 5471 LayerImpl::Create(host_impl.pending_tree(), 3);
5472 SetLayerPropertiesForTesting(grand_child.get(), identity_matrix, 5472 SetLayerPropertiesForTesting(grand_child.get(), identity_matrix,
5473 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30), 5473 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30),
5474 true, false, false); 5474 true, false, false);
5475 grand_child->SetDrawsContent(true); 5475 grand_child->SetDrawsContent(true);
5476 grand_child->test_properties()->hide_layer_and_subtree = true; 5476 grand_child->test_properties()->hide_layer_and_subtree = true;
5477 5477
5478 child->AddChild(std::move(grand_child)); 5478 child->test_properties()->AddChild(std::move(grand_child));
5479 root->AddChild(std::move(child)); 5479 root->test_properties()->AddChild(std::move(child));
5480 root->SetHasRenderSurface(true); 5480 root->SetHasRenderSurface(true);
5481 host_impl.pending_tree()->SetRootLayer(std::move(root)); 5481 host_impl.pending_tree()->SetRootLayer(std::move(root));
5482 5482
5483 LayerImplList render_surface_layer_list; 5483 LayerImplList render_surface_layer_list;
5484 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( 5484 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
5485 root_layer, root_layer->bounds(), &render_surface_layer_list); 5485 root_layer, root_layer->bounds(), &render_surface_layer_list);
5486 inputs.can_adjust_raster_scales = true; 5486 inputs.can_adjust_raster_scales = true;
5487 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); 5487 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs);
5488 5488
5489 // We should have one render surface and two layers. The grand child has 5489 // We should have one render surface and two layers. The grand child has
(...skipping 29 matching lines...) Expand all
5519 child->SetDrawsContent(true); 5519 child->SetDrawsContent(true);
5520 child->test_properties()->hide_layer_and_subtree = true; 5520 child->test_properties()->hide_layer_and_subtree = true;
5521 5521
5522 std::unique_ptr<LayerImpl> grand_child = 5522 std::unique_ptr<LayerImpl> grand_child =
5523 LayerImpl::Create(host_impl.pending_tree(), 3); 5523 LayerImpl::Create(host_impl.pending_tree(), 3);
5524 SetLayerPropertiesForTesting(grand_child.get(), identity_matrix, 5524 SetLayerPropertiesForTesting(grand_child.get(), identity_matrix,
5525 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30), 5525 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30),
5526 true, false, false); 5526 true, false, false);
5527 grand_child->SetDrawsContent(true); 5527 grand_child->SetDrawsContent(true);
5528 5528
5529 child->AddChild(std::move(grand_child)); 5529 child->test_properties()->AddChild(std::move(grand_child));
5530 root->AddChild(std::move(child)); 5530 root->test_properties()->AddChild(std::move(child));
5531 host_impl.pending_tree()->SetRootLayer(std::move(root)); 5531 host_impl.pending_tree()->SetRootLayer(std::move(root));
5532 5532
5533 LayerImplList render_surface_layer_list; 5533 LayerImplList render_surface_layer_list;
5534 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( 5534 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
5535 root_layer, root_layer->bounds(), &render_surface_layer_list); 5535 root_layer, root_layer->bounds(), &render_surface_layer_list);
5536 inputs.can_adjust_raster_scales = true; 5536 inputs.can_adjust_raster_scales = true;
5537 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); 5537 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs);
5538 5538
5539 // We should have one render surface and one layers. The child has 5539 // We should have one render surface and one layers. The child has
5540 // hidden itself and the grand child. 5540 // hidden itself and the grand child.
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
5613 5613
5614 std::unique_ptr<LayerImpl> copy_grand_parent_sibling_after = 5614 std::unique_ptr<LayerImpl> copy_grand_parent_sibling_after =
5615 LayerImpl::Create(host_impl.pending_tree(), 8); 5615 LayerImpl::Create(host_impl.pending_tree(), 8);
5616 SetLayerPropertiesForTesting(copy_grand_parent_sibling_after.get(), 5616 SetLayerPropertiesForTesting(copy_grand_parent_sibling_after.get(),
5617 identity_matrix, gfx::Point3F(), gfx::PointF(), 5617 identity_matrix, gfx::Point3F(), gfx::PointF(),
5618 gfx::Size(40, 40), true, false, false); 5618 gfx::Size(40, 40), true, false, false);
5619 copy_grand_parent_sibling_after->SetDrawsContent(true); 5619 copy_grand_parent_sibling_after->SetDrawsContent(true);
5620 LayerImpl* copy_grand_parent_sibling_after_layer = 5620 LayerImpl* copy_grand_parent_sibling_after_layer =
5621 copy_grand_parent_sibling_after.get(); 5621 copy_grand_parent_sibling_after.get();
5622 5622
5623 copy_child->AddChild(std::move(copy_grand_child)); 5623 copy_child->test_properties()->AddChild(std::move(copy_grand_child));
5624 copy_request->AddChild(std::move(copy_child)); 5624 copy_request->test_properties()->AddChild(std::move(copy_child));
5625 copy_parent->AddChild(std::move(copy_request)); 5625 copy_parent->test_properties()->AddChild(std::move(copy_request));
5626 copy_grand_parent->AddChild(std::move(copy_parent)); 5626 copy_grand_parent->test_properties()->AddChild(std::move(copy_parent));
5627 root->AddChild(std::move(copy_grand_parent_sibling_before)); 5627 root->test_properties()->AddChild(
5628 root->AddChild(std::move(copy_grand_parent)); 5628 std::move(copy_grand_parent_sibling_before));
5629 root->AddChild(std::move(copy_grand_parent_sibling_after)); 5629 root->test_properties()->AddChild(std::move(copy_grand_parent));
5630 root->test_properties()->AddChild(std::move(copy_grand_parent_sibling_after));
5630 host_impl.pending_tree()->SetRootLayer(std::move(root)); 5631 host_impl.pending_tree()->SetRootLayer(std::move(root));
5631 5632
5632 // Hide the copy_grand_parent and its subtree. But make a copy request in that 5633 // Hide the copy_grand_parent and its subtree. But make a copy request in that
5633 // hidden subtree on copy_layer. Also hide the copy grand child and its 5634 // hidden subtree on copy_layer. Also hide the copy grand child and its
5634 // subtree. 5635 // subtree.
5635 copy_grand_parent_layer->test_properties()->hide_layer_and_subtree = true; 5636 copy_grand_parent_layer->test_properties()->hide_layer_and_subtree = true;
5636 copy_grand_parent_sibling_before_layer->test_properties() 5637 copy_grand_parent_sibling_before_layer->test_properties()
5637 ->hide_layer_and_subtree = true; 5638 ->hide_layer_and_subtree = true;
5638 copy_grand_parent_sibling_after_layer->test_properties() 5639 copy_grand_parent_sibling_after_layer->test_properties()
5639 ->hide_layer_and_subtree = true; 5640 ->hide_layer_and_subtree = true;
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
5739 std::unique_ptr<LayerImpl> copy_child = 5740 std::unique_ptr<LayerImpl> copy_child =
5740 LayerImpl::Create(host_impl.pending_tree(), 4); 5741 LayerImpl::Create(host_impl.pending_tree(), 4);
5741 SetLayerPropertiesForTesting(copy_child.get(), identity_matrix, 5742 SetLayerPropertiesForTesting(copy_child.get(), identity_matrix,
5742 gfx::Point3F(), gfx::PointF(), gfx::Size(20, 20), 5743 gfx::Point3F(), gfx::PointF(), gfx::Size(20, 20),
5743 true, false, false); 5744 true, false, false);
5744 copy_child->SetDrawsContent(true); 5745 copy_child->SetDrawsContent(true);
5745 5746
5746 copy_layer->test_properties()->copy_requests.push_back( 5747 copy_layer->test_properties()->copy_requests.push_back(
5747 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback))); 5748 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback)));
5748 5749
5749 copy_layer->AddChild(std::move(copy_child)); 5750 copy_layer->test_properties()->AddChild(std::move(copy_child));
5750 copy_parent->AddChild(std::move(copy_layer)); 5751 copy_parent->test_properties()->AddChild(std::move(copy_layer));
5751 root->AddChild(std::move(copy_parent)); 5752 root->test_properties()->AddChild(std::move(copy_parent));
5752 5753
5753 LayerImplList render_surface_layer_list; 5754 LayerImplList render_surface_layer_list;
5754 LayerImpl* root_layer = root.get(); 5755 LayerImpl* root_layer = root.get();
5755 root_layer->layer_tree_impl()->SetRootLayer(std::move(root)); 5756 root_layer->layer_tree_impl()->SetRootLayer(std::move(root));
5756 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( 5757 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
5757 root_layer, root_layer->bounds(), &render_surface_layer_list); 5758 root_layer, root_layer->bounds(), &render_surface_layer_list);
5758 inputs.can_adjust_raster_scales = true; 5759 inputs.can_adjust_raster_scales = true;
5759 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); 5760 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs);
5760 5761
5761 // We should have two render surface, as the others are clipped out. 5762 // We should have two render surface, as the others are clipped out.
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
6322 SetLayerPropertiesForTesting(child2.get(), identity_matrix, transform_origin, 6323 SetLayerPropertiesForTesting(child2.get(), identity_matrix, transform_origin,
6323 position, bounds, true, false, true); 6324 position, bounds, true, false, true);
6324 child2->SetDrawsContent(true); 6325 child2->SetDrawsContent(true);
6325 SetLayerPropertiesForTesting(child3.get(), identity_matrix, transform_origin, 6326 SetLayerPropertiesForTesting(child3.get(), identity_matrix, transform_origin,
6326 position, bounds, true, false, false); 6327 position, bounds, true, false, false);
6327 child3->SetDrawsContent(true); 6328 child3->SetDrawsContent(true);
6328 6329
6329 child2->Set3dSortingContextId(1); 6330 child2->Set3dSortingContextId(1);
6330 child3->Set3dSortingContextId(1); 6331 child3->Set3dSortingContextId(1);
6331 6332
6332 child2->AddChild(std::move(child3)); 6333 child2->test_properties()->AddChild(std::move(child3));
6333 child1->AddChild(std::move(child2)); 6334 child1->test_properties()->AddChild(std::move(child2));
6334 root->AddChild(std::move(child1)); 6335 root->test_properties()->AddChild(std::move(child1));
6335 LayerImpl* root_layer = root.get(); 6336 LayerImpl* root_layer = root.get();
6336 root_layer->layer_tree_impl()->SetRootLayer(std::move(root)); 6337 root_layer->layer_tree_impl()->SetRootLayer(std::move(root));
6337 6338
6338 { 6339 {
6339 LayerImplList render_surface_layer_list; 6340 LayerImplList render_surface_layer_list;
6340 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(root_layer); 6341 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(root_layer);
6341 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( 6342 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
6342 root_layer, root_layer->bounds(), &render_surface_layer_list); 6343 root_layer, root_layer->bounds(), &render_surface_layer_list);
6343 inputs.can_render_to_separate_surface = true; 6344 inputs.can_render_to_separate_surface = true;
6344 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); 6345 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs);
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
7122 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30), 7123 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30),
7123 true, false, false); 7124 true, false, false);
7124 SetLayerPropertiesForTesting(fixed.get(), identity_transform, gfx::Point3F(), 7125 SetLayerPropertiesForTesting(fixed.get(), identity_transform, gfx::Point3F(),
7125 gfx::PointF(), gfx::Size(50, 50), true, false, 7126 gfx::PointF(), gfx::Size(50, 50), true, false,
7126 false); 7127 false);
7127 7128
7128 root->SetDrawsContent(true); 7129 root->SetDrawsContent(true);
7129 container->SetDrawsContent(true); 7130 container->SetDrawsContent(true);
7130 scroller->SetDrawsContent(true); 7131 scroller->SetDrawsContent(true);
7131 fixed->SetDrawsContent(true); 7132 fixed->SetDrawsContent(true);
7132 scroller->AddChild(std::move(fixed)); 7133 scroller->test_properties()->AddChild(std::move(fixed));
7133 container->AddChild(std::move(scroller)); 7134 container->test_properties()->AddChild(std::move(scroller));
7134 root->AddChild(std::move(container)); 7135 root->test_properties()->AddChild(std::move(container));
7135 7136
7136 // Rounded to integers already. 7137 // Rounded to integers already.
7137 { 7138 {
7138 root->layer_tree_impl()->SetRootLayer(std::move(root_ptr)); 7139 root->layer_tree_impl()->SetRootLayer(std::move(root_ptr));
7139 root->layer_tree_impl()->BuildLayerListAndPropertyTreesForTesting(); 7140 root->layer_tree_impl()->BuildLayerListAndPropertyTreesForTesting();
7140 7141
7141 gfx::Vector2dF scroll_delta(3.0, 5.0); 7142 gfx::Vector2dF scroll_delta(3.0, 5.0);
7142 SetScrollOffsetDelta(scroll_layer, scroll_delta); 7143 SetScrollOffsetDelta(scroll_layer, scroll_delta);
7143 7144
7144 LayerImplList render_surface_layer_list; 7145 LayerImplList render_surface_layer_list;
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
7304 std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> child = 7305 std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> child =
7305 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 3); 7306 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 3);
7306 std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> grand_child = 7307 std::unique_ptr<AnimationScaleFactorTrackingLayerImpl> grand_child =
7307 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 4); 7308 AnimationScaleFactorTrackingLayerImpl::Create(host_impl.active_tree(), 4);
7308 7309
7309 AnimationScaleFactorTrackingLayerImpl* parent_raw = parent.get(); 7310 AnimationScaleFactorTrackingLayerImpl* parent_raw = parent.get();
7310 AnimationScaleFactorTrackingLayerImpl* child_raw = child.get(); 7311 AnimationScaleFactorTrackingLayerImpl* child_raw = child.get();
7311 AnimationScaleFactorTrackingLayerImpl* grand_child_raw = grand_child.get(); 7312 AnimationScaleFactorTrackingLayerImpl* grand_child_raw = grand_child.get();
7312 AnimationScaleFactorTrackingLayerImpl* grand_parent_raw = grand_parent.get(); 7313 AnimationScaleFactorTrackingLayerImpl* grand_parent_raw = grand_parent.get();
7313 7314
7314 child->AddChild(std::move(grand_child)); 7315 child->test_properties()->AddChild(std::move(grand_child));
7315 parent->AddChild(std::move(child)); 7316 parent->test_properties()->AddChild(std::move(child));
7316 grand_parent->AddChild(std::move(parent)); 7317 grand_parent->test_properties()->AddChild(std::move(parent));
7317 7318
7318 SetLayerPropertiesForTesting(grand_parent_raw, identity_matrix, 7319 SetLayerPropertiesForTesting(grand_parent_raw, identity_matrix,
7319 gfx::Point3F(), gfx::PointF(), gfx::Size(1, 2), 7320 gfx::Point3F(), gfx::PointF(), gfx::Size(1, 2),
7320 true, false, true); 7321 true, false, true);
7321 SetLayerPropertiesForTesting(parent_raw, identity_matrix, gfx::Point3F(), 7322 SetLayerPropertiesForTesting(parent_raw, identity_matrix, gfx::Point3F(),
7322 gfx::PointF(), gfx::Size(1, 2), true, false, 7323 gfx::PointF(), gfx::Size(1, 2), true, false,
7323 false); 7324 false);
7324 SetLayerPropertiesForTesting(child_raw, identity_matrix, gfx::Point3F(), 7325 SetLayerPropertiesForTesting(child_raw, identity_matrix, gfx::Point3F(),
7325 gfx::PointF(), gfx::Size(1, 2), true, false, 7326 gfx::PointF(), gfx::Size(1, 2), true, false,
7326 false); 7327 false);
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
7660 LayerImpl::Create(host_impl.active_tree(), 7); 7661 LayerImpl::Create(host_impl.active_tree(), 7);
7661 std::unique_ptr<LayerImpl> grand_child2 = 7662 std::unique_ptr<LayerImpl> grand_child2 =
7662 LayerImpl::Create(host_impl.active_tree(), 9); 7663 LayerImpl::Create(host_impl.active_tree(), 9);
7663 7664
7664 LayerImpl* grand_parent_raw = grand_parent.get(); 7665 LayerImpl* grand_parent_raw = grand_parent.get();
7665 LayerImpl* parent_raw = parent.get(); 7666 LayerImpl* parent_raw = parent.get();
7666 LayerImpl* child_raw = child.get(); 7667 LayerImpl* child_raw = child.get();
7667 LayerImpl* grand_child1_raw = grand_child1.get(); 7668 LayerImpl* grand_child1_raw = grand_child1.get();
7668 LayerImpl* grand_child2_raw = grand_child2.get(); 7669 LayerImpl* grand_child2_raw = grand_child2.get();
7669 7670
7670 child->AddChild(std::move(grand_child1)); 7671 child->test_properties()->AddChild(std::move(grand_child1));
7671 child->AddChild(std::move(grand_child2)); 7672 child->test_properties()->AddChild(std::move(grand_child2));
7672 parent->AddChild(std::move(child)); 7673 parent->test_properties()->AddChild(std::move(child));
7673 grand_parent->AddChild(std::move(parent)); 7674 grand_parent->test_properties()->AddChild(std::move(parent));
7674 host_impl.active_tree()->SetRootLayer(std::move(grand_parent)); 7675 host_impl.active_tree()->SetRootLayer(std::move(grand_parent));
7675 7676
7676 SetLayerPropertiesForTesting(grand_parent_raw, identity_matrix, 7677 SetLayerPropertiesForTesting(grand_parent_raw, identity_matrix,
7677 gfx::Point3F(), gfx::PointF(), gfx::Size(1, 2), 7678 gfx::Point3F(), gfx::PointF(), gfx::Size(1, 2),
7678 true, false, true); 7679 true, false, true);
7679 SetLayerPropertiesForTesting(parent_raw, identity_matrix, gfx::Point3F(), 7680 SetLayerPropertiesForTesting(parent_raw, identity_matrix, gfx::Point3F(),
7680 gfx::PointF(), gfx::Size(1, 2), true, false, 7681 gfx::PointF(), gfx::Size(1, 2), true, false,
7681 false); 7682 false);
7682 7683
7683 SetLayerPropertiesForTesting(child_raw, identity_matrix, gfx::Point3F(), 7684 SetLayerPropertiesForTesting(child_raw, identity_matrix, gfx::Point3F(),
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
7909 std::unique_ptr<LayerImpl> root = 7910 std::unique_ptr<LayerImpl> root =
7910 LayerImpl::Create(host_impl.active_tree(), 1); 7911 LayerImpl::Create(host_impl.active_tree(), 1);
7911 LayerImpl* root_layer = root.get(); 7912 LayerImpl* root_layer = root.get();
7912 std::unique_ptr<LayerImpl> child1 = 7913 std::unique_ptr<LayerImpl> child1 =
7913 LayerImpl::Create(host_impl.active_tree(), 2); 7914 LayerImpl::Create(host_impl.active_tree(), 2);
7914 LayerImpl* child1_layer = child1.get(); 7915 LayerImpl* child1_layer = child1.get();
7915 std::unique_ptr<LayerImpl> child2 = 7916 std::unique_ptr<LayerImpl> child2 =
7916 LayerImpl::Create(host_impl.active_tree(), 3); 7917 LayerImpl::Create(host_impl.active_tree(), 3);
7917 LayerImpl* child2_layer = child2.get(); 7918 LayerImpl* child2_layer = child2.get();
7918 7919
7919 root->AddChild(std::move(child1)); 7920 root->test_properties()->AddChild(std::move(child1));
7920 root->AddChild(std::move(child2)); 7921 root->test_properties()->AddChild(std::move(child2));
7921 root->test_properties()->force_render_surface = true; 7922 root->test_properties()->force_render_surface = true;
7922 root->SetDrawsContent(true); 7923 root->SetDrawsContent(true);
7923 host_impl.active_tree()->SetRootLayer(std::move(root)); 7924 host_impl.active_tree()->SetRootLayer(std::move(root));
7924 7925
7925 gfx::Transform identity_matrix, scale_transform_child1, 7926 gfx::Transform identity_matrix, scale_transform_child1,
7926 scale_transform_child2; 7927 scale_transform_child2;
7927 scale_transform_child1.Scale(2, 3); 7928 scale_transform_child1.Scale(2, 3);
7928 scale_transform_child2.Scale(4, 5); 7929 scale_transform_child2.Scale(4, 5);
7929 7930
7930 SetLayerPropertiesForTesting(root_layer, identity_matrix, gfx::Point3F(), 7931 SetLayerPropertiesForTesting(root_layer, identity_matrix, gfx::Point3F(),
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
8105 SetLayerPropertiesForTesting(root, 8106 SetLayerPropertiesForTesting(root,
8106 identity_matrix, 8107 identity_matrix,
8107 gfx::Point3F(), 8108 gfx::Point3F(),
8108 gfx::PointF(), 8109 gfx::PointF(),
8109 root_size, 8110 root_size,
8110 false, 8111 false,
8111 false, 8112 false,
8112 true); 8113 true);
8113 root->SetMasksToBounds(true); 8114 root->SetMasksToBounds(true);
8114 8115
8115 root->AddChild(LayerImpl::Create(host_impl.active_tree(), 2)); 8116 root->test_properties()->AddChild(
8117 LayerImpl::Create(host_impl.active_tree(), 2));
8116 8118
8117 LayerImpl* sublayer = root->test_properties()->children[0]; 8119 LayerImpl* sublayer = root->test_properties()->children[0];
8118 SetLayerPropertiesForTesting(sublayer, 8120 SetLayerPropertiesForTesting(sublayer,
8119 identity_matrix, 8121 identity_matrix,
8120 gfx::Point3F(), 8122 gfx::Point3F(),
8121 gfx::PointF(), 8123 gfx::PointF(),
8122 sublayer_size, 8124 sublayer_size,
8123 false, 8125 false,
8124 false, 8126 false,
8125 false); 8127 false);
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
8822 gfx::PointF(), gfx::Size(10, 10), true, false, 8824 gfx::PointF(), gfx::Size(10, 10), true, false,
8823 false); 8825 false);
8824 SetLayerPropertiesForTesting(grandchild.get(), identity, gfx::Point3F(), 8826 SetLayerPropertiesForTesting(grandchild.get(), identity, gfx::Point3F(),
8825 gfx::PointF(), gfx::Size(10, 10), true, false, 8827 gfx::PointF(), gfx::Size(10, 10), true, false,
8826 false); 8828 false);
8827 8829
8828 LayerImpl* root_ptr = root.get(); 8830 LayerImpl* root_ptr = root.get();
8829 LayerImpl* child_ptr = child.get(); 8831 LayerImpl* child_ptr = child.get();
8830 LayerImpl* grandchild_ptr = grandchild.get(); 8832 LayerImpl* grandchild_ptr = grandchild.get();
8831 8833
8832 child->AddChild(std::move(grandchild)); 8834 child->test_properties()->AddChild(std::move(grandchild));
8833 root->AddChild(std::move(child)); 8835 root->test_properties()->AddChild(std::move(child));
8834 host_impl.active_tree()->SetRootLayer(std::move(root)); 8836 host_impl.active_tree()->SetRootLayer(std::move(root));
8835 8837
8836 // Check the non-skipped case. 8838 // Check the non-skipped case.
8837 // ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); 8839 // ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr);
8838 // EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); 8840 // EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect());
8839 8841
8840 // Now we will reset the visible rect from property trees for the grandchild, 8842 // Now we will reset the visible rect from property trees for the grandchild,
8841 // and we will configure |child| in several ways that should force the subtree 8843 // and we will configure |child| in several ways that should force the subtree
8842 // to be skipped. The visible content rect for |grandchild| should, therefore, 8844 // to be skipped. The visible content rect for |grandchild| should, therefore,
8843 // remain empty. 8845 // remain empty.
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
9027 SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(), 9029 SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(),
9028 gfx::PointF(), gfx::Size(10, 10), true, false, 9030 gfx::PointF(), gfx::Size(10, 10), true, false,
9029 false); 9031 false);
9030 SetLayerPropertiesForTesting(grandchild.get(), identity, gfx::Point3F(), 9032 SetLayerPropertiesForTesting(grandchild.get(), identity, gfx::Point3F(),
9031 gfx::PointF(), gfx::Size(10, 10), true, false, 9033 gfx::PointF(), gfx::Size(10, 10), true, false,
9032 false); 9034 false);
9033 9035
9034 LayerImpl* root_ptr = root.get(); 9036 LayerImpl* root_ptr = root.get();
9035 LayerImpl* grandchild_ptr = grandchild.get(); 9037 LayerImpl* grandchild_ptr = grandchild.get();
9036 9038
9037 child->AddChild(std::move(grandchild)); 9039 child->test_properties()->AddChild(std::move(grandchild));
9038 root->AddChild(std::move(child)); 9040 root->test_properties()->AddChild(std::move(child));
9039 9041
9040 host_impl.pending_tree()->SetRootLayer(std::move(root)); 9042 host_impl.pending_tree()->SetRootLayer(std::move(root));
9041 9043
9042 // Check the non-skipped case. 9044 // Check the non-skipped case.
9043 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); 9045 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr);
9044 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); 9046 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect());
9045 9047
9046 std::unique_ptr<KeyframedFloatAnimationCurve> curve( 9048 std::unique_ptr<KeyframedFloatAnimationCurve> curve(
9047 KeyframedFloatAnimationCurve::Create()); 9049 KeyframedFloatAnimationCurve::Create());
9048 std::unique_ptr<TimingFunction> func = 9050 std::unique_ptr<TimingFunction> func =
(...skipping 1275 matching lines...) Expand 10 before | Expand all | Expand 10 after
10324 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); 10326 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index());
10325 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); 10327 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index());
10326 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); 10328 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index());
10327 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); 10329 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index());
10328 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); 10330 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index());
10329 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); 10331 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index());
10330 } 10332 }
10331 10333
10332 } // namespace 10334 } // namespace
10333 } // namespace cc 10335 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/damage_tracker_unittest.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