| 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 "cc/layer_tree_host_common.h" | 7 #include "cc/layer_tree_host_common.h" |
| 8 | 8 |
| 9 #include "cc/content_layer.h" | 9 #include "cc/content_layer.h" |
| 10 #include "cc/content_layer_client.h" | 10 #include "cc/content_layer_client.h" |
| (...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 778 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 778 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); |
| 779 EXPECT_TRUE(parent->renderSurface()); | 779 EXPECT_TRUE(parent->renderSurface()); |
| 780 EXPECT_FALSE(renderSurface1->renderSurface()); | 780 EXPECT_FALSE(renderSurface1->renderSurface()); |
| 781 EXPECT_EQ(1U, renderSurfaceLayerList.size()); | 781 EXPECT_EQ(1U, renderSurfaceLayerList.size()); |
| 782 } | 782 } |
| 783 | 783 |
| 784 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithD
irectContainer) | 784 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithD
irectContainer) |
| 785 { | 785 { |
| 786 // This test checks for correct scroll compensation when the fixed-position
container | 786 // This test checks for correct scroll compensation when the fixed-position
container |
| 787 // is the direct parent of the fixed-position layer. | 787 // is the direct parent of the fixed-position layer. |
| 788 | |
| 789 DebugScopedSetImplThread scopedImplThread; | |
| 790 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); | 788 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); |
| 791 LayerImpl* child = root->children()[0]; | 789 LayerImpl* child = root->children()[0]; |
| 792 LayerImpl* grandChild = child->children()[0]; | 790 LayerImpl* grandChild = child->children()[0]; |
| 793 | 791 |
| 794 child->setIsContainerForFixedPositionLayers(true); | 792 child->setIsContainerForFixedPositionLayers(true); |
| 795 grandChild->setFixedToContainerLayer(true); | 793 grandChild->setFixedToContainerLayer(true); |
| 796 | 794 |
| 797 // Case 1: scrollDelta of 0, 0 | 795 // Case 1: scrollDelta of 0, 0 |
| 798 child->setScrollDelta(IntSize(0, 0)); | 796 child->setScrollDelta(IntSize(0, 0)); |
| 799 executeCalculateDrawTransformsAndVisibility(root.get()); | 797 executeCalculateDrawTransformsAndVisibility(root.get()); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 819 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithT
ransformedDirectContainer) | 817 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithT
ransformedDirectContainer) |
| 820 { | 818 { |
| 821 // This test checks for correct scroll compensation when the fixed-position
container | 819 // This test checks for correct scroll compensation when the fixed-position
container |
| 822 // is the direct parent of the fixed-position layer, but that container is t
ransformed. | 820 // is the direct parent of the fixed-position layer, but that container is t
ransformed. |
| 823 // In this case, the fixed position element inherits the container's transfo
rm, | 821 // In this case, the fixed position element inherits the container's transfo
rm, |
| 824 // but the scrollDelta that has to be undone should not be affected by that
transform. | 822 // but the scrollDelta that has to be undone should not be affected by that
transform. |
| 825 // | 823 // |
| 826 // Transforms are in general non-commutative; using something like a non-uni
form scale | 824 // Transforms are in general non-commutative; using something like a non-uni
form scale |
| 827 // helps to verify that translations and non-uniform scales are applied in t
he correct | 825 // helps to verify that translations and non-uniform scales are applied in t
he correct |
| 828 // order. | 826 // order. |
| 829 | |
| 830 DebugScopedSetImplThread scopedImplThread; | |
| 831 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); | 827 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); |
| 832 LayerImpl* child = root->children()[0]; | 828 LayerImpl* child = root->children()[0]; |
| 833 LayerImpl* grandChild = child->children()[0]; | 829 LayerImpl* grandChild = child->children()[0]; |
| 834 | 830 |
| 835 // This scale will cause child and grandChild to be effectively 200 x 800 wi
th respect to the renderTarget. | 831 // This scale will cause child and grandChild to be effectively 200 x 800 wi
th respect to the renderTarget. |
| 836 WebTransformationMatrix nonUniformScale; | 832 WebTransformationMatrix nonUniformScale; |
| 837 nonUniformScale.scaleNonUniform(2, 8); | 833 nonUniformScale.scaleNonUniform(2, 8); |
| 838 child->setTransform(nonUniformScale); | 834 child->setTransform(nonUniformScale); |
| 839 | 835 |
| 840 child->setIsContainerForFixedPositionLayers(true); | 836 child->setIsContainerForFixedPositionLayers(true); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 862 expectedChildTransform.multiply(nonUniformScale); | 858 expectedChildTransform.multiply(nonUniformScale); |
| 863 | 859 |
| 864 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); | 860 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); |
| 865 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); | 861 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); |
| 866 } | 862 } |
| 867 | 863 |
| 868 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithD
istantContainer) | 864 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithD
istantContainer) |
| 869 { | 865 { |
| 870 // This test checks for correct scroll compensation when the fixed-position
container | 866 // This test checks for correct scroll compensation when the fixed-position
container |
| 871 // is NOT the direct parent of the fixed-position layer. | 867 // is NOT the direct parent of the fixed-position layer. |
| 872 DebugScopedSetImplThread scopedImplThread; | |
| 873 | |
| 874 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); | 868 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); |
| 875 LayerImpl* child = root->children()[0]; | 869 LayerImpl* child = root->children()[0]; |
| 876 LayerImpl* grandChild = child->children()[0]; | 870 LayerImpl* grandChild = child->children()[0]; |
| 877 LayerImpl* greatGrandChild = grandChild->children()[0]; | 871 LayerImpl* greatGrandChild = grandChild->children()[0]; |
| 878 | 872 |
| 879 child->setIsContainerForFixedPositionLayers(true); | 873 child->setIsContainerForFixedPositionLayers(true); |
| 880 grandChild->setPosition(FloatPoint(8, 6)); | 874 grandChild->setPosition(FloatPoint(8, 6)); |
| 881 greatGrandChild->setFixedToContainerLayer(true); | 875 greatGrandChild->setFixedToContainerLayer(true); |
| 882 | 876 |
| 883 // Case 1: scrollDelta of 0, 0 | 877 // Case 1: scrollDelta of 0, 0 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 906 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); | 900 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); |
| 907 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); | 901 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); |
| 908 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand
Child->drawTransform()); | 902 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand
Child->drawTransform()); |
| 909 } | 903 } |
| 910 | 904 |
| 911 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithD
istantContainerAndTransforms) | 905 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithD
istantContainerAndTransforms) |
| 912 { | 906 { |
| 913 // This test checks for correct scroll compensation when the fixed-position
container | 907 // This test checks for correct scroll compensation when the fixed-position
container |
| 914 // is NOT the direct parent of the fixed-position layer, and the hierarchy h
as various | 908 // is NOT the direct parent of the fixed-position layer, and the hierarchy h
as various |
| 915 // transforms that have to be processed in the correct order. | 909 // transforms that have to be processed in the correct order. |
| 916 DebugScopedSetImplThread scopedImplThread; | |
| 917 | |
| 918 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); | 910 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); |
| 919 LayerImpl* child = root->children()[0]; | 911 LayerImpl* child = root->children()[0]; |
| 920 LayerImpl* grandChild = child->children()[0]; | 912 LayerImpl* grandChild = child->children()[0]; |
| 921 LayerImpl* greatGrandChild = grandChild->children()[0]; | 913 LayerImpl* greatGrandChild = grandChild->children()[0]; |
| 922 | 914 |
| 923 WebTransformationMatrix rotationAboutZ; | 915 WebTransformationMatrix rotationAboutZ; |
| 924 rotationAboutZ.rotate3d(0, 0, 90); | 916 rotationAboutZ.rotate3d(0, 0, 90); |
| 925 | 917 |
| 926 child->setIsContainerForFixedPositionLayers(true); | 918 child->setIsContainerForFixedPositionLayers(true); |
| 927 child->setTransform(rotationAboutZ); | 919 child->setTransform(rotationAboutZ); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 968 } | 960 } |
| 969 | 961 |
| 970 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithM
ultipleScrollDeltas) | 962 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithM
ultipleScrollDeltas) |
| 971 { | 963 { |
| 972 // This test checks for correct scroll compensation when the fixed-position
container | 964 // This test checks for correct scroll compensation when the fixed-position
container |
| 973 // has multiple ancestors that have nonzero scrollDelta before reaching the
space where the layer is fixed. | 965 // has multiple ancestors that have nonzero scrollDelta before reaching the
space where the layer is fixed. |
| 974 // In this test, each scrollDelta occurs in a different space because of eac
h layer's local transform. | 966 // In this test, each scrollDelta occurs in a different space because of eac
h layer's local transform. |
| 975 // This test checks for correct scroll compensation when the fixed-position
container | 967 // This test checks for correct scroll compensation when the fixed-position
container |
| 976 // is NOT the direct parent of the fixed-position layer, and the hierarchy h
as various | 968 // is NOT the direct parent of the fixed-position layer, and the hierarchy h
as various |
| 977 // transforms that have to be processed in the correct order. | 969 // transforms that have to be processed in the correct order. |
| 978 DebugScopedSetImplThread scopedImplThread; | |
| 979 | |
| 980 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); | 970 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); |
| 981 LayerImpl* child = root->children()[0]; | 971 LayerImpl* child = root->children()[0]; |
| 982 LayerImpl* grandChild = child->children()[0]; | 972 LayerImpl* grandChild = child->children()[0]; |
| 983 LayerImpl* greatGrandChild = grandChild->children()[0]; | 973 LayerImpl* greatGrandChild = grandChild->children()[0]; |
| 984 | 974 |
| 985 WebTransformationMatrix rotationAboutZ; | 975 WebTransformationMatrix rotationAboutZ; |
| 986 rotationAboutZ.rotate3d(0, 0, 90); | 976 rotationAboutZ.rotate3d(0, 0, 90); |
| 987 | 977 |
| 988 child->setIsContainerForFixedPositionLayers(true); | 978 child->setIsContainerForFixedPositionLayers(true); |
| 989 child->setTransform(rotationAboutZ); | 979 child->setTransform(rotationAboutZ); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1030 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); | 1020 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); |
| 1031 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand
Child->drawTransform()); | 1021 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand
Child->drawTransform()); |
| 1032 } | 1022 } |
| 1033 | 1023 |
| 1034 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithI
ntermediateSurfaceAndTransforms) | 1024 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithI
ntermediateSurfaceAndTransforms) |
| 1035 { | 1025 { |
| 1036 // This test checks for correct scroll compensation when the fixed-position
container | 1026 // This test checks for correct scroll compensation when the fixed-position
container |
| 1037 // contributes to a different renderSurface than the fixed-position layer. I
n this | 1027 // contributes to a different renderSurface than the fixed-position layer. I
n this |
| 1038 // case, the surface drawTransforms also have to be accounted for when check
ing the | 1028 // case, the surface drawTransforms also have to be accounted for when check
ing the |
| 1039 // scrollDelta. | 1029 // scrollDelta. |
| 1040 DebugScopedSetImplThread scopedImplThread; | |
| 1041 | |
| 1042 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); | 1030 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); |
| 1043 LayerImpl* child = root->children()[0]; | 1031 LayerImpl* child = root->children()[0]; |
| 1044 LayerImpl* grandChild = child->children()[0]; | 1032 LayerImpl* grandChild = child->children()[0]; |
| 1045 LayerImpl* greatGrandChild = grandChild->children()[0]; | 1033 LayerImpl* greatGrandChild = grandChild->children()[0]; |
| 1046 | 1034 |
| 1047 child->setIsContainerForFixedPositionLayers(true); | 1035 child->setIsContainerForFixedPositionLayers(true); |
| 1048 grandChild->setPosition(FloatPoint(8, 6)); | 1036 grandChild->setPosition(FloatPoint(8, 6)); |
| 1049 grandChild->setForceRenderSurface(true); | 1037 grandChild->setForceRenderSurface(true); |
| 1050 greatGrandChild->setFixedToContainerLayer(true); | 1038 greatGrandChild->setFixedToContainerLayer(true); |
| 1051 greatGrandChild->setDrawsContent(true); | 1039 greatGrandChild->setDrawsContent(true); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1103 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); | 1091 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); |
| 1104 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand
Child->drawTransform()); | 1092 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand
Child->drawTransform()); |
| 1105 } | 1093 } |
| 1106 | 1094 |
| 1107 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithM
ultipleIntermediateSurfaces) | 1095 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithM
ultipleIntermediateSurfaces) |
| 1108 { | 1096 { |
| 1109 // This test checks for correct scroll compensation when the fixed-position
container | 1097 // This test checks for correct scroll compensation when the fixed-position
container |
| 1110 // contributes to a different renderSurface than the fixed-position layer, w
ith | 1098 // contributes to a different renderSurface than the fixed-position layer, w
ith |
| 1111 // additional renderSurfaces in-between. This checks that the conversion to
ancestor | 1099 // additional renderSurfaces in-between. This checks that the conversion to
ancestor |
| 1112 // surfaces is accumulated properly in the final matrix transform. | 1100 // surfaces is accumulated properly in the final matrix transform. |
| 1113 DebugScopedSetImplThread scopedImplThread; | |
| 1114 | |
| 1115 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); | 1101 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); |
| 1116 LayerImpl* child = root->children()[0]; | 1102 LayerImpl* child = root->children()[0]; |
| 1117 LayerImpl* grandChild = child->children()[0]; | 1103 LayerImpl* grandChild = child->children()[0]; |
| 1118 LayerImpl* greatGrandChild = grandChild->children()[0]; | 1104 LayerImpl* greatGrandChild = grandChild->children()[0]; |
| 1119 | 1105 |
| 1120 // Add one more layer to the test tree for this scenario. | 1106 // Add one more layer to the test tree for this scenario. |
| 1121 { | 1107 { |
| 1122 WebTransformationMatrix identity; | 1108 WebTransformationMatrix identity; |
| 1123 scoped_ptr<LayerImpl> fixedPositionChild = LayerImpl::create(5); | 1109 scoped_ptr<LayerImpl> fixedPositionChild = LayerImpl::create(5); |
| 1124 setLayerPropertiesForTesting(fixedPositionChild.get(), identity, identit
y, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); | 1110 setLayerPropertiesForTesting(fixedPositionChild.get(), identity, identit
y, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1214 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand
Child->drawTransform()); | 1200 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand
Child->drawTransform()); |
| 1215 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedFixedPositionChildTransform, fixedPo
sitionChild->drawTransform()); | 1201 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedFixedPositionChildTransform, fixedPo
sitionChild->drawTransform()); |
| 1216 } | 1202 } |
| 1217 | 1203 |
| 1218 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithC
ontainerLayerThatHasSurface) | 1204 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithC
ontainerLayerThatHasSurface) |
| 1219 { | 1205 { |
| 1220 // This test checks for correct scroll compensation when the fixed-position
container | 1206 // This test checks for correct scroll compensation when the fixed-position
container |
| 1221 // itself has a renderSurface. In this case, the container layer should be t
reated | 1207 // itself has a renderSurface. In this case, the container layer should be t
reated |
| 1222 // like a layer that contributes to a renderTarget, and that renderTarget | 1208 // like a layer that contributes to a renderTarget, and that renderTarget |
| 1223 // is completely irrelevant; it should not affect the scroll compensation. | 1209 // is completely irrelevant; it should not affect the scroll compensation. |
| 1224 DebugScopedSetImplThread scopedImplThread; | |
| 1225 | |
| 1226 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); | 1210 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); |
| 1227 LayerImpl* child = root->children()[0]; | 1211 LayerImpl* child = root->children()[0]; |
| 1228 LayerImpl* grandChild = child->children()[0]; | 1212 LayerImpl* grandChild = child->children()[0]; |
| 1229 | 1213 |
| 1230 child->setIsContainerForFixedPositionLayers(true); | 1214 child->setIsContainerForFixedPositionLayers(true); |
| 1231 child->setForceRenderSurface(true); | 1215 child->setForceRenderSurface(true); |
| 1232 grandChild->setFixedToContainerLayer(true); | 1216 grandChild->setFixedToContainerLayer(true); |
| 1233 grandChild->setDrawsContent(true); | 1217 grandChild->setDrawsContent(true); |
| 1234 | 1218 |
| 1235 // Case 1: scrollDelta of 0, 0 | 1219 // Case 1: scrollDelta of 0, 0 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1261 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceDrawTransform, child->renderS
urface()->drawTransform()); | 1245 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceDrawTransform, child->renderS
urface()->drawTransform()); |
| 1262 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); | 1246 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); |
| 1263 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); | 1247 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); |
| 1264 } | 1248 } |
| 1265 | 1249 |
| 1266 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerThatI
sAlsoFixedPositionContainer) | 1250 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerThatI
sAlsoFixedPositionContainer) |
| 1267 { | 1251 { |
| 1268 // This test checks the scenario where a fixed-position layer also happens t
o be a | 1252 // This test checks the scenario where a fixed-position layer also happens t
o be a |
| 1269 // container itself for a descendant fixed position layer. In particular, th
e layer | 1253 // container itself for a descendant fixed position layer. In particular, th
e layer |
| 1270 // should not accidentally be fixed to itself. | 1254 // should not accidentally be fixed to itself. |
| 1271 DebugScopedSetImplThread scopedImplThread; | |
| 1272 | |
| 1273 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); | 1255 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); |
| 1274 LayerImpl* child = root->children()[0]; | 1256 LayerImpl* child = root->children()[0]; |
| 1275 LayerImpl* grandChild = child->children()[0]; | 1257 LayerImpl* grandChild = child->children()[0]; |
| 1276 | 1258 |
| 1277 child->setIsContainerForFixedPositionLayers(true); | 1259 child->setIsContainerForFixedPositionLayers(true); |
| 1278 grandChild->setFixedToContainerLayer(true); | 1260 grandChild->setFixedToContainerLayer(true); |
| 1279 | 1261 |
| 1280 // This should not confuse the grandChild. If correct, the grandChild would
still be considered fixed to its container (i.e. "child"). | 1262 // This should not confuse the grandChild. If correct, the grandChild would
still be considered fixed to its container (i.e. "child"). |
| 1281 grandChild->setIsContainerForFixedPositionLayers(true); | 1263 grandChild->setIsContainerForFixedPositionLayers(true); |
| 1282 | 1264 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1298 expectedChildTransform.translate(-10, -10); | 1280 expectedChildTransform.translate(-10, -10); |
| 1299 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); | 1281 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); |
| 1300 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); | 1282 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); |
| 1301 } | 1283 } |
| 1302 | 1284 |
| 1303 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerThatH
asNoContainer) | 1285 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerThatH
asNoContainer) |
| 1304 { | 1286 { |
| 1305 // This test checks scroll compensation when a fixed-position layer does not
find any | 1287 // This test checks scroll compensation when a fixed-position layer does not
find any |
| 1306 // ancestor that is a "containerForFixedPositionLayers". In this situation,
the layer should | 1288 // ancestor that is a "containerForFixedPositionLayers". In this situation,
the layer should |
| 1307 // be fixed to the viewport -- not the rootLayer, which may have transforms
of its own. | 1289 // be fixed to the viewport -- not the rootLayer, which may have transforms
of its own. |
| 1308 DebugScopedSetImplThread scopedImplThread; | |
| 1309 | |
| 1310 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); | 1290 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); |
| 1311 LayerImpl* child = root->children()[0]; | 1291 LayerImpl* child = root->children()[0]; |
| 1312 LayerImpl* grandChild = child->children()[0]; | 1292 LayerImpl* grandChild = child->children()[0]; |
| 1313 | 1293 |
| 1314 WebTransformationMatrix rotationByZ; | 1294 WebTransformationMatrix rotationByZ; |
| 1315 rotationByZ.rotate3d(0, 0, 90); | 1295 rotationByZ.rotate3d(0, 0, 90); |
| 1316 | 1296 |
| 1317 root->setTransform(rotationByZ); | 1297 root->setTransform(rotationByZ); |
| 1318 grandChild->setFixedToContainerLayer(true); | 1298 grandChild->setFixedToContainerLayer(true); |
| 1319 | 1299 |
| (...skipping 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2671 | 2651 |
| 2672 // Verify frontFacingSurface's layerList. | 2652 // Verify frontFacingSurface's layerList. |
| 2673 ASSERT_EQ(2u, renderSurfaceLayerList[1]->renderSurface()->layerList().size()
); | 2653 ASSERT_EQ(2u, renderSurfaceLayerList[1]->renderSurface()->layerList().size()
); |
| 2674 EXPECT_EQ(frontFacingSurface->id(), renderSurfaceLayerList[1]->renderSurface
()->layerList()[0]->id()); | 2654 EXPECT_EQ(frontFacingSurface->id(), renderSurfaceLayerList[1]->renderSurface
()->layerList()[0]->id()); |
| 2675 EXPECT_EQ(child1->id(), renderSurfaceLayerList[1]->renderSurface()->layerLis
t()[1]->id()); | 2655 EXPECT_EQ(child1->id(), renderSurfaceLayerList[1]->renderSurface()->layerLis
t()[1]->id()); |
| 2676 } | 2656 } |
| 2677 | 2657 |
| 2678 TEST(LayerTreeHostCommonTest, verifyHitTestingForEmptyLayerList) | 2658 TEST(LayerTreeHostCommonTest, verifyHitTestingForEmptyLayerList) |
| 2679 { | 2659 { |
| 2680 // Hit testing on an empty renderSurfaceLayerList should return a null point
er. | 2660 // Hit testing on an empty renderSurfaceLayerList should return a null point
er. |
| 2681 DebugScopedSetImplThread thisScopeIsOnImplThread; | |
| 2682 | |
| 2683 std::vector<LayerImpl*> renderSurfaceLayerList; | 2661 std::vector<LayerImpl*> renderSurfaceLayerList; |
| 2684 | 2662 |
| 2685 IntPoint testPoint(0, 0); | 2663 IntPoint testPoint(0, 0); |
| 2686 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); | 2664 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); |
| 2687 EXPECT_FALSE(resultLayer); | 2665 EXPECT_FALSE(resultLayer); |
| 2688 | 2666 |
| 2689 testPoint = IntPoint(10, 20); | 2667 testPoint = IntPoint(10, 20); |
| 2690 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); | 2668 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); |
| 2691 EXPECT_FALSE(resultLayer); | 2669 EXPECT_FALSE(resultLayer); |
| 2692 } | 2670 } |
| 2693 | 2671 |
| 2694 TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleLayer) | 2672 TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleLayer) |
| 2695 { | 2673 { |
| 2696 DebugScopedSetImplThread thisScopeIsOnImplThread; | |
| 2697 | |
| 2698 scoped_ptr<LayerImpl> root = LayerImpl::create(12345); | 2674 scoped_ptr<LayerImpl> root = LayerImpl::create(12345); |
| 2699 | 2675 |
| 2700 WebTransformationMatrix identityMatrix; | 2676 WebTransformationMatrix identityMatrix; |
| 2701 FloatPoint anchor(0, 0); | 2677 FloatPoint anchor(0, 0); |
| 2702 FloatPoint position(0, 0); | 2678 FloatPoint position(0, 0); |
| 2703 IntSize bounds(100, 100); | 2679 IntSize bounds(100, 100); |
| 2704 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); | 2680 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); |
| 2705 root->setDrawsContent(true); | 2681 root->setDrawsContent(true); |
| 2706 | 2682 |
| 2707 std::vector<LayerImpl*> renderSurfaceLayerList; | 2683 std::vector<LayerImpl*> renderSurfaceLayerList; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2728 EXPECT_EQ(12345, resultLayer->id()); | 2704 EXPECT_EQ(12345, resultLayer->id()); |
| 2729 | 2705 |
| 2730 testPoint = IntPoint(99, 99); | 2706 testPoint = IntPoint(99, 99); |
| 2731 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); | 2707 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); |
| 2732 ASSERT_TRUE(resultLayer); | 2708 ASSERT_TRUE(resultLayer); |
| 2733 EXPECT_EQ(12345, resultLayer->id()); | 2709 EXPECT_EQ(12345, resultLayer->id()); |
| 2734 } | 2710 } |
| 2735 | 2711 |
| 2736 TEST(LayerTreeHostCommonTest, verifyHitTestingForUninvertibleTransform) | 2712 TEST(LayerTreeHostCommonTest, verifyHitTestingForUninvertibleTransform) |
| 2737 { | 2713 { |
| 2738 DebugScopedSetImplThread thisScopeIsOnImplThread; | |
| 2739 | |
| 2740 scoped_ptr<LayerImpl> root = LayerImpl::create(12345); | 2714 scoped_ptr<LayerImpl> root = LayerImpl::create(12345); |
| 2741 | 2715 |
| 2742 WebTransformationMatrix uninvertibleTransform; | 2716 WebTransformationMatrix uninvertibleTransform; |
| 2743 uninvertibleTransform.setM11(0); | 2717 uninvertibleTransform.setM11(0); |
| 2744 uninvertibleTransform.setM22(0); | 2718 uninvertibleTransform.setM22(0); |
| 2745 uninvertibleTransform.setM33(0); | 2719 uninvertibleTransform.setM33(0); |
| 2746 uninvertibleTransform.setM44(0); | 2720 uninvertibleTransform.setM44(0); |
| 2747 ASSERT_FALSE(uninvertibleTransform.isInvertible()); | 2721 ASSERT_FALSE(uninvertibleTransform.isInvertible()); |
| 2748 | 2722 |
| 2749 WebTransformationMatrix identityMatrix; | 2723 WebTransformationMatrix identityMatrix; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2789 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); | 2763 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); |
| 2790 EXPECT_FALSE(resultLayer); | 2764 EXPECT_FALSE(resultLayer); |
| 2791 | 2765 |
| 2792 testPoint = IntPoint(-1, -1); | 2766 testPoint = IntPoint(-1, -1); |
| 2793 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); | 2767 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); |
| 2794 EXPECT_FALSE(resultLayer); | 2768 EXPECT_FALSE(resultLayer); |
| 2795 } | 2769 } |
| 2796 | 2770 |
| 2797 TEST(LayerTreeHostCommonTest, verifyHitTestingForSinglePositionedLayer) | 2771 TEST(LayerTreeHostCommonTest, verifyHitTestingForSinglePositionedLayer) |
| 2798 { | 2772 { |
| 2799 DebugScopedSetImplThread thisScopeIsOnImplThread; | |
| 2800 | |
| 2801 scoped_ptr<LayerImpl> root = LayerImpl::create(12345); | 2773 scoped_ptr<LayerImpl> root = LayerImpl::create(12345); |
| 2802 | 2774 |
| 2803 WebTransformationMatrix identityMatrix; | 2775 WebTransformationMatrix identityMatrix; |
| 2804 FloatPoint anchor(0, 0); | 2776 FloatPoint anchor(0, 0); |
| 2805 FloatPoint position(50, 50); // this layer is positioned, and hit testing sh
ould correctly know where the layer is located. | 2777 FloatPoint position(50, 50); // this layer is positioned, and hit testing sh
ould correctly know where the layer is located. |
| 2806 IntSize bounds(100, 100); | 2778 IntSize bounds(100, 100); |
| 2807 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); | 2779 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); |
| 2808 root->setDrawsContent(true); | 2780 root->setDrawsContent(true); |
| 2809 | 2781 |
| 2810 std::vector<LayerImpl*> renderSurfaceLayerList; | 2782 std::vector<LayerImpl*> renderSurfaceLayerList; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 2832 EXPECT_EQ(12345, resultLayer->id()); | 2804 EXPECT_EQ(12345, resultLayer->id()); |
| 2833 | 2805 |
| 2834 testPoint = IntPoint(99, 99); | 2806 testPoint = IntPoint(99, 99); |
| 2835 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); | 2807 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); |
| 2836 ASSERT_TRUE(resultLayer); | 2808 ASSERT_TRUE(resultLayer); |
| 2837 EXPECT_EQ(12345, resultLayer->id()); | 2809 EXPECT_EQ(12345, resultLayer->id()); |
| 2838 } | 2810 } |
| 2839 | 2811 |
| 2840 TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleRotatedLayer) | 2812 TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleRotatedLayer) |
| 2841 { | 2813 { |
| 2842 DebugScopedSetImplThread thisScopeIsOnImplThread; | |
| 2843 | |
| 2844 scoped_ptr<LayerImpl> root = LayerImpl::create(12345); | 2814 scoped_ptr<LayerImpl> root = LayerImpl::create(12345); |
| 2845 | 2815 |
| 2846 WebTransformationMatrix identityMatrix; | 2816 WebTransformationMatrix identityMatrix; |
| 2847 WebTransformationMatrix rotation45DegreesAboutCenter; | 2817 WebTransformationMatrix rotation45DegreesAboutCenter; |
| 2848 rotation45DegreesAboutCenter.translate(50, 50); | 2818 rotation45DegreesAboutCenter.translate(50, 50); |
| 2849 rotation45DegreesAboutCenter.rotate3d(0, 0, 45); | 2819 rotation45DegreesAboutCenter.rotate3d(0, 0, 45); |
| 2850 rotation45DegreesAboutCenter.translate(-50, -50); | 2820 rotation45DegreesAboutCenter.translate(-50, -50); |
| 2851 FloatPoint anchor(0, 0); | 2821 FloatPoint anchor(0, 0); |
| 2852 FloatPoint position(0, 0); | 2822 FloatPoint position(0, 0); |
| 2853 IntSize bounds(100, 100); | 2823 IntSize bounds(100, 100); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2883 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); | 2853 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); |
| 2884 ASSERT_FALSE(resultLayer); | 2854 ASSERT_FALSE(resultLayer); |
| 2885 | 2855 |
| 2886 testPoint = IntPoint(-1, 50); | 2856 testPoint = IntPoint(-1, 50); |
| 2887 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); | 2857 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); |
| 2888 ASSERT_FALSE(resultLayer); | 2858 ASSERT_FALSE(resultLayer); |
| 2889 } | 2859 } |
| 2890 | 2860 |
| 2891 TEST(LayerTreeHostCommonTest, verifyHitTestingForSinglePerspectiveLayer) | 2861 TEST(LayerTreeHostCommonTest, verifyHitTestingForSinglePerspectiveLayer) |
| 2892 { | 2862 { |
| 2893 DebugScopedSetImplThread thisScopeIsOnImplThread; | |
| 2894 | |
| 2895 scoped_ptr<LayerImpl> root = LayerImpl::create(12345); | 2863 scoped_ptr<LayerImpl> root = LayerImpl::create(12345); |
| 2896 | 2864 |
| 2897 WebTransformationMatrix identityMatrix; | 2865 WebTransformationMatrix identityMatrix; |
| 2898 | 2866 |
| 2899 // perspectiveProjectionAboutCenter * translationByZ is designed so that the
100 x 100 layer becomes 50 x 50, and remains centered at (50, 50). | 2867 // perspectiveProjectionAboutCenter * translationByZ is designed so that the
100 x 100 layer becomes 50 x 50, and remains centered at (50, 50). |
| 2900 WebTransformationMatrix perspectiveProjectionAboutCenter; | 2868 WebTransformationMatrix perspectiveProjectionAboutCenter; |
| 2901 perspectiveProjectionAboutCenter.translate(50, 50); | 2869 perspectiveProjectionAboutCenter.translate(50, 50); |
| 2902 perspectiveProjectionAboutCenter.applyPerspective(1); | 2870 perspectiveProjectionAboutCenter.applyPerspective(1); |
| 2903 perspectiveProjectionAboutCenter.translate(-50, -50); | 2871 perspectiveProjectionAboutCenter.translate(-50, -50); |
| 2904 WebTransformationMatrix translationByZ; | 2872 WebTransformationMatrix translationByZ; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2945 // A layer's visibleContentRect is actually in the layer's content space. Th
e | 2913 // A layer's visibleContentRect is actually in the layer's content space. Th
e |
| 2946 // screenSpaceTransform converts from the layer's origin space to screen spa
ce. This | 2914 // screenSpaceTransform converts from the layer's origin space to screen spa
ce. This |
| 2947 // test makes sure that hit testing works correctly accounts for the content
s scale. | 2915 // test makes sure that hit testing works correctly accounts for the content
s scale. |
| 2948 // A contentsScale that is not 1 effectively forces a non-identity transform
between | 2916 // A contentsScale that is not 1 effectively forces a non-identity transform
between |
| 2949 // layer's content space and layer's origin space. The hit testing code must
take this into account. | 2917 // layer's content space and layer's origin space. The hit testing code must
take this into account. |
| 2950 // | 2918 // |
| 2951 // To test this, the layer is positioned at (25, 25), and is size (50, 50).
If | 2919 // To test this, the layer is positioned at (25, 25), and is size (50, 50).
If |
| 2952 // contentsScale is ignored, then hit testing will mis-interpret the visible
ContentRect | 2920 // contentsScale is ignored, then hit testing will mis-interpret the visible
ContentRect |
| 2953 // as being larger than the actual bounds of the layer. | 2921 // as being larger than the actual bounds of the layer. |
| 2954 // | 2922 // |
| 2955 DebugScopedSetImplThread thisScopeIsOnImplThread; | |
| 2956 | |
| 2957 scoped_ptr<LayerImpl> root = LayerImpl::create(1); | 2923 scoped_ptr<LayerImpl> root = LayerImpl::create(1); |
| 2958 | 2924 |
| 2959 WebTransformationMatrix identityMatrix; | 2925 WebTransformationMatrix identityMatrix; |
| 2960 FloatPoint anchor(0, 0); | 2926 FloatPoint anchor(0, 0); |
| 2961 | 2927 |
| 2962 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, FloatPoint(0, 0), IntSize(100, 100), false); | 2928 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, FloatPoint(0, 0), IntSize(100, 100), false); |
| 2963 | 2929 |
| 2964 { | 2930 { |
| 2965 FloatPoint position(25, 25); | 2931 FloatPoint position(25, 25); |
| 2966 IntSize bounds(50, 50); | 2932 IntSize bounds(50, 50); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3007 testPoint = IntPoint(74, 74); | 2973 testPoint = IntPoint(74, 74); |
| 3008 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); | 2974 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); |
| 3009 ASSERT_TRUE(resultLayer); | 2975 ASSERT_TRUE(resultLayer); |
| 3010 EXPECT_EQ(12345, resultLayer->id()); | 2976 EXPECT_EQ(12345, resultLayer->id()); |
| 3011 } | 2977 } |
| 3012 | 2978 |
| 3013 TEST(LayerTreeHostCommonTest, verifyHitTestingForSimpleClippedLayer) | 2979 TEST(LayerTreeHostCommonTest, verifyHitTestingForSimpleClippedLayer) |
| 3014 { | 2980 { |
| 3015 // Test that hit-testing will only work for the visible portion of a layer,
and not | 2981 // Test that hit-testing will only work for the visible portion of a layer,
and not |
| 3016 // the entire layer bounds. Here we just test the simple axis-aligned case. | 2982 // the entire layer bounds. Here we just test the simple axis-aligned case. |
| 3017 DebugScopedSetImplThread thisScopeIsOnImplThread; | |
| 3018 | |
| 3019 WebTransformationMatrix identityMatrix; | 2983 WebTransformationMatrix identityMatrix; |
| 3020 FloatPoint anchor(0, 0); | 2984 FloatPoint anchor(0, 0); |
| 3021 | 2985 |
| 3022 scoped_ptr<LayerImpl> root = LayerImpl::create(1); | 2986 scoped_ptr<LayerImpl> root = LayerImpl::create(1); |
| 3023 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, FloatPoint(0, 0), IntSize(100, 100), false); | 2987 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, FloatPoint(0, 0), IntSize(100, 100), false); |
| 3024 | 2988 |
| 3025 { | 2989 { |
| 3026 scoped_ptr<LayerImpl> clippingLayer = LayerImpl::create(123); | 2990 scoped_ptr<LayerImpl> clippingLayer = LayerImpl::create(123); |
| 3027 FloatPoint position(25, 25); // this layer is positioned, and hit testin
g should correctly know where the layer is located. | 2991 FloatPoint position(25, 25); // this layer is positioned, and hit testin
g should correctly know where the layer is located. |
| 3028 IntSize bounds(50, 50); | 2992 IntSize bounds(50, 50); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3075 // This test checks whether hit testing correctly avoids hit testing with mu
ltiple | 3039 // This test checks whether hit testing correctly avoids hit testing with mu
ltiple |
| 3076 // ancestors that clip in non axis-aligned ways. To pass this test, the hit
testing | 3040 // ancestors that clip in non axis-aligned ways. To pass this test, the hit
testing |
| 3077 // algorithm needs to recognize that multiple parent layers may clip the lay
er, and | 3041 // algorithm needs to recognize that multiple parent layers may clip the lay
er, and |
| 3078 // should not actually hit those clipped areas. | 3042 // should not actually hit those clipped areas. |
| 3079 // | 3043 // |
| 3080 // The child and grandChild layers are both initialized to clip the rotatedL
eaf. The | 3044 // The child and grandChild layers are both initialized to clip the rotatedL
eaf. The |
| 3081 // child layer is rotated about the top-left corner, so that the root + chil
d clips | 3045 // child layer is rotated about the top-left corner, so that the root + chil
d clips |
| 3082 // combined create a triangle. The rotatedLeaf will only be visible where it
overlaps | 3046 // combined create a triangle. The rotatedLeaf will only be visible where it
overlaps |
| 3083 // this triangle. | 3047 // this triangle. |
| 3084 // | 3048 // |
| 3085 DebugScopedSetImplThread thisScopeIsOnImplThread; | |
| 3086 | |
| 3087 scoped_ptr<LayerImpl> root = LayerImpl::create(123); | 3049 scoped_ptr<LayerImpl> root = LayerImpl::create(123); |
| 3088 | 3050 |
| 3089 WebTransformationMatrix identityMatrix; | 3051 WebTransformationMatrix identityMatrix; |
| 3090 FloatPoint anchor(0, 0); | 3052 FloatPoint anchor(0, 0); |
| 3091 FloatPoint position(0, 0); | 3053 FloatPoint position(0, 0); |
| 3092 IntSize bounds(100, 100); | 3054 IntSize bounds(100, 100); |
| 3093 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); | 3055 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); |
| 3094 root->setMasksToBounds(true); | 3056 root->setMasksToBounds(true); |
| 3095 | 3057 |
| 3096 { | 3058 { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3175 testPoint = IntPoint(49, 51); | 3137 testPoint = IntPoint(49, 51); |
| 3176 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); | 3138 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); |
| 3177 ASSERT_TRUE(resultLayer); | 3139 ASSERT_TRUE(resultLayer); |
| 3178 EXPECT_EQ(2468, resultLayer->id()); | 3140 EXPECT_EQ(2468, resultLayer->id()); |
| 3179 } | 3141 } |
| 3180 | 3142 |
| 3181 TEST(LayerTreeHostCommonTest, verifyHitTestingForNonClippingIntermediateLayer) | 3143 TEST(LayerTreeHostCommonTest, verifyHitTestingForNonClippingIntermediateLayer) |
| 3182 { | 3144 { |
| 3183 // This test checks that hit testing code does not accidentally clip to laye
r | 3145 // This test checks that hit testing code does not accidentally clip to laye
r |
| 3184 // bounds for a layer that actually does not clip. | 3146 // bounds for a layer that actually does not clip. |
| 3185 DebugScopedSetImplThread thisScopeIsOnImplThread; | |
| 3186 | |
| 3187 WebTransformationMatrix identityMatrix; | 3147 WebTransformationMatrix identityMatrix; |
| 3188 FloatPoint anchor(0, 0); | 3148 FloatPoint anchor(0, 0); |
| 3189 | 3149 |
| 3190 scoped_ptr<LayerImpl> root = LayerImpl::create(1); | 3150 scoped_ptr<LayerImpl> root = LayerImpl::create(1); |
| 3191 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, FloatPoint(0, 0), IntSize(100, 100), false); | 3151 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, FloatPoint(0, 0), IntSize(100, 100), false); |
| 3192 | 3152 |
| 3193 { | 3153 { |
| 3194 scoped_ptr<LayerImpl> intermediateLayer = LayerImpl::create(123); | 3154 scoped_ptr<LayerImpl> intermediateLayer = LayerImpl::create(123); |
| 3195 FloatPoint position(10, 10); // this layer is positioned, and hit testin
g should correctly know where the layer is located. | 3155 FloatPoint position(10, 10); // this layer is positioned, and hit testin
g should correctly know where the layer is located. |
| 3196 IntSize bounds(50, 50); | 3156 IntSize bounds(50, 50); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3236 | 3196 |
| 3237 testPoint = IntPoint(89, 89); | 3197 testPoint = IntPoint(89, 89); |
| 3238 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); | 3198 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); |
| 3239 ASSERT_TRUE(resultLayer); | 3199 ASSERT_TRUE(resultLayer); |
| 3240 EXPECT_EQ(456, resultLayer->id()); | 3200 EXPECT_EQ(456, resultLayer->id()); |
| 3241 } | 3201 } |
| 3242 | 3202 |
| 3243 | 3203 |
| 3244 TEST(LayerTreeHostCommonTest, verifyHitTestingForMultipleLayers) | 3204 TEST(LayerTreeHostCommonTest, verifyHitTestingForMultipleLayers) |
| 3245 { | 3205 { |
| 3246 DebugScopedSetImplThread thisScopeIsOnImplThread; | |
| 3247 | |
| 3248 scoped_ptr<LayerImpl> root = LayerImpl::create(1); | 3206 scoped_ptr<LayerImpl> root = LayerImpl::create(1); |
| 3249 | 3207 |
| 3250 WebTransformationMatrix identityMatrix; | 3208 WebTransformationMatrix identityMatrix; |
| 3251 FloatPoint anchor(0, 0); | 3209 FloatPoint anchor(0, 0); |
| 3252 FloatPoint position(0, 0); | 3210 FloatPoint position(0, 0); |
| 3253 IntSize bounds(100, 100); | 3211 IntSize bounds(100, 100); |
| 3254 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); | 3212 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); |
| 3255 root->setDrawsContent(true); | 3213 root->setDrawsContent(true); |
| 3256 | 3214 |
| 3257 { | 3215 { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3341 ASSERT_TRUE(resultLayer); | 3299 ASSERT_TRUE(resultLayer); |
| 3342 EXPECT_EQ(4, resultLayer->id()); | 3300 EXPECT_EQ(4, resultLayer->id()); |
| 3343 } | 3301 } |
| 3344 | 3302 |
| 3345 TEST(LayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists) | 3303 TEST(LayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists) |
| 3346 { | 3304 { |
| 3347 // | 3305 // |
| 3348 // The geometry is set up similarly to the previous case, but | 3306 // The geometry is set up similarly to the previous case, but |
| 3349 // all layers are forced to be renderSurfaces now. | 3307 // all layers are forced to be renderSurfaces now. |
| 3350 // | 3308 // |
| 3351 DebugScopedSetImplThread thisScopeIsOnImplThread; | |
| 3352 | |
| 3353 scoped_ptr<LayerImpl> root = LayerImpl::create(1); | 3309 scoped_ptr<LayerImpl> root = LayerImpl::create(1); |
| 3354 | 3310 |
| 3355 WebTransformationMatrix identityMatrix; | 3311 WebTransformationMatrix identityMatrix; |
| 3356 FloatPoint anchor(0, 0); | 3312 FloatPoint anchor(0, 0); |
| 3357 FloatPoint position(0, 0); | 3313 FloatPoint position(0, 0); |
| 3358 IntSize bounds(100, 100); | 3314 IntSize bounds(100, 100); |
| 3359 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); | 3315 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); |
| 3360 root->setDrawsContent(true); | 3316 root->setDrawsContent(true); |
| 3361 | 3317 |
| 3362 { | 3318 { |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3888 int nonexistentId = -1; | 3844 int nonexistentId = -1; |
| 3889 EXPECT_EQ(root, LayerTreeHostCommon::findLayerInSubtree(root.get(), root->id
())); | 3845 EXPECT_EQ(root, LayerTreeHostCommon::findLayerInSubtree(root.get(), root->id
())); |
| 3890 EXPECT_EQ(child, LayerTreeHostCommon::findLayerInSubtree(root.get(), child->
id())); | 3846 EXPECT_EQ(child, LayerTreeHostCommon::findLayerInSubtree(root.get(), child->
id())); |
| 3891 EXPECT_EQ(grandChild, LayerTreeHostCommon::findLayerInSubtree(root.get(), gr
andChild->id())); | 3847 EXPECT_EQ(grandChild, LayerTreeHostCommon::findLayerInSubtree(root.get(), gr
andChild->id())); |
| 3892 EXPECT_EQ(maskLayer, LayerTreeHostCommon::findLayerInSubtree(root.get(), mas
kLayer->id())); | 3848 EXPECT_EQ(maskLayer, LayerTreeHostCommon::findLayerInSubtree(root.get(), mas
kLayer->id())); |
| 3893 EXPECT_EQ(replicaLayer, LayerTreeHostCommon::findLayerInSubtree(root.get(),
replicaLayer->id())); | 3849 EXPECT_EQ(replicaLayer, LayerTreeHostCommon::findLayerInSubtree(root.get(),
replicaLayer->id())); |
| 3894 EXPECT_EQ(0, LayerTreeHostCommon::findLayerInSubtree(root.get(), nonexistent
Id)); | 3850 EXPECT_EQ(0, LayerTreeHostCommon::findLayerInSubtree(root.get(), nonexistent
Id)); |
| 3895 } | 3851 } |
| 3896 | 3852 |
| 3897 } // namespace | 3853 } // namespace |
| OLD | NEW |