| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 // Returns -1 if the height of this flexbox is indefinite | 63 // Returns -1 if the height of this flexbox is indefinite |
| 64 LayoutUnit computeDefiniteLogicalWidth(); | 64 LayoutUnit computeDefiniteLogicalWidth(); |
| 65 LayoutUnit computeDefiniteLogicalHeight(); | 65 LayoutUnit computeDefiniteLogicalHeight(); |
| 66 | 66 |
| 67 LayoutUnit crossSizeForPercentageResolution(const LayoutBox& child); | 67 LayoutUnit crossSizeForPercentageResolution(const LayoutBox& child); |
| 68 LayoutUnit mainSizeForPercentageResolution(const LayoutBox& child); | 68 LayoutUnit mainSizeForPercentageResolution(const LayoutBox& child); |
| 69 LayoutUnit childLogicalHeightForPercentageResolution(const LayoutBox& child)
; | 69 LayoutUnit childLogicalHeightForPercentageResolution(const LayoutBox& child)
; |
| 70 LayoutUnit childLogicalWidthForPercentageResolution(const LayoutBox& child); | 70 LayoutUnit childLogicalWidthForPercentageResolution(const LayoutBox& child); |
| 71 | 71 |
| 72 void clearCachedMainSizeForChild(const LayoutBox& child); | 72 void clearCachedMainSizeForChild(const LayoutBox& child); |
| 73 |
| 74 LayoutUnit staticMainAxisPositionForPositionedChild(const LayoutBox& child); |
| 75 LayoutUnit staticCrossAxisPositionForPositionedChild(const LayoutBox& child)
; |
| 76 |
| 77 LayoutUnit staticInlinePositionForPositionedChild(const LayoutBox& child); |
| 78 LayoutUnit staticBlockPositionForPositionedChild(const LayoutBox& child); |
| 79 |
| 80 // Returns true if the position changed. In that case, the child will have t
o be |
| 81 // laid out again. |
| 82 bool setStaticPositionForPositionedLayout(LayoutBox& child); |
| 73 protected: | 83 protected: |
| 74 void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit&
maxLogicalWidth) const override; | 84 void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit&
maxLogicalWidth) const override; |
| 75 | 85 |
| 76 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override
; | 86 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override
; |
| 77 void removeChild(LayoutObject*) override; | 87 void removeChild(LayoutObject*) override; |
| 78 | 88 |
| 79 private: | 89 private: |
| 80 enum FlexSign { | 90 enum FlexSign { |
| 81 PositiveFlexibility, | 91 PositiveFlexibility, |
| 82 NegativeFlexibility, | 92 NegativeFlexibility, |
| 83 }; | 93 }; |
| 84 | 94 |
| 85 enum PositionedLayoutMode { | |
| 86 FlipForRowReverse, | |
| 87 NoFlipForRowReverse, | |
| 88 }; | |
| 89 | |
| 90 enum ChildLayoutType { | 95 enum ChildLayoutType { |
| 91 LayoutIfNeeded, | 96 LayoutIfNeeded, |
| 92 ForceLayout, | 97 ForceLayout, |
| 93 NeverLayout | 98 NeverLayout |
| 94 }; | 99 }; |
| 95 | 100 |
| 96 enum class TransformedWritingMode { | 101 enum class TransformedWritingMode { |
| 97 TopToBottomWritingMode, RightToLeftWritingMode, LeftToRightWritingMode,
BottomToTopWritingMode | 102 TopToBottomWritingMode, RightToLeftWritingMode, LeftToRightWritingMode,
BottomToTopWritingMode |
| 98 }; | 103 }; |
| 99 | 104 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 LayoutUnit adjustChildSizeForMinAndMax(const LayoutBox& child, LayoutUnit ch
ildSize); | 175 LayoutUnit adjustChildSizeForMinAndMax(const LayoutBox& child, LayoutUnit ch
ildSize); |
| 171 LayoutUnit adjustChildSizeForAspectRatioCrossAxisMinAndMax(const LayoutBox&
child, LayoutUnit childSize); | 176 LayoutUnit adjustChildSizeForAspectRatioCrossAxisMinAndMax(const LayoutBox&
child, LayoutUnit childSize); |
| 172 // The hypothetical main size of an item is the flex base size clamped accor
ding to its min and max main size properties | 177 // The hypothetical main size of an item is the flex base size clamped accor
ding to its min and max main size properties |
| 173 bool computeNextFlexLine(OrderedFlexItemList& orderedChildren, LayoutUnit& s
umFlexBaseSize, double& totalFlexGrow, double& totalFlexShrink, double& totalWei
ghtedFlexShrink, LayoutUnit& sumHypotheticalMainSize, bool relayoutChildren); | 178 bool computeNextFlexLine(OrderedFlexItemList& orderedChildren, LayoutUnit& s
umFlexBaseSize, double& totalFlexGrow, double& totalFlexShrink, double& totalWei
ghtedFlexShrink, LayoutUnit& sumHypotheticalMainSize, bool relayoutChildren); |
| 174 | 179 |
| 175 bool resolveFlexibleLengths(FlexSign, const OrderedFlexItemList&, LayoutUnit
availableFreeSpace, LayoutUnit& remainingFreeSpace, double& totalFlexGrow, doub
le& totalFlexShrink, double& totalWeightedFlexShrink, InflexibleFlexItemSize&, V
ector<LayoutUnit, 16>& childSizes); | 180 bool resolveFlexibleLengths(FlexSign, const OrderedFlexItemList&, LayoutUnit
availableFreeSpace, LayoutUnit& remainingFreeSpace, double& totalFlexGrow, doub
le& totalFlexShrink, double& totalWeightedFlexShrink, InflexibleFlexItemSize&, V
ector<LayoutUnit, 16>& childSizes); |
| 176 void freezeViolations(const Vector<Violation>&, LayoutUnit& availableFreeSpa
ce, double& totalFlexGrow, double& totalFlexShrink, double& totalWeightedFlexShr
ink, InflexibleFlexItemSize&); | 181 void freezeViolations(const Vector<Violation>&, LayoutUnit& availableFreeSpa
ce, double& totalFlexGrow, double& totalFlexShrink, double& totalWeightedFlexShr
ink, InflexibleFlexItemSize&); |
| 177 | 182 |
| 178 void resetAutoMarginsAndLogicalTopInCrossAxis(LayoutBox& child); | 183 void resetAutoMarginsAndLogicalTopInCrossAxis(LayoutBox& child); |
| 179 void setOverrideMainAxisSizeForChild(LayoutBox& child, LayoutUnit childPrefe
rredSize); | 184 void setOverrideMainAxisSizeForChild(LayoutBox& child, LayoutUnit childPrefe
rredSize); |
| 180 void prepareChildForPositionedLayout(LayoutBox& child, LayoutUnit mainAxisOf
fset, LayoutUnit crossAxisOffset, PositionedLayoutMode); | 185 void prepareChildForPositionedLayout(LayoutBox& child); |
| 181 size_t numberOfInFlowPositionedChildren(const OrderedFlexItemList&) const; | 186 size_t numberOfInFlowPositionedChildren(const OrderedFlexItemList&) const; |
| 182 void layoutAndPlaceChildren(LayoutUnit& crossAxisOffset, const OrderedFlexIt
emList&, const Vector<LayoutUnit, 16>& childSizes, LayoutUnit availableFreeSpace
, bool relayoutChildren, SubtreeLayoutScope&, Vector<LineContext>&); | 187 void layoutAndPlaceChildren(LayoutUnit& crossAxisOffset, const OrderedFlexIt
emList&, const Vector<LayoutUnit, 16>& childSizes, LayoutUnit availableFreeSpace
, bool relayoutChildren, SubtreeLayoutScope&, Vector<LineContext>&); |
| 183 void layoutColumnReverse(const OrderedFlexItemList&, LayoutUnit crossAxisOff
set, LayoutUnit availableFreeSpace); | 188 void layoutColumnReverse(const OrderedFlexItemList&, LayoutUnit crossAxisOff
set, LayoutUnit availableFreeSpace); |
| 184 void alignFlexLines(Vector<LineContext>&); | 189 void alignFlexLines(Vector<LineContext>&); |
| 185 void alignChildren(const Vector<LineContext>&); | 190 void alignChildren(const Vector<LineContext>&); |
| 186 void applyStretchAlignmentToChild(LayoutBox& child, LayoutUnit lineCrossAxis
Extent); | 191 void applyStretchAlignmentToChild(LayoutBox& child, LayoutUnit lineCrossAxis
Extent); |
| 187 void flipForRightToLeftColumn(); | 192 void flipForRightToLeftColumn(); |
| 188 void flipForWrapReverse(const Vector<LineContext>&, LayoutUnit crossAxisStar
tEdge); | 193 void flipForWrapReverse(const Vector<LineContext>&, LayoutUnit crossAxisStar
tEdge); |
| 189 | 194 |
| 190 float countIntrinsicSizeForAlgorithmChange(LayoutUnit maxPreferredWidth, Lay
outBox* child, float previousMaxContentFlexFraction) const; | 195 float countIntrinsicSizeForAlgorithmChange(LayoutUnit maxPreferredWidth, Lay
outBox* child, float previousMaxContentFlexFraction) const; |
| 191 | 196 |
| 192 // This is used to cache the preferred size for orthogonal flow children so
we don't have to relayout to get it | 197 // This is used to cache the preferred size for orthogonal flow children so
we don't have to relayout to get it |
| 193 HashMap<const LayoutObject*, LayoutUnit> m_intrinsicSizeAlongMainAxis; | 198 HashMap<const LayoutObject*, LayoutUnit> m_intrinsicSizeAlongMainAxis; |
| 194 | 199 |
| 195 // This set is used to keep track of which children we laid out in this curr
ent layout iteration. | 200 // This set is used to keep track of which children we laid out in this curr
ent layout iteration. |
| 196 // We need it because the ones in this set may need an additional layout pas
s for correct stretch alignment | 201 // We need it because the ones in this set may need an additional layout pas
s for correct stretch alignment |
| 197 // handling, as the first layout likely did not use the correct value for pe
rcentage sizing of children. | 202 // handling, as the first layout likely did not use the correct value for pe
rcentage sizing of children. |
| 198 HashSet<const LayoutObject*> m_relaidOutChildren; | 203 HashSet<const LayoutObject*> m_relaidOutChildren; |
| 199 | 204 |
| 200 mutable OrderIterator m_orderIterator; | 205 mutable OrderIterator m_orderIterator; |
| 201 int m_numberOfInFlowChildrenOnFirstLine; | 206 int m_numberOfInFlowChildrenOnFirstLine; |
| 202 }; | 207 }; |
| 203 | 208 |
| 204 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutFlexibleBox, isFlexibleBox()); | 209 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutFlexibleBox, isFlexibleBox()); |
| 205 | 210 |
| 206 } // namespace blink | 211 } // namespace blink |
| 207 | 212 |
| 208 #endif // LayoutFlexibleBox_h | 213 #endif // LayoutFlexibleBox_h |
| OLD | NEW |