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

Unified Diff: third_party/WebKit/Source/core/layout/MapCoordinatesTest.cpp

Issue 1907443003: Translate flow thread coords to the nearest enclosing coord space when appropriate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a unit test too. Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
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 ff0a4d973f021339cf034e73bd12e996adc0c760..61eeb2a102fb77c980947cc14012b42990318ef1 100644
--- a/third_party/WebKit/Source/core/layout/MapCoordinatesTest.cpp
+++ b/third_party/WebKit/Source/core/layout/MapCoordinatesTest.cpp
@@ -560,6 +560,44 @@ TEST_F(MapCoordinatesTest, MulticolWithBlock)
EXPECT_EQ(FloatPoint(), mappedPoint);
}
+TEST_F(MapCoordinatesTest, NestedMulticolWithBlock)
+{
+ setBodyInnerHTML(
+ "<div id='outerMulticol' style='columns:2; column-gap:0; column-fill:auto; width:560px; height:215px; border:8px solid; padding:7px;'>"
+ " <div style='height:10px;'></div>"
+ " <div id='innerMulticol' style='columns:2; column-gap:0; border:8px solid; padding:7px;'>"
+ " <div style='height:630px;'></div>"
+ " <div id='target' style='width:50px; height:50px;'></div>"
+ " </div>"
+ "</div>");
+
+ LayoutBox* target = toLayoutBox(getLayoutObjectByElementId("target"));
+ LayoutBox* outerMulticol = toLayoutBox(getLayoutObjectByElementId("outerMulticol"));
+ LayoutBox* innerMulticol = toLayoutBox(getLayoutObjectByElementId("innerMulticol"));
+ LayoutBox* innerFlowThread = target->parentBox();
+ ASSERT_TRUE(innerFlowThread->isLayoutFlowThread());
+ LayoutBox* outerFlowThread = innerMulticol->parentBox();
+ ASSERT_TRUE(outerFlowThread->isLayoutFlowThread());
+
+ FloatPoint mappedPoint = mapLocalToAncestor(target, outerMulticol, FloatPoint());
+ EXPECT_EQ(FloatPoint(435, 115), mappedPoint);
+
+ // TODO(mstensho): Add mapAncestorToLocal() tests when it starts working in nested multicol.
+
+ // Walk each ancestor in the chain separately, to verify each step on the way.
+ mappedPoint = mapLocalToAncestor(target, innerFlowThread, FloatPoint());
+ EXPECT_EQ(FloatPoint(0, 630), mappedPoint);
+
+ mappedPoint = mapLocalToAncestor(innerFlowThread, innerMulticol, mappedPoint);
+ EXPECT_EQ(FloatPoint(140, 305), mappedPoint);
+
+ mappedPoint = mapLocalToAncestor(innerMulticol, outerFlowThread, mappedPoint);
+ EXPECT_EQ(FloatPoint(140, 315), mappedPoint);
+
+ mappedPoint = mapLocalToAncestor(outerFlowThread, outerMulticol, mappedPoint);
+ EXPECT_EQ(FloatPoint(435, 115), mappedPoint);
+}
+
TEST_F(MapCoordinatesTest, MulticolWithAbsPosInRelPos)
{
setBodyInnerHTML(

Powered by Google App Engine
This is Rietveld 408576698