Bug 351570 - improve nsSVGPatternFrame encapsulation. r=tor, sr=bzbarsky

This commit is contained in:
longsonr%gmail.com 2006-09-08 13:54:05 +00:00
parent f25097377f
commit c56c77c39d
2 changed files with 18 additions and 13 deletions

View File

@ -68,6 +68,18 @@ static void printRect(char *msg, nsIDOMSVGRect *aRect);
//----------------------------------------------------------------------
// Implementation
nsSVGPatternFrame::nsSVGPatternFrame(nsStyleContext* aContext,
nsIDOMSVGURIReference *aRef) :
nsSVGPatternFrameBase(aContext),
mNextPattern(nsnull),
mLoopFlag(PR_FALSE)
{
if (aRef) {
// Get the hRef
aRef->GetHref(getter_AddRefs(mHref));
}
}
nsSVGPatternFrame::~nsSVGPatternFrame()
{
WillModify(mod_die);
@ -877,24 +889,14 @@ nsIFrame* NS_NewSVGPatternFrame(nsIPresShell* aPresShell,
if (!patternElement)
return nsnull;
nsSVGPatternFrame* it = new (aPresShell) nsSVGPatternFrame(aContext);
if (!it)
return nsnull;
nsCOMPtr<nsIDOMSVGURIReference> ref = do_QueryInterface(aContent);
NS_ASSERTION(ref,
"NS_NewSVGPatternFrame -- Content doesn't support nsIDOMSVGURIReference");
if (ref) {
// Get the hRef
ref->GetHref(getter_AddRefs(it->mHref));
}
it->mNextPattern = nsnull;
it->mLoopFlag = PR_FALSE;
#ifdef DEBUG_scooter
printf("NS_NewSVGPatternFrame\n");
#endif
return it;
return new (aPresShell) nsSVGPatternFrame(aContext, ref);
}
#ifdef DEBUG_scooter

View File

@ -113,6 +113,9 @@ public:
#endif // DEBUG
protected:
nsSVGPatternFrame(nsStyleContext* aContext,
nsIDOMSVGURIReference *aRef);
virtual ~nsSVGPatternFrame();
// Internal methods for handling referenced patterns
@ -147,8 +150,8 @@ protected:
private:
// this is a *temporary* reference to the frame of the element currently
// referencing our pattern. This must be termporary because different
// referencing frames will all reference this one fram
// referencing our pattern. This must be temporary because different
// referencing frames will all reference this one frame
nsSVGGeometryFrame *mSource;
nsCOMPtr<nsIDOMSVGMatrix> mCTM;