NS_ASSERTION(metrics, "null metrics");
if (!metrics) return NS_ERROR_FAILURE;
nsSVGTextFrame::GetExtentOfChar(PRUint32 charnum, nsIDOMSVGRect **_retval){  *_retval = nsnull;    EnsureFragmentTreeUpToDate();  nsISVGGlyphFragmentLeaf *fragment = GetGlyphFragmentAtCharNum(charnum);  if (!fragment) return NS_ERROR_FAILURE; // xxx return some index-out-of-range error    // query the renderer metrics for the bounds of the character  nsCOMPtr<nsISVGRendererGlyphMetrics> metrics;  fragment->GetGlyphMetrics(getter_AddRefs(metrics));  NS_ASSERTION(metrics, "null metrics");  nsresult rv = metrics->GetExtentOfChar(charnum-fragment->GetCharNumberOffset(),                                         _retval);  if (NS_FAILED(rv)) return NS_ERROR_FAILURE;  // offset the bounds by the position of the fragment:  float x,y;  (*_retval)->GetX(&x);  (*_retval)->GetY(&y);  (*_retval)->SetX(x+fragment->GetGlyphPositionX());  (*_retval)->SetY(y+fragment->GetGlyphPositionY());  return NS_OK;}