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

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

Issue 2692403003: [LayoutNG] Make NGBlockLayoutAlgorithm accept a NGBlockNode. (Closed)
Patch Set: comments! Created 3 years, 10 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 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/ng/ng_inline_node.h" 5 #include "core/layout/ng/ng_inline_node.h"
6 6
7 #include "core/layout/ng/ng_constraint_space.h" 7 #include "core/layout/ng/ng_constraint_space.h"
8 #include "core/layout/ng/ng_constraint_space_builder.h" 8 #include "core/layout/ng/ng_constraint_space_builder.h"
9 #include "core/layout/ng/ng_fragment_builder.h" 9 #include "core/layout/ng/ng_fragment_builder.h"
10 #include "core/layout/ng/ng_line_builder.h" 10 #include "core/layout/ng/ng_line_builder.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 void CreateLine(NGInlineNode* node, 66 void CreateLine(NGInlineNode* node,
67 Vector<RefPtr<const NGPhysicalTextFragment>>* fragments_out) { 67 Vector<RefPtr<const NGPhysicalTextFragment>>* fragments_out) {
68 NGConstraintSpace* constraint_space = 68 NGConstraintSpace* constraint_space =
69 NGConstraintSpaceBuilder(kHorizontalTopBottom) 69 NGConstraintSpaceBuilder(kHorizontalTopBottom)
70 .ToConstraintSpace(kHorizontalTopBottom); 70 .ToConstraintSpace(kHorizontalTopBottom);
71 NGLineBuilder line_builder(node, constraint_space); 71 NGLineBuilder line_builder(node, constraint_space);
72 72
73 NGTextLayoutAlgorithm algorithm(node, constraint_space); 73 NGTextLayoutAlgorithm algorithm(node, constraint_space);
74 algorithm.LayoutInline(&line_builder); 74 algorithm.LayoutInline(&line_builder);
75 75
76 NGFragmentBuilder fragment_builder(NGPhysicalFragment::kFragmentBox, 76 NGFragmentBuilder fragment_builder(NGPhysicalFragment::kFragmentBox, node);
77 /* layout_object */ nullptr);
78 line_builder.CreateFragments(&fragment_builder); 77 line_builder.CreateFragments(&fragment_builder);
79 RefPtr<NGPhysicalBoxFragment> fragment = fragment_builder.ToBoxFragment(); 78 RefPtr<NGPhysicalBoxFragment> fragment = fragment_builder.ToBoxFragment();
80 for (const auto& child : fragment->Children()) { 79 for (const auto& child : fragment->Children()) {
81 fragments_out->push_back(toNGPhysicalTextFragment(child.get())); 80 fragments_out->push_back(toNGPhysicalTextFragment(child.get()));
82 } 81 }
83 } 82 }
84 83
85 RefPtr<ComputedStyle> style_; 84 RefPtr<ComputedStyle> style_;
86 }; 85 };
87 86
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 CreateLine(node, &fragments); 192 CreateLine(node, &fragments);
194 ASSERT_EQ(5u, fragments.size()); 193 ASSERT_EQ(5u, fragments.size());
195 TEST_TEXT_FRAGMENT(fragments[0], node, 0u, 0u, 6u, TextDirection::kLtr); 194 TEST_TEXT_FRAGMENT(fragments[0], node, 0u, 0u, 6u, TextDirection::kLtr);
196 TEST_TEXT_FRAGMENT(fragments[1], node, 6u, 16u, 21u, TextDirection::kRtl); 195 TEST_TEXT_FRAGMENT(fragments[1], node, 6u, 16u, 21u, TextDirection::kRtl);
197 TEST_TEXT_FRAGMENT(fragments[2], node, 4u, 14u, 15u, TextDirection::kLtr); 196 TEST_TEXT_FRAGMENT(fragments[2], node, 4u, 14u, 15u, TextDirection::kLtr);
198 TEST_TEXT_FRAGMENT(fragments[3], node, 2u, 7u, 13u, TextDirection::kRtl); 197 TEST_TEXT_FRAGMENT(fragments[3], node, 2u, 7u, 13u, TextDirection::kRtl);
199 TEST_TEXT_FRAGMENT(fragments[4], node, 8u, 22u, 28u, TextDirection::kLtr); 198 TEST_TEXT_FRAGMENT(fragments[4], node, 8u, 22u, 28u, TextDirection::kLtr);
200 } 199 }
201 200
202 } // namespace blink 201 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698