| 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 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 if (size().height() < minHeight) | 785 if (size().height() < minHeight) |
| 786 setLogicalHeight(minHeight); | 786 setLogicalHeight(minHeight); |
| 787 } | 787 } |
| 788 | 788 |
| 789 updateLogicalHeight(); | 789 updateLogicalHeight(); |
| 790 repositionLogicalHeightDependentFlexItems(lineContexts); | 790 repositionLogicalHeightDependentFlexItems(lineContexts); |
| 791 } | 791 } |
| 792 | 792 |
| 793 LayoutUnit LayoutFlexibleBox::autoMarginOffsetInMainAxis(const OrderedFlexItemLi
st& children, LayoutUnit& availableFreeSpace) | 793 LayoutUnit LayoutFlexibleBox::autoMarginOffsetInMainAxis(const OrderedFlexItemLi
st& children, LayoutUnit& availableFreeSpace) |
| 794 { | 794 { |
| 795 if (availableFreeSpace <= 0) | 795 if (availableFreeSpace <= LayoutUnit()) |
| 796 return 0; | 796 return LayoutUnit(); |
| 797 | 797 |
| 798 int numberOfAutoMargins = 0; | 798 int numberOfAutoMargins = 0; |
| 799 bool isHorizontal = isHorizontalFlow(); | 799 bool isHorizontal = isHorizontalFlow(); |
| 800 for (size_t i = 0; i < children.size(); ++i) { | 800 for (size_t i = 0; i < children.size(); ++i) { |
| 801 LayoutBox* child = children[i]; | 801 LayoutBox* child = children[i]; |
| 802 if (child->isOutOfFlowPositioned()) | 802 if (child->isOutOfFlowPositioned()) |
| 803 continue; | 803 continue; |
| 804 if (isHorizontal) { | 804 if (isHorizontal) { |
| 805 if (child->style()->marginLeft().isAuto()) | 805 if (child->style()->marginLeft().isAuto()) |
| 806 ++numberOfAutoMargins; | 806 ++numberOfAutoMargins; |
| 807 if (child->style()->marginRight().isAuto()) | 807 if (child->style()->marginRight().isAuto()) |
| 808 ++numberOfAutoMargins; | 808 ++numberOfAutoMargins; |
| 809 } else { | 809 } else { |
| 810 if (child->style()->marginTop().isAuto()) | 810 if (child->style()->marginTop().isAuto()) |
| 811 ++numberOfAutoMargins; | 811 ++numberOfAutoMargins; |
| 812 if (child->style()->marginBottom().isAuto()) | 812 if (child->style()->marginBottom().isAuto()) |
| 813 ++numberOfAutoMargins; | 813 ++numberOfAutoMargins; |
| 814 } | 814 } |
| 815 } | 815 } |
| 816 if (!numberOfAutoMargins) | 816 if (!numberOfAutoMargins) |
| 817 return 0; | 817 return LayoutUnit(); |
| 818 | 818 |
| 819 LayoutUnit sizeOfAutoMargin = availableFreeSpace / numberOfAutoMargins; | 819 LayoutUnit sizeOfAutoMargin = availableFreeSpace / numberOfAutoMargins; |
| 820 availableFreeSpace = 0; | 820 availableFreeSpace = LayoutUnit(); |
| 821 return sizeOfAutoMargin; | 821 return sizeOfAutoMargin; |
| 822 } | 822 } |
| 823 | 823 |
| 824 void LayoutFlexibleBox::updateAutoMarginsInMainAxis(LayoutBox& child, LayoutUnit
autoMarginOffset) | 824 void LayoutFlexibleBox::updateAutoMarginsInMainAxis(LayoutBox& child, LayoutUnit
autoMarginOffset) |
| 825 { | 825 { |
| 826 ASSERT(autoMarginOffset >= 0); | 826 ASSERT(autoMarginOffset >= 0); |
| 827 | 827 |
| 828 if (isHorizontalFlow()) { | 828 if (isHorizontalFlow()) { |
| 829 if (child.style()->marginLeft().isAuto()) | 829 if (child.style()->marginLeft().isAuto()) |
| 830 child.setMarginLeft(autoMarginOffset); | 830 child.setMarginLeft(autoMarginOffset); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 child.setMarginBottom(availableAlignmentSpace); | 908 child.setMarginBottom(availableAlignmentSpace); |
| 909 else | 909 else |
| 910 child.setMarginRight(availableAlignmentSpace); | 910 child.setMarginRight(availableAlignmentSpace); |
| 911 return true; | 911 return true; |
| 912 } | 912 } |
| 913 return false; | 913 return false; |
| 914 } | 914 } |
| 915 | 915 |
| 916 LayoutUnit LayoutFlexibleBox::marginBoxAscentForChild(const LayoutBox& child) | 916 LayoutUnit LayoutFlexibleBox::marginBoxAscentForChild(const LayoutBox& child) |
| 917 { | 917 { |
| 918 LayoutUnit ascent = child.firstLineBoxBaseline(); | 918 LayoutUnit ascent(child.firstLineBoxBaseline()); |
| 919 if (ascent == -1) | 919 if (ascent == -1) |
| 920 ascent = crossAxisExtentForChild(child); | 920 ascent = crossAxisExtentForChild(child); |
| 921 return ascent + flowAwareMarginBeforeForChild(child); | 921 return ascent + flowAwareMarginBeforeForChild(child); |
| 922 } | 922 } |
| 923 | 923 |
| 924 LayoutUnit LayoutFlexibleBox::computeChildMarginValue(Length margin) | 924 LayoutUnit LayoutFlexibleBox::computeChildMarginValue(Length margin) |
| 925 { | 925 { |
| 926 // When resolving the margins, we use the content size for resolving percent
and calc (for percents in calc expressions) margins. | 926 // When resolving the margins, we use the content size for resolving percent
and calc (for percents in calc expressions) margins. |
| 927 // Fortunately, percent margins are always computed with respect to the bloc
k's width, even for margin-top and margin-bottom. | 927 // Fortunately, percent margins are always computed with respect to the bloc
k's width, even for margin-top and margin-bottom. |
| 928 LayoutUnit availableSize = contentLogicalWidth(); | 928 LayoutUnit availableSize = contentLogicalWidth(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 947 } else { | 947 } else { |
| 948 child->setMarginTop(computeChildMarginValue(child->style()->marginTo
p())); | 948 child->setMarginTop(computeChildMarginValue(child->style()->marginTo
p())); |
| 949 child->setMarginBottom(computeChildMarginValue(child->style()->margi
nBottom())); | 949 child->setMarginBottom(computeChildMarginValue(child->style()->margi
nBottom())); |
| 950 } | 950 } |
| 951 } | 951 } |
| 952 } | 952 } |
| 953 | 953 |
| 954 LayoutUnit LayoutFlexibleBox::adjustChildSizeForMinAndMax(const LayoutBox& child
, LayoutUnit childSize) | 954 LayoutUnit LayoutFlexibleBox::adjustChildSizeForMinAndMax(const LayoutBox& child
, LayoutUnit childSize) |
| 955 { | 955 { |
| 956 Length max = isHorizontalFlow() ? child.style()->maxWidth() : child.style()-
>maxHeight(); | 956 Length max = isHorizontalFlow() ? child.style()->maxWidth() : child.style()-
>maxHeight(); |
| 957 LayoutUnit maxExtent = -1; | 957 LayoutUnit maxExtent(-1); |
| 958 if (max.isSpecifiedOrIntrinsic()) { | 958 if (max.isSpecifiedOrIntrinsic()) { |
| 959 maxExtent = computeMainAxisExtentForChild(child, MaxSize, max); | 959 maxExtent = computeMainAxisExtentForChild(child, MaxSize, max); |
| 960 ASSERT(maxExtent >= -1); | 960 ASSERT(maxExtent >= -1); |
| 961 if (maxExtent != -1 && childSize > maxExtent) | 961 if (maxExtent != -1 && childSize > maxExtent) |
| 962 childSize = maxExtent; | 962 childSize = maxExtent; |
| 963 } | 963 } |
| 964 | 964 |
| 965 Length min = isHorizontalFlow() ? child.style()->minWidth() : child.style()-
>minHeight(); | 965 Length min = isHorizontalFlow() ? child.style()->minWidth() : child.style()-
>minHeight(); |
| 966 LayoutUnit minExtent = 0; | 966 LayoutUnit minExtent; |
| 967 if (min.isSpecifiedOrIntrinsic()) { | 967 if (min.isSpecifiedOrIntrinsic()) { |
| 968 minExtent = computeMainAxisExtentForChild(child, MinSize, min); | 968 minExtent = computeMainAxisExtentForChild(child, MinSize, min); |
| 969 // computeMainAxisExtentForChild can return -1 when the child has a perc
entage | 969 // computeMainAxisExtentForChild can return -1 when the child has a perc
entage |
| 970 // min size, but we have an indefinite size in that axis. | 970 // min size, but we have an indefinite size in that axis. |
| 971 minExtent = std::max(LayoutUnit(), minExtent); | 971 minExtent = std::max(LayoutUnit(), minExtent); |
| 972 } else if (min.isAuto() && mainAxisOverflowForChild(child) == OVISIBLE && !(
isColumnFlow() && child.isFlexibleBox())) { | 972 } else if (min.isAuto() && mainAxisOverflowForChild(child) == OVISIBLE && !(
isColumnFlow() && child.isFlexibleBox())) { |
| 973 // TODO(cbiesinger): For now, we do not handle min-height: auto for nest
ed column flexboxes. We need | 973 // TODO(cbiesinger): For now, we do not handle min-height: auto for nest
ed column flexboxes. We need |
| 974 // to implement https://drafts.csswg.org/css-flexbox/#intrinsic-sizes be
fore that produces | 974 // to implement https://drafts.csswg.org/css-flexbox/#intrinsic-sizes be
fore that produces |
| 975 // reasonable results. Tracking bug: https://crbug.com/581553 | 975 // reasonable results. Tracking bug: https://crbug.com/581553 |
| 976 // css-flexbox section 4.5 | 976 // css-flexbox section 4.5 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1016 LayoutUnit minValue = computeMainSizeFromAspectRatioUsing(child, crossMi
n); | 1016 LayoutUnit minValue = computeMainSizeFromAspectRatioUsing(child, crossMi
n); |
| 1017 childSize = std::max(minValue, childSize); | 1017 childSize = std::max(minValue, childSize); |
| 1018 } | 1018 } |
| 1019 | 1019 |
| 1020 return childSize; | 1020 return childSize; |
| 1021 } | 1021 } |
| 1022 | 1022 |
| 1023 bool LayoutFlexibleBox::computeNextFlexLine(OrderedFlexItemList& orderedChildren
, LayoutUnit& sumFlexBaseSize, double& totalFlexGrow, double& totalFlexShrink, d
ouble& totalWeightedFlexShrink, LayoutUnit& sumHypotheticalMainSize, bool relayo
utChildren) | 1023 bool LayoutFlexibleBox::computeNextFlexLine(OrderedFlexItemList& orderedChildren
, LayoutUnit& sumFlexBaseSize, double& totalFlexGrow, double& totalFlexShrink, d
ouble& totalWeightedFlexShrink, LayoutUnit& sumHypotheticalMainSize, bool relayo
utChildren) |
| 1024 { | 1024 { |
| 1025 orderedChildren.clear(); | 1025 orderedChildren.clear(); |
| 1026 sumFlexBaseSize = 0; | 1026 sumFlexBaseSize = LayoutUnit(); |
| 1027 totalFlexGrow = totalFlexShrink = totalWeightedFlexShrink = 0; | 1027 totalFlexGrow = totalFlexShrink = totalWeightedFlexShrink = 0; |
| 1028 sumHypotheticalMainSize = 0; | 1028 sumHypotheticalMainSize = LayoutUnit(); |
| 1029 | 1029 |
| 1030 if (!m_orderIterator.currentChild()) | 1030 if (!m_orderIterator.currentChild()) |
| 1031 return false; | 1031 return false; |
| 1032 | 1032 |
| 1033 LayoutUnit lineBreakLength = mainAxisContentExtent(LayoutUnit::max()); | 1033 LayoutUnit lineBreakLength = mainAxisContentExtent(LayoutUnit::max()); |
| 1034 | 1034 |
| 1035 bool lineHasInFlowItem = false; | 1035 bool lineHasInFlowItem = false; |
| 1036 | 1036 |
| 1037 for (LayoutBox* child = m_orderIterator.currentChild(); child; child = m_ord
erIterator.next()) { | 1037 for (LayoutBox* child = m_orderIterator.currentChild(); child; child = m_ord
erIterator.next()) { |
| 1038 if (child->isOutOfFlowPositioned()) { | 1038 if (child->isOutOfFlowPositioned()) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1085 // now leading to a negative result. See css3/flexbox/large-flex-shrink-
assert.html | 1085 // now leading to a negative result. See css3/flexbox/large-flex-shrink-
assert.html |
| 1086 totalWeightedFlexShrink = std::max(totalWeightedFlexShrink, 0.0); | 1086 totalWeightedFlexShrink = std::max(totalWeightedFlexShrink, 0.0); |
| 1087 inflexibleItems.set(child, childSize); | 1087 inflexibleItems.set(child, childSize); |
| 1088 } | 1088 } |
| 1089 } | 1089 } |
| 1090 | 1090 |
| 1091 // Returns true if we successfully ran the algorithm and sized the flex items. | 1091 // Returns true if we successfully ran the algorithm and sized the flex items. |
| 1092 bool LayoutFlexibleBox::resolveFlexibleLengths(FlexSign flexSign, const OrderedF
lexItemList& children, LayoutUnit availableFreeSpace, LayoutUnit& remainingFreeS
pace, double& totalFlexGrow, double& totalFlexShrink, double& totalWeightedFlexS
hrink, InflexibleFlexItemSize& inflexibleItems, Vector<LayoutUnit, 16>& childSiz
es) | 1092 bool LayoutFlexibleBox::resolveFlexibleLengths(FlexSign flexSign, const OrderedF
lexItemList& children, LayoutUnit availableFreeSpace, LayoutUnit& remainingFreeS
pace, double& totalFlexGrow, double& totalFlexShrink, double& totalWeightedFlexS
hrink, InflexibleFlexItemSize& inflexibleItems, Vector<LayoutUnit, 16>& childSiz
es) |
| 1093 { | 1093 { |
| 1094 childSizes.resize(0); | 1094 childSizes.resize(0); |
| 1095 LayoutUnit totalViolation = 0; | 1095 LayoutUnit totalViolation; |
| 1096 LayoutUnit usedFreeSpace = 0; | 1096 LayoutUnit usedFreeSpace; |
| 1097 Vector<Violation> minViolations; | 1097 Vector<Violation> minViolations; |
| 1098 Vector<Violation> maxViolations; | 1098 Vector<Violation> maxViolations; |
| 1099 | 1099 |
| 1100 double sumFlexFactors = (flexSign == PositiveFlexibility) ? totalFlexGrow :
totalFlexShrink; | 1100 double sumFlexFactors = (flexSign == PositiveFlexibility) ? totalFlexGrow :
totalFlexShrink; |
| 1101 if (sumFlexFactors > 0 && sumFlexFactors < 1) { | 1101 if (sumFlexFactors > 0 && sumFlexFactors < 1) { |
| 1102 LayoutUnit fractional = availableFreeSpace * sumFlexFactors; | 1102 LayoutUnit fractional = availableFreeSpace * sumFlexFactors; |
| 1103 if (fractional.abs() < remainingFreeSpace.abs()) | 1103 if (fractional.abs() < remainingFreeSpace.abs()) |
| 1104 remainingFreeSpace = fractional; | 1104 remainingFreeSpace = fractional; |
| 1105 } | 1105 } |
| 1106 | 1106 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1152 if (justifyContent == ContentPositionFlexEnd) | 1152 if (justifyContent == ContentPositionFlexEnd) |
| 1153 return availableFreeSpace; | 1153 return availableFreeSpace; |
| 1154 if (justifyContent == ContentPositionCenter) | 1154 if (justifyContent == ContentPositionCenter) |
| 1155 return availableFreeSpace / 2; | 1155 return availableFreeSpace / 2; |
| 1156 if (justifyContentDistribution == ContentDistributionSpaceAround) { | 1156 if (justifyContentDistribution == ContentDistributionSpaceAround) { |
| 1157 if (availableFreeSpace > 0 && numberOfChildren) | 1157 if (availableFreeSpace > 0 && numberOfChildren) |
| 1158 return availableFreeSpace / (2 * numberOfChildren); | 1158 return availableFreeSpace / (2 * numberOfChildren); |
| 1159 | 1159 |
| 1160 return availableFreeSpace / 2; | 1160 return availableFreeSpace / 2; |
| 1161 } | 1161 } |
| 1162 return 0; | 1162 return LayoutUnit(); |
| 1163 } | 1163 } |
| 1164 | 1164 |
| 1165 static LayoutUnit justifyContentSpaceBetweenChildren(LayoutUnit availableFreeSpa
ce, ContentDistributionType justifyContentDistribution, unsigned numberOfChildre
n) | 1165 static LayoutUnit justifyContentSpaceBetweenChildren(LayoutUnit availableFreeSpa
ce, ContentDistributionType justifyContentDistribution, unsigned numberOfChildre
n) |
| 1166 { | 1166 { |
| 1167 if (availableFreeSpace > 0 && numberOfChildren > 1) { | 1167 if (availableFreeSpace > 0 && numberOfChildren > 1) { |
| 1168 if (justifyContentDistribution == ContentDistributionSpaceBetween) | 1168 if (justifyContentDistribution == ContentDistributionSpaceBetween) |
| 1169 return availableFreeSpace / (numberOfChildren - 1); | 1169 return availableFreeSpace / (numberOfChildren - 1); |
| 1170 if (justifyContentDistribution == ContentDistributionSpaceAround) | 1170 if (justifyContentDistribution == ContentDistributionSpaceAround) |
| 1171 return availableFreeSpace / numberOfChildren; | 1171 return availableFreeSpace / numberOfChildren; |
| 1172 } | 1172 } |
| 1173 return 0; | 1173 return LayoutUnit(); |
| 1174 } | 1174 } |
| 1175 | 1175 |
| 1176 void LayoutFlexibleBox::setOverrideMainAxisSizeForChild(LayoutBox& child, Layout
Unit childPreferredSize) | 1176 void LayoutFlexibleBox::setOverrideMainAxisSizeForChild(LayoutBox& child, Layout
Unit childPreferredSize) |
| 1177 { | 1177 { |
| 1178 if (hasOrthogonalFlow(child)) | 1178 if (hasOrthogonalFlow(child)) |
| 1179 child.setOverrideLogicalContentHeight(childPreferredSize - child.borderA
ndPaddingLogicalHeight()); | 1179 child.setOverrideLogicalContentHeight(childPreferredSize - child.borderA
ndPaddingLogicalHeight()); |
| 1180 else | 1180 else |
| 1181 child.setOverrideLogicalContentWidth(childPreferredSize - child.borderAn
dPaddingLogicalWidth()); | 1181 child.setOverrideLogicalContentWidth(childPreferredSize - child.borderAn
dPaddingLogicalWidth()); |
| 1182 } | 1182 } |
| 1183 | 1183 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1226 } | 1226 } |
| 1227 return count; | 1227 return count; |
| 1228 } | 1228 } |
| 1229 | 1229 |
| 1230 void LayoutFlexibleBox::resetAutoMarginsAndLogicalTopInCrossAxis(LayoutBox& chil
d) | 1230 void LayoutFlexibleBox::resetAutoMarginsAndLogicalTopInCrossAxis(LayoutBox& chil
d) |
| 1231 { | 1231 { |
| 1232 if (hasAutoMarginsInCrossAxis(child)) { | 1232 if (hasAutoMarginsInCrossAxis(child)) { |
| 1233 child.updateLogicalHeight(); | 1233 child.updateLogicalHeight(); |
| 1234 if (isHorizontalFlow()) { | 1234 if (isHorizontalFlow()) { |
| 1235 if (child.style()->marginTop().isAuto()) | 1235 if (child.style()->marginTop().isAuto()) |
| 1236 child.setMarginTop(0); | 1236 child.setMarginTop(LayoutUnit()); |
| 1237 if (child.style()->marginBottom().isAuto()) | 1237 if (child.style()->marginBottom().isAuto()) |
| 1238 child.setMarginBottom(0); | 1238 child.setMarginBottom(LayoutUnit()); |
| 1239 } else { | 1239 } else { |
| 1240 if (child.style()->marginLeft().isAuto()) | 1240 if (child.style()->marginLeft().isAuto()) |
| 1241 child.setMarginLeft(0); | 1241 child.setMarginLeft(LayoutUnit()); |
| 1242 if (child.style()->marginRight().isAuto()) | 1242 if (child.style()->marginRight().isAuto()) |
| 1243 child.setMarginRight(0); | 1243 child.setMarginRight(LayoutUnit()); |
| 1244 } | 1244 } |
| 1245 } | 1245 } |
| 1246 } | 1246 } |
| 1247 | 1247 |
| 1248 bool LayoutFlexibleBox::needToStretchChildLogicalHeight(const LayoutBox& child)
const | 1248 bool LayoutFlexibleBox::needToStretchChildLogicalHeight(const LayoutBox& child)
const |
| 1249 { | 1249 { |
| 1250 // This function is a little bit magical. It relies on the fact that blocks
intrinsically | 1250 // This function is a little bit magical. It relies on the fact that blocks
intrinsically |
| 1251 // "stretch" themselves in their inline axis, i.e. a <div> has an implicit w
idth: 100%. | 1251 // "stretch" themselves in their inline axis, i.e. a <div> has an implicit w
idth: 100%. |
| 1252 // So the child will automatically stretch if our cross axis is the child's
inline axis. That's the case if: | 1252 // So the child will automatically stretch if our cross axis is the child's
inline axis. That's the case if: |
| 1253 // - We are horizontal and the child is in vertical writing mode | 1253 // - We are horizontal and the child is in vertical writing mode |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1295 ASSERT(childSizes.size() == children.size()); | 1295 ASSERT(childSizes.size() == children.size()); |
| 1296 | 1296 |
| 1297 size_t numberOfChildrenForJustifyContent = numberOfInFlowPositionedChildren(
children); | 1297 size_t numberOfChildrenForJustifyContent = numberOfInFlowPositionedChildren(
children); |
| 1298 LayoutUnit autoMarginOffset = autoMarginOffsetInMainAxis(children, available
FreeSpace); | 1298 LayoutUnit autoMarginOffset = autoMarginOffsetInMainAxis(children, available
FreeSpace); |
| 1299 LayoutUnit mainAxisOffset = flowAwareBorderStart() + flowAwarePaddingStart()
; | 1299 LayoutUnit mainAxisOffset = flowAwareBorderStart() + flowAwarePaddingStart()
; |
| 1300 mainAxisOffset += initialJustifyContentOffset(availableFreeSpace, style()->j
ustifyContentPosition(), style()->justifyContentDistribution(), numberOfChildren
ForJustifyContent); | 1300 mainAxisOffset += initialJustifyContentOffset(availableFreeSpace, style()->j
ustifyContentPosition(), style()->justifyContentDistribution(), numberOfChildren
ForJustifyContent); |
| 1301 if (style()->flexDirection() == FlowRowReverse) | 1301 if (style()->flexDirection() == FlowRowReverse) |
| 1302 mainAxisOffset += isHorizontalFlow() ? verticalScrollbarWidth() : horizo
ntalScrollbarHeight(); | 1302 mainAxisOffset += isHorizontalFlow() ? verticalScrollbarWidth() : horizo
ntalScrollbarHeight(); |
| 1303 | 1303 |
| 1304 LayoutUnit totalMainExtent = mainAxisExtent(); | 1304 LayoutUnit totalMainExtent = mainAxisExtent(); |
| 1305 LayoutUnit maxAscent = 0, maxDescent = 0; // Used when align-items: baseline
. | 1305 LayoutUnit maxAscent, maxDescent; // Used when align-items: baseline. |
| 1306 LayoutUnit maxChildCrossAxisExtent = 0; | 1306 LayoutUnit maxChildCrossAxisExtent; |
| 1307 size_t seenInFlowPositionedChildren = 0; | 1307 size_t seenInFlowPositionedChildren = 0; |
| 1308 bool shouldFlipMainAxis = !isColumnFlow() && !isLeftToRightFlow(); | 1308 bool shouldFlipMainAxis = !isColumnFlow() && !isLeftToRightFlow(); |
| 1309 for (size_t i = 0; i < children.size(); ++i) { | 1309 for (size_t i = 0; i < children.size(); ++i) { |
| 1310 LayoutBox* child = children[i]; | 1310 LayoutBox* child = children[i]; |
| 1311 | 1311 |
| 1312 if (child->isOutOfFlowPositioned()) { | 1312 if (child->isOutOfFlowPositioned()) { |
| 1313 prepareChildForPositionedLayout(*child, mainAxisOffset, crossAxisOff
set, FlipForRowReverse); | 1313 prepareChildForPositionedLayout(*child, mainAxisOffset, crossAxisOff
set, FlipForRowReverse); |
| 1314 continue; | 1314 continue; |
| 1315 } | 1315 } |
| 1316 | 1316 |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1629 ASSERT(child); | 1629 ASSERT(child); |
| 1630 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE
xtent; | 1630 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE
xtent; |
| 1631 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset
- crossAxisStartEdge; | 1631 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset
- crossAxisStartEdge; |
| 1632 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi
sExtent; | 1632 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi
sExtent; |
| 1633 adjustAlignmentForChild(*child, newOffset - originalOffset); | 1633 adjustAlignmentForChild(*child, newOffset - originalOffset); |
| 1634 } | 1634 } |
| 1635 } | 1635 } |
| 1636 } | 1636 } |
| 1637 | 1637 |
| 1638 } // namespace blink | 1638 } // namespace blink |
| OLD | NEW |