if (disp->mVisible) { const nsStyleList* myList = (const nsStyleList*)mStyleContext->GetStyleData(eStyleStruct_List);  if (myList->mListStyleImage.Length() > 0) { nsIImage* image = mImageLoader.GetImage(); if (nsnull == image) { if (!mImageLoader.GetLoadImageFailed()) {  return NS_OK; } } else { nsRect innerArea(mPadding.left, mPadding.top, mRect.width - (mPadding.left + mPadding.right), mRect.height - (mPadding.top + mPadding.bottom)); aRenderingContext.DrawImage(image, innerArea); return NS_OK; } }  const nsStyleFont* myFont = (const nsStyleFont*)mStyleContext->GetStyleData(eStyleStruct_Font); const nsStyleColor* myColor = (const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color); nsIFontMetrics* fm; aRenderingContext.SetColor(myColor->mColor);  nsAutoString text; switch (myList->mListStyleType) { case NS_STYLE_LIST_STYLE_NONE: break;  default: case NS_STYLE_LIST_STYLE_BASIC: case NS_STYLE_LIST_STYLE_DISC: aRenderingContext.FillEllipse(mPadding.left, mPadding.top, mRect.width - (mPadding.left + mPadding.right), mRect.height - (mPadding.top + mPadding.bottom)); break;  case NS_STYLE_LIST_STYLE_CIRCLE: aRenderingContext.DrawEllipse(mPadding.left, mPadding.top, mRect.width - (mPadding.left + mPadding.right), mRect.height - (mPadding.top + mPadding.bottom)); break;  case NS_STYLE_LIST_STYLE_SQUARE: aRenderingContext.FillRect(mPadding.left, mPadding.top, mRect.width - (mPadding.left + mPadding.right), mRect.height - (mPadding.top + mPadding.bottom)); break;  case NS_STYLE_LIST_STYLE_DECIMAL: case NS_STYLE_LIST_STYLE_LOWER_ROMAN: case NS_STYLE_LIST_STYLE_UPPER_ROMAN: case NS_STYLE_LIST_STYLE_LOWER_ALPHA: case NS_STYLE_LIST_STYLE_UPPER_ALPHA: fm = aCX.GetMetricsFor(myFont->mFont); GetListItemText(aCX, *myList, text); aRenderingContext.SetFont(fm); aRenderingContext.GetWidth(text, width); aRenderingContext.DrawString(text, mPadding.left, mPadding.top, width); NS_RELEASE(fm); break;
nsBlockFrame::Paint(nsPresContext*      aPresContext,                    nsIRenderingContext& aRenderingContext,                    const nsRect&        aDirtyRect,                    nsFramePaintLayer    aWhichLayer,                    PRUint32             aFlags){  if (NS_FRAME_IS_UNFLOWABLE & mState) {    return NS_OK;  }#ifdef DEBUG  if (gNoisyDamageRepair) {    if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) {      PRInt32 depth = GetDepth();      nsRect ca;      ::ComputeCombinedArea(mLines, mRect.width, mRect.height, ca);      nsFrame::IndentBy(stdout, depth);      ListTag(stdout);      printf(": bounds=%d,%d,%d,%d dirty=%d,%d,%d,%d ca=%d,%d,%d,%d\n",             mRect.x, mRect.y, mRect.width, mRect.height,             aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height,             ca.x, ca.y, ca.width, ca.height);    }  }#endif    if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) {    PaintSelf(aPresContext, aRenderingContext, aDirtyRect);  }  PRBool paintingSuppressed = PR_FALSE;    aPresContext->PresShell()->IsPaintingSuppressed(&paintingSuppressed);  if (paintingSuppressed)    return NS_OK;  const nsStyleDisplay* disp = GetStyleDisplay();  // If overflow is hidden then set the clip rect so that children don't  // leak out of us. Note that because overflow'-clip' only applies to  // the content area we do this after painting the border and background  if (NS_STYLE_OVERFLOW_CLIP == disp->mOverflowX) {    aRenderingContext.PushState();    SetOverflowClipRect(aRenderingContext);  }  // Child elements have the opportunity to override the visibility  // property and display even if the parent is hidden  if (NS_FRAME_PAINT_LAYER_FLOATS == aWhichLayer) {    PaintFloats(aPresContext, aRenderingContext, aDirtyRect);  }  PaintDecorationsAndChildren(aPresContext, aRenderingContext,                              aDirtyRect, aWhichLayer, PR_TRUE);  if (NS_STYLE_OVERFLOW_CLIP == disp->mOverflowX)    aRenderingContext.PopState();#if 0  if ((NS_FRAME_PAINT_LAYER_DEBUG == aWhichLayer) && GetShowFrameBorders()) {    // Render the bands in the spacemanager    nsSpaceManager* sm = mSpaceManager;    if (nsnull != sm) {      nsBlockBandData band;      band.Init(sm, nsSize(mRect.width, mRect.height));      nscoord y = 0;      while (y < mRect.height) {        nsRect availArea;        band.GetAvailableSpace(y, PR_FALSE, availArea);          // Render a box and a diagonal line through the band        aRenderingContext.SetColor(NS_RGB(0,255,0));        aRenderingContext.DrawRect(0, availArea.y,                                   mRect.width, availArea.height);        aRenderingContext.DrawLine(0, availArea.y,                                   mRect.width, availArea.YMost());          // Render boxes and opposite diagonal lines around the        // unavailable parts of the band.        PRInt32 i;        for (i = 0; i < band.GetTrapezoidCount(); i++) {          const nsBandTrapezoid* trapezoid = band.GetTrapezoid(i);          if (nsBandTrapezoid::Available != trapezoid->mState) {            nsRect r = trapezoid->GetRect();            if (nsBandTrapezoid::OccupiedMultiple == trapezoid->mState) {              aRenderingContext.SetColor(NS_RGB(0,255,128));            }            else {              aRenderingContext.SetColor(NS_RGB(128,255,0));            }            aRenderingContext.DrawRect(r);            aRenderingContext.DrawLine(r.x, r.YMost(), r.XMost(), r.y);          }        }        y = availArea.YMost();      }    }  }#endif  return NS_OK;}