Bug 388411 - Rationalise SVG frame construction. r+sr=tor,a=dsicore for m8

This commit is contained in:
longsonr@gmail.com 2007-09-07 02:30:51 -07:00
Родитель 6efb45d2ee
Коммит 5f113f9d73
11 изменённых файлов: 45 добавлений и 31 удалений

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

@ -50,11 +50,9 @@
nsIFrame*
NS_NewSVGClipPathFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsStyleContext* aContext)
{
nsCOMPtr<nsIDOMSVGTransformable> transformable = do_QueryInterface(aContent);
if (!transformable) {
#ifdef DEBUG
printf("warning: trying to construct an SVGClipPathFrame for a content element that doesn't support the right interfaces\n");
#endif
nsCOMPtr<nsIDOMSVGClipPathElement> clipPath = do_QueryInterface(aContent);
if (!clipPath) {
NS_ERROR("Can't create frame! Content is not an SVG clipPath!");
return nsnull;
}

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

@ -45,13 +45,13 @@ class nsSVGClipPathFrame : public nsSVGClipPathFrameBase
{
friend nsIFrame*
NS_NewSVGClipPathFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsStyleContext* aContext);
protected:
nsSVGClipPathFrame(nsStyleContext* aContext) :
nsSVGClipPathFrameBase(aContext),
mClipParentMatrix(nsnull),
mInUse(PR_FALSE) {}
public:
public:
// nsSVGClipPathFrame methods:
nsresult ClipPaint(nsSVGRenderState* aContext,
nsISVGChildFrame* aParent,

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

@ -49,17 +49,13 @@ class nsSVGContainerFrame : public nsSVGContainerFrameBase
friend nsIFrame* NS_NewSVGContainerFrame(nsIPresShell* aPresShell,
nsIContent* aContent,
nsStyleContext* aContext);
protected:
virtual PRBool IsFrameOfType(PRUint32 aFlags) const
{
return nsSVGContainerFrameBase::IsFrameOfType(aFlags & ~(nsIFrame::eSVG));
}
public:
nsSVGContainerFrame(nsStyleContext* aContext) :
nsSVGContainerFrameBase(aContext) {}
public:
virtual already_AddRefed<nsIDOMSVGMatrix> GetCanvasTM() { return nsnull; }
// nsIFrame:
NS_IMETHOD AppendFrames(nsIAtom* aListName,
nsIFrame* aFrameList);
@ -72,17 +68,21 @@ public:
nsIFrame* aParent,
nsIFrame* aPrevInFlow);
virtual already_AddRefed<nsIDOMSVGMatrix> GetCanvasTM() { return nsnull; }
virtual PRBool IsFrameOfType(PRUint32 aFlags) const
{
return nsSVGContainerFrameBase::IsFrameOfType(aFlags & ~(nsIFrame::eSVG));
}
};
class nsSVGDisplayContainerFrame : public nsSVGContainerFrame,
public nsISVGChildFrame
{
public:
protected:
nsSVGDisplayContainerFrame(nsStyleContext* aContext) :
nsSVGContainerFrame(aContext) {}
// nsISupports interface:
public:
// nsISupports interface:
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
private:
NS_IMETHOD_(nsrefcnt) AddRef() { return 1; }

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

@ -53,6 +53,12 @@
nsIFrame*
NS_NewSVGFilterFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsStyleContext* aContext)
{
nsCOMPtr<nsIDOMSVGFilterElement> filter = do_QueryInterface(aContent);
if (!filter) {
NS_ERROR("Can't create frame! Content is not an SVG filter");
return nsnull;
}
return new (aPresShell) nsSVGFilterFrame(aContext);
}

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

@ -46,10 +46,10 @@ class nsSVGFilterFrame : public nsSVGFilterFrameBase
{
friend nsIFrame*
NS_NewSVGFilterFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsStyleContext* aContext);
public:
protected:
nsSVGFilterFrame(nsStyleContext* aContext) : nsSVGFilterFrameBase(aContext) {}
public:
nsresult FilterPaint(nsSVGRenderState *aContext,
nsISVGChildFrame *aTarget);
nsRect GetInvalidationRegion(nsIFrame *aTarget);

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

@ -164,9 +164,6 @@ nsSVGImageFrame::Init(nsIContent* aContent,
nsresult rv = nsSVGPathGeometryFrame::Init(aContent, aParent, aPrevInFlow);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIDOMSVGImageElement> Rect = do_QueryInterface(mContent);
NS_ASSERTION(Rect,"wrong content element");
mListener = new nsSVGImageListener(this);
if (!mListener) return NS_ERROR_OUT_OF_MEMORY;
nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(mContent);

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

@ -47,6 +47,12 @@
nsIFrame*
NS_NewSVGMarkerFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsStyleContext* aContext)
{
nsCOMPtr<nsIDOMSVGMarkerElement> marker = do_QueryInterface(aContent);
if (!marker) {
NS_ASSERTION(marker, "Can't create frame! Content is not an SVG marker");
return nsnull;
}
return new (aPresShell) nsSVGMarkerFrame(aContext);
}

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

@ -49,17 +49,16 @@ typedef nsSVGContainerFrame nsSVGMarkerFrameBase;
class nsSVGMarkerFrame : public nsSVGMarkerFrameBase
{
protected:
friend nsIFrame*
NS_NewSVGMarkerFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsStyleContext* aContext);
public:
protected:
nsSVGMarkerFrame(nsStyleContext* aContext) :
nsSVGMarkerFrameBase(aContext),
mMarkedFrame(nsnull),
mInUse(PR_FALSE),
mInUse2(PR_FALSE) {}
public:
/**
* Get the "type" of the frame
*

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

@ -49,6 +49,13 @@
nsIFrame*
NS_NewSVGMaskFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsStyleContext* aContext)
{
nsCOMPtr<nsIDOMSVGMaskElement> mask = do_QueryInterface(aContent);
if (!mask) {
NS_ERROR("Can't create frame! Content is not an SVG mask");
return nsnull;
}
return new (aPresShell) nsSVGMaskFrame(aContext);
}
@ -146,7 +153,7 @@ nsSVGMaskFrame::ComputeMaskAlpha(nsSVGRenderState *aContext,
nsSVGUtils::SetClipRect(gfx, aMatrix, x, y, width, height);
}
mMaskParent = aParent,
mMaskParent = aParent;
mMaskParentMatrix = aMatrix;
for (nsIFrame* kid = mFrames.FirstChild(); kid;

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

@ -48,13 +48,13 @@ class nsSVGMaskFrame : public nsSVGMaskFrameBase
{
friend nsIFrame*
NS_NewSVGMaskFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsStyleContext* aContext);
protected:
nsSVGMaskFrame(nsStyleContext* aContext) :
nsSVGMaskFrameBase(aContext),
mMaskParentMatrix(nsnull),
mInUse(PR_FALSE) {}
public:
public:
// nsSVGMaskFrame method:
already_AddRefed<gfxPattern> ComputeMaskAlpha(nsSVGRenderState *aContext,
nsISVGChildFrame* aParent,
@ -75,7 +75,7 @@ class nsSVGMaskFrame : public nsSVGMaskFrameBase
}
#endif
private:
private:
// A helper class to allow us to paint masks safely. The helper
// automatically sets and clears the mInUse flag on the mask frame
// (to prevent nasty reference loops). It's easy to mess this up

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

@ -48,10 +48,11 @@ typedef nsSVGContainerFrame nsSVGPaintServerFrameBase;
class nsSVGPaintServerFrame : public nsSVGPaintServerFrameBase,
public nsSVGValue
{
public:
protected:
nsSVGPaintServerFrame(nsStyleContext* aContext) :
nsSVGPaintServerFrameBase(aContext) {}
nsSVGPaintServerFrameBase(aContext) {}
public:
/*
* Configure paint server prior to rendering
* @return PR_FALSE to skip rendering