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_block_node.h" | 9 #include "core/layout/ng/ng_block_node.h" |
10 #include "core/layout/ng/ng_layout_algorithm.h" | 10 #include "core/layout/ng/ng_layout_algorithm.h" |
11 #include "core/layout/ng/ng_units.h" | 11 #include "core/layout/ng/ng_units.h" |
12 #include "wtf/RefPtr.h" | 12 #include "wtf/RefPtr.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 class ComputedStyle; | 16 class ComputedStyle; |
17 class NGBlockBreakToken; | 17 class NGBlockBreakToken; |
18 class NGBreakToken; | 18 class NGBreakToken; |
19 class NGColumnMapper; | 19 class NGColumnMapper; |
20 class NGConstraintSpace; | 20 class NGConstraintSpace; |
21 class NGConstraintSpaceBuilder; | 21 class NGConstraintSpaceBuilder; |
22 class NGBoxFragment; | 22 class NGBoxFragment; |
| 23 class NGFragment; |
23 class NGFragmentBuilder; | 24 class NGFragmentBuilder; |
24 class NGPhysicalFragment; | 25 class NGPhysicalFragment; |
25 | 26 |
26 // A class for general block layout (e.g. a <div> with no special style). | 27 // A class for general block layout (e.g. a <div> with no special style). |
27 // Lays out the children in sequence. | 28 // Lays out the children in sequence. |
28 class CORE_EXPORT NGBlockLayoutAlgorithm : public NGLayoutAlgorithm { | 29 class CORE_EXPORT NGBlockLayoutAlgorithm : public NGLayoutAlgorithm { |
29 public: | 30 public: |
30 // Default constructor. | 31 // Default constructor. |
31 // @param style Style reference of the block that is being laid out. | 32 // @param style Style reference of the block that is being laid out. |
32 // @param first_child Our first child; the algorithm will use its NextSibling | 33 // @param first_child Our first child; the algorithm will use its NextSibling |
33 // method to access all the children. | 34 // method to access all the children. |
34 // @param space The constraint space which the algorithm should generate a | 35 // @param space The constraint space which the algorithm should generate a |
35 // fragment within. | 36 // fragment within. |
36 NGBlockLayoutAlgorithm(PassRefPtr<const ComputedStyle>, | 37 NGBlockLayoutAlgorithm(PassRefPtr<const ComputedStyle>, |
37 NGBlockNode* first_child, | 38 NGBlockNode* first_child, |
38 NGConstraintSpace* space, | 39 NGConstraintSpace* space, |
39 NGBreakToken* break_token = nullptr); | 40 NGBreakToken* break_token = nullptr); |
40 | 41 |
41 bool ComputeMinAndMaxContentSizes(MinAndMaxContentSizes*) override; | 42 bool ComputeMinAndMaxContentSizes(MinAndMaxContentSizes*) override; |
42 NGLayoutStatus Layout(NGPhysicalFragment*, | 43 NGPhysicalFragment* Layout() override; |
43 NGPhysicalFragment**, | |
44 NGLayoutAlgorithm**) override; | |
45 | 44 |
46 DECLARE_VIRTUAL_TRACE(); | 45 DECLARE_VIRTUAL_TRACE(); |
47 | 46 |
48 private: | 47 private: |
49 // Creates a new constraint space for the current child. | 48 // Creates a new constraint space for the current child. |
50 NGConstraintSpace* CreateConstraintSpaceForCurrentChild() const; | 49 NGConstraintSpace* CreateConstraintSpaceForCurrentChild() const; |
51 void FinishCurrentChildLayout(NGFragment* fragment); | 50 void FinishCurrentChildLayout(NGFragment* fragment); |
52 HeapLinkedHashSet<WeakMember<NGBlockNode>> LayoutOutOfFlowChildren(); | 51 HeapLinkedHashSet<WeakMember<NGBlockNode>> LayoutOutOfFlowChildren(); |
53 | 52 |
54 // Proceed to the next sibling that still needs layout. | 53 // Proceed to the next sibling that still needs layout. |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 // MarginStrut for the previous child. | 168 // MarginStrut for the previous child. |
170 NGMarginStrut prev_child_margin_strut_; | 169 NGMarginStrut prev_child_margin_strut_; |
171 // Whether the block-start was set for the currently built | 170 // Whether the block-start was set for the currently built |
172 // fragment's margin strut. | 171 // fragment's margin strut. |
173 bool is_fragment_margin_strut_block_start_updated_ : 1; | 172 bool is_fragment_margin_strut_block_start_updated_ : 1; |
174 }; | 173 }; |
175 | 174 |
176 } // namespace blink | 175 } // namespace blink |
177 | 176 |
178 #endif // NGBlockLayoutAlgorithm_h | 177 #endif // NGBlockLayoutAlgorithm_h |
OLD | NEW |