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

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

Issue 1372253002: gfx: Make conversions from gfx::Point to PointF explicit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pointfconvert-gfx: . Created 5 years, 2 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
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.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 } 908 }
909 909
910 void SetupTree() override { 910 void SetupTree() override {
911 root_layer_ = Layer::Create(layer_settings()); 911 root_layer_ = Layer::Create(layer_settings());
912 root_layer_->SetBounds(gfx::Size(10, 20)); 912 root_layer_->SetBounds(gfx::Size(10, 20));
913 913
914 bool paint_scrollbar = true; 914 bool paint_scrollbar = true;
915 bool has_thumb = false; 915 bool has_thumb = false;
916 scrollbar_ = FakePaintedScrollbarLayer::Create( 916 scrollbar_ = FakePaintedScrollbarLayer::Create(
917 layer_settings(), paint_scrollbar, has_thumb, root_layer_->id()); 917 layer_settings(), paint_scrollbar, has_thumb, root_layer_->id());
918 scrollbar_->SetPosition(gfx::Point(0, 10)); 918 scrollbar_->SetPosition(gfx::PointF(0.f, 10.f));
919 scrollbar_->SetBounds(gfx::Size(10, 10)); 919 scrollbar_->SetBounds(gfx::Size(10, 10));
920 920
921 root_layer_->AddChild(scrollbar_); 921 root_layer_->AddChild(scrollbar_);
922 922
923 layer_tree_host()->SetRootLayer(root_layer_); 923 layer_tree_host()->SetRootLayer(root_layer_);
924 LayerTreeHostTest::SetupTree(); 924 LayerTreeHostTest::SetupTree();
925 } 925 }
926 926
927 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 927 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
928 928
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
1624 layer_tree_host()->SetViewportSize(gfx::Size(60, 60)); 1624 layer_tree_host()->SetViewportSize(gfx::Size(60, 60));
1625 layer_tree_host()->SetDeviceScaleFactor(1.5); 1625 layer_tree_host()->SetDeviceScaleFactor(1.5);
1626 EXPECT_EQ(gfx::Size(60, 60), layer_tree_host()->device_viewport_size()); 1626 EXPECT_EQ(gfx::Size(60, 60), layer_tree_host()->device_viewport_size());
1627 1627
1628 root_layer_->AddChild(child_layer_); 1628 root_layer_->AddChild(child_layer_);
1629 1629
1630 root_layer_->SetIsDrawable(true); 1630 root_layer_->SetIsDrawable(true);
1631 root_layer_->SetBounds(gfx::Size(30, 30)); 1631 root_layer_->SetBounds(gfx::Size(30, 30));
1632 1632
1633 child_layer_->SetIsDrawable(true); 1633 child_layer_->SetIsDrawable(true);
1634 child_layer_->SetPosition(gfx::Point(2, 2)); 1634 child_layer_->SetPosition(gfx::PointF(2.f, 2.f));
1635 child_layer_->SetBounds(gfx::Size(10, 10)); 1635 child_layer_->SetBounds(gfx::Size(10, 10));
1636 1636
1637 layer_tree_host()->SetRootLayer(root_layer_); 1637 layer_tree_host()->SetRootLayer(root_layer_);
1638 1638
1639 PostSetNeedsCommitToMainThread(); 1639 PostSetNeedsCommitToMainThread();
1640 } 1640 }
1641 1641
1642 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { 1642 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override {
1643 // Should only do one commit. 1643 // Should only do one commit.
1644 EXPECT_EQ(0, impl->active_tree()->source_frame_number()); 1644 EXPECT_EQ(0, impl->active_tree()->source_frame_number());
1645 // Device scale factor should come over to impl. 1645 // Device scale factor should come over to impl.
1646 EXPECT_NEAR(impl->active_tree()->device_scale_factor(), 1.5f, 0.00001f); 1646 EXPECT_NEAR(impl->active_tree()->device_scale_factor(), 1.5f, 0.00001f);
1647 1647
1648 // Both layers are on impl. 1648 // Both layers are on impl.
1649 ASSERT_EQ(1u, impl->active_tree()->root_layer()->children().size()); 1649 ASSERT_EQ(1u, impl->active_tree()->root_layer()->children().size());
1650 1650
1651 // Device viewport is scaled. 1651 // Device viewport is scaled.
1652 EXPECT_EQ(gfx::Size(60, 60), impl->DrawViewportSize()); 1652 EXPECT_EQ(gfx::Size(60, 60), impl->DrawViewportSize());
1653 1653
1654 FakePictureLayerImpl* root = 1654 FakePictureLayerImpl* root =
1655 static_cast<FakePictureLayerImpl*>(impl->active_tree()->root_layer()); 1655 static_cast<FakePictureLayerImpl*>(impl->active_tree()->root_layer());
1656 FakePictureLayerImpl* child = static_cast<FakePictureLayerImpl*>( 1656 FakePictureLayerImpl* child = static_cast<FakePictureLayerImpl*>(
1657 impl->active_tree()->root_layer()->children()[0]); 1657 impl->active_tree()->root_layer()->children()[0]);
1658 1658
1659 // Positions remain in layout pixels. 1659 // Positions remain in layout pixels.
1660 EXPECT_EQ(gfx::Point(0, 0), root->position()); 1660 EXPECT_EQ(gfx::PointF(), root->position());
1661 EXPECT_EQ(gfx::Point(2, 2), child->position()); 1661 EXPECT_EQ(gfx::PointF(2.f, 2.f), child->position());
1662 1662
1663 // Compute all the layer transforms for the frame. 1663 // Compute all the layer transforms for the frame.
1664 LayerTreeHostImpl::FrameData frame_data; 1664 LayerTreeHostImpl::FrameData frame_data;
1665 impl->PrepareToDraw(&frame_data); 1665 impl->PrepareToDraw(&frame_data);
1666 impl->DidDrawAllLayers(frame_data); 1666 impl->DidDrawAllLayers(frame_data);
1667 1667
1668 const LayerImplList& render_surface_layer_list = 1668 const LayerImplList& render_surface_layer_list =
1669 *frame_data.render_surface_layer_list; 1669 *frame_data.render_surface_layer_list;
1670 1670
1671 // Both layers should be drawing into the root render surface. 1671 // Both layers should be drawing into the root render surface.
(...skipping 1608 matching lines...) Expand 10 before | Expand all | Expand 10 after
3280 EXPECT_FALSE(child_->needs_push_properties()); 3280 EXPECT_FALSE(child_->needs_push_properties());
3281 EXPECT_FALSE(child_->descendant_needs_push_properties()); 3281 EXPECT_FALSE(child_->descendant_needs_push_properties());
3282 EXPECT_FALSE(grandchild1_->needs_push_properties()); 3282 EXPECT_FALSE(grandchild1_->needs_push_properties());
3283 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); 3283 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties());
3284 EXPECT_FALSE(grandchild2_->needs_push_properties()); 3284 EXPECT_FALSE(grandchild2_->needs_push_properties());
3285 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); 3285 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties());
3286 EXPECT_FALSE(grandchild3_->needs_push_properties()); 3286 EXPECT_FALSE(grandchild3_->needs_push_properties());
3287 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); 3287 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties());
3288 3288
3289 grandchild1_->RemoveFromParent(); 3289 grandchild1_->RemoveFromParent();
3290 grandchild1_->SetPosition(gfx::Point(1, 1)); 3290 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f));
3291 3291
3292 EXPECT_FALSE(root_->needs_push_properties()); 3292 EXPECT_FALSE(root_->needs_push_properties());
3293 EXPECT_FALSE(root_->descendant_needs_push_properties()); 3293 EXPECT_FALSE(root_->descendant_needs_push_properties());
3294 EXPECT_FALSE(child_->needs_push_properties()); 3294 EXPECT_FALSE(child_->needs_push_properties());
3295 EXPECT_FALSE(child_->descendant_needs_push_properties()); 3295 EXPECT_FALSE(child_->descendant_needs_push_properties());
3296 EXPECT_FALSE(grandchild2_->needs_push_properties()); 3296 EXPECT_FALSE(grandchild2_->needs_push_properties());
3297 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); 3297 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties());
3298 EXPECT_FALSE(grandchild3_->needs_push_properties()); 3298 EXPECT_FALSE(grandchild3_->needs_push_properties());
3299 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); 3299 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties());
3300 3300
3301 child_->AddChild(grandchild1_); 3301 child_->AddChild(grandchild1_);
3302 3302
3303 EXPECT_FALSE(root_->needs_push_properties()); 3303 EXPECT_FALSE(root_->needs_push_properties());
3304 EXPECT_TRUE(root_->descendant_needs_push_properties()); 3304 EXPECT_TRUE(root_->descendant_needs_push_properties());
3305 EXPECT_FALSE(child_->needs_push_properties()); 3305 EXPECT_FALSE(child_->needs_push_properties());
3306 EXPECT_TRUE(child_->descendant_needs_push_properties()); 3306 EXPECT_TRUE(child_->descendant_needs_push_properties());
3307 EXPECT_TRUE(grandchild1_->needs_push_properties()); 3307 EXPECT_TRUE(grandchild1_->needs_push_properties());
3308 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); 3308 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties());
3309 EXPECT_FALSE(grandchild2_->needs_push_properties()); 3309 EXPECT_FALSE(grandchild2_->needs_push_properties());
3310 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); 3310 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties());
3311 EXPECT_FALSE(grandchild3_->needs_push_properties()); 3311 EXPECT_FALSE(grandchild3_->needs_push_properties());
3312 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); 3312 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties());
3313 3313
3314 grandchild2_->SetPosition(gfx::Point(1, 1)); 3314 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f));
3315 3315
3316 EXPECT_FALSE(root_->needs_push_properties()); 3316 EXPECT_FALSE(root_->needs_push_properties());
3317 EXPECT_TRUE(root_->descendant_needs_push_properties()); 3317 EXPECT_TRUE(root_->descendant_needs_push_properties());
3318 EXPECT_FALSE(child_->needs_push_properties()); 3318 EXPECT_FALSE(child_->needs_push_properties());
3319 EXPECT_TRUE(child_->descendant_needs_push_properties()); 3319 EXPECT_TRUE(child_->descendant_needs_push_properties());
3320 EXPECT_TRUE(grandchild1_->needs_push_properties()); 3320 EXPECT_TRUE(grandchild1_->needs_push_properties());
3321 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); 3321 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties());
3322 EXPECT_TRUE(grandchild2_->needs_push_properties()); 3322 EXPECT_TRUE(grandchild2_->needs_push_properties());
3323 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); 3323 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties());
3324 EXPECT_FALSE(grandchild3_->needs_push_properties()); 3324 EXPECT_FALSE(grandchild3_->needs_push_properties());
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
3412 EXPECT_FALSE(child_->descendant_needs_push_properties()); 3412 EXPECT_FALSE(child_->descendant_needs_push_properties());
3413 EXPECT_FALSE(grandchild1_->needs_push_properties()); 3413 EXPECT_FALSE(grandchild1_->needs_push_properties());
3414 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); 3414 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties());
3415 EXPECT_FALSE(grandchild2_->needs_push_properties()); 3415 EXPECT_FALSE(grandchild2_->needs_push_properties());
3416 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); 3416 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties());
3417 EXPECT_FALSE(grandchild3_->needs_push_properties()); 3417 EXPECT_FALSE(grandchild3_->needs_push_properties());
3418 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); 3418 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties());
3419 3419
3420 // Change grandchildren while their parent is not in the tree. 3420 // Change grandchildren while their parent is not in the tree.
3421 child_->RemoveFromParent(); 3421 child_->RemoveFromParent();
3422 grandchild1_->SetPosition(gfx::Point(1, 1)); 3422 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f));
3423 grandchild2_->SetPosition(gfx::Point(1, 1)); 3423 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f));
3424 root_->AddChild(child_); 3424 root_->AddChild(child_);
3425 3425
3426 EXPECT_FALSE(root_->needs_push_properties()); 3426 EXPECT_FALSE(root_->needs_push_properties());
3427 EXPECT_TRUE(root_->descendant_needs_push_properties()); 3427 EXPECT_TRUE(root_->descendant_needs_push_properties());
3428 EXPECT_TRUE(child_->needs_push_properties()); 3428 EXPECT_TRUE(child_->needs_push_properties());
3429 EXPECT_TRUE(child_->descendant_needs_push_properties()); 3429 EXPECT_TRUE(child_->descendant_needs_push_properties());
3430 EXPECT_TRUE(grandchild1_->needs_push_properties()); 3430 EXPECT_TRUE(grandchild1_->needs_push_properties());
3431 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); 3431 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties());
3432 EXPECT_TRUE(grandchild2_->needs_push_properties()); 3432 EXPECT_TRUE(grandchild2_->needs_push_properties());
3433 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); 3433 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties());
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
3478 EXPECT_FALSE(root_->descendant_needs_push_properties()); 3478 EXPECT_FALSE(root_->descendant_needs_push_properties());
3479 EXPECT_FALSE(child_->needs_push_properties()); 3479 EXPECT_FALSE(child_->needs_push_properties());
3480 EXPECT_FALSE(child_->descendant_needs_push_properties()); 3480 EXPECT_FALSE(child_->descendant_needs_push_properties());
3481 EXPECT_FALSE(grandchild1_->needs_push_properties()); 3481 EXPECT_FALSE(grandchild1_->needs_push_properties());
3482 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); 3482 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties());
3483 EXPECT_FALSE(grandchild2_->needs_push_properties()); 3483 EXPECT_FALSE(grandchild2_->needs_push_properties());
3484 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); 3484 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties());
3485 EXPECT_FALSE(grandchild3_->needs_push_properties()); 3485 EXPECT_FALSE(grandchild3_->needs_push_properties());
3486 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); 3486 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties());
3487 3487
3488 child_->SetPosition(gfx::Point(1, 1)); 3488 child_->SetPosition(gfx::PointF(1.f, 1.f));
3489 grandchild1_->SetPosition(gfx::Point(1, 1)); 3489 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f));
3490 grandchild2_->SetPosition(gfx::Point(1, 1)); 3490 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f));
3491 3491
3492 EXPECT_FALSE(root_->needs_push_properties()); 3492 EXPECT_FALSE(root_->needs_push_properties());
3493 EXPECT_TRUE(root_->descendant_needs_push_properties()); 3493 EXPECT_TRUE(root_->descendant_needs_push_properties());
3494 EXPECT_TRUE(child_->needs_push_properties()); 3494 EXPECT_TRUE(child_->needs_push_properties());
3495 EXPECT_TRUE(child_->descendant_needs_push_properties()); 3495 EXPECT_TRUE(child_->descendant_needs_push_properties());
3496 EXPECT_TRUE(grandchild1_->needs_push_properties()); 3496 EXPECT_TRUE(grandchild1_->needs_push_properties());
3497 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); 3497 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties());
3498 EXPECT_TRUE(grandchild2_->needs_push_properties()); 3498 EXPECT_TRUE(grandchild2_->needs_push_properties());
3499 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); 3499 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties());
3500 EXPECT_FALSE(grandchild3_->needs_push_properties()); 3500 EXPECT_FALSE(grandchild3_->needs_push_properties());
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
3542 EXPECT_FALSE(root_->descendant_needs_push_properties()); 3542 EXPECT_FALSE(root_->descendant_needs_push_properties());
3543 EXPECT_FALSE(child_->needs_push_properties()); 3543 EXPECT_FALSE(child_->needs_push_properties());
3544 EXPECT_FALSE(child_->descendant_needs_push_properties()); 3544 EXPECT_FALSE(child_->descendant_needs_push_properties());
3545 EXPECT_FALSE(grandchild1_->needs_push_properties()); 3545 EXPECT_FALSE(grandchild1_->needs_push_properties());
3546 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); 3546 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties());
3547 EXPECT_FALSE(grandchild2_->needs_push_properties()); 3547 EXPECT_FALSE(grandchild2_->needs_push_properties());
3548 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); 3548 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties());
3549 EXPECT_FALSE(grandchild3_->needs_push_properties()); 3549 EXPECT_FALSE(grandchild3_->needs_push_properties());
3550 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); 3550 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties());
3551 3551
3552 grandchild1_->SetPosition(gfx::Point(1, 1)); 3552 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f));
3553 grandchild2_->SetPosition(gfx::Point(1, 1)); 3553 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f));
3554 child_->SetPosition(gfx::Point(1, 1)); 3554 child_->SetPosition(gfx::PointF(1.f, 1.f));
3555 3555
3556 EXPECT_FALSE(root_->needs_push_properties()); 3556 EXPECT_FALSE(root_->needs_push_properties());
3557 EXPECT_TRUE(root_->descendant_needs_push_properties()); 3557 EXPECT_TRUE(root_->descendant_needs_push_properties());
3558 EXPECT_TRUE(child_->needs_push_properties()); 3558 EXPECT_TRUE(child_->needs_push_properties());
3559 EXPECT_TRUE(child_->descendant_needs_push_properties()); 3559 EXPECT_TRUE(child_->descendant_needs_push_properties());
3560 EXPECT_TRUE(grandchild1_->needs_push_properties()); 3560 EXPECT_TRUE(grandchild1_->needs_push_properties());
3561 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); 3561 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties());
3562 EXPECT_TRUE(grandchild2_->needs_push_properties()); 3562 EXPECT_TRUE(grandchild2_->needs_push_properties());
3563 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); 3563 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties());
3564 EXPECT_FALSE(grandchild3_->needs_push_properties()); 3564 EXPECT_FALSE(grandchild3_->needs_push_properties());
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
3734 invalidate_layer_ = layer; 3734 invalidate_layer_ = layer;
3735 } 3735 }
3736 }; 3736 };
3737 3737
3738 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestIOSurfaceLayerInvalidate); 3738 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestIOSurfaceLayerInvalidate);
3739 3739
3740 class LayerTreeHostTestPushHiddenLayer : public LayerTreeHostTest { 3740 class LayerTreeHostTestPushHiddenLayer : public LayerTreeHostTest {
3741 protected: 3741 protected:
3742 void SetupTree() override { 3742 void SetupTree() override {
3743 root_layer_ = Layer::Create(layer_settings()); 3743 root_layer_ = Layer::Create(layer_settings());
3744 root_layer_->SetPosition(gfx::Point()); 3744 root_layer_->SetPosition(gfx::PointF());
3745 root_layer_->SetBounds(gfx::Size(10, 10)); 3745 root_layer_->SetBounds(gfx::Size(10, 10));
3746 3746
3747 parent_layer_ = SolidColorLayer::Create(layer_settings()); 3747 parent_layer_ = SolidColorLayer::Create(layer_settings());
3748 parent_layer_->SetPosition(gfx::Point()); 3748 parent_layer_->SetPosition(gfx::PointF());
3749 parent_layer_->SetBounds(gfx::Size(10, 10)); 3749 parent_layer_->SetBounds(gfx::Size(10, 10));
3750 parent_layer_->SetIsDrawable(true); 3750 parent_layer_->SetIsDrawable(true);
3751 root_layer_->AddChild(parent_layer_); 3751 root_layer_->AddChild(parent_layer_);
3752 3752
3753 child_layer_ = SolidColorLayer::Create(layer_settings()); 3753 child_layer_ = SolidColorLayer::Create(layer_settings());
3754 child_layer_->SetPosition(gfx::Point()); 3754 child_layer_->SetPosition(gfx::PointF());
3755 child_layer_->SetBounds(gfx::Size(10, 10)); 3755 child_layer_->SetBounds(gfx::Size(10, 10));
3756 child_layer_->SetIsDrawable(true); 3756 child_layer_->SetIsDrawable(true);
3757 parent_layer_->AddChild(child_layer_); 3757 parent_layer_->AddChild(child_layer_);
3758 3758
3759 layer_tree_host()->SetRootLayer(root_layer_); 3759 layer_tree_host()->SetRootLayer(root_layer_);
3760 LayerTreeHostTest::SetupTree(); 3760 LayerTreeHostTest::SetupTree();
3761 } 3761 }
3762 3762
3763 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 3763 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
3764 3764
(...skipping 2030 matching lines...) Expand 10 before | Expand all | Expand 10 after
5795 FakePictureLayer::Create(layer_settings(), &client_); 5795 FakePictureLayer::Create(layer_settings(), &client_);
5796 content_layer->AddChild(content_child_layer); 5796 content_layer->AddChild(content_child_layer);
5797 5797
5798 scoped_refptr<FakePictureLayer> mask_layer = 5798 scoped_refptr<FakePictureLayer> mask_layer =
5799 FakePictureLayer::Create(layer_settings(), &client_); 5799 FakePictureLayer::Create(layer_settings(), &client_);
5800 content_layer->SetMaskLayer(mask_layer.get()); 5800 content_layer->SetMaskLayer(mask_layer.get());
5801 5801
5802 gfx::Size root_size(100, 100); 5802 gfx::Size root_size(100, 100);
5803 root->SetBounds(root_size); 5803 root->SetBounds(root_size);
5804 5804
5805 gfx::Rect clipping_rect(20, 10, 10, 20); 5805 gfx::PointF clipping_origin(20.f, 10.f);
5806 clipping_layer->SetBounds(clipping_rect.size()); 5806 gfx::Size clipping_size(10, 20);
5807 clipping_layer->SetPosition(clipping_rect.origin()); 5807 clipping_layer->SetBounds(clipping_size);
5808 clipping_layer->SetPosition(clipping_origin);
5808 clipping_layer->SetMasksToBounds(true); 5809 clipping_layer->SetMasksToBounds(true);
5809 5810
5810 gfx::Size layer_size(50, 50); 5811 gfx::Size layer_size(50, 50);
5811 content_layer->SetBounds(layer_size); 5812 content_layer->SetBounds(layer_size);
5812 content_layer->SetPosition(gfx::Point() - clipping_rect.OffsetFromOrigin()); 5813 content_layer->SetPosition(gfx::PointF() -
5814 clipping_origin.OffsetFromOrigin());
5813 5815
5814 gfx::Size child_size(50, 50); 5816 gfx::Size child_size(50, 50);
5815 content_child_layer->SetBounds(child_size); 5817 content_child_layer->SetBounds(child_size);
5816 content_child_layer->SetPosition(gfx::Point(20, 0)); 5818 content_child_layer->SetPosition(gfx::PointF(20.f, 0.f));
5817 5819
5818 gfx::Size mask_size(100, 100); 5820 gfx::Size mask_size(100, 100);
5819 mask_layer->SetBounds(mask_size); 5821 mask_layer->SetBounds(mask_size);
5820 mask_layer->SetIsMask(true); 5822 mask_layer->SetIsMask(true);
5821 5823
5822 layer_tree_host()->SetRootLayer(root); 5824 layer_tree_host()->SetRootLayer(root);
5823 LayerTreeTest::SetupTree(); 5825 LayerTreeTest::SetupTree();
5824 } 5826 }
5825 5827
5826 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 5828 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
6394 EndTest(); 6396 EndTest();
6395 } 6397 }
6396 6398
6397 void AfterTest() override {} 6399 void AfterTest() override {}
6398 }; 6400 };
6399 6401
6400 MULTI_THREAD_TEST_F(LayerTreeHostTestDestroyWhileInitializingOutputSurface); 6402 MULTI_THREAD_TEST_F(LayerTreeHostTestDestroyWhileInitializingOutputSurface);
6401 6403
6402 } // namespace 6404 } // namespace
6403 } // namespace cc 6405 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698