| 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_box.h" | 5 #include "core/layout/ng/ng_box.h" |
| 6 | 6 |
| 7 #include "core/layout/LayoutBlockFlow.h" |
| 7 #include "core/layout/ng/layout_ng_block_flow.h" | 8 #include "core/layout/ng/layout_ng_block_flow.h" |
| 8 #include "core/layout/ng/ng_block_layout_algorithm.h" | 9 #include "core/layout/ng/ng_block_layout_algorithm.h" |
| 9 #include "core/layout/ng/ng_constraint_space.h" | 10 #include "core/layout/ng/ng_constraint_space.h" |
| 10 #include "core/layout/ng/ng_direction.h" | 11 #include "core/layout/ng/ng_direction.h" |
| 11 #include "core/layout/ng/ng_fragment.h" | 12 #include "core/layout/ng/ng_fragment.h" |
| 12 #include "core/layout/ng/ng_fragment_builder.h" | 13 #include "core/layout/ng/ng_fragment_builder.h" |
| 13 #include "core/layout/ng/ng_writing_mode.h" | 14 #include "core/layout/ng/ng_writing_mode.h" |
| 14 | 15 |
| 15 namespace blink { | 16 namespace blink { |
| 16 NGBox::NGBox(LayoutObject* layout_object) | 17 NGBox::NGBox(LayoutObject* layout_object) |
| (...skipping 29 matching lines...) Expand all Loading... |
| 46 // Ensure the position of the children are copied across to the | 47 // Ensure the position of the children are copied across to the |
| 47 // LayoutObject tree. | 48 // LayoutObject tree. |
| 48 for (NGBox* box = FirstChild(); box; box = box->NextSibling()) { | 49 for (NGBox* box = FirstChild(); box; box = box->NextSibling()) { |
| 49 if (box->fragment_) | 50 if (box->fragment_) |
| 50 box->PositionUpdated(); | 51 box->PositionUpdated(); |
| 51 } | 52 } |
| 52 | 53 |
| 53 if (layout_box_->isLayoutBlock()) | 54 if (layout_box_->isLayoutBlock()) |
| 54 toLayoutBlock(layout_box_)->layoutPositionedObjects(true); | 55 toLayoutBlock(layout_box_)->layoutPositionedObjects(true); |
| 55 layout_box_->clearNeedsLayout(); | 56 layout_box_->clearNeedsLayout(); |
| 57 if (layout_box_->isLayoutBlockFlow()) { |
| 58 toLayoutBlockFlow(layout_box_)->updateIsSelfCollapsing(); |
| 59 } |
| 56 } | 60 } |
| 57 } else { | 61 } else { |
| 58 DCHECK(layout_box_); | 62 DCHECK(layout_box_); |
| 59 // TODO(layout-ng): If fixedSize is true, set the override width/height too | 63 // TODO(layout-ng): If fixedSize is true, set the override width/height too |
| 60 NGLogicalSize container_size = constraint_space->ContainerSize(); | 64 NGLogicalSize container_size = constraint_space->ContainerSize(); |
| 61 layout_box_->setOverrideContainingBlockContentLogicalWidth( | 65 layout_box_->setOverrideContainingBlockContentLogicalWidth( |
| 62 container_size.inline_size); | 66 container_size.inline_size); |
| 63 layout_box_->setOverrideContainingBlockContentLogicalHeight( | 67 layout_box_->setOverrideContainingBlockContentLogicalHeight( |
| 64 container_size.block_size); | 68 container_size.block_size); |
| 65 if (layout_box_->isLayoutNGBlockFlow() && layout_box_->needsLayout()) { | 69 if (layout_box_->isLayoutNGBlockFlow() && layout_box_->needsLayout()) { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 | 132 |
| 129 bool NGBox::CanUseNewLayout() { | 133 bool NGBox::CanUseNewLayout() { |
| 130 if (!layout_box_) | 134 if (!layout_box_) |
| 131 return true; | 135 return true; |
| 132 if (!layout_box_->isLayoutBlockFlow()) | 136 if (!layout_box_->isLayoutBlockFlow()) |
| 133 return false; | 137 return false; |
| 134 const LayoutBlockFlow* block_flow = toLayoutBlockFlow(layout_box_); | 138 const LayoutBlockFlow* block_flow = toLayoutBlockFlow(layout_box_); |
| 135 return !block_flow->childrenInline() || !block_flow->firstChild(); | 139 return !block_flow->childrenInline() || !block_flow->firstChild(); |
| 136 } | 140 } |
| 137 } // namespace blink | 141 } // namespace blink |
| OLD | NEW |