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 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); | 784 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(),
1, 1, dummyMaxTextureSize, renderSurfaceLayerList); |
785 EXPECT_TRUE(parent->renderSurface()); | 785 EXPECT_TRUE(parent->renderSurface()); |
786 EXPECT_FALSE(renderSurface1->renderSurface()); | 786 EXPECT_FALSE(renderSurface1->renderSurface()); |
787 EXPECT_EQ(1U, renderSurfaceLayerList.size()); | 787 EXPECT_EQ(1U, renderSurfaceLayerList.size()); |
788 } | 788 } |
789 | 789 |
790 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithD
irectContainer) | 790 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithD
irectContainer) |
791 { | 791 { |
792 // This test checks for correct scroll compensation when the fixed-position
container | 792 // This test checks for correct scroll compensation when the fixed-position
container |
793 // is the direct parent of the fixed-position layer. | 793 // is the direct parent of the fixed-position layer. |
| 794 |
| 795 DebugScopedSetImplThread scopedImplThread; |
794 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); | 796 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); |
795 LayerImpl* child = root->children()[0]; | 797 LayerImpl* child = root->children()[0]; |
796 LayerImpl* grandChild = child->children()[0]; | 798 LayerImpl* grandChild = child->children()[0]; |
797 | 799 |
798 child->setIsContainerForFixedPositionLayers(true); | 800 child->setIsContainerForFixedPositionLayers(true); |
799 grandChild->setFixedToContainerLayer(true); | 801 grandChild->setFixedToContainerLayer(true); |
800 | 802 |
801 // Case 1: scrollDelta of 0, 0 | 803 // Case 1: scrollDelta of 0, 0 |
802 child->setScrollDelta(IntSize(0, 0)); | 804 child->setScrollDelta(IntSize(0, 0)); |
803 executeCalculateDrawTransformsAndVisibility(root.get()); | 805 executeCalculateDrawTransformsAndVisibility(root.get()); |
(...skipping 19 matching lines...) Expand all Loading... |
823 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithT
ransformedDirectContainer) | 825 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithT
ransformedDirectContainer) |
824 { | 826 { |
825 // This test checks for correct scroll compensation when the fixed-position
container | 827 // This test checks for correct scroll compensation when the fixed-position
container |
826 // is the direct parent of the fixed-position layer, but that container is t
ransformed. | 828 // is the direct parent of the fixed-position layer, but that container is t
ransformed. |
827 // In this case, the fixed position element inherits the container's transfo
rm, | 829 // In this case, the fixed position element inherits the container's transfo
rm, |
828 // but the scrollDelta that has to be undone should not be affected by that
transform. | 830 // but the scrollDelta that has to be undone should not be affected by that
transform. |
829 // | 831 // |
830 // Transforms are in general non-commutative; using something like a non-uni
form scale | 832 // Transforms are in general non-commutative; using something like a non-uni
form scale |
831 // helps to verify that translations and non-uniform scales are applied in t
he correct | 833 // helps to verify that translations and non-uniform scales are applied in t
he correct |
832 // order. | 834 // order. |
| 835 |
| 836 DebugScopedSetImplThread scopedImplThread; |
833 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); | 837 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); |
834 LayerImpl* child = root->children()[0]; | 838 LayerImpl* child = root->children()[0]; |
835 LayerImpl* grandChild = child->children()[0]; | 839 LayerImpl* grandChild = child->children()[0]; |
836 | 840 |
837 // This scale will cause child and grandChild to be effectively 200 x 800 wi
th respect to the renderTarget. | 841 // This scale will cause child and grandChild to be effectively 200 x 800 wi
th respect to the renderTarget. |
838 WebTransformationMatrix nonUniformScale; | 842 WebTransformationMatrix nonUniformScale; |
839 nonUniformScale.scaleNonUniform(2, 8); | 843 nonUniformScale.scaleNonUniform(2, 8); |
840 child->setTransform(nonUniformScale); | 844 child->setTransform(nonUniformScale); |
841 | 845 |
842 child->setIsContainerForFixedPositionLayers(true); | 846 child->setIsContainerForFixedPositionLayers(true); |
(...skipping 21 matching lines...) Expand all Loading... |
864 expectedChildTransform.multiply(nonUniformScale); | 868 expectedChildTransform.multiply(nonUniformScale); |
865 | 869 |
866 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); | 870 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); |
867 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); | 871 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); |
868 } | 872 } |
869 | 873 |
870 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithD
istantContainer) | 874 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithD
istantContainer) |
871 { | 875 { |
872 // This test checks for correct scroll compensation when the fixed-position
container | 876 // This test checks for correct scroll compensation when the fixed-position
container |
873 // is NOT the direct parent of the fixed-position layer. | 877 // is NOT the direct parent of the fixed-position layer. |
| 878 DebugScopedSetImplThread scopedImplThread; |
| 879 |
874 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); | 880 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); |
875 LayerImpl* child = root->children()[0]; | 881 LayerImpl* child = root->children()[0]; |
876 LayerImpl* grandChild = child->children()[0]; | 882 LayerImpl* grandChild = child->children()[0]; |
877 LayerImpl* greatGrandChild = grandChild->children()[0]; | 883 LayerImpl* greatGrandChild = grandChild->children()[0]; |
878 | 884 |
879 child->setIsContainerForFixedPositionLayers(true); | 885 child->setIsContainerForFixedPositionLayers(true); |
880 grandChild->setPosition(gfx::PointF(8, 6)); | 886 grandChild->setPosition(gfx::PointF(8, 6)); |
881 greatGrandChild->setFixedToContainerLayer(true); | 887 greatGrandChild->setFixedToContainerLayer(true); |
882 | 888 |
883 // Case 1: scrollDelta of 0, 0 | 889 // Case 1: scrollDelta of 0, 0 |
(...skipping 22 matching lines...) Expand all Loading... |
906 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); | 912 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); |
907 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); | 913 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); |
908 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand
Child->drawTransform()); | 914 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand
Child->drawTransform()); |
909 } | 915 } |
910 | 916 |
911 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithD
istantContainerAndTransforms) | 917 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithD
istantContainerAndTransforms) |
912 { | 918 { |
913 // This test checks for correct scroll compensation when the fixed-position
container | 919 // 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 | 920 // 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. | 921 // transforms that have to be processed in the correct order. |
| 922 DebugScopedSetImplThread scopedImplThread; |
| 923 |
916 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); | 924 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); |
917 LayerImpl* child = root->children()[0]; | 925 LayerImpl* child = root->children()[0]; |
918 LayerImpl* grandChild = child->children()[0]; | 926 LayerImpl* grandChild = child->children()[0]; |
919 LayerImpl* greatGrandChild = grandChild->children()[0]; | 927 LayerImpl* greatGrandChild = grandChild->children()[0]; |
920 | 928 |
921 WebTransformationMatrix rotationAboutZ; | 929 WebTransformationMatrix rotationAboutZ; |
922 rotationAboutZ.rotate3d(0, 0, 90); | 930 rotationAboutZ.rotate3d(0, 0, 90); |
923 | 931 |
924 child->setIsContainerForFixedPositionLayers(true); | 932 child->setIsContainerForFixedPositionLayers(true); |
925 child->setTransform(rotationAboutZ); | 933 child->setTransform(rotationAboutZ); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
966 } | 974 } |
967 | 975 |
968 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithM
ultipleScrollDeltas) | 976 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithM
ultipleScrollDeltas) |
969 { | 977 { |
970 // This test checks for correct scroll compensation when the fixed-position
container | 978 // This test checks for correct scroll compensation when the fixed-position
container |
971 // has multiple ancestors that have nonzero scrollDelta before reaching the
space where the layer is fixed. | 979 // has multiple ancestors that have nonzero scrollDelta before reaching the
space where the layer is fixed. |
972 // In this test, each scrollDelta occurs in a different space because of eac
h layer's local transform. | 980 // In this test, each scrollDelta occurs in a different space because of eac
h layer's local transform. |
973 // This test checks for correct scroll compensation when the fixed-position
container | 981 // This test checks for correct scroll compensation when the fixed-position
container |
974 // is NOT the direct parent of the fixed-position layer, and the hierarchy h
as various | 982 // is NOT the direct parent of the fixed-position layer, and the hierarchy h
as various |
975 // transforms that have to be processed in the correct order. | 983 // transforms that have to be processed in the correct order. |
| 984 DebugScopedSetImplThread scopedImplThread; |
| 985 |
976 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); | 986 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); |
977 LayerImpl* child = root->children()[0]; | 987 LayerImpl* child = root->children()[0]; |
978 LayerImpl* grandChild = child->children()[0]; | 988 LayerImpl* grandChild = child->children()[0]; |
979 LayerImpl* greatGrandChild = grandChild->children()[0]; | 989 LayerImpl* greatGrandChild = grandChild->children()[0]; |
980 | 990 |
981 WebTransformationMatrix rotationAboutZ; | 991 WebTransformationMatrix rotationAboutZ; |
982 rotationAboutZ.rotate3d(0, 0, 90); | 992 rotationAboutZ.rotate3d(0, 0, 90); |
983 | 993 |
984 child->setIsContainerForFixedPositionLayers(true); | 994 child->setIsContainerForFixedPositionLayers(true); |
985 child->setTransform(rotationAboutZ); | 995 child->setTransform(rotationAboutZ); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1026 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); | 1036 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); |
1027 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand
Child->drawTransform()); | 1037 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand
Child->drawTransform()); |
1028 } | 1038 } |
1029 | 1039 |
1030 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithI
ntermediateSurfaceAndTransforms) | 1040 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithI
ntermediateSurfaceAndTransforms) |
1031 { | 1041 { |
1032 // This test checks for correct scroll compensation when the fixed-position
container | 1042 // This test checks for correct scroll compensation when the fixed-position
container |
1033 // contributes to a different renderSurface than the fixed-position layer. I
n this | 1043 // contributes to a different renderSurface than the fixed-position layer. I
n this |
1034 // case, the surface drawTransforms also have to be accounted for when check
ing the | 1044 // case, the surface drawTransforms also have to be accounted for when check
ing the |
1035 // scrollDelta. | 1045 // scrollDelta. |
| 1046 DebugScopedSetImplThread scopedImplThread; |
| 1047 |
1036 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); | 1048 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); |
1037 LayerImpl* child = root->children()[0]; | 1049 LayerImpl* child = root->children()[0]; |
1038 LayerImpl* grandChild = child->children()[0]; | 1050 LayerImpl* grandChild = child->children()[0]; |
1039 LayerImpl* greatGrandChild = grandChild->children()[0]; | 1051 LayerImpl* greatGrandChild = grandChild->children()[0]; |
1040 | 1052 |
1041 child->setIsContainerForFixedPositionLayers(true); | 1053 child->setIsContainerForFixedPositionLayers(true); |
1042 grandChild->setPosition(gfx::PointF(8, 6)); | 1054 grandChild->setPosition(gfx::PointF(8, 6)); |
1043 grandChild->setForceRenderSurface(true); | 1055 grandChild->setForceRenderSurface(true); |
1044 greatGrandChild->setFixedToContainerLayer(true); | 1056 greatGrandChild->setFixedToContainerLayer(true); |
1045 greatGrandChild->setDrawsContent(true); | 1057 greatGrandChild->setDrawsContent(true); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1097 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); | 1109 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); |
1098 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand
Child->drawTransform()); | 1110 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand
Child->drawTransform()); |
1099 } | 1111 } |
1100 | 1112 |
1101 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithM
ultipleIntermediateSurfaces) | 1113 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithM
ultipleIntermediateSurfaces) |
1102 { | 1114 { |
1103 // This test checks for correct scroll compensation when the fixed-position
container | 1115 // This test checks for correct scroll compensation when the fixed-position
container |
1104 // contributes to a different renderSurface than the fixed-position layer, w
ith | 1116 // contributes to a different renderSurface than the fixed-position layer, w
ith |
1105 // additional renderSurfaces in-between. This checks that the conversion to
ancestor | 1117 // additional renderSurfaces in-between. This checks that the conversion to
ancestor |
1106 // surfaces is accumulated properly in the final matrix transform. | 1118 // surfaces is accumulated properly in the final matrix transform. |
| 1119 DebugScopedSetImplThread scopedImplThread; |
| 1120 |
1107 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); | 1121 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); |
1108 LayerImpl* child = root->children()[0]; | 1122 LayerImpl* child = root->children()[0]; |
1109 LayerImpl* grandChild = child->children()[0]; | 1123 LayerImpl* grandChild = child->children()[0]; |
1110 LayerImpl* greatGrandChild = grandChild->children()[0]; | 1124 LayerImpl* greatGrandChild = grandChild->children()[0]; |
1111 | 1125 |
1112 // Add one more layer to the test tree for this scenario. | 1126 // Add one more layer to the test tree for this scenario. |
1113 { | 1127 { |
1114 WebTransformationMatrix identity; | 1128 WebTransformationMatrix identity; |
1115 scoped_ptr<LayerImpl> fixedPositionChild = LayerImpl::create(5); | 1129 scoped_ptr<LayerImpl> fixedPositionChild = LayerImpl::create(5); |
1116 setLayerPropertiesForTesting(fixedPositionChild.get(), identity, identit
y, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); | 1130 setLayerPropertiesForTesting(fixedPositionChild.get(), identity, identit
y, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1206 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand
Child->drawTransform()); | 1220 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand
Child->drawTransform()); |
1207 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedFixedPositionChildTransform, fixedPo
sitionChild->drawTransform()); | 1221 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedFixedPositionChildTransform, fixedPo
sitionChild->drawTransform()); |
1208 } | 1222 } |
1209 | 1223 |
1210 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithC
ontainerLayerThatHasSurface) | 1224 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithC
ontainerLayerThatHasSurface) |
1211 { | 1225 { |
1212 // This test checks for correct scroll compensation when the fixed-position
container | 1226 // This test checks for correct scroll compensation when the fixed-position
container |
1213 // itself has a renderSurface. In this case, the container layer should be t
reated | 1227 // itself has a renderSurface. In this case, the container layer should be t
reated |
1214 // like a layer that contributes to a renderTarget, and that renderTarget | 1228 // like a layer that contributes to a renderTarget, and that renderTarget |
1215 // is completely irrelevant; it should not affect the scroll compensation. | 1229 // is completely irrelevant; it should not affect the scroll compensation. |
| 1230 DebugScopedSetImplThread scopedImplThread; |
| 1231 |
1216 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); | 1232 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); |
1217 LayerImpl* child = root->children()[0]; | 1233 LayerImpl* child = root->children()[0]; |
1218 LayerImpl* grandChild = child->children()[0]; | 1234 LayerImpl* grandChild = child->children()[0]; |
1219 | 1235 |
1220 child->setIsContainerForFixedPositionLayers(true); | 1236 child->setIsContainerForFixedPositionLayers(true); |
1221 child->setForceRenderSurface(true); | 1237 child->setForceRenderSurface(true); |
1222 grandChild->setFixedToContainerLayer(true); | 1238 grandChild->setFixedToContainerLayer(true); |
1223 grandChild->setDrawsContent(true); | 1239 grandChild->setDrawsContent(true); |
1224 | 1240 |
1225 // Case 1: scrollDelta of 0, 0 | 1241 // Case 1: scrollDelta of 0, 0 |
(...skipping 25 matching lines...) Expand all Loading... |
1251 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceDrawTransform, child->renderS
urface()->drawTransform()); | 1267 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceDrawTransform, child->renderS
urface()->drawTransform()); |
1252 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); | 1268 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); |
1253 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); | 1269 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); |
1254 } | 1270 } |
1255 | 1271 |
1256 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerThatI
sAlsoFixedPositionContainer) | 1272 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerThatI
sAlsoFixedPositionContainer) |
1257 { | 1273 { |
1258 // This test checks the scenario where a fixed-position layer also happens t
o be a | 1274 // This test checks the scenario where a fixed-position layer also happens t
o be a |
1259 // container itself for a descendant fixed position layer. In particular, th
e layer | 1275 // container itself for a descendant fixed position layer. In particular, th
e layer |
1260 // should not accidentally be fixed to itself. | 1276 // should not accidentally be fixed to itself. |
| 1277 DebugScopedSetImplThread scopedImplThread; |
| 1278 |
1261 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); | 1279 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); |
1262 LayerImpl* child = root->children()[0]; | 1280 LayerImpl* child = root->children()[0]; |
1263 LayerImpl* grandChild = child->children()[0]; | 1281 LayerImpl* grandChild = child->children()[0]; |
1264 | 1282 |
1265 child->setIsContainerForFixedPositionLayers(true); | 1283 child->setIsContainerForFixedPositionLayers(true); |
1266 grandChild->setFixedToContainerLayer(true); | 1284 grandChild->setFixedToContainerLayer(true); |
1267 | 1285 |
1268 // This should not confuse the grandChild. If correct, the grandChild would
still be considered fixed to its container (i.e. "child"). | 1286 // This should not confuse the grandChild. If correct, the grandChild would
still be considered fixed to its container (i.e. "child"). |
1269 grandChild->setIsContainerForFixedPositionLayers(true); | 1287 grandChild->setIsContainerForFixedPositionLayers(true); |
1270 | 1288 |
(...skipping 15 matching lines...) Expand all Loading... |
1286 expectedChildTransform.translate(-10, -10); | 1304 expectedChildTransform.translate(-10, -10); |
1287 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); | 1305 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform
()); |
1288 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); | 1306 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); |
1289 } | 1307 } |
1290 | 1308 |
1291 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerThatH
asNoContainer) | 1309 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerThatH
asNoContainer) |
1292 { | 1310 { |
1293 // This test checks scroll compensation when a fixed-position layer does not
find any | 1311 // This test checks scroll compensation when a fixed-position layer does not
find any |
1294 // ancestor that is a "containerForFixedPositionLayers". In this situation,
the layer should | 1312 // ancestor that is a "containerForFixedPositionLayers". In this situation,
the layer should |
1295 // be fixed to the viewport -- not the rootLayer, which may have transforms
of its own. | 1313 // be fixed to the viewport -- not the rootLayer, which may have transforms
of its own. |
| 1314 DebugScopedSetImplThread scopedImplThread; |
| 1315 |
1296 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); | 1316 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); |
1297 LayerImpl* child = root->children()[0]; | 1317 LayerImpl* child = root->children()[0]; |
1298 LayerImpl* grandChild = child->children()[0]; | 1318 LayerImpl* grandChild = child->children()[0]; |
1299 | 1319 |
1300 WebTransformationMatrix rotationByZ; | 1320 WebTransformationMatrix rotationByZ; |
1301 rotationByZ.rotate3d(0, 0, 90); | 1321 rotationByZ.rotate3d(0, 0, 90); |
1302 | 1322 |
1303 root->setTransform(rotationByZ); | 1323 root->setTransform(rotationByZ); |
1304 grandChild->setFixedToContainerLayer(true); | 1324 grandChild->setFixedToContainerLayer(true); |
1305 | 1325 |
(...skipping 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2657 | 2677 |
2658 // Verify frontFacingSurface's layerList. | 2678 // Verify frontFacingSurface's layerList. |
2659 ASSERT_EQ(2u, renderSurfaceLayerList[1]->renderSurface()->layerList().size()
); | 2679 ASSERT_EQ(2u, renderSurfaceLayerList[1]->renderSurface()->layerList().size()
); |
2660 EXPECT_EQ(frontFacingSurface->id(), renderSurfaceLayerList[1]->renderSurface
()->layerList()[0]->id()); | 2680 EXPECT_EQ(frontFacingSurface->id(), renderSurfaceLayerList[1]->renderSurface
()->layerList()[0]->id()); |
2661 EXPECT_EQ(child1->id(), renderSurfaceLayerList[1]->renderSurface()->layerLis
t()[1]->id()); | 2681 EXPECT_EQ(child1->id(), renderSurfaceLayerList[1]->renderSurface()->layerLis
t()[1]->id()); |
2662 } | 2682 } |
2663 | 2683 |
2664 TEST(LayerTreeHostCommonTest, verifyHitTestingForEmptyLayerList) | 2684 TEST(LayerTreeHostCommonTest, verifyHitTestingForEmptyLayerList) |
2665 { | 2685 { |
2666 // Hit testing on an empty renderSurfaceLayerList should return a null point
er. | 2686 // Hit testing on an empty renderSurfaceLayerList should return a null point
er. |
| 2687 DebugScopedSetImplThread thisScopeIsOnImplThread; |
| 2688 |
2667 std::vector<LayerImpl*> renderSurfaceLayerList; | 2689 std::vector<LayerImpl*> renderSurfaceLayerList; |
2668 | 2690 |
2669 gfx::Point testPoint(0, 0); | 2691 gfx::Point testPoint(0, 0); |
2670 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); | 2692 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test
Point, renderSurfaceLayerList); |
2671 EXPECT_FALSE(resultLayer); | 2693 EXPECT_FALSE(resultLayer); |
2672 | 2694 |
2673 testPoint = gfx::Point(10, 20); | 2695 testPoint = gfx::Point(10, 20); |
2674 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); | 2696 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); |
2675 EXPECT_FALSE(resultLayer); | 2697 EXPECT_FALSE(resultLayer); |
2676 } | 2698 } |
2677 | 2699 |
2678 TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleLayer) | 2700 TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleLayer) |
2679 { | 2701 { |
| 2702 DebugScopedSetImplThread thisScopeIsOnImplThread; |
| 2703 |
2680 scoped_ptr<LayerImpl> root = LayerImpl::create(12345); | 2704 scoped_ptr<LayerImpl> root = LayerImpl::create(12345); |
2681 | 2705 |
2682 WebTransformationMatrix identityMatrix; | 2706 WebTransformationMatrix identityMatrix; |
2683 gfx::PointF anchor(0, 0); | 2707 gfx::PointF anchor(0, 0); |
2684 gfx::PointF position(0, 0); | 2708 gfx::PointF position(0, 0); |
2685 gfx::Size bounds(100, 100); | 2709 gfx::Size bounds(100, 100); |
2686 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); | 2710 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); |
2687 root->setDrawsContent(true); | 2711 root->setDrawsContent(true); |
2688 | 2712 |
2689 std::vector<LayerImpl*> renderSurfaceLayerList; | 2713 std::vector<LayerImpl*> renderSurfaceLayerList; |
(...skipping 20 matching lines...) Expand all Loading... |
2710 EXPECT_EQ(12345, resultLayer->id()); | 2734 EXPECT_EQ(12345, resultLayer->id()); |
2711 | 2735 |
2712 testPoint = gfx::Point(99, 99); | 2736 testPoint = gfx::Point(99, 99); |
2713 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); | 2737 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); |
2714 ASSERT_TRUE(resultLayer); | 2738 ASSERT_TRUE(resultLayer); |
2715 EXPECT_EQ(12345, resultLayer->id()); | 2739 EXPECT_EQ(12345, resultLayer->id()); |
2716 } | 2740 } |
2717 | 2741 |
2718 TEST(LayerTreeHostCommonTest, verifyHitTestingForUninvertibleTransform) | 2742 TEST(LayerTreeHostCommonTest, verifyHitTestingForUninvertibleTransform) |
2719 { | 2743 { |
| 2744 DebugScopedSetImplThread thisScopeIsOnImplThread; |
| 2745 |
2720 scoped_ptr<LayerImpl> root = LayerImpl::create(12345); | 2746 scoped_ptr<LayerImpl> root = LayerImpl::create(12345); |
2721 | 2747 |
2722 WebTransformationMatrix uninvertibleTransform; | 2748 WebTransformationMatrix uninvertibleTransform; |
2723 uninvertibleTransform.setM11(0); | 2749 uninvertibleTransform.setM11(0); |
2724 uninvertibleTransform.setM22(0); | 2750 uninvertibleTransform.setM22(0); |
2725 uninvertibleTransform.setM33(0); | 2751 uninvertibleTransform.setM33(0); |
2726 uninvertibleTransform.setM44(0); | 2752 uninvertibleTransform.setM44(0); |
2727 ASSERT_FALSE(uninvertibleTransform.isInvertible()); | 2753 ASSERT_FALSE(uninvertibleTransform.isInvertible()); |
2728 | 2754 |
2729 WebTransformationMatrix identityMatrix; | 2755 WebTransformationMatrix identityMatrix; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2769 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); | 2795 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); |
2770 EXPECT_FALSE(resultLayer); | 2796 EXPECT_FALSE(resultLayer); |
2771 | 2797 |
2772 testPoint = gfx::Point(-1, -1); | 2798 testPoint = gfx::Point(-1, -1); |
2773 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); | 2799 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); |
2774 EXPECT_FALSE(resultLayer); | 2800 EXPECT_FALSE(resultLayer); |
2775 } | 2801 } |
2776 | 2802 |
2777 TEST(LayerTreeHostCommonTest, verifyHitTestingForSinglePositionedLayer) | 2803 TEST(LayerTreeHostCommonTest, verifyHitTestingForSinglePositionedLayer) |
2778 { | 2804 { |
| 2805 DebugScopedSetImplThread thisScopeIsOnImplThread; |
| 2806 |
2779 scoped_ptr<LayerImpl> root = LayerImpl::create(12345); | 2807 scoped_ptr<LayerImpl> root = LayerImpl::create(12345); |
2780 | 2808 |
2781 WebTransformationMatrix identityMatrix; | 2809 WebTransformationMatrix identityMatrix; |
2782 gfx::PointF anchor(0, 0); | 2810 gfx::PointF anchor(0, 0); |
2783 gfx::PointF position(50, 50); // this layer is positioned, and hit testing s
hould correctly know where the layer is located. | 2811 gfx::PointF position(50, 50); // this layer is positioned, and hit testing s
hould correctly know where the layer is located. |
2784 gfx::Size bounds(100, 100); | 2812 gfx::Size bounds(100, 100); |
2785 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); | 2813 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); |
2786 root->setDrawsContent(true); | 2814 root->setDrawsContent(true); |
2787 | 2815 |
2788 std::vector<LayerImpl*> renderSurfaceLayerList; | 2816 std::vector<LayerImpl*> renderSurfaceLayerList; |
(...skipping 21 matching lines...) Expand all Loading... |
2810 EXPECT_EQ(12345, resultLayer->id()); | 2838 EXPECT_EQ(12345, resultLayer->id()); |
2811 | 2839 |
2812 testPoint = gfx::Point(99, 99); | 2840 testPoint = gfx::Point(99, 99); |
2813 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); | 2841 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); |
2814 ASSERT_TRUE(resultLayer); | 2842 ASSERT_TRUE(resultLayer); |
2815 EXPECT_EQ(12345, resultLayer->id()); | 2843 EXPECT_EQ(12345, resultLayer->id()); |
2816 } | 2844 } |
2817 | 2845 |
2818 TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleRotatedLayer) | 2846 TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleRotatedLayer) |
2819 { | 2847 { |
| 2848 DebugScopedSetImplThread thisScopeIsOnImplThread; |
| 2849 |
2820 scoped_ptr<LayerImpl> root = LayerImpl::create(12345); | 2850 scoped_ptr<LayerImpl> root = LayerImpl::create(12345); |
2821 | 2851 |
2822 WebTransformationMatrix identityMatrix; | 2852 WebTransformationMatrix identityMatrix; |
2823 WebTransformationMatrix rotation45DegreesAboutCenter; | 2853 WebTransformationMatrix rotation45DegreesAboutCenter; |
2824 rotation45DegreesAboutCenter.translate(50, 50); | 2854 rotation45DegreesAboutCenter.translate(50, 50); |
2825 rotation45DegreesAboutCenter.rotate3d(0, 0, 45); | 2855 rotation45DegreesAboutCenter.rotate3d(0, 0, 45); |
2826 rotation45DegreesAboutCenter.translate(-50, -50); | 2856 rotation45DegreesAboutCenter.translate(-50, -50); |
2827 gfx::PointF anchor(0, 0); | 2857 gfx::PointF anchor(0, 0); |
2828 gfx::PointF position(0, 0); | 2858 gfx::PointF position(0, 0); |
2829 gfx::Size bounds(100, 100); | 2859 gfx::Size bounds(100, 100); |
(...skipping 29 matching lines...) Expand all Loading... |
2859 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); | 2889 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); |
2860 ASSERT_FALSE(resultLayer); | 2890 ASSERT_FALSE(resultLayer); |
2861 | 2891 |
2862 testPoint = gfx::Point(-1, 50); | 2892 testPoint = gfx::Point(-1, 50); |
2863 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); | 2893 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); |
2864 ASSERT_FALSE(resultLayer); | 2894 ASSERT_FALSE(resultLayer); |
2865 } | 2895 } |
2866 | 2896 |
2867 TEST(LayerTreeHostCommonTest, verifyHitTestingForSinglePerspectiveLayer) | 2897 TEST(LayerTreeHostCommonTest, verifyHitTestingForSinglePerspectiveLayer) |
2868 { | 2898 { |
| 2899 DebugScopedSetImplThread thisScopeIsOnImplThread; |
| 2900 |
2869 scoped_ptr<LayerImpl> root = LayerImpl::create(12345); | 2901 scoped_ptr<LayerImpl> root = LayerImpl::create(12345); |
2870 | 2902 |
2871 WebTransformationMatrix identityMatrix; | 2903 WebTransformationMatrix identityMatrix; |
2872 | 2904 |
2873 // perspectiveProjectionAboutCenter * translationByZ is designed so that the
100 x 100 layer becomes 50 x 50, and remains centered at (50, 50). | 2905 // perspectiveProjectionAboutCenter * translationByZ is designed so that the
100 x 100 layer becomes 50 x 50, and remains centered at (50, 50). |
2874 WebTransformationMatrix perspectiveProjectionAboutCenter; | 2906 WebTransformationMatrix perspectiveProjectionAboutCenter; |
2875 perspectiveProjectionAboutCenter.translate(50, 50); | 2907 perspectiveProjectionAboutCenter.translate(50, 50); |
2876 perspectiveProjectionAboutCenter.applyPerspective(1); | 2908 perspectiveProjectionAboutCenter.applyPerspective(1); |
2877 perspectiveProjectionAboutCenter.translate(-50, -50); | 2909 perspectiveProjectionAboutCenter.translate(-50, -50); |
2878 WebTransformationMatrix translationByZ; | 2910 WebTransformationMatrix translationByZ; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2919 // A layer's visibleContentRect is actually in the layer's content space. Th
e | 2951 // A layer's visibleContentRect is actually in the layer's content space. Th
e |
2920 // screenSpaceTransform converts from the layer's origin space to screen spa
ce. This | 2952 // screenSpaceTransform converts from the layer's origin space to screen spa
ce. This |
2921 // test makes sure that hit testing works correctly accounts for the content
s scale. | 2953 // test makes sure that hit testing works correctly accounts for the content
s scale. |
2922 // A contentsScale that is not 1 effectively forces a non-identity transform
between | 2954 // A contentsScale that is not 1 effectively forces a non-identity transform
between |
2923 // layer's content space and layer's origin space. The hit testing code must
take this into account. | 2955 // layer's content space and layer's origin space. The hit testing code must
take this into account. |
2924 // | 2956 // |
2925 // To test this, the layer is positioned at (25, 25), and is size (50, 50).
If | 2957 // To test this, the layer is positioned at (25, 25), and is size (50, 50).
If |
2926 // contentsScale is ignored, then hit testing will mis-interpret the visible
ContentRect | 2958 // contentsScale is ignored, then hit testing will mis-interpret the visible
ContentRect |
2927 // as being larger than the actual bounds of the layer. | 2959 // as being larger than the actual bounds of the layer. |
2928 // | 2960 // |
| 2961 DebugScopedSetImplThread thisScopeIsOnImplThread; |
| 2962 |
2929 scoped_ptr<LayerImpl> root = LayerImpl::create(1); | 2963 scoped_ptr<LayerImpl> root = LayerImpl::create(1); |
2930 | 2964 |
2931 WebTransformationMatrix identityMatrix; | 2965 WebTransformationMatrix identityMatrix; |
2932 gfx::PointF anchor(0, 0); | 2966 gfx::PointF anchor(0, 0); |
2933 | 2967 |
2934 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, gfx::PointF(0, 0), gfx::Size(100, 100), false); | 2968 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, gfx::PointF(0, 0), gfx::Size(100, 100), false); |
2935 | 2969 |
2936 { | 2970 { |
2937 gfx::PointF position(25, 25); | 2971 gfx::PointF position(25, 25); |
2938 gfx::Size bounds(50, 50); | 2972 gfx::Size bounds(50, 50); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2980 testPoint = gfx::Point(74, 74); | 3014 testPoint = gfx::Point(74, 74); |
2981 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); | 3015 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); |
2982 ASSERT_TRUE(resultLayer); | 3016 ASSERT_TRUE(resultLayer); |
2983 EXPECT_EQ(12345, resultLayer->id()); | 3017 EXPECT_EQ(12345, resultLayer->id()); |
2984 } | 3018 } |
2985 | 3019 |
2986 TEST(LayerTreeHostCommonTest, verifyHitTestingForSimpleClippedLayer) | 3020 TEST(LayerTreeHostCommonTest, verifyHitTestingForSimpleClippedLayer) |
2987 { | 3021 { |
2988 // Test that hit-testing will only work for the visible portion of a layer,
and not | 3022 // Test that hit-testing will only work for the visible portion of a layer,
and not |
2989 // the entire layer bounds. Here we just test the simple axis-aligned case. | 3023 // the entire layer bounds. Here we just test the simple axis-aligned case. |
| 3024 DebugScopedSetImplThread thisScopeIsOnImplThread; |
| 3025 |
2990 WebTransformationMatrix identityMatrix; | 3026 WebTransformationMatrix identityMatrix; |
2991 gfx::PointF anchor(0, 0); | 3027 gfx::PointF anchor(0, 0); |
2992 | 3028 |
2993 scoped_ptr<LayerImpl> root = LayerImpl::create(1); | 3029 scoped_ptr<LayerImpl> root = LayerImpl::create(1); |
2994 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, gfx::PointF(0, 0), gfx::Size(100, 100), false); | 3030 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, gfx::PointF(0, 0), gfx::Size(100, 100), false); |
2995 | 3031 |
2996 { | 3032 { |
2997 scoped_ptr<LayerImpl> clippingLayer = LayerImpl::create(123); | 3033 scoped_ptr<LayerImpl> clippingLayer = LayerImpl::create(123); |
2998 gfx::PointF position(25, 25); // this layer is positioned, and hit testi
ng should correctly know where the layer is located. | 3034 gfx::PointF position(25, 25); // this layer is positioned, and hit testi
ng should correctly know where the layer is located. |
2999 gfx::Size bounds(50, 50); | 3035 gfx::Size bounds(50, 50); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3046 // This test checks whether hit testing correctly avoids hit testing with mu
ltiple | 3082 // This test checks whether hit testing correctly avoids hit testing with mu
ltiple |
3047 // ancestors that clip in non axis-aligned ways. To pass this test, the hit
testing | 3083 // ancestors that clip in non axis-aligned ways. To pass this test, the hit
testing |
3048 // algorithm needs to recognize that multiple parent layers may clip the lay
er, and | 3084 // algorithm needs to recognize that multiple parent layers may clip the lay
er, and |
3049 // should not actually hit those clipped areas. | 3085 // should not actually hit those clipped areas. |
3050 // | 3086 // |
3051 // The child and grandChild layers are both initialized to clip the rotatedL
eaf. The | 3087 // The child and grandChild layers are both initialized to clip the rotatedL
eaf. The |
3052 // child layer is rotated about the top-left corner, so that the root + chil
d clips | 3088 // child layer is rotated about the top-left corner, so that the root + chil
d clips |
3053 // combined create a triangle. The rotatedLeaf will only be visible where it
overlaps | 3089 // combined create a triangle. The rotatedLeaf will only be visible where it
overlaps |
3054 // this triangle. | 3090 // this triangle. |
3055 // | 3091 // |
| 3092 DebugScopedSetImplThread thisScopeIsOnImplThread; |
| 3093 |
3056 scoped_ptr<LayerImpl> root = LayerImpl::create(123); | 3094 scoped_ptr<LayerImpl> root = LayerImpl::create(123); |
3057 | 3095 |
3058 WebTransformationMatrix identityMatrix; | 3096 WebTransformationMatrix identityMatrix; |
3059 gfx::PointF anchor(0, 0); | 3097 gfx::PointF anchor(0, 0); |
3060 gfx::PointF position(0, 0); | 3098 gfx::PointF position(0, 0); |
3061 gfx::Size bounds(100, 100); | 3099 gfx::Size bounds(100, 100); |
3062 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); | 3100 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); |
3063 root->setMasksToBounds(true); | 3101 root->setMasksToBounds(true); |
3064 | 3102 |
3065 { | 3103 { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3144 testPoint = gfx::Point(49, 51); | 3182 testPoint = gfx::Point(49, 51); |
3145 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); | 3183 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); |
3146 ASSERT_TRUE(resultLayer); | 3184 ASSERT_TRUE(resultLayer); |
3147 EXPECT_EQ(2468, resultLayer->id()); | 3185 EXPECT_EQ(2468, resultLayer->id()); |
3148 } | 3186 } |
3149 | 3187 |
3150 TEST(LayerTreeHostCommonTest, verifyHitTestingForNonClippingIntermediateLayer) | 3188 TEST(LayerTreeHostCommonTest, verifyHitTestingForNonClippingIntermediateLayer) |
3151 { | 3189 { |
3152 // This test checks that hit testing code does not accidentally clip to laye
r | 3190 // This test checks that hit testing code does not accidentally clip to laye
r |
3153 // bounds for a layer that actually does not clip. | 3191 // bounds for a layer that actually does not clip. |
| 3192 DebugScopedSetImplThread thisScopeIsOnImplThread; |
| 3193 |
3154 WebTransformationMatrix identityMatrix; | 3194 WebTransformationMatrix identityMatrix; |
3155 gfx::PointF anchor(0, 0); | 3195 gfx::PointF anchor(0, 0); |
3156 | 3196 |
3157 scoped_ptr<LayerImpl> root = LayerImpl::create(1); | 3197 scoped_ptr<LayerImpl> root = LayerImpl::create(1); |
3158 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, gfx::PointF(0, 0), gfx::Size(100, 100), false); | 3198 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, gfx::PointF(0, 0), gfx::Size(100, 100), false); |
3159 | 3199 |
3160 { | 3200 { |
3161 scoped_ptr<LayerImpl> intermediateLayer = LayerImpl::create(123); | 3201 scoped_ptr<LayerImpl> intermediateLayer = LayerImpl::create(123); |
3162 gfx::PointF position(10, 10); // this layer is positioned, and hit testi
ng should correctly know where the layer is located. | 3202 gfx::PointF position(10, 10); // this layer is positioned, and hit testi
ng should correctly know where the layer is located. |
3163 gfx::Size bounds(50, 50); | 3203 gfx::Size bounds(50, 50); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3203 | 3243 |
3204 testPoint = gfx::Point(89, 89); | 3244 testPoint = gfx::Point(89, 89); |
3205 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); | 3245 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend
erSurfaceLayerList); |
3206 ASSERT_TRUE(resultLayer); | 3246 ASSERT_TRUE(resultLayer); |
3207 EXPECT_EQ(456, resultLayer->id()); | 3247 EXPECT_EQ(456, resultLayer->id()); |
3208 } | 3248 } |
3209 | 3249 |
3210 | 3250 |
3211 TEST(LayerTreeHostCommonTest, verifyHitTestingForMultipleLayers) | 3251 TEST(LayerTreeHostCommonTest, verifyHitTestingForMultipleLayers) |
3212 { | 3252 { |
| 3253 DebugScopedSetImplThread thisScopeIsOnImplThread; |
| 3254 |
3213 scoped_ptr<LayerImpl> root = LayerImpl::create(1); | 3255 scoped_ptr<LayerImpl> root = LayerImpl::create(1); |
3214 | 3256 |
3215 WebTransformationMatrix identityMatrix; | 3257 WebTransformationMatrix identityMatrix; |
3216 gfx::PointF anchor(0, 0); | 3258 gfx::PointF anchor(0, 0); |
3217 gfx::PointF position(0, 0); | 3259 gfx::PointF position(0, 0); |
3218 gfx::Size bounds(100, 100); | 3260 gfx::Size bounds(100, 100); |
3219 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); | 3261 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); |
3220 root->setDrawsContent(true); | 3262 root->setDrawsContent(true); |
3221 | 3263 |
3222 { | 3264 { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3306 ASSERT_TRUE(resultLayer); | 3348 ASSERT_TRUE(resultLayer); |
3307 EXPECT_EQ(4, resultLayer->id()); | 3349 EXPECT_EQ(4, resultLayer->id()); |
3308 } | 3350 } |
3309 | 3351 |
3310 TEST(LayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists) | 3352 TEST(LayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists) |
3311 { | 3353 { |
3312 // | 3354 // |
3313 // The geometry is set up similarly to the previous case, but | 3355 // The geometry is set up similarly to the previous case, but |
3314 // all layers are forced to be renderSurfaces now. | 3356 // all layers are forced to be renderSurfaces now. |
3315 // | 3357 // |
| 3358 DebugScopedSetImplThread thisScopeIsOnImplThread; |
| 3359 |
3316 scoped_ptr<LayerImpl> root = LayerImpl::create(1); | 3360 scoped_ptr<LayerImpl> root = LayerImpl::create(1); |
3317 | 3361 |
3318 WebTransformationMatrix identityMatrix; | 3362 WebTransformationMatrix identityMatrix; |
3319 gfx::PointF anchor(0, 0); | 3363 gfx::PointF anchor(0, 0); |
3320 gfx::PointF position(0, 0); | 3364 gfx::PointF position(0, 0); |
3321 gfx::Size bounds(100, 100); | 3365 gfx::Size bounds(100, 100); |
3322 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); | 3366 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc
hor, position, bounds, false); |
3323 root->setDrawsContent(true); | 3367 root->setDrawsContent(true); |
3324 | 3368 |
3325 { | 3369 { |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3995 int nonexistentId = -1; | 4039 int nonexistentId = -1; |
3996 EXPECT_EQ(root, LayerTreeHostCommon::findLayerInSubtree(root.get(), root->id
())); | 4040 EXPECT_EQ(root, LayerTreeHostCommon::findLayerInSubtree(root.get(), root->id
())); |
3997 EXPECT_EQ(child, LayerTreeHostCommon::findLayerInSubtree(root.get(), child->
id())); | 4041 EXPECT_EQ(child, LayerTreeHostCommon::findLayerInSubtree(root.get(), child->
id())); |
3998 EXPECT_EQ(grandChild, LayerTreeHostCommon::findLayerInSubtree(root.get(), gr
andChild->id())); | 4042 EXPECT_EQ(grandChild, LayerTreeHostCommon::findLayerInSubtree(root.get(), gr
andChild->id())); |
3999 EXPECT_EQ(maskLayer, LayerTreeHostCommon::findLayerInSubtree(root.get(), mas
kLayer->id())); | 4043 EXPECT_EQ(maskLayer, LayerTreeHostCommon::findLayerInSubtree(root.get(), mas
kLayer->id())); |
4000 EXPECT_EQ(replicaLayer, LayerTreeHostCommon::findLayerInSubtree(root.get(),
replicaLayer->id())); | 4044 EXPECT_EQ(replicaLayer, LayerTreeHostCommon::findLayerInSubtree(root.get(),
replicaLayer->id())); |
4001 EXPECT_EQ(0, LayerTreeHostCommon::findLayerInSubtree(root.get(), nonexistent
Id)); | 4045 EXPECT_EQ(0, LayerTreeHostCommon::findLayerInSubtree(root.get(), nonexistent
Id)); |
4002 } | 4046 } |
4003 | 4047 |
4004 } // namespace | 4048 } // namespace |
OLD | NEW |