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/LayoutMultiColumnFlowThread.h" | 8 #include "core/layout/LayoutMultiColumnFlowThread.h" |
9 #include "core/layout/LayoutMultiColumnSet.h" | 9 #include "core/layout/LayoutMultiColumnSet.h" |
10 #include "core/layout/api/LineLayoutAPIShim.h" | 10 #include "core/layout/api/LineLayoutAPIShim.h" |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 layout_box_->SetHeight(fragment->Size().height); | 272 layout_box_->SetHeight(fragment->Size().height); |
273 NGBoxStrut border_and_padding = ComputeBorders(constraint_space, Style()) + | 273 NGBoxStrut border_and_padding = ComputeBorders(constraint_space, Style()) + |
274 ComputePadding(constraint_space, Style()); | 274 ComputePadding(constraint_space, Style()); |
275 LayoutUnit intrinsic_logical_height = | 275 LayoutUnit intrinsic_logical_height = |
276 layout_box_->Style()->IsHorizontalWritingMode() | 276 layout_box_->Style()->IsHorizontalWritingMode() |
277 ? fragment->OverflowSize().height | 277 ? fragment->OverflowSize().height |
278 : fragment->OverflowSize().width; | 278 : fragment->OverflowSize().width; |
279 intrinsic_logical_height -= border_and_padding.BlockSum(); | 279 intrinsic_logical_height -= border_and_padding.BlockSum(); |
280 layout_box_->SetIntrinsicContentLogicalHeight(intrinsic_logical_height); | 280 layout_box_->SetIntrinsicContentLogicalHeight(intrinsic_logical_height); |
281 | 281 |
282 // We may still have unpositioned floats when we reach the root box. | 282 for (const NGPositionedFloat& positioned_float : fragment->PositionedFloats()) |
283 if (!layout_box_->Parent()) { | 283 FloatingObjectPositionedUpdated(positioned_float, layout_box_); |
284 for (const NGPositionedFloat& positioned_float : | |
285 fragment->PositionedFloats()) { | |
286 FloatingObjectPositionedUpdated(positioned_float, layout_box_); | |
287 } | |
288 } | |
289 | 284 |
290 for (const auto& child_fragment : fragment->Children()) { | 285 for (const auto& child_fragment : fragment->Children()) { |
291 if (child_fragment->IsPlaced()) | 286 if (child_fragment->IsPlaced()) |
292 FragmentPositionUpdated(ToNGPhysicalBoxFragment(*child_fragment)); | 287 FragmentPositionUpdated(ToNGPhysicalBoxFragment(*child_fragment)); |
293 | 288 |
294 for (const NGPositionedFloat& positioned_float : | 289 for (const NGPositionedFloat& positioned_float : |
295 ToNGPhysicalBoxFragment(child_fragment.Get())->PositionedFloats()) { | 290 ToNGPhysicalBoxFragment(child_fragment.Get())->PositionedFloats()) { |
296 FloatingObjectPositionedUpdated( | 291 FloatingObjectPositionedUpdated( |
297 positioned_float, ToLayoutBox(child_fragment->GetLayoutObject())); | 292 positioned_float, ToLayoutBox(child_fragment->GetLayoutObject())); |
298 } | 293 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 | 366 |
372 // Save static position for legacy AbsPos layout. | 367 // Save static position for legacy AbsPos layout. |
373 void NGBlockNode::SaveStaticOffsetForLegacy(const NGLogicalOffset& offset) { | 368 void NGBlockNode::SaveStaticOffsetForLegacy(const NGLogicalOffset& offset) { |
374 DCHECK(layout_box_->IsOutOfFlowPositioned()); | 369 DCHECK(layout_box_->IsOutOfFlowPositioned()); |
375 DCHECK(layout_box_->Layer()); | 370 DCHECK(layout_box_->Layer()); |
376 layout_box_->Layer()->SetStaticBlockPosition(offset.block_offset); | 371 layout_box_->Layer()->SetStaticBlockPosition(offset.block_offset); |
377 layout_box_->Layer()->SetStaticInlinePosition(offset.inline_offset); | 372 layout_box_->Layer()->SetStaticInlinePosition(offset.inline_offset); |
378 } | 373 } |
379 | 374 |
380 } // namespace blink | 375 } // namespace blink |
OLD | NEW |