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/LayoutObject.h" | 7 #include "core/layout/LayoutObject.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_box_iterator.h" | 10 #include "core/layout/ng/ng_box_iterator.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 fragment = algorithm.layout(constraintSpace); | 25 fragment = algorithm.layout(constraintSpace); |
26 m_layoutBox->setLogicalWidth(fragment->InlineSize()); | 26 m_layoutBox->setLogicalWidth(fragment->InlineSize()); |
27 m_layoutBox->setLogicalHeight(fragment->BlockSize()); | 27 m_layoutBox->setLogicalHeight(fragment->BlockSize()); |
28 if (m_layoutBox->isLayoutBlock()) | 28 if (m_layoutBox->isLayoutBlock()) |
29 toLayoutBlock(m_layoutBox)->layoutPositionedObjects(true); | 29 toLayoutBlock(m_layoutBox)->layoutPositionedObjects(true); |
30 m_layoutBox->clearNeedsLayout(); | 30 m_layoutBox->clearNeedsLayout(); |
31 } else { | 31 } else { |
32 // TODO(layout-ng): If fixedSize is true, set the override width/height too | 32 // TODO(layout-ng): If fixedSize is true, set the override width/height too |
33 NGLogicalSize containerSize = constraintSpace.ContainerSize(); | 33 NGLogicalSize containerSize = constraintSpace.ContainerSize(); |
34 m_layoutBox->setOverrideContainingBlockContentLogicalWidth( | 34 m_layoutBox->setOverrideContainingBlockContentLogicalWidth( |
35 containerSize.inlineSize); | 35 containerSize.inline_size); |
36 m_layoutBox->setOverrideContainingBlockContentLogicalHeight( | 36 m_layoutBox->setOverrideContainingBlockContentLogicalHeight( |
37 containerSize.blockSize); | 37 containerSize.block_size); |
38 if (m_layoutBox->isLayoutNGBlockFlow() && m_layoutBox->needsLayout()) { | 38 if (m_layoutBox->isLayoutNGBlockFlow() && m_layoutBox->needsLayout()) { |
39 toLayoutNGBlockFlow(m_layoutBox)->LayoutBlockFlow::layoutBlock(true); | 39 toLayoutNGBlockFlow(m_layoutBox)->LayoutBlockFlow::layoutBlock(true); |
40 } else { | 40 } else { |
41 m_layoutBox->layoutIfNeeded(); | 41 m_layoutBox->layoutIfNeeded(); |
42 } | 42 } |
43 LayoutRect overflow = m_layoutBox->layoutOverflowRect(); | 43 LayoutRect overflow = m_layoutBox->layoutOverflowRect(); |
44 // TODO(layout-ng): This does not handle writing modes correctly (for | 44 // TODO(layout-ng): This does not handle writing modes correctly (for |
45 // overflow & the enums) | 45 // overflow & the enums) |
46 NGFragmentBuilder builder(NGFragmentBase::FragmentBox); | 46 NGFragmentBuilder builder(NGFragmentBase::FragmentBox); |
47 builder.SetInlineSize(m_layoutBox->logicalWidth()) | 47 builder.SetInlineSize(m_layoutBox->logicalWidth()) |
(...skipping 27 matching lines...) Expand all Loading... |
75 } | 75 } |
76 | 76 |
77 bool NGBox::canUseNewLayout() { | 77 bool NGBox::canUseNewLayout() { |
78 if (!m_layoutBox) | 78 if (!m_layoutBox) |
79 return true; | 79 return true; |
80 if (m_layoutBox->isLayoutBlockFlow() && !m_layoutBox->childrenInline()) | 80 if (m_layoutBox->isLayoutBlockFlow() && !m_layoutBox->childrenInline()) |
81 return true; | 81 return true; |
82 return false; | 82 return false; |
83 } | 83 } |
84 } // namespace blink | 84 } // namespace blink |
OLD | NEW |