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 "core/layout/ng/inline/ng_inline_node.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 // Represents a line breaker. | 26 // Represents a line breaker. |
27 // | 27 // |
28 // This class measures each NGInlineItem and determines items to form a line, | 28 // This class measures each NGInlineItem and determines items to form a line, |
29 // so that NGInlineLayoutAlgorithm can build a line box from the output. | 29 // so that NGInlineLayoutAlgorithm can build a line box from the output. |
30 class CORE_EXPORT NGLineBreaker { | 30 class CORE_EXPORT NGLineBreaker { |
31 public: | 31 public: |
32 NGLineBreaker(NGInlineNode, | 32 NGLineBreaker(NGInlineNode, |
33 NGConstraintSpace*, | 33 NGConstraintSpace*, |
34 NGFragmentBuilder*, | 34 NGFragmentBuilder*, |
| 35 Vector<RefPtr<NGUnpositionedFloat>>*, |
35 const NGInlineBreakToken* = nullptr); | 36 const NGInlineBreakToken* = nullptr); |
36 ~NGLineBreaker() {} | 37 ~NGLineBreaker() {} |
37 STACK_ALLOCATED(); | 38 STACK_ALLOCATED(); |
38 | 39 |
39 // Compute the next line break point and produces NGInlineItemResults for | 40 // Compute the next line break point and produces NGInlineItemResults for |
40 // the line. | 41 // the line. |
41 bool NextLine(NGLineInfo*, const NGLogicalOffset&); | 42 bool NextLine(NGLineInfo*, const NGLogicalOffset&); |
42 | 43 |
43 // Create an NGInlineBreakToken for the last line returned by NextLine(). | 44 // Create an NGInlineBreakToken for the last line returned by NextLine(). |
44 RefPtr<NGInlineBreakToken> CreateBreakToken() const; | 45 RefPtr<NGInlineBreakToken> CreateBreakToken() const; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 90 |
90 void MoveToNextOf(const NGInlineItem&); | 91 void MoveToNextOf(const NGInlineItem&); |
91 void MoveToNextOf(const NGInlineItemResult&); | 92 void MoveToNextOf(const NGInlineItemResult&); |
92 void SkipCollapsibleWhitespaces(); | 93 void SkipCollapsibleWhitespaces(); |
93 | 94 |
94 bool IsFirstFormattedLine() const; | 95 bool IsFirstFormattedLine() const; |
95 | 96 |
96 NGInlineNode node_; | 97 NGInlineNode node_; |
97 NGConstraintSpace* constraint_space_; | 98 NGConstraintSpace* constraint_space_; |
98 NGFragmentBuilder* container_builder_; | 99 NGFragmentBuilder* container_builder_; |
| 100 Vector<RefPtr<NGUnpositionedFloat>>* unpositioned_floats_; |
99 const AtomicString locale_; | 101 const AtomicString locale_; |
100 unsigned item_index_; | 102 unsigned item_index_; |
101 unsigned offset_; | 103 unsigned offset_; |
102 LayoutUnit position_; | 104 LayoutUnit position_; |
103 WTF::Optional<NGLayoutOpportunity> opportunity_; | 105 WTF::Optional<NGLayoutOpportunity> opportunity_; |
104 NGLogicalOffset content_offset_; | 106 NGLogicalOffset content_offset_; |
105 LazyLineBreakIterator break_iterator_; | 107 LazyLineBreakIterator break_iterator_; |
106 HarfBuzzShaper shaper_; | 108 HarfBuzzShaper shaper_; |
107 ShapeResultSpacing<String> spacing_; | 109 ShapeResultSpacing<String> spacing_; |
108 | 110 |
109 bool auto_wrap_; | 111 bool auto_wrap_; |
110 bool break_if_overflow_; | 112 bool break_if_overflow_; |
111 | 113 |
112 // We don't create "certain zero-height line boxes". | 114 // We don't create "certain zero-height line boxes". |
113 // https://drafts.csswg.org/css2/visuren.html#phantom-line-box | 115 // https://drafts.csswg.org/css2/visuren.html#phantom-line-box |
114 // Such line boxes do not prevent two margins being "adjoining", and thus | 116 // Such line boxes do not prevent two margins being "adjoining", and thus |
115 // collapsing. | 117 // collapsing. |
116 // https://drafts.csswg.org/css2/box.html#collapsing-margins | 118 // https://drafts.csswg.org/css2/box.html#collapsing-margins |
117 bool should_create_line_box_; | 119 bool should_create_line_box_; |
118 | 120 |
119 bool is_after_forced_break_; | 121 bool is_after_forced_break_; |
120 }; | 122 }; |
121 | 123 |
122 } // namespace blink | 124 } // namespace blink |
123 | 125 |
124 #endif // NGLineBreaker_h | 126 #endif // NGLineBreaker_h |
OLD | NEW |