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

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

Issue 2590463002: Make column snapping optional when translating to flow thread coordinates. (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
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 837 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 EXPECT_EQ(FloatPoint(10, 120), mappedPoint); 848 EXPECT_EQ(FloatPoint(10, 120), mappedPoint);
849 mappedPoint = mapAncestorToLocal(target, flowThread, mappedPoint); 849 mappedPoint = mapAncestorToLocal(target, flowThread, mappedPoint);
850 EXPECT_EQ(FloatPoint(), mappedPoint); 850 EXPECT_EQ(FloatPoint(), mappedPoint);
851 851
852 mappedPoint = mapLocalToAncestor(flowThread, container, FloatPoint(10, 120)); 852 mappedPoint = mapLocalToAncestor(flowThread, container, FloatPoint(10, 120));
853 EXPECT_EQ(FloatPoint(125, 35), mappedPoint); 853 EXPECT_EQ(FloatPoint(125, 35), mappedPoint);
854 mappedPoint = mapAncestorToLocal(flowThread, container, mappedPoint); 854 mappedPoint = mapAncestorToLocal(flowThread, container, mappedPoint);
855 EXPECT_EQ(FloatPoint(10, 120), mappedPoint); 855 EXPECT_EQ(FloatPoint(10, 120), mappedPoint);
856 } 856 }
857 857
858 TEST_P(MapCoordinatesTest, MulticolWithBlockAbove) {
859 setBodyInnerHTML(
860 "<div id='container' style='columns:3; column-gap:0; "
861 "column-fill:auto; width:300px; height:200px;'>"
862 " <div id='target' style='margin-top:-50px; height:100px;'></div>"
863 "</div>");
864
865 LayoutBox* target = toLayoutBox(getLayoutObjectByElementId("target"));
866 LayoutBox* container = toLayoutBox(getLayoutObjectByElementId("container"));
867
868 FloatPoint mappedPoint = mapLocalToAncestor(target, container, FloatPoint());
869 EXPECT_EQ(FloatPoint(0, -50), mappedPoint);
870 mappedPoint = mapAncestorToLocal(target, container, mappedPoint);
871 EXPECT_EQ(FloatPoint(), mappedPoint);
872
873 // Walk each ancestor in the chain separately, to verify each step on the way.
874 LayoutBox* flowThread = target->parentBox();
875 ASSERT_TRUE(flowThread->isLayoutFlowThread());
876
877 mappedPoint = mapLocalToAncestor(target, flowThread, FloatPoint());
878 EXPECT_EQ(FloatPoint(0, -50), mappedPoint);
879 mappedPoint = mapAncestorToLocal(target, flowThread, mappedPoint);
880 EXPECT_EQ(FloatPoint(), mappedPoint);
881
882 mappedPoint = mapLocalToAncestor(flowThread, container, FloatPoint(0, -50));
883 EXPECT_EQ(FloatPoint(0, -50), mappedPoint);
884 mappedPoint = mapAncestorToLocal(flowThread, container, mappedPoint);
885 EXPECT_EQ(FloatPoint(0, -50), mappedPoint);
886 }
887
858 TEST_P(MapCoordinatesTest, NestedMulticolWithBlock) { 888 TEST_P(MapCoordinatesTest, NestedMulticolWithBlock) {
859 setBodyInnerHTML( 889 setBodyInnerHTML(
860 "<div id='outerMulticol' style='columns:2; column-gap:0; " 890 "<div id='outerMulticol' style='columns:2; column-gap:0; "
861 "column-fill:auto; width:560px; height:215px; border:8px solid; " 891 "column-fill:auto; width:560px; height:215px; border:8px solid; "
862 "padding:7px;'>" 892 "padding:7px;'>"
863 " <div style='height:10px;'></div>" 893 " <div style='height:10px;'></div>"
864 " <div id='innerMulticol' style='columns:2; column-gap:0; border:8px " 894 " <div id='innerMulticol' style='columns:2; column-gap:0; border:8px "
865 "solid; padding:7px;'>" 895 "solid; padding:7px;'>"
866 " <div style='height:630px;'></div>" 896 " <div style='height:630px;'></div>"
867 " <div id='target' style='width:50px; height:50px;'></div>" 897 " <div id='target' style='width:50px; height:50px;'></div>"
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
1552 LayoutUnit::epsilon()); 1582 LayoutUnit::epsilon());
1553 EXPECT_NEAR(50.0, matrix.projectPoint(FloatPoint(100.0, 50.0)).y(), 1583 EXPECT_NEAR(50.0, matrix.projectPoint(FloatPoint(100.0, 50.0)).y(),
1554 LayoutUnit::epsilon()); 1584 LayoutUnit::epsilon());
1555 EXPECT_NEAR(25.0, matrix.projectPoint(FloatPoint(50.0, 100.0)).x(), 1585 EXPECT_NEAR(25.0, matrix.projectPoint(FloatPoint(50.0, 100.0)).x(),
1556 LayoutUnit::epsilon()); 1586 LayoutUnit::epsilon());
1557 EXPECT_NEAR(100.0, matrix.projectPoint(FloatPoint(50.0, 100.0)).y(), 1587 EXPECT_NEAR(100.0, matrix.projectPoint(FloatPoint(50.0, 100.0)).y(),
1558 LayoutUnit::epsilon()); 1588 LayoutUnit::epsilon());
1559 } 1589 }
1560 1590
1561 } // namespace blink 1591 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698