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

Side by Side Diff: third_party/WebKit/Source/core/layout/MapCoordinatesTest.cpp

Issue 2593633002: Need to be inside the flow thread before converting a visual point. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" 9 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 mappedPoint = mapAncestorToLocal(multicol, container, mappedPoint); 1020 mappedPoint = mapAncestorToLocal(multicol, container, mappedPoint);
1021 EXPECT_EQ(FloatPoint(6, 6), mappedPoint); 1021 EXPECT_EQ(FloatPoint(6, 6), mappedPoint);
1022 1022
1023 mappedPoint = mapAncestorToLocal(flowThread, multicol, mappedPoint); 1023 mappedPoint = mapAncestorToLocal(flowThread, multicol, mappedPoint);
1024 EXPECT_EQ(FloatPoint(-9, -9), mappedPoint); 1024 EXPECT_EQ(FloatPoint(-9, -9), mappedPoint);
1025 1025
1026 mappedPoint = mapAncestorToLocal(target, flowThread, mappedPoint); 1026 mappedPoint = mapAncestorToLocal(target, flowThread, mappedPoint);
1027 EXPECT_EQ(FloatPoint(), mappedPoint); 1027 EXPECT_EQ(FloatPoint(), mappedPoint);
1028 } 1028 }
1029 1029
1030 TEST_P(MapCoordinatesTest, MulticolRtl) {
1031 setBodyInnerHTML(
1032 "<div id='container' style='columns:3; column-gap:0; column-fill:auto; "
1033 "width:300px; height:200px; direction:rtl;'>"
1034 " <div style='height:200px;'></div>"
1035 " <div id='target' style='height:50px;'></div>"
1036 "</div>");
1037
1038 LayoutBox* target = toLayoutBox(getLayoutObjectByElementId("target"));
1039 LayoutBox* container = toLayoutBox(getLayoutObjectByElementId("container"));
1040
1041 FloatPoint mappedPoint = mapLocalToAncestor(target, container, FloatPoint());
1042 EXPECT_EQ(FloatPoint(100, 0), mappedPoint);
1043 mappedPoint = mapAncestorToLocal(target, container, mappedPoint);
1044 EXPECT_EQ(FloatPoint(), mappedPoint);
1045
1046 // Walk each ancestor in the chain separately, to verify each step on the way.
1047 LayoutBox* flowThread = target->parentBox();
1048 ASSERT_TRUE(flowThread->isLayoutFlowThread());
1049
1050 mappedPoint = mapLocalToAncestor(target, flowThread, FloatPoint());
1051 EXPECT_EQ(FloatPoint(0, 200), mappedPoint);
1052 mappedPoint = mapAncestorToLocal(target, flowThread, mappedPoint);
1053 EXPECT_EQ(FloatPoint(), mappedPoint);
1054
1055 mappedPoint = mapLocalToAncestor(flowThread, container, FloatPoint(0, 200));
1056 EXPECT_EQ(FloatPoint(100, 0), mappedPoint);
1057 mappedPoint = mapAncestorToLocal(flowThread, container, mappedPoint);
1058 EXPECT_EQ(FloatPoint(0, 200), mappedPoint);
1059 }
1060
1061 TEST_P(MapCoordinatesTest, MulticolWithLargeBorder) {
1062 setBodyInnerHTML(
1063 "<div id='container' style='columns:3; column-gap:0; column-fill:auto; "
1064 "width:300px; height:200px; border:200px solid;'>"
1065 " <div style='height:200px;'></div>"
1066 " <div id='target' style='height:50px;'></div>"
1067 " <div style='height:200px;'></div>"
1068 "</div>");
1069
1070 LayoutBox* target = toLayoutBox(getLayoutObjectByElementId("target"));
1071 LayoutBox* container = toLayoutBox(getLayoutObjectByElementId("container"));
1072
1073 FloatPoint mappedPoint = mapLocalToAncestor(target, container, FloatPoint());
1074 EXPECT_EQ(FloatPoint(300, 200), mappedPoint);
1075 mappedPoint = mapAncestorToLocal(target, container, mappedPoint);
1076 EXPECT_EQ(FloatPoint(), mappedPoint);
1077
1078 // Walk each ancestor in the chain separately, to verify each step on the way.
1079 LayoutBox* flowThread = target->parentBox();
1080 ASSERT_TRUE(flowThread->isLayoutFlowThread());
1081
1082 mappedPoint = mapLocalToAncestor(target, flowThread, FloatPoint());
1083 EXPECT_EQ(FloatPoint(0, 200), mappedPoint);
1084 mappedPoint = mapAncestorToLocal(target, flowThread, mappedPoint);
1085 EXPECT_EQ(FloatPoint(), mappedPoint);
1086
1087 mappedPoint = mapLocalToAncestor(flowThread, container, FloatPoint(0, 200));
1088 EXPECT_EQ(FloatPoint(300, 200), mappedPoint);
1089 mappedPoint = mapAncestorToLocal(flowThread, container, mappedPoint);
1090 EXPECT_EQ(FloatPoint(0, 200), mappedPoint);
1091 }
1092
1030 TEST_P(MapCoordinatesTest, FlippedBlocksWritingModeWithText) { 1093 TEST_P(MapCoordinatesTest, FlippedBlocksWritingModeWithText) {
1031 setBodyInnerHTML( 1094 setBodyInnerHTML(
1032 "<div style='-webkit-writing-mode:vertical-rl;'>" 1095 "<div style='-webkit-writing-mode:vertical-rl;'>"
1033 " <div style='width:13px;'></div>" 1096 " <div style='width:13px;'></div>"
1034 " <div style='width:200px; height:400px; line-height:50px;'>" 1097 " <div style='width:200px; height:400px; line-height:50px;'>"
1035 " <br id='sibling'>text" 1098 " <br id='sibling'>text"
1036 " </div>" 1099 " </div>"
1037 " <div style='width:5px;'></div>" 1100 " <div style='width:5px;'></div>"
1038 "</div>"); 1101 "</div>");
1039 1102
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
1582 LayoutUnit::epsilon()); 1645 LayoutUnit::epsilon());
1583 EXPECT_NEAR(50.0, matrix.projectPoint(FloatPoint(100.0, 50.0)).y(), 1646 EXPECT_NEAR(50.0, matrix.projectPoint(FloatPoint(100.0, 50.0)).y(),
1584 LayoutUnit::epsilon()); 1647 LayoutUnit::epsilon());
1585 EXPECT_NEAR(25.0, matrix.projectPoint(FloatPoint(50.0, 100.0)).x(), 1648 EXPECT_NEAR(25.0, matrix.projectPoint(FloatPoint(50.0, 100.0)).x(),
1586 LayoutUnit::epsilon()); 1649 LayoutUnit::epsilon());
1587 EXPECT_NEAR(100.0, matrix.projectPoint(FloatPoint(50.0, 100.0)).y(), 1650 EXPECT_NEAR(100.0, matrix.projectPoint(FloatPoint(50.0, 100.0)).y(),
1588 LayoutUnit::epsilon()); 1651 LayoutUnit::epsilon());
1589 } 1652 }
1590 1653
1591 } // namespace blink 1654 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698