| 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 NGFragmentBuilder_h | 5 #ifndef NGFragmentBuilder_h |
| 6 #define NGFragmentBuilder_h | 6 #define NGFragmentBuilder_h |
| 7 | 7 |
| 8 #include "core/layout/ng/geometry/ng_static_position.h" | 8 #include "core/layout/ng/geometry/ng_static_position.h" |
| 9 #include "core/layout/ng/inline/ng_physical_text_fragment.h" | 9 #include "core/layout/ng/inline/ng_physical_text_fragment.h" |
| 10 #include "core/layout/ng/ng_break_token.h" | 10 #include "core/layout/ng/ng_break_token.h" |
| 11 #include "core/layout/ng/ng_constraint_space.h" | 11 #include "core/layout/ng/ng_constraint_space.h" |
| 12 #include "core/layout/ng/ng_physical_fragment.h" | 12 #include "core/layout/ng/ng_physical_fragment.h" |
| 13 #include "core/layout/ng/ng_positioned_float.h" | 13 #include "core/layout/ng/ng_positioned_float.h" |
| 14 #include "core/layout/ng/ng_unpositioned_float.h" | 14 #include "core/layout/ng/ng_unpositioned_float.h" |
| 15 #include "platform/wtf/Allocator.h" | 15 #include "platform/wtf/Allocator.h" |
| 16 | 16 |
| 17 namespace blink { | 17 namespace blink { |
| 18 | 18 |
| 19 class NGLayoutResult; | 19 class NGLayoutResult; |
| 20 | 20 |
| 21 class CORE_EXPORT NGFragmentBuilder final { | 21 class CORE_EXPORT NGFragmentBuilder final { |
| 22 DISALLOW_NEW(); | 22 DISALLOW_NEW(); |
| 23 | 23 |
| 24 public: | 24 public: |
| 25 NGFragmentBuilder(NGPhysicalFragment::NGFragmentType, NGLayoutInputNode*); | 25 NGFragmentBuilder(NGPhysicalFragment::NGFragmentType, NGLayoutInputNode); |
| 26 | 26 |
| 27 // Build a fragment for LayoutObject without NGLayoutInputNode. LayoutInline | 27 // Build a fragment for LayoutObject without NGLayoutInputNode. LayoutInline |
| 28 // has NGInlineItem but does not have corresponding NGLayoutInputNode. | 28 // has NGInlineItem but does not have corresponding NGLayoutInputNode. |
| 29 NGFragmentBuilder(NGPhysicalFragment::NGFragmentType, LayoutObject*); | 29 NGFragmentBuilder(NGPhysicalFragment::NGFragmentType, LayoutObject*); |
| 30 | 30 |
| 31 using WeakBoxList = PersistentHeapLinkedHashSet<WeakMember<NGBlockNode>>; | 31 using WeakBoxList = PersistentHeapLinkedHashSet<WeakMember<NGBlockNode>>; |
| 32 | 32 |
| 33 NGFragmentBuilder& SetWritingMode(NGWritingMode); | 33 NGFragmentBuilder& SetWritingMode(NGWritingMode); |
| 34 NGFragmentBuilder& SetDirection(TextDirection); | 34 NGFragmentBuilder& SetDirection(TextDirection); |
| 35 | 35 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 // builder->AddChild(fragment) | 69 // builder->AddChild(fragment) |
| 70 // end | 70 // end |
| 71 // | 71 // |
| 72 // builder->SetSize | 72 // builder->SetSize |
| 73 // | 73 // |
| 74 // Part 2: Out-of-flow layout part positions out-of-flow descendants. | 74 // Part 2: Out-of-flow layout part positions out-of-flow descendants. |
| 75 // | 75 // |
| 76 // NGOutOfFlowLayoutPart(container_style, builder).Run(); | 76 // NGOutOfFlowLayoutPart(container_style, builder).Run(); |
| 77 // | 77 // |
| 78 // See layout part for builder interaction. | 78 // See layout part for builder interaction. |
| 79 NGFragmentBuilder& AddOutOfFlowChildCandidate(NGBlockNode*, NGLogicalOffset); | 79 NGFragmentBuilder& AddOutOfFlowChildCandidate(NGBlockNode, NGLogicalOffset); |
| 80 | 80 |
| 81 void GetAndClearOutOfFlowDescendantCandidates(WeakBoxList*, | 81 void GetAndClearOutOfFlowDescendantCandidates(Vector<NGBlockNode>*, |
| 82 Vector<NGStaticPosition>*); | 82 Vector<NGStaticPosition>*); |
| 83 | 83 |
| 84 NGFragmentBuilder& AddOutOfFlowDescendant(NGBlockNode*, | 84 NGFragmentBuilder& AddOutOfFlowDescendant(NGBlockNode, |
| 85 const NGStaticPosition&); | 85 const NGStaticPosition&); |
| 86 | 86 |
| 87 // Sets how much of the block size we've used so far for this box. | 87 // Sets how much of the block size we've used so far for this box. |
| 88 // | 88 // |
| 89 // This will result in a fragment which has an unfinished break token, which | 89 // This will result in a fragment which has an unfinished break token, which |
| 90 // contains this information. | 90 // contains this information. |
| 91 NGFragmentBuilder& SetUsedBlockSize(LayoutUnit used_block_size) { | 91 NGFragmentBuilder& SetUsedBlockSize(LayoutUnit used_block_size) { |
| 92 used_block_size_ = used_block_size; | 92 used_block_size_ = used_block_size; |
| 93 did_break_ = true; | 93 did_break_ = true; |
| 94 return *this; | 94 return *this; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 // be computed until we know fragment's size. | 150 // be computed until we know fragment's size. |
| 151 struct OutOfFlowPlacement { | 151 struct OutOfFlowPlacement { |
| 152 NGLogicalOffset child_offset; | 152 NGLogicalOffset child_offset; |
| 153 NGStaticPosition descendant_position; | 153 NGStaticPosition descendant_position; |
| 154 }; | 154 }; |
| 155 | 155 |
| 156 NGPhysicalFragment::NGFragmentType type_; | 156 NGPhysicalFragment::NGFragmentType type_; |
| 157 NGWritingMode writing_mode_; | 157 NGWritingMode writing_mode_; |
| 158 TextDirection direction_; | 158 TextDirection direction_; |
| 159 | 159 |
| 160 Persistent<NGLayoutInputNode> node_; | 160 NGLayoutInputNode node_; |
| 161 LayoutObject* layout_object_; | 161 LayoutObject* layout_object_; |
| 162 | 162 |
| 163 NGLogicalSize size_; | 163 NGLogicalSize size_; |
| 164 NGLogicalSize overflow_; | 164 NGLogicalSize overflow_; |
| 165 | 165 |
| 166 Vector<RefPtr<NGPhysicalFragment>> children_; | 166 Vector<RefPtr<NGPhysicalFragment>> children_; |
| 167 Vector<NGLogicalOffset> offsets_; | 167 Vector<NGLogicalOffset> offsets_; |
| 168 | 168 |
| 169 bool did_break_; | 169 bool did_break_; |
| 170 LayoutUnit used_block_size_; | 170 LayoutUnit used_block_size_; |
| 171 | 171 |
| 172 Vector<RefPtr<NGBreakToken>> child_break_tokens_; | 172 Vector<RefPtr<NGBreakToken>> child_break_tokens_; |
| 173 RefPtr<NGBreakToken> last_inline_break_token_; | 173 RefPtr<NGBreakToken> last_inline_break_token_; |
| 174 | 174 |
| 175 WeakBoxList out_of_flow_descendant_candidates_; | 175 Vector<NGBlockNode> out_of_flow_descendant_candidates_; |
| 176 Vector<OutOfFlowPlacement> out_of_flow_candidate_placements_; | 176 Vector<OutOfFlowPlacement> out_of_flow_candidate_placements_; |
| 177 | 177 |
| 178 WeakBoxList out_of_flow_descendants_; | 178 Vector<NGBlockNode> out_of_flow_descendants_; |
| 179 Vector<NGStaticPosition> out_of_flow_positions_; | 179 Vector<NGStaticPosition> out_of_flow_positions_; |
| 180 | 180 |
| 181 // Floats that need to be positioned by the next in-flow fragment that can | 181 // Floats that need to be positioned by the next in-flow fragment that can |
| 182 // determine its block position in space. | 182 // determine its block position in space. |
| 183 Vector<RefPtr<NGUnpositionedFloat>> unpositioned_floats_; | 183 Vector<RefPtr<NGUnpositionedFloat>> unpositioned_floats_; |
| 184 | 184 |
| 185 Vector<NGPositionedFloat> positioned_floats_; | 185 Vector<NGPositionedFloat> positioned_floats_; |
| 186 | 186 |
| 187 WTF::Optional<NGLogicalOffset> bfc_offset_; | 187 WTF::Optional<NGLogicalOffset> bfc_offset_; |
| 188 NGMarginStrut end_margin_strut_; | 188 NGMarginStrut end_margin_strut_; |
| 189 | 189 |
| 190 NGBorderEdges::Logical border_edges_; | 190 NGBorderEdges::Logical border_edges_; |
| 191 }; | 191 }; |
| 192 | 192 |
| 193 } // namespace blink | 193 } // namespace blink |
| 194 | 194 |
| 195 #endif // NGFragmentBuilder | 195 #endif // NGFragmentBuilder |
| OLD | NEW |