Removed duplicate adjustment of the width/height; only use max-size-width if width is unconstrained AND it's a top-level body

This commit is contained in:
kipp%netscape.com 1998-09-29 22:33:47 +00:00
Родитель 4613e22c4b
Коммит 37a0848e7a
1 изменённых файлов: 3 добавлений и 12 удалений

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

@ -34,7 +34,6 @@
#include "nsHTMLIIDs.h" #include "nsHTMLIIDs.h"
#include "nsIWebShell.h" #include "nsIWebShell.h"
#include "nsHTMLValue.h" #include "nsHTMLValue.h"
//#include "nsHTMLTagContent.h"
#include "nsHTMLParts.h" #include "nsHTMLParts.h"
#include "nsCSSLayout.h" #include "nsCSSLayout.h"
@ -527,29 +526,21 @@ nsBodyFrame::ComputeDesiredSize(nsIPresContext& aPresContext,
// Apply style size if present; XXX note the inner value (style-size - // Apply style size if present; XXX note the inner value (style-size -
// border+padding) should be given to the child as a max-size // border+padding) should be given to the child as a max-size
nsSize styleSize; nsSize styleSize;
PRIntn ss = nsCSSLayout::GetStyleSize(&aPresContext, aReflowState, styleSize); PRIntn ss =
nsCSSLayout::GetStyleSize(&aPresContext, aReflowState, styleSize);
if (NS_SIZE_HAS_WIDTH & ss) { if (NS_SIZE_HAS_WIDTH & ss) {
width = styleSize.width + aBorderPadding.left + aBorderPadding.right; width = styleSize.width + aBorderPadding.left + aBorderPadding.right;
} }
else { else {
if (mIsTopLevel) { if (mIsTopLevel && (NS_UNCONSTRAINEDSIZE != aMaxSize.width)) {
// Make sure we're at least as wide as our available width // Make sure we're at least as wide as our available width
width = PR_MAX(aMetrics.width, aMaxSize.width); width = PR_MAX(aMetrics.width, aMaxSize.width);
} }
} }
if (NS_SIZE_HAS_HEIGHT & ss) { if (NS_SIZE_HAS_HEIGHT & ss) {
height = styleSize.width + aBorderPadding.top + aBorderPadding.bottom; height = styleSize.width + aBorderPadding.top + aBorderPadding.bottom;
} }
else { else {
if (mIsTopLevel) {
height += aBorderPadding.top + aBorderPadding.bottom;
}
}
if (mIsTopLevel) {
// Make sure we're at least as wide as our available width
width = PR_MAX(aMetrics.width, aMaxSize.width);
height += aBorderPadding.top + aBorderPadding.bottom; height += aBorderPadding.top + aBorderPadding.bottom;
} }