nsTextTransformer tx(lb, nsnull);
nsTextTransformer tx(lb, nsnull, aPresContext);
nsTextFrame::GetPositionSlowly(nsIPresContext* aPresContext,                               nsIRenderingContext* aRendContext,                               const nsPoint& aPoint,                               nsIContent** aNewContent,                               PRInt32& aOffset){  if (!aRendContext || !aNewContent) {    return NS_ERROR_NULL_POINTER;  }  TextStyle ts(aPresContext, *aRendContext, mStyleContext);  if (!ts.mSmallCaps && !ts.mWordSpacing && !ts.mLetterSpacing && !ts.mJustifying) {    return NS_ERROR_INVALID_ARG;  }  nsIView * view;  nsPoint origin;  GetOffsetFromView(aPresContext, origin, &view);  if (aPoint.x - origin.x < 0)  {      *aNewContent = mContent;      aOffset =0;  }  nsCOMPtr<nsIDocument> doc(getter_AddRefs(GetDocument(aPresContext)));  // 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<nsILineBreaker> lb;  doc->GetLineBreaker(getter_AddRefs(lb));  nsTextTransformer tx(lb, nsnull);  PRInt32 textLength;  PRInt32 numSpaces;  numSpaces = PrepareUnicodeText(tx, &indexBuffer, &paintBuffer, &textLength);  if (textLength <= 0) {    return NS_ERROR_FAILURE;  }  ComputeExtraJustificationSpacing(*aRendContext, ts, paintBuffer.mBuffer, textLength, numSpaces);//IF STYLE SAYS TO SELECT TO END OF FRAME HERE...  nsCOMPtr<nsIPref>     prefs;  PRInt32 prefInt = 0;  rv = nsServiceManager::GetService(kPrefCID,                                     NS_GET_IID(nsIPref),                                     (nsISupports**)&prefs);   PRBool outofstylehandled = PR_FALSE;  if (NS_SUCCEEDED(rv) && prefs)   {     if (NS_SUCCEEDED(prefs->GetIntPref("browser.drag_out_of_frame_style", &prefInt)) && prefInt)    {      nsRect bounds(mRect);            bounds.MoveBy(origin.x, origin.y);      if (aPoint.y < bounds.y)//above rectangle      {        aOffset = mContentOffset;        outofstylehandled = PR_TRUE;      }      else if (aPoint.y > (bounds.y + bounds.height))      {        aOffset = mContentOffset + mContentLength;        outofstylehandled = PR_TRUE;      }    }  }  if (!outofstylehandled) //then we drag to closest X point and dont worry about the 'Y'//END STYLE RULE  {    //the following will first get the index into the PAINTBUFFER then the actual content    nscoord adjustedX = PR_MAX(0,aPoint.x-origin.x);    aOffset = mContentOffset+GetLengthSlowly(*aRendContext, ts,paintBuffer.mBuffer,textLength,adjustedX);    PRInt32 i;    for (i = 0;i <= mContentLength; i ++){      if (indexBuffer.mBuffer[i] >= aOffset){ //reverse mapping          aOffset = i + mContentOffset;          break;      }    }  }  *aNewContent = mContent;  if (*aNewContent)    (*aNewContent)->AddRef();  return NS_OK;}