else
else if (!isPaginated)
nsTextFrame::PaintTextSlowly(nsIPresContext* aPresContext,                             nsIRenderingContext& aRenderingContext,                             nsIStyleContext* aStyleContext,                             TextStyle& aTextStyle,                             nscoord dx, nscoord dy){  nsCOMPtr<nsIPresShell> shell;  nsresult rv = aPresContext->GetShell(getter_AddRefs(shell));  if (NS_FAILED(rv) || !shell)    return;  nsCOMPtr<nsISelectionController> selCon;  rv = GetSelectionController(aPresContext, getter_AddRefs(selCon));  if (NS_FAILED(rv) || !selCon)    return;  PRInt16 selectionValue;  selCon->GetDisplaySelection(&selectionValue);  PRBool displaySelection = selectionValue > nsISelectionController::SELECTION_HIDDEN;  // Make enough space to transform  nsAutoTextBuffer paintBuffer;  nsAutoIndexBuffer indexBuffer;  if (NS_FAILED(indexBuffer.GrowTo(mContentLength + 1))) {    return;  }  nscoord width = mRect.width;  PRInt32 textLength;  // Transform text from content into renderable form  nsCOMPtr<nsIDocument> doc;  shell->GetDocument(getter_AddRefs(doc));  if (!doc)    return;  nsCOMPtr<nsILineBreaker> lb;  doc->GetLineBreaker(getter_AddRefs(lb));  nsTextTransformer tx(lb, nsnull, aPresContext);  PRInt32 numSpaces;    numSpaces = PrepareUnicodeText(tx, (displaySelection ? &indexBuffer : nsnull),                                 &paintBuffer, &textLength);  PRInt32* ip = indexBuffer.mBuffer;  PRUnichar* text = paintBuffer.mBuffer;  nsFrameState  frameState;  PRBool        isSelected;  GetFrameState(&frameState);  isSelected = (frameState & NS_FRAME_SELECTED_CONTENT) == NS_FRAME_SELECTED_CONTENT;  if (0 != textLength) {    ComputeExtraJustificationSpacing(aRenderingContext, aTextStyle, text, textLength, numSpaces);    if (!displaySelection || !isSelected) {       // When there is no selection showing, use the fastest and      // simplest rendering approach      aRenderingContext.SetColor(aTextStyle.mColor->mColor);      RenderString(aRenderingContext, aStyleContext, aTextStyle,                   text, textLength, dx, dy, width);    }    else     {      SelectionDetails *details = nsnull;      nsCOMPtr<nsIFrameSelection> frameSelection;//get the frame selection      frameSelection = do_QueryInterface(selCon); //this MAY implement      if (!frameSelection)//if that failed get it from the presshell        rv = shell->GetFrameSelection(getter_AddRefs(frameSelection));      if (NS_SUCCEEDED(rv) && frameSelection)      {        nsCOMPtr<nsIContent> content;        PRInt32 offset;        PRInt32 length;        rv = GetContentAndOffsetsForSelection(aPresContext,getter_AddRefs(content),&offset,&length);        if (NS_SUCCEEDED(rv))        {          rv = frameSelection->LookUpSelection(content, mContentOffset,                                 mContentLength , &details, PR_FALSE);        }      }      //where are the selection points "really"      SelectionDetails *sdptr = details;      while (sdptr){        sdptr->mStart = ip[sdptr->mStart] - mContentOffset;        sdptr->mEnd = ip[sdptr->mEnd]  - mContentOffset;        sdptr = sdptr->mNext;      }      DrawSelectionIterator iter(details,text,(PRUint32)textLength,aTextStyle, selectionValue);      if (!iter.IsDone() && iter.First())      {	      nscoord currentX = dx;	      nscoord newWidth;//temp	      while (!iter.IsDone())	      {	      PRUnichar *currenttext  = iter.CurrentTextUnicharPtr();	      PRUint32   currentlength= iter.CurrentLength();	      //TextStyle &currentStyle = iter.CurrentStyle();	      nscolor    currentFGColor = iter.CurrentForeGroundColor();	      nscolor    currentBKColor;	      GetWidth(aRenderingContext,aTextStyle,currenttext, (PRInt32)currentlength,&newWidth);	      if (newWidth)	      {		      if (iter.CurrentBackGroundColor(currentBKColor))		      {//DRAW RECT HERE!!!		      aRenderingContext.SetColor(currentBKColor);		      aRenderingContext.FillRect(currentX, dy, newWidth, mRect.height);						      currentFGColor = EnsureDifferentColors(currentFGColor, currentBKColor);		      }	      }	      else		      newWidth =0;    	      aRenderingContext.SetColor(currentFGColor);	      RenderString(aRenderingContext,aStyleContext, aTextStyle, currenttext, 					      currentlength, currentX, dy, width, details);	      //increment twips X start but remember to get ready for next draw by reducing current x by letter spacing amount	      currentX+=newWidth;// + aTextStyle.mLetterSpacing;	      iter.Next();	      }      }      else      {        aRenderingContext.SetColor(aTextStyle.mColor->mColor);        RenderString(aRenderingContext,aStyleContext, aTextStyle, text,                     PRUint32(textLength), dx, dy, width, details);      }      sdptr = details;      if (details){        while ((sdptr = details->mNext) != nsnull) {          delete details;          details = sdptr;        }        delete details;      }    }  }}