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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 private: | 68 private: |
69 NGBoxStrut CalculateMargins(NGLayoutInputNode child); | 69 NGBoxStrut CalculateMargins(NGLayoutInputNode child); |
70 | 70 |
71 // Creates a new constraint space for the current child. | 71 // Creates a new constraint space for the current child. |
72 RefPtr<NGConstraintSpace> CreateConstraintSpaceForChild( | 72 RefPtr<NGConstraintSpace> CreateConstraintSpaceForChild( |
73 const NGLayoutInputNode child, | 73 const NGLayoutInputNode child, |
74 const NGInflowChildData& child_data, | 74 const NGInflowChildData& child_data, |
75 const WTF::Optional<NGLogicalOffset> floats_bfc_offset = WTF::nullopt); | 75 const WTF::Optional<NGLogicalOffset> floats_bfc_offset = WTF::nullopt); |
76 | 76 |
77 // @return Estimated BFC offset for the "to be layout" child. | 77 // @return Estimated BFC offset for the "to be layout" child. |
78 WTF::Optional<NGInflowChildData> PrepareChildLayout( | 78 NGInflowChildData ComputeChildData(const NGPreviousInflowPosition&, |
79 const NGPreviousInflowPosition&, | 79 NGLayoutInputNode); |
80 NGLayoutInputNode); | |
81 | 80 |
82 WTF::Optional<NGPreviousInflowPosition> FinishChildLayout( | 81 NGPreviousInflowPosition ComputeInflowPosition( |
83 const NGConstraintSpace&, | 82 const NGPreviousInflowPosition& previous_inflow_position, |
84 const NGPreviousInflowPosition& prev_data, | |
85 const NGInflowChildData& child_data, | 83 const NGInflowChildData& child_data, |
86 NGLayoutInputNode child, | 84 const WTF::Optional<NGLogicalOffset>& child_bfc_offset, |
87 NGBreakToken* child_break_token, | 85 const NGLogicalOffset& logical_offset, |
88 RefPtr<NGLayoutResult>); | 86 const NGLayoutResult& layout_result, |
| 87 const NGFragment& fragment); |
89 | 88 |
90 // Positions the fragment that establishes a new formatting context. | 89 // Positions the fragment that establishes a new formatting context. |
91 // | 90 // |
92 // This uses Layout Opportunity iterator to position the fragment. | 91 // This uses Layout Opportunity iterator to position the fragment. |
93 // That's because an element that establishes a new block formatting context | 92 // That's because an element that establishes a new block formatting context |
94 // must not overlap the margin box of any floats in the same block formatting | 93 // must not overlap the margin box of any floats in the same block formatting |
95 // context as the element itself. | 94 // context as the element itself. |
96 // | 95 // |
97 // So if necessary, we clear the new BFC by placing it below any preceding | 96 // So if necessary, we clear the new BFC by placing it below any preceding |
98 // floats or place it adjacent to such floats if there is sufficient space. | 97 // floats or place it adjacent to such floats if there is sufficient space. |
(...skipping 28 matching lines...) Expand all Loading... |
127 // <div style="padding: 1px"> | 126 // <div style="padding: 1px"> |
128 // <div id="empty-div" style="margins: 1px"></div> | 127 // <div id="empty-div" style="margins: 1px"></div> |
129 NGLogicalOffset PositionWithParentBfc(const NGConstraintSpace&, | 128 NGLogicalOffset PositionWithParentBfc(const NGConstraintSpace&, |
130 const NGInflowChildData& child_data, | 129 const NGInflowChildData& child_data, |
131 const NGLayoutResult&); | 130 const NGLayoutResult&); |
132 | 131 |
133 NGLogicalOffset PositionLegacy(const NGConstraintSpace& child_space, | 132 NGLogicalOffset PositionLegacy(const NGConstraintSpace& child_space, |
134 const NGInflowChildData& child_data); | 133 const NGInflowChildData& child_data); |
135 | 134 |
136 void HandleOutOfFlowPositioned(const NGPreviousInflowPosition&, NGBlockNode); | 135 void HandleOutOfFlowPositioned(const NGPreviousInflowPosition&, NGBlockNode); |
137 void HandleFloating(const NGPreviousInflowPosition&, | 136 void HandleFloat(const NGPreviousInflowPosition&, |
138 NGBlockNode, | 137 NGBlockNode, |
139 NGBlockBreakToken*); | 138 NGBlockBreakToken*); |
| 139 WTF::Optional<NGPreviousInflowPosition> HandleInflow( |
| 140 const NGPreviousInflowPosition&, |
| 141 NGLayoutInputNode child, |
| 142 NGBreakToken* child_break_token); |
140 | 143 |
141 // Final adjustments before fragment creation. We need to prevent the | 144 // Final adjustments before fragment creation. We need to prevent the |
142 // fragment from crossing fragmentainer boundaries, and rather create a break | 145 // fragment from crossing fragmentainer boundaries, and rather create a break |
143 // token if we're out of space. | 146 // token if we're out of space. |
144 void FinalizeForFragmentation(); | 147 void FinalizeForFragmentation(); |
145 | 148 |
146 void PropagateBaselinesFromChildren(); | 149 void PropagateBaselinesFromChildren(); |
147 bool AddBaseline(const NGBaselineRequest&, unsigned); | 150 bool AddBaseline(const NGBaselineRequest&, unsigned); |
148 | 151 |
149 // Calculates logical offset for the current fragment using either | 152 // Calculates logical offset for the current fragment using either |
(...skipping 12 matching lines...) Expand all Loading... |
162 LayoutUnit max_inline_size_; | 165 LayoutUnit max_inline_size_; |
163 | 166 |
164 bool abort_when_bfc_resolved_; | 167 bool abort_when_bfc_resolved_; |
165 | 168 |
166 Vector<RefPtr<NGUnpositionedFloat>> unpositioned_floats_; | 169 Vector<RefPtr<NGUnpositionedFloat>> unpositioned_floats_; |
167 }; | 170 }; |
168 | 171 |
169 } // namespace blink | 172 } // namespace blink |
170 | 173 |
171 #endif // NGBlockLayoutAlgorithm_h | 174 #endif // NGBlockLayoutAlgorithm_h |
OLD | NEW |