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

Side by Side Diff: cc/CCLayerTreeHostCommonTest.cpp

Issue 11099040: [cc] Store CCLayerImpls as scoped_ptrs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix cc unit tests Created 8 years, 2 months 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 | Annotate | Revision Log
« no previous file with comments | « cc/CCLayerTreeHostCommon.h ('k') | cc/CCLayerTreeHostImpl.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 "CCLayerTreeHostCommon.h" 7 #include "CCLayerTreeHostCommon.h"
8 8
9 #include "CCAnimationTestCommon.h" 9 #include "CCAnimationTestCommon.h"
10 #include "CCGeometryTestUtils.h" 10 #include "CCGeometryTestUtils.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 ret.setM13(0); 83 ret.setM13(0);
84 ret.setM23(0); 84 ret.setM23(0);
85 ret.setM31(0); 85 ret.setM31(0);
86 ret.setM32(0); 86 ret.setM32(0);
87 ret.setM33(1); 87 ret.setM33(1);
88 ret.setM34(0); 88 ret.setM34(0);
89 ret.setM43(0); 89 ret.setM43(0);
90 return ret; 90 return ret;
91 } 91 }
92 92
93 PassOwnPtr<CCLayerImpl> createTreeForFixedPositionTests() 93 scoped_ptr<CCLayerImpl> createTreeForFixedPositionTests()
94 { 94 {
95 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); 95 scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1);
96 OwnPtr<CCLayerImpl> child = CCLayerImpl::create(2); 96 scoped_ptr<CCLayerImpl> child = CCLayerImpl::create(2);
97 OwnPtr<CCLayerImpl> grandChild = CCLayerImpl::create(3); 97 scoped_ptr<CCLayerImpl> grandChild = CCLayerImpl::create(3);
98 OwnPtr<CCLayerImpl> greatGrandChild = CCLayerImpl::create(4); 98 scoped_ptr<CCLayerImpl> greatGrandChild = CCLayerImpl::create(4);
99 99
100 WebTransformationMatrix IdentityMatrix; 100 WebTransformationMatrix IdentityMatrix;
101 FloatPoint anchor(0, 0); 101 FloatPoint anchor(0, 0);
102 FloatPoint position(0, 0); 102 FloatPoint position(0, 0);
103 IntSize bounds(100, 100); 103 IntSize bounds(100, 100);
104 setLayerPropertiesForTesting(root.get(), IdentityMatrix, IdentityMatrix, anc hor, position, bounds, false); 104 setLayerPropertiesForTesting(root.get(), IdentityMatrix, IdentityMatrix, anc hor, position, bounds, false);
105 setLayerPropertiesForTesting(child.get(), IdentityMatrix, IdentityMatrix, an chor, position, bounds, false); 105 setLayerPropertiesForTesting(child.get(), IdentityMatrix, IdentityMatrix, an chor, position, bounds, false);
106 setLayerPropertiesForTesting(grandChild.get(), IdentityMatrix, IdentityMatri x, anchor, position, bounds, false); 106 setLayerPropertiesForTesting(grandChild.get(), IdentityMatrix, IdentityMatri x, anchor, position, bounds, false);
107 setLayerPropertiesForTesting(greatGrandChild.get(), IdentityMatrix, Identity Matrix, anchor, position, bounds, false); 107 setLayerPropertiesForTesting(greatGrandChild.get(), IdentityMatrix, Identity Matrix, anchor, position, bounds, false);
108 108
109 grandChild->addChild(greatGrandChild.release()); 109 grandChild->addChild(greatGrandChild.Pass());
110 child->addChild(grandChild.release()); 110 child->addChild(grandChild.Pass());
111 root->addChild(child.release()); 111 root->addChild(child.Pass());
112 112
113 return root.release(); 113 return root.Pass();
114 } 114 }
115 115
116 class LayerChromiumWithForcedDrawsContent : public LayerChromium { 116 class LayerChromiumWithForcedDrawsContent : public LayerChromium {
117 public: 117 public:
118 LayerChromiumWithForcedDrawsContent() 118 LayerChromiumWithForcedDrawsContent()
119 : LayerChromium() 119 : LayerChromium()
120 { 120 {
121 } 121 }
122 122
123 virtual bool drawsContent() const OVERRIDE { return true; } 123 virtual bool drawsContent() const OVERRIDE { return true; }
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 EXPECT_FALSE(renderSurface1->renderSurface()); 756 EXPECT_FALSE(renderSurface1->renderSurface());
757 EXPECT_EQ(1U, renderSurfaceLayerList.size()); 757 EXPECT_EQ(1U, renderSurfaceLayerList.size());
758 } 758 }
759 759
760 TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit hDirectContainer) 760 TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit hDirectContainer)
761 { 761 {
762 // This test checks for correct scroll compensation when the fixed-position container 762 // This test checks for correct scroll compensation when the fixed-position container
763 // is the direct parent of the fixed-position layer. 763 // is the direct parent of the fixed-position layer.
764 764
765 DebugScopedSetImplThread scopedImplThread; 765 DebugScopedSetImplThread scopedImplThread;
766 OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests(); 766 scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests();
767 CCLayerImpl* child = root->children()[0]; 767 CCLayerImpl* child = root->children()[0];
768 CCLayerImpl* grandChild = child->children()[0]; 768 CCLayerImpl* grandChild = child->children()[0];
769 769
770 child->setIsContainerForFixedPositionLayers(true); 770 child->setIsContainerForFixedPositionLayers(true);
771 grandChild->setFixedToContainerLayer(true); 771 grandChild->setFixedToContainerLayer(true);
772 772
773 // Case 1: scrollDelta of 0, 0 773 // Case 1: scrollDelta of 0, 0
774 child->setScrollDelta(IntSize(0, 0)); 774 child->setScrollDelta(IntSize(0, 0));
775 executeCalculateDrawTransformsAndVisibility(root.get()); 775 executeCalculateDrawTransformsAndVisibility(root.get());
776 776
(...skipping 20 matching lines...) Expand all
797 // This test checks for correct scroll compensation when the fixed-position container 797 // This test checks for correct scroll compensation when the fixed-position container
798 // is the direct parent of the fixed-position layer, but that container is t ransformed. 798 // is the direct parent of the fixed-position layer, but that container is t ransformed.
799 // In this case, the fixed position element inherits the container's transfo rm, 799 // In this case, the fixed position element inherits the container's transfo rm,
800 // but the scrollDelta that has to be undone should not be affected by that transform. 800 // but the scrollDelta that has to be undone should not be affected by that transform.
801 // 801 //
802 // Transforms are in general non-commutative; using something like a non-uni form scale 802 // Transforms are in general non-commutative; using something like a non-uni form scale
803 // helps to verify that translations and non-uniform scales are applied in t he correct 803 // helps to verify that translations and non-uniform scales are applied in t he correct
804 // order. 804 // order.
805 805
806 DebugScopedSetImplThread scopedImplThread; 806 DebugScopedSetImplThread scopedImplThread;
807 OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests(); 807 scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests();
808 CCLayerImpl* child = root->children()[0]; 808 CCLayerImpl* child = root->children()[0];
809 CCLayerImpl* grandChild = child->children()[0]; 809 CCLayerImpl* grandChild = child->children()[0];
810 810
811 // This scale will cause child and grandChild to be effectively 200 x 800 wi th respect to the renderTarget. 811 // This scale will cause child and grandChild to be effectively 200 x 800 wi th respect to the renderTarget.
812 WebTransformationMatrix nonUniformScale; 812 WebTransformationMatrix nonUniformScale;
813 nonUniformScale.scaleNonUniform(2, 8); 813 nonUniformScale.scaleNonUniform(2, 8);
814 child->setTransform(nonUniformScale); 814 child->setTransform(nonUniformScale);
815 815
816 child->setIsContainerForFixedPositionLayers(true); 816 child->setIsContainerForFixedPositionLayers(true);
817 grandChild->setFixedToContainerLayer(true); 817 grandChild->setFixedToContainerLayer(true);
(...skipping 22 matching lines...) Expand all
840 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform ()); 840 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform ());
841 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra wTransform()); 841 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra wTransform());
842 } 842 }
843 843
844 TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit hDistantContainer) 844 TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit hDistantContainer)
845 { 845 {
846 // This test checks for correct scroll compensation when the fixed-position container 846 // This test checks for correct scroll compensation when the fixed-position container
847 // is NOT the direct parent of the fixed-position layer. 847 // is NOT the direct parent of the fixed-position layer.
848 DebugScopedSetImplThread scopedImplThread; 848 DebugScopedSetImplThread scopedImplThread;
849 849
850 OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests(); 850 scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests();
851 CCLayerImpl* child = root->children()[0]; 851 CCLayerImpl* child = root->children()[0];
852 CCLayerImpl* grandChild = child->children()[0]; 852 CCLayerImpl* grandChild = child->children()[0];
853 CCLayerImpl* greatGrandChild = grandChild->children()[0]; 853 CCLayerImpl* greatGrandChild = grandChild->children()[0];
854 854
855 child->setIsContainerForFixedPositionLayers(true); 855 child->setIsContainerForFixedPositionLayers(true);
856 grandChild->setPosition(FloatPoint(8, 6)); 856 grandChild->setPosition(FloatPoint(8, 6));
857 greatGrandChild->setFixedToContainerLayer(true); 857 greatGrandChild->setFixedToContainerLayer(true);
858 858
859 // Case 1: scrollDelta of 0, 0 859 // Case 1: scrollDelta of 0, 0
860 child->setScrollDelta(IntSize(0, 0)); 860 child->setScrollDelta(IntSize(0, 0));
(...skipping 23 matching lines...) Expand all
884 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand Child->drawTransform()); 884 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrand Child->drawTransform());
885 } 885 }
886 886
887 TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit hDistantContainerAndTransforms) 887 TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit hDistantContainerAndTransforms)
888 { 888 {
889 // This test checks for correct scroll compensation when the fixed-position container 889 // This test checks for correct scroll compensation when the fixed-position container
890 // is NOT the direct parent of the fixed-position layer, and the hierarchy h as various 890 // is NOT the direct parent of the fixed-position layer, and the hierarchy h as various
891 // transforms that have to be processed in the correct order. 891 // transforms that have to be processed in the correct order.
892 DebugScopedSetImplThread scopedImplThread; 892 DebugScopedSetImplThread scopedImplThread;
893 893
894 OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests(); 894 scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests();
895 CCLayerImpl* child = root->children()[0]; 895 CCLayerImpl* child = root->children()[0];
896 CCLayerImpl* grandChild = child->children()[0]; 896 CCLayerImpl* grandChild = child->children()[0];
897 CCLayerImpl* greatGrandChild = grandChild->children()[0]; 897 CCLayerImpl* greatGrandChild = grandChild->children()[0];
898 898
899 WebTransformationMatrix rotationAboutZ; 899 WebTransformationMatrix rotationAboutZ;
900 rotationAboutZ.rotate3d(0, 0, 90); 900 rotationAboutZ.rotate3d(0, 0, 90);
901 901
902 child->setIsContainerForFixedPositionLayers(true); 902 child->setIsContainerForFixedPositionLayers(true);
903 child->setTransform(rotationAboutZ); 903 child->setTransform(rotationAboutZ);
904 grandChild->setPosition(FloatPoint(8, 6)); 904 grandChild->setPosition(FloatPoint(8, 6));
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit hMultipleScrollDeltas) 946 TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit hMultipleScrollDeltas)
947 { 947 {
948 // This test checks for correct scroll compensation when the fixed-position container 948 // This test checks for correct scroll compensation when the fixed-position container
949 // has multiple ancestors that have nonzero scrollDelta before reaching the space where the layer is fixed. 949 // has multiple ancestors that have nonzero scrollDelta before reaching the space where the layer is fixed.
950 // In this test, each scrollDelta occurs in a different space because of eac h layer's local transform. 950 // In this test, each scrollDelta occurs in a different space because of eac h layer's local transform.
951 // This test checks for correct scroll compensation when the fixed-position container 951 // This test checks for correct scroll compensation when the fixed-position container
952 // is NOT the direct parent of the fixed-position layer, and the hierarchy h as various 952 // is NOT the direct parent of the fixed-position layer, and the hierarchy h as various
953 // transforms that have to be processed in the correct order. 953 // transforms that have to be processed in the correct order.
954 DebugScopedSetImplThread scopedImplThread; 954 DebugScopedSetImplThread scopedImplThread;
955 955
956 OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests(); 956 scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests();
957 CCLayerImpl* child = root->children()[0]; 957 CCLayerImpl* child = root->children()[0];
958 CCLayerImpl* grandChild = child->children()[0]; 958 CCLayerImpl* grandChild = child->children()[0];
959 CCLayerImpl* greatGrandChild = grandChild->children()[0]; 959 CCLayerImpl* greatGrandChild = grandChild->children()[0];
960 960
961 WebTransformationMatrix rotationAboutZ; 961 WebTransformationMatrix rotationAboutZ;
962 rotationAboutZ.rotate3d(0, 0, 90); 962 rotationAboutZ.rotate3d(0, 0, 90);
963 963
964 child->setIsContainerForFixedPositionLayers(true); 964 child->setIsContainerForFixedPositionLayers(true);
965 child->setTransform(rotationAboutZ); 965 child->setTransform(rotationAboutZ);
966 grandChild->setPosition(FloatPoint(8, 6)); 966 grandChild->setPosition(FloatPoint(8, 6));
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 } 1008 }
1009 1009
1010 TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit hIntermediateSurfaceAndTransforms) 1010 TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit hIntermediateSurfaceAndTransforms)
1011 { 1011 {
1012 // This test checks for correct scroll compensation when the fixed-position container 1012 // This test checks for correct scroll compensation when the fixed-position container
1013 // contributes to a different renderSurface than the fixed-position layer. I n this 1013 // contributes to a different renderSurface than the fixed-position layer. I n this
1014 // case, the surface drawTransforms also have to be accounted for when check ing the 1014 // case, the surface drawTransforms also have to be accounted for when check ing the
1015 // scrollDelta. 1015 // scrollDelta.
1016 DebugScopedSetImplThread scopedImplThread; 1016 DebugScopedSetImplThread scopedImplThread;
1017 1017
1018 OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests(); 1018 scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests();
1019 CCLayerImpl* child = root->children()[0]; 1019 CCLayerImpl* child = root->children()[0];
1020 CCLayerImpl* grandChild = child->children()[0]; 1020 CCLayerImpl* grandChild = child->children()[0];
1021 CCLayerImpl* greatGrandChild = grandChild->children()[0]; 1021 CCLayerImpl* greatGrandChild = grandChild->children()[0];
1022 1022
1023 child->setIsContainerForFixedPositionLayers(true); 1023 child->setIsContainerForFixedPositionLayers(true);
1024 grandChild->setPosition(FloatPoint(8, 6)); 1024 grandChild->setPosition(FloatPoint(8, 6));
1025 grandChild->setForceRenderSurface(true); 1025 grandChild->setForceRenderSurface(true);
1026 greatGrandChild->setFixedToContainerLayer(true); 1026 greatGrandChild->setFixedToContainerLayer(true);
1027 greatGrandChild->setDrawsContent(true); 1027 greatGrandChild->setDrawsContent(true);
1028 1028
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 } 1081 }
1082 1082
1083 TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit hMultipleIntermediateSurfaces) 1083 TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit hMultipleIntermediateSurfaces)
1084 { 1084 {
1085 // This test checks for correct scroll compensation when the fixed-position container 1085 // This test checks for correct scroll compensation when the fixed-position container
1086 // contributes to a different renderSurface than the fixed-position layer, w ith 1086 // contributes to a different renderSurface than the fixed-position layer, w ith
1087 // additional renderSurfaces in-between. This checks that the conversion to ancestor 1087 // additional renderSurfaces in-between. This checks that the conversion to ancestor
1088 // surfaces is accumulated properly in the final matrix transform. 1088 // surfaces is accumulated properly in the final matrix transform.
1089 DebugScopedSetImplThread scopedImplThread; 1089 DebugScopedSetImplThread scopedImplThread;
1090 1090
1091 OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests(); 1091 scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests();
1092 CCLayerImpl* child = root->children()[0]; 1092 CCLayerImpl* child = root->children()[0];
1093 CCLayerImpl* grandChild = child->children()[0]; 1093 CCLayerImpl* grandChild = child->children()[0];
1094 CCLayerImpl* greatGrandChild = grandChild->children()[0]; 1094 CCLayerImpl* greatGrandChild = grandChild->children()[0];
1095 1095
1096 // Add one more layer to the test tree for this scenario. 1096 // Add one more layer to the test tree for this scenario.
1097 { 1097 {
1098 WebTransformationMatrix identity; 1098 WebTransformationMatrix identity;
1099 OwnPtr<CCLayerImpl> fixedPositionChild = CCLayerImpl::create(5); 1099 scoped_ptr<CCLayerImpl> fixedPositionChild = CCLayerImpl::create(5);
1100 setLayerPropertiesForTesting(fixedPositionChild.get(), identity, identit y, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); 1100 setLayerPropertiesForTesting(fixedPositionChild.get(), identity, identit y, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
1101 greatGrandChild->addChild(fixedPositionChild.release()); 1101 greatGrandChild->addChild(fixedPositionChild.Pass());
1102 } 1102 }
1103 CCLayerImpl* fixedPositionChild = greatGrandChild->children()[0]; 1103 CCLayerImpl* fixedPositionChild = greatGrandChild->children()[0];
1104 1104
1105 // Actually set up the scenario here. 1105 // Actually set up the scenario here.
1106 child->setIsContainerForFixedPositionLayers(true); 1106 child->setIsContainerForFixedPositionLayers(true);
1107 grandChild->setPosition(FloatPoint(8, 6)); 1107 grandChild->setPosition(FloatPoint(8, 6));
1108 grandChild->setForceRenderSurface(true); 1108 grandChild->setForceRenderSurface(true);
1109 greatGrandChild->setPosition(FloatPoint(40, 60)); 1109 greatGrandChild->setPosition(FloatPoint(40, 60));
1110 greatGrandChild->setForceRenderSurface(true); 1110 greatGrandChild->setForceRenderSurface(true);
1111 fixedPositionChild->setFixedToContainerLayer(true); 1111 fixedPositionChild->setFixedToContainerLayer(true);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 } 1192 }
1193 1193
1194 TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit hContainerLayerThatHasSurface) 1194 TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit hContainerLayerThatHasSurface)
1195 { 1195 {
1196 // This test checks for correct scroll compensation when the fixed-position container 1196 // This test checks for correct scroll compensation when the fixed-position container
1197 // itself has a renderSurface. In this case, the container layer should be t reated 1197 // itself has a renderSurface. In this case, the container layer should be t reated
1198 // like a layer that contributes to a renderTarget, and that renderTarget 1198 // like a layer that contributes to a renderTarget, and that renderTarget
1199 // is completely irrelevant; it should not affect the scroll compensation. 1199 // is completely irrelevant; it should not affect the scroll compensation.
1200 DebugScopedSetImplThread scopedImplThread; 1200 DebugScopedSetImplThread scopedImplThread;
1201 1201
1202 OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests(); 1202 scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests();
1203 CCLayerImpl* child = root->children()[0]; 1203 CCLayerImpl* child = root->children()[0];
1204 CCLayerImpl* grandChild = child->children()[0]; 1204 CCLayerImpl* grandChild = child->children()[0];
1205 1205
1206 child->setIsContainerForFixedPositionLayers(true); 1206 child->setIsContainerForFixedPositionLayers(true);
1207 child->setForceRenderSurface(true); 1207 child->setForceRenderSurface(true);
1208 grandChild->setFixedToContainerLayer(true); 1208 grandChild->setFixedToContainerLayer(true);
1209 grandChild->setDrawsContent(true); 1209 grandChild->setDrawsContent(true);
1210 1210
1211 // Case 1: scrollDelta of 0, 0 1211 // Case 1: scrollDelta of 0, 0
1212 child->setScrollDelta(IntSize(0, 0)); 1212 child->setScrollDelta(IntSize(0, 0));
(...skipping 26 matching lines...) Expand all
1239 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra wTransform()); 1239 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra wTransform());
1240 } 1240 }
1241 1241
1242 TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerTha tIsAlsoFixedPositionContainer) 1242 TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerTha tIsAlsoFixedPositionContainer)
1243 { 1243 {
1244 // This test checks the scenario where a fixed-position layer also happens t o be a 1244 // This test checks the scenario where a fixed-position layer also happens t o be a
1245 // container itself for a descendant fixed position layer. In particular, th e layer 1245 // container itself for a descendant fixed position layer. In particular, th e layer
1246 // should not accidentally be fixed to itself. 1246 // should not accidentally be fixed to itself.
1247 DebugScopedSetImplThread scopedImplThread; 1247 DebugScopedSetImplThread scopedImplThread;
1248 1248
1249 OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests(); 1249 scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests();
1250 CCLayerImpl* child = root->children()[0]; 1250 CCLayerImpl* child = root->children()[0];
1251 CCLayerImpl* grandChild = child->children()[0]; 1251 CCLayerImpl* grandChild = child->children()[0];
1252 1252
1253 child->setIsContainerForFixedPositionLayers(true); 1253 child->setIsContainerForFixedPositionLayers(true);
1254 grandChild->setFixedToContainerLayer(true); 1254 grandChild->setFixedToContainerLayer(true);
1255 1255
1256 // This should not confuse the grandChild. If correct, the grandChild would still be considered fixed to its container (i.e. "child"). 1256 // This should not confuse the grandChild. If correct, the grandChild would still be considered fixed to its container (i.e. "child").
1257 grandChild->setIsContainerForFixedPositionLayers(true); 1257 grandChild->setIsContainerForFixedPositionLayers(true);
1258 1258
1259 // Case 1: scrollDelta of 0, 0 1259 // Case 1: scrollDelta of 0, 0
(...skipping 16 matching lines...) Expand all
1276 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra wTransform()); 1276 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra wTransform());
1277 } 1277 }
1278 1278
1279 TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerTha tHasNoContainer) 1279 TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerTha tHasNoContainer)
1280 { 1280 {
1281 // This test checks scroll compensation when a fixed-position layer does not find any 1281 // This test checks scroll compensation when a fixed-position layer does not find any
1282 // ancestor that is a "containerForFixedPositionLayers". In this situation, the layer should 1282 // ancestor that is a "containerForFixedPositionLayers". In this situation, the layer should
1283 // be fixed to the viewport -- not the rootLayer, which may have transforms of its own. 1283 // be fixed to the viewport -- not the rootLayer, which may have transforms of its own.
1284 DebugScopedSetImplThread scopedImplThread; 1284 DebugScopedSetImplThread scopedImplThread;
1285 1285
1286 OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests(); 1286 scoped_ptr<CCLayerImpl> root = createTreeForFixedPositionTests();
1287 CCLayerImpl* child = root->children()[0]; 1287 CCLayerImpl* child = root->children()[0];
1288 CCLayerImpl* grandChild = child->children()[0]; 1288 CCLayerImpl* grandChild = child->children()[0];
1289 1289
1290 WebTransformationMatrix rotationByZ; 1290 WebTransformationMatrix rotationByZ;
1291 rotationByZ.rotate3d(0, 0, 90); 1291 rotationByZ.rotate3d(0, 0, 90);
1292 1292
1293 root->setTransform(rotationByZ); 1293 root->setTransform(rotationByZ);
1294 grandChild->setFixedToContainerLayer(true); 1294 grandChild->setFixedToContainerLayer(true);
1295 1295
1296 // Case 1: root scrollDelta of 0, 0 1296 // Case 1: root scrollDelta of 0, 0
(...skipping 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after
2664 2664
2665 testPoint = IntPoint(10, 20); 2665 testPoint = IntPoint(10, 20);
2666 resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, re nderSurfaceLayerList); 2666 resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, re nderSurfaceLayerList);
2667 EXPECT_FALSE(resultLayer); 2667 EXPECT_FALSE(resultLayer);
2668 } 2668 }
2669 2669
2670 TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayer) 2670 TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayer)
2671 { 2671 {
2672 DebugScopedSetImplThread thisScopeIsOnImplThread; 2672 DebugScopedSetImplThread thisScopeIsOnImplThread;
2673 2673
2674 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(12345); 2674 scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(12345);
2675 2675
2676 WebTransformationMatrix identityMatrix; 2676 WebTransformationMatrix identityMatrix;
2677 FloatPoint anchor(0, 0); 2677 FloatPoint anchor(0, 0);
2678 FloatPoint position(0, 0); 2678 FloatPoint position(0, 0);
2679 IntSize bounds(100, 100); 2679 IntSize bounds(100, 100);
2680 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, position, bounds, false); 2680 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, position, bounds, false);
2681 root->setDrawsContent(true); 2681 root->setDrawsContent(true);
2682 2682
2683 std::vector<CCLayerImpl*> renderSurfaceLayerList; 2683 std::vector<CCLayerImpl*> renderSurfaceLayerList;
2684 int dummyMaxTextureSize = 512; 2684 int dummyMaxTextureSize = 512;
(...skipping 21 matching lines...) Expand all
2706 testPoint = IntPoint(99, 99); 2706 testPoint = IntPoint(99, 99);
2707 resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, re nderSurfaceLayerList); 2707 resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, re nderSurfaceLayerList);
2708 ASSERT_TRUE(resultLayer); 2708 ASSERT_TRUE(resultLayer);
2709 EXPECT_EQ(12345, resultLayer->id()); 2709 EXPECT_EQ(12345, resultLayer->id());
2710 } 2710 }
2711 2711
2712 TEST(CCLayerTreeHostCommonTest, verifyHitTestingForUninvertibleTransform) 2712 TEST(CCLayerTreeHostCommonTest, verifyHitTestingForUninvertibleTransform)
2713 { 2713 {
2714 DebugScopedSetImplThread thisScopeIsOnImplThread; 2714 DebugScopedSetImplThread thisScopeIsOnImplThread;
2715 2715
2716 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(12345); 2716 scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(12345);
2717 2717
2718 WebTransformationMatrix uninvertibleTransform; 2718 WebTransformationMatrix uninvertibleTransform;
2719 uninvertibleTransform.setM11(0); 2719 uninvertibleTransform.setM11(0);
2720 uninvertibleTransform.setM22(0); 2720 uninvertibleTransform.setM22(0);
2721 uninvertibleTransform.setM33(0); 2721 uninvertibleTransform.setM33(0);
2722 uninvertibleTransform.setM44(0); 2722 uninvertibleTransform.setM44(0);
2723 ASSERT_FALSE(uninvertibleTransform.isInvertible()); 2723 ASSERT_FALSE(uninvertibleTransform.isInvertible());
2724 2724
2725 WebTransformationMatrix identityMatrix; 2725 WebTransformationMatrix identityMatrix;
2726 FloatPoint anchor(0, 0); 2726 FloatPoint anchor(0, 0);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2767 2767
2768 testPoint = IntPoint(-1, -1); 2768 testPoint = IntPoint(-1, -1);
2769 resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, re nderSurfaceLayerList); 2769 resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, re nderSurfaceLayerList);
2770 EXPECT_FALSE(resultLayer); 2770 EXPECT_FALSE(resultLayer);
2771 } 2771 }
2772 2772
2773 TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSinglePositionedLayer) 2773 TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSinglePositionedLayer)
2774 { 2774 {
2775 DebugScopedSetImplThread thisScopeIsOnImplThread; 2775 DebugScopedSetImplThread thisScopeIsOnImplThread;
2776 2776
2777 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(12345); 2777 scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(12345);
2778 2778
2779 WebTransformationMatrix identityMatrix; 2779 WebTransformationMatrix identityMatrix;
2780 FloatPoint anchor(0, 0); 2780 FloatPoint anchor(0, 0);
2781 FloatPoint position(50, 50); // this layer is positioned, and hit testing sh ould correctly know where the layer is located. 2781 FloatPoint position(50, 50); // this layer is positioned, and hit testing sh ould correctly know where the layer is located.
2782 IntSize bounds(100, 100); 2782 IntSize bounds(100, 100);
2783 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, position, bounds, false); 2783 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, position, bounds, false);
2784 root->setDrawsContent(true); 2784 root->setDrawsContent(true);
2785 2785
2786 std::vector<CCLayerImpl*> renderSurfaceLayerList; 2786 std::vector<CCLayerImpl*> renderSurfaceLayerList;
2787 int dummyMaxTextureSize = 512; 2787 int dummyMaxTextureSize = 512;
(...skipping 22 matching lines...) Expand all
2810 testPoint = IntPoint(99, 99); 2810 testPoint = IntPoint(99, 99);
2811 resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, re nderSurfaceLayerList); 2811 resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, re nderSurfaceLayerList);
2812 ASSERT_TRUE(resultLayer); 2812 ASSERT_TRUE(resultLayer);
2813 EXPECT_EQ(12345, resultLayer->id()); 2813 EXPECT_EQ(12345, resultLayer->id());
2814 } 2814 }
2815 2815
2816 TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleRotatedLayer) 2816 TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleRotatedLayer)
2817 { 2817 {
2818 DebugScopedSetImplThread thisScopeIsOnImplThread; 2818 DebugScopedSetImplThread thisScopeIsOnImplThread;
2819 2819
2820 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(12345); 2820 scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(12345);
2821 2821
2822 WebTransformationMatrix identityMatrix; 2822 WebTransformationMatrix identityMatrix;
2823 WebTransformationMatrix rotation45DegreesAboutCenter; 2823 WebTransformationMatrix rotation45DegreesAboutCenter;
2824 rotation45DegreesAboutCenter.translate(50, 50); 2824 rotation45DegreesAboutCenter.translate(50, 50);
2825 rotation45DegreesAboutCenter.rotate3d(0, 0, 45); 2825 rotation45DegreesAboutCenter.rotate3d(0, 0, 45);
2826 rotation45DegreesAboutCenter.translate(-50, -50); 2826 rotation45DegreesAboutCenter.translate(-50, -50);
2827 FloatPoint anchor(0, 0); 2827 FloatPoint anchor(0, 0);
2828 FloatPoint position(0, 0); 2828 FloatPoint position(0, 0);
2829 IntSize bounds(100, 100); 2829 IntSize bounds(100, 100);
2830 setLayerPropertiesForTesting(root.get(), rotation45DegreesAboutCenter, ident ityMatrix, anchor, position, bounds, false); 2830 setLayerPropertiesForTesting(root.get(), rotation45DegreesAboutCenter, ident ityMatrix, anchor, position, bounds, false);
(...skipping 30 matching lines...) Expand all
2861 2861
2862 testPoint = IntPoint(-1, 50); 2862 testPoint = IntPoint(-1, 50);
2863 resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, re nderSurfaceLayerList); 2863 resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, re nderSurfaceLayerList);
2864 ASSERT_FALSE(resultLayer); 2864 ASSERT_FALSE(resultLayer);
2865 } 2865 }
2866 2866
2867 TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSinglePerspectiveLayer) 2867 TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSinglePerspectiveLayer)
2868 { 2868 {
2869 DebugScopedSetImplThread thisScopeIsOnImplThread; 2869 DebugScopedSetImplThread thisScopeIsOnImplThread;
2870 2870
2871 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(12345); 2871 scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(12345);
2872 2872
2873 WebTransformationMatrix identityMatrix; 2873 WebTransformationMatrix identityMatrix;
2874 2874
2875 // perspectiveProjectionAboutCenter * translationByZ is designed so that the 100 x 100 layer becomes 50 x 50, and remains centered at (50, 50). 2875 // perspectiveProjectionAboutCenter * translationByZ is designed so that the 100 x 100 layer becomes 50 x 50, and remains centered at (50, 50).
2876 WebTransformationMatrix perspectiveProjectionAboutCenter; 2876 WebTransformationMatrix perspectiveProjectionAboutCenter;
2877 perspectiveProjectionAboutCenter.translate(50, 50); 2877 perspectiveProjectionAboutCenter.translate(50, 50);
2878 perspectiveProjectionAboutCenter.applyPerspective(1); 2878 perspectiveProjectionAboutCenter.applyPerspective(1);
2879 perspectiveProjectionAboutCenter.translate(-50, -50); 2879 perspectiveProjectionAboutCenter.translate(-50, -50);
2880 WebTransformationMatrix translationByZ; 2880 WebTransformationMatrix translationByZ;
2881 translationByZ.translate3d(0, 0, -1); 2881 translationByZ.translate3d(0, 0, -1);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
2923 // test makes sure that hit testing works correctly accounts for the content s scale. 2923 // test makes sure that hit testing works correctly accounts for the content s scale.
2924 // A contentsScale that is not 1 effectively forces a non-identity transform between 2924 // A contentsScale that is not 1 effectively forces a non-identity transform between
2925 // layer's content space and layer's origin space. The hit testing code must take this into account. 2925 // layer's content space and layer's origin space. The hit testing code must take this into account.
2926 // 2926 //
2927 // To test this, the layer is positioned at (25, 25), and is size (50, 50). If 2927 // To test this, the layer is positioned at (25, 25), and is size (50, 50). If
2928 // contentsScale is ignored, then hit testing will mis-interpret the visible ContentRect 2928 // contentsScale is ignored, then hit testing will mis-interpret the visible ContentRect
2929 // as being larger than the actual bounds of the layer. 2929 // as being larger than the actual bounds of the layer.
2930 // 2930 //
2931 DebugScopedSetImplThread thisScopeIsOnImplThread; 2931 DebugScopedSetImplThread thisScopeIsOnImplThread;
2932 2932
2933 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); 2933 scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1);
2934 2934
2935 WebTransformationMatrix identityMatrix; 2935 WebTransformationMatrix identityMatrix;
2936 FloatPoint anchor(0, 0); 2936 FloatPoint anchor(0, 0);
2937 2937
2938 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, FloatPoint(0, 0), IntSize(100, 100), false); 2938 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, FloatPoint(0, 0), IntSize(100, 100), false);
2939 2939
2940 { 2940 {
2941 FloatPoint position(25, 25); 2941 FloatPoint position(25, 25);
2942 IntSize bounds(50, 50); 2942 IntSize bounds(50, 50);
2943 OwnPtr<CCLayerImpl> testLayer = CCLayerImpl::create(12345); 2943 scoped_ptr<CCLayerImpl> testLayer = CCLayerImpl::create(12345);
2944 setLayerPropertiesForTesting(testLayer.get(), identityMatrix, identityMa trix, anchor, position, bounds, false); 2944 setLayerPropertiesForTesting(testLayer.get(), identityMatrix, identityMa trix, anchor, position, bounds, false);
2945 2945
2946 // override contentBounds 2946 // override contentBounds
2947 testLayer->setContentBounds(IntSize(100, 100)); 2947 testLayer->setContentBounds(IntSize(100, 100));
2948 2948
2949 testLayer->setDrawsContent(true); 2949 testLayer->setDrawsContent(true);
2950 root->addChild(testLayer.release()); 2950 root->addChild(testLayer.Pass());
2951 } 2951 }
2952 2952
2953 std::vector<CCLayerImpl*> renderSurfaceLayerList; 2953 std::vector<CCLayerImpl*> renderSurfaceLayerList;
2954 int dummyMaxTextureSize = 512; 2954 int dummyMaxTextureSize = 512;
2955 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1 , 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); 2955 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1 , 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
2956 2956
2957 // Sanity check the scenario we just created. 2957 // Sanity check the scenario we just created.
2958 // The visibleContentRect for testLayer is actually 100x100, even though its layout size is 50x50, positioned at 25x25. 2958 // The visibleContentRect for testLayer is actually 100x100, even though its layout size is 50x50, positioned at 25x25.
2959 CCLayerImpl* testLayer = root->children()[0]; 2959 CCLayerImpl* testLayer = root->children()[0];
2960 EXPECT_RECT_EQ(IntRect(IntPoint::zero(), IntSize(100, 100)), testLayer->visi bleContentRect()); 2960 EXPECT_RECT_EQ(IntRect(IntPoint::zero(), IntSize(100, 100)), testLayer->visi bleContentRect());
(...skipping 27 matching lines...) Expand all
2988 2988
2989 TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSimpleClippedLayer) 2989 TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSimpleClippedLayer)
2990 { 2990 {
2991 // Test that hit-testing will only work for the visible portion of a layer, and not 2991 // Test that hit-testing will only work for the visible portion of a layer, and not
2992 // the entire layer bounds. Here we just test the simple axis-aligned case. 2992 // the entire layer bounds. Here we just test the simple axis-aligned case.
2993 DebugScopedSetImplThread thisScopeIsOnImplThread; 2993 DebugScopedSetImplThread thisScopeIsOnImplThread;
2994 2994
2995 WebTransformationMatrix identityMatrix; 2995 WebTransformationMatrix identityMatrix;
2996 FloatPoint anchor(0, 0); 2996 FloatPoint anchor(0, 0);
2997 2997
2998 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); 2998 scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1);
2999 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, FloatPoint(0, 0), IntSize(100, 100), false); 2999 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, FloatPoint(0, 0), IntSize(100, 100), false);
3000 3000
3001 { 3001 {
3002 OwnPtr<CCLayerImpl> clippingLayer = CCLayerImpl::create(123); 3002 scoped_ptr<CCLayerImpl> clippingLayer = CCLayerImpl::create(123);
3003 FloatPoint position(25, 25); // this layer is positioned, and hit testin g should correctly know where the layer is located. 3003 FloatPoint position(25, 25); // this layer is positioned, and hit testin g should correctly know where the layer is located.
3004 IntSize bounds(50, 50); 3004 IntSize bounds(50, 50);
3005 setLayerPropertiesForTesting(clippingLayer.get(), identityMatrix, identi tyMatrix, anchor, position, bounds, false); 3005 setLayerPropertiesForTesting(clippingLayer.get(), identityMatrix, identi tyMatrix, anchor, position, bounds, false);
3006 clippingLayer->setMasksToBounds(true); 3006 clippingLayer->setMasksToBounds(true);
3007 3007
3008 OwnPtr<CCLayerImpl> child = CCLayerImpl::create(456); 3008 scoped_ptr<CCLayerImpl> child = CCLayerImpl::create(456);
3009 position = FloatPoint(-50, -50); 3009 position = FloatPoint(-50, -50);
3010 bounds = IntSize(300, 300); 3010 bounds = IntSize(300, 300);
3011 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix , anchor, position, bounds, false); 3011 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix , anchor, position, bounds, false);
3012 child->setDrawsContent(true); 3012 child->setDrawsContent(true);
3013 clippingLayer->addChild(child.release()); 3013 clippingLayer->addChild(child.Pass());
3014 root->addChild(clippingLayer.release()); 3014 root->addChild(clippingLayer.Pass());
3015 } 3015 }
3016 3016
3017 std::vector<CCLayerImpl*> renderSurfaceLayerList; 3017 std::vector<CCLayerImpl*> renderSurfaceLayerList;
3018 int dummyMaxTextureSize = 512; 3018 int dummyMaxTextureSize = 512;
3019 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1 , 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); 3019 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1 , 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
3020 3020
3021 // Sanity check the scenario we just created. 3021 // Sanity check the scenario we just created.
3022 ASSERT_EQ(1u, renderSurfaceLayerList.size()); 3022 ASSERT_EQ(1u, renderSurfaceLayerList.size());
3023 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); 3023 ASSERT_EQ(1u, root->renderSurface()->layerList().size());
3024 ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id()); 3024 ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id());
(...skipping 28 matching lines...) Expand all
3053 // algorithm needs to recognize that multiple parent layers may clip the lay er, and 3053 // algorithm needs to recognize that multiple parent layers may clip the lay er, and
3054 // should not actually hit those clipped areas. 3054 // should not actually hit those clipped areas.
3055 // 3055 //
3056 // The child and grandChild layers are both initialized to clip the rotatedL eaf. The 3056 // The child and grandChild layers are both initialized to clip the rotatedL eaf. The
3057 // child layer is rotated about the top-left corner, so that the root + chil d clips 3057 // child layer is rotated about the top-left corner, so that the root + chil d clips
3058 // combined create a triangle. The rotatedLeaf will only be visible where it overlaps 3058 // combined create a triangle. The rotatedLeaf will only be visible where it overlaps
3059 // this triangle. 3059 // this triangle.
3060 // 3060 //
3061 DebugScopedSetImplThread thisScopeIsOnImplThread; 3061 DebugScopedSetImplThread thisScopeIsOnImplThread;
3062 3062
3063 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(123); 3063 scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(123);
3064 3064
3065 WebTransformationMatrix identityMatrix; 3065 WebTransformationMatrix identityMatrix;
3066 FloatPoint anchor(0, 0); 3066 FloatPoint anchor(0, 0);
3067 FloatPoint position(0, 0); 3067 FloatPoint position(0, 0);
3068 IntSize bounds(100, 100); 3068 IntSize bounds(100, 100);
3069 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, position, bounds, false); 3069 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, position, bounds, false);
3070 root->setMasksToBounds(true); 3070 root->setMasksToBounds(true);
3071 3071
3072 { 3072 {
3073 OwnPtr<CCLayerImpl> child = CCLayerImpl::create(456); 3073 scoped_ptr<CCLayerImpl> child = CCLayerImpl::create(456);
3074 OwnPtr<CCLayerImpl> grandChild = CCLayerImpl::create(789); 3074 scoped_ptr<CCLayerImpl> grandChild = CCLayerImpl::create(789);
3075 OwnPtr<CCLayerImpl> rotatedLeaf = CCLayerImpl::create(2468); 3075 scoped_ptr<CCLayerImpl> rotatedLeaf = CCLayerImpl::create(2468);
3076 3076
3077 position = FloatPoint(10, 10); 3077 position = FloatPoint(10, 10);
3078 bounds = IntSize(80, 80); 3078 bounds = IntSize(80, 80);
3079 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix , anchor, position, bounds, false); 3079 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix , anchor, position, bounds, false);
3080 child->setMasksToBounds(true); 3080 child->setMasksToBounds(true);
3081 3081
3082 WebTransformationMatrix rotation45DegreesAboutCorner; 3082 WebTransformationMatrix rotation45DegreesAboutCorner;
3083 rotation45DegreesAboutCorner.rotate3d(0, 0, 45); 3083 rotation45DegreesAboutCorner.rotate3d(0, 0, 45);
3084 3084
3085 position = FloatPoint(0, 0); // remember, positioned with respect to its parent which is already at 10, 10 3085 position = FloatPoint(0, 0); // remember, positioned with respect to its parent which is already at 10, 10
3086 bounds = IntSize(200, 200); // to ensure it covers at least sqrt(2) * 10 0. 3086 bounds = IntSize(200, 200); // to ensure it covers at least sqrt(2) * 10 0.
3087 setLayerPropertiesForTesting(grandChild.get(), rotation45DegreesAboutCor ner, identityMatrix, anchor, position, bounds, false); 3087 setLayerPropertiesForTesting(grandChild.get(), rotation45DegreesAboutCor ner, identityMatrix, anchor, position, bounds, false);
3088 grandChild->setMasksToBounds(true); 3088 grandChild->setMasksToBounds(true);
3089 3089
3090 // Rotates about the center of the layer 3090 // Rotates about the center of the layer
3091 WebTransformationMatrix rotatedLeafTransform; 3091 WebTransformationMatrix rotatedLeafTransform;
3092 rotatedLeafTransform.translate(-10, -10); // cancel out the grandParent' s position 3092 rotatedLeafTransform.translate(-10, -10); // cancel out the grandParent' s position
3093 rotatedLeafTransform.rotate3d(0, 0, -45); // cancel out the corner 45-de gree rotation of the parent. 3093 rotatedLeafTransform.rotate3d(0, 0, -45); // cancel out the corner 45-de gree rotation of the parent.
3094 rotatedLeafTransform.translate(50, 50); 3094 rotatedLeafTransform.translate(50, 50);
3095 rotatedLeafTransform.rotate3d(0, 0, 45); 3095 rotatedLeafTransform.rotate3d(0, 0, 45);
3096 rotatedLeafTransform.translate(-50, -50); 3096 rotatedLeafTransform.translate(-50, -50);
3097 position = FloatPoint(0, 0); 3097 position = FloatPoint(0, 0);
3098 bounds = IntSize(100, 100); 3098 bounds = IntSize(100, 100);
3099 setLayerPropertiesForTesting(rotatedLeaf.get(), rotatedLeafTransform, id entityMatrix, anchor, position, bounds, false); 3099 setLayerPropertiesForTesting(rotatedLeaf.get(), rotatedLeafTransform, id entityMatrix, anchor, position, bounds, false);
3100 rotatedLeaf->setDrawsContent(true); 3100 rotatedLeaf->setDrawsContent(true);
3101 3101
3102 grandChild->addChild(rotatedLeaf.release()); 3102 grandChild->addChild(rotatedLeaf.Pass());
3103 child->addChild(grandChild.release()); 3103 child->addChild(grandChild.Pass());
3104 root->addChild(child.release()); 3104 root->addChild(child.Pass());
3105 } 3105 }
3106 3106
3107 std::vector<CCLayerImpl*> renderSurfaceLayerList; 3107 std::vector<CCLayerImpl*> renderSurfaceLayerList;
3108 int dummyMaxTextureSize = 512; 3108 int dummyMaxTextureSize = 512;
3109 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1 , 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); 3109 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1 , 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
3110 3110
3111 // Sanity check the scenario we just created. 3111 // Sanity check the scenario we just created.
3112 // The grandChild is expected to create a renderSurface because it masksToBo unds and is not axis aligned. 3112 // The grandChild is expected to create a renderSurface because it masksToBo unds and is not axis aligned.
3113 ASSERT_EQ(2u, renderSurfaceLayerList.size()); 3113 ASSERT_EQ(2u, renderSurfaceLayerList.size());
3114 ASSERT_EQ(1u, renderSurfaceLayerList[0]->renderSurface()->layerList().size() ); 3114 ASSERT_EQ(1u, renderSurfaceLayerList[0]->renderSurface()->layerList().size() );
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
3156 3156
3157 TEST(CCLayerTreeHostCommonTest, verifyHitTestingForNonClippingIntermediateLayer) 3157 TEST(CCLayerTreeHostCommonTest, verifyHitTestingForNonClippingIntermediateLayer)
3158 { 3158 {
3159 // This test checks that hit testing code does not accidentally clip to laye r 3159 // This test checks that hit testing code does not accidentally clip to laye r
3160 // bounds for a layer that actually does not clip. 3160 // bounds for a layer that actually does not clip.
3161 DebugScopedSetImplThread thisScopeIsOnImplThread; 3161 DebugScopedSetImplThread thisScopeIsOnImplThread;
3162 3162
3163 WebTransformationMatrix identityMatrix; 3163 WebTransformationMatrix identityMatrix;
3164 FloatPoint anchor(0, 0); 3164 FloatPoint anchor(0, 0);
3165 3165
3166 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); 3166 scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1);
3167 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, FloatPoint(0, 0), IntSize(100, 100), false); 3167 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, FloatPoint(0, 0), IntSize(100, 100), false);
3168 3168
3169 { 3169 {
3170 OwnPtr<CCLayerImpl> intermediateLayer = CCLayerImpl::create(123); 3170 scoped_ptr<CCLayerImpl> intermediateLayer = CCLayerImpl::create(123);
3171 FloatPoint position(10, 10); // this layer is positioned, and hit testin g should correctly know where the layer is located. 3171 FloatPoint position(10, 10); // this layer is positioned, and hit testin g should correctly know where the layer is located.
3172 IntSize bounds(50, 50); 3172 IntSize bounds(50, 50);
3173 setLayerPropertiesForTesting(intermediateLayer.get(), identityMatrix, id entityMatrix, anchor, position, bounds, false); 3173 setLayerPropertiesForTesting(intermediateLayer.get(), identityMatrix, id entityMatrix, anchor, position, bounds, false);
3174 // Sanity check the intermediate layer should not clip. 3174 // Sanity check the intermediate layer should not clip.
3175 ASSERT_FALSE(intermediateLayer->masksToBounds()); 3175 ASSERT_FALSE(intermediateLayer->masksToBounds());
3176 ASSERT_FALSE(intermediateLayer->maskLayer()); 3176 ASSERT_FALSE(intermediateLayer->maskLayer());
3177 3177
3178 // The child of the intermediateLayer is translated so that it does not overlap intermediateLayer at all. 3178 // The child of the intermediateLayer is translated so that it does not overlap intermediateLayer at all.
3179 // If child is incorrectly clipped, we would not be able to hit it succe ssfully. 3179 // If child is incorrectly clipped, we would not be able to hit it succe ssfully.
3180 OwnPtr<CCLayerImpl> child = CCLayerImpl::create(456); 3180 scoped_ptr<CCLayerImpl> child = CCLayerImpl::create(456);
3181 position = FloatPoint(60, 60); // 70, 70 in screen space 3181 position = FloatPoint(60, 60); // 70, 70 in screen space
3182 bounds = IntSize(20, 20); 3182 bounds = IntSize(20, 20);
3183 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix , anchor, position, bounds, false); 3183 setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix , anchor, position, bounds, false);
3184 child->setDrawsContent(true); 3184 child->setDrawsContent(true);
3185 intermediateLayer->addChild(child.release()); 3185 intermediateLayer->addChild(child.Pass());
3186 root->addChild(intermediateLayer.release()); 3186 root->addChild(intermediateLayer.Pass());
3187 } 3187 }
3188 3188
3189 std::vector<CCLayerImpl*> renderSurfaceLayerList; 3189 std::vector<CCLayerImpl*> renderSurfaceLayerList;
3190 int dummyMaxTextureSize = 512; 3190 int dummyMaxTextureSize = 512;
3191 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1 , 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); 3191 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1 , 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
3192 3192
3193 // Sanity check the scenario we just created. 3193 // Sanity check the scenario we just created.
3194 ASSERT_EQ(1u, renderSurfaceLayerList.size()); 3194 ASSERT_EQ(1u, renderSurfaceLayerList.size());
3195 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); 3195 ASSERT_EQ(1u, root->renderSurface()->layerList().size());
3196 ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id()); 3196 ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id());
(...skipping 17 matching lines...) Expand all
3214 resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, re nderSurfaceLayerList); 3214 resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, re nderSurfaceLayerList);
3215 ASSERT_TRUE(resultLayer); 3215 ASSERT_TRUE(resultLayer);
3216 EXPECT_EQ(456, resultLayer->id()); 3216 EXPECT_EQ(456, resultLayer->id());
3217 } 3217 }
3218 3218
3219 3219
3220 TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayers) 3220 TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayers)
3221 { 3221 {
3222 DebugScopedSetImplThread thisScopeIsOnImplThread; 3222 DebugScopedSetImplThread thisScopeIsOnImplThread;
3223 3223
3224 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); 3224 scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1);
3225 3225
3226 WebTransformationMatrix identityMatrix; 3226 WebTransformationMatrix identityMatrix;
3227 FloatPoint anchor(0, 0); 3227 FloatPoint anchor(0, 0);
3228 FloatPoint position(0, 0); 3228 FloatPoint position(0, 0);
3229 IntSize bounds(100, 100); 3229 IntSize bounds(100, 100);
3230 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, position, bounds, false); 3230 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, position, bounds, false);
3231 root->setDrawsContent(true); 3231 root->setDrawsContent(true);
3232 3232
3233 { 3233 {
3234 // child 1 and child2 are initialized to overlap between x=50 and x=60. 3234 // child 1 and child2 are initialized to overlap between x=50 and x=60.
3235 // grandChild is set to overlap both child1 and child2 between y=50 and y=60. 3235 // grandChild is set to overlap both child1 and child2 between y=50 and y=60.
3236 // The expected stacking order is: 3236 // The expected stacking order is:
3237 // (front) child2, (second) grandChild, (third) child1, and (back) the root layer behind all other layers. 3237 // (front) child2, (second) grandChild, (third) child1, and (back) the root layer behind all other layers.
3238 3238
3239 OwnPtr<CCLayerImpl> child1 = CCLayerImpl::create(2); 3239 scoped_ptr<CCLayerImpl> child1 = CCLayerImpl::create(2);
3240 OwnPtr<CCLayerImpl> child2 = CCLayerImpl::create(3); 3240 scoped_ptr<CCLayerImpl> child2 = CCLayerImpl::create(3);
3241 OwnPtr<CCLayerImpl> grandChild1 = CCLayerImpl::create(4); 3241 scoped_ptr<CCLayerImpl> grandChild1 = CCLayerImpl::create(4);
3242 3242
3243 position = FloatPoint(10, 10); 3243 position = FloatPoint(10, 10);
3244 bounds = IntSize(50, 50); 3244 bounds = IntSize(50, 50);
3245 setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatri x, anchor, position, bounds, false); 3245 setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatri x, anchor, position, bounds, false);
3246 child1->setDrawsContent(true); 3246 child1->setDrawsContent(true);
3247 3247
3248 position = FloatPoint(50, 10); 3248 position = FloatPoint(50, 10);
3249 bounds = IntSize(50, 50); 3249 bounds = IntSize(50, 50);
3250 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatri x, anchor, position, bounds, false); 3250 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatri x, anchor, position, bounds, false);
3251 child2->setDrawsContent(true); 3251 child2->setDrawsContent(true);
3252 3252
3253 // Remember that grandChild is positioned with respect to its parent (i. e. child1). 3253 // Remember that grandChild is positioned with respect to its parent (i. e. child1).
3254 // In screen space, the intended position is (10, 50), with size 100 x 5 0. 3254 // In screen space, the intended position is (10, 50), with size 100 x 5 0.
3255 position = FloatPoint(0, 40); 3255 position = FloatPoint(0, 40);
3256 bounds = IntSize(100, 50); 3256 bounds = IntSize(100, 50);
3257 setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identity Matrix, anchor, position, bounds, false); 3257 setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identity Matrix, anchor, position, bounds, false);
3258 grandChild1->setDrawsContent(true); 3258 grandChild1->setDrawsContent(true);
3259 3259
3260 child1->addChild(grandChild1.release()); 3260 child1->addChild(grandChild1.Pass());
3261 root->addChild(child1.release()); 3261 root->addChild(child1.Pass());
3262 root->addChild(child2.release()); 3262 root->addChild(child2.Pass());
3263 } 3263 }
3264 3264
3265 CCLayerImpl* child1 = root->children()[0]; 3265 CCLayerImpl* child1 = root->children()[0];
3266 CCLayerImpl* child2 = root->children()[1]; 3266 CCLayerImpl* child2 = root->children()[1];
3267 CCLayerImpl* grandChild1 = child1->children()[0]; 3267 CCLayerImpl* grandChild1 = child1->children()[0];
3268 3268
3269 std::vector<CCLayerImpl*> renderSurfaceLayerList; 3269 std::vector<CCLayerImpl*> renderSurfaceLayerList;
3270 int dummyMaxTextureSize = 512; 3270 int dummyMaxTextureSize = 512;
3271 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1 , 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); 3271 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1 , 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
3272 3272
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
3319 } 3319 }
3320 3320
3321 TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists) 3321 TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists)
3322 { 3322 {
3323 // 3323 //
3324 // The geometry is set up similarly to the previous case, but 3324 // The geometry is set up similarly to the previous case, but
3325 // all layers are forced to be renderSurfaces now. 3325 // all layers are forced to be renderSurfaces now.
3326 // 3326 //
3327 DebugScopedSetImplThread thisScopeIsOnImplThread; 3327 DebugScopedSetImplThread thisScopeIsOnImplThread;
3328 3328
3329 OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); 3329 scoped_ptr<CCLayerImpl> root = CCLayerImpl::create(1);
3330 3330
3331 WebTransformationMatrix identityMatrix; 3331 WebTransformationMatrix identityMatrix;
3332 FloatPoint anchor(0, 0); 3332 FloatPoint anchor(0, 0);
3333 FloatPoint position(0, 0); 3333 FloatPoint position(0, 0);
3334 IntSize bounds(100, 100); 3334 IntSize bounds(100, 100);
3335 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, position, bounds, false); 3335 setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anc hor, position, bounds, false);
3336 root->setDrawsContent(true); 3336 root->setDrawsContent(true);
3337 3337
3338 { 3338 {
3339 // child 1 and child2 are initialized to overlap between x=50 and x=60. 3339 // child 1 and child2 are initialized to overlap between x=50 and x=60.
3340 // grandChild is set to overlap both child1 and child2 between y=50 and y=60. 3340 // grandChild is set to overlap both child1 and child2 between y=50 and y=60.
3341 // The expected stacking order is: 3341 // The expected stacking order is:
3342 // (front) child2, (second) grandChild, (third) child1, and (back) the root layer behind all other layers. 3342 // (front) child2, (second) grandChild, (third) child1, and (back) the root layer behind all other layers.
3343 3343
3344 OwnPtr<CCLayerImpl> child1 = CCLayerImpl::create(2); 3344 scoped_ptr<CCLayerImpl> child1 = CCLayerImpl::create(2);
3345 OwnPtr<CCLayerImpl> child2 = CCLayerImpl::create(3); 3345 scoped_ptr<CCLayerImpl> child2 = CCLayerImpl::create(3);
3346 OwnPtr<CCLayerImpl> grandChild1 = CCLayerImpl::create(4); 3346 scoped_ptr<CCLayerImpl> grandChild1 = CCLayerImpl::create(4);
3347 3347
3348 position = FloatPoint(10, 10); 3348 position = FloatPoint(10, 10);
3349 bounds = IntSize(50, 50); 3349 bounds = IntSize(50, 50);
3350 setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatri x, anchor, position, bounds, false); 3350 setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatri x, anchor, position, bounds, false);
3351 child1->setDrawsContent(true); 3351 child1->setDrawsContent(true);
3352 child1->setForceRenderSurface(true); 3352 child1->setForceRenderSurface(true);
3353 3353
3354 position = FloatPoint(50, 10); 3354 position = FloatPoint(50, 10);
3355 bounds = IntSize(50, 50); 3355 bounds = IntSize(50, 50);
3356 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatri x, anchor, position, bounds, false); 3356 setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatri x, anchor, position, bounds, false);
3357 child2->setDrawsContent(true); 3357 child2->setDrawsContent(true);
3358 child2->setForceRenderSurface(true); 3358 child2->setForceRenderSurface(true);
3359 3359
3360 // Remember that grandChild is positioned with respect to its parent (i. e. child1). 3360 // Remember that grandChild is positioned with respect to its parent (i. e. child1).
3361 // In screen space, the intended position is (10, 50), with size 100 x 5 0. 3361 // In screen space, the intended position is (10, 50), with size 100 x 5 0.
3362 position = FloatPoint(0, 40); 3362 position = FloatPoint(0, 40);
3363 bounds = IntSize(100, 50); 3363 bounds = IntSize(100, 50);
3364 setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identity Matrix, anchor, position, bounds, false); 3364 setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identity Matrix, anchor, position, bounds, false);
3365 grandChild1->setDrawsContent(true); 3365 grandChild1->setDrawsContent(true);
3366 grandChild1->setForceRenderSurface(true); 3366 grandChild1->setForceRenderSurface(true);
3367 3367
3368 child1->addChild(grandChild1.release()); 3368 child1->addChild(grandChild1.Pass());
3369 root->addChild(child1.release()); 3369 root->addChild(child1.Pass());
3370 root->addChild(child2.release()); 3370 root->addChild(child2.Pass());
3371 } 3371 }
3372 3372
3373 CCLayerImpl* child1 = root->children()[0]; 3373 CCLayerImpl* child1 = root->children()[0];
3374 CCLayerImpl* child2 = root->children()[1]; 3374 CCLayerImpl* child2 = root->children()[1];
3375 CCLayerImpl* grandChild1 = child1->children()[0]; 3375 CCLayerImpl* grandChild1 = child1->children()[0];
3376 3376
3377 std::vector<CCLayerImpl*> renderSurfaceLayerList; 3377 std::vector<CCLayerImpl*> renderSurfaceLayerList;
3378 int dummyMaxTextureSize = 512; 3378 int dummyMaxTextureSize = 512;
3379 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1 , 1, 0, dummyMaxTextureSize, renderSurfaceLayerList); 3379 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1 , 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
3380 3380
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
3815 int nonexistentId = -1; 3815 int nonexistentId = -1;
3816 EXPECT_EQ(root, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), root-> id())); 3816 EXPECT_EQ(root, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), root-> id()));
3817 EXPECT_EQ(child, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), child ->id())); 3817 EXPECT_EQ(child, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), child ->id()));
3818 EXPECT_EQ(grandChild, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), grandChild->id())); 3818 EXPECT_EQ(grandChild, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), grandChild->id()));
3819 EXPECT_EQ(maskLayer, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), m askLayer->id())); 3819 EXPECT_EQ(maskLayer, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), m askLayer->id()));
3820 EXPECT_EQ(replicaLayer, CCLayerTreeHostCommon::findLayerInSubtree(root.get() , replicaLayer->id())); 3820 EXPECT_EQ(replicaLayer, CCLayerTreeHostCommon::findLayerInSubtree(root.get() , replicaLayer->id()));
3821 EXPECT_EQ(0, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), nonexiste ntId)); 3821 EXPECT_EQ(0, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), nonexiste ntId));
3822 } 3822 }
3823 3823
3824 } // namespace 3824 } // namespace
OLDNEW
« no previous file with comments | « cc/CCLayerTreeHostCommon.h ('k') | cc/CCLayerTreeHostImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698