if (!IsInDoc()) return NS_ERROR_FAILURE; nsIPresShell *presShell = GetOwnerDoc()->GetShellAt(0);
nsIDocument* doc = GetCurrentDoc(); if (!doc) return NS_ERROR_FAILURE; nsIPresShell *presShell = doc->GetShellAt(0);
nsSVGSVGElement::SuspendRedraw(PRUint32 max_wait_milliseconds, PRUint32 *_retval){  *_retval = 1;  if (++mRedrawSuspendCount > 1)     return NS_OK;    if (!IsInDoc()) return NS_ERROR_FAILURE;  nsIPresShell *presShell = GetOwnerDoc()->GetShellAt(0);  NS_ASSERTION(presShell, "need presShell to suspend redraw");  if (!presShell) return NS_ERROR_FAILURE;  nsIFrame* frame;  presShell->GetPrimaryFrameFor(NS_STATIC_CAST(nsIStyledContent*, this), &frame);#ifdef DEBUG  // XXX We sometimes hit this assertion when the svg:svg element is  // in a binding and svg children are inserted underneath it using  // <children/>. If the svg children then call suspendRedraw, the  // above function call fails although the svg:svg's frame has been  // build. Strange...    NS_ASSERTION(frame, "suspending redraw w/o frame");#endif  if (frame) {    nsISVGSVGFrame* svgframe;    CallQueryInterface(frame, &svgframe);    NS_ASSERTION(svgframe, "wrong frame type");    if (svgframe) {      svgframe->SuspendRedraw();    }  }    return NS_OK;}