OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "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 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 EXPECT_EQ(1U, renderSurfaceLayerList.size()); | 714 EXPECT_EQ(1U, renderSurfaceLayerList.size()); |
715 } | 715 } |
716 | 716 |
717 TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit
hDirectContainer) | 717 TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit
hDirectContainer) |
718 { | 718 { |
719 // This test checks for correct scroll compensation when the fixed-position
container | 719 // This test checks for correct scroll compensation when the fixed-position
container |
720 // is the direct parent of the fixed-position layer. | 720 // is the direct parent of the fixed-position layer. |
721 | 721 |
722 DebugScopedSetImplThread scopedImplThread; | 722 DebugScopedSetImplThread scopedImplThread; |
723 OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests(); | 723 OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests(); |
724 CCLayerImpl* child = root->children()[0].get(); | 724 CCLayerImpl* child = root->children()[0]; |
725 CCLayerImpl* grandChild = child->children()[0].get(); | 725 CCLayerImpl* grandChild = child->children()[0]; |
726 | 726 |
727 child->setIsContainerForFixedPositionLayers(true); | 727 child->setIsContainerForFixedPositionLayers(true); |
728 grandChild->setFixedToContainerLayer(true); | 728 grandChild->setFixedToContainerLayer(true); |
729 | 729 |
730 // Case 1: scrollDelta of 0, 0 | 730 // Case 1: scrollDelta of 0, 0 |
731 child->setScrollDelta(IntSize(0, 0)); | 731 child->setScrollDelta(IntSize(0, 0)); |
732 executeCalculateDrawTransformsAndVisibility(root.get()); | 732 executeCalculateDrawTransformsAndVisibility(root.get()); |
733 | 733 |
734 WebTransformationMatrix expectedChildTransform; | 734 WebTransformationMatrix expectedChildTransform; |
735 WebTransformationMatrix expectedGrandChildTransform = expectedChildTransform
; | 735 WebTransformationMatrix expectedGrandChildTransform = expectedChildTransform
; |
(...skipping 19 matching lines...) Expand all Loading... |
755 // is the direct parent of the fixed-position layer, but that container is t
ransformed. | 755 // is the direct parent of the fixed-position layer, but that container is t
ransformed. |
756 // In this case, the fixed position element inherits the container's transfo
rm, | 756 // In this case, the fixed position element inherits the container's transfo
rm, |
757 // but the scrollDelta that has to be undone should not be affected by that
transform. | 757 // but the scrollDelta that has to be undone should not be affected by that
transform. |
758 // | 758 // |
759 // Transforms are in general non-commutative; using something like a non-uni
form scale | 759 // Transforms are in general non-commutative; using something like a non-uni
form scale |
760 // helps to verify that translations and non-uniform scales are applied in t
he correct | 760 // helps to verify that translations and non-uniform scales are applied in t
he correct |
761 // order. | 761 // order. |
762 | 762 |
763 DebugScopedSetImplThread scopedImplThread; | 763 DebugScopedSetImplThread scopedImplThread; |
764 OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests(); | 764 OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests(); |
765 CCLayerImpl* child = root->children()[0].get(); | 765 CCLayerImpl* child = root->children()[0]; |
766 CCLayerImpl* grandChild = child->children()[0].get(); | 766 CCLayerImpl* grandChild = child->children()[0]; |
767 | 767 |
768 // This scale will cause child and grandChild to be effectively 200 x 800 wi
th respect to the renderTarget. | 768 // This scale will cause child and grandChild to be effectively 200 x 800 wi
th respect to the renderTarget. |
769 WebTransformationMatrix nonUniformScale; | 769 WebTransformationMatrix nonUniformScale; |
770 nonUniformScale.scaleNonUniform(2, 8); | 770 nonUniformScale.scaleNonUniform(2, 8); |
771 child->setTransform(nonUniformScale); | 771 child->setTransform(nonUniformScale); |
772 | 772 |
773 child->setIsContainerForFixedPositionLayers(true); | 773 child->setIsContainerForFixedPositionLayers(true); |
774 grandChild->setFixedToContainerLayer(true); | 774 grandChild->setFixedToContainerLayer(true); |
775 | 775 |
776 // Case 1: scrollDelta of 0, 0 | 776 // Case 1: scrollDelta of 0, 0 |
(...skipping 21 matching lines...) Expand all Loading... |
798 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); | 798 EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->dra
wTransform()); |
799 } | 799 } |
800 | 800 |
801 TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit
hDistantContainer) | 801 TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit
hDistantContainer) |
802 { | 802 { |
803 // This test checks for correct scroll compensation when the fixed-position
container | 803 // This test checks for correct scroll compensation when the fixed-position
container |
804 // is NOT the direct parent of the fixed-position layer. | 804 // is NOT the direct parent of the fixed-position layer. |
805 DebugScopedSetImplThread scopedImplThread; | 805 DebugScopedSetImplThread scopedImplThread; |
806 | 806 |
807 OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests(); | 807 OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests(); |
808 CCLayerImpl* child = root->children()[0].get(); | 808 CCLayerImpl* child = root->children()[0]; |
809 CCLayerImpl* grandChild = child->children()[0].get(); | 809 CCLayerImpl* grandChild = child->children()[0]; |
810 CCLayerImpl* greatGrandChild = grandChild->children()[0].get(); | 810 CCLayerImpl* greatGrandChild = grandChild->children()[0]; |
811 | 811 |
812 child->setIsContainerForFixedPositionLayers(true); | 812 child->setIsContainerForFixedPositionLayers(true); |
813 grandChild->setPosition(FloatPoint(8, 6)); | 813 grandChild->setPosition(FloatPoint(8, 6)); |
814 greatGrandChild->setFixedToContainerLayer(true); | 814 greatGrandChild->setFixedToContainerLayer(true); |
815 | 815 |
816 // Case 1: scrollDelta of 0, 0 | 816 // Case 1: scrollDelta of 0, 0 |
817 child->setScrollDelta(IntSize(0, 0)); | 817 child->setScrollDelta(IntSize(0, 0)); |
818 executeCalculateDrawTransformsAndVisibility(root.get()); | 818 executeCalculateDrawTransformsAndVisibility(root.get()); |
819 | 819 |
820 WebTransformationMatrix expectedChildTransform; | 820 WebTransformationMatrix expectedChildTransform; |
(...skipping 21 matching lines...) Expand all Loading... |
842 } | 842 } |
843 | 843 |
844 TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit
hDistantContainerAndTransforms) | 844 TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit
hDistantContainerAndTransforms) |
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, and the hierarchy h
as various | 847 // is NOT the direct parent of the fixed-position layer, and the hierarchy h
as various |
848 // transforms that have to be processed in the correct order. | 848 // transforms that have to be processed in the correct order. |
849 DebugScopedSetImplThread scopedImplThread; | 849 DebugScopedSetImplThread scopedImplThread; |
850 | 850 |
851 OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests(); | 851 OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests(); |
852 CCLayerImpl* child = root->children()[0].get(); | 852 CCLayerImpl* child = root->children()[0]; |
853 CCLayerImpl* grandChild = child->children()[0].get(); | 853 CCLayerImpl* grandChild = child->children()[0]; |
854 CCLayerImpl* greatGrandChild = grandChild->children()[0].get(); | 854 CCLayerImpl* greatGrandChild = grandChild->children()[0]; |
855 | 855 |
856 WebTransformationMatrix rotationAboutZ; | 856 WebTransformationMatrix rotationAboutZ; |
857 rotationAboutZ.rotate3d(0, 0, 90); | 857 rotationAboutZ.rotate3d(0, 0, 90); |
858 | 858 |
859 child->setIsContainerForFixedPositionLayers(true); | 859 child->setIsContainerForFixedPositionLayers(true); |
860 child->setTransform(rotationAboutZ); | 860 child->setTransform(rotationAboutZ); |
861 grandChild->setPosition(FloatPoint(8, 6)); | 861 grandChild->setPosition(FloatPoint(8, 6)); |
862 grandChild->setTransform(rotationAboutZ); | 862 grandChild->setTransform(rotationAboutZ); |
863 greatGrandChild->setFixedToContainerLayer(true); // greatGrandChild is posit
ioned upside-down with respect to the renderTarget. | 863 greatGrandChild->setFixedToContainerLayer(true); // greatGrandChild is posit
ioned upside-down with respect to the renderTarget. |
864 | 864 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
904 { | 904 { |
905 // This test checks for correct scroll compensation when the fixed-position
container | 905 // This test checks for correct scroll compensation when the fixed-position
container |
906 // has multiple ancestors that have nonzero scrollDelta before reaching the
space where the layer is fixed. | 906 // has multiple ancestors that have nonzero scrollDelta before reaching the
space where the layer is fixed. |
907 // In this test, each scrollDelta occurs in a different space because of eac
h layer's local transform. | 907 // In this test, each scrollDelta occurs in a different space because of eac
h layer's local transform. |
908 // This test checks for correct scroll compensation when the fixed-position
container | 908 // This test checks for correct scroll compensation when the fixed-position
container |
909 // is NOT the direct parent of the fixed-position layer, and the hierarchy h
as various | 909 // is NOT the direct parent of the fixed-position layer, and the hierarchy h
as various |
910 // transforms that have to be processed in the correct order. | 910 // transforms that have to be processed in the correct order. |
911 DebugScopedSetImplThread scopedImplThread; | 911 DebugScopedSetImplThread scopedImplThread; |
912 | 912 |
913 OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests(); | 913 OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests(); |
914 CCLayerImpl* child = root->children()[0].get(); | 914 CCLayerImpl* child = root->children()[0]; |
915 CCLayerImpl* grandChild = child->children()[0].get(); | 915 CCLayerImpl* grandChild = child->children()[0]; |
916 CCLayerImpl* greatGrandChild = grandChild->children()[0].get(); | 916 CCLayerImpl* greatGrandChild = grandChild->children()[0]; |
917 | 917 |
918 WebTransformationMatrix rotationAboutZ; | 918 WebTransformationMatrix rotationAboutZ; |
919 rotationAboutZ.rotate3d(0, 0, 90); | 919 rotationAboutZ.rotate3d(0, 0, 90); |
920 | 920 |
921 child->setIsContainerForFixedPositionLayers(true); | 921 child->setIsContainerForFixedPositionLayers(true); |
922 child->setTransform(rotationAboutZ); | 922 child->setTransform(rotationAboutZ); |
923 grandChild->setPosition(FloatPoint(8, 6)); | 923 grandChild->setPosition(FloatPoint(8, 6)); |
924 grandChild->setTransform(rotationAboutZ); | 924 grandChild->setTransform(rotationAboutZ); |
925 greatGrandChild->setFixedToContainerLayer(true); // greatGrandChild is posit
ioned upside-down with respect to the renderTarget. | 925 greatGrandChild->setFixedToContainerLayer(true); // greatGrandChild is posit
ioned upside-down with respect to the renderTarget. |
926 | 926 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
966 | 966 |
967 TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit
hIntermediateSurfaceAndTransforms) | 967 TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit
hIntermediateSurfaceAndTransforms) |
968 { | 968 { |
969 // This test checks for correct scroll compensation when the fixed-position
container | 969 // This test checks for correct scroll compensation when the fixed-position
container |
970 // contributes to a different renderSurface than the fixed-position layer. I
n this | 970 // contributes to a different renderSurface than the fixed-position layer. I
n this |
971 // case, the surface drawTransforms also have to be accounted for when check
ing the | 971 // case, the surface drawTransforms also have to be accounted for when check
ing the |
972 // scrollDelta. | 972 // scrollDelta. |
973 DebugScopedSetImplThread scopedImplThread; | 973 DebugScopedSetImplThread scopedImplThread; |
974 | 974 |
975 OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests(); | 975 OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests(); |
976 CCLayerImpl* child = root->children()[0].get(); | 976 CCLayerImpl* child = root->children()[0]; |
977 CCLayerImpl* grandChild = child->children()[0].get(); | 977 CCLayerImpl* grandChild = child->children()[0]; |
978 CCLayerImpl* greatGrandChild = grandChild->children()[0].get(); | 978 CCLayerImpl* greatGrandChild = grandChild->children()[0]; |
979 | 979 |
980 child->setIsContainerForFixedPositionLayers(true); | 980 child->setIsContainerForFixedPositionLayers(true); |
981 grandChild->setPosition(FloatPoint(8, 6)); | 981 grandChild->setPosition(FloatPoint(8, 6)); |
982 grandChild->setForceRenderSurface(true); | 982 grandChild->setForceRenderSurface(true); |
983 greatGrandChild->setFixedToContainerLayer(true); | 983 greatGrandChild->setFixedToContainerLayer(true); |
984 greatGrandChild->setDrawsContent(true); | 984 greatGrandChild->setDrawsContent(true); |
985 | 985 |
986 WebTransformationMatrix rotationAboutZ; | 986 WebTransformationMatrix rotationAboutZ; |
987 rotationAboutZ.rotate3d(0, 0, 90); | 987 rotationAboutZ.rotate3d(0, 0, 90); |
988 grandChild->setTransform(rotationAboutZ); | 988 grandChild->setTransform(rotationAboutZ); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1039 | 1039 |
1040 TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit
hMultipleIntermediateSurfaces) | 1040 TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit
hMultipleIntermediateSurfaces) |
1041 { | 1041 { |
1042 // This test checks for correct scroll compensation when the fixed-position
container | 1042 // This test checks for correct scroll compensation when the fixed-position
container |
1043 // contributes to a different renderSurface than the fixed-position layer, w
ith | 1043 // contributes to a different renderSurface than the fixed-position layer, w
ith |
1044 // additional renderSurfaces in-between. This checks that the conversion to
ancestor | 1044 // additional renderSurfaces in-between. This checks that the conversion to
ancestor |
1045 // surfaces is accumulated properly in the final matrix transform. | 1045 // surfaces is accumulated properly in the final matrix transform. |
1046 DebugScopedSetImplThread scopedImplThread; | 1046 DebugScopedSetImplThread scopedImplThread; |
1047 | 1047 |
1048 OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests(); | 1048 OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests(); |
1049 CCLayerImpl* child = root->children()[0].get(); | 1049 CCLayerImpl* child = root->children()[0]; |
1050 CCLayerImpl* grandChild = child->children()[0].get(); | 1050 CCLayerImpl* grandChild = child->children()[0]; |
1051 CCLayerImpl* greatGrandChild = grandChild->children()[0].get(); | 1051 CCLayerImpl* greatGrandChild = grandChild->children()[0]; |
1052 | 1052 |
1053 // Add one more layer to the test tree for this scenario. | 1053 // Add one more layer to the test tree for this scenario. |
1054 { | 1054 { |
1055 WebTransformationMatrix identity; | 1055 WebTransformationMatrix identity; |
1056 OwnPtr<CCLayerImpl> fixedPositionChild = CCLayerImpl::create(5); | 1056 OwnPtr<CCLayerImpl> fixedPositionChild = CCLayerImpl::create(5); |
1057 setLayerPropertiesForTesting(fixedPositionChild.get(), identity, identit
y, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); | 1057 setLayerPropertiesForTesting(fixedPositionChild.get(), identity, identit
y, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); |
1058 greatGrandChild->addChild(fixedPositionChild.release()); | 1058 greatGrandChild->addChild(fixedPositionChild.release()); |
1059 } | 1059 } |
1060 CCLayerImpl* fixedPositionChild = greatGrandChild->children()[0].get(); | 1060 CCLayerImpl* fixedPositionChild = greatGrandChild->children()[0]; |
1061 | 1061 |
1062 // Actually set up the scenario here. | 1062 // Actually set up the scenario here. |
1063 child->setIsContainerForFixedPositionLayers(true); | 1063 child->setIsContainerForFixedPositionLayers(true); |
1064 grandChild->setPosition(FloatPoint(8, 6)); | 1064 grandChild->setPosition(FloatPoint(8, 6)); |
1065 grandChild->setForceRenderSurface(true); | 1065 grandChild->setForceRenderSurface(true); |
1066 greatGrandChild->setPosition(FloatPoint(40, 60)); | 1066 greatGrandChild->setPosition(FloatPoint(40, 60)); |
1067 greatGrandChild->setForceRenderSurface(true); | 1067 greatGrandChild->setForceRenderSurface(true); |
1068 fixedPositionChild->setFixedToContainerLayer(true); | 1068 fixedPositionChild->setFixedToContainerLayer(true); |
1069 fixedPositionChild->setDrawsContent(true); | 1069 fixedPositionChild->setDrawsContent(true); |
1070 | 1070 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 | 1150 |
1151 TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit
hContainerLayerThatHasSurface) | 1151 TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWit
hContainerLayerThatHasSurface) |
1152 { | 1152 { |
1153 // This test checks for correct scroll compensation when the fixed-position
container | 1153 // This test checks for correct scroll compensation when the fixed-position
container |
1154 // itself has a renderSurface. In this case, the container layer should be t
reated | 1154 // itself has a renderSurface. In this case, the container layer should be t
reated |
1155 // like a layer that contributes to a renderTarget, and that renderTarget | 1155 // like a layer that contributes to a renderTarget, and that renderTarget |
1156 // is completely irrelevant; it should not affect the scroll compensation. | 1156 // is completely irrelevant; it should not affect the scroll compensation. |
1157 DebugScopedSetImplThread scopedImplThread; | 1157 DebugScopedSetImplThread scopedImplThread; |
1158 | 1158 |
1159 OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests(); | 1159 OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests(); |
1160 CCLayerImpl* child = root->children()[0].get(); | 1160 CCLayerImpl* child = root->children()[0]; |
1161 CCLayerImpl* grandChild = child->children()[0].get(); | 1161 CCLayerImpl* grandChild = child->children()[0]; |
1162 | 1162 |
1163 child->setIsContainerForFixedPositionLayers(true); | 1163 child->setIsContainerForFixedPositionLayers(true); |
1164 child->setForceRenderSurface(true); | 1164 child->setForceRenderSurface(true); |
1165 grandChild->setFixedToContainerLayer(true); | 1165 grandChild->setFixedToContainerLayer(true); |
1166 grandChild->setDrawsContent(true); | 1166 grandChild->setDrawsContent(true); |
1167 | 1167 |
1168 // Case 1: scrollDelta of 0, 0 | 1168 // Case 1: scrollDelta of 0, 0 |
1169 child->setScrollDelta(IntSize(0, 0)); | 1169 child->setScrollDelta(IntSize(0, 0)); |
1170 executeCalculateDrawTransformsAndVisibility(root.get()); | 1170 executeCalculateDrawTransformsAndVisibility(root.get()); |
1171 | 1171 |
(...skipping 25 matching lines...) Expand all Loading... |
1197 } | 1197 } |
1198 | 1198 |
1199 TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerTha
tIsAlsoFixedPositionContainer) | 1199 TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerTha
tIsAlsoFixedPositionContainer) |
1200 { | 1200 { |
1201 // 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 |
1202 // 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 |
1203 // should not accidentally be fixed to itself. | 1203 // should not accidentally be fixed to itself. |
1204 DebugScopedSetImplThread scopedImplThread; | 1204 DebugScopedSetImplThread scopedImplThread; |
1205 | 1205 |
1206 OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests(); | 1206 OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests(); |
1207 CCLayerImpl* child = root->children()[0].get(); | 1207 CCLayerImpl* child = root->children()[0]; |
1208 CCLayerImpl* grandChild = child->children()[0].get(); | 1208 CCLayerImpl* grandChild = child->children()[0]; |
1209 | 1209 |
1210 child->setIsContainerForFixedPositionLayers(true); | 1210 child->setIsContainerForFixedPositionLayers(true); |
1211 grandChild->setFixedToContainerLayer(true); | 1211 grandChild->setFixedToContainerLayer(true); |
1212 | 1212 |
1213 // This should not confuse the grandChild. If correct, the grandChild would
still be considered fixed to its container (i.e. "child"). | 1213 // This should not confuse the grandChild. If correct, the grandChild would
still be considered fixed to its container (i.e. "child"). |
1214 grandChild->setIsContainerForFixedPositionLayers(true); | 1214 grandChild->setIsContainerForFixedPositionLayers(true); |
1215 | 1215 |
1216 // Case 1: scrollDelta of 0, 0 | 1216 // Case 1: scrollDelta of 0, 0 |
1217 child->setScrollDelta(IntSize(0, 0)); | 1217 child->setScrollDelta(IntSize(0, 0)); |
1218 executeCalculateDrawTransformsAndVisibility(root.get()); | 1218 executeCalculateDrawTransformsAndVisibility(root.get()); |
(...skipping 15 matching lines...) Expand all Loading... |
1234 } | 1234 } |
1235 | 1235 |
1236 TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerTha
tHasNoContainer) | 1236 TEST(CCLayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerTha
tHasNoContainer) |
1237 { | 1237 { |
1238 // This test checks scroll compensation when a fixed-position layer does not
find any | 1238 // This test checks scroll compensation when a fixed-position layer does not
find any |
1239 // ancestor that is a "containerForFixedPositionLayers". In this situation,
the layer should | 1239 // ancestor that is a "containerForFixedPositionLayers". In this situation,
the layer should |
1240 // be fixed to the viewport -- not the rootLayer, which may have transforms
of its own. | 1240 // be fixed to the viewport -- not the rootLayer, which may have transforms
of its own. |
1241 DebugScopedSetImplThread scopedImplThread; | 1241 DebugScopedSetImplThread scopedImplThread; |
1242 | 1242 |
1243 OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests(); | 1243 OwnPtr<CCLayerImpl> root = createTreeForFixedPositionTests(); |
1244 CCLayerImpl* child = root->children()[0].get(); | 1244 CCLayerImpl* child = root->children()[0]; |
1245 CCLayerImpl* grandChild = child->children()[0].get(); | 1245 CCLayerImpl* grandChild = child->children()[0]; |
1246 | 1246 |
1247 WebTransformationMatrix rotationByZ; | 1247 WebTransformationMatrix rotationByZ; |
1248 rotationByZ.rotate3d(0, 0, 90); | 1248 rotationByZ.rotate3d(0, 0, 90); |
1249 | 1249 |
1250 root->setTransform(rotationByZ); | 1250 root->setTransform(rotationByZ); |
1251 grandChild->setFixedToContainerLayer(true); | 1251 grandChild->setFixedToContainerLayer(true); |
1252 | 1252 |
1253 // Case 1: root scrollDelta of 0, 0 | 1253 // Case 1: root scrollDelta of 0, 0 |
1254 root->setScrollDelta(IntSize(0, 0)); | 1254 root->setScrollDelta(IntSize(0, 0)); |
1255 executeCalculateDrawTransformsAndVisibility(root.get()); | 1255 executeCalculateDrawTransformsAndVisibility(root.get()); |
(...skipping 1596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2852 root->addChild(testLayer.release()); | 2852 root->addChild(testLayer.release()); |
2853 } | 2853 } |
2854 | 2854 |
2855 Vector<CCLayerImpl*> renderSurfaceLayerList; | 2855 Vector<CCLayerImpl*> renderSurfaceLayerList; |
2856 int dummyMaxTextureSize = 512; | 2856 int dummyMaxTextureSize = 512; |
2857 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 2857 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
2858 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | 2858 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); |
2859 | 2859 |
2860 // Sanity check the scenario we just created. | 2860 // Sanity check the scenario we just created. |
2861 // The visibleContentRect for testLayer is actually 100x100, even though its
layout size is 50x50, positioned at 25x25. | 2861 // The visibleContentRect for testLayer is actually 100x100, even though its
layout size is 50x50, positioned at 25x25. |
2862 CCLayerImpl* testLayer = root->children()[0].get(); | 2862 CCLayerImpl* testLayer = root->children()[0]; |
2863 EXPECT_RECT_EQ(IntRect(IntPoint::zero(), IntSize(100, 100)), testLayer->visi
bleContentRect()); | 2863 EXPECT_RECT_EQ(IntRect(IntPoint::zero(), IntSize(100, 100)), testLayer->visi
bleContentRect()); |
2864 ASSERT_EQ(1u, renderSurfaceLayerList.size()); | 2864 ASSERT_EQ(1u, renderSurfaceLayerList.size()); |
2865 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); | 2865 ASSERT_EQ(1u, root->renderSurface()->layerList().size()); |
2866 | 2866 |
2867 // Hit testing for a point outside the layer should return a null pointer (t
he root layer does not draw content, so it will not be hit tested either). | 2867 // Hit testing for a point outside the layer should return a null pointer (t
he root layer does not draw content, so it will not be hit tested either). |
2868 IntPoint testPoint(101, 101); | 2868 IntPoint testPoint(101, 101); |
2869 CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(
testPoint, renderSurfaceLayerList); | 2869 CCLayerImpl* resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(
testPoint, renderSurfaceLayerList); |
2870 EXPECT_FALSE(resultLayer); | 2870 EXPECT_FALSE(resultLayer); |
2871 | 2871 |
2872 testPoint = IntPoint(24, 24); | 2872 testPoint = IntPoint(24, 24); |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3161 position = FloatPoint(0, 40); | 3161 position = FloatPoint(0, 40); |
3162 bounds = IntSize(100, 50); | 3162 bounds = IntSize(100, 50); |
3163 setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identity
Matrix, anchor, position, bounds, false); | 3163 setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identity
Matrix, anchor, position, bounds, false); |
3164 grandChild1->setDrawsContent(true); | 3164 grandChild1->setDrawsContent(true); |
3165 | 3165 |
3166 child1->addChild(grandChild1.release()); | 3166 child1->addChild(grandChild1.release()); |
3167 root->addChild(child1.release()); | 3167 root->addChild(child1.release()); |
3168 root->addChild(child2.release()); | 3168 root->addChild(child2.release()); |
3169 } | 3169 } |
3170 | 3170 |
3171 CCLayerImpl* child1 = root->children()[0].get(); | 3171 CCLayerImpl* child1 = root->children()[0]; |
3172 CCLayerImpl* child2 = root->children()[1].get(); | 3172 CCLayerImpl* child2 = root->children()[1]; |
3173 CCLayerImpl* grandChild1 = child1->children()[0].get(); | 3173 CCLayerImpl* grandChild1 = child1->children()[0]; |
3174 | 3174 |
3175 Vector<CCLayerImpl*> renderSurfaceLayerList; | 3175 Vector<CCLayerImpl*> renderSurfaceLayerList; |
3176 int dummyMaxTextureSize = 512; | 3176 int dummyMaxTextureSize = 512; |
3177 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 3177 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
3178 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | 3178 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); |
3179 | 3179 |
3180 // Sanity check the scenario we just created. | 3180 // Sanity check the scenario we just created. |
3181 ASSERT_TRUE(child1); | 3181 ASSERT_TRUE(child1); |
3182 ASSERT_TRUE(child2); | 3182 ASSERT_TRUE(child2); |
3183 ASSERT_TRUE(grandChild1); | 3183 ASSERT_TRUE(grandChild1); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3270 bounds = IntSize(100, 50); | 3270 bounds = IntSize(100, 50); |
3271 setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identity
Matrix, anchor, position, bounds, false); | 3271 setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identity
Matrix, anchor, position, bounds, false); |
3272 grandChild1->setDrawsContent(true); | 3272 grandChild1->setDrawsContent(true); |
3273 grandChild1->setForceRenderSurface(true); | 3273 grandChild1->setForceRenderSurface(true); |
3274 | 3274 |
3275 child1->addChild(grandChild1.release()); | 3275 child1->addChild(grandChild1.release()); |
3276 root->addChild(child1.release()); | 3276 root->addChild(child1.release()); |
3277 root->addChild(child2.release()); | 3277 root->addChild(child2.release()); |
3278 } | 3278 } |
3279 | 3279 |
3280 CCLayerImpl* child1 = root->children()[0].get(); | 3280 CCLayerImpl* child1 = root->children()[0]; |
3281 CCLayerImpl* child2 = root->children()[1].get(); | 3281 CCLayerImpl* child2 = root->children()[1]; |
3282 CCLayerImpl* grandChild1 = child1->children()[0].get(); | 3282 CCLayerImpl* grandChild1 = child1->children()[0]; |
3283 | 3283 |
3284 Vector<CCLayerImpl*> renderSurfaceLayerList; | 3284 Vector<CCLayerImpl*> renderSurfaceLayerList; |
3285 int dummyMaxTextureSize = 512; | 3285 int dummyMaxTextureSize = 512; |
3286 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); | 3286 CCLayerTreeHostCommon::calculateDrawTransforms(root.get(), root->bounds(), 1
, 0, dummyMaxTextureSize, renderSurfaceLayerList); |
3287 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); | 3287 CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); |
3288 | 3288 |
3289 // Sanity check the scenario we just created. | 3289 // Sanity check the scenario we just created. |
3290 ASSERT_TRUE(child1); | 3290 ASSERT_TRUE(child1); |
3291 ASSERT_TRUE(child2); | 3291 ASSERT_TRUE(child2); |
3292 ASSERT_TRUE(grandChild1); | 3292 ASSERT_TRUE(grandChild1); |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3525 int nonexistentId = -1; | 3525 int nonexistentId = -1; |
3526 EXPECT_EQ(root, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), root->
id())); | 3526 EXPECT_EQ(root, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), root->
id())); |
3527 EXPECT_EQ(child, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), child
->id())); | 3527 EXPECT_EQ(child, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), child
->id())); |
3528 EXPECT_EQ(grandChild, CCLayerTreeHostCommon::findLayerInSubtree(root.get(),
grandChild->id())); | 3528 EXPECT_EQ(grandChild, CCLayerTreeHostCommon::findLayerInSubtree(root.get(),
grandChild->id())); |
3529 EXPECT_EQ(maskLayer, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), m
askLayer->id())); | 3529 EXPECT_EQ(maskLayer, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), m
askLayer->id())); |
3530 EXPECT_EQ(replicaLayer, CCLayerTreeHostCommon::findLayerInSubtree(root.get()
, replicaLayer->id())); | 3530 EXPECT_EQ(replicaLayer, CCLayerTreeHostCommon::findLayerInSubtree(root.get()
, replicaLayer->id())); |
3531 EXPECT_EQ(0, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), nonexiste
ntId)); | 3531 EXPECT_EQ(0, CCLayerTreeHostCommon::findLayerInSubtree(root.get(), nonexiste
ntId)); |
3532 } | 3532 } |
3533 | 3533 |
3534 } // namespace | 3534 } // namespace |
OLD | NEW |