From b393f00121d65aa2615530541dc440f35af386d2 Mon Sep 17 00:00:00 2001 From: "tor%cs.brown.edu" Date: Fri, 1 Jul 2005 06:11:07 +0000 Subject: [PATCH] Bug 296626 - handle SVG glyph frames being constructed in invalid context. r=dbaron, sr=roc, a=brendan. --- layout/base/nsCSSFrameConstructor.cpp | 9 +++++++-- layout/svg/base/src/nsSVGGlyphFrame.cpp | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 395c8e91f229..997319ab9ddf 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -5199,8 +5199,13 @@ nsCSSFrameConstructor::ConstructTextFrame(nsFrameConstructorState& aState, // XXX kipp: temporary newFrame->AddStateBits(NS_FRAME_REPLACED_ELEMENT); - InitAndRestoreFrame(aState, aContent, aParentFrame, aStyleContext, nsnull, - newFrame); + rv = InitAndRestoreFrame(aState, aContent, aParentFrame, aStyleContext, + nsnull, newFrame); + + if (NS_FAILED(rv)) { + newFrame->Destroy(aState.mPresContext); + return rv; + } // We never need to create a view for a text frame. diff --git a/layout/svg/base/src/nsSVGGlyphFrame.cpp b/layout/svg/base/src/nsSVGGlyphFrame.cpp index 12dffcb8fd33..3bf790b418fa 100644 --- a/layout/svg/base/src/nsSVGGlyphFrame.cpp +++ b/layout/svg/base/src/nsSVGGlyphFrame.cpp @@ -280,6 +280,7 @@ nsSVGGlyphFrame::Init(nsPresContext* aPresContext, nsISVGOuterSVGFrame* outerSVGFrame = GetOuterSVGFrame(); if (!outerSVGFrame) { NS_ERROR("No outerSVGFrame"); + SetStyleContext(aPresContext, aContext); return NS_ERROR_FAILURE; } nsCOMPtr renderer;