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 #ifndef NGBlockLayoutAlgorithm_h | 5 #ifndef NGBlockLayoutAlgorithm_h |
6 #define NGBlockLayoutAlgorithm_h | 6 #define NGBlockLayoutAlgorithm_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/layout/ng/ng_box.h" | 9 #include "core/layout/ng/ng_box.h" |
| 10 #include "core/layout/ng/ng_box_iterator.h" |
10 #include "core/layout/ng/ng_layout_algorithm.h" | 11 #include "core/layout/ng/ng_layout_algorithm.h" |
11 #include "wtf/RefPtr.h" | 12 #include "wtf/RefPtr.h" |
12 | 13 |
13 namespace blink { | 14 namespace blink { |
14 | 15 |
15 class ComputedStyle; | 16 class ComputedStyle; |
16 class NGConstraintSpace; | 17 class NGConstraintSpace; |
17 class NGFragment; | 18 class NGFragment; |
18 | 19 |
19 // A class for general block layout (e.g. a <div> with no special style). | 20 // A class for general block layout (e.g. a <div> with no special style). |
20 // Lays out the children in sequence. | 21 // Lays out the children in sequence. |
21 class CORE_EXPORT NGBlockLayoutAlgorithm : public NGLayoutAlgorithm { | 22 class CORE_EXPORT NGBlockLayoutAlgorithm : public NGLayoutAlgorithm { |
22 public: | 23 public: |
23 NGBlockLayoutAlgorithm(PassRefPtr<const ComputedStyle>, NGBox); | 24 // Default constructor. |
| 25 // @param style Style reference of the block that is being laid out. |
| 26 // @param boxIterator Iterator for the block's children. |
| 27 NGBlockLayoutAlgorithm(PassRefPtr<const ComputedStyle>, NGBoxIterator); |
24 | 28 |
25 // Actual layout implementation. Lays out the children in sequence within the | 29 // Actual layout implementation. Lays out the children in sequence within the |
26 // constraints given by the NGConstraintSpace. Returns a fragment with the | 30 // constraints given by the NGConstraintSpace. Returns a fragment with the |
27 // resulting layout information. | 31 // resulting layout information. |
28 // This function can not be const because for interruptible layout, we have | 32 // This function can not be const because for interruptible layout, we have |
29 // to be able to store state information. | 33 // to be able to store state information. |
30 NGFragment* layout(const NGConstraintSpace&) override; | 34 NGFragment* layout(const NGConstraintSpace&) override; |
31 | 35 |
32 private: | 36 private: |
33 RefPtr<const ComputedStyle> m_style; | 37 RefPtr<const ComputedStyle> m_style; |
34 NGBox m_firstChild; | 38 NGBoxIterator m_boxIterator; |
35 }; | 39 }; |
36 | 40 |
37 } // namespace blink | 41 } // namespace blink |
38 | 42 |
39 #endif // NGBlockLayoutAlgorithm_h | 43 #endif // NGBlockLayoutAlgorithm_h |
OLD | NEW |