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/geometry/ng_logical_offset.h" | 9 #include "core/layout/ng/geometry/ng_logical_offset.h" |
10 #include "core/layout/ng/geometry/ng_logical_size.h" | 10 #include "core/layout/ng/geometry/ng_logical_size.h" |
11 #include "core/layout/ng/geometry/ng_margin_strut.h" | 11 #include "core/layout/ng/geometry/ng_margin_strut.h" |
12 #include "core/layout/ng/geometry/ng_physical_size.h" | 12 #include "core/layout/ng/geometry/ng_physical_size.h" |
13 #include "core/layout/ng/ng_exclusion.h" | 13 #include "core/layout/ng/ng_exclusion.h" |
| 14 #include "core/layout/ng/ng_layout_opportunity_iterator.h" |
14 #include "core/layout/ng/ng_writing_mode.h" | 15 #include "core/layout/ng/ng_writing_mode.h" |
15 #include "platform/heap/Handle.h" | 16 #include "platform/heap/Handle.h" |
16 #include "platform/text/TextDirection.h" | 17 #include "platform/text/TextDirection.h" |
17 #include "wtf/Optional.h" | 18 #include "wtf/Optional.h" |
18 #include "wtf/RefCounted.h" | 19 #include "wtf/RefCounted.h" |
19 #include "wtf/text/WTFString.h" | 20 #include "wtf/text/WTFString.h" |
20 | 21 |
21 namespace blink { | 22 namespace blink { |
22 | 23 |
23 class LayoutBox; | 24 class LayoutBox; |
24 class NGBoxFragment; | |
25 | 25 |
26 enum NGFragmentationType { | 26 enum NGFragmentationType { |
27 kFragmentNone, | 27 kFragmentNone, |
28 kFragmentPage, | 28 kFragmentPage, |
29 kFragmentColumn, | 29 kFragmentColumn, |
30 kFragmentRegion | 30 kFragmentRegion |
31 }; | 31 }; |
32 | 32 |
33 // The NGConstraintSpace represents a set of constraints and available space | 33 // The NGConstraintSpace represents a set of constraints and available space |
34 // which a layout algorithm may produce a NGFragment within. | 34 // which a layout algorithm may produce a NGFragment within. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 bool IsFixedSizeBlock() const { return is_fixed_size_block_; } | 101 bool IsFixedSizeBlock() const { return is_fixed_size_block_; } |
102 | 102 |
103 // Whether an auto inline-size should be interpreted as shrink-to-fit | 103 // Whether an auto inline-size should be interpreted as shrink-to-fit |
104 // (ie. fit-content). This is used for inline-block, floats, etc. | 104 // (ie. fit-content). This is used for inline-block, floats, etc. |
105 bool IsShrinkToFit() const { return is_shrink_to_fit_; } | 105 bool IsShrinkToFit() const { return is_shrink_to_fit_; } |
106 | 106 |
107 // If specified a layout should produce a Fragment which fragments at the | 107 // If specified a layout should produce a Fragment which fragments at the |
108 // blockSize if possible. | 108 // blockSize if possible. |
109 NGFragmentationType BlockFragmentationType() const; | 109 NGFragmentationType BlockFragmentationType() const; |
110 | 110 |
| 111 NGLayoutOpportunityIterator* LayoutOpportunityIterator(); |
| 112 |
111 // Return true if this contraint space participates in a fragmentation | 113 // Return true if this contraint space participates in a fragmentation |
112 // context. | 114 // context. |
113 bool HasBlockFragmentation() const { | 115 bool HasBlockFragmentation() const { |
114 return BlockFragmentationType() != kFragmentNone; | 116 return BlockFragmentationType() != kFragmentNone; |
115 } | 117 } |
116 | 118 |
117 // Modifies constraint space to account for a placed fragment. Depending on | |
118 // the shape of the fragment this will either modify the inline or block | |
119 // size, or add an exclusion. | |
120 void Subtract(const NGBoxFragment*); | |
121 | |
122 NGMarginStrut MarginStrut() const { return margin_strut_; } | 119 NGMarginStrut MarginStrut() const { return margin_strut_; } |
123 | 120 |
124 NGLogicalOffset BfcOffset() const { return bfc_offset_; } | 121 NGLogicalOffset BfcOffset() const { return bfc_offset_; } |
125 | 122 |
126 WTF::Optional<LayoutUnit> ClearanceOffset() const { | 123 WTF::Optional<LayoutUnit> ClearanceOffset() const { |
127 return clearance_offset_; | 124 return clearance_offset_; |
128 } | 125 } |
129 | 126 |
130 String ToString() const; | 127 String ToString() const; |
131 | 128 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 174 |
178 unsigned is_anonymous_ : 1; | 175 unsigned is_anonymous_ : 1; |
179 | 176 |
180 unsigned writing_mode_ : 3; | 177 unsigned writing_mode_ : 3; |
181 unsigned direction_ : 1; | 178 unsigned direction_ : 1; |
182 | 179 |
183 NGMarginStrut margin_strut_; | 180 NGMarginStrut margin_strut_; |
184 NGLogicalOffset bfc_offset_; | 181 NGLogicalOffset bfc_offset_; |
185 const std::shared_ptr<NGExclusions> exclusions_; | 182 const std::shared_ptr<NGExclusions> exclusions_; |
186 WTF::Optional<LayoutUnit> clearance_offset_; | 183 WTF::Optional<LayoutUnit> clearance_offset_; |
| 184 std::unique_ptr<NGLayoutOpportunityIterator> layout_opp_iter_; |
187 }; | 185 }; |
188 | 186 |
189 inline std::ostream& operator<<(std::ostream& stream, | 187 inline std::ostream& operator<<(std::ostream& stream, |
190 const NGConstraintSpace& value) { | 188 const NGConstraintSpace& value) { |
191 return stream << value.ToString(); | 189 return stream << value.ToString(); |
192 } | 190 } |
193 | 191 |
194 } // namespace blink | 192 } // namespace blink |
195 | 193 |
196 #endif // NGConstraintSpace_h | 194 #endif // NGConstraintSpace_h |
OLD | NEW |