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

Side by Side Diff: cc/layer_tree_host_common_unittest.cc

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

Powered by Google App Engine
This is Rietveld 408576698