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