| 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/LayoutBox.h" | 9 #include "core/layout/LayoutBox.h" |
| 10 #include "core/layout/ng/ng_physical_constraint_space.h" | 10 #include "core/layout/ng/ng_physical_constraint_space.h" |
| 11 #include "core/layout/ng/ng_writing_mode.h" | 11 #include "core/layout/ng/ng_writing_mode.h" |
| 12 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
| 13 #include "wtf/text/WTFString.h" | 13 #include "wtf/text/WTFString.h" |
| 14 #include "wtf/Vector.h" | 14 #include "wtf/Vector.h" |
| 15 | 15 |
| 16 namespace blink { | 16 namespace blink { |
| 17 | 17 |
| 18 class LayoutBox; | 18 class LayoutBox; |
| 19 class NGDerivedConstraintSpace; | |
| 20 class NGFragment; | 19 class NGFragment; |
| 21 class NGLayoutOpportunityIterator; | 20 class NGLayoutOpportunityIterator; |
| 22 | 21 |
| 23 // The NGConstraintSpace represents a set of constraints and available space | 22 // The NGConstraintSpace represents a set of constraints and available space |
| 24 // which a layout algorithm may produce a NGFragment within. It is a view on | 23 // which a layout algorithm may produce a NGFragment within. It is a view on |
| 25 // top of a NGPhysicalConstraintSpace and provides accessor methods in the | 24 // top of a NGPhysicalConstraintSpace and provides accessor methods in the |
| 26 // logical coordinate system defined by the writing mode given. | 25 // logical coordinate system defined by the writing mode given. |
| 27 class CORE_EXPORT NGConstraintSpace final | 26 class CORE_EXPORT NGConstraintSpace final |
| 28 : public GarbageCollected<NGConstraintSpace> { | 27 : public GarbageCollected<NGConstraintSpace> { |
| 29 public: | 28 public: |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 112 |
| 114 String toString() const; | 113 String toString() const; |
| 115 | 114 |
| 116 private: | 115 private: |
| 117 Member<NGPhysicalConstraintSpace> physical_space_; | 116 Member<NGPhysicalConstraintSpace> physical_space_; |
| 118 NGLogicalOffset offset_; | 117 NGLogicalOffset offset_; |
| 119 NGLogicalSize size_; | 118 NGLogicalSize size_; |
| 120 unsigned writing_mode_ : 3; | 119 unsigned writing_mode_ : 3; |
| 121 }; | 120 }; |
| 122 | 121 |
| 123 class CORE_EXPORT NGLayoutOpportunityIterator final | |
| 124 : public GarbageCollectedFinalized<NGLayoutOpportunityIterator> { | |
| 125 public: | |
| 126 NGLayoutOpportunityIterator(NGConstraintSpace* space, | |
| 127 unsigned clear, | |
| 128 bool for_inline_or_bfc); | |
| 129 ~NGLayoutOpportunityIterator() {} | |
| 130 | |
| 131 NGConstraintSpace* Next(); | |
| 132 | |
| 133 DEFINE_INLINE_VIRTUAL_TRACE() { | |
| 134 visitor->trace(constraint_space_); | |
| 135 visitor->trace(current_opportunities_); | |
| 136 } | |
| 137 | |
| 138 private: | |
| 139 void computeForExclusion(unsigned index); | |
| 140 LayoutUnit heightForOpportunity(LayoutUnit left, | |
| 141 LayoutUnit top, | |
| 142 LayoutUnit right, | |
| 143 LayoutUnit bottom); | |
| 144 void addLayoutOpportunity(LayoutUnit left, | |
| 145 LayoutUnit top, | |
| 146 LayoutUnit right, | |
| 147 LayoutUnit bottom); | |
| 148 | |
| 149 Member<NGConstraintSpace> constraint_space_; | |
| 150 unsigned clear_; | |
| 151 bool for_inline_or_bfc_; | |
| 152 Vector<NGExclusion> filtered_exclusions_; | |
| 153 HeapVector<Member<NGConstraintSpace>> current_opportunities_; | |
| 154 unsigned current_exclusion_idx_; | |
| 155 }; | |
| 156 | |
| 157 inline std::ostream& operator<<(std::ostream& stream, | 122 inline std::ostream& operator<<(std::ostream& stream, |
| 158 const NGConstraintSpace& value) { | 123 const NGConstraintSpace& value) { |
| 159 return stream << value.toString(); | 124 return stream << value.toString(); |
| 160 } | 125 } |
| 161 | 126 |
| 162 } // namespace blink | 127 } // namespace blink |
| 163 | 128 |
| 164 #endif // NGConstraintSpace_h | 129 #endif // NGConstraintSpace_h |
| OLD | NEW |