| OLD | NEW |
| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "cc/animation/layer_animation_controller.h" | 10 #include "cc/animation/layer_animation_controller.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 #include "testing/gtest/include/gtest/gtest.h" | 39 #include "testing/gtest/include/gtest/gtest.h" |
| 40 #include "ui/gfx/geometry/quad_f.h" | 40 #include "ui/gfx/geometry/quad_f.h" |
| 41 #include "ui/gfx/geometry/vector2d_conversions.h" | 41 #include "ui/gfx/geometry/vector2d_conversions.h" |
| 42 #include "ui/gfx/transform.h" | 42 #include "ui/gfx/transform.h" |
| 43 | 43 |
| 44 namespace cc { | 44 namespace cc { |
| 45 namespace { | 45 namespace { |
| 46 | 46 |
| 47 class LayerWithForcedDrawsContent : public Layer { | 47 class LayerWithForcedDrawsContent : public Layer { |
| 48 public: | 48 public: |
| 49 LayerWithForcedDrawsContent() {} | 49 explicit LayerWithForcedDrawsContent(const LayerSettings& settings) |
| 50 : Layer(settings) {} |
| 50 | 51 |
| 51 bool DrawsContent() const override; | 52 bool DrawsContent() const override; |
| 52 | 53 |
| 53 private: | 54 private: |
| 54 ~LayerWithForcedDrawsContent() override {} | 55 ~LayerWithForcedDrawsContent() override {} |
| 55 }; | 56 }; |
| 56 | 57 |
| 57 bool LayerWithForcedDrawsContent::DrawsContent() const { return true; } | 58 bool LayerWithForcedDrawsContent::DrawsContent() const { return true; } |
| 58 | 59 |
| 59 class MockContentLayerClient : public ContentLayerClient { | 60 class MockContentLayerClient : public ContentLayerClient { |
| 60 public: | 61 public: |
| 61 MockContentLayerClient() {} | 62 MockContentLayerClient() {} |
| 62 ~MockContentLayerClient() override {} | 63 ~MockContentLayerClient() override {} |
| 63 void PaintContents(SkCanvas* canvas, | 64 void PaintContents(SkCanvas* canvas, |
| 64 const gfx::Rect& clip, | 65 const gfx::Rect& clip, |
| 65 PaintingControlSetting picture_control) override {} | 66 PaintingControlSetting picture_control) override {} |
| 66 void PaintContentsToDisplayList( | 67 void PaintContentsToDisplayList( |
| 67 DisplayItemList* display_list, | 68 DisplayItemList* display_list, |
| 68 const gfx::Rect& clip, | 69 const gfx::Rect& clip, |
| 69 PaintingControlSetting picture_control) override { | 70 PaintingControlSetting picture_control) override { |
| 70 NOTIMPLEMENTED(); | 71 NOTIMPLEMENTED(); |
| 71 } | 72 } |
| 72 bool FillsBoundsCompletely() const override { return false; } | 73 bool FillsBoundsCompletely() const override { return false; } |
| 73 }; | 74 }; |
| 74 | 75 |
| 75 scoped_refptr<FakePictureLayer> CreateDrawablePictureLayer( | 76 scoped_refptr<FakePictureLayer> CreateDrawablePictureLayer( |
| 77 const LayerSettings& settings, |
| 76 ContentLayerClient* delegate) { | 78 ContentLayerClient* delegate) { |
| 77 scoped_refptr<FakePictureLayer> to_return = | 79 scoped_refptr<FakePictureLayer> to_return = |
| 78 FakePictureLayer::Create(delegate); | 80 FakePictureLayer::Create(settings, delegate); |
| 79 to_return->SetIsDrawable(true); | 81 to_return->SetIsDrawable(true); |
| 80 return to_return; | 82 return to_return; |
| 81 } | 83 } |
| 82 | 84 |
| 83 scoped_refptr<ContentLayer> CreateDrawableContentLayer( | 85 scoped_refptr<ContentLayer> CreateDrawableContentLayer( |
| 86 const LayerSettings& settings, |
| 84 ContentLayerClient* delegate) { | 87 ContentLayerClient* delegate) { |
| 85 scoped_refptr<ContentLayer> to_return = ContentLayer::Create(delegate); | 88 scoped_refptr<ContentLayer> to_return = |
| 89 ContentLayer::Create(settings, delegate); |
| 86 to_return->SetIsDrawable(true); | 90 to_return->SetIsDrawable(true); |
| 87 return to_return; | 91 return to_return; |
| 88 } | 92 } |
| 89 | 93 |
| 90 #define EXPECT_CONTENTS_SCALE_EQ(expected, layer) \ | 94 #define EXPECT_CONTENTS_SCALE_EQ(expected, layer) \ |
| 91 do { \ | 95 do { \ |
| 92 EXPECT_FLOAT_EQ(expected, layer->contents_scale_x()); \ | 96 EXPECT_FLOAT_EQ(expected, layer->contents_scale_x()); \ |
| 93 EXPECT_FLOAT_EQ(expected, layer->contents_scale_y()); \ | 97 EXPECT_FLOAT_EQ(expected, layer->contents_scale_y()); \ |
| 94 } while (false) | 98 } while (false) |
| 95 | 99 |
| 96 #define EXPECT_IDEAL_SCALE_EQ(expected, layer) \ | 100 #define EXPECT_IDEAL_SCALE_EQ(expected, layer) \ |
| 97 do { \ | 101 do { \ |
| 98 EXPECT_FLOAT_EQ(expected, layer->draw_properties().ideal_contents_scale); \ | 102 EXPECT_FLOAT_EQ(expected, layer->draw_properties().ideal_contents_scale); \ |
| 99 } while (false) | 103 } while (false) |
| 100 | 104 |
| 101 TEST_F(LayerTreeHostCommonTest, TransformsForNoOpLayer) { | 105 TEST_F(LayerTreeHostCommonTest, TransformsForNoOpLayer) { |
| 102 // Sanity check: For layers positioned at zero, with zero size, | 106 // Sanity check: For layers positioned at zero, with zero size, |
| 103 // and with identity transforms, then the draw transform, | 107 // and with identity transforms, then the draw transform, |
| 104 // screen space transform, and the hierarchy passed on to children | 108 // screen space transform, and the hierarchy passed on to children |
| 105 // layers should also be identity transforms. | 109 // layers should also be identity transforms. |
| 106 | 110 |
| 107 scoped_refptr<Layer> parent = Layer::Create(); | 111 scoped_refptr<Layer> parent = Layer::Create(layer_settings()); |
| 108 scoped_refptr<Layer> child = Layer::Create(); | 112 scoped_refptr<Layer> child = Layer::Create(layer_settings()); |
| 109 scoped_refptr<Layer> grand_child = Layer::Create(); | 113 scoped_refptr<Layer> grand_child = Layer::Create(layer_settings()); |
| 110 parent->AddChild(child); | 114 parent->AddChild(child); |
| 111 child->AddChild(grand_child); | 115 child->AddChild(grand_child); |
| 112 | 116 |
| 113 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 117 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 114 host->SetRootLayer(parent); | 118 host->SetRootLayer(parent); |
| 115 | 119 |
| 116 gfx::Transform identity_matrix; | 120 gfx::Transform identity_matrix; |
| 117 SetLayerPropertiesForTesting(parent.get(), | 121 SetLayerPropertiesForTesting(parent.get(), |
| 118 identity_matrix, | 122 identity_matrix, |
| 119 gfx::Point3F(), | 123 gfx::Point3F(), |
| (...skipping 21 matching lines...) Expand all Loading... |
| 141 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, child->draw_transform()); | 145 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, child->draw_transform()); |
| 142 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, | 146 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, |
| 143 child->screen_space_transform()); | 147 child->screen_space_transform()); |
| 144 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, | 148 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, |
| 145 grand_child->draw_transform()); | 149 grand_child->draw_transform()); |
| 146 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, | 150 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, |
| 147 grand_child->screen_space_transform()); | 151 grand_child->screen_space_transform()); |
| 148 } | 152 } |
| 149 | 153 |
| 150 TEST_F(LayerTreeHostCommonTest, DoNotSkipLayersWithHandlers) { | 154 TEST_F(LayerTreeHostCommonTest, DoNotSkipLayersWithHandlers) { |
| 151 scoped_refptr<Layer> parent = Layer::Create(); | 155 scoped_refptr<Layer> parent = Layer::Create(layer_settings()); |
| 152 scoped_refptr<Layer> child = Layer::Create(); | 156 scoped_refptr<Layer> child = Layer::Create(layer_settings()); |
| 153 scoped_refptr<Layer> grand_child = Layer::Create(); | 157 scoped_refptr<Layer> grand_child = Layer::Create(layer_settings()); |
| 154 parent->AddChild(child); | 158 parent->AddChild(child); |
| 155 child->AddChild(grand_child); | 159 child->AddChild(grand_child); |
| 156 | 160 |
| 157 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 161 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 158 host->SetRootLayer(parent); | 162 host->SetRootLayer(parent); |
| 159 | 163 |
| 160 gfx::Transform identity_matrix; | 164 gfx::Transform identity_matrix; |
| 161 SetLayerPropertiesForTesting(parent.get(), | 165 SetLayerPropertiesForTesting(parent.get(), |
| 162 identity_matrix, | 166 identity_matrix, |
| 163 gfx::Point3F(), | 167 gfx::Point3F(), |
| (...skipping 24 matching lines...) Expand all Loading... |
| 188 ExecuteCalculateDrawProperties(parent.get()); | 192 ExecuteCalculateDrawProperties(parent.get()); |
| 189 | 193 |
| 190 // Check that we've computed draw properties for the subtree rooted at | 194 // Check that we've computed draw properties for the subtree rooted at |
| 191 // |child|. | 195 // |child|. |
| 192 EXPECT_FALSE(child->draw_transform().IsIdentity()); | 196 EXPECT_FALSE(child->draw_transform().IsIdentity()); |
| 193 EXPECT_FALSE(grand_child->draw_transform().IsIdentity()); | 197 EXPECT_FALSE(grand_child->draw_transform().IsIdentity()); |
| 194 } | 198 } |
| 195 | 199 |
| 196 TEST_F(LayerTreeHostCommonTest, TransformsForSingleLayer) { | 200 TEST_F(LayerTreeHostCommonTest, TransformsForSingleLayer) { |
| 197 gfx::Transform identity_matrix; | 201 gfx::Transform identity_matrix; |
| 198 scoped_refptr<Layer> layer = Layer::Create(); | 202 scoped_refptr<Layer> layer = Layer::Create(layer_settings()); |
| 199 | 203 |
| 200 scoped_refptr<Layer> root = Layer::Create(); | 204 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 201 SetLayerPropertiesForTesting(root.get(), | 205 SetLayerPropertiesForTesting(root.get(), |
| 202 identity_matrix, | 206 identity_matrix, |
| 203 gfx::Point3F(), | 207 gfx::Point3F(), |
| 204 gfx::PointF(), | 208 gfx::PointF(), |
| 205 gfx::Size(1, 2), | 209 gfx::Size(1, 2), |
| 206 true, | 210 true, |
| 207 false); | 211 false); |
| 208 root->AddChild(layer); | 212 root->AddChild(layer); |
| 209 | 213 |
| 210 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 214 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 MathUtil::Round(kTranslateX * kPageScale * kDeviceScale + | 390 MathUtil::Round(kTranslateX * kPageScale * kDeviceScale + |
| 387 sub_layer_screen_position.x()), | 391 sub_layer_screen_position.x()), |
| 388 MathUtil::Round(kTranslateY * kPageScale * kDeviceScale + | 392 MathUtil::Round(kTranslateY * kPageScale * kDeviceScale + |
| 389 sub_layer_screen_position.y())); | 393 sub_layer_screen_position.y())); |
| 390 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform, | 394 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform, |
| 391 sublayer->draw_transform()); | 395 sublayer->draw_transform()); |
| 392 } | 396 } |
| 393 | 397 |
| 394 TEST_F(LayerTreeHostCommonTest, TransformsForSimpleHierarchy) { | 398 TEST_F(LayerTreeHostCommonTest, TransformsForSimpleHierarchy) { |
| 395 gfx::Transform identity_matrix; | 399 gfx::Transform identity_matrix; |
| 396 scoped_refptr<Layer> root = Layer::Create(); | 400 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 397 scoped_refptr<Layer> parent = Layer::Create(); | 401 scoped_refptr<Layer> parent = Layer::Create(layer_settings()); |
| 398 scoped_refptr<Layer> child = Layer::Create(); | 402 scoped_refptr<Layer> child = Layer::Create(layer_settings()); |
| 399 scoped_refptr<Layer> grand_child = Layer::Create(); | 403 scoped_refptr<Layer> grand_child = Layer::Create(layer_settings()); |
| 400 root->AddChild(parent); | 404 root->AddChild(parent); |
| 401 parent->AddChild(child); | 405 parent->AddChild(child); |
| 402 child->AddChild(grand_child); | 406 child->AddChild(grand_child); |
| 403 | 407 |
| 404 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 408 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 405 host->SetRootLayer(root); | 409 host->SetRootLayer(root); |
| 406 | 410 |
| 407 // One-time setup of root layer | 411 // One-time setup of root layer |
| 408 SetLayerPropertiesForTesting(root.get(), | 412 SetLayerPropertiesForTesting(root.get(), |
| 409 identity_matrix, | 413 identity_matrix, |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 child->draw_transform()); | 516 child->draw_transform()); |
| 513 EXPECT_TRANSFORMATION_MATRIX_EQ(parent_composite_transform, | 517 EXPECT_TRANSFORMATION_MATRIX_EQ(parent_composite_transform, |
| 514 child->screen_space_transform()); | 518 child->screen_space_transform()); |
| 515 EXPECT_TRANSFORMATION_MATRIX_EQ(parent_composite_transform, | 519 EXPECT_TRANSFORMATION_MATRIX_EQ(parent_composite_transform, |
| 516 grand_child->draw_transform()); | 520 grand_child->draw_transform()); |
| 517 EXPECT_TRANSFORMATION_MATRIX_EQ(parent_composite_transform, | 521 EXPECT_TRANSFORMATION_MATRIX_EQ(parent_composite_transform, |
| 518 grand_child->screen_space_transform()); | 522 grand_child->screen_space_transform()); |
| 519 } | 523 } |
| 520 | 524 |
| 521 TEST_F(LayerTreeHostCommonTest, TransformsForSingleRenderSurface) { | 525 TEST_F(LayerTreeHostCommonTest, TransformsForSingleRenderSurface) { |
| 522 scoped_refptr<Layer> root = Layer::Create(); | 526 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 523 scoped_refptr<Layer> parent = Layer::Create(); | 527 scoped_refptr<Layer> parent = Layer::Create(layer_settings()); |
| 524 scoped_refptr<Layer> child = Layer::Create(); | 528 scoped_refptr<Layer> child = Layer::Create(layer_settings()); |
| 525 scoped_refptr<LayerWithForcedDrawsContent> grand_child = | 529 scoped_refptr<LayerWithForcedDrawsContent> grand_child = |
| 526 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 530 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 527 root->AddChild(parent); | 531 root->AddChild(parent); |
| 528 parent->AddChild(child); | 532 parent->AddChild(child); |
| 529 child->AddChild(grand_child); | 533 child->AddChild(grand_child); |
| 530 | 534 |
| 531 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 535 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 532 host->SetRootLayer(root); | 536 host->SetRootLayer(root); |
| 533 | 537 |
| 534 // One-time setup of root layer | 538 // One-time setup of root layer |
| 535 gfx::Transform identity_matrix; | 539 gfx::Transform identity_matrix; |
| 536 SetLayerPropertiesForTesting(root.get(), | 540 SetLayerPropertiesForTesting(root.get(), |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 child->render_target()->render_surface()->draw_transform()); | 611 child->render_target()->render_surface()->draw_transform()); |
| 608 | 612 |
| 609 // The screen space is the same as the target since the child surface draws | 613 // The screen space is the same as the target since the child surface draws |
| 610 // into the root. | 614 // into the root. |
| 611 EXPECT_TRANSFORMATION_MATRIX_EQ( | 615 EXPECT_TRANSFORMATION_MATRIX_EQ( |
| 612 surface_sublayer_composite_transform, | 616 surface_sublayer_composite_transform, |
| 613 child->render_target()->render_surface()->screen_space_transform()); | 617 child->render_target()->render_surface()->screen_space_transform()); |
| 614 } | 618 } |
| 615 | 619 |
| 616 TEST_F(LayerTreeHostCommonTest, TransformsForReplica) { | 620 TEST_F(LayerTreeHostCommonTest, TransformsForReplica) { |
| 617 scoped_refptr<Layer> root = Layer::Create(); | 621 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 618 scoped_refptr<Layer> parent = Layer::Create(); | 622 scoped_refptr<Layer> parent = Layer::Create(layer_settings()); |
| 619 scoped_refptr<Layer> child = Layer::Create(); | 623 scoped_refptr<Layer> child = Layer::Create(layer_settings()); |
| 620 scoped_refptr<Layer> child_replica = Layer::Create(); | 624 scoped_refptr<Layer> child_replica = Layer::Create(layer_settings()); |
| 621 scoped_refptr<LayerWithForcedDrawsContent> grand_child = | 625 scoped_refptr<LayerWithForcedDrawsContent> grand_child = |
| 622 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 626 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 623 root->AddChild(parent); | 627 root->AddChild(parent); |
| 624 parent->AddChild(child); | 628 parent->AddChild(child); |
| 625 child->AddChild(grand_child); | 629 child->AddChild(grand_child); |
| 626 child->SetReplicaLayer(child_replica.get()); | 630 child->SetReplicaLayer(child_replica.get()); |
| 627 | 631 |
| 628 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 632 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 629 host->SetRootLayer(root); | 633 host->SetRootLayer(root); |
| 630 | 634 |
| 631 // One-time setup of root layer | 635 // One-time setup of root layer |
| 632 gfx::Transform identity_matrix; | 636 gfx::Transform identity_matrix; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 // transforms described w.r.t. that surface | 717 // transforms described w.r.t. that surface |
| 714 // - A render surface described w.r.t. an ancestor render surface: should | 718 // - A render surface described w.r.t. an ancestor render surface: should |
| 715 // have a draw transform described w.r.t. that ancestor surface | 719 // have a draw transform described w.r.t. that ancestor surface |
| 716 // - Replicas of a render surface are described w.r.t. the replica's | 720 // - Replicas of a render surface are described w.r.t. the replica's |
| 717 // transform around its anchor, along with the surface itself. | 721 // transform around its anchor, along with the surface itself. |
| 718 // - Sanity check on recursion: verify transforms of layers described w.r.t. | 722 // - Sanity check on recursion: verify transforms of layers described w.r.t. |
| 719 // a render surface that is described w.r.t. an ancestor render surface. | 723 // a render surface that is described w.r.t. an ancestor render surface. |
| 720 // - verifying that each layer has a reference to the correct render surface | 724 // - verifying that each layer has a reference to the correct render surface |
| 721 // and render target values. | 725 // and render target values. |
| 722 | 726 |
| 723 scoped_refptr<Layer> root = Layer::Create(); | 727 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 724 scoped_refptr<Layer> parent = Layer::Create(); | 728 scoped_refptr<Layer> parent = Layer::Create(layer_settings()); |
| 725 scoped_refptr<Layer> render_surface1 = Layer::Create(); | 729 scoped_refptr<Layer> render_surface1 = Layer::Create(layer_settings()); |
| 726 scoped_refptr<Layer> render_surface2 = Layer::Create(); | 730 scoped_refptr<Layer> render_surface2 = Layer::Create(layer_settings()); |
| 727 scoped_refptr<Layer> child_of_root = Layer::Create(); | 731 scoped_refptr<Layer> child_of_root = Layer::Create(layer_settings()); |
| 728 scoped_refptr<Layer> child_of_rs1 = Layer::Create(); | 732 scoped_refptr<Layer> child_of_rs1 = Layer::Create(layer_settings()); |
| 729 scoped_refptr<Layer> child_of_rs2 = Layer::Create(); | 733 scoped_refptr<Layer> child_of_rs2 = Layer::Create(layer_settings()); |
| 730 scoped_refptr<Layer> replica_of_rs1 = Layer::Create(); | 734 scoped_refptr<Layer> replica_of_rs1 = Layer::Create(layer_settings()); |
| 731 scoped_refptr<Layer> replica_of_rs2 = Layer::Create(); | 735 scoped_refptr<Layer> replica_of_rs2 = Layer::Create(layer_settings()); |
| 732 scoped_refptr<Layer> grand_child_of_root = Layer::Create(); | 736 scoped_refptr<Layer> grand_child_of_root = Layer::Create(layer_settings()); |
| 733 scoped_refptr<LayerWithForcedDrawsContent> grand_child_of_rs1 = | 737 scoped_refptr<LayerWithForcedDrawsContent> grand_child_of_rs1 = |
| 734 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 738 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 735 scoped_refptr<LayerWithForcedDrawsContent> grand_child_of_rs2 = | 739 scoped_refptr<LayerWithForcedDrawsContent> grand_child_of_rs2 = |
| 736 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 740 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 737 root->AddChild(parent); | 741 root->AddChild(parent); |
| 738 parent->AddChild(render_surface1); | 742 parent->AddChild(render_surface1); |
| 739 parent->AddChild(child_of_root); | 743 parent->AddChild(child_of_root); |
| 740 render_surface1->AddChild(child_of_rs1); | 744 render_surface1->AddChild(child_of_rs1); |
| 741 render_surface1->AddChild(render_surface2); | 745 render_surface1->AddChild(render_surface2); |
| 742 render_surface2->AddChild(child_of_rs2); | 746 render_surface2->AddChild(child_of_rs2); |
| 743 child_of_root->AddChild(grand_child_of_root); | 747 child_of_root->AddChild(grand_child_of_root); |
| 744 child_of_rs1->AddChild(grand_child_of_rs1); | 748 child_of_rs1->AddChild(grand_child_of_rs1); |
| 745 child_of_rs2->AddChild(grand_child_of_rs2); | 749 child_of_rs2->AddChild(grand_child_of_rs2); |
| 746 render_surface1->SetReplicaLayer(replica_of_rs1.get()); | 750 render_surface1->SetReplicaLayer(replica_of_rs1.get()); |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 999 EXPECT_FLOAT_EQ( | 1003 EXPECT_FLOAT_EQ( |
| 1000 5.0, grand_child_of_rs2->screen_space_transform().matrix().get(1, 3)); | 1004 5.0, grand_child_of_rs2->screen_space_transform().matrix().get(1, 3)); |
| 1001 } | 1005 } |
| 1002 | 1006 |
| 1003 TEST_F(LayerTreeHostCommonTest, TransformsForFlatteningLayer) { | 1007 TEST_F(LayerTreeHostCommonTest, TransformsForFlatteningLayer) { |
| 1004 // For layers that flatten their subtree, there should be an orthographic | 1008 // For layers that flatten their subtree, there should be an orthographic |
| 1005 // projection (for x and y values) in the middle of the transform sequence. | 1009 // projection (for x and y values) in the middle of the transform sequence. |
| 1006 // Note that the way the code is currently implemented, it is not expected to | 1010 // Note that the way the code is currently implemented, it is not expected to |
| 1007 // use a canonical orthographic projection. | 1011 // use a canonical orthographic projection. |
| 1008 | 1012 |
| 1009 scoped_refptr<Layer> root = Layer::Create(); | 1013 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 1010 scoped_refptr<Layer> child = Layer::Create(); | 1014 scoped_refptr<Layer> child = Layer::Create(layer_settings()); |
| 1011 scoped_refptr<LayerWithForcedDrawsContent> grand_child = | 1015 scoped_refptr<LayerWithForcedDrawsContent> grand_child = |
| 1012 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 1016 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 1013 scoped_refptr<LayerWithForcedDrawsContent> great_grand_child = | 1017 scoped_refptr<LayerWithForcedDrawsContent> great_grand_child = |
| 1014 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 1018 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 1015 | 1019 |
| 1016 gfx::Transform rotation_about_y_axis; | 1020 gfx::Transform rotation_about_y_axis; |
| 1017 rotation_about_y_axis.RotateAboutYAxis(30.0); | 1021 rotation_about_y_axis.RotateAboutYAxis(30.0); |
| 1018 | 1022 |
| 1019 const gfx::Transform identity_matrix; | 1023 const gfx::Transform identity_matrix; |
| 1020 SetLayerPropertiesForTesting(root.get(), | 1024 SetLayerPropertiesForTesting(root.get(), |
| 1021 identity_matrix, | 1025 identity_matrix, |
| 1022 gfx::Point3F(), | 1026 gfx::Point3F(), |
| 1023 gfx::PointF(), | 1027 gfx::PointF(), |
| 1024 gfx::Size(100, 100), | 1028 gfx::Size(100, 100), |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1095 TEST_F(LayerTreeHostCommonTest, TransformsForDegenerateIntermediateLayer) { | 1099 TEST_F(LayerTreeHostCommonTest, TransformsForDegenerateIntermediateLayer) { |
| 1096 // A layer that is empty in one axis, but not the other, was accidentally | 1100 // A layer that is empty in one axis, but not the other, was accidentally |
| 1097 // skipping a necessary translation. Without that translation, the coordinate | 1101 // skipping a necessary translation. Without that translation, the coordinate |
| 1098 // space of the layer's draw transform is incorrect. | 1102 // space of the layer's draw transform is incorrect. |
| 1099 // | 1103 // |
| 1100 // Normally this isn't a problem, because the layer wouldn't be drawn anyway, | 1104 // Normally this isn't a problem, because the layer wouldn't be drawn anyway, |
| 1101 // but if that layer becomes a render surface, then its draw transform is | 1105 // but if that layer becomes a render surface, then its draw transform is |
| 1102 // implicitly inherited by the rest of the subtree, which then is positioned | 1106 // implicitly inherited by the rest of the subtree, which then is positioned |
| 1103 // incorrectly as a result. | 1107 // incorrectly as a result. |
| 1104 | 1108 |
| 1105 scoped_refptr<Layer> root = Layer::Create(); | 1109 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 1106 scoped_refptr<Layer> child = Layer::Create(); | 1110 scoped_refptr<Layer> child = Layer::Create(layer_settings()); |
| 1107 scoped_refptr<LayerWithForcedDrawsContent> grand_child = | 1111 scoped_refptr<LayerWithForcedDrawsContent> grand_child = |
| 1108 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 1112 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 1109 | 1113 |
| 1110 // The child height is zero, but has non-zero width that should be accounted | 1114 // The child height is zero, but has non-zero width that should be accounted |
| 1111 // for while computing draw transforms. | 1115 // for while computing draw transforms. |
| 1112 const gfx::Transform identity_matrix; | 1116 const gfx::Transform identity_matrix; |
| 1113 SetLayerPropertiesForTesting(root.get(), | 1117 SetLayerPropertiesForTesting(root.get(), |
| 1114 identity_matrix, | 1118 identity_matrix, |
| 1115 gfx::Point3F(), | 1119 gfx::Point3F(), |
| 1116 gfx::PointF(), | 1120 gfx::PointF(), |
| 1117 gfx::Size(100, 100), | 1121 gfx::Size(100, 100), |
| 1118 true, | 1122 true, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1148 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, child->draw_transform()); | 1152 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, child->draw_transform()); |
| 1149 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, | 1153 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, |
| 1150 grand_child->draw_transform()); | 1154 grand_child->draw_transform()); |
| 1151 } | 1155 } |
| 1152 | 1156 |
| 1153 TEST_F(LayerTreeHostCommonTest, TransformAboveRootLayer) { | 1157 TEST_F(LayerTreeHostCommonTest, TransformAboveRootLayer) { |
| 1154 // Transformations applied at the root of the tree should be forwarded | 1158 // Transformations applied at the root of the tree should be forwarded |
| 1155 // to child layers instead of applied to the root RenderSurface. | 1159 // to child layers instead of applied to the root RenderSurface. |
| 1156 const gfx::Transform identity_matrix; | 1160 const gfx::Transform identity_matrix; |
| 1157 scoped_refptr<LayerWithForcedDrawsContent> root = | 1161 scoped_refptr<LayerWithForcedDrawsContent> root = |
| 1158 new LayerWithForcedDrawsContent; | 1162 new LayerWithForcedDrawsContent(layer_settings()); |
| 1159 scoped_refptr<LayerWithForcedDrawsContent> child = | 1163 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 1160 new LayerWithForcedDrawsContent; | 1164 new LayerWithForcedDrawsContent(layer_settings()); |
| 1161 child->SetScrollClipLayerId(root->id()); | 1165 child->SetScrollClipLayerId(root->id()); |
| 1162 root->AddChild(child); | 1166 root->AddChild(child); |
| 1163 | 1167 |
| 1164 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 1168 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 1165 host->SetRootLayer(root); | 1169 host->SetRootLayer(root); |
| 1166 | 1170 |
| 1167 SetLayerPropertiesForTesting(root.get(), | 1171 SetLayerPropertiesForTesting(root.get(), |
| 1168 identity_matrix, | 1172 identity_matrix, |
| 1169 gfx::Point3F(), | 1173 gfx::Point3F(), |
| 1170 gfx::PointF(), | 1174 gfx::PointF(), |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1302 EXPECT_TRANSFORMATION_MATRIX_EQ( | 1306 EXPECT_TRANSFORMATION_MATRIX_EQ( |
| 1303 compositeSquared, root->draw_properties().target_space_transform); | 1307 compositeSquared, root->draw_properties().target_space_transform); |
| 1304 EXPECT_TRANSFORMATION_MATRIX_EQ( | 1308 EXPECT_TRANSFORMATION_MATRIX_EQ( |
| 1305 compositeSquared, child->draw_properties().target_space_transform); | 1309 compositeSquared, child->draw_properties().target_space_transform); |
| 1306 EXPECT_EQ(identity_matrix, root->render_surface()->draw_transform()); | 1310 EXPECT_EQ(identity_matrix, root->render_surface()->draw_transform()); |
| 1307 } | 1311 } |
| 1308 } | 1312 } |
| 1309 | 1313 |
| 1310 TEST_F(LayerTreeHostCommonTest, | 1314 TEST_F(LayerTreeHostCommonTest, |
| 1311 RenderSurfaceListForRenderSurfaceWithClippedLayer) { | 1315 RenderSurfaceListForRenderSurfaceWithClippedLayer) { |
| 1312 scoped_refptr<Layer> parent = Layer::Create(); | 1316 scoped_refptr<Layer> parent = Layer::Create(layer_settings()); |
| 1313 scoped_refptr<Layer> render_surface1 = Layer::Create(); | 1317 scoped_refptr<Layer> render_surface1 = Layer::Create(layer_settings()); |
| 1314 scoped_refptr<LayerWithForcedDrawsContent> child = | 1318 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 1315 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 1319 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 1316 | 1320 |
| 1317 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 1321 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 1318 host->SetRootLayer(parent); | 1322 host->SetRootLayer(parent); |
| 1319 | 1323 |
| 1320 const gfx::Transform identity_matrix; | 1324 const gfx::Transform identity_matrix; |
| 1321 SetLayerPropertiesForTesting(parent.get(), | 1325 SetLayerPropertiesForTesting(parent.get(), |
| 1322 identity_matrix, | 1326 identity_matrix, |
| 1323 gfx::Point3F(), | 1327 gfx::Point3F(), |
| 1324 gfx::PointF(), | 1328 gfx::PointF(), |
| 1325 gfx::Size(10, 10), | 1329 gfx::Size(10, 10), |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1356 // The child layer's content is entirely outside the parent's clip rect, so | 1360 // The child layer's content is entirely outside the parent's clip rect, so |
| 1357 // the intermediate render surface should not be listed here, even if it was | 1361 // the intermediate render surface should not be listed here, even if it was |
| 1358 // forced to be created. Render surfaces without children or visible content | 1362 // forced to be created. Render surfaces without children or visible content |
| 1359 // are unexpected at draw time (e.g. we might try to create a content texture | 1363 // are unexpected at draw time (e.g. we might try to create a content texture |
| 1360 // of size 0). | 1364 // of size 0). |
| 1361 ASSERT_TRUE(parent->render_surface()); | 1365 ASSERT_TRUE(parent->render_surface()); |
| 1362 EXPECT_EQ(1U, render_surface_layer_list.size()); | 1366 EXPECT_EQ(1U, render_surface_layer_list.size()); |
| 1363 } | 1367 } |
| 1364 | 1368 |
| 1365 TEST_F(LayerTreeHostCommonTest, RenderSurfaceListForTransparentChild) { | 1369 TEST_F(LayerTreeHostCommonTest, RenderSurfaceListForTransparentChild) { |
| 1366 scoped_refptr<Layer> parent = Layer::Create(); | 1370 scoped_refptr<Layer> parent = Layer::Create(layer_settings()); |
| 1367 scoped_refptr<Layer> render_surface1 = Layer::Create(); | 1371 scoped_refptr<Layer> render_surface1 = Layer::Create(layer_settings()); |
| 1368 scoped_refptr<LayerWithForcedDrawsContent> child = | 1372 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 1369 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 1373 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 1370 | 1374 |
| 1371 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 1375 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 1372 host->SetRootLayer(parent); | 1376 host->SetRootLayer(parent); |
| 1373 | 1377 |
| 1374 const gfx::Transform identity_matrix; | 1378 const gfx::Transform identity_matrix; |
| 1375 SetLayerPropertiesForTesting(render_surface1.get(), | 1379 SetLayerPropertiesForTesting(render_surface1.get(), |
| 1376 identity_matrix, | 1380 identity_matrix, |
| 1377 gfx::Point3F(), | 1381 gfx::Point3F(), |
| 1378 gfx::PointF(), | 1382 gfx::PointF(), |
| 1379 gfx::Size(10, 10), | 1383 gfx::Size(10, 10), |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1402 // not have gotten added anywhere. Also, the drawable content rect should not | 1406 // not have gotten added anywhere. Also, the drawable content rect should not |
| 1403 // have been extended by the children. | 1407 // have been extended by the children. |
| 1404 ASSERT_TRUE(parent->render_surface()); | 1408 ASSERT_TRUE(parent->render_surface()); |
| 1405 EXPECT_EQ(0U, parent->render_surface()->layer_list().size()); | 1409 EXPECT_EQ(0U, parent->render_surface()->layer_list().size()); |
| 1406 EXPECT_EQ(1U, render_surface_layer_list.size()); | 1410 EXPECT_EQ(1U, render_surface_layer_list.size()); |
| 1407 EXPECT_EQ(parent->id(), render_surface_layer_list.at(0)->id()); | 1411 EXPECT_EQ(parent->id(), render_surface_layer_list.at(0)->id()); |
| 1408 EXPECT_EQ(gfx::Rect(), parent->drawable_content_rect()); | 1412 EXPECT_EQ(gfx::Rect(), parent->drawable_content_rect()); |
| 1409 } | 1413 } |
| 1410 | 1414 |
| 1411 TEST_F(LayerTreeHostCommonTest, RenderSurfaceForBlendMode) { | 1415 TEST_F(LayerTreeHostCommonTest, RenderSurfaceForBlendMode) { |
| 1412 scoped_refptr<Layer> parent = Layer::Create(); | 1416 scoped_refptr<Layer> parent = Layer::Create(layer_settings()); |
| 1413 scoped_refptr<LayerWithForcedDrawsContent> child = | 1417 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 1414 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 1418 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 1415 | 1419 |
| 1416 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 1420 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 1417 host->SetRootLayer(parent); | 1421 host->SetRootLayer(parent); |
| 1418 | 1422 |
| 1419 const gfx::Transform identity_matrix; | 1423 const gfx::Transform identity_matrix; |
| 1420 const SkXfermode::Mode blend_mode = SkXfermode::kMultiply_Mode; | 1424 const SkXfermode::Mode blend_mode = SkXfermode::kMultiply_Mode; |
| 1421 SetLayerPropertiesForTesting(child.get(), identity_matrix, gfx::Point3F(), | 1425 SetLayerPropertiesForTesting(child.get(), identity_matrix, gfx::Point3F(), |
| 1422 gfx::PointF(), gfx::Size(10, 10), true, false); | 1426 gfx::PointF(), gfx::Size(10, 10), true, false); |
| 1423 | 1427 |
| 1424 parent->AddChild(child); | 1428 parent->AddChild(child); |
| 1425 child->SetBlendMode(blend_mode); | 1429 child->SetBlendMode(blend_mode); |
| 1426 | 1430 |
| 1427 RenderSurfaceLayerList render_surface_layer_list; | 1431 RenderSurfaceLayerList render_surface_layer_list; |
| 1428 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 1432 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
| 1429 parent.get(), parent->bounds(), &render_surface_layer_list); | 1433 parent.get(), parent->bounds(), &render_surface_layer_list); |
| 1430 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 1434 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 1431 | 1435 |
| 1432 // Since the child layer has a blend mode other than normal, it should get | 1436 // Since the child layer has a blend mode other than normal, it should get |
| 1433 // its own render surface. Also, layer's draw_properties should contain the | 1437 // its own render surface. Also, layer's draw_properties should contain the |
| 1434 // default blend mode, since the render surface becomes responsible for | 1438 // default blend mode, since the render surface becomes responsible for |
| 1435 // applying the blend mode. | 1439 // applying the blend mode. |
| 1436 ASSERT_TRUE(child->render_surface()); | 1440 ASSERT_TRUE(child->render_surface()); |
| 1437 EXPECT_EQ(1U, child->render_surface()->layer_list().size()); | 1441 EXPECT_EQ(1U, child->render_surface()->layer_list().size()); |
| 1438 EXPECT_EQ(SkXfermode::kSrcOver_Mode, child->draw_properties().blend_mode); | 1442 EXPECT_EQ(SkXfermode::kSrcOver_Mode, child->draw_properties().blend_mode); |
| 1439 } | 1443 } |
| 1440 | 1444 |
| 1441 TEST_F(LayerTreeHostCommonTest, ForceRenderSurface) { | 1445 TEST_F(LayerTreeHostCommonTest, ForceRenderSurface) { |
| 1442 scoped_refptr<Layer> parent = Layer::Create(); | 1446 scoped_refptr<Layer> parent = Layer::Create(layer_settings()); |
| 1443 scoped_refptr<Layer> render_surface1 = Layer::Create(); | 1447 scoped_refptr<Layer> render_surface1 = Layer::Create(layer_settings()); |
| 1444 scoped_refptr<LayerWithForcedDrawsContent> child = | 1448 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 1445 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 1449 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 1446 render_surface1->SetForceRenderSurface(true); | 1450 render_surface1->SetForceRenderSurface(true); |
| 1447 | 1451 |
| 1448 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 1452 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 1449 host->SetRootLayer(parent); | 1453 host->SetRootLayer(parent); |
| 1450 | 1454 |
| 1451 const gfx::Transform identity_matrix; | 1455 const gfx::Transform identity_matrix; |
| 1452 SetLayerPropertiesForTesting(parent.get(), | 1456 SetLayerPropertiesForTesting(parent.get(), |
| 1453 identity_matrix, | 1457 identity_matrix, |
| 1454 gfx::Point3F(), | 1458 gfx::Point3F(), |
| 1455 gfx::PointF(), | 1459 gfx::PointF(), |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1501 EXPECT_TRUE(parent->render_surface()); | 1505 EXPECT_TRUE(parent->render_surface()); |
| 1502 EXPECT_FALSE(render_surface1->render_surface()); | 1506 EXPECT_FALSE(render_surface1->render_surface()); |
| 1503 EXPECT_EQ(1U, render_surface_layer_list.size()); | 1507 EXPECT_EQ(1U, render_surface_layer_list.size()); |
| 1504 } | 1508 } |
| 1505 } | 1509 } |
| 1506 | 1510 |
| 1507 TEST_F(LayerTreeHostCommonTest, RenderSurfacesFlattenScreenSpaceTransform) { | 1511 TEST_F(LayerTreeHostCommonTest, RenderSurfacesFlattenScreenSpaceTransform) { |
| 1508 // Render surfaces act as a flattening point for their subtree, so should | 1512 // Render surfaces act as a flattening point for their subtree, so should |
| 1509 // always flatten the target-to-screen space transform seen by descendants. | 1513 // always flatten the target-to-screen space transform seen by descendants. |
| 1510 | 1514 |
| 1511 scoped_refptr<Layer> root = Layer::Create(); | 1515 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 1512 scoped_refptr<Layer> parent = Layer::Create(); | 1516 scoped_refptr<Layer> parent = Layer::Create(layer_settings()); |
| 1513 scoped_refptr<LayerWithForcedDrawsContent> child = | 1517 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 1514 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 1518 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 1515 scoped_refptr<LayerWithForcedDrawsContent> grand_child = | 1519 scoped_refptr<LayerWithForcedDrawsContent> grand_child = |
| 1516 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 1520 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 1517 | 1521 |
| 1518 gfx::Transform rotation_about_y_axis; | 1522 gfx::Transform rotation_about_y_axis; |
| 1519 rotation_about_y_axis.RotateAboutYAxis(30.0); | 1523 rotation_about_y_axis.RotateAboutYAxis(30.0); |
| 1520 // Make |parent| have a render surface. | 1524 // Make |parent| have a render surface. |
| 1521 parent->SetOpacity(0.9f); | 1525 parent->SetOpacity(0.9f); |
| 1522 | 1526 |
| 1523 const gfx::Transform identity_matrix; | 1527 const gfx::Transform identity_matrix; |
| 1524 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), | 1528 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
| 1525 gfx::PointF(), gfx::Size(100, 100), true, false); | 1529 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 1526 SetLayerPropertiesForTesting(parent.get(), rotation_about_y_axis, | 1530 SetLayerPropertiesForTesting(parent.get(), rotation_about_y_axis, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1583 // - child has masksToBounds=true to cause clipping. | 1587 // - child has masksToBounds=true to cause clipping. |
| 1584 // - grand_child is positioned outside of the child's bounds | 1588 // - grand_child is positioned outside of the child's bounds |
| 1585 // - great_grand_child is also kept outside child's bounds. | 1589 // - great_grand_child is also kept outside child's bounds. |
| 1586 // | 1590 // |
| 1587 // In this configuration, grand_child and great_grand_child are completely | 1591 // In this configuration, grand_child and great_grand_child are completely |
| 1588 // outside the clip rect, and they should never get scheduled on the list of | 1592 // outside the clip rect, and they should never get scheduled on the list of |
| 1589 // render surfaces. | 1593 // render surfaces. |
| 1590 // | 1594 // |
| 1591 | 1595 |
| 1592 const gfx::Transform identity_matrix; | 1596 const gfx::Transform identity_matrix; |
| 1593 scoped_refptr<Layer> parent = Layer::Create(); | 1597 scoped_refptr<Layer> parent = Layer::Create(layer_settings()); |
| 1594 scoped_refptr<Layer> child = Layer::Create(); | 1598 scoped_refptr<Layer> child = Layer::Create(layer_settings()); |
| 1595 scoped_refptr<Layer> grand_child = Layer::Create(); | 1599 scoped_refptr<Layer> grand_child = Layer::Create(layer_settings()); |
| 1596 scoped_refptr<Layer> great_grand_child = Layer::Create(); | 1600 scoped_refptr<Layer> great_grand_child = Layer::Create(layer_settings()); |
| 1597 scoped_refptr<LayerWithForcedDrawsContent> leaf_node1 = | 1601 scoped_refptr<LayerWithForcedDrawsContent> leaf_node1 = |
| 1598 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 1602 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 1599 scoped_refptr<LayerWithForcedDrawsContent> leaf_node2 = | 1603 scoped_refptr<LayerWithForcedDrawsContent> leaf_node2 = |
| 1600 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 1604 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 1601 parent->AddChild(child); | 1605 parent->AddChild(child); |
| 1602 child->AddChild(grand_child); | 1606 child->AddChild(grand_child); |
| 1603 grand_child->AddChild(great_grand_child); | 1607 grand_child->AddChild(great_grand_child); |
| 1604 | 1608 |
| 1605 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 1609 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 1606 host->SetRootLayer(parent); | 1610 host->SetRootLayer(parent); |
| 1607 | 1611 |
| 1608 // leaf_node1 ensures that parent and child are kept on the | 1612 // leaf_node1 ensures that parent and child are kept on the |
| 1609 // render_surface_layer_list, even though grand_child and great_grand_child | 1613 // render_surface_layer_list, even though grand_child and great_grand_child |
| 1610 // should be clipped. | 1614 // should be clipped. |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1684 // - grand_child is a render surface, and the only visible content in child. | 1688 // - grand_child is a render surface, and the only visible content in child. |
| 1685 // It is positioned outside of the clip rect from parent. | 1689 // It is positioned outside of the clip rect from parent. |
| 1686 | 1690 |
| 1687 // In this configuration, grand_child should be outside the clipped | 1691 // In this configuration, grand_child should be outside the clipped |
| 1688 // content rect of the child, making grand_child not appear in the | 1692 // content rect of the child, making grand_child not appear in the |
| 1689 // render_surface_layer_list. However, when we place an animation on the | 1693 // render_surface_layer_list. However, when we place an animation on the |
| 1690 // child, this clipping should be avoided and we should keep the grand_child | 1694 // child, this clipping should be avoided and we should keep the grand_child |
| 1691 // in the render_surface_layer_list. | 1695 // in the render_surface_layer_list. |
| 1692 | 1696 |
| 1693 const gfx::Transform identity_matrix; | 1697 const gfx::Transform identity_matrix; |
| 1694 scoped_refptr<Layer> parent = Layer::Create(); | 1698 scoped_refptr<Layer> parent = Layer::Create(layer_settings()); |
| 1695 scoped_refptr<Layer> child = Layer::Create(); | 1699 scoped_refptr<Layer> child = Layer::Create(layer_settings()); |
| 1696 scoped_refptr<Layer> grand_child = Layer::Create(); | 1700 scoped_refptr<Layer> grand_child = Layer::Create(layer_settings()); |
| 1697 scoped_refptr<LayerWithForcedDrawsContent> leaf_node = | 1701 scoped_refptr<LayerWithForcedDrawsContent> leaf_node = |
| 1698 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 1702 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 1699 parent->AddChild(child); | 1703 parent->AddChild(child); |
| 1700 child->AddChild(grand_child); | 1704 child->AddChild(grand_child); |
| 1701 grand_child->AddChild(leaf_node); | 1705 grand_child->AddChild(leaf_node); |
| 1702 | 1706 |
| 1703 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 1707 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 1704 host->SetRootLayer(parent); | 1708 host->SetRootLayer(parent); |
| 1705 | 1709 |
| 1706 SetLayerPropertiesForTesting(parent.get(), | 1710 SetLayerPropertiesForTesting(parent.get(), |
| 1707 identity_matrix, | 1711 identity_matrix, |
| 1708 gfx::Point3F(), | 1712 gfx::Point3F(), |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1779 // - a surface is clipped by an ancestor that contributes to the same | 1783 // - a surface is clipped by an ancestor that contributes to the same |
| 1780 // render target. | 1784 // render target. |
| 1781 // | 1785 // |
| 1782 // In particular, for a layer that owns a render surface: | 1786 // In particular, for a layer that owns a render surface: |
| 1783 // - the render surface inherits any clip from ancestors, and does NOT | 1787 // - the render surface inherits any clip from ancestors, and does NOT |
| 1784 // pass that clipped status to the layer itself. | 1788 // pass that clipped status to the layer itself. |
| 1785 // - but if the layer itself masks to bounds, it is considered clipped | 1789 // - but if the layer itself masks to bounds, it is considered clipped |
| 1786 // and propagates the clip to the subtree. | 1790 // and propagates the clip to the subtree. |
| 1787 | 1791 |
| 1788 const gfx::Transform identity_matrix; | 1792 const gfx::Transform identity_matrix; |
| 1789 scoped_refptr<Layer> root = Layer::Create(); | 1793 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 1790 scoped_refptr<Layer> parent = Layer::Create(); | 1794 scoped_refptr<Layer> parent = Layer::Create(layer_settings()); |
| 1791 scoped_refptr<Layer> child1 = Layer::Create(); | 1795 scoped_refptr<Layer> child1 = Layer::Create(layer_settings()); |
| 1792 scoped_refptr<Layer> child2 = Layer::Create(); | 1796 scoped_refptr<Layer> child2 = Layer::Create(layer_settings()); |
| 1793 scoped_refptr<Layer> grand_child = Layer::Create(); | 1797 scoped_refptr<Layer> grand_child = Layer::Create(layer_settings()); |
| 1794 scoped_refptr<LayerWithForcedDrawsContent> leaf_node1 = | 1798 scoped_refptr<LayerWithForcedDrawsContent> leaf_node1 = |
| 1795 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 1799 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 1796 scoped_refptr<LayerWithForcedDrawsContent> leaf_node2 = | 1800 scoped_refptr<LayerWithForcedDrawsContent> leaf_node2 = |
| 1797 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 1801 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 1798 root->AddChild(parent); | 1802 root->AddChild(parent); |
| 1799 parent->AddChild(child1); | 1803 parent->AddChild(child1); |
| 1800 parent->AddChild(child2); | 1804 parent->AddChild(child2); |
| 1801 child1->AddChild(grand_child); | 1805 child1->AddChild(grand_child); |
| 1802 child2->AddChild(leaf_node2); | 1806 child2->AddChild(leaf_node2); |
| 1803 grand_child->AddChild(leaf_node1); | 1807 grand_child->AddChild(leaf_node1); |
| 1804 | 1808 |
| 1805 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 1809 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 1806 host->SetRootLayer(root); | 1810 host->SetRootLayer(root); |
| 1807 | 1811 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1940 // grand_child2 - partially clipped but NOT masksToBounds; the clip rect | 1944 // grand_child2 - partially clipped but NOT masksToBounds; the clip rect |
| 1941 // will be the intersection of layer bounds and the mask region. | 1945 // will be the intersection of layer bounds and the mask region. |
| 1942 // grand_child3 - partially clipped and masksToBounds; the | 1946 // grand_child3 - partially clipped and masksToBounds; the |
| 1943 // DrawableContentRect will still be the intersection of layer bounds and | 1947 // DrawableContentRect will still be the intersection of layer bounds and |
| 1944 // the mask region. | 1948 // the mask region. |
| 1945 // grand_child4 - outside parent's clip rect; the DrawableContentRect should | 1949 // grand_child4 - outside parent's clip rect; the DrawableContentRect should |
| 1946 // be empty. | 1950 // be empty. |
| 1947 // | 1951 // |
| 1948 | 1952 |
| 1949 const gfx::Transform identity_matrix; | 1953 const gfx::Transform identity_matrix; |
| 1950 scoped_refptr<Layer> parent = Layer::Create(); | 1954 scoped_refptr<Layer> parent = Layer::Create(layer_settings()); |
| 1951 scoped_refptr<Layer> child = Layer::Create(); | 1955 scoped_refptr<Layer> child = Layer::Create(layer_settings()); |
| 1952 scoped_refptr<Layer> grand_child1 = Layer::Create(); | 1956 scoped_refptr<Layer> grand_child1 = Layer::Create(layer_settings()); |
| 1953 scoped_refptr<Layer> grand_child2 = Layer::Create(); | 1957 scoped_refptr<Layer> grand_child2 = Layer::Create(layer_settings()); |
| 1954 scoped_refptr<Layer> grand_child3 = Layer::Create(); | 1958 scoped_refptr<Layer> grand_child3 = Layer::Create(layer_settings()); |
| 1955 scoped_refptr<Layer> grand_child4 = Layer::Create(); | 1959 scoped_refptr<Layer> grand_child4 = Layer::Create(layer_settings()); |
| 1956 | 1960 |
| 1957 parent->AddChild(child); | 1961 parent->AddChild(child); |
| 1958 child->AddChild(grand_child1); | 1962 child->AddChild(grand_child1); |
| 1959 child->AddChild(grand_child2); | 1963 child->AddChild(grand_child2); |
| 1960 child->AddChild(grand_child3); | 1964 child->AddChild(grand_child3); |
| 1961 child->AddChild(grand_child4); | 1965 child->AddChild(grand_child4); |
| 1962 | 1966 |
| 1963 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 1967 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 1964 host->SetRootLayer(parent); | 1968 host->SetRootLayer(parent); |
| 1965 | 1969 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2030 | 2034 |
| 2031 TEST_F(LayerTreeHostCommonTest, ClipRectIsPropagatedCorrectlyToSurfaces) { | 2035 TEST_F(LayerTreeHostCommonTest, ClipRectIsPropagatedCorrectlyToSurfaces) { |
| 2032 // Verify that render surfaces (and their layers) get the appropriate | 2036 // Verify that render surfaces (and their layers) get the appropriate |
| 2033 // clip rects when their parent masksToBounds is true. | 2037 // clip rects when their parent masksToBounds is true. |
| 2034 // | 2038 // |
| 2035 // Layers that own render surfaces (at least for now) do not inherit any | 2039 // Layers that own render surfaces (at least for now) do not inherit any |
| 2036 // clipping; instead the surface will enforce the clip for the entire subtree. | 2040 // clipping; instead the surface will enforce the clip for the entire subtree. |
| 2037 // They may still have a clip rect of their own layer bounds, however, if | 2041 // They may still have a clip rect of their own layer bounds, however, if |
| 2038 // masksToBounds was true. | 2042 // masksToBounds was true. |
| 2039 const gfx::Transform identity_matrix; | 2043 const gfx::Transform identity_matrix; |
| 2040 scoped_refptr<Layer> parent = Layer::Create(); | 2044 scoped_refptr<Layer> parent = Layer::Create(layer_settings()); |
| 2041 scoped_refptr<Layer> child = Layer::Create(); | 2045 scoped_refptr<Layer> child = Layer::Create(layer_settings()); |
| 2042 scoped_refptr<Layer> grand_child1 = Layer::Create(); | 2046 scoped_refptr<Layer> grand_child1 = Layer::Create(layer_settings()); |
| 2043 scoped_refptr<Layer> grand_child2 = Layer::Create(); | 2047 scoped_refptr<Layer> grand_child2 = Layer::Create(layer_settings()); |
| 2044 scoped_refptr<Layer> grand_child3 = Layer::Create(); | 2048 scoped_refptr<Layer> grand_child3 = Layer::Create(layer_settings()); |
| 2045 scoped_refptr<Layer> grand_child4 = Layer::Create(); | 2049 scoped_refptr<Layer> grand_child4 = Layer::Create(layer_settings()); |
| 2046 scoped_refptr<LayerWithForcedDrawsContent> leaf_node1 = | 2050 scoped_refptr<LayerWithForcedDrawsContent> leaf_node1 = |
| 2047 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2051 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 2048 scoped_refptr<LayerWithForcedDrawsContent> leaf_node2 = | 2052 scoped_refptr<LayerWithForcedDrawsContent> leaf_node2 = |
| 2049 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2053 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 2050 scoped_refptr<LayerWithForcedDrawsContent> leaf_node3 = | 2054 scoped_refptr<LayerWithForcedDrawsContent> leaf_node3 = |
| 2051 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2055 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 2052 scoped_refptr<LayerWithForcedDrawsContent> leaf_node4 = | 2056 scoped_refptr<LayerWithForcedDrawsContent> leaf_node4 = |
| 2053 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2057 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 2054 | 2058 |
| 2055 parent->AddChild(child); | 2059 parent->AddChild(child); |
| 2056 child->AddChild(grand_child1); | 2060 child->AddChild(grand_child1); |
| 2057 child->AddChild(grand_child2); | 2061 child->AddChild(grand_child2); |
| 2058 child->AddChild(grand_child3); | 2062 child->AddChild(grand_child3); |
| 2059 child->AddChild(grand_child4); | 2063 child->AddChild(grand_child4); |
| 2060 | 2064 |
| 2061 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 2065 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 2062 host->SetRootLayer(parent); | 2066 host->SetRootLayer(parent); |
| 2063 | 2067 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2168 // masksToBounds. | 2172 // masksToBounds. |
| 2169 EXPECT_EQ(gfx::Rect(0, 0, 20, 20), | 2173 EXPECT_EQ(gfx::Rect(0, 0, 20, 20), |
| 2170 grand_child1->render_surface()->clip_rect()); | 2174 grand_child1->render_surface()->clip_rect()); |
| 2171 EXPECT_EQ(gfx::Rect(0, 0, 20, 20), | 2175 EXPECT_EQ(gfx::Rect(0, 0, 20, 20), |
| 2172 grand_child2->render_surface()->clip_rect()); | 2176 grand_child2->render_surface()->clip_rect()); |
| 2173 EXPECT_EQ(gfx::Rect(0, 0, 20, 20), | 2177 EXPECT_EQ(gfx::Rect(0, 0, 20, 20), |
| 2174 grand_child3->render_surface()->clip_rect()); | 2178 grand_child3->render_surface()->clip_rect()); |
| 2175 } | 2179 } |
| 2176 | 2180 |
| 2177 TEST_F(LayerTreeHostCommonTest, AnimationsForRenderSurfaceHierarchy) { | 2181 TEST_F(LayerTreeHostCommonTest, AnimationsForRenderSurfaceHierarchy) { |
| 2178 scoped_refptr<Layer> parent = Layer::Create(); | 2182 scoped_refptr<Layer> parent = Layer::Create(layer_settings()); |
| 2179 scoped_refptr<Layer> render_surface1 = Layer::Create(); | 2183 scoped_refptr<Layer> render_surface1 = Layer::Create(layer_settings()); |
| 2180 scoped_refptr<Layer> render_surface2 = Layer::Create(); | 2184 scoped_refptr<Layer> render_surface2 = Layer::Create(layer_settings()); |
| 2181 scoped_refptr<Layer> child_of_root = Layer::Create(); | 2185 scoped_refptr<Layer> child_of_root = Layer::Create(layer_settings()); |
| 2182 scoped_refptr<Layer> child_of_rs1 = Layer::Create(); | 2186 scoped_refptr<Layer> child_of_rs1 = Layer::Create(layer_settings()); |
| 2183 scoped_refptr<Layer> child_of_rs2 = Layer::Create(); | 2187 scoped_refptr<Layer> child_of_rs2 = Layer::Create(layer_settings()); |
| 2184 scoped_refptr<Layer> grand_child_of_root = Layer::Create(); | 2188 scoped_refptr<Layer> grand_child_of_root = Layer::Create(layer_settings()); |
| 2185 scoped_refptr<LayerWithForcedDrawsContent> grand_child_of_rs1 = | 2189 scoped_refptr<LayerWithForcedDrawsContent> grand_child_of_rs1 = |
| 2186 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2190 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 2187 scoped_refptr<LayerWithForcedDrawsContent> grand_child_of_rs2 = | 2191 scoped_refptr<LayerWithForcedDrawsContent> grand_child_of_rs2 = |
| 2188 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2192 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 2189 parent->AddChild(render_surface1); | 2193 parent->AddChild(render_surface1); |
| 2190 parent->AddChild(child_of_root); | 2194 parent->AddChild(child_of_root); |
| 2191 render_surface1->AddChild(child_of_rs1); | 2195 render_surface1->AddChild(child_of_rs1); |
| 2192 render_surface1->AddChild(render_surface2); | 2196 render_surface1->AddChild(render_surface2); |
| 2193 render_surface2->AddChild(child_of_rs2); | 2197 render_surface2->AddChild(child_of_rs2); |
| 2194 child_of_root->AddChild(grand_child_of_root); | 2198 child_of_root->AddChild(grand_child_of_root); |
| 2195 child_of_rs1->AddChild(grand_child_of_rs1); | 2199 child_of_rs1->AddChild(grand_child_of_rs1); |
| 2196 child_of_rs2->AddChild(grand_child_of_rs2); | 2200 child_of_rs2->AddChild(grand_child_of_rs2); |
| 2197 | 2201 |
| 2198 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 2202 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2665 // Only the corner of the layer is not visible on the surface because of being | 2669 // Only the corner of the layer is not visible on the surface because of being |
| 2666 // clipped. But, the net result of rounding visible region to an axis-aligned | 2670 // clipped. But, the net result of rounding visible region to an axis-aligned |
| 2667 // rect is that the entire layer should still be considered visible. | 2671 // rect is that the entire layer should still be considered visible. |
| 2668 gfx::Rect expected = gfx::Rect(-10, -10, 20, 20); | 2672 gfx::Rect expected = gfx::Rect(-10, -10, 20, 20); |
| 2669 gfx::Rect actual = LayerTreeHostCommon::CalculateVisibleRect( | 2673 gfx::Rect actual = LayerTreeHostCommon::CalculateVisibleRect( |
| 2670 target_surface_rect, layer_content_rect, layer_to_surface_transform); | 2674 target_surface_rect, layer_content_rect, layer_to_surface_transform); |
| 2671 EXPECT_EQ(expected, actual); | 2675 EXPECT_EQ(expected, actual); |
| 2672 } | 2676 } |
| 2673 | 2677 |
| 2674 TEST_F(LayerTreeHostCommonTest, DrawableAndVisibleContentRectsForSimpleLayers) { | 2678 TEST_F(LayerTreeHostCommonTest, DrawableAndVisibleContentRectsForSimpleLayers) { |
| 2675 scoped_refptr<Layer> root = Layer::Create(); | 2679 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 2676 scoped_refptr<LayerWithForcedDrawsContent> child1 = | 2680 scoped_refptr<LayerWithForcedDrawsContent> child1 = |
| 2677 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2681 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 2678 scoped_refptr<LayerWithForcedDrawsContent> child2 = | 2682 scoped_refptr<LayerWithForcedDrawsContent> child2 = |
| 2679 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2683 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 2680 scoped_refptr<LayerWithForcedDrawsContent> child3 = | 2684 scoped_refptr<LayerWithForcedDrawsContent> child3 = |
| 2681 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2685 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 2682 root->AddChild(child1); | 2686 root->AddChild(child1); |
| 2683 root->AddChild(child2); | 2687 root->AddChild(child2); |
| 2684 root->AddChild(child3); | 2688 root->AddChild(child3); |
| 2685 | 2689 |
| 2686 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 2690 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 2687 host->SetRootLayer(root); | 2691 host->SetRootLayer(root); |
| 2688 | 2692 |
| 2689 gfx::Transform identity_matrix; | 2693 gfx::Transform identity_matrix; |
| 2690 SetLayerPropertiesForTesting(root.get(), | 2694 SetLayerPropertiesForTesting(root.get(), |
| 2691 identity_matrix, | 2695 identity_matrix, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2731 EXPECT_TRUE(child3->visible_content_rect().IsEmpty()); | 2735 EXPECT_TRUE(child3->visible_content_rect().IsEmpty()); |
| 2732 | 2736 |
| 2733 // layer drawable_content_rects are not clipped. | 2737 // layer drawable_content_rects are not clipped. |
| 2734 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), child1->drawable_content_rect()); | 2738 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), child1->drawable_content_rect()); |
| 2735 EXPECT_EQ(gfx::Rect(75, 75, 50, 50), child2->drawable_content_rect()); | 2739 EXPECT_EQ(gfx::Rect(75, 75, 50, 50), child2->drawable_content_rect()); |
| 2736 EXPECT_EQ(gfx::Rect(125, 125, 50, 50), child3->drawable_content_rect()); | 2740 EXPECT_EQ(gfx::Rect(125, 125, 50, 50), child3->drawable_content_rect()); |
| 2737 } | 2741 } |
| 2738 | 2742 |
| 2739 TEST_F(LayerTreeHostCommonTest, | 2743 TEST_F(LayerTreeHostCommonTest, |
| 2740 DrawableAndVisibleContentRectsForLayersClippedByLayer) { | 2744 DrawableAndVisibleContentRectsForLayersClippedByLayer) { |
| 2741 scoped_refptr<Layer> root = Layer::Create(); | 2745 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 2742 scoped_refptr<Layer> child = Layer::Create(); | 2746 scoped_refptr<Layer> child = Layer::Create(layer_settings()); |
| 2743 scoped_refptr<LayerWithForcedDrawsContent> grand_child1 = | 2747 scoped_refptr<LayerWithForcedDrawsContent> grand_child1 = |
| 2744 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2748 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 2745 scoped_refptr<LayerWithForcedDrawsContent> grand_child2 = | 2749 scoped_refptr<LayerWithForcedDrawsContent> grand_child2 = |
| 2746 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2750 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 2747 scoped_refptr<LayerWithForcedDrawsContent> grand_child3 = | 2751 scoped_refptr<LayerWithForcedDrawsContent> grand_child3 = |
| 2748 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2752 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 2749 root->AddChild(child); | 2753 root->AddChild(child); |
| 2750 child->AddChild(grand_child1); | 2754 child->AddChild(grand_child1); |
| 2751 child->AddChild(grand_child2); | 2755 child->AddChild(grand_child2); |
| 2752 child->AddChild(grand_child3); | 2756 child->AddChild(grand_child3); |
| 2753 | 2757 |
| 2754 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 2758 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 2755 host->SetRootLayer(root); | 2759 host->SetRootLayer(root); |
| 2756 | 2760 |
| 2757 gfx::Transform identity_matrix; | 2761 gfx::Transform identity_matrix; |
| 2758 SetLayerPropertiesForTesting(root.get(), | 2762 SetLayerPropertiesForTesting(root.get(), |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2809 EXPECT_EQ(gfx::Rect(0, 0, 25, 25), grand_child2->visible_content_rect()); | 2813 EXPECT_EQ(gfx::Rect(0, 0, 25, 25), grand_child2->visible_content_rect()); |
| 2810 EXPECT_TRUE(grand_child3->visible_content_rect().IsEmpty()); | 2814 EXPECT_TRUE(grand_child3->visible_content_rect().IsEmpty()); |
| 2811 | 2815 |
| 2812 // All grandchild DrawableContentRects should also be clipped by child. | 2816 // All grandchild DrawableContentRects should also be clipped by child. |
| 2813 EXPECT_EQ(gfx::Rect(5, 5, 50, 50), grand_child1->drawable_content_rect()); | 2817 EXPECT_EQ(gfx::Rect(5, 5, 50, 50), grand_child1->drawable_content_rect()); |
| 2814 EXPECT_EQ(gfx::Rect(75, 75, 25, 25), grand_child2->drawable_content_rect()); | 2818 EXPECT_EQ(gfx::Rect(75, 75, 25, 25), grand_child2->drawable_content_rect()); |
| 2815 EXPECT_TRUE(grand_child3->drawable_content_rect().IsEmpty()); | 2819 EXPECT_TRUE(grand_child3->drawable_content_rect().IsEmpty()); |
| 2816 } | 2820 } |
| 2817 | 2821 |
| 2818 TEST_F(LayerTreeHostCommonTest, VisibleContentRectWithClippingAndScaling) { | 2822 TEST_F(LayerTreeHostCommonTest, VisibleContentRectWithClippingAndScaling) { |
| 2819 scoped_refptr<Layer> root = Layer::Create(); | 2823 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 2820 scoped_refptr<Layer> child = Layer::Create(); | 2824 scoped_refptr<Layer> child = Layer::Create(layer_settings()); |
| 2821 scoped_refptr<LayerWithForcedDrawsContent> grand_child = | 2825 scoped_refptr<LayerWithForcedDrawsContent> grand_child = |
| 2822 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2826 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 2823 root->AddChild(child); | 2827 root->AddChild(child); |
| 2824 child->AddChild(grand_child); | 2828 child->AddChild(grand_child); |
| 2825 | 2829 |
| 2826 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 2830 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 2827 host->SetRootLayer(root); | 2831 host->SetRootLayer(root); |
| 2828 | 2832 |
| 2829 gfx::Transform identity_matrix; | 2833 gfx::Transform identity_matrix; |
| 2830 gfx::Transform child_scale_matrix; | 2834 gfx::Transform child_scale_matrix; |
| 2831 child_scale_matrix.Scale(0.25f, 0.25f); | 2835 child_scale_matrix.Scale(0.25f, 0.25f); |
| 2832 gfx::Transform grand_child_scale_matrix; | 2836 gfx::Transform grand_child_scale_matrix; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2843 ExecuteCalculateDrawProperties(root.get()); | 2847 ExecuteCalculateDrawProperties(root.get()); |
| 2844 | 2848 |
| 2845 // The visible rect is expanded to integer coordinates in target space before | 2849 // The visible rect is expanded to integer coordinates in target space before |
| 2846 // being projected back to layer space, where it is once again expanded to | 2850 // being projected back to layer space, where it is once again expanded to |
| 2847 // integer coordinates. | 2851 // integer coordinates. |
| 2848 EXPECT_EQ(gfx::Rect(49, 49), grand_child->visible_rect_from_property_trees()); | 2852 EXPECT_EQ(gfx::Rect(49, 49), grand_child->visible_rect_from_property_trees()); |
| 2849 } | 2853 } |
| 2850 | 2854 |
| 2851 TEST_F(LayerTreeHostCommonTest, | 2855 TEST_F(LayerTreeHostCommonTest, |
| 2852 DrawableAndVisibleContentRectsForLayersInUnclippedRenderSurface) { | 2856 DrawableAndVisibleContentRectsForLayersInUnclippedRenderSurface) { |
| 2853 scoped_refptr<Layer> root = Layer::Create(); | 2857 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 2854 scoped_refptr<Layer> render_surface1 = Layer::Create(); | 2858 scoped_refptr<Layer> render_surface1 = Layer::Create(layer_settings()); |
| 2855 scoped_refptr<LayerWithForcedDrawsContent> child1 = | 2859 scoped_refptr<LayerWithForcedDrawsContent> child1 = |
| 2856 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2860 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 2857 scoped_refptr<LayerWithForcedDrawsContent> child2 = | 2861 scoped_refptr<LayerWithForcedDrawsContent> child2 = |
| 2858 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2862 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 2859 scoped_refptr<LayerWithForcedDrawsContent> child3 = | 2863 scoped_refptr<LayerWithForcedDrawsContent> child3 = |
| 2860 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2864 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 2861 root->AddChild(render_surface1); | 2865 root->AddChild(render_surface1); |
| 2862 render_surface1->AddChild(child1); | 2866 render_surface1->AddChild(child1); |
| 2863 render_surface1->AddChild(child2); | 2867 render_surface1->AddChild(child2); |
| 2864 render_surface1->AddChild(child3); | 2868 render_surface1->AddChild(child3); |
| 2865 | 2869 |
| 2866 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 2870 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 2867 host->SetRootLayer(root); | 2871 host->SetRootLayer(root); |
| 2868 | 2872 |
| 2869 gfx::Transform identity_matrix; | 2873 gfx::Transform identity_matrix; |
| 2870 SetLayerPropertiesForTesting(root.get(), | 2874 SetLayerPropertiesForTesting(root.get(), |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2926 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), child2->visible_content_rect()); | 2930 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), child2->visible_content_rect()); |
| 2927 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), child3->visible_content_rect()); | 2931 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), child3->visible_content_rect()); |
| 2928 | 2932 |
| 2929 EXPECT_EQ(gfx::Rect(5, 5, 50, 50), child1->drawable_content_rect()); | 2933 EXPECT_EQ(gfx::Rect(5, 5, 50, 50), child1->drawable_content_rect()); |
| 2930 EXPECT_EQ(gfx::Rect(75, 75, 50, 50), child2->drawable_content_rect()); | 2934 EXPECT_EQ(gfx::Rect(75, 75, 50, 50), child2->drawable_content_rect()); |
| 2931 EXPECT_EQ(gfx::Rect(125, 125, 50, 50), child3->drawable_content_rect()); | 2935 EXPECT_EQ(gfx::Rect(125, 125, 50, 50), child3->drawable_content_rect()); |
| 2932 } | 2936 } |
| 2933 | 2937 |
| 2934 TEST_F(LayerTreeHostCommonTest, | 2938 TEST_F(LayerTreeHostCommonTest, |
| 2935 VisibleContentRectsForClippedSurfaceWithEmptyClip) { | 2939 VisibleContentRectsForClippedSurfaceWithEmptyClip) { |
| 2936 scoped_refptr<Layer> root = Layer::Create(); | 2940 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 2937 scoped_refptr<LayerWithForcedDrawsContent> child1 = | 2941 scoped_refptr<LayerWithForcedDrawsContent> child1 = |
| 2938 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2942 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 2939 scoped_refptr<LayerWithForcedDrawsContent> child2 = | 2943 scoped_refptr<LayerWithForcedDrawsContent> child2 = |
| 2940 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2944 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 2941 scoped_refptr<LayerWithForcedDrawsContent> child3 = | 2945 scoped_refptr<LayerWithForcedDrawsContent> child3 = |
| 2942 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2946 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 2943 root->AddChild(child1); | 2947 root->AddChild(child1); |
| 2944 root->AddChild(child2); | 2948 root->AddChild(child2); |
| 2945 root->AddChild(child3); | 2949 root->AddChild(child3); |
| 2946 | 2950 |
| 2947 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 2951 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 2948 host->SetRootLayer(root); | 2952 host->SetRootLayer(root); |
| 2949 | 2953 |
| 2950 gfx::Transform identity_matrix; | 2954 gfx::Transform identity_matrix; |
| 2951 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), | 2955 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
| 2952 gfx::PointF(), gfx::Size(100, 100), true, false); | 2956 gfx::PointF(), gfx::Size(100, 100), true, false); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2976 // Visible content rect calculation will check if the target surface is | 2980 // Visible content rect calculation will check if the target surface is |
| 2977 // clipped or not. An empty clip rect does not indicate the render surface | 2981 // clipped or not. An empty clip rect does not indicate the render surface |
| 2978 // is unclipped. | 2982 // is unclipped. |
| 2979 EXPECT_EQ(empty, child1->visible_content_rect()); | 2983 EXPECT_EQ(empty, child1->visible_content_rect()); |
| 2980 EXPECT_EQ(empty, child2->visible_content_rect()); | 2984 EXPECT_EQ(empty, child2->visible_content_rect()); |
| 2981 EXPECT_EQ(empty, child3->visible_content_rect()); | 2985 EXPECT_EQ(empty, child3->visible_content_rect()); |
| 2982 } | 2986 } |
| 2983 | 2987 |
| 2984 TEST_F(LayerTreeHostCommonTest, | 2988 TEST_F(LayerTreeHostCommonTest, |
| 2985 DrawableAndVisibleContentRectsForLayersWithUninvertibleTransform) { | 2989 DrawableAndVisibleContentRectsForLayersWithUninvertibleTransform) { |
| 2986 scoped_refptr<Layer> root = Layer::Create(); | 2990 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 2987 scoped_refptr<LayerWithForcedDrawsContent> child = | 2991 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 2988 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 2992 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 2989 root->AddChild(child); | 2993 root->AddChild(child); |
| 2990 | 2994 |
| 2991 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 2995 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 2992 host->SetRootLayer(root); | 2996 host->SetRootLayer(root); |
| 2993 | 2997 |
| 2994 // Case 1: a truly degenerate matrix | 2998 // Case 1: a truly degenerate matrix |
| 2995 gfx::Transform identity_matrix; | 2999 gfx::Transform identity_matrix; |
| 2996 gfx::Transform uninvertible_matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); | 3000 gfx::Transform uninvertible_matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); |
| 2997 ASSERT_FALSE(uninvertible_matrix.IsInvertible()); | 3001 ASSERT_FALSE(uninvertible_matrix.IsInvertible()); |
| 2998 | 3002 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3050 false); | 3054 false); |
| 3051 | 3055 |
| 3052 ExecuteCalculateDrawProperties(root.get()); | 3056 ExecuteCalculateDrawProperties(root.get()); |
| 3053 | 3057 |
| 3054 EXPECT_TRUE(child->visible_content_rect().IsEmpty()); | 3058 EXPECT_TRUE(child->visible_content_rect().IsEmpty()); |
| 3055 EXPECT_TRUE(child->drawable_content_rect().IsEmpty()); | 3059 EXPECT_TRUE(child->drawable_content_rect().IsEmpty()); |
| 3056 } | 3060 } |
| 3057 | 3061 |
| 3058 TEST_F(LayerTreeHostCommonTest, | 3062 TEST_F(LayerTreeHostCommonTest, |
| 3059 SingularTransformDoesNotPreventClearingDrawProperties) { | 3063 SingularTransformDoesNotPreventClearingDrawProperties) { |
| 3060 scoped_refptr<Layer> root = Layer::Create(); | 3064 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 3061 scoped_refptr<LayerWithForcedDrawsContent> child = | 3065 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 3062 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3066 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 3063 root->AddChild(child); | 3067 root->AddChild(child); |
| 3064 | 3068 |
| 3065 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 3069 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 3066 host->SetRootLayer(root); | 3070 host->SetRootLayer(root); |
| 3067 | 3071 |
| 3068 gfx::Transform identity_matrix; | 3072 gfx::Transform identity_matrix; |
| 3069 gfx::Transform uninvertible_matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); | 3073 gfx::Transform uninvertible_matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); |
| 3070 ASSERT_FALSE(uninvertible_matrix.IsInvertible()); | 3074 ASSERT_FALSE(uninvertible_matrix.IsInvertible()); |
| 3071 | 3075 |
| 3072 SetLayerPropertiesForTesting(root.get(), | 3076 SetLayerPropertiesForTesting(root.get(), |
| (...skipping 24 matching lines...) Expand all Loading... |
| 3097 | 3101 |
| 3098 EXPECT_TRUE(root->TransformIsAnimating()); | 3102 EXPECT_TRUE(root->TransformIsAnimating()); |
| 3099 | 3103 |
| 3100 ExecuteCalculateDrawProperties(root.get()); | 3104 ExecuteCalculateDrawProperties(root.get()); |
| 3101 | 3105 |
| 3102 EXPECT_FALSE(child->draw_properties().sorted_for_recursion); | 3106 EXPECT_FALSE(child->draw_properties().sorted_for_recursion); |
| 3103 } | 3107 } |
| 3104 | 3108 |
| 3105 TEST_F(LayerTreeHostCommonTest, | 3109 TEST_F(LayerTreeHostCommonTest, |
| 3106 SingularNonAnimatingTransformDoesNotPreventClearingDrawProperties) { | 3110 SingularNonAnimatingTransformDoesNotPreventClearingDrawProperties) { |
| 3107 scoped_refptr<Layer> root = Layer::Create(); | 3111 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 3108 | 3112 |
| 3109 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 3113 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 3110 host->SetRootLayer(root); | 3114 host->SetRootLayer(root); |
| 3111 | 3115 |
| 3112 gfx::Transform identity_matrix; | 3116 gfx::Transform identity_matrix; |
| 3113 gfx::Transform uninvertible_matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); | 3117 gfx::Transform uninvertible_matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); |
| 3114 ASSERT_FALSE(uninvertible_matrix.IsInvertible()); | 3118 ASSERT_FALSE(uninvertible_matrix.IsInvertible()); |
| 3115 | 3119 |
| 3116 SetLayerPropertiesForTesting(root.get(), | 3120 SetLayerPropertiesForTesting(root.get(), |
| 3117 uninvertible_matrix, | 3121 uninvertible_matrix, |
| 3118 gfx::Point3F(), | 3122 gfx::Point3F(), |
| 3119 gfx::PointF(), | 3123 gfx::PointF(), |
| 3120 gfx::Size(100, 100), | 3124 gfx::Size(100, 100), |
| 3121 true, | 3125 true, |
| 3122 false); | 3126 false); |
| 3123 | 3127 |
| 3124 root->draw_properties().sorted_for_recursion = true; | 3128 root->draw_properties().sorted_for_recursion = true; |
| 3125 | 3129 |
| 3126 EXPECT_FALSE(root->TransformIsAnimating()); | 3130 EXPECT_FALSE(root->TransformIsAnimating()); |
| 3127 | 3131 |
| 3128 ExecuteCalculateDrawProperties(root.get()); | 3132 ExecuteCalculateDrawProperties(root.get()); |
| 3129 | 3133 |
| 3130 EXPECT_FALSE(root->draw_properties().sorted_for_recursion); | 3134 EXPECT_FALSE(root->draw_properties().sorted_for_recursion); |
| 3131 } | 3135 } |
| 3132 | 3136 |
| 3133 TEST_F(LayerTreeHostCommonTest, | 3137 TEST_F(LayerTreeHostCommonTest, |
| 3134 DrawableAndVisibleContentRectsForLayersInClippedRenderSurface) { | 3138 DrawableAndVisibleContentRectsForLayersInClippedRenderSurface) { |
| 3135 scoped_refptr<Layer> root = Layer::Create(); | 3139 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 3136 scoped_refptr<Layer> render_surface1 = Layer::Create(); | 3140 scoped_refptr<Layer> render_surface1 = Layer::Create(layer_settings()); |
| 3137 scoped_refptr<LayerWithForcedDrawsContent> child1 = | 3141 scoped_refptr<LayerWithForcedDrawsContent> child1 = |
| 3138 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3142 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 3139 scoped_refptr<LayerWithForcedDrawsContent> child2 = | 3143 scoped_refptr<LayerWithForcedDrawsContent> child2 = |
| 3140 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3144 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 3141 scoped_refptr<LayerWithForcedDrawsContent> child3 = | 3145 scoped_refptr<LayerWithForcedDrawsContent> child3 = |
| 3142 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3146 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 3143 root->AddChild(render_surface1); | 3147 root->AddChild(render_surface1); |
| 3144 render_surface1->AddChild(child1); | 3148 render_surface1->AddChild(child1); |
| 3145 render_surface1->AddChild(child2); | 3149 render_surface1->AddChild(child2); |
| 3146 render_surface1->AddChild(child3); | 3150 render_surface1->AddChild(child3); |
| 3147 | 3151 |
| 3148 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 3152 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 3149 host->SetRootLayer(root); | 3153 host->SetRootLayer(root); |
| 3150 | 3154 |
| 3151 gfx::Transform identity_matrix; | 3155 gfx::Transform identity_matrix; |
| 3152 SetLayerPropertiesForTesting(root.get(), | 3156 SetLayerPropertiesForTesting(root.get(), |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3212 | 3216 |
| 3213 // But the DrawableContentRects are unclipped. | 3217 // But the DrawableContentRects are unclipped. |
| 3214 EXPECT_EQ(gfx::Rect(5, 5, 50, 50), child1->drawable_content_rect()); | 3218 EXPECT_EQ(gfx::Rect(5, 5, 50, 50), child1->drawable_content_rect()); |
| 3215 EXPECT_EQ(gfx::Rect(75, 75, 50, 50), child2->drawable_content_rect()); | 3219 EXPECT_EQ(gfx::Rect(75, 75, 50, 50), child2->drawable_content_rect()); |
| 3216 EXPECT_EQ(gfx::Rect(125, 125, 50, 50), child3->drawable_content_rect()); | 3220 EXPECT_EQ(gfx::Rect(125, 125, 50, 50), child3->drawable_content_rect()); |
| 3217 } | 3221 } |
| 3218 | 3222 |
| 3219 TEST_F(LayerTreeHostCommonTest, | 3223 TEST_F(LayerTreeHostCommonTest, |
| 3220 DrawableAndVisibleContentRectsForSurfaceHierarchy) { | 3224 DrawableAndVisibleContentRectsForSurfaceHierarchy) { |
| 3221 // Check that clipping does not propagate down surfaces. | 3225 // Check that clipping does not propagate down surfaces. |
| 3222 scoped_refptr<Layer> root = Layer::Create(); | 3226 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 3223 scoped_refptr<Layer> render_surface1 = Layer::Create(); | 3227 scoped_refptr<Layer> render_surface1 = Layer::Create(layer_settings()); |
| 3224 scoped_refptr<Layer> render_surface2 = Layer::Create(); | 3228 scoped_refptr<Layer> render_surface2 = Layer::Create(layer_settings()); |
| 3225 scoped_refptr<LayerWithForcedDrawsContent> child1 = | 3229 scoped_refptr<LayerWithForcedDrawsContent> child1 = |
| 3226 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3230 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 3227 scoped_refptr<LayerWithForcedDrawsContent> child2 = | 3231 scoped_refptr<LayerWithForcedDrawsContent> child2 = |
| 3228 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3232 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 3229 scoped_refptr<LayerWithForcedDrawsContent> child3 = | 3233 scoped_refptr<LayerWithForcedDrawsContent> child3 = |
| 3230 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3234 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 3231 root->AddChild(render_surface1); | 3235 root->AddChild(render_surface1); |
| 3232 render_surface1->AddChild(render_surface2); | 3236 render_surface1->AddChild(render_surface2); |
| 3233 render_surface2->AddChild(child1); | 3237 render_surface2->AddChild(child1); |
| 3234 render_surface2->AddChild(child2); | 3238 render_surface2->AddChild(child2); |
| 3235 render_surface2->AddChild(child3); | 3239 render_surface2->AddChild(child3); |
| 3236 | 3240 |
| 3237 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 3241 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 3238 host->SetRootLayer(root); | 3242 host->SetRootLayer(root); |
| 3239 | 3243 |
| 3240 gfx::Transform identity_matrix; | 3244 gfx::Transform identity_matrix; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3318 EXPECT_EQ(gfx::Rect(5, 5, 50, 50), child1->drawable_content_rect()); | 3322 EXPECT_EQ(gfx::Rect(5, 5, 50, 50), child1->drawable_content_rect()); |
| 3319 EXPECT_EQ(gfx::Rect(75, 75, 50, 50), child2->drawable_content_rect()); | 3323 EXPECT_EQ(gfx::Rect(75, 75, 50, 50), child2->drawable_content_rect()); |
| 3320 EXPECT_EQ(gfx::Rect(125, 125, 50, 50), child3->drawable_content_rect()); | 3324 EXPECT_EQ(gfx::Rect(125, 125, 50, 50), child3->drawable_content_rect()); |
| 3321 } | 3325 } |
| 3322 | 3326 |
| 3323 TEST_F(LayerTreeHostCommonTest, | 3327 TEST_F(LayerTreeHostCommonTest, |
| 3324 DrawableAndVisibleContentRectsWithTransformOnUnclippedSurface) { | 3328 DrawableAndVisibleContentRectsWithTransformOnUnclippedSurface) { |
| 3325 // Layers that have non-axis aligned bounds (due to transforms) have an | 3329 // Layers that have non-axis aligned bounds (due to transforms) have an |
| 3326 // expanded, axis-aligned DrawableContentRect and visible content rect. | 3330 // expanded, axis-aligned DrawableContentRect and visible content rect. |
| 3327 | 3331 |
| 3328 scoped_refptr<Layer> root = Layer::Create(); | 3332 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 3329 scoped_refptr<Layer> render_surface1 = Layer::Create(); | 3333 scoped_refptr<Layer> render_surface1 = Layer::Create(layer_settings()); |
| 3330 scoped_refptr<LayerWithForcedDrawsContent> child1 = | 3334 scoped_refptr<LayerWithForcedDrawsContent> child1 = |
| 3331 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3335 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 3332 root->AddChild(render_surface1); | 3336 root->AddChild(render_surface1); |
| 3333 render_surface1->AddChild(child1); | 3337 render_surface1->AddChild(child1); |
| 3334 | 3338 |
| 3335 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 3339 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 3336 host->SetRootLayer(root); | 3340 host->SetRootLayer(root); |
| 3337 | 3341 |
| 3338 gfx::Transform identity_matrix; | 3342 gfx::Transform identity_matrix; |
| 3339 gfx::Transform child_rotation; | 3343 gfx::Transform child_rotation; |
| 3340 child_rotation.Rotate(45.0); | 3344 child_rotation.Rotate(45.0); |
| 3341 SetLayerPropertiesForTesting(root.get(), | 3345 SetLayerPropertiesForTesting(root.get(), |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3387 // All layers that draw content into the unclipped surface are also unclipped. | 3391 // All layers that draw content into the unclipped surface are also unclipped. |
| 3388 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), child1->visible_content_rect()); | 3392 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), child1->visible_content_rect()); |
| 3389 EXPECT_EQ(expected_surface_drawable_content, child1->drawable_content_rect()); | 3393 EXPECT_EQ(expected_surface_drawable_content, child1->drawable_content_rect()); |
| 3390 } | 3394 } |
| 3391 | 3395 |
| 3392 TEST_F(LayerTreeHostCommonTest, | 3396 TEST_F(LayerTreeHostCommonTest, |
| 3393 DrawableAndVisibleContentRectsWithTransformOnClippedSurface) { | 3397 DrawableAndVisibleContentRectsWithTransformOnClippedSurface) { |
| 3394 // Layers that have non-axis aligned bounds (due to transforms) have an | 3398 // Layers that have non-axis aligned bounds (due to transforms) have an |
| 3395 // expanded, axis-aligned DrawableContentRect and visible content rect. | 3399 // expanded, axis-aligned DrawableContentRect and visible content rect. |
| 3396 | 3400 |
| 3397 scoped_refptr<Layer> root = Layer::Create(); | 3401 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 3398 scoped_refptr<Layer> render_surface1 = Layer::Create(); | 3402 scoped_refptr<Layer> render_surface1 = Layer::Create(layer_settings()); |
| 3399 scoped_refptr<LayerWithForcedDrawsContent> child1 = | 3403 scoped_refptr<LayerWithForcedDrawsContent> child1 = |
| 3400 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3404 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 3401 root->AddChild(render_surface1); | 3405 root->AddChild(render_surface1); |
| 3402 render_surface1->AddChild(child1); | 3406 render_surface1->AddChild(child1); |
| 3403 | 3407 |
| 3404 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 3408 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 3405 host->SetRootLayer(root); | 3409 host->SetRootLayer(root); |
| 3406 | 3410 |
| 3407 gfx::Transform identity_matrix; | 3411 gfx::Transform identity_matrix; |
| 3408 gfx::Transform child_rotation; | 3412 gfx::Transform child_rotation; |
| 3409 child_rotation.Rotate(45.0); | 3413 child_rotation.Rotate(45.0); |
| 3410 SetLayerPropertiesForTesting(root.get(), | 3414 SetLayerPropertiesForTesting(root.get(), |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3455 // Given the floating point math, this number is a little bit fuzzy. | 3459 // Given the floating point math, this number is a little bit fuzzy. |
| 3456 EXPECT_EQ(gfx::Rect(0, 0, 26, 50), child1->visible_content_rect()); | 3460 EXPECT_EQ(gfx::Rect(0, 0, 26, 50), child1->visible_content_rect()); |
| 3457 | 3461 |
| 3458 // The child's DrawableContentRect is unclipped. | 3462 // The child's DrawableContentRect is unclipped. |
| 3459 EXPECT_EQ(unclipped_surface_content, child1->drawable_content_rect()); | 3463 EXPECT_EQ(unclipped_surface_content, child1->drawable_content_rect()); |
| 3460 } | 3464 } |
| 3461 | 3465 |
| 3462 TEST_F(LayerTreeHostCommonTest, DrawableAndVisibleContentRectsInHighDPI) { | 3466 TEST_F(LayerTreeHostCommonTest, DrawableAndVisibleContentRectsInHighDPI) { |
| 3463 MockContentLayerClient client; | 3467 MockContentLayerClient client; |
| 3464 | 3468 |
| 3465 scoped_refptr<Layer> root = Layer::Create(); | 3469 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 3466 scoped_refptr<FakePictureLayer> render_surface1 = | 3470 scoped_refptr<FakePictureLayer> render_surface1 = |
| 3467 CreateDrawablePictureLayer(&client); | 3471 CreateDrawablePictureLayer(layer_settings(), &client); |
| 3468 scoped_refptr<FakePictureLayer> render_surface2 = | 3472 scoped_refptr<FakePictureLayer> render_surface2 = |
| 3469 CreateDrawablePictureLayer(&client); | 3473 CreateDrawablePictureLayer(layer_settings(), &client); |
| 3470 scoped_refptr<FakePictureLayer> child1 = CreateDrawablePictureLayer(&client); | 3474 scoped_refptr<FakePictureLayer> child1 = |
| 3471 scoped_refptr<FakePictureLayer> child2 = CreateDrawablePictureLayer(&client); | 3475 CreateDrawablePictureLayer(layer_settings(), &client); |
| 3472 scoped_refptr<FakePictureLayer> child3 = CreateDrawablePictureLayer(&client); | 3476 scoped_refptr<FakePictureLayer> child2 = |
| 3477 CreateDrawablePictureLayer(layer_settings(), &client); |
| 3478 scoped_refptr<FakePictureLayer> child3 = |
| 3479 CreateDrawablePictureLayer(layer_settings(), &client); |
| 3473 root->AddChild(render_surface1); | 3480 root->AddChild(render_surface1); |
| 3474 render_surface1->AddChild(render_surface2); | 3481 render_surface1->AddChild(render_surface2); |
| 3475 render_surface2->AddChild(child1); | 3482 render_surface2->AddChild(child1); |
| 3476 render_surface2->AddChild(child2); | 3483 render_surface2->AddChild(child2); |
| 3477 render_surface2->AddChild(child3); | 3484 render_surface2->AddChild(child3); |
| 3478 | 3485 |
| 3479 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 3486 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 3480 host->SetRootLayer(root); | 3487 host->SetRootLayer(root); |
| 3481 | 3488 |
| 3482 gfx::Transform identity_matrix; | 3489 gfx::Transform identity_matrix; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3561 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), child2->visible_content_rect()); | 3568 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), child2->visible_content_rect()); |
| 3562 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), child3->visible_content_rect()); | 3569 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), child3->visible_content_rect()); |
| 3563 } | 3570 } |
| 3564 | 3571 |
| 3565 TEST_F(LayerTreeHostCommonTest, BackFaceCullingWithoutPreserves3d) { | 3572 TEST_F(LayerTreeHostCommonTest, BackFaceCullingWithoutPreserves3d) { |
| 3566 // Verify the behavior of back-face culling when there are no preserve-3d | 3573 // Verify the behavior of back-face culling when there are no preserve-3d |
| 3567 // layers. Note that 3d transforms still apply in this case, but they are | 3574 // layers. Note that 3d transforms still apply in this case, but they are |
| 3568 // "flattened" to each parent layer according to current W3C spec. | 3575 // "flattened" to each parent layer according to current W3C spec. |
| 3569 | 3576 |
| 3570 const gfx::Transform identity_matrix; | 3577 const gfx::Transform identity_matrix; |
| 3571 scoped_refptr<Layer> parent = Layer::Create(); | 3578 scoped_refptr<Layer> parent = Layer::Create(layer_settings()); |
| 3572 scoped_refptr<LayerWithForcedDrawsContent> front_facing_child = | 3579 scoped_refptr<LayerWithForcedDrawsContent> front_facing_child = |
| 3573 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3580 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 3574 scoped_refptr<LayerWithForcedDrawsContent> back_facing_child = | 3581 scoped_refptr<LayerWithForcedDrawsContent> back_facing_child = |
| 3575 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3582 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 3576 scoped_refptr<LayerWithForcedDrawsContent> front_facing_surface = | 3583 scoped_refptr<LayerWithForcedDrawsContent> front_facing_surface = |
| 3577 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3584 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 3578 scoped_refptr<LayerWithForcedDrawsContent> back_facing_surface = | 3585 scoped_refptr<LayerWithForcedDrawsContent> back_facing_surface = |
| 3579 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3586 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 3580 scoped_refptr<LayerWithForcedDrawsContent> | 3587 scoped_refptr<LayerWithForcedDrawsContent> |
| 3581 front_facing_child_of_front_facing_surface = | 3588 front_facing_child_of_front_facing_surface = |
| 3582 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3589 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 3583 scoped_refptr<LayerWithForcedDrawsContent> | 3590 scoped_refptr<LayerWithForcedDrawsContent> |
| 3584 back_facing_child_of_front_facing_surface = | 3591 back_facing_child_of_front_facing_surface = |
| 3585 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3592 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 3586 scoped_refptr<LayerWithForcedDrawsContent> | 3593 scoped_refptr<LayerWithForcedDrawsContent> |
| 3587 front_facing_child_of_back_facing_surface = | 3594 front_facing_child_of_back_facing_surface = |
| 3588 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3595 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 3589 scoped_refptr<LayerWithForcedDrawsContent> | 3596 scoped_refptr<LayerWithForcedDrawsContent> |
| 3590 back_facing_child_of_back_facing_surface = | 3597 back_facing_child_of_back_facing_surface = |
| 3591 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3598 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 3592 | 3599 |
| 3593 parent->AddChild(front_facing_child); | 3600 parent->AddChild(front_facing_child); |
| 3594 parent->AddChild(back_facing_child); | 3601 parent->AddChild(back_facing_child); |
| 3595 parent->AddChild(front_facing_surface); | 3602 parent->AddChild(front_facing_surface); |
| 3596 parent->AddChild(back_facing_surface); | 3603 parent->AddChild(back_facing_surface); |
| 3597 front_facing_surface->AddChild(front_facing_child_of_front_facing_surface); | 3604 front_facing_surface->AddChild(front_facing_child_of_front_facing_surface); |
| 3598 front_facing_surface->AddChild(back_facing_child_of_front_facing_surface); | 3605 front_facing_surface->AddChild(back_facing_child_of_front_facing_surface); |
| 3599 back_facing_surface->AddChild(front_facing_child_of_back_facing_surface); | 3606 back_facing_surface->AddChild(front_facing_child_of_back_facing_surface); |
| 3600 back_facing_surface->AddChild(back_facing_child_of_back_facing_surface); | 3607 back_facing_surface->AddChild(back_facing_child_of_back_facing_surface); |
| 3601 | 3608 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3763 ->layer_list() | 3770 ->layer_list() |
| 3764 .at(0) | 3771 .at(0) |
| 3765 ->id()); | 3772 ->id()); |
| 3766 } | 3773 } |
| 3767 | 3774 |
| 3768 TEST_F(LayerTreeHostCommonTest, BackFaceCullingWithPreserves3d) { | 3775 TEST_F(LayerTreeHostCommonTest, BackFaceCullingWithPreserves3d) { |
| 3769 // Verify the behavior of back-face culling when preserves-3d transform style | 3776 // Verify the behavior of back-face culling when preserves-3d transform style |
| 3770 // is used. | 3777 // is used. |
| 3771 | 3778 |
| 3772 const gfx::Transform identity_matrix; | 3779 const gfx::Transform identity_matrix; |
| 3773 scoped_refptr<Layer> parent = Layer::Create(); | 3780 scoped_refptr<Layer> parent = Layer::Create(layer_settings()); |
| 3774 scoped_refptr<LayerWithForcedDrawsContent> front_facing_child = | 3781 scoped_refptr<LayerWithForcedDrawsContent> front_facing_child = |
| 3775 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3782 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 3776 scoped_refptr<LayerWithForcedDrawsContent> back_facing_child = | 3783 scoped_refptr<LayerWithForcedDrawsContent> back_facing_child = |
| 3777 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3784 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 3778 scoped_refptr<LayerWithForcedDrawsContent> front_facing_surface = | 3785 scoped_refptr<LayerWithForcedDrawsContent> front_facing_surface = |
| 3779 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3786 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 3780 scoped_refptr<LayerWithForcedDrawsContent> back_facing_surface = | 3787 scoped_refptr<LayerWithForcedDrawsContent> back_facing_surface = |
| 3781 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3788 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 3782 scoped_refptr<LayerWithForcedDrawsContent> | 3789 scoped_refptr<LayerWithForcedDrawsContent> |
| 3783 front_facing_child_of_front_facing_surface = | 3790 front_facing_child_of_front_facing_surface = |
| 3784 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3791 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 3785 scoped_refptr<LayerWithForcedDrawsContent> | 3792 scoped_refptr<LayerWithForcedDrawsContent> |
| 3786 back_facing_child_of_front_facing_surface = | 3793 back_facing_child_of_front_facing_surface = |
| 3787 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3794 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 3788 scoped_refptr<LayerWithForcedDrawsContent> | 3795 scoped_refptr<LayerWithForcedDrawsContent> |
| 3789 front_facing_child_of_back_facing_surface = | 3796 front_facing_child_of_back_facing_surface = |
| 3790 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3797 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 3791 scoped_refptr<LayerWithForcedDrawsContent> | 3798 scoped_refptr<LayerWithForcedDrawsContent> |
| 3792 back_facing_child_of_back_facing_surface = | 3799 back_facing_child_of_back_facing_surface = |
| 3793 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3800 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 3794 scoped_refptr<LayerWithForcedDrawsContent> dummy_replica_layer1 = | 3801 scoped_refptr<LayerWithForcedDrawsContent> dummy_replica_layer1 = |
| 3795 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3802 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 3796 scoped_refptr<LayerWithForcedDrawsContent> dummy_replica_layer2 = | 3803 scoped_refptr<LayerWithForcedDrawsContent> dummy_replica_layer2 = |
| 3797 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3804 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 3798 | 3805 |
| 3799 parent->AddChild(front_facing_child); | 3806 parent->AddChild(front_facing_child); |
| 3800 parent->AddChild(back_facing_child); | 3807 parent->AddChild(back_facing_child); |
| 3801 parent->AddChild(front_facing_surface); | 3808 parent->AddChild(front_facing_surface); |
| 3802 parent->AddChild(back_facing_surface); | 3809 parent->AddChild(back_facing_surface); |
| 3803 front_facing_surface->AddChild(front_facing_child_of_front_facing_surface); | 3810 front_facing_surface->AddChild(front_facing_child_of_front_facing_surface); |
| 3804 front_facing_surface->AddChild(back_facing_child_of_front_facing_surface); | 3811 front_facing_surface->AddChild(back_facing_child_of_front_facing_surface); |
| 3805 back_facing_surface->AddChild(front_facing_child_of_back_facing_surface); | 3812 back_facing_surface->AddChild(front_facing_child_of_back_facing_surface); |
| 3806 back_facing_surface->AddChild(back_facing_child_of_back_facing_surface); | 3813 back_facing_surface->AddChild(back_facing_child_of_back_facing_surface); |
| 3807 | 3814 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3948 } | 3955 } |
| 3949 | 3956 |
| 3950 TEST_F(LayerTreeHostCommonTest, BackFaceCullingWithAnimatingTransforms) { | 3957 TEST_F(LayerTreeHostCommonTest, BackFaceCullingWithAnimatingTransforms) { |
| 3951 // Verify that layers are appropriately culled when their back face is showing | 3958 // Verify that layers are appropriately culled when their back face is showing |
| 3952 // and they are not double sided, while animations are going on. | 3959 // and they are not double sided, while animations are going on. |
| 3953 // | 3960 // |
| 3954 // Layers that are animating do not get culled on the main thread, as their | 3961 // Layers that are animating do not get culled on the main thread, as their |
| 3955 // transforms should be treated as "unknown" so we can not be sure that their | 3962 // transforms should be treated as "unknown" so we can not be sure that their |
| 3956 // back face is really showing. | 3963 // back face is really showing. |
| 3957 const gfx::Transform identity_matrix; | 3964 const gfx::Transform identity_matrix; |
| 3958 scoped_refptr<Layer> parent = Layer::Create(); | 3965 scoped_refptr<Layer> parent = Layer::Create(layer_settings()); |
| 3959 scoped_refptr<LayerWithForcedDrawsContent> child = | 3966 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 3960 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3967 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 3961 scoped_refptr<LayerWithForcedDrawsContent> animating_surface = | 3968 scoped_refptr<LayerWithForcedDrawsContent> animating_surface = |
| 3962 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3969 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 3963 scoped_refptr<LayerWithForcedDrawsContent> child_of_animating_surface = | 3970 scoped_refptr<LayerWithForcedDrawsContent> child_of_animating_surface = |
| 3964 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3971 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 3965 scoped_refptr<LayerWithForcedDrawsContent> animating_child = | 3972 scoped_refptr<LayerWithForcedDrawsContent> animating_child = |
| 3966 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3973 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 3967 scoped_refptr<LayerWithForcedDrawsContent> child2 = | 3974 scoped_refptr<LayerWithForcedDrawsContent> child2 = |
| 3968 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 3975 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 3969 | 3976 |
| 3970 parent->AddChild(child); | 3977 parent->AddChild(child); |
| 3971 parent->AddChild(animating_surface); | 3978 parent->AddChild(animating_surface); |
| 3972 animating_surface->AddChild(child_of_animating_surface); | 3979 animating_surface->AddChild(child_of_animating_surface); |
| 3973 parent->AddChild(animating_child); | 3980 parent->AddChild(animating_child); |
| 3974 parent->AddChild(child2); | 3981 parent->AddChild(child2); |
| 3975 | 3982 |
| 3976 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 3983 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 3977 host->SetRootLayer(parent); | 3984 host->SetRootLayer(parent); |
| 3978 | 3985 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4097 EXPECT_EQ(child_of_animating_surface->visible_content_rect(), | 4104 EXPECT_EQ(child_of_animating_surface->visible_content_rect(), |
| 4098 gfx::Rect(child_of_animating_surface->content_bounds())); | 4105 gfx::Rect(child_of_animating_surface->content_bounds())); |
| 4099 } | 4106 } |
| 4100 | 4107 |
| 4101 TEST_F(LayerTreeHostCommonTest, | 4108 TEST_F(LayerTreeHostCommonTest, |
| 4102 BackFaceCullingWithPreserves3dForFlatteningSurface) { | 4109 BackFaceCullingWithPreserves3dForFlatteningSurface) { |
| 4103 // Verify the behavior of back-face culling for a render surface that is | 4110 // Verify the behavior of back-face culling for a render surface that is |
| 4104 // created when it flattens its subtree, and its parent has preserves-3d. | 4111 // created when it flattens its subtree, and its parent has preserves-3d. |
| 4105 | 4112 |
| 4106 const gfx::Transform identity_matrix; | 4113 const gfx::Transform identity_matrix; |
| 4107 scoped_refptr<Layer> parent = Layer::Create(); | 4114 scoped_refptr<Layer> parent = Layer::Create(layer_settings()); |
| 4108 scoped_refptr<LayerWithForcedDrawsContent> front_facing_surface = | 4115 scoped_refptr<LayerWithForcedDrawsContent> front_facing_surface = |
| 4109 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 4116 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 4110 scoped_refptr<LayerWithForcedDrawsContent> back_facing_surface = | 4117 scoped_refptr<LayerWithForcedDrawsContent> back_facing_surface = |
| 4111 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 4118 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 4112 scoped_refptr<LayerWithForcedDrawsContent> child1 = | 4119 scoped_refptr<LayerWithForcedDrawsContent> child1 = |
| 4113 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 4120 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 4114 scoped_refptr<LayerWithForcedDrawsContent> child2 = | 4121 scoped_refptr<LayerWithForcedDrawsContent> child2 = |
| 4115 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 4122 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 4116 | 4123 |
| 4117 parent->AddChild(front_facing_surface); | 4124 parent->AddChild(front_facing_surface); |
| 4118 parent->AddChild(back_facing_surface); | 4125 parent->AddChild(back_facing_surface); |
| 4119 front_facing_surface->AddChild(child1); | 4126 front_facing_surface->AddChild(child1); |
| 4120 back_facing_surface->AddChild(child2); | 4127 back_facing_surface->AddChild(child2); |
| 4121 | 4128 |
| 4122 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 4129 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 4123 host->SetRootLayer(parent); | 4130 host->SetRootLayer(parent); |
| 4124 | 4131 |
| 4125 // RenderSurfaces are not double-sided | 4132 // RenderSurfaces are not double-sided |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4207 EXPECT_EQ(front_facing_surface->id(), | 4214 EXPECT_EQ(front_facing_surface->id(), |
| 4208 render_surface_layer_list.at(1) | 4215 render_surface_layer_list.at(1) |
| 4209 ->render_surface()->layer_list().at(0)->id()); | 4216 ->render_surface()->layer_list().at(0)->id()); |
| 4210 EXPECT_EQ(child1->id(), | 4217 EXPECT_EQ(child1->id(), |
| 4211 render_surface_layer_list.at(1) | 4218 render_surface_layer_list.at(1) |
| 4212 ->render_surface()->layer_list().at(1)->id()); | 4219 ->render_surface()->layer_list().at(1)->id()); |
| 4213 } | 4220 } |
| 4214 | 4221 |
| 4215 class NoScaleContentLayer : public ContentLayer { | 4222 class NoScaleContentLayer : public ContentLayer { |
| 4216 public: | 4223 public: |
| 4217 static scoped_refptr<NoScaleContentLayer> Create(ContentLayerClient* client) { | 4224 static scoped_refptr<NoScaleContentLayer> Create( |
| 4218 return make_scoped_refptr(new NoScaleContentLayer(client)); | 4225 const LayerSettings& settings, |
| 4226 ContentLayerClient* client) { |
| 4227 return make_scoped_refptr(new NoScaleContentLayer(settings, client)); |
| 4219 } | 4228 } |
| 4220 | 4229 |
| 4221 void CalculateContentsScale(float ideal_contents_scale, | 4230 void CalculateContentsScale(float ideal_contents_scale, |
| 4222 float* contents_scale_x, | 4231 float* contents_scale_x, |
| 4223 float* contents_scale_y, | 4232 float* contents_scale_y, |
| 4224 gfx::Size* content_bounds) override { | 4233 gfx::Size* content_bounds) override { |
| 4225 // Skip over the ContentLayer to the base Layer class. | 4234 // Skip over the ContentLayer to the base Layer class. |
| 4226 Layer::CalculateContentsScale(ideal_contents_scale, | 4235 Layer::CalculateContentsScale(ideal_contents_scale, |
| 4227 contents_scale_x, | 4236 contents_scale_x, |
| 4228 contents_scale_y, | 4237 contents_scale_y, |
| 4229 content_bounds); | 4238 content_bounds); |
| 4230 } | 4239 } |
| 4231 | 4240 |
| 4232 protected: | 4241 protected: |
| 4233 explicit NoScaleContentLayer(ContentLayerClient* client) | 4242 NoScaleContentLayer(const LayerSettings& settings, ContentLayerClient* client) |
| 4234 : ContentLayer(client) {} | 4243 : ContentLayer(settings, client) {} |
| 4235 ~NoScaleContentLayer() override {} | 4244 ~NoScaleContentLayer() override {} |
| 4236 }; | 4245 }; |
| 4237 | 4246 |
| 4238 scoped_refptr<NoScaleContentLayer> CreateNoScaleDrawableContentLayer( | 4247 scoped_refptr<NoScaleContentLayer> CreateNoScaleDrawableContentLayer( |
| 4248 const LayerSettings& settings, |
| 4239 ContentLayerClient* delegate) { | 4249 ContentLayerClient* delegate) { |
| 4240 scoped_refptr<NoScaleContentLayer> to_return = | 4250 scoped_refptr<NoScaleContentLayer> to_return = |
| 4241 NoScaleContentLayer::Create(delegate); | 4251 NoScaleContentLayer::Create(settings, delegate); |
| 4242 to_return->SetIsDrawable(true); | 4252 to_return->SetIsDrawable(true); |
| 4243 return to_return; | 4253 return to_return; |
| 4244 } | 4254 } |
| 4245 | 4255 |
| 4246 TEST_F(LayerTreeHostCommonTest, LayerTransformsInHighDPI) { | 4256 TEST_F(LayerTreeHostCommonTest, LayerTransformsInHighDPI) { |
| 4247 // Verify draw and screen space transforms of layers not in a surface. | 4257 // Verify draw and screen space transforms of layers not in a surface. |
| 4248 MockContentLayerClient delegate; | 4258 MockContentLayerClient delegate; |
| 4249 gfx::Transform identity_matrix; | 4259 gfx::Transform identity_matrix; |
| 4250 | 4260 |
| 4251 scoped_refptr<FakePictureLayer> parent = | 4261 scoped_refptr<FakePictureLayer> parent = |
| 4252 CreateDrawablePictureLayer(&delegate); | 4262 CreateDrawablePictureLayer(layer_settings(), &delegate); |
| 4253 SetLayerPropertiesForTesting(parent.get(), | 4263 SetLayerPropertiesForTesting(parent.get(), |
| 4254 identity_matrix, | 4264 identity_matrix, |
| 4255 gfx::Point3F(), | 4265 gfx::Point3F(), |
| 4256 gfx::PointF(), | 4266 gfx::PointF(), |
| 4257 gfx::Size(100, 100), | 4267 gfx::Size(100, 100), |
| 4258 false, | 4268 false, |
| 4259 true); | 4269 true); |
| 4260 | 4270 |
| 4261 scoped_refptr<FakePictureLayer> child = CreateDrawablePictureLayer(&delegate); | 4271 scoped_refptr<FakePictureLayer> child = |
| 4272 CreateDrawablePictureLayer(layer_settings(), &delegate); |
| 4262 SetLayerPropertiesForTesting(child.get(), | 4273 SetLayerPropertiesForTesting(child.get(), |
| 4263 identity_matrix, | 4274 identity_matrix, |
| 4264 gfx::Point3F(), | 4275 gfx::Point3F(), |
| 4265 gfx::PointF(2.f, 2.f), | 4276 gfx::PointF(2.f, 2.f), |
| 4266 gfx::Size(10, 10), | 4277 gfx::Size(10, 10), |
| 4267 false, | 4278 false, |
| 4268 true); | 4279 true); |
| 4269 | 4280 |
| 4270 scoped_refptr<FakePictureLayer> child_empty = | 4281 scoped_refptr<FakePictureLayer> child_empty = |
| 4271 CreateDrawablePictureLayer(&delegate); | 4282 CreateDrawablePictureLayer(layer_settings(), &delegate); |
| 4272 SetLayerPropertiesForTesting(child_empty.get(), | 4283 SetLayerPropertiesForTesting(child_empty.get(), |
| 4273 identity_matrix, | 4284 identity_matrix, |
| 4274 gfx::Point3F(), | 4285 gfx::Point3F(), |
| 4275 gfx::PointF(2.f, 2.f), | 4286 gfx::PointF(2.f, 2.f), |
| 4276 gfx::Size(), | 4287 gfx::Size(), |
| 4277 false, | 4288 false, |
| 4278 true); | 4289 true); |
| 4279 | 4290 |
| 4280 parent->AddChild(child); | 4291 parent->AddChild(child); |
| 4281 parent->AddChild(child_empty); | 4292 parent->AddChild(child_empty); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4362 // Verify draw and screen space transforms of layers in a surface. | 4373 // Verify draw and screen space transforms of layers in a surface. |
| 4363 MockContentLayerClient delegate; | 4374 MockContentLayerClient delegate; |
| 4364 gfx::Transform identity_matrix; | 4375 gfx::Transform identity_matrix; |
| 4365 | 4376 |
| 4366 gfx::Transform perspective_matrix; | 4377 gfx::Transform perspective_matrix; |
| 4367 perspective_matrix.ApplyPerspectiveDepth(2.0); | 4378 perspective_matrix.ApplyPerspectiveDepth(2.0); |
| 4368 | 4379 |
| 4369 gfx::Transform scale_small_matrix; | 4380 gfx::Transform scale_small_matrix; |
| 4370 scale_small_matrix.Scale(SK_MScalar1 / 10.f, SK_MScalar1 / 12.f); | 4381 scale_small_matrix.Scale(SK_MScalar1 / 10.f, SK_MScalar1 / 12.f); |
| 4371 | 4382 |
| 4372 scoped_refptr<Layer> root = Layer::Create(); | 4383 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 4373 | 4384 |
| 4374 scoped_refptr<FakePictureLayer> parent = | 4385 scoped_refptr<FakePictureLayer> parent = |
| 4375 CreateDrawablePictureLayer(&delegate); | 4386 CreateDrawablePictureLayer(layer_settings(), &delegate); |
| 4376 SetLayerPropertiesForTesting(parent.get(), | 4387 SetLayerPropertiesForTesting(parent.get(), |
| 4377 identity_matrix, | 4388 identity_matrix, |
| 4378 gfx::Point3F(), | 4389 gfx::Point3F(), |
| 4379 gfx::PointF(), | 4390 gfx::PointF(), |
| 4380 gfx::Size(100, 100), | 4391 gfx::Size(100, 100), |
| 4381 false, | 4392 false, |
| 4382 true); | 4393 true); |
| 4383 | 4394 |
| 4384 scoped_refptr<FakePictureLayer> perspective_surface = | 4395 scoped_refptr<FakePictureLayer> perspective_surface = |
| 4385 CreateDrawablePictureLayer(&delegate); | 4396 CreateDrawablePictureLayer(layer_settings(), &delegate); |
| 4386 SetLayerPropertiesForTesting(perspective_surface.get(), | 4397 SetLayerPropertiesForTesting(perspective_surface.get(), |
| 4387 perspective_matrix * scale_small_matrix, | 4398 perspective_matrix * scale_small_matrix, |
| 4388 gfx::Point3F(), | 4399 gfx::Point3F(), |
| 4389 gfx::PointF(2.f, 2.f), | 4400 gfx::PointF(2.f, 2.f), |
| 4390 gfx::Size(10, 10), | 4401 gfx::Size(10, 10), |
| 4391 false, | 4402 false, |
| 4392 true); | 4403 true); |
| 4393 | 4404 |
| 4394 scoped_refptr<FakePictureLayer> scale_surface = | 4405 scoped_refptr<FakePictureLayer> scale_surface = |
| 4395 CreateDrawablePictureLayer(&delegate); | 4406 CreateDrawablePictureLayer(layer_settings(), &delegate); |
| 4396 SetLayerPropertiesForTesting(scale_surface.get(), | 4407 SetLayerPropertiesForTesting(scale_surface.get(), |
| 4397 scale_small_matrix, | 4408 scale_small_matrix, |
| 4398 gfx::Point3F(), | 4409 gfx::Point3F(), |
| 4399 gfx::PointF(2.f, 2.f), | 4410 gfx::PointF(2.f, 2.f), |
| 4400 gfx::Size(10, 10), | 4411 gfx::Size(10, 10), |
| 4401 false, | 4412 false, |
| 4402 true); | 4413 true); |
| 4403 | 4414 |
| 4404 perspective_surface->SetForceRenderSurface(true); | 4415 perspective_surface->SetForceRenderSurface(true); |
| 4405 scale_surface->SetForceRenderSurface(true); | 4416 scale_surface->SetForceRenderSurface(true); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4478 perspective_surface->draw_transform()); | 4489 perspective_surface->draw_transform()); |
| 4479 } | 4490 } |
| 4480 | 4491 |
| 4481 // TODO(sohanjg): Remove this test when ContentLayer is removed. | 4492 // TODO(sohanjg): Remove this test when ContentLayer is removed. |
| 4482 TEST_F(LayerTreeHostCommonTest, | 4493 TEST_F(LayerTreeHostCommonTest, |
| 4483 LayerTransformsInHighDPIAccurateScaleZeroChildPosition) { | 4494 LayerTransformsInHighDPIAccurateScaleZeroChildPosition) { |
| 4484 // Verify draw and screen space transforms of layers not in a surface. | 4495 // Verify draw and screen space transforms of layers not in a surface. |
| 4485 MockContentLayerClient delegate; | 4496 MockContentLayerClient delegate; |
| 4486 gfx::Transform identity_matrix; | 4497 gfx::Transform identity_matrix; |
| 4487 | 4498 |
| 4488 scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate); | 4499 scoped_refptr<ContentLayer> parent = |
| 4500 CreateDrawableContentLayer(layer_settings(), &delegate); |
| 4489 SetLayerPropertiesForTesting(parent.get(), | 4501 SetLayerPropertiesForTesting(parent.get(), |
| 4490 identity_matrix, | 4502 identity_matrix, |
| 4491 gfx::Point3F(), | 4503 gfx::Point3F(), |
| 4492 gfx::PointF(), | 4504 gfx::PointF(), |
| 4493 gfx::Size(133, 133), | 4505 gfx::Size(133, 133), |
| 4494 false, | 4506 false, |
| 4495 true); | 4507 true); |
| 4496 | 4508 |
| 4497 scoped_refptr<ContentLayer> child = CreateDrawableContentLayer(&delegate); | 4509 scoped_refptr<ContentLayer> child = |
| 4510 CreateDrawableContentLayer(layer_settings(), &delegate); |
| 4498 SetLayerPropertiesForTesting(child.get(), | 4511 SetLayerPropertiesForTesting(child.get(), |
| 4499 identity_matrix, | 4512 identity_matrix, |
| 4500 gfx::Point3F(), | 4513 gfx::Point3F(), |
| 4501 gfx::PointF(), | 4514 gfx::PointF(), |
| 4502 gfx::Size(13, 13), | 4515 gfx::Size(13, 13), |
| 4503 false, | 4516 false, |
| 4504 true); | 4517 true); |
| 4505 | 4518 |
| 4506 scoped_refptr<NoScaleContentLayer> child_no_scale = | 4519 scoped_refptr<NoScaleContentLayer> child_no_scale = |
| 4507 CreateNoScaleDrawableContentLayer(&delegate); | 4520 CreateNoScaleDrawableContentLayer(layer_settings(), &delegate); |
| 4508 SetLayerPropertiesForTesting(child_no_scale.get(), | 4521 SetLayerPropertiesForTesting(child_no_scale.get(), |
| 4509 identity_matrix, | 4522 identity_matrix, |
| 4510 gfx::Point3F(), | 4523 gfx::Point3F(), |
| 4511 gfx::PointF(), | 4524 gfx::PointF(), |
| 4512 gfx::Size(13, 13), | 4525 gfx::Size(13, 13), |
| 4513 false, | 4526 false, |
| 4514 true); | 4527 true); |
| 4515 | 4528 |
| 4516 parent->AddChild(child); | 4529 parent->AddChild(child); |
| 4517 parent->AddChild(child_no_scale); | 4530 parent->AddChild(child_no_scale); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4601 gfx::Transform identity_matrix; | 4614 gfx::Transform identity_matrix; |
| 4602 | 4615 |
| 4603 gfx::Transform parent_scale_matrix; | 4616 gfx::Transform parent_scale_matrix; |
| 4604 SkMScalar initial_parent_scale = 1.75; | 4617 SkMScalar initial_parent_scale = 1.75; |
| 4605 parent_scale_matrix.Scale(initial_parent_scale, initial_parent_scale); | 4618 parent_scale_matrix.Scale(initial_parent_scale, initial_parent_scale); |
| 4606 | 4619 |
| 4607 gfx::Transform child_scale_matrix; | 4620 gfx::Transform child_scale_matrix; |
| 4608 SkMScalar initial_child_scale = 1.25; | 4621 SkMScalar initial_child_scale = 1.25; |
| 4609 child_scale_matrix.Scale(initial_child_scale, initial_child_scale); | 4622 child_scale_matrix.Scale(initial_child_scale, initial_child_scale); |
| 4610 | 4623 |
| 4611 scoped_refptr<Layer> root = Layer::Create(); | 4624 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 4612 root->SetBounds(gfx::Size(100, 100)); | 4625 root->SetBounds(gfx::Size(100, 100)); |
| 4613 | 4626 |
| 4614 scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate); | 4627 scoped_refptr<ContentLayer> parent = |
| 4628 CreateDrawableContentLayer(layer_settings(), &delegate); |
| 4615 SetLayerPropertiesForTesting(parent.get(), | 4629 SetLayerPropertiesForTesting(parent.get(), |
| 4616 parent_scale_matrix, | 4630 parent_scale_matrix, |
| 4617 gfx::Point3F(), | 4631 gfx::Point3F(), |
| 4618 gfx::PointF(), | 4632 gfx::PointF(), |
| 4619 gfx::Size(100, 100), | 4633 gfx::Size(100, 100), |
| 4620 false, | 4634 false, |
| 4621 true); | 4635 true); |
| 4622 | 4636 |
| 4623 scoped_refptr<ContentLayer> child_scale = | 4637 scoped_refptr<ContentLayer> child_scale = |
| 4624 CreateDrawableContentLayer(&delegate); | 4638 CreateDrawableContentLayer(layer_settings(), &delegate); |
| 4625 SetLayerPropertiesForTesting(child_scale.get(), | 4639 SetLayerPropertiesForTesting(child_scale.get(), |
| 4626 child_scale_matrix, | 4640 child_scale_matrix, |
| 4627 gfx::Point3F(), | 4641 gfx::Point3F(), |
| 4628 gfx::PointF(2.f, 2.f), | 4642 gfx::PointF(2.f, 2.f), |
| 4629 gfx::Size(10, 10), | 4643 gfx::Size(10, 10), |
| 4630 false, | 4644 false, |
| 4631 true); | 4645 true); |
| 4632 | 4646 |
| 4633 scoped_refptr<ContentLayer> child_empty = | 4647 scoped_refptr<ContentLayer> child_empty = |
| 4634 CreateDrawableContentLayer(&delegate); | 4648 CreateDrawableContentLayer(layer_settings(), &delegate); |
| 4635 SetLayerPropertiesForTesting(child_empty.get(), | 4649 SetLayerPropertiesForTesting(child_empty.get(), |
| 4636 child_scale_matrix, | 4650 child_scale_matrix, |
| 4637 gfx::Point3F(), | 4651 gfx::Point3F(), |
| 4638 gfx::PointF(2.f, 2.f), | 4652 gfx::PointF(2.f, 2.f), |
| 4639 gfx::Size(), | 4653 gfx::Size(), |
| 4640 false, | 4654 false, |
| 4641 true); | 4655 true); |
| 4642 | 4656 |
| 4643 scoped_refptr<NoScaleContentLayer> child_no_scale = | 4657 scoped_refptr<NoScaleContentLayer> child_no_scale = |
| 4644 CreateNoScaleDrawableContentLayer(&delegate); | 4658 CreateNoScaleDrawableContentLayer(layer_settings(), &delegate); |
| 4645 SetLayerPropertiesForTesting(child_no_scale.get(), | 4659 SetLayerPropertiesForTesting(child_no_scale.get(), |
| 4646 child_scale_matrix, | 4660 child_scale_matrix, |
| 4647 gfx::Point3F(), | 4661 gfx::Point3F(), |
| 4648 gfx::PointF(12.f, 12.f), | 4662 gfx::PointF(12.f, 12.f), |
| 4649 gfx::Size(10, 10), | 4663 gfx::Size(10, 10), |
| 4650 false, | 4664 false, |
| 4651 true); | 4665 true); |
| 4652 | 4666 |
| 4653 root->AddChild(parent); | 4667 root->AddChild(parent); |
| 4654 | 4668 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4790 gfx::Transform identity_matrix; | 4804 gfx::Transform identity_matrix; |
| 4791 | 4805 |
| 4792 gfx::Transform parent_scale_matrix; | 4806 gfx::Transform parent_scale_matrix; |
| 4793 SkMScalar initial_parent_scale = 1.75; | 4807 SkMScalar initial_parent_scale = 1.75; |
| 4794 parent_scale_matrix.Scale(initial_parent_scale, initial_parent_scale); | 4808 parent_scale_matrix.Scale(initial_parent_scale, initial_parent_scale); |
| 4795 | 4809 |
| 4796 gfx::Transform child_scale_matrix; | 4810 gfx::Transform child_scale_matrix; |
| 4797 SkMScalar initial_child_scale = 1.25; | 4811 SkMScalar initial_child_scale = 1.25; |
| 4798 child_scale_matrix.Scale(initial_child_scale, initial_child_scale); | 4812 child_scale_matrix.Scale(initial_child_scale, initial_child_scale); |
| 4799 | 4813 |
| 4800 scoped_refptr<Layer> root = Layer::Create(); | 4814 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 4801 root->SetBounds(gfx::Size(100, 100)); | 4815 root->SetBounds(gfx::Size(100, 100)); |
| 4802 | 4816 |
| 4803 scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate); | 4817 scoped_refptr<ContentLayer> parent = |
| 4818 CreateDrawableContentLayer(layer_settings(), &delegate); |
| 4804 SetLayerPropertiesForTesting(parent.get(), | 4819 SetLayerPropertiesForTesting(parent.get(), |
| 4805 parent_scale_matrix, | 4820 parent_scale_matrix, |
| 4806 gfx::Point3F(), | 4821 gfx::Point3F(), |
| 4807 gfx::PointF(), | 4822 gfx::PointF(), |
| 4808 gfx::Size(100, 100), | 4823 gfx::Size(100, 100), |
| 4809 false, | 4824 false, |
| 4810 true); | 4825 true); |
| 4811 | 4826 |
| 4812 scoped_refptr<ContentLayer> child_scale = | 4827 scoped_refptr<ContentLayer> child_scale = |
| 4813 CreateDrawableContentLayer(&delegate); | 4828 CreateDrawableContentLayer(layer_settings(), &delegate); |
| 4814 SetLayerPropertiesForTesting(child_scale.get(), | 4829 SetLayerPropertiesForTesting(child_scale.get(), |
| 4815 child_scale_matrix, | 4830 child_scale_matrix, |
| 4816 gfx::Point3F(), | 4831 gfx::Point3F(), |
| 4817 gfx::PointF(2.f, 2.f), | 4832 gfx::PointF(2.f, 2.f), |
| 4818 gfx::Size(10, 10), | 4833 gfx::Size(10, 10), |
| 4819 false, | 4834 false, |
| 4820 true); | 4835 true); |
| 4821 | 4836 |
| 4822 scoped_refptr<ContentLayer> child_empty = | 4837 scoped_refptr<ContentLayer> child_empty = |
| 4823 CreateDrawableContentLayer(&delegate); | 4838 CreateDrawableContentLayer(layer_settings(), &delegate); |
| 4824 SetLayerPropertiesForTesting(child_empty.get(), | 4839 SetLayerPropertiesForTesting(child_empty.get(), |
| 4825 child_scale_matrix, | 4840 child_scale_matrix, |
| 4826 gfx::Point3F(), | 4841 gfx::Point3F(), |
| 4827 gfx::PointF(2.f, 2.f), | 4842 gfx::PointF(2.f, 2.f), |
| 4828 gfx::Size(), | 4843 gfx::Size(), |
| 4829 false, | 4844 false, |
| 4830 true); | 4845 true); |
| 4831 | 4846 |
| 4832 scoped_refptr<NoScaleContentLayer> child_no_scale = | 4847 scoped_refptr<NoScaleContentLayer> child_no_scale = |
| 4833 CreateNoScaleDrawableContentLayer(&delegate); | 4848 CreateNoScaleDrawableContentLayer(layer_settings(), &delegate); |
| 4834 SetLayerPropertiesForTesting(child_no_scale.get(), | 4849 SetLayerPropertiesForTesting(child_no_scale.get(), |
| 4835 child_scale_matrix, | 4850 child_scale_matrix, |
| 4836 gfx::Point3F(), | 4851 gfx::Point3F(), |
| 4837 gfx::PointF(12.f, 12.f), | 4852 gfx::PointF(12.f, 12.f), |
| 4838 gfx::Size(10, 10), | 4853 gfx::Size(10, 10), |
| 4839 false, | 4854 false, |
| 4840 true); | 4855 true); |
| 4841 | 4856 |
| 4842 root->AddChild(parent); | 4857 root->AddChild(parent); |
| 4843 | 4858 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4895 gfx::Transform identity_matrix; | 4910 gfx::Transform identity_matrix; |
| 4896 | 4911 |
| 4897 gfx::Transform parent_scale_matrix; | 4912 gfx::Transform parent_scale_matrix; |
| 4898 SkMScalar initial_parent_scale = 1.75; | 4913 SkMScalar initial_parent_scale = 1.75; |
| 4899 parent_scale_matrix.Scale(initial_parent_scale, initial_parent_scale); | 4914 parent_scale_matrix.Scale(initial_parent_scale, initial_parent_scale); |
| 4900 | 4915 |
| 4901 gfx::Transform child_scale_matrix; | 4916 gfx::Transform child_scale_matrix; |
| 4902 SkMScalar initial_child_scale = 0.25; | 4917 SkMScalar initial_child_scale = 0.25; |
| 4903 child_scale_matrix.Scale(initial_child_scale, initial_child_scale); | 4918 child_scale_matrix.Scale(initial_child_scale, initial_child_scale); |
| 4904 | 4919 |
| 4905 scoped_refptr<Layer> root = Layer::Create(); | 4920 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 4906 root->SetBounds(gfx::Size(100, 100)); | 4921 root->SetBounds(gfx::Size(100, 100)); |
| 4907 | 4922 |
| 4908 scoped_refptr<FakePictureLayer> parent = | 4923 scoped_refptr<FakePictureLayer> parent = |
| 4909 CreateDrawablePictureLayer(&delegate); | 4924 CreateDrawablePictureLayer(layer_settings(), &delegate); |
| 4910 SetLayerPropertiesForTesting(parent.get(), | 4925 SetLayerPropertiesForTesting(parent.get(), |
| 4911 parent_scale_matrix, | 4926 parent_scale_matrix, |
| 4912 gfx::Point3F(), | 4927 gfx::Point3F(), |
| 4913 gfx::PointF(), | 4928 gfx::PointF(), |
| 4914 gfx::Size(100, 100), | 4929 gfx::Size(100, 100), |
| 4915 false, | 4930 false, |
| 4916 true); | 4931 true); |
| 4917 | 4932 |
| 4918 scoped_refptr<FakePictureLayer> child_scale = | 4933 scoped_refptr<FakePictureLayer> child_scale = |
| 4919 CreateDrawablePictureLayer(&delegate); | 4934 CreateDrawablePictureLayer(layer_settings(), &delegate); |
| 4920 SetLayerPropertiesForTesting(child_scale.get(), | 4935 SetLayerPropertiesForTesting(child_scale.get(), |
| 4921 child_scale_matrix, | 4936 child_scale_matrix, |
| 4922 gfx::Point3F(), | 4937 gfx::Point3F(), |
| 4923 gfx::PointF(2.f, 2.f), | 4938 gfx::PointF(2.f, 2.f), |
| 4924 gfx::Size(10, 10), | 4939 gfx::Size(10, 10), |
| 4925 false, | 4940 false, |
| 4926 true); | 4941 true); |
| 4927 | 4942 |
| 4928 root->AddChild(parent); | 4943 root->AddChild(parent); |
| 4929 | 4944 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4963 gfx::Transform identity_matrix; | 4978 gfx::Transform identity_matrix; |
| 4964 | 4979 |
| 4965 gfx::Transform parent_scale_matrix; | 4980 gfx::Transform parent_scale_matrix; |
| 4966 SkMScalar initial_parent_scale = 2.0; | 4981 SkMScalar initial_parent_scale = 2.0; |
| 4967 parent_scale_matrix.Scale(initial_parent_scale, initial_parent_scale); | 4982 parent_scale_matrix.Scale(initial_parent_scale, initial_parent_scale); |
| 4968 | 4983 |
| 4969 gfx::Transform child_scale_matrix; | 4984 gfx::Transform child_scale_matrix; |
| 4970 SkMScalar initial_child_scale = 3.0; | 4985 SkMScalar initial_child_scale = 3.0; |
| 4971 child_scale_matrix.Scale(initial_child_scale, initial_child_scale); | 4986 child_scale_matrix.Scale(initial_child_scale, initial_child_scale); |
| 4972 | 4987 |
| 4973 scoped_refptr<Layer> root = Layer::Create(); | 4988 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 4974 root->SetBounds(gfx::Size(100, 100)); | 4989 root->SetBounds(gfx::Size(100, 100)); |
| 4975 | 4990 |
| 4976 scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate); | 4991 scoped_refptr<ContentLayer> parent = |
| 4992 CreateDrawableContentLayer(layer_settings(), &delegate); |
| 4977 SetLayerPropertiesForTesting(parent.get(), | 4993 SetLayerPropertiesForTesting(parent.get(), |
| 4978 parent_scale_matrix, | 4994 parent_scale_matrix, |
| 4979 gfx::Point3F(), | 4995 gfx::Point3F(), |
| 4980 gfx::PointF(), | 4996 gfx::PointF(), |
| 4981 gfx::Size(100, 100), | 4997 gfx::Size(100, 100), |
| 4982 false, | 4998 false, |
| 4983 true); | 4999 true); |
| 4984 | 5000 |
| 4985 scoped_refptr<ContentLayer> surface_scale = | 5001 scoped_refptr<ContentLayer> surface_scale = |
| 4986 CreateDrawableContentLayer(&delegate); | 5002 CreateDrawableContentLayer(layer_settings(), &delegate); |
| 4987 SetLayerPropertiesForTesting(surface_scale.get(), | 5003 SetLayerPropertiesForTesting(surface_scale.get(), |
| 4988 child_scale_matrix, | 5004 child_scale_matrix, |
| 4989 gfx::Point3F(), | 5005 gfx::Point3F(), |
| 4990 gfx::PointF(2.f, 2.f), | 5006 gfx::PointF(2.f, 2.f), |
| 4991 gfx::Size(10, 10), | 5007 gfx::Size(10, 10), |
| 4992 false, | 5008 false, |
| 4993 true); | 5009 true); |
| 4994 | 5010 |
| 4995 scoped_refptr<ContentLayer> surface_scale_child_scale = | 5011 scoped_refptr<ContentLayer> surface_scale_child_scale = |
| 4996 CreateDrawableContentLayer(&delegate); | 5012 CreateDrawableContentLayer(layer_settings(), &delegate); |
| 4997 SetLayerPropertiesForTesting(surface_scale_child_scale.get(), | 5013 SetLayerPropertiesForTesting(surface_scale_child_scale.get(), |
| 4998 child_scale_matrix, | 5014 child_scale_matrix, |
| 4999 gfx::Point3F(), | 5015 gfx::Point3F(), |
| 5000 gfx::PointF(), | 5016 gfx::PointF(), |
| 5001 gfx::Size(10, 10), | 5017 gfx::Size(10, 10), |
| 5002 false, | 5018 false, |
| 5003 true); | 5019 true); |
| 5004 | 5020 |
| 5005 scoped_refptr<NoScaleContentLayer> surface_scale_child_no_scale = | 5021 scoped_refptr<NoScaleContentLayer> surface_scale_child_no_scale = |
| 5006 CreateNoScaleDrawableContentLayer(&delegate); | 5022 CreateNoScaleDrawableContentLayer(layer_settings(), &delegate); |
| 5007 SetLayerPropertiesForTesting(surface_scale_child_no_scale.get(), | 5023 SetLayerPropertiesForTesting(surface_scale_child_no_scale.get(), |
| 5008 child_scale_matrix, | 5024 child_scale_matrix, |
| 5009 gfx::Point3F(), | 5025 gfx::Point3F(), |
| 5010 gfx::PointF(), | 5026 gfx::PointF(), |
| 5011 gfx::Size(10, 10), | 5027 gfx::Size(10, 10), |
| 5012 false, | 5028 false, |
| 5013 true); | 5029 true); |
| 5014 | 5030 |
| 5015 scoped_refptr<NoScaleContentLayer> surface_no_scale = | 5031 scoped_refptr<NoScaleContentLayer> surface_no_scale = |
| 5016 CreateNoScaleDrawableContentLayer(&delegate); | 5032 CreateNoScaleDrawableContentLayer(layer_settings(), &delegate); |
| 5017 SetLayerPropertiesForTesting(surface_no_scale.get(), | 5033 SetLayerPropertiesForTesting(surface_no_scale.get(), |
| 5018 child_scale_matrix, | 5034 child_scale_matrix, |
| 5019 gfx::Point3F(), | 5035 gfx::Point3F(), |
| 5020 gfx::PointF(12.f, 12.f), | 5036 gfx::PointF(12.f, 12.f), |
| 5021 gfx::Size(10, 10), | 5037 gfx::Size(10, 10), |
| 5022 false, | 5038 false, |
| 5023 true); | 5039 true); |
| 5024 | 5040 |
| 5025 scoped_refptr<ContentLayer> surface_no_scale_child_scale = | 5041 scoped_refptr<ContentLayer> surface_no_scale_child_scale = |
| 5026 CreateDrawableContentLayer(&delegate); | 5042 CreateDrawableContentLayer(layer_settings(), &delegate); |
| 5027 SetLayerPropertiesForTesting(surface_no_scale_child_scale.get(), | 5043 SetLayerPropertiesForTesting(surface_no_scale_child_scale.get(), |
| 5028 child_scale_matrix, | 5044 child_scale_matrix, |
| 5029 gfx::Point3F(), | 5045 gfx::Point3F(), |
| 5030 gfx::PointF(), | 5046 gfx::PointF(), |
| 5031 gfx::Size(10, 10), | 5047 gfx::Size(10, 10), |
| 5032 false, | 5048 false, |
| 5033 true); | 5049 true); |
| 5034 | 5050 |
| 5035 scoped_refptr<NoScaleContentLayer> surface_no_scale_child_no_scale = | 5051 scoped_refptr<NoScaleContentLayer> surface_no_scale_child_no_scale = |
| 5036 CreateNoScaleDrawableContentLayer(&delegate); | 5052 CreateNoScaleDrawableContentLayer(layer_settings(), &delegate); |
| 5037 SetLayerPropertiesForTesting(surface_no_scale_child_no_scale.get(), | 5053 SetLayerPropertiesForTesting(surface_no_scale_child_no_scale.get(), |
| 5038 child_scale_matrix, | 5054 child_scale_matrix, |
| 5039 gfx::Point3F(), | 5055 gfx::Point3F(), |
| 5040 gfx::PointF(), | 5056 gfx::PointF(), |
| 5041 gfx::Size(10, 10), | 5057 gfx::Size(10, 10), |
| 5042 false, | 5058 false, |
| 5043 true); | 5059 true); |
| 5044 | 5060 |
| 5045 root->AddChild(parent); | 5061 root->AddChild(parent); |
| 5046 | 5062 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5166 gfx::Transform identity_matrix; | 5182 gfx::Transform identity_matrix; |
| 5167 | 5183 |
| 5168 gfx::Transform parent_scale_matrix; | 5184 gfx::Transform parent_scale_matrix; |
| 5169 SkMScalar initial_parent_scale = 2.0; | 5185 SkMScalar initial_parent_scale = 2.0; |
| 5170 parent_scale_matrix.Scale(initial_parent_scale, initial_parent_scale); | 5186 parent_scale_matrix.Scale(initial_parent_scale, initial_parent_scale); |
| 5171 | 5187 |
| 5172 gfx::Transform child_scale_matrix; | 5188 gfx::Transform child_scale_matrix; |
| 5173 SkMScalar initial_child_scale = 3.0; | 5189 SkMScalar initial_child_scale = 3.0; |
| 5174 child_scale_matrix.Scale(initial_child_scale, initial_child_scale); | 5190 child_scale_matrix.Scale(initial_child_scale, initial_child_scale); |
| 5175 | 5191 |
| 5176 scoped_refptr<Layer> root = Layer::Create(); | 5192 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 5177 root->SetBounds(gfx::Size(100, 100)); | 5193 root->SetBounds(gfx::Size(100, 100)); |
| 5178 | 5194 |
| 5179 scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate); | 5195 scoped_refptr<ContentLayer> parent = |
| 5196 CreateDrawableContentLayer(layer_settings(), &delegate); |
| 5180 SetLayerPropertiesForTesting(parent.get(), | 5197 SetLayerPropertiesForTesting(parent.get(), |
| 5181 parent_scale_matrix, | 5198 parent_scale_matrix, |
| 5182 gfx::Point3F(), | 5199 gfx::Point3F(), |
| 5183 gfx::PointF(), | 5200 gfx::PointF(), |
| 5184 gfx::Size(100, 100), | 5201 gfx::Size(100, 100), |
| 5185 false, | 5202 false, |
| 5186 true); | 5203 true); |
| 5187 | 5204 |
| 5188 scoped_refptr<ContentLayer> surface_scale = | 5205 scoped_refptr<ContentLayer> surface_scale = |
| 5189 CreateDrawableContentLayer(&delegate); | 5206 CreateDrawableContentLayer(layer_settings(), &delegate); |
| 5190 SetLayerPropertiesForTesting(surface_scale.get(), | 5207 SetLayerPropertiesForTesting(surface_scale.get(), |
| 5191 child_scale_matrix, | 5208 child_scale_matrix, |
| 5192 gfx::Point3F(), | 5209 gfx::Point3F(), |
| 5193 gfx::PointF(2.f, 2.f), | 5210 gfx::PointF(2.f, 2.f), |
| 5194 gfx::Size(10, 10), | 5211 gfx::Size(10, 10), |
| 5195 false, | 5212 false, |
| 5196 true); | 5213 true); |
| 5197 | 5214 |
| 5198 scoped_refptr<ContentLayer> surface_scale_child_scale = | 5215 scoped_refptr<ContentLayer> surface_scale_child_scale = |
| 5199 CreateDrawableContentLayer(&delegate); | 5216 CreateDrawableContentLayer(layer_settings(), &delegate); |
| 5200 SetLayerPropertiesForTesting(surface_scale_child_scale.get(), | 5217 SetLayerPropertiesForTesting(surface_scale_child_scale.get(), |
| 5201 child_scale_matrix, | 5218 child_scale_matrix, |
| 5202 gfx::Point3F(), | 5219 gfx::Point3F(), |
| 5203 gfx::PointF(), | 5220 gfx::PointF(), |
| 5204 gfx::Size(10, 10), | 5221 gfx::Size(10, 10), |
| 5205 false, | 5222 false, |
| 5206 true); | 5223 true); |
| 5207 | 5224 |
| 5208 scoped_refptr<NoScaleContentLayer> surface_scale_child_no_scale = | 5225 scoped_refptr<NoScaleContentLayer> surface_scale_child_no_scale = |
| 5209 CreateNoScaleDrawableContentLayer(&delegate); | 5226 CreateNoScaleDrawableContentLayer(layer_settings(), &delegate); |
| 5210 SetLayerPropertiesForTesting(surface_scale_child_no_scale.get(), | 5227 SetLayerPropertiesForTesting(surface_scale_child_no_scale.get(), |
| 5211 child_scale_matrix, | 5228 child_scale_matrix, |
| 5212 gfx::Point3F(), | 5229 gfx::Point3F(), |
| 5213 gfx::PointF(), | 5230 gfx::PointF(), |
| 5214 gfx::Size(10, 10), | 5231 gfx::Size(10, 10), |
| 5215 false, | 5232 false, |
| 5216 true); | 5233 true); |
| 5217 | 5234 |
| 5218 scoped_refptr<NoScaleContentLayer> surface_no_scale = | 5235 scoped_refptr<NoScaleContentLayer> surface_no_scale = |
| 5219 CreateNoScaleDrawableContentLayer(&delegate); | 5236 CreateNoScaleDrawableContentLayer(layer_settings(), &delegate); |
| 5220 SetLayerPropertiesForTesting(surface_no_scale.get(), | 5237 SetLayerPropertiesForTesting(surface_no_scale.get(), |
| 5221 child_scale_matrix, | 5238 child_scale_matrix, |
| 5222 gfx::Point3F(), | 5239 gfx::Point3F(), |
| 5223 gfx::PointF(12.f, 12.f), | 5240 gfx::PointF(12.f, 12.f), |
| 5224 gfx::Size(10, 10), | 5241 gfx::Size(10, 10), |
| 5225 false, | 5242 false, |
| 5226 true); | 5243 true); |
| 5227 | 5244 |
| 5228 scoped_refptr<ContentLayer> surface_no_scale_child_scale = | 5245 scoped_refptr<ContentLayer> surface_no_scale_child_scale = |
| 5229 CreateDrawableContentLayer(&delegate); | 5246 CreateDrawableContentLayer(layer_settings(), &delegate); |
| 5230 SetLayerPropertiesForTesting(surface_no_scale_child_scale.get(), | 5247 SetLayerPropertiesForTesting(surface_no_scale_child_scale.get(), |
| 5231 child_scale_matrix, | 5248 child_scale_matrix, |
| 5232 gfx::Point3F(), | 5249 gfx::Point3F(), |
| 5233 gfx::PointF(), | 5250 gfx::PointF(), |
| 5234 gfx::Size(10, 10), | 5251 gfx::Size(10, 10), |
| 5235 false, | 5252 false, |
| 5236 true); | 5253 true); |
| 5237 | 5254 |
| 5238 scoped_refptr<NoScaleContentLayer> surface_no_scale_child_no_scale = | 5255 scoped_refptr<NoScaleContentLayer> surface_no_scale_child_no_scale = |
| 5239 CreateNoScaleDrawableContentLayer(&delegate); | 5256 CreateNoScaleDrawableContentLayer(layer_settings(), &delegate); |
| 5240 SetLayerPropertiesForTesting(surface_no_scale_child_no_scale.get(), | 5257 SetLayerPropertiesForTesting(surface_no_scale_child_no_scale.get(), |
| 5241 child_scale_matrix, | 5258 child_scale_matrix, |
| 5242 gfx::Point3F(), | 5259 gfx::Point3F(), |
| 5243 gfx::PointF(), | 5260 gfx::PointF(), |
| 5244 gfx::Size(10, 10), | 5261 gfx::Size(10, 10), |
| 5245 false, | 5262 false, |
| 5246 true); | 5263 true); |
| 5247 | 5264 |
| 5248 root->AddChild(parent); | 5265 root->AddChild(parent); |
| 5249 | 5266 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5375 gfx::Transform identity_matrix; | 5392 gfx::Transform identity_matrix; |
| 5376 | 5393 |
| 5377 gfx::Transform parent_scale_matrix; | 5394 gfx::Transform parent_scale_matrix; |
| 5378 SkMScalar initial_parent_scale = 1.75; | 5395 SkMScalar initial_parent_scale = 1.75; |
| 5379 parent_scale_matrix.Scale(initial_parent_scale, initial_parent_scale); | 5396 parent_scale_matrix.Scale(initial_parent_scale, initial_parent_scale); |
| 5380 | 5397 |
| 5381 gfx::Transform child_scale_matrix; | 5398 gfx::Transform child_scale_matrix; |
| 5382 SkMScalar initial_child_scale = 1.25; | 5399 SkMScalar initial_child_scale = 1.25; |
| 5383 child_scale_matrix.Scale(initial_child_scale, initial_child_scale); | 5400 child_scale_matrix.Scale(initial_child_scale, initial_child_scale); |
| 5384 | 5401 |
| 5385 scoped_refptr<Layer> root = Layer::Create(); | 5402 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 5386 root->SetBounds(gfx::Size(100, 100)); | 5403 root->SetBounds(gfx::Size(100, 100)); |
| 5387 | 5404 |
| 5388 scoped_refptr<FakePictureLayer> parent = | 5405 scoped_refptr<FakePictureLayer> parent = |
| 5389 CreateDrawablePictureLayer(&delegate); | 5406 CreateDrawablePictureLayer(layer_settings(), &delegate); |
| 5390 SetLayerPropertiesForTesting(parent.get(), | 5407 SetLayerPropertiesForTesting(parent.get(), |
| 5391 parent_scale_matrix, | 5408 parent_scale_matrix, |
| 5392 gfx::Point3F(), | 5409 gfx::Point3F(), |
| 5393 gfx::PointF(), | 5410 gfx::PointF(), |
| 5394 gfx::Size(100, 100), | 5411 gfx::Size(100, 100), |
| 5395 false, | 5412 false, |
| 5396 true); | 5413 true); |
| 5397 | 5414 |
| 5398 scoped_refptr<FakePictureLayer> child_scale = | 5415 scoped_refptr<FakePictureLayer> child_scale = |
| 5399 CreateDrawablePictureLayer(&delegate); | 5416 CreateDrawablePictureLayer(layer_settings(), &delegate); |
| 5400 SetLayerPropertiesForTesting(child_scale.get(), | 5417 SetLayerPropertiesForTesting(child_scale.get(), |
| 5401 child_scale_matrix, | 5418 child_scale_matrix, |
| 5402 gfx::Point3F(), | 5419 gfx::Point3F(), |
| 5403 gfx::PointF(2.f, 2.f), | 5420 gfx::PointF(2.f, 2.f), |
| 5404 gfx::Size(10, 10), | 5421 gfx::Size(10, 10), |
| 5405 false, | 5422 false, |
| 5406 true); | 5423 true); |
| 5407 | 5424 |
| 5408 root->AddChild(parent); | 5425 root->AddChild(parent); |
| 5409 | 5426 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 5424 // they are static. | 5441 // they are static. |
| 5425 EXPECT_IDEAL_SCALE_EQ(initial_child_scale * initial_parent_scale, | 5442 EXPECT_IDEAL_SCALE_EQ(initial_child_scale * initial_parent_scale, |
| 5426 child_scale); | 5443 child_scale); |
| 5427 } | 5444 } |
| 5428 } | 5445 } |
| 5429 | 5446 |
| 5430 // TODO(sohanjg): Remove this test when ContentLayer is removed. | 5447 // TODO(sohanjg): Remove this test when ContentLayer is removed. |
| 5431 TEST_F(LayerTreeHostCommonTest, | 5448 TEST_F(LayerTreeHostCommonTest, |
| 5432 ChangeInContentBoundsOrScaleTriggersPushProperties) { | 5449 ChangeInContentBoundsOrScaleTriggersPushProperties) { |
| 5433 MockContentLayerClient delegate; | 5450 MockContentLayerClient delegate; |
| 5434 scoped_refptr<Layer> root = Layer::Create(); | 5451 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 5435 scoped_refptr<Layer> child = CreateDrawableContentLayer(&delegate); | 5452 scoped_refptr<Layer> child = |
| 5453 CreateDrawableContentLayer(layer_settings(), &delegate); |
| 5436 root->AddChild(child); | 5454 root->AddChild(child); |
| 5437 | 5455 |
| 5438 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 5456 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 5439 host->SetRootLayer(root); | 5457 host->SetRootLayer(root); |
| 5440 | 5458 |
| 5441 gfx::Transform identity_matrix; | 5459 gfx::Transform identity_matrix; |
| 5442 SetLayerPropertiesForTesting(root.get(), | 5460 SetLayerPropertiesForTesting(root.get(), |
| 5443 identity_matrix, | 5461 identity_matrix, |
| 5444 gfx::Point3F(), | 5462 gfx::Point3F(), |
| 5445 gfx::PointF(), | 5463 gfx::PointF(), |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5487 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 5505 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 5488 EXPECT_FALSE(root->needs_push_properties()); | 5506 EXPECT_FALSE(root->needs_push_properties()); |
| 5489 EXPECT_FALSE(child->needs_push_properties()); | 5507 EXPECT_FALSE(child->needs_push_properties()); |
| 5490 } | 5508 } |
| 5491 | 5509 |
| 5492 TEST_F(LayerTreeHostCommonTest, RenderSurfaceTransformsInHighDPI) { | 5510 TEST_F(LayerTreeHostCommonTest, RenderSurfaceTransformsInHighDPI) { |
| 5493 MockContentLayerClient delegate; | 5511 MockContentLayerClient delegate; |
| 5494 gfx::Transform identity_matrix; | 5512 gfx::Transform identity_matrix; |
| 5495 | 5513 |
| 5496 scoped_refptr<FakePictureLayer> parent = | 5514 scoped_refptr<FakePictureLayer> parent = |
| 5497 CreateDrawablePictureLayer(&delegate); | 5515 CreateDrawablePictureLayer(layer_settings(), &delegate); |
| 5498 SetLayerPropertiesForTesting(parent.get(), | 5516 SetLayerPropertiesForTesting(parent.get(), |
| 5499 identity_matrix, | 5517 identity_matrix, |
| 5500 gfx::Point3F(), | 5518 gfx::Point3F(), |
| 5501 gfx::PointF(), | 5519 gfx::PointF(), |
| 5502 gfx::Size(30, 30), | 5520 gfx::Size(30, 30), |
| 5503 false, | 5521 false, |
| 5504 true); | 5522 true); |
| 5505 | 5523 |
| 5506 scoped_refptr<FakePictureLayer> child = CreateDrawablePictureLayer(&delegate); | 5524 scoped_refptr<FakePictureLayer> child = |
| 5525 CreateDrawablePictureLayer(layer_settings(), &delegate); |
| 5507 SetLayerPropertiesForTesting(child.get(), | 5526 SetLayerPropertiesForTesting(child.get(), |
| 5508 identity_matrix, | 5527 identity_matrix, |
| 5509 gfx::Point3F(), | 5528 gfx::Point3F(), |
| 5510 gfx::PointF(2.f, 2.f), | 5529 gfx::PointF(2.f, 2.f), |
| 5511 gfx::Size(10, 10), | 5530 gfx::Size(10, 10), |
| 5512 false, | 5531 false, |
| 5513 true); | 5532 true); |
| 5514 | 5533 |
| 5515 gfx::Transform replica_transform; | 5534 gfx::Transform replica_transform; |
| 5516 replica_transform.Scale(1.0, -1.0); | 5535 replica_transform.Scale(1.0, -1.0); |
| 5517 scoped_refptr<FakePictureLayer> replica = | 5536 scoped_refptr<FakePictureLayer> replica = |
| 5518 CreateDrawablePictureLayer(&delegate); | 5537 CreateDrawablePictureLayer(layer_settings(), &delegate); |
| 5519 SetLayerPropertiesForTesting(replica.get(), | 5538 SetLayerPropertiesForTesting(replica.get(), |
| 5520 replica_transform, | 5539 replica_transform, |
| 5521 gfx::Point3F(), | 5540 gfx::Point3F(), |
| 5522 gfx::PointF(2.f, 2.f), | 5541 gfx::PointF(2.f, 2.f), |
| 5523 gfx::Size(10, 10), | 5542 gfx::Size(10, 10), |
| 5524 false, | 5543 false, |
| 5525 true); | 5544 true); |
| 5526 | 5545 |
| 5527 // This layer should end up in the same surface as child, with the same draw | 5546 // This layer should end up in the same surface as child, with the same draw |
| 5528 // and screen space transforms. | 5547 // and screen space transforms. |
| 5529 scoped_refptr<FakePictureLayer> duplicate_child_non_owner = | 5548 scoped_refptr<FakePictureLayer> duplicate_child_non_owner = |
| 5530 CreateDrawablePictureLayer(&delegate); | 5549 CreateDrawablePictureLayer(layer_settings(), &delegate); |
| 5531 SetLayerPropertiesForTesting(duplicate_child_non_owner.get(), | 5550 SetLayerPropertiesForTesting(duplicate_child_non_owner.get(), |
| 5532 identity_matrix, | 5551 identity_matrix, |
| 5533 gfx::Point3F(), | 5552 gfx::Point3F(), |
| 5534 gfx::PointF(), | 5553 gfx::PointF(), |
| 5535 gfx::Size(10, 10), | 5554 gfx::Size(10, 10), |
| 5536 false, | 5555 false, |
| 5537 true); | 5556 true); |
| 5538 | 5557 |
| 5539 parent->AddChild(child); | 5558 parent->AddChild(child); |
| 5540 child->AddChild(duplicate_child_non_owner); | 5559 child->AddChild(duplicate_child_non_owner); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5627 expected_replica_screen_space_transform, | 5646 expected_replica_screen_space_transform, |
| 5628 child->render_surface()->replica_screen_space_transform()); | 5647 child->render_surface()->replica_screen_space_transform()); |
| 5629 } | 5648 } |
| 5630 | 5649 |
| 5631 TEST_F(LayerTreeHostCommonTest, | 5650 TEST_F(LayerTreeHostCommonTest, |
| 5632 RenderSurfaceTransformsInHighDPIAccurateScaleZeroPosition) { | 5651 RenderSurfaceTransformsInHighDPIAccurateScaleZeroPosition) { |
| 5633 MockContentLayerClient delegate; | 5652 MockContentLayerClient delegate; |
| 5634 gfx::Transform identity_matrix; | 5653 gfx::Transform identity_matrix; |
| 5635 | 5654 |
| 5636 scoped_refptr<FakePictureLayer> parent = | 5655 scoped_refptr<FakePictureLayer> parent = |
| 5637 CreateDrawablePictureLayer(&delegate); | 5656 CreateDrawablePictureLayer(layer_settings(), &delegate); |
| 5638 SetLayerPropertiesForTesting(parent.get(), | 5657 SetLayerPropertiesForTesting(parent.get(), |
| 5639 identity_matrix, | 5658 identity_matrix, |
| 5640 gfx::Point3F(), | 5659 gfx::Point3F(), |
| 5641 gfx::PointF(), | 5660 gfx::PointF(), |
| 5642 gfx::Size(33, 31), | 5661 gfx::Size(33, 31), |
| 5643 false, | 5662 false, |
| 5644 true); | 5663 true); |
| 5645 | 5664 |
| 5646 scoped_refptr<FakePictureLayer> child = CreateDrawablePictureLayer(&delegate); | 5665 scoped_refptr<FakePictureLayer> child = |
| 5666 CreateDrawablePictureLayer(layer_settings(), &delegate); |
| 5647 SetLayerPropertiesForTesting(child.get(), | 5667 SetLayerPropertiesForTesting(child.get(), |
| 5648 identity_matrix, | 5668 identity_matrix, |
| 5649 gfx::Point3F(), | 5669 gfx::Point3F(), |
| 5650 gfx::PointF(), | 5670 gfx::PointF(), |
| 5651 gfx::Size(13, 11), | 5671 gfx::Size(13, 11), |
| 5652 false, | 5672 false, |
| 5653 true); | 5673 true); |
| 5654 | 5674 |
| 5655 gfx::Transform replica_transform; | 5675 gfx::Transform replica_transform; |
| 5656 replica_transform.Scale(1.0, -1.0); | 5676 replica_transform.Scale(1.0, -1.0); |
| 5657 scoped_refptr<FakePictureLayer> replica = | 5677 scoped_refptr<FakePictureLayer> replica = |
| 5658 CreateDrawablePictureLayer(&delegate); | 5678 CreateDrawablePictureLayer(layer_settings(), &delegate); |
| 5659 SetLayerPropertiesForTesting(replica.get(), | 5679 SetLayerPropertiesForTesting(replica.get(), |
| 5660 replica_transform, | 5680 replica_transform, |
| 5661 gfx::Point3F(), | 5681 gfx::Point3F(), |
| 5662 gfx::PointF(), | 5682 gfx::PointF(), |
| 5663 gfx::Size(13, 11), | 5683 gfx::Size(13, 11), |
| 5664 false, | 5684 false, |
| 5665 true); | 5685 true); |
| 5666 | 5686 |
| 5667 parent->AddChild(child); | 5687 parent->AddChild(child); |
| 5668 child->SetReplicaLayer(replica.get()); | 5688 child->SetReplicaLayer(replica.get()); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 5698 child->render_surface()->replica_draw_transform()); | 5718 child->render_surface()->replica_draw_transform()); |
| 5699 | 5719 |
| 5700 gfx::Transform expected_replica_screen_space_transform; | 5720 gfx::Transform expected_replica_screen_space_transform; |
| 5701 expected_replica_screen_space_transform.matrix().set(1, 1, -1.0); | 5721 expected_replica_screen_space_transform.matrix().set(1, 1, -1.0); |
| 5702 EXPECT_TRANSFORMATION_MATRIX_EQ( | 5722 EXPECT_TRANSFORMATION_MATRIX_EQ( |
| 5703 expected_replica_screen_space_transform, | 5723 expected_replica_screen_space_transform, |
| 5704 child->render_surface()->replica_screen_space_transform()); | 5724 child->render_surface()->replica_screen_space_transform()); |
| 5705 } | 5725 } |
| 5706 | 5726 |
| 5707 TEST_F(LayerTreeHostCommonTest, SubtreeSearch) { | 5727 TEST_F(LayerTreeHostCommonTest, SubtreeSearch) { |
| 5708 scoped_refptr<Layer> root = Layer::Create(); | 5728 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 5709 scoped_refptr<Layer> child = Layer::Create(); | 5729 scoped_refptr<Layer> child = Layer::Create(layer_settings()); |
| 5710 scoped_refptr<Layer> grand_child = Layer::Create(); | 5730 scoped_refptr<Layer> grand_child = Layer::Create(layer_settings()); |
| 5711 scoped_refptr<Layer> mask_layer = Layer::Create(); | 5731 scoped_refptr<Layer> mask_layer = Layer::Create(layer_settings()); |
| 5712 scoped_refptr<Layer> replica_layer = Layer::Create(); | 5732 scoped_refptr<Layer> replica_layer = Layer::Create(layer_settings()); |
| 5713 | 5733 |
| 5714 grand_child->SetReplicaLayer(replica_layer.get()); | 5734 grand_child->SetReplicaLayer(replica_layer.get()); |
| 5715 child->AddChild(grand_child.get()); | 5735 child->AddChild(grand_child.get()); |
| 5716 child->SetMaskLayer(mask_layer.get()); | 5736 child->SetMaskLayer(mask_layer.get()); |
| 5717 root->AddChild(child.get()); | 5737 root->AddChild(child.get()); |
| 5718 | 5738 |
| 5719 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 5739 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 5720 host->SetRootLayer(root); | 5740 host->SetRootLayer(root); |
| 5721 | 5741 |
| 5722 int nonexistent_id = -1; | 5742 int nonexistent_id = -1; |
| 5723 EXPECT_EQ(root.get(), | 5743 EXPECT_EQ(root.get(), |
| 5724 LayerTreeHostCommon::FindLayerInSubtree(root.get(), root->id())); | 5744 LayerTreeHostCommon::FindLayerInSubtree(root.get(), root->id())); |
| 5725 EXPECT_EQ(child.get(), | 5745 EXPECT_EQ(child.get(), |
| 5726 LayerTreeHostCommon::FindLayerInSubtree(root.get(), child->id())); | 5746 LayerTreeHostCommon::FindLayerInSubtree(root.get(), child->id())); |
| 5727 EXPECT_EQ( | 5747 EXPECT_EQ( |
| 5728 grand_child.get(), | 5748 grand_child.get(), |
| 5729 LayerTreeHostCommon::FindLayerInSubtree(root.get(), grand_child->id())); | 5749 LayerTreeHostCommon::FindLayerInSubtree(root.get(), grand_child->id())); |
| 5730 EXPECT_EQ( | 5750 EXPECT_EQ( |
| 5731 mask_layer.get(), | 5751 mask_layer.get(), |
| 5732 LayerTreeHostCommon::FindLayerInSubtree(root.get(), mask_layer->id())); | 5752 LayerTreeHostCommon::FindLayerInSubtree(root.get(), mask_layer->id())); |
| 5733 EXPECT_EQ( | 5753 EXPECT_EQ( |
| 5734 replica_layer.get(), | 5754 replica_layer.get(), |
| 5735 LayerTreeHostCommon::FindLayerInSubtree(root.get(), replica_layer->id())); | 5755 LayerTreeHostCommon::FindLayerInSubtree(root.get(), replica_layer->id())); |
| 5736 EXPECT_EQ( | 5756 EXPECT_EQ( |
| 5737 0, LayerTreeHostCommon::FindLayerInSubtree(root.get(), nonexistent_id)); | 5757 0, LayerTreeHostCommon::FindLayerInSubtree(root.get(), nonexistent_id)); |
| 5738 } | 5758 } |
| 5739 | 5759 |
| 5740 TEST_F(LayerTreeHostCommonTest, TransparentChildRenderSurfaceCreation) { | 5760 TEST_F(LayerTreeHostCommonTest, TransparentChildRenderSurfaceCreation) { |
| 5741 scoped_refptr<Layer> root = Layer::Create(); | 5761 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 5742 scoped_refptr<Layer> child = Layer::Create(); | 5762 scoped_refptr<Layer> child = Layer::Create(layer_settings()); |
| 5743 scoped_refptr<LayerWithForcedDrawsContent> grand_child = | 5763 scoped_refptr<LayerWithForcedDrawsContent> grand_child = |
| 5744 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 5764 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 5745 | 5765 |
| 5746 const gfx::Transform identity_matrix; | 5766 const gfx::Transform identity_matrix; |
| 5747 SetLayerPropertiesForTesting(root.get(), | 5767 SetLayerPropertiesForTesting(root.get(), |
| 5748 identity_matrix, | 5768 identity_matrix, |
| 5749 gfx::Point3F(), | 5769 gfx::Point3F(), |
| 5750 gfx::PointF(), | 5770 gfx::PointF(), |
| 5751 gfx::Size(100, 100), | 5771 gfx::Size(100, 100), |
| 5752 true, | 5772 true, |
| 5753 false); | 5773 false); |
| 5754 SetLayerPropertiesForTesting(child.get(), | 5774 SetLayerPropertiesForTesting(child.get(), |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6005 testing::Bool(), | 6025 testing::Bool(), |
| 6006 testing::Bool())); | 6026 testing::Bool())); |
| 6007 | 6027 |
| 6008 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayer) { | 6028 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayer) { |
| 6009 FakeImplProxy proxy; | 6029 FakeImplProxy proxy; |
| 6010 TestSharedBitmapManager shared_bitmap_manager; | 6030 TestSharedBitmapManager shared_bitmap_manager; |
| 6011 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); | 6031 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); |
| 6012 host_impl.CreatePendingTree(); | 6032 host_impl.CreatePendingTree(); |
| 6013 const gfx::Transform identity_matrix; | 6033 const gfx::Transform identity_matrix; |
| 6014 | 6034 |
| 6015 scoped_refptr<Layer> root = Layer::Create(); | 6035 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 6016 SetLayerPropertiesForTesting(root.get(), | 6036 SetLayerPropertiesForTesting(root.get(), |
| 6017 identity_matrix, | 6037 identity_matrix, |
| 6018 gfx::Point3F(), | 6038 gfx::Point3F(), |
| 6019 gfx::PointF(), | 6039 gfx::PointF(), |
| 6020 gfx::Size(50, 50), | 6040 gfx::Size(50, 50), |
| 6021 true, | 6041 true, |
| 6022 false); | 6042 false); |
| 6023 root->SetIsDrawable(true); | 6043 root->SetIsDrawable(true); |
| 6024 | 6044 |
| 6025 scoped_refptr<Layer> child = Layer::Create(); | 6045 scoped_refptr<Layer> child = Layer::Create(layer_settings()); |
| 6026 SetLayerPropertiesForTesting(child.get(), | 6046 SetLayerPropertiesForTesting(child.get(), |
| 6027 identity_matrix, | 6047 identity_matrix, |
| 6028 gfx::Point3F(), | 6048 gfx::Point3F(), |
| 6029 gfx::PointF(), | 6049 gfx::PointF(), |
| 6030 gfx::Size(40, 40), | 6050 gfx::Size(40, 40), |
| 6031 true, | 6051 true, |
| 6032 false); | 6052 false); |
| 6033 child->SetIsDrawable(true); | 6053 child->SetIsDrawable(true); |
| 6034 | 6054 |
| 6035 scoped_refptr<Layer> grand_child = Layer::Create(); | 6055 scoped_refptr<Layer> grand_child = Layer::Create(layer_settings()); |
| 6036 SetLayerPropertiesForTesting(grand_child.get(), | 6056 SetLayerPropertiesForTesting(grand_child.get(), |
| 6037 identity_matrix, | 6057 identity_matrix, |
| 6038 gfx::Point3F(), | 6058 gfx::Point3F(), |
| 6039 gfx::PointF(), | 6059 gfx::PointF(), |
| 6040 gfx::Size(30, 30), | 6060 gfx::Size(30, 30), |
| 6041 true, | 6061 true, |
| 6042 false); | 6062 false); |
| 6043 grand_child->SetIsDrawable(true); | 6063 grand_child->SetIsDrawable(true); |
| 6044 grand_child->SetHideLayerAndSubtree(true); | 6064 grand_child->SetHideLayerAndSubtree(true); |
| 6045 | 6065 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6108 EXPECT_EQ(2, root->render_surface()->layer_list().at(1)->id()); | 6128 EXPECT_EQ(2, root->render_surface()->layer_list().at(1)->id()); |
| 6109 } | 6129 } |
| 6110 | 6130 |
| 6111 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayers) { | 6131 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayers) { |
| 6112 FakeImplProxy proxy; | 6132 FakeImplProxy proxy; |
| 6113 TestSharedBitmapManager shared_bitmap_manager; | 6133 TestSharedBitmapManager shared_bitmap_manager; |
| 6114 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); | 6134 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); |
| 6115 host_impl.CreatePendingTree(); | 6135 host_impl.CreatePendingTree(); |
| 6116 const gfx::Transform identity_matrix; | 6136 const gfx::Transform identity_matrix; |
| 6117 | 6137 |
| 6118 scoped_refptr<Layer> root = Layer::Create(); | 6138 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 6119 SetLayerPropertiesForTesting(root.get(), | 6139 SetLayerPropertiesForTesting(root.get(), |
| 6120 identity_matrix, | 6140 identity_matrix, |
| 6121 gfx::Point3F(), | 6141 gfx::Point3F(), |
| 6122 gfx::PointF(), | 6142 gfx::PointF(), |
| 6123 gfx::Size(50, 50), | 6143 gfx::Size(50, 50), |
| 6124 true, | 6144 true, |
| 6125 false); | 6145 false); |
| 6126 root->SetIsDrawable(true); | 6146 root->SetIsDrawable(true); |
| 6127 | 6147 |
| 6128 scoped_refptr<Layer> child = Layer::Create(); | 6148 scoped_refptr<Layer> child = Layer::Create(layer_settings()); |
| 6129 SetLayerPropertiesForTesting(child.get(), | 6149 SetLayerPropertiesForTesting(child.get(), |
| 6130 identity_matrix, | 6150 identity_matrix, |
| 6131 gfx::Point3F(), | 6151 gfx::Point3F(), |
| 6132 gfx::PointF(), | 6152 gfx::PointF(), |
| 6133 gfx::Size(40, 40), | 6153 gfx::Size(40, 40), |
| 6134 true, | 6154 true, |
| 6135 false); | 6155 false); |
| 6136 child->SetIsDrawable(true); | 6156 child->SetIsDrawable(true); |
| 6137 child->SetHideLayerAndSubtree(true); | 6157 child->SetHideLayerAndSubtree(true); |
| 6138 | 6158 |
| 6139 scoped_refptr<Layer> grand_child = Layer::Create(); | 6159 scoped_refptr<Layer> grand_child = Layer::Create(layer_settings()); |
| 6140 SetLayerPropertiesForTesting(grand_child.get(), | 6160 SetLayerPropertiesForTesting(grand_child.get(), |
| 6141 identity_matrix, | 6161 identity_matrix, |
| 6142 gfx::Point3F(), | 6162 gfx::Point3F(), |
| 6143 gfx::PointF(), | 6163 gfx::PointF(), |
| 6144 gfx::Size(30, 30), | 6164 gfx::Size(30, 30), |
| 6145 true, | 6165 true, |
| 6146 false); | 6166 false); |
| 6147 grand_child->SetIsDrawable(true); | 6167 grand_child->SetIsDrawable(true); |
| 6148 | 6168 |
| 6149 child->AddChild(grand_child); | 6169 child->AddChild(grand_child); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6210 | 6230 |
| 6211 void EmptyCopyOutputCallback(scoped_ptr<CopyOutputResult> result) {} | 6231 void EmptyCopyOutputCallback(scoped_ptr<CopyOutputResult> result) {} |
| 6212 | 6232 |
| 6213 TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) { | 6233 TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) { |
| 6214 FakeImplProxy proxy; | 6234 FakeImplProxy proxy; |
| 6215 TestSharedBitmapManager shared_bitmap_manager; | 6235 TestSharedBitmapManager shared_bitmap_manager; |
| 6216 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); | 6236 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); |
| 6217 host_impl.CreatePendingTree(); | 6237 host_impl.CreatePendingTree(); |
| 6218 const gfx::Transform identity_matrix; | 6238 const gfx::Transform identity_matrix; |
| 6219 | 6239 |
| 6220 scoped_refptr<Layer> root = Layer::Create(); | 6240 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 6221 SetLayerPropertiesForTesting(root.get(), | 6241 SetLayerPropertiesForTesting(root.get(), |
| 6222 identity_matrix, | 6242 identity_matrix, |
| 6223 gfx::Point3F(), | 6243 gfx::Point3F(), |
| 6224 gfx::PointF(), | 6244 gfx::PointF(), |
| 6225 gfx::Size(50, 50), | 6245 gfx::Size(50, 50), |
| 6226 true, | 6246 true, |
| 6227 false); | 6247 false); |
| 6228 root->SetIsDrawable(true); | 6248 root->SetIsDrawable(true); |
| 6229 | 6249 |
| 6230 scoped_refptr<Layer> copy_grand_parent = Layer::Create(); | 6250 scoped_refptr<Layer> copy_grand_parent = Layer::Create(layer_settings()); |
| 6231 SetLayerPropertiesForTesting(copy_grand_parent.get(), | 6251 SetLayerPropertiesForTesting(copy_grand_parent.get(), |
| 6232 identity_matrix, | 6252 identity_matrix, |
| 6233 gfx::Point3F(), | 6253 gfx::Point3F(), |
| 6234 gfx::PointF(), | 6254 gfx::PointF(), |
| 6235 gfx::Size(40, 40), | 6255 gfx::Size(40, 40), |
| 6236 true, | 6256 true, |
| 6237 false); | 6257 false); |
| 6238 copy_grand_parent->SetIsDrawable(true); | 6258 copy_grand_parent->SetIsDrawable(true); |
| 6239 | 6259 |
| 6240 scoped_refptr<Layer> copy_parent = Layer::Create(); | 6260 scoped_refptr<Layer> copy_parent = Layer::Create(layer_settings()); |
| 6241 SetLayerPropertiesForTesting(copy_parent.get(), | 6261 SetLayerPropertiesForTesting(copy_parent.get(), |
| 6242 identity_matrix, | 6262 identity_matrix, |
| 6243 gfx::Point3F(), | 6263 gfx::Point3F(), |
| 6244 gfx::PointF(), | 6264 gfx::PointF(), |
| 6245 gfx::Size(30, 30), | 6265 gfx::Size(30, 30), |
| 6246 true, | 6266 true, |
| 6247 false); | 6267 false); |
| 6248 copy_parent->SetIsDrawable(true); | 6268 copy_parent->SetIsDrawable(true); |
| 6249 copy_parent->SetForceRenderSurface(true); | 6269 copy_parent->SetForceRenderSurface(true); |
| 6250 | 6270 |
| 6251 scoped_refptr<Layer> copy_layer = Layer::Create(); | 6271 scoped_refptr<Layer> copy_layer = Layer::Create(layer_settings()); |
| 6252 SetLayerPropertiesForTesting(copy_layer.get(), | 6272 SetLayerPropertiesForTesting(copy_layer.get(), |
| 6253 identity_matrix, | 6273 identity_matrix, |
| 6254 gfx::Point3F(), | 6274 gfx::Point3F(), |
| 6255 gfx::PointF(), | 6275 gfx::PointF(), |
| 6256 gfx::Size(20, 20), | 6276 gfx::Size(20, 20), |
| 6257 true, | 6277 true, |
| 6258 false); | 6278 false); |
| 6259 copy_layer->SetIsDrawable(true); | 6279 copy_layer->SetIsDrawable(true); |
| 6260 | 6280 |
| 6261 scoped_refptr<Layer> copy_child = Layer::Create(); | 6281 scoped_refptr<Layer> copy_child = Layer::Create(layer_settings()); |
| 6262 SetLayerPropertiesForTesting(copy_child.get(), | 6282 SetLayerPropertiesForTesting(copy_child.get(), |
| 6263 identity_matrix, | 6283 identity_matrix, |
| 6264 gfx::Point3F(), | 6284 gfx::Point3F(), |
| 6265 gfx::PointF(), | 6285 gfx::PointF(), |
| 6266 gfx::Size(20, 20), | 6286 gfx::Size(20, 20), |
| 6267 true, | 6287 true, |
| 6268 false); | 6288 false); |
| 6269 copy_child->SetIsDrawable(true); | 6289 copy_child->SetIsDrawable(true); |
| 6270 | 6290 |
| 6271 scoped_refptr<Layer> copy_grand_parent_sibling_before = Layer::Create(); | 6291 scoped_refptr<Layer> copy_grand_parent_sibling_before = |
| 6292 Layer::Create(layer_settings()); |
| 6272 SetLayerPropertiesForTesting(copy_grand_parent_sibling_before.get(), | 6293 SetLayerPropertiesForTesting(copy_grand_parent_sibling_before.get(), |
| 6273 identity_matrix, | 6294 identity_matrix, |
| 6274 gfx::Point3F(), | 6295 gfx::Point3F(), |
| 6275 gfx::PointF(), | 6296 gfx::PointF(), |
| 6276 gfx::Size(40, 40), | 6297 gfx::Size(40, 40), |
| 6277 true, | 6298 true, |
| 6278 false); | 6299 false); |
| 6279 copy_grand_parent_sibling_before->SetIsDrawable(true); | 6300 copy_grand_parent_sibling_before->SetIsDrawable(true); |
| 6280 | 6301 |
| 6281 scoped_refptr<Layer> copy_grand_parent_sibling_after = Layer::Create(); | 6302 scoped_refptr<Layer> copy_grand_parent_sibling_after = |
| 6303 Layer::Create(layer_settings()); |
| 6282 SetLayerPropertiesForTesting(copy_grand_parent_sibling_after.get(), | 6304 SetLayerPropertiesForTesting(copy_grand_parent_sibling_after.get(), |
| 6283 identity_matrix, | 6305 identity_matrix, |
| 6284 gfx::Point3F(), | 6306 gfx::Point3F(), |
| 6285 gfx::PointF(), | 6307 gfx::PointF(), |
| 6286 gfx::Size(40, 40), | 6308 gfx::Size(40, 40), |
| 6287 true, | 6309 true, |
| 6288 false); | 6310 false); |
| 6289 copy_grand_parent_sibling_after->SetIsDrawable(true); | 6311 copy_grand_parent_sibling_after->SetIsDrawable(true); |
| 6290 | 6312 |
| 6291 copy_layer->AddChild(copy_child); | 6313 copy_layer->AddChild(copy_child); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6357 copy_layer->render_surface()->layer_list().at(1)->id()); | 6379 copy_layer->render_surface()->layer_list().at(1)->id()); |
| 6358 } | 6380 } |
| 6359 | 6381 |
| 6360 TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) { | 6382 TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) { |
| 6361 FakeImplProxy proxy; | 6383 FakeImplProxy proxy; |
| 6362 TestSharedBitmapManager shared_bitmap_manager; | 6384 TestSharedBitmapManager shared_bitmap_manager; |
| 6363 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); | 6385 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); |
| 6364 host_impl.CreatePendingTree(); | 6386 host_impl.CreatePendingTree(); |
| 6365 const gfx::Transform identity_matrix; | 6387 const gfx::Transform identity_matrix; |
| 6366 | 6388 |
| 6367 scoped_refptr<Layer> root = Layer::Create(); | 6389 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 6368 SetLayerPropertiesForTesting(root.get(), | 6390 SetLayerPropertiesForTesting(root.get(), |
| 6369 identity_matrix, | 6391 identity_matrix, |
| 6370 gfx::Point3F(), | 6392 gfx::Point3F(), |
| 6371 gfx::PointF(), | 6393 gfx::PointF(), |
| 6372 gfx::Size(50, 50), | 6394 gfx::Size(50, 50), |
| 6373 true, | 6395 true, |
| 6374 false); | 6396 false); |
| 6375 root->SetIsDrawable(true); | 6397 root->SetIsDrawable(true); |
| 6376 | 6398 |
| 6377 scoped_refptr<Layer> copy_parent = Layer::Create(); | 6399 scoped_refptr<Layer> copy_parent = Layer::Create(layer_settings()); |
| 6378 SetLayerPropertiesForTesting(copy_parent.get(), | 6400 SetLayerPropertiesForTesting(copy_parent.get(), |
| 6379 identity_matrix, | 6401 identity_matrix, |
| 6380 gfx::Point3F(), | 6402 gfx::Point3F(), |
| 6381 gfx::PointF(), | 6403 gfx::PointF(), |
| 6382 gfx::Size(), | 6404 gfx::Size(), |
| 6383 true, | 6405 true, |
| 6384 false); | 6406 false); |
| 6385 copy_parent->SetIsDrawable(true); | 6407 copy_parent->SetIsDrawable(true); |
| 6386 copy_parent->SetMasksToBounds(true); | 6408 copy_parent->SetMasksToBounds(true); |
| 6387 | 6409 |
| 6388 scoped_refptr<Layer> copy_layer = Layer::Create(); | 6410 scoped_refptr<Layer> copy_layer = Layer::Create(layer_settings()); |
| 6389 SetLayerPropertiesForTesting(copy_layer.get(), | 6411 SetLayerPropertiesForTesting(copy_layer.get(), |
| 6390 identity_matrix, | 6412 identity_matrix, |
| 6391 gfx::Point3F(), | 6413 gfx::Point3F(), |
| 6392 gfx::PointF(), | 6414 gfx::PointF(), |
| 6393 gfx::Size(30, 30), | 6415 gfx::Size(30, 30), |
| 6394 true, | 6416 true, |
| 6395 false); | 6417 false); |
| 6396 copy_layer->SetIsDrawable(true); | 6418 copy_layer->SetIsDrawable(true); |
| 6397 | 6419 |
| 6398 scoped_refptr<Layer> copy_child = Layer::Create(); | 6420 scoped_refptr<Layer> copy_child = Layer::Create(layer_settings()); |
| 6399 SetLayerPropertiesForTesting(copy_child.get(), | 6421 SetLayerPropertiesForTesting(copy_child.get(), |
| 6400 identity_matrix, | 6422 identity_matrix, |
| 6401 gfx::Point3F(), | 6423 gfx::Point3F(), |
| 6402 gfx::PointF(), | 6424 gfx::PointF(), |
| 6403 gfx::Size(20, 20), | 6425 gfx::Size(20, 20), |
| 6404 true, | 6426 true, |
| 6405 false); | 6427 false); |
| 6406 copy_child->SetIsDrawable(true); | 6428 copy_child->SetIsDrawable(true); |
| 6407 | 6429 |
| 6408 copy_layer->AddChild(copy_child); | 6430 copy_layer->AddChild(copy_child); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 6432 EXPECT_EQ(root->id(), root->render_surface()->layer_list().at(0)->id()); | 6454 EXPECT_EQ(root->id(), root->render_surface()->layer_list().at(0)->id()); |
| 6433 } | 6455 } |
| 6434 | 6456 |
| 6435 TEST_F(LayerTreeHostCommonTest, VisibleContentRectInsideSurface) { | 6457 TEST_F(LayerTreeHostCommonTest, VisibleContentRectInsideSurface) { |
| 6436 FakeImplProxy proxy; | 6458 FakeImplProxy proxy; |
| 6437 TestSharedBitmapManager shared_bitmap_manager; | 6459 TestSharedBitmapManager shared_bitmap_manager; |
| 6438 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); | 6460 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); |
| 6439 host_impl.CreatePendingTree(); | 6461 host_impl.CreatePendingTree(); |
| 6440 const gfx::Transform identity_matrix; | 6462 const gfx::Transform identity_matrix; |
| 6441 | 6463 |
| 6442 scoped_refptr<Layer> root = Layer::Create(); | 6464 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 6443 SetLayerPropertiesForTesting(root.get(), | 6465 SetLayerPropertiesForTesting(root.get(), |
| 6444 identity_matrix, | 6466 identity_matrix, |
| 6445 gfx::Point3F(), | 6467 gfx::Point3F(), |
| 6446 gfx::PointF(), | 6468 gfx::PointF(), |
| 6447 gfx::Size(50, 50), | 6469 gfx::Size(50, 50), |
| 6448 true, | 6470 true, |
| 6449 false); | 6471 false); |
| 6450 root->SetIsDrawable(true); | 6472 root->SetIsDrawable(true); |
| 6451 | 6473 |
| 6452 // The surface is moved slightly outside of the viewport. | 6474 // The surface is moved slightly outside of the viewport. |
| 6453 scoped_refptr<Layer> surface = Layer::Create(); | 6475 scoped_refptr<Layer> surface = Layer::Create(layer_settings()); |
| 6454 SetLayerPropertiesForTesting(surface.get(), | 6476 SetLayerPropertiesForTesting(surface.get(), |
| 6455 identity_matrix, | 6477 identity_matrix, |
| 6456 gfx::Point3F(), | 6478 gfx::Point3F(), |
| 6457 gfx::PointF(-10, -20), | 6479 gfx::PointF(-10, -20), |
| 6458 gfx::Size(), | 6480 gfx::Size(), |
| 6459 true, | 6481 true, |
| 6460 false); | 6482 false); |
| 6461 surface->SetForceRenderSurface(true); | 6483 surface->SetForceRenderSurface(true); |
| 6462 | 6484 |
| 6463 scoped_refptr<Layer> surface_child = Layer::Create(); | 6485 scoped_refptr<Layer> surface_child = Layer::Create(layer_settings()); |
| 6464 SetLayerPropertiesForTesting(surface_child.get(), | 6486 SetLayerPropertiesForTesting(surface_child.get(), |
| 6465 identity_matrix, | 6487 identity_matrix, |
| 6466 gfx::Point3F(), | 6488 gfx::Point3F(), |
| 6467 gfx::PointF(), | 6489 gfx::PointF(), |
| 6468 gfx::Size(50, 50), | 6490 gfx::Size(50, 50), |
| 6469 true, | 6491 true, |
| 6470 false); | 6492 false); |
| 6471 surface_child->SetIsDrawable(true); | 6493 surface_child->SetIsDrawable(true); |
| 6472 | 6494 |
| 6473 surface->AddChild(surface_child); | 6495 surface->AddChild(surface_child); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 6493 // problem. Constructs the following layer tree. | 6515 // problem. Constructs the following layer tree. |
| 6494 // | 6516 // |
| 6495 // root (a render surface) | 6517 // root (a render surface) |
| 6496 // + render_surface | 6518 // + render_surface |
| 6497 // + clip_parent (scaled) | 6519 // + clip_parent (scaled) |
| 6498 // + intervening_clipping_layer | 6520 // + intervening_clipping_layer |
| 6499 // + clip_child | 6521 // + clip_child |
| 6500 // | 6522 // |
| 6501 // The render surface should be resized correctly and the clip child should | 6523 // The render surface should be resized correctly and the clip child should |
| 6502 // inherit the right clip rect. | 6524 // inherit the right clip rect. |
| 6503 scoped_refptr<Layer> root = Layer::Create(); | 6525 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 6504 scoped_refptr<Layer> render_surface = Layer::Create(); | 6526 scoped_refptr<Layer> render_surface = Layer::Create(layer_settings()); |
| 6505 scoped_refptr<Layer> clip_parent = Layer::Create(); | 6527 scoped_refptr<Layer> clip_parent = Layer::Create(layer_settings()); |
| 6506 scoped_refptr<Layer> intervening = Layer::Create(); | 6528 scoped_refptr<Layer> intervening = Layer::Create(layer_settings()); |
| 6507 scoped_refptr<LayerWithForcedDrawsContent> clip_child = | 6529 scoped_refptr<LayerWithForcedDrawsContent> clip_child = |
| 6508 make_scoped_refptr(new LayerWithForcedDrawsContent); | 6530 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 6509 | 6531 |
| 6510 root->AddChild(render_surface); | 6532 root->AddChild(render_surface); |
| 6511 render_surface->AddChild(clip_parent); | 6533 render_surface->AddChild(clip_parent); |
| 6512 clip_parent->AddChild(intervening); | 6534 clip_parent->AddChild(intervening); |
| 6513 intervening->AddChild(clip_child); | 6535 intervening->AddChild(clip_child); |
| 6514 | 6536 |
| 6515 clip_child->SetClipParent(clip_parent.get()); | 6537 clip_child->SetClipParent(clip_parent.get()); |
| 6516 | 6538 |
| 6517 intervening->SetMasksToBounds(true); | 6539 intervening->SetMasksToBounds(true); |
| 6518 clip_parent->SetMasksToBounds(true); | 6540 clip_parent->SetMasksToBounds(true); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6595 // case. In the following tree, both render surfaces should be resized to | 6617 // case. In the following tree, both render surfaces should be resized to |
| 6596 // accomodate for the clip child, despite an intervening clip. | 6618 // accomodate for the clip child, despite an intervening clip. |
| 6597 // | 6619 // |
| 6598 // root (a render surface) | 6620 // root (a render surface) |
| 6599 // + clip_parent (masks to bounds) | 6621 // + clip_parent (masks to bounds) |
| 6600 // + render_surface1 (sets opacity) | 6622 // + render_surface1 (sets opacity) |
| 6601 // + intervening (masks to bounds) | 6623 // + intervening (masks to bounds) |
| 6602 // + render_surface2 (also sets opacity) | 6624 // + render_surface2 (also sets opacity) |
| 6603 // + clip_child | 6625 // + clip_child |
| 6604 // | 6626 // |
| 6605 scoped_refptr<Layer> root = Layer::Create(); | 6627 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 6606 scoped_refptr<Layer> clip_parent = Layer::Create(); | 6628 scoped_refptr<Layer> clip_parent = Layer::Create(layer_settings()); |
| 6607 scoped_refptr<Layer> render_surface1 = Layer::Create(); | 6629 scoped_refptr<Layer> render_surface1 = Layer::Create(layer_settings()); |
| 6608 scoped_refptr<Layer> intervening = Layer::Create(); | 6630 scoped_refptr<Layer> intervening = Layer::Create(layer_settings()); |
| 6609 scoped_refptr<Layer> render_surface2 = Layer::Create(); | 6631 scoped_refptr<Layer> render_surface2 = Layer::Create(layer_settings()); |
| 6610 scoped_refptr<LayerWithForcedDrawsContent> clip_child = | 6632 scoped_refptr<LayerWithForcedDrawsContent> clip_child = |
| 6611 make_scoped_refptr(new LayerWithForcedDrawsContent); | 6633 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 6612 | 6634 |
| 6613 root->AddChild(clip_parent); | 6635 root->AddChild(clip_parent); |
| 6614 clip_parent->AddChild(render_surface1); | 6636 clip_parent->AddChild(render_surface1); |
| 6615 render_surface1->AddChild(intervening); | 6637 render_surface1->AddChild(intervening); |
| 6616 intervening->AddChild(render_surface2); | 6638 intervening->AddChild(render_surface2); |
| 6617 render_surface2->AddChild(clip_child); | 6639 render_surface2->AddChild(clip_child); |
| 6618 | 6640 |
| 6619 clip_child->SetClipParent(clip_parent.get()); | 6641 clip_child->SetClipParent(clip_parent.get()); |
| 6620 | 6642 |
| 6621 intervening->SetMasksToBounds(true); | 6643 intervening->SetMasksToBounds(true); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6722 // is a scroll involved. Note, we do _not_ have to consider any other sort | 6744 // is a scroll involved. Note, we do _not_ have to consider any other sort |
| 6723 // of transform. | 6745 // of transform. |
| 6724 // | 6746 // |
| 6725 // root (a render surface) | 6747 // root (a render surface) |
| 6726 // + clip_parent (masks to bounds) | 6748 // + clip_parent (masks to bounds) |
| 6727 // + render_surface1 (sets opacity) | 6749 // + render_surface1 (sets opacity) |
| 6728 // + intervening (masks to bounds AND scrolls) | 6750 // + intervening (masks to bounds AND scrolls) |
| 6729 // + render_surface2 (also sets opacity) | 6751 // + render_surface2 (also sets opacity) |
| 6730 // + clip_child | 6752 // + clip_child |
| 6731 // | 6753 // |
| 6732 scoped_refptr<Layer> root = Layer::Create(); | 6754 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 6733 scoped_refptr<Layer> clip_parent = Layer::Create(); | 6755 scoped_refptr<Layer> clip_parent = Layer::Create(layer_settings()); |
| 6734 scoped_refptr<Layer> render_surface1 = Layer::Create(); | 6756 scoped_refptr<Layer> render_surface1 = Layer::Create(layer_settings()); |
| 6735 scoped_refptr<Layer> intervening = Layer::Create(); | 6757 scoped_refptr<Layer> intervening = Layer::Create(layer_settings()); |
| 6736 scoped_refptr<Layer> render_surface2 = Layer::Create(); | 6758 scoped_refptr<Layer> render_surface2 = Layer::Create(layer_settings()); |
| 6737 scoped_refptr<LayerWithForcedDrawsContent> clip_child = | 6759 scoped_refptr<LayerWithForcedDrawsContent> clip_child = |
| 6738 make_scoped_refptr(new LayerWithForcedDrawsContent); | 6760 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 6739 | 6761 |
| 6740 root->AddChild(clip_parent); | 6762 root->AddChild(clip_parent); |
| 6741 clip_parent->AddChild(render_surface1); | 6763 clip_parent->AddChild(render_surface1); |
| 6742 render_surface1->AddChild(intervening); | 6764 render_surface1->AddChild(intervening); |
| 6743 intervening->AddChild(render_surface2); | 6765 intervening->AddChild(render_surface2); |
| 6744 render_surface2->AddChild(clip_child); | 6766 render_surface2->AddChild(clip_child); |
| 6745 | 6767 |
| 6746 clip_child->SetClipParent(clip_parent.get()); | 6768 clip_child->SetClipParent(clip_parent.get()); |
| 6747 | 6769 |
| 6748 intervening->SetMasksToBounds(true); | 6770 intervening->SetMasksToBounds(true); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6848 | 6870 |
| 6849 TEST_F(LayerTreeHostCommonTest, DescendantsOfClipChildren) { | 6871 TEST_F(LayerTreeHostCommonTest, DescendantsOfClipChildren) { |
| 6850 // Ensures that descendants of the clip child inherit the correct clip. | 6872 // Ensures that descendants of the clip child inherit the correct clip. |
| 6851 // | 6873 // |
| 6852 // root (a render surface) | 6874 // root (a render surface) |
| 6853 // + clip_parent (masks to bounds) | 6875 // + clip_parent (masks to bounds) |
| 6854 // + intervening (masks to bounds) | 6876 // + intervening (masks to bounds) |
| 6855 // + clip_child | 6877 // + clip_child |
| 6856 // + child | 6878 // + child |
| 6857 // | 6879 // |
| 6858 scoped_refptr<Layer> root = Layer::Create(); | 6880 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 6859 scoped_refptr<Layer> clip_parent = Layer::Create(); | 6881 scoped_refptr<Layer> clip_parent = Layer::Create(layer_settings()); |
| 6860 scoped_refptr<Layer> intervening = Layer::Create(); | 6882 scoped_refptr<Layer> intervening = Layer::Create(layer_settings()); |
| 6861 scoped_refptr<Layer> clip_child = Layer::Create(); | 6883 scoped_refptr<Layer> clip_child = Layer::Create(layer_settings()); |
| 6862 scoped_refptr<LayerWithForcedDrawsContent> child = | 6884 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 6863 make_scoped_refptr(new LayerWithForcedDrawsContent); | 6885 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 6864 | 6886 |
| 6865 root->AddChild(clip_parent); | 6887 root->AddChild(clip_parent); |
| 6866 clip_parent->AddChild(intervening); | 6888 clip_parent->AddChild(intervening); |
| 6867 intervening->AddChild(clip_child); | 6889 intervening->AddChild(clip_child); |
| 6868 clip_child->AddChild(child); | 6890 clip_child->AddChild(child); |
| 6869 | 6891 |
| 6870 clip_child->SetClipParent(clip_parent.get()); | 6892 clip_child->SetClipParent(clip_parent.get()); |
| 6871 | 6893 |
| 6872 intervening->SetMasksToBounds(true); | 6894 intervening->SetMasksToBounds(true); |
| 6873 clip_parent->SetMasksToBounds(true); | 6895 clip_parent->SetMasksToBounds(true); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6932 // render surfaces. | 6954 // render surfaces. |
| 6933 // | 6955 // |
| 6934 // root (a render surface) | 6956 // root (a render surface) |
| 6935 // + clip_parent (masks to bounds) | 6957 // + clip_parent (masks to bounds) |
| 6936 // + render_surface1 | 6958 // + render_surface1 |
| 6937 // + clip_child | 6959 // + clip_child |
| 6938 // + render_surface2 | 6960 // + render_surface2 |
| 6939 // + non_clip_child | 6961 // + non_clip_child |
| 6940 // | 6962 // |
| 6941 // In this example render_surface2 should be unaffected by clip_child. | 6963 // In this example render_surface2 should be unaffected by clip_child. |
| 6942 scoped_refptr<Layer> root = Layer::Create(); | 6964 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 6943 scoped_refptr<Layer> clip_parent = Layer::Create(); | 6965 scoped_refptr<Layer> clip_parent = Layer::Create(layer_settings()); |
| 6944 scoped_refptr<Layer> render_surface1 = Layer::Create(); | 6966 scoped_refptr<Layer> render_surface1 = Layer::Create(layer_settings()); |
| 6945 scoped_refptr<LayerWithForcedDrawsContent> clip_child = | 6967 scoped_refptr<LayerWithForcedDrawsContent> clip_child = |
| 6946 make_scoped_refptr(new LayerWithForcedDrawsContent); | 6968 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 6947 scoped_refptr<Layer> render_surface2 = Layer::Create(); | 6969 scoped_refptr<Layer> render_surface2 = Layer::Create(layer_settings()); |
| 6948 scoped_refptr<LayerWithForcedDrawsContent> non_clip_child = | 6970 scoped_refptr<LayerWithForcedDrawsContent> non_clip_child = |
| 6949 make_scoped_refptr(new LayerWithForcedDrawsContent); | 6971 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 6950 | 6972 |
| 6951 root->AddChild(clip_parent); | 6973 root->AddChild(clip_parent); |
| 6952 clip_parent->AddChild(render_surface1); | 6974 clip_parent->AddChild(render_surface1); |
| 6953 render_surface1->AddChild(clip_child); | 6975 render_surface1->AddChild(clip_child); |
| 6954 clip_parent->AddChild(render_surface2); | 6976 clip_parent->AddChild(render_surface2); |
| 6955 render_surface2->AddChild(non_clip_child); | 6977 render_surface2->AddChild(non_clip_child); |
| 6956 | 6978 |
| 6957 clip_child->SetClipParent(clip_parent.get()); | 6979 clip_child->SetClipParent(clip_parent.get()); |
| 6958 | 6980 |
| 6959 clip_parent->SetMasksToBounds(true); | 6981 clip_parent->SetMasksToBounds(true); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7141 // Only root layer has a render surface. | 7163 // Only root layer has a render surface. |
| 7142 EXPECT_EQ(1, count_represents_target_render_surface); | 7164 EXPECT_EQ(1, count_represents_target_render_surface); |
| 7143 // No layer contributes a render surface to root render surface. | 7165 // No layer contributes a render surface to root render surface. |
| 7144 EXPECT_EQ(0, count_represents_contributing_render_surface); | 7166 EXPECT_EQ(0, count_represents_contributing_render_surface); |
| 7145 // All 4 layers represent itself. | 7167 // All 4 layers represent itself. |
| 7146 EXPECT_EQ(4, count_represents_itself); | 7168 EXPECT_EQ(4, count_represents_itself); |
| 7147 } | 7169 } |
| 7148 } | 7170 } |
| 7149 | 7171 |
| 7150 TEST_F(LayerTreeHostCommonTest, DoNotIncludeBackfaceInvisibleSurfaces) { | 7172 TEST_F(LayerTreeHostCommonTest, DoNotIncludeBackfaceInvisibleSurfaces) { |
| 7151 scoped_refptr<Layer> root = Layer::Create(); | 7173 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 7152 scoped_refptr<Layer> render_surface = Layer::Create(); | 7174 scoped_refptr<Layer> render_surface = Layer::Create(layer_settings()); |
| 7153 scoped_refptr<LayerWithForcedDrawsContent> child = | 7175 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 7154 make_scoped_refptr(new LayerWithForcedDrawsContent); | 7176 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7155 | 7177 |
| 7156 root->AddChild(render_surface); | 7178 root->AddChild(render_surface); |
| 7157 render_surface->AddChild(child); | 7179 render_surface->AddChild(child); |
| 7158 | 7180 |
| 7159 gfx::Transform identity_transform; | 7181 gfx::Transform identity_transform; |
| 7160 SetLayerPropertiesForTesting(root.get(), | 7182 SetLayerPropertiesForTesting(root.get(), |
| 7161 identity_transform, | 7183 identity_transform, |
| 7162 gfx::Point3F(), | 7184 gfx::Point3F(), |
| 7163 gfx::PointF(), | 7185 gfx::PointF(), |
| 7164 gfx::Size(50, 50), | 7186 gfx::Size(50, 50), |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7213 TEST_F(LayerTreeHostCommonTest, ClippedByScrollParent) { | 7235 TEST_F(LayerTreeHostCommonTest, ClippedByScrollParent) { |
| 7214 // Checks that the simple case (being clipped by a scroll parent that would | 7236 // Checks that the simple case (being clipped by a scroll parent that would |
| 7215 // have been processed before you anyhow) results in the right clips. | 7237 // have been processed before you anyhow) results in the right clips. |
| 7216 // | 7238 // |
| 7217 // + root | 7239 // + root |
| 7218 // + scroll_parent_border | 7240 // + scroll_parent_border |
| 7219 // | + scroll_parent_clip | 7241 // | + scroll_parent_clip |
| 7220 // | + scroll_parent | 7242 // | + scroll_parent |
| 7221 // + scroll_child | 7243 // + scroll_child |
| 7222 // | 7244 // |
| 7223 scoped_refptr<Layer> root = Layer::Create(); | 7245 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 7224 scoped_refptr<Layer> scroll_parent_border = Layer::Create(); | 7246 scoped_refptr<Layer> scroll_parent_border = Layer::Create(layer_settings()); |
| 7225 scoped_refptr<Layer> scroll_parent_clip = Layer::Create(); | 7247 scoped_refptr<Layer> scroll_parent_clip = Layer::Create(layer_settings()); |
| 7226 scoped_refptr<LayerWithForcedDrawsContent> scroll_parent = | 7248 scoped_refptr<LayerWithForcedDrawsContent> scroll_parent = |
| 7227 make_scoped_refptr(new LayerWithForcedDrawsContent); | 7249 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7228 scoped_refptr<LayerWithForcedDrawsContent> scroll_child = | 7250 scoped_refptr<LayerWithForcedDrawsContent> scroll_child = |
| 7229 make_scoped_refptr(new LayerWithForcedDrawsContent); | 7251 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7230 | 7252 |
| 7231 root->AddChild(scroll_child); | 7253 root->AddChild(scroll_child); |
| 7232 | 7254 |
| 7233 root->AddChild(scroll_parent_border); | 7255 root->AddChild(scroll_parent_border); |
| 7234 scroll_parent_border->AddChild(scroll_parent_clip); | 7256 scroll_parent_border->AddChild(scroll_parent_clip); |
| 7235 scroll_parent_clip->AddChild(scroll_parent); | 7257 scroll_parent_clip->AddChild(scroll_parent); |
| 7236 | 7258 |
| 7237 scroll_parent_clip->SetMasksToBounds(true); | 7259 scroll_parent_clip->SetMasksToBounds(true); |
| 7238 | 7260 |
| 7239 scroll_child->SetScrollParent(scroll_parent.get()); | 7261 scroll_child->SetScrollParent(scroll_parent.get()); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7282 | 7304 |
| 7283 EXPECT_TRUE(root->render_surface()); | 7305 EXPECT_TRUE(root->render_surface()); |
| 7284 | 7306 |
| 7285 EXPECT_EQ(gfx::Rect(0, 0, 30, 30).ToString(), | 7307 EXPECT_EQ(gfx::Rect(0, 0, 30, 30).ToString(), |
| 7286 scroll_child->clip_rect().ToString()); | 7308 scroll_child->clip_rect().ToString()); |
| 7287 EXPECT_TRUE(scroll_child->is_clipped()); | 7309 EXPECT_TRUE(scroll_child->is_clipped()); |
| 7288 } | 7310 } |
| 7289 | 7311 |
| 7290 TEST_F(LayerTreeHostCommonTest, SingularTransformSubtreesDoNotDraw) { | 7312 TEST_F(LayerTreeHostCommonTest, SingularTransformSubtreesDoNotDraw) { |
| 7291 scoped_refptr<LayerWithForcedDrawsContent> root = | 7313 scoped_refptr<LayerWithForcedDrawsContent> root = |
| 7292 make_scoped_refptr(new LayerWithForcedDrawsContent); | 7314 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7293 scoped_refptr<LayerWithForcedDrawsContent> parent = | 7315 scoped_refptr<LayerWithForcedDrawsContent> parent = |
| 7294 make_scoped_refptr(new LayerWithForcedDrawsContent); | 7316 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7295 scoped_refptr<LayerWithForcedDrawsContent> child = | 7317 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 7296 make_scoped_refptr(new LayerWithForcedDrawsContent); | 7318 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7297 | 7319 |
| 7298 root->AddChild(parent); | 7320 root->AddChild(parent); |
| 7299 parent->AddChild(child); | 7321 parent->AddChild(child); |
| 7300 | 7322 |
| 7301 gfx::Transform identity_transform; | 7323 gfx::Transform identity_transform; |
| 7302 SetLayerPropertiesForTesting(root.get(), | 7324 SetLayerPropertiesForTesting(root.get(), |
| 7303 identity_transform, | 7325 identity_transform, |
| 7304 gfx::Point3F(), | 7326 gfx::Point3F(), |
| 7305 gfx::PointF(), | 7327 gfx::PointF(), |
| 7306 gfx::Size(50, 50), | 7328 gfx::Size(50, 50), |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7354 TEST_F(LayerTreeHostCommonTest, ClippedByOutOfOrderScrollParent) { | 7376 TEST_F(LayerTreeHostCommonTest, ClippedByOutOfOrderScrollParent) { |
| 7355 // Checks that clipping by a scroll parent that follows you in paint order | 7377 // Checks that clipping by a scroll parent that follows you in paint order |
| 7356 // still results in correct clipping. | 7378 // still results in correct clipping. |
| 7357 // | 7379 // |
| 7358 // + root | 7380 // + root |
| 7359 // + scroll_child | 7381 // + scroll_child |
| 7360 // + scroll_parent_border | 7382 // + scroll_parent_border |
| 7361 // + scroll_parent_clip | 7383 // + scroll_parent_clip |
| 7362 // + scroll_parent | 7384 // + scroll_parent |
| 7363 // | 7385 // |
| 7364 scoped_refptr<Layer> root = Layer::Create(); | 7386 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 7365 scoped_refptr<Layer> scroll_parent_border = Layer::Create(); | 7387 scoped_refptr<Layer> scroll_parent_border = Layer::Create(layer_settings()); |
| 7366 scoped_refptr<Layer> scroll_parent_clip = Layer::Create(); | 7388 scoped_refptr<Layer> scroll_parent_clip = Layer::Create(layer_settings()); |
| 7367 scoped_refptr<LayerWithForcedDrawsContent> scroll_parent = | 7389 scoped_refptr<LayerWithForcedDrawsContent> scroll_parent = |
| 7368 make_scoped_refptr(new LayerWithForcedDrawsContent); | 7390 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7369 scoped_refptr<LayerWithForcedDrawsContent> scroll_child = | 7391 scoped_refptr<LayerWithForcedDrawsContent> scroll_child = |
| 7370 make_scoped_refptr(new LayerWithForcedDrawsContent); | 7392 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7371 | 7393 |
| 7372 root->AddChild(scroll_parent_border); | 7394 root->AddChild(scroll_parent_border); |
| 7373 scroll_parent_border->AddChild(scroll_parent_clip); | 7395 scroll_parent_border->AddChild(scroll_parent_clip); |
| 7374 scroll_parent_clip->AddChild(scroll_parent); | 7396 scroll_parent_clip->AddChild(scroll_parent); |
| 7375 | 7397 |
| 7376 root->AddChild(scroll_child); | 7398 root->AddChild(scroll_child); |
| 7377 | 7399 |
| 7378 scroll_parent_clip->SetMasksToBounds(true); | 7400 scroll_parent_clip->SetMasksToBounds(true); |
| 7379 | 7401 |
| 7380 scroll_child->SetScrollParent(scroll_parent.get()); | 7402 scroll_child->SetScrollParent(scroll_parent.get()); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7434 // | 7456 // |
| 7435 // + root | 7457 // + root |
| 7436 // + scroll_child | 7458 // + scroll_child |
| 7437 // + scroll_parent_border | 7459 // + scroll_parent_border |
| 7438 // | + scroll_parent_clip | 7460 // | + scroll_parent_clip |
| 7439 // | + scroll_parent | 7461 // | + scroll_parent |
| 7440 // + scroll_grandparent_border | 7462 // + scroll_grandparent_border |
| 7441 // + scroll_grandparent_clip | 7463 // + scroll_grandparent_clip |
| 7442 // + scroll_grandparent | 7464 // + scroll_grandparent |
| 7443 // | 7465 // |
| 7444 scoped_refptr<Layer> root = Layer::Create(); | 7466 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 7445 scoped_refptr<Layer> scroll_parent_border = Layer::Create(); | 7467 scoped_refptr<Layer> scroll_parent_border = Layer::Create(layer_settings()); |
| 7446 scoped_refptr<Layer> scroll_parent_clip = Layer::Create(); | 7468 scoped_refptr<Layer> scroll_parent_clip = Layer::Create(layer_settings()); |
| 7447 scoped_refptr<LayerWithForcedDrawsContent> scroll_parent = | 7469 scoped_refptr<LayerWithForcedDrawsContent> scroll_parent = |
| 7448 make_scoped_refptr(new LayerWithForcedDrawsContent); | 7470 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7449 | 7471 |
| 7450 scoped_refptr<Layer> scroll_grandparent_border = Layer::Create(); | 7472 scoped_refptr<Layer> scroll_grandparent_border = |
| 7451 scoped_refptr<Layer> scroll_grandparent_clip = Layer::Create(); | 7473 Layer::Create(layer_settings()); |
| 7474 scoped_refptr<Layer> scroll_grandparent_clip = |
| 7475 Layer::Create(layer_settings()); |
| 7452 scoped_refptr<LayerWithForcedDrawsContent> scroll_grandparent = | 7476 scoped_refptr<LayerWithForcedDrawsContent> scroll_grandparent = |
| 7453 make_scoped_refptr(new LayerWithForcedDrawsContent); | 7477 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7454 | 7478 |
| 7455 scoped_refptr<LayerWithForcedDrawsContent> scroll_child = | 7479 scoped_refptr<LayerWithForcedDrawsContent> scroll_child = |
| 7456 make_scoped_refptr(new LayerWithForcedDrawsContent); | 7480 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7457 | 7481 |
| 7458 root->AddChild(scroll_child); | 7482 root->AddChild(scroll_child); |
| 7459 | 7483 |
| 7460 root->AddChild(scroll_parent_border); | 7484 root->AddChild(scroll_parent_border); |
| 7461 scroll_parent_border->AddChild(scroll_parent_clip); | 7485 scroll_parent_border->AddChild(scroll_parent_clip); |
| 7462 scroll_parent_clip->AddChild(scroll_parent); | 7486 scroll_parent_clip->AddChild(scroll_parent); |
| 7463 | 7487 |
| 7464 root->AddChild(scroll_grandparent_border); | 7488 root->AddChild(scroll_grandparent_border); |
| 7465 scroll_grandparent_border->AddChild(scroll_grandparent_clip); | 7489 scroll_grandparent_border->AddChild(scroll_grandparent_clip); |
| 7466 scroll_grandparent_clip->AddChild(scroll_grandparent); | 7490 scroll_grandparent_clip->AddChild(scroll_grandparent); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7559 // + scroll_parent_border | 7583 // + scroll_parent_border |
| 7560 // + scroll_parent_clip | 7584 // + scroll_parent_clip |
| 7561 // + scroll_parent | 7585 // + scroll_parent |
| 7562 // + render_surface1 | 7586 // + render_surface1 |
| 7563 // + scroll_grandparent_border | 7587 // + scroll_grandparent_border |
| 7564 // + scroll_grandparent_clip | 7588 // + scroll_grandparent_clip |
| 7565 // + scroll_grandparent | 7589 // + scroll_grandparent |
| 7566 // + render_surface2 | 7590 // + render_surface2 |
| 7567 // | 7591 // |
| 7568 scoped_refptr<LayerWithForcedDrawsContent> root = | 7592 scoped_refptr<LayerWithForcedDrawsContent> root = |
| 7569 make_scoped_refptr(new LayerWithForcedDrawsContent); | 7593 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7570 | 7594 |
| 7571 scoped_refptr<Layer> scroll_parent_border = Layer::Create(); | 7595 scoped_refptr<Layer> scroll_parent_border = Layer::Create(layer_settings()); |
| 7572 scoped_refptr<Layer> scroll_parent_clip = Layer::Create(); | 7596 scoped_refptr<Layer> scroll_parent_clip = Layer::Create(layer_settings()); |
| 7573 scoped_refptr<LayerWithForcedDrawsContent> scroll_parent = | 7597 scoped_refptr<LayerWithForcedDrawsContent> scroll_parent = |
| 7574 make_scoped_refptr(new LayerWithForcedDrawsContent); | 7598 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7575 scoped_refptr<LayerWithForcedDrawsContent> render_surface1 = | 7599 scoped_refptr<LayerWithForcedDrawsContent> render_surface1 = |
| 7576 make_scoped_refptr(new LayerWithForcedDrawsContent); | 7600 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7577 | 7601 |
| 7578 scoped_refptr<Layer> scroll_grandparent_border = Layer::Create(); | 7602 scoped_refptr<Layer> scroll_grandparent_border = |
| 7579 scoped_refptr<Layer> scroll_grandparent_clip = Layer::Create(); | 7603 Layer::Create(layer_settings()); |
| 7604 scoped_refptr<Layer> scroll_grandparent_clip = |
| 7605 Layer::Create(layer_settings()); |
| 7580 scoped_refptr<LayerWithForcedDrawsContent> scroll_grandparent = | 7606 scoped_refptr<LayerWithForcedDrawsContent> scroll_grandparent = |
| 7581 make_scoped_refptr(new LayerWithForcedDrawsContent); | 7607 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7582 scoped_refptr<LayerWithForcedDrawsContent> render_surface2 = | 7608 scoped_refptr<LayerWithForcedDrawsContent> render_surface2 = |
| 7583 make_scoped_refptr(new LayerWithForcedDrawsContent); | 7609 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7584 | 7610 |
| 7585 scoped_refptr<LayerWithForcedDrawsContent> scroll_child = | 7611 scoped_refptr<LayerWithForcedDrawsContent> scroll_child = |
| 7586 make_scoped_refptr(new LayerWithForcedDrawsContent); | 7612 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7587 | 7613 |
| 7588 root->AddChild(scroll_child); | 7614 root->AddChild(scroll_child); |
| 7589 | 7615 |
| 7590 root->AddChild(scroll_parent_border); | 7616 root->AddChild(scroll_parent_border); |
| 7591 scroll_parent_border->AddChild(scroll_parent_clip); | 7617 scroll_parent_border->AddChild(scroll_parent_clip); |
| 7592 scroll_parent_clip->AddChild(scroll_parent); | 7618 scroll_parent_clip->AddChild(scroll_parent); |
| 7593 scroll_parent->AddChild(render_surface2); | 7619 scroll_parent->AddChild(render_surface2); |
| 7594 | 7620 |
| 7595 root->AddChild(scroll_grandparent_border); | 7621 root->AddChild(scroll_grandparent_border); |
| 7596 scroll_grandparent_border->AddChild(scroll_grandparent_clip); | 7622 scroll_grandparent_border->AddChild(scroll_grandparent_clip); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7711 // Ensures that when we have a render surface between a fixed position layer | 7737 // Ensures that when we have a render surface between a fixed position layer |
| 7712 // and its container, we compute the fixed position layer's draw transform | 7738 // and its container, we compute the fixed position layer's draw transform |
| 7713 // with respect to that intervening render surface, not with respect to its | 7739 // with respect to that intervening render surface, not with respect to its |
| 7714 // container's render target. | 7740 // container's render target. |
| 7715 // | 7741 // |
| 7716 // + root | 7742 // + root |
| 7717 // + render_surface | 7743 // + render_surface |
| 7718 // + fixed | 7744 // + fixed |
| 7719 // + child | 7745 // + child |
| 7720 // | 7746 // |
| 7721 scoped_refptr<Layer> root = Layer::Create(); | 7747 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 7722 scoped_refptr<LayerWithForcedDrawsContent> render_surface = | 7748 scoped_refptr<LayerWithForcedDrawsContent> render_surface = |
| 7723 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 7749 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7724 scoped_refptr<LayerWithForcedDrawsContent> fixed = | 7750 scoped_refptr<LayerWithForcedDrawsContent> fixed = |
| 7725 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 7751 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7726 scoped_refptr<LayerWithForcedDrawsContent> child = | 7752 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 7727 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 7753 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7728 | 7754 |
| 7729 root->AddChild(render_surface); | 7755 root->AddChild(render_surface); |
| 7730 render_surface->AddChild(fixed); | 7756 render_surface->AddChild(fixed); |
| 7731 fixed->AddChild(child); | 7757 fixed->AddChild(child); |
| 7732 | 7758 |
| 7733 root->SetIsContainerForFixedPositionLayers(true); | 7759 root->SetIsContainerForFixedPositionLayers(true); |
| 7734 render_surface->SetForceRenderSurface(true); | 7760 render_surface->SetForceRenderSurface(true); |
| 7735 | 7761 |
| 7736 LayerPositionConstraint constraint; | 7762 LayerPositionConstraint constraint; |
| 7737 constraint.set_is_fixed_position(true); | 7763 constraint.set_is_fixed_position(true); |
| (...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8696 4.f, child1_layer->mask_layer()->draw_properties().device_scale_factor); | 8722 4.f, child1_layer->mask_layer()->draw_properties().device_scale_factor); |
| 8697 EXPECT_FLOAT_EQ(4.f, | 8723 EXPECT_FLOAT_EQ(4.f, |
| 8698 child1_layer->replica_layer() | 8724 child1_layer->replica_layer() |
| 8699 ->mask_layer() | 8725 ->mask_layer() |
| 8700 ->draw_properties() | 8726 ->draw_properties() |
| 8701 .device_scale_factor); | 8727 .device_scale_factor); |
| 8702 EXPECT_FLOAT_EQ(4.f, child2_layer->draw_properties().device_scale_factor); | 8728 EXPECT_FLOAT_EQ(4.f, child2_layer->draw_properties().device_scale_factor); |
| 8703 } | 8729 } |
| 8704 | 8730 |
| 8705 TEST_F(LayerTreeHostCommonTest, VisibleContentRectInChildRenderSurface) { | 8731 TEST_F(LayerTreeHostCommonTest, VisibleContentRectInChildRenderSurface) { |
| 8706 scoped_refptr<Layer> root = Layer::Create(); | 8732 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 8707 SetLayerPropertiesForTesting(root.get(), | 8733 SetLayerPropertiesForTesting(root.get(), |
| 8708 gfx::Transform(), | 8734 gfx::Transform(), |
| 8709 gfx::Point3F(), | 8735 gfx::Point3F(), |
| 8710 gfx::PointF(), | 8736 gfx::PointF(), |
| 8711 gfx::Size(768 / 2, 3000), | 8737 gfx::Size(768 / 2, 3000), |
| 8712 true, | 8738 true, |
| 8713 false); | 8739 false); |
| 8714 root->SetIsDrawable(true); | 8740 root->SetIsDrawable(true); |
| 8715 | 8741 |
| 8716 scoped_refptr<Layer> clip = Layer::Create(); | 8742 scoped_refptr<Layer> clip = Layer::Create(layer_settings()); |
| 8717 SetLayerPropertiesForTesting(clip.get(), | 8743 SetLayerPropertiesForTesting(clip.get(), |
| 8718 gfx::Transform(), | 8744 gfx::Transform(), |
| 8719 gfx::Point3F(), | 8745 gfx::Point3F(), |
| 8720 gfx::PointF(), | 8746 gfx::PointF(), |
| 8721 gfx::Size(768 / 2, 10000), | 8747 gfx::Size(768 / 2, 10000), |
| 8722 true, | 8748 true, |
| 8723 false); | 8749 false); |
| 8724 clip->SetMasksToBounds(true); | 8750 clip->SetMasksToBounds(true); |
| 8725 | 8751 |
| 8726 scoped_refptr<Layer> content = Layer::Create(); | 8752 scoped_refptr<Layer> content = Layer::Create(layer_settings()); |
| 8727 SetLayerPropertiesForTesting(content.get(), | 8753 SetLayerPropertiesForTesting(content.get(), |
| 8728 gfx::Transform(), | 8754 gfx::Transform(), |
| 8729 gfx::Point3F(), | 8755 gfx::Point3F(), |
| 8730 gfx::PointF(), | 8756 gfx::PointF(), |
| 8731 gfx::Size(768 / 2, 10000), | 8757 gfx::Size(768 / 2, 10000), |
| 8732 true, | 8758 true, |
| 8733 false); | 8759 false); |
| 8734 content->SetIsDrawable(true); | 8760 content->SetIsDrawable(true); |
| 8735 content->SetForceRenderSurface(true); | 8761 content->SetForceRenderSurface(true); |
| 8736 | 8762 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8819 | 8845 |
| 8820 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 8846 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 8821 | 8847 |
| 8822 gfx::Rect affected_by_delta(0, 0, root_size.width(), | 8848 gfx::Rect affected_by_delta(0, 0, root_size.width(), |
| 8823 root_size.height() + 50); | 8849 root_size.height() + 50); |
| 8824 EXPECT_EQ(affected_by_delta, sublayer->visible_content_rect()); | 8850 EXPECT_EQ(affected_by_delta, sublayer->visible_content_rect()); |
| 8825 } | 8851 } |
| 8826 | 8852 |
| 8827 TEST_F(LayerTreeHostCommonTest, VisibleContentRectForAnimatedLayer) { | 8853 TEST_F(LayerTreeHostCommonTest, VisibleContentRectForAnimatedLayer) { |
| 8828 const gfx::Transform identity_matrix; | 8854 const gfx::Transform identity_matrix; |
| 8829 scoped_refptr<Layer> root = Layer::Create(); | 8855 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 8830 scoped_refptr<LayerWithForcedDrawsContent> animated = | 8856 scoped_refptr<LayerWithForcedDrawsContent> animated = |
| 8831 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 8857 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 8832 | 8858 |
| 8833 root->AddChild(animated); | 8859 root->AddChild(animated); |
| 8834 | 8860 |
| 8835 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 8861 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 8836 host->SetRootLayer(root); | 8862 host->SetRootLayer(root); |
| 8837 | 8863 |
| 8838 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), | 8864 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
| 8839 gfx::PointF(), gfx::Size(100, 100), true, false); | 8865 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 8840 SetLayerPropertiesForTesting(animated.get(), identity_matrix, gfx::Point3F(), | 8866 SetLayerPropertiesForTesting(animated.get(), identity_matrix, gfx::Point3F(), |
| 8841 gfx::PointF(), gfx::Size(20, 20), true, false); | 8867 gfx::PointF(), gfx::Size(20, 20), true, false); |
| 8842 | 8868 |
| 8843 root->SetMasksToBounds(true); | 8869 root->SetMasksToBounds(true); |
| 8844 root->SetForceRenderSurface(true); | 8870 root->SetForceRenderSurface(true); |
| 8845 animated->SetOpacity(0.f); | 8871 animated->SetOpacity(0.f); |
| 8846 | 8872 |
| 8847 AddOpacityTransitionToController(animated->layer_animation_controller(), 10.0, | 8873 AddOpacityTransitionToController(animated->layer_animation_controller(), 10.0, |
| 8848 0.f, 1.f, false); | 8874 0.f, 1.f, false); |
| 8849 | 8875 |
| 8850 ExecuteCalculateDrawProperties(root.get()); | 8876 ExecuteCalculateDrawProperties(root.get()); |
| 8851 | 8877 |
| 8852 EXPECT_FALSE(animated->visible_rect_from_property_trees().IsEmpty()); | 8878 EXPECT_FALSE(animated->visible_rect_from_property_trees().IsEmpty()); |
| 8853 } | 8879 } |
| 8854 | 8880 |
| 8855 TEST_F(LayerTreeHostCommonTest, | 8881 TEST_F(LayerTreeHostCommonTest, |
| 8856 VisibleContentRectForAnimatedLayerWithSingularTransform) { | 8882 VisibleContentRectForAnimatedLayerWithSingularTransform) { |
| 8857 const gfx::Transform identity_matrix; | 8883 const gfx::Transform identity_matrix; |
| 8858 scoped_refptr<Layer> root = Layer::Create(); | 8884 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 8859 scoped_refptr<Layer> clip = Layer::Create(); | 8885 scoped_refptr<Layer> clip = Layer::Create(layer_settings()); |
| 8860 scoped_refptr<LayerWithForcedDrawsContent> animated = | 8886 scoped_refptr<LayerWithForcedDrawsContent> animated = |
| 8861 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 8887 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 8862 scoped_refptr<LayerWithForcedDrawsContent> surface = | 8888 scoped_refptr<LayerWithForcedDrawsContent> surface = |
| 8863 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 8889 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 8864 scoped_refptr<LayerWithForcedDrawsContent> descendant_of_animation = | 8890 scoped_refptr<LayerWithForcedDrawsContent> descendant_of_animation = |
| 8865 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 8891 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 8866 | 8892 |
| 8867 root->AddChild(clip); | 8893 root->AddChild(clip); |
| 8868 clip->AddChild(animated); | 8894 clip->AddChild(animated); |
| 8869 animated->AddChild(surface); | 8895 animated->AddChild(surface); |
| 8870 surface->AddChild(descendant_of_animation); | 8896 surface->AddChild(descendant_of_animation); |
| 8871 | 8897 |
| 8872 clip->SetMasksToBounds(true); | 8898 clip->SetMasksToBounds(true); |
| 8873 surface->SetForceRenderSurface(true); | 8899 surface->SetForceRenderSurface(true); |
| 8874 | 8900 |
| 8875 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 8901 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8925 // means the clip cannot be projected into |surface|'s space, so we treat | 8951 // means the clip cannot be projected into |surface|'s space, so we treat |
| 8926 // |surface| and layers that draw into it as fully visible. | 8952 // |surface| and layers that draw into it as fully visible. |
| 8927 EXPECT_EQ(gfx::Rect(100, 100), surface->visible_rect_from_property_trees()); | 8953 EXPECT_EQ(gfx::Rect(100, 100), surface->visible_rect_from_property_trees()); |
| 8928 EXPECT_EQ(gfx::Rect(200, 200), | 8954 EXPECT_EQ(gfx::Rect(200, 200), |
| 8929 descendant_of_animation->visible_rect_from_property_trees()); | 8955 descendant_of_animation->visible_rect_from_property_trees()); |
| 8930 } | 8956 } |
| 8931 | 8957 |
| 8932 // Verify that having an animated filter (but no current filter, as these | 8958 // Verify that having an animated filter (but no current filter, as these |
| 8933 // are mutually exclusive) correctly creates a render surface. | 8959 // are mutually exclusive) correctly creates a render surface. |
| 8934 TEST_F(LayerTreeHostCommonTest, AnimatedFilterCreatesRenderSurface) { | 8960 TEST_F(LayerTreeHostCommonTest, AnimatedFilterCreatesRenderSurface) { |
| 8935 scoped_refptr<Layer> root = Layer::Create(); | 8961 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 8936 scoped_refptr<Layer> child = Layer::Create(); | 8962 scoped_refptr<Layer> child = Layer::Create(layer_settings()); |
| 8937 scoped_refptr<Layer> grandchild = Layer::Create(); | 8963 scoped_refptr<Layer> grandchild = Layer::Create(layer_settings()); |
| 8938 root->AddChild(child); | 8964 root->AddChild(child); |
| 8939 child->AddChild(grandchild); | 8965 child->AddChild(grandchild); |
| 8940 | 8966 |
| 8941 gfx::Transform identity_transform; | 8967 gfx::Transform identity_transform; |
| 8942 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), | 8968 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), |
| 8943 gfx::PointF(), gfx::Size(50, 50), true, false); | 8969 gfx::PointF(), gfx::Size(50, 50), true, false); |
| 8944 SetLayerPropertiesForTesting(child.get(), identity_transform, gfx::Point3F(), | 8970 SetLayerPropertiesForTesting(child.get(), identity_transform, gfx::Point3F(), |
| 8945 gfx::PointF(), gfx::Size(50, 50), true, false); | 8971 gfx::PointF(), gfx::Size(50, 50), true, false); |
| 8946 SetLayerPropertiesForTesting(grandchild.get(), identity_transform, | 8972 SetLayerPropertiesForTesting(grandchild.get(), identity_transform, |
| 8947 gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50), | 8973 gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50), |
| (...skipping 14 matching lines...) Expand all Loading... |
| 8962 EXPECT_TRUE(grandchild->filters().IsEmpty()); | 8988 EXPECT_TRUE(grandchild->filters().IsEmpty()); |
| 8963 | 8989 |
| 8964 EXPECT_FALSE(root->FilterIsAnimating()); | 8990 EXPECT_FALSE(root->FilterIsAnimating()); |
| 8965 EXPECT_TRUE(child->FilterIsAnimating()); | 8991 EXPECT_TRUE(child->FilterIsAnimating()); |
| 8966 EXPECT_FALSE(grandchild->FilterIsAnimating()); | 8992 EXPECT_FALSE(grandchild->FilterIsAnimating()); |
| 8967 } | 8993 } |
| 8968 | 8994 |
| 8969 // Ensures that the property tree code accounts for offsets between fixed | 8995 // Ensures that the property tree code accounts for offsets between fixed |
| 8970 // position layers and their respective containers. | 8996 // position layers and their respective containers. |
| 8971 TEST_F(LayerTreeHostCommonTest, PropertyTreesAccountForFixedParentOffset) { | 8997 TEST_F(LayerTreeHostCommonTest, PropertyTreesAccountForFixedParentOffset) { |
| 8972 scoped_refptr<Layer> root = Layer::Create(); | 8998 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 8973 scoped_refptr<Layer> child = Layer::Create(); | 8999 scoped_refptr<Layer> child = Layer::Create(layer_settings()); |
| 8974 scoped_refptr<LayerWithForcedDrawsContent> grandchild = | 9000 scoped_refptr<LayerWithForcedDrawsContent> grandchild = |
| 8975 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 9001 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 8976 | 9002 |
| 8977 root->AddChild(child); | 9003 root->AddChild(child); |
| 8978 child->AddChild(grandchild); | 9004 child->AddChild(grandchild); |
| 8979 | 9005 |
| 8980 gfx::Transform identity_transform; | 9006 gfx::Transform identity_transform; |
| 8981 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), | 9007 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), |
| 8982 gfx::PointF(), gfx::Size(50, 50), true, false); | 9008 gfx::PointF(), gfx::Size(50, 50), true, false); |
| 8983 SetLayerPropertiesForTesting(child.get(), identity_transform, gfx::Point3F(), | 9009 SetLayerPropertiesForTesting(child.get(), identity_transform, gfx::Point3F(), |
| 8984 gfx::PointF(1000, 1000), gfx::Size(50, 50), true, | 9010 gfx::PointF(1000, 1000), gfx::Size(50, 50), true, |
| 8985 false); | 9011 false); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 9007 TEST_F(LayerTreeHostCommonTest, CombineClipsUsingContentTarget) { | 9033 TEST_F(LayerTreeHostCommonTest, CombineClipsUsingContentTarget) { |
| 9008 // In the following layer tree, the layer |box|'s render target is |surface|. | 9034 // In the following layer tree, the layer |box|'s render target is |surface|. |
| 9009 // |surface| also creates a transform node. We want to combine clips for |box| | 9035 // |surface| also creates a transform node. We want to combine clips for |box| |
| 9010 // in the space of its target (i.e., |surface|), not its target's target. This | 9036 // in the space of its target (i.e., |surface|), not its target's target. This |
| 9011 // test ensures that happens. | 9037 // test ensures that happens. |
| 9012 | 9038 |
| 9013 gfx::Transform rotate; | 9039 gfx::Transform rotate; |
| 9014 rotate.Rotate(5); | 9040 rotate.Rotate(5); |
| 9015 gfx::Transform identity; | 9041 gfx::Transform identity; |
| 9016 | 9042 |
| 9017 scoped_refptr<Layer> root = Layer::Create(); | 9043 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 9018 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 9044 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 9019 gfx::PointF(), gfx::Size(2500, 1500), true, | 9045 gfx::PointF(), gfx::Size(2500, 1500), true, |
| 9020 false); | 9046 false); |
| 9021 | 9047 |
| 9022 scoped_refptr<Layer> frame_clip = Layer::Create(); | 9048 scoped_refptr<Layer> frame_clip = Layer::Create(layer_settings()); |
| 9023 SetLayerPropertiesForTesting(frame_clip.get(), identity, gfx::Point3F(), | 9049 SetLayerPropertiesForTesting(frame_clip.get(), identity, gfx::Point3F(), |
| 9024 gfx::PointF(), gfx::Size(2500, 1500), true, | 9050 gfx::PointF(), gfx::Size(2500, 1500), true, |
| 9025 false); | 9051 false); |
| 9026 frame_clip->SetMasksToBounds(true); | 9052 frame_clip->SetMasksToBounds(true); |
| 9027 | 9053 |
| 9028 scoped_refptr<Layer> rotated = Layer::Create(); | 9054 scoped_refptr<Layer> rotated = Layer::Create(layer_settings()); |
| 9029 SetLayerPropertiesForTesting(rotated.get(), rotate, | 9055 SetLayerPropertiesForTesting(rotated.get(), rotate, |
| 9030 gfx::Point3F(1250, 250, 0), gfx::PointF(), | 9056 gfx::Point3F(1250, 250, 0), gfx::PointF(), |
| 9031 gfx::Size(2500, 500), true, false); | 9057 gfx::Size(2500, 500), true, false); |
| 9032 | 9058 |
| 9033 scoped_refptr<Layer> surface = Layer::Create(); | 9059 scoped_refptr<Layer> surface = Layer::Create(layer_settings()); |
| 9034 SetLayerPropertiesForTesting(surface.get(), rotate, gfx::Point3F(), | 9060 SetLayerPropertiesForTesting(surface.get(), rotate, gfx::Point3F(), |
| 9035 gfx::PointF(), gfx::Size(2500, 500), true, | 9061 gfx::PointF(), gfx::Size(2500, 500), true, |
| 9036 false); | 9062 false); |
| 9037 surface->SetOpacity(0.5); | 9063 surface->SetOpacity(0.5); |
| 9038 | 9064 |
| 9039 scoped_refptr<LayerWithForcedDrawsContent> container = | 9065 scoped_refptr<LayerWithForcedDrawsContent> container = |
| 9040 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 9066 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 9041 SetLayerPropertiesForTesting(container.get(), identity, gfx::Point3F(), | 9067 SetLayerPropertiesForTesting(container.get(), identity, gfx::Point3F(), |
| 9042 gfx::PointF(), gfx::Size(300, 300), true, false); | 9068 gfx::PointF(), gfx::Size(300, 300), true, false); |
| 9043 | 9069 |
| 9044 scoped_refptr<LayerWithForcedDrawsContent> box = | 9070 scoped_refptr<LayerWithForcedDrawsContent> box = |
| 9045 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 9071 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 9046 SetLayerPropertiesForTesting(box.get(), identity, gfx::Point3F(), | 9072 SetLayerPropertiesForTesting(box.get(), identity, gfx::Point3F(), |
| 9047 gfx::PointF(), gfx::Size(100, 100), true, false); | 9073 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 9048 | 9074 |
| 9049 root->AddChild(frame_clip); | 9075 root->AddChild(frame_clip); |
| 9050 frame_clip->AddChild(rotated); | 9076 frame_clip->AddChild(rotated); |
| 9051 rotated->AddChild(surface); | 9077 rotated->AddChild(surface); |
| 9052 surface->AddChild(container); | 9078 surface->AddChild(container); |
| 9053 surface->AddChild(box); | 9079 surface->AddChild(box); |
| 9054 | 9080 |
| 9055 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 9081 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 9056 host->SetRootLayer(root); | 9082 host->SetRootLayer(root); |
| 9057 | 9083 |
| 9058 ExecuteCalculateDrawProperties(root.get()); | 9084 ExecuteCalculateDrawProperties(root.get()); |
| 9059 } | 9085 } |
| 9060 | 9086 |
| 9061 TEST_F(LayerTreeHostCommonTest, OnlyApplyFixedPositioningOnce) { | 9087 TEST_F(LayerTreeHostCommonTest, OnlyApplyFixedPositioningOnce) { |
| 9062 gfx::Transform identity; | 9088 gfx::Transform identity; |
| 9063 gfx::Transform translate_z; | 9089 gfx::Transform translate_z; |
| 9064 translate_z.Translate3d(0, 0, 10); | 9090 translate_z.Translate3d(0, 0, 10); |
| 9065 | 9091 |
| 9066 scoped_refptr<Layer> root = Layer::Create(); | 9092 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 9067 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 9093 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 9068 gfx::PointF(), gfx::Size(800, 800), true, false); | 9094 gfx::PointF(), gfx::Size(800, 800), true, false); |
| 9069 root->SetIsContainerForFixedPositionLayers(true); | 9095 root->SetIsContainerForFixedPositionLayers(true); |
| 9070 | 9096 |
| 9071 scoped_refptr<Layer> frame_clip = Layer::Create(); | 9097 scoped_refptr<Layer> frame_clip = Layer::Create(layer_settings()); |
| 9072 SetLayerPropertiesForTesting(frame_clip.get(), translate_z, gfx::Point3F(), | 9098 SetLayerPropertiesForTesting(frame_clip.get(), translate_z, gfx::Point3F(), |
| 9073 gfx::PointF(500, 100), gfx::Size(100, 100), true, | 9099 gfx::PointF(500, 100), gfx::Size(100, 100), true, |
| 9074 false); | 9100 false); |
| 9075 frame_clip->SetMasksToBounds(true); | 9101 frame_clip->SetMasksToBounds(true); |
| 9076 | 9102 |
| 9077 scoped_refptr<LayerWithForcedDrawsContent> fixed = | 9103 scoped_refptr<LayerWithForcedDrawsContent> fixed = |
| 9078 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 9104 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 9079 SetLayerPropertiesForTesting(fixed.get(), identity, gfx::Point3F(), | 9105 SetLayerPropertiesForTesting(fixed.get(), identity, gfx::Point3F(), |
| 9080 gfx::PointF(), gfx::Size(1000, 1000), true, | 9106 gfx::PointF(), gfx::Size(1000, 1000), true, |
| 9081 false); | 9107 false); |
| 9082 | 9108 |
| 9083 LayerPositionConstraint constraint; | 9109 LayerPositionConstraint constraint; |
| 9084 constraint.set_is_fixed_position(true); | 9110 constraint.set_is_fixed_position(true); |
| 9085 fixed->SetPositionConstraint(constraint); | 9111 fixed->SetPositionConstraint(constraint); |
| 9086 | 9112 |
| 9087 root->AddChild(frame_clip); | 9113 root->AddChild(frame_clip); |
| 9088 frame_clip->AddChild(fixed); | 9114 frame_clip->AddChild(fixed); |
| 9089 | 9115 |
| 9090 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 9116 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 9091 host->SetRootLayer(root); | 9117 host->SetRootLayer(root); |
| 9092 | 9118 |
| 9093 ExecuteCalculateDrawProperties(root.get()); | 9119 ExecuteCalculateDrawProperties(root.get()); |
| 9094 | 9120 |
| 9095 gfx::Rect expected(0, 0, 100, 100); | 9121 gfx::Rect expected(0, 0, 100, 100); |
| 9096 EXPECT_EQ(expected, fixed->visible_rect_from_property_trees()); | 9122 EXPECT_EQ(expected, fixed->visible_rect_from_property_trees()); |
| 9097 } | 9123 } |
| 9098 | 9124 |
| 9099 TEST_F(LayerTreeHostCommonTest, | 9125 TEST_F(LayerTreeHostCommonTest, |
| 9100 PropertyTreesAccountForScrollCompensationAdjustment) { | 9126 PropertyTreesAccountForScrollCompensationAdjustment) { |
| 9101 gfx::Transform identity; | 9127 gfx::Transform identity; |
| 9102 gfx::Transform translate_z; | 9128 gfx::Transform translate_z; |
| 9103 translate_z.Translate3d(0, 0, 10); | 9129 translate_z.Translate3d(0, 0, 10); |
| 9104 | 9130 |
| 9105 scoped_refptr<Layer> root = Layer::Create(); | 9131 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 9106 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 9132 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 9107 gfx::PointF(), gfx::Size(800, 800), true, false); | 9133 gfx::PointF(), gfx::Size(800, 800), true, false); |
| 9108 root->SetIsContainerForFixedPositionLayers(true); | 9134 root->SetIsContainerForFixedPositionLayers(true); |
| 9109 | 9135 |
| 9110 scoped_refptr<Layer> frame_clip = Layer::Create(); | 9136 scoped_refptr<Layer> frame_clip = Layer::Create(layer_settings()); |
| 9111 SetLayerPropertiesForTesting(frame_clip.get(), translate_z, gfx::Point3F(), | 9137 SetLayerPropertiesForTesting(frame_clip.get(), translate_z, gfx::Point3F(), |
| 9112 gfx::PointF(500, 100), gfx::Size(100, 100), true, | 9138 gfx::PointF(500, 100), gfx::Size(100, 100), true, |
| 9113 false); | 9139 false); |
| 9114 frame_clip->SetMasksToBounds(true); | 9140 frame_clip->SetMasksToBounds(true); |
| 9115 | 9141 |
| 9116 scoped_refptr<LayerWithForcedDrawsContent> scroller = | 9142 scoped_refptr<LayerWithForcedDrawsContent> scroller = |
| 9117 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 9143 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 9118 SetLayerPropertiesForTesting(scroller.get(), identity, gfx::Point3F(), | 9144 SetLayerPropertiesForTesting(scroller.get(), identity, gfx::Point3F(), |
| 9119 gfx::PointF(), gfx::Size(1000, 1000), true, | 9145 gfx::PointF(), gfx::Size(1000, 1000), true, |
| 9120 false); | 9146 false); |
| 9121 | 9147 |
| 9122 scroller->SetScrollCompensationAdjustment(gfx::Vector2dF(0.3f, 0.7f)); | 9148 scroller->SetScrollCompensationAdjustment(gfx::Vector2dF(0.3f, 0.7f)); |
| 9123 scroller->SetScrollOffset(gfx::ScrollOffset(0.3, 0.7)); | 9149 scroller->SetScrollOffset(gfx::ScrollOffset(0.3, 0.7)); |
| 9124 scroller->SetScrollClipLayerId(frame_clip->id()); | 9150 scroller->SetScrollClipLayerId(frame_clip->id()); |
| 9125 | 9151 |
| 9126 scoped_refptr<LayerWithForcedDrawsContent> fixed = | 9152 scoped_refptr<LayerWithForcedDrawsContent> fixed = |
| 9127 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 9153 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 9128 SetLayerPropertiesForTesting(fixed.get(), identity, gfx::Point3F(), | 9154 SetLayerPropertiesForTesting(fixed.get(), identity, gfx::Point3F(), |
| 9129 gfx::PointF(), gfx::Size(50, 50), true, false); | 9155 gfx::PointF(), gfx::Size(50, 50), true, false); |
| 9130 | 9156 |
| 9131 LayerPositionConstraint constraint; | 9157 LayerPositionConstraint constraint; |
| 9132 constraint.set_is_fixed_position(true); | 9158 constraint.set_is_fixed_position(true); |
| 9133 fixed->SetPositionConstraint(constraint); | 9159 fixed->SetPositionConstraint(constraint); |
| 9134 | 9160 |
| 9135 scoped_refptr<LayerWithForcedDrawsContent> fixed_child = | 9161 scoped_refptr<LayerWithForcedDrawsContent> fixed_child = |
| 9136 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 9162 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 9137 SetLayerPropertiesForTesting(fixed_child.get(), identity, gfx::Point3F(), | 9163 SetLayerPropertiesForTesting(fixed_child.get(), identity, gfx::Point3F(), |
| 9138 gfx::PointF(), gfx::Size(10, 10), true, false); | 9164 gfx::PointF(), gfx::Size(10, 10), true, false); |
| 9139 | 9165 |
| 9140 fixed_child->SetPositionConstraint(constraint); | 9166 fixed_child->SetPositionConstraint(constraint); |
| 9141 | 9167 |
| 9142 root->AddChild(frame_clip); | 9168 root->AddChild(frame_clip); |
| 9143 frame_clip->AddChild(scroller); | 9169 frame_clip->AddChild(scroller); |
| 9144 scroller->AddChild(fixed); | 9170 scroller->AddChild(fixed); |
| 9145 fixed->AddChild(fixed_child); | 9171 fixed->AddChild(fixed_child); |
| 9146 | 9172 |
| 9147 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 9173 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 9148 host->SetRootLayer(root); | 9174 host->SetRootLayer(root); |
| 9149 | 9175 |
| 9150 ExecuteCalculateDrawProperties(root.get()); | 9176 ExecuteCalculateDrawProperties(root.get()); |
| 9151 | 9177 |
| 9152 gfx::Rect expected(0, 0, 50, 50); | 9178 gfx::Rect expected(0, 0, 50, 50); |
| 9153 EXPECT_EQ(expected, fixed->visible_rect_from_property_trees()); | 9179 EXPECT_EQ(expected, fixed->visible_rect_from_property_trees()); |
| 9154 | 9180 |
| 9155 expected = gfx::Rect(0, 0, 10, 10); | 9181 expected = gfx::Rect(0, 0, 10, 10); |
| 9156 EXPECT_EQ(expected, fixed_child->visible_rect_from_property_trees()); | 9182 EXPECT_EQ(expected, fixed_child->visible_rect_from_property_trees()); |
| 9157 } | 9183 } |
| 9158 | 9184 |
| 9159 TEST_F(LayerTreeHostCommonTest, FixedClipsShouldBeAssociatedWithTheRightNode) { | 9185 TEST_F(LayerTreeHostCommonTest, FixedClipsShouldBeAssociatedWithTheRightNode) { |
| 9160 gfx::Transform identity; | 9186 gfx::Transform identity; |
| 9161 | 9187 |
| 9162 scoped_refptr<Layer> root = Layer::Create(); | 9188 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 9163 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 9189 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 9164 gfx::PointF(), gfx::Size(800, 800), true, false); | 9190 gfx::PointF(), gfx::Size(800, 800), true, false); |
| 9165 root->SetIsContainerForFixedPositionLayers(true); | 9191 root->SetIsContainerForFixedPositionLayers(true); |
| 9166 | 9192 |
| 9167 scoped_refptr<Layer> frame_clip = Layer::Create(); | 9193 scoped_refptr<Layer> frame_clip = Layer::Create(layer_settings()); |
| 9168 SetLayerPropertiesForTesting(frame_clip.get(), identity, gfx::Point3F(), | 9194 SetLayerPropertiesForTesting(frame_clip.get(), identity, gfx::Point3F(), |
| 9169 gfx::PointF(500, 100), gfx::Size(100, 100), true, | 9195 gfx::PointF(500, 100), gfx::Size(100, 100), true, |
| 9170 false); | 9196 false); |
| 9171 frame_clip->SetMasksToBounds(true); | 9197 frame_clip->SetMasksToBounds(true); |
| 9172 | 9198 |
| 9173 scoped_refptr<LayerWithForcedDrawsContent> scroller = | 9199 scoped_refptr<LayerWithForcedDrawsContent> scroller = |
| 9174 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 9200 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 9175 SetLayerPropertiesForTesting(scroller.get(), identity, gfx::Point3F(), | 9201 SetLayerPropertiesForTesting(scroller.get(), identity, gfx::Point3F(), |
| 9176 gfx::PointF(), gfx::Size(1000, 1000), true, | 9202 gfx::PointF(), gfx::Size(1000, 1000), true, |
| 9177 false); | 9203 false); |
| 9178 | 9204 |
| 9179 scroller->SetScrollOffset(gfx::ScrollOffset(100, 100)); | 9205 scroller->SetScrollOffset(gfx::ScrollOffset(100, 100)); |
| 9180 scroller->SetScrollClipLayerId(frame_clip->id()); | 9206 scroller->SetScrollClipLayerId(frame_clip->id()); |
| 9181 | 9207 |
| 9182 scoped_refptr<LayerWithForcedDrawsContent> fixed = | 9208 scoped_refptr<LayerWithForcedDrawsContent> fixed = |
| 9183 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 9209 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 9184 SetLayerPropertiesForTesting(fixed.get(), identity, gfx::Point3F(), | 9210 SetLayerPropertiesForTesting(fixed.get(), identity, gfx::Point3F(), |
| 9185 gfx::PointF(100, 100), gfx::Size(50, 50), true, | 9211 gfx::PointF(100, 100), gfx::Size(50, 50), true, |
| 9186 false); | 9212 false); |
| 9187 | 9213 |
| 9188 LayerPositionConstraint constraint; | 9214 LayerPositionConstraint constraint; |
| 9189 constraint.set_is_fixed_position(true); | 9215 constraint.set_is_fixed_position(true); |
| 9190 fixed->SetPositionConstraint(constraint); | 9216 fixed->SetPositionConstraint(constraint); |
| 9191 fixed->SetForceRenderSurface(true); | 9217 fixed->SetForceRenderSurface(true); |
| 9192 fixed->SetMasksToBounds(true); | 9218 fixed->SetMasksToBounds(true); |
| 9193 | 9219 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 9205 } | 9231 } |
| 9206 | 9232 |
| 9207 TEST_F(LayerTreeHostCommonTest, ChangingAxisAlignmentTriggersRebuild) { | 9233 TEST_F(LayerTreeHostCommonTest, ChangingAxisAlignmentTriggersRebuild) { |
| 9208 gfx::Transform identity; | 9234 gfx::Transform identity; |
| 9209 gfx::Transform translate; | 9235 gfx::Transform translate; |
| 9210 gfx::Transform rotate; | 9236 gfx::Transform rotate; |
| 9211 | 9237 |
| 9212 translate.Translate(10, 10); | 9238 translate.Translate(10, 10); |
| 9213 rotate.Rotate(45); | 9239 rotate.Rotate(45); |
| 9214 | 9240 |
| 9215 scoped_refptr<Layer> root = Layer::Create(); | 9241 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 9216 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 9242 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 9217 gfx::PointF(), gfx::Size(800, 800), true, false); | 9243 gfx::PointF(), gfx::Size(800, 800), true, false); |
| 9218 root->SetIsContainerForFixedPositionLayers(true); | 9244 root->SetIsContainerForFixedPositionLayers(true); |
| 9219 | 9245 |
| 9220 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 9246 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 9221 host->SetRootLayer(root); | 9247 host->SetRootLayer(root); |
| 9222 | 9248 |
| 9223 ExecuteCalculateDrawProperties(root.get()); | 9249 ExecuteCalculateDrawProperties(root.get()); |
| 9224 | 9250 |
| 9225 root->SetTransform(translate); | 9251 root->SetTransform(translate); |
| 9226 EXPECT_FALSE(host->property_trees()->needs_rebuild); | 9252 EXPECT_FALSE(host->property_trees()->needs_rebuild); |
| 9227 | 9253 |
| 9228 root->SetTransform(rotate); | 9254 root->SetTransform(rotate); |
| 9229 EXPECT_TRUE(host->property_trees()->needs_rebuild); | 9255 EXPECT_TRUE(host->property_trees()->needs_rebuild); |
| 9230 } | 9256 } |
| 9231 | 9257 |
| 9232 TEST_F(LayerTreeHostCommonTest, ChangeTransformOrigin) { | 9258 TEST_F(LayerTreeHostCommonTest, ChangeTransformOrigin) { |
| 9233 scoped_refptr<Layer> root = Layer::Create(); | 9259 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 9234 scoped_refptr<LayerWithForcedDrawsContent> child = | 9260 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 9235 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 9261 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 9236 root->AddChild(child); | 9262 root->AddChild(child); |
| 9237 | 9263 |
| 9238 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 9264 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 9239 host->SetRootLayer(root); | 9265 host->SetRootLayer(root); |
| 9240 | 9266 |
| 9241 gfx::Transform identity_matrix; | 9267 gfx::Transform identity_matrix; |
| 9242 gfx::Transform scale_matrix; | 9268 gfx::Transform scale_matrix; |
| 9243 scale_matrix.Scale(2.f, 2.f); | 9269 scale_matrix.Scale(2.f, 2.f); |
| 9244 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), | 9270 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
| 9245 gfx::PointF(), gfx::Size(100, 100), true, false); | 9271 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 9246 SetLayerPropertiesForTesting(child.get(), scale_matrix, gfx::Point3F(), | 9272 SetLayerPropertiesForTesting(child.get(), scale_matrix, gfx::Point3F(), |
| 9247 gfx::PointF(), gfx::Size(10, 10), true, false); | 9273 gfx::PointF(), gfx::Size(10, 10), true, false); |
| 9248 | 9274 |
| 9249 ExecuteCalculateDrawProperties(root.get()); | 9275 ExecuteCalculateDrawProperties(root.get()); |
| 9250 EXPECT_EQ(gfx::Rect(10, 10), child->visible_rect_from_property_trees()); | 9276 EXPECT_EQ(gfx::Rect(10, 10), child->visible_rect_from_property_trees()); |
| 9251 | 9277 |
| 9252 child->SetTransformOrigin(gfx::Point3F(10.f, 10.f, 10.f)); | 9278 child->SetTransformOrigin(gfx::Point3F(10.f, 10.f, 10.f)); |
| 9253 | 9279 |
| 9254 ExecuteCalculateDrawProperties(root.get()); | 9280 ExecuteCalculateDrawProperties(root.get()); |
| 9255 EXPECT_EQ(gfx::Rect(5, 5, 5, 5), child->visible_rect_from_property_trees()); | 9281 EXPECT_EQ(gfx::Rect(5, 5, 5, 5), child->visible_rect_from_property_trees()); |
| 9256 } | 9282 } |
| 9257 | 9283 |
| 9258 TEST_F(LayerTreeHostCommonTest, UpdateScrollChildPosition) { | 9284 TEST_F(LayerTreeHostCommonTest, UpdateScrollChildPosition) { |
| 9259 scoped_refptr<Layer> root = Layer::Create(); | 9285 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 9260 scoped_refptr<LayerWithForcedDrawsContent> scroll_parent = | 9286 scoped_refptr<LayerWithForcedDrawsContent> scroll_parent = |
| 9261 make_scoped_refptr(new LayerWithForcedDrawsContent); | 9287 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 9262 scoped_refptr<LayerWithForcedDrawsContent> scroll_child = | 9288 scoped_refptr<LayerWithForcedDrawsContent> scroll_child = |
| 9263 make_scoped_refptr(new LayerWithForcedDrawsContent); | 9289 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 9264 | 9290 |
| 9265 root->AddChild(scroll_child); | 9291 root->AddChild(scroll_child); |
| 9266 root->AddChild(scroll_parent); | 9292 root->AddChild(scroll_parent); |
| 9267 scroll_child->SetScrollParent(scroll_parent.get()); | 9293 scroll_child->SetScrollParent(scroll_parent.get()); |
| 9268 scroll_parent->SetScrollClipLayerId(root->id()); | 9294 scroll_parent->SetScrollClipLayerId(root->id()); |
| 9269 | 9295 |
| 9270 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 9296 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 9271 host->SetRootLayer(root); | 9297 host->SetRootLayer(root); |
| 9272 | 9298 |
| 9273 gfx::Transform identity_transform; | 9299 gfx::Transform identity_transform; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 9291 EXPECT_EQ(gfx::Rect(0, 5, 25, 25), | 9317 EXPECT_EQ(gfx::Rect(0, 5, 25, 25), |
| 9292 scroll_child->visible_rect_from_property_trees()); | 9318 scroll_child->visible_rect_from_property_trees()); |
| 9293 } | 9319 } |
| 9294 | 9320 |
| 9295 static void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) { | 9321 static void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) { |
| 9296 } | 9322 } |
| 9297 | 9323 |
| 9298 TEST_F(LayerTreeHostCommonTest, SkippingSubtreeMain) { | 9324 TEST_F(LayerTreeHostCommonTest, SkippingSubtreeMain) { |
| 9299 gfx::Transform identity; | 9325 gfx::Transform identity; |
| 9300 FakeContentLayerClient client; | 9326 FakeContentLayerClient client; |
| 9301 scoped_refptr<Layer> root = Layer::Create(); | 9327 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 9302 scoped_refptr<LayerWithForcedDrawsContent> child = | 9328 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 9303 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 9329 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 9304 scoped_refptr<LayerWithForcedDrawsContent> grandchild = | 9330 scoped_refptr<LayerWithForcedDrawsContent> grandchild = |
| 9305 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 9331 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 9306 scoped_refptr<FakeContentLayer> greatgrandchild( | 9332 scoped_refptr<FakeContentLayer> greatgrandchild( |
| 9307 FakeContentLayer::Create(&client)); | 9333 FakeContentLayer::Create(layer_settings(), &client)); |
| 9308 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 9334 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 9309 gfx::PointF(), gfx::Size(100, 100), true, false); | 9335 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 9310 SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(), | 9336 SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(), |
| 9311 gfx::PointF(), gfx::Size(10, 10), true, false); | 9337 gfx::PointF(), gfx::Size(10, 10), true, false); |
| 9312 SetLayerPropertiesForTesting(grandchild.get(), identity, gfx::Point3F(), | 9338 SetLayerPropertiesForTesting(grandchild.get(), identity, gfx::Point3F(), |
| 9313 gfx::PointF(), gfx::Size(10, 10), true, false); | 9339 gfx::PointF(), gfx::Size(10, 10), true, false); |
| 9314 SetLayerPropertiesForTesting(greatgrandchild.get(), identity, gfx::Point3F(), | 9340 SetLayerPropertiesForTesting(greatgrandchild.get(), identity, gfx::Point3F(), |
| 9315 gfx::PointF(), gfx::Size(10, 10), true, false); | 9341 gfx::PointF(), gfx::Size(10, 10), true, false); |
| 9316 | 9342 |
| 9317 root->AddChild(child); | 9343 root->AddChild(child); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9453 | 9479 |
| 9454 greatgrandchild_ptr->PassCopyRequests(&requests); | 9480 greatgrandchild_ptr->PassCopyRequests(&requests); |
| 9455 ExecuteCalculateDrawProperties(root.get()); | 9481 ExecuteCalculateDrawProperties(root.get()); |
| 9456 EXPECT_EQ(gfx::Rect(10, 10), | 9482 EXPECT_EQ(gfx::Rect(10, 10), |
| 9457 grandchild_ptr->visible_rect_from_property_trees()); | 9483 grandchild_ptr->visible_rect_from_property_trees()); |
| 9458 } | 9484 } |
| 9459 | 9485 |
| 9460 TEST_F(LayerTreeHostCommonTest, SkippingLayer) { | 9486 TEST_F(LayerTreeHostCommonTest, SkippingLayer) { |
| 9461 gfx::Transform identity; | 9487 gfx::Transform identity; |
| 9462 FakeContentLayerClient client; | 9488 FakeContentLayerClient client; |
| 9463 scoped_refptr<Layer> root = Layer::Create(); | 9489 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 9464 scoped_refptr<LayerWithForcedDrawsContent> child = | 9490 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 9465 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 9491 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 9466 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 9492 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 9467 gfx::PointF(), gfx::Size(100, 100), true, false); | 9493 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 9468 SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(), | 9494 SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(), |
| 9469 gfx::PointF(), gfx::Size(10, 10), true, false); | 9495 gfx::PointF(), gfx::Size(10, 10), true, false); |
| 9470 root->AddChild(child); | 9496 root->AddChild(child); |
| 9471 | 9497 |
| 9472 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 9498 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 9473 host->SetRootLayer(root); | 9499 host->SetRootLayer(root); |
| 9474 | 9500 |
| 9475 ExecuteCalculateDrawProperties(root.get()); | 9501 ExecuteCalculateDrawProperties(root.get()); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 9496 child->SetTransform(identity); | 9522 child->SetTransform(identity); |
| 9497 | 9523 |
| 9498 child->SetOpacity(0.f); | 9524 child->SetOpacity(0.f); |
| 9499 ExecuteCalculateDrawProperties(root.get()); | 9525 ExecuteCalculateDrawProperties(root.get()); |
| 9500 EXPECT_EQ(gfx::Rect(0, 0), child->visible_rect_from_property_trees()); | 9526 EXPECT_EQ(gfx::Rect(0, 0), child->visible_rect_from_property_trees()); |
| 9501 } | 9527 } |
| 9502 | 9528 |
| 9503 TEST_F(LayerTreeHostCommonTest, LayerTreeRebuildTest) { | 9529 TEST_F(LayerTreeHostCommonTest, LayerTreeRebuildTest) { |
| 9504 // Ensure that the treewalk in LayerTreeHostCommom:: | 9530 // Ensure that the treewalk in LayerTreeHostCommom:: |
| 9505 // PreCalculateMetaInformation happens when its required. | 9531 // PreCalculateMetaInformation happens when its required. |
| 9506 scoped_refptr<Layer> root = Layer::Create(); | 9532 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 9507 scoped_refptr<Layer> parent = Layer::Create(); | 9533 scoped_refptr<Layer> parent = Layer::Create(layer_settings()); |
| 9508 scoped_refptr<Layer> child = Layer::Create(); | 9534 scoped_refptr<Layer> child = Layer::Create(layer_settings()); |
| 9509 | 9535 |
| 9510 root->AddChild(parent); | 9536 root->AddChild(parent); |
| 9511 parent->AddChild(child); | 9537 parent->AddChild(child); |
| 9512 | 9538 |
| 9513 child->SetClipParent(root.get()); | 9539 child->SetClipParent(root.get()); |
| 9514 | 9540 |
| 9515 gfx::Transform identity; | 9541 gfx::Transform identity; |
| 9516 | 9542 |
| 9517 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 9543 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 9518 gfx::PointF(), gfx::Size(100, 100), true, false); | 9544 gfx::PointF(), gfx::Size(100, 100), true, false); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 9541 child->RequestCopyOfOutput( | 9567 child->RequestCopyOfOutput( |
| 9542 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback))); | 9568 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback))); |
| 9543 EXPECT_TRUE(root->draw_properties().layer_or_descendant_has_copy_request); | 9569 EXPECT_TRUE(root->draw_properties().layer_or_descendant_has_copy_request); |
| 9544 ExecuteCalculateDrawProperties(root.get()); | 9570 ExecuteCalculateDrawProperties(root.get()); |
| 9545 EXPECT_TRUE(root->draw_properties().layer_or_descendant_has_copy_request); | 9571 EXPECT_TRUE(root->draw_properties().layer_or_descendant_has_copy_request); |
| 9546 } | 9572 } |
| 9547 | 9573 |
| 9548 TEST_F(LayerTreeHostCommonTest, InputHandlersRecursiveUpdateTest) { | 9574 TEST_F(LayerTreeHostCommonTest, InputHandlersRecursiveUpdateTest) { |
| 9549 // Ensure that the treewalk in LayertreeHostCommon:: | 9575 // Ensure that the treewalk in LayertreeHostCommon:: |
| 9550 // PreCalculateMetaInformation updates input handlers correctly. | 9576 // PreCalculateMetaInformation updates input handlers correctly. |
| 9551 scoped_refptr<Layer> root = Layer::Create(); | 9577 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 9552 scoped_refptr<Layer> child = Layer::Create(); | 9578 scoped_refptr<Layer> child = Layer::Create(layer_settings()); |
| 9553 | 9579 |
| 9554 root->AddChild(child); | 9580 root->AddChild(child); |
| 9555 | 9581 |
| 9556 child->SetHaveWheelEventHandlers(true); | 9582 child->SetHaveWheelEventHandlers(true); |
| 9557 | 9583 |
| 9558 gfx::Transform identity; | 9584 gfx::Transform identity; |
| 9559 | 9585 |
| 9560 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 9586 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 9561 gfx::PointF(), gfx::Size(100, 100), true, false); | 9587 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 9562 SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(), | 9588 SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(), |
| 9563 gfx::PointF(), gfx::Size(100, 100), true, false); | 9589 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 9564 | 9590 |
| 9565 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 9591 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 9566 host->SetRootLayer(root); | 9592 host->SetRootLayer(root); |
| 9567 | 9593 |
| 9568 EXPECT_EQ(root->num_layer_or_descendants_with_input_handler(), 0); | 9594 EXPECT_EQ(root->num_layer_or_descendants_with_input_handler(), 0); |
| 9569 ExecuteCalculateDrawProperties(root.get()); | 9595 ExecuteCalculateDrawProperties(root.get()); |
| 9570 EXPECT_EQ(root->num_layer_or_descendants_with_input_handler(), 1); | 9596 EXPECT_EQ(root->num_layer_or_descendants_with_input_handler(), 1); |
| 9571 child->SetHaveWheelEventHandlers(false); | 9597 child->SetHaveWheelEventHandlers(false); |
| 9572 EXPECT_EQ(root->num_layer_or_descendants_with_input_handler(), 0); | 9598 EXPECT_EQ(root->num_layer_or_descendants_with_input_handler(), 0); |
| 9573 } | 9599 } |
| 9574 | 9600 |
| 9575 } // namespace | 9601 } // namespace |
| 9576 } // namespace cc | 9602 } // namespace cc |
| OLD | NEW |