From 343ced44bae079dccf5418d33bfa424caab22cbd Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Fri, 26 Jan 2007 00:05:12 +0000 Subject: [PATCH] Make mComputedWidth private, with a getter/setter, and make the setter update the resize flags. Bug 367442, r+sr=dbaron git-svn-id: svn://10.0.0.236/trunk@218933 18797224-902f-48f8-a5cc-f745e15eee43 --- .../layout/forms/nsComboboxControlFrame.cpp | 35 ++++++------------- mozilla/layout/forms/nsFieldSetFrame.cpp | 12 +++---- .../layout/forms/nsHTMLButtonControlFrame.cpp | 8 ++--- mozilla/layout/forms/nsListControlFrame.cpp | 2 +- .../generic/nsAbsoluteContainingBlock.cpp | 6 ++-- mozilla/layout/generic/nsBlockFrame.cpp | 16 ++++----- .../layout/generic/nsBlockReflowContext.cpp | 10 +++--- mozilla/layout/generic/nsBlockReflowState.cpp | 4 +-- mozilla/layout/generic/nsColumnSetFrame.cpp | 12 +++---- mozilla/layout/generic/nsFrame.cpp | 21 +++++------ mozilla/layout/generic/nsGfxScrollFrame.cpp | 4 +-- mozilla/layout/generic/nsHTMLCanvasFrame.cpp | 2 +- mozilla/layout/generic/nsHTMLReflowState.cpp | 14 ++++++++ mozilla/layout/generic/nsHTMLReflowState.h | 5 +++ mozilla/layout/generic/nsImageFrame.cpp | 12 +++---- mozilla/layout/generic/nsLeafFrame.cpp | 4 +-- mozilla/layout/generic/nsObjectFrame.cpp | 2 +- .../layout/generic/nsSimplePageSequence.cpp | 2 +- mozilla/layout/generic/nsViewportFrame.cpp | 5 +-- .../base/src/nsMathMLContainerFrame.cpp | 2 +- .../mathml/base/src/nsMathMLTokenFrame.cpp | 2 +- .../mathml/base/src/nsMathMLmactionFrame.cpp | 3 +- .../mathml/base/src/nsMathMLmfencedFrame.cpp | 2 +- .../mathml/base/src/nsMathMLmrootFrame.cpp | 2 +- .../svg/base/src/nsSVGOuterSVGFrame.cpp | 8 ++--- .../tables/BasicTableLayoutStrategy.cpp | 2 +- .../tables/FixedTableLayoutStrategy.cpp | 2 +- mozilla/layout/tables/nsTableFrame.cpp | 8 ++--- mozilla/layout/tables/nsTableOuterFrame.cpp | 10 +++--- mozilla/layout/tables/nsTableRowFrame.cpp | 10 +++--- mozilla/layout/xul/base/src/nsBoxFrame.cpp | 6 ++-- .../layout/xul/base/src/nsLeafBoxFrame.cpp | 8 ++--- 32 files changed, 124 insertions(+), 117 deletions(-) diff --git a/mozilla/layout/forms/nsComboboxControlFrame.cpp b/mozilla/layout/forms/nsComboboxControlFrame.cpp index bd1f5348377..b3f3ee36529 100644 --- a/mozilla/layout/forms/nsComboboxControlFrame.cpp +++ b/mozilla/layout/forms/nsComboboxControlFrame.cpp @@ -256,22 +256,6 @@ static PRInt32 gReflowInx = -1; #define PX(__v) __v #endif -//------------------------------------------ -// Asserts if we return a desired size that -// doesn't correctly match the mComputedWidth -//------------------------------------------ -#ifdef DO_UNCONSTRAINED_CHECK -#define UNCONSTRAINED_CHECK() \ -if (aReflowState.mComputedWidth != NS_UNCONSTRAINEDSIZE) { \ - nscoord width = aDesiredSize.width - borderPadding.left - borderPadding.right; \ - if (width != aReflowState.mComputedWidth) { \ - printf("aDesiredSize.width %d %d != aReflowState.mComputedWidth %d\n", aDesiredSize.width, width, aReflowState.mComputedWidth); \ - } \ - NS_ASSERTION(width == aReflowState.mComputedWidth, "Returning bad value when constrained!"); \ -} -#else -#define UNCONSTRAINED_CHECK() -#endif //------------------------------------------------------ //-- Done with macros //------------------------------------------------------ @@ -479,11 +463,11 @@ nsComboboxControlFrame::ReflowDropdown(nsPresContext* aPresContext, // If the dropdown's intrinsic width is narrower than our specified width, // then expand it out. We want our border-box width to end up the same as // the dropdown's so account for both sets of mComputedBorderPadding. - nscoord forcedWidth = aReflowState.mComputedWidth + + nscoord forcedWidth = aReflowState.ComputedWidth() + aReflowState.mComputedBorderPadding.LeftRight() - kidReflowState.mComputedBorderPadding.LeftRight(); - kidReflowState.mComputedWidth = PR_MAX(kidReflowState.mComputedWidth, - forcedWidth); + kidReflowState.SetComputedWidth(PR_MAX(kidReflowState.ComputedWidth(), + forcedWidth)); // ensure we start off hidden if (GetStateBits() & NS_FRAME_FIRST_REFLOW) { @@ -670,11 +654,11 @@ nsComboboxControlFrame::Reflow(nsPresContext* aPresContext, nsBoxLayoutState bls(GetPresContext(), aReflowState.rendContext); nscoord buttonWidth = scrollable->GetDesiredScrollbarSizes(&bls).LeftRight(); - if (buttonWidth > aReflowState.mComputedWidth) { + if (buttonWidth > aReflowState.ComputedWidth()) { buttonWidth = 0; } - mDisplayWidth = aReflowState.mComputedWidth - buttonWidth; + mDisplayWidth = aReflowState.ComputedWidth() - buttonWidth; nsresult rv = nsAreaFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus); @@ -1125,11 +1109,12 @@ nsComboboxDisplayFrame::Reflow(nsPresContext* aPresContext, // rows look like, for lack of anything better. state.mComputedHeight = mComboBox->mListControlFrame->GetHeightOfARow(); } - state.mComputedWidth = mComboBox->mDisplayWidth - - state.mComputedBorderPadding.LeftRight(); - if (state.mComputedWidth < 0) { - state.mComputedWidth = 0; + nscoord computedWidth = mComboBox->mDisplayWidth - + state.mComputedBorderPadding.LeftRight(); + if (computedWidth < 0) { + computedWidth = 0; } + state.SetComputedWidth(computedWidth); return nsBlockFrame::Reflow(aPresContext, aDesiredSize, state, aStatus); } diff --git a/mozilla/layout/forms/nsFieldSetFrame.cpp b/mozilla/layout/forms/nsFieldSetFrame.cpp index e2bc4eecbb8..c4d08d17dc6 100644 --- a/mozilla/layout/forms/nsFieldSetFrame.cpp +++ b/mozilla/layout/forms/nsFieldSetFrame.cpp @@ -445,7 +445,7 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext, DO_GLOBAL_REFLOW_COUNT("nsFieldSetFrame"); DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus); - NS_PRECONDITION(aReflowState.mComputedWidth != NS_INTRINSICSIZE, + NS_PRECONDITION(aReflowState.ComputedWidth() != NS_INTRINSICSIZE, "Should have a precomputed width!"); // Initialize OUT parameter @@ -468,7 +468,7 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext, (NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN)) != 0; } - nsSize availSize(aReflowState.mComputedWidth, aReflowState.availableHeight); + nsSize availSize(aReflowState.ComputedWidth(), aReflowState.availableHeight); NS_ASSERTION(!mContentFrame || GetContentMinWidth(aReflowState.rendContext) <= availSize.width, "Bogus availSize.width; should be bigger"); @@ -495,8 +495,8 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext, legendAvailSize); // always give the legend as much size as it wants - legendReflowState.mComputedWidth = - mLegendFrame->GetPrefWidth(aReflowState.rendContext); + legendReflowState. + SetComputedWidth(mLegendFrame->GetPrefWidth(aReflowState.rendContext)); legendReflowState.mComputedHeight = NS_INTRINSICSIZE; nsHTMLReflowMetrics legendDesiredSize; @@ -583,8 +583,8 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext, } // use the computed width if the inner content does not fill it - if (aReflowState.mComputedWidth > contentRect.width) { - contentRect.width = aReflowState.mComputedWidth; + if (aReflowState.ComputedWidth() > contentRect.width) { + contentRect.width = aReflowState.ComputedWidth(); } if (mLegendFrame) { diff --git a/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp b/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp index 8a04fbfa41e..3b4df035f74 100644 --- a/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp +++ b/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp @@ -297,7 +297,7 @@ nsHTMLButtonControlFrame::Reflow(nsPresContext* aPresContext, DO_GLOBAL_REFLOW_COUNT("nsHTMLButtonControlFrame"); DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus); - NS_PRECONDITION(aReflowState.mComputedWidth != NS_INTRINSICSIZE, + NS_PRECONDITION(aReflowState.ComputedWidth() != NS_INTRINSICSIZE, "Should have real computed width by now"); if (mState & NS_FRAME_FIRST_REFLOW) { @@ -319,7 +319,7 @@ nsHTMLButtonControlFrame::Reflow(nsPresContext* aPresContext, ReflowButtonContents(aPresContext, aDesiredSize, aReflowState, firstKid, focusPadding, aStatus); - aDesiredSize.width = aReflowState.mComputedWidth; + aDesiredSize.width = aReflowState.ComputedWidth(); // If computed use the computed value. if (aReflowState.mComputedHeight != NS_INTRINSICSIZE) @@ -361,7 +361,7 @@ nsHTMLButtonControlFrame::ReflowButtonContents(nsPresContext* aPresContext, nsMargin aFocusPadding, nsReflowStatus& aStatus) { - nsSize availSize(aReflowState.mComputedWidth, NS_INTRINSICSIZE); + nsSize availSize(aReflowState.ComputedWidth(), NS_INTRINSICSIZE); // Indent the child inside us by the focus border. We must do this separate // from the regular border. @@ -374,7 +374,7 @@ nsHTMLButtonControlFrame::ReflowButtonContents(nsPresContext* aPresContext, // offset to allow the kid to spill left into our padding. nscoord xoffset = aFocusPadding.left + aReflowState.mComputedBorderPadding.left; nscoord extrawidth = DoGetMinWidth(aReflowState.rendContext, PR_FALSE) - - aReflowState.mComputedWidth; + aReflowState.ComputedWidth(); if (extrawidth > 0) { nscoord extraleft = extrawidth / 2; nscoord extraright = extrawidth - extraleft; diff --git a/mozilla/layout/forms/nsListControlFrame.cpp b/mozilla/layout/forms/nsListControlFrame.cpp index 4adeaf1990d..c0e9599eb72 100644 --- a/mozilla/layout/forms/nsListControlFrame.cpp +++ b/mozilla/layout/forms/nsListControlFrame.cpp @@ -526,7 +526,7 @@ nsListControlFrame::Reflow(nsPresContext* aPresContext, const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus) { - NS_PRECONDITION(aReflowState.mComputedWidth != NS_UNCONSTRAINEDSIZE, + NS_PRECONDITION(aReflowState.ComputedWidth() != NS_UNCONSTRAINEDSIZE, "Must have a computed width"); // If all the content and frames are here diff --git a/mozilla/layout/generic/nsAbsoluteContainingBlock.cpp b/mozilla/layout/generic/nsAbsoluteContainingBlock.cpp index 481ce2b676f..11e7fd75066 100644 --- a/mozilla/layout/generic/nsAbsoluteContainingBlock.cpp +++ b/mozilla/layout/generic/nsAbsoluteContainingBlock.cpp @@ -334,7 +334,7 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat PrettyUC(aReflowState.availableWidth, width); PrettyUC(aReflowState.availableHeight, height); printf(" a=%s,%s ", width, height); - PrettyUC(aReflowState.mComputedWidth, width); + PrettyUC(aReflowState.ComputedWidth(), width); PrettyUC(aReflowState.mComputedHeight, height); printf("c=%s,%s \n", width, height); } @@ -347,10 +347,10 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat nscoord availWidth = aContainingBlockWidth; if (availWidth == -1) { - NS_ASSERTION(aReflowState.mComputedWidth != NS_UNCONSTRAINEDSIZE, + NS_ASSERTION(aReflowState.ComputedWidth() != NS_UNCONSTRAINEDSIZE, "Must have a useful width _somewhere_"); availWidth = - aReflowState.mComputedWidth + aReflowState.mComputedPadding.LeftRight(); + aReflowState.ComputedWidth() + aReflowState.mComputedPadding.LeftRight(); } nsHTMLReflowMetrics kidDesiredSize; diff --git a/mozilla/layout/generic/nsBlockFrame.cpp b/mozilla/layout/generic/nsBlockFrame.cpp index 1b5d8f1b402..b5f2083eae8 100644 --- a/mozilla/layout/generic/nsBlockFrame.cpp +++ b/mozilla/layout/generic/nsBlockFrame.cpp @@ -787,9 +787,9 @@ CalculateContainingBlockSizeForAbsolutes(const nsHTMLReflowState& aReflowState, } // We found a reflow state for the outermost wrapping frame, so use // its computed metrics if available - if (aLastRS->mComputedWidth != NS_UNCONSTRAINEDSIZE) { + if (aLastRS->ComputedWidth() != NS_UNCONSTRAINEDSIZE) { cbSize.width = PR_MAX(0, - aLastRS->mComputedWidth + aLastRS->mComputedPadding.LeftRight() - scrollbars.LeftRight()); + aLastRS->ComputedWidth() + aLastRS->mComputedPadding.LeftRight() - scrollbars.LeftRight()); } if (aLastRS->mComputedHeight != NS_UNCONSTRAINEDSIZE) { cbSize.height = PR_MAX(0, @@ -815,7 +815,7 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext, ListTag(stdout); printf(": begin reflow availSize=%d,%d computedSize=%d,%d\n", aReflowState.availableWidth, aReflowState.availableHeight, - aReflowState.mComputedWidth, aReflowState.mComputedHeight); + aReflowState.ComputedWidth(), aReflowState.mComputedHeight); } AutoNoisyIndenter indent(gNoisy); PRTime start = LL_ZERO; // Initialize these variablies to silence the compiler. @@ -1230,7 +1230,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState, #endif // Compute final width - aMetrics.width = borderPadding.left + aReflowState.mComputedWidth + + aMetrics.width = borderPadding.left + aReflowState.ComputedWidth() + borderPadding.right; // Return bottom margin information @@ -1453,9 +1453,9 @@ nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState) if (tryAndSkipLines) { nscoord newAvailWidth = aState.mReflowState.mComputedBorderPadding.left + - aState.mReflowState.mComputedWidth; + aState.mReflowState.ComputedWidth(); NS_ASSERTION(NS_UNCONSTRAINEDSIZE != aState.mReflowState.mComputedBorderPadding.left && - NS_UNCONSTRAINEDSIZE != aState.mReflowState.mComputedWidth, + NS_UNCONSTRAINEDSIZE != aState.mReflowState.ComputedWidth(), "math on NS_UNCONSTRAINEDSIZE"); #ifdef DEBUG @@ -1673,7 +1673,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) IndentBy(stdout, gNoiseIndent); ListTag(stdout); printf(": reflowing dirty lines"); - printf(" computedWidth=%d\n", aState.mReflowState.mComputedWidth); + printf(" computedWidth=%d\n", aState.mReflowState.ComputedWidth()); } AutoNoisyIndenter indent(gNoisyReflow); #endif @@ -6180,7 +6180,7 @@ nsBlockFrame::ReflowBullet(nsBlockReflowState& aState, // Reflow the bullet now nsSize availSize; // Make up a width since it doesn't really matter (XXX). - availSize.width = rs.mComputedWidth; + availSize.width = rs.ComputedWidth(); availSize.height = NS_UNCONSTRAINEDSIZE; // Get the reason right. diff --git a/mozilla/layout/generic/nsBlockReflowContext.cpp b/mozilla/layout/generic/nsBlockReflowContext.cpp index 2d191e96ffc..cba4c3db7dc 100644 --- a/mozilla/layout/generic/nsBlockReflowContext.cpp +++ b/mozilla/layout/generic/nsBlockReflowContext.cpp @@ -175,14 +175,14 @@ nsBlockReflowContext::ComputeCollapsedTopMargin(const nsHTMLReflowState& aRS, if (frame != aRS.frame) { NS_ASSERTION(frame->GetParent() == aRS.frame, "Can only drill through one level of block wrapper"); - nsSize availSpace(aRS.mComputedWidth, aRS.mComputedHeight); + nsSize availSpace(aRS.ComputedWidth(), aRS.mComputedHeight); outerReflowState = new nsHTMLReflowState(prescontext, aRS, frame, availSpace); if (!outerReflowState) goto done; } { - nsSize availSpace(outerReflowState->mComputedWidth, + nsSize availSpace(outerReflowState->ComputedWidth(), outerReflowState->mComputedHeight); nsHTMLReflowState innerReflowState(prescontext, *outerReflowState, kid, @@ -281,7 +281,7 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace, if (!aIsAdjacentWithTop) { aFrameRS.mFlags.mIsTopOfPage = PR_FALSE; // make sure this is cleared } - mComputedWidth = aFrameRS.mComputedWidth; + mComputedWidth = aFrameRS.ComputedWidth(); if (aApplyTopMargin) { mTopMargin = aPrevMargin; @@ -315,11 +315,11 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace, if (NS_STYLE_FLOAT_RIGHT == aFrameRS.mStyleDisplay->mFloats) { nscoord frameWidth; - if (NS_UNCONSTRAINEDSIZE == aFrameRS.mComputedWidth) { + if (NS_UNCONSTRAINEDSIZE == aFrameRS.ComputedWidth()) { // Use the current frame width frameWidth = mFrame->GetSize().width; } else { - frameWidth = aFrameRS.mComputedWidth + + frameWidth = aFrameRS.ComputedWidth() + aFrameRS.mComputedBorderPadding.left + aFrameRS.mComputedBorderPadding.right; } diff --git a/mozilla/layout/generic/nsBlockReflowState.cpp b/mozilla/layout/generic/nsBlockReflowState.cpp index b0892feae94..cb83069b707 100644 --- a/mozilla/layout/generic/nsBlockReflowState.cpp +++ b/mozilla/layout/generic/nsBlockReflowState.cpp @@ -102,9 +102,9 @@ nsBlockReflowState::nsBlockReflowState(const nsHTMLReflowState& aReflowState, mPresContext = aPresContext; mNextInFlow = NS_STATIC_CAST(nsBlockFrame*, mBlock->GetNextInFlow()); - NS_ASSERTION(NS_UNCONSTRAINEDSIZE != aReflowState.mComputedWidth, + NS_ASSERTION(NS_UNCONSTRAINEDSIZE != aReflowState.ComputedWidth(), "no unconstrained widths should be present anymore"); - mContentArea.width = aReflowState.mComputedWidth; + mContentArea.width = aReflowState.ComputedWidth(); // Compute content area height. Unlike the width, if we have a // specified style height we ignore it since extra content is diff --git a/mozilla/layout/generic/nsColumnSetFrame.cpp b/mozilla/layout/generic/nsColumnSetFrame.cpp index e9e7615ccf8..5fc037dbb9c 100644 --- a/mozilla/layout/generic/nsColumnSetFrame.cpp +++ b/mozilla/layout/generic/nsColumnSetFrame.cpp @@ -201,8 +201,8 @@ nsColumnSetFrame::ChooseColumnStrategy(const nsHTMLReflowState& aReflowState) { const nsStyleColumn* colStyle = GetStyleColumn(); nscoord availContentWidth = GetAvailableContentWidth(aReflowState); - if (aReflowState.mComputedWidth != NS_INTRINSICSIZE) { - availContentWidth = aReflowState.mComputedWidth; + if (aReflowState.ComputedWidth() != NS_INTRINSICSIZE) { + availContentWidth = aReflowState.ComputedWidth(); } nscoord colHeight = GetAvailableContentHeight(aReflowState); if (aReflowState.mComputedHeight != NS_INTRINSICSIZE) { @@ -371,8 +371,8 @@ nsColumnSetFrame::ReflowChildren(nsHTMLReflowMetrics& aDesiredSize, nscoord targetX = borderPadding.left; if (RTL) { nscoord availWidth = aReflowState.availableWidth; - if (aReflowState.mComputedWidth != NS_INTRINSICSIZE) { - availWidth = aReflowState.mComputedWidth; + if (aReflowState.ComputedWidth() != NS_INTRINSICSIZE) { + availWidth = aReflowState.ComputedWidth(); } if (availWidth != NS_INTRINSICSIZE) { childOrigin.x += availWidth - aConfig.mColWidth; @@ -576,8 +576,8 @@ nsColumnSetFrame::ReflowChildren(nsHTMLReflowMetrics& aDesiredSize, contentSize.height = PR_MAX(aReflowState.mComputedMinHeight, contentSize.height); } } - if (aReflowState.mComputedWidth != NS_INTRINSICSIZE) { - contentSize.width = aReflowState.mComputedWidth; + if (aReflowState.ComputedWidth() != NS_INTRINSICSIZE) { + contentSize.width = aReflowState.ComputedWidth(); } else { if (NS_UNCONSTRAINEDSIZE != aReflowState.mComputedMaxWidth) { contentSize.width = PR_MIN(aReflowState.mComputedMaxWidth, contentSize.width); diff --git a/mozilla/layout/generic/nsFrame.cpp b/mozilla/layout/generic/nsFrame.cpp index f71283e3bc8..af98cb004c4 100644 --- a/mozilla/layout/generic/nsFrame.cpp +++ b/mozilla/layout/generic/nsFrame.cpp @@ -6120,7 +6120,7 @@ nsFrame::BoxReflow(nsBoxLayoutState& aState, // This may not do very much useful, but it's probably worth trying. if (parentSize.width != NS_INTRINSICSIZE) - parentReflowState.mComputedWidth = parentSize.width; + parentReflowState.SetComputedWidth(parentSize.width); if (parentSize.height != NS_INTRINSICSIZE) parentReflowState.mComputedHeight = parentSize.height; parentReflowState.mComputedMargin.SizeTo(0, 0, 0, 0); @@ -6143,10 +6143,10 @@ nsFrame::BoxReflow(nsBoxLayoutState& aState, // mComputedWidth and mComputedHeight are content-box, not // border-box if (aWidth != NS_INTRINSICSIZE) { - reflowState.mComputedWidth = + nscoord computedWidth = aWidth - reflowState.mComputedBorderPadding.LeftRight(); - if (reflowState.mComputedWidth < 0) - reflowState.mComputedWidth = 0; + computedWidth = PR_MAX(computedWidth, 0); + reflowState.SetComputedWidth(computedWidth); } if (aHeight != NS_INTRINSICSIZE) { reflowState.mComputedHeight = @@ -6168,7 +6168,7 @@ nsFrame::BoxReflow(nsBoxLayoutState& aState, #ifdef DEBUG_REFLOW nsAdaptorAddIndents(); - printf("Size=(%d,%d)\n",reflowState.mComputedWidth, reflowState.mComputedHeight); + printf("Size=(%d,%d)\n",reflowState.ComputedWidth(), reflowState.mComputedHeight); nsAdaptorAddIndents(); nsAdaptorPrintReason(reflowState); printf("\n"); @@ -6203,9 +6203,10 @@ nsFrame::BoxReflow(nsBoxLayoutState& aState, else { if (aDesiredSize.width > aWidth) { - reflowState.mComputedWidth = aDesiredSize.width - reflowState.mComputedBorderPadding.LeftRight(); - if (reflowState.mComputedWidth < 0) - reflowState.mComputedWidth = 0; + nscoord computedWidth = aDesiredSize.width - + reflowState.mComputedBorderPadding.LeftRight(); + computedWidth = PR_MAX(computedWidth, 0); + reflowState.SetComputedWidth(computedWidth); reflowState.availableWidth = aDesiredSize.width; DidReflow(aPresContext, &reflowState, NS_FRAME_REFLOW_FINISHED); #ifdef DEBUG_REFLOW @@ -7145,7 +7146,7 @@ static void DisplayReflowEnterPrint(nsPresContext* aPresContext, DR_state->PrettyUC(aReflowState.availableHeight, height); printf("Reflow a=%s,%s ", width, height); - DR_state->PrettyUC(aReflowState.mComputedWidth, width); + DR_state->PrettyUC(aReflowState.ComputedWidth(), width); DR_state->PrettyUC(aReflowState.mComputedHeight, height); printf("c=%s,%s ", width, height); @@ -7180,7 +7181,7 @@ static void DisplayReflowEnterPrint(nsPresContext* aPresContext, float p2t = aPresContext->ScaledPixelsToTwips(); CheckPixelError(aReflowState.availableWidth, p2t); CheckPixelError(aReflowState.availableHeight, p2t); - CheckPixelError(aReflowState.mComputedWidth, p2t); + CheckPixelError(aReflowState.ComputedWidth(), p2t); CheckPixelError(aReflowState.mComputedHeight, p2t); } } diff --git a/mozilla/layout/generic/nsGfxScrollFrame.cpp b/mozilla/layout/generic/nsGfxScrollFrame.cpp index 3a3eafa6226..597fa193179 100644 --- a/mozilla/layout/generic/nsGfxScrollFrame.cpp +++ b/mozilla/layout/generic/nsGfxScrollFrame.cpp @@ -269,7 +269,7 @@ static nsSize ComputeInsideBorderSize(ScrollReflowState* aState, // aDesiredInsideBorderSize is the frame size; i.e., it includes // borders and padding (but the scrolled child doesn't have // borders). The scrolled child has the same padding as us. - nscoord contentWidth = aState->mReflowState.mComputedWidth; + nscoord contentWidth = aState->mReflowState.ComputedWidth(); if (contentWidth == NS_UNCONSTRAINEDSIZE) { contentWidth = aDesiredInsideBorderSize.width - aState->mReflowState.mComputedPadding.LeftRight(); @@ -423,7 +423,7 @@ nsHTMLScrollFrame::ReflowScrolledFrame(const ScrollReflowState& aState, // be OK nscoord paddingLR = aState.mReflowState.mComputedPadding.LeftRight(); - nscoord availWidth = aState.mReflowState.mComputedWidth + paddingLR; + nscoord availWidth = aState.mReflowState.ComputedWidth() + paddingLR; if (aAssumeVScroll) { nsSize vScrollbarPrefSize = diff --git a/mozilla/layout/generic/nsHTMLCanvasFrame.cpp b/mozilla/layout/generic/nsHTMLCanvasFrame.cpp index 0137877788b..62f65d6f64f 100644 --- a/mozilla/layout/generic/nsHTMLCanvasFrame.cpp +++ b/mozilla/layout/generic/nsHTMLCanvasFrame.cpp @@ -130,7 +130,7 @@ nsHTMLCanvasFrame::Reflow(nsPresContext* aPresContext, aStatus = NS_FRAME_COMPLETE; - aMetrics.width = aReflowState.mComputedWidth; + aMetrics.width = aReflowState.ComputedWidth(); aMetrics.height = aReflowState.mComputedHeight; // stash this away so we can compute our inner area later diff --git a/mozilla/layout/generic/nsHTMLReflowState.cpp b/mozilla/layout/generic/nsHTMLReflowState.cpp index 279303b9d36..f18b5043e4d 100644 --- a/mozilla/layout/generic/nsHTMLReflowState.cpp +++ b/mozilla/layout/generic/nsHTMLReflowState.cpp @@ -203,6 +203,20 @@ nsCSSOffsetState::ComputeHeightDependentValue(nscoord aContainingBlockHeight, aCoord); } +void +nsHTMLReflowState::SetComputedWidth(nscoord aComputedWidth) +{ + NS_ASSERTION(frame, "Must have a frame!"); + NS_ASSERTION(!(frame->GetStateBits() & NS_FRAME_IN_REFLOW), + "frame shouldn't be in reflow yet"); + + nscoord oldComputedWidth = mComputedWidth; + mComputedWidth = aComputedWidth; + if (mComputedWidth != oldComputedWidth) { + InitResizeFlags(frame->GetPresContext()); + } +} + void nsHTMLReflowState::Init(nsPresContext* aPresContext, nscoord aContainingBlockWidth, diff --git a/mozilla/layout/generic/nsHTMLReflowState.h b/mozilla/layout/generic/nsHTMLReflowState.h index 81f0e10fa84..398f2308e9e 100644 --- a/mozilla/layout/generic/nsHTMLReflowState.h +++ b/mozilla/layout/generic/nsHTMLReflowState.h @@ -234,6 +234,7 @@ struct nsHTMLReflowState : public nsCSSOffsetState { // percentage widths, etc.) of this reflow state's frame. const nsHTMLReflowState *mCBReflowState; +private: // The computed width specifies the frame's content area width, and it does // not apply to inline non-replaced elements // @@ -244,6 +245,7 @@ struct nsHTMLReflowState : public nsCSSOffsetState { // containing block, the margin/border/padding areas, and the min/max width. nscoord mComputedWidth; +public: // The computed height specifies the frame's content height, and it does // not apply to inline non-replaced elements // @@ -409,6 +411,9 @@ struct nsHTMLReflowState : public nsCSSOffsetState { (frame->GetStateBits() & NS_FRAME_CONTAINS_RELATIVE_HEIGHT)); } + nscoord ComputedWidth() const { return mComputedWidth; } + void SetComputedWidth(nscoord aComputedWidth); + protected: void InitCBReflowState(); diff --git a/mozilla/layout/generic/nsImageFrame.cpp b/mozilla/layout/generic/nsImageFrame.cpp index 67fb3a361c4..523cc4f9948 100644 --- a/mozilla/layout/generic/nsImageFrame.cpp +++ b/mozilla/layout/generic/nsImageFrame.cpp @@ -151,17 +151,17 @@ inline PRBool HaveFixedSize(const nsHTMLReflowState& aReflowState) { NS_ASSERTION(aReflowState.mStylePosition, "crappy reflowState - null stylePosition"); // when an image has percent css style height or width, but mComputedHeight - // or mComputedWidth of reflow state is NS_UNCONSTRAINEDSIZE + // or ComputedWidth() of reflow state is NS_UNCONSTRAINEDSIZE // it needs to return PR_FALSE to cause an incremental reflow later // if an image is inside table like bug 156731 simple testcase III, - // during pass 1 reflow, mComputedWidth is NS_UNCONSTRAINEDSIZE - // in pass 2 reflow, mComputedWidth is 0, it also needs to return PR_FALSE + // during pass 1 reflow, ComputedWidth() is NS_UNCONSTRAINEDSIZE + // in pass 2 reflow, ComputedWidth() is 0, it also needs to return PR_FALSE // see bug 156731 nsStyleUnit heightUnit = (*(aReflowState.mStylePosition)).mHeight.GetUnit(); nsStyleUnit widthUnit = (*(aReflowState.mStylePosition)).mWidth.GetUnit(); return ((eStyleUnit_Percent == heightUnit && NS_UNCONSTRAINEDSIZE == aReflowState.mComputedHeight) || - (eStyleUnit_Percent == widthUnit && (NS_UNCONSTRAINEDSIZE == aReflowState.mComputedWidth || - 0 == aReflowState.mComputedWidth))) + (eStyleUnit_Percent == widthUnit && (NS_UNCONSTRAINEDSIZE == aReflowState.ComputedWidth() || + 0 == aReflowState.ComputedWidth()))) ? PR_FALSE : HaveFixedSize(aReflowState.mStylePosition); } @@ -837,7 +837,7 @@ nsImageFrame::Reflow(nsPresContext* aPresContext, // transform it can. mBorderPadding = aReflowState.mComputedBorderPadding; - nsSize newSize(aReflowState.mComputedWidth, aReflowState.mComputedHeight); + nsSize newSize(aReflowState.ComputedWidth(), aReflowState.mComputedHeight); if (mComputedSize != newSize) { mComputedSize = newSize; RecalculateTransform(nsnull); diff --git a/mozilla/layout/generic/nsLeafFrame.cpp b/mozilla/layout/generic/nsLeafFrame.cpp index 7fbf9af6eff..56bda764c52 100644 --- a/mozilla/layout/generic/nsLeafFrame.cpp +++ b/mozilla/layout/generic/nsLeafFrame.cpp @@ -84,10 +84,10 @@ nsLeafFrame::Reflow(nsPresContext* aPresContext, // XXX add in code to check for width/height being set via css // and if set use them instead of calling GetDesiredSize. - NS_ASSERTION(aReflowState.mComputedWidth != NS_UNCONSTRAINEDSIZE, + NS_ASSERTION(aReflowState.ComputedWidth() != NS_UNCONSTRAINEDSIZE, "Shouldn't have unconstrained stuff here"); - aMetrics.width = aReflowState.mComputedWidth; + aMetrics.width = aReflowState.ComputedWidth(); if (NS_INTRINSICSIZE != aReflowState.mComputedHeight) { aMetrics.height = aReflowState.mComputedHeight; } else { diff --git a/mozilla/layout/generic/nsObjectFrame.cpp b/mozilla/layout/generic/nsObjectFrame.cpp index 74c7254ff59..4312a230bf0 100644 --- a/mozilla/layout/generic/nsObjectFrame.cpp +++ b/mozilla/layout/generic/nsObjectFrame.cpp @@ -632,7 +632,7 @@ nsObjectFrame::GetDesiredSize(nsPresContext* aPresContext, return; } - aMetrics.width = aReflowState.mComputedWidth; + aMetrics.width = aReflowState.ComputedWidth(); aMetrics.height = aReflowState.mComputedHeight; // for EMBED and APPLET, default to 240x200 for compatibility diff --git a/mozilla/layout/generic/nsSimplePageSequence.cpp b/mozilla/layout/generic/nsSimplePageSequence.cpp index 0769dcf1a3f..c95f922d458 100644 --- a/mozilla/layout/generic/nsSimplePageSequence.cpp +++ b/mozilla/layout/generic/nsSimplePageSequence.cpp @@ -289,7 +289,7 @@ nsSimplePageSequenceFrame::Reflow(nsPresContext* aPresContext, availSize); nsReflowStatus status; - kidReflowState.mComputedWidth = kidReflowState.availableWidth; + kidReflowState.SetComputedWidth(kidReflowState.availableWidth); //kidReflowState.mComputedHeight = kidReflowState.availableHeight; PR_PL(("AV W: %d H: %d\n", kidReflowState.availableWidth, kidReflowState.availableHeight)); diff --git a/mozilla/layout/generic/nsViewportFrame.cpp b/mozilla/layout/generic/nsViewportFrame.cpp index 30e681d0ecf..0f7a31e7381 100644 --- a/mozilla/layout/generic/nsViewportFrame.cpp +++ b/mozilla/layout/generic/nsViewportFrame.cpp @@ -235,7 +235,8 @@ nsPoint if (scrollingFrame) { nsMargin scrollbars = scrollingFrame->GetActualScrollbarSizes(); - aReflowState->mComputedWidth -= scrollbars.left + scrollbars.right; + aReflowState->SetComputedWidth(aReflowState->ComputedWidth() - + (scrollbars.left + scrollbars.right)); aReflowState->availableWidth -= scrollbars.left + scrollbars.right; aReflowState->mComputedHeight -= scrollbars.top + scrollbars.bottom; // XXX why don't we also adjust "aReflowState->availableHeight"? @@ -320,7 +321,7 @@ ViewportFrame::Reflow(nsPresContext* aPresContext, // Just reflow all the fixed-pos frames. rv = mFixedContainer.Reflow(this, aPresContext, reflowState, - reflowState.mComputedWidth, + reflowState.ComputedWidth(), reflowState.mComputedHeight, PR_TRUE, PR_TRUE); // XXX could be optimized diff --git a/mozilla/layout/mathml/base/src/nsMathMLContainerFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLContainerFrame.cpp index 2c5c50ee5ff..aed0b1a13b3 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLContainerFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLContainerFrame.cpp @@ -1023,7 +1023,7 @@ nsMathMLContainerFrame::Reflow(nsPresContext* aPresContext, // Asking each child to cache its bounding metrics nsReflowStatus childStatus; - nsSize availSize(aReflowState.mComputedWidth, aReflowState.mComputedHeight); + nsSize availSize(aReflowState.ComputedWidth(), aReflowState.mComputedHeight); nsHTMLReflowMetrics childDesiredSize( aDesiredSize.mFlags | NS_REFLOW_CALC_BOUNDING_METRICS); nsIFrame* childFrame = mFrames.FirstChild(); diff --git a/mozilla/layout/mathml/base/src/nsMathMLTokenFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLTokenFrame.cpp index d974d6f5076..61782245f8d 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLTokenFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLTokenFrame.cpp @@ -133,7 +133,7 @@ nsMathMLTokenFrame::Reflow(nsPresContext* aPresContext, // ask our children to compute their bounding metrics nsHTMLReflowMetrics childDesiredSize( aDesiredSize.mFlags | NS_REFLOW_CALC_BOUNDING_METRICS); - nsSize availSize(aReflowState.mComputedWidth, aReflowState.mComputedHeight); + nsSize availSize(aReflowState.ComputedWidth(), aReflowState.mComputedHeight); PRInt32 count = 0; nsIFrame* childFrame = GetFirstChild(nsnull); while (childFrame) { diff --git a/mozilla/layout/mathml/base/src/nsMathMLmactionFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmactionFrame.cpp index 8e40b2dbe04..8638e07a91e 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmactionFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmactionFrame.cpp @@ -283,7 +283,8 @@ nsMathMLmactionFrame::Reflow(nsPresContext* aPresContext, mBoundingMetrics.Clear(); nsIFrame* childFrame = GetSelectedFrame(); if (childFrame) { - nsSize availSize(aReflowState.mComputedWidth, aReflowState.mComputedHeight); + nsSize availSize(aReflowState.ComputedWidth(), + aReflowState.mComputedHeight); nsHTMLReflowState childReflowState(aPresContext, aReflowState, childFrame, availSize); rv = ReflowChild(childFrame, aPresContext, aDesiredSize, diff --git a/mozilla/layout/mathml/base/src/nsMathMLmfencedFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmfencedFrame.cpp index e5549240298..3cf2305e8f1 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmfencedFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmfencedFrame.cpp @@ -285,7 +285,7 @@ nsMathMLmfencedFrame::doReflow(nsPresContext* aPresContext, PRInt32 count = 0; nsReflowStatus childStatus; - nsSize availSize(aReflowState.mComputedWidth, aReflowState.mComputedHeight); + nsSize availSize(aReflowState.ComputedWidth(), aReflowState.mComputedHeight); nsHTMLReflowMetrics childDesiredSize( aDesiredSize.mFlags | NS_REFLOW_CALC_BOUNDING_METRICS); nsIFrame* firstChild = aForFrame->GetFirstChild(nsnull); diff --git a/mozilla/layout/mathml/base/src/nsMathMLmrootFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmrootFrame.cpp index f8dca39b71d..74b3dd9d25f 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmrootFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmrootFrame.cpp @@ -162,7 +162,7 @@ nsMathMLmrootFrame::Reflow(nsPresContext* aPresContext, // ask our children to compute their bounding metrics nsHTMLReflowMetrics childDesiredSize( aDesiredSize.mFlags | NS_REFLOW_CALC_BOUNDING_METRICS); - nsSize availSize(aReflowState.mComputedWidth, aReflowState.mComputedHeight); + nsSize availSize(aReflowState.ComputedWidth(), aReflowState.mComputedHeight); nsReflowStatus childStatus; aDesiredSize.width = aDesiredSize.height = 0; diff --git a/mozilla/layout/svg/base/src/nsSVGOuterSVGFrame.cpp b/mozilla/layout/svg/base/src/nsSVGOuterSVGFrame.cpp index 72f2835b5d5..113ac17a4f3 100644 --- a/mozilla/layout/svg/base/src/nsSVGOuterSVGFrame.cpp +++ b/mozilla/layout/svg/base/src/nsSVGOuterSVGFrame.cpp @@ -283,7 +283,7 @@ nsSVGOuterSVGFrame::Reflow(nsPresContext* aPresContext, // aReflowState.availableHeight, // r.width, r.height); // printf("******* cw: %d, ch: %d \n cmaxw: %d, cmaxh: %d\n", -// aReflowState.mComputedWidth, +// aReflowState.ComputedWidth(), // aReflowState.mComputedHeight, // aReflowState.mComputedMaxWidth, // aReflowState.mComputedMaxHeight); @@ -293,7 +293,7 @@ nsSVGOuterSVGFrame::Reflow(nsPresContext* aPresContext, // aReflowState.parentReflowState->availableWidth, // aReflowState.parentReflowState->availableHeight); // printf("******* parent cw: %d, parent ch: %d \n parent cmaxw: %d, parent cmaxh: %d\n", -// aReflowState.parentReflowState->mComputedWidth, +// aReflowState.parentReflowState->ComputedWidth(), // aReflowState.parentReflowState->mComputedHeight, // aReflowState.parentReflowState->mComputedMaxWidth, // aReflowState.parentReflowState->mComputedMaxHeight); @@ -713,8 +713,8 @@ nsSVGOuterSVGFrame::CalculateAvailableSpace(nsRect *maxRect, if (aReflowState.availableWidth != NS_INTRINSICSIZE) maxRect->width = aReflowState.availableWidth; else if (aReflowState.parentReflowState && - aReflowState.parentReflowState->mComputedWidth != NS_INTRINSICSIZE) - maxRect->width = aReflowState.parentReflowState->mComputedWidth; + aReflowState.parentReflowState->ComputedWidth() != NS_INTRINSICSIZE) + maxRect->width = aReflowState.parentReflowState->ComputedWidth(); else maxRect->width = NS_MAXSIZE; diff --git a/mozilla/layout/tables/BasicTableLayoutStrategy.cpp b/mozilla/layout/tables/BasicTableLayoutStrategy.cpp index 305c1c2e5bc..564d4572e86 100644 --- a/mozilla/layout/tables/BasicTableLayoutStrategy.cpp +++ b/mozilla/layout/tables/BasicTableLayoutStrategy.cpp @@ -614,7 +614,7 @@ BasicTableLayoutStrategy::MarkIntrinsicWidthsDirty() /* virtual */ void BasicTableLayoutStrategy::ComputeColumnWidths(const nsHTMLReflowState& aReflowState) { - nscoord width = aReflowState.mComputedWidth; + nscoord width = aReflowState.ComputedWidth(); if (mLastCalcWidth == width) return; diff --git a/mozilla/layout/tables/FixedTableLayoutStrategy.cpp b/mozilla/layout/tables/FixedTableLayoutStrategy.cpp index 9cbdaa4a0d1..8767ca7a78c 100644 --- a/mozilla/layout/tables/FixedTableLayoutStrategy.cpp +++ b/mozilla/layout/tables/FixedTableLayoutStrategy.cpp @@ -160,7 +160,7 @@ FixedTableLayoutStrategy::MarkIntrinsicWidthsDirty() /* virtual */ void FixedTableLayoutStrategy::ComputeColumnWidths(const nsHTMLReflowState& aReflowState) { - nscoord tableWidth = aReflowState.mComputedWidth; + nscoord tableWidth = aReflowState.ComputedWidth(); if (mLastCalcWidth == tableWidth) return; diff --git a/mozilla/layout/tables/nsTableFrame.cpp b/mozilla/layout/tables/nsTableFrame.cpp index 1173e679e7b..9abd8cdc3e9 100644 --- a/mozilla/layout/tables/nsTableFrame.cpp +++ b/mozilla/layout/tables/nsTableFrame.cpp @@ -1966,7 +1966,7 @@ NS_METHOD nsTableFrame::Reflow(nsPresContext* aPresContext, mutable_rs.mFlags.mSpecialHeightReflow = oldSpecialHeightReflow; } - aDesiredSize.width = aReflowState.mComputedWidth + + aDesiredSize.width = aReflowState.ComputedWidth() + aReflowState.mComputedBorderPadding.LeftRight(); if (!haveDesiredHeight) { CalcDesiredHeight(aReflowState, aDesiredSize); @@ -2031,7 +2031,7 @@ nsTableFrame::ReflowTable(nsHTMLReflowMetrics& aDesiredSize, } // Constrain our reflow width to the computed table width (of the 1st in flow). // and our reflow height to our avail height minus border, padding, cellspacing - aDesiredSize.width = aReflowState.mComputedWidth + + aDesiredSize.width = aReflowState.ComputedWidth() + aReflowState.mComputedBorderPadding.LeftRight(); nsTableReflowState reflowState(*GetPresContext(), aReflowState, *this, aDesiredSize.width, aAvailHeight); @@ -2805,8 +2805,6 @@ nsTableFrame::ReflowChildren(nsTableReflowState& aReflowState, kidFrame, kidAvailSize, -1, -1, PR_FALSE); InitChildReflowState(kidReflowState); - // XXX fix up bad mComputedWidth for scroll frame - kidReflowState.mComputedWidth = PR_MAX(kidReflowState.mComputedWidth, 0); // If this isn't the first row group, then we can't be at the top of the page // When a new page starts, a head row group may be added automatically. @@ -3387,7 +3385,7 @@ nsTableFrame::GetBorderPadding(const nsHTMLReflowState& aReflowState, while (parentRS) { if (parentRS->frame) { if (nsGkAtoms::tableFrame == parentRS->frame->GetType()) { - nsSize basis(parentRS->mComputedWidth, parentRS->mComputedHeight); + nsSize basis(parentRS->ComputedWidth(), parentRS->mComputedHeight); GetPaddingFor(basis, *paddingData, padding); break; } diff --git a/mozilla/layout/tables/nsTableOuterFrame.cpp b/mozilla/layout/tables/nsTableOuterFrame.cpp index b1189f367fe..25a101fcf3f 100644 --- a/mozilla/layout/tables/nsTableOuterFrame.cpp +++ b/mozilla/layout/tables/nsTableOuterFrame.cpp @@ -469,7 +469,7 @@ GetContainingBlockSize(const nsHTMLReflowState& aOuterRS) aOuterRS.mCBReflowState; if (containRS) { - size.width = containRS->mComputedWidth; + size.width = containRS->ComputedWidth(); if (NS_UNCONSTRAINEDSIZE == size.width) { size.width = 0; } @@ -1193,19 +1193,19 @@ NS_METHOD nsTableOuterFrame::Reflow(nsPresContext* aPresContext, nsReflowStatus capStatus; // don't let the caption cause incomplete rv = OuterReflowChild(aPresContext, mCaptionFrame, aOuterRS, captionRSSpace, captionMet, - aOuterRS.mComputedWidth, captionSize, + aOuterRS.ComputedWidth(), captionSize, captionMargin, capStatus); if (NS_FAILED(rv)) return rv; } else if (mCaptionFrame) { captionSize = mCaptionFrame->GetSize(); - GetMargin(aPresContext, aOuterRS, mCaptionFrame, aOuterRS.mComputedWidth, + GetMargin(aPresContext, aOuterRS, mCaptionFrame, aOuterRS.ComputedWidth(), captionMargin); } else { captionSize.SizeTo(0,0); captionMargin.SizeTo(0,0,0,0); } - nscoord innerAvailWidth = aOuterRS.mComputedWidth; + nscoord innerAvailWidth = aOuterRS.ComputedWidth(); if (captionSide == NS_SIDE_LEFT || captionSide == NS_SIDE_RIGHT) // If side is left/right then we know we have a caption and we // reflowed it. @@ -1225,7 +1225,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsPresContext* aPresContext, } else { innerSize = mInnerTableFrame->GetSize(); GetMargin(aPresContext, aOuterRS, mInnerTableFrame, - aOuterRS.mComputedWidth, innerMargin); + aOuterRS.ComputedWidth(), innerMargin); } nsSize containSize = GetContainingBlockSize(aOuterRS); diff --git a/mozilla/layout/tables/nsTableRowFrame.cpp b/mozilla/layout/tables/nsTableRowFrame.cpp index c07529e6177..66a999680f0 100644 --- a/mozilla/layout/tables/nsTableRowFrame.cpp +++ b/mozilla/layout/tables/nsTableRowFrame.cpp @@ -73,9 +73,11 @@ void nsTableCellReflowState::FixUp(const nsSize& aAvailSpace) // fix the mComputed values during a pass 2 reflow since the cell can be a percentage base NS_ASSERTION(NS_UNCONSTRAINEDSIZE != aAvailSpace.width, "unconstrained available width in reflow"); - if (NS_UNCONSTRAINEDSIZE != mComputedWidth) { - mComputedWidth = aAvailSpace.width - mComputedBorderPadding.left - mComputedBorderPadding.right; - mComputedWidth = PR_MAX(0, mComputedWidth); + if (NS_UNCONSTRAINEDSIZE != ComputedWidth()) { + nscoord computedWidth = aAvailSpace.width - mComputedBorderPadding.left - + mComputedBorderPadding.right; + computedWidth = PR_MAX(0, computedWidth); + SetComputedWidth(computedWidth); } if (NS_UNCONSTRAINEDSIZE != mComputedHeight) { if (NS_UNCONSTRAINEDSIZE != aAvailSpace.height) { @@ -785,7 +787,7 @@ GetComputedWidth(const nsHTMLReflowState& aReflowState, nscoord computedWidth = 0; while (parentReflow) { if (parentReflow->frame == &aTableFrame) { - computedWidth = parentReflow->mComputedWidth; + computedWidth = parentReflow->ComputedWidth(); break; } parentReflow = parentReflow->parentReflowState; diff --git a/mozilla/layout/xul/base/src/nsBoxFrame.cpp b/mozilla/layout/xul/base/src/nsBoxFrame.cpp index bcfc28eb45b..cf1ca702b0a 100644 --- a/mozilla/layout/xul/base/src/nsBoxFrame.cpp +++ b/mozilla/layout/xul/base/src/nsBoxFrame.cpp @@ -717,7 +717,7 @@ nsBoxFrame::Reflow(nsPresContext* aPresContext, DO_GLOBAL_REFLOW_COUNT("nsBoxFrame"); DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus); - NS_ASSERTION(aReflowState.mComputedWidth >=0 && aReflowState.mComputedHeight >= 0, "Computed Size < 0"); + NS_ASSERTION(aReflowState.ComputedWidth() >=0 && aReflowState.ComputedWidth() >= 0, "Computed Size < 0"); #ifdef DO_NOISY_REFLOW printf("\n-------------Starting BoxFrame Reflow ----------------------------\n"); @@ -725,7 +725,7 @@ nsBoxFrame::Reflow(nsPresContext* aPresContext, printSize("AW", aReflowState.availableWidth); printSize("AH", aReflowState.availableHeight); - printSize("CW", aReflowState.mComputedWidth); + printSize("CW", aReflowState.ComputedWidth()); printSize("CH", aReflowState.mComputedHeight); printf(" *\n"); @@ -737,7 +737,7 @@ nsBoxFrame::Reflow(nsPresContext* aPresContext, // create the layout state nsBoxLayoutState state(aPresContext, aReflowState.rendContext); - nsSize computedSize(aReflowState.mComputedWidth,aReflowState.mComputedHeight); + nsSize computedSize(aReflowState.ComputedWidth(),aReflowState.mComputedHeight); nsMargin m; m = aReflowState.mComputedBorderPadding; diff --git a/mozilla/layout/xul/base/src/nsLeafBoxFrame.cpp b/mozilla/layout/xul/base/src/nsLeafBoxFrame.cpp index 1a93a993cb2..931f70a9f3a 100644 --- a/mozilla/layout/xul/base/src/nsLeafBoxFrame.cpp +++ b/mozilla/layout/xul/base/src/nsLeafBoxFrame.cpp @@ -252,7 +252,7 @@ nsLeafBoxFrame::Reflow(nsPresContext* aPresContext, DO_GLOBAL_REFLOW_COUNT("nsLeafBoxFrame"); DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus); - NS_ASSERTION(aReflowState.mComputedWidth >=0 && aReflowState.mComputedHeight >= 0, "Computed Size < 0"); + NS_ASSERTION(aReflowState.ComputedWidth() >=0 && aReflowState.mComputedHeight >= 0, "Computed Size < 0"); #ifdef DO_NOISY_REFLOW printf("\n-------------Starting LeafBoxFrame Reflow ----------------------------\n"); @@ -274,7 +274,7 @@ nsLeafBoxFrame::Reflow(nsPresContext* aPresContext, printSize("AW", aReflowState.availableWidth); printSize("AH", aReflowState.availableHeight); - printSize("CW", aReflowState.mComputedWidth); + printSize("CW", aReflowState.ComputedWidth()); printSize("CH", aReflowState.mComputedHeight); printf(" *\n"); @@ -286,7 +286,7 @@ nsLeafBoxFrame::Reflow(nsPresContext* aPresContext, // create the layout state nsBoxLayoutState state(aPresContext, aReflowState.rendContext); - nsSize computedSize(aReflowState.mComputedWidth,aReflowState.mComputedHeight); + nsSize computedSize(aReflowState.ComputedWidth(),aReflowState.mComputedHeight); nsMargin m; m = aReflowState.mComputedBorderPadding; @@ -310,7 +310,7 @@ nsLeafBoxFrame::Reflow(nsPresContext* aPresContext, } // get our desiredSize - if (aReflowState.mComputedWidth == NS_INTRINSICSIZE) { + if (aReflowState.ComputedWidth() == NS_INTRINSICSIZE) { computedSize.width = prefSize.width; } else { computedSize.width += m.left + m.right;