if (mContentLength <= 0) { outPoint->x = 0; outPoint->y = 0; return NS_OK; }
TextFrame::GetPointFromOffset(nsIPresContext* inPresContext, nsIRenderingContext* inRendContext, PRInt32 inOffset, nsPoint* outPoint){  if (!inPresContext || !inRendContext)    return NS_ERROR_NULL_POINTER;  inOffset-=mContentOffset;  if (inOffset < 0){    NS_ASSERTION(0,"offset less than this frame has in GetPointFromOffset");    inOffset = 0;  }  TextStyle ts(*inPresContext, *inRendContext, mStyleContext);    PRUnichar wordBufMem[WORD_BUF_SIZE];  PRUnichar paintBufMem[TEXT_BUF_SIZE];  PRInt32 indicies[TEXT_BUF_SIZE];  PRUnichar* paintBuf = paintBufMem;  PRInt32* ip = indicies;  if (mContentLength > TEXT_BUF_SIZE) {    ip = new PRInt32[mContentLength+1];    paintBuf = new PRUnichar[mContentLength];  }  nscoord width = mRect.width;  PRInt32 textLength;  // Transform text from content into renderable form  nsCOMPtr<nsIPresShell> shell;  inPresContext->GetShell(getter_AddRefs(shell));  nsCOMPtr<nsIDocument> doc;  shell->GetDocument(getter_AddRefs(doc));  nsCOMPtr<nsILineBreaker> lb;  doc->GetLineBreaker(getter_AddRefs(lb));  nsTextTransformer tx(wordBufMem, WORD_BUF_SIZE, lb);  PrepareUnicodeText(tx,                     ip,                     paintBuf, textLength, width);  ip[mContentLength] = ip[mContentLength-1]+1; //must set up last one for selection beyond edge  if (inOffset > mContentLength){    NS_ASSERTION(0, "invalid offset passed to GetPointFromOffset");    inOffset = mContentLength;  }  GetWidth(*inRendContext, ts,           paintBuf, ip[inOffset]-mContentOffset,           width);  (*outPoint).x = width;  (*outPoint).y = 0;  if (paintBuf != paintBufMem)    delete [] paintBuf;  if (ip != indicies) {    delete [] ip;  }  return NS_OK;}