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

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

Issue 2866733002: Remove owning_id from EffectNode and replace it by an opaque stable_id (Closed)
Patch Set: none Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/effect_node.cc ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host_common.h" 5 #include "cc/trees/layer_tree_host_common.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 grand_child_of_rs2->test_properties()->transform_origin = 871 grand_child_of_rs2->test_properties()->transform_origin =
872 gfx::Point3F(2.5f, 0.f, 0.f); 872 gfx::Point3F(2.5f, 0.f, 0.f);
873 grand_child_of_rs2->test_properties()->transform = layer_transform; 873 grand_child_of_rs2->test_properties()->transform = layer_transform;
874 grand_child_of_rs2->SetBounds(gfx::Size(10, 10)); 874 grand_child_of_rs2->SetBounds(gfx::Size(10, 10));
875 875
876 ExecuteCalculateDrawProperties(root); 876 ExecuteCalculateDrawProperties(root);
877 877
878 // Only layers that are associated with render surfaces should have an actual 878 // Only layers that are associated with render surfaces should have an actual
879 // RenderSurface() value. 879 // RenderSurface() value.
880 ASSERT_TRUE(GetRenderSurface(root)); 880 ASSERT_TRUE(GetRenderSurface(root));
881 ASSERT_FALSE(GetRenderSurface(child_of_root)); 881 ASSERT_EQ(GetRenderSurface(child_of_root), GetRenderSurface(root));
882 ASSERT_FALSE(GetRenderSurface(grand_child_of_root)); 882 ASSERT_EQ(GetRenderSurface(grand_child_of_root), GetRenderSurface(root));
883 883
884 ASSERT_TRUE(GetRenderSurface(render_surface1)); 884 ASSERT_NE(GetRenderSurface(render_surface1), GetRenderSurface(root));
885 ASSERT_FALSE(GetRenderSurface(child_of_rs1)); 885 ASSERT_EQ(GetRenderSurface(child_of_rs1), GetRenderSurface(render_surface1));
886 ASSERT_FALSE(GetRenderSurface(grand_child_of_rs1)); 886 ASSERT_EQ(GetRenderSurface(grand_child_of_rs1),
887 GetRenderSurface(render_surface1));
887 888
888 ASSERT_TRUE(GetRenderSurface(render_surface2)); 889 ASSERT_NE(GetRenderSurface(render_surface2), GetRenderSurface(root));
889 ASSERT_FALSE(GetRenderSurface(child_of_rs2)); 890 ASSERT_NE(GetRenderSurface(render_surface2),
890 ASSERT_FALSE(GetRenderSurface(grand_child_of_rs2)); 891 GetRenderSurface(render_surface1));
892 ASSERT_EQ(GetRenderSurface(child_of_rs2), GetRenderSurface(render_surface2));
893 ASSERT_EQ(GetRenderSurface(grand_child_of_rs2),
894 GetRenderSurface(render_surface2));
891 895
892 // Verify all render target accessors 896 // Verify all render target accessors
893 EXPECT_EQ(GetRenderSurface(root), parent->render_target()); 897 EXPECT_EQ(GetRenderSurface(root), parent->render_target());
894 EXPECT_EQ(GetRenderSurface(root), child_of_root->render_target()); 898 EXPECT_EQ(GetRenderSurface(root), child_of_root->render_target());
895 EXPECT_EQ(GetRenderSurface(root), grand_child_of_root->render_target()); 899 EXPECT_EQ(GetRenderSurface(root), grand_child_of_root->render_target());
896 900
897 EXPECT_EQ(GetRenderSurface(render_surface1), 901 EXPECT_EQ(GetRenderSurface(render_surface1),
898 render_surface1->render_target()); 902 render_surface1->render_target());
899 EXPECT_EQ(GetRenderSurface(render_surface1), child_of_rs1->render_target()); 903 EXPECT_EQ(GetRenderSurface(render_surface1), child_of_rs1->render_target());
900 EXPECT_EQ(GetRenderSurface(render_surface1), 904 EXPECT_EQ(GetRenderSurface(render_surface1),
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
1541 surface1->test_properties()->force_render_surface = true; 1545 surface1->test_properties()->force_render_surface = true;
1542 not_surface->SetBounds(gfx::Size(10, 10)); 1546 not_surface->SetBounds(gfx::Size(10, 10));
1543 not_surface->test_properties()->opacity = 0.5f; 1547 not_surface->test_properties()->opacity = 0.5f;
1544 surface2->SetBounds(gfx::Size(10, 10)); 1548 surface2->SetBounds(gfx::Size(10, 10));
1545 surface2->SetDrawsContent(true); 1549 surface2->SetDrawsContent(true);
1546 surface2->test_properties()->opacity = 0.5f; 1550 surface2->test_properties()->opacity = 0.5f;
1547 surface2->test_properties()->force_render_surface = true; 1551 surface2->test_properties()->force_render_surface = true;
1548 ExecuteCalculateDrawProperties(root); 1552 ExecuteCalculateDrawProperties(root);
1549 1553
1550 ASSERT_TRUE(GetRenderSurface(surface1)); 1554 ASSERT_TRUE(GetRenderSurface(surface1));
1551 ASSERT_FALSE(GetRenderSurface(not_surface)); 1555 ASSERT_EQ(GetRenderSurface(not_surface), GetRenderSurface(surface1));
1552 ASSERT_TRUE(GetRenderSurface(surface2)); 1556 ASSERT_TRUE(GetRenderSurface(surface2));
1553 EXPECT_EQ(0.5f, GetRenderSurface(surface1)->draw_opacity()); 1557 EXPECT_EQ(0.5f, GetRenderSurface(surface1)->draw_opacity());
1554 // surface2's draw opacity should include the opacity of not-surface and 1558 // surface2's draw opacity should include the opacity of not-surface and
1555 // itself, but not the opacity of surface1. 1559 // itself, but not the opacity of surface1.
1556 EXPECT_EQ(0.25f, GetRenderSurface(surface2)->draw_opacity()); 1560 EXPECT_EQ(0.25f, GetRenderSurface(surface2)->draw_opacity());
1557 } 1561 }
1558 1562
1559 TEST_F(LayerTreeHostCommonTest, ForceRenderSurface) { 1563 TEST_F(LayerTreeHostCommonTest, ForceRenderSurface) {
1560 LayerImpl* root = root_layer_for_testing(); 1564 LayerImpl* root = root_layer_for_testing();
1561 LayerImpl* render_surface1 = AddChildToRoot<LayerImpl>(); 1565 LayerImpl* render_surface1 = AddChildToRoot<LayerImpl>();
1562 LayerImpl* child = AddChild<LayerImpl>(render_surface1); 1566 LayerImpl* child = AddChild<LayerImpl>(render_surface1);
1563 1567
1564 root->SetBounds(gfx::Size(10, 10)); 1568 root->SetBounds(gfx::Size(10, 10));
1565 render_surface1->SetBounds(gfx::Size(10, 10)); 1569 render_surface1->SetBounds(gfx::Size(10, 10));
1566 render_surface1->test_properties()->force_render_surface = true; 1570 render_surface1->test_properties()->force_render_surface = true;
1567 child->SetBounds(gfx::Size(10, 10)); 1571 child->SetBounds(gfx::Size(10, 10));
1568 child->SetDrawsContent(true); 1572 child->SetDrawsContent(true);
1569 1573
1570 { 1574 {
1571 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root); 1575 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root);
1572 1576
1573 // The root layer always creates a render surface 1577 // The root layer always creates a render surface
1574 EXPECT_TRUE(GetRenderSurface(root)); 1578 EXPECT_TRUE(GetRenderSurface(root));
1575 EXPECT_TRUE(GetRenderSurface(render_surface1)); 1579 EXPECT_NE(GetRenderSurface(render_surface1), GetRenderSurface(root));
1576 } 1580 }
1577 1581
1578 { 1582 {
1579 render_surface1->test_properties()->force_render_surface = false; 1583 render_surface1->test_properties()->force_render_surface = false;
1580 render_surface1->layer_tree_impl()->property_trees()->needs_rebuild = true; 1584 render_surface1->layer_tree_impl()->property_trees()->needs_rebuild = true;
1581 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root); 1585 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root);
1582 EXPECT_TRUE(GetRenderSurface(root)); 1586 EXPECT_TRUE(GetRenderSurface(root));
1583 EXPECT_FALSE(GetRenderSurface(render_surface1)); 1587 EXPECT_EQ(GetRenderSurface(render_surface1), GetRenderSurface(root));
1584 } 1588 }
1585 } 1589 }
1586 1590
1587 TEST_F(LayerTreeHostCommonTest, RenderSurfacesFlattenScreenSpaceTransform) { 1591 TEST_F(LayerTreeHostCommonTest, RenderSurfacesFlattenScreenSpaceTransform) {
1588 // Render surfaces act as a flattening point for their subtree, so should 1592 // Render surfaces act as a flattening point for their subtree, so should
1589 // always flatten the target-to-screen space transform seen by descendants. 1593 // always flatten the target-to-screen space transform seen by descendants.
1590 LayerImpl* root = root_layer_for_testing(); 1594 LayerImpl* root = root_layer_for_testing();
1591 LayerImpl* parent = AddChild<LayerImpl>(root); 1595 LayerImpl* parent = AddChild<LayerImpl>(root);
1592 LayerImpl* child = AddChild<LayerImpl>(parent); 1596 LayerImpl* child = AddChild<LayerImpl>(parent);
1593 LayerImpl* grand_child = AddChild<LayerImpl>(child); 1597 LayerImpl* grand_child = AddChild<LayerImpl>(child);
1594 1598
1595 gfx::Transform rotation_about_y_axis; 1599 gfx::Transform rotation_about_y_axis;
1596 rotation_about_y_axis.RotateAboutYAxis(30.0); 1600 rotation_about_y_axis.RotateAboutYAxis(30.0);
1597 1601
1598 root->SetBounds(gfx::Size(100, 100)); 1602 root->SetBounds(gfx::Size(100, 100));
1599 parent->test_properties()->transform = rotation_about_y_axis; 1603 parent->test_properties()->transform = rotation_about_y_axis;
1600 parent->SetBounds(gfx::Size(10, 10)); 1604 parent->SetBounds(gfx::Size(10, 10));
1601 parent->test_properties()->force_render_surface = true; 1605 parent->test_properties()->force_render_surface = true;
1602 child->SetBounds(gfx::Size(10, 10)); 1606 child->SetBounds(gfx::Size(10, 10));
1603 child->SetDrawsContent(true); 1607 child->SetDrawsContent(true);
1604 grand_child->SetBounds(gfx::Size(10, 10)); 1608 grand_child->SetBounds(gfx::Size(10, 10));
1605 grand_child->SetDrawsContent(true); 1609 grand_child->SetDrawsContent(true);
1606 grand_child->test_properties()->should_flatten_transform = false; 1610 grand_child->test_properties()->should_flatten_transform = false;
1607 ExecuteCalculateDrawProperties(root); 1611 ExecuteCalculateDrawProperties(root);
1608 1612
1609 EXPECT_TRUE(GetRenderSurface(parent)); 1613 EXPECT_TRUE(GetRenderSurface(parent));
1610 EXPECT_FALSE(GetRenderSurface(child)); 1614 EXPECT_EQ(GetRenderSurface(child), GetRenderSurface(parent));
1611 EXPECT_FALSE(GetRenderSurface(grand_child)); 1615 EXPECT_EQ(GetRenderSurface(grand_child), GetRenderSurface(parent));
1612 1616
1613 EXPECT_TRANSFORMATION_MATRIX_EQ(gfx::Transform(), child->DrawTransform()); 1617 EXPECT_TRANSFORMATION_MATRIX_EQ(gfx::Transform(), child->DrawTransform());
1614 EXPECT_TRANSFORMATION_MATRIX_EQ(gfx::Transform(), 1618 EXPECT_TRANSFORMATION_MATRIX_EQ(gfx::Transform(),
1615 grand_child->DrawTransform()); 1619 grand_child->DrawTransform());
1616 1620
1617 // The screen-space transform inherited by |child| and |grand_child| should 1621 // The screen-space transform inherited by |child| and |grand_child| should
1618 // have been flattened at their render target. In particular, the fact that 1622 // have been flattened at their render target. In particular, the fact that
1619 // |grand_child| happens to preserve 3d shouldn't affect this flattening. 1623 // |grand_child| happens to preserve 3d shouldn't affect this flattening.
1620 gfx::Transform flattened_rotation_about_y = rotation_about_y_axis; 1624 gfx::Transform flattened_rotation_about_y = rotation_about_y_axis;
1621 flattened_rotation_about_y.FlattenTo2d(); 1625 flattened_rotation_about_y.FlattenTo2d();
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1940 // Surfaces are clipped by their parent, but un-affected by the owning layer's 1944 // Surfaces are clipped by their parent, but un-affected by the owning layer's
1941 // MasksToBounds. 1945 // MasksToBounds.
1942 EXPECT_EQ(gfx::Rect(0, 0, 20, 20), 1946 EXPECT_EQ(gfx::Rect(0, 0, 20, 20),
1943 GetRenderSurface(grand_child1)->clip_rect()); 1947 GetRenderSurface(grand_child1)->clip_rect());
1944 EXPECT_EQ(gfx::Rect(0, 0, 20, 20), 1948 EXPECT_EQ(gfx::Rect(0, 0, 20, 20),
1945 GetRenderSurface(grand_child2)->clip_rect()); 1949 GetRenderSurface(grand_child2)->clip_rect());
1946 EXPECT_EQ(gfx::Rect(0, 0, 20, 20), 1950 EXPECT_EQ(gfx::Rect(0, 0, 20, 20),
1947 GetRenderSurface(grand_child3)->clip_rect()); 1951 GetRenderSurface(grand_child3)->clip_rect());
1948 } 1952 }
1949 1953
1954 TEST_F(LayerTreeHostCommonTest, HitTestingWhenSurfacesDisabled) {
1955 LayerImpl* root = root_layer_for_testing();
1956 LayerImpl* parent = AddChild<LayerImpl>(root);
1957 LayerImpl* child = AddChild<LayerImpl>(parent);
1958 LayerImpl* grand_child = AddChild<LayerImpl>(child);
1959 LayerImpl* leaf_node = AddChild<LayerImpl>(grand_child);
1960
1961 root->SetBounds(gfx::Size(100, 100));
1962 parent->SetPosition(gfx::PointF(2.f, 2.f));
1963 parent->SetBounds(gfx::Size(400, 400));
1964 parent->SetMasksToBounds(true);
1965 child->SetPosition(gfx::PointF(4.f, 4.f));
1966 child->SetBounds(gfx::Size(800, 800));
1967 child->SetMasksToBounds(true);
1968 child->test_properties()->force_render_surface = true;
1969 grand_child->SetPosition(gfx::PointF(8.f, 8.f));
1970 grand_child->SetBounds(gfx::Size(1500, 1500));
1971 grand_child->test_properties()->force_render_surface = true;
1972 leaf_node->SetPosition(gfx::PointF(16.f, 16.f));
1973 leaf_node->SetBounds(gfx::Size(2000, 2000));
1974
1975 root->SetDrawsContent(true);
1976 parent->SetDrawsContent(true);
1977 child->SetDrawsContent(true);
1978 grand_child->SetDrawsContent(true);
1979 leaf_node->SetDrawsContent(true);
1980
1981 host_impl()->set_resourceless_software_draw_for_testing();
1982 ExecuteCalculateDrawPropertiesWithoutSeparateSurfaces(root);
1983 gfx::PointF test_point(90.f, 90.f);
1984 LayerImpl* result_layer =
1985 root->layer_tree_impl()->FindLayerThatIsHitByPoint(test_point);
1986 ASSERT_TRUE(result_layer);
1987 EXPECT_EQ(leaf_node, result_layer);
1988 }
1989
1950 TEST_F(LayerTreeHostCommonTest, AnimationsForRenderSurfaceHierarchy) { 1990 TEST_F(LayerTreeHostCommonTest, AnimationsForRenderSurfaceHierarchy) {
1951 LayerImpl* root = root_layer_for_testing(); 1991 LayerImpl* root = root_layer_for_testing();
1952 LayerImpl* render_surface1 = AddChildToRoot<LayerImpl>(); 1992 LayerImpl* render_surface1 = AddChildToRoot<LayerImpl>();
1953 LayerImpl* child_of_rs1 = AddChild<LayerImpl>(render_surface1); 1993 LayerImpl* child_of_rs1 = AddChild<LayerImpl>(render_surface1);
1954 LayerImpl* grand_child_of_rs1 = AddChild<LayerImpl>(child_of_rs1); 1994 LayerImpl* grand_child_of_rs1 = AddChild<LayerImpl>(child_of_rs1);
1955 LayerImpl* render_surface2 = AddChild<LayerImpl>(render_surface1); 1995 LayerImpl* render_surface2 = AddChild<LayerImpl>(render_surface1);
1956 LayerImpl* child_of_rs2 = AddChild<LayerImpl>(render_surface2); 1996 LayerImpl* child_of_rs2 = AddChild<LayerImpl>(render_surface2);
1957 LayerImpl* grand_child_of_rs2 = AddChild<LayerImpl>(child_of_rs2); 1997 LayerImpl* grand_child_of_rs2 = AddChild<LayerImpl>(child_of_rs2);
1958 LayerImpl* child_of_root = AddChildToRoot<LayerImpl>(); 1998 LayerImpl* child_of_root = AddChildToRoot<LayerImpl>();
1959 LayerImpl* grand_child_of_root = AddChild<LayerImpl>(child_of_root); 1999 LayerImpl* grand_child_of_root = AddChild<LayerImpl>(child_of_root);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
2039 timeline_impl(), 10.0, 30, 0); 2079 timeline_impl(), 10.0, 30, 0);
2040 AddAnimatedTransformToElementWithPlayer(grand_child_of_rs2->element_id(), 2080 AddAnimatedTransformToElementWithPlayer(grand_child_of_rs2->element_id(),
2041 timeline_impl(), 10.0, 30, 0); 2081 timeline_impl(), 10.0, 30, 0);
2042 2082
2043 root->layer_tree_impl()->property_trees()->needs_rebuild = true; 2083 root->layer_tree_impl()->property_trees()->needs_rebuild = true;
2044 ExecuteCalculateDrawProperties(root); 2084 ExecuteCalculateDrawProperties(root);
2045 2085
2046 // Only layers that are associated with render surfaces should have an actual 2086 // Only layers that are associated with render surfaces should have an actual
2047 // RenderSurface() value. 2087 // RenderSurface() value.
2048 ASSERT_TRUE(GetRenderSurface(root)); 2088 ASSERT_TRUE(GetRenderSurface(root));
2049 ASSERT_FALSE(GetRenderSurface(child_of_root)); 2089 ASSERT_EQ(GetRenderSurface(child_of_root), GetRenderSurface(root));
2050 ASSERT_FALSE(GetRenderSurface(grand_child_of_root)); 2090 ASSERT_EQ(GetRenderSurface(grand_child_of_root), GetRenderSurface(root));
2051 2091
2052 ASSERT_TRUE(GetRenderSurface(render_surface1)); 2092 ASSERT_NE(GetRenderSurface(render_surface1), GetRenderSurface(root));
2053 ASSERT_FALSE(GetRenderSurface(child_of_rs1)); 2093 ASSERT_EQ(GetRenderSurface(child_of_rs1), GetRenderSurface(render_surface1));
2054 ASSERT_FALSE(GetRenderSurface(grand_child_of_rs1)); 2094 ASSERT_EQ(GetRenderSurface(grand_child_of_rs1),
2095 GetRenderSurface(render_surface1));
2055 2096
2056 ASSERT_TRUE(GetRenderSurface(render_surface2)); 2097 ASSERT_NE(GetRenderSurface(render_surface2), GetRenderSurface(root));
2057 ASSERT_FALSE(GetRenderSurface(child_of_rs2)); 2098 ASSERT_NE(GetRenderSurface(render_surface2),
2058 ASSERT_FALSE(GetRenderSurface(grand_child_of_rs2)); 2099 GetRenderSurface(render_surface1));
2100 ASSERT_EQ(GetRenderSurface(child_of_rs2), GetRenderSurface(render_surface2));
2101 ASSERT_EQ(GetRenderSurface(grand_child_of_rs2),
2102 GetRenderSurface(render_surface2));
2059 2103
2060 // Verify all render target accessors 2104 // Verify all render target accessors
2061 EXPECT_EQ(GetRenderSurface(root), root->render_target()); 2105 EXPECT_EQ(GetRenderSurface(root), root->render_target());
2062 EXPECT_EQ(GetRenderSurface(root), child_of_root->render_target()); 2106 EXPECT_EQ(GetRenderSurface(root), child_of_root->render_target());
2063 EXPECT_EQ(GetRenderSurface(root), grand_child_of_root->render_target()); 2107 EXPECT_EQ(GetRenderSurface(root), grand_child_of_root->render_target());
2064 2108
2065 EXPECT_EQ(GetRenderSurface(render_surface1), 2109 EXPECT_EQ(GetRenderSurface(render_surface1),
2066 render_surface1->render_target()); 2110 render_surface1->render_target());
2067 EXPECT_EQ(GetRenderSurface(render_surface1), child_of_rs1->render_target()); 2111 EXPECT_EQ(GetRenderSurface(render_surface1), child_of_rs1->render_target());
2068 EXPECT_EQ(GetRenderSurface(render_surface1), 2112 EXPECT_EQ(GetRenderSurface(render_surface1),
(...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after
3679 backface_matrix; 3723 backface_matrix;
3680 back_facing_child_of_back_facing_surface->test_properties()->transform = 3724 back_facing_child_of_back_facing_surface->test_properties()->transform =
3681 backface_matrix; 3725 backface_matrix;
3682 3726
3683 // Note: No layers preserve 3d. According to current W3C CSS gfx::Transforms 3727 // Note: No layers preserve 3d. According to current W3C CSS gfx::Transforms
3684 // spec, these layers should blindly use their own local transforms to 3728 // spec, these layers should blindly use their own local transforms to
3685 // determine back-face culling. 3729 // determine back-face culling.
3686 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root); 3730 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root);
3687 3731
3688 // Verify which render surfaces were created. 3732 // Verify which render surfaces were created.
3689 EXPECT_FALSE(GetRenderSurface(front_facing_child)); 3733 EXPECT_EQ(GetRenderSurface(front_facing_child), GetRenderSurface(root));
3690 EXPECT_FALSE(GetRenderSurface(back_facing_child)); 3734 EXPECT_EQ(GetRenderSurface(back_facing_child), GetRenderSurface(root));
3691 EXPECT_TRUE(GetRenderSurface(front_facing_surface)); 3735 EXPECT_NE(GetRenderSurface(front_facing_surface), GetRenderSurface(root));
3692 EXPECT_TRUE(GetRenderSurface(back_facing_surface)); 3736 EXPECT_NE(GetRenderSurface(back_facing_surface), GetRenderSurface(root));
3693 EXPECT_FALSE(GetRenderSurface(front_facing_child_of_front_facing_surface)); 3737 EXPECT_NE(GetRenderSurface(back_facing_surface),
3694 EXPECT_FALSE(GetRenderSurface(back_facing_child_of_front_facing_surface)); 3738 GetRenderSurface(front_facing_surface));
3695 EXPECT_FALSE(GetRenderSurface(front_facing_child_of_back_facing_surface)); 3739 EXPECT_EQ(GetRenderSurface(front_facing_child_of_front_facing_surface),
3696 EXPECT_FALSE(GetRenderSurface(back_facing_child_of_back_facing_surface)); 3740 GetRenderSurface(front_facing_surface));
3741 EXPECT_EQ(GetRenderSurface(back_facing_child_of_front_facing_surface),
3742 GetRenderSurface(front_facing_surface));
3743 EXPECT_EQ(GetRenderSurface(front_facing_child_of_back_facing_surface),
3744 GetRenderSurface(back_facing_surface));
3745 EXPECT_EQ(GetRenderSurface(back_facing_child_of_back_facing_surface),
3746 GetRenderSurface(back_facing_surface));
3697 3747
3698 EXPECT_EQ(3u, update_layer_list_impl()->size()); 3748 EXPECT_EQ(3u, update_layer_list_impl()->size());
3699 EXPECT_TRUE(UpdateLayerListImplContains(front_facing_child->id())); 3749 EXPECT_TRUE(UpdateLayerListImplContains(front_facing_child->id()));
3700 EXPECT_TRUE(UpdateLayerListImplContains(front_facing_surface->id())); 3750 EXPECT_TRUE(UpdateLayerListImplContains(front_facing_surface->id()));
3701 EXPECT_TRUE(UpdateLayerListImplContains( 3751 EXPECT_TRUE(UpdateLayerListImplContains(
3702 front_facing_child_of_front_facing_surface->id())); 3752 front_facing_child_of_front_facing_surface->id()));
3703 } 3753 }
3704 3754
3705 TEST_F(LayerTreeHostCommonTest, BackFaceCullingWithPreserves3d) { 3755 TEST_F(LayerTreeHostCommonTest, BackFaceCullingWithPreserves3d) {
3706 // Verify the behavior of back-face culling when preserves-3d transform style 3756 // Verify the behavior of back-face culling when preserves-3d transform style
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
3787 back_facing_child_of_front_facing_surface->test_properties() 3837 back_facing_child_of_front_facing_surface->test_properties()
3788 ->sorting_context_id = 1; 3838 ->sorting_context_id = 1;
3789 front_facing_child_of_back_facing_surface->test_properties() 3839 front_facing_child_of_back_facing_surface->test_properties()
3790 ->sorting_context_id = 1; 3840 ->sorting_context_id = 1;
3791 back_facing_child_of_back_facing_surface->test_properties() 3841 back_facing_child_of_back_facing_surface->test_properties()
3792 ->sorting_context_id = 1; 3842 ->sorting_context_id = 1;
3793 3843
3794 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root); 3844 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root);
3795 3845
3796 // Verify which render surfaces were created and used. 3846 // Verify which render surfaces were created and used.
3797 EXPECT_FALSE(GetRenderSurface(front_facing_child)); 3847 EXPECT_EQ(GetRenderSurface(front_facing_child), GetRenderSurface(root));
3798 EXPECT_FALSE(GetRenderSurface(back_facing_child)); 3848 EXPECT_EQ(GetRenderSurface(back_facing_child), GetRenderSurface(root));
3799 EXPECT_TRUE(GetRenderSurface(front_facing_surface)); 3849 EXPECT_NE(GetRenderSurface(front_facing_surface), GetRenderSurface(root));
3800 // We expect that a has_render_surface was created but not used. 3850 // We expect that a has_render_surface was created but not used.
3801 EXPECT_TRUE(GetRenderSurface(back_facing_surface)); 3851 EXPECT_NE(GetRenderSurface(back_facing_surface), GetRenderSurface(root));
3802 EXPECT_FALSE(GetRenderSurface(front_facing_child_of_front_facing_surface)); 3852 EXPECT_NE(GetRenderSurface(back_facing_surface),
3803 EXPECT_FALSE(GetRenderSurface(back_facing_child_of_front_facing_surface)); 3853 GetRenderSurface(front_facing_surface));
3804 EXPECT_FALSE(GetRenderSurface(front_facing_child_of_back_facing_surface)); 3854 EXPECT_EQ(GetRenderSurface(front_facing_child_of_front_facing_surface),
3805 EXPECT_FALSE(GetRenderSurface(back_facing_child_of_back_facing_surface)); 3855 GetRenderSurface(front_facing_surface));
3856 EXPECT_EQ(GetRenderSurface(back_facing_child_of_front_facing_surface),
3857 GetRenderSurface(front_facing_surface));
3858 EXPECT_EQ(GetRenderSurface(front_facing_child_of_back_facing_surface),
3859 GetRenderSurface(back_facing_surface));
3860 EXPECT_EQ(GetRenderSurface(back_facing_child_of_back_facing_surface),
3861 GetRenderSurface(back_facing_surface));
3806 3862
3807 EXPECT_EQ(3u, update_layer_list_impl()->size()); 3863 EXPECT_EQ(3u, update_layer_list_impl()->size());
3808 3864
3809 EXPECT_TRUE(UpdateLayerListImplContains(front_facing_child->id())); 3865 EXPECT_TRUE(UpdateLayerListImplContains(front_facing_child->id()));
3810 EXPECT_TRUE(UpdateLayerListImplContains(front_facing_surface->id())); 3866 EXPECT_TRUE(UpdateLayerListImplContains(front_facing_surface->id()));
3811 EXPECT_TRUE(UpdateLayerListImplContains( 3867 EXPECT_TRUE(UpdateLayerListImplContains(
3812 front_facing_child_of_front_facing_surface->id())); 3868 front_facing_child_of_front_facing_surface->id()));
3813 } 3869 }
3814 3870
3815 TEST_F(LayerTreeHostCommonTest, BackFaceCullingWithAnimatingTransforms) { 3871 TEST_F(LayerTreeHostCommonTest, BackFaceCullingWithAnimatingTransforms) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
3861 animating_surface->test_properties()->transform = backface_matrix; 3917 animating_surface->test_properties()->transform = backface_matrix;
3862 animating_surface->test_properties()->force_render_surface = true; 3918 animating_surface->test_properties()->force_render_surface = true;
3863 child_of_animating_surface->SetBounds(gfx::Size(100, 100)); 3919 child_of_animating_surface->SetBounds(gfx::Size(100, 100));
3864 child_of_animating_surface->test_properties()->transform = backface_matrix; 3920 child_of_animating_surface->test_properties()->transform = backface_matrix;
3865 animating_child->SetBounds(gfx::Size(100, 100)); 3921 animating_child->SetBounds(gfx::Size(100, 100));
3866 animating_child->test_properties()->transform = backface_matrix; 3922 animating_child->test_properties()->transform = backface_matrix;
3867 child2->SetBounds(gfx::Size(100, 100)); 3923 child2->SetBounds(gfx::Size(100, 100));
3868 3924
3869 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root); 3925 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root);
3870 3926
3871 EXPECT_FALSE(GetRenderSurface(child)); 3927 EXPECT_EQ(GetRenderSurface(child), GetRenderSurface(root));
3872 EXPECT_TRUE(GetRenderSurface(animating_surface)); 3928 EXPECT_TRUE(GetRenderSurface(animating_surface));
3873 EXPECT_FALSE(GetRenderSurface(child_of_animating_surface)); 3929 EXPECT_EQ(GetRenderSurface(child_of_animating_surface),
3874 EXPECT_FALSE(GetRenderSurface(animating_child)); 3930 GetRenderSurface(animating_surface));
3875 EXPECT_FALSE(GetRenderSurface(child2)); 3931 EXPECT_EQ(GetRenderSurface(animating_child), GetRenderSurface(root));
3932 EXPECT_EQ(GetRenderSurface(child2), GetRenderSurface(root));
3876 3933
3877 EXPECT_EQ(1u, update_layer_list_impl()->size()); 3934 EXPECT_EQ(1u, update_layer_list_impl()->size());
3878 3935
3879 // The back facing layers are culled from the layer list, and have an empty 3936 // The back facing layers are culled from the layer list, and have an empty
3880 // visible rect. 3937 // visible rect.
3881 EXPECT_TRUE(UpdateLayerListImplContains(child2->id())); 3938 EXPECT_TRUE(UpdateLayerListImplContains(child2->id()));
3882 EXPECT_TRUE(child->visible_layer_rect().IsEmpty()); 3939 EXPECT_TRUE(child->visible_layer_rect().IsEmpty());
3883 EXPECT_TRUE(animating_surface->visible_layer_rect().IsEmpty()); 3940 EXPECT_TRUE(animating_surface->visible_layer_rect().IsEmpty());
3884 EXPECT_TRUE(child_of_animating_surface->visible_layer_rect().IsEmpty()); 3941 EXPECT_TRUE(child_of_animating_surface->visible_layer_rect().IsEmpty());
3885 EXPECT_TRUE(animating_child->visible_layer_rect().IsEmpty()); 3942 EXPECT_TRUE(animating_child->visible_layer_rect().IsEmpty());
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
3924 3981
3925 front_facing_surface->test_properties()->sorting_context_id = 1; 3982 front_facing_surface->test_properties()->sorting_context_id = 1;
3926 back_facing_surface->test_properties()->sorting_context_id = 1; 3983 back_facing_surface->test_properties()->sorting_context_id = 1;
3927 3984
3928 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root); 3985 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root);
3929 3986
3930 // Verify which render surfaces were created and used. 3987 // Verify which render surfaces were created and used.
3931 EXPECT_TRUE(GetRenderSurface(front_facing_surface)); 3988 EXPECT_TRUE(GetRenderSurface(front_facing_surface));
3932 3989
3933 // We expect the render surface to have been created, but remain unused. 3990 // We expect the render surface to have been created, but remain unused.
3934 EXPECT_TRUE(GetRenderSurface(back_facing_surface)); 3991 EXPECT_NE(GetRenderSurface(back_facing_surface), GetRenderSurface(root));
3935 EXPECT_FALSE(GetRenderSurface(child1)); 3992 EXPECT_EQ(GetRenderSurface(child1), GetRenderSurface(front_facing_surface));
3936 EXPECT_FALSE(GetRenderSurface(child2)); 3993 EXPECT_EQ(GetRenderSurface(child2), GetRenderSurface(back_facing_surface));
3937 3994
3938 EXPECT_EQ(2u, update_layer_list_impl()->size()); 3995 EXPECT_EQ(2u, update_layer_list_impl()->size());
3939 EXPECT_TRUE(UpdateLayerListImplContains(front_facing_surface->id())); 3996 EXPECT_TRUE(UpdateLayerListImplContains(front_facing_surface->id()));
3940 EXPECT_TRUE(UpdateLayerListImplContains(child1->id())); 3997 EXPECT_TRUE(UpdateLayerListImplContains(child1->id()));
3941 } 3998 }
3942 3999
3943 TEST_F(LayerTreeHostCommonScalingTest, LayerTransformsInHighDPI) { 4000 TEST_F(LayerTreeHostCommonScalingTest, LayerTransformsInHighDPI) {
3944 // Verify draw and screen space transforms of layers not in a surface. 4001 // Verify draw and screen space transforms of layers not in a surface.
3945 LayerImpl* root = root_layer_for_testing(); 4002 LayerImpl* root = root_layer_for_testing();
3946 root->SetBounds(gfx::Size(100, 100)); 4003 root->SetBounds(gfx::Size(100, 100));
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
4326 LayerImpl* root = root_layer_for_testing(); 4383 LayerImpl* root = root_layer_for_testing();
4327 LayerImpl* child = AddChild<LayerImpl>(root); 4384 LayerImpl* child = AddChild<LayerImpl>(root);
4328 LayerImpl* grand_child = AddChild<LayerImpl>(child); 4385 LayerImpl* grand_child = AddChild<LayerImpl>(child);
4329 4386
4330 root->SetBounds(gfx::Size(100, 100)); 4387 root->SetBounds(gfx::Size(100, 100));
4331 child->SetBounds(gfx::Size(10, 10)); 4388 child->SetBounds(gfx::Size(10, 10));
4332 child->test_properties()->opacity = 0.5f; 4389 child->test_properties()->opacity = 0.5f;
4333 grand_child->SetBounds(gfx::Size(10, 10)); 4390 grand_child->SetBounds(gfx::Size(10, 10));
4334 grand_child->SetDrawsContent(true); 4391 grand_child->SetDrawsContent(true);
4335 ExecuteCalculateDrawProperties(root); 4392 ExecuteCalculateDrawProperties(root);
4336 EXPECT_FALSE(GetRenderSurface(child)); 4393 EXPECT_EQ(GetRenderSurface(child), GetRenderSurface(root));
4337 } 4394 }
4338 4395
4339 TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) { 4396 TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) {
4340 FakeImplTaskRunnerProvider task_runner_provider; 4397 FakeImplTaskRunnerProvider task_runner_provider;
4341 TestTaskGraphRunner task_graph_runner; 4398 TestTaskGraphRunner task_graph_runner;
4342 FakeLayerTreeHostImpl host_impl(host()->GetSettings(), &task_runner_provider, 4399 FakeLayerTreeHostImpl host_impl(host()->GetSettings(), &task_runner_provider,
4343 &task_graph_runner); 4400 &task_graph_runner);
4344 host_impl.CreatePendingTree(); 4401 host_impl.CreatePendingTree();
4345 std::unique_ptr<LayerImpl> root = 4402 std::unique_ptr<LayerImpl> root =
4346 LayerImpl::Create(host_impl.pending_tree(), 1); 4403 LayerImpl::Create(host_impl.pending_tree(), 1);
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after
5419 child2->SetBounds(bounds); 5476 child2->SetBounds(bounds);
5420 child2->SetDrawsContent(true); 5477 child2->SetDrawsContent(true);
5421 child2->test_properties()->sorting_context_id = 1; 5478 child2->test_properties()->sorting_context_id = 1;
5422 child3->SetBounds(bounds); 5479 child3->SetBounds(bounds);
5423 child3->SetDrawsContent(true); 5480 child3->SetDrawsContent(true);
5424 child3->test_properties()->sorting_context_id = 1; 5481 child3->test_properties()->sorting_context_id = 1;
5425 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root); 5482 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root);
5426 5483
5427 // Verify which render surfaces were created. 5484 // Verify which render surfaces were created.
5428 EXPECT_TRUE(GetRenderSurface(root)); 5485 EXPECT_TRUE(GetRenderSurface(root));
5429 EXPECT_FALSE(GetRenderSurface(child1)); 5486 EXPECT_EQ(GetRenderSurface(child1), GetRenderSurface(root));
5430 EXPECT_TRUE(GetRenderSurface(child2)); 5487 EXPECT_NE(GetRenderSurface(child2), GetRenderSurface(root));
5431 EXPECT_FALSE(GetRenderSurface(child3)); 5488 EXPECT_EQ(GetRenderSurface(child3), GetRenderSurface(child2));
5432 } 5489 }
5433 5490
5434 TEST_F(LayerTreeHostCommonTest, DoNotIncludeBackfaceInvisibleSurfaces) { 5491 TEST_F(LayerTreeHostCommonTest, DoNotIncludeBackfaceInvisibleSurfaces) {
5435 LayerImpl* root = root_layer_for_testing(); 5492 LayerImpl* root = root_layer_for_testing();
5436 LayerImpl* back_facing = AddChild<LayerImpl>(root); 5493 LayerImpl* back_facing = AddChild<LayerImpl>(root);
5437 5494
5438 LayerImpl* render_surface1 = AddChild<LayerImpl>(back_facing); 5495 LayerImpl* render_surface1 = AddChild<LayerImpl>(back_facing);
5439 LayerImpl* child1 = AddChild<LayerImpl>(render_surface1); 5496 LayerImpl* child1 = AddChild<LayerImpl>(render_surface1);
5440 5497
5441 LayerImpl* flattener = AddChild<LayerImpl>(back_facing); 5498 LayerImpl* flattener = AddChild<LayerImpl>(back_facing);
(...skipping 2853 matching lines...) Expand 10 before | Expand all | Expand 10 after
8295 child->SetBounds(gfx::Size(50, 50)); 8352 child->SetBounds(gfx::Size(50, 50));
8296 child->SetDrawsContent(true); 8353 child->SetDrawsContent(true);
8297 grandchild->SetBounds(gfx::Size(50, 50)); 8354 grandchild->SetBounds(gfx::Size(50, 50));
8298 grandchild->SetDrawsContent(true); 8355 grandchild->SetDrawsContent(true);
8299 8356
8300 SetElementIdsForTesting(); 8357 SetElementIdsForTesting();
8301 AddOpacityTransitionToElementWithPlayer(child->element_id(), timeline_impl(), 8358 AddOpacityTransitionToElementWithPlayer(child->element_id(), timeline_impl(),
8302 10.0, 1.f, 0.2f, false); 8359 10.0, 1.f, 0.2f, false);
8303 ExecuteCalculateDrawProperties(root); 8360 ExecuteCalculateDrawProperties(root);
8304 8361
8305 EXPECT_EQ(1.f, child->Opacity()); 8362 EXPECT_EQ(1.f, OpacityForLayer(child));
8306 EXPECT_TRUE(GetRenderSurface(root)); 8363 EXPECT_TRUE(GetRenderSurface(root));
8307 EXPECT_TRUE(GetRenderSurface(child)); 8364 EXPECT_NE(GetRenderSurface(child), GetRenderSurface(root));
8308 EXPECT_FALSE(GetRenderSurface(grandchild)); 8365 EXPECT_EQ(GetRenderSurface(grandchild), GetRenderSurface(child));
8309 } 8366 }
8310 8367
8311 // Verify that having an animated filter (but no current filter, as these 8368 // Verify that having an animated filter (but no current filter, as these
8312 // are mutually exclusive) correctly creates a render surface. 8369 // are mutually exclusive) correctly creates a render surface.
8313 TEST_F(LayerTreeHostCommonTest, AnimatedFilterCreatesRenderSurface) { 8370 TEST_F(LayerTreeHostCommonTest, AnimatedFilterCreatesRenderSurface) {
8314 LayerImpl* root = root_layer_for_testing(); 8371 LayerImpl* root = root_layer_for_testing();
8315 LayerImpl* child = AddChild<LayerImpl>(root); 8372 LayerImpl* child = AddChild<LayerImpl>(root);
8316 LayerImpl* grandchild = AddChild<LayerImpl>(child); 8373 LayerImpl* grandchild = AddChild<LayerImpl>(child);
8317 8374
8318 root->SetBounds(gfx::Size(50, 50)); 8375 root->SetBounds(gfx::Size(50, 50));
8319 child->SetBounds(gfx::Size(50, 50)); 8376 child->SetBounds(gfx::Size(50, 50));
8320 grandchild->SetBounds(gfx::Size(50, 50)); 8377 grandchild->SetBounds(gfx::Size(50, 50));
8321 8378
8322 SetElementIdsForTesting(); 8379 SetElementIdsForTesting();
8323 AddAnimatedFilterToElementWithPlayer(child->element_id(), timeline_impl(), 8380 AddAnimatedFilterToElementWithPlayer(child->element_id(), timeline_impl(),
8324 10.0, 0.1f, 0.2f); 8381 10.0, 0.1f, 0.2f);
8325 ExecuteCalculateDrawProperties(root); 8382 ExecuteCalculateDrawProperties(root);
8326 8383
8327 EXPECT_TRUE(GetRenderSurface(root)); 8384 EXPECT_TRUE(GetRenderSurface(root));
8328 EXPECT_TRUE(GetRenderSurface(child)); 8385 EXPECT_NE(GetRenderSurface(child), GetRenderSurface(root));
8329 EXPECT_FALSE(GetRenderSurface(grandchild)); 8386 EXPECT_EQ(GetRenderSurface(grandchild), GetRenderSurface(child));
8330 8387
8331 EXPECT_TRUE(GetRenderSurface(root)->Filters().IsEmpty()); 8388 EXPECT_TRUE(GetRenderSurface(root)->Filters().IsEmpty());
8332 EXPECT_TRUE(GetRenderSurface(child)->Filters().IsEmpty()); 8389 EXPECT_TRUE(GetRenderSurface(child)->Filters().IsEmpty());
8333 8390
8334 EXPECT_FALSE(root->FilterIsAnimating()); 8391 EXPECT_FALSE(root->FilterIsAnimating());
8335 EXPECT_TRUE(child->FilterIsAnimating()); 8392 EXPECT_TRUE(child->FilterIsAnimating());
8336 EXPECT_FALSE(grandchild->FilterIsAnimating()); 8393 EXPECT_FALSE(grandchild->FilterIsAnimating());
8337 } 8394 }
8338 8395
8339 // Verify that having a filter animation with a delayed start time creates a 8396 // Verify that having a filter animation with a delayed start time creates a
(...skipping 22 matching lines...) Expand all
8362 std::unique_ptr<Animation> animation = 8419 std::unique_ptr<Animation> animation =
8363 Animation::Create(std::move(curve), 0, 1, TargetProperty::FILTER); 8420 Animation::Create(std::move(curve), 0, 1, TargetProperty::FILTER);
8364 animation->set_fill_mode(Animation::FillMode::NONE); 8421 animation->set_fill_mode(Animation::FillMode::NONE);
8365 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000)); 8422 animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000));
8366 8423
8367 AddAnimationToElementWithPlayer(child->element_id(), timeline_impl(), 8424 AddAnimationToElementWithPlayer(child->element_id(), timeline_impl(),
8368 std::move(animation)); 8425 std::move(animation));
8369 ExecuteCalculateDrawProperties(root); 8426 ExecuteCalculateDrawProperties(root);
8370 8427
8371 EXPECT_TRUE(GetRenderSurface(root)); 8428 EXPECT_TRUE(GetRenderSurface(root));
8372 EXPECT_TRUE(GetRenderSurface(child)); 8429 EXPECT_NE(GetRenderSurface(child), GetRenderSurface(root));
8373 EXPECT_FALSE(GetRenderSurface(grandchild)); 8430 EXPECT_EQ(GetRenderSurface(grandchild), GetRenderSurface(child));
8374 8431
8375 EXPECT_TRUE(GetRenderSurface(root)->Filters().IsEmpty()); 8432 EXPECT_TRUE(GetRenderSurface(root)->Filters().IsEmpty());
8376 EXPECT_TRUE(GetRenderSurface(child)->Filters().IsEmpty()); 8433 EXPECT_TRUE(GetRenderSurface(child)->Filters().IsEmpty());
8377 8434
8378 EXPECT_FALSE(root->FilterIsAnimating()); 8435 EXPECT_FALSE(root->FilterIsAnimating());
8379 EXPECT_FALSE(root->HasPotentiallyRunningFilterAnimation()); 8436 EXPECT_FALSE(root->HasPotentiallyRunningFilterAnimation());
8380 EXPECT_FALSE(child->FilterIsAnimating()); 8437 EXPECT_FALSE(child->FilterIsAnimating());
8381 EXPECT_TRUE(child->HasPotentiallyRunningFilterAnimation()); 8438 EXPECT_TRUE(child->HasPotentiallyRunningFilterAnimation());
8382 EXPECT_FALSE(grandchild->FilterIsAnimating()); 8439 EXPECT_FALSE(grandchild->FilterIsAnimating());
8383 EXPECT_FALSE(grandchild->HasPotentiallyRunningFilterAnimation()); 8440 EXPECT_FALSE(grandchild->HasPotentiallyRunningFilterAnimation());
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
9074 page_scale_layer, inner_viewport_scroll_layer, 9131 page_scale_layer, inner_viewport_scroll_layer,
9075 outer_viewport_scroll_layer); 9132 outer_viewport_scroll_layer);
9076 9133
9077 TransformTree& transform_tree = 9134 TransformTree& transform_tree =
9078 root->layer_tree_impl()->property_trees()->transform_tree; 9135 root->layer_tree_impl()->property_trees()->transform_tree;
9079 TransformNode* transform_node = 9136 TransformNode* transform_node =
9080 transform_tree.Node(significant_transform->transform_tree_index()); 9137 transform_tree.Node(significant_transform->transform_tree_index());
9081 EXPECT_EQ(transform_node->owning_layer_id, significant_transform->id()); 9138 EXPECT_EQ(transform_node->owning_layer_id, significant_transform->id());
9082 9139
9083 EXPECT_TRUE(GetRenderSurface(root)); 9140 EXPECT_TRUE(GetRenderSurface(root));
9084 EXPECT_FALSE(GetRenderSurface(significant_transform)); 9141 EXPECT_EQ(GetRenderSurface(significant_transform), GetRenderSurface(root));
9085 EXPECT_TRUE(GetRenderSurface(layer_clips_subtree)); 9142 EXPECT_TRUE(GetRenderSurface(layer_clips_subtree));
9086 EXPECT_TRUE(GetRenderSurface(render_surface)); 9143 EXPECT_NE(GetRenderSurface(render_surface), GetRenderSurface(root));
9087 EXPECT_FALSE(GetRenderSurface(test_layer)); 9144 EXPECT_EQ(GetRenderSurface(test_layer), GetRenderSurface(render_surface));
9088 9145
9089 EXPECT_EQ(gfx::Rect(30, 20), test_layer->visible_layer_rect()); 9146 EXPECT_EQ(gfx::Rect(30, 20), test_layer->visible_layer_rect());
9090 } 9147 }
9091 9148
9092 TEST_F(LayerTreeHostCommonTest, TransformOfParentClipNodeAncestorOfTarget) { 9149 TEST_F(LayerTreeHostCommonTest, TransformOfParentClipNodeAncestorOfTarget) {
9093 // Ensure that when parent clip node's transform is an ancestor of current 9150 // Ensure that when parent clip node's transform is an ancestor of current
9094 // clip node's target, clip is 'projected' from parent space to current 9151 // clip node's target, clip is 'projected' from parent space to current
9095 // target space and visible rects are calculated correctly. 9152 // target space and visible rects are calculated correctly.
9096 LayerImpl* root = root_layer_for_testing(); 9153 LayerImpl* root = root_layer_for_testing();
9097 LayerImpl* clip_layer = AddChild<LayerImpl>(root); 9154 LayerImpl* clip_layer = AddChild<LayerImpl>(root);
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after
10093 10150
10094 // Check child layer draw properties. 10151 // Check child layer draw properties.
10095 EXPECT_EQ(gfx::Rect(10, 10), child->visible_layer_rect()); 10152 EXPECT_EQ(gfx::Rect(10, 10), child->visible_layer_rect());
10096 EXPECT_EQ(gfx::Transform(), child->DrawTransform()); 10153 EXPECT_EQ(gfx::Transform(), child->DrawTransform());
10097 EXPECT_EQ(gfx::Rect(10, 10), child->clip_rect()); 10154 EXPECT_EQ(gfx::Rect(10, 10), child->clip_rect());
10098 EXPECT_EQ(gfx::Rect(10, 10), child->drawable_content_rect()); 10155 EXPECT_EQ(gfx::Rect(10, 10), child->drawable_content_rect());
10099 } 10156 }
10100 10157
10101 } // namespace 10158 } // namespace
10102 } // namespace cc 10159 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/effect_node.cc ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698