| 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 "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "CCLayerTreeHostCommon.h" | 7 #include "CCLayerTreeHostCommon.h" |
| 8 | 8 |
| 9 #include "CCAnimationTestCommon.h" | 9 #include "CCAnimationTestCommon.h" |
| 10 #include "CCGeometryTestUtils.h" | 10 #include "CCGeometryTestUtils.h" |
| (...skipping 1930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1941 root->addChild(child3); | 1941 root->addChild(child3); |
| 1942 | 1942 |
| 1943 WebTransformationMatrix identityMatrix; | 1943 WebTransformationMatrix identityMatrix; |
| 1944 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, Flo
atPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); | 1944 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, Flo
atPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); |
| 1945 setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(0, 0), IntSize(50, 50), false); | 1945 setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(0, 0), IntSize(50, 50), false); |
| 1946 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(75, 75), IntSize(50, 50), false); | 1946 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(75, 75), IntSize(50, 50), false); |
| 1947 setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(125, 125), IntSize(50, 50), false); | 1947 setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(125, 125), IntSize(50, 50), false); |
| 1948 | 1948 |
| 1949 executeCalculateDrawTransformsAndVisibility(root.get()); | 1949 executeCalculateDrawTransformsAndVisibility(root.get()); |
| 1950 | 1950 |
| 1951 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->renderSurface()->drawableConte
ntRect()); | 1951 EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 100, 100), root->renderSurface()->drawa
bleContentRect()); |
| 1952 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect()); | 1952 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect()); |
| 1953 | 1953 |
| 1954 // Layers that do not draw content should have empty visibleContentRects. | 1954 // Layers that do not draw content should have empty visibleContentRects. |
| 1955 EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect()); | 1955 EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect()); |
| 1956 | 1956 |
| 1957 // layer visibleContentRects are clipped by their targetSurface | 1957 // layer visibleContentRects are clipped by their targetSurface |
| 1958 EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child1->visibleContentRect()); | 1958 EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child1->visibleContentRect()); |
| 1959 EXPECT_RECT_EQ(IntRect(0, 0, 25, 25), child2->visibleContentRect()); | 1959 EXPECT_RECT_EQ(IntRect(0, 0, 25, 25), child2->visibleContentRect()); |
| 1960 EXPECT_TRUE(child3->visibleContentRect().isEmpty()); | 1960 EXPECT_TRUE(child3->visibleContentRect().isEmpty()); |
| 1961 | 1961 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1982 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, Fl
oatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); | 1982 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, Fl
oatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); |
| 1983 setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identityMatr
ix, FloatPoint(0, 0), FloatPoint(5, 5), IntSize(50, 50), false); | 1983 setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identityMatr
ix, FloatPoint(0, 0), FloatPoint(5, 5), IntSize(50, 50), false); |
| 1984 setLayerPropertiesForTesting(grandChild2.get(), identityMatrix, identityMatr
ix, FloatPoint(0, 0), FloatPoint(75, 75), IntSize(50, 50), false); | 1984 setLayerPropertiesForTesting(grandChild2.get(), identityMatrix, identityMatr
ix, FloatPoint(0, 0), FloatPoint(75, 75), IntSize(50, 50), false); |
| 1985 setLayerPropertiesForTesting(grandChild3.get(), identityMatrix, identityMatr
ix, FloatPoint(0, 0), FloatPoint(125, 125), IntSize(50, 50), false); | 1985 setLayerPropertiesForTesting(grandChild3.get(), identityMatrix, identityMatr
ix, FloatPoint(0, 0), FloatPoint(125, 125), IntSize(50, 50), false); |
| 1986 | 1986 |
| 1987 child->setMasksToBounds(true); | 1987 child->setMasksToBounds(true); |
| 1988 executeCalculateDrawTransformsAndVisibility(root.get()); | 1988 executeCalculateDrawTransformsAndVisibility(root.get()); |
| 1989 | 1989 |
| 1990 ASSERT_FALSE(child->renderSurface()); | 1990 ASSERT_FALSE(child->renderSurface()); |
| 1991 | 1991 |
| 1992 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->renderSurface()->drawableConte
ntRect()); | 1992 EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 100, 100), root->renderSurface()->drawa
bleContentRect()); |
| 1993 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect()); | 1993 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect()); |
| 1994 | 1994 |
| 1995 // Layers that do not draw content should have empty visibleContentRects. | 1995 // Layers that do not draw content should have empty visibleContentRects. |
| 1996 EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect()); | 1996 EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect()); |
| 1997 EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), child->visibleContentRect()); | 1997 EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), child->visibleContentRect()); |
| 1998 | 1998 |
| 1999 // All grandchild visibleContentRects should be clipped by child. | 1999 // All grandchild visibleContentRects should be clipped by child. |
| 2000 EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), grandChild1->visibleContentRect()); | 2000 EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), grandChild1->visibleContentRect()); |
| 2001 EXPECT_RECT_EQ(IntRect(0, 0, 25, 25), grandChild2->visibleContentRect()); | 2001 EXPECT_RECT_EQ(IntRect(0, 0, 25, 25), grandChild2->visibleContentRect()); |
| 2002 EXPECT_TRUE(grandChild3->visibleContentRect().isEmpty()); | 2002 EXPECT_TRUE(grandChild3->visibleContentRect().isEmpty()); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 2024 setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityM
atrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(3, 4), false); | 2024 setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityM
atrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(3, 4), false); |
| 2025 setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(5, 5), IntSize(50, 50), false); | 2025 setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(5, 5), IntSize(50, 50), false); |
| 2026 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(75, 75), IntSize(50, 50), false); | 2026 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(75, 75), IntSize(50, 50), false); |
| 2027 setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(125, 125), IntSize(50, 50), false); | 2027 setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(125, 125), IntSize(50, 50), false); |
| 2028 | 2028 |
| 2029 renderSurface1->setForceRenderSurface(true); | 2029 renderSurface1->setForceRenderSurface(true); |
| 2030 executeCalculateDrawTransformsAndVisibility(root.get()); | 2030 executeCalculateDrawTransformsAndVisibility(root.get()); |
| 2031 | 2031 |
| 2032 ASSERT_TRUE(renderSurface1->renderSurface()); | 2032 ASSERT_TRUE(renderSurface1->renderSurface()); |
| 2033 | 2033 |
| 2034 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->renderSurface()->drawableConte
ntRect()); | 2034 EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 100, 100), root->renderSurface()->drawa
bleContentRect()); |
| 2035 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect()); | 2035 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect()); |
| 2036 | 2036 |
| 2037 // Layers that do not draw content should have empty visibleContentRects. | 2037 // Layers that do not draw content should have empty visibleContentRects. |
| 2038 EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect()); | 2038 EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect()); |
| 2039 EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), renderSurface1->visibleContentRect()); | 2039 EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), renderSurface1->visibleContentRect()); |
| 2040 | 2040 |
| 2041 // An unclipped surface grows its drawableContentRect to include all drawabl
e regions of the subtree. | 2041 // An unclipped surface grows its drawableContentRect to include all drawabl
e regions of the subtree. |
| 2042 EXPECT_RECT_EQ(IntRect(5, 5, 170, 170), renderSurface1->renderSurface()->dra
wableContentRect()); | 2042 EXPECT_FLOAT_RECT_EQ(FloatRect(5, 5, 170, 170), renderSurface1->renderSurfac
e()->drawableContentRect()); |
| 2043 | 2043 |
| 2044 // All layers that draw content into the unclipped surface are also unclippe
d. | 2044 // All layers that draw content into the unclipped surface are also unclippe
d. |
| 2045 EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child1->visibleContentRect()); | 2045 EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child1->visibleContentRect()); |
| 2046 EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child2->visibleContentRect()); | 2046 EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child2->visibleContentRect()); |
| 2047 EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child3->visibleContentRect()); | 2047 EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child3->visibleContentRect()); |
| 2048 | 2048 |
| 2049 EXPECT_RECT_EQ(IntRect(5, 5, 50, 50), child1->drawableContentRect()); | 2049 EXPECT_RECT_EQ(IntRect(5, 5, 50, 50), child1->drawableContentRect()); |
| 2050 EXPECT_RECT_EQ(IntRect(75, 75, 50, 50), child2->drawableContentRect()); | 2050 EXPECT_RECT_EQ(IntRect(75, 75, 50, 50), child2->drawableContentRect()); |
| 2051 EXPECT_RECT_EQ(IntRect(125, 125, 50, 50), child3->drawableContentRect()); | 2051 EXPECT_RECT_EQ(IntRect(125, 125, 50, 50), child3->drawableContentRect()); |
| 2052 } | 2052 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2069 setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(5, 5), IntSize(50, 50), false); | 2069 setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(5, 5), IntSize(50, 50), false); |
| 2070 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(75, 75), IntSize(50, 50), false); | 2070 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(75, 75), IntSize(50, 50), false); |
| 2071 setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(125, 125), IntSize(50, 50), false); | 2071 setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(125, 125), IntSize(50, 50), false); |
| 2072 | 2072 |
| 2073 root->setMasksToBounds(true); | 2073 root->setMasksToBounds(true); |
| 2074 renderSurface1->setForceRenderSurface(true); | 2074 renderSurface1->setForceRenderSurface(true); |
| 2075 executeCalculateDrawTransformsAndVisibility(root.get()); | 2075 executeCalculateDrawTransformsAndVisibility(root.get()); |
| 2076 | 2076 |
| 2077 ASSERT_TRUE(renderSurface1->renderSurface()); | 2077 ASSERT_TRUE(renderSurface1->renderSurface()); |
| 2078 | 2078 |
| 2079 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->renderSurface()->drawableConte
ntRect()); | 2079 EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 100, 100), root->renderSurface()->drawa
bleContentRect()); |
| 2080 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect()); | 2080 EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 100, 100), root->drawableContentRect())
; |
| 2081 | 2081 |
| 2082 // Layers that do not draw content should have empty visibleContentRects. | 2082 // Layers that do not draw content should have empty visibleContentRects. |
| 2083 EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect()); | 2083 EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect()); |
| 2084 EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), renderSurface1->visibleContentRect()); | 2084 EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), renderSurface1->visibleContentRect()); |
| 2085 | 2085 |
| 2086 // A clipped surface grows its drawableContentRect to include all drawable r
egions of the subtree, | 2086 // A clipped surface grows its drawableContentRect to include all drawable r
egions of the subtree, |
| 2087 // but also gets clamped by the ancestor's clip. | 2087 // but also gets clamped by the ancestor's clip. |
| 2088 EXPECT_RECT_EQ(IntRect(5, 5, 95, 95), renderSurface1->renderSurface()->drawa
bleContentRect()); | 2088 EXPECT_FLOAT_RECT_EQ(FloatRect(5, 5, 95, 95), renderSurface1->renderSurface(
)->drawableContentRect()); |
| 2089 | 2089 |
| 2090 // All layers that draw content into the surface have their visibleContentRe
ct clipped by the surface clipRect. | 2090 // All layers that draw content into the surface have their visibleContentRe
ct clipped by the surface clipRect. |
| 2091 EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child1->visibleContentRect()); | 2091 EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child1->visibleContentRect()); |
| 2092 EXPECT_RECT_EQ(IntRect(0, 0, 25, 25), child2->visibleContentRect()); | 2092 EXPECT_RECT_EQ(IntRect(0, 0, 25, 25), child2->visibleContentRect()); |
| 2093 EXPECT_TRUE(child3->visibleContentRect().isEmpty()); | 2093 EXPECT_TRUE(child3->visibleContentRect().isEmpty()); |
| 2094 | 2094 |
| 2095 // But the drawableContentRects are unclipped. | 2095 // But the drawableContentRects are unclipped. |
| 2096 EXPECT_RECT_EQ(IntRect(5, 5, 50, 50), child1->drawableContentRect()); | 2096 EXPECT_RECT_EQ(IntRect(5, 5, 50, 50), child1->drawableContentRect()); |
| 2097 EXPECT_RECT_EQ(IntRect(75, 75, 50, 50), child2->drawableContentRect()); | 2097 EXPECT_RECT_EQ(IntRect(75, 75, 50, 50), child2->drawableContentRect()); |
| 2098 EXPECT_RECT_EQ(IntRect(125, 125, 50, 50), child3->drawableContentRect()); | 2098 EXPECT_RECT_EQ(IntRect(125, 125, 50, 50), child3->drawableContentRect()); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2122 setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(125, 125), IntSize(50, 50), false); | 2122 setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, F
loatPoint(0, 0), FloatPoint(125, 125), IntSize(50, 50), false); |
| 2123 | 2123 |
| 2124 root->setMasksToBounds(true); | 2124 root->setMasksToBounds(true); |
| 2125 renderSurface1->setForceRenderSurface(true); | 2125 renderSurface1->setForceRenderSurface(true); |
| 2126 renderSurface2->setForceRenderSurface(true); | 2126 renderSurface2->setForceRenderSurface(true); |
| 2127 executeCalculateDrawTransformsAndVisibility(root.get()); | 2127 executeCalculateDrawTransformsAndVisibility(root.get()); |
| 2128 | 2128 |
| 2129 ASSERT_TRUE(renderSurface1->renderSurface()); | 2129 ASSERT_TRUE(renderSurface1->renderSurface()); |
| 2130 ASSERT_TRUE(renderSurface2->renderSurface()); | 2130 ASSERT_TRUE(renderSurface2->renderSurface()); |
| 2131 | 2131 |
| 2132 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->renderSurface()->drawableConte
ntRect()); | 2132 EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 100, 100), root->renderSurface()->drawa
bleContentRect()); |
| 2133 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect()); | 2133 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect()); |
| 2134 | 2134 |
| 2135 // Layers that do not draw content should have empty visibleContentRects. | 2135 // Layers that do not draw content should have empty visibleContentRects. |
| 2136 EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect()); | 2136 EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect()); |
| 2137 EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), renderSurface1->visibleContentRect()); | 2137 EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), renderSurface1->visibleContentRect()); |
| 2138 EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), renderSurface2->visibleContentRect()); | 2138 EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), renderSurface2->visibleContentRect()); |
| 2139 | 2139 |
| 2140 // A clipped surface grows its drawableContentRect to include all drawable r
egions of the subtree, | 2140 // A clipped surface grows its drawableContentRect to include all drawable r
egions of the subtree, |
| 2141 // but also gets clamped by the ancestor's clip. | 2141 // but also gets clamped by the ancestor's clip. |
| 2142 EXPECT_RECT_EQ(IntRect(5, 5, 95, 95), renderSurface1->renderSurface()->drawa
bleContentRect()); | 2142 EXPECT_FLOAT_RECT_EQ(FloatRect(5, 5, 95, 95), renderSurface1->renderSurface(
)->drawableContentRect()); |
| 2143 | 2143 |
| 2144 // renderSurface1 lives in the "unclipped universe" of renderSurface1, and i
s only | 2144 // renderSurface1 lives in the "unclipped universe" of renderSurface1, and i
s only |
| 2145 // implicitly clipped by renderSurface1's contentRect. So, renderSurface2 gr
ows to | 2145 // implicitly clipped by renderSurface1's contentRect. So, renderSurface2 gr
ows to |
| 2146 // enclose all drawable content of its subtree. | 2146 // enclose all drawable content of its subtree. |
| 2147 EXPECT_RECT_EQ(IntRect(5, 5, 170, 170), renderSurface2->renderSurface()->dra
wableContentRect()); | 2147 EXPECT_FLOAT_RECT_EQ(FloatRect(5, 5, 170, 170), renderSurface2->renderSurfac
e()->drawableContentRect()); |
| 2148 | 2148 |
| 2149 // All layers that draw content into renderSurface2 think they are unclipped
. | 2149 // All layers that draw content into renderSurface2 think they are unclipped
. |
| 2150 EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child1->visibleContentRect()); | 2150 EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child1->visibleContentRect()); |
| 2151 EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child2->visibleContentRect()); | 2151 EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child2->visibleContentRect()); |
| 2152 EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child3->visibleContentRect()); | 2152 EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child3->visibleContentRect()); |
| 2153 | 2153 |
| 2154 // drawableContentRects are also unclipped. | 2154 // drawableContentRects are also unclipped. |
| 2155 EXPECT_RECT_EQ(IntRect(5, 5, 50, 50), child1->drawableContentRect()); | 2155 EXPECT_RECT_EQ(IntRect(5, 5, 50, 50), child1->drawableContentRect()); |
| 2156 EXPECT_RECT_EQ(IntRect(75, 75, 50, 50), child2->drawableContentRect()); | 2156 EXPECT_RECT_EQ(IntRect(75, 75, 50, 50), child2->drawableContentRect()); |
| 2157 EXPECT_RECT_EQ(IntRect(125, 125, 50, 50), child3->drawableContentRect()); | 2157 EXPECT_RECT_EQ(IntRect(125, 125, 50, 50), child3->drawableContentRect()); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2173 childRotation.rotate(45); | 2173 childRotation.rotate(45); |
| 2174 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, Flo
atPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); | 2174 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, Flo
atPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); |
| 2175 setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityM
atrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(3, 4), false); | 2175 setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityM
atrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(3, 4), false); |
| 2176 setLayerPropertiesForTesting(child1.get(), childRotation, identityMatrix, Fl
oatPoint(0.5, 0.5), FloatPoint(25, 25), IntSize(50, 50), false); | 2176 setLayerPropertiesForTesting(child1.get(), childRotation, identityMatrix, Fl
oatPoint(0.5, 0.5), FloatPoint(25, 25), IntSize(50, 50), false); |
| 2177 | 2177 |
| 2178 renderSurface1->setForceRenderSurface(true); | 2178 renderSurface1->setForceRenderSurface(true); |
| 2179 executeCalculateDrawTransformsAndVisibility(root.get()); | 2179 executeCalculateDrawTransformsAndVisibility(root.get()); |
| 2180 | 2180 |
| 2181 ASSERT_TRUE(renderSurface1->renderSurface()); | 2181 ASSERT_TRUE(renderSurface1->renderSurface()); |
| 2182 | 2182 |
| 2183 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->renderSurface()->drawableConte
ntRect()); | 2183 EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 100, 100), root->renderSurface()->drawa
bleContentRect()); |
| 2184 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect()); | 2184 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect()); |
| 2185 | 2185 |
| 2186 // Layers that do not draw content should have empty visibleContentRects. | 2186 // Layers that do not draw content should have empty visibleContentRects. |
| 2187 EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect()); | 2187 EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect()); |
| 2188 EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), renderSurface1->visibleContentRect()); | 2188 EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), renderSurface1->visibleContentRect()); |
| 2189 | 2189 |
| 2190 // The unclipped surface grows its drawableContentRect to include all drawab
le regions of the subtree. | 2190 // The unclipped surface grows its drawableContentRect to include all drawab
le regions of the subtree. |
| 2191 int diagonalRadius = ceil(sqrt(2.0) * 25); | 2191 int diagonalRadius = ceil(sqrt(2.0) * 25); |
| 2192 IntRect expectedSurfaceDrawableContent = IntRect(50 - diagonalRadius, 50 - d
iagonalRadius, diagonalRadius * 2, diagonalRadius * 2); | 2192 IntRect expectedSurfaceDrawableContent = IntRect(50 - diagonalRadius, 50 - d
iagonalRadius, diagonalRadius * 2, diagonalRadius * 2); |
| 2193 EXPECT_RECT_EQ(expectedSurfaceDrawableContent, renderSurface1->renderSurface
()->drawableContentRect()); | 2193 EXPECT_FLOAT_RECT_EQ(FloatRect(expectedSurfaceDrawableContent), renderSurfac
e1->renderSurface()->drawableContentRect()); |
| 2194 | 2194 |
| 2195 // All layers that draw content into the unclipped surface are also unclippe
d. | 2195 // All layers that draw content into the unclipped surface are also unclippe
d. |
| 2196 EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child1->visibleContentRect()); | 2196 EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child1->visibleContentRect()); |
| 2197 EXPECT_RECT_EQ(expectedSurfaceDrawableContent, child1->drawableContentRect()
); | 2197 EXPECT_RECT_EQ(expectedSurfaceDrawableContent, child1->drawableContentRect()
); |
| 2198 } | 2198 } |
| 2199 | 2199 |
| 2200 TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsWithTransfor
mOnClippedSurface) | 2200 TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsWithTransfor
mOnClippedSurface) |
| 2201 { | 2201 { |
| 2202 // Layers that have non-axis aligned bounds (due to transforms) have an expa
nded, | 2202 // Layers that have non-axis aligned bounds (due to transforms) have an expa
nded, |
| 2203 // axis-aligned drawableContentRect and visibleContentRect. | 2203 // axis-aligned drawableContentRect and visibleContentRect. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 2217 | 2217 |
| 2218 root->setMasksToBounds(true); | 2218 root->setMasksToBounds(true); |
| 2219 renderSurface1->setForceRenderSurface(true); | 2219 renderSurface1->setForceRenderSurface(true); |
| 2220 executeCalculateDrawTransformsAndVisibility(root.get()); | 2220 executeCalculateDrawTransformsAndVisibility(root.get()); |
| 2221 | 2221 |
| 2222 ASSERT_TRUE(renderSurface1->renderSurface()); | 2222 ASSERT_TRUE(renderSurface1->renderSurface()); |
| 2223 | 2223 |
| 2224 // The clipped surface clamps the drawableContentRect that encloses the rota
ted layer. | 2224 // The clipped surface clamps the drawableContentRect that encloses the rota
ted layer. |
| 2225 int diagonalRadius = ceil(sqrt(2.0) * 25); | 2225 int diagonalRadius = ceil(sqrt(2.0) * 25); |
| 2226 IntRect unclippedSurfaceContent = IntRect(50 - diagonalRadius, 50 - diagonal
Radius, diagonalRadius * 2, diagonalRadius * 2); | 2226 IntRect unclippedSurfaceContent = IntRect(50 - diagonalRadius, 50 - diagonal
Radius, diagonalRadius * 2, diagonalRadius * 2); |
| 2227 IntRect expectedSurfaceDrawableContent = intersection(unclippedSurfaceConten
t, IntRect(0, 0, 50, 50)); | 2227 FloatRect expectedSurfaceDrawableContent = intersection(unclippedSurfaceCont
ent, FloatRect(0, 0, 50, 50)); |
| 2228 EXPECT_RECT_EQ(expectedSurfaceDrawableContent, renderSurface1->renderSurface
()->drawableContentRect()); | 2228 EXPECT_FLOAT_RECT_EQ(expectedSurfaceDrawableContent, renderSurface1->renderS
urface()->drawableContentRect()); |
| 2229 | 2229 |
| 2230 // On the clipped surface, only a quarter of the child1 is visible, but whe
n rotating | 2230 // On the clipped surface, only a quarter of the child1 is visible, but whe
n rotating |
| 2231 // it back to child1's content space, the actual enclosing rect ends up cov
ering the | 2231 // it back to child1's content space, the actual enclosing rect ends up cov
ering the |
| 2232 // full left half of child1. | 2232 // full left half of child1. |
| 2233 EXPECT_RECT_EQ(IntRect(0, 0, 26, 50), child1->visibleContentRect()); | 2233 EXPECT_RECT_EQ(IntRect(0, 0, 26, 50), child1->visibleContentRect()); |
| 2234 | 2234 |
| 2235 // The child's drawableContentRect is unclipped. | 2235 // The child's drawableContentRect is unclipped. |
| 2236 EXPECT_RECT_EQ(unclippedSurfaceContent, child1->drawableContentRect()); | 2236 EXPECT_RECT_EQ(unclippedSurfaceContent, child1->drawableContentRect()); |
| 2237 } | 2237 } |
| 2238 | 2238 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2270 | 2270 |
| 2271 root->setMasksToBounds(true); | 2271 root->setMasksToBounds(true); |
| 2272 renderSurface1->setForceRenderSurface(true); | 2272 renderSurface1->setForceRenderSurface(true); |
| 2273 renderSurface2->setForceRenderSurface(true); | 2273 renderSurface2->setForceRenderSurface(true); |
| 2274 executeCalculateDrawTransformsAndVisibility(root.get(), deviceScaleFactor); | 2274 executeCalculateDrawTransformsAndVisibility(root.get(), deviceScaleFactor); |
| 2275 | 2275 |
| 2276 ASSERT_TRUE(renderSurface1->renderSurface()); | 2276 ASSERT_TRUE(renderSurface1->renderSurface()); |
| 2277 ASSERT_TRUE(renderSurface2->renderSurface()); | 2277 ASSERT_TRUE(renderSurface2->renderSurface()); |
| 2278 | 2278 |
| 2279 // DrawableContentRects for all layers and surfaces are scaled by deviceScal
eFactor. | 2279 // DrawableContentRects for all layers and surfaces are scaled by deviceScal
eFactor. |
| 2280 EXPECT_RECT_EQ(IntRect(0, 0, 200, 200), root->renderSurface()->drawableConte
ntRect()); | 2280 EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 200, 200), root->renderSurface()->drawa
bleContentRect()); |
| 2281 EXPECT_RECT_EQ(IntRect(0, 0, 200, 200), root->drawableContentRect()); | 2281 EXPECT_RECT_EQ(IntRect(0, 0, 200, 200), root->drawableContentRect()); |
| 2282 EXPECT_RECT_EQ(IntRect(10, 10, 190, 190), renderSurface1->renderSurface()->d
rawableContentRect()); | 2282 EXPECT_FLOAT_RECT_EQ(FloatRect(10, 10, 190, 190), renderSurface1->renderSurf
ace()->drawableContentRect()); |
| 2283 | 2283 |
| 2284 // renderSurface2 lives in the "unclipped universe" of renderSurface1, and | 2284 // renderSurface2 lives in the "unclipped universe" of renderSurface1, and |
| 2285 // is only implicitly clipped by renderSurface1. | 2285 // is only implicitly clipped by renderSurface1. |
| 2286 EXPECT_RECT_EQ(IntRect(10, 10, 350, 350), renderSurface2->renderSurface()->d
rawableContentRect()); | 2286 EXPECT_FLOAT_RECT_EQ(FloatRect(10, 10, 350, 350), renderSurface2->renderSurf
ace()->drawableContentRect()); |
| 2287 | 2287 |
| 2288 EXPECT_RECT_EQ(IntRect(10, 10, 100, 100), child1->drawableContentRect()); | 2288 EXPECT_RECT_EQ(IntRect(10, 10, 100, 100), child1->drawableContentRect()); |
| 2289 EXPECT_RECT_EQ(IntRect(150, 150, 100, 100), child2->drawableContentRect()); | 2289 EXPECT_RECT_EQ(IntRect(150, 150, 100, 100), child2->drawableContentRect()); |
| 2290 EXPECT_RECT_EQ(IntRect(250, 250, 100, 100), child3->drawableContentRect()); | 2290 EXPECT_RECT_EQ(IntRect(250, 250, 100, 100), child3->drawableContentRect()); |
| 2291 | 2291 |
| 2292 // The root layer does not actually draw content of its own. | 2292 // The root layer does not actually draw content of its own. |
| 2293 EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect()); | 2293 EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect()); |
| 2294 | 2294 |
| 2295 // All layer visibleContentRects are expressed in content space of each | 2295 // All layer visibleContentRects are expressed in content space of each |
| 2296 // layer, so they are also scaled by the deviceScaleFactor. | 2296 // layer, so they are also scaled by the deviceScaleFactor. |
| (...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3592 int nonexistentId = -1; | 3592 int nonexistentId = -1; |
| 3593 EXPECT_EQ(root, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), root->
id())); | 3593 EXPECT_EQ(root, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), root->
id())); |
| 3594 EXPECT_EQ(child, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), child
->id())); | 3594 EXPECT_EQ(child, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), child
->id())); |
| 3595 EXPECT_EQ(grandChild, CCLayerTreeHostCommon::findLayerInSubtree(root.get(),
grandChild->id())); | 3595 EXPECT_EQ(grandChild, CCLayerTreeHostCommon::findLayerInSubtree(root.get(),
grandChild->id())); |
| 3596 EXPECT_EQ(maskLayer, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), m
askLayer->id())); | 3596 EXPECT_EQ(maskLayer, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), m
askLayer->id())); |
| 3597 EXPECT_EQ(replicaLayer, CCLayerTreeHostCommon::findLayerInSubtree(root.get()
, replicaLayer->id())); | 3597 EXPECT_EQ(replicaLayer, CCLayerTreeHostCommon::findLayerInSubtree(root.get()
, replicaLayer->id())); |
| 3598 EXPECT_EQ(0, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), nonexiste
ntId)); | 3598 EXPECT_EQ(0, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), nonexiste
ntId)); |
| 3599 } | 3599 } |
| 3600 | 3600 |
| 3601 } // namespace | 3601 } // namespace |
| OLD | NEW |