Bug 1315383 part 3 - [css-grid] Don't try to preserve intrinsic ratio when applying min/max-size, if either axis has 'stretch' alignment. r=dholbert

This commit is contained in:
Mats Palmgren 2016-11-11 18:28:43 +01:00
Родитель 945854bec6
Коммит 24c2d68059
1 изменённых файлов: 7 добавлений и 5 удалений

Просмотреть файл

@ -5224,7 +5224,13 @@ nsFrame::ComputeSizeWithIntrinsicDimensions(nsRenderingContext* aRenderingConte
tentISize = NSCoordMulDiv(bSize, logicalRatio.ISize(aWM), logicalRatio.BSize(aWM));
}
}
}
// ComputeAutoSizeWithIntrinsicDimensions preserves the ratio when applying
// the min/max-size. We don't want that when we have 'stretch' in either
// axis because tentISize/tentBSize is likely not according to ratio now.
if (aIntrinsicRatio != nsSize(0, 0) &&
stretchI != eStretch && stretchB != eStretch) {
nsSize autoSize = nsLayoutUtils::
ComputeAutoSizeWithIntrinsicDimensions(minISize, minBSize,
maxISize, maxBSize,
@ -5236,11 +5242,7 @@ nsFrame::ComputeSizeWithIntrinsicDimensions(nsRenderingContext* aRenderingConte
iSize = autoSize.width;
bSize = autoSize.height;
} else {
// No intrinsic ratio, so just clamp the dimensions
// independently without calling
// ComputeAutoSizeWithIntrinsicDimensions, which deals with
// propagating these changes to the other dimension (and would
// be incorrect when there is no intrinsic ratio).
// Not honoring an intrinsic ratio: clamp the dimensions independently.
iSize = NS_CSS_MINMAX(tentISize, minISize, maxISize);
bSize = NS_CSS_MINMAX(tentBSize, minBSize, maxBSize);
}