DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
HRuleFrame::Reflow(nsIPresContext*          aPresContext,                   nsHTMLReflowMetrics&     aDesiredSize,                   const nsHTMLReflowState& aReflowState,                   nsReflowStatus&          aStatus){  DO_GLOBAL_REFLOW_COUNT("HRuleFrame", aReflowState.reason);  DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);  NS_PRECONDITION(mState & NS_FRAME_IN_REFLOW, "frame is not in reflow");  // bug 18754: In compat mode, we treat HR's as inline elements  //            with break-before and break-after semantics  //            achieved in quirks.css using :before and :after  //            In standard mode, HR is still just a block, no special handling  nsCompatibility mode;  aPresContext->GetCompatibilityMode(&mode);  // Compute the width  float p2t;  aPresContext->GetScaledPixelsToTwips(&p2t);  nscoord onePixel = NSIntPixelsToTwips(1, p2t);  // get the rounding right  nscoord twoPixels= NSIntPixelsToTwips(2, p2t);  // get the rounding right  if (NS_UNCONSTRAINEDSIZE != aReflowState.mComputedWidth) {    aDesiredSize.width = aReflowState.mComputedWidth;  }  else {    if (NS_UNCONSTRAINEDSIZE == aReflowState.availableWidth) {      aDesiredSize.width = onePixel;    }    else {      aDesiredSize.width = aReflowState.availableWidth;    }  }  // Get the thickness of the rule. Note that this specifies the  // height of the rule, not the height of the frame.  nscoord thickness;  if (NS_UNCONSTRAINEDSIZE != aReflowState.mComputedHeight)   {    thickness = aReflowState.mComputedHeight;    // fix up thickness based on noshade and mode.  see bug 53568 and 54980    if (eCompatibility_NavQuirks == mode)    {      nscoord adjustment =  aReflowState.mComputedBorderPadding.top +                             aReflowState.mComputedBorderPadding.bottom;       thickness += adjustment;  // adjust for -moz-bg-inset       PRBool noShadeAttribute = GetNoShade();      if (thickness != onePixel)      {        if (!noShadeAttribute) { // this makes us compatible with Nav4, and one pixel taller than IE5          thickness += onePixel;        }      }    }  }  else {    thickness = NSIntPixelsToTwips(DEFAULT_THICKNESS, p2t);  }  // remember the computed thickness  mThickness = thickness;  NS_ASSERTION(mThickness>=0, "negative height calculated for HR");  // Compute height of "line" that hrule will layout within. Use the  // font-size to do this.  nscoord minLineHeight = thickness + twoPixels;  const nsStyleFont* font;  GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&) font);  const nsFont& f = font->mFont;  nsCOMPtr<nsIFontMetrics> fm;  aPresContext->GetMetricsFor(f, getter_AddRefs(fm));  nscoord fontHeight;  fm->GetHeight(fontHeight);  aDesiredSize.height =    (minLineHeight < fontHeight ? fontHeight : minLineHeight) +    aReflowState.mComputedBorderPadding.top +    aReflowState.mComputedBorderPadding.bottom;  aDesiredSize.ascent = aDesiredSize.height;  aDesiredSize.descent = 0;  // HR's do not impact the max-element-size, unless a width is  // specified otherwise tables behave badly. This makes sense -- they  // are springy.  if (nsnull != aDesiredSize.maxElementSize) {    if (NS_UNCONSTRAINEDSIZE != aReflowState.mComputedWidth) {      nsStyleUnit widthUnit = aReflowState.mStylePosition->mWidth.GetUnit();      if ((eStyleUnit_Percent == widthUnit) ||           (eStyleUnit_Auto == widthUnit)) {        // When the HR is using an 'auto' or percentage width, make sure it        // remains springy.        aDesiredSize.maxElementSize->width = onePixel;      }      else {        aDesiredSize.maxElementSize->width = aReflowState.mComputedWidth;      }    }    else {      aDesiredSize.maxElementSize->width = onePixel;    }    NS_ASSERTION(aDesiredSize.maxElementSize->width <= aDesiredSize.width, "bad max-element-size width");    aDesiredSize.maxElementSize->height = aDesiredSize.height;  }  aStatus = NS_FRAME_COMPLETE;  return NS_OK;}