(pfd->mMaxElementWidth == pfd->mCombinedArea.width &&
(pfd->mMaxElementWidth == pfd->mBounds.width &&
nsLineLayout::VerticalAlignLine(nsLineBox* aLineBox,                                nscoord* aMaxElementWidthResult){  // Synthesize a PerFrameData for the block frame  PerFrameData rootPFD;  rootPFD.mFrame = mBlockReflowState->frame;  rootPFD.mFrameType = mBlockReflowState->mFrameType;  rootPFD.mAscent = 0;  rootPFD.mDescent = 0;  mRootSpan->mFrame = &rootPFD;  mLineBox = aLineBox;  // Partially place the children of the block frame. The baseline for  // this operation is set to zero so that the y coordinates for all  // of the placed children will be relative to there.  PerSpanData* psd = mRootSpan;  VerticalAlignFrames(psd);  // Compute the line-height. The line-height will be the larger of:  //  // [1] maxY - minY (the distance between the highest childs top edge  // and the lowest childs bottom edge)  //  // [2] the maximum logical box height (since not every frame may have  // participated in #1; for example: top/bottom aligned frames)  //  // [3] the minimum line height (line-height property set on the  // block frame)  nscoord lineHeight = psd->mMaxY - psd->mMinY;  // Now that the line-height is computed, we need to know where the  // baseline is in the line. Position baseline so that mMinY is just  // inside the top of the line box.  nscoord baselineY;  if (psd->mMinY < 0) {    baselineY = mTopEdge - psd->mMinY;  }  else {    baselineY = mTopEdge;  }  // It's also possible that the line-height isn't tall enough because  // of top/bottom aligned elements that were not accounted for in  // min/max Y.  //  // The CSS2 spec doesn't really say what happens when to the  // baseline in this situations. What we do is if the largest top  // aligned box height is greater than the line-height then we leave  // the baseline alone. If the largest bottom aligned box is greater  // than the line-height then we slide the baseline down by the extra  // amount.  //  // Navigator 4 gives precedence to the first top/bottom aligned  // object.  We just let bottom aligned objects win.  if (lineHeight < mMaxBottomBoxHeight) {    // When the line is shorter than the maximum top aligned box    nscoord extra = mMaxBottomBoxHeight - lineHeight;    baselineY += extra;    lineHeight = mMaxBottomBoxHeight;  }  if (lineHeight < mMaxTopBoxHeight) {    lineHeight = mMaxTopBoxHeight;  }#ifdef NOISY_VERTICAL_ALIGN  printf("  [line]==> lineHeight=%d baselineY=%d\n", lineHeight, baselineY);#endif  // Now position all of the frames in the root span. We will also  // recurse over the child spans and place any top/bottom aligned  // frames we find.  // XXX PERFORMANCE: set a bit per-span to avoid the extra work  // (propagate it upward too)  PerFrameData* pfd = psd->mFirstFrame;  nscoord maxElementWidth = 0;  PRBool prevFrameAccumulates = PR_FALSE;  nscoord accumulatedWidth = 0;#ifdef HACK_MEW  PRBool strictMode = InStrictMode();  PRBool inUnconstrainedTable = InUnconstrainedTableCell(*mBlockReflowState);#endif#ifdef DEBUG  int frameCount = 0;#endif  nscoord indent = mTextIndent; // Used for the first frame.  while (nsnull != pfd) {    // Compute max-element-width if necessary    if (mComputeMaxElementWidth) {      nscoord mw = pfd->mMaxElementWidth +        pfd->mMargin.left + pfd->mMargin.right + indent;      // Zero |indent| after including the 'text-indent' only for the      // frame that is indented.      indent = 0;      if (psd->mNoWrap) {        maxElementWidth += mw;      }      else {#ifdef HACK_MEW#ifdef DEBUG      if (nsBlockFrame::gNoisyMaxElementWidth)         frameCount++;#endif        // if in Quirks mode and in a table cell with an unconstrained width, then emulate an IE        // quirk to keep consecutive images from breaking the line        // - see bugs 54565, 32191, and their many dups        // XXX - reconsider how textFrame text measurement happens and have it take into account        //       image frames as well, thus eliminating the need for this code        if (!strictMode && inUnconstrainedTable ) {          nscoord imgSizes = AccumulateImageSizes(*mPresContext, *pfd->mFrame);          // XXXldb We should NOT be using mCombinedArea here!          PRBool curFrameAccumulates = (imgSizes > 0) ||                                        (pfd->mMaxElementWidth == pfd->mCombinedArea.width &&                                        pfd->GetFlag(PFD_ISNONWHITESPACETEXTFRAME));            // NOTE: we check for the maxElementWidth == the CombinedAreaWidth to detect when            //       a textframe has whitespace in it and thus should not be used as the basis            //       for accumulating the image width            // - this is to handle images in a text run          if(prevFrameAccumulates && curFrameAccumulates) {            accumulatedWidth += mw;          } else {            accumulatedWidth = mw;          }           // now update the prevFrame          prevFrameAccumulates = curFrameAccumulates;        #ifdef DEBUG          if (nsBlockFrame::gNoisyMaxElementWidth) {            nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);            printf("(%d) last frame's MEW=%d | Accumulated MEW=%d\n", frameCount, mw, accumulatedWidth);          }#endif           mw = accumulatedWidth;        }#endif // HACK_MEW        // and finally reset the max element width        if (maxElementWidth < mw) {          maxElementWidth = mw;        }      }    }    PerSpanData* span = pfd->mSpan;#ifdef DEBUG    NS_ASSERTION(0xFF != pfd->mVerticalAlign, "umr");#endif    switch (pfd->mVerticalAlign) {      case VALIGN_TOP:        if (span) {          pfd->mBounds.y = mTopEdge - pfd->mBorderPadding.top +            span->mTopLeading;        }        else {          pfd->mBounds.y = mTopEdge + pfd->mMargin.top;        }        break;      case VALIGN_BOTTOM:        if (span) {          // Compute bottom leading          pfd->mBounds.y = mTopEdge + lineHeight -            pfd->mBounds.height + pfd->mBorderPadding.bottom -            span->mBottomLeading;        }        else {          pfd->mBounds.y = mTopEdge + lineHeight - pfd->mMargin.bottom -            pfd->mBounds.height;        }        break;      case VALIGN_OTHER:        pfd->mBounds.y += baselineY;        break;    }    pfd->mFrame->SetRect(pfd->mBounds);#ifdef NOISY_VERTICAL_ALIGN    printf("  [child of line]");    nsFrame::ListTag(stdout, pfd->mFrame);    printf(": y=%d\n", pfd->mBounds.y);#endif    if (span) {      nscoord distanceFromTop = pfd->mBounds.y - mTopEdge;      PlaceTopBottomFrames(span, distanceFromTop, lineHeight);    }    // check to see if the frame is an inline replace element    // and if it is percent-aware.  If so, mark the line.    if ((PR_FALSE==aLineBox->ResizeReflowOptimizationDisabled()) &&         pfd->mFrameType & NS_CSS_FRAME_TYPE_INLINE)    {      if (IsPercentageAwareFrame(mPresContext, pfd->mFrame))        aLineBox->DisableResizeReflowOptimization();    }    pfd = pfd->mNext;  }  // Fill in returned line-box and max-element-width data  aLineBox->mBounds.x = psd->mLeftEdge;  aLineBox->mBounds.y = mTopEdge;  aLineBox->mBounds.width = psd->mX - psd->mLeftEdge;  aLineBox->mBounds.height = lineHeight;  mFinalLineHeight = lineHeight;  *aMaxElementWidthResult = maxElementWidth;  aLineBox->SetAscent(baselineY - mTopEdge);#ifdef NOISY_VERTICAL_ALIGN  printf(    "  [line]==> bounds{x,y,w,h}={%d,%d,%d,%d} lh=%d a=%d mew=%d\n",    aLineBox->mBounds.x, aLineBox->mBounds.y,    aLineBox->mBounds.width, aLineBox->mBounds.height,    mFinalLineHeight, aLineBox->GetAscent(),    *aMaxElementWidthResult);#endif  // Undo root-span mFrame pointer to prevent brane damage later on...  mRootSpan->mFrame = nsnull;  mLineBox = nsnull;}