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::DidModifySVGObservable (nsISVGValue* observable){  // either viewport, viewbox or preserveAspectRatio have changed  // invalidate viewbox -> viewport xform & inform frames  mViewBoxToViewportTransform = nsnull;    if (!IsInDoc()) return NS_ERROR_FAILURE;  nsIPresShell* presShell = GetOwnerDoc()->GetShellAt(0);  NS_ASSERTION(presShell, "no presShell");  if (!presShell) return NS_ERROR_FAILURE;  nsIFrame* frame;  presShell->GetPrimaryFrameFor(NS_STATIC_CAST(nsIStyledContent*, this), &frame);  if (frame) {    nsISVGSVGFrame* svgframe;    CallQueryInterface(frame, &svgframe);    if (svgframe) {      svgframe->NotifyViewportChange();    }#ifdef DEBUG    else {      // XXX we get here during nsSVGOuterSVGFrame::Init() since that      // function is called before the presshell association between us      // and our frame is established.      NS_WARNING("wrong frame type");    }#endif  }    #ifdef DEBUG  printf("viewport/viewbox/preserveAspectRatio have been changed\n");#endif  return NS_OK;}