Introduce a setter for nsHTMLReflowState::mComputedHeight so that we're sure to
authorbzbarsky@mit.edu
Thu, 02 Aug 2007 11:08:05 -0700
changeset 4166 95253d8a4143ddc6417020bf2d7b35f3bb5ae163
parent 4165 6302937dbcdb96a93ecc13efe3ec6320d110bd43
child 4167 d0971bca5f7953038778ea64e0f160c9bfc2950e
push idunknown
push userunknown
push dateunknown
bugs388084
milestone1.9a7pre
Introduce a setter for nsHTMLReflowState::mComputedHeight so that we're sure to update the resize flags properly. Bug 388084, r+sr+a=dbaron
layout/base/nsPresShell.cpp
layout/forms/nsComboboxControlFrame.cpp
layout/forms/nsFieldSetFrame.cpp
layout/forms/nsFileControlFrame.cpp
layout/forms/nsHTMLButtonControlFrame.cpp
layout/forms/nsListControlFrame.cpp
layout/generic/nsAbsoluteContainingBlock.cpp
layout/generic/nsBlockFrame.cpp
layout/generic/nsBlockReflowContext.cpp
layout/generic/nsColumnSetFrame.cpp
layout/generic/nsFrame.cpp
layout/generic/nsGfxScrollFrame.cpp
layout/generic/nsHTMLCanvasFrame.cpp
layout/generic/nsHTMLReflowState.cpp
layout/generic/nsHTMLReflowState.h
layout/generic/nsImageFrame.cpp
layout/generic/nsLeafFrame.cpp
layout/generic/nsObjectFrame.cpp
layout/generic/nsSimplePageSequence.cpp
layout/generic/nsViewportFrame.cpp
layout/mathml/base/src/nsMathMLContainerFrame.cpp
layout/mathml/base/src/nsMathMLTokenFrame.cpp
layout/mathml/base/src/nsMathMLmactionFrame.cpp
layout/mathml/base/src/nsMathMLmfencedFrame.cpp
layout/mathml/base/src/nsMathMLmrootFrame.cpp
layout/svg/base/src/nsSVGForeignObjectFrame.cpp
layout/svg/base/src/nsSVGOuterSVGFrame.cpp
layout/tables/nsTableCellFrame.cpp
layout/tables/nsTableFrame.cpp
layout/tables/nsTableOuterFrame.cpp
layout/tables/nsTableRowFrame.cpp
layout/tables/nsTableRowGroupFrame.cpp
layout/xul/base/src/nsBoxFrame.cpp
layout/xul/base/src/nsLeafBoxFrame.cpp
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -6065,18 +6065,20 @@ PresShell::DoReflow(nsIFrame* target)
   else
     reflowSize = size;
   nsHTMLReflowState reflowState(mPresContext, target, rcx, reflowSize);
 
   // fix the computed height
   NS_ASSERTION(reflowState.mComputedMargin == nsMargin(0, 0, 0, 0),
                "reflow state should not set margin for reflow roots");
   if (size.height != NS_UNCONSTRAINEDSIZE) {
-    reflowState.mComputedHeight =
+    nscoord computedHeight =
       size.height - reflowState.mComputedBorderPadding.TopBottom();
+    computedHeight = PR_MAX(computedHeight, 0);
+    reflowState.SetComputedHeight(computedHeight);
   }
   NS_ASSERTION(reflowState.ComputedWidth() ==
                  size.width -
                    reflowState.mComputedBorderPadding.LeftRight(),
                "reflow state computed incorrect width");
 
   nsReflowStatus status;
   nsHTMLReflowMetrics desiredSize;
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -674,35 +674,35 @@ nsComboboxControlFrame::Reflow(nsPresCon
                                     aStatus);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Now set the correct width and height on our button.  The width we need to
   // set always, the height only if we had an auto height.
   nsRect buttonRect = mButtonFrame->GetRect();
   // If we have a non-intrinsic computed height, our kids should have sized
   // themselves properly on their own.
