if (!IsInDoc()) {
nsIDocument* doc = GetCurrentDoc(); if (!doc) {
nsSVGTextElement::GetTextContentMetrics(){  if (!IsInDoc()) {    NS_ERROR("no document");    return nsnull;  }    nsIPresShell* presShell = GetOwnerDoc()->GetShellAt(0);  if (!presShell) {    NS_ERROR("no presshell");    return nsnull;  }  nsIFrame* frame;  presShell->GetPrimaryFrameFor(NS_STATIC_CAST(nsIStyledContent*, this), &frame);  if (!frame) {    NS_ERROR("no frame");    return nsnull;  }    nsISVGTextContentMetrics* metrics;  frame->QueryInterface(NS_GET_IID(nsISVGTextContentMetrics),(void**)&metrics);  NS_ASSERTION(metrics, "wrong frame type");  return metrics;}