PRInt32 length; tc->GetTextLength(&length);  frameSelection->LookUpSelection(mContent, 0, length,
frameSelection->LookUpSelection(mContent, 0, fragment->GetLength(),
nsSVGGlyphFrame::GetHighlight(PRUint32 *charnum, PRUint32 *nchars, nscolor *foreground, nscolor *background){  *foreground = NS_RGB(255,255,255);  *background = NS_RGB(0,0,0);   *charnum=0;  *nchars=0;    PRBool hasHighlight;  GetHasHighlight(&hasHighlight);  if (!hasHighlight) {    NS_ERROR("nsSVGGlyphFrame::GetHighlight() called by renderer when there is no highlight");    return NS_ERROR_FAILURE;  }  // XXX gcc 3.2.2 requires the explicit 'nsSVGGlyphFrameBase::' qualification  nsIPresContext *presContext = nsSVGGlyphFrameBase::GetPresContext();  nsCOMPtr<nsITextContent> tc = do_QueryInterface(mContent);  NS_ASSERTION(tc, "no textcontent interface");  // The selection ranges are relative to the uncompressed text in  // the content element. We'll need the text fragment:  const nsTextFragment*fragment=nsnull;  tc->GetText(&fragment);  NS_ASSERTION(fragment, "null text fragment");    // get the selection details   SelectionDetails *details = nsnull;  {    nsCOMPtr<nsIFrameSelection> frameSelection;    {      nsCOMPtr<nsISelectionController> controller;      GetSelectionController(presContext, getter_AddRefs(controller));            if (!controller) {        NS_ERROR("no selection controller");        return NS_ERROR_FAILURE;      }      frameSelection = do_QueryInterface(controller);    }    if (!frameSelection) {      presContext->PresShell()->GetFrameSelection(getter_AddRefs(frameSelection));    }    if (!frameSelection) {      NS_ERROR("no frameselection interface");      return NS_ERROR_FAILURE;    }    PRInt32 length;    tc->GetTextLength(&length);        frameSelection->LookUpSelection(mContent, 0, length,                                    &details, PR_FALSE);  }#if defined(DEBUG) && defined(SVG_DEBUG_SELECTION)  {    SelectionDetails *dp = details;    printf("nsSVGGlyphFrame(%p)::GetHighlight() [\n", this);    while (dp) {      printf("selection detail: %d(%d)->%d(%d) type %d\n",             dp->mStart, CompressIndex(dp->mStart, fragment),             dp->mEnd, CompressIndex(dp->mEnd, fragment),             dp->mType);      dp = dp->mNext;    }    printf("]\n");        }#endif    if (details) {    NS_ASSERTION(details->mNext==nsnull, "can't do multiple selection ranges");    *charnum=CompressIndex(details->mStart, fragment);    *nchars=CompressIndex(details->mEnd, fragment)-*charnum;          nsILookAndFeel *look = presContext->LookAndFeel();    look->GetColor(nsILookAndFeel::eColor_TextSelectBackground, *background);    look->GetColor(nsILookAndFeel::eColor_TextSelectForeground, *foreground);    SelectionDetails *dp = details;    while ((dp=details->mNext) != nsnull) {      delete details;      details = dp;    }    delete details;  }    return NS_OK;}