| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 enum ChildLayoutType { | 92 enum ChildLayoutType { |
| 93 LayoutIfNeeded, | 93 LayoutIfNeeded, |
| 94 ForceLayout, | 94 ForceLayout, |
| 95 NeverLayout | 95 NeverLayout |
| 96 }; | 96 }; |
| 97 | 97 |
| 98 enum class TransformedWritingMode { | 98 enum class TransformedWritingMode { |
| 99 TopToBottomWritingMode, RightToLeftWritingMode, LeftToRightWritingMode,
BottomToTopWritingMode | 99 TopToBottomWritingMode, RightToLeftWritingMode, LeftToRightWritingMode,
BottomToTopWritingMode |
| 100 }; | 100 }; |
| 101 | 101 |
| 102 typedef HashMap<const LayoutBox*, LayoutUnit> InflexibleFlexItemSize; | 102 struct FlexItem; |
| 103 typedef Vector<LayoutBox*> OrderedFlexItemList; | 103 struct LineContext; |
| 104 | 104 |
| 105 struct LineContext; | 105 typedef Vector<FlexItem> OrderedFlexItemList; |
| 106 struct Violation; | |
| 107 | |
| 108 // Use an inline capacity of 8, since flexbox containers usually have less t
han 8 children. | 106 // Use an inline capacity of 8, since flexbox containers usually have less t
han 8 children. |
| 109 typedef Vector<LayoutRect, 8> ChildFrameRects; | 107 typedef Vector<LayoutRect, 8> ChildFrameRects; |
| 110 | 108 |
| 111 bool hasOrthogonalFlow(const LayoutBox& child) const; | 109 bool hasOrthogonalFlow(const LayoutBox& child) const; |
| 112 bool isColumnFlow() const; | 110 bool isColumnFlow() const; |
| 113 bool isLeftToRightFlow() const; | 111 bool isLeftToRightFlow() const; |
| 114 bool isMultiline() const; | 112 bool isMultiline() const; |
| 115 Length flexBasisForChild(const LayoutBox& child) const; | 113 Length flexBasisForChild(const LayoutBox& child) const; |
| 116 LayoutUnit crossAxisExtentForChild(const LayoutBox& child) const; | 114 LayoutUnit crossAxisExtentForChild(const LayoutBox& child) const; |
| 117 LayoutUnit crossAxisIntrinsicExtentForChild(const LayoutBox& child) const; | 115 LayoutUnit crossAxisIntrinsicExtentForChild(const LayoutBox& child) const; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 LayoutUnit availableAlignmentSpaceForChildBeforeStretching(LayoutUnit lineCr
ossAxisExtent, const LayoutBox& child); | 165 LayoutUnit availableAlignmentSpaceForChildBeforeStretching(LayoutUnit lineCr
ossAxisExtent, const LayoutBox& child); |
| 168 LayoutUnit marginBoxAscentForChild(const LayoutBox& child); | 166 LayoutUnit marginBoxAscentForChild(const LayoutBox& child); |
| 169 | 167 |
| 170 LayoutUnit computeChildMarginValue(Length margin); | 168 LayoutUnit computeChildMarginValue(Length margin); |
| 171 void prepareOrderIteratorAndMargins(); | 169 void prepareOrderIteratorAndMargins(); |
| 172 LayoutUnit adjustChildSizeForMinAndMax(const LayoutBox& child, LayoutUnit ch
ildSize); | 170 LayoutUnit adjustChildSizeForMinAndMax(const LayoutBox& child, LayoutUnit ch
ildSize); |
| 173 LayoutUnit adjustChildSizeForAspectRatioCrossAxisMinAndMax(const LayoutBox&
child, LayoutUnit childSize); | 171 LayoutUnit adjustChildSizeForAspectRatioCrossAxisMinAndMax(const LayoutBox&
child, LayoutUnit childSize); |
| 174 // The hypothetical main size of an item is the flex base size clamped accor
ding to its min and max main size properties | 172 // The hypothetical main size of an item is the flex base size clamped accor
ding to its min and max main size properties |
| 175 bool computeNextFlexLine(OrderedFlexItemList& orderedChildren, LayoutUnit& s
umFlexBaseSize, double& totalFlexGrow, double& totalFlexShrink, double& totalWei
ghtedFlexShrink, LayoutUnit& sumHypotheticalMainSize, bool relayoutChildren); | 173 bool computeNextFlexLine(OrderedFlexItemList& orderedChildren, LayoutUnit& s
umFlexBaseSize, double& totalFlexGrow, double& totalFlexShrink, double& totalWei
ghtedFlexShrink, LayoutUnit& sumHypotheticalMainSize, bool relayoutChildren); |
| 176 | 174 |
| 177 bool resolveFlexibleLengths(FlexSign, const OrderedFlexItemList&, LayoutUnit
availableFreeSpace, LayoutUnit& remainingFreeSpace, double& totalFlexGrow, doub
le& totalFlexShrink, double& totalWeightedFlexShrink, InflexibleFlexItemSize&, V
ector<LayoutUnit, 16>& childSizes); | 175 bool resolveFlexibleLengths(FlexSign, OrderedFlexItemList&, LayoutUnit avail
ableFreeSpace, LayoutUnit& remainingFreeSpace, double& totalFlexGrow, double& to
talFlexShrink, double& totalWeightedFlexShrink); |
| 178 void freezeViolations(const Vector<Violation>&, LayoutUnit& availableFreeSpa
ce, double& totalFlexGrow, double& totalFlexShrink, double& totalWeightedFlexShr
ink, InflexibleFlexItemSize&); | 176 void freezeViolations(Vector<FlexItem*>&, LayoutUnit& availableFreeSpace, do
uble& totalFlexGrow, double& totalFlexShrink, double& totalWeightedFlexShrink); |
| 179 | 177 |
| 180 void resetAutoMarginsAndLogicalTopInCrossAxis(LayoutBox& child); | 178 void resetAutoMarginsAndLogicalTopInCrossAxis(LayoutBox& child); |
| 181 void setOverrideMainAxisSizeForChild(LayoutBox& child, LayoutUnit childPrefe
rredSize); | 179 void setOverrideMainAxisSizeForChild(LayoutBox& child, LayoutUnit childPrefe
rredSize); |
| 182 void prepareChildForPositionedLayout(LayoutBox& child); | 180 void prepareChildForPositionedLayout(LayoutBox& child); |
| 183 size_t numberOfInFlowPositionedChildren(const OrderedFlexItemList&) const; | 181 size_t numberOfInFlowPositionedChildren(const OrderedFlexItemList&) const; |
| 184 void layoutAndPlaceChildren(LayoutUnit& crossAxisOffset, const OrderedFlexIt
emList&, const Vector<LayoutUnit, 16>& childSizes, LayoutUnit availableFreeSpace
, bool relayoutChildren, SubtreeLayoutScope&, Vector<LineContext>&); | 182 void layoutAndPlaceChildren(LayoutUnit& crossAxisOffset, const OrderedFlexIt
emList&, LayoutUnit availableFreeSpace, bool relayoutChildren, SubtreeLayoutScop
e&, Vector<LineContext>&); |
| 185 void layoutColumnReverse(const OrderedFlexItemList&, LayoutUnit crossAxisOff
set, LayoutUnit availableFreeSpace); | 183 void layoutColumnReverse(const OrderedFlexItemList&, LayoutUnit crossAxisOff
set, LayoutUnit availableFreeSpace); |
| 186 void alignFlexLines(Vector<LineContext>&); | 184 void alignFlexLines(Vector<LineContext>&); |
| 187 void alignChildren(const Vector<LineContext>&); | 185 void alignChildren(const Vector<LineContext>&); |
| 188 void applyStretchAlignmentToChild(LayoutBox& child, LayoutUnit lineCrossAxis
Extent); | 186 void applyStretchAlignmentToChild(LayoutBox& child, LayoutUnit lineCrossAxis
Extent); |
| 189 void flipForRightToLeftColumn(); | 187 void flipForRightToLeftColumn(); |
| 190 void flipForWrapReverse(const Vector<LineContext>&, LayoutUnit crossAxisStar
tEdge); | 188 void flipForWrapReverse(const Vector<LineContext>&, LayoutUnit crossAxisStar
tEdge); |
| 191 | 189 |
| 192 float countIntrinsicSizeForAlgorithmChange(LayoutUnit maxPreferredWidth, Lay
outBox* child, float previousMaxContentFlexFraction) const; | 190 float countIntrinsicSizeForAlgorithmChange(LayoutUnit maxPreferredWidth, Lay
outBox* child, float previousMaxContentFlexFraction) const; |
| 193 | 191 |
| 194 // This is used to cache the preferred size for orthogonal flow children so
we don't have to relayout to get it | 192 // This is used to cache the preferred size for orthogonal flow children so
we don't have to relayout to get it |
| 195 HashMap<const LayoutObject*, LayoutUnit> m_intrinsicSizeAlongMainAxis; | 193 HashMap<const LayoutObject*, LayoutUnit> m_intrinsicSizeAlongMainAxis; |
| 196 | 194 |
| 197 // This set is used to keep track of which children we laid out in this curr
ent layout iteration. | 195 // This set is used to keep track of which children we laid out in this curr
ent layout iteration. |
| 198 // We need it because the ones in this set may need an additional layout pas
s for correct stretch alignment | 196 // We need it because the ones in this set may need an additional layout pas
s for correct stretch alignment |
| 199 // handling, as the first layout likely did not use the correct value for pe
rcentage sizing of children. | 197 // handling, as the first layout likely did not use the correct value for pe
rcentage sizing of children. |
| 200 HashSet<const LayoutObject*> m_relaidOutChildren; | 198 HashSet<const LayoutObject*> m_relaidOutChildren; |
| 201 | 199 |
| 202 mutable OrderIterator m_orderIterator; | 200 mutable OrderIterator m_orderIterator; |
| 203 int m_numberOfInFlowChildrenOnFirstLine; | 201 int m_numberOfInFlowChildrenOnFirstLine; |
| 204 }; | 202 }; |
| 205 | 203 |
| 206 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutFlexibleBox, isFlexibleBox()); | 204 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutFlexibleBox, isFlexibleBox()); |
| 207 | 205 |
| 208 } // namespace blink | 206 } // namespace blink |
| 209 | 207 |
| 210 #endif // LayoutFlexibleBox_h | 208 #endif // LayoutFlexibleBox_h |
| OLD | NEW |