Fix nsLayoutUtils::ComputeSizeWithIntrinsicDimensions to produce correct results when one of the tentative height/width (i.e., the intrinsic height/width) is 0. (Bug 677091) r=roc

When either the intrinsic width or the intrinsic height is 0, the
element does not have an intrinsic ratio, and thus the table that
ComputeAutoSizeWithIntrinsicDimensions is implementing technically
doesn't apply.  However, it can quite straightforwardly produce the
correct results despite that, if we correctly apply the
min/max-width/height properties.
This commit is contained in:
L. David Baron 2011-08-17 17:54:59 -07:00
Родитель f96aaa3b4e
Коммит ef98f8f848
1 изменённых файлов: 2 добавлений и 4 удалений

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

@ -2762,8 +2762,7 @@ nsLayoutUtils::ComputeAutoSizeWithIntrinsicDimensions(nscoord minWidth, nscoord
if (heightAtMinWidth > maxHeight) if (heightAtMinWidth > maxHeight)
heightAtMinWidth = maxHeight; heightAtMinWidth = maxHeight;
} else { } else {
heightAtMaxWidth = tentHeight; heightAtMaxWidth = heightAtMinWidth = NS_CSS_MINMAX(tentHeight, minHeight, maxHeight);
heightAtMinWidth = tentHeight;
} }
if (tentHeight > 0) { if (tentHeight > 0) {
@ -2774,8 +2773,7 @@ nsLayoutUtils::ComputeAutoSizeWithIntrinsicDimensions(nscoord minWidth, nscoord
if (widthAtMinHeight > maxWidth) if (widthAtMinHeight > maxWidth)
widthAtMinHeight = maxWidth; widthAtMinHeight = maxWidth;
} else { } else {
widthAtMaxHeight = tentWidth; widthAtMaxHeight = widthAtMinHeight = NS_CSS_MINMAX(tentWidth, minWidth, maxWidth);
widthAtMinHeight = tentWidth;
} }
// The table at http://www.w3.org/TR/CSS21/visudet.html#min-max-widths : // The table at http://www.w3.org/TR/CSS21/visudet.html#min-max-widths :