| 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 #ifndef NGLineBreaker_h | 5 #ifndef NGLineBreaker_h |
| 6 #define NGLineBreaker_h | 6 #define NGLineBreaker_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "core/layout/ng/inline/ng_inline_item_result.h" | 9 #include "core/layout/ng/inline/ng_inline_item_result.h" |
| 10 #include "core/layout/ng/inline/ng_inline_node.h" |
| 10 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
| 11 #include "platform/text/TextBreakIterator.h" | 12 #include "platform/text/TextBreakIterator.h" |
| 12 #include "platform/wtf/Allocator.h" | 13 #include "platform/wtf/Allocator.h" |
| 13 #include "platform/wtf/text/AtomicString.h" | 14 #include "platform/wtf/text/AtomicString.h" |
| 14 | 15 |
| 15 namespace blink { | 16 namespace blink { |
| 16 | 17 |
| 17 class NGInlineBreakToken; | 18 class NGInlineBreakToken; |
| 18 class NGInlineItem; | 19 class NGInlineItem; |
| 19 class NGInlineNode; | 20 class NGInlineNode; |
| 20 class NGInlineLayoutAlgorithm; | 21 class NGInlineLayoutAlgorithm; |
| 21 | 22 |
| 22 // Represents a line breaker. | 23 // Represents a line breaker. |
| 23 // | 24 // |
| 24 // This class measures each NGInlineItem and determines items to form a line, | 25 // This class measures each NGInlineItem and determines items to form a line, |
| 25 // so that NGInlineLayoutAlgorithm can build a line box from the output. | 26 // so that NGInlineLayoutAlgorithm can build a line box from the output. |
| 26 class CORE_EXPORT NGLineBreaker { | 27 class CORE_EXPORT NGLineBreaker { |
| 27 public: | 28 public: |
| 28 NGLineBreaker(NGInlineNode*, | 29 NGLineBreaker(NGInlineNode, |
| 29 const NGConstraintSpace*, | 30 const NGConstraintSpace*, |
| 30 NGInlineBreakToken* = nullptr); | 31 NGInlineBreakToken* = nullptr); |
| 31 ~NGLineBreaker() {} | 32 ~NGLineBreaker() {} |
| 32 STACK_ALLOCATED(); | 33 STACK_ALLOCATED(); |
| 33 | 34 |
| 34 // Compute the next line break point and produces NGInlineItemResults for | 35 // Compute the next line break point and produces NGInlineItemResults for |
| 35 // the line. | 36 // the line. |
| 36 // TODO(kojii): NGInlineLayoutAlgorithm is needed because floats require | 37 // TODO(kojii): NGInlineLayoutAlgorithm is needed because floats require |
| 37 // not only constraint space but also container builder. Consider refactor | 38 // not only constraint space but also container builder. Consider refactor |
| 38 // not to require algorithm. | 39 // not to require algorithm. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 72 |
| 72 void HandleOverflow(NGInlineItemResults*); | 73 void HandleOverflow(NGInlineItemResults*); |
| 73 void Rewind(NGInlineItemResults*, unsigned new_end); | 74 void Rewind(NGInlineItemResults*, unsigned new_end); |
| 74 | 75 |
| 75 void UpdateBreakIterator(const ComputedStyle&); | 76 void UpdateBreakIterator(const ComputedStyle&); |
| 76 | 77 |
| 77 void MoveToNextOf(const NGInlineItem&); | 78 void MoveToNextOf(const NGInlineItem&); |
| 78 void MoveToNextOf(const NGInlineItemResult&); | 79 void MoveToNextOf(const NGInlineItemResult&); |
| 79 void SkipCollapsibleWhitespaces(); | 80 void SkipCollapsibleWhitespaces(); |
| 80 | 81 |
| 81 Persistent<NGInlineNode> node_; | 82 NGInlineNode node_; |
| 82 const NGConstraintSpace* constraint_space_; | 83 const NGConstraintSpace* constraint_space_; |
| 83 const AtomicString locale_; | 84 const AtomicString locale_; |
| 84 unsigned item_index_; | 85 unsigned item_index_; |
| 85 unsigned offset_; | 86 unsigned offset_; |
| 86 LayoutUnit available_width_; | 87 LayoutUnit available_width_; |
| 87 LayoutUnit position_; | 88 LayoutUnit position_; |
| 88 LazyLineBreakIterator break_iterator_; | 89 LazyLineBreakIterator break_iterator_; |
| 89 | 90 |
| 90 unsigned auto_wrap_ : 1; | 91 unsigned auto_wrap_ : 1; |
| 91 }; | 92 }; |
| 92 | 93 |
| 93 } // namespace blink | 94 } // namespace blink |
| 94 | 95 |
| 95 #endif // NGLineBreaker_h | 96 #endif // NGLineBreaker_h |
| OLD | NEW |