Chromium Code Reviews| Index: third_party/WebKit/Source/core/layout/LayoutReplaced.cpp |
| diff --git a/third_party/WebKit/Source/core/layout/LayoutReplaced.cpp b/third_party/WebKit/Source/core/layout/LayoutReplaced.cpp |
| index bd27c594a47772ee24036d0e686671722edca626..a080e31cce3950ed7ee2f907244345ac7875f93f 100644 |
| --- a/third_party/WebKit/Source/core/layout/LayoutReplaced.cpp |
| +++ b/third_party/WebKit/Source/core/layout/LayoutReplaced.cpp |
| @@ -564,7 +564,7 @@ LayoutUnit LayoutReplaced::computeReplacedLogicalWidth(ShouldComputePreferred sh |
| FloatSize constrainedSize = constrainIntrinsicSizeToMinMax(intrinsicSizingInfo); |
| if (style()->logicalWidth().isAuto()) { |
| - bool computedHeightIsAuto = hasAutoHeightOrContainingBlockWithAutoHeight(); |
| + bool computedHeightIsAuto = style()->logicalHeight().isAuto(); |
| // If 'height' and 'width' both have computed values of 'auto' and the element also has an intrinsic width, then that intrinsic width is the used value of 'width'. |
| if (computedHeightIsAuto && intrinsicSizingInfo.hasWidth) |
| @@ -575,8 +575,10 @@ LayoutUnit LayoutReplaced::computeReplacedLogicalWidth(ShouldComputePreferred sh |
| // or if 'width' has a computed value of 'auto', 'height' has some other computed value, and the element does have an intrinsic ratio; then the used value |
| // of 'width' is: (used height) * (intrinsic ratio) |
| if ((computedHeightIsAuto && !intrinsicSizingInfo.hasWidth && intrinsicSizingInfo.hasHeight) || !computedHeightIsAuto) { |
| - LayoutUnit logicalHeight = computeReplacedLogicalHeight(); |
| - return computeReplacedLogicalWidthRespectingMinMaxWidth(resolveWidthForRatio(logicalHeight, intrinsicSizingInfo.aspectRatio), shouldComputePreferred); |
| + LayoutUnit estimatedUsedWidth = intrinsicSizingInfo.hasWidth ? LayoutUnit(constrainedSize.width()) : containingBlock()->availableLogicalWidth(); |
| + LayoutUnit logicalHeight = computeReplacedLogicalHeight(estimatedUsedWidth); |
| + LayoutUnit width = computeReplacedLogicalWidthRespectingMinMaxWidth(resolveWidthForRatio(logicalHeight, intrinsicSizingInfo.aspectRatio), shouldComputePreferred); |
| + return width; |
|
cbiesinger
2016/04/15 21:44:39
I would merge this line with the previous one and
|
| } |
| // If 'height' and 'width' both have computed values of 'auto' and the element has an intrinsic ratio but no intrinsic height or width, then the used value of |
| @@ -611,7 +613,7 @@ LayoutUnit LayoutReplaced::computeReplacedLogicalWidth(ShouldComputePreferred sh |
| return computeReplacedLogicalWidthRespectingMinMaxWidth(intrinsicLogicalWidth(), shouldComputePreferred); |
| } |
| -LayoutUnit LayoutReplaced::computeReplacedLogicalHeight() const |
| +LayoutUnit LayoutReplaced::computeReplacedLogicalHeight(LayoutUnit estimatedUsedWidth) const |
| { |
| // 10.5 Content height: the 'height' property: http://www.w3.org/TR/CSS21/visudet.html#propdef-height |
| if (hasReplacedLogicalHeight()) |
| @@ -632,8 +634,10 @@ LayoutUnit LayoutReplaced::computeReplacedLogicalHeight() const |
| // Otherwise, if 'height' has a computed value of 'auto', and the element has an intrinsic ratio then the used value of 'height' is: |
| // (used width) / (intrinsic ratio) |
| - if (!intrinsicSizingInfo.aspectRatio.isEmpty()) |
| - return computeReplacedLogicalHeightRespectingMinMaxHeight(resolveHeightForRatio(availableLogicalWidth(), intrinsicSizingInfo.aspectRatio)); |
| + if (!intrinsicSizingInfo.aspectRatio.isEmpty()) { |
| + LayoutUnit usedWidth = estimatedUsedWidth ? estimatedUsedWidth : availableLogicalWidth(); |
| + return computeReplacedLogicalHeightRespectingMinMaxHeight(resolveHeightForRatio(usedWidth, intrinsicSizingInfo.aspectRatio)); |
| + } |
| // Otherwise, if 'height' has a computed value of 'auto', and the element has an intrinsic height, then that intrinsic height is the used value of 'height'. |
| if (intrinsicSizingInfo.hasHeight) |