diameter, diameter, 270.0f, 180.0f);
diameter, diameter, 270.0f, 90.0f);
HRuleFrame::Paint(nsIPresContext*      aPresContext,                  nsIRenderingContext& aRenderingContext,                  const nsRect&        aDirtyRect,                  nsFramePaintLayer    aWhichLayer){  if (NS_FRAME_PAINT_LAYER_FOREGROUND != aWhichLayer) {    return NS_OK;  }  const nsStyleDisplay* disp =    (const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display);  if (!disp->IsVisible()) {    return NS_OK;  }  float p2t;  aPresContext->GetScaledPixelsToTwips(&p2t);  nscoord thickness = mThickness;  // Get style data  nscoord x0 = mBorderPadding.left;  nscoord y0 = mBorderPadding.top;  nscoord width = mRect.width -    (mBorderPadding.left + mBorderPadding.right);  nscoord height = mRect.height -    (mBorderPadding.top + mBorderPadding.bottom);  // Center hrule vertically within the available space  y0 += (height - thickness) / 2;  height = thickness;  // To shade or not to shade, that is the question. Begin by collecting the  // three decision criteria: rendering to the printer or the display, is the  // "Beveled Lines" checkbox set in the page setup dialog, and does the tag  // have the NOSHADE attribute set.	PRBool noShadeAttribute = GetNoShade();  // Now that we have the data to make the shading criteria, we next  // collect the decision criteria for rending in solid black:  // printing (which we already have) and the "Black Lines" setting in  // the page setup dialog  const nsStyleColor* color;  // Draw a "shadowed" box around the rule area  if (!noShadeAttribute) {    nsRect rect(x0, y0, width, height);    const nsStyleSpacing* spacing =       (nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing);    color = (nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color);        nsCSSRendering::PaintBackground(aPresContext, aRenderingContext,                                    this,aDirtyRect, rect, *color,                                     *spacing, 0, 0);    nsCSSRendering::PaintBorder(aPresContext, aRenderingContext,                                this,aDirtyRect, rect, *spacing,                                mStyleContext, 0);  } else {    nscolor colors[2];     // Get the background color that applies to this HR     color = nsStyleUtil::FindNonTransparentBackground(mStyleContext);     NS_Get3DColors(colors, color->mBackgroundColor);     // When a rule is not shaded, then we use a uniform color and    // draw half-circles on the end points.    aRenderingContext.SetColor (colors[0]);    nscoord diameter = height;    if ((diameter > width) || (diameter < NSIntPixelsToTwips(3, p2t))) {      // The half-circles on the ends of the rule aren't going to      // look right so don't bother drawing them.      aRenderingContext.FillRect(x0, y0, width, height);    } else {      aRenderingContext.FillArc(x0, y0, diameter, diameter, 90.0f, 270.0f);      aRenderingContext.FillArc(x0 + width - diameter, y0,                                diameter, diameter, 270.0f, 180.0f);      aRenderingContext.FillRect(x0 + diameter/2, y0,                                 width - diameter, height);     }  }  return nsFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);}