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 "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
10 #include "platform/wtf/text/AtomicString.h" | 11 #include "platform/wtf/text/AtomicString.h" |
11 | 12 |
12 namespace blink { | 13 namespace blink { |
13 | 14 |
| 15 class LazyLineBreakIterator; |
| 16 class NGInlineBreakToken; |
| 17 class NGInlineItem; |
| 18 class NGInlineNode; |
14 class NGInlineLayoutAlgorithm; | 19 class NGInlineLayoutAlgorithm; |
15 | 20 |
16 // Represents a line breaker. | 21 // Represents a line breaker. |
17 class CORE_EXPORT NGLineBreaker { | 22 class CORE_EXPORT NGLineBreaker { |
18 public: | 23 public: |
19 NGLineBreaker(const AtomicString locale) : locale_(locale) {} | 24 NGLineBreaker(NGInlineNode*, |
| 25 NGConstraintSpace*, |
| 26 NGInlineBreakToken* = nullptr); |
20 ~NGLineBreaker() {} | 27 ~NGLineBreaker() {} |
21 STACK_ALLOCATED(); | 28 STACK_ALLOCATED(); |
22 | 29 |
23 void BreakLines(NGInlineLayoutAlgorithm*, const String&, unsigned); | 30 // Compute the next line break point and produces NGInlineItemResults for |
| 31 // the line. |
| 32 void NextLine(NGInlineItemResults*, NGInlineLayoutAlgorithm*); |
| 33 |
| 34 // Create an NGInlineBreakToken for the last line returned by NextLine(). |
| 35 RefPtr<NGInlineBreakToken> CreateBreakToken() const; |
24 | 36 |
25 private: | 37 private: |
| 38 void LayoutAtomicInline(const NGInlineItem&, NGInlineItemResult*); |
| 39 |
| 40 void HandleOverflow(NGInlineItemResults*, const LazyLineBreakIterator&); |
| 41 |
| 42 void SkipCollapsibleWhitespaces(); |
| 43 |
| 44 Persistent<NGInlineNode> node_; |
| 45 const NGConstraintSpace* constraint_space_; |
26 const AtomicString locale_; | 46 const AtomicString locale_; |
| 47 unsigned item_index_; |
| 48 unsigned offset_; |
27 }; | 49 }; |
28 | 50 |
29 } // namespace blink | 51 } // namespace blink |
30 | 52 |
31 #endif // NGLineBreaker_h | 53 #endif // NGLineBreaker_h |
OLD | NEW |