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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/MapCoordinatesTest.cpp
diff --git a/third_party/WebKit/Source/core/layout/MapCoordinatesTest.cpp b/third_party/WebKit/Source/core/layout/MapCoordinatesTest.cpp
index 4ceb94b28a441d9e61fe626f2dd6b0c26dc6c305..3e92f198d3bc8109641eaf0b366aca8e7fdd1b7c 100644
--- a/third_party/WebKit/Source/core/layout/MapCoordinatesTest.cpp
+++ b/third_party/WebKit/Source/core/layout/MapCoordinatesTest.cpp
@@ -1027,6 +1027,69 @@ TEST_P(MapCoordinatesTest, MulticolWithAbsPosNotContained) {
EXPECT_EQ(FloatPoint(), mappedPoint);
}
+TEST_P(MapCoordinatesTest, MulticolRtl) {
+ setBodyInnerHTML(
+ "<div id='container' style='columns:3; column-gap:0; column-fill:auto; "
+ "width:300px; height:200px; direction:rtl;'>"
+ " <div style='height:200px;'></div>"
+ " <div id='target' style='height:50px;'></div>"
+ "</div>");
+
+ LayoutBox* target = toLayoutBox(getLayoutObjectByElementId("target"));
+ LayoutBox* container = toLayoutBox(getLayoutObjectByElementId("container"));
+
+ FloatPoint mappedPoint = mapLocalToAncestor(target, container, FloatPoint());
+ EXPECT_EQ(FloatPoint(100, 0), mappedPoint);
+ mappedPoint = mapAncestorToLocal(target, container, mappedPoint);
+ EXPECT_EQ(FloatPoint(), mappedPoint);
+
+ // Walk each ancestor in the chain separately, to verify each step on the way.
+ LayoutBox* flowThread = target->parentBox();
+ ASSERT_TRUE(flowThread->isLayoutFlowThread());
+
+ mappedPoint = mapLocalToAncestor(target, flowThread, FloatPoint());
+ EXPECT_EQ(FloatPoint(0, 200), mappedPoint);
+ mappedPoint = mapAncestorToLocal(target, flowThread, mappedPoint);
+ EXPECT_EQ(FloatPoint(), mappedPoint);
+
+ mappedPoint = mapLocalToAncestor(flowThread, container, FloatPoint(0, 200));
+ EXPECT_EQ(FloatPoint(100, 0), mappedPoint);
+ mappedPoint = mapAncestorToLocal(flowThread, container, mappedPoint);
+ EXPECT_EQ(FloatPoint(0, 200), mappedPoint);
+}
+
+TEST_P(MapCoordinatesTest, MulticolWithLargeBorder) {
+ setBodyInnerHTML(
+ "<div id='container' style='columns:3; column-gap:0; column-fill:auto; "
+ "width:300px; height:200px; border:200px solid;'>"
+ " <div style='height:200px;'></div>"
+ " <div id='target' style='height:50px;'></div>"
+ " <div style='height:200px;'></div>"
+ "</div>");
+
+ LayoutBox* target = toLayoutBox(getLayoutObjectByElementId("target"));
+ LayoutBox* container = toLayoutBox(getLayoutObjectByElementId("container"));
+
+ FloatPoint mappedPoint = mapLocalToAncestor(target, container, FloatPoint());
+ EXPECT_EQ(FloatPoint(300, 200), mappedPoint);
+ mappedPoint = mapAncestorToLocal(target, container, mappedPoint);
+ EXPECT_EQ(FloatPoint(), mappedPoint);
+
+ // Walk each ancestor in the chain separately, to verify each step on the way.
+ LayoutBox* flowThread = target->parentBox();
+ ASSERT_TRUE(flowThread->isLayoutFlowThread());
+
+ mappedPoint = mapLocalToAncestor(target, flowThread, FloatPoint());
+ EXPECT_EQ(FloatPoint(0, 200), mappedPoint);
+ mappedPoint = mapAncestorToLocal(target, flowThread, mappedPoint);
+ EXPECT_EQ(FloatPoint(), mappedPoint);
+
+ mappedPoint = mapLocalToAncestor(flowThread, container, FloatPoint(0, 200));
+ EXPECT_EQ(FloatPoint(300, 200), mappedPoint);
+ mappedPoint = mapAncestorToLocal(flowThread, container, mappedPoint);
+ EXPECT_EQ(FloatPoint(0, 200), mappedPoint);
+}
+
TEST_P(MapCoordinatesTest, FlippedBlocksWritingModeWithText) {
setBodyInnerHTML(
"<div style='-webkit-writing-mode:vertical-rl;'>"
« 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