Bug 351297 - textPath elements must have text element parents r=tor,sr=roc

This commit is contained in:
longsonr%gmail.com 2006-09-08 12:27:27 +00:00
parent 43ee106c73
commit 28dcfe891e
2 changed files with 5 additions and 8 deletions

View File

@ -7774,9 +7774,8 @@ nsCSSFrameConstructor::ConstructSVGFrame(nsFrameConstructorState& aState,
newFrame = NS_NewSVGClipPathFrame(mPresShell, aContent, aStyleContext);
}
else if (aTag == nsSVGAtoms::textPath) {
nsISVGTextContentMetrics* metrics;
CallQueryInterface(aParentFrame, &metrics);
if (metrics) {
if (aParentFrame &&
aParentFrame->GetType() == nsLayoutAtoms::svgTextFrame) {
newFrame = NS_NewSVGTextPathFrame(mPresShell, aContent, aParentFrame, aStyleContext);
}
}

View File

@ -60,15 +60,13 @@ NS_NewSVGTextPathFrame(nsIPresShell* aPresShell, nsIContent* aContent,
nsIFrame* parentFrame, nsStyleContext* aContext)
{
NS_ASSERTION(parentFrame, "null parent");
nsISVGTextContentMetrics *metrics;
CallQueryInterface(parentFrame, &metrics);
if (!metrics) {
if (parentFrame->GetType() != nsLayoutAtoms::svgTextFrame) {
NS_ERROR("trying to construct an SVGTextPathFrame for an invalid container");
return nsnull;
}
nsCOMPtr<nsIDOMSVGTextPathElement> tspan_elem = do_QueryInterface(aContent);
if (!tspan_elem) {
nsCOMPtr<nsIDOMSVGTextPathElement> tpath_elem = do_QueryInterface(aContent);
if (!tpath_elem) {
NS_ERROR("Trying to construct an SVGTextPathFrame for a "
"content element that doesn't support the right interfaces");
return nsnull;