From fbf4d262ab3989bc81cbbad129fe19bfd83dddcd Mon Sep 17 00:00:00 2001 From: "longsonr%gmail.com" Date: Tue, 24 Jul 2007 09:05:37 +0000 Subject: [PATCH] Bug 388295 - Clean up nsSVGPathGeometryFrame: make constructor protected, put methods belonging to the same interface together. r+sr=tor git-svn-id: svn://10.0.0.236/trunk@230740 18797224-902f-48f8-a5cc-f745e15eee43 --- .../svg/base/src/nsSVGPathGeometryFrame.cpp | 86 ++++++++----------- .../svg/base/src/nsSVGPathGeometryFrame.h | 14 ++- 2 files changed, 48 insertions(+), 52 deletions(-) diff --git a/mozilla/layout/svg/base/src/nsSVGPathGeometryFrame.cpp b/mozilla/layout/svg/base/src/nsSVGPathGeometryFrame.cpp index 9cd2949131b..74d41d5114b 100644 --- a/mozilla/layout/svg/base/src/nsSVGPathGeometryFrame.cpp +++ b/mozilla/layout/svg/base/src/nsSVGPathGeometryFrame.cpp @@ -222,18 +222,6 @@ NS_NewSVGPathGeometryFrame(nsIPresShell* aPresShell, return new (aPresShell) nsSVGPathGeometryFrame(aContext); } -//////////////////////////////////////////////////////////////////////// -// nsSVGPathGeometryFrame - -nsSVGPathGeometryFrame::nsSVGPathGeometryFrame(nsStyleContext* aContext) - : nsSVGPathGeometryFrameBase(aContext), - mPropagateTransform(PR_TRUE) -{ -#ifdef DEBUG -// printf("nsSVGPathGeometryFrame %p CTOR\n", this); -#endif -} - //---------------------------------------------------------------------- // nsISupports methods @@ -289,43 +277,6 @@ nsSVGPathGeometryFrame::GetType() const return nsGkAtoms::svgPathGeometryFrame; } -nsSVGMarkerProperty * -nsSVGPathGeometryFrame::GetMarkerProperty() -{ - if (GetStateBits() & NS_STATE_SVG_HAS_MARKERS) - return static_cast - (GetProperty(nsGkAtoms::marker)); - - return nsnull; -} - -void -nsSVGPathGeometryFrame::UpdateMarkerProperty() -{ - if (GetStateBits() & NS_STATE_SVG_HAS_MARKERS) - return; - - const nsStyleSVG *style = GetStyleSVG(); - - if ((style->mMarkerStart || style->mMarkerMid || style->mMarkerEnd) && - !new nsSVGMarkerProperty(style->mMarkerStart, - style->mMarkerMid, - style->mMarkerEnd, - this)) { - NS_ERROR("Could not create marker property"); - return; - } -} - -void -nsSVGPathGeometryFrame::RemovePathProperties() -{ - nsSVGUtils::StyleEffects(this); - - if (GetStateBits() & NS_STATE_SVG_HAS_MARKERS) - DeleteProperty(nsGkAtoms::marker); -} - //---------------------------------------------------------------------- // nsISVGChildFrame methods @@ -602,6 +553,43 @@ nsSVGPathGeometryFrame::GetCanvasTM(nsIDOMSVGMatrix * *aCTM) //---------------------------------------------------------------------- // nsSVGPathGeometryFrame methods: +nsSVGMarkerProperty * +nsSVGPathGeometryFrame::GetMarkerProperty() +{ + if (GetStateBits() & NS_STATE_SVG_HAS_MARKERS) + return static_cast + (GetProperty(nsGkAtoms::marker)); + + return nsnull; +} + +void +nsSVGPathGeometryFrame::UpdateMarkerProperty() +{ + if (GetStateBits() & NS_STATE_SVG_HAS_MARKERS) + return; + + const nsStyleSVG *style = GetStyleSVG(); + + if ((style->mMarkerStart || style->mMarkerMid || style->mMarkerEnd) && + !new nsSVGMarkerProperty(style->mMarkerStart, + style->mMarkerMid, + style->mMarkerEnd, + this)) { + NS_ERROR("Could not create marker property"); + return; + } +} + +void +nsSVGPathGeometryFrame::RemovePathProperties() +{ + nsSVGUtils::StyleEffects(this); + + if (GetStateBits() & NS_STATE_SVG_HAS_MARKERS) + DeleteProperty(nsGkAtoms::marker); +} + void nsSVGPathGeometryFrame::Render(nsSVGRenderState *aContext) { diff --git a/mozilla/layout/svg/base/src/nsSVGPathGeometryFrame.h b/mozilla/layout/svg/base/src/nsSVGPathGeometryFrame.h index 4e61d1044d1..146d4c50db1 100644 --- a/mozilla/layout/svg/base/src/nsSVGPathGeometryFrame.h +++ b/mozilla/layout/svg/base/src/nsSVGPathGeometryFrame.h @@ -59,14 +59,22 @@ typedef nsSVGGeometryFrame nsSVGPathGeometryFrameBase; class nsSVGPathGeometryFrame : public nsSVGPathGeometryFrameBase, public nsISVGChildFrame { -public: - nsSVGPathGeometryFrame(nsStyleContext* aContext); + friend nsIFrame* + NS_NewSVGPathGeometryFrame(nsIPresShell* aPresShell, nsIContent* aContent, + nsStyleContext* aContext); +protected: + nsSVGPathGeometryFrame(nsStyleContext* aContext) : + nsSVGPathGeometryFrameBase(aContext), + mPropagateTransform(PR_TRUE) {} - // nsISupports interface: +public: + // nsISupports interface: NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); +private: NS_IMETHOD_(nsrefcnt) AddRef() { return 1; } NS_IMETHOD_(nsrefcnt) Release() { return 1; } +public: // nsIFrame interface: virtual void Destroy(); NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID,