| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/ng/ng_base_layout_algorithm_test.h" | 5 #include "core/layout/ng/ng_base_layout_algorithm_test.h" |
| 6 | 6 |
| 7 #include "core/dom/TagCollection.h" | 7 #include "core/dom/TagCollection.h" |
| 8 #include "core/layout/line/InlineTextBox.h" | 8 #include "core/layout/line/InlineTextBox.h" |
| 9 #include "core/layout/ng/inline/ng_inline_node.h" | 9 #include "core/layout/ng/inline/ng_inline_node.h" |
| 10 #include "core/layout/ng/inline/ng_physical_line_box_fragment.h" | 10 #include "core/layout/ng/inline/ng_physical_line_box_fragment.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 )HTML"); | 137 )HTML"); |
| 138 // ** Run LayoutNG algorithm ** | 138 // ** Run LayoutNG algorithm ** |
| 139 RefPtr<NGConstraintSpace> space; | 139 RefPtr<NGConstraintSpace> space; |
| 140 RefPtr<NGPhysicalBoxFragment> html_fragment; | 140 RefPtr<NGPhysicalBoxFragment> html_fragment; |
| 141 std::tie(html_fragment, space) = RunBlockLayoutAlgorithmForElement( | 141 std::tie(html_fragment, space) = RunBlockLayoutAlgorithmForElement( |
| 142 GetDocument().getElementsByTagName("html")->item(0)); | 142 GetDocument().getElementsByTagName("html")->item(0)); |
| 143 auto* body_fragment = | 143 auto* body_fragment = |
| 144 ToNGPhysicalBoxFragment(html_fragment->Children()[0].Get()); | 144 ToNGPhysicalBoxFragment(html_fragment->Children()[0].Get()); |
| 145 auto* container_fragment = | 145 auto* container_fragment = |
| 146 ToNGPhysicalBoxFragment(body_fragment->Children()[0].Get()); | 146 ToNGPhysicalBoxFragment(body_fragment->Children()[0].Get()); |
| 147 auto* span_box_fragments_wrapper = |
| 148 ToNGPhysicalBoxFragment(container_fragment->Children()[0].Get()); |
| 147 auto* line_box_fragments_wrapper = | 149 auto* line_box_fragments_wrapper = |
| 148 ToNGPhysicalBoxFragment(container_fragment->Children()[0].Get()); | 150 ToNGPhysicalBoxFragment(span_box_fragments_wrapper->Children()[0].Get()); |
| 149 Vector<NGPhysicalTextFragment*> text_fragments; | 151 Vector<NGPhysicalTextFragment*> text_fragments; |
| 150 for (const auto& child : line_box_fragments_wrapper->Children()) { | 152 for (const auto& child : line_box_fragments_wrapper->Children()) { |
| 151 auto* line_box = ToNGPhysicalLineBoxFragment(child.Get()); | 153 auto* line_box = ToNGPhysicalLineBoxFragment(child.Get()); |
| 152 EXPECT_EQ(1u, line_box->Children().size()); | 154 EXPECT_EQ(1u, line_box->Children().size()); |
| 153 for (const auto& text : line_box->Children()) | 155 for (const auto& text : line_box->Children()) |
| 154 text_fragments.push_back(ToNGPhysicalTextFragment(text.Get())); | 156 text_fragments.push_back(ToNGPhysicalTextFragment(text.Get())); |
| 155 } | 157 } |
| 156 | 158 |
| 157 LayoutText* layout_text = | 159 LayoutText* layout_text = |
| 158 ToLayoutText(GetLayoutObjectByElementId("text")->SlowFirstChild()); | 160 ToLayoutText(GetLayoutObjectByElementId("text")->SlowFirstChild()); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 ToLayoutText(GetLayoutObjectByElementId("text")->SlowFirstChild()); | 321 ToLayoutText(GetLayoutObjectByElementId("text")->SlowFirstChild()); |
| 320 DCHECK(layout_text->HasTextBoxes()); | 322 DCHECK(layout_text->HasTextBoxes()); |
| 321 | 323 |
| 322 InlineTextBox* inline_text_box1 = layout_text->FirstTextBox(); | 324 InlineTextBox* inline_text_box1 = layout_text->FirstTextBox(); |
| 323 // 45 = sum of left's inline margins: 40 + left's width: 5 | 325 // 45 = sum of left's inline margins: 40 + left's width: 5 |
| 324 EXPECT_EQ(LayoutUnit(45), inline_text_box1->X()); | 326 EXPECT_EQ(LayoutUnit(45), inline_text_box1->X()); |
| 325 } | 327 } |
| 326 | 328 |
| 327 } // namespace | 329 } // namespace |
| 328 } // namespace blink | 330 } // namespace blink |
| OLD | NEW |