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_macros.h" | 9 #include "core/layout/ng/ng_macros.h" |
10 #include "core/layout/ng/ng_physical_constraint_space.h" | 10 #include "core/layout/ng/ng_physical_constraint_space.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 NGLogicalSize PercentageResolutionSize() const; | 72 NGLogicalSize PercentageResolutionSize() const; |
73 | 73 |
74 // The available space size. | 74 // The available space size. |
75 // See: https://drafts.csswg.org/css-sizing/#available | 75 // See: https://drafts.csswg.org/css-sizing/#available |
76 NGLogicalSize AvailableSize() const; | 76 NGLogicalSize AvailableSize() const; |
77 | 77 |
78 // Offset relative to the root constraint space. | 78 // Offset relative to the root constraint space. |
79 NGLogicalOffset Offset() const { return offset_; } | 79 NGLogicalOffset Offset() const { return offset_; } |
80 void SetOffset(const NGLogicalOffset& offset) { offset_ = offset; } | 80 void SetOffset(const NGLogicalOffset& offset) { offset_ = offset; } |
81 | 81 |
82 // Returns the effective size of the constraint space. Equal to the | |
83 // AvailableSize() for the root constraint space but derived constraint spaces | |
84 // return the size of the layout opportunity. | |
85 virtual NGLogicalSize Size() const { return size_; } | |
86 void SetSize(const NGLogicalSize& size) { size_ = size; } | |
87 | |
88 // Whether the current constraint space is for the newly established | 82 // Whether the current constraint space is for the newly established |
89 // Formatting Context. | 83 // Formatting Context. |
90 bool IsNewFormattingContext() const; | 84 bool IsNewFormattingContext() const; |
91 | 85 |
92 // Whether exceeding the AvailableSize() triggers the presence of a scrollbar | 86 // Whether exceeding the AvailableSize() triggers the presence of a scrollbar |
93 // for the indicated direction. | 87 // for the indicated direction. |
94 // If exceeded the current layout should be aborted and invoked again with a | 88 // If exceeded the current layout should be aborted and invoked again with a |
95 // constraint space modified to reserve space for a scrollbar. | 89 // constraint space modified to reserve space for a scrollbar. |
96 bool InlineTriggersScrollbar() const; | 90 bool InlineTriggersScrollbar() const; |
97 bool BlockTriggersScrollbar() const; | 91 bool BlockTriggersScrollbar() const; |
(...skipping 13 matching lines...) Expand all Loading... |
111 // the shape of the fragment this will either modify the inline or block | 105 // the shape of the fragment this will either modify the inline or block |
112 // size, or add an exclusion. | 106 // size, or add an exclusion. |
113 void Subtract(const NGFragment*); | 107 void Subtract(const NGFragment*); |
114 | 108 |
115 NGLayoutOpportunityIterator* LayoutOpportunities( | 109 NGLayoutOpportunityIterator* LayoutOpportunities( |
116 unsigned clear = NGClearNone, | 110 unsigned clear = NGClearNone, |
117 bool for_inline_or_bfc = false); | 111 bool for_inline_or_bfc = false); |
118 | 112 |
119 DEFINE_INLINE_VIRTUAL_TRACE() { visitor->trace(physical_space_); } | 113 DEFINE_INLINE_VIRTUAL_TRACE() { visitor->trace(physical_space_); } |
120 | 114 |
121 // The setters for the NGConstraintSpace should only be used when constructing | |
122 // a derived NGConstraintSpace. | |
123 void SetOverflowTriggersScrollbar(bool inlineTriggers, bool blockTriggers); | |
124 void SetFixedSize(bool inlineFixed, bool blockFixed); | |
125 void SetFragmentationType(NGFragmentationType); | |
126 void SetIsNewFormattingContext(bool is_new_fc); | |
127 | |
128 NGConstraintSpace* ChildSpace(const ComputedStyle* style) const; | 115 NGConstraintSpace* ChildSpace(const ComputedStyle* style) const; |
129 | 116 |
130 String ToString() const; | 117 String ToString() const; |
131 | 118 |
132 private: | 119 private: |
133 Member<NGPhysicalConstraintSpace> physical_space_; | 120 Member<NGPhysicalConstraintSpace> physical_space_; |
134 NGLogicalOffset offset_; | 121 NGLogicalOffset offset_; |
135 NGLogicalSize size_; | |
136 unsigned writing_mode_ : 3; | 122 unsigned writing_mode_ : 3; |
137 unsigned direction_ : 1; | 123 unsigned direction_ : 1; |
138 }; | 124 }; |
139 | 125 |
140 inline std::ostream& operator<<(std::ostream& stream, | 126 inline std::ostream& operator<<(std::ostream& stream, |
141 const NGConstraintSpace& value) { | 127 const NGConstraintSpace& value) { |
142 return stream << value.ToString(); | 128 return stream << value.ToString(); |
143 } | 129 } |
144 | 130 |
145 } // namespace blink | 131 } // namespace blink |
146 | 132 |
147 #endif // NGConstraintSpace_h | 133 #endif // NGConstraintSpace_h |
OLD | NEW |