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 "wtf/DoublyLinkedList.h" | 10 #include "wtf/DoublyLinkedList.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 NGClearFragment = 4 | 25 NGClearFragment = 4 |
26 }; | 26 }; |
27 | 27 |
28 enum NGFragmentationType { | 28 enum NGFragmentationType { |
29 FragmentNone, | 29 FragmentNone, |
30 FragmentPage, | 30 FragmentPage, |
31 FragmentColumn, | 31 FragmentColumn, |
32 FragmentRegion | 32 FragmentRegion |
33 }; | 33 }; |
34 | 34 |
35 enum NGExclusionFlowType { | |
36 ExcludeNone, | |
37 ExcludeInlineFlow, | |
38 ExcludeInlineStart, | |
39 ExcludeInlineEnd, | |
40 ExcludeInlineBoth | |
41 }; | |
42 | |
43 enum NGWritingMode { | 35 enum NGWritingMode { |
44 HorizontalTopBottom = 0, | 36 HorizontalTopBottom = 0, |
45 VerticalRightLeft = 1, | 37 VerticalRightLeft = 1, |
46 VerticalLeftRight = 2, | 38 VerticalLeftRight = 2, |
47 SidewaysRightLeft = 3, | 39 SidewaysRightLeft = 3, |
48 SidewaysLeftRight = 4 | 40 SidewaysLeftRight = 4 |
49 }; | 41 }; |
50 | 42 |
51 enum NGDirection { LeftToRight = 0, RightToLeft = 1 }; | 43 enum NGDirection { LeftToRight = 0, RightToLeft = 1 }; |
52 | 44 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 // If specified a layout should produce a Fragment which fragments at the | 91 // If specified a layout should produce a Fragment which fragments at the |
100 // blockSize if possible. | 92 // blockSize if possible. |
101 NGFragmentationType blockFragmentationType() const { | 93 NGFragmentationType blockFragmentationType() const { |
102 return static_cast<NGFragmentationType>(block_fragmentation_type_); | 94 return static_cast<NGFragmentationType>(block_fragmentation_type_); |
103 } | 95 } |
104 | 96 |
105 DoublyLinkedList<const NGExclusion> exclusions(unsigned options = 0) const; | 97 DoublyLinkedList<const NGExclusion> exclusions(unsigned options = 0) const; |
106 | 98 |
107 NGLayoutOpportunityIterator layoutOpportunities( | 99 NGLayoutOpportunityIterator layoutOpportunities( |
108 unsigned clear = NGClearNone, | 100 unsigned clear = NGClearNone, |
109 NGExclusionFlowType avoid = ExcludeNone) const; | 101 bool for_inline_or_bfc = false) const; |
110 | 102 |
111 // Modifies constraint space to account for a placed fragment. Depending on | 103 // Modifies constraint space to account for a placed fragment. Depending on |
112 // 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 |
113 // size, or add an exclusion. | 105 // size, or add an exclusion. |
114 void subtract(const NGFragment); | 106 void subtract(const NGFragment); |
115 | 107 |
116 private: | 108 private: |
117 NGLogicalSize container_size_; | 109 NGLogicalSize container_size_; |
118 | 110 |
119 unsigned fixed_inline_size_ : 1; | 111 unsigned fixed_inline_size_ : 1; |
120 unsigned fixed_block_size_ : 1; | 112 unsigned fixed_block_size_ : 1; |
121 unsigned inline_triggers_scrollbar_ : 1; | 113 unsigned inline_triggers_scrollbar_ : 1; |
122 unsigned block_triggers_scrollbar_ : 1; | 114 unsigned block_triggers_scrollbar_ : 1; |
123 unsigned block_fragmentation_type_ : 2; | 115 unsigned block_fragmentation_type_ : 2; |
124 | 116 |
125 DoublyLinkedList<const NGExclusion> exclusions_; | 117 DoublyLinkedList<const NGExclusion> exclusions_; |
126 }; | 118 }; |
127 | 119 |
128 class CORE_EXPORT NGLayoutOpportunityIterator final { | 120 class CORE_EXPORT NGLayoutOpportunityIterator final { |
129 public: | 121 public: |
130 NGLayoutOpportunityIterator(const NGConstraintSpace* space, unsigned clear, | 122 NGLayoutOpportunityIterator(const NGConstraintSpace* space, |
131 NGExclusionFlowType avoid) | 123 unsigned clear, |
132 : constraint_space_(space), clear_(clear), avoid_(avoid) {} | 124 bool for_inline_or_bfc) |
| 125 : constraint_space_(space), |
| 126 clear_(clear), |
| 127 for_inline_or_bfc_(for_inline_or_bfc) {} |
133 ~NGLayoutOpportunityIterator() {} | 128 ~NGLayoutOpportunityIterator() {} |
134 | 129 |
135 const NGDerivedConstraintSpace* next(); | 130 const NGDerivedConstraintSpace* next(); |
136 | 131 |
137 private: | 132 private: |
138 const NGConstraintSpace* constraint_space_; | 133 const NGConstraintSpace* constraint_space_; |
139 unsigned clear_; | 134 unsigned clear_; |
140 NGExclusionFlowType avoid_; | 135 bool for_inline_or_bfc_; |
141 }; | 136 }; |
142 | 137 |
143 } // namespace blink | 138 } // namespace blink |
144 | 139 |
145 #endif // NGConstraintSpace_h | 140 #endif // NGConstraintSpace_h |
OLD | NEW |