| OLD | NEW |
| 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 #ifndef NGLineBuilder_h | 5 #ifndef NGLineBuilder_h |
| 6 #define NGLineBuilder_h | 6 #define NGLineBuilder_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "core/layout/ng/geometry/ng_logical_offset.h" | 9 #include "core/layout/ng/geometry/ng_logical_offset.h" |
| 10 #include "core/layout/ng/ng_fragment_builder.h" | 10 #include "core/layout/ng/ng_fragment_builder.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 // NGLineBuilder creates the fragment tree for a line. | 25 // NGLineBuilder creates the fragment tree for a line. |
| 26 // NGLineBuilder manages the current line as a range, |start| and |end|. | 26 // NGLineBuilder manages the current line as a range, |start| and |end|. |
| 27 // |end| can be extended multiple times before creating a line, usually until | 27 // |end| can be extended multiple times before creating a line, usually until |
| 28 // |!CanFitOnLine()|. | 28 // |!CanFitOnLine()|. |
| 29 // |SetBreakOpportunity| can mark the last confirmed offset that can fit. | 29 // |SetBreakOpportunity| can mark the last confirmed offset that can fit. |
| 30 class CORE_EXPORT NGLineBuilder final { | 30 class CORE_EXPORT NGLineBuilder final { |
| 31 STACK_ALLOCATED(); | 31 STACK_ALLOCATED(); |
| 32 | 32 |
| 33 public: | 33 public: |
| 34 NGLineBuilder(NGInlineNode*, NGConstraintSpace*, NGFragmentBuilder*); | 34 NGLineBuilder(NGInlineNode*, NGConstraintSpace*); |
| 35 | 35 |
| 36 const NGConstraintSpace& ConstraintSpace() const { | 36 const NGConstraintSpace& ConstraintSpace() const { |
| 37 return *constraint_space_; | 37 return *constraint_space_; |
| 38 } | 38 } |
| 39 | 39 |
| 40 LayoutUnit MaxInlineSize() const { return max_inline_size_; } | 40 LayoutUnit MaxInlineSize() const { return max_inline_size_; } |
| 41 | 41 |
| 42 // Returns if the current items fit on a line. | 42 // Returns if the current items fit on a line. |
| 43 bool CanFitOnLine() const; | 43 bool CanFitOnLine() const; |
| 44 | 44 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 LayoutUnit PlaceAtomicInline(const NGLayoutInlineItem&, | 152 LayoutUnit PlaceAtomicInline(const NGLayoutInlineItem&, |
| 153 LayoutUnit estimated_baseline, | 153 LayoutUnit estimated_baseline, |
| 154 LineBoxData*, | 154 LineBoxData*, |
| 155 NGFragmentBuilder*); | 155 NGFragmentBuilder*); |
| 156 | 156 |
| 157 // Finds the next layout opportunity for the next text fragment. | 157 // Finds the next layout opportunity for the next text fragment. |
| 158 void FindNextLayoutOpportunity(); | 158 void FindNextLayoutOpportunity(); |
| 159 | 159 |
| 160 Persistent<NGInlineNode> inline_box_; | 160 Persistent<NGInlineNode> inline_box_; |
| 161 NGConstraintSpace* constraint_space_; // Not owned as STACK_ALLOCATED. | 161 NGConstraintSpace* constraint_space_; // Not owned as STACK_ALLOCATED. |
| 162 NGFragmentBuilder* containing_block_builder_; | |
| 163 Vector<RefPtr<NGLayoutResult>, 32> layout_results_; | 162 Vector<RefPtr<NGLayoutResult>, 32> layout_results_; |
| 164 Vector<LineBoxData, 32> line_box_data_list_; | 163 Vector<LineBoxData, 32> line_box_data_list_; |
| 165 unsigned start_index_ = 0; | 164 unsigned start_index_ = 0; |
| 166 unsigned start_offset_ = 0; | 165 unsigned start_offset_ = 0; |
| 167 unsigned last_index_ = 0; | 166 unsigned last_index_ = 0; |
| 168 unsigned end_offset_ = 0; | 167 unsigned end_offset_ = 0; |
| 169 unsigned last_break_opportunity_index_ = 0; | 168 unsigned last_break_opportunity_index_ = 0; |
| 170 unsigned last_break_opportunity_offset_ = 0; | 169 unsigned last_break_opportunity_offset_ = 0; |
| 171 LayoutUnit end_position_; | 170 LayoutUnit end_position_; |
| 172 LayoutUnit last_break_opportunity_position_; | 171 LayoutUnit last_break_opportunity_position_; |
| 173 LayoutUnit content_size_; | 172 LayoutUnit content_size_; |
| 174 LayoutUnit max_inline_size_; | 173 LayoutUnit max_inline_size_; |
| 175 NGFragmentBuilder container_builder_; | 174 NGFragmentBuilder container_builder_; |
| 176 RefPtr<NGLayoutResult> container_layout_result_; | 175 RefPtr<NGLayoutResult> container_layout_result_; |
| 177 FontBaseline baseline_type_ = FontBaseline::AlphabeticBaseline; | 176 FontBaseline baseline_type_ = FontBaseline::AlphabeticBaseline; |
| 178 | 177 |
| 179 NGLogicalOffset bfc_offset_; | 178 NGLogicalOffset bfc_offset_; |
| 180 NGLogicalRect current_opportunity_; | 179 NGLogicalRect current_opportunity_; |
| 181 | 180 |
| 182 unsigned is_horizontal_writing_mode_ : 1; | 181 unsigned is_horizontal_writing_mode_ : 1; |
| 183 #if DCHECK_IS_ON() | 182 #if DCHECK_IS_ON() |
| 184 unsigned is_bidi_reordered_ : 1; | 183 unsigned is_bidi_reordered_ : 1; |
| 185 #endif | 184 #endif |
| 186 }; | 185 }; |
| 187 | 186 |
| 188 } // namespace blink | 187 } // namespace blink |
| 189 | 188 |
| 190 #endif // NGLineBuilder_h | 189 #endif // NGLineBuilder_h |
| OLD | NEW |