nsTextTransformer tx(aLineBreaker, nsnull);
nsTextTransformer tx(aLineBreaker, nsnull, aPresContext);
nsTextFrame::ComputeWordFragmentWidth(nsIPresContext* aPresContext,                                      nsILineBreaker* aLineBreaker,                                      nsLineLayout& aLineLayout,                                      const nsHTMLReflowState& aReflowState,                                      nsIFrame* aTextFrame,                                      nsIContent* aContent,                                      nsITextContent* aText,                                      PRBool* aStop,                                      const PRUnichar* aWordBuf,                                      PRUint32& aRunningWordLen,                                      PRUint32 aWordBufSize){  nsTextTransformer tx(aLineBreaker, nsnull);  tx.Init(aTextFrame, aContent, 0);  PRBool isWhitespace, wasTransformed;  PRInt32 wordLen, contentLen;  PRUnichar* bp = tx.GetNextWord(PR_TRUE, &wordLen, &contentLen, &isWhitespace, &wasTransformed);  if (!bp || isWhitespace) {    // Don't bother measuring nothing    *aStop = PR_TRUE;    return 0;  }  *aStop = contentLen < tx.GetContentLength();  // Convert any spaces in the current word back to nbsp's. This keeps  // the breaking logic happy.  RevertSpacesToNBSP(bp, wordLen);  // We need to adjust the length by look at the two pieces together  // XXX this should grow aWordBuf if necessary  PRUint32 copylen = sizeof(PRUnichar) *    ( ((wordLen + aRunningWordLen) > aWordBufSize)      ? (aWordBufSize - aRunningWordLen)      : wordLen      );  if((aWordBufSize > aRunningWordLen) && (copylen > 0))  {    nsCRT::memcpy((void*)&(aWordBuf[aRunningWordLen]), bp, copylen);    PRUint32 breakP=0;    PRBool needMore=PR_TRUE;    nsresult lres = aLineBreaker->Next(aWordBuf, aRunningWordLen+wordLen,                                       0, &breakP, &needMore);    if(NS_SUCCEEDED(lres))     {       // when we look at two pieces text together, we might decide to break       // eariler than if we only look at the 2nd pieces of text       if(!needMore && (breakP < (aRunningWordLen + wordLen)))       {           wordLen = breakP - aRunningWordLen;            if(wordLen < 0)               wordLen = 0;           *aStop = PR_TRUE;       }     }    // if we don't stop, we need to extend the buf so the next one can    // see this part otherwise, it does not matter since we will stop    // anyway    if(! *aStop)       aRunningWordLen += wordLen;  }  if((*aStop) && (wordLen == 0))	  return 0;  nsCOMPtr<nsIStyleContext> sc;  aTextFrame->GetStyleContext(getter_AddRefs(sc));  if (sc) {    // Measure the piece of text. Note that we have to select the    // appropriate font into the text first because the rendering    // context has our font in it, not the font that aText is using.    nscoord width;    nsIRenderingContext& rc = *aReflowState.rendContext;    nsCOMPtr<nsIFontMetrics> oldfm;    rc.GetFontMetrics(*getter_AddRefs(oldfm));    TextStyle ts(aLineLayout.mPresContext, rc, sc);    if (ts.mSmallCaps) {      MeasureSmallCapsText(aReflowState, ts, bp, wordLen, &width);    }    else {      rc.GetWidth(bp, wordLen, width);      // NOTE: Don't forget to add letter spacing for the word fragment!      width += wordLen*ts.mLetterSpacing;    }    rc.SetFont(oldfm);#ifdef DEBUG_WORD_WRAPPING    nsAutoString tmp(bp, wordLen);    printf("  fragment='");    fputs(tmp, stdout);    printf("' width=%d [wordLen=%d contentLen=%d ContentLength=%d]\n",           width, wordLen, contentLen, tx.GetContentLength());#endif    // Remember the text frame for later so that we don't bother doing    // the word look ahead.    aLineLayout.RecordWordFrame(aTextFrame);    return width;  }  *aStop = PR_TRUE;  return 0;}