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/LayoutBlockFlow.h" |
8 #include "core/layout/ng/layout_ng_block_flow.h" | 8 #include "core/layout/ng/layout_ng_block_flow.h" |
9 #include "core/layout/ng/ng_block_layout_algorithm.h" | 9 #include "core/layout/ng/ng_block_layout_algorithm.h" |
10 #include "core/layout/ng/ng_constraint_space.h" | 10 #include "core/layout/ng/ng_constraint_space.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 DCHECK(layout_box_); | 75 DCHECK(layout_box_); |
76 // TODO(layout-ng): If fixedSize is true, set the override width/height too | 76 // TODO(layout-ng): If fixedSize is true, set the override width/height too |
77 NGLogicalSize container_size = constraint_space->ContainerSize(); | 77 NGLogicalSize container_size = constraint_space->ContainerSize(); |
78 layout_box_->setOverrideContainingBlockContentLogicalWidth( | 78 layout_box_->setOverrideContainingBlockContentLogicalWidth( |
79 container_size.inline_size); | 79 container_size.inline_size); |
80 layout_box_->setOverrideContainingBlockContentLogicalHeight( | 80 layout_box_->setOverrideContainingBlockContentLogicalHeight( |
81 container_size.block_size); | 81 container_size.block_size); |
82 if (layout_box_->isLayoutNGBlockFlow() && layout_box_->needsLayout()) { | 82 if (layout_box_->isLayoutNGBlockFlow() && layout_box_->needsLayout()) { |
83 toLayoutNGBlockFlow(layout_box_)->LayoutBlockFlow::layoutBlock(true); | 83 toLayoutNGBlockFlow(layout_box_)->LayoutBlockFlow::layoutBlock(true); |
84 } else { | 84 } else { |
85 layout_box_->layoutIfNeeded(); | 85 layout_box_->forceLayout(); |
86 } | 86 } |
87 LayoutRect overflow = layout_box_->layoutOverflowRect(); | 87 LayoutRect overflow = layout_box_->layoutOverflowRect(); |
88 // TODO(layout-ng): This does not handle writing modes correctly (for | 88 // TODO(layout-ng): This does not handle writing modes correctly (for |
89 // overflow) | 89 // overflow) |
90 NGFragmentBuilder builder(NGPhysicalFragmentBase::FragmentBox); | 90 NGFragmentBuilder builder(NGPhysicalFragmentBase::FragmentBox); |
91 builder.SetInlineSize(layout_box_->logicalWidth()) | 91 builder.SetInlineSize(layout_box_->logicalWidth()) |
92 .SetBlockSize(layout_box_->logicalHeight()) | 92 .SetBlockSize(layout_box_->logicalHeight()) |
93 .SetDirection( | 93 .SetDirection( |
94 FromPlatformDirection(layout_box_->styleRef().direction())) | 94 FromPlatformDirection(layout_box_->styleRef().direction())) |
95 .SetWritingMode( | 95 .SetWritingMode( |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 | 149 |
150 bool NGBox::CanUseNewLayout() { | 150 bool NGBox::CanUseNewLayout() { |
151 if (!layout_box_) | 151 if (!layout_box_) |
152 return true; | 152 return true; |
153 if (!layout_box_->isLayoutBlockFlow()) | 153 if (!layout_box_->isLayoutBlockFlow()) |
154 return false; | 154 return false; |
155 const LayoutBlockFlow* block_flow = toLayoutBlockFlow(layout_box_); | 155 const LayoutBlockFlow* block_flow = toLayoutBlockFlow(layout_box_); |
156 return !block_flow->childrenInline() || !block_flow->firstChild(); | 156 return !block_flow->childrenInline() || !block_flow->firstChild(); |
157 } | 157 } |
158 } // namespace blink | 158 } // namespace blink |
OLD | NEW |