mContentLength , &details);
mContentLength , &details, PR_FALSE);
nsTextFrame::PaintUnicodeText(nsIPresContext* aPresContext,                              nsIRenderingContext& aRenderingContext,                              nsIStyleContext* aStyleContext,                              TextStyle& aTextStyle,                              nscoord dx, nscoord dy){  nsCOMPtr<nsIDocument> doc(getter_AddRefs(GetDocument(aPresContext)));  PRBool displaySelection;  displaySelection = doc->GetDisplaySelection();  // Make enough space to transform  nsAutoTextBuffer paintBuffer;  nsAutoIndexBuffer indexBuffer;  if (displaySelection) {    if (NS_FAILED(indexBuffer.GrowTo(mContentLength + 1))) {      return;    }  }  nscoord width = mRect.width;  // Transform text from content into renderable form  nsCOMPtr<nsILineBreaker> lb;  doc->GetLineBreaker(getter_AddRefs(lb));  nsTextTransformer tx(lb, nsnull);  PRInt32 textLength;  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) {    if (!displaySelection || !isSelected ) {       // When there is no selection showing, use the fastest and      // simplest rendering approach      aRenderingContext.SetColor(aTextStyle.mColor->mColor);      aRenderingContext.DrawString(text, PRUint32(textLength), dx, dy);      PaintTextDecorations(aRenderingContext, aStyleContext, aTextStyle,                           dx, dy, width);    }    else {      SelectionDetails *details = nsnull;      nsCOMPtr<nsIPresShell> shell;      nsCOMPtr<nsIFrameSelection> frameSelection;      nsresult rv = aPresContext->GetShell(getter_AddRefs(shell));      if (NS_SUCCEEDED(rv) && shell){        rv = shell->GetFrameSelection(getter_AddRefs(frameSelection));        if (NS_SUCCEEDED(rv) && frameSelection){          nsCOMPtr<nsIContent> content;          rv = GetContent(getter_AddRefs(content));          if (NS_SUCCEEDED(rv) && content){            rv = frameSelection->LookUpSelection(content, mContentOffset,                                   mContentLength , &details);// last param notused          }        }      }              //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;      }      aRenderingContext.SetColor(aTextStyle.mColor->mColor);      aRenderingContext.DrawString(text, PRUint32(textLength), dx, dy);      PaintTextDecorations(aRenderingContext, aStyleContext,                           aTextStyle, dx, dy, width, text, details,0,(PRUint32)textLength);      sdptr = details;      if (details){        while ((sdptr = details->mNext) != nsnull) {          delete details;          details = sdptr;        }        delete details;      }    }  }}