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/geometry/ng_margin_strut.h" | 9 #include "core/layout/ng/geometry/ng_margin_strut.h" |
10 #include "core/layout/ng/ng_block_break_token.h" | 10 #include "core/layout/ng/ng_block_break_token.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 // fragment within. | 41 // fragment within. |
42 // @param break_token The break token from which the layout should start. | 42 // @param break_token The break token from which the layout should start. |
43 NGBlockLayoutAlgorithm(NGBlockNode* node, | 43 NGBlockLayoutAlgorithm(NGBlockNode* node, |
44 NGConstraintSpace* space, | 44 NGConstraintSpace* space, |
45 NGBlockBreakToken* break_token = nullptr); | 45 NGBlockBreakToken* break_token = nullptr); |
46 | 46 |
47 Optional<MinMaxContentSize> ComputeMinMaxContentSize() const override; | 47 Optional<MinMaxContentSize> ComputeMinMaxContentSize() const override; |
48 virtual RefPtr<NGLayoutResult> Layout() override; | 48 virtual RefPtr<NGLayoutResult> Layout() override; |
49 | 49 |
50 private: | 50 private: |
51 NGBoxStrut CalculateMargins(NGLayoutInputNode* child, | 51 NGBoxStrut CalculateMargins(NGLayoutInputNode* child); |
52 const NGConstraintSpace& space); | |
53 | 52 |
54 // Creates a new constraint space for the current child. | 53 // Creates a new constraint space for the current child. |
55 RefPtr<NGConstraintSpace> CreateConstraintSpaceForChild( | 54 RefPtr<NGConstraintSpace> CreateConstraintSpaceForChild( |
56 const NGLogicalOffset& child_bfc_offset, | 55 const NGLogicalOffset& child_bfc_offset, |
57 NGLayoutInputNode*); | 56 const NGLayoutInputNode&); |
58 | 57 |
59 // @return Estimated BFC offset for the "to be layout" child. | 58 // @return Estimated BFC offset for the "to be layout" child. |
60 NGLogicalOffset PrepareChildLayout(NGLayoutInputNode*); | 59 NGLogicalOffset PrepareChildLayout(NGLayoutInputNode*); |
61 | 60 |
62 void FinishChildLayout(const NGConstraintSpace&, | 61 void FinishChildLayout(const NGConstraintSpace&, |
63 const NGLayoutInputNode* child, | 62 const NGLayoutInputNode* child, |
64 NGLayoutResult*); | 63 NGLayoutResult*); |
65 | 64 |
66 // Positions the fragment that establishes a new formatting context. | 65 // Positions the fragment that establishes a new formatting context. |
67 // | 66 // |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 // token if we're out of space. | 107 // token if we're out of space. |
109 void FinalizeForFragmentation(); | 108 void FinalizeForFragmentation(); |
110 | 109 |
111 // Calculates logical offset for the current fragment using either | 110 // Calculates logical offset for the current fragment using either |
112 // {@code content_size_} when the fragment doesn't know it's offset | 111 // {@code content_size_} when the fragment doesn't know it's offset |
113 // or {@code known_fragment_offset} if the fragment knows it's offset | 112 // or {@code known_fragment_offset} if the fragment knows it's offset |
114 // @return Fragment's offset relative to the fragment's parent. | 113 // @return Fragment's offset relative to the fragment's parent. |
115 NGLogicalOffset CalculateLogicalOffset( | 114 NGLogicalOffset CalculateLogicalOffset( |
116 const WTF::Optional<NGLogicalOffset>& known_fragment_offset); | 115 const WTF::Optional<NGLogicalOffset>& known_fragment_offset); |
117 | 116 |
118 NGConstraintSpaceBuilder space_builder_; | 117 NGLogicalSize child_available_size_; |
| 118 NGLogicalSize child_percentage_size_; |
119 | 119 |
120 NGBoxStrut border_and_padding_; | 120 NGBoxStrut border_and_padding_; |
121 LayoutUnit content_size_; | 121 LayoutUnit content_size_; |
122 LayoutUnit max_inline_size_; | 122 LayoutUnit max_inline_size_; |
123 // MarginStrut for the previous child. | 123 // MarginStrut for the previous child. |
124 NGMarginStrut curr_margin_strut_; | 124 NGMarginStrut curr_margin_strut_; |
125 NGLogicalOffset curr_bfc_offset_; | 125 NGLogicalOffset curr_bfc_offset_; |
126 NGBoxStrut curr_child_margins_; | 126 NGBoxStrut curr_child_margins_; |
127 }; | 127 }; |
128 | 128 |
129 } // namespace blink | 129 } // namespace blink |
130 | 130 |
131 #endif // NGBlockLayoutAlgorithm_h | 131 #endif // NGBlockLayoutAlgorithm_h |
OLD | NEW |