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

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: Address code review comments and fix all cc_unittests 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
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 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); 727 LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList);
728 EXPECT_TRUE(parent->renderSurface()); 728 EXPECT_TRUE(parent->renderSurface());
729 EXPECT_FALSE(renderSurface1->renderSurface()); 729 EXPECT_FALSE(renderSurface1->renderSurface());
730 EXPECT_EQ(1U, renderSurfaceLayerList.size()); 730 EXPECT_EQ(1U, renderSurfaceLayerList.size());
731 } 731 }
732 732
733 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithD irectContainer) 733 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithD irectContainer)
734 { 734 {
735 // This test checks for correct scroll compensation when the fixed-position container 735 // This test checks for correct scroll compensation when the fixed-position container
736 // is the direct parent of the fixed-position layer. 736 // is the direct parent of the fixed-position layer.
737
738 DebugScopedSetImplThread scopedImplThread;
739 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); 737 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests();
740 LayerImpl* child = root->children()[0]; 738 LayerImpl* child = root->children()[0];
741 LayerImpl* grandChild = child->children()[0]; 739 LayerImpl* grandChild = child->children()[0];
742 740
743 child->setIsContainerForFixedPositionLayers(true); 741 child->setIsContainerForFixedPositionLayers(true);
744 grandChild->setFixedToContainerLayer(true); 742 grandChild->setFixedToContainerLayer(true);
745 743
746 // Case 1: scrollDelta of 0, 0 744 // Case 1: scrollDelta of 0, 0
747 child->setScrollDelta(IntSize(0, 0)); 745 child->setScrollDelta(IntSize(0, 0));
748 executeCalculateDrawTransformsAndVisibility(root.get()); 746 executeCalculateDrawTransformsAndVisibility(root.get());
(...skipping 19 matching lines...) Expand all
768 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithT ransformedDirectContainer) 766 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithT ransformedDirectContainer)
769 { 767 {
770 // This test checks for correct scroll compensation when the fixed-position container 768 // This test checks for correct scroll compensation when the fixed-position container
771 // is the direct parent of the fixed-position layer, but that container is t ransformed. 769 // is the direct parent of the fixed-position layer, but that container is t ransformed.
772 // In this case, the fixed position element inherits the container's transfo rm, 770 // In this case, the fixed position element inherits the container's transfo rm,
773 // but the scrollDelta that has to be undone should not be affected by that transform. 771 // but the scrollDelta that has to be undone should not be affected by that transform.
774 // 772 //
775 // Transforms are in general non-commutative; using something like a non-uni form scale 773 // Transforms are in general non-commutative; using something like a non-uni form scale
776 // helps to verify that translations and non-uniform scales are applied in t he correct 774 // helps to verify that translations and non-uniform scales are applied in t he correct
777 // order. 775 // order.
778
779 DebugScopedSetImplThread scopedImplThread;
780 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); 776 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests();
781 LayerImpl* child = root->children()[0]; 777 LayerImpl* child = root->children()[0];
782 LayerImpl* grandChild = child->children()[0]; 778 LayerImpl* grandChild = child->children()[0];
783 779
784 // This scale will cause child and grandChild to be effectively 200 x 800 wi th respect to the renderTarget. 780 // This scale will cause child and grandChild to be effectively 200 x 800 wi th respect to the renderTarget.
785 WebTransformationMatrix nonUniformScale; 781 WebTransformationMatrix nonUniformScale;
786 nonUniformScale.scaleNonUniform(2, 8); 782 nonUniformScale.scaleNonUniform(2, 8);
787 child->setTransform(nonUniformScale); 783 child->setTransform(nonUniformScale);
788 784
789 child->setIsContainerForFixedPositionLayers(true); 785 child->setIsContainerForFixedPositionLayers(true);
(...skipping 21 matching lines...) Expand all
811 expectedChildTransform.multiply(nonUniformScale); 807 expectedChildTransform.multiply(nonUniformScale);
812 808
813 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform ()); 809 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform ());
814 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra wTransform()); 810 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra wTransform());
815 } 811 }
816 812
817 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithD istantContainer) 813 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithD istantContainer)
818 { 814 {
819 // This test checks for correct scroll compensation when the fixed-position container 815 // This test checks for correct scroll compensation when the fixed-position container
820 // is NOT the direct parent of the fixed-position layer. 816 // is NOT the direct parent of the fixed-position layer.
821 DebugScopedSetImplThread scopedImplThread;
822
823 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); 817 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests();
824 LayerImpl* child = root->children()[0]; 818 LayerImpl* child = root->children()[0];
825 LayerImpl* grandChild = child->children()[0]; 819 LayerImpl* grandChild = child->children()[0];
826 LayerImpl* greatGrandChild = grandChild->children()[0]; 820 LayerImpl* greatGrandChild = grandChild->children()[0];
827 821
828 child->setIsContainerForFixedPositionLayers(true); 822 child->setIsContainerForFixedPositionLayers(true);
829 grandChild->setPosition(FloatPoint(8, 6)); 823 grandChild->setPosition(FloatPoint(8, 6));
830 greatGrandChild->setFixedToContainerLayer(true); 824 greatGrandChild->setFixedToContainerLayer(true);
831 825
832 // Case 1: scrollDelta of 0, 0 826 // Case 1: scrollDelta of 0, 0
(...skipping 22 matching lines...) Expand all
855 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform ()); 849 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform ());
856 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra wTransform()); 850 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra wTransform());
857 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand Child->drawTransform()); 851 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand Child->drawTransform());
858 } 852 }
859 853
860 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithD istantContainerAndTransforms) 854 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithD istantContainerAndTransforms)
861 { 855 {
862 // This test checks for correct scroll compensation when the fixed-position container 856 // This test checks for correct scroll compensation when the fixed-position container
863 // is NOT the direct parent of the fixed-position layer, and the hierarchy h as various 857 // is NOT the direct parent of the fixed-position layer, and the hierarchy h as various
864 // transforms that have to be processed in the correct order. 858 // transforms that have to be processed in the correct order.
865 DebugScopedSetImplThread scopedImplThread;
866
867 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); 859 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests();
868 LayerImpl* child = root->children()[0]; 860 LayerImpl* child = root->children()[0];
869 LayerImpl* grandChild = child->children()[0]; 861 LayerImpl* grandChild = child->children()[0];
870 LayerImpl* greatGrandChild = grandChild->children()[0]; 862 LayerImpl* greatGrandChild = grandChild->children()[0];
871 863
872 WebTransformationMatrix rotationAboutZ; 864 WebTransformationMatrix rotationAboutZ;
873 rotationAboutZ.rotate3d(0, 0, 90); 865 rotationAboutZ.rotate3d(0, 0, 90);
874 866
875 child->setIsContainerForFixedPositionLayers(true); 867 child->setIsContainerForFixedPositionLayers(true);
876 child->setTransform(rotationAboutZ); 868 child->setTransform(rotationAboutZ);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 } 909 }
918 910
919 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithM ultipleScrollDeltas) 911 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithM ultipleScrollDeltas)
920 { 912 {
921 // 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
922 // has multiple ancestors that have nonzero scrollDelta before reaching the space where the layer is fixed. 914 // has multiple ancestors that have nonzero scrollDelta before reaching the space where the layer is fixed.
923 // In this test, each scrollDelta occurs in a different space because of eac h layer's local transform. 915 // In this test, each scrollDelta occurs in a different space because of eac h layer's local transform.
924 // This test checks for correct scroll compensation when the fixed-position container 916 // This test checks for correct scroll compensation when the fixed-position container
925 // is NOT the direct parent of the fixed-position layer, and the hierarchy h as various 917 // is NOT the direct parent of the fixed-position layer, and the hierarchy h as various
926 // transforms that have to be processed in the correct order. 918 // transforms that have to be processed in the correct order.
927 DebugScopedSetImplThread scopedImplThread;
928
929 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); 919 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests();
930 LayerImpl* child = root->children()[0]; 920 LayerImpl* child = root->children()[0];
931 LayerImpl* grandChild = child->children()[0]; 921 LayerImpl* grandChild = child->children()[0];
932 LayerImpl* greatGrandChild = grandChild->children()[0]; 922 LayerImpl* greatGrandChild = grandChild->children()[0];
933 923
934 WebTransformationMatrix rotationAboutZ; 924 WebTransformationMatrix rotationAboutZ;
935 rotationAboutZ.rotate3d(0, 0, 90); 925 rotationAboutZ.rotate3d(0, 0, 90);
936 926
937 child->setIsContainerForFixedPositionLayers(true); 927 child->setIsContainerForFixedPositionLayers(true);
938 child->setTransform(rotationAboutZ); 928 child->setTransform(rotationAboutZ);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra wTransform()); 969 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra wTransform());
980 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand Child->drawTransform()); 970 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand Child->drawTransform());
981 } 971 }
982 972
983 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithI ntermediateSurfaceAndTransforms) 973 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithI ntermediateSurfaceAndTransforms)
984 { 974 {
985 // This test checks for correct scroll compensation when the fixed-position container 975 // This test checks for correct scroll compensation when the fixed-position container
986 // contributes to a different renderSurface than the fixed-position layer. I n this 976 // contributes to a different renderSurface than the fixed-position layer. I n this
987 // case, the surface drawTransforms also have to be accounted for when check ing the 977 // case, the surface drawTransforms also have to be accounted for when check ing the
988 // scrollDelta. 978 // scrollDelta.
989 DebugScopedSetImplThread scopedImplThread;
990
991 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); 979 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests();
992 LayerImpl* child = root->children()[0]; 980 LayerImpl* child = root->children()[0];
993 LayerImpl* grandChild = child->children()[0]; 981 LayerImpl* grandChild = child->children()[0];
994 LayerImpl* greatGrandChild = grandChild->children()[0]; 982 LayerImpl* greatGrandChild = grandChild->children()[0];
995 983
996 child->setIsContainerForFixedPositionLayers(true); 984 child->setIsContainerForFixedPositionLayers(true);
997 grandChild->setPosition(FloatPoint(8, 6)); 985 grandChild->setPosition(FloatPoint(8, 6));
998 grandChild->setForceRenderSurface(true); 986 grandChild->setForceRenderSurface(true);
999 greatGrandChild->setFixedToContainerLayer(true); 987 greatGrandChild->setFixedToContainerLayer(true);
1000 greatGrandChild->setDrawsContent(true); 988 greatGrandChild->setDrawsContent(true);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1052 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra wTransform()); 1040 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra wTransform());
1053 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand Child->drawTransform()); 1041 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand Child->drawTransform());
1054 } 1042 }
1055 1043
1056 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithM ultipleIntermediateSurfaces) 1044 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithM ultipleIntermediateSurfaces)
1057 { 1045 {
1058 // This test checks for correct scroll compensation when the fixed-position container 1046 // This test checks for correct scroll compensation when the fixed-position container
1059 // contributes to a different renderSurface than the fixed-position layer, w ith 1047 // contributes to a different renderSurface than the fixed-position layer, w ith
1060 // additional renderSurfaces in-between. This checks that the conversion to ancestor 1048 // additional renderSurfaces in-between. This checks that the conversion to ancestor
1061 // surfaces is accumulated properly in the final matrix transform. 1049 // surfaces is accumulated properly in the final matrix transform.
1062 DebugScopedSetImplThread scopedImplThread;
1063
1064 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); 1050 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests();
1065 LayerImpl* child = root->children()[0]; 1051 LayerImpl* child = root->children()[0];
1066 LayerImpl* grandChild = child->children()[0]; 1052 LayerImpl* grandChild = child->children()[0];
1067 LayerImpl* greatGrandChild = grandChild->children()[0]; 1053 LayerImpl* greatGrandChild = grandChild->children()[0];
1068 1054
1069 // Add one more layer to the test tree for this scenario. 1055 // Add one more layer to the test tree for this scenario.
1070 { 1056 {
1071 WebTransformationMatrix identity; 1057 WebTransformationMatrix identity;
1072 scoped_ptr<LayerImpl> fixedPositionChild = LayerImpl::create(5); 1058 scoped_ptr<LayerImpl> fixedPositionChild = LayerImpl::create(5);
1073 setLayerPropertiesForTesting(fixedPositionChild.get(), identity, identit y, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); 1059 setLayerPropertiesForTesting(fixedPositionChild.get(), identity, identit y, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand Child->drawTransform()); 1149 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand Child->drawTransform());
1164 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedFixedPositionChildTransform, fixedPo sitionChild->drawTransform()); 1150 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedFixedPositionChildTransform, fixedPo sitionChild->drawTransform());
1165 } 1151 }
1166 1152
1167 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithC ontainerLayerThatHasSurface) 1153 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithC ontainerLayerThatHasSurface)
1168 { 1154 {
1169 // This test checks for correct scroll compensation when the fixed-position container 1155 // This test checks for correct scroll compensation when the fixed-position container
1170 // itself has a renderSurface. In this case, the container layer should be t reated 1156 // itself has a renderSurface. In this case, the container layer should be t reated
1171 // like a layer that contributes to a renderTarget, and that renderTarget 1157 // like a layer that contributes to a renderTarget, and that renderTarget
1172 // is completely irrelevant; it should not affect the scroll compensation. 1158 // is completely irrelevant; it should not affect the scroll compensation.
1173 DebugScopedSetImplThread scopedImplThread;
1174
1175 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); 1159 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests();
1176 LayerImpl* child = root->children()[0]; 1160 LayerImpl* child = root->children()[0];
1177 LayerImpl* grandChild = child->children()[0]; 1161 LayerImpl* grandChild = child->children()[0];
1178 1162
1179 child->setIsContainerForFixedPositionLayers(true); 1163 child->setIsContainerForFixedPositionLayers(true);
1180 child->setForceRenderSurface(true); 1164 child->setForceRenderSurface(true);
1181 grandChild->setFixedToContainerLayer(true); 1165 grandChild->setFixedToContainerLayer(true);
1182 grandChild->setDrawsContent(true); 1166 grandChild->setDrawsContent(true);
1183 1167
1184 // Case 1: scrollDelta of 0, 0 1168 // Case 1: scrollDelta of 0, 0
(...skipping 25 matching lines...) Expand all
1210 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceDrawTransform, child->renderS urface()->drawTransform()); 1194 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceDrawTransform, child->renderS urface()->drawTransform());
1211 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform ()); 1195 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform ());
1212 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra wTransform()); 1196 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra wTransform());
1213 } 1197 }
1214 1198
1215 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerThatI sAlsoFixedPositionContainer) 1199 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerThatI sAlsoFixedPositionContainer)
1216 { 1200 {
1217 // This test checks the scenario where a fixed-position layer also happens t o be a 1201 // This test checks the scenario where a fixed-position layer also happens t o be a
1218 // container itself for a descendant fixed position layer. In particular, th e layer 1202 // container itself for a descendant fixed position layer. In particular, th e layer
1219 // should not accidentally be fixed to itself. 1203 // should not accidentally be fixed to itself.
1220 DebugScopedSetImplThread scopedImplThread;
1221
1222 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); 1204 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests();
1223 LayerImpl* child = root->children()[0]; 1205 LayerImpl* child = root->children()[0];
1224 LayerImpl* grandChild = child->children()[0]; 1206 LayerImpl* grandChild = child->children()[0];
1225 1207
1226 child->setIsContainerForFixedPositionLayers(true); 1208 child->setIsContainerForFixedPositionLayers(true);
1227 grandChild->setFixedToContainerLayer(true); 1209 grandChild->setFixedToContainerLayer(true);
1228 1210
1229 // This should not confuse the grandChild. If correct, the grandChild would still be considered fixed to its container (i.e. "child"). 1211 // This should not confuse the grandChild. If correct, the grandChild would still be considered fixed to its container (i.e. "child").
1230 grandChild->setIsContainerForFixedPositionLayers(true); 1212 grandChild->setIsContainerForFixedPositionLayers(true);
1231 1213
(...skipping 15 matching lines...) Expand all
1247 expectedChildTransform.translate(-10, -10); 1229 expectedChildTransform.translate(-10, -10);
1248 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform ()); 1230 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform ());
1249 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra wTransform()); 1231 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra wTransform());
1250 } 1232 }
1251 1233
1252 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerThatH asNoContainer) 1234 TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerThatH asNoContainer)
1253 { 1235 {
1254 // This test checks scroll compensation when a fixed-position layer does not find any 1236 // This test checks scroll compensation when a fixed-position layer does not find any
1255 // ancestor that is a "containerForFixedPositionLayers". In this situation, the layer should 1237 // ancestor that is a "containerForFixedPositionLayers". In this situation, the layer should
1256 // be fixed to the viewport -- not the rootLayer, which may have transforms of its own. 1238 // be fixed to the viewport -- not the rootLayer, which may have transforms of its own.
1257 DebugScopedSetImplThread scopedImplThread;
1258
1259 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests(); 1239 scoped_ptr<LayerImpl> root = createTreeForFixedPositionTests();
1260 LayerImpl* child = root->children()[0]; 1240 LayerImpl* child = root->children()[0];
1261 LayerImpl* grandChild = child->children()[0]; 1241 LayerImpl* grandChild = child->children()[0];
1262 1242
1263 WebTransformationMatrix rotationByZ; 1243 WebTransformationMatrix rotationByZ;
1264 rotationByZ.rotate3d(0, 0, 90); 1244 rotationByZ.rotate3d(0, 0, 90);
1265 1245
1266 root->setTransform(rotationByZ); 1246 root->setTransform(rotationByZ);
1267 grandChild->setFixedToContainerLayer(true); 1247 grandChild->setFixedToContainerLayer(true);
1268 1248
(...skipping 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after
2620 2600
2621 // Verify frontFacingSurface's layerList. 2601 // Verify frontFacingSurface's layerList.
2622 ASSERT_EQ(2u, renderSurfaceLayerList[1]->renderSurface()->layerList().size() ); 2602 ASSERT_EQ(2u, renderSurfaceLayerList[1]->renderSurface()->layerList().size() );
2623 EXPECT_EQ(frontFacingSurface->id(), renderSurfaceLayerList[1]->renderSurface ()->layerList()[0]->id()); 2603 EXPECT_EQ(frontFacingSurface->id(), renderSurfaceLayerList[1]->renderSurface ()->layerList()[0]->id());
2624 EXPECT_EQ(child1->id(), renderSurfaceLayerList[1]->renderSurface()->layerLis t()[1]->id()); 2604 EXPECT_EQ(child1->id(), renderSurfaceLayerList[1]->renderSurface()->layerLis t()[1]->id());
2625 } 2605 }
2626 2606
2627 TEST(LayerTreeHostCommonTest, verifyHitTestingForEmptyLayerList) 2607 TEST(LayerTreeHostCommonTest, verifyHitTestingForEmptyLayerList)
2628 { 2608 {
2629 // Hit testing on an empty renderSurfaceLayerList should return a null point er. 2609 // Hit testing on an empty renderSurfaceLayerList should return a null point er.
2630 DebugScopedSetImplThread thisScopeIsOnImplThread;
2631
2632 std::vector<LayerImpl*> renderSurfaceLayerList; 2610 std::vector<LayerImpl*> renderSurfaceLayerList;
2633 2611
2634 IntPoint testPoint(0, 0); 2612 IntPoint testPoint(0, 0);
2635 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test Point, renderSurfaceLayerList); 2613 LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(test Point, renderSurfaceLayerList);
2636 EXPECT_FALSE(resultLayer); 2614 EXPECT_FALSE(resultLayer);
2637 2615
2638 testPoint = IntPoint(10, 20); 2616 testPoint = IntPoint(10, 20);
2639 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend erSurfaceLayerList); 2617 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend erSurfaceLayerList);
2640 EXPECT_FALSE(resultLayer); 2618 EXPECT_FALSE(resultLayer);
2641 } 2619 }
2642 2620
2643 TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleLayer) 2621 TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleLayer)
2644 { 2622 {
2645 DebugScopedSetImplThread thisScopeIsOnImplThread;
2646
2647 scoped_ptr<LayerImpl> root = LayerImpl::create(12345); 2623 scoped_ptr<LayerImpl> root = LayerImpl::create(12345);
2648 2624
2649 WebTransformationMatrix identityMatrix; 2625 WebTransformationMatrix identityMatrix;
2650 FloatPoint anchor(0, 0); 2626 FloatPoint anchor(0, 0);
2651 FloatPoint position(0, 0); 2627 FloatPoint position(0, 0);
2652 IntSize bounds(100, 100); 2628 IntSize bounds(100, 100);
2653 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, position, bounds, false); 2629 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, position, bounds, false);
2654 root->setDrawsContent(true); 2630 root->setDrawsContent(true);
2655 2631
2656 std::vector<LayerImpl*> renderSurfaceLayerList; 2632 std::vector<LayerImpl*> renderSurfaceLayerList;
(...skipping 20 matching lines...) Expand all
2677 EXPECT_EQ(12345, resultLayer->id()); 2653 EXPECT_EQ(12345, resultLayer->id());
2678 2654
2679 testPoint = IntPoint(99, 99); 2655 testPoint = IntPoint(99, 99);
2680 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend erSurfaceLayerList); 2656 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend erSurfaceLayerList);
2681 ASSERT_TRUE(resultLayer); 2657 ASSERT_TRUE(resultLayer);
2682 EXPECT_EQ(12345, resultLayer->id()); 2658 EXPECT_EQ(12345, resultLayer->id());
2683 } 2659 }
2684 2660
2685 TEST(LayerTreeHostCommonTest, verifyHitTestingForUninvertibleTransform) 2661 TEST(LayerTreeHostCommonTest, verifyHitTestingForUninvertibleTransform)
2686 { 2662 {
2687 DebugScopedSetImplThread thisScopeIsOnImplThread;
2688
2689 scoped_ptr<LayerImpl> root = LayerImpl::create(12345); 2663 scoped_ptr<LayerImpl> root = LayerImpl::create(12345);
2690 2664
2691 WebTransformationMatrix uninvertibleTransform; 2665 WebTransformationMatrix uninvertibleTransform;
2692 uninvertibleTransform.setM11(0); 2666 uninvertibleTransform.setM11(0);
2693 uninvertibleTransform.setM22(0); 2667 uninvertibleTransform.setM22(0);
2694 uninvertibleTransform.setM33(0); 2668 uninvertibleTransform.setM33(0);
2695 uninvertibleTransform.setM44(0); 2669 uninvertibleTransform.setM44(0);
2696 ASSERT_FALSE(uninvertibleTransform.isInvertible()); 2670 ASSERT_FALSE(uninvertibleTransform.isInvertible());
2697 2671
2698 WebTransformationMatrix identityMatrix; 2672 WebTransformationMatrix identityMatrix;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
2738 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend erSurfaceLayerList); 2712 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend erSurfaceLayerList);
2739 EXPECT_FALSE(resultLayer); 2713 EXPECT_FALSE(resultLayer);
2740 2714
2741 testPoint = IntPoint(-1, -1); 2715 testPoint = IntPoint(-1, -1);
2742 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend erSurfaceLayerList); 2716 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend erSurfaceLayerList);
2743 EXPECT_FALSE(resultLayer); 2717 EXPECT_FALSE(resultLayer);
2744 } 2718 }
2745 2719
2746 TEST(LayerTreeHostCommonTest, verifyHitTestingForSinglePositionedLayer) 2720 TEST(LayerTreeHostCommonTest, verifyHitTestingForSinglePositionedLayer)
2747 { 2721 {
2748 DebugScopedSetImplThread thisScopeIsOnImplThread;
2749
2750 scoped_ptr<LayerImpl> root = LayerImpl::create(12345); 2722 scoped_ptr<LayerImpl> root = LayerImpl::create(12345);
2751 2723
2752 WebTransformationMatrix identityMatrix; 2724 WebTransformationMatrix identityMatrix;
2753 FloatPoint anchor(0, 0); 2725 FloatPoint anchor(0, 0);
2754 FloatPoint position(50, 50); // this layer is positioned, and hit testing sh ould correctly know where the layer is located. 2726 FloatPoint position(50, 50); // this layer is positioned, and hit testing sh ould correctly know where the layer is located.
2755 IntSize bounds(100, 100); 2727 IntSize bounds(100, 100);
2756 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, position, bounds, false); 2728 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, position, bounds, false);
2757 root->setDrawsContent(true); 2729 root->setDrawsContent(true);
2758 2730
2759 std::vector<LayerImpl*> renderSurfaceLayerList; 2731 std::vector<LayerImpl*> renderSurfaceLayerList;
(...skipping 21 matching lines...) Expand all
2781 EXPECT_EQ(12345, resultLayer->id()); 2753 EXPECT_EQ(12345, resultLayer->id());
2782 2754
2783 testPoint = IntPoint(99, 99); 2755 testPoint = IntPoint(99, 99);
2784 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend erSurfaceLayerList); 2756 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend erSurfaceLayerList);
2785 ASSERT_TRUE(resultLayer); 2757 ASSERT_TRUE(resultLayer);
2786 EXPECT_EQ(12345, resultLayer->id()); 2758 EXPECT_EQ(12345, resultLayer->id());
2787 } 2759 }
2788 2760
2789 TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleRotatedLayer) 2761 TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleRotatedLayer)
2790 { 2762 {
2791 DebugScopedSetImplThread thisScopeIsOnImplThread;
2792
2793 scoped_ptr<LayerImpl> root = LayerImpl::create(12345); 2763 scoped_ptr<LayerImpl> root = LayerImpl::create(12345);
2794 2764
2795 WebTransformationMatrix identityMatrix; 2765 WebTransformationMatrix identityMatrix;
2796 WebTransformationMatrix rotation45DegreesAboutCenter; 2766 WebTransformationMatrix rotation45DegreesAboutCenter;
2797 rotation45DegreesAboutCenter.translate(50, 50); 2767 rotation45DegreesAboutCenter.translate(50, 50);
2798 rotation45DegreesAboutCenter.rotate3d(0, 0, 45); 2768 rotation45DegreesAboutCenter.rotate3d(0, 0, 45);
2799 rotation45DegreesAboutCenter.translate(-50, -50); 2769 rotation45DegreesAboutCenter.translate(-50, -50);
2800 FloatPoint anchor(0, 0); 2770 FloatPoint anchor(0, 0);
2801 FloatPoint position(0, 0); 2771 FloatPoint position(0, 0);
2802 IntSize bounds(100, 100); 2772 IntSize bounds(100, 100);
(...skipping 29 matching lines...) Expand all
2832 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend erSurfaceLayerList); 2802 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend erSurfaceLayerList);
2833 ASSERT_FALSE(resultLayer); 2803 ASSERT_FALSE(resultLayer);
2834 2804
2835 testPoint = IntPoint(-1, 50); 2805 testPoint = IntPoint(-1, 50);
2836 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend erSurfaceLayerList); 2806 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend erSurfaceLayerList);
2837 ASSERT_FALSE(resultLayer); 2807 ASSERT_FALSE(resultLayer);
2838 } 2808 }
2839 2809
2840 TEST(LayerTreeHostCommonTest, verifyHitTestingForSinglePerspectiveLayer) 2810 TEST(LayerTreeHostCommonTest, verifyHitTestingForSinglePerspectiveLayer)
2841 { 2811 {
2842 DebugScopedSetImplThread thisScopeIsOnImplThread;
2843
2844 scoped_ptr<LayerImpl> root = LayerImpl::create(12345); 2812 scoped_ptr<LayerImpl> root = LayerImpl::create(12345);
2845 2813
2846 WebTransformationMatrix identityMatrix; 2814 WebTransformationMatrix identityMatrix;
2847 2815
2848 // perspectiveProjectionAboutCenter * translationByZ is designed so that the 100 x 100 layer becomes 50 x 50, and remains centered at (50, 50). 2816 // perspectiveProjectionAboutCenter * translationByZ is designed so that the 100 x 100 layer becomes 50 x 50, and remains centered at (50, 50).
2849 WebTransformationMatrix perspectiveProjectionAboutCenter; 2817 WebTransformationMatrix perspectiveProjectionAboutCenter;
2850 perspectiveProjectionAboutCenter.translate(50, 50); 2818 perspectiveProjectionAboutCenter.translate(50, 50);
2851 perspectiveProjectionAboutCenter.applyPerspective(1); 2819 perspectiveProjectionAboutCenter.applyPerspective(1);
2852 perspectiveProjectionAboutCenter.translate(-50, -50); 2820 perspectiveProjectionAboutCenter.translate(-50, -50);
2853 WebTransformationMatrix translationByZ; 2821 WebTransformationMatrix translationByZ;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2894 // A layer's visibleContentRect is actually in the layer's content space. Th e 2862 // A layer's visibleContentRect is actually in the layer's content space. Th e
2895 // screenSpaceTransform converts from the layer's origin space to screen spa ce. This 2863 // screenSpaceTransform converts from the layer's origin space to screen spa ce. This
2896 // test makes sure that hit testing works correctly accounts for the content s scale. 2864 // test makes sure that hit testing works correctly accounts for the content s scale.
2897 // A contentsScale that is not 1 effectively forces a non-identity transform between 2865 // A contentsScale that is not 1 effectively forces a non-identity transform between
2898 // layer's content space and layer's origin space. The hit testing code must take this into account. 2866 // layer's content space and layer's origin space. The hit testing code must take this into account.
2899 // 2867 //
2900 // To test this, the layer is positioned at (25, 25), and is size (50, 50). If 2868 // To test this, the layer is positioned at (25, 25), and is size (50, 50). If
2901 // contentsScale is ignored, then hit testing will mis-interpret the visible ContentRect 2869 // contentsScale is ignored, then hit testing will mis-interpret the visible ContentRect
2902 // as being larger than the actual bounds of the layer. 2870 // as being larger than the actual bounds of the layer.
2903 // 2871 //
2904 DebugScopedSetImplThread thisScopeIsOnImplThread;
2905
2906 scoped_ptr<LayerImpl> root = LayerImpl::create(1); 2872 scoped_ptr<LayerImpl> root = LayerImpl::create(1);
2907 2873
2908 WebTransformationMatrix identityMatrix; 2874 WebTransformationMatrix identityMatrix;
2909 FloatPoint anchor(0, 0); 2875 FloatPoint anchor(0, 0);
2910 2876
2911 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, FloatPoint(0, 0), IntSize(100, 100), false); 2877 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, FloatPoint(0, 0), IntSize(100, 100), false);
2912 2878
2913 { 2879 {
2914 FloatPoint position(25, 25); 2880 FloatPoint position(25, 25);
2915 IntSize bounds(50, 50); 2881 IntSize bounds(50, 50);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2956 testPoint = IntPoint(74, 74); 2922 testPoint = IntPoint(74, 74);
2957 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend erSurfaceLayerList); 2923 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend erSurfaceLayerList);
2958 ASSERT_TRUE(resultLayer); 2924 ASSERT_TRUE(resultLayer);
2959 EXPECT_EQ(12345, resultLayer->id()); 2925 EXPECT_EQ(12345, resultLayer->id());
2960 } 2926 }
2961 2927
2962 TEST(LayerTreeHostCommonTest, verifyHitTestingForSimpleClippedLayer) 2928 TEST(LayerTreeHostCommonTest, verifyHitTestingForSimpleClippedLayer)
2963 { 2929 {
2964 // Test that hit-testing will only work for the visible portion of a layer, and not 2930 // Test that hit-testing will only work for the visible portion of a layer, and not
2965 // the entire layer bounds. Here we just test the simple axis-aligned case. 2931 // the entire layer bounds. Here we just test the simple axis-aligned case.
2966 DebugScopedSetImplThread thisScopeIsOnImplThread;
2967
2968 WebTransformationMatrix identityMatrix; 2932 WebTransformationMatrix identityMatrix;
2969 FloatPoint anchor(0, 0); 2933 FloatPoint anchor(0, 0);
2970 2934
2971 scoped_ptr<LayerImpl> root = LayerImpl::create(1); 2935 scoped_ptr<LayerImpl> root = LayerImpl::create(1);
2972 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, FloatPoint(0, 0), IntSize(100, 100), false); 2936 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, FloatPoint(0, 0), IntSize(100, 100), false);
2973 2937
2974 { 2938 {
2975 scoped_ptr<LayerImpl> clippingLayer = LayerImpl::create(123); 2939 scoped_ptr<LayerImpl> clippingLayer = LayerImpl::create(123);
2976 FloatPoint position(25, 25); // this layer is positioned, and hit testin g should correctly know where the layer is located. 2940 FloatPoint position(25, 25); // this layer is positioned, and hit testin g should correctly know where the layer is located.
2977 IntSize bounds(50, 50); 2941 IntSize bounds(50, 50);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
3024 // This test checks whether hit testing correctly avoids hit testing with mu ltiple 2988 // This test checks whether hit testing correctly avoids hit testing with mu ltiple
3025 // ancestors that clip in non axis-aligned ways. To pass this test, the hit testing 2989 // ancestors that clip in non axis-aligned ways. To pass this test, the hit testing
3026 // algorithm needs to recognize that multiple parent layers may clip the lay er, and 2990 // algorithm needs to recognize that multiple parent layers may clip the lay er, and
3027 // should not actually hit those clipped areas. 2991 // should not actually hit those clipped areas.
3028 // 2992 //
3029 // The child and grandChild layers are both initialized to clip the rotatedL eaf. The 2993 // The child and grandChild layers are both initialized to clip the rotatedL eaf. The
3030 // child layer is rotated about the top-left corner, so that the root + chil d clips 2994 // child layer is rotated about the top-left corner, so that the root + chil d clips
3031 // combined create a triangle. The rotatedLeaf will only be visible where it overlaps 2995 // combined create a triangle. The rotatedLeaf will only be visible where it overlaps
3032 // this triangle. 2996 // this triangle.
3033 // 2997 //
3034 DebugScopedSetImplThread thisScopeIsOnImplThread;
3035
3036 scoped_ptr<LayerImpl> root = LayerImpl::create(123); 2998 scoped_ptr<LayerImpl> root = LayerImpl::create(123);
3037 2999
3038 WebTransformationMatrix identityMatrix; 3000 WebTransformationMatrix identityMatrix;
3039 FloatPoint anchor(0, 0); 3001 FloatPoint anchor(0, 0);
3040 FloatPoint position(0, 0); 3002 FloatPoint position(0, 0);
3041 IntSize bounds(100, 100); 3003 IntSize bounds(100, 100);
3042 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, position, bounds, false); 3004 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, position, bounds, false);
3043 root->setMasksToBounds(true); 3005 root->setMasksToBounds(true);
3044 3006
3045 { 3007 {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
3124 testPoint = IntPoint(49, 51); 3086 testPoint = IntPoint(49, 51);
3125 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend erSurfaceLayerList); 3087 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend erSurfaceLayerList);
3126 ASSERT_TRUE(resultLayer); 3088 ASSERT_TRUE(resultLayer);
3127 EXPECT_EQ(2468, resultLayer->id()); 3089 EXPECT_EQ(2468, resultLayer->id());
3128 } 3090 }
3129 3091
3130 TEST(LayerTreeHostCommonTest, verifyHitTestingForNonClippingIntermediateLayer) 3092 TEST(LayerTreeHostCommonTest, verifyHitTestingForNonClippingIntermediateLayer)
3131 { 3093 {
3132 // This test checks that hit testing code does not accidentally clip to laye r 3094 // This test checks that hit testing code does not accidentally clip to laye r
3133 // bounds for a layer that actually does not clip. 3095 // bounds for a layer that actually does not clip.
3134 DebugScopedSetImplThread thisScopeIsOnImplThread;
3135
3136 WebTransformationMatrix identityMatrix; 3096 WebTransformationMatrix identityMatrix;
3137 FloatPoint anchor(0, 0); 3097 FloatPoint anchor(0, 0);
3138 3098
3139 scoped_ptr<LayerImpl> root = LayerImpl::create(1); 3099 scoped_ptr<LayerImpl> root = LayerImpl::create(1);
3140 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, FloatPoint(0, 0), IntSize(100, 100), false); 3100 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, FloatPoint(0, 0), IntSize(100, 100), false);
3141 3101
3142 { 3102 {
3143 scoped_ptr<LayerImpl> intermediateLayer = LayerImpl::create(123); 3103 scoped_ptr<LayerImpl> intermediateLayer = LayerImpl::create(123);
3144 FloatPoint position(10, 10); // this layer is positioned, and hit testin g should correctly know where the layer is located. 3104 FloatPoint position(10, 10); // this layer is positioned, and hit testin g should correctly know where the layer is located.
3145 IntSize bounds(50, 50); 3105 IntSize bounds(50, 50);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
3185 3145
3186 testPoint = IntPoint(89, 89); 3146 testPoint = IntPoint(89, 89);
3187 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend erSurfaceLayerList); 3147 resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, rend erSurfaceLayerList);
3188 ASSERT_TRUE(resultLayer); 3148 ASSERT_TRUE(resultLayer);
3189 EXPECT_EQ(456, resultLayer->id()); 3149 EXPECT_EQ(456, resultLayer->id());
3190 } 3150 }
3191 3151
3192 3152
3193 TEST(LayerTreeHostCommonTest, verifyHitTestingForMultipleLayers) 3153 TEST(LayerTreeHostCommonTest, verifyHitTestingForMultipleLayers)
3194 { 3154 {
3195 DebugScopedSetImplThread thisScopeIsOnImplThread;
3196
3197 scoped_ptr<LayerImpl> root = LayerImpl::create(1); 3155 scoped_ptr<LayerImpl> root = LayerImpl::create(1);
3198 3156
3199 WebTransformationMatrix identityMatrix; 3157 WebTransformationMatrix identityMatrix;
3200 FloatPoint anchor(0, 0); 3158 FloatPoint anchor(0, 0);
3201 FloatPoint position(0, 0); 3159 FloatPoint position(0, 0);
3202 IntSize bounds(100, 100); 3160 IntSize bounds(100, 100);
3203 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, position, bounds, false); 3161 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, position, bounds, false);
3204 root->setDrawsContent(true); 3162 root->setDrawsContent(true);
3205 3163
3206 { 3164 {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
3290 ASSERT_TRUE(resultLayer); 3248 ASSERT_TRUE(resultLayer);
3291 EXPECT_EQ(4, resultLayer->id()); 3249 EXPECT_EQ(4, resultLayer->id());
3292 } 3250 }
3293 3251
3294 TEST(LayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists) 3252 TEST(LayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists)
3295 { 3253 {
3296 // 3254 //
3297 // The geometry is set up similarly to the previous case, but 3255 // The geometry is set up similarly to the previous case, but
3298 // all layers are forced to be renderSurfaces now. 3256 // all layers are forced to be renderSurfaces now.
3299 // 3257 //
3300 DebugScopedSetImplThread thisScopeIsOnImplThread;
3301
3302 scoped_ptr<LayerImpl> root = LayerImpl::create(1); 3258 scoped_ptr<LayerImpl> root = LayerImpl::create(1);
3303 3259
3304 WebTransformationMatrix identityMatrix; 3260 WebTransformationMatrix identityMatrix;
3305 FloatPoint anchor(0, 0); 3261 FloatPoint anchor(0, 0);
3306 FloatPoint position(0, 0); 3262 FloatPoint position(0, 0);
3307 IntSize bounds(100, 100); 3263 IntSize bounds(100, 100);
3308 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, position, bounds, false); 3264 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, position, bounds, false);
3309 root->setDrawsContent(true); 3265 root->setDrawsContent(true);
3310 3266
3311 { 3267 {
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
3576 int nonexistentId = -1; 3532 int nonexistentId = -1;
3577 EXPECT_EQ(root, LayerTreeHostCommon::findLayerInSubtree(root.get(), root->id ())); 3533 EXPECT_EQ(root, LayerTreeHostCommon::findLayerInSubtree(root.get(), root->id ()));
3578 EXPECT_EQ(child, LayerTreeHostCommon::findLayerInSubtree(root.get(), child-> id())); 3534 EXPECT_EQ(child, LayerTreeHostCommon::findLayerInSubtree(root.get(), child-> id()));
3579 EXPECT_EQ(grandChild, LayerTreeHostCommon::findLayerInSubtree(root.get(), gr andChild->id())); 3535 EXPECT_EQ(grandChild, LayerTreeHostCommon::findLayerInSubtree(root.get(), gr andChild->id()));
3580 EXPECT_EQ(maskLayer, LayerTreeHostCommon::findLayerInSubtree(root.get(), mas kLayer->id())); 3536 EXPECT_EQ(maskLayer, LayerTreeHostCommon::findLayerInSubtree(root.get(), mas kLayer->id()));
3581 EXPECT_EQ(replicaLayer, LayerTreeHostCommon::findLayerInSubtree(root.get(), replicaLayer->id())); 3537 EXPECT_EQ(replicaLayer, LayerTreeHostCommon::findLayerInSubtree(root.get(), replicaLayer->id()));
3582 EXPECT_EQ(0, LayerTreeHostCommon::findLayerInSubtree(root.get(), nonexistent Id)); 3538 EXPECT_EQ(0, LayerTreeHostCommon::findLayerInSubtree(root.get(), nonexistent Id));
3583 } 3539 }
3584 3540
3585 } // namespace 3541 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698