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 NGConstraintSpace_h | 5 #ifndef NGConstraintSpace_h |
6 #define NGConstraintSpace_h | 6 #define NGConstraintSpace_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/layout/ng/ng_units.h" | 9 #include "core/layout/ng/ng_units.h" |
10 #include "core/layout/ng/ng_writing_mode.h" | 10 #include "core/layout/ng/ng_writing_mode.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 105 |
106 // Modifies constraint space to account for a placed fragment. Depending on | 106 // Modifies constraint space to account for a placed fragment. Depending on |
107 // the shape of the fragment this will either modify the inline or block | 107 // the shape of the fragment this will either modify the inline or block |
108 // size, or add an exclusion. | 108 // size, or add an exclusion. |
109 void Subtract(const NGBoxFragment*); | 109 void Subtract(const NGBoxFragment*); |
110 | 110 |
111 NGMarginStrut MarginStrut() const { return margin_strut_; } | 111 NGMarginStrut MarginStrut() const { return margin_strut_; } |
112 | 112 |
113 NGLogicalOffset BfcOffset() const { return bfc_offset_; } | 113 NGLogicalOffset BfcOffset() const { return bfc_offset_; } |
114 | 114 |
| 115 WTF::Optional<LayoutUnit> ClearanceOffset() const { |
| 116 return clearance_offset_; |
| 117 } |
| 118 |
115 DEFINE_INLINE_VIRTUAL_TRACE() {} | 119 DEFINE_INLINE_VIRTUAL_TRACE() {} |
116 | 120 |
117 String ToString() const; | 121 String ToString() const; |
118 | 122 |
119 private: | 123 private: |
120 friend class NGConstraintSpaceBuilder; | 124 friend class NGConstraintSpaceBuilder; |
121 // Default constructor. | 125 // Default constructor. |
122 NGConstraintSpace(NGWritingMode, | 126 NGConstraintSpace(NGWritingMode, |
123 TextDirection, | 127 TextDirection, |
124 NGLogicalSize available_size, | 128 NGLogicalSize available_size, |
125 NGLogicalSize percentage_resolution_size, | 129 NGLogicalSize percentage_resolution_size, |
126 NGPhysicalSize initial_containing_block_size, | 130 NGPhysicalSize initial_containing_block_size, |
127 LayoutUnit fragmentainer_space_available, | 131 LayoutUnit fragmentainer_space_available, |
128 bool is_fixed_size_inline, | 132 bool is_fixed_size_inline, |
129 bool is_fixed_size_block, | 133 bool is_fixed_size_block, |
130 bool is_shrink_to_fit, | 134 bool is_shrink_to_fit, |
131 bool is_inline_direction_triggers_scrollbar, | 135 bool is_inline_direction_triggers_scrollbar, |
132 bool is_block_direction_triggers_scrollbar, | 136 bool is_block_direction_triggers_scrollbar, |
133 NGFragmentationType block_direction_fragmentation_type, | 137 NGFragmentationType block_direction_fragmentation_type, |
134 bool is_new_fc, | 138 bool is_new_fc, |
135 const NGMarginStrut& margin_strut, | 139 const NGMarginStrut& margin_strut, |
136 const NGLogicalOffset& bfc_offset, | 140 const NGLogicalOffset& bfc_offset, |
137 const std::shared_ptr<NGExclusions>& exclusions); | 141 const std::shared_ptr<NGExclusions>& exclusions, |
| 142 const WTF::Optional<LayoutUnit>& clearance_offset); |
138 | 143 |
139 NGPhysicalSize InitialContainingBlockSize() const { | 144 NGPhysicalSize InitialContainingBlockSize() const { |
140 return initial_containing_block_size_; | 145 return initial_containing_block_size_; |
141 } | 146 } |
142 | 147 |
143 NGLogicalSize available_size_; | 148 NGLogicalSize available_size_; |
144 NGLogicalSize percentage_resolution_size_; | 149 NGLogicalSize percentage_resolution_size_; |
145 NGPhysicalSize initial_containing_block_size_; | 150 NGPhysicalSize initial_containing_block_size_; |
146 | 151 |
147 LayoutUnit fragmentainer_space_available_; | 152 LayoutUnit fragmentainer_space_available_; |
(...skipping 11 matching lines...) Expand all Loading... |
159 // Whether the current constraint space is for the newly established | 164 // Whether the current constraint space is for the newly established |
160 // formatting Context | 165 // formatting Context |
161 unsigned is_new_fc_ : 1; | 166 unsigned is_new_fc_ : 1; |
162 | 167 |
163 unsigned writing_mode_ : 3; | 168 unsigned writing_mode_ : 3; |
164 unsigned direction_ : 1; | 169 unsigned direction_ : 1; |
165 | 170 |
166 NGMarginStrut margin_strut_; | 171 NGMarginStrut margin_strut_; |
167 NGLogicalOffset bfc_offset_; | 172 NGLogicalOffset bfc_offset_; |
168 const std::shared_ptr<NGExclusions> exclusions_; | 173 const std::shared_ptr<NGExclusions> exclusions_; |
| 174 WTF::Optional<LayoutUnit> clearance_offset_; |
169 }; | 175 }; |
170 | 176 |
171 inline std::ostream& operator<<(std::ostream& stream, | 177 inline std::ostream& operator<<(std::ostream& stream, |
172 const NGConstraintSpace& value) { | 178 const NGConstraintSpace& value) { |
173 return stream << value.ToString(); | 179 return stream << value.ToString(); |
174 } | 180 } |
175 | 181 |
176 } // namespace blink | 182 } // namespace blink |
177 | 183 |
178 #endif // NGConstraintSpace_h | 184 #endif // NGConstraintSpace_h |
OLD | NEW |