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/line/InlineTextBox.h" | 5 #include "core/layout/line/InlineTextBox.h" |
6 | 6 |
7 #include "core/layout/LayoutTestHelper.h" | 7 #include "core/layout/LayoutTestHelper.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 class InlineTextBoxTest : public RenderingTest { | 12 class InlineTextBoxTest : public RenderingTest { |
13 }; | 13 }; |
14 | 14 |
15 class TestInlineTextBox : public InlineTextBox { | 15 class TestInlineTextBox : public InlineTextBox { |
16 public: | 16 public: |
17 TestInlineTextBox(LineLayoutItem item) | 17 TestInlineTextBox(LineLayoutItem item) |
18 : InlineTextBox(item, 0, 0) | 18 : InlineTextBox(item, 0, 0) |
19 { | 19 { |
20 setHasVirtualLogicalHeight(); | 20 setHasVirtualLogicalHeight(); |
21 } | 21 } |
22 | 22 |
23 static TestInlineTextBox* create(Document& document, const String& string) | 23 static TestInlineTextBox* create(Document& document, const String& string) |
24 { | 24 { |
25 Text* node = document.createTextNode(string); | 25 Text* node = document.createTextNode(string); |
26 LayoutText* text = new LayoutText(node, string.impl()); | 26 LayoutText* text = new LayoutText(node, string.impl()); |
| 27 text->setStyle(ComputedStyle::create()); |
27 return new TestInlineTextBox(LineLayoutItem(text)); | 28 return new TestInlineTextBox(LineLayoutItem(text)); |
28 } | 29 } |
29 | 30 |
30 LayoutUnit virtualLogicalHeight() const override | 31 LayoutUnit virtualLogicalHeight() const override |
31 { | 32 { |
32 return m_logicalHeight; | 33 return m_logicalHeight; |
33 } | 34 } |
34 | 35 |
35 void setLogicalFrameRect(const LayoutRect& rect) | 36 void setLogicalFrameRect(const LayoutRect& rect) |
36 { | 37 { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 overflow.expand(LayoutSize(10, 10)); | 82 overflow.expand(LayoutSize(10, 10)); |
82 box->setLogicalOverflowRect(overflow); | 83 box->setLogicalOverflowRect(overflow); |
83 ASSERT_EQ(frame, box->logicalFrameRect()); | 84 ASSERT_EQ(frame, box->logicalFrameRect()); |
84 ASSERT_EQ(overflow, box->logicalOverflowRect()); | 85 ASSERT_EQ(overflow, box->logicalOverflowRect()); |
85 | 86 |
86 // Ensure it's still movable correctly. | 87 // Ensure it's still movable correctly. |
87 moveAndTest(box, move, frame, overflow); | 88 moveAndTest(box, move, frame, overflow); |
88 } | 89 } |
89 | 90 |
90 } // namespace blink | 91 } // namespace blink |
OLD | NEW |