Index: Source/core/rendering/RenderFlexibleBox.cpp |
diff --git a/Source/core/rendering/RenderFlexibleBox.cpp b/Source/core/rendering/RenderFlexibleBox.cpp |
index 7cb1c671c53bc8417cfb52b5fdccc2f719bf66aa..4592f81f3a90d3dcb1afda201ee024b8d38d3ba8 100644 |
--- a/Source/core/rendering/RenderFlexibleBox.cpp |
+++ b/Source/core/rendering/RenderFlexibleBox.cpp |
@@ -214,6 +214,7 @@ void RenderFlexibleBox::styleDidChange(StyleDifference diff, const RenderStyle* |
// Flex items that were previously stretching need to be relayed out so we can compute new available cross axis space. |
// This is only necessary for stretching since other alignment values don't change the size of the box. |
for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) { |
+ child->clearOverrideSize(); |
cbiesinger
2014/08/29 00:28:09
Hmm, so we do need to do this in this case, but we
harpreet.sk
2014/09/01 08:10:59
Sorry Chris we do not required clearOverrideSize h
|
ItemPosition previousAlignment = resolveAlignment(oldStyle, child->style()); |
if (previousAlignment == ItemPositionStretch && previousAlignment != resolveAlignment(style(), child->style())) |
child->setChildNeedsLayout(MarkOnlyThis); |
@@ -611,7 +612,7 @@ bool RenderFlexibleBox::childPreferredMainAxisContentExtentRequiresLayout(Render |
LayoutUnit RenderFlexibleBox::preferredMainAxisContentExtentForChild(RenderBox* child, bool hasInfiniteLineLength, bool relayoutChildren) |
{ |
- child->clearOverrideSize(); |
+ clearLogicalOverrideSize(child); |
if (child->style()->hasAspectRatio() || child->isImage() || child->isVideo() || child->isCanvas()) |
UseCounter::count(document(), UseCounter::AspectRatioFlexItem); |
@@ -993,6 +994,14 @@ void RenderFlexibleBox::setLogicalOverrideSize(RenderBox* child, LayoutUnit chil |
child->setOverrideLogicalContentWidth(childPreferredSize - child->borderAndPaddingLogicalWidth()); |
} |
+void RenderFlexibleBox::clearLogicalOverrideSize(RenderBox* child) |
+{ |
+ if (hasOrthogonalFlow(child)) |
+ child->clearOverrideLogicalContentHeight(); |
+ else |
+ child->clearOverrideLogicalContentWidth(); |
+} |
+ |
void RenderFlexibleBox::prepareChildForPositionedLayout(RenderBox* child, LayoutUnit mainAxisOffset, LayoutUnit crossAxisOffset, PositionedLayoutMode layoutMode) |
{ |
ASSERT(child->isOutOfFlowPositioned()); |
@@ -1353,10 +1362,10 @@ void RenderFlexibleBox::applyStretchAlignmentToChild(RenderBox* child, LayoutUni |
LayoutUnit stretchedLogicalHeight = heightBeforeStretching + availableAlignmentSpaceForChildBeforeStretching(lineCrossAxisExtent, child); |
ASSERT(!child->needsLayout()); |
LayoutUnit desiredLogicalHeight = child->constrainLogicalHeightByMinMax(stretchedLogicalHeight, heightBeforeStretching - child->borderAndPaddingLogicalHeight()); |
+ child->setOverrideLogicalContentHeight(desiredLogicalHeight - child->borderAndPaddingLogicalHeight()); |
// FIXME: Can avoid laying out here in some cases. See https://webkit.org/b/87905. |
if (desiredLogicalHeight != child->logicalHeight()) { |
- child->setOverrideLogicalContentHeight(desiredLogicalHeight - child->borderAndPaddingLogicalHeight()); |
child->setLogicalHeight(0); |
child->forceChildLayout(); |
} |