sync iframe and object frame MEW with their reported widths, bug 263050 r/sr=dbaron

This commit is contained in:
bmlk%gmx.de 2004-12-11 12:31:39 +00:00
Родитель 9d2a6e9e3c
Коммит ccc66b8940
1 изменённых файлов: 27 добавлений и 13 удалений

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

@ -302,17 +302,17 @@ nsSubDocumentFrame::GetDesiredSize(nsPresContext* aPresContext,
aDesiredSize.width = aReflowState.mComputedWidth; aDesiredSize.width = aReflowState.mComputedWidth;
} }
else { else {
aDesiredSize.width = PR_MIN(PR_MAX(NSIntPixelsToTwips(300, p2t), aDesiredSize.width = PR_MAX(PR_MIN(NSIntPixelsToTwips(300, p2t),
aReflowState.mComputedMinWidth), aReflowState.mComputedMaxWidth),
aReflowState.mComputedMaxWidth); aReflowState.mComputedMinWidth);
} }
if (NS_UNCONSTRAINEDSIZE != aReflowState.mComputedHeight) { if (NS_UNCONSTRAINEDSIZE != aReflowState.mComputedHeight) {
aDesiredSize.height = aReflowState.mComputedHeight; aDesiredSize.height = aReflowState.mComputedHeight;
} }
else { else {
aDesiredSize.height = PR_MIN(PR_MAX(NSIntPixelsToTwips(150, p2t), aDesiredSize.height = PR_MAX(PR_MIN(NSIntPixelsToTwips(150, p2t),
aReflowState.mComputedMinHeight), aReflowState.mComputedMaxHeight),
aReflowState.mComputedMaxHeight); aReflowState.mComputedMinHeight);
} }
aDesiredSize.ascent = aDesiredSize.height; aDesiredSize.ascent = aDesiredSize.height;
aDesiredSize.descent = 0; aDesiredSize.descent = 0;
@ -370,16 +370,30 @@ nsSubDocumentFrame::Reflow(nsPresContext* aPresContext,
vm->ResizeView(mInnerView, nsRect(0, 0, innerSize.width, innerSize.height), PR_TRUE); vm->ResizeView(mInnerView, nsRect(0, 0, innerSize.width, innerSize.height), PR_TRUE);
} }
if (aDesiredSize.mComputeMEW) { if (aDesiredSize.mComputeMEW) {
// If our width is set by style to some fixed length, nscoord defaultAutoWidth = NSIntPixelsToTwips(300, aPresContext->ScaledPixelsToTwips());
// then our actual width is our minimum width if (mContent->IsContentOfType(nsIContent::eXUL)) {
// XUL frames don't have a default 300px width
defaultAutoWidth = 0;
}
nsStyleUnit widthUnit = GetStylePosition()->mWidth.GetUnit(); nsStyleUnit widthUnit = GetStylePosition()->mWidth.GetUnit();
if (widthUnit != eStyleUnit_Percent && widthUnit != eStyleUnit_Auto) { switch (widthUnit) {
aDesiredSize.mMaxElementWidth = aDesiredSize.width; case eStyleUnit_Percent:
} else { // if our width is percentage, then we can shrink until
// if our width is auto or a percentage, then we can shrink until
// there's nothing left but our borders // there's nothing left but our borders
aDesiredSize.mMaxElementWidth = border.left + border.right; aDesiredSize.mMaxElementWidth = border.left + border.right;
break;
case eStyleUnit_Auto:
aDesiredSize.mMaxElementWidth = PR_MAX(PR_MIN(defaultAutoWidth,
aReflowState.mComputedMaxWidth),
aReflowState.mComputedMinWidth) +
border.left + border.right;
break;
default:
// If our width is set by style to some fixed length,
// then our actual width is our minimum width
aDesiredSize.mMaxElementWidth = aDesiredSize.width;
break;
} }
} }