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_layout_algorithm.h" |
10 #include "wtf/RefPtr.h" | 11 #include "wtf/RefPtr.h" |
11 | 12 |
12 namespace blink { | 13 namespace blink { |
13 | 14 |
14 class ComputedStyle; | 15 class ComputedStyle; |
15 class NGConstraintSpace; | 16 class NGConstraintSpace; |
16 class NGFragment; | 17 class NGFragment; |
17 | 18 |
18 // 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). |
19 // Lays out the children in sequence. | 20 // Lays out the children in sequence. |
20 class CORE_EXPORT NGBlockLayoutAlgorithm { | 21 class CORE_EXPORT NGBlockLayoutAlgorithm : public NGLayoutAlgorithm { |
21 public: | 22 public: |
22 NGBlockLayoutAlgorithm(PassRefPtr<const ComputedStyle>, NGBox); | 23 NGBlockLayoutAlgorithm(PassRefPtr<const ComputedStyle>, NGBox); |
23 | 24 |
24 // Actual layout implementation. Lays out the children in sequence within the | 25 // Actual layout implementation. Lays out the children in sequence within the |
25 // constraints given by the NGConstraintSpace. Returns a fragment with the | 26 // constraints given by the NGConstraintSpace. Returns a fragment with the |
26 // resulting layout information. | 27 // resulting layout information. |
27 // 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 |
28 // to be able to store state information. | 29 // to be able to store state information. |
29 NGFragment* layout(const NGConstraintSpace&); | 30 NGFragment* layout(const NGConstraintSpace&) override; |
30 | 31 |
31 private: | 32 private: |
32 RefPtr<const ComputedStyle> m_style; | 33 RefPtr<const ComputedStyle> m_style; |
33 NGBox m_firstChild; | 34 NGBox m_firstChild; |
34 }; | 35 }; |
35 | 36 |
36 } // namespace blink | 37 } // namespace blink |
37 | 38 |
38 #endif // NGBlockLayoutAlgorithm_h | 39 #endif // NGBlockLayoutAlgorithm_h |
OLD | NEW |