diff --git a/content/html/style/src/nsHTMLStyleSheet.cpp b/content/html/style/src/nsHTMLStyleSheet.cpp index f7b65301b423..36b6f6a66a5d 100644 --- a/content/html/style/src/nsHTMLStyleSheet.cpp +++ b/content/html/style/src/nsHTMLStyleSheet.cpp @@ -1443,21 +1443,13 @@ PRBool HTMLStyleSheetImpl::IsScrollable(nsIFrame* aFrame, const nsStyleDisplay* aDisplay) { - // If the overflow property is scroll then it's scrollable regardless - // of whether the content overflows the block. - // XXX This isn't correct. Only do this if the height is not allowed to - // grow to accomodate its child frames... - if (NS_STYLE_OVERFLOW_SCROLL == aDisplay->mOverflow) { + // For the time being it's scrollable if the overflow property is auto or + // scroll, regardless of whether the width or height is fixed in size + if ((NS_STYLE_OVERFLOW_SCROLL == aDisplay->mOverflow) || + (NS_STYLE_OVERFLOW_AUTO == aDisplay->mOverflow)) { return PR_TRUE; } -#if 0 - if ((NS_STYLE_OVERFLOW_SCROLL == aDisplay->mOverflow) || - // If the element has a fixed height (it isn't auto) and an overflow - // property of scroll or auto, then it's potentially scrollable. - // XXX Deal with width considerations, too - (NS_STYLE_OVERFLOW_AUTO == aDisplay->mOverflow)) { -#endif return PR_FALSE; } diff --git a/layout/forms/nsFieldSetFrame.cpp b/layout/forms/nsFieldSetFrame.cpp index a026ac564dd7..079092ad0b87 100644 --- a/layout/forms/nsFieldSetFrame.cpp +++ b/layout/forms/nsFieldSetFrame.cpp @@ -266,7 +266,7 @@ nsFieldSetFrame::Reflow(nsIPresContext& aPresContext, nscoord horTaken = borderPadding.left + borderPadding.right + (2 * minTopBorder) + legendMargin.left + legendMargin.right; nscoord verTaken = padding.top + borderPadding.bottom + legendMargin.top + legendMargin.bottom; - if (aReflowState.HaveConstrainedWidth()) { + if (aReflowState.HaveFixedContentWidth()) { availSize.width = aReflowState.minWidth; } else { @@ -347,7 +347,7 @@ nsFieldSetFrame::Reflow(nsIPresContext& aPresContext, nscoord contentWidth = contentSize.width + borderPadding.left + borderPadding.right; aDesiredSize.width = (legendWidth > contentWidth) ? legendWidth : contentWidth; - if (aReflowState.HaveConstrainedWidth() && (aReflowState.minWidth > aDesiredSize.width)) { + if (aReflowState.HaveFixedContentWidth() && (aReflowState.minWidth > aDesiredSize.width)) { aDesiredSize.width = aReflowState.minWidth; } @@ -410,7 +410,7 @@ nsFieldSetFrame::Reflow(nsIPresContext& aPresContext, aDesiredSize.height = contentTopOffset + contentSize.height + borderPadding.bottom; if (mInline) // XXX parents don't yet ...... aDesiredSize.height += margin.bottom; - if (aReflowState.HaveConstrainedHeight() && (aReflowState.minHeight > aDesiredSize.height)) { + if (aReflowState.HaveFixedContentHeight() && (aReflowState.minHeight > aDesiredSize.height)) { aDesiredSize.height = aReflowState.minHeight; } aDesiredSize.ascent = aDesiredSize.height; diff --git a/layout/forms/nsFormControlFrame.cpp b/layout/forms/nsFormControlFrame.cpp index bcd77b9e4254..9f7add8bf31c 100644 --- a/layout/forms/nsFormControlFrame.cpp +++ b/layout/forms/nsFormControlFrame.cpp @@ -582,13 +582,13 @@ nsFormControlFrame::GetStyleSize(nsIPresContext& aPresContext, const nsHTMLReflowState& aReflowState, nsSize& aSize) { - if (aReflowState.HaveConstrainedWidth()) { + if (aReflowState.HaveFixedContentWidth()) { aSize.width = aReflowState.minWidth; } else { aSize.width = CSS_NOTSET; } - if (aReflowState.HaveConstrainedHeight()) { + if (aReflowState.HaveFixedContentHeight()) { aSize.height = aReflowState.minHeight; } else { diff --git a/layout/forms/nsHTMLButtonControlFrame.cpp b/layout/forms/nsHTMLButtonControlFrame.cpp index 7ec02b2899ca..bec2beb88822 100644 --- a/layout/forms/nsHTMLButtonControlFrame.cpp +++ b/layout/forms/nsHTMLButtonControlFrame.cpp @@ -650,10 +650,10 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext& aPresContext, } // if we are constrained and the child is smaller, use the constrained values - if (aReflowState.HaveConstrainedWidth() && (aDesiredSize.width < aReflowState.minWidth)) { + if (aReflowState.HaveFixedContentWidth() && (aDesiredSize.width < aReflowState.minWidth)) { aDesiredSize.width = aReflowState.minWidth; } - if (aReflowState.HaveConstrainedHeight() && (aDesiredSize.height < aReflowState.minHeight)) { + if (aReflowState.HaveFixedContentHeight() && (aDesiredSize.height < aReflowState.minHeight)) { aDesiredSize.height = aReflowState.minHeight; } diff --git a/layout/forms/nsLegendFrame.cpp b/layout/forms/nsLegendFrame.cpp index 9606a51dcda5..b8eef87220c1 100644 --- a/layout/forms/nsLegendFrame.cpp +++ b/layout/forms/nsLegendFrame.cpp @@ -146,12 +146,12 @@ nsLegendFrame::Reflow(nsIPresContext& aPresContext, // add in our border and padding to the size of the child aDesiredSize.width += borderPadding.left + borderPadding.right; - if (aReflowState.HaveConstrainedWidth() && (aReflowState.minWidth > aDesiredSize.width)) { + if (aReflowState.HaveFixedContentWidth() && (aReflowState.minWidth > aDesiredSize.width)) { aDesiredSize.width = aReflowState.minWidth; } aDesiredSize.height += borderPadding.top + borderPadding.bottom; - if (aReflowState.HaveConstrainedHeight() && (aReflowState.minHeight > aDesiredSize.height)) { + if (aReflowState.HaveFixedContentHeight() && (aReflowState.minHeight > aDesiredSize.height)) { aDesiredSize.height = aReflowState.minHeight; } diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index 36ac8389c955..6cc971ba97df 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -1366,7 +1366,7 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext, nscoord lr = mBorderPadding.left + mBorderPadding.right; mY = mBorderPadding.top; - if (eHTMLFrameConstraint_Unconstrained != widthConstraint) { + if (eHTMLFrameConstraint_FixedContent == widthConstraint) { // The CSS2 spec says that the width attribute defines the width // of the "content area" which does not include the border // padding. So we add those back in. @@ -1879,7 +1879,7 @@ nsBlockFrame::ComputeFinalSize(nsBlockReflowState& aState, nsHTMLReflowMetrics& aMetrics) { // Compute final width - if (eHTMLFrameConstraint_Unconstrained != aState.widthConstraint) { + if (eHTMLFrameConstraint_FixedContent == aState.widthConstraint) { // Use style defined width aMetrics.width = aState.mBorderPadding.left + aState.minWidth + aState.mBorderPadding.right; @@ -1899,7 +1899,7 @@ nsBlockFrame::ComputeFinalSize(nsBlockReflowState& aState, } // Compute final height - if (eHTMLFrameConstraint_Unconstrained != aState.heightConstraint) { + if (eHTMLFrameConstraint_FixedContent == aState.heightConstraint) { // Use style defined height aMetrics.height = aState.mBorderPadding.top + aState.minHeight + aState.mBorderPadding.bottom; @@ -4162,8 +4162,8 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext, // If either dimension is constrained then get the border and // padding values in advance. nsMargin bp(0, 0, 0, 0); - if (reflowState.HaveConstrainedWidth() || - reflowState.HaveConstrainedHeight()) { + if (reflowState.HaveFixedContentWidth() || + reflowState.HaveFixedContentHeight()) { const nsStyleSpacing* spacing; if (NS_OK == aFloaterFrame->GetStyleData(eStyleStruct_Spacing, (const nsStyleStruct*&)spacing)) { @@ -4172,7 +4172,7 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext, } // Compute the available width for the floater - if (reflowState.HaveConstrainedWidth()) { + if (reflowState.HaveFixedContentWidth()) { // When the floater has a contrained width, give it just enough // space for its styled width plus its borders and paddings. kidAvailSize.width = reflowState.minWidth + bp.left + bp.right; @@ -4184,7 +4184,7 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext, const nsHTMLReflowState* rsp = &aState; kidAvailSize.width = 0; while (nsnull != rsp) { - if (eHTMLFrameConstraint_Unconstrained != rsp->widthConstraint) { + if (eHTMLFrameConstraint_FixedContent == rsp->widthConstraint) { kidAvailSize.width = rsp->minWidth; break; } @@ -4200,7 +4200,7 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext, } // Compute the available height for the floater - if (reflowState.HaveConstrainedHeight()) { + if (reflowState.HaveFixedContentHeight()) { kidAvailSize.height = reflowState.minHeight + bp.top + bp.bottom; } else { diff --git a/layout/generic/nsBlockReflowState.cpp b/layout/generic/nsBlockReflowState.cpp index 36ac8389c955..6cc971ba97df 100644 --- a/layout/generic/nsBlockReflowState.cpp +++ b/layout/generic/nsBlockReflowState.cpp @@ -1366,7 +1366,7 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext, nscoord lr = mBorderPadding.left + mBorderPadding.right; mY = mBorderPadding.top; - if (eHTMLFrameConstraint_Unconstrained != widthConstraint) { + if (eHTMLFrameConstraint_FixedContent == widthConstraint) { // The CSS2 spec says that the width attribute defines the width // of the "content area" which does not include the border // padding. So we add those back in. @@ -1879,7 +1879,7 @@ nsBlockFrame::ComputeFinalSize(nsBlockReflowState& aState, nsHTMLReflowMetrics& aMetrics) { // Compute final width - if (eHTMLFrameConstraint_Unconstrained != aState.widthConstraint) { + if (eHTMLFrameConstraint_FixedContent == aState.widthConstraint) { // Use style defined width aMetrics.width = aState.mBorderPadding.left + aState.minWidth + aState.mBorderPadding.right; @@ -1899,7 +1899,7 @@ nsBlockFrame::ComputeFinalSize(nsBlockReflowState& aState, } // Compute final height - if (eHTMLFrameConstraint_Unconstrained != aState.heightConstraint) { + if (eHTMLFrameConstraint_FixedContent == aState.heightConstraint) { // Use style defined height aMetrics.height = aState.mBorderPadding.top + aState.minHeight + aState.mBorderPadding.bottom; @@ -4162,8 +4162,8 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext, // If either dimension is constrained then get the border and // padding values in advance. nsMargin bp(0, 0, 0, 0); - if (reflowState.HaveConstrainedWidth() || - reflowState.HaveConstrainedHeight()) { + if (reflowState.HaveFixedContentWidth() || + reflowState.HaveFixedContentHeight()) { const nsStyleSpacing* spacing; if (NS_OK == aFloaterFrame->GetStyleData(eStyleStruct_Spacing, (const nsStyleStruct*&)spacing)) { @@ -4172,7 +4172,7 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext, } // Compute the available width for the floater - if (reflowState.HaveConstrainedWidth()) { + if (reflowState.HaveFixedContentWidth()) { // When the floater has a contrained width, give it just enough // space for its styled width plus its borders and paddings. kidAvailSize.width = reflowState.minWidth + bp.left + bp.right; @@ -4184,7 +4184,7 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext, const nsHTMLReflowState* rsp = &aState; kidAvailSize.width = 0; while (nsnull != rsp) { - if (eHTMLFrameConstraint_Unconstrained != rsp->widthConstraint) { + if (eHTMLFrameConstraint_FixedContent == rsp->widthConstraint) { kidAvailSize.width = rsp->minWidth; break; } @@ -4200,7 +4200,7 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext, } // Compute the available height for the floater - if (reflowState.HaveConstrainedHeight()) { + if (reflowState.HaveFixedContentHeight()) { kidAvailSize.height = reflowState.minHeight + bp.top + bp.bottom; } else { diff --git a/layout/generic/nsBlockReflowState.h b/layout/generic/nsBlockReflowState.h index 36ac8389c955..6cc971ba97df 100644 --- a/layout/generic/nsBlockReflowState.h +++ b/layout/generic/nsBlockReflowState.h @@ -1366,7 +1366,7 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext, nscoord lr = mBorderPadding.left + mBorderPadding.right; mY = mBorderPadding.top; - if (eHTMLFrameConstraint_Unconstrained != widthConstraint) { + if (eHTMLFrameConstraint_FixedContent == widthConstraint) { // The CSS2 spec says that the width attribute defines the width // of the "content area" which does not include the border // padding. So we add those back in. @@ -1879,7 +1879,7 @@ nsBlockFrame::ComputeFinalSize(nsBlockReflowState& aState, nsHTMLReflowMetrics& aMetrics) { // Compute final width - if (eHTMLFrameConstraint_Unconstrained != aState.widthConstraint) { + if (eHTMLFrameConstraint_FixedContent == aState.widthConstraint) { // Use style defined width aMetrics.width = aState.mBorderPadding.left + aState.minWidth + aState.mBorderPadding.right; @@ -1899,7 +1899,7 @@ nsBlockFrame::ComputeFinalSize(nsBlockReflowState& aState, } // Compute final height - if (eHTMLFrameConstraint_Unconstrained != aState.heightConstraint) { + if (eHTMLFrameConstraint_FixedContent == aState.heightConstraint) { // Use style defined height aMetrics.height = aState.mBorderPadding.top + aState.minHeight + aState.mBorderPadding.bottom; @@ -4162,8 +4162,8 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext, // If either dimension is constrained then get the border and // padding values in advance. nsMargin bp(0, 0, 0, 0); - if (reflowState.HaveConstrainedWidth() || - reflowState.HaveConstrainedHeight()) { + if (reflowState.HaveFixedContentWidth() || + reflowState.HaveFixedContentHeight()) { const nsStyleSpacing* spacing; if (NS_OK == aFloaterFrame->GetStyleData(eStyleStruct_Spacing, (const nsStyleStruct*&)spacing)) { @@ -4172,7 +4172,7 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext, } // Compute the available width for the floater - if (reflowState.HaveConstrainedWidth()) { + if (reflowState.HaveFixedContentWidth()) { // When the floater has a contrained width, give it just enough // space for its styled width plus its borders and paddings. kidAvailSize.width = reflowState.minWidth + bp.left + bp.right; @@ -4184,7 +4184,7 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext, const nsHTMLReflowState* rsp = &aState; kidAvailSize.width = 0; while (nsnull != rsp) { - if (eHTMLFrameConstraint_Unconstrained != rsp->widthConstraint) { + if (eHTMLFrameConstraint_FixedContent == rsp->widthConstraint) { kidAvailSize.width = rsp->minWidth; break; } @@ -4200,7 +4200,7 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext, } // Compute the available height for the floater - if (reflowState.HaveConstrainedHeight()) { + if (reflowState.HaveFixedContentHeight()) { kidAvailSize.height = reflowState.minHeight + bp.top + bp.bottom; } else { diff --git a/layout/generic/nsFrameFrame.cpp b/layout/generic/nsFrameFrame.cpp index 70302f460a84..a8714278c313 100644 --- a/layout/generic/nsFrameFrame.cpp +++ b/layout/generic/nsFrameFrame.cpp @@ -240,13 +240,13 @@ nsHTMLFrameOuterFrame::GetDesiredSize(nsIPresContext* aPresContext, float p2t = aPresContext->GetPixelsToTwips(); // XXX this needs to be changed from (200,200) to a better default for inline frames - if (aReflowState.HaveConstrainedWidth()) { + if (aReflowState.HaveFixedContentWidth()) { aDesiredSize.width = aReflowState.minWidth; } else { aDesiredSize.width = NSIntPixelsToTwips(200, p2t); } - if (aReflowState.HaveConstrainedHeight()) { + if (aReflowState.HaveFixedContentHeight()) { aDesiredSize.height = aReflowState.minHeight; } else { diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp index 42a2c64d698c..f0059c3724ff 100644 --- a/layout/generic/nsImageFrame.cpp +++ b/layout/generic/nsImageFrame.cpp @@ -273,13 +273,14 @@ nsHTMLImageLoader::GetDesiredSize(nsIPresContext* aPresContext, // Start the image loading PRIntn loadStatus; StartLoadImage(aPresContext, aTargetFrame, aCallBack, - !aReflowState.HaveConstrainedWidthAndHeight(), + !(aReflowState.HaveFixedContentWidth() && aReflowState.HaveFixedContentHeight()), loadStatus); // Choose reflow size - if (aReflowState.HaveConstrainedWidth() || - aReflowState.HaveConstrainedHeight()) { - if (aReflowState.HaveConstrainedWidthAndHeight()) { + if (aReflowState.HaveFixedContentWidth() || + aReflowState.HaveFixedContentHeight()) { + if (aReflowState.HaveFixedContentWidth() && + aReflowState.HaveFixedContentHeight()) { // The image is fully constrained. Use the constraints directly. aDesiredSize.width = aReflowState.minWidth; aDesiredSize.height = aReflowState.minHeight; @@ -301,7 +302,7 @@ nsHTMLImageLoader::GetDesiredSize(nsIPresContext* aPresContext, float imageWidth = imageSize.width * p2t; float imageHeight = imageSize.height * p2t; if (0.0f != imageHeight) { - if (aReflowState.HaveConstrainedWidth()) { + if (aReflowState.HaveFixedContentWidth()) { // We have a width, and an auto height. Compute height // from width. aDesiredSize.width = aReflowState.minWidth; diff --git a/layout/generic/nsObjectFrame.cpp b/layout/generic/nsObjectFrame.cpp index be4b01f32d19..00e049fd1208 100644 --- a/layout/generic/nsObjectFrame.cpp +++ b/layout/generic/nsObjectFrame.cpp @@ -302,11 +302,11 @@ nsObjectFrame::GetDesiredSize(nsIPresContext* aPresContext, // Determine our size stylistically PRBool haveWidth = PR_FALSE; PRBool haveHeight = PR_FALSE; - if (aReflowState.HaveConstrainedWidth()) { + if (aReflowState.HaveFixedContentWidth()) { aMetrics.width = aReflowState.minWidth; haveWidth = PR_TRUE; } - if (aReflowState.HaveConstrainedHeight()) { + if (aReflowState.HaveFixedContentHeight()) { aMetrics.height = aReflowState.minHeight; haveHeight = PR_TRUE; } diff --git a/layout/html/base/src/nsBlockFrame.cpp b/layout/html/base/src/nsBlockFrame.cpp index 36ac8389c955..6cc971ba97df 100644 --- a/layout/html/base/src/nsBlockFrame.cpp +++ b/layout/html/base/src/nsBlockFrame.cpp @@ -1366,7 +1366,7 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext, nscoord lr = mBorderPadding.left + mBorderPadding.right; mY = mBorderPadding.top; - if (eHTMLFrameConstraint_Unconstrained != widthConstraint) { + if (eHTMLFrameConstraint_FixedContent == widthConstraint) { // The CSS2 spec says that the width attribute defines the width // of the "content area" which does not include the border // padding. So we add those back in. @@ -1879,7 +1879,7 @@ nsBlockFrame::ComputeFinalSize(nsBlockReflowState& aState, nsHTMLReflowMetrics& aMetrics) { // Compute final width - if (eHTMLFrameConstraint_Unconstrained != aState.widthConstraint) { + if (eHTMLFrameConstraint_FixedContent == aState.widthConstraint) { // Use style defined width aMetrics.width = aState.mBorderPadding.left + aState.minWidth + aState.mBorderPadding.right; @@ -1899,7 +1899,7 @@ nsBlockFrame::ComputeFinalSize(nsBlockReflowState& aState, } // Compute final height - if (eHTMLFrameConstraint_Unconstrained != aState.heightConstraint) { + if (eHTMLFrameConstraint_FixedContent == aState.heightConstraint) { // Use style defined height aMetrics.height = aState.mBorderPadding.top + aState.minHeight + aState.mBorderPadding.bottom; @@ -4162,8 +4162,8 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext, // If either dimension is constrained then get the border and // padding values in advance. nsMargin bp(0, 0, 0, 0); - if (reflowState.HaveConstrainedWidth() || - reflowState.HaveConstrainedHeight()) { + if (reflowState.HaveFixedContentWidth() || + reflowState.HaveFixedContentHeight()) { const nsStyleSpacing* spacing; if (NS_OK == aFloaterFrame->GetStyleData(eStyleStruct_Spacing, (const nsStyleStruct*&)spacing)) { @@ -4172,7 +4172,7 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext, } // Compute the available width for the floater - if (reflowState.HaveConstrainedWidth()) { + if (reflowState.HaveFixedContentWidth()) { // When the floater has a contrained width, give it just enough // space for its styled width plus its borders and paddings. kidAvailSize.width = reflowState.minWidth + bp.left + bp.right; @@ -4184,7 +4184,7 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext, const nsHTMLReflowState* rsp = &aState; kidAvailSize.width = 0; while (nsnull != rsp) { - if (eHTMLFrameConstraint_Unconstrained != rsp->widthConstraint) { + if (eHTMLFrameConstraint_FixedContent == rsp->widthConstraint) { kidAvailSize.width = rsp->minWidth; break; } @@ -4200,7 +4200,7 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext, } // Compute the available height for the floater - if (reflowState.HaveConstrainedHeight()) { + if (reflowState.HaveFixedContentHeight()) { kidAvailSize.height = reflowState.minHeight + bp.top + bp.bottom; } else { diff --git a/layout/html/base/src/nsBlockReflowState.cpp b/layout/html/base/src/nsBlockReflowState.cpp index 36ac8389c955..6cc971ba97df 100644 --- a/layout/html/base/src/nsBlockReflowState.cpp +++ b/layout/html/base/src/nsBlockReflowState.cpp @@ -1366,7 +1366,7 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext, nscoord lr = mBorderPadding.left + mBorderPadding.right; mY = mBorderPadding.top; - if (eHTMLFrameConstraint_Unconstrained != widthConstraint) { + if (eHTMLFrameConstraint_FixedContent == widthConstraint) { // The CSS2 spec says that the width attribute defines the width // of the "content area" which does not include the border // padding. So we add those back in. @@ -1879,7 +1879,7 @@ nsBlockFrame::ComputeFinalSize(nsBlockReflowState& aState, nsHTMLReflowMetrics& aMetrics) { // Compute final width - if (eHTMLFrameConstraint_Unconstrained != aState.widthConstraint) { + if (eHTMLFrameConstraint_FixedContent == aState.widthConstraint) { // Use style defined width aMetrics.width = aState.mBorderPadding.left + aState.minWidth + aState.mBorderPadding.right; @@ -1899,7 +1899,7 @@ nsBlockFrame::ComputeFinalSize(nsBlockReflowState& aState, } // Compute final height - if (eHTMLFrameConstraint_Unconstrained != aState.heightConstraint) { + if (eHTMLFrameConstraint_FixedContent == aState.heightConstraint) { // Use style defined height aMetrics.height = aState.mBorderPadding.top + aState.minHeight + aState.mBorderPadding.bottom; @@ -4162,8 +4162,8 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext, // If either dimension is constrained then get the border and // padding values in advance. nsMargin bp(0, 0, 0, 0); - if (reflowState.HaveConstrainedWidth() || - reflowState.HaveConstrainedHeight()) { + if (reflowState.HaveFixedContentWidth() || + reflowState.HaveFixedContentHeight()) { const nsStyleSpacing* spacing; if (NS_OK == aFloaterFrame->GetStyleData(eStyleStruct_Spacing, (const nsStyleStruct*&)spacing)) { @@ -4172,7 +4172,7 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext, } // Compute the available width for the floater - if (reflowState.HaveConstrainedWidth()) { + if (reflowState.HaveFixedContentWidth()) { // When the floater has a contrained width, give it just enough // space for its styled width plus its borders and paddings. kidAvailSize.width = reflowState.minWidth + bp.left + bp.right; @@ -4184,7 +4184,7 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext, const nsHTMLReflowState* rsp = &aState; kidAvailSize.width = 0; while (nsnull != rsp) { - if (eHTMLFrameConstraint_Unconstrained != rsp->widthConstraint) { + if (eHTMLFrameConstraint_FixedContent == rsp->widthConstraint) { kidAvailSize.width = rsp->minWidth; break; } @@ -4200,7 +4200,7 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext, } // Compute the available height for the floater - if (reflowState.HaveConstrainedHeight()) { + if (reflowState.HaveFixedContentHeight()) { kidAvailSize.height = reflowState.minHeight + bp.top + bp.bottom; } else { diff --git a/layout/html/base/src/nsBlockReflowState.h b/layout/html/base/src/nsBlockReflowState.h index 36ac8389c955..6cc971ba97df 100644 --- a/layout/html/base/src/nsBlockReflowState.h +++ b/layout/html/base/src/nsBlockReflowState.h @@ -1366,7 +1366,7 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext, nscoord lr = mBorderPadding.left + mBorderPadding.right; mY = mBorderPadding.top; - if (eHTMLFrameConstraint_Unconstrained != widthConstraint) { + if (eHTMLFrameConstraint_FixedContent == widthConstraint) { // The CSS2 spec says that the width attribute defines the width // of the "content area" which does not include the border // padding. So we add those back in. @@ -1879,7 +1879,7 @@ nsBlockFrame::ComputeFinalSize(nsBlockReflowState& aState, nsHTMLReflowMetrics& aMetrics) { // Compute final width - if (eHTMLFrameConstraint_Unconstrained != aState.widthConstraint) { + if (eHTMLFrameConstraint_FixedContent == aState.widthConstraint) { // Use style defined width aMetrics.width = aState.mBorderPadding.left + aState.minWidth + aState.mBorderPadding.right; @@ -1899,7 +1899,7 @@ nsBlockFrame::ComputeFinalSize(nsBlockReflowState& aState, } // Compute final height - if (eHTMLFrameConstraint_Unconstrained != aState.heightConstraint) { + if (eHTMLFrameConstraint_FixedContent == aState.heightConstraint) { // Use style defined height aMetrics.height = aState.mBorderPadding.top + aState.minHeight + aState.mBorderPadding.bottom; @@ -4162,8 +4162,8 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext, // If either dimension is constrained then get the border and // padding values in advance. nsMargin bp(0, 0, 0, 0); - if (reflowState.HaveConstrainedWidth() || - reflowState.HaveConstrainedHeight()) { + if (reflowState.HaveFixedContentWidth() || + reflowState.HaveFixedContentHeight()) { const nsStyleSpacing* spacing; if (NS_OK == aFloaterFrame->GetStyleData(eStyleStruct_Spacing, (const nsStyleStruct*&)spacing)) { @@ -4172,7 +4172,7 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext, } // Compute the available width for the floater - if (reflowState.HaveConstrainedWidth()) { + if (reflowState.HaveFixedContentWidth()) { // When the floater has a contrained width, give it just enough // space for its styled width plus its borders and paddings. kidAvailSize.width = reflowState.minWidth + bp.left + bp.right; @@ -4184,7 +4184,7 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext, const nsHTMLReflowState* rsp = &aState; kidAvailSize.width = 0; while (nsnull != rsp) { - if (eHTMLFrameConstraint_Unconstrained != rsp->widthConstraint) { + if (eHTMLFrameConstraint_FixedContent == rsp->widthConstraint) { kidAvailSize.width = rsp->minWidth; break; } @@ -4200,7 +4200,7 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext, } // Compute the available height for the floater - if (reflowState.HaveConstrainedHeight()) { + if (reflowState.HaveFixedContentHeight()) { kidAvailSize.height = reflowState.minHeight + bp.top + bp.bottom; } else { diff --git a/layout/html/base/src/nsBodyFrame.cpp b/layout/html/base/src/nsBodyFrame.cpp index 5f6af2014bc7..63b336d767d0 100644 --- a/layout/html/base/src/nsBodyFrame.cpp +++ b/layout/html/base/src/nsBodyFrame.cpp @@ -616,11 +616,11 @@ nsBodyFrame::GetColumnAvailSpace(nsIPresContext& aPresContext, } } else { - if (aReflowState.HaveConstrainedWidth()) { + if (aReflowState.HaveFixedContentWidth()) { result.width = aReflowState.minWidth + aBorderPadding.left + aBorderPadding.right; } - if (aReflowState.HaveConstrainedHeight()) { + if (aReflowState.HaveFixedContentHeight()) { result.height -= aBorderPadding.top + aBorderPadding.bottom; } } @@ -628,10 +628,10 @@ nsBodyFrame::GetColumnAvailSpace(nsIPresContext& aPresContext, NS_FRAME_TRACE_MSG(NS_FRAME_TRACE_CALLS, (": nsBodyFrame: columnAvailSpace=%d,%d [%s,%s]\n", result.width, result.height, - aReflowState.HaveConstrainedWidth() - ? "constrained" : "not-constrained", - aReflowState.HaveConstrainedHeight() - ? "constrained" : "not-constrained")); + eHTMLFrameConstraint_Unconstrained == aReflowState.widthConstraint + ? "not-constrained" : "constrained", + eHTMLFrameConstraint_Unconstrained == aReflowState.heightConstraint + ? "not-constrained" : "constrained")); return result; } @@ -669,7 +669,7 @@ nsBodyFrame::ComputeDesiredSize(nsIPresContext& aPresContext, // Apply style size if present; XXX note the inner value (style-size - // border+padding) should be given to the child as a max-size - if (aReflowState.HaveConstrainedWidth()) { + if (aReflowState.HaveFixedContentWidth()) { width = aReflowState.minWidth + aBorderPadding.left + aBorderPadding.right; } else { @@ -681,7 +681,7 @@ nsBodyFrame::ComputeDesiredSize(nsIPresContext& aPresContext, } } } - if (aReflowState.HaveConstrainedHeight()) { + if (aReflowState.HaveFixedContentHeight()) { height = aReflowState.minHeight + aBorderPadding.top + aBorderPadding.bottom; } diff --git a/layout/html/base/src/nsFrameReflowState.cpp b/layout/html/base/src/nsFrameReflowState.cpp index 5bd73ab1fd88..abc919bd4b0c 100644 --- a/layout/html/base/src/nsFrameReflowState.cpp +++ b/layout/html/base/src/nsFrameReflowState.cpp @@ -107,9 +107,6 @@ nsHTMLReflowState::DetermineFrameType(nsIPresContext& aPresContext) void nsHTMLReflowState::InitConstraints(nsIPresContext& aPresContext) { - // XXX This is what we should be setting this to, but if we do - // it breaks the block and inline code -#if 0 // Determine whether the values are constrained or unconstrained // by looking at the maxSize widthConstraint = NS_UNCONSTRAINEDSIZE == maxSize.width ? @@ -118,11 +115,6 @@ nsHTMLReflowState::InitConstraints(nsIPresContext& aPresContext) heightConstraint = NS_UNCONSTRAINEDSIZE == maxSize.height ? eHTMLFrameConstraint_Unconstrained : eHTMLFrameConstraint_Constrained; -#else - // Assume that the values are unconstrained - widthConstraint = eHTMLFrameConstraint_Unconstrained; - heightConstraint = eHTMLFrameConstraint_Unconstrained; -#endif minWidth = 0; minHeight = 0; diff --git a/layout/html/base/src/nsHRFrame.cpp b/layout/html/base/src/nsHRFrame.cpp index ab80da7c7cc0..87bfc5362d50 100644 --- a/layout/html/base/src/nsHRFrame.cpp +++ b/layout/html/base/src/nsHRFrame.cpp @@ -223,7 +223,7 @@ HRuleFrame::Reflow(nsIPresContext& aPresContext, // otherwise tables behave badly. This makes sense they are springy. if (nsnull != aDesiredSize.maxElementSize) { nscoord onePixel = NSIntPixelsToTwips(1, aPresContext.GetPixelsToTwips()); - if (aReflowState.HaveConstrainedWidth()) { + if (aReflowState.HaveFixedContentWidth()) { aDesiredSize.maxElementSize->width = aReflowState.minWidth; aDesiredSize.maxElementSize->height = onePixel; } @@ -242,7 +242,7 @@ HRuleFrame::GetDesiredSize(nsIPresContext* aPresContext, const nsHTMLReflowState& aReflowState, nsHTMLReflowMetrics& aDesiredSize) { - if (aReflowState.HaveConstrainedWidth()) { + if (aReflowState.HaveFixedContentWidth()) { aDesiredSize.width = aReflowState.minWidth; } else { diff --git a/layout/html/base/src/nsIHTMLReflow.h b/layout/html/base/src/nsIHTMLReflow.h index e22c301099b1..780d20b7de8c 100644 --- a/layout/html/base/src/nsIHTMLReflow.h +++ b/layout/html/base/src/nsIHTMLReflow.h @@ -208,16 +208,12 @@ struct nsHTMLReflowState : nsReflowState { const nsSize& aMaxSize, nsReflowReason aReflowReason); - PRBool HaveConstrainedWidth() const { - return eHTMLFrameConstraint_Unconstrained != widthConstraint; + PRBool HaveFixedContentWidth() const { + return eHTMLFrameConstraint_FixedContent == widthConstraint; } - PRBool HaveConstrainedHeight() const { - return eHTMLFrameConstraint_Unconstrained != heightConstraint; - } - - PRBool HaveConstrainedWidthAndHeight() const { - return HaveConstrainedWidth() && HaveConstrainedHeight(); + PRBool HaveFixedContentHeight() const { + return eHTMLFrameConstraint_FixedContent == heightConstraint; } protected: diff --git a/layout/html/base/src/nsImageFrame.cpp b/layout/html/base/src/nsImageFrame.cpp index 42a2c64d698c..f0059c3724ff 100644 --- a/layout/html/base/src/nsImageFrame.cpp +++ b/layout/html/base/src/nsImageFrame.cpp @@ -273,13 +273,14 @@ nsHTMLImageLoader::GetDesiredSize(nsIPresContext* aPresContext, // Start the image loading PRIntn loadStatus; StartLoadImage(aPresContext, aTargetFrame, aCallBack, - !aReflowState.HaveConstrainedWidthAndHeight(), + !(aReflowState.HaveFixedContentWidth() && aReflowState.HaveFixedContentHeight()), loadStatus); // Choose reflow size - if (aReflowState.HaveConstrainedWidth() || - aReflowState.HaveConstrainedHeight()) { - if (aReflowState.HaveConstrainedWidthAndHeight()) { + if (aReflowState.HaveFixedContentWidth() || + aReflowState.HaveFixedContentHeight()) { + if (aReflowState.HaveFixedContentWidth() && + aReflowState.HaveFixedContentHeight()) { // The image is fully constrained. Use the constraints directly. aDesiredSize.width = aReflowState.minWidth; aDesiredSize.height = aReflowState.minHeight; @@ -301,7 +302,7 @@ nsHTMLImageLoader::GetDesiredSize(nsIPresContext* aPresContext, float imageWidth = imageSize.width * p2t; float imageHeight = imageSize.height * p2t; if (0.0f != imageHeight) { - if (aReflowState.HaveConstrainedWidth()) { + if (aReflowState.HaveFixedContentWidth()) { // We have a width, and an auto height. Compute height // from width. aDesiredSize.width = aReflowState.minWidth; diff --git a/layout/html/base/src/nsInlineReflow.cpp b/layout/html/base/src/nsInlineReflow.cpp index 4709effcc187..531b1c2fe95d 100644 --- a/layout/html/base/src/nsInlineReflow.cpp +++ b/layout/html/base/src/nsInlineReflow.cpp @@ -353,7 +353,7 @@ nsInlineReflow::ApplyTopLeftMargins() } else if (eStyleUnit_Percent == unit) { nscoord width; - if (mOuterReflowState.HaveConstrainedWidth()) { + if (mOuterReflowState.HaveFixedContentWidth()) { width = mOuterReflowState.minWidth; } else if (NS_UNCONSTRAINEDSIZE == mOuterReflowState.maxSize.width) { diff --git a/layout/html/base/src/nsObjectFrame.cpp b/layout/html/base/src/nsObjectFrame.cpp index be4b01f32d19..00e049fd1208 100644 --- a/layout/html/base/src/nsObjectFrame.cpp +++ b/layout/html/base/src/nsObjectFrame.cpp @@ -302,11 +302,11 @@ nsObjectFrame::GetDesiredSize(nsIPresContext* aPresContext, // Determine our size stylistically PRBool haveWidth = PR_FALSE; PRBool haveHeight = PR_FALSE; - if (aReflowState.HaveConstrainedWidth()) { + if (aReflowState.HaveFixedContentWidth()) { aMetrics.width = aReflowState.minWidth; haveWidth = PR_TRUE; } - if (aReflowState.HaveConstrainedHeight()) { + if (aReflowState.HaveFixedContentHeight()) { aMetrics.height = aReflowState.minHeight; haveHeight = PR_TRUE; } diff --git a/layout/html/base/src/nsScrollFrame.cpp b/layout/html/base/src/nsScrollFrame.cpp index 9de24c531907..8d9fd8b8eee1 100644 --- a/layout/html/base/src/nsScrollFrame.cpp +++ b/layout/html/base/src/nsScrollFrame.cpp @@ -187,12 +187,10 @@ nsScrollFrame::CreateScrollingView() view->QueryInterface(kScrollViewIID, (void**)&scrollingView); // Set the scroll prefrence -#if 0 nsScrollPreference scrollPref = (NS_STYLE_OVERFLOW_SCROLL == display->mOverflow) ? nsScrollPreference_kAlwaysScroll : nsScrollPreference_kAuto; scrollingView->SetScrollPreference(scrollPref); -#endif // Set the scrolling view's insets to whatever our border is nsMargin border; @@ -291,7 +289,8 @@ nsScrollFrame::Reflow(nsIPresContext& aPresContext, // Compute the scroll area size. This is the area inside of our border edge // and inside of any vertical and horizontal scrollbars nsSize scrollAreaSize; - if (aReflowState.HaveConstrainedWidth()) { + if ((eHTMLFrameConstraint_Fixed == aReflowState.widthConstraint) || + (eHTMLFrameConstraint_FixedContent == aReflowState.widthConstraint)) { // The reflow state width reflects space for the content area only, so don't // subtract for borders... scrollAreaSize.width = aReflowState.minWidth; @@ -314,7 +313,8 @@ nsScrollFrame::Reflow(nsIPresContext& aPresContext, } } - if (aReflowState.HaveConstrainedHeight()) { + if ((eHTMLFrameConstraint_Fixed == aReflowState.heightConstraint) || + (eHTMLFrameConstraint_FixedContent == aReflowState.heightConstraint)) { // The reflow state height reflects space for the content area only, so don't // subtract for borders... scrollAreaSize.height = aReflowState.minHeight; @@ -322,13 +322,11 @@ nsScrollFrame::Reflow(nsIPresContext& aPresContext, if (eHTMLFrameConstraint_Fixed == aReflowState.heightConstraint) { scrollAreaSize.height -= border.top + border.bottom; -#if 0 // If scrollbars are always visible then subtract for the // height of the horizontal scrollbar if (NS_STYLE_OVERFLOW_SCROLL == display->mOverflow) { scrollAreaSize.height -= NSToCoordRound(sbHeight); } -#endif } } else { @@ -338,13 +336,11 @@ nsScrollFrame::Reflow(nsIPresContext& aPresContext, // The height is constrained so subtract for borders scrollAreaSize.height -= border.top + border.bottom; -#if 0 // If scrollbars are always visible then subtract for the // height of the horizontal scrollbar if (NS_STYLE_OVERFLOW_SCROLL == display->mOverflow) { scrollAreaSize.height -= NSToCoordRound(sbHeight); } -#endif } } //@ Make me a subroutine... @@ -361,7 +357,8 @@ nsScrollFrame::Reflow(nsIPresContext& aPresContext, // Make sure the scrolled frame fills the entire scroll area along a // fixed dimension - if ((eHTMLFrameConstraint_Fixed == aReflowState.heightConstraint) || aReflowState.HaveConstrainedHeight()) { + if ((eHTMLFrameConstraint_Fixed == aReflowState.heightConstraint) || + (eHTMLFrameConstraint_FixedContent == aReflowState.heightConstraint)) { if (kidDesiredSize.height < scrollAreaSize.height) { kidDesiredSize.height = scrollAreaSize.height; } @@ -370,16 +367,13 @@ nsScrollFrame::Reflow(nsIPresContext& aPresContext, // If the scrollbars are auto and the scrolled frame is fully visible // vertically then the vertical scrollbar will be hidden so increase the // width of the scrolled frame -#if 0 if (NS_STYLE_OVERFLOW_AUTO == display->mOverflow) { -#endif kidDesiredSize.width += NSToCoordRound(sbWidth); -#if 0 } -#endif } } - if ((eHTMLFrameConstraint_Fixed == aReflowState.widthConstraint) || aReflowState.HaveConstrainedWidth()) { + if ((eHTMLFrameConstraint_Fixed == aReflowState.widthConstraint) || + (eHTMLFrameConstraint_FixedContent == aReflowState.widthConstraint)) { if (kidDesiredSize.width < scrollAreaSize.width) { kidDesiredSize.width = scrollAreaSize.width; } @@ -403,25 +397,25 @@ nsScrollFrame::Reflow(nsIPresContext& aPresContext, // Compute our desired size. If our size was fixed then use the fixed size; // otherwise, shrink wrap around the scrolled frame - if ((eHTMLFrameConstraint_Fixed == aReflowState.widthConstraint) || aReflowState.HaveConstrainedWidth()) { + if ((eHTMLFrameConstraint_Fixed == aReflowState.widthConstraint) || + (eHTMLFrameConstraint_FixedContent == aReflowState.widthConstraint)) { aDesiredSize.width = scrollAreaSize.width; } else { aDesiredSize.width = kidDesiredSize.width; } aDesiredSize.width += border.left + border.right + NSToCoordRound(sbWidth); - if ((eHTMLFrameConstraint_Fixed == aReflowState.heightConstraint) || aReflowState.HaveConstrainedHeight()) { + if ((eHTMLFrameConstraint_Fixed == aReflowState.heightConstraint) || + (eHTMLFrameConstraint_FixedContent == aReflowState.heightConstraint)) { aDesiredSize.height = scrollAreaSize.height; } else { aDesiredSize.height = kidDesiredSize.height; } aDesiredSize.height += border.top + border.bottom; -#if 0 // XXX This should really be "if we have a visible horizontal scrollbar"... if (NS_STYLE_OVERFLOW_SCROLL == display->mOverflow) { aDesiredSize.height += NSToCoordRound(sbHeight); } -#endif aDesiredSize.ascent = aDesiredSize.height; aDesiredSize.descent = 0; diff --git a/layout/html/document/src/nsFrameFrame.cpp b/layout/html/document/src/nsFrameFrame.cpp index 70302f460a84..a8714278c313 100644 --- a/layout/html/document/src/nsFrameFrame.cpp +++ b/layout/html/document/src/nsFrameFrame.cpp @@ -240,13 +240,13 @@ nsHTMLFrameOuterFrame::GetDesiredSize(nsIPresContext* aPresContext, float p2t = aPresContext->GetPixelsToTwips(); // XXX this needs to be changed from (200,200) to a better default for inline frames - if (aReflowState.HaveConstrainedWidth()) { + if (aReflowState.HaveFixedContentWidth()) { aDesiredSize.width = aReflowState.minWidth; } else { aDesiredSize.width = NSIntPixelsToTwips(200, p2t); } - if (aReflowState.HaveConstrainedHeight()) { + if (aReflowState.HaveFixedContentHeight()) { aDesiredSize.height = aReflowState.minHeight; } else { diff --git a/layout/html/document/src/ua.css b/layout/html/document/src/ua.css index fa84b85ed0e0..5a2b70344997 100644 --- a/layout/html/document/src/ua.css +++ b/layout/html/document/src/ua.css @@ -27,7 +27,7 @@ BODY { line-height: normal; //XXX not yet... margin: 8px; padding: 8px; - overflow: scroll; + overflow: auto; } FRAMESET { diff --git a/layout/html/forms/src/nsFieldSetFrame.cpp b/layout/html/forms/src/nsFieldSetFrame.cpp index a026ac564dd7..079092ad0b87 100644 --- a/layout/html/forms/src/nsFieldSetFrame.cpp +++ b/layout/html/forms/src/nsFieldSetFrame.cpp @@ -266,7 +266,7 @@ nsFieldSetFrame::Reflow(nsIPresContext& aPresContext, nscoord horTaken = borderPadding.left + borderPadding.right + (2 * minTopBorder) + legendMargin.left + legendMargin.right; nscoord verTaken = padding.top + borderPadding.bottom + legendMargin.top + legendMargin.bottom; - if (aReflowState.HaveConstrainedWidth()) { + if (aReflowState.HaveFixedContentWidth()) { availSize.width = aReflowState.minWidth; } else { @@ -347,7 +347,7 @@ nsFieldSetFrame::Reflow(nsIPresContext& aPresContext, nscoord contentWidth = contentSize.width + borderPadding.left + borderPadding.right; aDesiredSize.width = (legendWidth > contentWidth) ? legendWidth : contentWidth; - if (aReflowState.HaveConstrainedWidth() && (aReflowState.minWidth > aDesiredSize.width)) { + if (aReflowState.HaveFixedContentWidth() && (aReflowState.minWidth > aDesiredSize.width)) { aDesiredSize.width = aReflowState.minWidth; } @@ -410,7 +410,7 @@ nsFieldSetFrame::Reflow(nsIPresContext& aPresContext, aDesiredSize.height = contentTopOffset + contentSize.height + borderPadding.bottom; if (mInline) // XXX parents don't yet ...... aDesiredSize.height += margin.bottom; - if (aReflowState.HaveConstrainedHeight() && (aReflowState.minHeight > aDesiredSize.height)) { + if (aReflowState.HaveFixedContentHeight() && (aReflowState.minHeight > aDesiredSize.height)) { aDesiredSize.height = aReflowState.minHeight; } aDesiredSize.ascent = aDesiredSize.height; diff --git a/layout/html/forms/src/nsFormControlFrame.cpp b/layout/html/forms/src/nsFormControlFrame.cpp index bcd77b9e4254..9f7add8bf31c 100644 --- a/layout/html/forms/src/nsFormControlFrame.cpp +++ b/layout/html/forms/src/nsFormControlFrame.cpp @@ -582,13 +582,13 @@ nsFormControlFrame::GetStyleSize(nsIPresContext& aPresContext, const nsHTMLReflowState& aReflowState, nsSize& aSize) { - if (aReflowState.HaveConstrainedWidth()) { + if (aReflowState.HaveFixedContentWidth()) { aSize.width = aReflowState.minWidth; } else { aSize.width = CSS_NOTSET; } - if (aReflowState.HaveConstrainedHeight()) { + if (aReflowState.HaveFixedContentHeight()) { aSize.height = aReflowState.minHeight; } else { diff --git a/layout/html/forms/src/nsHTMLButtonControlFrame.cpp b/layout/html/forms/src/nsHTMLButtonControlFrame.cpp index 7ec02b2899ca..bec2beb88822 100644 --- a/layout/html/forms/src/nsHTMLButtonControlFrame.cpp +++ b/layout/html/forms/src/nsHTMLButtonControlFrame.cpp @@ -650,10 +650,10 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext& aPresContext, } // if we are constrained and the child is smaller, use the constrained values - if (aReflowState.HaveConstrainedWidth() && (aDesiredSize.width < aReflowState.minWidth)) { + if (aReflowState.HaveFixedContentWidth() && (aDesiredSize.width < aReflowState.minWidth)) { aDesiredSize.width = aReflowState.minWidth; } - if (aReflowState.HaveConstrainedHeight() && (aDesiredSize.height < aReflowState.minHeight)) { + if (aReflowState.HaveFixedContentHeight() && (aDesiredSize.height < aReflowState.minHeight)) { aDesiredSize.height = aReflowState.minHeight; } diff --git a/layout/html/forms/src/nsLabelFrame.cpp b/layout/html/forms/src/nsLabelFrame.cpp index 62d5f44e8e3e..4c86d2a64b9a 100644 --- a/layout/html/forms/src/nsLabelFrame.cpp +++ b/layout/html/forms/src/nsLabelFrame.cpp @@ -493,10 +493,10 @@ nsLabelFrame::Reflow(nsIPresContext& aPresContext, } // if we are constrained and the child is smaller, use the constrained values - if (aReflowState.HaveConstrainedWidth() && (aDesiredSize.width < aReflowState.minWidth)) { + if (aReflowState.HaveFixedContentWidth() && (aDesiredSize.width < aReflowState.minWidth)) { aDesiredSize.width = aReflowState.minWidth; } - if (aReflowState.HaveConstrainedHeight() && (aDesiredSize.height < aReflowState.minHeight)) { + if (aReflowState.HaveFixedContentHeight() && (aDesiredSize.height < aReflowState.minHeight)) { aDesiredSize.height = aReflowState.minHeight; } diff --git a/layout/html/forms/src/nsLegendFrame.cpp b/layout/html/forms/src/nsLegendFrame.cpp index 9606a51dcda5..b8eef87220c1 100644 --- a/layout/html/forms/src/nsLegendFrame.cpp +++ b/layout/html/forms/src/nsLegendFrame.cpp @@ -146,12 +146,12 @@ nsLegendFrame::Reflow(nsIPresContext& aPresContext, // add in our border and padding to the size of the child aDesiredSize.width += borderPadding.left + borderPadding.right; - if (aReflowState.HaveConstrainedWidth() && (aReflowState.minWidth > aDesiredSize.width)) { + if (aReflowState.HaveFixedContentWidth() && (aReflowState.minWidth > aDesiredSize.width)) { aDesiredSize.width = aReflowState.minWidth; } aDesiredSize.height += borderPadding.top + borderPadding.bottom; - if (aReflowState.HaveConstrainedHeight() && (aReflowState.minHeight > aDesiredSize.height)) { + if (aReflowState.HaveFixedContentHeight() && (aReflowState.minHeight > aDesiredSize.height)) { aDesiredSize.height = aReflowState.minHeight; } diff --git a/layout/html/style/src/nsHTMLStyleSheet.cpp b/layout/html/style/src/nsHTMLStyleSheet.cpp index f7b65301b423..36b6f6a66a5d 100644 --- a/layout/html/style/src/nsHTMLStyleSheet.cpp +++ b/layout/html/style/src/nsHTMLStyleSheet.cpp @@ -1443,21 +1443,13 @@ PRBool HTMLStyleSheetImpl::IsScrollable(nsIFrame* aFrame, const nsStyleDisplay* aDisplay) { - // If the overflow property is scroll then it's scrollable regardless - // of whether the content overflows the block. - // XXX This isn't correct. Only do this if the height is not allowed to - // grow to accomodate its child frames... - if (NS_STYLE_OVERFLOW_SCROLL == aDisplay->mOverflow) { + // For the time being it's scrollable if the overflow property is auto or + // scroll, regardless of whether the width or height is fixed in size + if ((NS_STYLE_OVERFLOW_SCROLL == aDisplay->mOverflow) || + (NS_STYLE_OVERFLOW_AUTO == aDisplay->mOverflow)) { return PR_TRUE; } -#if 0 - if ((NS_STYLE_OVERFLOW_SCROLL == aDisplay->mOverflow) || - // If the element has a fixed height (it isn't auto) and an overflow - // property of scroll or auto, then it's potentially scrollable. - // XXX Deal with width considerations, too - (NS_STYLE_OVERFLOW_AUTO == aDisplay->mOverflow)) { -#endif return PR_FALSE; } diff --git a/layout/style/nsHTMLStyleSheet.cpp b/layout/style/nsHTMLStyleSheet.cpp index f7b65301b423..36b6f6a66a5d 100644 --- a/layout/style/nsHTMLStyleSheet.cpp +++ b/layout/style/nsHTMLStyleSheet.cpp @@ -1443,21 +1443,13 @@ PRBool HTMLStyleSheetImpl::IsScrollable(nsIFrame* aFrame, const nsStyleDisplay* aDisplay) { - // If the overflow property is scroll then it's scrollable regardless - // of whether the content overflows the block. - // XXX This isn't correct. Only do this if the height is not allowed to - // grow to accomodate its child frames... - if (NS_STYLE_OVERFLOW_SCROLL == aDisplay->mOverflow) { + // For the time being it's scrollable if the overflow property is auto or + // scroll, regardless of whether the width or height is fixed in size + if ((NS_STYLE_OVERFLOW_SCROLL == aDisplay->mOverflow) || + (NS_STYLE_OVERFLOW_AUTO == aDisplay->mOverflow)) { return PR_TRUE; } -#if 0 - if ((NS_STYLE_OVERFLOW_SCROLL == aDisplay->mOverflow) || - // If the element has a fixed height (it isn't auto) and an overflow - // property of scroll or auto, then it's potentially scrollable. - // XXX Deal with width considerations, too - (NS_STYLE_OVERFLOW_AUTO == aDisplay->mOverflow)) { -#endif return PR_FALSE; } diff --git a/layout/style/ua.css b/layout/style/ua.css index fa84b85ed0e0..5a2b70344997 100644 --- a/layout/style/ua.css +++ b/layout/style/ua.css @@ -27,7 +27,7 @@ BODY { line-height: normal; //XXX not yet... margin: 8px; padding: 8px; - overflow: scroll; + overflow: auto; } FRAMESET {