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_block_layout_algorithm.h" | 5 #include "core/layout/ng/ng_block_layout_algorithm.h" |
6 | 6 |
7 #include "core/layout/ng/ng_constraint_space.h" | 7 #include "core/layout/ng/ng_constraint_space.h" |
8 #include "core/layout/ng/ng_constraint_space_builder.h" | |
8 #include "core/layout/ng/ng_fragment_builder.h" | 9 #include "core/layout/ng/ng_fragment_builder.h" |
9 #include "core/layout/ng/ng_fragment.h" | 10 #include "core/layout/ng/ng_fragment.h" |
10 #include "core/layout/ng/ng_layout_opportunity_iterator.h" | 11 #include "core/layout/ng/ng_layout_opportunity_iterator.h" |
11 #include "core/layout/ng/ng_length_utils.h" | 12 #include "core/layout/ng/ng_length_utils.h" |
12 #include "core/layout/ng/ng_units.h" | 13 #include "core/layout/ng/ng_units.h" |
13 #include "core/style/ComputedStyle.h" | 14 #include "core/style/ComputedStyle.h" |
14 #include "platform/LengthFunctions.h" | 15 #include "platform/LengthFunctions.h" |
15 | 16 |
16 namespace blink { | 17 namespace blink { |
17 namespace { | 18 namespace { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
51 // It iterates over all layout opportunities in the constraint space and returns | 52 // It iterates over all layout opportunities in the constraint space and returns |
52 // the first layout opportunity that is wider than the fragment or returns the | 53 // the first layout opportunity that is wider than the fragment or returns the |
53 // last one which is always the widest. | 54 // last one which is always the widest. |
54 // | 55 // |
55 // @param space Constraint space that is used to find layout opportunity for | 56 // @param space Constraint space that is used to find layout opportunity for |
56 // the fragment. | 57 // the fragment. |
57 // @param fragment Fragment that needs to be placed. | 58 // @param fragment Fragment that needs to be placed. |
58 // @param margins Margins of the fragment. | 59 // @param margins Margins of the fragment. |
59 // @return Layout opportunity for the fragment. | 60 // @return Layout opportunity for the fragment. |
60 const NGLayoutOpportunity FindLayoutOpportunityForFragment( | 61 const NGLayoutOpportunity FindLayoutOpportunityForFragment( |
61 const Member<NGConstraintSpace>& space, | 62 NGConstraintSpace* space, |
62 const NGFragment& fragment, | 63 const NGFragment& fragment, |
63 const NGBoxStrut& margins) { | 64 const NGBoxStrut& margins) { |
64 NGLayoutOpportunityIterator* opportunity_iter = space->LayoutOpportunities(); | 65 NGLayoutOpportunityIterator* opportunity_iter = space->LayoutOpportunities(); |
65 NGLayoutOpportunity opportunity; | 66 NGLayoutOpportunity opportunity; |
66 NGLayoutOpportunity opportunity_candidate = opportunity_iter->Next(); | 67 NGLayoutOpportunity opportunity_candidate = opportunity_iter->Next(); |
67 | 68 |
68 while (!opportunity_candidate.IsEmpty()) { | 69 while (!opportunity_candidate.IsEmpty()) { |
69 opportunity = opportunity_candidate; | 70 opportunity = opportunity_candidate; |
70 // Checking opportunity's block size is not necessary as a float cannot be | 71 // Checking opportunity's block size is not necessary as a float cannot be |
71 // positioned on top of another float inside of the same constraint space. | 72 // positioned on top of another float inside of the same constraint space. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
136 if (space.WritingMode() != FromPlatformWritingMode(style.getWritingMode())) | 137 if (space.WritingMode() != FromPlatformWritingMode(style.getWritingMode())) |
137 return true; | 138 return true; |
138 | 139 |
139 return false; | 140 return false; |
140 } | 141 } |
141 | 142 |
142 } // namespace | 143 } // namespace |
143 | 144 |
144 NGBlockLayoutAlgorithm::NGBlockLayoutAlgorithm( | 145 NGBlockLayoutAlgorithm::NGBlockLayoutAlgorithm( |
145 PassRefPtr<const ComputedStyle> style, | 146 PassRefPtr<const ComputedStyle> style, |
146 NGBox* first_child) | 147 NGBox* first_child, |
147 : style_(style), | 148 NGConstraintSpace* constraint_space) |
149 : state_(kStateInit), | |
150 style_(style), | |
148 first_child_(first_child), | 151 first_child_(first_child), |
149 state_(kStateInit), | 152 constraint_space_(constraint_space), |
150 is_fragment_margin_strut_block_start_updated_(false) { | 153 is_fragment_margin_strut_block_start_updated_(false) { |
151 DCHECK(style_); | 154 DCHECK(style_); |
152 } | 155 } |
153 | 156 |
154 bool NGBlockLayoutAlgorithm::Layout(const NGConstraintSpace* constraint_space, | 157 bool NGBlockLayoutAlgorithm::Layout(NGPhysicalFragment** out) { |
155 NGPhysicalFragment** out) { | |
156 switch (state_) { | 158 switch (state_) { |
157 case kStateInit: { | 159 case kStateInit: { |
158 border_and_padding_ = | 160 border_and_padding_ = |
159 ComputeBorders(Style()) + ComputePadding(*constraint_space, Style()); | 161 ComputeBorders(Style()) + ComputePadding(*constraint_space_, Style()); |
160 | 162 |
161 LayoutUnit inline_size = | 163 LayoutUnit inline_size = |
162 ComputeInlineSizeForFragment(*constraint_space, Style()); | 164 ComputeInlineSizeForFragment(*constraint_space_, Style()); |
163 LayoutUnit adjusted_inline_size = | 165 LayoutUnit adjusted_inline_size = |
164 inline_size - border_and_padding_.InlineSum(); | 166 inline_size - border_and_padding_.InlineSum(); |
165 // TODO(layout-ng): For quirks mode, should we pass blockSize instead of | 167 // TODO(layout-ng): For quirks mode, should we pass blockSize instead of |
166 // -1? | 168 // -1? |
167 LayoutUnit block_size = ComputeBlockSizeForFragment( | 169 LayoutUnit block_size = ComputeBlockSizeForFragment( |
168 *constraint_space, Style(), NGSizeIndefinite); | 170 *constraint_space_, Style(), NGSizeIndefinite); |
169 LayoutUnit adjusted_block_size(block_size); | 171 LayoutUnit adjusted_block_size(block_size); |
170 // Our calculated block-axis size may be indefinite at this point. | 172 // Our calculated block-axis size may be indefinite at this point. |
171 // If so, just leave the size as NGSizeIndefinite instead of subtracting | 173 // If so, just leave the size as NGSizeIndefinite instead of subtracting |
172 // borders and padding. | 174 // borders and padding. |
173 if (adjusted_block_size != NGSizeIndefinite) | 175 if (adjusted_block_size != NGSizeIndefinite) |
174 adjusted_block_size -= border_and_padding_.BlockSum(); | 176 adjusted_block_size -= border_and_padding_.BlockSum(); |
175 constraint_space_for_children_ = new NGConstraintSpace( | 177 |
176 FromPlatformWritingMode(Style().getWritingMode()), | 178 space_builder_ = |
177 FromPlatformDirection(Style().direction()), *constraint_space, | 179 new NGConstraintSpaceBuilder(constraint_space_->WritingMode()); |
cbiesinger
2016/10/27 21:47:19
You're not setting the direction? The old code did
ikilpatrick
2016/10/27 21:56:13
This is only for the builder, which only needs to
cbiesinger
2016/10/28 18:58:56
Hmm OK. It makes me uneasy to leave this out, even
| |
180 space_builder_->SetContainerSize( | |
178 NGLogicalSize(adjusted_inline_size, adjusted_block_size)); | 181 NGLogicalSize(adjusted_inline_size, adjusted_block_size)); |
182 | |
183 constraint_space_->SetSize( | |
184 NGLogicalSize(adjusted_inline_size, adjusted_block_size)); | |
185 | |
179 content_size_ = border_and_padding_.block_start; | 186 content_size_ = border_and_padding_.block_start; |
180 | 187 |
181 builder_ = new NGFragmentBuilder(NGPhysicalFragmentBase::FragmentBox); | 188 builder_ = new NGFragmentBuilder(NGPhysicalFragmentBase::FragmentBox); |
182 builder_->SetDirection(constraint_space->Direction()); | 189 builder_->SetDirection(constraint_space_->Direction()); |
183 builder_->SetWritingMode(constraint_space->WritingMode()); | 190 builder_->SetWritingMode(constraint_space_->WritingMode()); |
184 builder_->SetInlineSize(inline_size).SetBlockSize(block_size); | 191 builder_->SetInlineSize(inline_size).SetBlockSize(block_size); |
185 current_child_ = first_child_; | 192 current_child_ = first_child_; |
193 if (current_child_) | |
194 space_for_current_child_ = CreateConstraintSpaceForCurrentChild(); | |
195 | |
186 state_ = kStateChildLayout; | 196 state_ = kStateChildLayout; |
187 return false; | 197 return false; |
188 } | 198 } |
189 case kStateChildLayout: { | 199 case kStateChildLayout: { |
190 if (current_child_) { | 200 if (current_child_) { |
191 if (!LayoutCurrentChild(constraint_space)) | 201 if (!LayoutCurrentChild()) |
192 return false; | 202 return false; |
193 current_child_ = current_child_->NextSibling(); | 203 current_child_ = current_child_->NextSibling(); |
194 if (current_child_) | 204 if (current_child_) { |
205 space_for_current_child_ = CreateConstraintSpaceForCurrentChild(); | |
195 return false; | 206 return false; |
207 } | |
196 } | 208 } |
197 state_ = kStateFinalize; | 209 state_ = kStateFinalize; |
198 return false; | 210 return false; |
199 } | 211 } |
200 case kStateFinalize: { | 212 case kStateFinalize: { |
201 content_size_ += border_and_padding_.block_end; | 213 content_size_ += border_and_padding_.block_end; |
202 | 214 |
203 // Recompute the block-axis size now that we know our content size. | 215 // Recompute the block-axis size now that we know our content size. |
204 LayoutUnit block_size = ComputeBlockSizeForFragment( | 216 LayoutUnit block_size = ComputeBlockSizeForFragment( |
205 *constraint_space, Style(), content_size_); | 217 *constraint_space_, Style(), content_size_); |
206 | 218 |
207 builder_->SetBlockSize(block_size) | 219 builder_->SetBlockSize(block_size) |
208 .SetInlineOverflow(max_inline_size_) | 220 .SetInlineOverflow(max_inline_size_) |
209 .SetBlockOverflow(content_size_); | 221 .SetBlockOverflow(content_size_); |
210 *out = builder_->ToFragment(); | 222 *out = builder_->ToFragment(); |
211 state_ = kStateInit; | 223 state_ = kStateInit; |
212 return true; | 224 return true; |
213 } | 225 } |
214 }; | 226 }; |
215 NOTREACHED(); | 227 NOTREACHED(); |
216 *out = nullptr; | 228 *out = nullptr; |
217 return true; | 229 return true; |
218 } | 230 } |
219 | 231 |
220 bool NGBlockLayoutAlgorithm::LayoutCurrentChild( | 232 bool NGBlockLayoutAlgorithm::LayoutCurrentChild() { |
221 const NGConstraintSpace* constraint_space) { | |
222 constraint_space_for_children_->SetIsNewFormattingContext( | |
223 IsNewFormattingContextForInFlowBlockLevelChild(*constraint_space, | |
224 *current_child_->Style())); | |
225 | |
226 NGFragment* fragment; | 233 NGFragment* fragment; |
227 if (!current_child_->Layout(constraint_space_for_children_, &fragment)) | 234 if (!current_child_->Layout(space_for_current_child_, &fragment)) |
228 return false; | 235 return false; |
229 | 236 |
230 NGBoxStrut child_margins = | 237 NGBoxStrut child_margins = ComputeMargins( |
231 ComputeMargins(*constraint_space_for_children_, *current_child_->Style(), | 238 *space_for_current_child_, *current_child_->Style(), |
232 constraint_space_for_children_->WritingMode(), | 239 constraint_space_->WritingMode(), constraint_space_->Direction()); |
233 constraint_space_for_children_->Direction()); | |
234 | 240 |
235 NGLogicalOffset fragment_offset; | 241 NGLogicalOffset fragment_offset; |
236 if (current_child_->Style()->isFloating()) { | 242 if (current_child_->Style()->isFloating()) { |
237 fragment_offset = PositionFloatFragment(*fragment, child_margins); | 243 fragment_offset = PositionFloatFragment(*fragment, child_margins); |
238 } else { | 244 } else { |
239 // TODO(layout-ng): move ApplyAutoMargins to PositionFragment | 245 ApplyAutoMargins(*space_for_current_child_, *current_child_->Style(), |
cbiesinger
2016/10/27 21:47:19
Thanks
Gleb Lanbin
2016/10/27 22:30:06
you need to run 'git rebase-update', it was delete
ikilpatrick
2016/10/28 00:16:28
And added here: https://codereview.chromium.org/24
| |
240 ApplyAutoMargins(*constraint_space_for_children_, *current_child_->Style(), | |
241 *fragment, &child_margins); | 246 *fragment, &child_margins); |
242 fragment_offset = | 247 fragment_offset = PositionFragment(*fragment, child_margins); |
243 PositionFragment(*fragment, child_margins, *constraint_space); | |
244 } | 248 } |
245 builder_->AddChild(fragment, fragment_offset); | 249 builder_->AddChild(fragment, fragment_offset); |
246 return true; | 250 return true; |
247 } | 251 } |
248 | 252 |
249 NGBoxStrut NGBlockLayoutAlgorithm::CollapseMargins( | 253 NGBoxStrut NGBlockLayoutAlgorithm::CollapseMargins( |
250 const NGConstraintSpace& space, | |
251 const NGBoxStrut& margins, | 254 const NGBoxStrut& margins, |
252 const NGFragment& fragment) { | 255 const NGFragment& fragment) { |
253 bool is_zero_height_box = !fragment.BlockSize() && margins.IsEmpty() && | 256 bool is_zero_height_box = !fragment.BlockSize() && margins.IsEmpty() && |
254 fragment.MarginStrut().IsEmpty(); | 257 fragment.MarginStrut().IsEmpty(); |
255 // Create the current child's margin strut from its children's margin strut or | 258 // Create the current child's margin strut from its children's margin strut or |
256 // use margin strut from the the last non-empty child. | 259 // use margin strut from the the last non-empty child. |
257 NGMarginStrut curr_margin_strut = | 260 NGMarginStrut curr_margin_strut = |
258 is_zero_height_box ? prev_child_margin_strut_ : fragment.MarginStrut(); | 261 is_zero_height_box ? prev_child_margin_strut_ : fragment.MarginStrut(); |
259 | 262 |
260 // Calculate borders and padding for the current child. | 263 // Calculate borders and padding for the current child. |
261 NGBoxStrut border_and_padding = | 264 NGBoxStrut border_and_padding = |
262 ComputeBorders(*current_child_->Style()) + | 265 ComputeBorders(*current_child_->Style()) + |
263 ComputePadding(space, *current_child_->Style()); | 266 ComputePadding(*constraint_space_, *current_child_->Style()); |
264 | 267 |
265 // Collapse BLOCK-START margins if there is no padding or border between | 268 // Collapse BLOCK-START margins if there is no padding or border between |
266 // parent (current child) and its first in-flow child. | 269 // parent (current child) and its first in-flow child. |
267 if (border_and_padding.block_start) { | 270 if (border_and_padding.block_start) { |
268 curr_margin_strut.SetMarginBlockStart(margins.block_start); | 271 curr_margin_strut.SetMarginBlockStart(margins.block_start); |
269 } else { | 272 } else { |
270 curr_margin_strut.AppendMarginBlockStart(margins.block_start); | 273 curr_margin_strut.AppendMarginBlockStart(margins.block_start); |
271 } | 274 } |
272 | 275 |
273 // Collapse BLOCK-END margins if | 276 // Collapse BLOCK-END margins if |
274 // 1) there is no padding or border between parent (current child) and its | 277 // 1) there is no padding or border between parent (current child) and its |
275 // first/last in-flow child | 278 // first/last in-flow child |
276 // 2) parent's logical height is auto. | 279 // 2) parent's logical height is auto. |
277 if (current_child_->Style()->logicalHeight().isAuto() && | 280 if (current_child_->Style()->logicalHeight().isAuto() && |
278 !border_and_padding.block_end) { | 281 !border_and_padding.block_end) { |
279 curr_margin_strut.AppendMarginBlockEnd(margins.block_end); | 282 curr_margin_strut.AppendMarginBlockEnd(margins.block_end); |
280 } else { | 283 } else { |
281 curr_margin_strut.SetMarginBlockEnd(margins.block_end); | 284 curr_margin_strut.SetMarginBlockEnd(margins.block_end); |
282 } | 285 } |
283 | 286 |
284 NGBoxStrut result_margins; | 287 NGBoxStrut result_margins; |
285 // Margins of the newly established formatting context do not participate | 288 // Margins of the newly established formatting context do not participate |
286 // in Collapsing Margins: | 289 // in Collapsing Margins: |
287 // - Compute margins block start for adjoining blocks *including* 1st block. | 290 // - Compute margins block start for adjoining blocks *including* 1st block. |
288 // - Compute margins block end for the last block. | 291 // - Compute margins block end for the last block. |
289 // - Do not set the computed margins to the parent fragment. | 292 // - Do not set the computed margins to the parent fragment. |
290 if (space.IsNewFormattingContext()) { | 293 if (constraint_space_->IsNewFormattingContext()) { |
291 result_margins.block_start = ComputeCollapsedMarginBlockStart( | 294 result_margins.block_start = ComputeCollapsedMarginBlockStart( |
292 prev_child_margin_strut_, curr_margin_strut); | 295 prev_child_margin_strut_, curr_margin_strut); |
293 bool is_last_child = !current_child_->NextSibling(); | 296 bool is_last_child = !current_child_->NextSibling(); |
294 if (is_last_child) | 297 if (is_last_child) |
295 result_margins.block_end = curr_margin_strut.BlockEndSum(); | 298 result_margins.block_end = curr_margin_strut.BlockEndSum(); |
296 return result_margins; | 299 return result_margins; |
297 } | 300 } |
298 | 301 |
299 // Zero-height boxes are ignored and do not participate in margin collapsing. | 302 // Zero-height boxes are ignored and do not participate in margin collapsing. |
300 if (is_zero_height_box) | 303 if (is_zero_height_box) |
301 return result_margins; | 304 return result_margins; |
302 | 305 |
303 // Compute the margin block start for adjoining blocks *excluding* 1st block | 306 // Compute the margin block start for adjoining blocks *excluding* 1st block |
304 if (is_fragment_margin_strut_block_start_updated_) { | 307 if (is_fragment_margin_strut_block_start_updated_) { |
305 result_margins.block_start = ComputeCollapsedMarginBlockStart( | 308 result_margins.block_start = ComputeCollapsedMarginBlockStart( |
306 prev_child_margin_strut_, curr_margin_strut); | 309 prev_child_margin_strut_, curr_margin_strut); |
307 } | 310 } |
308 | 311 |
309 // Update the parent fragment's margin strut | 312 // Update the parent fragment's margin strut |
310 UpdateMarginStrut(curr_margin_strut); | 313 UpdateMarginStrut(curr_margin_strut); |
311 | 314 |
312 prev_child_margin_strut_ = curr_margin_strut; | 315 prev_child_margin_strut_ = curr_margin_strut; |
313 return result_margins; | 316 return result_margins; |
314 } | 317 } |
315 | 318 |
316 NGLogicalOffset NGBlockLayoutAlgorithm::PositionFragment( | 319 NGLogicalOffset NGBlockLayoutAlgorithm::PositionFragment( |
317 const NGFragment& fragment, | 320 const NGFragment& fragment, |
318 const NGBoxStrut& child_margins, | 321 const NGBoxStrut& child_margins) { |
319 const NGConstraintSpace& space) { | 322 const NGBoxStrut collapsed_margins = CollapseMargins(child_margins, fragment); |
320 const NGBoxStrut collapsed_margins = | |
321 CollapseMargins(space, child_margins, fragment); | |
322 | 323 |
323 LayoutUnit inline_offset = | 324 LayoutUnit inline_offset = |
324 border_and_padding_.inline_start + child_margins.inline_start; | 325 border_and_padding_.inline_start + child_margins.inline_start; |
325 LayoutUnit block_offset = content_size_ + collapsed_margins.block_start; | 326 LayoutUnit block_offset = content_size_ + collapsed_margins.block_start; |
326 | 327 |
327 content_size_ += fragment.BlockSize() + collapsed_margins.BlockSum(); | 328 content_size_ += fragment.BlockSize() + collapsed_margins.BlockSum(); |
328 max_inline_size_ = std::max( | 329 max_inline_size_ = std::max( |
329 max_inline_size_, fragment.InlineSize() + child_margins.InlineSum() + | 330 max_inline_size_, fragment.InlineSize() + child_margins.InlineSum() + |
330 border_and_padding_.InlineSum()); | 331 border_and_padding_.InlineSum()); |
331 return NGLogicalOffset(inline_offset, block_offset); | 332 return NGLogicalOffset(inline_offset, block_offset); |
332 } | 333 } |
333 | 334 |
334 NGLogicalOffset NGBlockLayoutAlgorithm::PositionFloatFragment( | 335 NGLogicalOffset NGBlockLayoutAlgorithm::PositionFloatFragment( |
335 const NGFragment& fragment, | 336 const NGFragment& fragment, |
336 const NGBoxStrut& margins) { | 337 const NGBoxStrut& margins) { |
337 // TODO(glebl@chromium.org): Support the top edge alignment rule. | 338 // TODO(glebl@chromium.org): Support the top edge alignment rule. |
338 // Find a layout opportunity that will fit our float. | 339 // Find a layout opportunity that will fit our float. |
339 const NGLayoutOpportunity opportunity = FindLayoutOpportunityForFragment( | 340 const NGLayoutOpportunity opportunity = |
340 constraint_space_for_children_, fragment, margins); | 341 FindLayoutOpportunityForFragment(constraint_space_, fragment, margins); |
cbiesinger
2016/10/27 21:47:19
I don't think that's correct? If you use constrain
ikilpatrick
2016/10/27 21:56:13
Yeah see constraint_space_->SetSize(...) above.
B
cbiesinger
2016/10/28 18:58:56
Ah I see. So, the basic concept is that instead of
ikilpatrick
2016/10/28 19:43:49
Yeah, more than happy to revisit this later; felt
| |
341 DCHECK(!opportunity.IsEmpty()) << "Opportunity is empty but it shouldn't be"; | 342 DCHECK(!opportunity.IsEmpty()) << "Opportunity is empty but it shouldn't be"; |
342 | 343 |
343 // Calculate the float offset if needed. | 344 // Calculate the float offset if needed. |
344 LayoutUnit float_offset; | 345 LayoutUnit float_offset; |
345 if (current_child_->Style()->floating() == EFloat::Right) { | 346 if (current_child_->Style()->floating() == EFloat::Right) { |
346 float_offset = opportunity.size.inline_size - fragment.InlineSize(); | 347 float_offset = opportunity.size.inline_size - fragment.InlineSize(); |
347 } | 348 } |
348 | 349 |
349 // Add the float as an exclusion. | 350 // Add the float as an exclusion. |
350 const NGExclusion* exclusion = | 351 const NGExclusion* exclusion = |
351 CreateExclusion(fragment, opportunity, float_offset, margins); | 352 CreateExclusion(fragment, opportunity, float_offset, margins); |
352 constraint_space_for_children_->AddExclusion(exclusion); | 353 constraint_space_->AddExclusion(exclusion); |
353 | 354 |
354 return CalculateLogicalOffsetForOpportunity(opportunity, border_and_padding_, | 355 return CalculateLogicalOffsetForOpportunity(opportunity, border_and_padding_, |
355 float_offset, margins); | 356 float_offset, margins); |
356 } | 357 } |
357 | 358 |
359 NGConstraintSpace* | |
360 NGBlockLayoutAlgorithm::CreateConstraintSpaceForCurrentChild() { | |
Gleb Lanbin
2016/10/27 22:30:06
1) move this to the unnamed namespace?
2) may be
ikilpatrick
2016/10/28 00:16:28
done?
| |
361 DCHECK(current_child_); | |
362 space_builder_->SetIsNewFormattingContext( | |
363 IsNewFormattingContextForInFlowBlockLevelChild(*constraint_space_, | |
364 *current_child_->Style())); | |
365 return new NGConstraintSpace(constraint_space_->WritingMode(), | |
366 constraint_space_->Direction(), | |
367 space_builder_->ToConstraintSpace()); | |
368 } | |
369 | |
358 void NGBlockLayoutAlgorithm::UpdateMarginStrut(const NGMarginStrut& from) { | 370 void NGBlockLayoutAlgorithm::UpdateMarginStrut(const NGMarginStrut& from) { |
359 if (!is_fragment_margin_strut_block_start_updated_) { | 371 if (!is_fragment_margin_strut_block_start_updated_) { |
360 builder_->SetMarginStrutBlockStart(from); | 372 builder_->SetMarginStrutBlockStart(from); |
361 is_fragment_margin_strut_block_start_updated_ = true; | 373 is_fragment_margin_strut_block_start_updated_ = true; |
362 } | 374 } |
363 builder_->SetMarginStrutBlockEnd(from); | 375 builder_->SetMarginStrutBlockEnd(from); |
364 } | 376 } |
365 | 377 |
366 DEFINE_TRACE(NGBlockLayoutAlgorithm) { | 378 DEFINE_TRACE(NGBlockLayoutAlgorithm) { |
367 NGLayoutAlgorithm::trace(visitor); | 379 NGLayoutAlgorithm::trace(visitor); |
368 visitor->trace(first_child_); | 380 visitor->trace(first_child_); |
381 visitor->trace(constraint_space_); | |
369 visitor->trace(builder_); | 382 visitor->trace(builder_); |
370 visitor->trace(constraint_space_for_children_); | 383 visitor->trace(space_builder_); |
384 visitor->trace(space_for_current_child_); | |
371 visitor->trace(current_child_); | 385 visitor->trace(current_child_); |
372 } | 386 } |
373 | 387 |
374 } // namespace blink | 388 } // namespace blink |
OLD | NEW |