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
Родитель 43ee106c73
Коммит 28dcfe891e
2 изменённых файлов: 5 добавлений и 8 удалений

Просмотреть файл

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

Просмотреть файл

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