| 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" |
| 11 #include "platform/heap/Handle.h" | |
| 12 #include "wtf/Optional.h" | 11 #include "wtf/Optional.h" |
| 12 #include "wtf/RefCounted.h" |
| 13 #include "wtf/text/WTFString.h" | 13 #include "wtf/text/WTFString.h" |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 class LayoutBox; | 17 class LayoutBox; |
| 18 class NGBoxFragment; | 18 class NGBoxFragment; |
| 19 | 19 |
| 20 enum NGFragmentationType { | 20 enum NGFragmentationType { |
| 21 kFragmentNone, | 21 kFragmentNone, |
| 22 kFragmentPage, | 22 kFragmentPage, |
| 23 kFragmentColumn, | 23 kFragmentColumn, |
| 24 kFragmentRegion | 24 kFragmentRegion |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 // The NGConstraintSpace represents a set of constraints and available space | 27 // The NGConstraintSpace represents a set of constraints and available space |
| 28 // which a layout algorithm may produce a NGFragment within. | 28 // which a layout algorithm may produce a NGFragment within. |
| 29 class CORE_EXPORT NGConstraintSpace final | 29 class CORE_EXPORT NGConstraintSpace final |
| 30 : public GarbageCollectedFinalized<NGConstraintSpace> { | 30 : public RefCounted<NGConstraintSpace> { |
| 31 public: | 31 public: |
| 32 // This should live on NGBlockNode or another layout bridge and probably take | 32 // This should live on NGBlockNode or another layout bridge and probably take |
| 33 // a root NGConstraintSpace. | 33 // a root NGConstraintSpace. |
| 34 static NGConstraintSpace* CreateFromLayoutObject(const LayoutBox&); | 34 static RefPtr<NGConstraintSpace> CreateFromLayoutObject(const LayoutBox&); |
| 35 | 35 |
| 36 const std::shared_ptr<NGExclusions>& Exclusions() const { | 36 const std::shared_ptr<NGExclusions>& Exclusions() const { |
| 37 return exclusions_; | 37 return exclusions_; |
| 38 } | 38 } |
| 39 | 39 |
| 40 TextDirection Direction() const { | 40 TextDirection Direction() const { |
| 41 return static_cast<TextDirection>(direction_); | 41 return static_cast<TextDirection>(direction_); |
| 42 } | 42 } |
| 43 | 43 |
| 44 NGWritingMode WritingMode() const { | 44 NGWritingMode WritingMode() const { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 void Subtract(const NGBoxFragment*); | 114 void Subtract(const NGBoxFragment*); |
| 115 | 115 |
| 116 NGMarginStrut MarginStrut() const { return margin_strut_; } | 116 NGMarginStrut MarginStrut() const { return margin_strut_; } |
| 117 | 117 |
| 118 NGLogicalOffset BfcOffset() const { return bfc_offset_; } | 118 NGLogicalOffset BfcOffset() const { return bfc_offset_; } |
| 119 | 119 |
| 120 WTF::Optional<LayoutUnit> ClearanceOffset() const { | 120 WTF::Optional<LayoutUnit> ClearanceOffset() const { |
| 121 return clearance_offset_; | 121 return clearance_offset_; |
| 122 } | 122 } |
| 123 | 123 |
| 124 DEFINE_INLINE_VIRTUAL_TRACE() {} | |
| 125 | |
| 126 String ToString() const; | 124 String ToString() const; |
| 127 | 125 |
| 128 private: | 126 private: |
| 129 friend class NGConstraintSpaceBuilder; | 127 friend class NGConstraintSpaceBuilder; |
| 130 // Default constructor. | 128 // Default constructor. |
| 131 NGConstraintSpace(NGWritingMode, | 129 NGConstraintSpace(NGWritingMode, |
| 132 TextDirection, | 130 TextDirection, |
| 133 NGLogicalSize available_size, | 131 NGLogicalSize available_size, |
| 134 NGLogicalSize percentage_resolution_size, | 132 NGLogicalSize percentage_resolution_size, |
| 135 NGPhysicalSize initial_containing_block_size, | 133 NGPhysicalSize initial_containing_block_size, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 }; | 181 }; |
| 184 | 182 |
| 185 inline std::ostream& operator<<(std::ostream& stream, | 183 inline std::ostream& operator<<(std::ostream& stream, |
| 186 const NGConstraintSpace& value) { | 184 const NGConstraintSpace& value) { |
| 187 return stream << value.ToString(); | 185 return stream << value.ToString(); |
| 188 } | 186 } |
| 189 | 187 |
| 190 } // namespace blink | 188 } // namespace blink |
| 191 | 189 |
| 192 #endif // NGConstraintSpace_h | 190 #endif // NGConstraintSpace_h |
| OLD | NEW |