nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, aDirtyRect, rect, *spacing, mStyleContext, skipSides, &mTopBorderGap);
if (mLegendFrame) {    PRBool clipState;   nsRect clipRect(rect); clipRect.width = mLegendRect.x - rect.x; clipRect.height = border.top;  aRenderingContext.PushState(); aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect, clipState); nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, aDirtyRect, rect, *spacing, mStyleContext, skipSides);  aRenderingContext.PopState(clipState);    clipRect = rect; clipRect.x = mLegendRect.x + mLegendRect.width; clipRect.width -= (mLegendRect.x + mLegendRect.width); clipRect.height = border.top;  aRenderingContext.PushState(); aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect, clipState); nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, aDirtyRect, rect, *spacing, mStyleContext, skipSides);  aRenderingContext.PopState(clipState);     clipRect = rect; clipRect.y += border.top; clipRect.height = mRect.height - (yoff + border.top);  aRenderingContext.PushState(); aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect, clipState); nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, aDirtyRect, rect, *spacing, mStyleContext, skipSides);  aRenderingContext.PopState(clipState); } else {   nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, aDirtyRect, nsRect(0,0,mRect.width, mRect.height), *spacing, mStyleContext, skipSides); }
nsFieldSetFrame::Paint(nsIPresContext& aPresContext,                       nsIRenderingContext& aRenderingContext,                       const nsRect& aDirtyRect,                       nsFramePaintLayer aWhichLayer){  if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) {    // Paint our background and border    const nsStyleDisplay* disp =      (const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display);    if (disp->mVisible && mRect.width && mRect.height) {      PRIntn skipSides = GetSkipSides();      const nsStyleColor* color =        (const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color);      const nsStyleSpacing* spacing =        (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing);      // XXX      nsRect backgroundRect(0, 0, mRect.width, mRect.height);      // XXX our parent doesn't account for top and bottom margins yet, if we are inline      //if (mInline) {      //  nsMargin margin;      //  spacing->CalcMarginFor(this, margin);       //  nsRect rect(0, mTopBorderOffset, mRect.width, mRect.height - margin.top -       //              margin.bottom - mTopBorderOffset);      //  nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,      //                                  aDirtyRect, rect, *color, *spacing, 0, 0);      //  nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,      //                              aDirtyRect, rect, *spacing, mStyleContext, skipSides, &mTopBorderGap);      //} else {        nsRect rect(0, mTopBorderOffset, mRect.width, mRect.height - mTopBorderOffset);        nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,                                        aDirtyRect, rect, *color, *spacing, 0, 0);        nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,                                    aDirtyRect, rect, *spacing, mStyleContext, skipSides, &mTopBorderGap);      //}     }  }  PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);  if ((NS_FRAME_PAINT_LAYER_DEBUG == aWhichLayer) && GetShowFrameBorders()) {    nsIView* view;    GetView(&view);    if (nsnull != view) {      aRenderingContext.SetColor(NS_RGB(0,0,255));    }    else {      aRenderingContext.SetColor(NS_RGB(255,0,0));    }    aRenderingContext.DrawRect(0, 0, mRect.width, mRect.height);  }  return NS_OK;}