nsTextTransformer tx(lb, nsnull);
nsTextTransformer tx(lb, nsnull, aPresContext);
nsTextFrame::GetPointFromOffset(nsIPresContext* aPresContext,                                nsIRenderingContext* inRendContext,                                PRInt32 inOffset,                                nsPoint* outPoint){  if (!aPresContext || !inRendContext || !outPoint)    return NS_ERROR_NULL_POINTER;  if (mContentLength <= 0) {    outPoint->x = 0;    outPoint->y = 0;    return NS_OK;  }  inOffset-=mContentOffset;  if (inOffset < 0){    NS_ASSERTION(0,"offset less than this frame has in GetPointFromOffset");    inOffset = 0;  }  if (inOffset >= mContentLength)    inOffset = mContentLength;  TextStyle ts(aPresContext, *inRendContext, mStyleContext);  // Make enough space to transform  nsAutoTextBuffer paintBuffer;  nsAutoIndexBuffer indexBuffer;  nsresult rv = indexBuffer.GrowTo(mContentLength + 1);  if (NS_FAILED(rv)) {    return rv;  }  // Transform text from content into renderable form  nsCOMPtr<nsIDocument> doc(getter_AddRefs(GetDocument(aPresContext)));  nsCOMPtr<nsILineBreaker> lb;  doc->GetLineBreaker(getter_AddRefs(lb));  nsTextTransformer tx(lb, nsnull);  PRInt32 textLength;  PRInt32 numSpaces;  numSpaces = PrepareUnicodeText(tx, &indexBuffer, &paintBuffer, &textLength);  ComputeExtraJustificationSpacing(*inRendContext, ts, paintBuffer.mBuffer, textLength, numSpaces);  PRInt32* ip = indexBuffer.mBuffer;  if (inOffset > mContentLength){    NS_ASSERTION(0, "invalid offset passed to GetPointFromOffset");    inOffset = mContentLength;  }  while (inOffset >=0 && ip[inOffset] < mContentOffset) //buffer has shrunk    inOffset --;  nscoord width = mRect.width;  if (inOffset <0)  {    NS_ASSERTION(0, "invalid offset passed to GetPointFromOffset");    inOffset=0;    width = 0;  }  else  {    if (ts.mSmallCaps || (0 != ts.mWordSpacing) || (0 != ts.mLetterSpacing) || ts.mJustifying)    {      GetWidth(*inRendContext, ts,               paintBuffer.mBuffer, ip[inOffset]-mContentOffset,               &width);    }    else    {      if (inOffset >=0)        inRendContext->GetWidth(paintBuffer.mBuffer, ip[inOffset]-mContentOffset,width);    }    if (inOffset > textLength && (TEXT_TRIMMED_WS & mState)){      //      // Offset must be after a space that has      // been trimmed off the end of the frame.      // Add the width of the trimmed space back      // to the total width, so the caret appears      // in the proper place!      //      // NOTE: the trailing whitespace includes the word spacing!!      width += ts.mSpaceWidth + ts.mWordSpacing;    }  }  outPoint->x = width;  outPoint->y = 0;  return NS_OK;}