if (nsContentUtils::ContentIsDescendantOf(this, targetContent)) return NS_ERROR_FAILURE;
nsSVGUseElement::CreateAnonymousContent(nsPresContext*    aPresContext,                                        nsISupportsArray& aAnonymousItems){#ifdef DEBUG_tor  nsAutoString href;  mHref->GetBaseVal(href);  fprintf(stderr, "<svg:use> reclone of \"%s\"\n", ToNewCString(href));#endif  nsCOMPtr<nsIDOMSVGElement> element;  nsresult rv = LookupHref(getter_AddRefs(element));  if (!element)    return rv;  // make sure target is valid type for <use>  // QIable nsSVGGraphicsElement would eliminate enumerating all elements  nsCOMPtr<nsIContent> targetContent = do_QueryInterface(element);  nsIAtom *tag = targetContent->Tag();  if (tag != nsSVGAtoms::svg &&      tag != nsSVGAtoms::symbol &&      tag != nsSVGAtoms::g &&      tag != nsSVGAtoms::path &&      tag != nsSVGAtoms::text &&      tag != nsSVGAtoms::rect &&      tag != nsSVGAtoms::circle &&      tag != nsSVGAtoms::ellipse &&      tag != nsSVGAtoms::line &&      tag != nsSVGAtoms::polyline &&      tag != nsSVGAtoms::polygon &&      tag != nsSVGAtoms::image &&      tag != nsSVGAtoms::use)    return NS_ERROR_FAILURE;  nsCOMPtr<nsIDOMNode> newchild;  element->CloneNode(PR_TRUE, getter_AddRefs(newchild));  if (!newchild)    return NS_ERROR_FAILURE;    nsCOMPtr<nsIContent>             newcontent = do_QueryInterface(newchild);  nsCOMPtr<nsIDOMSVGSymbolElement> symbol     = do_QueryInterface(newchild);  nsCOMPtr<nsIDOMSVGSVGElement>    svg        = do_QueryInterface(newchild);  if (symbol) {    nsIDocument *document = GetCurrentDoc();    if (!document)      return NS_ERROR_FAILURE;    nsNodeInfoManager *nodeInfoManager = document->NodeInfoManager();    if (!nodeInfoManager)      return NS_ERROR_FAILURE;    nsCOMPtr<nsINodeInfo> nodeInfo;    nodeInfoManager->GetNodeInfo(nsSVGAtoms::svg, nsnull, kNameSpaceID_SVG,                                 getter_AddRefs(nodeInfo));    if (!nodeInfo)      return NS_ERROR_FAILURE;    nsCOMPtr<nsIContent> svgNode;    NS_NewSVGSVGElement(getter_AddRefs(svgNode), nodeInfo);    if (!svgNode)      return NS_ERROR_FAILURE;        if (newcontent->HasAttr(kNameSpaceID_None, nsSVGAtoms::viewBox)) {      nsAutoString viewbox;      newcontent->GetAttr(kNameSpaceID_None, nsSVGAtoms::viewBox, viewbox);      svgNode->SetAttr(kNameSpaceID_None, nsSVGAtoms::viewBox, viewbox, PR_FALSE);    }    // copy attributes    PRUint32 i;    for (i = 0; i < newcontent->GetAttrCount(); i++) {      PRInt32 nsID;      nsCOMPtr<nsIAtom> name;      nsCOMPtr<nsIAtom> prefix;      nsAutoString value;      newcontent->GetAttrNameAt(i, &nsID,                                getter_AddRefs(name),                                getter_AddRefs(prefix));      newcontent->GetAttr(nsID, name, value);      svgNode->SetAttr(nsID, name, prefix, value, PR_FALSE);    }    // move the children over    PRUint32 num = newcontent->GetChildCount();    for (i = 0; i < num; i++) {      nsCOMPtr<nsIContent> child = newcontent->GetChildAt(0);      newcontent->RemoveChildAt(0, PR_FALSE);      svgNode->InsertChildAt(child, i, PR_TRUE, PR_TRUE);    }    newcontent = svgNode;  }  if (symbol || svg) {    if (HasAttr(kNameSpaceID_None, nsSVGAtoms::width)) {      nsAutoString width;      GetAttr(kNameSpaceID_None, nsSVGAtoms::width, width);      newcontent->SetAttr(kNameSpaceID_None, nsSVGAtoms::width, width, PR_FALSE);    }    if (HasAttr(kNameSpaceID_None, nsSVGAtoms::height)) {      nsAutoString height;      GetAttr(kNameSpaceID_None, nsSVGAtoms::height, height);      newcontent->SetAttr(kNameSpaceID_None, nsSVGAtoms::height, height, PR_FALSE);    }  }  aAnonymousItems.AppendElement(newcontent);  return NS_OK;}