| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 88 |
| 88 void MoveToNextOf(const NGInlineItem&); | 89 void MoveToNextOf(const NGInlineItem&); |
| 89 void MoveToNextOf(const NGInlineItemResult&); | 90 void MoveToNextOf(const NGInlineItemResult&); |
| 90 void SkipCollapsibleWhitespaces(); | 91 void SkipCollapsibleWhitespaces(); |
| 91 | 92 |
| 92 bool IsFirstFormattedLine() const; | 93 bool IsFirstFormattedLine() const; |
| 93 | 94 |
| 94 NGInlineNode node_; | 95 NGInlineNode node_; |
| 95 NGConstraintSpace* constraint_space_; | 96 NGConstraintSpace* constraint_space_; |
| 96 NGFragmentBuilder* container_builder_; | 97 NGFragmentBuilder* container_builder_; |
| 98 Vector<RefPtr<NGUnpositionedFloat>>* unpositioned_floats_; |
| 97 const AtomicString locale_; | 99 const AtomicString locale_; |
| 98 unsigned item_index_; | 100 unsigned item_index_; |
| 99 unsigned offset_; | 101 unsigned offset_; |
| 100 LayoutUnit position_; | 102 LayoutUnit position_; |
| 101 WTF::Optional<NGLayoutOpportunity> opportunity_; | 103 WTF::Optional<NGLayoutOpportunity> opportunity_; |
| 102 NGLogicalOffset content_offset_; | 104 NGLogicalOffset content_offset_; |
| 103 LazyLineBreakIterator break_iterator_; | 105 LazyLineBreakIterator break_iterator_; |
| 104 HarfBuzzShaper shaper_; | 106 HarfBuzzShaper shaper_; |
| 105 ShapeResultSpacing<String> spacing_; | 107 ShapeResultSpacing<String> spacing_; |
| 106 | 108 |
| 107 bool auto_wrap_; | 109 bool auto_wrap_; |
| 108 bool break_if_overflow_; | 110 bool break_if_overflow_; |
| 109 | 111 |
| 110 // We don't create "certain zero-height line boxes". | 112 // We don't create "certain zero-height line boxes". |
| 111 // https://drafts.csswg.org/css2/visuren.html#phantom-line-box | 113 // https://drafts.csswg.org/css2/visuren.html#phantom-line-box |
| 112 // Such line boxes do not prevent two margins being "adjoining", and thus | 114 // Such line boxes do not prevent two margins being "adjoining", and thus |
| 113 // collapsing. | 115 // collapsing. |
| 114 // https://drafts.csswg.org/css2/box.html#collapsing-margins | 116 // https://drafts.csswg.org/css2/box.html#collapsing-margins |
| 115 bool should_create_line_box_; | 117 bool should_create_line_box_; |
| 116 | 118 |
| 117 bool is_after_forced_break_; | 119 bool is_after_forced_break_; |
| 118 }; | 120 }; |
| 119 | 121 |
| 120 } // namespace blink | 122 } // namespace blink |
| 121 | 123 |
| 122 #endif // NGLineBreaker_h | 124 #endif // NGLineBreaker_h |
| OLD | NEW |