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/LayoutAnalyzer.h" | 7 #include "core/layout/LayoutAnalyzer.h" |
8 | 8 |
9 namespace blink { | 9 namespace blink { |
10 | 10 |
11 LayoutNGBlockFlow::LayoutNGBlockFlow(Element* element) | 11 LayoutNGBlockFlow::LayoutNGBlockFlow(Element* element) |
12 : LayoutBlockFlow(element) {} | 12 : LayoutBlockFlow(element) {} |
13 | 13 |
14 bool LayoutNGBlockFlow::isOfType(LayoutObjectType type) const { | 14 bool LayoutNGBlockFlow::isOfType(LayoutObjectType type) const { |
15 return type == LayoutObjectNGBlockFlow || LayoutBlockFlow::isOfType(type); | 15 return type == LayoutObjectNGBlockFlow || LayoutBlockFlow::isOfType(type); |
16 } | 16 } |
17 | 17 |
18 void LayoutNGBlockFlow::layoutBlock(bool relayoutChildren) { | 18 void LayoutNGBlockFlow::layoutBlock(bool relayoutChildren) { |
19 LayoutAnalyzer::BlockScope analyzer(*this); | 19 LayoutAnalyzer::BlockScope analyzer(*this); |
20 | 20 |
21 const auto* constraint_space = | 21 auto* constraint_space = NGConstraintSpace::CreateFromLayoutObject(*this); |
22 NGConstraintSpace::CreateFromLayoutObject(*this); | |
23 | 22 |
24 // TODO(layout-dev): This should be created in the constructor once instead. | 23 // 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 | 24 // There is some internal state which needs to be cleared between layout |
26 // passes (probably FirstChild(), etc). | 25 // passes (probably FirstChild(), etc). |
27 m_box = new NGBlockNode(this); | 26 m_box = new NGBlockNode(this); |
28 | 27 |
29 NGFragmentBase* fragment; | 28 NGFragmentBase* fragment; |
30 while (!m_box->Layout(constraint_space, &fragment)) | 29 while (!m_box->Layout(constraint_space, &fragment)) |
31 ; | 30 ; |
32 clearNeedsLayout(); | 31 clearNeedsLayout(); |
33 } | 32 } |
34 | 33 |
35 } // namespace blink | 34 } // namespace blink |
OLD | NEW |