OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "core/layout/LayoutInline.h" | 5 #include "core/layout/LayoutInline.h" |
6 #include "core/layout/LayoutTestHelper.h" | 6 #include "core/layout/LayoutTestHelper.h" |
7 #include "core/layout/LayoutView.h" | 7 #include "core/layout/LayoutView.h" |
8 #include "platform/geometry/TransformState.h" | 8 #include "platform/geometry/TransformState.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 FloatPoint mapAncestorToLocal(const LayoutObject*, | 25 FloatPoint mapAncestorToLocal(const LayoutObject*, |
26 const LayoutBoxModelObject* ancestor, | 26 const LayoutBoxModelObject* ancestor, |
27 FloatPoint, | 27 FloatPoint, |
28 MapCoordinatesFlags = 0) const; | 28 MapCoordinatesFlags = 0) const; |
29 FloatQuad mapAncestorToLocal(const LayoutObject*, | 29 FloatQuad mapAncestorToLocal(const LayoutObject*, |
30 const LayoutBoxModelObject* ancestor, | 30 const LayoutBoxModelObject* ancestor, |
31 FloatQuad, | 31 FloatQuad, |
32 MapCoordinatesFlags = 0) const; | 32 MapCoordinatesFlags = 0) const; |
33 }; | 33 }; |
34 | 34 |
35 // One note about tests here that operate on LayoutInline and LayoutText objects
: | 35 // One note about tests here that operate on LayoutInline and LayoutText |
36 // mapLocalToAncestor() expects such objects to pass their static location and s
ize (relatively to | 36 // objects: mapLocalToAncestor() expects such objects to pass their static |
37 // the border edge of their container) to mapLocalToAncestor() via the Transform
State | 37 // location and size (relatively to the border edge of their container) to |
38 // argument. mapLocalToAncestor() is then only expected to make adjustments for | 38 // mapLocalToAncestor() via the TransformState argument. mapLocalToAncestor() is |
39 // relative-positioning, container-specific characteristics (such as writing mod
e roots, multicol), | 39 // then only expected to make adjustments for relative-positioning, |
40 // and so on. This in contrast to LayoutBox objects, where the TransformState pa
ssed is relative to | 40 // container-specific characteristics (such as writing mode roots, multicol), |
41 // the box itself, not the container. | 41 // and so on. This in contrast to LayoutBox objects, where the TransformState |
| 42 // passed is relative to the box itself, not the container. |
42 | 43 |
43 FloatPoint MapCoordinatesTest::mapLocalToAncestor( | 44 FloatPoint MapCoordinatesTest::mapLocalToAncestor( |
44 const LayoutObject* object, | 45 const LayoutObject* object, |
45 const LayoutBoxModelObject* ancestor, | 46 const LayoutBoxModelObject* ancestor, |
46 FloatPoint point, | 47 FloatPoint point, |
47 MapCoordinatesFlags mode) const { | 48 MapCoordinatesFlags mode) const { |
48 TransformState transformState(TransformState::ApplyTransformDirection, point); | 49 TransformState transformState(TransformState::ApplyTransformDirection, point); |
49 object->mapLocalToAncestor(ancestor, transformState, mode); | 50 object->mapLocalToAncestor(ancestor, transformState, mode); |
50 transformState.flatten(); | 51 transformState.flatten(); |
51 return transformState.lastPlanarPoint(); | 52 return transformState.lastPlanarPoint(); |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 ProgrammaticScroll); | 596 ProgrammaticScroll); |
596 document().view()->updateAllLifecyclePhases(); | 597 document().view()->updateAllLifecyclePhases(); |
597 | 598 |
598 Element* target = frameDocument.getElementById("target"); | 599 Element* target = frameDocument.getElementById("target"); |
599 ASSERT_TRUE(target); | 600 ASSERT_TRUE(target); |
600 FloatPoint mappedPoint = | 601 FloatPoint mappedPoint = |
601 mapAncestorToLocal(target->layoutObject(), nullptr, FloatPoint(10, 70), | 602 mapAncestorToLocal(target->layoutObject(), nullptr, FloatPoint(10, 70), |
602 TraverseDocumentBoundaries); | 603 TraverseDocumentBoundaries); |
603 | 604 |
604 // y = 70 - 8000, since the iframe is offset by 8000px from the main frame. | 605 // y = 70 - 8000, since the iframe is offset by 8000px from the main frame. |
605 // The scroll is not taken into account because the element is not fixed to th
e root LayoutView, | 606 // The scroll is not taken into account because the element is not fixed to |
606 // and the space of the root LayoutView does not include scroll. | 607 // the root LayoutView, and the space of the root LayoutView does not include |
| 608 // scroll. |
607 EXPECT_EQ(FloatPoint(10, -7930), mappedPoint); | 609 EXPECT_EQ(FloatPoint(10, -7930), mappedPoint); |
608 } | 610 } |
609 | 611 |
610 TEST_F(MapCoordinatesTest, IFrameTransformed) { | 612 TEST_F(MapCoordinatesTest, IFrameTransformed) { |
611 document().setBaseURLOverride(KURL(ParsedURLString, "http://test.com")); | 613 document().setBaseURLOverride(KURL(ParsedURLString, "http://test.com")); |
612 setBodyInnerHTML( | 614 setBodyInnerHTML( |
613 "<style>body { margin: 0; }</style>" | 615 "<style>body { margin: 0; }</style>" |
614 "<iframe style='transform: scale(2)' id=frame src='http://test.com' " | 616 "<iframe style='transform: scale(2)' id=frame src='http://test.com' " |
615 "width='500' height='500' frameBorder='0'>" | 617 "width='500' height='500' frameBorder='0'>" |
616 "</iframe>"); | 618 "</iframe>"); |
617 | 619 |
618 Document& frameDocument = | 620 Document& frameDocument = |
619 setupChildIframe("frame", | 621 setupChildIframe("frame", |
620 "<style>body { margin: 0; } #target { width: 200px; " | 622 "<style>body { margin: 0; } #target { width: 200px; " |
621 "height: 8000px}</style><div id=target></div>"); | 623 "height: 8000px}</style><div id=target></div>"); |
622 | 624 |
623 document().view()->updateAllLifecyclePhases(); | 625 document().view()->updateAllLifecyclePhases(); |
624 | 626 |
625 frameDocument.view()->setScrollOffset(ScrollOffset(0.0, 1000), | 627 frameDocument.view()->setScrollOffset(ScrollOffset(0.0, 1000), |
626 ProgrammaticScroll); | 628 ProgrammaticScroll); |
627 frameDocument.view()->updateAllLifecyclePhases(); | 629 frameDocument.view()->updateAllLifecyclePhases(); |
628 | 630 |
629 Element* target = frameDocument.getElementById("target"); | 631 Element* target = frameDocument.getElementById("target"); |
630 ASSERT_TRUE(target); | 632 ASSERT_TRUE(target); |
631 FloatPoint mappedPoint = | 633 FloatPoint mappedPoint = |
632 mapAncestorToLocal(target->layoutObject(), nullptr, FloatPoint(200, 200), | 634 mapAncestorToLocal(target->layoutObject(), nullptr, FloatPoint(200, 200), |
633 TraverseDocumentBoundaries | UseTransforms); | 635 TraverseDocumentBoundaries | UseTransforms); |
634 | 636 |
635 // Derivation: | 637 // Derivation: |
636 // (200, 200) -> (-50, -50) (Adjust for transform origin of scale, which is a
t the center of the 500x500 iframe) | 638 // (200, 200) -> (-50, -50) (Adjust for transform origin of scale, which is |
| 639 // at the center of the 500x500 iframe) |
637 // (-50, -50) -> (-25, -25) (Divide by 2 to invert the scale) | 640 // (-50, -50) -> (-25, -25) (Divide by 2 to invert the scale) |
638 // (-25, -25) -> (225, 225) (Add the origin back in) | 641 // (-25, -25) -> (225, 225) (Add the origin back in) |
639 // (225, 225) -> (225, 1225) (Adjust by scroll offset of y=1000) | 642 // (225, 225) -> (225, 1225) (Adjust by scroll offset of y=1000) |
640 EXPECT_EQ(FloatPoint(225, 1225), mappedPoint); | 643 EXPECT_EQ(FloatPoint(225, 1225), mappedPoint); |
641 } | 644 } |
642 | 645 |
643 TEST_F(MapCoordinatesTest, FixedPosInScrolledIFrameWithTransform) { | 646 TEST_F(MapCoordinatesTest, FixedPosInScrolledIFrameWithTransform) { |
644 document().setBaseURLOverride(KURL(ParsedURLString, "http://test.com")); | 647 document().setBaseURLOverride(KURL(ParsedURLString, "http://test.com")); |
645 setBodyInnerHTML( | 648 setBodyInnerHTML( |
646 "<style>* { margin: 0; }</style>" | 649 "<style>* { margin: 0; }</style>" |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 "padding:7px;'>" | 860 "padding:7px;'>" |
858 " <div style='height:110px;'></div>" | 861 " <div style='height:110px;'></div>" |
859 " <div id='target' style='position:absolute; left:-1px; top:-1px; " | 862 " <div id='target' style='position:absolute; left:-1px; top:-1px; " |
860 "margin:10px; border:13px; padding:13px;'></div>" | 863 "margin:10px; border:13px; padding:13px;'></div>" |
861 " </div>" | 864 " </div>" |
862 "</div>"); | 865 "</div>"); |
863 | 866 |
864 LayoutBox* target = toLayoutBox(getLayoutObjectByElementId("target")); | 867 LayoutBox* target = toLayoutBox(getLayoutObjectByElementId("target")); |
865 LayoutBox* container = toLayoutBox(getLayoutObjectByElementId("container")); | 868 LayoutBox* container = toLayoutBox(getLayoutObjectByElementId("container")); |
866 | 869 |
867 // The multicol container isn't in the containing block chain of the abspos #t
arget. | 870 // The multicol container isn't in the containing block chain of the abspos |
| 871 // #target. |
868 FloatPoint mappedPoint = mapLocalToAncestor(target, container, FloatPoint()); | 872 FloatPoint mappedPoint = mapLocalToAncestor(target, container, FloatPoint()); |
869 EXPECT_EQ(FloatPoint(16, 16), mappedPoint); | 873 EXPECT_EQ(FloatPoint(16, 16), mappedPoint); |
870 mappedPoint = mapAncestorToLocal(target, container, mappedPoint); | 874 mappedPoint = mapAncestorToLocal(target, container, mappedPoint); |
871 EXPECT_EQ(FloatPoint(), mappedPoint); | 875 EXPECT_EQ(FloatPoint(), mappedPoint); |
872 | 876 |
873 // Walk each ancestor in the chain separately, to verify each step on the way. | 877 // Walk each ancestor in the chain separately, to verify each step on the way. |
874 LayoutBox* multicol = toLayoutBox(getLayoutObjectByElementId("multicol")); | 878 LayoutBox* multicol = toLayoutBox(getLayoutObjectByElementId("multicol")); |
875 LayoutBox* flowThread = target->parentBox(); | 879 LayoutBox* flowThread = target->parentBox(); |
876 ASSERT_TRUE(flowThread->isLayoutFlowThread()); | 880 ASSERT_TRUE(flowThread->isLayoutFlowThread()); |
877 | 881 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
909 ASSERT_TRUE(text->isText()); | 913 ASSERT_TRUE(text->isText()); |
910 | 914 |
911 // Map to the nearest container. Flipping should occur. | 915 // Map to the nearest container. Flipping should occur. |
912 FloatPoint mappedPoint = mapLocalToAncestor( | 916 FloatPoint mappedPoint = mapLocalToAncestor( |
913 text, text->containingBlock(), FloatPoint(75, 10), ApplyContainerFlip); | 917 text, text->containingBlock(), FloatPoint(75, 10), ApplyContainerFlip); |
914 EXPECT_EQ(FloatPoint(125, 10), mappedPoint); | 918 EXPECT_EQ(FloatPoint(125, 10), mappedPoint); |
915 mappedPoint = mapAncestorToLocal(text, text->containingBlock(), mappedPoint, | 919 mappedPoint = mapAncestorToLocal(text, text->containingBlock(), mappedPoint, |
916 ApplyContainerFlip); | 920 ApplyContainerFlip); |
917 EXPECT_EQ(FloatPoint(75, 10), mappedPoint); | 921 EXPECT_EQ(FloatPoint(75, 10), mappedPoint); |
918 | 922 |
919 // Map to a container further up in the tree. Flipping should still occur on t
he nearest | 923 // Map to a container further up in the tree. Flipping should still occur on |
920 // container. LayoutObject::mapLocalToAncestor() is called recursively until t
he ancestor is | 924 // the nearest container. LayoutObject::mapLocalToAncestor() is called |
921 // reached, and the ApplyContainerFlip flag is cleared after having processed
the innermost | 925 // recursively until the ancestor is reached, and the ApplyContainerFlip flag |
922 // object. | 926 // is cleared after having processed the innermost object. |
923 mappedPoint = | 927 mappedPoint = |
924 mapLocalToAncestor(text, text->containingBlock()->containingBlock(), | 928 mapLocalToAncestor(text, text->containingBlock()->containingBlock(), |
925 FloatPoint(75, 10), ApplyContainerFlip); | 929 FloatPoint(75, 10), ApplyContainerFlip); |
926 EXPECT_EQ(FloatPoint(130, 10), mappedPoint); | 930 EXPECT_EQ(FloatPoint(130, 10), mappedPoint); |
927 mappedPoint = | 931 mappedPoint = |
928 mapAncestorToLocal(text, text->containingBlock()->containingBlock(), | 932 mapAncestorToLocal(text, text->containingBlock()->containingBlock(), |
929 mappedPoint, ApplyContainerFlip); | 933 mappedPoint, ApplyContainerFlip); |
930 EXPECT_EQ(FloatPoint(75, 10), mappedPoint); | 934 EXPECT_EQ(FloatPoint(75, 10), mappedPoint); |
931 | 935 |
932 // If the ApplyContainerFlip flag isn't specified, no flipping should take pla
ce. | 936 // If the ApplyContainerFlip flag isn't specified, no flipping should take |
| 937 // place. |
933 mappedPoint = mapLocalToAncestor( | 938 mappedPoint = mapLocalToAncestor( |
934 text, text->containingBlock()->containingBlock(), FloatPoint(75, 10)); | 939 text, text->containingBlock()->containingBlock(), FloatPoint(75, 10)); |
935 EXPECT_EQ(FloatPoint(80, 10), mappedPoint); | 940 EXPECT_EQ(FloatPoint(80, 10), mappedPoint); |
936 mappedPoint = mapAncestorToLocal( | 941 mappedPoint = mapAncestorToLocal( |
937 text, text->containingBlock()->containingBlock(), mappedPoint); | 942 text, text->containingBlock()->containingBlock(), mappedPoint); |
938 EXPECT_EQ(FloatPoint(75, 10), mappedPoint); | 943 EXPECT_EQ(FloatPoint(75, 10), mappedPoint); |
939 } | 944 } |
940 | 945 |
941 TEST_F(MapCoordinatesTest, FlippedBlocksWritingModeWithInline) { | 946 TEST_F(MapCoordinatesTest, FlippedBlocksWritingModeWithInline) { |
942 setBodyInnerHTML( | 947 setBodyInnerHTML( |
943 "<div style='-webkit-writing-mode:vertical-rl;'>" | 948 "<div style='-webkit-writing-mode:vertical-rl;'>" |
944 " <div style='width:13px;'></div>" | 949 " <div style='width:13px;'></div>" |
945 " <div style='width:200px; height:400px; line-height:50px;'>" | 950 " <div style='width:200px; height:400px; line-height:50px;'>" |
946 " <span>" | 951 " <span>" |
947 " <span id='target'><br>text</span>" | 952 " <span id='target'><br>text</span>" |
948 " </span>" | 953 " </span>" |
949 " </div>" | 954 " </div>" |
950 " <div style='width:7px;'></div>" | 955 " <div style='width:7px;'></div>" |
951 "</div>"); | 956 "</div>"); |
952 | 957 |
953 LayoutObject* target = getLayoutObjectByElementId("target"); | 958 LayoutObject* target = getLayoutObjectByElementId("target"); |
954 ASSERT_TRUE(target); | 959 ASSERT_TRUE(target); |
955 | 960 |
956 // First map to the parent SPAN. Nothing special should happen, since flipping
occurs at the nearest container. | 961 // First map to the parent SPAN. Nothing special should happen, since flipping |
| 962 // occurs at the nearest container. |
957 FloatPoint mappedPoint = | 963 FloatPoint mappedPoint = |
958 mapLocalToAncestor(target, toLayoutBoxModelObject(target->parent()), | 964 mapLocalToAncestor(target, toLayoutBoxModelObject(target->parent()), |
959 FloatPoint(75, 10), ApplyContainerFlip); | 965 FloatPoint(75, 10), ApplyContainerFlip); |
960 EXPECT_EQ(FloatPoint(75, 10), mappedPoint); | 966 EXPECT_EQ(FloatPoint(75, 10), mappedPoint); |
961 mappedPoint = | 967 mappedPoint = |
962 mapAncestorToLocal(target, toLayoutBoxModelObject(target->parent()), | 968 mapAncestorToLocal(target, toLayoutBoxModelObject(target->parent()), |
963 mappedPoint, ApplyContainerFlip); | 969 mappedPoint, ApplyContainerFlip); |
964 EXPECT_EQ(FloatPoint(75, 10), mappedPoint); | 970 EXPECT_EQ(FloatPoint(75, 10), mappedPoint); |
965 | 971 |
966 // Continue to the nearest container. Flipping should occur. | 972 // Continue to the nearest container. Flipping should occur. |
967 mappedPoint = mapLocalToAncestor(toLayoutBoxModelObject(target->parent()), | 973 mappedPoint = mapLocalToAncestor(toLayoutBoxModelObject(target->parent()), |
968 target->containingBlock(), | 974 target->containingBlock(), |
969 FloatPoint(75, 10), ApplyContainerFlip); | 975 FloatPoint(75, 10), ApplyContainerFlip); |
970 EXPECT_EQ(FloatPoint(125, 10), mappedPoint); | 976 EXPECT_EQ(FloatPoint(125, 10), mappedPoint); |
971 mappedPoint = mapAncestorToLocal(toLayoutBoxModelObject(target->parent()), | 977 mappedPoint = mapAncestorToLocal(toLayoutBoxModelObject(target->parent()), |
972 target->containingBlock(), mappedPoint, | 978 target->containingBlock(), mappedPoint, |
973 ApplyContainerFlip); | 979 ApplyContainerFlip); |
974 EXPECT_EQ(FloatPoint(75, 10), mappedPoint); | 980 EXPECT_EQ(FloatPoint(75, 10), mappedPoint); |
975 | 981 |
976 // Now map from the innermost inline to the nearest container in one go. | 982 // Now map from the innermost inline to the nearest container in one go. |
977 mappedPoint = mapLocalToAncestor(target, target->containingBlock(), | 983 mappedPoint = mapLocalToAncestor(target, target->containingBlock(), |
978 FloatPoint(75, 10), ApplyContainerFlip); | 984 FloatPoint(75, 10), ApplyContainerFlip); |
979 EXPECT_EQ(FloatPoint(125, 10), mappedPoint); | 985 EXPECT_EQ(FloatPoint(125, 10), mappedPoint); |
980 mappedPoint = mapAncestorToLocal(target, target->containingBlock(), | 986 mappedPoint = mapAncestorToLocal(target, target->containingBlock(), |
981 mappedPoint, ApplyContainerFlip); | 987 mappedPoint, ApplyContainerFlip); |
982 EXPECT_EQ(FloatPoint(75, 10), mappedPoint); | 988 EXPECT_EQ(FloatPoint(75, 10), mappedPoint); |
983 | 989 |
984 // Map to a container further up in the tree. Flipping should still only occur
on the nearest container. | 990 // Map to a container further up in the tree. Flipping should still only occur |
| 991 // on the nearest container. |
985 mappedPoint = | 992 mappedPoint = |
986 mapLocalToAncestor(target, target->containingBlock()->containingBlock(), | 993 mapLocalToAncestor(target, target->containingBlock()->containingBlock(), |
987 FloatPoint(75, 10), ApplyContainerFlip); | 994 FloatPoint(75, 10), ApplyContainerFlip); |
988 EXPECT_EQ(FloatPoint(132, 10), mappedPoint); | 995 EXPECT_EQ(FloatPoint(132, 10), mappedPoint); |
989 mappedPoint = | 996 mappedPoint = |
990 mapAncestorToLocal(target, target->containingBlock()->containingBlock(), | 997 mapAncestorToLocal(target, target->containingBlock()->containingBlock(), |
991 mappedPoint, ApplyContainerFlip); | 998 mappedPoint, ApplyContainerFlip); |
992 EXPECT_EQ(FloatPoint(75, 10), mappedPoint); | 999 EXPECT_EQ(FloatPoint(75, 10), mappedPoint); |
993 | 1000 |
994 // If the ApplyContainerFlip flag isn't specified, no flipping should take pla
ce. | 1001 // If the ApplyContainerFlip flag isn't specified, no flipping should take |
| 1002 // place. |
995 mappedPoint = mapLocalToAncestor( | 1003 mappedPoint = mapLocalToAncestor( |
996 target, target->containingBlock()->containingBlock(), FloatPoint(75, 10)); | 1004 target, target->containingBlock()->containingBlock(), FloatPoint(75, 10)); |
997 EXPECT_EQ(FloatPoint(82, 10), mappedPoint); | 1005 EXPECT_EQ(FloatPoint(82, 10), mappedPoint); |
998 mappedPoint = mapAncestorToLocal( | 1006 mappedPoint = mapAncestorToLocal( |
999 target, target->containingBlock()->containingBlock(), mappedPoint); | 1007 target, target->containingBlock()->containingBlock(), mappedPoint); |
1000 EXPECT_EQ(FloatPoint(75, 10), mappedPoint); | 1008 EXPECT_EQ(FloatPoint(75, 10), mappedPoint); |
1001 } | 1009 } |
1002 | 1010 |
1003 TEST_F(MapCoordinatesTest, FlippedBlocksWritingModeWithBlock) { | 1011 TEST_F(MapCoordinatesTest, FlippedBlocksWritingModeWithBlock) { |
1004 setBodyInnerHTML( | 1012 setBodyInnerHTML( |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1420 " <div id='child2'></div>" | 1428 " <div id='child2'></div>" |
1421 " </div>" | 1429 " </div>" |
1422 " </div>" | 1430 " </div>" |
1423 "</div>"); | 1431 "</div>"); |
1424 LayoutObject* child1 = getLayoutObjectByElementId("child1"); | 1432 LayoutObject* child1 = getLayoutObjectByElementId("child1"); |
1425 LayoutObject* child2 = getLayoutObjectByElementId("child2"); | 1433 LayoutObject* child2 = getLayoutObjectByElementId("child2"); |
1426 TransformationMatrix matrix; | 1434 TransformationMatrix matrix; |
1427 | 1435 |
1428 matrix = child1->localToAbsoluteTransform(); | 1436 matrix = child1->localToAbsoluteTransform(); |
1429 | 1437 |
1430 // With child1, the rotations cancel and points should map basically back to t
hemselves. | 1438 // With child1, the rotations cancel and points should map basically back to |
| 1439 // themselves. |
1431 EXPECT_NEAR(100.0, matrix.projectPoint(FloatPoint(100.0, 50.0)).x(), | 1440 EXPECT_NEAR(100.0, matrix.projectPoint(FloatPoint(100.0, 50.0)).x(), |
1432 LayoutUnit::epsilon()); | 1441 LayoutUnit::epsilon()); |
1433 EXPECT_NEAR(50.0, matrix.projectPoint(FloatPoint(100.0, 50.0)).y(), | 1442 EXPECT_NEAR(50.0, matrix.projectPoint(FloatPoint(100.0, 50.0)).y(), |
1434 LayoutUnit::epsilon()); | 1443 LayoutUnit::epsilon()); |
1435 EXPECT_NEAR(50.0, matrix.projectPoint(FloatPoint(50.0, 100.0)).x(), | 1444 EXPECT_NEAR(50.0, matrix.projectPoint(FloatPoint(50.0, 100.0)).x(), |
1436 LayoutUnit::epsilon()); | 1445 LayoutUnit::epsilon()); |
1437 EXPECT_NEAR(100.0, matrix.projectPoint(FloatPoint(50.0, 100.0)).y(), | 1446 EXPECT_NEAR(100.0, matrix.projectPoint(FloatPoint(50.0, 100.0)).y(), |
1438 LayoutUnit::epsilon()); | 1447 LayoutUnit::epsilon()); |
1439 | 1448 |
1440 // With child2, each rotation gets flattened and the end result is approximate
ly a 90-degree rotation. | 1449 // With child2, each rotation gets flattened and the end result is |
| 1450 // approximately a 90-degree rotation. |
1441 matrix = child2->localToAbsoluteTransform(); | 1451 matrix = child2->localToAbsoluteTransform(); |
1442 EXPECT_NEAR(50.0, matrix.projectPoint(FloatPoint(100.0, 50.0)).x(), | 1452 EXPECT_NEAR(50.0, matrix.projectPoint(FloatPoint(100.0, 50.0)).x(), |
1443 LayoutUnit::epsilon()); | 1453 LayoutUnit::epsilon()); |
1444 EXPECT_NEAR(50.0, matrix.projectPoint(FloatPoint(100.0, 50.0)).y(), | 1454 EXPECT_NEAR(50.0, matrix.projectPoint(FloatPoint(100.0, 50.0)).y(), |
1445 LayoutUnit::epsilon()); | 1455 LayoutUnit::epsilon()); |
1446 EXPECT_NEAR(25.0, matrix.projectPoint(FloatPoint(50.0, 100.0)).x(), | 1456 EXPECT_NEAR(25.0, matrix.projectPoint(FloatPoint(50.0, 100.0)).x(), |
1447 LayoutUnit::epsilon()); | 1457 LayoutUnit::epsilon()); |
1448 EXPECT_NEAR(100.0, matrix.projectPoint(FloatPoint(50.0, 100.0)).y(), | 1458 EXPECT_NEAR(100.0, matrix.projectPoint(FloatPoint(50.0, 100.0)).y(), |
1449 LayoutUnit::epsilon()); | 1459 LayoutUnit::epsilon()); |
1450 } | 1460 } |
1451 | 1461 |
1452 } // namespace blink | 1462 } // namespace blink |
OLD | NEW |