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 #include "core/layout/ng/ng_fragment_builder.h" | 5 #include "core/layout/ng/ng_fragment_builder.h" |
6 | 6 |
7 #include "core/layout/ng/inline/ng_physical_line_box_fragment.h" | 7 #include "core/layout/ng/inline/ng_physical_line_box_fragment.h" |
8 #include "core/layout/ng/inline/ng_physical_text_fragment.h" | 8 #include "core/layout/ng/inline/ng_physical_text_fragment.h" |
9 #include "core/layout/ng/ng_block_break_token.h" | 9 #include "core/layout/ng/ng_block_break_token.h" |
10 #include "core/layout/ng/ng_block_node.h" | 10 #include "core/layout/ng/ng_block_node.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 oof_positioned_candidates_.push_back(NGOutOfFlowPositionedCandidate{ | 141 oof_positioned_candidates_.push_back(NGOutOfFlowPositionedCandidate{ |
142 NGOutOfFlowPositionedDescendant{ | 142 NGOutOfFlowPositionedDescendant{ |
143 child, NGStaticPosition::Create(writing_mode_, direction_, | 143 child, NGStaticPosition::Create(writing_mode_, direction_, |
144 NGPhysicalOffset())}, | 144 NGPhysicalOffset())}, |
145 child_offset}); | 145 child_offset}); |
146 | 146 |
147 child.SaveStaticOffsetForLegacy(child_offset); | 147 child.SaveStaticOffsetForLegacy(child_offset); |
148 return *this; | 148 return *this; |
149 } | 149 } |
150 | 150 |
151 NGFragmentBuilder& NGFragmentBuilder::AddUnpositionedFloat( | |
152 RefPtr<NGUnpositionedFloat> unpositioned_float) { | |
153 unpositioned_floats_.push_back(std::move(unpositioned_float)); | |
154 return *this; | |
155 } | |
156 | |
157 void NGFragmentBuilder::GetAndClearOutOfFlowDescendantCandidates( | 151 void NGFragmentBuilder::GetAndClearOutOfFlowDescendantCandidates( |
158 Vector<NGOutOfFlowPositionedDescendant>* descendant_candidates) { | 152 Vector<NGOutOfFlowPositionedDescendant>* descendant_candidates) { |
159 DCHECK(descendant_candidates->IsEmpty()); | 153 DCHECK(descendant_candidates->IsEmpty()); |
160 | 154 |
161 descendant_candidates->ReserveCapacity(oof_positioned_candidates_.size()); | 155 descendant_candidates->ReserveCapacity(oof_positioned_candidates_.size()); |
162 | 156 |
163 DCHECK_GE(size_.inline_size, LayoutUnit()); | 157 DCHECK_GE(size_.inline_size, LayoutUnit()); |
164 DCHECK_GE(size_.block_size, LayoutUnit()); | 158 DCHECK_GE(size_.block_size, LayoutUnit()); |
165 NGPhysicalSize builder_physical_size{size_.ConvertToPhysical(writing_mode_)}; | 159 NGPhysicalSize builder_physical_size{size_.ConvertToPhysical(writing_mode_)}; |
166 | 160 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 positioned_float.logical_offset.ConvertToPhysical( | 226 positioned_float.logical_offset.ConvertToPhysical( |
233 writing_mode_, direction_, physical_size, | 227 writing_mode_, direction_, physical_size, |
234 floating_fragment->Size())); | 228 floating_fragment->Size())); |
235 } | 229 } |
236 | 230 |
237 RefPtr<NGPhysicalBoxFragment> fragment = AdoptRef(new NGPhysicalBoxFragment( | 231 RefPtr<NGPhysicalBoxFragment> fragment = AdoptRef(new NGPhysicalBoxFragment( |
238 layout_object_, physical_size, overflow_.ConvertToPhysical(writing_mode_), | 232 layout_object_, physical_size, overflow_.ConvertToPhysical(writing_mode_), |
239 children_, positioned_floats_, baselines_, | 233 children_, positioned_floats_, baselines_, |
240 border_edges_.ToPhysical(writing_mode_), std::move(break_token))); | 234 border_edges_.ToPhysical(writing_mode_), std::move(break_token))); |
241 | 235 |
242 return AdoptRef( | 236 return AdoptRef(new NGLayoutResult( |
243 new NGLayoutResult(std::move(fragment), oof_positioned_descendants_, | 237 std::move(fragment), oof_positioned_descendants_, unpositioned_floats_, |
244 unpositioned_floats_, bfc_offset_, end_margin_strut_)); | 238 bfc_offset_, end_margin_strut_, NGLayoutResult::kSuccess)); |
| 239 } |
| 240 |
| 241 RefPtr<NGLayoutResult> NGFragmentBuilder::Abort( |
| 242 NGLayoutResult::NGLayoutResultStatus status) { |
| 243 return AdoptRef(new NGLayoutResult( |
| 244 nullptr, Vector<NGOutOfFlowPositionedDescendant>(), unpositioned_floats_, |
| 245 bfc_offset_, end_margin_strut_, status)); |
245 } | 246 } |
246 | 247 |
247 } // namespace blink | 248 } // namespace blink |
OLD | NEW |