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

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

Issue 2721613003: [LayoutNG] Move remaining ng_units structs to their own files (Closed)
Patch Set: Don't export NGBoxStrut for now Created 3 years, 9 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/LayoutBlockFlow.h" 7 #include "core/layout/LayoutBlockFlow.h"
8 #include "core/layout/LayoutObject.h" 8 #include "core/layout/LayoutObject.h"
9 #include "core/layout/LayoutText.h" 9 #include "core/layout/LayoutText.h"
10 #include "core/layout/ng/ng_bidi_paragraph.h" 10 #include "core/layout/ng/ng_bidi_paragraph.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 NGLineBuilder* line_builder) { 255 NGLineBuilder* line_builder) {
256 if (!IsPrepareLayoutFinished()) 256 if (!IsPrepareLayoutFinished())
257 PrepareLayout(); 257 PrepareLayout();
258 258
259 if (text_content_.isEmpty()) 259 if (text_content_.isEmpty())
260 return; 260 return;
261 261
262 NGTextLayoutAlgorithm(this, constraint_space).LayoutInline(line_builder); 262 NGTextLayoutAlgorithm(this, constraint_space).LayoutInline(line_builder);
263 } 263 }
264 264
265 MinAndMaxContentSizes NGInlineNode::ComputeMinAndMaxContentSizes() { 265 MinMaxContentSize NGInlineNode::ComputeMinMaxContentSize() {
266 // Compute the max of inline sizes of all line boxes with 0 available inline 266 // Compute the max of inline sizes of all line boxes with 0 available inline
267 // size. This gives the min-content, the width where lines wrap at every break 267 // size. This gives the min-content, the width where lines wrap at every break
268 // opportunity. 268 // opportunity.
269 NGWritingMode writing_mode = 269 NGWritingMode writing_mode =
270 FromPlatformWritingMode(BlockStyle()->getWritingMode()); 270 FromPlatformWritingMode(BlockStyle()->getWritingMode());
271 NGConstraintSpace* constraint_space = 271 NGConstraintSpace* constraint_space =
272 NGConstraintSpaceBuilder(writing_mode) 272 NGConstraintSpaceBuilder(writing_mode)
273 .SetTextDirection(BlockStyle()->direction()) 273 .SetTextDirection(BlockStyle()->direction())
274 .SetAvailableSize({LayoutUnit(), NGSizeIndefinite}) 274 .SetAvailableSize({LayoutUnit(), NGSizeIndefinite})
275 .ToConstraintSpace(writing_mode); 275 .ToConstraintSpace(writing_mode);
276 NGLineBuilder line_builder(this, constraint_space); 276 NGLineBuilder line_builder(this, constraint_space);
277 LayoutInline(constraint_space, &line_builder); 277 LayoutInline(constraint_space, &line_builder);
278 MinAndMaxContentSizes sizes; 278 MinMaxContentSize sizes;
279 sizes.min_content = line_builder.MaxInlineSize(); 279 sizes.min_content = line_builder.MaxInlineSize();
280 280
281 // max-content is the width without any line wrapping. 281 // max-content is the width without any line wrapping.
282 // TODO(kojii): Implement hard breaks (<br> etc.) to break. 282 // TODO(kojii): Implement hard breaks (<br> etc.) to break.
283 for (const auto& item : items_) 283 for (const auto& item : items_)
284 sizes.max_content += item.InlineSize(); 284 sizes.max_content += item.InlineSize();
285 285
286 return sizes; 286 return sizes;
287 } 287 }
288 288
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 Vector<NGLayoutInlineItem>* items, 354 Vector<NGLayoutInlineItem>* items,
355 unsigned start_index, 355 unsigned start_index,
356 unsigned end_index) 356 unsigned end_index)
357 : start_item_(&(*items)[start_index]), 357 : start_item_(&(*items)[start_index]),
358 size_(end_index - start_index), 358 size_(end_index - start_index),
359 start_index_(start_index) { 359 start_index_(start_index) {
360 RELEASE_ASSERT(start_index <= end_index && end_index <= items->size()); 360 RELEASE_ASSERT(start_index <= end_index && end_index <= items->size());
361 } 361 }
362 362
363 } // namespace blink 363 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698