-  if (aReflowState.mComputedHeight == NS_INTRINSICSIZE) {
+  if (aReflowState.ComputedHeight() == NS_INTRINSICSIZE) {
     // The display frame is going to be the right height and width at this
     // point. Use its height as the button height.
     nsRect displayRect = mDisplayFrame->GetRect();
     buttonRect.height = displayRect.height;
     buttonRect.y = displayRect.y;
   }
 #ifdef DEBUG
   else {
     nscoord buttonHeight = mButtonFrame->GetSize().height;
     nscoord displayHeight = mDisplayFrame->GetSize().height;
 
     // The button and display area should be equal heights, unless the computed
     // height on the combobox is too small to fit their borders and padding.
     NS_ASSERTION(buttonHeight == displayHeight ||
-                 (aReflowState.mComputedHeight < buttonHeight &&
+                 (aReflowState.ComputedHeight() < buttonHeight &&
                   buttonHeight ==
                     mButtonFrame->GetUsedBorderAndPadding().TopBottom()) ||
-                 (aReflowState.mComputedHeight < displayHeight &&
+                 (aReflowState.ComputedHeight() < displayHeight &&
                   displayHeight ==
                     mDisplayFrame->GetUsedBorderAndPadding().TopBottom()),
                  "Different heights?");
   }
 #endif
   
   if (GetStyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL) {
     // Make sure the right edge of the button frame stays where it is now
@@ -1093,21 +1093,21 @@ nsComboboxDisplayFrame::GetType() const
 
 NS_IMETHODIMP
 nsComboboxDisplayFrame::Reflow(nsPresContext*           aPresContext,
                                nsHTMLReflowMetrics&     aDesiredSize,
                                const nsHTMLReflowState& aReflowState,
                                nsReflowStatus&          aStatus)
 {
   nsHTMLReflowState state(aReflowState);
-  if (state.mComputedHeight == NS_INTRINSICSIZE) {
+  if (state.ComputedHeight() == NS_INTRINSICSIZE) {
     // Note that the only way we can have a computed height here is if the
     // combobox had a specified height.  If it didn't, size based on what our
     // rows look like, for lack of anything better.
-    state.mComputedHeight = mComboBox->mListControlFrame->GetHeightOfARow();
+    state.SetComputedHeight(mComboBox->mListControlFrame->GetHeightOfARow());
   }
   nscoord computedWidth = mComboBox->mDisplayWidth -
     state.mComputedBorderPadding.LeftRight(); 
   if (computedWidth < 0) {
     computedWidth = 0;
   }
   state.SetComputedWidth(computedWidth);
 
--- a/layout/forms/nsFieldSetFrame.cpp
+++ b/layout/forms/nsFieldSetFrame.cpp
@@ -488,17 +488,17 @@ nsFieldSetFrame::Reflow(nsPresContext*  
 
     nsHTMLReflowState legendReflowState(aPresContext, aReflowState,
                                         mLegendFrame,
                                         legendAvailSize);
 
     // always give the legend as much size as it wants
     legendReflowState.
       SetComputedWidth(mLegendFrame->GetPrefWidth(aReflowState.rendContext));
-    legendReflowState.mComputedHeight = NS_INTRINSICSIZE;
+    legendReflowState.SetComputedHeight(NS_INTRINSICSIZE);
 
     nsHTMLReflowMetrics legendDesiredSize;
 
     ReflowChild(mLegendFrame, aPresContext, legendDesiredSize, legendReflowState,
                 0, 0, NS_FRAME_NO_MOVE_FRAME, aStatus);
 #ifdef NOISY_REFLOW
     printf("  returned (%d, %d)\n", legendDesiredSize.width, legendDesiredSize.height);
 #endif
@@ -550,19 +550,19 @@ nsFieldSetFrame::Reflow(nsPresContext*  
     // Reflow the frame
     ReflowChild(mContentFrame, aPresContext, kidDesiredSize, kidReflowState,
                 borderPadding.left + kidReflowState.mComputedMargin.left,
                 borderPadding.top + mLegendSpace + kidReflowState.mComputedMargin.top,
                 0, aStatus);
 
     // set the rect. make sure we add the margin back in.
     contentRect.SetRect(borderPadding.left,borderPadding.top + mLegendSpace,kidDesiredSize.width ,kidDesiredSize.height);
-    if (aReflowState.mComputedHeight != NS_INTRINSICSIZE &&
-        borderPadding.top + mLegendSpace+kidDesiredSize.height > aReflowState.mComputedHeight) {
-      kidDesiredSize.height = aReflowState.mComputedHeight-(borderPadding.top + mLegendSpace);
+    if (aReflowState.ComputedHeight() != NS_INTRINSICSIZE &&
+        borderPadding.top + mLegendSpace+kidDesiredSize.height > aReflowState.ComputedHeight()) {
+      kidDesiredSize.height = aReflowState.ComputedHeight()-(borderPadding.top + mLegendSpace);
     }
 
     FinishReflowChild(mContentFrame, aPresContext, &kidReflowState, 
                       kidDesiredSize, contentRect.x, contentRect.y, 0);
     NS_FRAME_TRACE_REFLOW_OUT("FieldSet::Reflow", aStatus);
 
   } else if (mContentFrame) {
     // if we don't need to reflow just get the old size
@@ -615,28 +615,28 @@ nsFieldSetFrame::Reflow(nsPresContext*  
 
       // We need to recursively process the legend frame's
       // children since we're moving the frame after Reflow.
       nsContainerFrame::PositionChildViews(mLegendFrame);
     }
   }
 
   // Return our size and our result
-  if (aReflowState.mComputedHeight == NS_INTRINSICSIZE) {
+  if (aReflowState.ComputedHeight() == NS_INTRINSICSIZE) {
     aDesiredSize.height = mLegendSpace + 
-                          borderPadding.top +
-                          contentRect.height +
-                          borderPadding.bottom;
+                          borderPadding.TopBottom() +
+                          contentRect.height;
   } else {
-    nscoord min = borderPadding.top + borderPadding.bottom + mLegendRect.height;
-    aDesiredSize.height = aReflowState.mComputedHeight + borderPadding.top + borderPadding.bottom;
+    nscoord min = borderPadding.TopBottom() + mLegendRect.height;
+    aDesiredSize.height =
+      aReflowState.ComputedHeight() + borderPadding.TopBottom();
     if (aDesiredSize.height < min)
       aDesiredSize.height = min;
   }
-  aDesiredSize.width = contentRect.width + borderPadding.left + borderPadding.right;
+  aDesiredSize.width = contentRect.width + borderPadding.LeftRight();
   aDesiredSize.mOverflowArea = nsRect(0, 0, aDesiredSize.width, aDesiredSize.height);
   if (mLegendFrame)
     ConsiderChildOverflow(aDesiredSize.mOverflowArea, mLegendFrame);
   if (mContentFrame)
     ConsiderChildOverflow(aDesiredSize.mOverflowArea, mContentFrame);
   FinishAndStoreOverflow(&aDesiredSize);
 
   Invalidate(aDesiredSize.mOverflowArea);
--- a/layout/forms/nsFileControlFrame.cpp
+++ b/layout/forms/nsFileControlFrame.cpp
@@ -399,17 +399,17 @@ NS_IMETHODIMP nsFileControlFrame::Reflow
       // messes up the button's rect
       if (txtRect.width + buttonRect.width != aDesiredSize.width ||
           txtRect.height != aDesiredSize.height) {
         nsHTMLReflowMetrics txtKidSize;
         nsSize txtAvailSize(aReflowState.availableWidth, aDesiredSize.height);
         nsHTMLReflowState   txtKidReflowState(aPresContext,
                                               *aReflowState.parentReflowState,
                                               this, txtAvailSize);
-        txtKidReflowState.mComputedHeight = aDesiredSize.height;
+        txtKidReflowState.SetComputedHeight(aDesiredSize.height);
         rv = nsAreaFrame::WillReflow(aPresContext);
         NS_ASSERTION(NS_SUCCEEDED(rv), "Should have succeeded");
         rv = nsAreaFrame::Reflow(aPresContext, txtKidSize, txtKidReflowState, aStatus);
         NS_ASSERTION(NS_SUCCEEDED(rv), "Should have succeeded");
         rv = nsAreaFrame::DidReflow(aPresContext, &txtKidReflowState, aStatus);
         NS_ASSERTION(NS_SUCCEEDED(rv), "Should have succeeded");
 
         // And now manually resize the frame...
--- a/layout/forms/nsHTMLButtonControlFrame.cpp
+++ b/layout/forms/nsHTMLButtonControlFrame.cpp
@@ -298,18 +298,18 @@ nsHTMLButtonControlFrame::Reflow(nsPresC
   
   // Reflow the contents of the button.
   ReflowButtonContents(aPresContext, aDesiredSize, aReflowState, firstKid,
                        focusPadding, aStatus);
 
   aDesiredSize.width = aReflowState.ComputedWidth();
 
   // If computed use the computed value.
-  if (aReflowState.mComputedHeight != NS_INTRINSICSIZE) 
-    aDesiredSize.height = aReflowState.mComputedHeight;
+  if (aReflowState.ComputedHeight() != NS_INTRINSICSIZE) 
+    aDesiredSize.height = aReflowState.ComputedHeight();
   else
     aDesiredSize.height += focusPadding.TopBottom();
   
   aDesiredSize.width += aReflowState.mComputedBorderPadding.LeftRight();
   aDesiredSize.height += aReflowState.mComputedBorderPadding.TopBottom();
 
   // Make sure we obey min/max-height.  Note that we do this after adjusting
   // for borderpadding, since buttons have border-box sizing...
@@ -379,18 +379,18 @@ nsHTMLButtonControlFrame::ReflowButtonCo
   // calculate the min internal height so the contents gets centered correctly.
   // XXXbz this assumes border-box sizing.
   nscoord minInternalHeight = aReflowState.mComputedMinHeight -
     aReflowState.mComputedBorderPadding.TopBottom();
   minInternalHeight = PR_MAX(minInternalHeight, 0);
 
   // center child vertically
   nscoord yoff = 0;
-  if (aReflowState.mComputedHeight != NS_INTRINSICSIZE) {
-    yoff = (aReflowState.mComputedHeight - aDesiredSize.height)/2;
+  if (aReflowState.ComputedHeight() != NS_INTRINSICSIZE) {
+    yoff = (aReflowState.ComputedHeight() - aDesiredSize.height)/2;
     if (yoff < 0) {
       yoff = 0;
     }
   } else if (aDesiredSize.height < minInternalHeight) {
     yoff = (minInternalHeight - aDesiredSize.height) / 2;
   }
 
   // Place the child
--- a/layout/forms/nsListControlFrame.cpp
+++ b/layout/forms/nsListControlFrame.cpp
@@ -560,30 +560,31 @@ nsListControlFrame::Reflow(nsPresContext
    * - We're reflowing with a constrained computed height -- just use that
    *   height.
    * - We're not dirty and have no dirty kids.  In this case, our cached max
    *   height of a child is not going to change.
    * - We do our first reflow using our cached max height of a child, then
    *   compute the new max height and it's the same as the old one.
    */
 
-  PRBool autoHeight = (aReflowState.mComputedHeight == NS_UNCONSTRAINEDSIZE);
+  PRBool autoHeight = (aReflowState.ComputedHeight() == NS_UNCONSTRAINEDSIZE);
 
   mMightNeedSecondPass = autoHeight && NS_SUBTREE_DIRTY(this);
   
   nsHTMLReflowState state(aReflowState);
   PRInt32 length = GetNumberOfOptions();  
 
   nscoord oldHeightOfARow = HeightOfARow();
   
   if (!(GetStateBits() & NS_FRAME_FIRST_REFLOW) && autoHeight) {
     // When not doing an initial reflow, and when the height is auto, start off
     // with our computed height set to what we'd expect our height to be.
-    state.mComputedHeight = CalcIntrinsicHeight(oldHeightOfARow, length);
-    state.ApplyMinMaxConstraints(nsnull, &state.mComputedHeight);
+    nscoord computedHeight = CalcIntrinsicHeight(oldHeightOfARow, length);
+    state.ApplyMinMaxConstraints(nsnull, &computedHeight);
+    state.SetComputedHeight(computedHeight);
   }
 
   nsresult rv = nsHTMLScrollFrame::Reflow(aPresContext, aDesiredSize,
                                           state, aStatus);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (!mMightNeedSecondPass) {
     NS_ASSERTION(!autoHeight || HeightOfARow() == oldHeightOfARow,
@@ -610,50 +611,51 @@ nsListControlFrame::Reflow(nsPresContext
   // Gotta reflow again.
   // XXXbz We're just changing the height here; do we need to dirty ourselves
   // or anything like that?  We might need to, per the letter of the reflow
   // protocol, but things seem to work fine without it...  Is that just an
   // implementation detail of nsHTMLScrollFrame that we're depending on?
   nsHTMLScrollFrame::DidReflow(aPresContext, &state, aStatus);
 
   // Now compute the height we want to have
-  state.mComputedHeight = CalcIntrinsicHeight(HeightOfARow(), length);
-  state.ApplyMinMaxConstraints(nsnull, &state.mComputedHeight);
+  nscoord computedHeight = CalcIntrinsicHeight(HeightOfARow(), length); 
+  state.ApplyMinMaxConstraints(nsnull, &computedHeight);
+  state.SetComputedHeight(computedHeight);
 
   nsHTMLScrollFrame::WillReflow(aPresContext);
 
   // XXXbz to make the ascent really correct, we should add our
   // mComputedPadding.top to it (and subtract it from descent).  Need that
   // because nsGfxScrollFrame just adds in the border....
   return nsHTMLScrollFrame::Reflow(aPresContext, aDesiredSize, state, aStatus);
 }
 
 nsresult
 nsListControlFrame::ReflowAsDropdown(nsPresContext*           aPresContext, 
                                      nsHTMLReflowMetrics&     aDesiredSize,
                                      const nsHTMLReflowState& aReflowState, 
                                      nsReflowStatus&          aStatus)
 {
-  NS_PRECONDITION(aReflowState.mComputedHeight == NS_UNCONSTRAINEDSIZE,
+  NS_PRECONDITION(aReflowState.ComputedHeight() == NS_UNCONSTRAINEDSIZE,
                   "We should not have a computed height here!");
   
   mMightNeedSecondPass = NS_SUBTREE_DIRTY(this);
 
   nscoord oldHeightOfARow = HeightOfARow();
 
   nsHTMLReflowState state(aReflowState);
 
   nscoord oldVisibleHeight;
   if (!(GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
     // When not doing an initial reflow, and when the height is auto, start off
     // with our computed height set to what we'd expect our height to be.
     // Note: At this point, mLastDropdownComputedHeight can be
     // NS_UNCONSTRAINEDSIZE in cases when last time we didn't have to constrain
     // the height.  That's fine; just do the same thing as last time.
-    state.mComputedHeight = mLastDropdownComputedHeight;
+    state.SetComputedHeight(mLastDropdownComputedHeight);
     oldVisibleHeight = GetScrolledFrame()->GetSize().height;
   } else {
     // Set oldVisibleHeight to something that will never test true against a
     // real height.
     oldVisibleHeight = NS_UNCONSTRAINEDSIZE;
   }
 
   nsresult rv = nsHTMLScrollFrame::Reflow(aPresContext, aDesiredSize,
@@ -724,32 +726,32 @@ nsListControlFrame::ReflowAsDropdown(nsP
         mNumDisplayRows = visibleHeight / heightOfARow;
       } else {
         // Hmmm, not sure what to do here. Punt, and make both of them one
         visibleHeight   = 1;
         mNumDisplayRows = 1;
       }
     }
 
-    state.mComputedHeight = mNumDisplayRows * heightOfARow;
+    state.SetComputedHeight(mNumDisplayRows * heightOfARow);
     // Note: no need to apply min/max constraints, since we have no such
     // rules applied to the combobox dropdown.
     // XXXbz this is ending up too big!!  Figure out why.
   } else if (visibleHeight == 0) {
     // Looks like we have no options.  Just size us to a single row height.
-    state.mComputedHeight = heightOfARow;
+    state.SetComputedHeight(heightOfARow);
   } else {
     // Not too big, not too small.  Just use it!
-    state.mComputedHeight = NS_UNCONSTRAINEDSIZE;
+    state.SetComputedHeight(NS_UNCONSTRAINEDSIZE);
   }
 
   // Note: At this point, state.mComputedHeight can be NS_UNCONSTRAINEDSIZE in
   // cases when there were some options, but not too many (so no scrollbar was
   // needed).  That's fine; just store that.
-  mLastDropdownComputedHeight = state.mComputedHeight;
+  mLastDropdownComputedHeight = state.ComputedHeight();
 
   nsHTMLScrollFrame::WillReflow(aPresContext);
   return nsHTMLScrollFrame::Reflow(aPresContext, aDesiredSize, state, aStatus);
 }
 
 nsGfxScrollFrameInner::ScrollbarStyles
 nsListControlFrame::GetScrollbarStyles() const
 {
--- a/layout/generic/nsAbsoluteContainingBlock.cpp
+++ b/layout/generic/nsAbsoluteContainingBlock.cpp
@@ -333,17 +333,17 @@ nsAbsoluteContainingBlock::ReflowAbsolut
     }
 
     char width[16];
     char height[16];
     PrettyUC(aReflowState.availableWidth, width);
     PrettyUC(aReflowState.availableHeight, height);
     printf(" a=%s,%s ", width, height);
     PrettyUC(aReflowState.ComputedWidth(), width);
-    PrettyUC(aReflowState.mComputedHeight, height);
+    PrettyUC(aReflowState.ComputedHeight(), height);
     printf("c=%s,%s \n", width, height);
   }
   AutoNoisyIndenter indent(nsBlockFrame::gNoisy);
 #endif // DEBUG
 
   // Store position and overflow rect so taht we can invalidate the correct
   // area if the position changes
   nsRect oldOverflowRect(aKidFrame->GetOverflowRect() +
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -819,19 +819,19 @@ CalculateContainingBlockSizeForAbsolutes
         }
       }
       // We found a reflow state for the outermost wrapping frame, so use
       // its computed metrics if available
       if (aLastRS->ComputedWidth() != NS_UNCONSTRAINEDSIZE) {
         cbSize.width = PR_MAX(0,
           aLastRS->ComputedWidth() + aLastRS->mComputedPadding.LeftRight() - scrollbars.LeftRight());
       }
-      if (aLastRS->mComputedHeight != NS_UNCONSTRAINEDSIZE) {
+      if (aLastRS->ComputedHeight() != NS_UNCONSTRAINEDSIZE) {
         cbSize.height = PR_MAX(0,
-          aLastRS->mComputedHeight + aLastRS->mComputedPadding.TopBottom() - scrollbars.TopBottom());
+          aLastRS->ComputedHeight() + aLastRS->mComputedPadding.TopBottom() - scrollbars.TopBottom());
       }
     }
   }
 
   return cbSize;
 }
 
 NS_IMETHODIMP
@@ -843,17 +843,17 @@ nsBlockFrame::Reflow(nsPresContext*     
   DO_GLOBAL_REFLOW_COUNT("nsBlockFrame");
   DISPLAY_REFLOW(aPresContext, this, aReflowState, aMetrics, aStatus);
 #ifdef DEBUG
   if (gNoisyReflow) {
     IndentBy(stdout, gNoiseIndent);
     ListTag(stdout);
     printf(": begin reflow availSize=%d,%d computedSize=%d,%d\n",
            aReflowState.availableWidth, aReflowState.availableHeight,
-           aReflowState.ComputedWidth(), aReflowState.mComputedHeight);
+           aReflowState.ComputedWidth(), aReflowState.ComputedHeight());
   }
   AutoNoisyIndenter indent(gNoisy);
   PRTime start = LL_ZERO; // Initialize these variablies to silence the compiler.
   PRInt32 ctc = 0;        // We only use these if they are set (gLameReflowMetrics).
   if (gLameReflowMetrics) {
     start = PR_Now();
     ctc = nsLineBox::GetCtorCount();
   }
@@ -1125,17 +1125,17 @@ nsBlockFrame::Reflow(nsPresContext*     
     // changed.
     PRBool cbWidthChanged = aMetrics.width != oldSize.width;
     PRBool isRoot = !GetContent()->GetParent();
     // If isRoot and we have auto height, then we are the initial
     // containing block and the containing block height is the
     // viewport height, which can't change during incremental
     // reflow.
     PRBool cbHeightChanged =
-      !(isRoot && NS_UNCONSTRAINEDSIZE == aReflowState.mComputedHeight) &&
+      !(isRoot && NS_UNCONSTRAINEDSIZE == aReflowState.ComputedHeight()) &&
       aMetrics.height != oldSize.height;
 
     rv = mAbsoluteContainer.Reflow(this, aPresContext, aReflowState,
                                    containingBlockSize.width,
                                    containingBlockSize.height,
                                    cbWidthChanged, cbHeightChanged,
                                    &childBounds);
 
@@ -1258,20 +1258,20 @@ nsBlockFrame::ComputeFinalSize(const nsH
       aState.mPrevBottomMargin.Zero();
     }
     aMetrics.mCarriedOutBottomMargin = aState.mPrevBottomMargin;
   } else {
     aMetrics.mCarriedOutBottomMargin.Zero();
   }
 
   // Compute final height
-  if (NS_UNCONSTRAINEDSIZE != aReflowState.mComputedHeight) {
+  if (NS_UNCONSTRAINEDSIZE != aReflowState.ComputedHeight()) {
     // Figure out how much of the computed height should be
     // applied to this frame.
-    nscoord computedHeightLeftOver = aReflowState.mComputedHeight;
+    nscoord computedHeightLeftOver = aReflowState.ComputedHeight();
     if (GetPrevInFlow()) {
       // Reduce the height by the computed height of prev-in-flows.
       for (nsIFrame* prev = GetPrevInFlow(); prev; prev = prev->GetPrevInFlow()) {
         computedHeightLeftOver -= prev->GetRect().height;
       }
       // We just subtracted our top-border padding, since it was included in the
       // first frame's height. Add it back to get the content height.
       computedHeightLeftOver += aReflowState.mComputedBorderPadding.top;
--- a/layout/generic/nsBlockReflowContext.cpp
+++ b/layout/generic/nsBlockReflowContext.cpp
@@ -170,25 +170,25 @@ nsBlockReflowContext::ComputeCollapsedTo
             // We may have to construct an extra reflow state here if
             // we drilled down through a block wrapper. At the moment
             // we can only drill down one level so we only have to support
             // one extra reflow state.
             const nsHTMLReflowState* outerReflowState = &aRS;
             if (frame != aRS.frame) {
               NS_ASSERTION(frame->GetParent() == aRS.frame,
                            "Can only drill through one level of block wrapper");
-              nsSize availSpace(aRS.ComputedWidth(), aRS.mComputedHeight);
+              nsSize availSpace(aRS.ComputedWidth(), aRS.ComputedHeight());
               outerReflowState = new nsHTMLReflowState(prescontext,
                                                        aRS, frame, availSpace);
               if (!outerReflowState)
                 goto done;
             }
             {
               nsSize availSpace(outerReflowState->ComputedWidth(),
-                                outerReflowState->mComputedHeight);
+                                outerReflowState->ComputedHeight());
               nsHTMLReflowState innerReflowState(prescontext,
                                                  *outerReflowState, kid,
                                                  availSpace);
               // Record that we're being optimistic by assuming the kid
               // has no clearance
               if (kid->GetStyleDisplay()->mBreakType != NS_STYLE_CLEAR_NONE) {
                 *aMayNeedRetry = PR_TRUE;
               }
--- a/layout/generic/nsColumnSetFrame.cpp
+++ b/layout/generic/nsColumnSetFrame.cpp
@@ -220,18 +220,18 @@ nsColumnSetFrame::ReflowConfig
 nsColumnSetFrame::ChooseColumnStrategy(const nsHTMLReflowState& aReflowState)
 {
   const nsStyleColumn* colStyle = GetStyleColumn();
   nscoord availContentWidth = GetAvailableContentWidth(aReflowState);
   if (aReflowState.ComputedWidth() != NS_INTRINSICSIZE) {
     availContentWidth = aReflowState.ComputedWidth();
   }
   nscoord colHeight = GetAvailableContentHeight(aReflowState);
-  if (aReflowState.mComputedHeight != NS_INTRINSICSIZE) {
-    colHeight = aReflowState.mComputedHeight;
+  if (aReflowState.ComputedHeight() != NS_INTRINSICSIZE) {
+    colHeight = aReflowState.ComputedHeight();
   }
 
   nscoord colGap = GetColumnGap(this, colStyle);
   PRInt32 numColumns = colStyle->mColumnCount;
 
   nscoord colWidth = NS_INTRINSICSIZE;
   if (colStyle->mColumnWidth.GetUnit() == eStyleUnit_Coord) {
     colWidth = colStyle->mColumnWidth.GetCoordValue();
@@ -277,17 +277,17 @@ nsColumnSetFrame::ChooseColumnStrategy(c
       PR_MAX(0, availContentWidth - (colWidth*numColumns + colGap*(numColumns - 1)));
     nscoord extraToColumns = extraSpace/numColumns;
     colWidth += extraToColumns;
     expectedWidthLeftOver = extraSpace - (extraToColumns*numColumns);
   }
 
   // NOTE that the non-balancing behavior for non-auto computed height
   // is not in the CSS3 columns draft as of 18 January 2001
-  if (aReflowState.mComputedHeight == NS_INTRINSICSIZE) {
+  if (aReflowState.ComputedHeight() == NS_INTRINSICSIZE) {
     // Balancing!
     if (numColumns <= 0) {
       // Hmm, auto column count, column width or available width is unknown,
       // and balancing is required. Let's just use one column then.
       numColumns = 1;
     }
     colHeight = PR_MIN(mLastBalanceHeight, GetAvailableContentHeight(aReflowState));
   } else {
@@ -483,17 +483,17 @@ nsColumnSetFrame::ReflowChildren(nsHTMLR
         availSize.height = GetAvailableContentHeight(aReflowState);
       }
   
       if (reflowNext)
         child->AddStateBits(NS_FRAME_IS_DIRTY);
 
       nsHTMLReflowState kidReflowState(PresContext(), aReflowState, child,
                                        availSize, availSize.width,
-                                       aReflowState.mComputedHeight);
+                                       aReflowState.ComputedHeight());
       kidReflowState.mFlags.mIsTopOfPage = PR_TRUE;
       kidReflowState.mFlags.mTableIsSplittable = PR_FALSE;
           
 #ifdef DEBUG_roc
       printf("*** Reflowing child #%d %p: availHeight=%d\n",
              columnCount, (void*)child,availSize.height);
 #endif
 
@@ -633,18 +633,18 @@ nsColumnSetFrame::ReflowChildren(nsHTMLR
   mLastFrameStatus = aStatus;
   
   // contentRect included the borderPadding.left,borderPadding.top of the child rects
   contentRect -= nsPoint(borderPadding.left, borderPadding.top);
   
   nsSize contentSize = nsSize(contentRect.XMost(), contentRect.YMost());
 
   // Apply computed and min/max values
-  if (aReflowState.mComputedHeight != NS_INTRINSICSIZE) {
-    contentSize.height = aReflowState.mComputedHeight;
+  if (aReflowState.ComputedHeight() != NS_INTRINSICSIZE) {
+    contentSize.height = aReflowState.ComputedHeight();
   } else {
     if (NS_UNCONSTRAINEDSIZE != aReflowState.mComputedMaxHeight) {
       contentSize.height = PR_MIN(aReflowState.mComputedMaxHeight, contentSize.height);
     }
     if (NS_UNCONSTRAINEDSIZE != aReflowState.mComputedMinHeight) {
       contentSize.height = PR_MAX(aReflowState.mComputedMinHeight, contentSize.height);
     }
   }
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -3297,18 +3297,18 @@ nsFrame::DidReflow(nsPresContext*       
   }
 
   // Notify the percent height observer if there is a percent height
   // but no computed height. The observer may be able to initiate
   // another reflow with a computed height. This happens in the case
   // where a table cell has no computed height but can fabricate one
   // when the cell height is known.
   if (aReflowState && aReflowState->mPercentHeightObserver &&
-      ((NS_UNCONSTRAINEDSIZE == aReflowState->mComputedHeight) ||         // no computed height 
-       (0                    == aReflowState->mComputedHeight))        && 
+      ((NS_UNCONSTRAINEDSIZE == aReflowState->ComputedHeight()) ||         // no computed height 
+       (0                    == aReflowState->ComputedHeight()))        && 
       (eStyleUnit_Percent == aReflowState->mStylePosition->mHeight.GetUnit())) {
 
     nsIFrame* prevInFlow = GetPrevInFlow();
     if (!prevInFlow) { // 1st in flow
       aReflowState->mPercentHeightObserver->NotifyPercentHeight(*aReflowState);
     }
   }
 
@@ -6182,17 +6182,17 @@ nsFrame::BoxReflow(nsBoxLayoutState&    
                                         parentSize);
     parentFrame->RemoveStateBits(0xffffffff);
     parentFrame->AddStateBits(savedState);
 
     // This may not do very much useful, but it's probably worth trying.
     if (parentSize.width != NS_INTRINSICSIZE)
       parentReflowState.SetComputedWidth(parentSize.width);
     if (parentSize.height != NS_INTRINSICSIZE)
-      parentReflowState.mComputedHeight = parentSize.height;
+      parentReflowState.SetComputedHeight(parentSize.height);
     parentReflowState.mComputedMargin.SizeTo(0, 0, 0, 0);
     // XXX use box methods
     parentFrame->GetPadding(parentReflowState.mComputedPadding);
     parentFrame->GetBorder(parentReflowState.mComputedBorderPadding);
     parentReflowState.mComputedBorderPadding +=
       parentReflowState.mComputedPadding;
 
     // XXX Is it OK that this reflow state has no parent reflow state?
@@ -6210,48 +6210,50 @@ nsFrame::BoxReflow(nsBoxLayoutState&    
     // border-box
     if (aWidth != NS_INTRINSICSIZE) {
       nscoord computedWidth =
         aWidth - reflowState.mComputedBorderPadding.LeftRight();
       computedWidth = PR_MAX(computedWidth, 0);
       reflowState.SetComputedWidth(computedWidth);
     }
     if (aHeight != NS_INTRINSICSIZE) {
-      reflowState.mComputedHeight =
+      nscoord computedHeight =
         aHeight - reflowState.mComputedBorderPadding.TopBottom();
-      if (reflowState.mComputedHeight < 0)
-        reflowState.mComputedHeight = 0;
+      computedHeight = PR_MAX(computedHeight, 0);
+      reflowState.SetComputedHeight(computedHeight);
     } else {
-      reflowState.mComputedHeight =
+      reflowState.SetComputedHeight(
         ComputeSize(aRenderingContext, availSize, availSize.width,
                     nsSize(reflowState.mComputedMargin.LeftRight(),
                            reflowState.mComputedMargin.TopBottom()),
                     nsSize(reflowState.mComputedBorderPadding.LeftRight() -
                              reflowState.mComputedPadding.LeftRight(),
                            reflowState.mComputedBorderPadding.TopBottom() -
                              reflowState.mComputedPadding.TopBottom()),
                     nsSize(reflowState.mComputedPadding.LeftRight(),
                            reflowState.mComputedPadding.TopBottom()),
-                    PR_FALSE).height;
+                    PR_FALSE).height
+        );
     }
 
     // Box layout calls SetRect before Layout, whereas non-box layout
     // calls SetRect after Reflow.
     // XXX Perhaps we should be doing this by twiddling the rect back to
     // mLastSize before calling Reflow and then switching it back, but
     // However, mLastSize can also be the size passed to BoxReflow by
     // RefreshSizeCache, so that doesn't really make sense.
     if (metrics->mLastSize.width != aWidth)
       reflowState.mFlags.mHResize = PR_TRUE;
     if (metrics->mLastSize.height != aHeight)
       reflowState.mFlags.mVResize = PR_TRUE;
 
     #ifdef DEBUG_REFLOW
       nsAdaptorAddIndents();
-      printf("Size=(%d,%d)\n",reflowState.ComputedWidth(), reflowState.mComputedHeight);
+      printf("Size=(%d,%d)\n",reflowState.ComputedWidth(),
+             reflowState.ComputedHeight());
       nsAdaptorAddIndents();
       nsAdaptorPrintReason(reflowState);
       printf("\n");
     #endif
 
        // place the child and reflow
     WillReflow(aPresContext);
 
@@ -7206,17 +7208,17 @@ static void DisplayReflowEnterPrint(nsPr
     char width[16];
     char height[16];
 
     DR_state->PrettyUC(aReflowState.availableWidth, width);
     DR_state->PrettyUC(aReflowState.availableHeight, height);
     printf("Reflow a=%s,%s ", width, height);
 
     DR_state->PrettyUC(aReflowState.ComputedWidth(), width);
-    DR_state->PrettyUC(aReflowState.mComputedHeight, height);
+    DR_state->PrettyUC(aReflowState.ComputedHeight(), height);
     printf("c=%s,%s ", width, height);
 
     if (aFrame->GetStateBits() & NS_FRAME_IS_DIRTY)
       printf("dirty ");
 
     if (aFrame->GetStateBits() & NS_FRAME_HAS_DIRTY_CHILDREN)
       printf("dirty-children ");
 
@@ -7241,17 +7243,17 @@ static void DisplayReflowEnterPrint(nsPr
       printf("CHANGED \n");
     else 
       printf("cnt=%d \n", DR_state->mCount);
     if (DR_state->mDisplayPixelErrors) {
       PRInt32 p2t = aPresContext->AppUnitsPerDevPixel();
       CheckPixelError(aReflowState.availableWidth, p2t);
       CheckPixelError(aReflowState.availableHeight, p2t);
       CheckPixelError(aReflowState.ComputedWidth(), p2t);
-      CheckPixelError(aReflowState.mComputedHeight, p2t);
+      CheckPixelError(aReflowState.ComputedHeight(), p2t);
     }
   }
 }
 
 void* nsFrame::DisplayReflowEnter(nsPresContext*          aPresContext,
                                   nsIFrame*                aFrame,
                                   const nsHTMLReflowState& aReflowState)
 {
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -264,17 +264,17 @@ static nsSize ComputeInsideBorderSize(Sc
   // 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.ComputedWidth();
   if (contentWidth == NS_UNCONSTRAINEDSIZE) {
     contentWidth = aDesiredInsideBorderSize.width -
       aState->mReflowState.mComputedPadding.LeftRight();
   }
-  nscoord contentHeight = aState->mReflowState.mComputedHeight;
+  nscoord contentHeight = aState->mReflowState.ComputedHeight();
   if (contentHeight == NS_UNCONSTRAINEDSIZE) {
     contentHeight = aDesiredInsideBorderSize.height -
       aState->mReflowState.mComputedPadding.TopBottom();
   }
 
   aState->mReflowState.ApplyMinMaxConstraints(&contentWidth, &contentHeight);
   return nsSize(contentWidth + aState->mReflowState.mComputedPadding.LeftRight(),
                 contentHeight + aState->mReflowState.mComputedPadding.TopBottom());
--- a/layout/generic/nsHTMLCanvasFrame.cpp
+++ b/layout/generic/nsHTMLCanvasFrame.cpp
@@ -132,17 +132,17 @@ nsHTMLCanvasFrame::Reflow(nsPresContext*
                   ("enter nsHTMLCanvasFrame::Reflow: availSize=%d,%d",
                   aReflowState.availableWidth, aReflowState.availableHeight));
 
   NS_PRECONDITION(mState & NS_FRAME_IN_REFLOW, "frame is not in reflow");
 
   aStatus = NS_FRAME_COMPLETE;
 
   aMetrics.width = aReflowState.ComputedWidth();
-  aMetrics.height = aReflowState.mComputedHeight;
+  aMetrics.height = aReflowState.ComputedHeight();
 
   // stash this away so we can compute our inner area later
   mBorderPadding   = aReflowState.mComputedBorderPadding;
 
   aMetrics.width += mBorderPadding.left + mBorderPadding.right;
   aMetrics.height += mBorderPadding.top + mBorderPadding.bottom;
 
   if (GetPrevInFlow()) {
--- a/layout/generic/nsHTMLReflowState.cpp
+++ b/layout/generic/nsHTMLReflowState.cpp
@@ -259,16 +259,42 @@ nsHTMLReflowState::SetComputedWidth(nsco
     mComputedWidth = aComputedWidth;
     if (frame->GetType() != nsGkAtoms::viewportFrame) { // Or check GetParent()?
       InitResizeFlags(frame->PresContext());
     }
   }
 }
 
 void
+nsHTMLReflowState::SetComputedHeight(nscoord aComputedHeight)
+{
+  NS_ASSERTION(frame, "Must have a frame!");
+  // It'd be nice to assert that |frame| is not in reflow, but this fails for
+  // two reasons:
+  //
+  // 1) Viewport frames reset the computed height on a copy of their reflow
+  //    state when reflowing fixed-pos kids.  In that case we actually don't
+  //    want to mess with the resize flags, because comparing the frame's rect
+  //    to the munged computed width is pointless.
+  // 2) nsFrame::BoxReflow creates a reflow state for its parent.  This reflow
+  //    state is not used to reflow the parent, but just as a parent for the
+  //    frame's own reflow state.  So given a nsBoxFrame inside some non-XUL
+  //    (like a text control, for example), we'll end up creating a reflow
+  //    state for the parent while the parent is reflowing.
+
+  NS_PRECONDITION(aComputedHeight >= 0, "Invalid computed height");
+  if (mComputedHeight != aComputedHeight) {
+    mComputedHeight = aComputedHeight;
+    if (frame->GetType() != nsGkAtoms::viewportFrame) { // Or check GetParent()?
+      InitResizeFlags(frame->PresContext());
+    }
+  }
+}
+
+void
 nsHTMLReflowState::Init(nsPresContext* aPresContext,
                         nscoord         aContainingBlockWidth,
                         nscoord         aContainingBlockHeight,
                         const nsMargin* aBorder,
                         const nsMargin* aPadding)
 {
   NS_ASSERTION(availableWidth != NS_UNCONSTRAINEDSIZE,
                "shouldn't use unconstrained widths anymore");
@@ -341,17 +367,17 @@ IsQuirkContainingBlockHeight(const nsHTM
       if (rs->frame->GetStyleContext()->GetPseudoType() ==
           nsCSSAnonBoxes::scrolledContent) {
         return PR_FALSE;
       }
     }
     
     // Note: This next condition could change due to a style change,
     // but that would cause a style reflow anyway, which means we're ok.
-    if (NS_AUTOHEIGHT == rs->mComputedHeight) {
+    if (NS_AUTOHEIGHT == rs->ComputedHeight()) {
       if (!rs->frame->GetStyleDisplay()->IsAbsolutelyPositioned()) {
         return PR_FALSE;
       }
     }
   }
   return PR_TRUE;
 }
 
@@ -1395,17 +1421,17 @@ CalcQuirkContainingBlockHeight(const nsH
 
       secondAncestorRS = firstAncestorRS;
       firstAncestorRS = (nsHTMLReflowState*)rs;
 
       // If the current frame we're looking at is positioned, we don't want to
       // go any further (see bug 221784).  The behavior we want here is: 1) If
       // not auto-height, use this as the percentage base.  2) If auto-height,
       // keep looking, unless the frame is positioned.
-      if (NS_AUTOHEIGHT == rs->mComputedHeight) {
+      if (NS_AUTOHEIGHT == rs->ComputedHeight()) {
         if (rs->frame->GetStyleDisplay()->IsAbsolutelyPositioned()) {
           break;
         } else {
           continue;
         }
       }
     }
     else if (nsGkAtoms::canvasFrame == frameType) {
@@ -1424,17 +1450,17 @@ CalcQuirkContainingBlockHeight(const nsH
     }
     else {
       break;
     }
 
     // if the ancestor is the page content frame then the percent base is 
     // the avail height, otherwise it is the computed height
     result = (nsGkAtoms::pageContentFrame == frameType)
-             ? rs->availableHeight : rs->mComputedHeight;
+             ? rs->availableHeight : rs->ComputedHeight();
     // if unconstrained - don't sutract borders - would result in huge height
     if (NS_AUTOHEIGHT == result) return result;
 
     // if we got to the canvas or page content frame, then subtract out 
     // margin/border/padding for the BODY and HTML elements
     if ((nsGkAtoms::canvasFrame == frameType) || 
         (nsGkAtoms::pageContentFrame == frameType)) {
 
--- a/layout/generic/nsHTMLReflowState.h
+++ b/layout/generic/nsHTMLReflowState.h
@@ -273,32 +273,32 @@ private:
   //
   // For replaced inline frames, a value of NS_INTRINSICSIZE means you should
   // use your intrinsic width as the computed width
   //
   // For block-level frames, the computed width is based on the width of the
   // 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
   //
   // For replaced inline frames, a value of NS_INTRINSICSIZE means you should
   // use your intrinsic height as the computed height
   //
   // For non-replaced block-level frames in the flow and floated, a value of
   // NS_AUTOHEIGHT means you choose a height to shrink wrap around the normal
   // flow child frames. The height must be within the limit of the min/max
   // height if there is such a limit
   //
   // For replaced block-level frames, a value of NS_INTRINSICSIZE
   // means you use your intrinsic height as the computed height
   nscoord          mComputedHeight;
 
+public:
   // Computed values for 'left/top/right/bottom' offsets. Only applies to
   // 'positioned' elements
   nsMargin         mComputedOffsets;
 
   // Computed values for 'min-width/max-width' and 'min-height/max-height'
   // XXXldb The width ones here should go; they should be needed only
   // internally.
   nscoord          mComputedMinWidth, mComputedMaxWidth;
@@ -442,18 +442,23 @@ public:
     // frames NS_FRAME_CONTAINS_RELATIVE_HEIGHT is marked on.
     return (frame->GetStateBits() & NS_FRAME_IS_DIRTY) ||
            mFlags.mHResize ||
            (mFlags.mVResize && 
             (frame->GetStateBits() & NS_FRAME_CONTAINS_RELATIVE_HEIGHT));
   }
 
   nscoord ComputedWidth() const { return mComputedWidth; }
+  // This method doesn't apply min/max computed widths to the value passed in.
   void SetComputedWidth(nscoord aComputedWidth);
 
+  nscoord ComputedHeight() const { return mComputedHeight; }
+  // This method doesn't apply min/max computed heights to the value passed in.
+  void SetComputedHeight(nscoord aComputedHeight);
+
   void SetTruncated(const nsHTMLReflowMetrics& aMetrics, nsReflowStatus* aStatus) const;
 
 protected:
 
   void InitCBReflowState();
   void InitResizeFlags(nsPresContext* aPresContext);
 
   void InitConstraints(nsPresContext* aPresContext,
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -144,26 +144,26 @@ static PRBool HaveFixedSize(const nsStyl
            heightUnit == eStyleUnit_Percent));
 }
 // use the data in the reflow state to decide if the image has a constrained size
 // (i.e. width and height that are based on the containing block size and not the image size) 
 // so we can avoid animated GIF related reflows
 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 
+  // when an image has percent css style height or width, but ComputedHeight() 
   // 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, 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) ||
+  return ((eStyleUnit_Percent == heightUnit && NS_UNCONSTRAINEDSIZE == aReflowState.ComputedHeight()) ||
           (eStyleUnit_Percent == widthUnit && (NS_UNCONSTRAINEDSIZE == aReflowState.ComputedWidth() ||
            0 == aReflowState.ComputedWidth())))
           ? PR_FALSE
           : HaveFixedSize(aReflowState.mStylePosition); 
 }
 
 nsIFrame*
 NS_NewImageFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
@@ -787,17 +787,17 @@ nsImageFrame::Reflow(nsPresContext*     
 
   // XXXldb These two bits are almost exact opposites (except in the
   // middle of the initial reflow); remove IMAGE_GOTINITIALREFLOW.
   if (GetStateBits() & NS_FRAME_FIRST_REFLOW) {
     mState |= IMAGE_GOTINITIALREFLOW;
   }
 
   mComputedSize = 
-    nsSize(aReflowState.ComputedWidth(), aReflowState.mComputedHeight);
+    nsSize(aReflowState.ComputedWidth(), aReflowState.ComputedHeight());
   RecalculateTransform();
 
   aMetrics.width = mComputedSize.width;
   aMetrics.height = mComputedSize.height;
 
   // add borders and padding
   aMetrics.width  += aReflowState.mComputedBorderPadding.LeftRight();
   aMetrics.height += aReflowState.mComputedBorderPadding.TopBottom();
--- a/layout/generic/nsLeafFrame.cpp
+++ b/layout/generic/nsLeafFrame.cpp
@@ -82,18 +82,18 @@ nsLeafFrame::Reflow(nsPresContext* aPres
 
   // 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.ComputedWidth() != NS_UNCONSTRAINEDSIZE,
                "Shouldn't have unconstrained stuff here");
 
   aMetrics.width = aReflowState.ComputedWidth();
-  if (NS_INTRINSICSIZE != aReflowState.mComputedHeight) {
-    aMetrics.height = aReflowState.mComputedHeight;
+  if (NS_INTRINSICSIZE != aReflowState.ComputedHeight()) {
+    aMetrics.height = aReflowState.ComputedHeight();
   } else {
     aMetrics.height = GetIntrinsicHeight();
     // XXXbz using NS_CSS_MINMAX like this presupposes content-box sizing.
     aMetrics.height = NS_CSS_MINMAX(aMetrics.height,
                                     aReflowState.mComputedMinHeight,
                                     aReflowState.mComputedMaxHeight);
   }
   
--- a/layout/generic/nsObjectFrame.cpp
+++ b/layout/generic/nsObjectFrame.cpp
@@ -639,17 +639,17 @@ nsObjectFrame::GetDesiredSize(nsPresCont
   aMetrics.width = 0;
   aMetrics.height = 0;
 
   if (IsHidden(PR_FALSE)) {
     return;
   }
   
   aMetrics.width = aReflowState.ComputedWidth();
-  aMetrics.height = aReflowState.mComputedHeight;
+  aMetrics.height = aReflowState.ComputedHeight();
 
   // for EMBED and APPLET, default to 240x200 for compatibility
   nsIAtom *atom = mContent->Tag();
   if (atom == nsGkAtoms::applet || atom == nsGkAtoms::embed) {
     if (aMetrics.width == NS_UNCONSTRAINEDSIZE) {
       aMetrics.width = PR_MIN(PR_MAX(nsPresContext::CSSPixelsToAppUnits(EMBED_DEF_WIDTH),
                                      aReflowState.mComputedMinWidth),
                               aReflowState.mComputedMaxWidth);
--- a/layout/generic/nsSimplePageSequence.cpp
+++ b/layout/generic/nsSimplePageSequence.cpp
@@ -282,17 +282,17 @@ nsSimplePageSequenceFrame::Reflow(nsPres
   nsHTMLReflowMetrics kidSize;
   for (nsIFrame* kidFrame = mFrames.FirstChild(); nsnull != kidFrame; ) {
     // Reflow the page
     nsHTMLReflowState kidReflowState(aPresContext, aReflowState, kidFrame,
                                      availSize);
     nsReflowStatus  status;
 
     kidReflowState.SetComputedWidth(kidReflowState.availableWidth);
-    //kidReflowState.mComputedHeight = kidReflowState.availableHeight;
+    //kidReflowState.SetComputedHeight(kidReflowState.availableHeight);
     PR_PL(("AV W: %d   H: %d\n", kidReflowState.availableWidth, kidReflowState.availableHeight));
 
     // Set the shared data into the page frame before reflow
     nsPageFrame * pf = static_cast<nsPageFrame*>(kidFrame);
     pf->SetSharedPageData(mPageData);
 
     // Place and size the page. If the page is narrower than our
     // max width then center it horizontally
--- a/layout/generic/nsViewportFrame.cpp
+++ b/layout/generic/nsViewportFrame.cpp
@@ -227,19 +227,20 @@ nsPoint
 
   // Get our prinicpal child frame and see if we're scrollable
   nsIFrame* kidFrame = mFrames.FirstChild();
   nsCOMPtr<nsIScrollableFrame> scrollingFrame(do_QueryInterface(kidFrame));
 
   if (scrollingFrame) {
     nsMargin scrollbars = scrollingFrame->GetActualScrollbarSizes();
     aReflowState->SetComputedWidth(aReflowState->ComputedWidth() -
-                                   (scrollbars.left + scrollbars.right));
-    aReflowState->availableWidth -= scrollbars.left + scrollbars.right;
-    aReflowState->mComputedHeight -= scrollbars.top + scrollbars.bottom;
+                                   scrollbars.LeftRight());
+    aReflowState->availableWidth -= scrollbars.LeftRight();
+    aReflowState->SetComputedHeight(aReflowState->ComputedHeight() -
+                                    scrollbars.TopBottom());
     // XXX why don't we also adjust "aReflowState->availableHeight"?
     return nsPoint(scrollbars.left, scrollbars.top);
   }
   return nsPoint(0, 0);
 }
 
 NS_IMETHODIMP
 ViewportFrame::Reflow(nsPresContext*          aPresContext,
@@ -275,17 +276,17 @@ ViewportFrame::Reflow(nsPresContext*    
       nsIFrame*           kidFrame = mFrames.FirstChild();
       nsHTMLReflowMetrics kidDesiredSize;
       nsSize              availableSpace(aReflowState.availableWidth,
                                          aReflowState.availableHeight);
       nsHTMLReflowState   kidReflowState(aPresContext, aReflowState,
                                          kidFrame, availableSpace);
 
       // Reflow the frame
-      kidReflowState.mComputedHeight = aReflowState.availableHeight;
+      kidReflowState.SetComputedHeight(aReflowState.availableHeight);
       rv = ReflowChild(kidFrame, aPresContext, kidDesiredSize, kidReflowState,
                        0, 0, 0, aStatus);
       kidRect.width = kidDesiredSize.width;
       kidRect.height = kidDesiredSize.height;
 
       FinishReflowChild(kidFrame, aPresContext, nsnull, kidDesiredSize, 0, 0, 0);
     }
   }
@@ -312,17 +313,17 @@ ViewportFrame::Reflow(nsPresContext*    
   NS_ASSERTION(!f || (offset.x == 0 && offset.y == 0),
                "We don't handle correct positioning of fixed frames with "
                "scrollbars in odd positions");
 #endif
 
   // Just reflow all the fixed-pos frames.
   rv = mFixedContainer.Reflow(this, aPresContext, reflowState,
                               reflowState.ComputedWidth(),
-                              reflowState.mComputedHeight,
+                              reflowState.ComputedHeight(),
                               PR_TRUE, PR_TRUE); // XXX could be optimized
 
   // If we were dirty then do a repaint
   if (GetStateBits() & NS_FRAME_IS_DIRTY) {
     nsRect damageRect(0, 0, aDesiredSize.width, aDesiredSize.height);
     Invalidate(damageRect, PR_FALSE);
   }
 
--- a/layout/mathml/base/src/nsMathMLContainerFrame.cpp
+++ b/layout/mathml/base/src/nsMathMLContainerFrame.cpp
@@ -1045,17 +1045,17 @@ nsMathMLContainerFrame::Reflow(nsPresCon
   aDesiredSize.ascent = 0;
   aDesiredSize.mBoundingMetrics.Clear();
 
   /////////////
   // Reflow children
   // Asking each child to cache its bounding metrics
 
   nsReflowStatus childStatus;
-  nsSize availSize(aReflowState.ComputedWidth(), aReflowState.mComputedHeight);
+  nsSize availSize(aReflowState.ComputedWidth(), aReflowState.ComputedHeight());
   nsHTMLReflowMetrics childDesiredSize(
                       aDesiredSize.mFlags | NS_REFLOW_CALC_BOUNDING_METRICS);
   nsIFrame* childFrame = mFrames.FirstChild();
   while (childFrame) {
     nsHTMLReflowState childReflowState(aPresContext, aReflowState,
                                        childFrame, availSize);
     rv = ReflowChild(childFrame, aPresContext, childDesiredSize,
                      childReflowState, childStatus);
--- a/layout/mathml/base/src/nsMathMLTokenFrame.cpp
+++ b/layout/mathml/base/src/nsMathMLTokenFrame.cpp
@@ -127,17 +127,17 @@ nsMathMLTokenFrame::Reflow(nsPresContext
   // initializations needed for empty markup like <mtag></mtag>
   aDesiredSize.width = aDesiredSize.height = 0;
   aDesiredSize.ascent = 0;
   aDesiredSize.mBoundingMetrics.Clear();
 
   // ask our children to compute their bounding metrics
   nsHTMLReflowMetrics childDesiredSize(
                       aDesiredSize.mFlags | NS_REFLOW_CALC_BOUNDING_METRICS);
-  nsSize availSize(aReflowState.ComputedWidth(), aReflowState.mComputedHeight);
+  nsSize availSize(aReflowState.ComputedWidth(), aReflowState.ComputedHeight());
   PRInt32 count = 0;
   nsIFrame* childFrame = GetFirstChild(nsnull);
   while (childFrame) {
     nsHTMLReflowState childReflowState(aPresContext, aReflowState,
                                        childFrame, availSize);
     rv = ReflowChild(childFrame, aPresContext, childDesiredSize,
                      childReflowState, aStatus);
     //NS_ASSERTION(NS_FRAME_IS_COMPLETE(aStatus), "bad status");
--- a/layout/mathml/base/src/nsMathMLmactionFrame.cpp
+++ b/layout/mathml/base/src/nsMathMLmactionFrame.cpp
@@ -278,17 +278,17 @@ nsMathMLmactionFrame::Reflow(nsPresConte
   nsresult rv = NS_OK;
   aStatus = NS_FRAME_COMPLETE;
   aDesiredSize.width = aDesiredSize.height = 0;
   aDesiredSize.ascent = 0;
   mBoundingMetrics.Clear();
   nsIFrame* childFrame = GetSelectedFrame();
   if (childFrame) {
     nsSize availSize(aReflowState.ComputedWidth(),
-                     aReflowState.mComputedHeight);
+                     aReflowState.ComputedHeight());
     nsHTMLReflowState childReflowState(aPresContext, aReflowState,
                                        childFrame, availSize);
     rv = ReflowChild(childFrame, aPresContext, aDesiredSize,
                      childReflowState, aStatus);
     childFrame->SetRect(nsRect(0,aDesiredSize.ascent,
                         aDesiredSize.width,aDesiredSize.height));
     mBoundingMetrics = aDesiredSize.mBoundingMetrics;
   }
--- a/layout/mathml/base/src/nsMathMLmfencedFrame.cpp
+++ b/layout/mathml/base/src/nsMathMLmfencedFrame.cpp
@@ -281,17 +281,17 @@ nsMathMLmfencedFrame::doReflow(nsPresCon
   // the *same* initial aDesiredSize.mBoundingMetrics. If we were to use the base
   // method here, our stretchy frames will be stretched and placed, and we may
   // end up stretching our fences/separators with a different aDesiredSize.
   // XXX The above decision was revisited in bug 121748 and this code can be
   // refactored to use nsMathMLContainerFrame::Reflow() at some stage.
 
   PRInt32 count = 0;
   nsReflowStatus childStatus;
-  nsSize availSize(aReflowState.ComputedWidth(), aReflowState.mComputedHeight);
+  nsSize availSize(aReflowState.ComputedWidth(), aReflowState.ComputedHeight());
   nsHTMLReflowMetrics childDesiredSize(
                       aDesiredSize.mFlags | NS_REFLOW_CALC_BOUNDING_METRICS);
   nsIFrame* firstChild = aForFrame->GetFirstChild(nsnull);
   nsIFrame* childFrame = firstChild;
   nscoord ascent = 0, descent = 0;
   if (firstChild || aOpenChar || aCloseChar || aSeparatorsCount > 0) {
     // We use the ASCII metrics to get our minimum height. This way, if we have
     // borders or a background, they will fit better with other elements on the line
--- a/layout/mathml/base/src/nsMathMLmrootFrame.cpp
+++ b/layout/mathml/base/src/nsMathMLmrootFrame.cpp
@@ -158,17 +158,17 @@ nsMathMLmrootFrame::Reflow(nsPresContext
                            nsHTMLReflowMetrics&     aDesiredSize,
                            const nsHTMLReflowState& aReflowState,
                            nsReflowStatus&          aStatus)
 {
   nsresult rv = NS_OK;
   // ask our children to compute their bounding metrics 
   nsHTMLReflowMetrics childDesiredSize(
                       aDesiredSize.mFlags | NS_REFLOW_CALC_BOUNDING_METRICS);
-  nsSize availSize(aReflowState.ComputedWidth(), aReflowState.mComputedHeight);
+  nsSize availSize(aReflowState.ComputedWidth(), aReflowState.ComputedHeight());
   nsReflowStatus childStatus;
 
   aDesiredSize.width = aDesiredSize.height = 0;
   aDesiredSize.ascent = 0;
 
   nsBoundingMetrics bmSqr, bmBase, bmIndex;
   nsIRenderingContext& renderingContext = *aReflowState.rendContext;
 
--- a/layout/svg/base/src/nsSVGForeignObjectFrame.cpp
+++ b/layout/svg/base/src/nsSVGForeignObjectFrame.cpp
@@ -161,25 +161,25 @@ nsSVGForeignObjectFrame::Reflow(nsPresCo
                                 nsReflowStatus&          aStatus)
 {
   // InitialUpdate and AttributeChanged make sure mRect is up to date before
   // we're called (UpdateCoveredRegion sets mRect).
 
   NS_ASSERTION(!aReflowState.parentReflowState,
                "should only get reflow from being reflow root");
   NS_ASSERTION(aReflowState.ComputedWidth() == GetSize().width &&
-               aReflowState.mComputedHeight == GetSize().height,
+               aReflowState.ComputedHeight() == GetSize().height,
                "reflow roots should be reflown at existing size and "
                "svg.css should ensure we have no padding/border/margin");
 
   DoReflow();
 
   // XXX why don't we convert from CSS pixels to app units? How does this work?
   aDesiredSize.width = aReflowState.ComputedWidth();
-  aDesiredSize.height = aReflowState.mComputedHeight;
+  aDesiredSize.height = aReflowState.ComputedHeight();
   aDesiredSize.mOverflowArea =
     nsRect(nsPoint(0, 0), nsSize(aDesiredSize.width, aDesiredSize.height));
   aStatus = NS_FRAME_COMPLETE;
 
   return NS_OK;
 }
 
 void
@@ -619,17 +619,17 @@ nsSVGForeignObjectFrame::DoReflow()
   // We don't use size.height above because that tells the child to do
   // page/column breaking at that height.
   NS_ASSERTION(reflowState.mComputedBorderPadding == nsMargin(0, 0, 0, 0) &&
                reflowState.mComputedMargin == nsMargin(0, 0, 0, 0),
                "style system should ensure that :-moz-svg-foreign content "
                "does not get styled");
   NS_ASSERTION(reflowState.ComputedWidth() == size.width,
                "reflow state made child wrong size");
-  reflowState.mComputedHeight = size.height;
+  reflowState.SetComputedHeight(size.height);
   
   ReflowChild(kid, presContext, desiredSize, reflowState, 0, 0,
               NS_FRAME_NO_MOVE_FRAME, status);
   NS_ASSERTION(size.width == desiredSize.width &&
                size.height == desiredSize.height, "unexpected size");
   FinishReflowChild(kid, presContext, &reflowState, desiredSize, 0, 0,
                     NS_FRAME_NO_MOVE_FRAME);
   
--- a/layout/svg/base/src/nsSVGOuterSVGFrame.cpp
+++ b/layout/svg/base/src/nsSVGOuterSVGFrame.cpp
@@ -630,18 +630,18 @@ nsSVGOuterSVGFrame::CalculateAvailableSp
            aReflowState.parentReflowState->ComputedWidth() != NS_INTRINSICSIZE)
     maxRect->width = aReflowState.parentReflowState->ComputedWidth();
   else
     maxRect->width = NS_MAXSIZE;
   
   if (aReflowState.availableHeight != NS_INTRINSICSIZE)
     maxRect->height = aReflowState.availableHeight;    
   else if (aReflowState.parentReflowState &&
-           aReflowState.parentReflowState->mComputedHeight != NS_INTRINSICSIZE)
-    maxRect->height = aReflowState.parentReflowState->mComputedHeight;
+           aReflowState.parentReflowState->ComputedHeight() != NS_INTRINSICSIZE)
+    maxRect->height = aReflowState.parentReflowState->ComputedHeight();
   else
     maxRect->height = NS_MAXSIZE;
 
   if (preferredRect->width > maxRect->width)
     preferredRect->width = maxRect->width;
   if (preferredRect->height > maxRect->height)
     preferredRect->height = maxRect->height;
 }  
--- a/layout/tables/nsTableCellFrame.cpp
+++ b/layout/tables/nsTableCellFrame.cpp
@@ -124,18 +124,18 @@ nsTableCellFrame::NotifyPercentHeight(co
   // outer table.
   // XXXldb Given the now-stricter |NeedsToObserve|, many if not all of
   // these tests are probably unnecessary.
 
   // Maybe the cell reflow state; we sure if we're inside the |if|.
   const nsHTMLReflowState *cellRS = aReflowState.mCBReflowState;
 
   if (cellRS && cellRS->frame == this &&
-      (cellRS->mComputedHeight == NS_UNCONSTRAINEDSIZE ||
-       cellRS->mComputedHeight == 0)) { // XXXldb Why 0?
+      (cellRS->ComputedHeight() == NS_UNCONSTRAINEDSIZE ||
+       cellRS->ComputedHeight() == 0)) { // XXXldb Why 0?
     // This is a percentage height on a frame whose percentage heights
     // are based on the height of the cell, since its containing block
     // is the inner cell frame.
 
     // We'll only honor the percent height if sibling-cells/ancestors
     // have specified/pct height. (Also, siblings only count for this if
     // both this cell and the sibling cell span exactly 1 row.)
 
@@ -814,23 +814,23 @@ NS_METHOD nsTableCellFrame::Reflow(nsPre
   kidSize.width = kidSize.height = 0;
   SetPriorAvailWidth(aReflowState.availableWidth);
   nsIFrame* firstKid = mFrames.FirstChild();
   NS_ASSERTION(firstKid, "Frame construction error, a table cell always has an inner cell frame");
 
   nscoord computedPaginatedHeight = 0;
 
   if (aReflowState.mFlags.mSpecialHeightReflow) {
-    ((nsHTMLReflowState&)aReflowState).mComputedHeight = mRect.height - topInset - bottomInset;
+    const_cast<nsHTMLReflowState&>(aReflowState).SetComputedHeight(mRect.height - topInset - bottomInset);
     DISPLAY_REFLOW_CHANGE();
   }
   else if (aPresContext->IsPaginated()) {
     computedPaginatedHeight = CalcUnpaginagedHeight(aPresContext, (nsTableCellFrame&)*this, *tableFrame, topInset + bottomInset);
     if (computedPaginatedHeight > 0) {
-      ((nsHTMLReflowState&)aReflowState).mComputedHeight = computedPaginatedHeight;
+      const_cast<nsHTMLReflowState&>(aReflowState).SetComputedHeight(computedPaginatedHeight);
       DISPLAY_REFLOW_CHANGE();
     }
   }      
   else {
     SetHasPctOverHeight(PR_FALSE);
   }
 
   nsHTMLReflowState kidReflowState(aPresContext, aReflowState, firstKid,
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -1716,18 +1716,18 @@ nsTableFrame::AncestorsHaveStyleHeight(c
   return PR_FALSE;
 }
 
 // See if a special height reflow needs to occur and if so, call RequestSpecialHeightReflow
 void
 nsTableFrame::CheckRequestSpecialHeightReflow(const nsHTMLReflowState& aReflowState)
 {
   if (!aReflowState.frame->GetPrevInFlow() &&  // 1st in flow
-      (NS_UNCONSTRAINEDSIZE == aReflowState.mComputedHeight ||  // no computed height
-       0                    == aReflowState.mComputedHeight) && 
+      (NS_UNCONSTRAINEDSIZE == aReflowState.ComputedHeight() ||  // no computed height
+       0                    == aReflowState.ComputedHeight()) && 
       eStyleUnit_Percent == aReflowState.mStylePosition->mHeight.GetUnit() && // pct height
       nsTableFrame::AncestorsHaveStyleHeight(*aReflowState.parentReflowState)) {
     nsTableFrame::RequestSpecialHeightReflow(aReflowState);
   }
 }
 
 // Notify the frame and its ancestors (up to the containing table) that a special
 // height reflow will occur. During a special height reflow, a table, row group,
@@ -1840,17 +1840,17 @@ NS_METHOD nsTableFrame::Reflow(nsPresCon
   aDesiredSize.width = aReflowState.availableWidth;
 
   // Check for an overflow list, and append any row group frames being pushed
   MoveOverflowToChildList(aPresContext);
 
   PRBool haveDesiredHeight = PR_FALSE;
   PRBool reflowedChildren  = PR_FALSE;
 
-  if (aReflowState.mComputedHeight != NS_UNCONSTRAINEDSIZE ||
+  if (aReflowState.ComputedHeight() != NS_UNCONSTRAINEDSIZE ||
       // Also check mVResize, to handle the first Reflow preceding a
       // special height Reflow, when we've already had a special height
       // Reflow (where mComputedHeight would not be
       // NS_UNCONSTRAINEDSIZE, but without a style change in between).
       aReflowState.mFlags.mVResize) {
     // XXX Eventually, we should modify DistributeHeightToRows to use
     // nsTableRowFrame::GetHeight instead of nsIFrame::GetSize().height.
     // That way, it will make its calculations based on internal table
@@ -3182,17 +3182,17 @@ nsTableFrame::DistributeHeightToRows(con
   
   RowGroupArray rowGroups;
   OrderRowGroups(rowGroups);
 
   nscoord amountUsed = 0;
   // distribute space to each pct height row whose row group doesn't have a computed 
   // height, and base the pct on the table height. If the row group had a computed 
   // height, then this was already done in nsTableRowGroupFrame::CalculateRowHeights
-  nscoord pctBasis = aReflowState.mComputedHeight - (GetCellSpacingY() * (GetRowCount() + 1));
+  nscoord pctBasis = aReflowState.ComputedHeight() - (GetCellSpacingY() * (GetRowCount() + 1));
   nscoord yOriginRG = borderPadding.top + GetCellSpacingY();
   nscoord yEndRG = yOriginRG;
   PRUint32 rgX;
   for (rgX = 0; rgX < rowGroups.Length(); rgX++) {
     nsTableRowGroupFrame* rgFrame = rowGroups[rgX];
     nscoord amountUsedByRG = 0;
     nscoord yOriginRow = 0;
     nsRect rgRect = rgFrame->GetRect();
@@ -3500,17 +3500,17 @@ nsTableFrame::IsAutoHeight()
   }
 
   return isAuto; 
 }
 
 nscoord 
 nsTableFrame::CalcBorderBoxHeight(const nsHTMLReflowState& aState)
 {
-  nscoord height = aState.mComputedHeight;
+  nscoord height = aState.ComputedHeight();
   if (NS_AUTOHEIGHT != height) {
     nsMargin borderPadding = GetContentAreaOffset(&aState);
     height += borderPadding.top + borderPadding.bottom;
   }
   height = PR_MAX(0, height);
 
   return height;
 }
--- a/layout/tables/nsTableOuterFrame.cpp
+++ b/layout/tables/nsTableOuterFrame.cpp
@@ -506,17 +506,17 @@ GetContainingBlockSize(const nsHTMLReflo
   const nsHTMLReflowState* containRS =
     aOuterRS.mCBReflowState;
 
   if (containRS) {
     size.width = containRS->ComputedWidth();
     if (NS_UNCONSTRAINEDSIZE == size.width) {
       size.width = 0;
     }
-    size.height = containRS->mComputedHeight;
+    size.height = containRS->ComputedHeight();
     if (NS_UNCONSTRAINEDSIZE == size.height) {
       size.height = 0;
     }
   }
   return size;
 }
 
 void
--- a/layout/tables/nsTableRowFrame.cpp
+++ b/layout/tables/nsTableRowFrame.cpp
@@ -68,26 +68,27 @@ struct nsTableCellReflowState : public n
 };
 
 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 != ComputedWidth()) {
-    nscoord computedWidth = aAvailSpace.width - mComputedBorderPadding.left -
-      mComputedBorderPadding.right;
+    nscoord computedWidth =
+      aAvailSpace.width - mComputedBorderPadding.LeftRight();
     computedWidth = PR_MAX(0, computedWidth);
     SetComputedWidth(computedWidth);
   }
-  if (NS_UNCONSTRAINEDSIZE != mComputedHeight) {
-    if (NS_UNCONSTRAINEDSIZE != aAvailSpace.height) {
-      mComputedHeight = aAvailSpace.height - mComputedBorderPadding.top - mComputedBorderPadding.bottom;
-      mComputedHeight = PR_MAX(0, mComputedHeight);
-    }
+  if (NS_UNCONSTRAINEDSIZE != ComputedHeight() &&
+      NS_UNCONSTRAINEDSIZE != aAvailSpace.height) {
+    nscoord computedHeight =
+      aAvailSpace.height - mComputedBorderPadding.TopBottom();
+    computedHeight = PR_MAX(0, computedHeight);
+    SetComputedHeight(computedHeight);
   }
 }
 
 void
 nsTableRowFrame::InitChildReflowState(nsPresContext&         aPresContext,
                                       const nsSize&           aAvailSize,
                                       PRBool                  aBorderCollapse,
                                       nsTableCellReflowState& aReflowState)
@@ -490,18 +491,18 @@ nsTableRowFrame::UpdateHeight(nscoord   
 
 nscoord
 nsTableRowFrame::CalcHeight(const nsHTMLReflowState& aReflowState)
 {
   nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
   if (!tableFrame)
     return 0;
 
-  nscoord computedHeight = (NS_UNCONSTRAINEDSIZE == aReflowState.mComputedHeight)
-                            ? 0 : aReflowState.mComputedHeight;
+  nscoord computedHeight = (NS_UNCONSTRAINEDSIZE == aReflowState.ComputedHeight())
+                            ? 0 : aReflowState.ComputedHeight();
   ResetHeight(computedHeight);
 
   const nsStylePosition* position = GetStylePosition();
   if (eStyleUnit_Coord == position->mHeight.GetUnit()) {
     SetFixedHeight(position->mHeight.GetCoordValue());
   }
   else if (eStyleUnit_Percent == position->mHeight.GetUnit()) {
     SetPctHeight(position->mHeight.GetPercentValue());
--- a/layout/tables/nsTableRowGroupFrame.cpp
+++ b/layout/tables/nsTableRowGroupFrame.cpp
@@ -752,19 +752,19 @@ nsTableRowGroupFrame::CalculateRowHeight
       UpdateHeights(rInfo, rowExtra, heightOfRows, heightOfUnStyledRows);
       extra -= rowExtra;
     }
   }
 
   PRBool styleHeightAllocation = PR_FALSE;
   nscoord rowGroupHeight = startRowGroupHeight + heightOfRows + ((numRows - 1) * cellSpacingY);
   // if we have a style height, allocate the extra height to unconstrained rows
-  if ((aReflowState.mComputedHeight > rowGroupHeight) && 
-      (NS_UNCONSTRAINEDSIZE != aReflowState.mComputedHeight)) {
-    nscoord extraComputedHeight = aReflowState.mComputedHeight - rowGroupHeight;
+  if ((aReflowState.ComputedHeight() > rowGroupHeight) && 
+      (NS_UNCONSTRAINEDSIZE != aReflowState.ComputedHeight())) {
+    nscoord extraComputedHeight = aReflowState.ComputedHeight() - rowGroupHeight;
     nscoord extraUsed = 0;
     PRBool haveUnStyledRows = (heightOfUnStyledRows > 0);
     nscoord divisor = (haveUnStyledRows) 
                       ? heightOfUnStyledRows : heightOfRows;
     if (divisor > 0) {
       styleHeightAllocation = PR_TRUE;
       for (rowIndex = 0; rowIndex < numRows; rowIndex++) {
         if (!haveUnStyledRows || !rowInfo[rowIndex].hasStyleHeight) {
@@ -781,17 +781,17 @@ nsTableRowGroupFrame::CalculateRowHeight
           extraUsed += extraForRow;
           if (extraUsed >= extraComputedHeight) {
             NS_ASSERTION((extraUsed == extraComputedHeight), "invalid row height calculation");
             break;
           }
         }
       }
     }
-    rowGroupHeight = aReflowState.mComputedHeight;
+    rowGroupHeight = aReflowState.ComputedHeight();
   }
 
   nscoord yOrigin = startRowGroupHeight;
   // update the rows with their (potentially) new heights
   for (rowFrame = startRowFrame, rowIndex = 0; rowFrame; rowFrame = rowFrame->GetNextRow(), rowIndex++) {
     nsRect rowBounds = rowFrame->GetRect(); 
 
     PRBool movedFrame = (rowBounds.y != yOrigin);  
@@ -1290,18 +1290,18 @@ nsTableRowGroupFrame::Reflow(nsPresConte
   }
 
   // If we have a next-in-flow, then we're not complete
   // XXXldb This used to be done only for the incremental reflow codepath.
   if (GetNextInFlow()) {
     aStatus = NS_FRAME_NOT_COMPLETE;
   }
 
-  SetHasStyleHeight((NS_UNCONSTRAINEDSIZE != aReflowState.mComputedHeight) &&
-                    (aReflowState.mComputedHeight > 0)); 
+  SetHasStyleHeight((NS_UNCONSTRAINEDSIZE != aReflowState.ComputedHeight()) &&
+                    (aReflowState.ComputedHeight() > 0)); 
   
   // just set our width to what was available. The table will calculate the width and not use our value.
   aDesiredSize.width = aReflowState.availableWidth;
 
   aDesiredSize.mOverflowArea.UnionRect(aDesiredSize.mOverflowArea, nsRect(0, 0, aDesiredSize.width,
 	                                                                      aDesiredSize.height)); 
   FinishAndStoreOverflow(&aDesiredSize);
   NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
@@ -1435,29 +1435,29 @@ nsTableRowGroupFrame::GetUsedPadding() c
 }
 
 nscoord 
 nsTableRowGroupFrame::GetHeightBasis(const nsHTMLReflowState& aReflowState)
 {
   nscoord result = 0;
   nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
   if (tableFrame) {
-    if ((aReflowState.mComputedHeight > 0) && (aReflowState.mComputedHeight < NS_UNCONSTRAINEDSIZE)) {
+    if ((aReflowState.ComputedHeight() > 0) && (aReflowState.ComputedHeight() < NS_UNCONSTRAINEDSIZE)) {
       nscoord cellSpacing = PR_MAX(0, GetRowCount() - 1) * tableFrame->GetCellSpacingY();
-      result = aReflowState.mComputedHeight - cellSpacing;
+      result = aReflowState.ComputedHeight() - cellSpacing;
     }
     else {
       const nsHTMLReflowState* parentRS = aReflowState.parentReflowState;
       if (parentRS && (tableFrame != parentRS->frame)) {
         parentRS = parentRS->parentReflowState;
       }
       if (parentRS && (tableFrame == parentRS->frame) && 
-          (parentRS->mComputedHeight > 0) && (parentRS->mComputedHeight < NS_UNCONSTRAINEDSIZE)) {
+          (parentRS->ComputedHeight() > 0) && (parentRS->ComputedHeight() < NS_UNCONSTRAINEDSIZE)) {
         nscoord cellSpacing = PR_MAX(0, tableFrame->GetRowCount() + 1) * tableFrame->GetCellSpacingY();
-        result = parentRS->mComputedHeight - cellSpacing;
+        result = parentRS->ComputedHeight() - cellSpacing;
       }
     }
   }
 
   return result;
 }
 
 PRBool
--- a/layout/xul/base/src/nsBoxFrame.cpp
+++ b/layout/xul/base/src/nsBoxFrame.cpp
@@ -678,28 +678,28 @@ nsBoxFrame::Reflow(nsPresContext*       
 
 #ifdef DO_NOISY_REFLOW
   printf("\n-------------Starting BoxFrame Reflow ----------------------------\n");
   printf("%p ** nsBF::Reflow %d ", this, myCounter++);
   
   printSize("AW", aReflowState.availableWidth);
   printSize("AH", aReflowState.availableHeight);
   printSize("CW", aReflowState.ComputedWidth());
-  printSize("CH", aReflowState.mComputedHeight);
+  printSize("CH", aReflowState.ComputedHeight());
 
   printf(" *\n");
 
 #endif
 
   aStatus = NS_FRAME_COMPLETE;
 
   // create the layout state
   nsBoxLayoutState state(aPresContext, aReflowState.rendContext);
 
-  nsSize computedSize(aReflowState.ComputedWidth(),aReflowState.mComputedHeight);
+  nsSize computedSize(aReflowState.ComputedWidth(),aReflowState.ComputedHeight());
 
   nsMargin m;
   m = aReflowState.mComputedBorderPadding;
   // GetBorderAndPadding(m);
 
   nsSize prefSize(0,0);
 
   // if we are told to layout intrinsic then get our preferred size.
@@ -710,17 +710,17 @@ nsBoxFrame::Reflow(nsPresContext*       
     nsSize minSize = GetMinSize(state);
     nsSize maxSize = GetMaxSize(state);
     BoundsCheck(minSize, prefSize, maxSize);
   }
 
   // get our desiredSize
   computedSize.width += m.left + m.right;
 
-  if (aReflowState.mComputedHeight == NS_INTRINSICSIZE) {
+  if (aReflowState.ComputedHeight() == NS_INTRINSICSIZE) {
     computedSize.height = prefSize.height;
   } else {
     computedSize.height += m.top + m.bottom;
   }
 
   // handle reflow state min and max sizes
 
   if (computedSize.width > aReflowState.mComputedMaxWidth)
--- a/layout/xul/base/src/nsLeafBoxFrame.cpp
+++ b/layout/xul/base/src/nsLeafBoxFrame.cpp
@@ -238,17 +238,18 @@ nsLeafBoxFrame::Reflow(nsPresContext*   
   // This is mostly a copy of nsBoxFrame::Reflow().
   // We aren't able to share an implementation because of the frame
   // class hierarchy.  If you make changes here, please keep
   // nsBoxFrame::Reflow in sync.
 
   DO_GLOBAL_REFLOW_COUNT("nsLeafBoxFrame");
   DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
 
-  NS_ASSERTION(aReflowState.ComputedWidth() >=0 && aReflowState.mComputedHeight >= 0, "Computed Size < 0");
+  NS_ASSERTION(aReflowState.ComputedWidth() >=0 &&
+               aReflowState.ComputedHeight() >= 0, "Computed Size < 0");
 
 #ifdef DO_NOISY_REFLOW
   printf("\n-------------Starting LeafBoxFrame Reflow ----------------------------\n");
   printf("%p ** nsLBF::Reflow %d R: ", this, myCounter++);
   switch (aReflowState.reason) {
     case eReflowReason_Initial:
       printf("Ini");break;
     case eReflowReason_Incremental:
@@ -261,36 +262,36 @@ nsLeafBoxFrame::Reflow(nsPresContext*   
       printf("Drt ");
       break;
     default:printf("<unknown>%d", aReflowState.reason);break;
   }
   
   printSize("AW", aReflowState.availableWidth);
   printSize("AH", aReflowState.availableHeight);
   printSize("CW", aReflowState.ComputedWidth());
-  printSize("CH", aReflowState.mComputedHeight);
+  printSize("CH", aReflowState.ComputedHeight());
 
   printf(" *\n");
 
 #endif
 
   aStatus = NS_FRAME_COMPLETE;
 
   // create the layout state
   nsBoxLayoutState state(aPresContext, aReflowState.rendContext);
 
-  nsSize computedSize(aReflowState.ComputedWidth(),aReflowState.mComputedHeight);
+  nsSize computedSize(aReflowState.ComputedWidth(),aReflowState.ComputedHeight());
 
   nsMargin m;
   m = aReflowState.mComputedBorderPadding;
 
   //GetBorderAndPadding(m);
 
   // this happens sometimes. So lets handle it gracefully.
-  if (aReflowState.mComputedHeight == 0) {
+  if (aReflowState.ComputedHeight() == 0) {
     nsSize minSize = GetMinSize(state);
     computedSize.height = minSize.height - m.top - m.bottom;
   }
 
   nsSize prefSize(0,0);
 
   // if we are told to layout intrinic then get our preferred size.
   if (computedSize.width == NS_INTRINSICSIZE || computedSize.height == NS_INTRINSICSIZE) {
@@ -302,17 +303,17 @@ nsLeafBoxFrame::Reflow(nsPresContext*   
 
   // get our desiredSize
   if (aReflowState.ComputedWidth() == NS_INTRINSICSIZE) {
     computedSize.width = prefSize.width;
   } else {
     computedSize.width += m.left + m.right;
   }
 
-  if (aReflowState.mComputedHeight == NS_INTRINSICSIZE) {
+  if (aReflowState.ComputedHeight() == NS_INTRINSICSIZE) {
     computedSize.height = prefSize.height;
   } else {
     computedSize.height += m.top + m.bottom;
   }
 
   // handle reflow state min and max sizes
 
   if (computedSize.width > aReflowState.mComputedMaxWidth)