Chromium Code Reviews| 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_layout_opportunity_iterator.h" | 10 #include "core/layout/ng/ng_layout_opportunity_iterator.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 79 | 79 |
| 80 // Create fragments for all lines created so far. | 80 // Create fragments for all lines created so far. |
| 81 RefPtr<NGLayoutResult> CreateFragments(); | 81 RefPtr<NGLayoutResult> CreateFragments(); |
| 82 | 82 |
| 83 // Copy fragment data of all lines created by this NGLineBuilder to | 83 // Copy fragment data of all lines created by this NGLineBuilder to |
| 84 // LayoutBlockFlow. | 84 // LayoutBlockFlow. |
| 85 // This must run after |CreateFragments()|, and after the fragments it created | 85 // This must run after |CreateFragments()|, and after the fragments it created |
| 86 // are placed. | 86 // are placed. |
| 87 void CopyFragmentDataToLayoutBlockFlow(); | 87 void CopyFragmentDataToLayoutBlockFlow(); |
| 88 | 88 |
| 89 // Compute inline size of an NGLayoutInlineItem. | |
| 90 // Same as NGLayoutInlineItem::InlineSize(), except that this function can | |
| 91 // compute atomic inlines by laying out them. | |
|
ikilpatrick
2017/03/16 18:26:16
.nit
"by layout them out."
or
"by performing layou
kojii
2017/03/16 19:16:33
Done, thank you!
| |
| 92 LayoutUnit InlineSize(const NGLayoutInlineItem&); | |
| 93 | |
| 89 private: | 94 private: |
| 95 bool IsHorizontalWritingMode() const { return is_horizontal_writing_mode_; } | |
| 96 | |
| 97 LayoutUnit InlineSize(const NGLayoutInlineItem&, | |
| 98 unsigned start_offset, | |
| 99 unsigned end_offset); | |
| 100 LayoutUnit InlineSizeFromLayout(const NGLayoutInlineItem&); | |
| 101 const NGLayoutResult* LayoutItem(const NGLayoutInlineItem&); | |
| 102 | |
| 90 struct LineItemChunk { | 103 struct LineItemChunk { |
| 91 unsigned index; | 104 unsigned index; |
| 92 unsigned start_offset; | 105 unsigned start_offset; |
| 93 unsigned end_offset; | 106 unsigned end_offset; |
| 94 LayoutUnit inline_size; | 107 LayoutUnit inline_size; |
| 95 }; | 108 }; |
| 96 | 109 |
| 97 void BidiReorder(Vector<LineItemChunk, 32>*); | 110 void BidiReorder(Vector<LineItemChunk, 32>*); |
| 98 | 111 |
| 99 // Represents block-direction metrics for an |NGLayoutInlineItem|. | 112 // Represents block-direction metrics for an |NGLayoutInlineItem|. |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 129 float max_descent_and_leading = 0; | 142 float max_descent_and_leading = 0; |
| 130 | 143 |
| 131 // Include |InlineItemMetrics| into the metrics for this line box. | 144 // Include |InlineItemMetrics| into the metrics for this line box. |
| 132 void UpdateMaxAscentAndDescent(const InlineItemMetrics&); | 145 void UpdateMaxAscentAndDescent(const InlineItemMetrics&); |
| 133 }; | 146 }; |
| 134 | 147 |
| 135 void PlaceItems(const Vector<LineItemChunk, 32>&); | 148 void PlaceItems(const Vector<LineItemChunk, 32>&); |
| 136 void AccumulateUsedFonts(const NGLayoutInlineItem&, | 149 void AccumulateUsedFonts(const NGLayoutInlineItem&, |
| 137 const LineItemChunk&, | 150 const LineItemChunk&, |
| 138 LineBoxData*); | 151 LineBoxData*); |
| 152 LayoutUnit PlaceAtomicInline(const NGLayoutInlineItem&, | |
| 153 LayoutUnit estimated_baseline, | |
| 154 LineBoxData*, | |
| 155 NGFragmentBuilder*); | |
| 139 | 156 |
| 140 // Finds the next layout opportunity for the next text fragment. | 157 // Finds the next layout opportunity for the next text fragment. |
| 141 void FindNextLayoutOpportunity(); | 158 void FindNextLayoutOpportunity(); |
| 142 | 159 |
| 143 Persistent<NGInlineNode> inline_box_; | 160 Persistent<NGInlineNode> inline_box_; |
| 144 NGConstraintSpace* constraint_space_; // Not owned as STACK_ALLOCATED. | 161 NGConstraintSpace* constraint_space_; // Not owned as STACK_ALLOCATED. |
| 145 NGFragmentBuilder* containing_block_builder_; | 162 NGFragmentBuilder* containing_block_builder_; |
| 163 Vector<RefPtr<NGLayoutResult>, 32> layout_results_; | |
| 146 Vector<RefPtr<NGPhysicalFragment>, 32> fragments_; | 164 Vector<RefPtr<NGPhysicalFragment>, 32> fragments_; |
| 147 Vector<NGLogicalOffset, 32> offsets_; | 165 Vector<NGLogicalOffset, 32> offsets_; |
| 148 Vector<LineBoxData, 32> line_box_data_list_; | 166 Vector<LineBoxData, 32> line_box_data_list_; |
| 149 unsigned start_index_ = 0; | 167 unsigned start_index_ = 0; |
| 150 unsigned start_offset_ = 0; | 168 unsigned start_offset_ = 0; |
| 151 unsigned last_index_ = 0; | 169 unsigned last_index_ = 0; |
| 152 unsigned end_offset_ = 0; | 170 unsigned end_offset_ = 0; |
| 153 unsigned last_break_opportunity_index_ = 0; | 171 unsigned last_break_opportunity_index_ = 0; |
| 154 unsigned last_break_opportunity_offset_ = 0; | 172 unsigned last_break_opportunity_offset_ = 0; |
| 155 LayoutUnit end_position_; | 173 LayoutUnit end_position_; |
| 156 LayoutUnit last_break_opportunity_position_; | 174 LayoutUnit last_break_opportunity_position_; |
| 157 LayoutUnit content_size_; | 175 LayoutUnit content_size_; |
| 158 LayoutUnit max_inline_size_; | 176 LayoutUnit max_inline_size_; |
| 159 FontBaseline baseline_type_; | 177 FontBaseline baseline_type_ = FontBaseline::AlphabeticBaseline; |
| 160 | 178 |
| 161 NGLogicalOffset bfc_offset_; | 179 NGLogicalOffset bfc_offset_; |
| 162 NGLogicalRect current_opportunity_; | 180 NGLogicalRect current_opportunity_; |
| 163 | 181 |
| 182 unsigned is_horizontal_writing_mode_ : 1; | |
| 164 #if DCHECK_IS_ON() | 183 #if DCHECK_IS_ON() |
| 165 unsigned is_bidi_reordered_ : 1; | 184 unsigned is_bidi_reordered_ : 1; |
| 166 #endif | 185 #endif |
| 167 }; | 186 }; |
| 168 | 187 |
| 169 } // namespace blink | 188 } // namespace blink |
| 170 | 189 |
| 171 #endif // NGLineBuilder_h | 190 #endif // NGLineBuilder_h |
| OLD | NEW |