OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 LayoutUnit childLogicalHeightForPercentageResolution(const LayoutBox& child); | 75 LayoutUnit childLogicalHeightForPercentageResolution(const LayoutBox& child); |
76 | 76 |
77 void clearCachedMainSizeForChild(const LayoutBox& child); | 77 void clearCachedMainSizeForChild(const LayoutBox& child); |
78 | 78 |
79 LayoutUnit staticMainAxisPositionForPositionedChild(const LayoutBox& child); | 79 LayoutUnit staticMainAxisPositionForPositionedChild(const LayoutBox& child); |
80 LayoutUnit staticCrossAxisPositionForPositionedChild(const LayoutBox& child); | 80 LayoutUnit staticCrossAxisPositionForPositionedChild(const LayoutBox& child); |
81 | 81 |
82 LayoutUnit staticInlinePositionForPositionedChild(const LayoutBox& child); | 82 LayoutUnit staticInlinePositionForPositionedChild(const LayoutBox& child); |
83 LayoutUnit staticBlockPositionForPositionedChild(const LayoutBox& child); | 83 LayoutUnit staticBlockPositionForPositionedChild(const LayoutBox& child); |
84 | 84 |
85 // Returns true if the position changed. In that case, the child will have to
be | 85 // Returns true if the position changed. In that case, the child will have to |
86 // laid out again. | 86 // be laid out again. |
87 bool setStaticPositionForPositionedLayout(LayoutBox& child); | 87 bool setStaticPositionForPositionedLayout(LayoutBox& child); |
88 | 88 |
89 protected: | 89 protected: |
90 void computeIntrinsicLogicalWidths( | 90 void computeIntrinsicLogicalWidths( |
91 LayoutUnit& minLogicalWidth, | 91 LayoutUnit& minLogicalWidth, |
92 LayoutUnit& maxLogicalWidth) const override; | 92 LayoutUnit& maxLogicalWidth) const override; |
93 | 93 |
94 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override; | 94 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override; |
95 void removeChild(LayoutObject*) override; | 95 void removeChild(LayoutObject*) override; |
96 | 96 |
(...skipping 11 matching lines...) Expand all Loading... |
108 LeftToRightWritingMode, | 108 LeftToRightWritingMode, |
109 BottomToTopWritingMode | 109 BottomToTopWritingMode |
110 }; | 110 }; |
111 | 111 |
112 enum class SizeDefiniteness { Definite, Indefinite, Unknown }; | 112 enum class SizeDefiniteness { Definite, Indefinite, Unknown }; |
113 | 113 |
114 struct FlexItem; | 114 struct FlexItem; |
115 struct LineContext; | 115 struct LineContext; |
116 | 116 |
117 typedef Vector<FlexItem> OrderedFlexItemList; | 117 typedef Vector<FlexItem> OrderedFlexItemList; |
118 // Use an inline capacity of 8, since flexbox containers usually have less tha
n 8 children. | 118 // Use an inline capacity of 8, since flexbox containers usually have less |
| 119 // than 8 children. |
119 typedef Vector<LayoutRect, 8> ChildFrameRects; | 120 typedef Vector<LayoutRect, 8> ChildFrameRects; |
120 | 121 |
121 bool hasOrthogonalFlow(const LayoutBox& child) const; | 122 bool hasOrthogonalFlow(const LayoutBox& child) const; |
122 bool isColumnFlow() const; | 123 bool isColumnFlow() const; |
123 bool isLeftToRightFlow() const; | 124 bool isLeftToRightFlow() const; |
124 bool isMultiline() const; | 125 bool isMultiline() const; |
125 Length flexBasisForChild(const LayoutBox& child) const; | 126 Length flexBasisForChild(const LayoutBox& child) const; |
126 LayoutUnit crossAxisExtentForChild(const LayoutBox& child) const; | 127 LayoutUnit crossAxisExtentForChild(const LayoutBox& child) const; |
127 LayoutUnit crossAxisIntrinsicExtentForChild(const LayoutBox& child) const; | 128 LayoutUnit crossAxisIntrinsicExtentForChild(const LayoutBox& child) const; |
128 LayoutUnit childIntrinsicLogicalHeight(const LayoutBox& child) const; | 129 LayoutUnit childIntrinsicLogicalHeight(const LayoutBox& child) const; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 LayoutUnit marginBoxAscentForChild(const LayoutBox& child); | 195 LayoutUnit marginBoxAscentForChild(const LayoutBox& child); |
195 | 196 |
196 LayoutUnit computeChildMarginValue(Length margin); | 197 LayoutUnit computeChildMarginValue(Length margin); |
197 void prepareOrderIteratorAndMargins(); | 198 void prepareOrderIteratorAndMargins(); |
198 LayoutUnit adjustChildSizeForMinAndMax(const LayoutBox& child, | 199 LayoutUnit adjustChildSizeForMinAndMax(const LayoutBox& child, |
199 LayoutUnit childSize); | 200 LayoutUnit childSize); |
200 LayoutUnit adjustChildSizeForAspectRatioCrossAxisMinAndMax( | 201 LayoutUnit adjustChildSizeForAspectRatioCrossAxisMinAndMax( |
201 const LayoutBox& child, | 202 const LayoutBox& child, |
202 LayoutUnit childSize); | 203 LayoutUnit childSize); |
203 FlexItem constructFlexItem(LayoutBox& child, ChildLayoutType); | 204 FlexItem constructFlexItem(LayoutBox& child, ChildLayoutType); |
204 // The hypothetical main size of an item is the flex base size clamped accordi
ng to its min and max main size properties | 205 // The hypothetical main size of an item is the flex base size clamped |
| 206 // according to its min and max main size properties |
205 bool computeNextFlexLine(OrderedFlexItemList& orderedChildren, | 207 bool computeNextFlexLine(OrderedFlexItemList& orderedChildren, |
206 LayoutUnit& sumFlexBaseSize, | 208 LayoutUnit& sumFlexBaseSize, |
207 double& totalFlexGrow, | 209 double& totalFlexGrow, |
208 double& totalFlexShrink, | 210 double& totalFlexShrink, |
209 double& totalWeightedFlexShrink, | 211 double& totalWeightedFlexShrink, |
210 LayoutUnit& sumHypotheticalMainSize, | 212 LayoutUnit& sumHypotheticalMainSize, |
211 bool relayoutChildren, | 213 bool relayoutChildren, |
212 LayoutObject* childToExclude); | 214 LayoutObject* childToExclude); |
213 | 215 |
214 void freezeInflexibleItems(FlexSign, | 216 void freezeInflexibleItems(FlexSign, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 LayoutUnit lineCrossAxisExtent); | 252 LayoutUnit lineCrossAxisExtent); |
251 void flipForRightToLeftColumn(); | 253 void flipForRightToLeftColumn(); |
252 void flipForWrapReverse(const Vector<LineContext>&, | 254 void flipForWrapReverse(const Vector<LineContext>&, |
253 LayoutUnit crossAxisStartEdge); | 255 LayoutUnit crossAxisStartEdge); |
254 | 256 |
255 float countIntrinsicSizeForAlgorithmChange( | 257 float countIntrinsicSizeForAlgorithmChange( |
256 LayoutUnit maxPreferredWidth, | 258 LayoutUnit maxPreferredWidth, |
257 LayoutBox* child, | 259 LayoutBox* child, |
258 float previousMaxContentFlexFraction) const; | 260 float previousMaxContentFlexFraction) const; |
259 | 261 |
260 // This is used to cache the preferred size for orthogonal flow children so we
don't have to relayout to get it | 262 // This is used to cache the preferred size for orthogonal flow children so we |
| 263 // don't have to relayout to get it |
261 HashMap<const LayoutObject*, LayoutUnit> m_intrinsicSizeAlongMainAxis; | 264 HashMap<const LayoutObject*, LayoutUnit> m_intrinsicSizeAlongMainAxis; |
262 | 265 |
263 // This set is used to keep track of which children we laid out in this curren
t layout iteration. | 266 // This set is used to keep track of which children we laid out in this |
264 // We need it because the ones in this set may need an additional layout pass
for correct stretch alignment | 267 // current layout iteration. We need it because the ones in this set may |
265 // handling, as the first layout likely did not use the correct value for perc
entage sizing of children. | 268 // need an additional layout pass for correct stretch alignment handling, as |
| 269 // the first layout likely did not use the correct value for percentage |
| 270 // sizing of children. |
266 HashSet<const LayoutObject*> m_relaidOutChildren; | 271 HashSet<const LayoutObject*> m_relaidOutChildren; |
267 | 272 |
268 mutable OrderIterator m_orderIterator; | 273 mutable OrderIterator m_orderIterator; |
269 int m_numberOfInFlowChildrenOnFirstLine; | 274 int m_numberOfInFlowChildrenOnFirstLine; |
270 | 275 |
271 // This is SizeIsUnknown outside of layoutBlock() | 276 // This is SizeIsUnknown outside of layoutBlock() |
272 mutable SizeDefiniteness m_hasDefiniteHeight; | 277 mutable SizeDefiniteness m_hasDefiniteHeight; |
273 }; | 278 }; |
274 | 279 |
275 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutFlexibleBox, isFlexibleBox()); | 280 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutFlexibleBox, isFlexibleBox()); |
276 | 281 |
277 } // namespace blink | 282 } // namespace blink |
278 | 283 |
279 #endif // LayoutFlexibleBox_h | 284 #endif // LayoutFlexibleBox_h |
OLD | NEW |