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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 child_break_tokens_.push_back(std::move(last_inline_break_token_)); | 189 child_break_tokens_.push_back(std::move(last_inline_break_token_)); |
190 did_break_ = true; | 190 did_break_ = true; |
191 } | 191 } |
192 if (did_break_) { | 192 if (did_break_) { |
193 break_token = NGBlockBreakToken::Create(node_.Get(), used_block_size_, | 193 break_token = NGBlockBreakToken::Create(node_.Get(), used_block_size_, |
194 child_break_tokens_); | 194 child_break_tokens_); |
195 } else { | 195 } else { |
196 break_token = NGBlockBreakToken::Create(node_.Get()); | 196 break_token = NGBlockBreakToken::Create(node_.Get()); |
197 } | 197 } |
198 | 198 |
199 for (auto& floating_object : positioned_floats_) { | 199 for (auto& positioned_float : positioned_floats_) { |
200 DCHECK(floating_object->logical_offset) | 200 NGPhysicalFragment* floating_fragment = positioned_float.fragment.Get(); |
201 << "logical_offset should be set for a positioned float."; | 201 floating_fragment->SetOffset(positioned_float.offset.ConvertToPhysical( |
202 NGPhysicalFragment* floating_fragment = floating_object->fragment.Get(); | 202 writing_mode_, direction_, physical_size, floating_fragment->Size())); |
203 floating_fragment->SetOffset( | |
204 floating_object->logical_offset.value().ConvertToPhysical( | |
205 writing_mode_, direction_, physical_size, | |
206 floating_fragment->Size())); | |
207 } | 203 } |
208 | 204 |
209 RefPtr<NGPhysicalBoxFragment> fragment = AdoptRef(new NGPhysicalBoxFragment( | 205 RefPtr<NGPhysicalBoxFragment> fragment = AdoptRef(new NGPhysicalBoxFragment( |
210 node_->GetLayoutObject(), physical_size, | 206 node_->GetLayoutObject(), physical_size, |
211 overflow_.ConvertToPhysical(writing_mode_), children_, positioned_floats_, | 207 overflow_.ConvertToPhysical(writing_mode_), children_, positioned_floats_, |
212 bfc_offset_, end_margin_strut_, std::move(break_token))); | 208 bfc_offset_, end_margin_strut_, std::move(break_token))); |
213 | 209 |
214 return AdoptRef( | 210 return AdoptRef( |
215 new NGLayoutResult(std::move(fragment), out_of_flow_descendants_, | 211 new NGLayoutResult(std::move(fragment), out_of_flow_descendants_, |
216 out_of_flow_positions_, unpositioned_floats_)); | 212 out_of_flow_positions_, unpositioned_floats_)); |
217 } | 213 } |
218 | 214 |
219 } // namespace blink | 215 } // namespace blink |
OLD | NEW |