Bug 1450705: Don't go through the binding manager to see if our parent is an SVG element. r?bz
We don't extend svg elements, except in a lone test, that isn't really impacted
by this.
I agree this should look at the frame btw, though that looks a bit out of scope
for this bug.
MozReview-Commit-ID: MbvIE5TszB
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -5286,31 +5286,28 @@ nsCSSFrameConstructor::FindSVGData(Eleme
static const FrameConstructionData sSuppressData = SUPPRESS_FCDATA();
static const FrameConstructionData sContainerData =
SIMPLE_SVG_FCDATA(NS_NewSVGContainerFrame);
bool parentIsSVG = aIsWithinSVGText;
nsIContent* parentContent =
aParentFrame ? aParentFrame->GetContent() : nullptr;
- // XXXbz should this really be based on the XBL-resolved tag of the parent
- // frame's content? Should it not be based on the type of the parent frame
- // (e.g. whether it's an SVG frame)?
+
+ // XXXbz should this really be based on the tag of the parent frame's content?
+ // Should it not be based on the type of the parent frame (e.g. whether it's
+ // an SVG frame)?
if (parentContent) {
- int32_t parentNSID;
- nsAtom* parentTag =
- parentContent->OwnerDoc()->BindingManager()->
- ResolveTag(parentContent, &parentNSID);
-
// It's not clear whether the SVG spec intends to allow any SVG
// content within svg:foreignObject at all (SVG 1.1, section
// 23.2), but if it does, it better be svg:svg. So given that
// we're allowing it, treat it as a non-SVG parent.
- parentIsSVG = parentNSID == kNameSpaceID_SVG &&
- parentTag != nsGkAtoms::foreignObject;
+ parentIsSVG =
+ parentContent->IsSVGElement() &&
+ parentContent->NodeInfo()->NameAtom() != nsGkAtoms::foreignObject;
}
if ((aTag != nsGkAtoms::svg && !parentIsSVG) ||
(aTag == nsGkAtoms::desc || aTag == nsGkAtoms::title ||
aTag == nsGkAtoms::metadata)) {
// Sections 5.1 and G.4 of SVG 1.1 say that SVG elements other than
// svg:svg not contained within svg:svg are incorrect, although they
// don't seem to specify error handling. Ignore them, since many of