OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "core/layout/line/InlineBox.h" |
| 6 |
| 7 #include "core/layout/LayoutBlockFlow.h" |
| 8 #include "core/layout/LayoutTestHelper.h" |
| 9 |
| 10 namespace blink { |
| 11 |
| 12 using InlineBoxTest = RenderingTest; |
| 13 |
| 14 TEST_F(InlineBoxTest, LogicalRectToPhysicalRectNormal) { |
| 15 setBodyInnerHTML( |
| 16 "<div id='div' style='width: 80px; height: 50px'>Test</div>"); |
| 17 LayoutBlockFlow* div = toLayoutBlockFlow(getLayoutObjectByElementId("div")); |
| 18 InlineBox* inlineBox = div->firstLineBox(); |
| 19 LayoutRect rect(11, 22, 33, 44); |
| 20 inlineBox->logicalRectToPhysicalRect(rect); |
| 21 EXPECT_EQ(LayoutRect(11, 22, 33, 44), rect); |
| 22 } |
| 23 |
| 24 TEST_F(InlineBoxTest, LogicalRectToPhysicalRectVerticalRL) { |
| 25 setBodyInnerHTML( |
| 26 "<div id='div' " |
| 27 "style='writing-mode:vertical-rl; width: 80px; height: 50px'>Test</div>"); |
| 28 LayoutBlockFlow* div = toLayoutBlockFlow(getLayoutObjectByElementId("div")); |
| 29 InlineBox* inlineBox = div->firstLineBox(); |
| 30 LayoutRect rect(11, 22, 33, 44); |
| 31 inlineBox->logicalRectToPhysicalRect(rect); |
| 32 EXPECT_EQ(LayoutRect(14, 11, 44, 33), rect); |
| 33 } |
| 34 |
| 35 TEST_F(InlineBoxTest, LogicalRectToPhysicalRectVerticalLR) { |
| 36 setBodyInnerHTML( |
| 37 "<div id='div' " |
| 38 "style='writing-mode:vertical-lr; width: 80px; height: 50px'>Test</div>"); |
| 39 LayoutBlockFlow* div = toLayoutBlockFlow(getLayoutObjectByElementId("div")); |
| 40 InlineBox* inlineBox = div->firstLineBox(); |
| 41 LayoutRect rect(11, 22, 33, 44); |
| 42 inlineBox->logicalRectToPhysicalRect(rect); |
| 43 EXPECT_EQ(LayoutRect(22, 11, 44, 33), rect); |
| 44 } |
| 45 |
| 46 } // namespace blink |
OLD | NEW |