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