Renamed HaveConstrainedWidth() and HaveConstrainedHeight() to HaveFixedContentWidth()

and HaveFixedContentHeight()
This commit is contained in:
troy%netscape.com 1998-11-01 01:29:00 +00:00
Родитель 384b8c7c1c
Коммит fe4e76d9d9
32 изменённых файлов: 129 добавлений и 169 удалений

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

@ -1443,21 +1443,13 @@ PRBool
HTMLStyleSheetImpl::IsScrollable(nsIFrame* aFrame, HTMLStyleSheetImpl::IsScrollable(nsIFrame* aFrame,
const nsStyleDisplay* aDisplay) const nsStyleDisplay* aDisplay)
{ {
// If the overflow property is scroll then it's scrollable regardless // For the time being it's scrollable if the overflow property is auto or
// of whether the content overflows the block. // scroll, regardless of whether the width or height is fixed in size
// XXX This isn't correct. Only do this if the height is not allowed to if ((NS_STYLE_OVERFLOW_SCROLL == aDisplay->mOverflow) ||
// grow to accomodate its child frames... (NS_STYLE_OVERFLOW_AUTO == aDisplay->mOverflow)) {
if (NS_STYLE_OVERFLOW_SCROLL == aDisplay->mOverflow) {
return PR_TRUE; 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; return PR_FALSE;
} }

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

@ -266,7 +266,7 @@ nsFieldSetFrame::Reflow(nsIPresContext& aPresContext,
nscoord horTaken = borderPadding.left + borderPadding.right + (2 * minTopBorder) + nscoord horTaken = borderPadding.left + borderPadding.right + (2 * minTopBorder) +
legendMargin.left + legendMargin.right; legendMargin.left + legendMargin.right;
nscoord verTaken = padding.top + borderPadding.bottom + legendMargin.top + legendMargin.bottom; nscoord verTaken = padding.top + borderPadding.bottom + legendMargin.top + legendMargin.bottom;
if (aReflowState.HaveConstrainedWidth()) { if (aReflowState.HaveFixedContentWidth()) {
availSize.width = aReflowState.minWidth; availSize.width = aReflowState.minWidth;
} }
else { else {
@ -347,7 +347,7 @@ nsFieldSetFrame::Reflow(nsIPresContext& aPresContext,
nscoord contentWidth = contentSize.width + borderPadding.left + borderPadding.right; nscoord contentWidth = contentSize.width + borderPadding.left + borderPadding.right;
aDesiredSize.width = (legendWidth > contentWidth) ? legendWidth : contentWidth; aDesiredSize.width = (legendWidth > contentWidth) ? legendWidth : contentWidth;
if (aReflowState.HaveConstrainedWidth() && (aReflowState.minWidth > aDesiredSize.width)) { if (aReflowState.HaveFixedContentWidth() && (aReflowState.minWidth > aDesiredSize.width)) {
aDesiredSize.width = aReflowState.minWidth; aDesiredSize.width = aReflowState.minWidth;
} }
@ -410,7 +410,7 @@ nsFieldSetFrame::Reflow(nsIPresContext& aPresContext,
aDesiredSize.height = contentTopOffset + contentSize.height + borderPadding.bottom; aDesiredSize.height = contentTopOffset + contentSize.height + borderPadding.bottom;
if (mInline) // XXX parents don't yet ...... if (mInline) // XXX parents don't yet ......
aDesiredSize.height += margin.bottom; aDesiredSize.height += margin.bottom;
if (aReflowState.HaveConstrainedHeight() && (aReflowState.minHeight > aDesiredSize.height)) { if (aReflowState.HaveFixedContentHeight() && (aReflowState.minHeight > aDesiredSize.height)) {
aDesiredSize.height = aReflowState.minHeight; aDesiredSize.height = aReflowState.minHeight;
} }
aDesiredSize.ascent = aDesiredSize.height; aDesiredSize.ascent = aDesiredSize.height;

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

@ -582,13 +582,13 @@ nsFormControlFrame::GetStyleSize(nsIPresContext& aPresContext,
const nsHTMLReflowState& aReflowState, const nsHTMLReflowState& aReflowState,
nsSize& aSize) nsSize& aSize)
{ {
if (aReflowState.HaveConstrainedWidth()) { if (aReflowState.HaveFixedContentWidth()) {
aSize.width = aReflowState.minWidth; aSize.width = aReflowState.minWidth;
} }
else { else {
aSize.width = CSS_NOTSET; aSize.width = CSS_NOTSET;
} }
if (aReflowState.HaveConstrainedHeight()) { if (aReflowState.HaveFixedContentHeight()) {
aSize.height = aReflowState.minHeight; aSize.height = aReflowState.minHeight;
} }
else { else {

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

@ -650,10 +650,10 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext& aPresContext,
} }
// if we are constrained and the child is smaller, use the constrained values // 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; aDesiredSize.width = aReflowState.minWidth;
} }
if (aReflowState.HaveConstrainedHeight() && (aDesiredSize.height < aReflowState.minHeight)) { if (aReflowState.HaveFixedContentHeight() && (aDesiredSize.height < aReflowState.minHeight)) {
aDesiredSize.height = aReflowState.minHeight; aDesiredSize.height = aReflowState.minHeight;
} }

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

@ -146,12 +146,12 @@ nsLegendFrame::Reflow(nsIPresContext& aPresContext,
// add in our border and padding to the size of the child // add in our border and padding to the size of the child
aDesiredSize.width += borderPadding.left + borderPadding.right; 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.width = aReflowState.minWidth;
} }
aDesiredSize.height += borderPadding.top + borderPadding.bottom; aDesiredSize.height += borderPadding.top + borderPadding.bottom;
if (aReflowState.HaveConstrainedHeight() && (aReflowState.minHeight > aDesiredSize.height)) { if (aReflowState.HaveFixedContentHeight() && (aReflowState.minHeight > aDesiredSize.height)) {
aDesiredSize.height = aReflowState.minHeight; aDesiredSize.height = aReflowState.minHeight;
} }

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

@ -1366,7 +1366,7 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext,
nscoord lr = mBorderPadding.left + mBorderPadding.right; nscoord lr = mBorderPadding.left + mBorderPadding.right;
mY = mBorderPadding.top; mY = mBorderPadding.top;
if (eHTMLFrameConstraint_Unconstrained != widthConstraint) { if (eHTMLFrameConstraint_FixedContent == widthConstraint) {
// The CSS2 spec says that the width attribute defines the width // The CSS2 spec says that the width attribute defines the width
// of the "content area" which does not include the border // of the "content area" which does not include the border
// padding. So we add those back in. // padding. So we add those back in.
@ -1879,7 +1879,7 @@ nsBlockFrame::ComputeFinalSize(nsBlockReflowState& aState,
nsHTMLReflowMetrics& aMetrics) nsHTMLReflowMetrics& aMetrics)
{ {
// Compute final width // Compute final width
if (eHTMLFrameConstraint_Unconstrained != aState.widthConstraint) { if (eHTMLFrameConstraint_FixedContent == aState.widthConstraint) {
// Use style defined width // Use style defined width
aMetrics.width = aState.mBorderPadding.left + aMetrics.width = aState.mBorderPadding.left +
aState.minWidth + aState.mBorderPadding.right; aState.minWidth + aState.mBorderPadding.right;
@ -1899,7 +1899,7 @@ nsBlockFrame::ComputeFinalSize(nsBlockReflowState& aState,
} }
// Compute final height // Compute final height
if (eHTMLFrameConstraint_Unconstrained != aState.heightConstraint) { if (eHTMLFrameConstraint_FixedContent == aState.heightConstraint) {
// Use style defined height // Use style defined height
aMetrics.height = aState.mBorderPadding.top + aMetrics.height = aState.mBorderPadding.top +
aState.minHeight + aState.mBorderPadding.bottom; aState.minHeight + aState.mBorderPadding.bottom;
@ -4162,8 +4162,8 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext,
// If either dimension is constrained then get the border and // If either dimension is constrained then get the border and
// padding values in advance. // padding values in advance.
nsMargin bp(0, 0, 0, 0); nsMargin bp(0, 0, 0, 0);
if (reflowState.HaveConstrainedWidth() || if (reflowState.HaveFixedContentWidth() ||
reflowState.HaveConstrainedHeight()) { reflowState.HaveFixedContentHeight()) {
const nsStyleSpacing* spacing; const nsStyleSpacing* spacing;
if (NS_OK == aFloaterFrame->GetStyleData(eStyleStruct_Spacing, if (NS_OK == aFloaterFrame->GetStyleData(eStyleStruct_Spacing,
(const nsStyleStruct*&)spacing)) { (const nsStyleStruct*&)spacing)) {
@ -4172,7 +4172,7 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext,
} }
// Compute the available width for the floater // Compute the available width for the floater
if (reflowState.HaveConstrainedWidth()) { if (reflowState.HaveFixedContentWidth()) {
// When the floater has a contrained width, give it just enough // When the floater has a contrained width, give it just enough
// space for its styled width plus its borders and paddings. // space for its styled width plus its borders and paddings.
kidAvailSize.width = reflowState.minWidth + bp.left + bp.right; kidAvailSize.width = reflowState.minWidth + bp.left + bp.right;
@ -4184,7 +4184,7 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext,
const nsHTMLReflowState* rsp = &aState; const nsHTMLReflowState* rsp = &aState;
kidAvailSize.width = 0; kidAvailSize.width = 0;
while (nsnull != rsp) { while (nsnull != rsp) {
if (eHTMLFrameConstraint_Unconstrained != rsp->widthConstraint) { if (eHTMLFrameConstraint_FixedContent == rsp->widthConstraint) {
kidAvailSize.width = rsp->minWidth; kidAvailSize.width = rsp->minWidth;
break; break;
} }
@ -4200,7 +4200,7 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext,
} }
// Compute the available height for the floater // Compute the available height for the floater
if (reflowState.HaveConstrainedHeight()) { if (reflowState.HaveFixedContentHeight()) {
kidAvailSize.height = reflowState.minHeight + bp.top + bp.bottom; kidAvailSize.height = reflowState.minHeight + bp.top + bp.bottom;
} }
else { else {

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

@ -1366,7 +1366,7 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext,
nscoord lr = mBorderPadding.left + mBorderPadding.right; nscoord lr = mBorderPadding.left + mBorderPadding.right;
mY = mBorderPadding.top; mY = mBorderPadding.top;
if (eHTMLFrameConstraint_Unconstrained != widthConstraint) { if (eHTMLFrameConstraint_FixedContent == widthConstraint) {
// The CSS2 spec says that the width attribute defines the width // The CSS2 spec says that the width attribute defines the width
// of the "content area" which does not include the border // of the "content area" which does not include the border
// padding. So we add those back in. // padding. So we add those back in.
@ -1879,7 +1879,7 @@ nsBlockFrame::ComputeFinalSize(nsBlockReflowState& aState,
nsHTMLReflowMetrics& aMetrics) nsHTMLReflowMetrics& aMetrics)
{ {
// Compute final width // Compute final width
if (eHTMLFrameConstraint_Unconstrained != aState.widthConstraint) { if (eHTMLFrameConstraint_FixedContent == aState.widthConstraint) {
// Use style defined width // Use style defined width
aMetrics.width = aState.mBorderPadding.left + aMetrics.width = aState.mBorderPadding.left +
aState.minWidth + aState.mBorderPadding.right; aState.minWidth + aState.mBorderPadding.right;
@ -1899,7 +1899,7 @@ nsBlockFrame::ComputeFinalSize(nsBlockReflowState& aState,
} }
// Compute final height // Compute final height
if (eHTMLFrameConstraint_Unconstrained != aState.heightConstraint) { if (eHTMLFrameConstraint_FixedContent == aState.heightConstraint) {
// Use style defined height // Use style defined height
aMetrics.height = aState.mBorderPadding.top + aMetrics.height = aState.mBorderPadding.top +
aState.minHeight + aState.mBorderPadding.bottom; aState.minHeight + aState.mBorderPadding.bottom;
@ -4162,8 +4162,8 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext,
// If either dimension is constrained then get the border and // If either dimension is constrained then get the border and
// padding values in advance. // padding values in advance.
nsMargin bp(0, 0, 0, 0); nsMargin bp(0, 0, 0, 0);
if (reflowState.HaveConstrainedWidth() || if (reflowState.HaveFixedContentWidth() ||
reflowState.HaveConstrainedHeight()) { reflowState.HaveFixedContentHeight()) {
const nsStyleSpacing* spacing; const nsStyleSpacing* spacing;
if (NS_OK == aFloaterFrame->GetStyleData(eStyleStruct_Spacing, if (NS_OK == aFloaterFrame->GetStyleData(eStyleStruct_Spacing,
(const nsStyleStruct*&)spacing)) { (const nsStyleStruct*&)spacing)) {
@ -4172,7 +4172,7 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext,
} }
// Compute the available width for the floater // Compute the available width for the floater
if (reflowState.HaveConstrainedWidth()) { if (reflowState.HaveFixedContentWidth()) {
// When the floater has a contrained width, give it just enough // When the floater has a contrained width, give it just enough
// space for its styled width plus its borders and paddings. // space for its styled width plus its borders and paddings.
kidAvailSize.width = reflowState.minWidth + bp.left + bp.right; kidAvailSize.width = reflowState.minWidth + bp.left + bp.right;
@ -4184,7 +4184,7 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext,
const nsHTMLReflowState* rsp = &aState; const nsHTMLReflowState* rsp = &aState;
kidAvailSize.width = 0; kidAvailSize.width = 0;
while (nsnull != rsp) { while (nsnull != rsp) {
if (eHTMLFrameConstraint_Unconstrained != rsp->widthConstraint) { if (eHTMLFrameConstraint_FixedContent == rsp->widthConstraint) {
kidAvailSize.width = rsp->minWidth; kidAvailSize.width = rsp->minWidth;
break; break;
} }
@ -4200,7 +4200,7 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext,
} }
// Compute the available height for the floater // Compute the available height for the floater
if (reflowState.HaveConstrainedHeight()) { if (reflowState.HaveFixedContentHeight()) {
kidAvailSize.height = reflowState.minHeight + bp.top + bp.bottom; kidAvailSize.height = reflowState.minHeight + bp.top + bp.bottom;
} }
else { else {

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

@ -1366,7 +1366,7 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext,
nscoord lr = mBorderPadding.left + mBorderPadding.right; nscoord lr = mBorderPadding.left + mBorderPadding.right;
mY = mBorderPadding.top; mY = mBorderPadding.top;
if (eHTMLFrameConstraint_Unconstrained != widthConstraint) { if (eHTMLFrameConstraint_FixedContent == widthConstraint) {
// The CSS2 spec says that the width attribute defines the width // The CSS2 spec says that the width attribute defines the width
// of the "content area" which does not include the border // of the "content area" which does not include the border
// padding. So we add those back in. // padding. So we add those back in.
@ -1879,7 +1879,7 @@ nsBlockFrame::ComputeFinalSize(nsBlockReflowState& aState,
nsHTMLReflowMetrics& aMetrics) nsHTMLReflowMetrics& aMetrics)
{ {
// Compute final width // Compute final width
if (eHTMLFrameConstraint_Unconstrained != aState.widthConstraint) { if (eHTMLFrameConstraint_FixedContent == aState.widthConstraint) {
// Use style defined width // Use style defined width
aMetrics.width = aState.mBorderPadding.left + aMetrics.width = aState.mBorderPadding.left +
aState.minWidth + aState.mBorderPadding.right; aState.minWidth + aState.mBorderPadding.right;
@ -1899,7 +1899,7 @@ nsBlockFrame::ComputeFinalSize(nsBlockReflowState& aState,
} }
// Compute final height // Compute final height
if (eHTMLFrameConstraint_Unconstrained != aState.heightConstraint) { if (eHTMLFrameConstraint_FixedContent == aState.heightConstraint) {
// Use style defined height // Use style defined height
aMetrics.height = aState.mBorderPadding.top + aMetrics.height = aState.mBorderPadding.top +
aState.minHeight + aState.mBorderPadding.bottom; aState.minHeight + aState.mBorderPadding.bottom;
@ -4162,8 +4162,8 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext,
// If either dimension is constrained then get the border and // If either dimension is constrained then get the border and
// padding values in advance. // padding values in advance.
nsMargin bp(0, 0, 0, 0); nsMargin bp(0, 0, 0, 0);
if (reflowState.HaveConstrainedWidth() || if (reflowState.HaveFixedContentWidth() ||
reflowState.HaveConstrainedHeight()) { reflowState.HaveFixedContentHeight()) {
const nsStyleSpacing* spacing; const nsStyleSpacing* spacing;
if (NS_OK == aFloaterFrame->GetStyleData(eStyleStruct_Spacing, if (NS_OK == aFloaterFrame->GetStyleData(eStyleStruct_Spacing,
(const nsStyleStruct*&)spacing)) { (const nsStyleStruct*&)spacing)) {
@ -4172,7 +4172,7 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext,
} }
// Compute the available width for the floater // Compute the available width for the floater
if (reflowState.HaveConstrainedWidth()) { if (reflowState.HaveFixedContentWidth()) {
// When the floater has a contrained width, give it just enough // When the floater has a contrained width, give it just enough
// space for its styled width plus its borders and paddings. // space for its styled width plus its borders and paddings.
kidAvailSize.width = reflowState.minWidth + bp.left + bp.right; kidAvailSize.width = reflowState.minWidth + bp.left + bp.right;
@ -4184,7 +4184,7 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext,
const nsHTMLReflowState* rsp = &aState; const nsHTMLReflowState* rsp = &aState;
kidAvailSize.width = 0; kidAvailSize.width = 0;
while (nsnull != rsp) { while (nsnull != rsp) {
if (eHTMLFrameConstraint_Unconstrained != rsp->widthConstraint) { if (eHTMLFrameConstraint_FixedContent == rsp->widthConstraint) {
kidAvailSize.width = rsp->minWidth; kidAvailSize.width = rsp->minWidth;
break; break;
} }
@ -4200,7 +4200,7 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext,
} }
// Compute the available height for the floater // Compute the available height for the floater
if (reflowState.HaveConstrainedHeight()) { if (reflowState.HaveFixedContentHeight()) {
kidAvailSize.height = reflowState.minHeight + bp.top + bp.bottom; kidAvailSize.height = reflowState.minHeight + bp.top + bp.bottom;
} }
else { else {

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

@ -240,13 +240,13 @@ nsHTMLFrameOuterFrame::GetDesiredSize(nsIPresContext* aPresContext,
float p2t = aPresContext->GetPixelsToTwips(); float p2t = aPresContext->GetPixelsToTwips();
// XXX this needs to be changed from (200,200) to a better default for inline frames // 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; aDesiredSize.width = aReflowState.minWidth;
} }
else { else {
aDesiredSize.width = NSIntPixelsToTwips(200, p2t); aDesiredSize.width = NSIntPixelsToTwips(200, p2t);
} }
if (aReflowState.HaveConstrainedHeight()) { if (aReflowState.HaveFixedContentHeight()) {
aDesiredSize.height = aReflowState.minHeight; aDesiredSize.height = aReflowState.minHeight;
} }
else { else {

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

@ -273,13 +273,14 @@ nsHTMLImageLoader::GetDesiredSize(nsIPresContext* aPresContext,
// Start the image loading // Start the image loading
PRIntn loadStatus; PRIntn loadStatus;
StartLoadImage(aPresContext, aTargetFrame, aCallBack, StartLoadImage(aPresContext, aTargetFrame, aCallBack,
!aReflowState.HaveConstrainedWidthAndHeight(), !(aReflowState.HaveFixedContentWidth() && aReflowState.HaveFixedContentHeight()),
loadStatus); loadStatus);
// Choose reflow size // Choose reflow size
if (aReflowState.HaveConstrainedWidth() || if (aReflowState.HaveFixedContentWidth() ||
aReflowState.HaveConstrainedHeight()) { aReflowState.HaveFixedContentHeight()) {
if (aReflowState.HaveConstrainedWidthAndHeight()) { if (aReflowState.HaveFixedContentWidth() &&
aReflowState.HaveFixedContentHeight()) {
// The image is fully constrained. Use the constraints directly. // The image is fully constrained. Use the constraints directly.
aDesiredSize.width = aReflowState.minWidth; aDesiredSize.width = aReflowState.minWidth;
aDesiredSize.height = aReflowState.minHeight; aDesiredSize.height = aReflowState.minHeight;
@ -301,7 +302,7 @@ nsHTMLImageLoader::GetDesiredSize(nsIPresContext* aPresContext,
float imageWidth = imageSize.width * p2t; float imageWidth = imageSize.width * p2t;
float imageHeight = imageSize.height * p2t; float imageHeight = imageSize.height * p2t;
if (0.0f != imageHeight) { if (0.0f != imageHeight) {
if (aReflowState.HaveConstrainedWidth()) { if (aReflowState.HaveFixedContentWidth()) {
// We have a width, and an auto height. Compute height // We have a width, and an auto height. Compute height
// from width. // from width.
aDesiredSize.width = aReflowState.minWidth; aDesiredSize.width = aReflowState.minWidth;

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

@ -302,11 +302,11 @@ nsObjectFrame::GetDesiredSize(nsIPresContext* aPresContext,
// Determine our size stylistically // Determine our size stylistically
PRBool haveWidth = PR_FALSE; PRBool haveWidth = PR_FALSE;
PRBool haveHeight = PR_FALSE; PRBool haveHeight = PR_FALSE;
if (aReflowState.HaveConstrainedWidth()) { if (aReflowState.HaveFixedContentWidth()) {
aMetrics.width = aReflowState.minWidth; aMetrics.width = aReflowState.minWidth;
haveWidth = PR_TRUE; haveWidth = PR_TRUE;
} }
if (aReflowState.HaveConstrainedHeight()) { if (aReflowState.HaveFixedContentHeight()) {
aMetrics.height = aReflowState.minHeight; aMetrics.height = aReflowState.minHeight;
haveHeight = PR_TRUE; haveHeight = PR_TRUE;
} }

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

@ -1366,7 +1366,7 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext,
nscoord lr = mBorderPadding.left + mBorderPadding.right; nscoord lr = mBorderPadding.left + mBorderPadding.right;
mY = mBorderPadding.top; mY = mBorderPadding.top;
if (eHTMLFrameConstraint_Unconstrained != widthConstraint) { if (eHTMLFrameConstraint_FixedContent == widthConstraint) {
// The CSS2 spec says that the width attribute defines the width // The CSS2 spec says that the width attribute defines the width
// of the "content area" which does not include the border // of the "content area" which does not include the border
// padding. So we add those back in. // padding. So we add those back in.
@ -1879,7 +1879,7 @@ nsBlockFrame::ComputeFinalSize(nsBlockReflowState& aState,
nsHTMLReflowMetrics& aMetrics) nsHTMLReflowMetrics& aMetrics)
{ {
// Compute final width // Compute final width
if (eHTMLFrameConstraint_Unconstrained != aState.widthConstraint) { if (eHTMLFrameConstraint_FixedContent == aState.widthConstraint) {
// Use style defined width // Use style defined width
aMetrics.width = aState.mBorderPadding.left + aMetrics.width = aState.mBorderPadding.left +
aState.minWidth + aState.mBorderPadding.right; aState.minWidth + aState.mBorderPadding.right;
@ -1899,7 +1899,7 @@ nsBlockFrame::ComputeFinalSize(nsBlockReflowState& aState,
} }
// Compute final height // Compute final height
if (eHTMLFrameConstraint_Unconstrained != aState.heightConstraint) { if (eHTMLFrameConstraint_FixedContent == aState.heightConstraint) {
// Use style defined height // Use style defined height
aMetrics.height = aState.mBorderPadding.top + aMetrics.height = aState.mBorderPadding.top +
aState.minHeight + aState.mBorderPadding.bottom; aState.minHeight + aState.mBorderPadding.bottom;
@ -4162,8 +4162,8 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext,
// If either dimension is constrained then get the border and // If either dimension is constrained then get the border and
// padding values in advance. // padding values in advance.
nsMargin bp(0, 0, 0, 0); nsMargin bp(0, 0, 0, 0);
if (reflowState.HaveConstrainedWidth() || if (reflowState.HaveFixedContentWidth() ||
reflowState.HaveConstrainedHeight()) { reflowState.HaveFixedContentHeight()) {
const nsStyleSpacing* spacing; const nsStyleSpacing* spacing;
if (NS_OK == aFloaterFrame->GetStyleData(eStyleStruct_Spacing, if (NS_OK == aFloaterFrame->GetStyleData(eStyleStruct_Spacing,
(const nsStyleStruct*&)spacing)) { (const nsStyleStruct*&)spacing)) {
@ -4172,7 +4172,7 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext,
} }
// Compute the available width for the floater // Compute the available width for the floater
if (reflowState.HaveConstrainedWidth()) { if (reflowState.HaveFixedContentWidth()) {
// When the floater has a contrained width, give it just enough // When the floater has a contrained width, give it just enough
// space for its styled width plus its borders and paddings. // space for its styled width plus its borders and paddings.
kidAvailSize.width = reflowState.minWidth + bp.left + bp.right; kidAvailSize.width = reflowState.minWidth + bp.left + bp.right;
@ -4184,7 +4184,7 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext,
const nsHTMLReflowState* rsp = &aState; const nsHTMLReflowState* rsp = &aState;
kidAvailSize.width = 0; kidAvailSize.width = 0;
while (nsnull != rsp) { while (nsnull != rsp) {
if (eHTMLFrameConstraint_Unconstrained != rsp->widthConstraint) { if (eHTMLFrameConstraint_FixedContent == rsp->widthConstraint) {
kidAvailSize.width = rsp->minWidth; kidAvailSize.width = rsp->minWidth;
break; break;
} }
@ -4200,7 +4200,7 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext,
} }
// Compute the available height for the floater // Compute the available height for the floater
if (reflowState.HaveConstrainedHeight()) { if (reflowState.HaveFixedContentHeight()) {
kidAvailSize.height = reflowState.minHeight + bp.top + bp.bottom; kidAvailSize.height = reflowState.minHeight + bp.top + bp.bottom;
} }
else { else {

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

@ -1366,7 +1366,7 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext,
nscoord lr = mBorderPadding.left + mBorderPadding.right; nscoord lr = mBorderPadding.left + mBorderPadding.right;
mY = mBorderPadding.top; mY = mBorderPadding.top;
if (eHTMLFrameConstraint_Unconstrained != widthConstraint) { if (eHTMLFrameConstraint_FixedContent == widthConstraint) {
// The CSS2 spec says that the width attribute defines the width // The CSS2 spec says that the width attribute defines the width
// of the "content area" which does not include the border // of the "content area" which does not include the border
// padding. So we add those back in. // padding. So we add those back in.
@ -1879,7 +1879,7 @@ nsBlockFrame::ComputeFinalSize(nsBlockReflowState& aState,
nsHTMLReflowMetrics& aMetrics) nsHTMLReflowMetrics& aMetrics)
{ {
// Compute final width // Compute final width
if (eHTMLFrameConstraint_Unconstrained != aState.widthConstraint) { if (eHTMLFrameConstraint_FixedContent == aState.widthConstraint) {
// Use style defined width // Use style defined width
aMetrics.width = aState.mBorderPadding.left + aMetrics.width = aState.mBorderPadding.left +
aState.minWidth + aState.mBorderPadding.right; aState.minWidth + aState.mBorderPadding.right;
@ -1899,7 +1899,7 @@ nsBlockFrame::ComputeFinalSize(nsBlockReflowState& aState,
} }
// Compute final height // Compute final height
if (eHTMLFrameConstraint_Unconstrained != aState.heightConstraint) { if (eHTMLFrameConstraint_FixedContent == aState.heightConstraint) {
// Use style defined height // Use style defined height
aMetrics.height = aState.mBorderPadding.top + aMetrics.height = aState.mBorderPadding.top +
aState.minHeight + aState.mBorderPadding.bottom; aState.minHeight + aState.mBorderPadding.bottom;
@ -4162,8 +4162,8 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext,
// If either dimension is constrained then get the border and // If either dimension is constrained then get the border and
// padding values in advance. // padding values in advance.
nsMargin bp(0, 0, 0, 0); nsMargin bp(0, 0, 0, 0);
if (reflowState.HaveConstrainedWidth() || if (reflowState.HaveFixedContentWidth() ||
reflowState.HaveConstrainedHeight()) { reflowState.HaveFixedContentHeight()) {
const nsStyleSpacing* spacing; const nsStyleSpacing* spacing;
if (NS_OK == aFloaterFrame->GetStyleData(eStyleStruct_Spacing, if (NS_OK == aFloaterFrame->GetStyleData(eStyleStruct_Spacing,
(const nsStyleStruct*&)spacing)) { (const nsStyleStruct*&)spacing)) {
@ -4172,7 +4172,7 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext,
} }
// Compute the available width for the floater // Compute the available width for the floater
if (reflowState.HaveConstrainedWidth()) { if (reflowState.HaveFixedContentWidth()) {
// When the floater has a contrained width, give it just enough // When the floater has a contrained width, give it just enough
// space for its styled width plus its borders and paddings. // space for its styled width plus its borders and paddings.
kidAvailSize.width = reflowState.minWidth + bp.left + bp.right; kidAvailSize.width = reflowState.minWidth + bp.left + bp.right;
@ -4184,7 +4184,7 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext,
const nsHTMLReflowState* rsp = &aState; const nsHTMLReflowState* rsp = &aState;
kidAvailSize.width = 0; kidAvailSize.width = 0;
while (nsnull != rsp) { while (nsnull != rsp) {
if (eHTMLFrameConstraint_Unconstrained != rsp->widthConstraint) { if (eHTMLFrameConstraint_FixedContent == rsp->widthConstraint) {
kidAvailSize.width = rsp->minWidth; kidAvailSize.width = rsp->minWidth;
break; break;
} }
@ -4200,7 +4200,7 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext,
} }
// Compute the available height for the floater // Compute the available height for the floater
if (reflowState.HaveConstrainedHeight()) { if (reflowState.HaveFixedContentHeight()) {
kidAvailSize.height = reflowState.minHeight + bp.top + bp.bottom; kidAvailSize.height = reflowState.minHeight + bp.top + bp.bottom;
} }
else { else {

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

@ -1366,7 +1366,7 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext,
nscoord lr = mBorderPadding.left + mBorderPadding.right; nscoord lr = mBorderPadding.left + mBorderPadding.right;
mY = mBorderPadding.top; mY = mBorderPadding.top;
if (eHTMLFrameConstraint_Unconstrained != widthConstraint) { if (eHTMLFrameConstraint_FixedContent == widthConstraint) {
// The CSS2 spec says that the width attribute defines the width // The CSS2 spec says that the width attribute defines the width
// of the "content area" which does not include the border // of the "content area" which does not include the border
// padding. So we add those back in. // padding. So we add those back in.
@ -1879,7 +1879,7 @@ nsBlockFrame::ComputeFinalSize(nsBlockReflowState& aState,
nsHTMLReflowMetrics& aMetrics) nsHTMLReflowMetrics& aMetrics)
{ {
// Compute final width // Compute final width
if (eHTMLFrameConstraint_Unconstrained != aState.widthConstraint) { if (eHTMLFrameConstraint_FixedContent == aState.widthConstraint) {
// Use style defined width // Use style defined width
aMetrics.width = aState.mBorderPadding.left + aMetrics.width = aState.mBorderPadding.left +
aState.minWidth + aState.mBorderPadding.right; aState.minWidth + aState.mBorderPadding.right;
@ -1899,7 +1899,7 @@ nsBlockFrame::ComputeFinalSize(nsBlockReflowState& aState,
} }
// Compute final height // Compute final height
if (eHTMLFrameConstraint_Unconstrained != aState.heightConstraint) { if (eHTMLFrameConstraint_FixedContent == aState.heightConstraint) {
// Use style defined height // Use style defined height
aMetrics.height = aState.mBorderPadding.top + aMetrics.height = aState.mBorderPadding.top +
aState.minHeight + aState.mBorderPadding.bottom; aState.minHeight + aState.mBorderPadding.bottom;
@ -4162,8 +4162,8 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext,
// If either dimension is constrained then get the border and // If either dimension is constrained then get the border and
// padding values in advance. // padding values in advance.
nsMargin bp(0, 0, 0, 0); nsMargin bp(0, 0, 0, 0);
if (reflowState.HaveConstrainedWidth() || if (reflowState.HaveFixedContentWidth() ||
reflowState.HaveConstrainedHeight()) { reflowState.HaveFixedContentHeight()) {
const nsStyleSpacing* spacing; const nsStyleSpacing* spacing;
if (NS_OK == aFloaterFrame->GetStyleData(eStyleStruct_Spacing, if (NS_OK == aFloaterFrame->GetStyleData(eStyleStruct_Spacing,
(const nsStyleStruct*&)spacing)) { (const nsStyleStruct*&)spacing)) {
@ -4172,7 +4172,7 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext,
} }
// Compute the available width for the floater // Compute the available width for the floater
if (reflowState.HaveConstrainedWidth()) { if (reflowState.HaveFixedContentWidth()) {
// When the floater has a contrained width, give it just enough // When the floater has a contrained width, give it just enough
// space for its styled width plus its borders and paddings. // space for its styled width plus its borders and paddings.
kidAvailSize.width = reflowState.minWidth + bp.left + bp.right; kidAvailSize.width = reflowState.minWidth + bp.left + bp.right;
@ -4184,7 +4184,7 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext,
const nsHTMLReflowState* rsp = &aState; const nsHTMLReflowState* rsp = &aState;
kidAvailSize.width = 0; kidAvailSize.width = 0;
while (nsnull != rsp) { while (nsnull != rsp) {
if (eHTMLFrameConstraint_Unconstrained != rsp->widthConstraint) { if (eHTMLFrameConstraint_FixedContent == rsp->widthConstraint) {
kidAvailSize.width = rsp->minWidth; kidAvailSize.width = rsp->minWidth;
break; break;
} }
@ -4200,7 +4200,7 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext,
} }
// Compute the available height for the floater // Compute the available height for the floater
if (reflowState.HaveConstrainedHeight()) { if (reflowState.HaveFixedContentHeight()) {
kidAvailSize.height = reflowState.minHeight + bp.top + bp.bottom; kidAvailSize.height = reflowState.minHeight + bp.top + bp.bottom;
} }
else { else {

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

@ -616,11 +616,11 @@ nsBodyFrame::GetColumnAvailSpace(nsIPresContext& aPresContext,
} }
} }
else { else {
if (aReflowState.HaveConstrainedWidth()) { if (aReflowState.HaveFixedContentWidth()) {
result.width = aReflowState.minWidth + result.width = aReflowState.minWidth +
aBorderPadding.left + aBorderPadding.right; aBorderPadding.left + aBorderPadding.right;
} }
if (aReflowState.HaveConstrainedHeight()) { if (aReflowState.HaveFixedContentHeight()) {
result.height -= aBorderPadding.top + aBorderPadding.bottom; result.height -= aBorderPadding.top + aBorderPadding.bottom;
} }
} }
@ -628,10 +628,10 @@ nsBodyFrame::GetColumnAvailSpace(nsIPresContext& aPresContext,
NS_FRAME_TRACE_MSG(NS_FRAME_TRACE_CALLS, NS_FRAME_TRACE_MSG(NS_FRAME_TRACE_CALLS,
(": nsBodyFrame: columnAvailSpace=%d,%d [%s,%s]\n", (": nsBodyFrame: columnAvailSpace=%d,%d [%s,%s]\n",
result.width, result.height, result.width, result.height,
aReflowState.HaveConstrainedWidth() eHTMLFrameConstraint_Unconstrained == aReflowState.widthConstraint
? "constrained" : "not-constrained", ? "not-constrained" : "constrained",
aReflowState.HaveConstrainedHeight() eHTMLFrameConstraint_Unconstrained == aReflowState.heightConstraint
? "constrained" : "not-constrained")); ? "not-constrained" : "constrained"));
return result; return result;
} }
@ -669,7 +669,7 @@ 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
if (aReflowState.HaveConstrainedWidth()) { if (aReflowState.HaveFixedContentWidth()) {
width = aReflowState.minWidth + aBorderPadding.left + aBorderPadding.right; width = aReflowState.minWidth + aBorderPadding.left + aBorderPadding.right;
} }
else { else {
@ -681,7 +681,7 @@ nsBodyFrame::ComputeDesiredSize(nsIPresContext& aPresContext,
} }
} }
} }
if (aReflowState.HaveConstrainedHeight()) { if (aReflowState.HaveFixedContentHeight()) {
height = aReflowState.minHeight + height = aReflowState.minHeight +
aBorderPadding.top + aBorderPadding.bottom; aBorderPadding.top + aBorderPadding.bottom;
} }

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

@ -107,9 +107,6 @@ nsHTMLReflowState::DetermineFrameType(nsIPresContext& aPresContext)
void void
nsHTMLReflowState::InitConstraints(nsIPresContext& aPresContext) 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 // Determine whether the values are constrained or unconstrained
// by looking at the maxSize // by looking at the maxSize
widthConstraint = NS_UNCONSTRAINEDSIZE == maxSize.width ? widthConstraint = NS_UNCONSTRAINEDSIZE == maxSize.width ?
@ -118,11 +115,6 @@ nsHTMLReflowState::InitConstraints(nsIPresContext& aPresContext)
heightConstraint = NS_UNCONSTRAINEDSIZE == maxSize.height ? heightConstraint = NS_UNCONSTRAINEDSIZE == maxSize.height ?
eHTMLFrameConstraint_Unconstrained : eHTMLFrameConstraint_Unconstrained :
eHTMLFrameConstraint_Constrained; eHTMLFrameConstraint_Constrained;
#else
// Assume that the values are unconstrained
widthConstraint = eHTMLFrameConstraint_Unconstrained;
heightConstraint = eHTMLFrameConstraint_Unconstrained;
#endif
minWidth = 0; minWidth = 0;
minHeight = 0; minHeight = 0;

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

@ -223,7 +223,7 @@ HRuleFrame::Reflow(nsIPresContext& aPresContext,
// otherwise tables behave badly. This makes sense they are springy. // otherwise tables behave badly. This makes sense they are springy.
if (nsnull != aDesiredSize.maxElementSize) { if (nsnull != aDesiredSize.maxElementSize) {
nscoord onePixel = NSIntPixelsToTwips(1, aPresContext.GetPixelsToTwips()); nscoord onePixel = NSIntPixelsToTwips(1, aPresContext.GetPixelsToTwips());
if (aReflowState.HaveConstrainedWidth()) { if (aReflowState.HaveFixedContentWidth()) {
aDesiredSize.maxElementSize->width = aReflowState.minWidth; aDesiredSize.maxElementSize->width = aReflowState.minWidth;
aDesiredSize.maxElementSize->height = onePixel; aDesiredSize.maxElementSize->height = onePixel;
} }
@ -242,7 +242,7 @@ HRuleFrame::GetDesiredSize(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState, const nsHTMLReflowState& aReflowState,
nsHTMLReflowMetrics& aDesiredSize) nsHTMLReflowMetrics& aDesiredSize)
{ {
if (aReflowState.HaveConstrainedWidth()) { if (aReflowState.HaveFixedContentWidth()) {
aDesiredSize.width = aReflowState.minWidth; aDesiredSize.width = aReflowState.minWidth;
} }
else { else {

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

@ -208,16 +208,12 @@ struct nsHTMLReflowState : nsReflowState {
const nsSize& aMaxSize, const nsSize& aMaxSize,
nsReflowReason aReflowReason); nsReflowReason aReflowReason);
PRBool HaveConstrainedWidth() const { PRBool HaveFixedContentWidth() const {
return eHTMLFrameConstraint_Unconstrained != widthConstraint; return eHTMLFrameConstraint_FixedContent == widthConstraint;
} }
PRBool HaveConstrainedHeight() const { PRBool HaveFixedContentHeight() const {
return eHTMLFrameConstraint_Unconstrained != heightConstraint; return eHTMLFrameConstraint_FixedContent == heightConstraint;
}
PRBool HaveConstrainedWidthAndHeight() const {
return HaveConstrainedWidth() && HaveConstrainedHeight();
} }
protected: protected:

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

@ -273,13 +273,14 @@ nsHTMLImageLoader::GetDesiredSize(nsIPresContext* aPresContext,
// Start the image loading // Start the image loading
PRIntn loadStatus; PRIntn loadStatus;
StartLoadImage(aPresContext, aTargetFrame, aCallBack, StartLoadImage(aPresContext, aTargetFrame, aCallBack,
!aReflowState.HaveConstrainedWidthAndHeight(), !(aReflowState.HaveFixedContentWidth() && aReflowState.HaveFixedContentHeight()),
loadStatus); loadStatus);
// Choose reflow size // Choose reflow size
if (aReflowState.HaveConstrainedWidth() || if (aReflowState.HaveFixedContentWidth() ||
aReflowState.HaveConstrainedHeight()) { aReflowState.HaveFixedContentHeight()) {
if (aReflowState.HaveConstrainedWidthAndHeight()) { if (aReflowState.HaveFixedContentWidth() &&
aReflowState.HaveFixedContentHeight()) {
// The image is fully constrained. Use the constraints directly. // The image is fully constrained. Use the constraints directly.
aDesiredSize.width = aReflowState.minWidth; aDesiredSize.width = aReflowState.minWidth;
aDesiredSize.height = aReflowState.minHeight; aDesiredSize.height = aReflowState.minHeight;
@ -301,7 +302,7 @@ nsHTMLImageLoader::GetDesiredSize(nsIPresContext* aPresContext,
float imageWidth = imageSize.width * p2t; float imageWidth = imageSize.width * p2t;
float imageHeight = imageSize.height * p2t; float imageHeight = imageSize.height * p2t;
if (0.0f != imageHeight) { if (0.0f != imageHeight) {
if (aReflowState.HaveConstrainedWidth()) { if (aReflowState.HaveFixedContentWidth()) {
// We have a width, and an auto height. Compute height // We have a width, and an auto height. Compute height
// from width. // from width.
aDesiredSize.width = aReflowState.minWidth; aDesiredSize.width = aReflowState.minWidth;

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

@ -353,7 +353,7 @@ nsInlineReflow::ApplyTopLeftMargins()
} }
else if (eStyleUnit_Percent == unit) { else if (eStyleUnit_Percent == unit) {
nscoord width; nscoord width;
if (mOuterReflowState.HaveConstrainedWidth()) { if (mOuterReflowState.HaveFixedContentWidth()) {
width = mOuterReflowState.minWidth; width = mOuterReflowState.minWidth;
} }
else if (NS_UNCONSTRAINEDSIZE == mOuterReflowState.maxSize.width) { else if (NS_UNCONSTRAINEDSIZE == mOuterReflowState.maxSize.width) {

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

@ -302,11 +302,11 @@ nsObjectFrame::GetDesiredSize(nsIPresContext* aPresContext,
// Determine our size stylistically // Determine our size stylistically
PRBool haveWidth = PR_FALSE; PRBool haveWidth = PR_FALSE;
PRBool haveHeight = PR_FALSE; PRBool haveHeight = PR_FALSE;
if (aReflowState.HaveConstrainedWidth()) { if (aReflowState.HaveFixedContentWidth()) {
aMetrics.width = aReflowState.minWidth; aMetrics.width = aReflowState.minWidth;
haveWidth = PR_TRUE; haveWidth = PR_TRUE;
} }
if (aReflowState.HaveConstrainedHeight()) { if (aReflowState.HaveFixedContentHeight()) {
aMetrics.height = aReflowState.minHeight; aMetrics.height = aReflowState.minHeight;
haveHeight = PR_TRUE; haveHeight = PR_TRUE;
} }

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

@ -187,12 +187,10 @@ nsScrollFrame::CreateScrollingView()
view->QueryInterface(kScrollViewIID, (void**)&scrollingView); view->QueryInterface(kScrollViewIID, (void**)&scrollingView);
// Set the scroll prefrence // Set the scroll prefrence
#if 0
nsScrollPreference scrollPref = (NS_STYLE_OVERFLOW_SCROLL == display->mOverflow) nsScrollPreference scrollPref = (NS_STYLE_OVERFLOW_SCROLL == display->mOverflow)
? nsScrollPreference_kAlwaysScroll : ? nsScrollPreference_kAlwaysScroll :
nsScrollPreference_kAuto; nsScrollPreference_kAuto;
scrollingView->SetScrollPreference(scrollPref); scrollingView->SetScrollPreference(scrollPref);
#endif
// Set the scrolling view's insets to whatever our border is // Set the scrolling view's insets to whatever our border is
nsMargin border; nsMargin border;
@ -291,7 +289,8 @@ nsScrollFrame::Reflow(nsIPresContext& aPresContext,
// Compute the scroll area size. This is the area inside of our border edge // Compute the scroll area size. This is the area inside of our border edge
// and inside of any vertical and horizontal scrollbars // and inside of any vertical and horizontal scrollbars
nsSize scrollAreaSize; 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 // The reflow state width reflects space for the content area only, so don't
// subtract for borders... // subtract for borders...
scrollAreaSize.width = aReflowState.minWidth; 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 // The reflow state height reflects space for the content area only, so don't
// subtract for borders... // subtract for borders...
scrollAreaSize.height = aReflowState.minHeight; scrollAreaSize.height = aReflowState.minHeight;
@ -322,13 +322,11 @@ nsScrollFrame::Reflow(nsIPresContext& aPresContext,
if (eHTMLFrameConstraint_Fixed == aReflowState.heightConstraint) { if (eHTMLFrameConstraint_Fixed == aReflowState.heightConstraint) {
scrollAreaSize.height -= border.top + border.bottom; scrollAreaSize.height -= border.top + border.bottom;
#if 0
// If scrollbars are always visible then subtract for the // If scrollbars are always visible then subtract for the
// height of the horizontal scrollbar // height of the horizontal scrollbar
if (NS_STYLE_OVERFLOW_SCROLL == display->mOverflow) { if (NS_STYLE_OVERFLOW_SCROLL == display->mOverflow) {
scrollAreaSize.height -= NSToCoordRound(sbHeight); scrollAreaSize.height -= NSToCoordRound(sbHeight);
} }
#endif
} }
} }
else { else {
@ -338,13 +336,11 @@ nsScrollFrame::Reflow(nsIPresContext& aPresContext,
// The height is constrained so subtract for borders // The height is constrained so subtract for borders
scrollAreaSize.height -= border.top + border.bottom; scrollAreaSize.height -= border.top + border.bottom;
#if 0
// If scrollbars are always visible then subtract for the // If scrollbars are always visible then subtract for the
// height of the horizontal scrollbar // height of the horizontal scrollbar
if (NS_STYLE_OVERFLOW_SCROLL == display->mOverflow) { if (NS_STYLE_OVERFLOW_SCROLL == display->mOverflow) {
scrollAreaSize.height -= NSToCoordRound(sbHeight); scrollAreaSize.height -= NSToCoordRound(sbHeight);
} }
#endif
} }
} }
//@ Make me a subroutine... //@ Make me a subroutine...
@ -361,7 +357,8 @@ nsScrollFrame::Reflow(nsIPresContext& aPresContext,
// Make sure the scrolled frame fills the entire scroll area along a // Make sure the scrolled frame fills the entire scroll area along a
// fixed dimension // fixed dimension
if ((eHTMLFrameConstraint_Fixed == aReflowState.heightConstraint) || aReflowState.HaveConstrainedHeight()) { if ((eHTMLFrameConstraint_Fixed == aReflowState.heightConstraint) ||
(eHTMLFrameConstraint_FixedContent == aReflowState.heightConstraint)) {
if (kidDesiredSize.height < scrollAreaSize.height) { if (kidDesiredSize.height < scrollAreaSize.height) {
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 // If the scrollbars are auto and the scrolled frame is fully visible
// vertically then the vertical scrollbar will be hidden so increase the // vertically then the vertical scrollbar will be hidden so increase the
// width of the scrolled frame // width of the scrolled frame
#if 0
if (NS_STYLE_OVERFLOW_AUTO == display->mOverflow) { if (NS_STYLE_OVERFLOW_AUTO == display->mOverflow) {
#endif
kidDesiredSize.width += NSToCoordRound(sbWidth); 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) { if (kidDesiredSize.width < scrollAreaSize.width) {
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; // Compute our desired size. If our size was fixed then use the fixed size;
// otherwise, shrink wrap around the scrolled frame // 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; aDesiredSize.width = scrollAreaSize.width;
} else { } else {
aDesiredSize.width = kidDesiredSize.width; aDesiredSize.width = kidDesiredSize.width;
} }
aDesiredSize.width += border.left + border.right + NSToCoordRound(sbWidth); 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; aDesiredSize.height = scrollAreaSize.height;
} else { } else {
aDesiredSize.height = kidDesiredSize.height; aDesiredSize.height = kidDesiredSize.height;
} }
aDesiredSize.height += border.top + border.bottom; aDesiredSize.height += border.top + border.bottom;
#if 0
// XXX This should really be "if we have a visible horizontal scrollbar"... // XXX This should really be "if we have a visible horizontal scrollbar"...
if (NS_STYLE_OVERFLOW_SCROLL == display->mOverflow) { if (NS_STYLE_OVERFLOW_SCROLL == display->mOverflow) {
aDesiredSize.height += NSToCoordRound(sbHeight); aDesiredSize.height += NSToCoordRound(sbHeight);
} }
#endif
aDesiredSize.ascent = aDesiredSize.height; aDesiredSize.ascent = aDesiredSize.height;
aDesiredSize.descent = 0; aDesiredSize.descent = 0;

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

@ -240,13 +240,13 @@ nsHTMLFrameOuterFrame::GetDesiredSize(nsIPresContext* aPresContext,
float p2t = aPresContext->GetPixelsToTwips(); float p2t = aPresContext->GetPixelsToTwips();
// XXX this needs to be changed from (200,200) to a better default for inline frames // 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; aDesiredSize.width = aReflowState.minWidth;
} }
else { else {
aDesiredSize.width = NSIntPixelsToTwips(200, p2t); aDesiredSize.width = NSIntPixelsToTwips(200, p2t);
} }
if (aReflowState.HaveConstrainedHeight()) { if (aReflowState.HaveFixedContentHeight()) {
aDesiredSize.height = aReflowState.minHeight; aDesiredSize.height = aReflowState.minHeight;
} }
else { else {

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

@ -27,7 +27,7 @@ BODY {
line-height: normal; line-height: normal;
//XXX not yet... margin: 8px; //XXX not yet... margin: 8px;
padding: 8px; padding: 8px;
overflow: scroll; overflow: auto;
} }
FRAMESET { FRAMESET {

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

@ -266,7 +266,7 @@ nsFieldSetFrame::Reflow(nsIPresContext& aPresContext,
nscoord horTaken = borderPadding.left + borderPadding.right + (2 * minTopBorder) + nscoord horTaken = borderPadding.left + borderPadding.right + (2 * minTopBorder) +
legendMargin.left + legendMargin.right; legendMargin.left + legendMargin.right;
nscoord verTaken = padding.top + borderPadding.bottom + legendMargin.top + legendMargin.bottom; nscoord verTaken = padding.top + borderPadding.bottom + legendMargin.top + legendMargin.bottom;
if (aReflowState.HaveConstrainedWidth()) { if (aReflowState.HaveFixedContentWidth()) {
availSize.width = aReflowState.minWidth; availSize.width = aReflowState.minWidth;
} }
else { else {
@ -347,7 +347,7 @@ nsFieldSetFrame::Reflow(nsIPresContext& aPresContext,
nscoord contentWidth = contentSize.width + borderPadding.left + borderPadding.right; nscoord contentWidth = contentSize.width + borderPadding.left + borderPadding.right;
aDesiredSize.width = (legendWidth > contentWidth) ? legendWidth : contentWidth; aDesiredSize.width = (legendWidth > contentWidth) ? legendWidth : contentWidth;
if (aReflowState.HaveConstrainedWidth() && (aReflowState.minWidth > aDesiredSize.width)) { if (aReflowState.HaveFixedContentWidth() && (aReflowState.minWidth > aDesiredSize.width)) {
aDesiredSize.width = aReflowState.minWidth; aDesiredSize.width = aReflowState.minWidth;
} }
@ -410,7 +410,7 @@ nsFieldSetFrame::Reflow(nsIPresContext& aPresContext,
aDesiredSize.height = contentTopOffset + contentSize.height + borderPadding.bottom; aDesiredSize.height = contentTopOffset + contentSize.height + borderPadding.bottom;
if (mInline) // XXX parents don't yet ...... if (mInline) // XXX parents don't yet ......
aDesiredSize.height += margin.bottom; aDesiredSize.height += margin.bottom;
if (aReflowState.HaveConstrainedHeight() && (aReflowState.minHeight > aDesiredSize.height)) { if (aReflowState.HaveFixedContentHeight() && (aReflowState.minHeight > aDesiredSize.height)) {
aDesiredSize.height = aReflowState.minHeight; aDesiredSize.height = aReflowState.minHeight;
} }
aDesiredSize.ascent = aDesiredSize.height; aDesiredSize.ascent = aDesiredSize.height;

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

@ -582,13 +582,13 @@ nsFormControlFrame::GetStyleSize(nsIPresContext& aPresContext,
const nsHTMLReflowState& aReflowState, const nsHTMLReflowState& aReflowState,
nsSize& aSize) nsSize& aSize)
{ {
if (aReflowState.HaveConstrainedWidth()) { if (aReflowState.HaveFixedContentWidth()) {
aSize.width = aReflowState.minWidth; aSize.width = aReflowState.minWidth;
} }
else { else {
aSize.width = CSS_NOTSET; aSize.width = CSS_NOTSET;
} }
if (aReflowState.HaveConstrainedHeight()) { if (aReflowState.HaveFixedContentHeight()) {
aSize.height = aReflowState.minHeight; aSize.height = aReflowState.minHeight;
} }
else { else {

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

@ -650,10 +650,10 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext& aPresContext,
} }
// if we are constrained and the child is smaller, use the constrained values // 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; aDesiredSize.width = aReflowState.minWidth;
} }
if (aReflowState.HaveConstrainedHeight() && (aDesiredSize.height < aReflowState.minHeight)) { if (aReflowState.HaveFixedContentHeight() && (aDesiredSize.height < aReflowState.minHeight)) {
aDesiredSize.height = aReflowState.minHeight; aDesiredSize.height = aReflowState.minHeight;
} }

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

@ -493,10 +493,10 @@ nsLabelFrame::Reflow(nsIPresContext& aPresContext,
} }
// if we are constrained and the child is smaller, use the constrained values // 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; aDesiredSize.width = aReflowState.minWidth;
} }
if (aReflowState.HaveConstrainedHeight() && (aDesiredSize.height < aReflowState.minHeight)) { if (aReflowState.HaveFixedContentHeight() && (aDesiredSize.height < aReflowState.minHeight)) {
aDesiredSize.height = aReflowState.minHeight; aDesiredSize.height = aReflowState.minHeight;
} }

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

@ -146,12 +146,12 @@ nsLegendFrame::Reflow(nsIPresContext& aPresContext,
// add in our border and padding to the size of the child // add in our border and padding to the size of the child
aDesiredSize.width += borderPadding.left + borderPadding.right; 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.width = aReflowState.minWidth;
} }
aDesiredSize.height += borderPadding.top + borderPadding.bottom; aDesiredSize.height += borderPadding.top + borderPadding.bottom;
if (aReflowState.HaveConstrainedHeight() && (aReflowState.minHeight > aDesiredSize.height)) { if (aReflowState.HaveFixedContentHeight() && (aReflowState.minHeight > aDesiredSize.height)) {
aDesiredSize.height = aReflowState.minHeight; aDesiredSize.height = aReflowState.minHeight;
} }

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

@ -1443,21 +1443,13 @@ PRBool
HTMLStyleSheetImpl::IsScrollable(nsIFrame* aFrame, HTMLStyleSheetImpl::IsScrollable(nsIFrame* aFrame,
const nsStyleDisplay* aDisplay) const nsStyleDisplay* aDisplay)
{ {
// If the overflow property is scroll then it's scrollable regardless // For the time being it's scrollable if the overflow property is auto or
// of whether the content overflows the block. // scroll, regardless of whether the width or height is fixed in size
// XXX This isn't correct. Only do this if the height is not allowed to if ((NS_STYLE_OVERFLOW_SCROLL == aDisplay->mOverflow) ||
// grow to accomodate its child frames... (NS_STYLE_OVERFLOW_AUTO == aDisplay->mOverflow)) {
if (NS_STYLE_OVERFLOW_SCROLL == aDisplay->mOverflow) {
return PR_TRUE; 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; return PR_FALSE;
} }

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

@ -1443,21 +1443,13 @@ PRBool
HTMLStyleSheetImpl::IsScrollable(nsIFrame* aFrame, HTMLStyleSheetImpl::IsScrollable(nsIFrame* aFrame,
const nsStyleDisplay* aDisplay) const nsStyleDisplay* aDisplay)
{ {
// If the overflow property is scroll then it's scrollable regardless // For the time being it's scrollable if the overflow property is auto or
// of whether the content overflows the block. // scroll, regardless of whether the width or height is fixed in size
// XXX This isn't correct. Only do this if the height is not allowed to if ((NS_STYLE_OVERFLOW_SCROLL == aDisplay->mOverflow) ||
// grow to accomodate its child frames... (NS_STYLE_OVERFLOW_AUTO == aDisplay->mOverflow)) {
if (NS_STYLE_OVERFLOW_SCROLL == aDisplay->mOverflow) {
return PR_TRUE; 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; return PR_FALSE;
} }

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

@ -27,7 +27,7 @@ BODY {
line-height: normal; line-height: normal;
//XXX not yet... margin: 8px; //XXX not yet... margin: 8px;
padding: 8px; padding: 8px;
overflow: scroll; overflow: auto;
} }
FRAMESET { FRAMESET {