if (aReflowState.availableHeight != NS_UNCONSTRAINEDSIZE) { mBlock->SetProperty(nsLayoutAtoms::overflowPlaceholdersProperty, &mOverflowPlaceholders, nsnull); mBlock->AddStateBits(NS_BLOCK_HAS_OVERFLOW_PLACEHOLDERS);
if (aBlockMarginRoot) { SetFlag(BRS_ISTOPMARGINROOT, PR_TRUE); SetFlag(BRS_ISBOTTOMMARGINROOT, PR_TRUE);
nsBlockReflowState::nsBlockReflowState(const nsHTMLReflowState& aReflowState,                                       nsPresContext* aPresContext,                                       nsBlockFrame* aFrame,                                       const nsHTMLReflowMetrics& aMetrics,                                       PRBool aTopMarginRoot,                                       PRBool aBottomMarginRoot)  : mBlock(aFrame),    mPresContext(aPresContext),    mReflowState(aReflowState),    mPrevBottomMargin(),    mLineNumber(0),    mFlags(0),    mFloatBreakType(NS_STYLE_CLEAR_NONE){  SetFlag(BRS_ISFIRSTINFLOW, aFrame->GetPrevInFlow() == nsnull);  const nsMargin& borderPadding = BorderPadding();  if (aReflowState.availableHeight != NS_UNCONSTRAINEDSIZE) {    mBlock->SetProperty(nsLayoutAtoms::overflowPlaceholdersProperty,                        &mOverflowPlaceholders, nsnull);    mBlock->AddStateBits(NS_BLOCK_HAS_OVERFLOW_PLACEHOLDERS);  }  if (aTopMarginRoot || 0 != aReflowState.mComputedBorderPadding.top) {    SetFlag(BRS_ISTOPMARGINROOT, PR_TRUE);  }  if (aBottomMarginRoot || 0 != aReflowState.mComputedBorderPadding.bottom) {    SetFlag(BRS_ISBOTTOMMARGINROOT, PR_TRUE);  }  if (GetFlag(BRS_ISTOPMARGINROOT)) {    SetFlag(BRS_APPLYTOPMARGIN, PR_TRUE);  }    mSpaceManager = aReflowState.mSpaceManager;  NS_ASSERTION(mSpaceManager,               "SpaceManager should be set in nsBlockReflowState" );  if (mSpaceManager) {    // Translate into our content area and then save the     // coordinate system origin for later.    mSpaceManager->Translate(borderPadding.left, borderPadding.top);    mSpaceManager->GetTranslation(mSpaceManagerX, mSpaceManagerY);  }  mReflowStatus = NS_FRAME_COMPLETE;  mPresContext = aPresContext;  mNextInFlow = NS_STATIC_CAST(nsBlockFrame*, mBlock->GetNextInFlow());  mKidXMost = 0;  // Compute content area width (the content area is inside the border  // and padding)  if (NS_UNCONSTRAINEDSIZE != aReflowState.mComputedWidth) {    mContentArea.width = aReflowState.mComputedWidth;  }  else {    if (NS_UNCONSTRAINEDSIZE == aReflowState.availableWidth) {      mContentArea.width = NS_UNCONSTRAINEDSIZE;      SetFlag(BRS_UNCONSTRAINEDWIDTH, PR_TRUE);    }    else if (NS_UNCONSTRAINEDSIZE != aReflowState.mComputedMaxWidth) {      // Choose a width based on the content (shrink wrap width) up      // to the maximum width      mContentArea.width = aReflowState.mComputedMaxWidth;      SetFlag(BRS_SHRINKWRAPWIDTH, PR_TRUE);    }    else {      nscoord lr = borderPadding.left + borderPadding.right;      mContentArea.width = PR_MAX(0, aReflowState.availableWidth - lr);    }  }  // Compute content area height. Unlike the width, if we have a  // specified style height we ignore it since extra content is  // managed by the "overflow" property. When we don't have a  // specified style height then we may end up limiting our height if  // the availableHeight is constrained (this situation occurs when we  // are paginated).  if (NS_UNCONSTRAINEDSIZE != aReflowState.availableHeight) {    // We are in a paginated situation. The bottom edge is just inside    // the bottom border and padding. The content area height doesn't    // include either border or padding edge.    mBottomEdge = aReflowState.availableHeight - borderPadding.bottom;    mContentArea.height = PR_MAX(0, mBottomEdge - borderPadding.top);  }  else {    // When we are not in a paginated situation then we always use    // an constrained height.    SetFlag(BRS_UNCONSTRAINEDHEIGHT, PR_TRUE);    mContentArea.height = mBottomEdge = NS_UNCONSTRAINEDSIZE;  }  mY = borderPadding.top;  mBand.Init(mSpaceManager, mContentArea);  mPrevChild = nsnull;  mCurrentLine = aFrame->end_lines();  SetFlag(BRS_COMPUTEMAXELEMENTWIDTH, aMetrics.mComputeMEW);#ifdef DEBUG  if (nsBlockFrame::gNoisyMaxElementWidth) {    nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);    printf("BRS: setting compute-MEW to %d\n", aMetrics.mComputeMEW);  }#endif  mMaxElementWidth = 0;  SetFlag(BRS_COMPUTEMAXWIDTH,           (NS_REFLOW_CALC_MAX_WIDTH == (aMetrics.mFlags & NS_REFLOW_CALC_MAX_WIDTH)));  mMaximumWidth = 0;  mMinLineHeight = nsHTMLReflowState::CalcLineHeight(mPresContext,                                                     aReflowState.rendContext,                                                     aReflowState.frame);}