| 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 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 2847 ExecuteCalculateDrawPropertiesWithPropertyTrees(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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6029 testing::Bool(), | 6049 testing::Bool(), |
| 6030 testing::Bool())); | 6050 testing::Bool())); |
| 6031 | 6051 |
| 6032 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayer) { | 6052 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayer) { |
| 6033 FakeImplProxy proxy; | 6053 FakeImplProxy proxy; |
| 6034 TestSharedBitmapManager shared_bitmap_manager; | 6054 TestSharedBitmapManager shared_bitmap_manager; |
| 6035 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); | 6055 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); |
| 6036 host_impl.CreatePendingTree(); | 6056 host_impl.CreatePendingTree(); |
| 6037 const gfx::Transform identity_matrix; | 6057 const gfx::Transform identity_matrix; |
| 6038 | 6058 |
| 6039 scoped_refptr<Layer> root = Layer::Create(); | 6059 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 6040 SetLayerPropertiesForTesting(root.get(), | 6060 SetLayerPropertiesForTesting(root.get(), |
| 6041 identity_matrix, | 6061 identity_matrix, |
| 6042 gfx::Point3F(), | 6062 gfx::Point3F(), |
| 6043 gfx::PointF(), | 6063 gfx::PointF(), |
| 6044 gfx::Size(50, 50), | 6064 gfx::Size(50, 50), |
| 6045 true, | 6065 true, |
| 6046 false); | 6066 false); |
| 6047 root->SetIsDrawable(true); | 6067 root->SetIsDrawable(true); |
| 6048 | 6068 |
| 6049 scoped_refptr<Layer> child = Layer::Create(); | 6069 scoped_refptr<Layer> child = Layer::Create(layer_settings()); |
| 6050 SetLayerPropertiesForTesting(child.get(), | 6070 SetLayerPropertiesForTesting(child.get(), |
| 6051 identity_matrix, | 6071 identity_matrix, |
| 6052 gfx::Point3F(), | 6072 gfx::Point3F(), |
| 6053 gfx::PointF(), | 6073 gfx::PointF(), |
| 6054 gfx::Size(40, 40), | 6074 gfx::Size(40, 40), |
| 6055 true, | 6075 true, |
| 6056 false); | 6076 false); |
| 6057 child->SetIsDrawable(true); | 6077 child->SetIsDrawable(true); |
| 6058 | 6078 |
| 6059 scoped_refptr<Layer> grand_child = Layer::Create(); | 6079 scoped_refptr<Layer> grand_child = Layer::Create(layer_settings()); |
| 6060 SetLayerPropertiesForTesting(grand_child.get(), | 6080 SetLayerPropertiesForTesting(grand_child.get(), |
| 6061 identity_matrix, | 6081 identity_matrix, |
| 6062 gfx::Point3F(), | 6082 gfx::Point3F(), |
| 6063 gfx::PointF(), | 6083 gfx::PointF(), |
| 6064 gfx::Size(30, 30), | 6084 gfx::Size(30, 30), |
| 6065 true, | 6085 true, |
| 6066 false); | 6086 false); |
| 6067 grand_child->SetIsDrawable(true); | 6087 grand_child->SetIsDrawable(true); |
| 6068 grand_child->SetHideLayerAndSubtree(true); | 6088 grand_child->SetHideLayerAndSubtree(true); |
| 6069 | 6089 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6132 EXPECT_EQ(2, root->render_surface()->layer_list().at(1)->id()); | 6152 EXPECT_EQ(2, root->render_surface()->layer_list().at(1)->id()); |
| 6133 } | 6153 } |
| 6134 | 6154 |
| 6135 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayers) { | 6155 TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayers) { |
| 6136 FakeImplProxy proxy; | 6156 FakeImplProxy proxy; |
| 6137 TestSharedBitmapManager shared_bitmap_manager; | 6157 TestSharedBitmapManager shared_bitmap_manager; |
| 6138 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); | 6158 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); |
| 6139 host_impl.CreatePendingTree(); | 6159 host_impl.CreatePendingTree(); |
| 6140 const gfx::Transform identity_matrix; | 6160 const gfx::Transform identity_matrix; |
| 6141 | 6161 |
| 6142 scoped_refptr<Layer> root = Layer::Create(); | 6162 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 6143 SetLayerPropertiesForTesting(root.get(), | 6163 SetLayerPropertiesForTesting(root.get(), |
| 6144 identity_matrix, | 6164 identity_matrix, |
| 6145 gfx::Point3F(), | 6165 gfx::Point3F(), |
| 6146 gfx::PointF(), | 6166 gfx::PointF(), |
| 6147 gfx::Size(50, 50), | 6167 gfx::Size(50, 50), |
| 6148 true, | 6168 true, |
| 6149 false); | 6169 false); |
| 6150 root->SetIsDrawable(true); | 6170 root->SetIsDrawable(true); |
| 6151 | 6171 |
| 6152 scoped_refptr<Layer> child = Layer::Create(); | 6172 scoped_refptr<Layer> child = Layer::Create(layer_settings()); |
| 6153 SetLayerPropertiesForTesting(child.get(), | 6173 SetLayerPropertiesForTesting(child.get(), |
| 6154 identity_matrix, | 6174 identity_matrix, |
| 6155 gfx::Point3F(), | 6175 gfx::Point3F(), |
| 6156 gfx::PointF(), | 6176 gfx::PointF(), |
| 6157 gfx::Size(40, 40), | 6177 gfx::Size(40, 40), |
| 6158 true, | 6178 true, |
| 6159 false); | 6179 false); |
| 6160 child->SetIsDrawable(true); | 6180 child->SetIsDrawable(true); |
| 6161 child->SetHideLayerAndSubtree(true); | 6181 child->SetHideLayerAndSubtree(true); |
| 6162 | 6182 |
| 6163 scoped_refptr<Layer> grand_child = Layer::Create(); | 6183 scoped_refptr<Layer> grand_child = Layer::Create(layer_settings()); |
| 6164 SetLayerPropertiesForTesting(grand_child.get(), | 6184 SetLayerPropertiesForTesting(grand_child.get(), |
| 6165 identity_matrix, | 6185 identity_matrix, |
| 6166 gfx::Point3F(), | 6186 gfx::Point3F(), |
| 6167 gfx::PointF(), | 6187 gfx::PointF(), |
| 6168 gfx::Size(30, 30), | 6188 gfx::Size(30, 30), |
| 6169 true, | 6189 true, |
| 6170 false); | 6190 false); |
| 6171 grand_child->SetIsDrawable(true); | 6191 grand_child->SetIsDrawable(true); |
| 6172 | 6192 |
| 6173 child->AddChild(grand_child); | 6193 child->AddChild(grand_child); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6234 | 6254 |
| 6235 void EmptyCopyOutputCallback(scoped_ptr<CopyOutputResult> result) {} | 6255 void EmptyCopyOutputCallback(scoped_ptr<CopyOutputResult> result) {} |
| 6236 | 6256 |
| 6237 TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) { | 6257 TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) { |
| 6238 FakeImplProxy proxy; | 6258 FakeImplProxy proxy; |
| 6239 TestSharedBitmapManager shared_bitmap_manager; | 6259 TestSharedBitmapManager shared_bitmap_manager; |
| 6240 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); | 6260 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); |
| 6241 host_impl.CreatePendingTree(); | 6261 host_impl.CreatePendingTree(); |
| 6242 const gfx::Transform identity_matrix; | 6262 const gfx::Transform identity_matrix; |
| 6243 | 6263 |
| 6244 scoped_refptr<Layer> root = Layer::Create(); | 6264 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 6245 SetLayerPropertiesForTesting(root.get(), | 6265 SetLayerPropertiesForTesting(root.get(), |
| 6246 identity_matrix, | 6266 identity_matrix, |
| 6247 gfx::Point3F(), | 6267 gfx::Point3F(), |
| 6248 gfx::PointF(), | 6268 gfx::PointF(), |
| 6249 gfx::Size(50, 50), | 6269 gfx::Size(50, 50), |
| 6250 true, | 6270 true, |
| 6251 false); | 6271 false); |
| 6252 root->SetIsDrawable(true); | 6272 root->SetIsDrawable(true); |
| 6253 | 6273 |
| 6254 scoped_refptr<Layer> copy_grand_parent = Layer::Create(); | 6274 scoped_refptr<Layer> copy_grand_parent = Layer::Create(layer_settings()); |
| 6255 SetLayerPropertiesForTesting(copy_grand_parent.get(), | 6275 SetLayerPropertiesForTesting(copy_grand_parent.get(), |
| 6256 identity_matrix, | 6276 identity_matrix, |
| 6257 gfx::Point3F(), | 6277 gfx::Point3F(), |
| 6258 gfx::PointF(), | 6278 gfx::PointF(), |
| 6259 gfx::Size(40, 40), | 6279 gfx::Size(40, 40), |
| 6260 true, | 6280 true, |
| 6261 false); | 6281 false); |
| 6262 copy_grand_parent->SetIsDrawable(true); | 6282 copy_grand_parent->SetIsDrawable(true); |
| 6263 | 6283 |
| 6264 scoped_refptr<Layer> copy_parent = Layer::Create(); | 6284 scoped_refptr<Layer> copy_parent = Layer::Create(layer_settings()); |
| 6265 SetLayerPropertiesForTesting(copy_parent.get(), | 6285 SetLayerPropertiesForTesting(copy_parent.get(), |
| 6266 identity_matrix, | 6286 identity_matrix, |
| 6267 gfx::Point3F(), | 6287 gfx::Point3F(), |
| 6268 gfx::PointF(), | 6288 gfx::PointF(), |
| 6269 gfx::Size(30, 30), | 6289 gfx::Size(30, 30), |
| 6270 true, | 6290 true, |
| 6271 false); | 6291 false); |
| 6272 copy_parent->SetIsDrawable(true); | 6292 copy_parent->SetIsDrawable(true); |
| 6273 copy_parent->SetForceRenderSurface(true); | 6293 copy_parent->SetForceRenderSurface(true); |
| 6274 | 6294 |
| 6275 scoped_refptr<Layer> copy_layer = Layer::Create(); | 6295 scoped_refptr<Layer> copy_layer = Layer::Create(layer_settings()); |
| 6276 SetLayerPropertiesForTesting(copy_layer.get(), | 6296 SetLayerPropertiesForTesting(copy_layer.get(), |
| 6277 identity_matrix, | 6297 identity_matrix, |
| 6278 gfx::Point3F(), | 6298 gfx::Point3F(), |
| 6279 gfx::PointF(), | 6299 gfx::PointF(), |
| 6280 gfx::Size(20, 20), | 6300 gfx::Size(20, 20), |
| 6281 true, | 6301 true, |
| 6282 false); | 6302 false); |
| 6283 copy_layer->SetIsDrawable(true); | 6303 copy_layer->SetIsDrawable(true); |
| 6284 | 6304 |
| 6285 scoped_refptr<Layer> copy_child = Layer::Create(); | 6305 scoped_refptr<Layer> copy_child = Layer::Create(layer_settings()); |
| 6286 SetLayerPropertiesForTesting(copy_child.get(), | 6306 SetLayerPropertiesForTesting(copy_child.get(), |
| 6287 identity_matrix, | 6307 identity_matrix, |
| 6288 gfx::Point3F(), | 6308 gfx::Point3F(), |
| 6289 gfx::PointF(), | 6309 gfx::PointF(), |
| 6290 gfx::Size(20, 20), | 6310 gfx::Size(20, 20), |
| 6291 true, | 6311 true, |
| 6292 false); | 6312 false); |
| 6293 copy_child->SetIsDrawable(true); | 6313 copy_child->SetIsDrawable(true); |
| 6294 | 6314 |
| 6295 scoped_refptr<Layer> copy_grand_parent_sibling_before = Layer::Create(); | 6315 scoped_refptr<Layer> copy_grand_parent_sibling_before = |
| 6316 Layer::Create(layer_settings()); |
| 6296 SetLayerPropertiesForTesting(copy_grand_parent_sibling_before.get(), | 6317 SetLayerPropertiesForTesting(copy_grand_parent_sibling_before.get(), |
| 6297 identity_matrix, | 6318 identity_matrix, |
| 6298 gfx::Point3F(), | 6319 gfx::Point3F(), |
| 6299 gfx::PointF(), | 6320 gfx::PointF(), |
| 6300 gfx::Size(40, 40), | 6321 gfx::Size(40, 40), |
| 6301 true, | 6322 true, |
| 6302 false); | 6323 false); |
| 6303 copy_grand_parent_sibling_before->SetIsDrawable(true); | 6324 copy_grand_parent_sibling_before->SetIsDrawable(true); |
| 6304 | 6325 |
| 6305 scoped_refptr<Layer> copy_grand_parent_sibling_after = Layer::Create(); | 6326 scoped_refptr<Layer> copy_grand_parent_sibling_after = |
| 6327 Layer::Create(layer_settings()); |
| 6306 SetLayerPropertiesForTesting(copy_grand_parent_sibling_after.get(), | 6328 SetLayerPropertiesForTesting(copy_grand_parent_sibling_after.get(), |
| 6307 identity_matrix, | 6329 identity_matrix, |
| 6308 gfx::Point3F(), | 6330 gfx::Point3F(), |
| 6309 gfx::PointF(), | 6331 gfx::PointF(), |
| 6310 gfx::Size(40, 40), | 6332 gfx::Size(40, 40), |
| 6311 true, | 6333 true, |
| 6312 false); | 6334 false); |
| 6313 copy_grand_parent_sibling_after->SetIsDrawable(true); | 6335 copy_grand_parent_sibling_after->SetIsDrawable(true); |
| 6314 | 6336 |
| 6315 copy_layer->AddChild(copy_child); | 6337 copy_layer->AddChild(copy_child); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6381 copy_layer->render_surface()->layer_list().at(1)->id()); | 6403 copy_layer->render_surface()->layer_list().at(1)->id()); |
| 6382 } | 6404 } |
| 6383 | 6405 |
| 6384 TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) { | 6406 TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) { |
| 6385 FakeImplProxy proxy; | 6407 FakeImplProxy proxy; |
| 6386 TestSharedBitmapManager shared_bitmap_manager; | 6408 TestSharedBitmapManager shared_bitmap_manager; |
| 6387 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); | 6409 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); |
| 6388 host_impl.CreatePendingTree(); | 6410 host_impl.CreatePendingTree(); |
| 6389 const gfx::Transform identity_matrix; | 6411 const gfx::Transform identity_matrix; |
| 6390 | 6412 |
| 6391 scoped_refptr<Layer> root = Layer::Create(); | 6413 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 6392 SetLayerPropertiesForTesting(root.get(), | 6414 SetLayerPropertiesForTesting(root.get(), |
| 6393 identity_matrix, | 6415 identity_matrix, |
| 6394 gfx::Point3F(), | 6416 gfx::Point3F(), |
| 6395 gfx::PointF(), | 6417 gfx::PointF(), |
| 6396 gfx::Size(50, 50), | 6418 gfx::Size(50, 50), |
| 6397 true, | 6419 true, |
| 6398 false); | 6420 false); |
| 6399 root->SetIsDrawable(true); | 6421 root->SetIsDrawable(true); |
| 6400 | 6422 |
| 6401 scoped_refptr<Layer> copy_parent = Layer::Create(); | 6423 scoped_refptr<Layer> copy_parent = Layer::Create(layer_settings()); |
| 6402 SetLayerPropertiesForTesting(copy_parent.get(), | 6424 SetLayerPropertiesForTesting(copy_parent.get(), |
| 6403 identity_matrix, | 6425 identity_matrix, |
| 6404 gfx::Point3F(), | 6426 gfx::Point3F(), |
| 6405 gfx::PointF(), | 6427 gfx::PointF(), |
| 6406 gfx::Size(), | 6428 gfx::Size(), |
| 6407 true, | 6429 true, |
| 6408 false); | 6430 false); |
| 6409 copy_parent->SetIsDrawable(true); | 6431 copy_parent->SetIsDrawable(true); |
| 6410 copy_parent->SetMasksToBounds(true); | 6432 copy_parent->SetMasksToBounds(true); |
| 6411 | 6433 |
| 6412 scoped_refptr<Layer> copy_layer = Layer::Create(); | 6434 scoped_refptr<Layer> copy_layer = Layer::Create(layer_settings()); |
| 6413 SetLayerPropertiesForTesting(copy_layer.get(), | 6435 SetLayerPropertiesForTesting(copy_layer.get(), |
| 6414 identity_matrix, | 6436 identity_matrix, |
| 6415 gfx::Point3F(), | 6437 gfx::Point3F(), |
| 6416 gfx::PointF(), | 6438 gfx::PointF(), |
| 6417 gfx::Size(30, 30), | 6439 gfx::Size(30, 30), |
| 6418 true, | 6440 true, |
| 6419 false); | 6441 false); |
| 6420 copy_layer->SetIsDrawable(true); | 6442 copy_layer->SetIsDrawable(true); |
| 6421 | 6443 |
| 6422 scoped_refptr<Layer> copy_child = Layer::Create(); | 6444 scoped_refptr<Layer> copy_child = Layer::Create(layer_settings()); |
| 6423 SetLayerPropertiesForTesting(copy_child.get(), | 6445 SetLayerPropertiesForTesting(copy_child.get(), |
| 6424 identity_matrix, | 6446 identity_matrix, |
| 6425 gfx::Point3F(), | 6447 gfx::Point3F(), |
| 6426 gfx::PointF(), | 6448 gfx::PointF(), |
| 6427 gfx::Size(20, 20), | 6449 gfx::Size(20, 20), |
| 6428 true, | 6450 true, |
| 6429 false); | 6451 false); |
| 6430 copy_child->SetIsDrawable(true); | 6452 copy_child->SetIsDrawable(true); |
| 6431 | 6453 |
| 6432 copy_layer->AddChild(copy_child); | 6454 copy_layer->AddChild(copy_child); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 6456 EXPECT_EQ(root->id(), root->render_surface()->layer_list().at(0)->id()); | 6478 EXPECT_EQ(root->id(), root->render_surface()->layer_list().at(0)->id()); |
| 6457 } | 6479 } |
| 6458 | 6480 |
| 6459 TEST_F(LayerTreeHostCommonTest, VisibleContentRectInsideSurface) { | 6481 TEST_F(LayerTreeHostCommonTest, VisibleContentRectInsideSurface) { |
| 6460 FakeImplProxy proxy; | 6482 FakeImplProxy proxy; |
| 6461 TestSharedBitmapManager shared_bitmap_manager; | 6483 TestSharedBitmapManager shared_bitmap_manager; |
| 6462 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); | 6484 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); |
| 6463 host_impl.CreatePendingTree(); | 6485 host_impl.CreatePendingTree(); |
| 6464 const gfx::Transform identity_matrix; | 6486 const gfx::Transform identity_matrix; |
| 6465 | 6487 |
| 6466 scoped_refptr<Layer> root = Layer::Create(); | 6488 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 6467 SetLayerPropertiesForTesting(root.get(), | 6489 SetLayerPropertiesForTesting(root.get(), |
| 6468 identity_matrix, | 6490 identity_matrix, |
| 6469 gfx::Point3F(), | 6491 gfx::Point3F(), |
| 6470 gfx::PointF(), | 6492 gfx::PointF(), |
| 6471 gfx::Size(50, 50), | 6493 gfx::Size(50, 50), |
| 6472 true, | 6494 true, |
| 6473 false); | 6495 false); |
| 6474 root->SetIsDrawable(true); | 6496 root->SetIsDrawable(true); |
| 6475 | 6497 |
| 6476 // The surface is moved slightly outside of the viewport. | 6498 // The surface is moved slightly outside of the viewport. |
| 6477 scoped_refptr<Layer> surface = Layer::Create(); | 6499 scoped_refptr<Layer> surface = Layer::Create(layer_settings()); |
| 6478 SetLayerPropertiesForTesting(surface.get(), | 6500 SetLayerPropertiesForTesting(surface.get(), |
| 6479 identity_matrix, | 6501 identity_matrix, |
| 6480 gfx::Point3F(), | 6502 gfx::Point3F(), |
| 6481 gfx::PointF(-10, -20), | 6503 gfx::PointF(-10, -20), |
| 6482 gfx::Size(), | 6504 gfx::Size(), |
| 6483 true, | 6505 true, |
| 6484 false); | 6506 false); |
| 6485 surface->SetForceRenderSurface(true); | 6507 surface->SetForceRenderSurface(true); |
| 6486 | 6508 |
| 6487 scoped_refptr<Layer> surface_child = Layer::Create(); | 6509 scoped_refptr<Layer> surface_child = Layer::Create(layer_settings()); |
| 6488 SetLayerPropertiesForTesting(surface_child.get(), | 6510 SetLayerPropertiesForTesting(surface_child.get(), |
| 6489 identity_matrix, | 6511 identity_matrix, |
| 6490 gfx::Point3F(), | 6512 gfx::Point3F(), |
| 6491 gfx::PointF(), | 6513 gfx::PointF(), |
| 6492 gfx::Size(50, 50), | 6514 gfx::Size(50, 50), |
| 6493 true, | 6515 true, |
| 6494 false); | 6516 false); |
| 6495 surface_child->SetIsDrawable(true); | 6517 surface_child->SetIsDrawable(true); |
| 6496 | 6518 |
| 6497 surface->AddChild(surface_child); | 6519 surface->AddChild(surface_child); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 6517 // problem. Constructs the following layer tree. | 6539 // problem. Constructs the following layer tree. |
| 6518 // | 6540 // |
| 6519 // root (a render surface) | 6541 // root (a render surface) |
| 6520 // + render_surface | 6542 // + render_surface |
| 6521 // + clip_parent (scaled) | 6543 // + clip_parent (scaled) |
| 6522 // + intervening_clipping_layer | 6544 // + intervening_clipping_layer |
| 6523 // + clip_child | 6545 // + clip_child |
| 6524 // | 6546 // |
| 6525 // The render surface should be resized correctly and the clip child should | 6547 // The render surface should be resized correctly and the clip child should |
| 6526 // inherit the right clip rect. | 6548 // inherit the right clip rect. |
| 6527 scoped_refptr<Layer> root = Layer::Create(); | 6549 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 6528 scoped_refptr<Layer> render_surface = Layer::Create(); | 6550 scoped_refptr<Layer> render_surface = Layer::Create(layer_settings()); |
| 6529 scoped_refptr<Layer> clip_parent = Layer::Create(); | 6551 scoped_refptr<Layer> clip_parent = Layer::Create(layer_settings()); |
| 6530 scoped_refptr<Layer> intervening = Layer::Create(); | 6552 scoped_refptr<Layer> intervening = Layer::Create(layer_settings()); |
| 6531 scoped_refptr<LayerWithForcedDrawsContent> clip_child = | 6553 scoped_refptr<LayerWithForcedDrawsContent> clip_child = |
| 6532 make_scoped_refptr(new LayerWithForcedDrawsContent); | 6554 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 6533 | 6555 |
| 6534 root->AddChild(render_surface); | 6556 root->AddChild(render_surface); |
| 6535 render_surface->AddChild(clip_parent); | 6557 render_surface->AddChild(clip_parent); |
| 6536 clip_parent->AddChild(intervening); | 6558 clip_parent->AddChild(intervening); |
| 6537 intervening->AddChild(clip_child); | 6559 intervening->AddChild(clip_child); |
| 6538 | 6560 |
| 6539 clip_child->SetClipParent(clip_parent.get()); | 6561 clip_child->SetClipParent(clip_parent.get()); |
| 6540 | 6562 |
| 6541 intervening->SetMasksToBounds(true); | 6563 intervening->SetMasksToBounds(true); |
| 6542 clip_parent->SetMasksToBounds(true); | 6564 clip_parent->SetMasksToBounds(true); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6619 // case. In the following tree, both render surfaces should be resized to | 6641 // case. In the following tree, both render surfaces should be resized to |
| 6620 // accomodate for the clip child, despite an intervening clip. | 6642 // accomodate for the clip child, despite an intervening clip. |
| 6621 // | 6643 // |
| 6622 // root (a render surface) | 6644 // root (a render surface) |
| 6623 // + clip_parent (masks to bounds) | 6645 // + clip_parent (masks to bounds) |
| 6624 // + render_surface1 (sets opacity) | 6646 // + render_surface1 (sets opacity) |
| 6625 // + intervening (masks to bounds) | 6647 // + intervening (masks to bounds) |
| 6626 // + render_surface2 (also sets opacity) | 6648 // + render_surface2 (also sets opacity) |
| 6627 // + clip_child | 6649 // + clip_child |
| 6628 // | 6650 // |
| 6629 scoped_refptr<Layer> root = Layer::Create(); | 6651 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 6630 scoped_refptr<Layer> clip_parent = Layer::Create(); | 6652 scoped_refptr<Layer> clip_parent = Layer::Create(layer_settings()); |
| 6631 scoped_refptr<Layer> render_surface1 = Layer::Create(); | 6653 scoped_refptr<Layer> render_surface1 = Layer::Create(layer_settings()); |
| 6632 scoped_refptr<Layer> intervening = Layer::Create(); | 6654 scoped_refptr<Layer> intervening = Layer::Create(layer_settings()); |
| 6633 scoped_refptr<Layer> render_surface2 = Layer::Create(); | 6655 scoped_refptr<Layer> render_surface2 = Layer::Create(layer_settings()); |
| 6634 scoped_refptr<LayerWithForcedDrawsContent> clip_child = | 6656 scoped_refptr<LayerWithForcedDrawsContent> clip_child = |
| 6635 make_scoped_refptr(new LayerWithForcedDrawsContent); | 6657 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 6636 | 6658 |
| 6637 root->AddChild(clip_parent); | 6659 root->AddChild(clip_parent); |
| 6638 clip_parent->AddChild(render_surface1); | 6660 clip_parent->AddChild(render_surface1); |
| 6639 render_surface1->AddChild(intervening); | 6661 render_surface1->AddChild(intervening); |
| 6640 intervening->AddChild(render_surface2); | 6662 intervening->AddChild(render_surface2); |
| 6641 render_surface2->AddChild(clip_child); | 6663 render_surface2->AddChild(clip_child); |
| 6642 | 6664 |
| 6643 clip_child->SetClipParent(clip_parent.get()); | 6665 clip_child->SetClipParent(clip_parent.get()); |
| 6644 | 6666 |
| 6645 intervening->SetMasksToBounds(true); | 6667 intervening->SetMasksToBounds(true); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6746 // is a scroll involved. Note, we do _not_ have to consider any other sort | 6768 // is a scroll involved. Note, we do _not_ have to consider any other sort |
| 6747 // of transform. | 6769 // of transform. |
| 6748 // | 6770 // |
| 6749 // root (a render surface) | 6771 // root (a render surface) |
| 6750 // + clip_parent (masks to bounds) | 6772 // + clip_parent (masks to bounds) |
| 6751 // + render_surface1 (sets opacity) | 6773 // + render_surface1 (sets opacity) |
| 6752 // + intervening (masks to bounds AND scrolls) | 6774 // + intervening (masks to bounds AND scrolls) |
| 6753 // + render_surface2 (also sets opacity) | 6775 // + render_surface2 (also sets opacity) |
| 6754 // + clip_child | 6776 // + clip_child |
| 6755 // | 6777 // |
| 6756 scoped_refptr<Layer> root = Layer::Create(); | 6778 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 6757 scoped_refptr<Layer> clip_parent = Layer::Create(); | 6779 scoped_refptr<Layer> clip_parent = Layer::Create(layer_settings()); |
| 6758 scoped_refptr<Layer> render_surface1 = Layer::Create(); | 6780 scoped_refptr<Layer> render_surface1 = Layer::Create(layer_settings()); |
| 6759 scoped_refptr<Layer> intervening = Layer::Create(); | 6781 scoped_refptr<Layer> intervening = Layer::Create(layer_settings()); |
| 6760 scoped_refptr<Layer> render_surface2 = Layer::Create(); | 6782 scoped_refptr<Layer> render_surface2 = Layer::Create(layer_settings()); |
| 6761 scoped_refptr<LayerWithForcedDrawsContent> clip_child = | 6783 scoped_refptr<LayerWithForcedDrawsContent> clip_child = |
| 6762 make_scoped_refptr(new LayerWithForcedDrawsContent); | 6784 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 6763 | 6785 |
| 6764 root->AddChild(clip_parent); | 6786 root->AddChild(clip_parent); |
| 6765 clip_parent->AddChild(render_surface1); | 6787 clip_parent->AddChild(render_surface1); |
| 6766 render_surface1->AddChild(intervening); | 6788 render_surface1->AddChild(intervening); |
| 6767 intervening->AddChild(render_surface2); | 6789 intervening->AddChild(render_surface2); |
| 6768 render_surface2->AddChild(clip_child); | 6790 render_surface2->AddChild(clip_child); |
| 6769 | 6791 |
| 6770 clip_child->SetClipParent(clip_parent.get()); | 6792 clip_child->SetClipParent(clip_parent.get()); |
| 6771 | 6793 |
| 6772 intervening->SetMasksToBounds(true); | 6794 intervening->SetMasksToBounds(true); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6872 | 6894 |
| 6873 TEST_F(LayerTreeHostCommonTest, DescendantsOfClipChildren) { | 6895 TEST_F(LayerTreeHostCommonTest, DescendantsOfClipChildren) { |
| 6874 // Ensures that descendants of the clip child inherit the correct clip. | 6896 // Ensures that descendants of the clip child inherit the correct clip. |
| 6875 // | 6897 // |
| 6876 // root (a render surface) | 6898 // root (a render surface) |
| 6877 // + clip_parent (masks to bounds) | 6899 // + clip_parent (masks to bounds) |
| 6878 // + intervening (masks to bounds) | 6900 // + intervening (masks to bounds) |
| 6879 // + clip_child | 6901 // + clip_child |
| 6880 // + child | 6902 // + child |
| 6881 // | 6903 // |
| 6882 scoped_refptr<Layer> root = Layer::Create(); | 6904 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 6883 scoped_refptr<Layer> clip_parent = Layer::Create(); | 6905 scoped_refptr<Layer> clip_parent = Layer::Create(layer_settings()); |
| 6884 scoped_refptr<Layer> intervening = Layer::Create(); | 6906 scoped_refptr<Layer> intervening = Layer::Create(layer_settings()); |
| 6885 scoped_refptr<Layer> clip_child = Layer::Create(); | 6907 scoped_refptr<Layer> clip_child = Layer::Create(layer_settings()); |
| 6886 scoped_refptr<LayerWithForcedDrawsContent> child = | 6908 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 6887 make_scoped_refptr(new LayerWithForcedDrawsContent); | 6909 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 6888 | 6910 |
| 6889 root->AddChild(clip_parent); | 6911 root->AddChild(clip_parent); |
| 6890 clip_parent->AddChild(intervening); | 6912 clip_parent->AddChild(intervening); |
| 6891 intervening->AddChild(clip_child); | 6913 intervening->AddChild(clip_child); |
| 6892 clip_child->AddChild(child); | 6914 clip_child->AddChild(child); |
| 6893 | 6915 |
| 6894 clip_child->SetClipParent(clip_parent.get()); | 6916 clip_child->SetClipParent(clip_parent.get()); |
| 6895 | 6917 |
| 6896 intervening->SetMasksToBounds(true); | 6918 intervening->SetMasksToBounds(true); |
| 6897 clip_parent->SetMasksToBounds(true); | 6919 clip_parent->SetMasksToBounds(true); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6956 // render surfaces. | 6978 // render surfaces. |
| 6957 // | 6979 // |
| 6958 // root (a render surface) | 6980 // root (a render surface) |
| 6959 // + clip_parent (masks to bounds) | 6981 // + clip_parent (masks to bounds) |
| 6960 // + render_surface1 | 6982 // + render_surface1 |
| 6961 // + clip_child | 6983 // + clip_child |
| 6962 // + render_surface2 | 6984 // + render_surface2 |
| 6963 // + non_clip_child | 6985 // + non_clip_child |
| 6964 // | 6986 // |
| 6965 // In this example render_surface2 should be unaffected by clip_child. | 6987 // In this example render_surface2 should be unaffected by clip_child. |
| 6966 scoped_refptr<Layer> root = Layer::Create(); | 6988 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 6967 scoped_refptr<Layer> clip_parent = Layer::Create(); | 6989 scoped_refptr<Layer> clip_parent = Layer::Create(layer_settings()); |
| 6968 scoped_refptr<Layer> render_surface1 = Layer::Create(); | 6990 scoped_refptr<Layer> render_surface1 = Layer::Create(layer_settings()); |
| 6969 scoped_refptr<LayerWithForcedDrawsContent> clip_child = | 6991 scoped_refptr<LayerWithForcedDrawsContent> clip_child = |
| 6970 make_scoped_refptr(new LayerWithForcedDrawsContent); | 6992 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 6971 scoped_refptr<Layer> render_surface2 = Layer::Create(); | 6993 scoped_refptr<Layer> render_surface2 = Layer::Create(layer_settings()); |
| 6972 scoped_refptr<LayerWithForcedDrawsContent> non_clip_child = | 6994 scoped_refptr<LayerWithForcedDrawsContent> non_clip_child = |
| 6973 make_scoped_refptr(new LayerWithForcedDrawsContent); | 6995 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 6974 | 6996 |
| 6975 root->AddChild(clip_parent); | 6997 root->AddChild(clip_parent); |
| 6976 clip_parent->AddChild(render_surface1); | 6998 clip_parent->AddChild(render_surface1); |
| 6977 render_surface1->AddChild(clip_child); | 6999 render_surface1->AddChild(clip_child); |
| 6978 clip_parent->AddChild(render_surface2); | 7000 clip_parent->AddChild(render_surface2); |
| 6979 render_surface2->AddChild(non_clip_child); | 7001 render_surface2->AddChild(non_clip_child); |
| 6980 | 7002 |
| 6981 clip_child->SetClipParent(clip_parent.get()); | 7003 clip_child->SetClipParent(clip_parent.get()); |
| 6982 | 7004 |
| 6983 clip_parent->SetMasksToBounds(true); | 7005 clip_parent->SetMasksToBounds(true); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7165 // Only root layer has a render surface. | 7187 // Only root layer has a render surface. |
| 7166 EXPECT_EQ(1, count_represents_target_render_surface); | 7188 EXPECT_EQ(1, count_represents_target_render_surface); |
| 7167 // No layer contributes a render surface to root render surface. | 7189 // No layer contributes a render surface to root render surface. |
| 7168 EXPECT_EQ(0, count_represents_contributing_render_surface); | 7190 EXPECT_EQ(0, count_represents_contributing_render_surface); |
| 7169 // All 4 layers represent itself. | 7191 // All 4 layers represent itself. |
| 7170 EXPECT_EQ(4, count_represents_itself); | 7192 EXPECT_EQ(4, count_represents_itself); |
| 7171 } | 7193 } |
| 7172 } | 7194 } |
| 7173 | 7195 |
| 7174 TEST_F(LayerTreeHostCommonTest, DoNotIncludeBackfaceInvisibleSurfaces) { | 7196 TEST_F(LayerTreeHostCommonTest, DoNotIncludeBackfaceInvisibleSurfaces) { |
| 7175 scoped_refptr<Layer> root = Layer::Create(); | 7197 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 7176 scoped_refptr<Layer> render_surface = Layer::Create(); | 7198 scoped_refptr<Layer> render_surface = Layer::Create(layer_settings()); |
| 7177 scoped_refptr<LayerWithForcedDrawsContent> child = | 7199 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 7178 make_scoped_refptr(new LayerWithForcedDrawsContent); | 7200 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7179 | 7201 |
| 7180 root->AddChild(render_surface); | 7202 root->AddChild(render_surface); |
| 7181 render_surface->AddChild(child); | 7203 render_surface->AddChild(child); |
| 7182 | 7204 |
| 7183 gfx::Transform identity_transform; | 7205 gfx::Transform identity_transform; |
| 7184 SetLayerPropertiesForTesting(root.get(), | 7206 SetLayerPropertiesForTesting(root.get(), |
| 7185 identity_transform, | 7207 identity_transform, |
| 7186 gfx::Point3F(), | 7208 gfx::Point3F(), |
| 7187 gfx::PointF(), | 7209 gfx::PointF(), |
| 7188 gfx::Size(50, 50), | 7210 gfx::Size(50, 50), |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7237 TEST_F(LayerTreeHostCommonTest, ClippedByScrollParent) { | 7259 TEST_F(LayerTreeHostCommonTest, ClippedByScrollParent) { |
| 7238 // Checks that the simple case (being clipped by a scroll parent that would | 7260 // Checks that the simple case (being clipped by a scroll parent that would |
| 7239 // have been processed before you anyhow) results in the right clips. | 7261 // have been processed before you anyhow) results in the right clips. |
| 7240 // | 7262 // |
| 7241 // + root | 7263 // + root |
| 7242 // + scroll_parent_border | 7264 // + scroll_parent_border |
| 7243 // | + scroll_parent_clip | 7265 // | + scroll_parent_clip |
| 7244 // | + scroll_parent | 7266 // | + scroll_parent |
| 7245 // + scroll_child | 7267 // + scroll_child |
| 7246 // | 7268 // |
| 7247 scoped_refptr<Layer> root = Layer::Create(); | 7269 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 7248 scoped_refptr<Layer> scroll_parent_border = Layer::Create(); | 7270 scoped_refptr<Layer> scroll_parent_border = Layer::Create(layer_settings()); |
| 7249 scoped_refptr<Layer> scroll_parent_clip = Layer::Create(); | 7271 scoped_refptr<Layer> scroll_parent_clip = Layer::Create(layer_settings()); |
| 7250 scoped_refptr<LayerWithForcedDrawsContent> scroll_parent = | 7272 scoped_refptr<LayerWithForcedDrawsContent> scroll_parent = |
| 7251 make_scoped_refptr(new LayerWithForcedDrawsContent); | 7273 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7252 scoped_refptr<LayerWithForcedDrawsContent> scroll_child = | 7274 scoped_refptr<LayerWithForcedDrawsContent> scroll_child = |
| 7253 make_scoped_refptr(new LayerWithForcedDrawsContent); | 7275 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7254 | 7276 |
| 7255 root->AddChild(scroll_child); | 7277 root->AddChild(scroll_child); |
| 7256 | 7278 |
| 7257 root->AddChild(scroll_parent_border); | 7279 root->AddChild(scroll_parent_border); |
| 7258 scroll_parent_border->AddChild(scroll_parent_clip); | 7280 scroll_parent_border->AddChild(scroll_parent_clip); |
| 7259 scroll_parent_clip->AddChild(scroll_parent); | 7281 scroll_parent_clip->AddChild(scroll_parent); |
| 7260 | 7282 |
| 7261 scroll_parent_clip->SetMasksToBounds(true); | 7283 scroll_parent_clip->SetMasksToBounds(true); |
| 7262 | 7284 |
| 7263 scroll_child->SetScrollParent(scroll_parent.get()); | 7285 scroll_child->SetScrollParent(scroll_parent.get()); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7306 | 7328 |
| 7307 EXPECT_TRUE(root->render_surface()); | 7329 EXPECT_TRUE(root->render_surface()); |
| 7308 | 7330 |
| 7309 EXPECT_EQ(gfx::Rect(0, 0, 30, 30).ToString(), | 7331 EXPECT_EQ(gfx::Rect(0, 0, 30, 30).ToString(), |
| 7310 scroll_child->clip_rect().ToString()); | 7332 scroll_child->clip_rect().ToString()); |
| 7311 EXPECT_TRUE(scroll_child->is_clipped()); | 7333 EXPECT_TRUE(scroll_child->is_clipped()); |
| 7312 } | 7334 } |
| 7313 | 7335 |
| 7314 TEST_F(LayerTreeHostCommonTest, SingularTransformSubtreesDoNotDraw) { | 7336 TEST_F(LayerTreeHostCommonTest, SingularTransformSubtreesDoNotDraw) { |
| 7315 scoped_refptr<LayerWithForcedDrawsContent> root = | 7337 scoped_refptr<LayerWithForcedDrawsContent> root = |
| 7316 make_scoped_refptr(new LayerWithForcedDrawsContent); | 7338 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7317 scoped_refptr<LayerWithForcedDrawsContent> parent = | 7339 scoped_refptr<LayerWithForcedDrawsContent> parent = |
| 7318 make_scoped_refptr(new LayerWithForcedDrawsContent); | 7340 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7319 scoped_refptr<LayerWithForcedDrawsContent> child = | 7341 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 7320 make_scoped_refptr(new LayerWithForcedDrawsContent); | 7342 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7321 | 7343 |
| 7322 root->AddChild(parent); | 7344 root->AddChild(parent); |
| 7323 parent->AddChild(child); | 7345 parent->AddChild(child); |
| 7324 | 7346 |
| 7325 gfx::Transform identity_transform; | 7347 gfx::Transform identity_transform; |
| 7326 SetLayerPropertiesForTesting(root.get(), | 7348 SetLayerPropertiesForTesting(root.get(), |
| 7327 identity_transform, | 7349 identity_transform, |
| 7328 gfx::Point3F(), | 7350 gfx::Point3F(), |
| 7329 gfx::PointF(), | 7351 gfx::PointF(), |
| 7330 gfx::Size(50, 50), | 7352 gfx::Size(50, 50), |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7378 TEST_F(LayerTreeHostCommonTest, ClippedByOutOfOrderScrollParent) { | 7400 TEST_F(LayerTreeHostCommonTest, ClippedByOutOfOrderScrollParent) { |
| 7379 // Checks that clipping by a scroll parent that follows you in paint order | 7401 // Checks that clipping by a scroll parent that follows you in paint order |
| 7380 // still results in correct clipping. | 7402 // still results in correct clipping. |
| 7381 // | 7403 // |
| 7382 // + root | 7404 // + root |
| 7383 // + scroll_child | 7405 // + scroll_child |
| 7384 // + scroll_parent_border | 7406 // + scroll_parent_border |
| 7385 // + scroll_parent_clip | 7407 // + scroll_parent_clip |
| 7386 // + scroll_parent | 7408 // + scroll_parent |
| 7387 // | 7409 // |
| 7388 scoped_refptr<Layer> root = Layer::Create(); | 7410 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 7389 scoped_refptr<Layer> scroll_parent_border = Layer::Create(); | 7411 scoped_refptr<Layer> scroll_parent_border = Layer::Create(layer_settings()); |
| 7390 scoped_refptr<Layer> scroll_parent_clip = Layer::Create(); | 7412 scoped_refptr<Layer> scroll_parent_clip = Layer::Create(layer_settings()); |
| 7391 scoped_refptr<LayerWithForcedDrawsContent> scroll_parent = | 7413 scoped_refptr<LayerWithForcedDrawsContent> scroll_parent = |
| 7392 make_scoped_refptr(new LayerWithForcedDrawsContent); | 7414 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7393 scoped_refptr<LayerWithForcedDrawsContent> scroll_child = | 7415 scoped_refptr<LayerWithForcedDrawsContent> scroll_child = |
| 7394 make_scoped_refptr(new LayerWithForcedDrawsContent); | 7416 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7395 | 7417 |
| 7396 root->AddChild(scroll_parent_border); | 7418 root->AddChild(scroll_parent_border); |
| 7397 scroll_parent_border->AddChild(scroll_parent_clip); | 7419 scroll_parent_border->AddChild(scroll_parent_clip); |
| 7398 scroll_parent_clip->AddChild(scroll_parent); | 7420 scroll_parent_clip->AddChild(scroll_parent); |
| 7399 | 7421 |
| 7400 root->AddChild(scroll_child); | 7422 root->AddChild(scroll_child); |
| 7401 | 7423 |
| 7402 scroll_parent_clip->SetMasksToBounds(true); | 7424 scroll_parent_clip->SetMasksToBounds(true); |
| 7403 | 7425 |
| 7404 scroll_child->SetScrollParent(scroll_parent.get()); | 7426 scroll_child->SetScrollParent(scroll_parent.get()); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7458 // | 7480 // |
| 7459 // + root | 7481 // + root |
| 7460 // + scroll_child | 7482 // + scroll_child |
| 7461 // + scroll_parent_border | 7483 // + scroll_parent_border |
| 7462 // | + scroll_parent_clip | 7484 // | + scroll_parent_clip |
| 7463 // | + scroll_parent | 7485 // | + scroll_parent |
| 7464 // + scroll_grandparent_border | 7486 // + scroll_grandparent_border |
| 7465 // + scroll_grandparent_clip | 7487 // + scroll_grandparent_clip |
| 7466 // + scroll_grandparent | 7488 // + scroll_grandparent |
| 7467 // | 7489 // |
| 7468 scoped_refptr<Layer> root = Layer::Create(); | 7490 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 7469 scoped_refptr<Layer> scroll_parent_border = Layer::Create(); | 7491 scoped_refptr<Layer> scroll_parent_border = Layer::Create(layer_settings()); |
| 7470 scoped_refptr<Layer> scroll_parent_clip = Layer::Create(); | 7492 scoped_refptr<Layer> scroll_parent_clip = Layer::Create(layer_settings()); |
| 7471 scoped_refptr<LayerWithForcedDrawsContent> scroll_parent = | 7493 scoped_refptr<LayerWithForcedDrawsContent> scroll_parent = |
| 7472 make_scoped_refptr(new LayerWithForcedDrawsContent); | 7494 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7473 | 7495 |
| 7474 scoped_refptr<Layer> scroll_grandparent_border = Layer::Create(); | 7496 scoped_refptr<Layer> scroll_grandparent_border = |
| 7475 scoped_refptr<Layer> scroll_grandparent_clip = Layer::Create(); | 7497 Layer::Create(layer_settings()); |
| 7498 scoped_refptr<Layer> scroll_grandparent_clip = |
| 7499 Layer::Create(layer_settings()); |
| 7476 scoped_refptr<LayerWithForcedDrawsContent> scroll_grandparent = | 7500 scoped_refptr<LayerWithForcedDrawsContent> scroll_grandparent = |
| 7477 make_scoped_refptr(new LayerWithForcedDrawsContent); | 7501 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7478 | 7502 |
| 7479 scoped_refptr<LayerWithForcedDrawsContent> scroll_child = | 7503 scoped_refptr<LayerWithForcedDrawsContent> scroll_child = |
| 7480 make_scoped_refptr(new LayerWithForcedDrawsContent); | 7504 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7481 | 7505 |
| 7482 root->AddChild(scroll_child); | 7506 root->AddChild(scroll_child); |
| 7483 | 7507 |
| 7484 root->AddChild(scroll_parent_border); | 7508 root->AddChild(scroll_parent_border); |
| 7485 scroll_parent_border->AddChild(scroll_parent_clip); | 7509 scroll_parent_border->AddChild(scroll_parent_clip); |
| 7486 scroll_parent_clip->AddChild(scroll_parent); | 7510 scroll_parent_clip->AddChild(scroll_parent); |
| 7487 | 7511 |
| 7488 root->AddChild(scroll_grandparent_border); | 7512 root->AddChild(scroll_grandparent_border); |
| 7489 scroll_grandparent_border->AddChild(scroll_grandparent_clip); | 7513 scroll_grandparent_border->AddChild(scroll_grandparent_clip); |
| 7490 scroll_grandparent_clip->AddChild(scroll_grandparent); | 7514 scroll_grandparent_clip->AddChild(scroll_grandparent); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7583 // + scroll_parent_border | 7607 // + scroll_parent_border |
| 7584 // + scroll_parent_clip | 7608 // + scroll_parent_clip |
| 7585 // + scroll_parent | 7609 // + scroll_parent |
| 7586 // + render_surface1 | 7610 // + render_surface1 |
| 7587 // + scroll_grandparent_border | 7611 // + scroll_grandparent_border |
| 7588 // + scroll_grandparent_clip | 7612 // + scroll_grandparent_clip |
| 7589 // + scroll_grandparent | 7613 // + scroll_grandparent |
| 7590 // + render_surface2 | 7614 // + render_surface2 |
| 7591 // | 7615 // |
| 7592 scoped_refptr<LayerWithForcedDrawsContent> root = | 7616 scoped_refptr<LayerWithForcedDrawsContent> root = |
| 7593 make_scoped_refptr(new LayerWithForcedDrawsContent); | 7617 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7594 | 7618 |
| 7595 scoped_refptr<Layer> scroll_parent_border = Layer::Create(); | 7619 scoped_refptr<Layer> scroll_parent_border = Layer::Create(layer_settings()); |
| 7596 scoped_refptr<Layer> scroll_parent_clip = Layer::Create(); | 7620 scoped_refptr<Layer> scroll_parent_clip = Layer::Create(layer_settings()); |
| 7597 scoped_refptr<LayerWithForcedDrawsContent> scroll_parent = | 7621 scoped_refptr<LayerWithForcedDrawsContent> scroll_parent = |
| 7598 make_scoped_refptr(new LayerWithForcedDrawsContent); | 7622 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7599 scoped_refptr<LayerWithForcedDrawsContent> render_surface1 = | 7623 scoped_refptr<LayerWithForcedDrawsContent> render_surface1 = |
| 7600 make_scoped_refptr(new LayerWithForcedDrawsContent); | 7624 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7601 | 7625 |
| 7602 scoped_refptr<Layer> scroll_grandparent_border = Layer::Create(); | 7626 scoped_refptr<Layer> scroll_grandparent_border = |
| 7603 scoped_refptr<Layer> scroll_grandparent_clip = Layer::Create(); | 7627 Layer::Create(layer_settings()); |
| 7628 scoped_refptr<Layer> scroll_grandparent_clip = |
| 7629 Layer::Create(layer_settings()); |
| 7604 scoped_refptr<LayerWithForcedDrawsContent> scroll_grandparent = | 7630 scoped_refptr<LayerWithForcedDrawsContent> scroll_grandparent = |
| 7605 make_scoped_refptr(new LayerWithForcedDrawsContent); | 7631 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7606 scoped_refptr<LayerWithForcedDrawsContent> render_surface2 = | 7632 scoped_refptr<LayerWithForcedDrawsContent> render_surface2 = |
| 7607 make_scoped_refptr(new LayerWithForcedDrawsContent); | 7633 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7608 | 7634 |
| 7609 scoped_refptr<LayerWithForcedDrawsContent> scroll_child = | 7635 scoped_refptr<LayerWithForcedDrawsContent> scroll_child = |
| 7610 make_scoped_refptr(new LayerWithForcedDrawsContent); | 7636 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7611 | 7637 |
| 7612 root->AddChild(scroll_child); | 7638 root->AddChild(scroll_child); |
| 7613 | 7639 |
| 7614 root->AddChild(scroll_parent_border); | 7640 root->AddChild(scroll_parent_border); |
| 7615 scroll_parent_border->AddChild(scroll_parent_clip); | 7641 scroll_parent_border->AddChild(scroll_parent_clip); |
| 7616 scroll_parent_clip->AddChild(scroll_parent); | 7642 scroll_parent_clip->AddChild(scroll_parent); |
| 7617 scroll_parent->AddChild(render_surface2); | 7643 scroll_parent->AddChild(render_surface2); |
| 7618 | 7644 |
| 7619 root->AddChild(scroll_grandparent_border); | 7645 root->AddChild(scroll_grandparent_border); |
| 7620 scroll_grandparent_border->AddChild(scroll_grandparent_clip); | 7646 scroll_grandparent_border->AddChild(scroll_grandparent_clip); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7735 // Ensures that when we have a render surface between a fixed position layer | 7761 // Ensures that when we have a render surface between a fixed position layer |
| 7736 // and its container, we compute the fixed position layer's draw transform | 7762 // and its container, we compute the fixed position layer's draw transform |
| 7737 // with respect to that intervening render surface, not with respect to its | 7763 // with respect to that intervening render surface, not with respect to its |
| 7738 // container's render target. | 7764 // container's render target. |
| 7739 // | 7765 // |
| 7740 // + root | 7766 // + root |
| 7741 // + render_surface | 7767 // + render_surface |
| 7742 // + fixed | 7768 // + fixed |
| 7743 // + child | 7769 // + child |
| 7744 // | 7770 // |
| 7745 scoped_refptr<Layer> root = Layer::Create(); | 7771 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 7746 scoped_refptr<LayerWithForcedDrawsContent> render_surface = | 7772 scoped_refptr<LayerWithForcedDrawsContent> render_surface = |
| 7747 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 7773 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7748 scoped_refptr<LayerWithForcedDrawsContent> fixed = | 7774 scoped_refptr<LayerWithForcedDrawsContent> fixed = |
| 7749 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 7775 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7750 scoped_refptr<LayerWithForcedDrawsContent> child = | 7776 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 7751 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 7777 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 7752 | 7778 |
| 7753 root->AddChild(render_surface); | 7779 root->AddChild(render_surface); |
| 7754 render_surface->AddChild(fixed); | 7780 render_surface->AddChild(fixed); |
| 7755 fixed->AddChild(child); | 7781 fixed->AddChild(child); |
| 7756 | 7782 |
| 7757 root->SetIsContainerForFixedPositionLayers(true); | 7783 root->SetIsContainerForFixedPositionLayers(true); |
| 7758 render_surface->SetForceRenderSurface(true); | 7784 render_surface->SetForceRenderSurface(true); |
| 7759 | 7785 |
| 7760 LayerPositionConstraint constraint; | 7786 LayerPositionConstraint constraint; |
| 7761 constraint.set_is_fixed_position(true); | 7787 constraint.set_is_fixed_position(true); |
| (...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8720 4.f, child1_layer->mask_layer()->draw_properties().device_scale_factor); | 8746 4.f, child1_layer->mask_layer()->draw_properties().device_scale_factor); |
| 8721 EXPECT_FLOAT_EQ(4.f, | 8747 EXPECT_FLOAT_EQ(4.f, |
| 8722 child1_layer->replica_layer() | 8748 child1_layer->replica_layer() |
| 8723 ->mask_layer() | 8749 ->mask_layer() |
| 8724 ->draw_properties() | 8750 ->draw_properties() |
| 8725 .device_scale_factor); | 8751 .device_scale_factor); |
| 8726 EXPECT_FLOAT_EQ(4.f, child2_layer->draw_properties().device_scale_factor); | 8752 EXPECT_FLOAT_EQ(4.f, child2_layer->draw_properties().device_scale_factor); |
| 8727 } | 8753 } |
| 8728 | 8754 |
| 8729 TEST_F(LayerTreeHostCommonTest, VisibleContentRectInChildRenderSurface) { | 8755 TEST_F(LayerTreeHostCommonTest, VisibleContentRectInChildRenderSurface) { |
| 8730 scoped_refptr<Layer> root = Layer::Create(); | 8756 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 8731 SetLayerPropertiesForTesting(root.get(), | 8757 SetLayerPropertiesForTesting(root.get(), |
| 8732 gfx::Transform(), | 8758 gfx::Transform(), |
| 8733 gfx::Point3F(), | 8759 gfx::Point3F(), |
| 8734 gfx::PointF(), | 8760 gfx::PointF(), |
| 8735 gfx::Size(768 / 2, 3000), | 8761 gfx::Size(768 / 2, 3000), |
| 8736 true, | 8762 true, |
| 8737 false); | 8763 false); |
| 8738 root->SetIsDrawable(true); | 8764 root->SetIsDrawable(true); |
| 8739 | 8765 |
| 8740 scoped_refptr<Layer> clip = Layer::Create(); | 8766 scoped_refptr<Layer> clip = Layer::Create(layer_settings()); |
| 8741 SetLayerPropertiesForTesting(clip.get(), | 8767 SetLayerPropertiesForTesting(clip.get(), |
| 8742 gfx::Transform(), | 8768 gfx::Transform(), |
| 8743 gfx::Point3F(), | 8769 gfx::Point3F(), |
| 8744 gfx::PointF(), | 8770 gfx::PointF(), |
| 8745 gfx::Size(768 / 2, 10000), | 8771 gfx::Size(768 / 2, 10000), |
| 8746 true, | 8772 true, |
| 8747 false); | 8773 false); |
| 8748 clip->SetMasksToBounds(true); | 8774 clip->SetMasksToBounds(true); |
| 8749 | 8775 |
| 8750 scoped_refptr<Layer> content = Layer::Create(); | 8776 scoped_refptr<Layer> content = Layer::Create(layer_settings()); |
| 8751 SetLayerPropertiesForTesting(content.get(), | 8777 SetLayerPropertiesForTesting(content.get(), |
| 8752 gfx::Transform(), | 8778 gfx::Transform(), |
| 8753 gfx::Point3F(), | 8779 gfx::Point3F(), |
| 8754 gfx::PointF(), | 8780 gfx::PointF(), |
| 8755 gfx::Size(768 / 2, 10000), | 8781 gfx::Size(768 / 2, 10000), |
| 8756 true, | 8782 true, |
| 8757 false); | 8783 false); |
| 8758 content->SetIsDrawable(true); | 8784 content->SetIsDrawable(true); |
| 8759 content->SetForceRenderSurface(true); | 8785 content->SetForceRenderSurface(true); |
| 8760 | 8786 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8843 | 8869 |
| 8844 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 8870 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 8845 | 8871 |
| 8846 gfx::Rect affected_by_delta(0, 0, root_size.width(), | 8872 gfx::Rect affected_by_delta(0, 0, root_size.width(), |
| 8847 root_size.height() + 50); | 8873 root_size.height() + 50); |
| 8848 EXPECT_EQ(affected_by_delta, sublayer->visible_content_rect()); | 8874 EXPECT_EQ(affected_by_delta, sublayer->visible_content_rect()); |
| 8849 } | 8875 } |
| 8850 | 8876 |
| 8851 TEST_F(LayerTreeHostCommonTest, VisibleContentRectForAnimatedLayer) { | 8877 TEST_F(LayerTreeHostCommonTest, VisibleContentRectForAnimatedLayer) { |
| 8852 const gfx::Transform identity_matrix; | 8878 const gfx::Transform identity_matrix; |
| 8853 scoped_refptr<Layer> root = Layer::Create(); | 8879 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 8854 scoped_refptr<LayerWithForcedDrawsContent> animated = | 8880 scoped_refptr<LayerWithForcedDrawsContent> animated = |
| 8855 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 8881 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 8856 | 8882 |
| 8857 root->AddChild(animated); | 8883 root->AddChild(animated); |
| 8858 | 8884 |
| 8859 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 8885 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 8860 host->SetRootLayer(root); | 8886 host->SetRootLayer(root); |
| 8861 | 8887 |
| 8862 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), | 8888 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
| 8863 gfx::PointF(), gfx::Size(100, 100), true, false); | 8889 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 8864 SetLayerPropertiesForTesting(animated.get(), identity_matrix, gfx::Point3F(), | 8890 SetLayerPropertiesForTesting(animated.get(), identity_matrix, gfx::Point3F(), |
| 8865 gfx::PointF(), gfx::Size(20, 20), true, false); | 8891 gfx::PointF(), gfx::Size(20, 20), true, false); |
| 8866 | 8892 |
| 8867 root->SetMasksToBounds(true); | 8893 root->SetMasksToBounds(true); |
| 8868 root->SetForceRenderSurface(true); | 8894 root->SetForceRenderSurface(true); |
| 8869 animated->SetOpacity(0.f); | 8895 animated->SetOpacity(0.f); |
| 8870 | 8896 |
| 8871 AddOpacityTransitionToController(animated->layer_animation_controller(), 10.0, | 8897 AddOpacityTransitionToController(animated->layer_animation_controller(), 10.0, |
| 8872 0.f, 1.f, false); | 8898 0.f, 1.f, false); |
| 8873 | 8899 |
| 8874 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 8900 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 8875 | 8901 |
| 8876 EXPECT_FALSE(animated->visible_rect_from_property_trees().IsEmpty()); | 8902 EXPECT_FALSE(animated->visible_rect_from_property_trees().IsEmpty()); |
| 8877 } | 8903 } |
| 8878 | 8904 |
| 8879 TEST_F(LayerTreeHostCommonTest, | 8905 TEST_F(LayerTreeHostCommonTest, |
| 8880 VisibleContentRectForAnimatedLayerWithSingularTransform) { | 8906 VisibleContentRectForAnimatedLayerWithSingularTransform) { |
| 8881 const gfx::Transform identity_matrix; | 8907 const gfx::Transform identity_matrix; |
| 8882 scoped_refptr<Layer> root = Layer::Create(); | 8908 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 8883 scoped_refptr<Layer> clip = Layer::Create(); | 8909 scoped_refptr<Layer> clip = Layer::Create(layer_settings()); |
| 8884 scoped_refptr<LayerWithForcedDrawsContent> animated = | 8910 scoped_refptr<LayerWithForcedDrawsContent> animated = |
| 8885 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 8911 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 8886 scoped_refptr<LayerWithForcedDrawsContent> surface = | 8912 scoped_refptr<LayerWithForcedDrawsContent> surface = |
| 8887 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 8913 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 8888 scoped_refptr<LayerWithForcedDrawsContent> descendant_of_animation = | 8914 scoped_refptr<LayerWithForcedDrawsContent> descendant_of_animation = |
| 8889 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 8915 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 8890 | 8916 |
| 8891 root->AddChild(clip); | 8917 root->AddChild(clip); |
| 8892 clip->AddChild(animated); | 8918 clip->AddChild(animated); |
| 8893 animated->AddChild(surface); | 8919 animated->AddChild(surface); |
| 8894 surface->AddChild(descendant_of_animation); | 8920 surface->AddChild(descendant_of_animation); |
| 8895 | 8921 |
| 8896 clip->SetMasksToBounds(true); | 8922 clip->SetMasksToBounds(true); |
| 8897 surface->SetForceRenderSurface(true); | 8923 surface->SetForceRenderSurface(true); |
| 8898 | 8924 |
| 8899 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 8925 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8949 // means the clip cannot be projected into |surface|'s space, so we treat | 8975 // means the clip cannot be projected into |surface|'s space, so we treat |
| 8950 // |surface| and layers that draw into it as fully visible. | 8976 // |surface| and layers that draw into it as fully visible. |
| 8951 EXPECT_EQ(gfx::Rect(100, 100), surface->visible_rect_from_property_trees()); | 8977 EXPECT_EQ(gfx::Rect(100, 100), surface->visible_rect_from_property_trees()); |
| 8952 EXPECT_EQ(gfx::Rect(200, 200), | 8978 EXPECT_EQ(gfx::Rect(200, 200), |
| 8953 descendant_of_animation->visible_rect_from_property_trees()); | 8979 descendant_of_animation->visible_rect_from_property_trees()); |
| 8954 } | 8980 } |
| 8955 | 8981 |
| 8956 // Verify that having an animated filter (but no current filter, as these | 8982 // Verify that having an animated filter (but no current filter, as these |
| 8957 // are mutually exclusive) correctly creates a render surface. | 8983 // are mutually exclusive) correctly creates a render surface. |
| 8958 TEST_F(LayerTreeHostCommonTest, AnimatedFilterCreatesRenderSurface) { | 8984 TEST_F(LayerTreeHostCommonTest, AnimatedFilterCreatesRenderSurface) { |
| 8959 scoped_refptr<Layer> root = Layer::Create(); | 8985 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 8960 scoped_refptr<Layer> child = Layer::Create(); | 8986 scoped_refptr<Layer> child = Layer::Create(layer_settings()); |
| 8961 scoped_refptr<Layer> grandchild = Layer::Create(); | 8987 scoped_refptr<Layer> grandchild = Layer::Create(layer_settings()); |
| 8962 root->AddChild(child); | 8988 root->AddChild(child); |
| 8963 child->AddChild(grandchild); | 8989 child->AddChild(grandchild); |
| 8964 | 8990 |
| 8965 gfx::Transform identity_transform; | 8991 gfx::Transform identity_transform; |
| 8966 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), | 8992 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), |
| 8967 gfx::PointF(), gfx::Size(50, 50), true, false); | 8993 gfx::PointF(), gfx::Size(50, 50), true, false); |
| 8968 SetLayerPropertiesForTesting(child.get(), identity_transform, gfx::Point3F(), | 8994 SetLayerPropertiesForTesting(child.get(), identity_transform, gfx::Point3F(), |
| 8969 gfx::PointF(), gfx::Size(50, 50), true, false); | 8995 gfx::PointF(), gfx::Size(50, 50), true, false); |
| 8970 SetLayerPropertiesForTesting(grandchild.get(), identity_transform, | 8996 SetLayerPropertiesForTesting(grandchild.get(), identity_transform, |
| 8971 gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50), | 8997 gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50), |
| (...skipping 14 matching lines...) Expand all Loading... |
| 8986 EXPECT_TRUE(grandchild->filters().IsEmpty()); | 9012 EXPECT_TRUE(grandchild->filters().IsEmpty()); |
| 8987 | 9013 |
| 8988 EXPECT_FALSE(root->FilterIsAnimating()); | 9014 EXPECT_FALSE(root->FilterIsAnimating()); |
| 8989 EXPECT_TRUE(child->FilterIsAnimating()); | 9015 EXPECT_TRUE(child->FilterIsAnimating()); |
| 8990 EXPECT_FALSE(grandchild->FilterIsAnimating()); | 9016 EXPECT_FALSE(grandchild->FilterIsAnimating()); |
| 8991 } | 9017 } |
| 8992 | 9018 |
| 8993 // Ensures that the property tree code accounts for offsets between fixed | 9019 // Ensures that the property tree code accounts for offsets between fixed |
| 8994 // position layers and their respective containers. | 9020 // position layers and their respective containers. |
| 8995 TEST_F(LayerTreeHostCommonTest, PropertyTreesAccountForFixedParentOffset) { | 9021 TEST_F(LayerTreeHostCommonTest, PropertyTreesAccountForFixedParentOffset) { |
| 8996 scoped_refptr<Layer> root = Layer::Create(); | 9022 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 8997 scoped_refptr<Layer> child = Layer::Create(); | 9023 scoped_refptr<Layer> child = Layer::Create(layer_settings()); |
| 8998 scoped_refptr<LayerWithForcedDrawsContent> grandchild = | 9024 scoped_refptr<LayerWithForcedDrawsContent> grandchild = |
| 8999 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 9025 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 9000 | 9026 |
| 9001 root->AddChild(child); | 9027 root->AddChild(child); |
| 9002 child->AddChild(grandchild); | 9028 child->AddChild(grandchild); |
| 9003 | 9029 |
| 9004 gfx::Transform identity_transform; | 9030 gfx::Transform identity_transform; |
| 9005 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), | 9031 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), |
| 9006 gfx::PointF(), gfx::Size(50, 50), true, false); | 9032 gfx::PointF(), gfx::Size(50, 50), true, false); |
| 9007 SetLayerPropertiesForTesting(child.get(), identity_transform, gfx::Point3F(), | 9033 SetLayerPropertiesForTesting(child.get(), identity_transform, gfx::Point3F(), |
| 9008 gfx::PointF(1000, 1000), gfx::Size(50, 50), true, | 9034 gfx::PointF(1000, 1000), gfx::Size(50, 50), true, |
| 9009 false); | 9035 false); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 9031 TEST_F(LayerTreeHostCommonTest, CombineClipsUsingContentTarget) { | 9057 TEST_F(LayerTreeHostCommonTest, CombineClipsUsingContentTarget) { |
| 9032 // In the following layer tree, the layer |box|'s render target is |surface|. | 9058 // In the following layer tree, the layer |box|'s render target is |surface|. |
| 9033 // |surface| also creates a transform node. We want to combine clips for |box| | 9059 // |surface| also creates a transform node. We want to combine clips for |box| |
| 9034 // in the space of its target (i.e., |surface|), not its target's target. This | 9060 // in the space of its target (i.e., |surface|), not its target's target. This |
| 9035 // test ensures that happens. | 9061 // test ensures that happens. |
| 9036 | 9062 |
| 9037 gfx::Transform rotate; | 9063 gfx::Transform rotate; |
| 9038 rotate.Rotate(5); | 9064 rotate.Rotate(5); |
| 9039 gfx::Transform identity; | 9065 gfx::Transform identity; |
| 9040 | 9066 |
| 9041 scoped_refptr<Layer> root = Layer::Create(); | 9067 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 9042 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 9068 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 9043 gfx::PointF(), gfx::Size(2500, 1500), true, | 9069 gfx::PointF(), gfx::Size(2500, 1500), true, |
| 9044 false); | 9070 false); |
| 9045 | 9071 |
| 9046 scoped_refptr<Layer> frame_clip = Layer::Create(); | 9072 scoped_refptr<Layer> frame_clip = Layer::Create(layer_settings()); |
| 9047 SetLayerPropertiesForTesting(frame_clip.get(), identity, gfx::Point3F(), | 9073 SetLayerPropertiesForTesting(frame_clip.get(), identity, gfx::Point3F(), |
| 9048 gfx::PointF(), gfx::Size(2500, 1500), true, | 9074 gfx::PointF(), gfx::Size(2500, 1500), true, |
| 9049 false); | 9075 false); |
| 9050 frame_clip->SetMasksToBounds(true); | 9076 frame_clip->SetMasksToBounds(true); |
| 9051 | 9077 |
| 9052 scoped_refptr<Layer> rotated = Layer::Create(); | 9078 scoped_refptr<Layer> rotated = Layer::Create(layer_settings()); |
| 9053 SetLayerPropertiesForTesting(rotated.get(), rotate, | 9079 SetLayerPropertiesForTesting(rotated.get(), rotate, |
| 9054 gfx::Point3F(1250, 250, 0), gfx::PointF(), | 9080 gfx::Point3F(1250, 250, 0), gfx::PointF(), |
| 9055 gfx::Size(2500, 500), true, false); | 9081 gfx::Size(2500, 500), true, false); |
| 9056 | 9082 |
| 9057 scoped_refptr<Layer> surface = Layer::Create(); | 9083 scoped_refptr<Layer> surface = Layer::Create(layer_settings()); |
| 9058 SetLayerPropertiesForTesting(surface.get(), rotate, gfx::Point3F(), | 9084 SetLayerPropertiesForTesting(surface.get(), rotate, gfx::Point3F(), |
| 9059 gfx::PointF(), gfx::Size(2500, 500), true, | 9085 gfx::PointF(), gfx::Size(2500, 500), true, |
| 9060 false); | 9086 false); |
| 9061 surface->SetOpacity(0.5); | 9087 surface->SetOpacity(0.5); |
| 9062 | 9088 |
| 9063 scoped_refptr<LayerWithForcedDrawsContent> container = | 9089 scoped_refptr<LayerWithForcedDrawsContent> container = |
| 9064 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 9090 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 9065 SetLayerPropertiesForTesting(container.get(), identity, gfx::Point3F(), | 9091 SetLayerPropertiesForTesting(container.get(), identity, gfx::Point3F(), |
| 9066 gfx::PointF(), gfx::Size(300, 300), true, false); | 9092 gfx::PointF(), gfx::Size(300, 300), true, false); |
| 9067 | 9093 |
| 9068 scoped_refptr<LayerWithForcedDrawsContent> box = | 9094 scoped_refptr<LayerWithForcedDrawsContent> box = |
| 9069 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 9095 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 9070 SetLayerPropertiesForTesting(box.get(), identity, gfx::Point3F(), | 9096 SetLayerPropertiesForTesting(box.get(), identity, gfx::Point3F(), |
| 9071 gfx::PointF(), gfx::Size(100, 100), true, false); | 9097 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 9072 | 9098 |
| 9073 root->AddChild(frame_clip); | 9099 root->AddChild(frame_clip); |
| 9074 frame_clip->AddChild(rotated); | 9100 frame_clip->AddChild(rotated); |
| 9075 rotated->AddChild(surface); | 9101 rotated->AddChild(surface); |
| 9076 surface->AddChild(container); | 9102 surface->AddChild(container); |
| 9077 surface->AddChild(box); | 9103 surface->AddChild(box); |
| 9078 | 9104 |
| 9079 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 9105 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 9080 host->SetRootLayer(root); | 9106 host->SetRootLayer(root); |
| 9081 | 9107 |
| 9082 ExecuteCalculateDrawProperties(root.get()); | 9108 ExecuteCalculateDrawProperties(root.get()); |
| 9083 } | 9109 } |
| 9084 | 9110 |
| 9085 TEST_F(LayerTreeHostCommonTest, OnlyApplyFixedPositioningOnce) { | 9111 TEST_F(LayerTreeHostCommonTest, OnlyApplyFixedPositioningOnce) { |
| 9086 gfx::Transform identity; | 9112 gfx::Transform identity; |
| 9087 gfx::Transform translate_z; | 9113 gfx::Transform translate_z; |
| 9088 translate_z.Translate3d(0, 0, 10); | 9114 translate_z.Translate3d(0, 0, 10); |
| 9089 | 9115 |
| 9090 scoped_refptr<Layer> root = Layer::Create(); | 9116 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 9091 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 9117 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 9092 gfx::PointF(), gfx::Size(800, 800), true, false); | 9118 gfx::PointF(), gfx::Size(800, 800), true, false); |
| 9093 root->SetIsContainerForFixedPositionLayers(true); | 9119 root->SetIsContainerForFixedPositionLayers(true); |
| 9094 | 9120 |
| 9095 scoped_refptr<Layer> frame_clip = Layer::Create(); | 9121 scoped_refptr<Layer> frame_clip = Layer::Create(layer_settings()); |
| 9096 SetLayerPropertiesForTesting(frame_clip.get(), translate_z, gfx::Point3F(), | 9122 SetLayerPropertiesForTesting(frame_clip.get(), translate_z, gfx::Point3F(), |
| 9097 gfx::PointF(500, 100), gfx::Size(100, 100), true, | 9123 gfx::PointF(500, 100), gfx::Size(100, 100), true, |
| 9098 false); | 9124 false); |
| 9099 frame_clip->SetMasksToBounds(true); | 9125 frame_clip->SetMasksToBounds(true); |
| 9100 | 9126 |
| 9101 scoped_refptr<LayerWithForcedDrawsContent> fixed = | 9127 scoped_refptr<LayerWithForcedDrawsContent> fixed = |
| 9102 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 9128 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 9103 SetLayerPropertiesForTesting(fixed.get(), identity, gfx::Point3F(), | 9129 SetLayerPropertiesForTesting(fixed.get(), identity, gfx::Point3F(), |
| 9104 gfx::PointF(), gfx::Size(1000, 1000), true, | 9130 gfx::PointF(), gfx::Size(1000, 1000), true, |
| 9105 false); | 9131 false); |
| 9106 | 9132 |
| 9107 LayerPositionConstraint constraint; | 9133 LayerPositionConstraint constraint; |
| 9108 constraint.set_is_fixed_position(true); | 9134 constraint.set_is_fixed_position(true); |
| 9109 fixed->SetPositionConstraint(constraint); | 9135 fixed->SetPositionConstraint(constraint); |
| 9110 | 9136 |
| 9111 root->AddChild(frame_clip); | 9137 root->AddChild(frame_clip); |
| 9112 frame_clip->AddChild(fixed); | 9138 frame_clip->AddChild(fixed); |
| 9113 | 9139 |
| 9114 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 9140 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 9115 host->SetRootLayer(root); | 9141 host->SetRootLayer(root); |
| 9116 | 9142 |
| 9117 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 9143 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9118 | 9144 |
| 9119 gfx::Rect expected(0, 0, 100, 100); | 9145 gfx::Rect expected(0, 0, 100, 100); |
| 9120 EXPECT_EQ(expected, fixed->visible_rect_from_property_trees()); | 9146 EXPECT_EQ(expected, fixed->visible_rect_from_property_trees()); |
| 9121 } | 9147 } |
| 9122 | 9148 |
| 9123 TEST_F(LayerTreeHostCommonTest, | 9149 TEST_F(LayerTreeHostCommonTest, |
| 9124 PropertyTreesAccountForScrollCompensationAdjustment) { | 9150 PropertyTreesAccountForScrollCompensationAdjustment) { |
| 9125 gfx::Transform identity; | 9151 gfx::Transform identity; |
| 9126 gfx::Transform translate_z; | 9152 gfx::Transform translate_z; |
| 9127 translate_z.Translate3d(0, 0, 10); | 9153 translate_z.Translate3d(0, 0, 10); |
| 9128 | 9154 |
| 9129 scoped_refptr<Layer> root = Layer::Create(); | 9155 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 9130 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 9156 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 9131 gfx::PointF(), gfx::Size(800, 800), true, false); | 9157 gfx::PointF(), gfx::Size(800, 800), true, false); |
| 9132 root->SetIsContainerForFixedPositionLayers(true); | 9158 root->SetIsContainerForFixedPositionLayers(true); |
| 9133 | 9159 |
| 9134 scoped_refptr<Layer> frame_clip = Layer::Create(); | 9160 scoped_refptr<Layer> frame_clip = Layer::Create(layer_settings()); |
| 9135 SetLayerPropertiesForTesting(frame_clip.get(), translate_z, gfx::Point3F(), | 9161 SetLayerPropertiesForTesting(frame_clip.get(), translate_z, gfx::Point3F(), |
| 9136 gfx::PointF(500, 100), gfx::Size(100, 100), true, | 9162 gfx::PointF(500, 100), gfx::Size(100, 100), true, |
| 9137 false); | 9163 false); |
| 9138 frame_clip->SetMasksToBounds(true); | 9164 frame_clip->SetMasksToBounds(true); |
| 9139 | 9165 |
| 9140 scoped_refptr<LayerWithForcedDrawsContent> scroller = | 9166 scoped_refptr<LayerWithForcedDrawsContent> scroller = |
| 9141 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 9167 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 9142 SetLayerPropertiesForTesting(scroller.get(), identity, gfx::Point3F(), | 9168 SetLayerPropertiesForTesting(scroller.get(), identity, gfx::Point3F(), |
| 9143 gfx::PointF(), gfx::Size(1000, 1000), true, | 9169 gfx::PointF(), gfx::Size(1000, 1000), true, |
| 9144 false); | 9170 false); |
| 9145 | 9171 |
| 9146 scroller->SetScrollCompensationAdjustment(gfx::Vector2dF(0.3f, 0.7f)); | 9172 scroller->SetScrollCompensationAdjustment(gfx::Vector2dF(0.3f, 0.7f)); |
| 9147 scroller->SetScrollOffset(gfx::ScrollOffset(0.3, 0.7)); | 9173 scroller->SetScrollOffset(gfx::ScrollOffset(0.3, 0.7)); |
| 9148 scroller->SetScrollClipLayerId(frame_clip->id()); | 9174 scroller->SetScrollClipLayerId(frame_clip->id()); |
| 9149 | 9175 |
| 9150 scoped_refptr<LayerWithForcedDrawsContent> fixed = | 9176 scoped_refptr<LayerWithForcedDrawsContent> fixed = |
| 9151 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 9177 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 9152 SetLayerPropertiesForTesting(fixed.get(), identity, gfx::Point3F(), | 9178 SetLayerPropertiesForTesting(fixed.get(), identity, gfx::Point3F(), |
| 9153 gfx::PointF(), gfx::Size(50, 50), true, false); | 9179 gfx::PointF(), gfx::Size(50, 50), true, false); |
| 9154 | 9180 |
| 9155 LayerPositionConstraint constraint; | 9181 LayerPositionConstraint constraint; |
| 9156 constraint.set_is_fixed_position(true); | 9182 constraint.set_is_fixed_position(true); |
| 9157 fixed->SetPositionConstraint(constraint); | 9183 fixed->SetPositionConstraint(constraint); |
| 9158 | 9184 |
| 9159 scoped_refptr<LayerWithForcedDrawsContent> fixed_child = | 9185 scoped_refptr<LayerWithForcedDrawsContent> fixed_child = |
| 9160 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 9186 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 9161 SetLayerPropertiesForTesting(fixed_child.get(), identity, gfx::Point3F(), | 9187 SetLayerPropertiesForTesting(fixed_child.get(), identity, gfx::Point3F(), |
| 9162 gfx::PointF(), gfx::Size(10, 10), true, false); | 9188 gfx::PointF(), gfx::Size(10, 10), true, false); |
| 9163 | 9189 |
| 9164 fixed_child->SetPositionConstraint(constraint); | 9190 fixed_child->SetPositionConstraint(constraint); |
| 9165 | 9191 |
| 9166 root->AddChild(frame_clip); | 9192 root->AddChild(frame_clip); |
| 9167 frame_clip->AddChild(scroller); | 9193 frame_clip->AddChild(scroller); |
| 9168 scroller->AddChild(fixed); | 9194 scroller->AddChild(fixed); |
| 9169 fixed->AddChild(fixed_child); | 9195 fixed->AddChild(fixed_child); |
| 9170 | 9196 |
| 9171 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 9197 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 9172 host->SetRootLayer(root); | 9198 host->SetRootLayer(root); |
| 9173 | 9199 |
| 9174 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 9200 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9175 | 9201 |
| 9176 gfx::Rect expected(0, 0, 50, 50); | 9202 gfx::Rect expected(0, 0, 50, 50); |
| 9177 EXPECT_EQ(expected, fixed->visible_rect_from_property_trees()); | 9203 EXPECT_EQ(expected, fixed->visible_rect_from_property_trees()); |
| 9178 | 9204 |
| 9179 expected = gfx::Rect(0, 0, 10, 10); | 9205 expected = gfx::Rect(0, 0, 10, 10); |
| 9180 EXPECT_EQ(expected, fixed_child->visible_rect_from_property_trees()); | 9206 EXPECT_EQ(expected, fixed_child->visible_rect_from_property_trees()); |
| 9181 } | 9207 } |
| 9182 | 9208 |
| 9183 TEST_F(LayerTreeHostCommonTest, FixedClipsShouldBeAssociatedWithTheRightNode) { | 9209 TEST_F(LayerTreeHostCommonTest, FixedClipsShouldBeAssociatedWithTheRightNode) { |
| 9184 gfx::Transform identity; | 9210 gfx::Transform identity; |
| 9185 | 9211 |
| 9186 scoped_refptr<Layer> root = Layer::Create(); | 9212 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 9187 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 9213 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 9188 gfx::PointF(), gfx::Size(800, 800), true, false); | 9214 gfx::PointF(), gfx::Size(800, 800), true, false); |
| 9189 root->SetIsContainerForFixedPositionLayers(true); | 9215 root->SetIsContainerForFixedPositionLayers(true); |
| 9190 | 9216 |
| 9191 scoped_refptr<Layer> frame_clip = Layer::Create(); | 9217 scoped_refptr<Layer> frame_clip = Layer::Create(layer_settings()); |
| 9192 SetLayerPropertiesForTesting(frame_clip.get(), identity, gfx::Point3F(), | 9218 SetLayerPropertiesForTesting(frame_clip.get(), identity, gfx::Point3F(), |
| 9193 gfx::PointF(500, 100), gfx::Size(100, 100), true, | 9219 gfx::PointF(500, 100), gfx::Size(100, 100), true, |
| 9194 false); | 9220 false); |
| 9195 frame_clip->SetMasksToBounds(true); | 9221 frame_clip->SetMasksToBounds(true); |
| 9196 | 9222 |
| 9197 scoped_refptr<LayerWithForcedDrawsContent> scroller = | 9223 scoped_refptr<LayerWithForcedDrawsContent> scroller = |
| 9198 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 9224 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 9199 SetLayerPropertiesForTesting(scroller.get(), identity, gfx::Point3F(), | 9225 SetLayerPropertiesForTesting(scroller.get(), identity, gfx::Point3F(), |
| 9200 gfx::PointF(), gfx::Size(1000, 1000), true, | 9226 gfx::PointF(), gfx::Size(1000, 1000), true, |
| 9201 false); | 9227 false); |
| 9202 | 9228 |
| 9203 scroller->SetScrollOffset(gfx::ScrollOffset(100, 100)); | 9229 scroller->SetScrollOffset(gfx::ScrollOffset(100, 100)); |
| 9204 scroller->SetScrollClipLayerId(frame_clip->id()); | 9230 scroller->SetScrollClipLayerId(frame_clip->id()); |
| 9205 | 9231 |
| 9206 scoped_refptr<LayerWithForcedDrawsContent> fixed = | 9232 scoped_refptr<LayerWithForcedDrawsContent> fixed = |
| 9207 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 9233 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 9208 SetLayerPropertiesForTesting(fixed.get(), identity, gfx::Point3F(), | 9234 SetLayerPropertiesForTesting(fixed.get(), identity, gfx::Point3F(), |
| 9209 gfx::PointF(100, 100), gfx::Size(50, 50), true, | 9235 gfx::PointF(100, 100), gfx::Size(50, 50), true, |
| 9210 false); | 9236 false); |
| 9211 | 9237 |
| 9212 LayerPositionConstraint constraint; | 9238 LayerPositionConstraint constraint; |
| 9213 constraint.set_is_fixed_position(true); | 9239 constraint.set_is_fixed_position(true); |
| 9214 fixed->SetPositionConstraint(constraint); | 9240 fixed->SetPositionConstraint(constraint); |
| 9215 fixed->SetForceRenderSurface(true); | 9241 fixed->SetForceRenderSurface(true); |
| 9216 fixed->SetMasksToBounds(true); | 9242 fixed->SetMasksToBounds(true); |
| 9217 | 9243 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 9229 } | 9255 } |
| 9230 | 9256 |
| 9231 TEST_F(LayerTreeHostCommonTest, ChangingAxisAlignmentTriggersRebuild) { | 9257 TEST_F(LayerTreeHostCommonTest, ChangingAxisAlignmentTriggersRebuild) { |
| 9232 gfx::Transform identity; | 9258 gfx::Transform identity; |
| 9233 gfx::Transform translate; | 9259 gfx::Transform translate; |
| 9234 gfx::Transform rotate; | 9260 gfx::Transform rotate; |
| 9235 | 9261 |
| 9236 translate.Translate(10, 10); | 9262 translate.Translate(10, 10); |
| 9237 rotate.Rotate(45); | 9263 rotate.Rotate(45); |
| 9238 | 9264 |
| 9239 scoped_refptr<Layer> root = Layer::Create(); | 9265 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 9240 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 9266 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 9241 gfx::PointF(), gfx::Size(800, 800), true, false); | 9267 gfx::PointF(), gfx::Size(800, 800), true, false); |
| 9242 root->SetIsContainerForFixedPositionLayers(true); | 9268 root->SetIsContainerForFixedPositionLayers(true); |
| 9243 | 9269 |
| 9244 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 9270 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 9245 host->SetRootLayer(root); | 9271 host->SetRootLayer(root); |
| 9246 | 9272 |
| 9247 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 9273 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9248 EXPECT_FALSE(host->property_trees()->needs_rebuild); | 9274 EXPECT_FALSE(host->property_trees()->needs_rebuild); |
| 9249 | 9275 |
| 9250 root->SetTransform(translate); | 9276 root->SetTransform(translate); |
| 9251 EXPECT_FALSE(host->property_trees()->needs_rebuild); | 9277 EXPECT_FALSE(host->property_trees()->needs_rebuild); |
| 9252 | 9278 |
| 9253 root->SetTransform(rotate); | 9279 root->SetTransform(rotate); |
| 9254 EXPECT_TRUE(host->property_trees()->needs_rebuild); | 9280 EXPECT_TRUE(host->property_trees()->needs_rebuild); |
| 9255 } | 9281 } |
| 9256 | 9282 |
| 9257 TEST_F(LayerTreeHostCommonTest, ChangeTransformOrigin) { | 9283 TEST_F(LayerTreeHostCommonTest, ChangeTransformOrigin) { |
| 9258 scoped_refptr<Layer> root = Layer::Create(); | 9284 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 9259 scoped_refptr<LayerWithForcedDrawsContent> child = | 9285 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 9260 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 9286 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 9261 root->AddChild(child); | 9287 root->AddChild(child); |
| 9262 | 9288 |
| 9263 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 9289 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 9264 host->SetRootLayer(root); | 9290 host->SetRootLayer(root); |
| 9265 | 9291 |
| 9266 gfx::Transform identity_matrix; | 9292 gfx::Transform identity_matrix; |
| 9267 gfx::Transform scale_matrix; | 9293 gfx::Transform scale_matrix; |
| 9268 scale_matrix.Scale(2.f, 2.f); | 9294 scale_matrix.Scale(2.f, 2.f); |
| 9269 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), | 9295 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
| 9270 gfx::PointF(), gfx::Size(100, 100), true, false); | 9296 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 9271 SetLayerPropertiesForTesting(child.get(), scale_matrix, gfx::Point3F(), | 9297 SetLayerPropertiesForTesting(child.get(), scale_matrix, gfx::Point3F(), |
| 9272 gfx::PointF(), gfx::Size(10, 10), true, false); | 9298 gfx::PointF(), gfx::Size(10, 10), true, false); |
| 9273 | 9299 |
| 9274 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 9300 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9275 EXPECT_EQ(gfx::Rect(10, 10), child->visible_rect_from_property_trees()); | 9301 EXPECT_EQ(gfx::Rect(10, 10), child->visible_rect_from_property_trees()); |
| 9276 | 9302 |
| 9277 child->SetTransformOrigin(gfx::Point3F(10.f, 10.f, 10.f)); | 9303 child->SetTransformOrigin(gfx::Point3F(10.f, 10.f, 10.f)); |
| 9278 | 9304 |
| 9279 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 9305 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9280 EXPECT_EQ(gfx::Rect(5, 5, 5, 5), child->visible_rect_from_property_trees()); | 9306 EXPECT_EQ(gfx::Rect(5, 5, 5, 5), child->visible_rect_from_property_trees()); |
| 9281 } | 9307 } |
| 9282 | 9308 |
| 9283 TEST_F(LayerTreeHostCommonTest, UpdateScrollChildPosition) { | 9309 TEST_F(LayerTreeHostCommonTest, UpdateScrollChildPosition) { |
| 9284 scoped_refptr<Layer> root = Layer::Create(); | 9310 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 9285 scoped_refptr<LayerWithForcedDrawsContent> scroll_parent = | 9311 scoped_refptr<LayerWithForcedDrawsContent> scroll_parent = |
| 9286 make_scoped_refptr(new LayerWithForcedDrawsContent); | 9312 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 9287 scoped_refptr<LayerWithForcedDrawsContent> scroll_child = | 9313 scoped_refptr<LayerWithForcedDrawsContent> scroll_child = |
| 9288 make_scoped_refptr(new LayerWithForcedDrawsContent); | 9314 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 9289 | 9315 |
| 9290 root->AddChild(scroll_child); | 9316 root->AddChild(scroll_child); |
| 9291 root->AddChild(scroll_parent); | 9317 root->AddChild(scroll_parent); |
| 9292 scroll_child->SetScrollParent(scroll_parent.get()); | 9318 scroll_child->SetScrollParent(scroll_parent.get()); |
| 9293 scroll_parent->SetScrollClipLayerId(root->id()); | 9319 scroll_parent->SetScrollClipLayerId(root->id()); |
| 9294 | 9320 |
| 9295 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 9321 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 9296 host->SetRootLayer(root); | 9322 host->SetRootLayer(root); |
| 9297 | 9323 |
| 9298 gfx::Transform identity_transform; | 9324 gfx::Transform identity_transform; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 9316 EXPECT_EQ(gfx::Rect(0, 5, 25, 25), | 9342 EXPECT_EQ(gfx::Rect(0, 5, 25, 25), |
| 9317 scroll_child->visible_rect_from_property_trees()); | 9343 scroll_child->visible_rect_from_property_trees()); |
| 9318 } | 9344 } |
| 9319 | 9345 |
| 9320 static void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) { | 9346 static void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) { |
| 9321 } | 9347 } |
| 9322 | 9348 |
| 9323 TEST_F(LayerTreeHostCommonTest, SkippingSubtreeMain) { | 9349 TEST_F(LayerTreeHostCommonTest, SkippingSubtreeMain) { |
| 9324 gfx::Transform identity; | 9350 gfx::Transform identity; |
| 9325 FakeContentLayerClient client; | 9351 FakeContentLayerClient client; |
| 9326 scoped_refptr<Layer> root = Layer::Create(); | 9352 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 9327 scoped_refptr<LayerWithForcedDrawsContent> child = | 9353 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 9328 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 9354 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 9329 scoped_refptr<LayerWithForcedDrawsContent> grandchild = | 9355 scoped_refptr<LayerWithForcedDrawsContent> grandchild = |
| 9330 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 9356 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 9331 scoped_refptr<FakeContentLayer> greatgrandchild( | 9357 scoped_refptr<FakeContentLayer> greatgrandchild( |
| 9332 FakeContentLayer::Create(&client)); | 9358 FakeContentLayer::Create(layer_settings(), &client)); |
| 9333 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 9359 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 9334 gfx::PointF(), gfx::Size(100, 100), true, false); | 9360 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 9335 SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(), | 9361 SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(), |
| 9336 gfx::PointF(), gfx::Size(10, 10), true, false); | 9362 gfx::PointF(), gfx::Size(10, 10), true, false); |
| 9337 SetLayerPropertiesForTesting(grandchild.get(), identity, gfx::Point3F(), | 9363 SetLayerPropertiesForTesting(grandchild.get(), identity, gfx::Point3F(), |
| 9338 gfx::PointF(), gfx::Size(10, 10), true, false); | 9364 gfx::PointF(), gfx::Size(10, 10), true, false); |
| 9339 SetLayerPropertiesForTesting(greatgrandchild.get(), identity, gfx::Point3F(), | 9365 SetLayerPropertiesForTesting(greatgrandchild.get(), identity, gfx::Point3F(), |
| 9340 gfx::PointF(), gfx::Size(10, 10), true, false); | 9366 gfx::PointF(), gfx::Size(10, 10), true, false); |
| 9341 | 9367 |
| 9342 root->AddChild(child); | 9368 root->AddChild(child); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9478 | 9504 |
| 9479 greatgrandchild_ptr->PassCopyRequests(&requests); | 9505 greatgrandchild_ptr->PassCopyRequests(&requests); |
| 9480 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 9506 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9481 EXPECT_EQ(gfx::Rect(10, 10), | 9507 EXPECT_EQ(gfx::Rect(10, 10), |
| 9482 grandchild_ptr->visible_rect_from_property_trees()); | 9508 grandchild_ptr->visible_rect_from_property_trees()); |
| 9483 } | 9509 } |
| 9484 | 9510 |
| 9485 TEST_F(LayerTreeHostCommonTest, SkippingLayer) { | 9511 TEST_F(LayerTreeHostCommonTest, SkippingLayer) { |
| 9486 gfx::Transform identity; | 9512 gfx::Transform identity; |
| 9487 FakeContentLayerClient client; | 9513 FakeContentLayerClient client; |
| 9488 scoped_refptr<Layer> root = Layer::Create(); | 9514 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 9489 scoped_refptr<LayerWithForcedDrawsContent> child = | 9515 scoped_refptr<LayerWithForcedDrawsContent> child = |
| 9490 make_scoped_refptr(new LayerWithForcedDrawsContent()); | 9516 make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); |
| 9491 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 9517 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 9492 gfx::PointF(), gfx::Size(100, 100), true, false); | 9518 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 9493 SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(), | 9519 SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(), |
| 9494 gfx::PointF(), gfx::Size(10, 10), true, false); | 9520 gfx::PointF(), gfx::Size(10, 10), true, false); |
| 9495 root->AddChild(child); | 9521 root->AddChild(child); |
| 9496 | 9522 |
| 9497 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 9523 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 9498 host->SetRootLayer(root); | 9524 host->SetRootLayer(root); |
| 9499 | 9525 |
| 9500 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 9526 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 9521 child->SetTransform(identity); | 9547 child->SetTransform(identity); |
| 9522 | 9548 |
| 9523 child->SetOpacity(0.f); | 9549 child->SetOpacity(0.f); |
| 9524 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); | 9550 ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get()); |
| 9525 EXPECT_EQ(gfx::Rect(0, 0), child->visible_rect_from_property_trees()); | 9551 EXPECT_EQ(gfx::Rect(0, 0), child->visible_rect_from_property_trees()); |
| 9526 } | 9552 } |
| 9527 | 9553 |
| 9528 TEST_F(LayerTreeHostCommonTest, LayerTreeRebuildTest) { | 9554 TEST_F(LayerTreeHostCommonTest, LayerTreeRebuildTest) { |
| 9529 // Ensure that the treewalk in LayerTreeHostCommom:: | 9555 // Ensure that the treewalk in LayerTreeHostCommom:: |
| 9530 // PreCalculateMetaInformation happens when its required. | 9556 // PreCalculateMetaInformation happens when its required. |
| 9531 scoped_refptr<Layer> root = Layer::Create(); | 9557 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 9532 scoped_refptr<Layer> parent = Layer::Create(); | 9558 scoped_refptr<Layer> parent = Layer::Create(layer_settings()); |
| 9533 scoped_refptr<Layer> child = Layer::Create(); | 9559 scoped_refptr<Layer> child = Layer::Create(layer_settings()); |
| 9534 | 9560 |
| 9535 root->AddChild(parent); | 9561 root->AddChild(parent); |
| 9536 parent->AddChild(child); | 9562 parent->AddChild(child); |
| 9537 | 9563 |
| 9538 child->SetClipParent(root.get()); | 9564 child->SetClipParent(root.get()); |
| 9539 | 9565 |
| 9540 gfx::Transform identity; | 9566 gfx::Transform identity; |
| 9541 | 9567 |
| 9542 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 9568 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 9543 gfx::PointF(), gfx::Size(100, 100), true, false); | 9569 gfx::PointF(), gfx::Size(100, 100), true, false); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 9566 child->RequestCopyOfOutput( | 9592 child->RequestCopyOfOutput( |
| 9567 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback))); | 9593 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback))); |
| 9568 EXPECT_TRUE(root->draw_properties().layer_or_descendant_has_copy_request); | 9594 EXPECT_TRUE(root->draw_properties().layer_or_descendant_has_copy_request); |
| 9569 ExecuteCalculateDrawProperties(root.get()); | 9595 ExecuteCalculateDrawProperties(root.get()); |
| 9570 EXPECT_TRUE(root->draw_properties().layer_or_descendant_has_copy_request); | 9596 EXPECT_TRUE(root->draw_properties().layer_or_descendant_has_copy_request); |
| 9571 } | 9597 } |
| 9572 | 9598 |
| 9573 TEST_F(LayerTreeHostCommonTest, InputHandlersRecursiveUpdateTest) { | 9599 TEST_F(LayerTreeHostCommonTest, InputHandlersRecursiveUpdateTest) { |
| 9574 // Ensure that the treewalk in LayertreeHostCommon:: | 9600 // Ensure that the treewalk in LayertreeHostCommon:: |
| 9575 // PreCalculateMetaInformation updates input handlers correctly. | 9601 // PreCalculateMetaInformation updates input handlers correctly. |
| 9576 scoped_refptr<Layer> root = Layer::Create(); | 9602 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 9577 scoped_refptr<Layer> child = Layer::Create(); | 9603 scoped_refptr<Layer> child = Layer::Create(layer_settings()); |
| 9578 | 9604 |
| 9579 root->AddChild(child); | 9605 root->AddChild(child); |
| 9580 | 9606 |
| 9581 child->SetHaveWheelEventHandlers(true); | 9607 child->SetHaveWheelEventHandlers(true); |
| 9582 | 9608 |
| 9583 gfx::Transform identity; | 9609 gfx::Transform identity; |
| 9584 | 9610 |
| 9585 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 9611 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 9586 gfx::PointF(), gfx::Size(100, 100), true, false); | 9612 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 9587 SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(), | 9613 SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(), |
| 9588 gfx::PointF(), gfx::Size(100, 100), true, false); | 9614 gfx::PointF(), gfx::Size(100, 100), true, false); |
| 9589 | 9615 |
| 9590 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); | 9616 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); |
| 9591 host->SetRootLayer(root); | 9617 host->SetRootLayer(root); |
| 9592 | 9618 |
| 9593 EXPECT_EQ(root->num_layer_or_descendants_with_input_handler(), 0); | 9619 EXPECT_EQ(root->num_layer_or_descendants_with_input_handler(), 0); |
| 9594 ExecuteCalculateDrawProperties(root.get()); | 9620 ExecuteCalculateDrawProperties(root.get()); |
| 9595 EXPECT_EQ(root->num_layer_or_descendants_with_input_handler(), 1); | 9621 EXPECT_EQ(root->num_layer_or_descendants_with_input_handler(), 1); |
| 9596 child->SetHaveWheelEventHandlers(false); | 9622 child->SetHaveWheelEventHandlers(false); |
| 9597 EXPECT_EQ(root->num_layer_or_descendants_with_input_handler(), 0); | 9623 EXPECT_EQ(root->num_layer_or_descendants_with_input_handler(), 0); |
| 9598 } | 9624 } |
| 9599 | 9625 |
| 9600 } // namespace | 9626 } // namespace |
| 9601 } // namespace cc | 9627 } // namespace cc |
| OLD | NEW |