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,
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;
}

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

@ -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;

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

@ -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 {

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

@ -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;
}

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

@ -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;
}

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

@ -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 {

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

@ -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 {

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

@ -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 {

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

@ -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 {

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

@ -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;

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

@ -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;
}

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

@ -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 {

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

@ -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 {

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

@ -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 {

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

@ -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;
}

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

@ -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;

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

@ -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 {

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

@ -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:

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

@ -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;

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

@ -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) {

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

@ -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;
}

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

@ -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;

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

@ -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 {

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

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

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

@ -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;

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

@ -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 {

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

@ -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;
}

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

@ -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;
}

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

@ -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;
}

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

@ -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;
}

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

@ -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;
}

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

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