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

Side by Side Diff: third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm_test.cc

Issue 2847823002: Make leading OOF objects to be handled by block layout in LayoutNG (Closed)
Patch Set: Created 3 years, 7 months 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 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 )HTML"); 112 )HTML");
113 // ** Run LayoutNG algorithm ** 113 // ** Run LayoutNG algorithm **
114 RefPtr<NGConstraintSpace> space; 114 RefPtr<NGConstraintSpace> space;
115 RefPtr<NGPhysicalBoxFragment> html_fragment; 115 RefPtr<NGPhysicalBoxFragment> html_fragment;
116 std::tie(html_fragment, space) = RunBlockLayoutAlgorithmForElement( 116 std::tie(html_fragment, space) = RunBlockLayoutAlgorithmForElement(
117 GetDocument().getElementsByTagName("html")->item(0)); 117 GetDocument().getElementsByTagName("html")->item(0));
118 auto* body_fragment = 118 auto* body_fragment =
119 ToNGPhysicalBoxFragment(html_fragment->Children()[0].Get()); 119 ToNGPhysicalBoxFragment(html_fragment->Children()[0].Get());
120 auto* container_fragment = 120 auto* container_fragment =
121 ToNGPhysicalBoxFragment(body_fragment->Children()[0].Get()); 121 ToNGPhysicalBoxFragment(body_fragment->Children()[0].Get());
122 auto* span_box_fragments_wrapper =
123 ToNGPhysicalBoxFragment(container_fragment->Children()[0].Get());
122 auto* line_box_fragments_wrapper = 124 auto* line_box_fragments_wrapper =
123 ToNGPhysicalBoxFragment(container_fragment->Children()[0].Get()); 125 ToNGPhysicalBoxFragment(span_box_fragments_wrapper->Children()[0].Get());
124 Vector<NGPhysicalTextFragment*> text_fragments; 126 Vector<NGPhysicalTextFragment*> text_fragments;
125 for (const auto& child : line_box_fragments_wrapper->Children()) { 127 for (const auto& child : line_box_fragments_wrapper->Children()) {
126 auto* line_box = ToNGPhysicalLineBoxFragment(child.Get()); 128 auto* line_box = ToNGPhysicalLineBoxFragment(child.Get());
127 EXPECT_EQ(1u, line_box->Children().size()); 129 EXPECT_EQ(1u, line_box->Children().size());
128 for (const auto& text : line_box->Children()) 130 for (const auto& text : line_box->Children())
129 text_fragments.push_back(ToNGPhysicalTextFragment(text.Get())); 131 text_fragments.push_back(ToNGPhysicalTextFragment(text.Get()));
130 } 132 }
131 133
132 LayoutText* layout_text = 134 LayoutText* layout_text =
133 ToLayoutText(GetLayoutObjectByElementId("text")->SlowFirstChild()); 135 ToLayoutText(GetLayoutObjectByElementId("text")->SlowFirstChild());
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 ToLayoutText(GetLayoutObjectByElementId("text")->SlowFirstChild()); 296 ToLayoutText(GetLayoutObjectByElementId("text")->SlowFirstChild());
295 DCHECK(layout_text->HasTextBoxes()); 297 DCHECK(layout_text->HasTextBoxes());
296 298
297 InlineTextBox* inline_text_box1 = layout_text->FirstTextBox(); 299 InlineTextBox* inline_text_box1 = layout_text->FirstTextBox();
298 // 45 = sum of left's inline margins: 40 + left's width: 5 300 // 45 = sum of left's inline margins: 40 + left's width: 5
299 EXPECT_EQ(LayoutUnit(45), inline_text_box1->X()); 301 EXPECT_EQ(LayoutUnit(45), inline_text_box1->X());
300 } 302 }
301 303
302 } // namespace 304 } // namespace
303 } // namespace blink 305 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698