Index: third_party/WebKit/Source/core/layout/LayoutBox.cpp |
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp |
index 19a44fa575637f77d5753f2562537344ed6d13fc..da53872bc0c0a9b81783204198ccd074f3ac90de 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp |
@@ -2124,18 +2124,19 @@ void LayoutBox::computeLogicalWidth(LogicalExtentComputedValues& computedValues) |
return; |
} |
+ LayoutUnit containerWidthInInlineDirection = containerLogicalWidth; |
+ if (hasPerpendicularContainingBlock) |
+ containerWidthInInlineDirection = perpendicularContainingBlockLogicalHeight(); |
+ |
// Width calculations |
if (treatAsReplaced) { |
computedValues.m_extent = LayoutUnit(logicalWidthLength.value()) + borderAndPaddingLogicalWidth(); |
- } else if (parent()->isLayoutGrid() && style()->logicalWidth().isAuto() && style()->logicalMinWidth().isAuto() && style()->overflowX() == OverflowVisible && containerLogicalWidth < minPreferredLogicalWidth()) { |
+ } else if (parent()->isLayoutGrid() && style()->logicalWidth().isAuto() && style()->logicalMinWidth().isAuto() && style()->overflowX() == OverflowVisible && containerWidthInInlineDirection < minPreferredLogicalWidth()) { |
// TODO (lajava) Move this logic to the LayoutGrid class. |
// Implied minimum size of Grid items. |
- computedValues.m_extent = constrainLogicalWidthByMinMax(minPreferredLogicalWidth(), containerLogicalWidth, cb); |
+ computedValues.m_extent = constrainLogicalWidthByMinMax(minPreferredLogicalWidth(), containerWidthInInlineDirection, cb); |
} else { |
- LayoutUnit containerWidthInInlineDirection = containerLogicalWidth; |
- if (hasPerpendicularContainingBlock) { |
- containerWidthInInlineDirection = perpendicularContainingBlockLogicalHeight(); |
- } else if (cb->isFlexItem() && styleToUse.logicalWidth().hasPercent() && !isOutOfFlowPositioned()) { |
+ if (!hasPerpendicularContainingBlock && cb->isFlexItem() && styleToUse.logicalWidth().hasPercent() && !isOutOfFlowPositioned()) { |
LayoutUnit stretchedWidth = toLayoutFlexibleBox(cb->parent())->childLogicalWidthForPercentageResolution(*cb); |
if (stretchedWidth != LayoutUnit(-1)) |
containerWidthInInlineDirection = stretchedWidth; |