nsCOMPtr<nsIContent> next;  if (bindingManager) { bindingManager->GetInsertionParent(parent, getter_AddRefs(next));
nsCOMPtr<nsIDOMSVGLocatable> locatableElement = do_QueryInterface(ancestor); if (locatableElement) { rv = locatableElement->GetScreenCTM(getter_AddRefs(ancestorScreenCTM)); if (NS_FAILED(rv)) return rv; break;
nsSVGSVGElement::GetScreenCTM(nsIDOMSVGMatrix **_retval){  nsCOMPtr<nsIDOMSVGMatrix> screenCTM;  nsIBindingManager *bindingManager = nsnull;  // XXXbz I _think_ this is right.  We want to be using the binding manager  // that would have attached the binding that gives us our anonymous parent.  // That's the binding manager for the document we actually belong to, which  // is our owner doc.  nsIDocument* ownerDoc = GetOwnerDoc();  if (ownerDoc) {    bindingManager = ownerDoc->BindingManager();  }  nsCOMPtr<nsIContent> parent;    if (bindingManager) {    // we have a binding manager -- do we have an anonymous parent?    bindingManager->GetInsertionParent(this, getter_AddRefs(parent));  }  if (!parent) {    // if we didn't find an anonymous parent, use the explicit one,    // whether it's null or not...    parent = GetParent();  }    while (parent) {        nsCOMPtr<nsIDOMSVGLocatable> locatableElement = do_QueryInterface(parent);    if (locatableElement) {      locatableElement->GetScreenCTM(getter_AddRefs(screenCTM));      if (!screenCTM) break;      nsCOMPtr<nsIDOMSVGSVGElement> viewportElement = do_QueryInterface(parent);      if (viewportElement) {        // it is a viewport element        nsCOMPtr<nsIDOMSVGMatrix> tmp;        nsCOMPtr<nsIDOMSVGMatrix> res;        nsCOMPtr<nsIContent> vpElement = do_QueryInterface(viewportElement);        if (ownerDoc && ownerDoc->GetRootContent() == vpElement) {          // it is also the document element          // first append its currentScale and currentTranslate values          float cs, ctx, cty;          nsCOMPtr<nsIDOMSVGPoint> currentTranslate;          viewportElement->GetCurrentScale(&cs);          viewportElement->GetCurrentTranslate(getter_AddRefs(currentTranslate));          currentTranslate->GetX(&ctx);          currentTranslate->GetY(&cty);          NS_NewSVGMatrix(getter_AddRefs(tmp), cs, 0, 0, cs, ctx, cty);          screenCTM->Multiply(tmp, getter_AddRefs(res));          screenCTM.swap(res);          if (!screenCTM) break; // out of memory        }        // append its viewbox transform        viewportElement->GetViewboxToViewportTransform(getter_AddRefs(tmp));        screenCTM->Multiply(tmp, getter_AddRefs(res));        screenCTM.swap(res);      }      break;    }    // Our parent was not svg content. We allow interdispersed non-SVG    // content to coexist with XBL. Loop until we find the first SVG    // parent.        nsCOMPtr<nsIContent> next;    if (bindingManager) {      bindingManager->GetInsertionParent(parent, getter_AddRefs(next));    }    if (!next) {      // no anonymous parent, so use explicit one      next = parent->GetParent();    }    parent = next;  }  if (!screenCTM) {    // We either didn't find an SVG parent, or our parent failed in    // giving us a CTM.    // In either case, we'll just assume that we are the outermost SVG element:    // we get our client offset in case we're inline in some other content    PRInt32 x, y;    GetClientPosition(x, y);    NS_NewSVGMatrix(getter_AddRefs(screenCTM), 1, 0, 0, 1, (float)x, (float)y);  }  // XXX do we have to append our viewboxToViewport  transformation?  // if we do we have to change nsSVGGraphicElement::GetScreenCTM()    *_retval = screenCTM;  NS_IF_ADDREF(*_retval);  return NS_OK;}