Bug 388295 - Clean up nsSVGPathGeometryFrame: make constructor protected, put methods belonging to the same interface together. r+sr=tor

This commit is contained in:
longsonr@gmail.com 2007-07-24 02:05:37 -07:00
parent 9ebfcd078b
commit ed3758057c
2 changed files with 48 additions and 52 deletions

View File

@ -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<nsSVGMarkerProperty *>
(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<nsSVGMarkerProperty *>
(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)
{

View File

@ -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,