| 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_block_layout_algorithm.h" | |
| 8 #include "core/layout/ng/ng_fragment_base.h" | |
| 9 #include "core/layout/LayoutAnalyzer.h" | 7 #include "core/layout/LayoutAnalyzer.h" |
| 10 | 8 |
| 11 namespace blink { | 9 namespace blink { |
| 12 | 10 |
| 13 LayoutNGBlockFlow::LayoutNGBlockFlow(Element* element) | 11 LayoutNGBlockFlow::LayoutNGBlockFlow(Element* element) |
| 14 : LayoutBlockFlow(element) {} | 12 : LayoutBlockFlow(element) {} |
| 15 | 13 |
| 16 bool LayoutNGBlockFlow::isOfType(LayoutObjectType type) const { | 14 bool LayoutNGBlockFlow::isOfType(LayoutObjectType type) const { |
| 17 return type == LayoutObjectNGBlockFlow || LayoutBlockFlow::isOfType(type); | 15 return type == LayoutObjectNGBlockFlow || LayoutBlockFlow::isOfType(type); |
| 18 } | 16 } |
| 19 | 17 |
| 20 void LayoutNGBlockFlow::layoutBlock(bool relayoutChildren) { | 18 void LayoutNGBlockFlow::layoutBlock(bool relayoutChildren) { |
| 21 LayoutAnalyzer::BlockScope analyzer(*this); | 19 LayoutAnalyzer::BlockScope analyzer(*this); |
| 22 | 20 |
| 23 const auto* constraint_space = | 21 const auto* constraint_space = |
| 24 NGConstraintSpace::CreateFromLayoutObject(*this); | 22 NGConstraintSpace::CreateFromLayoutObject(*this); |
| 25 | 23 |
| 26 // 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. |
| 27 // 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 |
| 28 // passes (probably FirstChild(), etc). | 26 // passes (probably FirstChild(), etc). |
| 29 m_box = new NGBlockNode(this); | 27 m_box = new NGBlockNode(this); |
| 30 | 28 |
| 31 NGFragmentBase* fragment; | 29 NGFragmentBase* fragment; |
| 32 while (!m_box->Layout(constraint_space, &fragment)) | 30 while (!m_box->Layout(constraint_space, &fragment)) |
| 33 ; | 31 ; |
| 34 clearNeedsLayout(); | 32 clearNeedsLayout(); |
| 35 } | 33 } |
| 36 | 34 |
| 37 } // namespace blink | 35 } // namespace blink |
| OLD | NEW |