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