Chromium Code Reviews| 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/keyframed_animation_curve.h" | 10 #include "cc/animation/keyframed_animation_curve.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, | 139 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, |
| 140 grand_child->draw_transform()); | 140 grand_child->draw_transform()); |
| 141 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, | 141 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, |
| 142 grand_child->screen_space_transform()); | 142 grand_child->screen_space_transform()); |
| 143 } | 143 } |
| 144 | 144 |
| 145 TEST_F(LayerTreeHostCommonTest, DoNotSkipLayersWithHandlers) { | 145 TEST_F(LayerTreeHostCommonTest, DoNotSkipLayersWithHandlers) { |
| 146 LayerImpl* parent = root_layer(); | 146 LayerImpl* parent = root_layer(); |
| 147 LayerImpl* child = AddChild<LayerImpl>(parent); | 147 LayerImpl* child = AddChild<LayerImpl>(parent); |
| 148 LayerImpl* grand_child = AddChild<LayerImpl>(child); | 148 LayerImpl* grand_child = AddChild<LayerImpl>(child); |
| 149 child->SetDrawsContent(true); | |
| 150 grand_child->SetDrawsContent(true); | |
| 149 | 151 |
| 150 gfx::Transform identity_matrix; | 152 gfx::Transform identity_matrix; |
| 151 SetLayerPropertiesForTesting(parent, identity_matrix, gfx::Point3F(), | 153 SetLayerPropertiesForTesting(parent, identity_matrix, gfx::Point3F(), |
| 152 gfx::PointF(), gfx::Size(100, 100), true, false, | 154 gfx::PointF(), gfx::Size(100, 100), true, false, |
| 153 true); | 155 true); |
| 154 SetLayerPropertiesForTesting(child, identity_matrix, gfx::Point3F(), | 156 SetLayerPropertiesForTesting(child, identity_matrix, gfx::Point3F(), |
| 155 gfx::PointF(10, 10), gfx::Size(100, 100), true, | 157 gfx::PointF(10, 10), gfx::Size(100, 100), true, |
| 156 false, false); | 158 false, false); |
| 157 // This would have previously caused us to skip our subtree, but this would be | 159 // This would have previously caused us to skip our subtree, but this would be |
| 158 // wrong; we need up-to-date draw properties to do hit testing on the layers | 160 // wrong; we need up-to-date draw properties to do hit testing on the layers |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 461 LayerImpl* grand_child = AddChild<LayerImpl>(child); | 463 LayerImpl* grand_child = AddChild<LayerImpl>(child); |
| 462 grand_child->SetDrawsContent(true); | 464 grand_child->SetDrawsContent(true); |
| 463 | 465 |
| 464 gfx::Transform identity_matrix; | 466 gfx::Transform identity_matrix; |
| 465 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(), | 467 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(), |
| 466 gfx::PointF(), gfx::Size(1, 2), true, false, | 468 gfx::PointF(), gfx::Size(1, 2), true, false, |
| 467 true); | 469 true); |
| 468 | 470 |
| 469 // Child is set up so that a new render surface should be created. | 471 // Child is set up so that a new render surface should be created. |
| 470 child->SetOpacity(0.5f); | 472 child->SetOpacity(0.5f); |
| 473 child->SetDrawsContent(true); | |
| 471 | 474 |
| 472 gfx::Transform parent_layer_transform; | 475 gfx::Transform parent_layer_transform; |
| 473 parent_layer_transform.Scale3d(1.f, 0.9f, 1.f); | 476 parent_layer_transform.Scale3d(1.f, 0.9f, 1.f); |
| 474 gfx::Transform parent_translation_to_anchor; | 477 gfx::Transform parent_translation_to_anchor; |
| 475 parent_translation_to_anchor.Translate(25.0, 30.0); | 478 parent_translation_to_anchor.Translate(25.0, 30.0); |
| 476 | 479 |
| 477 gfx::Transform parent_composite_transform = | 480 gfx::Transform parent_composite_transform = |
| 478 parent_translation_to_anchor * parent_layer_transform * | 481 parent_translation_to_anchor * parent_layer_transform * |
| 479 Inverse(parent_translation_to_anchor); | 482 Inverse(parent_translation_to_anchor); |
| 480 gfx::Vector2dF parent_composite_scale = | 483 gfx::Vector2dF parent_composite_scale = |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 655 // have a draw transform described w.r.t. that ancestor surface | 658 // have a draw transform described w.r.t. that ancestor surface |
| 656 // - Replicas of a render surface are described w.r.t. the replica's | 659 // - Replicas of a render surface are described w.r.t. the replica's |
| 657 // transform around its anchor, along with the surface itself. | 660 // transform around its anchor, along with the surface itself. |
| 658 // - Sanity check on recursion: verify transforms of layers described w.r.t. | 661 // - Sanity check on recursion: verify transforms of layers described w.r.t. |
| 659 // a render surface that is described w.r.t. an ancestor render surface. | 662 // a render surface that is described w.r.t. an ancestor render surface. |
| 660 // - verifying that each layer has a reference to the correct render surface | 663 // - verifying that each layer has a reference to the correct render surface |
| 661 // and render target values. | 664 // and render target values. |
| 662 | 665 |
| 663 LayerImpl* root = root_layer(); | 666 LayerImpl* root = root_layer(); |
| 664 LayerImpl* parent = AddChildToRoot<LayerImpl>(); | 667 LayerImpl* parent = AddChildToRoot<LayerImpl>(); |
| 668 parent->SetDrawsContent(true); | |
| 665 LayerImpl* render_surface1 = AddChild<LayerImpl>(parent); | 669 LayerImpl* render_surface1 = AddChild<LayerImpl>(parent); |
| 670 render_surface1->SetDrawsContent(true); | |
| 666 LayerImpl* render_surface2 = AddChild<LayerImpl>(render_surface1); | 671 LayerImpl* render_surface2 = AddChild<LayerImpl>(render_surface1); |
| 672 render_surface2->SetDrawsContent(true); | |
| 667 LayerImpl* child_of_root = AddChild<LayerImpl>(parent); | 673 LayerImpl* child_of_root = AddChild<LayerImpl>(parent); |
| 674 child_of_root->SetDrawsContent(true); | |
| 668 LayerImpl* child_of_rs1 = AddChild<LayerImpl>(render_surface1); | 675 LayerImpl* child_of_rs1 = AddChild<LayerImpl>(render_surface1); |
| 676 child_of_rs1->SetDrawsContent(true); | |
| 669 LayerImpl* child_of_rs2 = AddChild<LayerImpl>(render_surface2); | 677 LayerImpl* child_of_rs2 = AddChild<LayerImpl>(render_surface2); |
| 678 child_of_rs2->SetDrawsContent(true); | |
| 670 LayerImpl* grand_child_of_root = AddChild<LayerImpl>(child_of_root); | 679 LayerImpl* grand_child_of_root = AddChild<LayerImpl>(child_of_root); |
| 680 grand_child_of_root->SetDrawsContent(true); | |
| 671 LayerImpl* grand_child_of_rs1 = AddChild<LayerImpl>(child_of_rs1); | 681 LayerImpl* grand_child_of_rs1 = AddChild<LayerImpl>(child_of_rs1); |
| 672 grand_child_of_rs1->SetDrawsContent(true); | 682 grand_child_of_rs1->SetDrawsContent(true); |
| 673 LayerImpl* grand_child_of_rs2 = AddChild<LayerImpl>(child_of_rs2); | 683 LayerImpl* grand_child_of_rs2 = AddChild<LayerImpl>(child_of_rs2); |
| 674 grand_child_of_rs2->SetDrawsContent(true); | 684 grand_child_of_rs2->SetDrawsContent(true); |
| 675 | 685 |
| 676 scoped_ptr<LayerImpl> replica_of_rs1 = | 686 scoped_ptr<LayerImpl> replica_of_rs1 = |
| 677 LayerImpl::Create(host_impl()->active_tree(), 101); | 687 LayerImpl::Create(host_impl()->active_tree(), 101); |
| 678 scoped_ptr<LayerImpl> replica_of_rs2 = | 688 scoped_ptr<LayerImpl> replica_of_rs2 = |
| 679 LayerImpl::Create(host_impl()->active_tree(), 102); | 689 LayerImpl::Create(host_impl()->active_tree(), 102); |
| 680 | 690 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 884 } | 894 } |
| 885 | 895 |
| 886 TEST_F(LayerTreeHostCommonTest, TransformsForFlatteningLayer) { | 896 TEST_F(LayerTreeHostCommonTest, TransformsForFlatteningLayer) { |
| 887 // For layers that flatten their subtree, there should be an orthographic | 897 // For layers that flatten their subtree, there should be an orthographic |
| 888 // projection (for x and y values) in the middle of the transform sequence. | 898 // projection (for x and y values) in the middle of the transform sequence. |
| 889 // Note that the way the code is currently implemented, it is not expected to | 899 // Note that the way the code is currently implemented, it is not expected to |
| 890 // use a canonical orthographic projection. | 900 // use a canonical orthographic projection. |
| 891 | 901 |
| 892 LayerImpl* root = root_layer(); | 902 LayerImpl* root = root_layer(); |
| 893 LayerImpl* child = AddChildToRoot<LayerImpl>(); | 903 LayerImpl* child = AddChildToRoot<LayerImpl>(); |
| 904 child->SetDrawsContent(true); | |
| 894 LayerImpl* grand_child = AddChild<LayerImpl>(child); | 905 LayerImpl* grand_child = AddChild<LayerImpl>(child); |
| 895 grand_child->SetDrawsContent(true); | 906 grand_child->SetDrawsContent(true); |
| 896 LayerImpl* great_grand_child = AddChild<LayerImpl>(grand_child); | 907 LayerImpl* great_grand_child = AddChild<LayerImpl>(grand_child); |
| 897 great_grand_child->SetDrawsContent(true); | 908 great_grand_child->SetDrawsContent(true); |
| 898 | 909 |
| 899 gfx::Transform rotation_about_y_axis; | 910 gfx::Transform rotation_about_y_axis; |
| 900 rotation_about_y_axis.RotateAboutYAxis(30.0); | 911 rotation_about_y_axis.RotateAboutYAxis(30.0); |
| 901 | 912 |
| 902 const gfx::Transform identity_matrix; | 913 const gfx::Transform identity_matrix; |
| 903 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(), | 914 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(), |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1248 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( | 1259 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
| 1249 parent, parent->bounds(), &render_surface_layer_list); | 1260 parent, parent->bounds(), &render_surface_layer_list); |
| 1250 inputs.can_adjust_raster_scales = true; | 1261 inputs.can_adjust_raster_scales = true; |
| 1251 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 1262 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 1252 | 1263 |
| 1253 // The layer is fully transparent, but has a background filter, so it | 1264 // The layer is fully transparent, but has a background filter, so it |
| 1254 // shouldn't be skipped. | 1265 // shouldn't be skipped. |
| 1255 ASSERT_TRUE(parent->render_surface()); | 1266 ASSERT_TRUE(parent->render_surface()); |
| 1256 EXPECT_EQ(1U, parent->render_surface()->layer_list().size()); | 1267 EXPECT_EQ(1U, parent->render_surface()->layer_list().size()); |
| 1257 EXPECT_EQ(2U, render_surface_layer_list.size()); | 1268 EXPECT_EQ(2U, render_surface_layer_list.size()); |
| 1258 EXPECT_EQ(gfx::Rect(0, 0, 10, 10), parent->drawable_content_rect()); | |
|
ajuma
2015/11/09 23:17:19
Just to make sure, is this line removed because ma
jaydasika
2015/11/09 23:27:58
Yes, making parent draw content will change what t
| |
| 1259 } | 1269 } |
| 1260 | 1270 |
| 1261 TEST_F(LayerTreeHostCommonTest, RenderSurfaceForBlendMode) { | 1271 TEST_F(LayerTreeHostCommonTest, RenderSurfaceForBlendMode) { |
| 1262 LayerImpl* parent = root_layer(); | 1272 LayerImpl* parent = root_layer(); |
| 1263 LayerImpl* child = AddChild<LayerImpl>(parent); | 1273 LayerImpl* child = AddChild<LayerImpl>(parent); |
| 1264 child->SetDrawsContent(true); | 1274 child->SetDrawsContent(true); |
| 1265 | 1275 |
| 1266 const gfx::Transform identity_matrix; | 1276 const gfx::Transform identity_matrix; |
| 1267 const SkXfermode::Mode blend_mode = SkXfermode::kMultiply_Mode; | 1277 const SkXfermode::Mode blend_mode = SkXfermode::kMultiply_Mode; |
| 1268 SetLayerPropertiesForTesting(parent, identity_matrix, gfx::Point3F(), | 1278 SetLayerPropertiesForTesting(parent, identity_matrix, gfx::Point3F(), |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1607 // | 1617 // |
| 1608 // In particular, for a layer that owns a render surface: | 1618 // In particular, for a layer that owns a render surface: |
| 1609 // - the render surface inherits any clip from ancestors, and does NOT | 1619 // - the render surface inherits any clip from ancestors, and does NOT |
| 1610 // pass that clipped status to the layer itself. | 1620 // pass that clipped status to the layer itself. |
| 1611 // - but if the layer itself masks to bounds, it is considered clipped | 1621 // - but if the layer itself masks to bounds, it is considered clipped |
| 1612 // and propagates the clip to the subtree. | 1622 // and propagates the clip to the subtree. |
| 1613 | 1623 |
| 1614 const gfx::Transform identity_matrix; | 1624 const gfx::Transform identity_matrix; |
| 1615 LayerImpl* root = root_layer(); | 1625 LayerImpl* root = root_layer(); |
| 1616 LayerImpl* parent = AddChild<LayerImpl>(root); | 1626 LayerImpl* parent = AddChild<LayerImpl>(root); |
| 1627 parent->SetDrawsContent(true); | |
| 1617 LayerImpl* child1 = AddChild<LayerImpl>(parent); | 1628 LayerImpl* child1 = AddChild<LayerImpl>(parent); |
| 1629 child1->SetDrawsContent(true); | |
| 1618 LayerImpl* child2 = AddChild<LayerImpl>(parent); | 1630 LayerImpl* child2 = AddChild<LayerImpl>(parent); |
| 1631 child2->SetDrawsContent(true); | |
| 1619 LayerImpl* grand_child = AddChild<LayerImpl>(child1); | 1632 LayerImpl* grand_child = AddChild<LayerImpl>(child1); |
| 1633 grand_child->SetDrawsContent(true); | |
| 1620 LayerImpl* leaf_node1 = AddChild<LayerImpl>(grand_child); | 1634 LayerImpl* leaf_node1 = AddChild<LayerImpl>(grand_child); |
| 1621 leaf_node1->SetDrawsContent(true); | 1635 leaf_node1->SetDrawsContent(true); |
| 1622 LayerImpl* leaf_node2 = AddChild<LayerImpl>(child2); | 1636 LayerImpl* leaf_node2 = AddChild<LayerImpl>(child2); |
| 1623 leaf_node2->SetDrawsContent(true); | 1637 leaf_node2->SetDrawsContent(true); |
| 1624 | 1638 |
| 1625 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(), | 1639 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(), |
| 1626 gfx::PointF(), gfx::Size(100, 100), true, false, | 1640 gfx::PointF(), gfx::Size(100, 100), true, false, |
| 1627 true); | 1641 true); |
| 1628 SetLayerPropertiesForTesting(parent, identity_matrix, gfx::Point3F(), | 1642 SetLayerPropertiesForTesting(parent, identity_matrix, gfx::Point3F(), |
| 1629 gfx::PointF(), gfx::Size(100, 100), true, false, | 1643 gfx::PointF(), gfx::Size(100, 100), true, false, |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1886 // grand_child3 - partially clipped and masksToBounds; the | 1900 // grand_child3 - partially clipped and masksToBounds; the |
| 1887 // DrawableContentRect will still be the intersection of layer bounds and | 1901 // DrawableContentRect will still be the intersection of layer bounds and |
| 1888 // the mask region. | 1902 // the mask region. |
| 1889 // grand_child4 - outside parent's clip rect; the DrawableContentRect should | 1903 // grand_child4 - outside parent's clip rect; the DrawableContentRect should |
| 1890 // be empty. | 1904 // be empty. |
| 1891 | 1905 |
| 1892 const gfx::Transform identity_matrix; | 1906 const gfx::Transform identity_matrix; |
| 1893 LayerImpl* parent = root_layer(); | 1907 LayerImpl* parent = root_layer(); |
| 1894 LayerImpl* child = AddChild<LayerImpl>(parent); | 1908 LayerImpl* child = AddChild<LayerImpl>(parent); |
| 1895 LayerImpl* grand_child1 = AddChild<LayerImpl>(child); | 1909 LayerImpl* grand_child1 = AddChild<LayerImpl>(child); |
| 1910 grand_child1->SetDrawsContent(true); | |
| 1896 LayerImpl* grand_child2 = AddChild<LayerImpl>(child); | 1911 LayerImpl* grand_child2 = AddChild<LayerImpl>(child); |
| 1912 grand_child2->SetDrawsContent(true); | |
| 1897 LayerImpl* grand_child3 = AddChild<LayerImpl>(child); | 1913 LayerImpl* grand_child3 = AddChild<LayerImpl>(child); |
| 1914 grand_child3->SetDrawsContent(true); | |
| 1898 LayerImpl* grand_child4 = AddChild<LayerImpl>(child); | 1915 LayerImpl* grand_child4 = AddChild<LayerImpl>(child); |
| 1916 grand_child4->SetDrawsContent(true); | |
| 1899 | 1917 |
| 1900 SetLayerPropertiesForTesting(parent, identity_matrix, gfx::Point3F(), | 1918 SetLayerPropertiesForTesting(parent, identity_matrix, gfx::Point3F(), |
| 1901 gfx::PointF(), gfx::Size(500, 500), true, false, | 1919 gfx::PointF(), gfx::Size(500, 500), true, false, |
| 1902 true); | 1920 true); |
| 1903 SetLayerPropertiesForTesting(child, identity_matrix, gfx::Point3F(), | 1921 SetLayerPropertiesForTesting(child, identity_matrix, gfx::Point3F(), |
| 1904 gfx::PointF(), gfx::Size(20, 20), true, false, | 1922 gfx::PointF(), gfx::Size(20, 20), true, false, |
| 1905 true); | 1923 true); |
| 1906 SetLayerPropertiesForTesting(grand_child1, identity_matrix, gfx::Point3F(), | 1924 SetLayerPropertiesForTesting(grand_child1, identity_matrix, gfx::Point3F(), |
| 1907 gfx::PointF(5.f, 5.f), gfx::Size(10, 10), true, | 1925 gfx::PointF(5.f, 5.f), gfx::Size(10, 10), true, |
| 1908 false, false); | 1926 false, false); |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2200 LayerImpl* parent = root_layer(); | 2218 LayerImpl* parent = root_layer(); |
| 2201 LayerImpl* render_surface1 = AddChildToRoot<LayerImpl>(); | 2219 LayerImpl* render_surface1 = AddChildToRoot<LayerImpl>(); |
| 2202 LayerImpl* child_of_rs1 = AddChild<LayerImpl>(render_surface1); | 2220 LayerImpl* child_of_rs1 = AddChild<LayerImpl>(render_surface1); |
| 2203 LayerImpl* grand_child_of_rs1 = AddChild<LayerImpl>(child_of_rs1); | 2221 LayerImpl* grand_child_of_rs1 = AddChild<LayerImpl>(child_of_rs1); |
| 2204 LayerImpl* render_surface2 = AddChild<LayerImpl>(render_surface1); | 2222 LayerImpl* render_surface2 = AddChild<LayerImpl>(render_surface1); |
| 2205 LayerImpl* child_of_rs2 = AddChild<LayerImpl>(render_surface2); | 2223 LayerImpl* child_of_rs2 = AddChild<LayerImpl>(render_surface2); |
| 2206 LayerImpl* grand_child_of_rs2 = AddChild<LayerImpl>(child_of_rs2); | 2224 LayerImpl* grand_child_of_rs2 = AddChild<LayerImpl>(child_of_rs2); |
| 2207 LayerImpl* child_of_root = AddChildToRoot<LayerImpl>(); | 2225 LayerImpl* child_of_root = AddChildToRoot<LayerImpl>(); |
| 2208 LayerImpl* grand_child_of_root = AddChild<LayerImpl>(child_of_root); | 2226 LayerImpl* grand_child_of_root = AddChild<LayerImpl>(child_of_root); |
| 2209 | 2227 |
| 2228 parent->SetDrawsContent(true); | |
| 2229 render_surface1->SetDrawsContent(true); | |
| 2230 child_of_rs1->SetDrawsContent(true); | |
| 2210 grand_child_of_rs1->SetDrawsContent(true); | 2231 grand_child_of_rs1->SetDrawsContent(true); |
| 2232 render_surface2->SetDrawsContent(true); | |
| 2233 child_of_rs2->SetDrawsContent(true); | |
| 2211 grand_child_of_rs2->SetDrawsContent(true); | 2234 grand_child_of_rs2->SetDrawsContent(true); |
| 2235 child_of_root->SetDrawsContent(true); | |
| 2236 grand_child_of_root->SetDrawsContent(true); | |
| 2212 | 2237 |
| 2213 gfx::Transform layer_transform; | 2238 gfx::Transform layer_transform; |
| 2214 layer_transform.Translate(1.0, 1.0); | 2239 layer_transform.Translate(1.0, 1.0); |
| 2215 | 2240 |
| 2216 SetLayerPropertiesForTesting( | 2241 SetLayerPropertiesForTesting( |
| 2217 parent, layer_transform, gfx::Point3F(0.25f, 0.f, 0.f), | 2242 parent, layer_transform, gfx::Point3F(0.25f, 0.f, 0.f), |
| 2218 gfx::PointF(2.5f, 0.f), gfx::Size(10, 10), true, false, true); | 2243 gfx::PointF(2.5f, 0.f), gfx::Size(10, 10), true, false, true); |
| 2219 SetLayerPropertiesForTesting( | 2244 SetLayerPropertiesForTesting( |
| 2220 render_surface1, layer_transform, gfx::Point3F(0.25f, 0.f, 0.f), | 2245 render_surface1, layer_transform, gfx::Point3F(0.25f, 0.f, 0.f), |
| 2221 gfx::PointF(2.5f, 0.f), gfx::Size(10, 10), true, false, true); | 2246 gfx::PointF(2.5f, 0.f), gfx::Size(10, 10), true, false, true); |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2722 gfx::PointF(75.f, 75.f), gfx::Size(50, 50), true, | 2747 gfx::PointF(75.f, 75.f), gfx::Size(50, 50), true, |
| 2723 false, false); | 2748 false, false); |
| 2724 SetLayerPropertiesForTesting(child3_layer, identity_matrix, gfx::Point3F(), | 2749 SetLayerPropertiesForTesting(child3_layer, identity_matrix, gfx::Point3F(), |
| 2725 gfx::PointF(125.f, 125.f), gfx::Size(50, 50), | 2750 gfx::PointF(125.f, 125.f), gfx::Size(50, 50), |
| 2726 true, false, false); | 2751 true, false, false); |
| 2727 | 2752 |
| 2728 ExecuteCalculateDrawProperties(root); | 2753 ExecuteCalculateDrawProperties(root); |
| 2729 | 2754 |
| 2730 EXPECT_EQ(gfx::RectF(100.f, 100.f), | 2755 EXPECT_EQ(gfx::RectF(100.f, 100.f), |
| 2731 root->render_surface()->DrawableContentRect()); | 2756 root->render_surface()->DrawableContentRect()); |
| 2732 EXPECT_EQ(gfx::Rect(100, 100), root->drawable_content_rect()); | |
| 2733 | 2757 |
| 2734 // Layers that do not draw content should have empty visible_layer_rects. | 2758 // Layers that do not draw content should have empty visible_layer_rects. |
| 2735 EXPECT_EQ(gfx::Rect(0, 0, 0, 0), root->visible_layer_rect()); | 2759 EXPECT_EQ(gfx::Rect(0, 0, 0, 0), root->visible_layer_rect()); |
| 2736 | 2760 |
| 2737 // layer visible_layer_rects are clipped by their target surface. | 2761 // layer visible_layer_rects are clipped by their target surface. |
| 2738 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), child1_layer->visible_layer_rect()); | 2762 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), child1_layer->visible_layer_rect()); |
| 2739 EXPECT_EQ(gfx::Rect(0, 0, 25, 25), child2_layer->visible_layer_rect()); | 2763 EXPECT_EQ(gfx::Rect(0, 0, 25, 25), child2_layer->visible_layer_rect()); |
| 2740 EXPECT_TRUE(child3_layer->visible_layer_rect().IsEmpty()); | 2764 EXPECT_TRUE(child3_layer->visible_layer_rect().IsEmpty()); |
| 2741 | 2765 |
| 2742 // layer drawable_content_rects are not clipped. | 2766 // layer drawable_content_rects are not clipped. |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 2771 false, false); | 2795 false, false); |
| 2772 SetLayerPropertiesForTesting(grand_child3, identity_matrix, gfx::Point3F(), | 2796 SetLayerPropertiesForTesting(grand_child3, identity_matrix, gfx::Point3F(), |
| 2773 gfx::PointF(125.f, 125.f), gfx::Size(50, 50), | 2797 gfx::PointF(125.f, 125.f), gfx::Size(50, 50), |
| 2774 true, false, false); | 2798 true, false, false); |
| 2775 | 2799 |
| 2776 child->SetMasksToBounds(true); | 2800 child->SetMasksToBounds(true); |
| 2777 ExecuteCalculateDrawProperties(root); | 2801 ExecuteCalculateDrawProperties(root); |
| 2778 | 2802 |
| 2779 EXPECT_EQ(gfx::RectF(100.f, 100.f), | 2803 EXPECT_EQ(gfx::RectF(100.f, 100.f), |
| 2780 root->render_surface()->DrawableContentRect()); | 2804 root->render_surface()->DrawableContentRect()); |
| 2781 EXPECT_EQ(gfx::Rect(100, 100), root->drawable_content_rect()); | |
| 2782 | 2805 |
| 2783 // Layers that do not draw content should have empty visible content rects. | 2806 // Layers that do not draw content should have empty visible content rects. |
| 2784 EXPECT_EQ(gfx::Rect(0, 0, 0, 0), root->visible_layer_rect()); | 2807 EXPECT_EQ(gfx::Rect(0, 0, 0, 0), root->visible_layer_rect()); |
| 2785 EXPECT_EQ(gfx::Rect(0, 0, 0, 0), child->visible_layer_rect()); | 2808 EXPECT_EQ(gfx::Rect(0, 0, 0, 0), child->visible_layer_rect()); |
| 2786 | 2809 |
| 2787 // All grandchild visible content rects should be clipped by child. | 2810 // All grandchild visible content rects should be clipped by child. |
| 2788 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), grand_child1->visible_layer_rect()); | 2811 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), grand_child1->visible_layer_rect()); |
| 2789 EXPECT_EQ(gfx::Rect(0, 0, 25, 25), grand_child2->visible_layer_rect()); | 2812 EXPECT_EQ(gfx::Rect(0, 0, 25, 25), grand_child2->visible_layer_rect()); |
| 2790 EXPECT_TRUE(grand_child3->visible_layer_rect().IsEmpty()); | 2813 EXPECT_TRUE(grand_child3->visible_layer_rect().IsEmpty()); |
| 2791 | 2814 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2854 SetLayerPropertiesForTesting(child3, identity_matrix, gfx::Point3F(), | 2877 SetLayerPropertiesForTesting(child3, identity_matrix, gfx::Point3F(), |
| 2855 gfx::PointF(125.f, 125.f), gfx::Size(50, 50), | 2878 gfx::PointF(125.f, 125.f), gfx::Size(50, 50), |
| 2856 true, false, false); | 2879 true, false, false); |
| 2857 | 2880 |
| 2858 ExecuteCalculateDrawProperties(root); | 2881 ExecuteCalculateDrawProperties(root); |
| 2859 | 2882 |
| 2860 ASSERT_TRUE(render_surface->render_surface()); | 2883 ASSERT_TRUE(render_surface->render_surface()); |
| 2861 | 2884 |
| 2862 EXPECT_EQ(gfx::RectF(100.f, 100.f), | 2885 EXPECT_EQ(gfx::RectF(100.f, 100.f), |
| 2863 root->render_surface()->DrawableContentRect()); | 2886 root->render_surface()->DrawableContentRect()); |
| 2864 EXPECT_EQ(gfx::Rect(100, 100), root->drawable_content_rect()); | |
| 2865 | 2887 |
| 2866 // Layers that do not draw content should have empty visible content rects. | 2888 // Layers that do not draw content should have empty visible content rects. |
| 2867 EXPECT_EQ(gfx::Rect(0, 0, 0, 0), root->visible_layer_rect()); | 2889 EXPECT_EQ(gfx::Rect(0, 0, 0, 0), root->visible_layer_rect()); |
| 2868 EXPECT_EQ(gfx::Rect(0, 0, 0, 0), render_surface->visible_layer_rect()); | 2890 EXPECT_EQ(gfx::Rect(0, 0, 0, 0), render_surface->visible_layer_rect()); |
| 2869 | 2891 |
| 2870 // An unclipped surface grows its DrawableContentRect to include all drawable | 2892 // An unclipped surface grows its DrawableContentRect to include all drawable |
| 2871 // regions of the subtree. | 2893 // regions of the subtree. |
| 2872 EXPECT_EQ(gfx::RectF(5.f, 5.f, 170.f, 170.f), | 2894 EXPECT_EQ(gfx::RectF(5.f, 5.f, 170.f, 170.f), |
| 2873 render_surface->render_surface()->DrawableContentRect()); | 2895 render_surface->render_surface()->DrawableContentRect()); |
| 2874 | 2896 |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3381 true, false, false); | 3403 true, false, false); |
| 3382 | 3404 |
| 3383 root->SetMasksToBounds(true); | 3405 root->SetMasksToBounds(true); |
| 3384 | 3406 |
| 3385 ExecuteCalculateDrawProperties(root); | 3407 ExecuteCalculateDrawProperties(root); |
| 3386 | 3408 |
| 3387 ASSERT_TRUE(render_surface->render_surface()); | 3409 ASSERT_TRUE(render_surface->render_surface()); |
| 3388 | 3410 |
| 3389 EXPECT_EQ(gfx::RectF(100.f, 100.f), | 3411 EXPECT_EQ(gfx::RectF(100.f, 100.f), |
| 3390 root->render_surface()->DrawableContentRect()); | 3412 root->render_surface()->DrawableContentRect()); |
| 3391 EXPECT_EQ(gfx::Rect(100, 100), root->drawable_content_rect()); | |
| 3392 | 3413 |
| 3393 // Layers that do not draw content should have empty visible content rects. | 3414 // Layers that do not draw content should have empty visible content rects. |
| 3394 EXPECT_EQ(gfx::Rect(0, 0, 0, 0), root->visible_layer_rect()); | 3415 EXPECT_EQ(gfx::Rect(0, 0, 0, 0), root->visible_layer_rect()); |
| 3395 EXPECT_EQ(gfx::Rect(0, 0, 0, 0), render_surface->visible_layer_rect()); | 3416 EXPECT_EQ(gfx::Rect(0, 0, 0, 0), render_surface->visible_layer_rect()); |
| 3396 | 3417 |
| 3397 // A clipped surface grows its DrawableContentRect to include all drawable | 3418 // A clipped surface grows its DrawableContentRect to include all drawable |
| 3398 // regions of the subtree, but also gets clamped by the ancestor's clip. | 3419 // regions of the subtree, but also gets clamped by the ancestor's clip. |
| 3399 EXPECT_EQ(gfx::RectF(5.f, 5.f, 95.f, 95.f), | 3420 EXPECT_EQ(gfx::RectF(5.f, 5.f, 95.f, 95.f), |
| 3400 render_surface->render_surface()->DrawableContentRect()); | 3421 render_surface->render_surface()->DrawableContentRect()); |
| 3401 | 3422 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3446 | 3467 |
| 3447 root->SetMasksToBounds(true); | 3468 root->SetMasksToBounds(true); |
| 3448 | 3469 |
| 3449 ExecuteCalculateDrawProperties(root); | 3470 ExecuteCalculateDrawProperties(root); |
| 3450 | 3471 |
| 3451 ASSERT_TRUE(render_surface1->render_surface()); | 3472 ASSERT_TRUE(render_surface1->render_surface()); |
| 3452 ASSERT_TRUE(render_surface2->render_surface()); | 3473 ASSERT_TRUE(render_surface2->render_surface()); |
| 3453 | 3474 |
| 3454 EXPECT_EQ(gfx::RectF(100.f, 100.f), | 3475 EXPECT_EQ(gfx::RectF(100.f, 100.f), |
| 3455 root->render_surface()->DrawableContentRect()); | 3476 root->render_surface()->DrawableContentRect()); |
| 3456 EXPECT_EQ(gfx::Rect(100, 100), root->drawable_content_rect()); | |
| 3457 | 3477 |
| 3458 // Layers that do not draw content should have empty visible content rects. | 3478 // Layers that do not draw content should have empty visible content rects |
|
ajuma
2015/11/09 23:17:19
Nit (here and once more below): no need to remove
jaydasika
2015/11/09 23:27:58
Done.
| |
| 3459 EXPECT_EQ(gfx::Rect(0, 0, 0, 0), root->visible_layer_rect()); | 3479 EXPECT_EQ(gfx::Rect(0, 0, 0, 0), root->visible_layer_rect()); |
| 3460 EXPECT_EQ(gfx::Rect(0, 0, 0, 0), render_surface1->visible_layer_rect()); | 3480 EXPECT_EQ(gfx::Rect(0, 0, 0, 0), render_surface1->visible_layer_rect()); |
| 3461 EXPECT_EQ(gfx::Rect(0, 0, 0, 0), render_surface2->visible_layer_rect()); | 3481 EXPECT_EQ(gfx::Rect(0, 0, 0, 0), render_surface2->visible_layer_rect()); |
| 3462 | 3482 |
| 3463 // A clipped surface grows its DrawableContentRect to include all drawable | 3483 // A clipped surface grows its DrawableContentRect to include all drawable |
| 3464 // regions of the subtree, but also gets clamped by the ancestor's clip. | 3484 // regions of the subtree, but also gets clamped by the ancestor's clip. |
| 3465 EXPECT_EQ(gfx::RectF(5.f, 5.f, 95.f, 95.f), | 3485 EXPECT_EQ(gfx::RectF(5.f, 5.f, 95.f, 95.f), |
| 3466 render_surface1->render_surface()->DrawableContentRect()); | 3486 render_surface1->render_surface()->DrawableContentRect()); |
| 3467 | 3487 |
| 3468 // render_surface1 lives in the "unclipped universe" of render_surface1, and | 3488 // render_surface1 lives in the "unclipped universe" of render_surface1, and |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3739 SetLayerPropertiesForTesting( | 3759 SetLayerPropertiesForTesting( |
| 3740 child1, child_rotation, gfx::Point3F(25, 25, 0.f), | 3760 child1, child_rotation, gfx::Point3F(25, 25, 0.f), |
| 3741 gfx::PointF(25.f, 25.f), gfx::Size(50, 50), true, false, false); | 3761 gfx::PointF(25.f, 25.f), gfx::Size(50, 50), true, false, false); |
| 3742 | 3762 |
| 3743 ExecuteCalculateDrawProperties(root); | 3763 ExecuteCalculateDrawProperties(root); |
| 3744 | 3764 |
| 3745 ASSERT_TRUE(render_surface->render_surface()); | 3765 ASSERT_TRUE(render_surface->render_surface()); |
| 3746 | 3766 |
| 3747 EXPECT_EQ(gfx::RectF(100.f, 100.f), | 3767 EXPECT_EQ(gfx::RectF(100.f, 100.f), |
| 3748 root->render_surface()->DrawableContentRect()); | 3768 root->render_surface()->DrawableContentRect()); |
| 3749 EXPECT_EQ(gfx::Rect(0, 0, 100, 100), root->drawable_content_rect()); | |
| 3750 | 3769 |
| 3751 // Layers that do not draw content should have empty visible content rects. | 3770 // Layers that do not draw content should have empty visible content rects |
| 3752 EXPECT_EQ(gfx::Rect(0, 0, 0, 0), root->visible_layer_rect()); | 3771 EXPECT_EQ(gfx::Rect(0, 0, 0, 0), root->visible_layer_rect()); |
| 3753 EXPECT_EQ(gfx::Rect(0, 0, 0, 0), render_surface->visible_layer_rect()); | 3772 EXPECT_EQ(gfx::Rect(0, 0, 0, 0), render_surface->visible_layer_rect()); |
| 3754 | 3773 |
| 3755 // The unclipped surface grows its DrawableContentRect to include all drawable | 3774 // The unclipped surface grows its DrawableContentRect to include all drawable |
| 3756 // regions of the subtree. | 3775 // regions of the subtree. |
| 3757 int diagonal_radius = ceil(sqrt(2.0) * 25.0); | 3776 int diagonal_radius = ceil(sqrt(2.0) * 25.0); |
| 3758 gfx::Rect expected_surface_drawable_content = | 3777 gfx::Rect expected_surface_drawable_content = |
| 3759 gfx::Rect(50 - diagonal_radius, | 3778 gfx::Rect(50 - diagonal_radius, |
| 3760 50 - diagonal_radius, | 3779 50 - diagonal_radius, |
| 3761 diagonal_radius * 2, | 3780 diagonal_radius * 2, |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3864 | 3883 |
| 3865 ExecuteCalculateDrawProperties(root, device_scale_factor); | 3884 ExecuteCalculateDrawProperties(root, device_scale_factor); |
| 3866 | 3885 |
| 3867 ASSERT_TRUE(render_surface1->render_surface()); | 3886 ASSERT_TRUE(render_surface1->render_surface()); |
| 3868 ASSERT_TRUE(render_surface2->render_surface()); | 3887 ASSERT_TRUE(render_surface2->render_surface()); |
| 3869 | 3888 |
| 3870 // drawable_content_rects for all layers and surfaces are scaled by | 3889 // drawable_content_rects for all layers and surfaces are scaled by |
| 3871 // device_scale_factor. | 3890 // device_scale_factor. |
| 3872 EXPECT_EQ(gfx::RectF(200.f, 200.f), | 3891 EXPECT_EQ(gfx::RectF(200.f, 200.f), |
| 3873 root->render_surface()->DrawableContentRect()); | 3892 root->render_surface()->DrawableContentRect()); |
| 3874 EXPECT_EQ(gfx::Rect(0, 0, 200, 200), root->drawable_content_rect()); | |
| 3875 EXPECT_EQ(gfx::RectF(10.f, 10.f, 190.f, 190.f), | 3893 EXPECT_EQ(gfx::RectF(10.f, 10.f, 190.f, 190.f), |
| 3876 render_surface1->render_surface()->DrawableContentRect()); | 3894 render_surface1->render_surface()->DrawableContentRect()); |
| 3877 | 3895 |
| 3878 // render_surface2 lives in the "unclipped universe" of render_surface1, and | 3896 // render_surface2 lives in the "unclipped universe" of render_surface1, and |
| 3879 // is only implicitly clipped by render_surface1. | 3897 // is only implicitly clipped by render_surface1. |
| 3880 EXPECT_EQ(gfx::RectF(10.f, 10.f, 350.f, 350.f), | 3898 EXPECT_EQ(gfx::RectF(10.f, 10.f, 350.f, 350.f), |
| 3881 render_surface2->render_surface()->DrawableContentRect()); | 3899 render_surface2->render_surface()->DrawableContentRect()); |
| 3882 | 3900 |
| 3883 EXPECT_EQ(gfx::Rect(10, 10, 100, 100), child1->drawable_content_rect()); | 3901 EXPECT_EQ(gfx::Rect(10, 10, 100, 100), child1->drawable_content_rect()); |
| 3884 EXPECT_EQ(gfx::Rect(150, 150, 100, 100), child2->drawable_content_rect()); | 3902 EXPECT_EQ(gfx::Rect(150, 150, 100, 100), child2->drawable_content_rect()); |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4411 EXPECT_EQ(2u, update_layer_list().size()); | 4429 EXPECT_EQ(2u, update_layer_list().size()); |
| 4412 EXPECT_TRUE(UpdateLayerListContains(front_facing_surface->id())); | 4430 EXPECT_TRUE(UpdateLayerListContains(front_facing_surface->id())); |
| 4413 EXPECT_TRUE(UpdateLayerListContains(child1->id())); | 4431 EXPECT_TRUE(UpdateLayerListContains(child1->id())); |
| 4414 } | 4432 } |
| 4415 | 4433 |
| 4416 TEST_F(LayerTreeHostCommonScalingTest, LayerTransformsInHighDPI) { | 4434 TEST_F(LayerTreeHostCommonScalingTest, LayerTransformsInHighDPI) { |
| 4417 // Verify draw and screen space transforms of layers not in a surface. | 4435 // Verify draw and screen space transforms of layers not in a surface. |
| 4418 gfx::Transform identity_matrix; | 4436 gfx::Transform identity_matrix; |
| 4419 | 4437 |
| 4420 LayerImpl* parent = root_layer(); | 4438 LayerImpl* parent = root_layer(); |
| 4439 parent->SetDrawsContent(true); | |
| 4421 SetLayerPropertiesForTesting(parent, identity_matrix, gfx::Point3F(), | 4440 SetLayerPropertiesForTesting(parent, identity_matrix, gfx::Point3F(), |
| 4422 gfx::PointF(), gfx::Size(100, 100), false, true, | 4441 gfx::PointF(), gfx::Size(100, 100), false, true, |
| 4423 true); | 4442 true); |
| 4424 | 4443 |
| 4425 LayerImpl* child = AddChildToRoot<LayerImpl>(); | 4444 LayerImpl* child = AddChildToRoot<LayerImpl>(); |
| 4445 child->SetDrawsContent(true); | |
| 4426 SetLayerPropertiesForTesting(child, identity_matrix, gfx::Point3F(), | 4446 SetLayerPropertiesForTesting(child, identity_matrix, gfx::Point3F(), |
| 4427 gfx::PointF(2.f, 2.f), gfx::Size(10, 10), false, | 4447 gfx::PointF(2.f, 2.f), gfx::Size(10, 10), false, |
| 4428 true, false); | 4448 true, false); |
| 4429 | 4449 |
| 4430 LayerImpl* child_empty = AddChildToRoot<LayerImpl>(); | 4450 LayerImpl* child2 = AddChildToRoot<LayerImpl>(); |
| 4431 SetLayerPropertiesForTesting(child_empty, identity_matrix, gfx::Point3F(), | 4451 child2->SetDrawsContent(true); |
| 4432 gfx::PointF(2.f, 2.f), gfx::Size(), false, true, | 4452 SetLayerPropertiesForTesting(child2, identity_matrix, gfx::Point3F(), |
| 4433 false); | 4453 gfx::PointF(2.f, 2.f), gfx::Size(5, 5), false, |
| 4454 true, false); | |
| 4434 | 4455 |
| 4435 float device_scale_factor = 2.5f; | 4456 float device_scale_factor = 2.5f; |
| 4436 gfx::Size viewport_size(100, 100); | 4457 gfx::Size viewport_size(100, 100); |
| 4437 ExecuteCalculateDrawProperties(parent, device_scale_factor); | 4458 ExecuteCalculateDrawProperties(parent, device_scale_factor); |
| 4438 | 4459 |
| 4439 EXPECT_IDEAL_SCALE_EQ(device_scale_factor, parent); | 4460 EXPECT_IDEAL_SCALE_EQ(device_scale_factor, parent); |
| 4440 EXPECT_IDEAL_SCALE_EQ(device_scale_factor, child); | 4461 EXPECT_IDEAL_SCALE_EQ(device_scale_factor, child); |
| 4441 EXPECT_IDEAL_SCALE_EQ(device_scale_factor, child_empty); | 4462 EXPECT_IDEAL_SCALE_EQ(device_scale_factor, child2); |
| 4442 | 4463 |
| 4443 EXPECT_EQ(1u, render_surface_layer_list_impl()->size()); | 4464 EXPECT_EQ(1u, render_surface_layer_list_impl()->size()); |
| 4444 | 4465 |
| 4445 // Verify parent transforms | 4466 // Verify parent transforms |
| 4446 gfx::Transform expected_parent_transform; | 4467 gfx::Transform expected_parent_transform; |
| 4447 expected_parent_transform.Scale(device_scale_factor, device_scale_factor); | 4468 expected_parent_transform.Scale(device_scale_factor, device_scale_factor); |
| 4448 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_parent_transform, | 4469 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_parent_transform, |
| 4449 parent->screen_space_transform()); | 4470 parent->screen_space_transform()); |
| 4450 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_parent_transform, | 4471 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_parent_transform, |
| 4451 parent->draw_transform()); | 4472 parent->draw_transform()); |
| 4452 | 4473 |
| 4453 // Verify results of transformed parent rects | 4474 // Verify results of transformed parent rects |
| 4454 gfx::RectF parent_bounds(gfx::SizeF(parent->bounds())); | 4475 gfx::RectF parent_bounds(gfx::SizeF(parent->bounds())); |
| 4455 | 4476 |
| 4456 gfx::RectF parent_draw_rect = | 4477 gfx::RectF parent_draw_rect = |
| 4457 MathUtil::MapClippedRect(parent->draw_transform(), parent_bounds); | 4478 MathUtil::MapClippedRect(parent->draw_transform(), parent_bounds); |
| 4458 gfx::RectF parent_screen_space_rect = | 4479 gfx::RectF parent_screen_space_rect = |
| 4459 MathUtil::MapClippedRect(parent->screen_space_transform(), parent_bounds); | 4480 MathUtil::MapClippedRect(parent->screen_space_transform(), parent_bounds); |
| 4460 | 4481 |
| 4461 gfx::RectF expected_parent_draw_rect(gfx::SizeF(parent->bounds())); | 4482 gfx::RectF expected_parent_draw_rect(gfx::SizeF(parent->bounds())); |
| 4462 expected_parent_draw_rect.Scale(device_scale_factor); | 4483 expected_parent_draw_rect.Scale(device_scale_factor); |
| 4463 EXPECT_FLOAT_RECT_EQ(expected_parent_draw_rect, parent_draw_rect); | 4484 EXPECT_FLOAT_RECT_EQ(expected_parent_draw_rect, parent_draw_rect); |
| 4464 EXPECT_FLOAT_RECT_EQ(expected_parent_draw_rect, parent_screen_space_rect); | 4485 EXPECT_FLOAT_RECT_EQ(expected_parent_draw_rect, parent_screen_space_rect); |
| 4465 | 4486 |
| 4466 // Verify child and child_empty transforms. They should match. | 4487 // Verify child and child2 transforms. They should match. |
| 4467 gfx::Transform expected_child_transform; | 4488 gfx::Transform expected_child_transform; |
| 4468 expected_child_transform.Scale(device_scale_factor, device_scale_factor); | 4489 expected_child_transform.Scale(device_scale_factor, device_scale_factor); |
| 4469 expected_child_transform.Translate(child->position().x(), | 4490 expected_child_transform.Translate(child->position().x(), |
| 4470 child->position().y()); | 4491 child->position().y()); |
| 4471 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_child_transform, | 4492 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_child_transform, |
| 4472 child->draw_transform()); | 4493 child->draw_transform()); |
| 4473 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_child_transform, | 4494 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_child_transform, |
| 4474 child->screen_space_transform()); | 4495 child->screen_space_transform()); |
| 4475 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_child_transform, | 4496 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_child_transform, |
| 4476 child_empty->draw_transform()); | 4497 child2->draw_transform()); |
| 4477 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_child_transform, | 4498 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_child_transform, |
| 4478 child_empty->screen_space_transform()); | 4499 child2->screen_space_transform()); |
| 4479 | 4500 |
| 4480 // Verify results of transformed child and child_empty rects. They should | 4501 // Verify results of transformed child and child2 rects. They should |
| 4481 // match. | 4502 // match. |
| 4482 gfx::RectF child_bounds(gfx::SizeF(child->bounds())); | 4503 gfx::RectF child_bounds(gfx::SizeF(child->bounds())); |
| 4483 | 4504 |
| 4484 gfx::RectF child_draw_rect = | 4505 gfx::RectF child_draw_rect = |
| 4485 MathUtil::MapClippedRect(child->draw_transform(), child_bounds); | 4506 MathUtil::MapClippedRect(child->draw_transform(), child_bounds); |
| 4486 gfx::RectF child_screen_space_rect = | 4507 gfx::RectF child_screen_space_rect = |
| 4487 MathUtil::MapClippedRect(child->screen_space_transform(), child_bounds); | 4508 MathUtil::MapClippedRect(child->screen_space_transform(), child_bounds); |
| 4488 | 4509 |
| 4489 gfx::RectF child_empty_draw_rect = | 4510 gfx::RectF child2_draw_rect = |
| 4490 MathUtil::MapClippedRect(child_empty->draw_transform(), child_bounds); | 4511 MathUtil::MapClippedRect(child2->draw_transform(), child_bounds); |
| 4491 gfx::RectF child_empty_screen_space_rect = MathUtil::MapClippedRect( | 4512 gfx::RectF child2_screen_space_rect = |
| 4492 child_empty->screen_space_transform(), child_bounds); | 4513 MathUtil::MapClippedRect(child2->screen_space_transform(), child_bounds); |
| 4493 | 4514 |
| 4494 gfx::RectF expected_child_draw_rect(child->position(), | 4515 gfx::RectF expected_child_draw_rect(child->position(), |
| 4495 gfx::SizeF(child->bounds())); | 4516 gfx::SizeF(child->bounds())); |
| 4496 expected_child_draw_rect.Scale(device_scale_factor); | 4517 expected_child_draw_rect.Scale(device_scale_factor); |
| 4497 EXPECT_FLOAT_RECT_EQ(expected_child_draw_rect, child_draw_rect); | 4518 EXPECT_FLOAT_RECT_EQ(expected_child_draw_rect, child_draw_rect); |
| 4498 EXPECT_FLOAT_RECT_EQ(expected_child_draw_rect, child_screen_space_rect); | 4519 EXPECT_FLOAT_RECT_EQ(expected_child_draw_rect, child_screen_space_rect); |
| 4499 EXPECT_FLOAT_RECT_EQ(expected_child_draw_rect, child_empty_draw_rect); | 4520 EXPECT_FLOAT_RECT_EQ(expected_child_draw_rect, child2_draw_rect); |
| 4500 EXPECT_FLOAT_RECT_EQ(expected_child_draw_rect, child_empty_screen_space_rect); | 4521 EXPECT_FLOAT_RECT_EQ(expected_child_draw_rect, child2_screen_space_rect); |
| 4501 } | 4522 } |
| 4502 | 4523 |
| 4503 TEST_F(LayerTreeHostCommonScalingTest, SurfaceLayerTransformsInHighDPI) { | 4524 TEST_F(LayerTreeHostCommonScalingTest, SurfaceLayerTransformsInHighDPI) { |
| 4504 // Verify draw and screen space transforms of layers in a surface. | 4525 // Verify draw and screen space transforms of layers in a surface. |
| 4505 gfx::Transform identity_matrix; | 4526 gfx::Transform identity_matrix; |
| 4506 gfx::Transform perspective_matrix; | 4527 gfx::Transform perspective_matrix; |
| 4507 perspective_matrix.ApplyPerspectiveDepth(2.0); | 4528 perspective_matrix.ApplyPerspectiveDepth(2.0); |
| 4508 | 4529 |
| 4509 gfx::Transform scale_small_matrix; | 4530 gfx::Transform scale_small_matrix; |
| 4510 scale_small_matrix.Scale(SK_MScalar1 / 10.f, SK_MScalar1 / 12.f); | 4531 scale_small_matrix.Scale(SK_MScalar1 / 10.f, SK_MScalar1 / 12.f); |
| 4511 | 4532 |
| 4512 LayerImpl* root = root_layer(); | 4533 LayerImpl* root = root_layer(); |
| 4513 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(), | 4534 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(), |
| 4514 gfx::PointF(), gfx::Size(100, 100), false, true, | 4535 gfx::PointF(), gfx::Size(100, 100), false, true, |
| 4515 false); | 4536 false); |
| 4516 LayerImpl* parent = AddChildToRoot<LayerImpl>(); | 4537 LayerImpl* parent = AddChildToRoot<LayerImpl>(); |
| 4538 parent->SetDrawsContent(true); | |
| 4517 SetLayerPropertiesForTesting(parent, identity_matrix, gfx::Point3F(), | 4539 SetLayerPropertiesForTesting(parent, identity_matrix, gfx::Point3F(), |
| 4518 gfx::PointF(), gfx::Size(100, 100), false, true, | 4540 gfx::PointF(), gfx::Size(100, 100), false, true, |
| 4519 false); | 4541 false); |
| 4520 | 4542 |
| 4521 LayerImpl* perspective_surface = AddChild<LayerImpl>(parent); | 4543 LayerImpl* perspective_surface = AddChild<LayerImpl>(parent); |
| 4522 SetLayerPropertiesForTesting(perspective_surface, | 4544 SetLayerPropertiesForTesting(perspective_surface, |
| 4523 perspective_matrix * scale_small_matrix, | 4545 perspective_matrix * scale_small_matrix, |
| 4524 gfx::Point3F(), gfx::PointF(2.f, 2.f), | 4546 gfx::Point3F(), gfx::PointF(2.f, 2.f), |
| 4525 gfx::Size(10, 10), false, true, true); | 4547 gfx::Size(10, 10), false, true, true); |
| 4526 perspective_surface->SetDrawsContent(true); | 4548 perspective_surface->SetDrawsContent(true); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4597 parent_scale_matrix.Scale(initial_parent_scale, initial_parent_scale); | 4619 parent_scale_matrix.Scale(initial_parent_scale, initial_parent_scale); |
| 4598 | 4620 |
| 4599 gfx::Transform child_scale_matrix; | 4621 gfx::Transform child_scale_matrix; |
| 4600 SkMScalar initial_child_scale = 0.25; | 4622 SkMScalar initial_child_scale = 0.25; |
| 4601 child_scale_matrix.Scale(initial_child_scale, initial_child_scale); | 4623 child_scale_matrix.Scale(initial_child_scale, initial_child_scale); |
| 4602 | 4624 |
| 4603 LayerImpl* root = root_layer(); | 4625 LayerImpl* root = root_layer(); |
| 4604 root->SetBounds(gfx::Size(100, 100)); | 4626 root->SetBounds(gfx::Size(100, 100)); |
| 4605 | 4627 |
| 4606 LayerImpl* parent = AddChildToRoot<LayerImpl>(); | 4628 LayerImpl* parent = AddChildToRoot<LayerImpl>(); |
| 4629 parent->SetDrawsContent(true); | |
| 4607 SetLayerPropertiesForTesting(parent, parent_scale_matrix, gfx::Point3F(), | 4630 SetLayerPropertiesForTesting(parent, parent_scale_matrix, gfx::Point3F(), |
| 4608 gfx::PointF(), gfx::Size(100, 100), false, true, | 4631 gfx::PointF(), gfx::Size(100, 100), false, true, |
| 4609 false); | 4632 false); |
| 4610 | 4633 |
| 4611 LayerImpl* child_scale = AddChild<LayerImpl>(parent); | 4634 LayerImpl* child_scale = AddChild<LayerImpl>(parent); |
| 4635 child_scale->SetDrawsContent(true); | |
| 4612 SetLayerPropertiesForTesting(child_scale, child_scale_matrix, gfx::Point3F(), | 4636 SetLayerPropertiesForTesting(child_scale, child_scale_matrix, gfx::Point3F(), |
| 4613 gfx::PointF(2.f, 2.f), gfx::Size(10, 10), false, | 4637 gfx::PointF(2.f, 2.f), gfx::Size(10, 10), false, |
| 4614 true, false); | 4638 true, false); |
| 4615 | 4639 |
| 4616 float device_scale_factor = 2.5f; | 4640 float device_scale_factor = 2.5f; |
| 4617 float page_scale_factor = 0.01f; | 4641 float page_scale_factor = 0.01f; |
| 4618 | 4642 |
| 4619 { | 4643 { |
| 4620 ExecuteCalculateDrawProperties(root, device_scale_factor, page_scale_factor, | 4644 ExecuteCalculateDrawProperties(root, device_scale_factor, page_scale_factor, |
| 4621 root); | 4645 root); |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 4639 parent_scale_matrix.Scale(initial_parent_scale, initial_parent_scale); | 4663 parent_scale_matrix.Scale(initial_parent_scale, initial_parent_scale); |
| 4640 | 4664 |
| 4641 gfx::Transform child_scale_matrix; | 4665 gfx::Transform child_scale_matrix; |
| 4642 SkMScalar initial_child_scale = 1.25; | 4666 SkMScalar initial_child_scale = 1.25; |
| 4643 child_scale_matrix.Scale(initial_child_scale, initial_child_scale); | 4667 child_scale_matrix.Scale(initial_child_scale, initial_child_scale); |
| 4644 | 4668 |
| 4645 LayerImpl* root = root_layer(); | 4669 LayerImpl* root = root_layer(); |
| 4646 root->SetBounds(gfx::Size(100, 100)); | 4670 root->SetBounds(gfx::Size(100, 100)); |
| 4647 | 4671 |
| 4648 LayerImpl* parent = AddChildToRoot<LayerImpl>(); | 4672 LayerImpl* parent = AddChildToRoot<LayerImpl>(); |
| 4673 parent->SetDrawsContent(true); | |
| 4649 SetLayerPropertiesForTesting(parent, parent_scale_matrix, gfx::Point3F(), | 4674 SetLayerPropertiesForTesting(parent, parent_scale_matrix, gfx::Point3F(), |
| 4650 gfx::PointF(), gfx::Size(100, 100), false, true, | 4675 gfx::PointF(), gfx::Size(100, 100), false, true, |
| 4651 false); | 4676 false); |
| 4652 | 4677 |
| 4653 LayerImpl* child_scale = AddChild<LayerImpl>(parent); | 4678 LayerImpl* child_scale = AddChild<LayerImpl>(parent); |
| 4679 child_scale->SetDrawsContent(true); | |
| 4654 SetLayerPropertiesForTesting(child_scale, child_scale_matrix, gfx::Point3F(), | 4680 SetLayerPropertiesForTesting(child_scale, child_scale_matrix, gfx::Point3F(), |
| 4655 gfx::PointF(2.f, 2.f), gfx::Size(10, 10), false, | 4681 gfx::PointF(2.f, 2.f), gfx::Size(10, 10), false, |
| 4656 true, false); | 4682 true, false); |
| 4657 | 4683 |
| 4658 { | 4684 { |
| 4659 ExecuteCalculateDrawProperties(root); | 4685 ExecuteCalculateDrawProperties(root); |
| 4660 | 4686 |
| 4661 EXPECT_IDEAL_SCALE_EQ(initial_parent_scale, parent); | 4687 EXPECT_IDEAL_SCALE_EQ(initial_parent_scale, parent); |
| 4662 // Animating layers compute ideal scale in the same way as when | 4688 // Animating layers compute ideal scale in the same way as when |
| 4663 // they are static. | 4689 // they are static. |
| (...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5599 // + intervening (masks to bounds) | 5625 // + intervening (masks to bounds) |
| 5600 // + render_surface2 (also sets opacity) | 5626 // + render_surface2 (also sets opacity) |
| 5601 // + clip_child | 5627 // + clip_child |
| 5602 // | 5628 // |
| 5603 LayerImpl* root = root_layer(); | 5629 LayerImpl* root = root_layer(); |
| 5604 LayerImpl* clip_parent = AddChildToRoot<LayerImpl>(); | 5630 LayerImpl* clip_parent = AddChildToRoot<LayerImpl>(); |
| 5605 LayerImpl* render_surface1 = AddChild<LayerImpl>(clip_parent); | 5631 LayerImpl* render_surface1 = AddChild<LayerImpl>(clip_parent); |
| 5606 LayerImpl* intervening = AddChild<LayerImpl>(render_surface1); | 5632 LayerImpl* intervening = AddChild<LayerImpl>(render_surface1); |
| 5607 LayerImpl* render_surface2 = AddChild<LayerImpl>(intervening); | 5633 LayerImpl* render_surface2 = AddChild<LayerImpl>(intervening); |
| 5608 LayerImpl* clip_child = AddChild<LayerImpl>(render_surface2); | 5634 LayerImpl* clip_child = AddChild<LayerImpl>(render_surface2); |
| 5635 render_surface1->SetDrawsContent(true); | |
| 5636 render_surface2->SetDrawsContent(true); | |
| 5609 clip_child->SetDrawsContent(true); | 5637 clip_child->SetDrawsContent(true); |
| 5610 | 5638 |
| 5611 clip_child->SetClipParent(clip_parent); | 5639 clip_child->SetClipParent(clip_parent); |
| 5612 | 5640 |
| 5613 intervening->SetMasksToBounds(true); | 5641 intervening->SetMasksToBounds(true); |
| 5614 clip_parent->SetMasksToBounds(true); | 5642 clip_parent->SetMasksToBounds(true); |
| 5615 | 5643 |
| 5616 gfx::Transform translation_transform; | 5644 gfx::Transform translation_transform; |
| 5617 translation_transform.Translate(2, 2); | 5645 translation_transform.Translate(2, 2); |
| 5618 | 5646 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5690 // + intervening (masks to bounds AND scrolls) | 5718 // + intervening (masks to bounds AND scrolls) |
| 5691 // + render_surface2 (also sets opacity) | 5719 // + render_surface2 (also sets opacity) |
| 5692 // + clip_child | 5720 // + clip_child |
| 5693 // | 5721 // |
| 5694 LayerImpl* root = root_layer(); | 5722 LayerImpl* root = root_layer(); |
| 5695 LayerImpl* clip_parent = AddChildToRoot<LayerImpl>(); | 5723 LayerImpl* clip_parent = AddChildToRoot<LayerImpl>(); |
| 5696 LayerImpl* render_surface1 = AddChild<LayerImpl>(clip_parent); | 5724 LayerImpl* render_surface1 = AddChild<LayerImpl>(clip_parent); |
| 5697 LayerImpl* intervening = AddChild<LayerImpl>(render_surface1); | 5725 LayerImpl* intervening = AddChild<LayerImpl>(render_surface1); |
| 5698 LayerImpl* render_surface2 = AddChild<LayerImpl>(intervening); | 5726 LayerImpl* render_surface2 = AddChild<LayerImpl>(intervening); |
| 5699 LayerImpl* clip_child = AddChild<LayerImpl>(render_surface2); | 5727 LayerImpl* clip_child = AddChild<LayerImpl>(render_surface2); |
| 5728 render_surface1->SetDrawsContent(true); | |
| 5729 render_surface2->SetDrawsContent(true); | |
| 5700 clip_child->SetDrawsContent(true); | 5730 clip_child->SetDrawsContent(true); |
| 5701 | 5731 |
| 5702 clip_child->SetClipParent(clip_parent); | 5732 clip_child->SetClipParent(clip_parent); |
| 5703 | 5733 |
| 5704 intervening->SetMasksToBounds(true); | 5734 intervening->SetMasksToBounds(true); |
| 5705 clip_parent->SetMasksToBounds(true); | 5735 clip_parent->SetMasksToBounds(true); |
| 5706 intervening->SetScrollClipLayer(clip_parent->id()); | 5736 intervening->SetScrollClipLayer(clip_parent->id()); |
| 5707 intervening->SetCurrentScrollOffset(gfx::ScrollOffset(3, 3)); | 5737 intervening->SetCurrentScrollOffset(gfx::ScrollOffset(3, 3)); |
| 5708 | 5738 |
| 5709 gfx::Transform translation_transform; | 5739 gfx::Transform translation_transform; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5779 // + clip_parent (masks to bounds) | 5809 // + clip_parent (masks to bounds) |
| 5780 // + intervening (masks to bounds) | 5810 // + intervening (masks to bounds) |
| 5781 // + clip_child | 5811 // + clip_child |
| 5782 // + child | 5812 // + child |
| 5783 // | 5813 // |
| 5784 LayerImpl* root = root_layer(); | 5814 LayerImpl* root = root_layer(); |
| 5785 LayerImpl* clip_parent = AddChild<LayerImpl>(root); | 5815 LayerImpl* clip_parent = AddChild<LayerImpl>(root); |
| 5786 LayerImpl* intervening = AddChild<LayerImpl>(clip_parent); | 5816 LayerImpl* intervening = AddChild<LayerImpl>(clip_parent); |
| 5787 LayerImpl* clip_child = AddChild<LayerImpl>(intervening); | 5817 LayerImpl* clip_child = AddChild<LayerImpl>(intervening); |
| 5788 LayerImpl* child = AddChild<LayerImpl>(clip_child); | 5818 LayerImpl* child = AddChild<LayerImpl>(clip_child); |
| 5819 clip_child->SetDrawsContent(true); | |
| 5789 child->SetDrawsContent(true); | 5820 child->SetDrawsContent(true); |
| 5790 | 5821 |
| 5791 clip_child->SetClipParent(clip_parent); | 5822 clip_child->SetClipParent(clip_parent); |
| 5792 scoped_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>); | 5823 scoped_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>); |
| 5793 clip_children->insert(clip_child); | 5824 clip_children->insert(clip_child); |
| 5794 clip_parent->SetClipChildren(clip_children.release()); | 5825 clip_parent->SetClipChildren(clip_children.release()); |
| 5795 | 5826 |
| 5796 intervening->SetMasksToBounds(true); | 5827 intervening->SetMasksToBounds(true); |
| 5797 clip_parent->SetMasksToBounds(true); | 5828 clip_parent->SetMasksToBounds(true); |
| 5798 | 5829 |
| (...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6631 scoped_ptr<LayerImpl> scroller = | 6662 scoped_ptr<LayerImpl> scroller = |
| 6632 LayerImpl::Create(host_impl.active_tree(), 3); | 6663 LayerImpl::Create(host_impl.active_tree(), 3); |
| 6633 LayerImpl* scroll_layer = scroller.get(); | 6664 LayerImpl* scroll_layer = scroller.get(); |
| 6634 scoped_ptr<LayerImpl> fixed = LayerImpl::Create(host_impl.active_tree(), 4); | 6665 scoped_ptr<LayerImpl> fixed = LayerImpl::Create(host_impl.active_tree(), 4); |
| 6635 LayerImpl* fixed_layer = fixed.get(); | 6666 LayerImpl* fixed_layer = fixed.get(); |
| 6636 | 6667 |
| 6637 container->SetIsContainerForFixedPositionLayers(true); | 6668 container->SetIsContainerForFixedPositionLayers(true); |
| 6638 | 6669 |
| 6639 LayerPositionConstraint constraint; | 6670 LayerPositionConstraint constraint; |
| 6640 constraint.set_is_fixed_position(true); | 6671 constraint.set_is_fixed_position(true); |
| 6672 container->SetDrawsContent(true); | |
| 6673 fixed->SetDrawsContent(true); | |
| 6641 fixed->SetPositionConstraint(constraint); | 6674 fixed->SetPositionConstraint(constraint); |
| 6642 | 6675 |
| 6676 scroller->SetDrawsContent(true); | |
| 6643 scroller->SetScrollClipLayer(container->id()); | 6677 scroller->SetScrollClipLayer(container->id()); |
| 6644 | 6678 |
| 6645 gfx::Transform identity_transform; | 6679 gfx::Transform identity_transform; |
| 6646 gfx::Transform container_transform; | 6680 gfx::Transform container_transform; |
| 6647 container_transform.Translate3d(10.0, 20.0, 0.0); | 6681 container_transform.Translate3d(10.0, 20.0, 0.0); |
| 6648 gfx::Vector2dF container_offset = container_transform.To2dTranslation(); | 6682 gfx::Vector2dF container_offset = container_transform.To2dTranslation(); |
| 6649 | 6683 |
| 6650 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), | 6684 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), |
| 6651 gfx::PointF(), gfx::Size(50, 50), true, false, | 6685 gfx::PointF(), gfx::Size(50, 50), true, false, |
| 6652 true); | 6686 true); |
| (...skipping 2384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9037 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(), | 9071 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(), |
| 9038 gfx::PointF(), gfx::Size(30, 30), true, false, | 9072 gfx::PointF(), gfx::Size(30, 30), true, false, |
| 9039 true); | 9073 true); |
| 9040 SetLayerPropertiesForTesting(render_surface, identity_matrix, gfx::Point3F(), | 9074 SetLayerPropertiesForTesting(render_surface, identity_matrix, gfx::Point3F(), |
| 9041 gfx::PointF(), gfx::Size(50, 50), true, false, | 9075 gfx::PointF(), gfx::Size(50, 50), true, false, |
| 9042 true); | 9076 true); |
| 9043 SetLayerPropertiesForTesting(test_layer, identity_matrix, gfx::Point3F(), | 9077 SetLayerPropertiesForTesting(test_layer, identity_matrix, gfx::Point3F(), |
| 9044 gfx::PointF(), gfx::Size(50, 50), true, false, | 9078 gfx::PointF(), gfx::Size(50, 50), true, false, |
| 9045 false); | 9079 false); |
| 9046 root->SetMasksToBounds(true); | 9080 root->SetMasksToBounds(true); |
| 9081 root->SetDrawsContent(true); | |
| 9047 render_surface->SetMasksToBounds(true); | 9082 render_surface->SetMasksToBounds(true); |
| 9083 render_surface->SetDrawsContent(true); | |
| 9048 test_layer->SetMasksToBounds(true); | 9084 test_layer->SetMasksToBounds(true); |
| 9049 test_layer->SetDrawsContent(true); | 9085 test_layer->SetDrawsContent(true); |
| 9050 ExecuteCalculateDrawProperties(root); | 9086 ExecuteCalculateDrawProperties(root); |
| 9051 | 9087 |
| 9052 EXPECT_EQ(gfx::Rect(30, 30), root->clip_rect()); | 9088 EXPECT_EQ(gfx::Rect(30, 30), root->clip_rect()); |
| 9053 EXPECT_EQ(gfx::Rect(50, 50), render_surface->clip_rect()); | 9089 EXPECT_EQ(gfx::Rect(50, 50), render_surface->clip_rect()); |
| 9054 EXPECT_EQ(gfx::Rect(50, 50), test_layer->clip_rect()); | 9090 EXPECT_EQ(gfx::Rect(50, 50), test_layer->clip_rect()); |
| 9055 } | 9091 } |
| 9056 | 9092 |
| 9057 TEST_F(LayerTreeHostCommonTest, TwoUnclippedRenderSurfaces) { | 9093 TEST_F(LayerTreeHostCommonTest, TwoUnclippedRenderSurfaces) { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9107 true); | 9143 true); |
| 9108 SetLayerPropertiesForTesting(render_surface1, large_transform, gfx::Point3F(), | 9144 SetLayerPropertiesForTesting(render_surface1, large_transform, gfx::Point3F(), |
| 9109 gfx::PointF(), gfx::Size(30, 30), true, false, | 9145 gfx::PointF(), gfx::Size(30, 30), true, false, |
| 9110 true); | 9146 true); |
| 9111 SetLayerPropertiesForTesting(render_surface2, identity_matrix, gfx::Point3F(), | 9147 SetLayerPropertiesForTesting(render_surface2, identity_matrix, gfx::Point3F(), |
| 9112 gfx::PointF(), gfx::Size(30, 30), true, false, | 9148 gfx::PointF(), gfx::Size(30, 30), true, false, |
| 9113 true); | 9149 true); |
| 9114 | 9150 |
| 9115 ExecuteCalculateDrawProperties(root); | 9151 ExecuteCalculateDrawProperties(root); |
| 9116 | 9152 |
| 9117 EXPECT_TRUE(std::isinf( | 9153 bool is_inf_or_nan = |
| 9118 render_surface2->render_surface()->draw_transform().matrix().get(0, 0))); | 9154 std::isinf( |
| 9119 EXPECT_TRUE(std::isinf( | 9155 render_surface2->render_surface()->draw_transform().matrix().get( |
| 9120 render_surface2->render_surface()->draw_transform().matrix().get(1, 1))); | 9156 0, 0)) || |
| 9157 std::isnan( | |
| 9158 render_surface2->render_surface()->draw_transform().matrix().get(0, | |
| 9159 0)); | |
| 9160 EXPECT_TRUE(is_inf_or_nan); | |
| 9161 is_inf_or_nan = | |
| 9162 std::isinf( | |
| 9163 render_surface2->render_surface()->draw_transform().matrix().get( | |
| 9164 1, 1)) || | |
| 9165 std::isnan( | |
| 9166 render_surface2->render_surface()->draw_transform().matrix().get(1, | |
| 9167 1)); | |
| 9168 EXPECT_TRUE(is_inf_or_nan); | |
| 9121 EXPECT_EQ(gfx::RectF(), | 9169 EXPECT_EQ(gfx::RectF(), |
| 9122 render_surface2->render_surface()->DrawableContentRect()); | 9170 render_surface2->render_surface()->DrawableContentRect()); |
| 9123 | 9171 |
| 9124 std::vector<LayerImpl*>* rsll = render_surface_layer_list_impl(); | 9172 std::vector<LayerImpl*>* rsll = render_surface_layer_list_impl(); |
| 9125 bool root_in_rsll = | 9173 bool root_in_rsll = |
| 9126 std::find(rsll->begin(), rsll->end(), root) != rsll->end(); | 9174 std::find(rsll->begin(), rsll->end(), root) != rsll->end(); |
| 9127 EXPECT_TRUE(root_in_rsll); | 9175 EXPECT_TRUE(root_in_rsll); |
| 9128 bool render_surface2_in_rsll = | 9176 bool render_surface2_in_rsll = |
| 9129 std::find(rsll->begin(), rsll->end(), render_surface2) != rsll->end(); | 9177 std::find(rsll->begin(), rsll->end(), render_surface2) != rsll->end(); |
| 9130 EXPECT_FALSE(render_surface2_in_rsll); | 9178 EXPECT_FALSE(render_surface2_in_rsll); |
| 9131 } | 9179 } |
| 9132 | 9180 |
| 9133 } // namespace | 9181 } // namespace |
| 9134 } // namespace cc | 9182 } // namespace cc |
| OLD | NEW |