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_physical_constraint_space.h" | 9 #include "core/layout/ng/ng_physical_constraint_space.h" |
10 #include "core/layout/ng/ng_writing_mode.h" | 10 #include "core/layout/ng/ng_writing_mode.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // Offset relative to the root constraint space. | 80 // Offset relative to the root constraint space. |
81 NGLogicalOffset Offset() const { return offset_; } | 81 NGLogicalOffset Offset() const { return offset_; } |
82 | 82 |
83 // Returns the effective size of the constraint space. Equal to the | 83 // Returns the effective size of the constraint space. Equal to the |
84 // ContainerSize() for the root constraint space but derived constraint spaces | 84 // ContainerSize() for the root constraint space but derived constraint spaces |
85 // return the size of the layout opportunity. | 85 // return the size of the layout opportunity. |
86 virtual NGLogicalSize Size() const { return size_; } | 86 virtual NGLogicalSize Size() const { return size_; } |
87 | 87 |
88 // Whether the current constraint space is for the newly established | 88 // Whether the current constraint space is for the newly established |
89 // Formatting Context. | 89 // Formatting Context. |
90 bool IsNewFormattingContext() const { return is_new_fc_; } | 90 bool IsNewFormattingContext() const; |
91 | 91 |
92 // Whether exceeding the containerSize triggers the presence of a scrollbar | 92 // Whether exceeding the containerSize triggers the presence of a scrollbar |
93 // for the indicated direction. | 93 // for the indicated direction. |
94 // If exceeded the current layout should be aborted and invoked again with a | 94 // If exceeded the current layout should be aborted and invoked again with a |
95 // constraint space modified to reserve space for a scrollbar. | 95 // constraint space modified to reserve space for a scrollbar. |
96 bool InlineTriggersScrollbar() const; | 96 bool InlineTriggersScrollbar() const; |
97 bool BlockTriggersScrollbar() const; | 97 bool BlockTriggersScrollbar() const; |
98 | 98 |
99 // Some layout modes “stretch” their children to a fixed size (e.g. flex, | 99 // Some layout modes “stretch” their children to a fixed size (e.g. flex, |
100 // grid). These flags represented whether a layout needs to produce a | 100 // grid). These flags represented whether a layout needs to produce a |
(...skipping 15 matching lines...) Expand all Loading... |
116 unsigned clear = NGClearNone, | 116 unsigned clear = NGClearNone, |
117 bool for_inline_or_bfc = false); | 117 bool for_inline_or_bfc = false); |
118 | 118 |
119 DEFINE_INLINE_VIRTUAL_TRACE() { visitor->trace(physical_space_); } | 119 DEFINE_INLINE_VIRTUAL_TRACE() { visitor->trace(physical_space_); } |
120 | 120 |
121 // The setters for the NGConstraintSpace should only be used when constructing | 121 // The setters for the NGConstraintSpace should only be used when constructing |
122 // a derived NGConstraintSpace. | 122 // a derived NGConstraintSpace. |
123 void SetOverflowTriggersScrollbar(bool inlineTriggers, bool blockTriggers); | 123 void SetOverflowTriggersScrollbar(bool inlineTriggers, bool blockTriggers); |
124 void SetFixedSize(bool inlineFixed, bool blockFixed); | 124 void SetFixedSize(bool inlineFixed, bool blockFixed); |
125 void SetFragmentationType(NGFragmentationType); | 125 void SetFragmentationType(NGFragmentationType); |
126 // TODO(layout-ng): Add m_isNewFc flag to ComputedStyle and use it instead of | 126 void SetIsNewFormattingContext(bool is_new_fc); |
127 // the function below. | |
128 void SetIsNewFormattingContext(bool is_new_fc) { is_new_fc_ = is_new_fc; } | |
129 | 127 |
130 String ToString() const; | 128 String ToString() const; |
131 | 129 |
132 private: | 130 private: |
133 Member<NGPhysicalConstraintSpace> physical_space_; | 131 Member<NGPhysicalConstraintSpace> physical_space_; |
134 NGLogicalOffset offset_; | 132 NGLogicalOffset offset_; |
135 NGLogicalSize size_; | 133 NGLogicalSize size_; |
136 unsigned writing_mode_ : 3; | 134 unsigned writing_mode_ : 3; |
137 unsigned direction_ : 1; | 135 unsigned direction_ : 1; |
138 // Whether the current constraint space is for the newly established | |
139 // formatting Context | |
140 bool is_new_fc_ : 1; | |
141 }; | 136 }; |
142 | 137 |
143 inline std::ostream& operator<<(std::ostream& stream, | 138 inline std::ostream& operator<<(std::ostream& stream, |
144 const NGConstraintSpace& value) { | 139 const NGConstraintSpace& value) { |
145 return stream << value.ToString(); | 140 return stream << value.ToString(); |
146 } | 141 } |
147 | 142 |
148 } // namespace blink | 143 } // namespace blink |
149 | 144 |
150 #endif // NGConstraintSpace_h | 145 #endif // NGConstraintSpace_h |
OLD | NEW |