Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(929)

Side by Side Diff: third_party/WebKit/Source/core/layout/ng/layout_ng_block_flow.cc

Issue 2702403003: [layoutng] Split NGLayoutResult out of NGPhysicalFragment (Closed)
Patch Set: rebased Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 10
11 namespace blink { 11 namespace blink {
12 12
13 LayoutNGBlockFlow::LayoutNGBlockFlow(Element* element) 13 LayoutNGBlockFlow::LayoutNGBlockFlow(Element* element)
14 : LayoutBlockFlow(element) {} 14 : LayoutBlockFlow(element) {}
15 15
16 bool LayoutNGBlockFlow::isOfType(LayoutObjectType type) const { 16 bool LayoutNGBlockFlow::isOfType(LayoutObjectType type) const {
17 return type == LayoutObjectNGBlockFlow || LayoutBlockFlow::isOfType(type); 17 return type == LayoutObjectNGBlockFlow || LayoutBlockFlow::isOfType(type);
18 } 18 }
19 19
20 void LayoutNGBlockFlow::layoutBlock(bool relayoutChildren) { 20 void LayoutNGBlockFlow::layoutBlock(bool relayoutChildren) {
21 LayoutAnalyzer::BlockScope analyzer(*this); 21 LayoutAnalyzer::BlockScope analyzer(*this);
22 22
23 auto* constraint_space = NGConstraintSpace::CreateFromLayoutObject(*this); 23 auto* constraint_space = NGConstraintSpace::CreateFromLayoutObject(*this);
24 24
25 // TODO(layout-dev): This should be created in the constructor once instead. 25 // TODO(layout-dev): This should be created in the constructor once instead.
26 // There is some internal state which needs to be cleared between layout 26 // There is some internal state which needs to be cleared between layout
27 // passes (probably FirstChild(), etc). 27 // passes (probably FirstChild(), etc).
28 m_box = new NGBlockNode(this); 28 m_box = new NGBlockNode(this);
29 29
30 RefPtr<NGPhysicalFragment> fragment = m_box->Layout(constraint_space); 30 RefPtr<NGLayoutResult> result = m_box->Layout(constraint_space);
31 31
32 if (isOutOfFlowPositioned()) { 32 if (isOutOfFlowPositioned()) {
33 // In legacy layout, abspos differs from regular blocks in that abspos 33 // In legacy layout, abspos differs from regular blocks in that abspos
34 // blocks position themselves in their own layout, instead of getting 34 // blocks position themselves in their own layout, instead of getting
35 // positioned by their parent. So it we are a positioned block in a legacy- 35 // positioned by their parent. So it we are a positioned block in a legacy-
36 // layout containing block, we have to emulate this positioning. 36 // layout containing block, we have to emulate this positioning.
37 // Additionally, until we natively support abspos in LayoutNG, this code 37 // Additionally, until we natively support abspos in LayoutNG, this code
38 // will also be reached though the layoutPositionedObjects call in 38 // will also be reached though the layoutPositionedObjects call in
39 // NGBlockNode::CopyFragmentDataToLayoutBox. 39 // NGBlockNode::CopyFragmentDataToLayoutBox.
40 LogicalExtentComputedValues computedValues; 40 LogicalExtentComputedValues computedValues;
41 computeLogicalWidth(computedValues); 41 computeLogicalWidth(computedValues);
42 setLogicalLeft(computedValues.m_position); 42 setLogicalLeft(computedValues.m_position);
43 computeLogicalHeight(logicalHeight(), logicalTop(), computedValues); 43 computeLogicalHeight(logicalHeight(), logicalTop(), computedValues);
44 setLogicalTop(computedValues.m_position); 44 setLogicalTop(computedValues.m_position);
45 } 45 }
46 46
47 for (auto& descendant : fragment->OutOfFlowDescendants()) 47 for (auto& descendant : result->OutOfFlowDescendants())
48 descendant->UseOldOutOfFlowPositioning(); 48 descendant->UseOldOutOfFlowPositioning();
49 clearNeedsLayout(); 49 clearNeedsLayout();
50 } 50 }
51 51
52 } // namespace blink 52 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/BUILD.gn ('k') | third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698