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/layout_ng_block_flow.h" | 5 #include "core/layout/ng/layout_ng_block_flow.h" |
6 | 6 |
7 #include "core/layout/LayoutAnalyzer.h" | 7 #include "core/layout/LayoutAnalyzer.h" |
8 #include "core/layout/ng/ng_constraint_space.h" | 8 #include "core/layout/ng/ng_constraint_space.h" |
9 #include "core/layout/ng/ng_fragment.h" | 9 #include "core/layout/ng/ng_fragment.h" |
| 10 #include "core/layout/ng/ng_min_max_content_size.h" |
10 | 11 |
11 namespace blink { | 12 namespace blink { |
12 | 13 |
13 LayoutNGBlockFlow::LayoutNGBlockFlow(Element* element) | 14 LayoutNGBlockFlow::LayoutNGBlockFlow(Element* element) |
14 : LayoutBlockFlow(element) {} | 15 : LayoutBlockFlow(element) {} |
15 | 16 |
16 bool LayoutNGBlockFlow::isOfType(LayoutObjectType type) const { | 17 bool LayoutNGBlockFlow::isOfType(LayoutObjectType type) const { |
17 return type == LayoutObjectNGBlockFlow || LayoutBlockFlow::isOfType(type); | 18 return type == LayoutObjectNGBlockFlow || LayoutBlockFlow::isOfType(type); |
18 } | 19 } |
19 | 20 |
(...skipping 23 matching lines...) Expand all Loading... |
43 setLogicalLeft(computedValues.m_position); | 44 setLogicalLeft(computedValues.m_position); |
44 computeLogicalHeight(logicalHeight(), logicalTop(), computedValues); | 45 computeLogicalHeight(logicalHeight(), logicalTop(), computedValues); |
45 setLogicalTop(computedValues.m_position); | 46 setLogicalTop(computedValues.m_position); |
46 } | 47 } |
47 | 48 |
48 for (auto& descendant : result->OutOfFlowDescendants()) | 49 for (auto& descendant : result->OutOfFlowDescendants()) |
49 descendant->UseOldOutOfFlowPositioning(); | 50 descendant->UseOldOutOfFlowPositioning(); |
50 clearNeedsLayout(); | 51 clearNeedsLayout(); |
51 } | 52 } |
52 | 53 |
| 54 void LayoutNGBlockFlow::computeIntrinsicLogicalWidths( |
| 55 LayoutUnit& minLogicalWidth, |
| 56 LayoutUnit& maxLogicalWidth) const { |
| 57 // TODO(layout-dev): This should be created in the constructor once instead. |
| 58 // See also the comment in layoutBlock(). |
| 59 NGBlockNode* node = new NGBlockNode(const_cast<LayoutNGBlockFlow*>(this)); |
| 60 if (!node->CanUseNewLayout()) { |
| 61 LayoutBlockFlow::computeIntrinsicLogicalWidths(minLogicalWidth, |
| 62 maxLogicalWidth); |
| 63 return; |
| 64 } |
| 65 MinMaxContentSize sizes = node->ComputeMinMaxContentSize(); |
| 66 minLogicalWidth = sizes.min_content; |
| 67 maxLogicalWidth = sizes.max_content; |
| 68 } |
| 69 |
53 } // namespace blink | 70 } // namespace blink |
OLD | NEW |