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_node.h" | 5 #include "core/layout/ng/ng_block_node.h" |
6 | 6 |
7 #include "core/layout/LayoutBlockFlow.h" | 7 #include "core/layout/LayoutBlockFlow.h" |
8 #include "core/layout/api/LineLayoutAPIShim.h" | 8 #include "core/layout/api/LineLayoutAPIShim.h" |
9 #include "core/layout/line/InlineIterator.h" | 9 #include "core/layout/line/InlineIterator.h" |
10 #include "core/layout/ng/layout_ng_block_flow.h" | 10 #include "core/layout/ng/layout_ng_block_flow.h" |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 ComputePadding(constraint_space, Style()); | 232 ComputePadding(constraint_space, Style()); |
233 LayoutUnit intrinsic_logical_height = | 233 LayoutUnit intrinsic_logical_height = |
234 layout_box_->style()->isHorizontalWritingMode() | 234 layout_box_->style()->isHorizontalWritingMode() |
235 ? fragment->HeightOverflow() | 235 ? fragment->HeightOverflow() |
236 : fragment->WidthOverflow(); | 236 : fragment->WidthOverflow(); |
237 intrinsic_logical_height -= border_and_padding.BlockSum(); | 237 intrinsic_logical_height -= border_and_padding.BlockSum(); |
238 layout_box_->setIntrinsicContentLogicalHeight(intrinsic_logical_height); | 238 layout_box_->setIntrinsicContentLogicalHeight(intrinsic_logical_height); |
239 | 239 |
240 // We may still have unpositioned floats when we reach the root box. | 240 // We may still have unpositioned floats when we reach the root box. |
241 if (!layout_box_->parent()) { | 241 if (!layout_box_->parent()) { |
242 for (const auto& floating_object : fragment->PositionedFloats()) { | 242 for (const RefPtr<NGFloatingObject>& floating_object : |
243 FloatingObjectPositionedUpdated(floating_object, layout_box_); | 243 fragment->PositionedFloats()) { |
| 244 FloatingObjectPositionedUpdated(floating_object.get(), layout_box_); |
244 } | 245 } |
245 } | 246 } |
246 | 247 |
247 for (const auto& child_fragment : fragment->Children()) { | 248 for (const auto& child_fragment : fragment->Children()) { |
248 if (child_fragment->IsPlaced()) | 249 if (child_fragment->IsPlaced()) |
249 FragmentPositionUpdated(toNGPhysicalBoxFragment(*child_fragment)); | 250 FragmentPositionUpdated(toNGPhysicalBoxFragment(*child_fragment)); |
250 | 251 |
251 for (const auto& floating_object : | 252 for (const RefPtr<NGFloatingObject>& floating_object : |
252 toNGPhysicalBoxFragment(child_fragment.get())->PositionedFloats()) { | 253 toNGPhysicalBoxFragment(child_fragment.get())->PositionedFloats()) { |
253 FloatingObjectPositionedUpdated( | 254 FloatingObjectPositionedUpdated( |
254 floating_object, toLayoutBox(child_fragment->GetLayoutObject())); | 255 floating_object.get(), |
| 256 toLayoutBox(child_fragment->GetLayoutObject())); |
255 } | 257 } |
256 } | 258 } |
257 | 259 |
258 if (layout_box_->isLayoutBlock()) | 260 if (layout_box_->isLayoutBlock()) |
259 toLayoutBlock(layout_box_)->layoutPositionedObjects(true); | 261 toLayoutBlock(layout_box_)->layoutPositionedObjects(true); |
260 layout_box_->clearNeedsLayout(); | 262 layout_box_->clearNeedsLayout(); |
261 if (layout_box_->isLayoutBlockFlow()) { | 263 if (layout_box_->isLayoutBlockFlow()) { |
262 toLayoutBlockFlow(layout_box_)->updateIsSelfCollapsing(); | 264 toLayoutBlockFlow(layout_box_)->updateIsSelfCollapsing(); |
263 } | 265 } |
264 } | 266 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 | 327 |
326 // Save static position for legacy AbsPos layout. | 328 // Save static position for legacy AbsPos layout. |
327 void NGBlockNode::SaveStaticOffsetForLegacy(const NGLogicalOffset& offset) { | 329 void NGBlockNode::SaveStaticOffsetForLegacy(const NGLogicalOffset& offset) { |
328 DCHECK(layout_box_->isOutOfFlowPositioned()); | 330 DCHECK(layout_box_->isOutOfFlowPositioned()); |
329 DCHECK(layout_box_->layer()); | 331 DCHECK(layout_box_->layer()); |
330 layout_box_->layer()->setStaticBlockPosition(offset.block_offset); | 332 layout_box_->layer()->setStaticBlockPosition(offset.block_offset); |
331 layout_box_->layer()->setStaticInlinePosition(offset.inline_offset); | 333 layout_box_->layer()->setStaticInlinePosition(offset.inline_offset); |
332 } | 334 } |
333 | 335 |
334 } // namespace blink | 336 } // namespace blink |
OLD | NEW |