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" |
(...skipping 18 matching lines...) Expand all Loading... |
29 // @param style Style reference of the block that is being laid out. | 29 // @param style Style reference of the block that is being laid out. |
30 // @param first_child Our first child; the algorithm will use its NextSibling | 30 // @param first_child Our first child; the algorithm will use its NextSibling |
31 // method to access all the children. | 31 // method to access all the children. |
32 // @param space The constraint space which the algorithm should generate a | 32 // @param space The constraint space which the algorithm should generate a |
33 // fragment within. | 33 // fragment within. |
34 NGBlockLayoutAlgorithm(PassRefPtr<const ComputedStyle>, | 34 NGBlockLayoutAlgorithm(PassRefPtr<const ComputedStyle>, |
35 NGBlockNode* first_child, | 35 NGBlockNode* first_child, |
36 NGConstraintSpace* space, | 36 NGConstraintSpace* space, |
37 NGBreakToken* break_token = nullptr); | 37 NGBreakToken* break_token = nullptr); |
38 | 38 |
| 39 MinAndMaxState ComputeMinAndMaxContentSizes(MinAndMaxContentSizes*) override; |
39 NGLayoutStatus Layout(NGPhysicalFragmentBase*, | 40 NGLayoutStatus Layout(NGPhysicalFragmentBase*, |
40 NGPhysicalFragmentBase**, | 41 NGPhysicalFragmentBase**, |
41 NGLayoutAlgorithm**) override; | 42 NGLayoutAlgorithm**) override; |
42 | 43 |
43 DECLARE_VIRTUAL_TRACE(); | 44 DECLARE_VIRTUAL_TRACE(); |
44 | 45 |
45 private: | 46 private: |
46 // Creates a new constraint space for the current child. | 47 // Creates a new constraint space for the current child. |
47 NGConstraintSpace* CreateConstraintSpaceForCurrentChild() const; | 48 NGConstraintSpace* CreateConstraintSpaceForCurrentChild() const; |
48 void FinishCurrentChildLayout(NGFragmentBase* fragment); | 49 void FinishCurrentChildLayout(NGFragmentBase* fragment); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 DCHECK(current_child_); | 92 DCHECK(current_child_); |
92 return *current_child_->Style(); | 93 return *current_child_->Style(); |
93 } | 94 } |
94 | 95 |
95 const NGConstraintSpace& ConstraintSpace() const { | 96 const NGConstraintSpace& ConstraintSpace() const { |
96 return *constraint_space_; | 97 return *constraint_space_; |
97 } | 98 } |
98 | 99 |
99 const ComputedStyle& Style() const { return *style_; } | 100 const ComputedStyle& Style() const { return *style_; } |
100 | 101 |
101 enum State { | 102 enum LayoutState { |
102 kStateInit, | 103 kStateInit, |
103 kStatePrepareForChildLayout, | 104 kStatePrepareForChildLayout, |
104 kStateChildLayout, | 105 kStateChildLayout, |
105 kStateFinalize | 106 kStateFinalize |
106 }; | 107 }; |
107 State state_; | 108 LayoutState layout_state_; |
| 109 LayoutState compute_minmax_state_; |
108 | 110 |
109 RefPtr<const ComputedStyle> style_; | 111 RefPtr<const ComputedStyle> style_; |
110 | 112 |
111 Member<NGBlockNode> first_child_; | 113 Member<NGBlockNode> first_child_; |
112 Member<NGConstraintSpace> constraint_space_; | 114 Member<NGConstraintSpace> constraint_space_; |
113 Member<NGBreakToken> break_token_; | 115 Member<NGBreakToken> break_token_; |
114 Member<NGFragmentBuilder> builder_; | 116 Member<NGFragmentBuilder> builder_; |
115 Member<NGConstraintSpaceBuilder> space_builder_; | 117 Member<NGConstraintSpaceBuilder> space_builder_; |
116 Member<NGConstraintSpace> space_for_current_child_; | 118 Member<NGConstraintSpace> space_for_current_child_; |
117 Member<NGBlockNode> current_child_; | 119 Member<NGBlockNode> current_child_; |
| 120 Member<NGBlockNode> current_minmax_child_; |
| 121 MinAndMaxContentSizes pending_minmax_sizes_; |
118 | 122 |
119 NGBoxStrut border_and_padding_; | 123 NGBoxStrut border_and_padding_; |
120 LayoutUnit content_size_; | 124 LayoutUnit content_size_; |
121 LayoutUnit max_inline_size_; | 125 LayoutUnit max_inline_size_; |
122 // MarginStrut for the previous child. | 126 // MarginStrut for the previous child. |
123 NGMarginStrut prev_child_margin_strut_; | 127 NGMarginStrut prev_child_margin_strut_; |
124 // Whether the block-start was set for the currently built | 128 // Whether the block-start was set for the currently built |
125 // fragment's margin strut. | 129 // fragment's margin strut. |
126 bool is_fragment_margin_strut_block_start_updated_ : 1; | 130 bool is_fragment_margin_strut_block_start_updated_ : 1; |
127 }; | 131 }; |
128 | 132 |
129 } // namespace blink | 133 } // namespace blink |
130 | 134 |
131 #endif // NGBlockLayoutAlgorithm_h | 135 #endif // NGBlockLayoutAlgorithm_h |
OLD | NEW |