| 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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 | 471 |
| 472 // y = 70 - 8000, since the iframe is offset by 8000px from the main frame. | 472 // y = 70 - 8000, since the iframe is offset by 8000px from the main frame. |
| 473 // The scroll is not taken into account because the element is not fixed to
the root LayoutView, | 473 // The scroll is not taken into account because the element is not fixed to
the root LayoutView, |
| 474 // and the space of the root LayoutView does not include scroll. | 474 // and the space of the root LayoutView does not include scroll. |
| 475 EXPECT_EQ(FloatPoint(10, -7930), mappedPoint); | 475 EXPECT_EQ(FloatPoint(10, -7930), mappedPoint); |
| 476 } | 476 } |
| 477 | 477 |
| 478 TEST_F(MapCoordinatesTest, MulticolWithText) | 478 TEST_F(MapCoordinatesTest, MulticolWithText) |
| 479 { | 479 { |
| 480 setBodyInnerHTML( | 480 setBodyInnerHTML( |
| 481 "<div id='multicol' style='-webkit-columns:2; -webkit-column-gap:20px; w
idth:400px; line-height:50px; padding:5px;'>" | 481 "<div id='multicol' style='columns:2; column-gap:20px; width:400px; line
-height:50px; padding:5px; orphans:1; widows:1;'>" |
| 482 " <br id='sibling'>" | 482 " <br id='sibling'>" |
| 483 " text" | 483 " text" |
| 484 "</div>"); | 484 "</div>"); |
| 485 | 485 |
| 486 LayoutObject* target = getLayoutObjectByElementId("sibling")->nextSibling(); | 486 LayoutObject* target = getLayoutObjectByElementId("sibling")->nextSibling(); |
| 487 ASSERT_TRUE(target->isText()); | 487 ASSERT_TRUE(target->isText()); |
| 488 LayoutBox* flowThread = toLayoutBox(target->parent()); | 488 LayoutBox* flowThread = toLayoutBox(target->parent()); |
| 489 ASSERT_TRUE(flowThread->isLayoutFlowThread()); | 489 ASSERT_TRUE(flowThread->isLayoutFlowThread()); |
| 490 LayoutBox* multicol = toLayoutBox(getLayoutObjectByElementId("multicol")); | 490 LayoutBox* multicol = toLayoutBox(getLayoutObjectByElementId("multicol")); |
| 491 | 491 |
| 492 FloatPoint mappedPoint = mapLocalToAncestor(target, flowThread, FloatPoint(1
0, 70)); | 492 FloatPoint mappedPoint = mapLocalToAncestor(target, flowThread, FloatPoint(1
0, 70)); |
| 493 EXPECT_EQ(FloatPoint(10, 70), mappedPoint); | 493 EXPECT_EQ(FloatPoint(10, 70), mappedPoint); |
| 494 | 494 |
| 495 mappedPoint = mapLocalToAncestor(flowThread, multicol, mappedPoint); | 495 mappedPoint = mapLocalToAncestor(flowThread, multicol, mappedPoint); |
| 496 EXPECT_EQ(FloatPoint(225, 25), mappedPoint); | 496 EXPECT_EQ(FloatPoint(225, 25), mappedPoint); |
| 497 | 497 |
| 498 mappedPoint = mapAncestorToLocal(flowThread, multicol, mappedPoint); | 498 mappedPoint = mapAncestorToLocal(flowThread, multicol, mappedPoint); |
| 499 EXPECT_EQ(FloatPoint(220, 20), mappedPoint); | 499 EXPECT_EQ(FloatPoint(220, 20), mappedPoint); |
| 500 | 500 |
| 501 mappedPoint = mapAncestorToLocal(target, flowThread, mappedPoint); | 501 mappedPoint = mapAncestorToLocal(target, flowThread, mappedPoint); |
| 502 EXPECT_EQ(FloatPoint(10, 70), mappedPoint); | 502 EXPECT_EQ(FloatPoint(10, 70), mappedPoint); |
| 503 } | 503 } |
| 504 | 504 |
| 505 TEST_F(MapCoordinatesTest, MulticolWithInline) | 505 TEST_F(MapCoordinatesTest, MulticolWithInline) |
| 506 { | 506 { |
| 507 setBodyInnerHTML( | 507 setBodyInnerHTML( |
| 508 "<div id='multicol' style='-webkit-columns:2; -webkit-column-gap:20px; w
idth:400px; line-height:50px; padding:5px;'>" | 508 "<div id='multicol' style='columns:2; column-gap:20px; width:400px; line
-height:50px; padding:5px; orphans:1; widows:1;'>" |
| 509 " <span id='target'><br>text</span>" | 509 " <span id='target'><br>text</span>" |
| 510 "</div>"); | 510 "</div>"); |
| 511 | 511 |
| 512 LayoutObject* target = getLayoutObjectByElementId("target"); | 512 LayoutObject* target = getLayoutObjectByElementId("target"); |
| 513 LayoutBox* flowThread = toLayoutBox(target->parent()); | 513 LayoutBox* flowThread = toLayoutBox(target->parent()); |
| 514 ASSERT_TRUE(flowThread->isLayoutFlowThread()); | 514 ASSERT_TRUE(flowThread->isLayoutFlowThread()); |
| 515 LayoutBox* multicol = toLayoutBox(getLayoutObjectByElementId("multicol")); | 515 LayoutBox* multicol = toLayoutBox(getLayoutObjectByElementId("multicol")); |
| 516 | 516 |
| 517 FloatPoint mappedPoint = mapLocalToAncestor(target, flowThread, FloatPoint(1
0, 70)); | 517 FloatPoint mappedPoint = mapLocalToAncestor(target, flowThread, FloatPoint(1
0, 70)); |
| 518 EXPECT_EQ(FloatPoint(10, 70), mappedPoint); | 518 EXPECT_EQ(FloatPoint(10, 70), mappedPoint); |
| (...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1169 | 1169 |
| 1170 // With child2, each rotation gets flattened and the end result is approxima
tely a 90-degree rotation. | 1170 // With child2, each rotation gets flattened and the end result is approxima
tely a 90-degree rotation. |
| 1171 matrix = child2->localToAbsoluteTransform(); | 1171 matrix = child2->localToAbsoluteTransform(); |
| 1172 EXPECT_NEAR(50.0, matrix.projectPoint(FloatPoint(100.0, 50.0)).x(), LayoutUn
it::epsilon()); | 1172 EXPECT_NEAR(50.0, matrix.projectPoint(FloatPoint(100.0, 50.0)).x(), LayoutUn
it::epsilon()); |
| 1173 EXPECT_NEAR(50.0, matrix.projectPoint(FloatPoint(100.0, 50.0)).y(), LayoutUn
it::epsilon()); | 1173 EXPECT_NEAR(50.0, matrix.projectPoint(FloatPoint(100.0, 50.0)).y(), LayoutUn
it::epsilon()); |
| 1174 EXPECT_NEAR(25.0, matrix.projectPoint(FloatPoint(50.0, 100.0)).x(), LayoutUn
it::epsilon()); | 1174 EXPECT_NEAR(25.0, matrix.projectPoint(FloatPoint(50.0, 100.0)).x(), LayoutUn
it::epsilon()); |
| 1175 EXPECT_NEAR(100.0, matrix.projectPoint(FloatPoint(50.0, 100.0)).y(), LayoutU
nit::epsilon()); | 1175 EXPECT_NEAR(100.0, matrix.projectPoint(FloatPoint(50.0, 100.0)).y(), LayoutU
nit::epsilon()); |
| 1176 } | 1176 } |
| 1177 | 1177 |
| 1178 } // namespace blink | 1178 } // namespace blink |
| OLD | NEW |