| Index: Source/core/rendering/RenderFlexibleBox.cpp
|
| diff --git a/Source/core/rendering/RenderFlexibleBox.cpp b/Source/core/rendering/RenderFlexibleBox.cpp
|
| index 8e0730e60799e36f1102860555d8a7070e7d0047..3183dc57f9895d939355e0ce21808d60d2ad1fbc 100644
|
| --- a/Source/core/rendering/RenderFlexibleBox.cpp
|
| +++ b/Source/core/rendering/RenderFlexibleBox.cpp
|
| @@ -608,11 +608,45 @@ bool RenderFlexibleBox::childPreferredMainAxisContentExtentRequiresLayout(Render
|
| return preferredMainAxisExtentDependsOnLayout(flexBasisForChild(child), hasInfiniteLineLength) && hasOrthogonalFlow(child);
|
| }
|
|
|
| +bool RenderFlexibleBox::childHasFiniteCrossSize(RenderBox* child) const
|
| +{
|
| + if (child->style()->logicalHeight().isFixed())
|
| + return true;
|
| +
|
| + if (!style()->logicalHeight().isFixed())
|
| + return false;
|
| +
|
| + if (child->style()->logicalHeight().isPercent())
|
| + return true;
|
| +
|
| + if (!isMultiline() && needToStretchChildLogicalHeight(child))
|
| + return true;
|
| +
|
| + return false;
|
| +}
|
| +
|
| +void RenderFlexibleBox::computeAspectRatioOfChild(RenderBox* child, double& aspectRatio)
|
| +{
|
| + if (child->style()->hasAspectRatio())
|
| + aspectRatio = child->style()->aspectRatio();
|
| + else if (child->hasAspectRatio() && child->intrinsicLogicalHeight())
|
| + aspectRatio = child->intrinsicLogicalWidth().rawValue() / child->intrinsicLogicalHeight().rawValue();
|
| +}
|
| +
|
| LayoutUnit RenderFlexibleBox::preferredMainAxisContentExtentForChild(RenderBox* child, bool hasInfiniteLineLength, bool relayoutChildren)
|
| {
|
| child->clearOverrideSize();
|
|
|
| Length flexBasis = flexBasisForChild(child);
|
| + double aspectRatio = -1.0;
|
| + computeAspectRatioOfChild(child, aspectRatio);
|
| +
|
| + if (aspectRatio >= 0 && flexBasis.isAuto() && childHasFiniteCrossSize(child)) {
|
| + if (!isMultiline() && needToStretchChildLogicalHeight(child))
|
| + return aspectRatio * style()->logicalHeight().value();
|
| + return aspectRatio * crossAxisIntrinsicExtentForChild(child);
|
| + }
|
| +
|
| if (preferredMainAxisExtentDependsOnLayout(flexBasis, hasInfiniteLineLength)) {
|
| LayoutUnit mainAxisExtent;
|
| if (hasOrthogonalFlow(child)) {
|
|
|