Chromium Code Reviews| 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 | |
|
eae
2016/04/25 02:37:28
Having a setter return a bool is a bit unusual. Yo
cbiesinger
2016/04/26 18:21:56
Done.
| |
| 80 bool setStaticPositionForPositionedLayout(LayoutBox& child); | |
| 73 protected: | 81 protected: |
| 74 void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const override; | 82 void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const override; |
| 75 | 83 |
| 76 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override ; | 84 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override ; |
| 77 void removeChild(LayoutObject*) override; | 85 void removeChild(LayoutObject*) override; |
| 78 | 86 |
| 79 private: | 87 private: |
| 80 enum FlexSign { | 88 enum FlexSign { |
| 81 PositiveFlexibility, | 89 PositiveFlexibility, |
| 82 NegativeFlexibility, | 90 NegativeFlexibility, |
| 83 }; | 91 }; |
| 84 | 92 |
| 85 enum PositionedLayoutMode { | |
| 86 FlipForRowReverse, | |
| 87 NoFlipForRowReverse, | |
| 88 }; | |
| 89 | |
| 90 enum ChildLayoutType { | 93 enum ChildLayoutType { |
| 91 LayoutIfNeeded, | 94 LayoutIfNeeded, |
| 92 ForceLayout, | 95 ForceLayout, |
| 93 NeverLayout | 96 NeverLayout |
| 94 }; | 97 }; |
| 95 | 98 |
| 96 enum class TransformedWritingMode { | 99 enum class TransformedWritingMode { |
| 97 TopToBottomWritingMode, RightToLeftWritingMode, LeftToRightWritingMode, BottomToTopWritingMode | 100 TopToBottomWritingMode, RightToLeftWritingMode, LeftToRightWritingMode, BottomToTopWritingMode |
| 98 }; | 101 }; |
| 99 | 102 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 170 LayoutUnit adjustChildSizeForMinAndMax(const LayoutBox& child, LayoutUnit ch ildSize); | 173 LayoutUnit adjustChildSizeForMinAndMax(const LayoutBox& child, LayoutUnit ch ildSize); |
| 171 LayoutUnit adjustChildSizeForAspectRatioCrossAxisMinAndMax(const LayoutBox& child, LayoutUnit childSize); | 174 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 | 175 // 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); | 176 bool computeNextFlexLine(OrderedFlexItemList& orderedChildren, LayoutUnit& s umFlexBaseSize, double& totalFlexGrow, double& totalFlexShrink, double& totalWei ghtedFlexShrink, LayoutUnit& sumHypotheticalMainSize, bool relayoutChildren); |
| 174 | 177 |
| 175 bool resolveFlexibleLengths(FlexSign, const OrderedFlexItemList&, LayoutUnit availableFreeSpace, LayoutUnit& remainingFreeSpace, double& totalFlexGrow, doub le& totalFlexShrink, double& totalWeightedFlexShrink, InflexibleFlexItemSize&, V ector<LayoutUnit, 16>& childSizes); | 178 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&); | 179 void freezeViolations(const Vector<Violation>&, LayoutUnit& availableFreeSpa ce, double& totalFlexGrow, double& totalFlexShrink, double& totalWeightedFlexShr ink, InflexibleFlexItemSize&); |
| 177 | 180 |
| 178 void resetAutoMarginsAndLogicalTopInCrossAxis(LayoutBox& child); | 181 void resetAutoMarginsAndLogicalTopInCrossAxis(LayoutBox& child); |
| 179 void setOverrideMainAxisSizeForChild(LayoutBox& child, LayoutUnit childPrefe rredSize); | 182 void setOverrideMainAxisSizeForChild(LayoutBox& child, LayoutUnit childPrefe rredSize); |
| 180 void prepareChildForPositionedLayout(LayoutBox& child, LayoutUnit mainAxisOf fset, LayoutUnit crossAxisOffset, PositionedLayoutMode); | 183 void prepareChildForPositionedLayout(LayoutBox& child); |
| 181 size_t numberOfInFlowPositionedChildren(const OrderedFlexItemList&) const; | 184 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>&); | 185 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); | 186 void layoutColumnReverse(const OrderedFlexItemList&, LayoutUnit crossAxisOff set, LayoutUnit availableFreeSpace); |
| 184 void alignFlexLines(Vector<LineContext>&); | 187 void alignFlexLines(Vector<LineContext>&); |
| 185 void alignChildren(const Vector<LineContext>&); | 188 void alignChildren(const Vector<LineContext>&); |
| 186 void applyStretchAlignmentToChild(LayoutBox& child, LayoutUnit lineCrossAxis Extent); | 189 void applyStretchAlignmentToChild(LayoutBox& child, LayoutUnit lineCrossAxis Extent); |
| 187 void flipForRightToLeftColumn(); | 190 void flipForRightToLeftColumn(); |
| 188 void flipForWrapReverse(const Vector<LineContext>&, LayoutUnit crossAxisStar tEdge); | 191 void flipForWrapReverse(const Vector<LineContext>&, LayoutUnit crossAxisStar tEdge); |
| 189 | 192 |
| 190 float countIntrinsicSizeForAlgorithmChange(LayoutUnit maxPreferredWidth, Lay outBox* child, float previousMaxContentFlexFraction) const; | 193 float countIntrinsicSizeForAlgorithmChange(LayoutUnit maxPreferredWidth, Lay outBox* child, float previousMaxContentFlexFraction) const; |
| 191 | 194 |
| 192 // This is used to cache the preferred size for orthogonal flow children so we don't have to relayout to get it | 195 // 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; | 196 HashMap<const LayoutObject*, LayoutUnit> m_intrinsicSizeAlongMainAxis; |
| 194 | 197 |
| 195 // This set is used to keep track of which children we laid out in this curr ent layout iteration. | 198 // 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 | 199 // 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. | 200 // handling, as the first layout likely did not use the correct value for pe rcentage sizing of children. |
| 198 HashSet<const LayoutObject*> m_relaidOutChildren; | 201 HashSet<const LayoutObject*> m_relaidOutChildren; |
| 199 | 202 |
| 200 mutable OrderIterator m_orderIterator; | 203 mutable OrderIterator m_orderIterator; |
| 201 int m_numberOfInFlowChildrenOnFirstLine; | 204 int m_numberOfInFlowChildrenOnFirstLine; |
| 202 }; | 205 }; |
| 203 | 206 |
| 204 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutFlexibleBox, isFlexibleBox()); | 207 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutFlexibleBox, isFlexibleBox()); |
| 205 | 208 |
| 206 } // namespace blink | 209 } // namespace blink |
| 207 | 210 |
| 208 #endif // LayoutFlexibleBox_h | 211 #endif // LayoutFlexibleBox_h |
| OLD | NEW |