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 #include "core/layout/ng/ng_constraint_space.h" | 6 #include "core/layout/ng/ng_constraint_space.h" |
7 #include "core/layout/ng/ng_fragment_base.h" | 7 #include "core/layout/ng/ng_fragment_base.h" |
8 #include "core/layout/LayoutAnalyzer.h" | 8 #include "core/layout/LayoutAnalyzer.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 // TODO(layout-dev): This should be created in the constructor once instead. | 24 // TODO(layout-dev): This should be created in the constructor once instead. |
25 // There is some internal state which needs to be cleared between layout | 25 // There is some internal state which needs to be cleared between layout |
26 // passes (probably FirstChild(), etc). | 26 // passes (probably FirstChild(), etc). |
27 m_box = new NGBlockNode(this); | 27 m_box = new NGBlockNode(this); |
28 | 28 |
29 NGFragmentBase* fragment; | 29 NGFragmentBase* fragment; |
30 while (!m_box->Layout(constraint_space, &fragment)) | 30 while (!m_box->Layout(constraint_space, &fragment)) |
31 ; | 31 ; |
32 | 32 |
| 33 if (isOutOfFlowPositioned()) { |
| 34 // In legacy layout, abspos differs from regular blocks in that abspos |
| 35 // blocks position themselves in their own layout, instead of getting |
| 36 // positioned by their parent. So it we are a positioned block in a legacy- |
| 37 // layout containing block, we have to emulate this positioning. |
| 38 // Additionally, until we natively support abspos in LayoutNG, this code |
| 39 // will also be reached though the layoutPositionedObjects call in |
| 40 // NGBlockNode::CopyFragmentDataToLayoutBox. |
| 41 LogicalExtentComputedValues computedValues; |
| 42 computeLogicalWidth(computedValues); |
| 43 setLogicalLeft(computedValues.m_position); |
| 44 computeLogicalHeight(logicalHeight(), logicalTop(), computedValues); |
| 45 setLogicalTop(computedValues.m_position); |
| 46 } |
| 47 |
33 for (auto& descendant : fragment->PhysicalFragment()->OutOfFlowDescendants()) | 48 for (auto& descendant : fragment->PhysicalFragment()->OutOfFlowDescendants()) |
34 descendant->UseOldOutOfFlowPositioning(); | 49 descendant->UseOldOutOfFlowPositioning(); |
35 clearNeedsLayout(); | 50 clearNeedsLayout(); |
36 } | 51 } |
37 | 52 |
38 } // namespace blink | 53 } // namespace blink |
OLD | NEW |