Bug 265894 - Part 7. Do not convert symbol element into svg element.
Since we already have nsSVGSymbolFrame, there is no need to leverage svg element
for rendering symbol element in use-element shadow tree, remove conversion code.
MozReview-Commit-ID: GmGLZ7Az6Gb
--- a/dom/svg/SVGUseElement.cpp
+++ b/dom/svg/SVGUseElement.cpp
@@ -270,61 +270,16 @@ SVGUseElement::CreateAnonymousContent()
nsNodeUtils::Clone(targetContent, true, nodeInfoManager, unused,
getter_AddRefs(newnode));
nsCOMPtr<nsIContent> newcontent = do_QueryInterface(newnode);
if (!newcontent)
return nullptr;
- if (newcontent->IsSVGElement(nsGkAtoms::symbol)) {
- nsIDocument *document = GetComposedDoc();
- if (!document)
- return nullptr;
-
- nsNodeInfoManager *nodeInfoManager = document->NodeInfoManager();
- if (!nodeInfoManager)
- return nullptr;
-
- RefPtr<mozilla::dom::NodeInfo> nodeInfo;
- nodeInfo = nodeInfoManager->GetNodeInfo(nsGkAtoms::svg, nullptr,
- kNameSpaceID_SVG,
- nsIDOMNode::ELEMENT_NODE);
-
- nsCOMPtr<nsIContent> svgNode;
- NS_NewSVGSVGElement(getter_AddRefs(svgNode), nodeInfo.forget(),
- NOT_FROM_PARSER);
-
- if (!svgNode)
- return nullptr;
-
- // copy attributes
- BorrowedAttrInfo info;
- uint32_t i;
- for (i = 0; (info = newcontent->GetAttrInfoAt(i)); i++) {
- nsAutoString value;
- int32_t nsID = info.mName->NamespaceID();
- nsIAtom* lname = info.mName->LocalName();
-
- info.mValue->ToString(value);
-
- svgNode->SetAttr(nsID, lname, info.mName->GetPrefix(), value, false);
- }
-
- // move the children over
- uint32_t num = newcontent->GetChildCount();
- for (i = 0; i < num; i++) {
- nsCOMPtr<nsIContent> child = newcontent->GetFirstChild();
- newcontent->RemoveChildAt(0, false);
- svgNode->InsertChildAt(child, i, true);
- }
-
- newcontent = svgNode;
- }
-
if (newcontent->IsAnyOfSVGElements(nsGkAtoms::svg, nsGkAtoms::symbol)) {
nsSVGElement *newElement = static_cast<nsSVGElement*>(newcontent.get());
if (mLengthAttributes[ATTR_WIDTH].IsExplicitlySet())
newElement->SetLength(nsGkAtoms::width, mLengthAttributes[ATTR_WIDTH]);
if (mLengthAttributes[ATTR_HEIGHT].IsExplicitlySet())
newElement->SetLength(nsGkAtoms::height, mLengthAttributes[ATTR_HEIGHT]);
}
--- a/layout/svg/nsSVGContainerFrame.cpp
+++ b/layout/svg/nsSVGContainerFrame.cpp
@@ -370,17 +370,17 @@ nsSVGDisplayContainerFrame::ReflowSVG()
// <svg> can create an SVG viewport with an offset due to its
// x/y/width/height attributes, and <use> can introduce an offset with an
// empty mRect (any width/height is copied to an anonymous <svg> child).
// Other than that containers should not set mRect since all other offsets
// come from transforms, which are accounted for by nsDisplayTransform.
// Note that we rely on |overflow:visible| to allow display list items to be
// created for our children.
- MOZ_ASSERT(mContent->IsSVGElement(nsGkAtoms::svg) ||
+ MOZ_ASSERT(mContent->IsAnyOfSVGElements(nsGkAtoms::svg, nsGkAtoms::symbol) ||
(mContent->IsSVGElement(nsGkAtoms::use) &&
mRect.Size() == nsSize(0,0)) ||
mRect.IsEqualEdges(nsRect()),
"Only inner-<svg>/<use> is expected to have mRect set");
if (isFirstReflow) {
// Make sure we have our filter property (if any) before calling
// FinishAndStoreOverflow (subsequent filter changes are handled off