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 3bc1709ebb82d41630deda811a4c8265d7b1c927..3bf7f7951f552ceacaea3ff16054446c49f49cdc 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp |
@@ -2099,8 +2099,13 @@ void LayoutBox::computeLogicalWidth(LogicalExtentComputedValues& computedValues) |
computedValues.m_extent = constrainLogicalWidthByMinMax(minPreferredLogicalWidth(), containerLogicalWidth, cb); |
} else { |
LayoutUnit containerWidthInInlineDirection = containerLogicalWidth; |
- if (hasPerpendicularContainingBlock) |
+ if (hasPerpendicularContainingBlock) { |
containerWidthInInlineDirection = perpendicularContainingBlockLogicalHeight(); |
+ } else if (cb->isFlexItem() && styleToUse.logicalWidth().hasPercent() && !isOutOfFlowPositioned()) { |
+ LayoutUnit stretchedWidth = toLayoutFlexibleBox(cb->parent())->childLogicalWidthForPercentageResolution(*cb); |
+ if (stretchedWidth != LayoutUnit(-1)) |
+ containerWidthInInlineDirection = stretchedWidth; |
+ } |
LayoutUnit preferredWidth = computeLogicalWidthUsing(MainOrPreferredSize, styleToUse.logicalWidth(), containerWidthInInlineDirection, cb); |
computedValues.m_extent = constrainLogicalWidthByMinMax(preferredWidth, containerWidthInInlineDirection, cb); |
} |
@@ -2600,8 +2605,14 @@ LayoutUnit LayoutBox::computePercentageLogicalHeight(const Length& height) const |
bool includeBorderPadding = isTable(); |
+ LayoutUnit stretchedFlexHeight(-1); |
+ if (cb->isFlexItem()) |
+ stretchedFlexHeight = toLayoutFlexibleBox(cb->parent())->childLogicalHeightForPercentageResolution(*cb); |
+ |
if (isHorizontalWritingMode() != cb->isHorizontalWritingMode()) { |
availableHeight = containingBlockChild->containingBlockLogicalWidthForContent(); |
+ } else if (stretchedFlexHeight != LayoutUnit(-1)) { |
+ availableHeight = stretchedFlexHeight; |
} else if (hasOverrideContainingBlockLogicalHeight()) { |
availableHeight = overrideContainingBlockContentLogicalHeight(); |
} else if (cb->isTableCell()) { |