Index: Source/core/layout/LayoutFlexibleBox.cpp |
diff --git a/Source/core/layout/LayoutFlexibleBox.cpp b/Source/core/layout/LayoutFlexibleBox.cpp |
index c7212bed4904545c273a0aafc5ccc0924b489b38..11500b2cf3d367ed75b1e92a76c377fe4a62f32b 100644 |
--- a/Source/core/layout/LayoutFlexibleBox.cpp |
+++ b/Source/core/layout/LayoutFlexibleBox.cpp |
@@ -834,7 +834,7 @@ void LayoutFlexibleBox::prepareOrderIteratorAndMargins() |
} |
} |
-LayoutUnit LayoutFlexibleBox::adjustChildSizeForMinAndMax(LayoutBox& child, LayoutUnit childSize) |
+LayoutUnit LayoutFlexibleBox::adjustChildSizeForMinAndMax(LayoutBox& child, LayoutUnit childSize, bool childShrunk) |
{ |
Length max = isHorizontalFlow() ? child.style()->maxWidth() : child.style()->maxHeight(); |
LayoutUnit maxExtent = -1; |
@@ -851,7 +851,7 @@ LayoutUnit LayoutFlexibleBox::adjustChildSizeForMinAndMax(LayoutBox& child, Layo |
// computeMainAxisExtentForChild can return -1 when the child has a percentage |
// min size, but we have an indefinite size in that axis. |
minExtent = std::max(LayoutUnit(), minExtent); |
- } else if (min.isAuto() && mainAxisOverflowForChild(child) == OVISIBLE) { |
+ } else if (childShrunk && min.isAuto() && mainAxisOverflowForChild(child) == OVISIBLE) { |
// css-flexbox section 4.5 |
LayoutUnit contentSize = computeMainAxisExtentForChild(child, MinSize, Length(MinContent)); |
ASSERT(contentSize >= 0); |
@@ -905,7 +905,7 @@ bool LayoutFlexibleBox::computeNextFlexLine(OrderedFlexItemList& orderedChildren |
+ (isHorizontalFlow() ? child->marginWidth() : child->marginHeight()); |
LayoutUnit childFlexBaseSize = childMainAxisExtent + childMainAxisMarginBorderPadding; |
- LayoutUnit childMinMaxAppliedMainAxisExtent = adjustChildSizeForMinAndMax(*child, childMainAxisExtent); |
+ LayoutUnit childMinMaxAppliedMainAxisExtent = adjustChildSizeForMinAndMax(*child, childMainAxisExtent, false); |
leviw_travelin_and_unemployed
2015/04/17 19:17:40
Maybe make the parameter default to false to avoid
cbiesinger
2015/04/17 19:39:25
Done.
|
LayoutUnit childHypotheticalMainSize = childMinMaxAppliedMainAxisExtent + childMainAxisMarginBorderPadding; |
if (isMultiline() && sumHypotheticalMainSize + childHypotheticalMainSize > lineBreakLength && lineHasInFlowItem) |
@@ -954,14 +954,17 @@ bool LayoutFlexibleBox::resolveFlexibleLengths(FlexSign flexSign, const OrderedF |
LayoutUnit preferredChildSize = preferredMainAxisContentExtentForChild(*child); |
LayoutUnit childSize = preferredChildSize; |
double extraSpace = 0; |
- if (availableFreeSpace > 0 && totalFlexGrow > 0 && flexSign == PositiveFlexibility && std::isfinite(totalFlexGrow)) |
+ bool childShrunk = false; |
+ if (availableFreeSpace > 0 && totalFlexGrow > 0 && flexSign == PositiveFlexibility && std::isfinite(totalFlexGrow)) { |
extraSpace = availableFreeSpace * child->style()->flexGrow() / totalFlexGrow; |
- else if (availableFreeSpace < 0 && totalWeightedFlexShrink > 0 && flexSign == NegativeFlexibility && std::isfinite(totalWeightedFlexShrink)) |
+ } else if (availableFreeSpace < 0 && totalWeightedFlexShrink > 0 && flexSign == NegativeFlexibility && std::isfinite(totalWeightedFlexShrink) && child->style()->flexShrink()) { |
extraSpace = availableFreeSpace * child->style()->flexShrink() * preferredChildSize / totalWeightedFlexShrink; |
+ childShrunk = true; |
+ } |
if (std::isfinite(extraSpace)) |
childSize += LayoutUnit::fromFloatRound(extraSpace); |
- LayoutUnit adjustedChildSize = adjustChildSizeForMinAndMax(*child, childSize); |
+ LayoutUnit adjustedChildSize = adjustChildSizeForMinAndMax(*child, childSize, childShrunk); |
ASSERT(adjustedChildSize >= 0); |
childSizes.append(adjustedChildSize); |
usedFreeSpace += adjustedChildSize - preferredChildSize; |