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 for (const auto& floating_object : fragment_->PositionedFloats()) { |
| 250 FloatingObjectPositionedUpdated(floating_object, layout_box_); |
| 251 } |
| 252 |
249 // TODO(layout-dev): Currently we are not actually performing layout on | 253 // 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 | 254 // inline children. For now just clear the needsLayout bit so that we can |
251 // run unittests. | 255 // run unittests. |
252 if (HasInlineChildren()) { | 256 if (HasInlineChildren()) { |
253 for (InlineWalker walker( | 257 for (InlineWalker walker( |
254 LineLayoutBlockFlow(toLayoutBlockFlow(layout_box_))); | 258 LineLayoutBlockFlow(toLayoutBlockFlow(layout_box_))); |
255 !walker.atEnd(); walker.advance()) { | 259 !walker.atEnd(); walker.advance()) { |
256 LayoutObject* o = LineLayoutAPIShim::layoutObjectFrom(walker.current()); | 260 LayoutObject* o = LineLayoutAPIShim::layoutObjectFrom(walker.current()); |
257 o->clearNeedsLayout(); | 261 o->clearNeedsLayout(); |
258 } | 262 } |
259 | 263 |
260 // Ensure the position of the children are copied across to the | 264 // Ensure the position of the children are copied across to the |
261 // LayoutObject tree. | 265 // LayoutObject tree. |
262 } else { | 266 } else { |
263 for (const auto& child_fragment : fragment_->Children()) { | 267 for (const auto& child_fragment : fragment_->Children()) { |
264 if (child_fragment->IsPlaced()) | 268 if (child_fragment->IsPlaced()) |
265 FragmentPositionUpdated(toNGPhysicalBoxFragment(*child_fragment)); | 269 FragmentPositionUpdated(toNGPhysicalBoxFragment(*child_fragment)); |
266 | |
267 for (const auto& floating_object : child_fragment->PositionedFloats()) { | |
268 FloatingObjectPositionedUpdated(floating_object, layout_box_); | |
269 } | |
270 } | 270 } |
271 } | 271 } |
272 | 272 |
273 if (layout_box_->isLayoutBlock()) | 273 if (layout_box_->isLayoutBlock()) |
274 toLayoutBlock(layout_box_)->layoutPositionedObjects(true); | 274 toLayoutBlock(layout_box_)->layoutPositionedObjects(true); |
275 layout_box_->clearNeedsLayout(); | 275 layout_box_->clearNeedsLayout(); |
276 if (layout_box_->isLayoutBlockFlow()) { | 276 if (layout_box_->isLayoutBlockFlow()) { |
277 toLayoutBlockFlow(layout_box_)->updateIsSelfCollapsing(); | 277 toLayoutBlockFlow(layout_box_)->updateIsSelfCollapsing(); |
278 } | 278 } |
279 } | 279 } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 // Save static position for legacy AbsPos layout. | 325 // Save static position for legacy AbsPos layout. |
326 void NGBlockNode::SaveStaticOffsetForLegacy(const NGLogicalOffset& offset) { | 326 void NGBlockNode::SaveStaticOffsetForLegacy(const NGLogicalOffset& offset) { |
327 DCHECK(layout_box_); | 327 DCHECK(layout_box_); |
328 DCHECK(layout_box_->isOutOfFlowPositioned()); | 328 DCHECK(layout_box_->isOutOfFlowPositioned()); |
329 DCHECK(layout_box_->layer()); | 329 DCHECK(layout_box_->layer()); |
330 layout_box_->layer()->setStaticBlockPosition(offset.block_offset); | 330 layout_box_->layer()->setStaticBlockPosition(offset.block_offset); |
331 layout_box_->layer()->setStaticInlinePosition(offset.inline_offset); | 331 layout_box_->layer()->setStaticInlinePosition(offset.inline_offset); |
332 } | 332 } |
333 | 333 |
334 } // namespace blink | 334 } // namespace blink |
OLD | NEW |