Chromium Code Reviews| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 } | 87 } |
| 88 | 88 |
| 89 // Some layout modes “stretch” their children to a fixed size (e.g. flex, | 89 // Some layout modes “stretch” their children to a fixed size (e.g. flex, |
| 90 // grid). These flags represented whether a layout needs to produce a | 90 // grid). These flags represented whether a layout needs to produce a |
| 91 // fragment that satisfies a fixed constraint in the inline and block | 91 // fragment that satisfies a fixed constraint in the inline and block |
| 92 // direction respectively. | 92 // direction respectively. |
| 93 bool IsFixedSizeInline() const { return is_fixed_size_inline_; } | 93 bool IsFixedSizeInline() const { return is_fixed_size_inline_; } |
| 94 | 94 |
| 95 bool IsFixedSizeBlock() const { return is_fixed_size_block_; } | 95 bool IsFixedSizeBlock() const { return is_fixed_size_block_; } |
| 96 | 96 |
| 97 bool HasForcedShrinkToFit() const { return has_forced_shrink_to_fit_; } | |
|
ikilpatrick
2016/12/22 00:06:14
Comment explaining what this does? E.g.
Whether t
ikilpatrick
2016/12/22 00:06:14
IsShrinkToFit? to keep in line with other bits?
cbiesinger
2016/12/22 03:34:25
Done (both).
| |
| 98 | |
| 97 // If specified a layout should produce a Fragment which fragments at the | 99 // If specified a layout should produce a Fragment which fragments at the |
| 98 // blockSize if possible. | 100 // blockSize if possible. |
| 99 NGFragmentationType BlockFragmentationType() const; | 101 NGFragmentationType BlockFragmentationType() const; |
| 100 | 102 |
| 101 // Modifies constraint space to account for a placed fragment. Depending on | 103 // Modifies constraint space to account for a placed fragment. Depending on |
| 102 // the shape of the fragment this will either modify the inline or block | 104 // the shape of the fragment this will either modify the inline or block |
| 103 // size, or add an exclusion. | 105 // size, or add an exclusion. |
| 104 void Subtract(const NGFragment*); | 106 void Subtract(const NGFragment*); |
| 105 | 107 |
| 106 NGLayoutOpportunityIterator* LayoutOpportunities( | 108 NGLayoutOpportunityIterator* LayoutOpportunities( |
| 107 unsigned clear = kNGClearNone, | 109 unsigned clear = kNGClearNone, |
| 108 bool for_inline_or_bfc = false); | 110 bool for_inline_or_bfc = false); |
| 109 | 111 |
| 110 DEFINE_INLINE_VIRTUAL_TRACE() {} | 112 DEFINE_INLINE_VIRTUAL_TRACE() {} |
| 111 | 113 |
| 112 String ToString() const; | 114 String ToString() const; |
| 113 | 115 |
| 114 private: | 116 private: |
| 115 friend class NGConstraintSpaceBuilder; | 117 friend class NGConstraintSpaceBuilder; |
| 116 // Default constructor. | 118 // Default constructor. |
| 117 NGConstraintSpace(NGWritingMode, | 119 NGConstraintSpace(NGWritingMode, |
| 118 TextDirection, | 120 TextDirection, |
| 119 NGLogicalSize available_size, | 121 NGLogicalSize available_size, |
| 120 NGLogicalSize percentage_resolution_size, | 122 NGLogicalSize percentage_resolution_size, |
| 121 bool is_fixed_size_inline, | 123 bool is_fixed_size_inline, |
| 122 bool is_fixed_size_block, | 124 bool is_fixed_size_block, |
| 125 bool has_forced_shrink_to_fit, | |
| 123 bool is_inline_direction_triggers_scrollbar, | 126 bool is_inline_direction_triggers_scrollbar, |
| 124 bool is_block_direction_triggers_scrollbar, | 127 bool is_block_direction_triggers_scrollbar, |
| 125 NGFragmentationType block_direction_fragmentation_type, | 128 NGFragmentationType block_direction_fragmentation_type, |
| 126 bool is_new_fc, | 129 bool is_new_fc, |
| 127 const std::shared_ptr<NGExclusions>& exclusions_); | 130 const std::shared_ptr<NGExclusions>& exclusions_); |
| 128 | 131 |
| 129 NGLogicalSize available_size_; | 132 NGLogicalSize available_size_; |
| 130 NGLogicalSize percentage_resolution_size_; | 133 NGLogicalSize percentage_resolution_size_; |
| 131 | 134 |
| 132 unsigned is_fixed_size_inline_ : 1; | 135 unsigned is_fixed_size_inline_ : 1; |
| 133 unsigned is_fixed_size_block_ : 1; | 136 unsigned is_fixed_size_block_ : 1; |
| 134 | 137 |
| 138 unsigned has_forced_shrink_to_fit_ : 1; | |
| 139 | |
| 135 unsigned is_inline_direction_triggers_scrollbar_ : 1; | 140 unsigned is_inline_direction_triggers_scrollbar_ : 1; |
| 136 unsigned is_block_direction_triggers_scrollbar_ : 1; | 141 unsigned is_block_direction_triggers_scrollbar_ : 1; |
| 137 | 142 |
| 138 unsigned block_direction_fragmentation_type_ : 2; | 143 unsigned block_direction_fragmentation_type_ : 2; |
| 139 | 144 |
| 140 // Whether the current constraint space is for the newly established | 145 // Whether the current constraint space is for the newly established |
| 141 // formatting Context | 146 // formatting Context |
| 142 unsigned is_new_fc_ : 1; | 147 unsigned is_new_fc_ : 1; |
| 143 | 148 |
| 144 NGLogicalOffset offset_; | 149 NGLogicalOffset offset_; |
| 145 unsigned writing_mode_ : 3; | 150 unsigned writing_mode_ : 3; |
| 146 unsigned direction_ : 1; | 151 unsigned direction_ : 1; |
| 147 | 152 |
| 148 const std::shared_ptr<NGExclusions> exclusions_; | 153 const std::shared_ptr<NGExclusions> exclusions_; |
| 149 }; | 154 }; |
| 150 | 155 |
| 151 inline std::ostream& operator<<(std::ostream& stream, | 156 inline std::ostream& operator<<(std::ostream& stream, |
| 152 const NGConstraintSpace& value) { | 157 const NGConstraintSpace& value) { |
| 153 return stream << value.ToString(); | 158 return stream << value.ToString(); |
| 154 } | 159 } |
| 155 | 160 |
| 156 } // namespace blink | 161 } // namespace blink |
| 157 | 162 |
| 158 #endif // NGConstraintSpace_h | 163 #endif // NGConstraintSpace_h |
| OLD | NEW |