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

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

Issue 2931563002: [LayoutNG] Implement 'text-align-last' (Closed)
Patch Set: Rebase Created 3 years, 6 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/inline/ng_inline_node.h" 5 #include "core/layout/ng/inline/ng_inline_node.h"
6 6
7 #include "core/layout/BidiRun.h" 7 #include "core/layout/BidiRun.h"
8 #include "core/layout/LayoutBlockFlow.h" 8 #include "core/layout/LayoutBlockFlow.h"
9 #include "core/layout/LayoutObject.h" 9 #include "core/layout/LayoutObject.h"
10 #include "core/layout/LayoutText.h" 10 #include "core/layout/LayoutText.h"
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 const ComputedStyle& style = node.Style(); 352 const ComputedStyle& style = node.Style();
353 NGWritingMode writing_mode = FromPlatformWritingMode(style.GetWritingMode()); 353 NGWritingMode writing_mode = FromPlatformWritingMode(style.GetWritingMode());
354 354
355 RefPtr<NGConstraintSpace> space = 355 RefPtr<NGConstraintSpace> space =
356 NGConstraintSpaceBuilder(writing_mode) 356 NGConstraintSpaceBuilder(writing_mode)
357 .SetTextDirection(style.Direction()) 357 .SetTextDirection(style.Direction())
358 .SetAvailableSize({available_inline_size, NGSizeIndefinite}) 358 .SetAvailableSize({available_inline_size, NGSizeIndefinite})
359 .ToConstraintSpace(writing_mode); 359 .ToConstraintSpace(writing_mode);
360 NGLineBreaker line_breaker(node, space.Get()); 360 NGLineBreaker line_breaker(node, space.Get());
361 NGInlineLayoutAlgorithm algorithm(node, space.Get()); 361 NGInlineLayoutAlgorithm algorithm(node, space.Get());
362 NGInlineItemResults item_results; 362 NGLineInfo line_info;
363 LayoutUnit result; 363 LayoutUnit result;
364 while (true) { 364 while (line_breaker.NextLine(&line_info, &algorithm)) {
365 line_breaker.NextLine(&item_results, &algorithm);
366 if (item_results.IsEmpty())
367 break;
368 LayoutUnit inline_size; 365 LayoutUnit inline_size;
369 for (const NGInlineItemResult item_result : item_results) 366 for (const NGInlineItemResult item_result : line_info.Results())
370 inline_size += item_result.inline_size; 367 inline_size += item_result.inline_size;
371 if (mode == ContentSizeMode::Max) { 368 if (mode == ContentSizeMode::Max) {
372 result = std::max(inline_size, result); 369 result = std::max(inline_size, result);
373 } else { 370 } else {
374 result += inline_size; 371 result += inline_size;
375 } 372 }
376 item_results.clear();
377 } 373 }
378 return result; 374 return result;
379 } 375 }
380 376
381 MinMaxContentSize NGInlineNode::ComputeMinMaxContentSize() { 377 MinMaxContentSize NGInlineNode::ComputeMinMaxContentSize() {
382 // TODO(kojii): Invalidate PrepareLayout() more efficiently. 378 // TODO(kojii): Invalidate PrepareLayout() more efficiently.
383 InvalidatePrepareLayout(); 379 InvalidatePrepareLayout();
384 PrepareLayout(); 380 PrepareLayout();
385 381
386 // Run line breaking with 0 and indefinite available width. 382 // Run line breaking with 0 and indefinite available width.
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 item.Style() == item.GetLayoutObject()->Style()); 515 item.Style() == item.GetLayoutObject()->Style());
520 } 516 }
521 #endif 517 #endif
522 } 518 }
523 519
524 String NGInlineNode::ToString() const { 520 String NGInlineNode::ToString() const {
525 return String::Format("NGInlineNode"); 521 return String::Format("NGInlineNode");
526 } 522 }
527 523
528 } // namespace blink 524 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698