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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 layout_box_->setHeight(fragment_->Height()); | 239 layout_box_->setHeight(fragment_->Height()); |
240 NGBoxStrut border_and_padding = | 240 NGBoxStrut border_and_padding = |
241 ComputeBorders(Style()) + ComputePadding(constraint_space, Style()); | 241 ComputeBorders(Style()) + ComputePadding(constraint_space, Style()); |
242 LayoutUnit intrinsic_logical_height = | 242 LayoutUnit intrinsic_logical_height = |
243 layout_box_->style()->isHorizontalWritingMode() | 243 layout_box_->style()->isHorizontalWritingMode() |
244 ? fragment_->HeightOverflow() | 244 ? fragment_->HeightOverflow() |
245 : fragment_->WidthOverflow(); | 245 : fragment_->WidthOverflow(); |
246 intrinsic_logical_height -= border_and_padding.BlockSum(); | 246 intrinsic_logical_height -= border_and_padding.BlockSum(); |
247 layout_box_->setIntrinsicContentLogicalHeight(intrinsic_logical_height); | 247 layout_box_->setIntrinsicContentLogicalHeight(intrinsic_logical_height); |
248 | 248 |
| 249 // We may still have unpositioned floats when we reach the root box. |
| 250 if (!layout_box_->parent()) { |
| 251 for (const auto& floating_object : fragment_->PositionedFloats()) { |
| 252 FloatingObjectPositionedUpdated(floating_object, layout_box_); |
| 253 } |
| 254 } |
| 255 |
249 // TODO(layout-dev): Currently we are not actually performing layout on | 256 // TODO(layout-dev): Currently we are not actually performing layout on |
250 // inline children. For now just clear the needsLayout bit so that we can | 257 // inline children. For now just clear the needsLayout bit so that we can |
251 // run unittests. | 258 // run unittests. |
252 if (HasInlineChildren()) { | 259 if (HasInlineChildren()) { |
253 for (InlineWalker walker( | 260 for (InlineWalker walker( |
254 LineLayoutBlockFlow(toLayoutBlockFlow(layout_box_))); | 261 LineLayoutBlockFlow(toLayoutBlockFlow(layout_box_))); |
255 !walker.atEnd(); walker.advance()) { | 262 !walker.atEnd(); walker.advance()) { |
256 LayoutObject* o = LineLayoutAPIShim::layoutObjectFrom(walker.current()); | 263 LayoutObject* o = LineLayoutAPIShim::layoutObjectFrom(walker.current()); |
257 o->clearNeedsLayout(); | 264 o->clearNeedsLayout(); |
258 } | 265 } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 // Save static position for legacy AbsPos layout. | 332 // Save static position for legacy AbsPos layout. |
326 void NGBlockNode::SaveStaticOffsetForLegacy(const NGLogicalOffset& offset) { | 333 void NGBlockNode::SaveStaticOffsetForLegacy(const NGLogicalOffset& offset) { |
327 DCHECK(layout_box_); | 334 DCHECK(layout_box_); |
328 DCHECK(layout_box_->isOutOfFlowPositioned()); | 335 DCHECK(layout_box_->isOutOfFlowPositioned()); |
329 DCHECK(layout_box_->layer()); | 336 DCHECK(layout_box_->layer()); |
330 layout_box_->layer()->setStaticBlockPosition(offset.block_offset); | 337 layout_box_->layer()->setStaticBlockPosition(offset.block_offset); |
331 layout_box_->layer()->setStaticInlinePosition(offset.inline_offset); | 338 layout_box_->layer()->setStaticInlinePosition(offset.inline_offset); |
332 } | 339 } |
333 | 340 |
334 } // namespace blink | 341 } // namespace blink |
OLD | NEW |