nsCOMPtr<nsIDOMSVGForeignObjectElement> foreignObject = do_QueryInterface(mContent); NS_ASSERTION(foreignObject, "wrong content element");  { nsCOMPtr<nsIDOMSVGAnimatedLength> length; foreignObject->GetX(getter_AddRefs(length)); length->GetAnimVal(getter_AddRefs(mX)); NS_ASSERTION(mX, "no x"); if (!mX) return NS_ERROR_FAILURE; nsCOMPtr<nsISVGValue> value = do_QueryInterface(mX); if (value) value->AddObserver(this); }
nsresult rv; rv = nsSVGForeignObjectFrameBase::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
nsresult nsSVGForeignObjectFrame::Init(){  nsCOMPtr<nsIDOMSVGForeignObjectElement> foreignObject = do_QueryInterface(mContent);  NS_ASSERTION(foreignObject, "wrong content element");    {    nsCOMPtr<nsIDOMSVGAnimatedLength> length;    foreignObject->GetX(getter_AddRefs(length));    length->GetAnimVal(getter_AddRefs(mX));    NS_ASSERTION(mX, "no x");    if (!mX) return NS_ERROR_FAILURE;    nsCOMPtr<nsISVGValue> value = do_QueryInterface(mX);    if (value)      value->AddObserver(this);  }  {    nsCOMPtr<nsIDOMSVGAnimatedLength> length;    foreignObject->GetY(getter_AddRefs(length));    length->GetAnimVal(getter_AddRefs(mY));    NS_ASSERTION(mY, "no y");    if (!mY) return NS_ERROR_FAILURE;    nsCOMPtr<nsISVGValue> value = do_QueryInterface(mY);    if (value)      value->AddObserver(this);  }  {    nsCOMPtr<nsIDOMSVGAnimatedLength> length;    foreignObject->GetWidth(getter_AddRefs(length));    length->GetAnimVal(getter_AddRefs(mWidth));    NS_ASSERTION(mWidth, "no width");    if (!mWidth) return NS_ERROR_FAILURE;    nsCOMPtr<nsISVGValue> value = do_QueryInterface(mWidth);    if (value)      value->AddObserver(this);  }  {    nsCOMPtr<nsIDOMSVGAnimatedLength> length;    foreignObject->GetHeight(getter_AddRefs(length));    length->GetAnimVal(getter_AddRefs(mHeight));    NS_ASSERTION(mHeight, "no height");    if (!mHeight) return NS_ERROR_FAILURE;    nsCOMPtr<nsISVGValue> value = do_QueryInterface(mHeight);    if (value)      value->AddObserver(this);  }  // XXX //   nsCOMPtr<nsIDOMSVGTransformable> transformable = do_QueryInterface(mContent);//   NS_ASSERTION(transformable, "wrong content element");//   nsCOMPtr<nsIDOMSVGAnimatedTransformList> transforms;//   transformable->GetTransform(getter_AddRefs(transforms));//   nsCOMPtr<nsISVGValue> value = do_QueryInterface(transforms);//   NS_ASSERTION(value, "interface not found");//   if (value)//     value->AddObserver(this);  // XXX for some reason updating fails when done here. Why is this too early?  // anyway - we use a less desirable mechanism now of updating in paint().//  Update();     return NS_OK;}