const nsStyleDisplay* disp = (const nsStyleDisplay*) sc->GetStyleData(eStyleStruct_Display); if (disp->IsVisible()) {
PRBool isVisible; if (NS_SUCCEEDED(IsVisibleForPainting(aPresContext, aRenderingContext, PR_TRUE, &isVisible)) && isVisible) {
nsTextFrame::Paint(nsIPresContext* aPresContext,                   nsIRenderingContext& aRenderingContext,                   const nsRect& aDirtyRect,                   nsFramePaintLayer aWhichLayer){  if (NS_FRAME_PAINT_LAYER_FOREGROUND != aWhichLayer) {    return NS_OK;  }  if ((0 != (mState & TEXT_BLINK_ON)) && nsBlinkTimer::GetBlinkIsOff()) {    return NS_OK;  }  nsIStyleContext* sc = mStyleContext;  const nsStyleDisplay* disp = (const nsStyleDisplay*)    sc->GetStyleData(eStyleStruct_Display);  if (disp->IsVisible()) {    TextStyle ts(aPresContext, aRenderingContext, mStyleContext);    if (ts.mSmallCaps || (0 != ts.mWordSpacing) || (0 != ts.mLetterSpacing)      || ts.mJustifying) {      PaintTextSlowly(aPresContext, aRenderingContext, sc, ts, 0, 0);    }    else {      // Get the text fragment      nsCOMPtr<nsITextContent> tc = do_QueryInterface(mContent);      const nsTextFragment* frag = nsnull;      if (tc.get()) {        tc->GetText(&frag);      }      if (!frag) {        return NS_ERROR_FAILURE;      }      // Choose rendering pathway based on rendering context performance      // hint, whether it needs to be transformed, and whether it's      // multi-byte      PRBool   hasMultiByteChars = (0 != (mState & TEXT_HAS_MULTIBYTE));      PRUint32 hints = 0;      aRenderingContext.GetHints(hints);      // If we have ascii text that doesn't contain multi-byte characters      // and the text doesn't need transforming then always render as ascii      if ((0 == (mState & TEXT_WAS_TRANSFORMED)) && !frag->Is2b() && !hasMultiByteChars) {        PaintAsciiText(aPresContext, aRenderingContext, sc, ts, 0, 0);            } else if (hasMultiByteChars || (0 == (hints & NS_RENDERING_HINT_FAST_8BIT_TEXT))) {        // If it has multi-byte characters then we have to render it as Unicode        // regardless of whether the text fragment is 1-byte or 2-byte characters.        // Or if the text fragment requires transforming then leave it up to the        // rendering context's preference        PaintUnicodeText(aPresContext, aRenderingContext, sc, ts, 0, 0);      }      else {        // Use char rendering routine        PaintAsciiText(aPresContext, aRenderingContext, sc, ts, 0, 0);      }    }  }  return NS_OK;}