Bug 459758 - effects on outer svg frames only work accidentally. r+sr=roc

This commit is contained in:
Robert Longson 2008-10-20 09:42:03 +01:00
Родитель 65de892f3f
Коммит 3cfd9bd4ee
23 изменённых файлов: 53 добавлений и 42 удалений

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

@ -51,8 +51,8 @@ class nsIDOMSVGMatrix;
class nsSVGRenderState;
#define NS_ISVGCHILDFRAME_IID \
{ 0x91253119, 0x4fe4, 0x4628, \
{ 0xaf, 0x25, 0x4e, 0x4b, 0x43, 0x5f, 0x66, 0xf2 } }
{ 0xfc3ee9b2, 0xaf40, 0x416d, \
{ 0xa8, 0x51, 0xb4, 0x68, 0xa4, 0xe4, 0x8b, 0xcd } }
class nsISVGChildFrame : public nsISupports {
public:
@ -61,7 +61,8 @@ public:
// Paint this frame - aDirtyRect is the area being redrawn, in frame
// offset pixel coordinates
NS_IMETHOD PaintSVG(nsSVGRenderState* aContext, nsIntRect *aDirtyRect)=0;
NS_IMETHOD PaintSVG(nsSVGRenderState* aContext,
const nsIntRect *aDirtyRect)=0;
// Check if this frame or children contain the given point,
// specified in app units relative to the origin of the outer

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

@ -166,7 +166,7 @@ nsSVGDisplayContainerFrame::RemoveFrame(nsIAtom* aListName,
NS_IMETHODIMP
nsSVGDisplayContainerFrame::PaintSVG(nsSVGRenderState* aContext,
nsIntRect *aDirtyRect)
const nsIntRect *aDirtyRect)
{
const nsStyleDisplay *display = mStyleContext->GetStyleDisplay();
if (display->mOpacity == 0.0)
@ -174,7 +174,7 @@ nsSVGDisplayContainerFrame::PaintSVG(nsSVGRenderState* aContext,
for (nsIFrame* kid = mFrames.FirstChild(); kid;
kid = kid->GetNextSibling()) {
nsSVGUtils::PaintChildWithEffects(aContext, aDirtyRect, kid);
nsSVGUtils::PaintFrameWithEffects(aContext, aDirtyRect, kid);
}
return NS_OK;

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

@ -102,7 +102,8 @@ public:
nsIFrame* aPrevInFlow);
// nsISVGChildFrame interface:
NS_IMETHOD PaintSVG(nsSVGRenderState* aContext, nsIntRect *aDirtyRect);
NS_IMETHOD PaintSVG(nsSVGRenderState* aContext,
const nsIntRect *aDirtyRect);
NS_IMETHOD_(nsIFrame*) GetFrameForPoint(const nsPoint &aPoint);
NS_IMETHOD_(nsRect) GetCoveredRegion();
NS_IMETHOD UpdateCoveredRegion();

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

@ -229,7 +229,7 @@ GetTransformedRegion(float aX, float aY, float aWidth, float aHeight,
NS_IMETHODIMP
nsSVGForeignObjectFrame::PaintSVG(nsSVGRenderState *aContext,
nsIntRect *aDirtyRect)
const nsIntRect *aDirtyRect)
{
if (IsDisabled())
return NS_OK;

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

@ -120,7 +120,8 @@ public:
#endif
// nsISVGChildFrame interface:
NS_IMETHOD PaintSVG(nsSVGRenderState *aContext, nsIntRect *aDirtyRect);
NS_IMETHOD PaintSVG(nsSVGRenderState *aContext,
const nsIntRect *aDirtyRect);
NS_IMETHOD_(nsIFrame*) GetFrameForPoint(const nsPoint &aPoint);
NS_IMETHOD_(nsRect) GetCoveredRegion();
NS_IMETHOD UpdateCoveredRegion();

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

@ -298,7 +298,8 @@ nsSVGGlyphFrame::GetType() const
// nsISVGChildFrame methods
NS_IMETHODIMP
nsSVGGlyphFrame::PaintSVG(nsSVGRenderState *aContext, nsIntRect *aDirtyRect)
nsSVGGlyphFrame::PaintSVG(nsSVGRenderState *aContext,
const nsIntRect *aDirtyRect)
{
if (!GetStyleVisibility()->IsVisible())
return NS_OK;

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

@ -115,7 +115,8 @@ public:
// nsISVGChildFrame interface:
// These four always use the global transform, even if NS_STATE_NONDISPLAY_CHILD
NS_IMETHOD PaintSVG(nsSVGRenderState *aContext, nsIntRect *aDirtyRect);
NS_IMETHOD PaintSVG(nsSVGRenderState *aContext,
const nsIntRect *aDirtyRect);
NS_IMETHOD_(nsIFrame*) GetFrameForPoint(const nsPoint &aPoint);
NS_IMETHOD UpdateCoveredRegion();
NS_IMETHOD GetBBox(nsIDOMSVGRect **_retval);

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

@ -79,12 +79,6 @@ public:
}
#endif // DEBUG
// nsISVGChildFrame interface:
NS_IMETHOD PaintSVG(gfxContext* aContext)
{
return NS_OK; // override - our frames don't directly render
}
private:
// Parse our xlink:href and set up our nsSVGPaintingProperty if we

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

@ -85,7 +85,7 @@ protected:
public:
// nsISVGChildFrame interface:
NS_IMETHOD PaintSVG(nsSVGRenderState *aContext, nsIntRect *aDirtyRect);
NS_IMETHOD PaintSVG(nsSVGRenderState *aContext, const nsIntRect *aDirtyRect);
NS_IMETHOD_(nsIFrame*) GetFrameForPoint(const nsPoint &aPoint);
// nsSVGPathGeometryFrame methods:
@ -224,7 +224,8 @@ nsSVGImageFrame::GetImageTransform()
//----------------------------------------------------------------------
// nsISVGChildFrame methods:
NS_IMETHODIMP
nsSVGImageFrame::PaintSVG(nsSVGRenderState *aContext, nsIntRect *aDirtyRect)
nsSVGImageFrame::PaintSVG(nsSVGRenderState *aContext,
const nsIntRect *aDirtyRect)
{
nsresult rv = NS_OK;

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

@ -83,7 +83,7 @@ public:
#endif
// nsISVGChildFrame interface:
NS_IMETHOD PaintSVG(nsSVGRenderState *aContext, nsIntRect *aDirtyRect);
NS_IMETHOD PaintSVG(nsSVGRenderState *aContext, const nsIntRect *aDirtyRect);
virtual void NotifySVGChanged(PRUint32 aFlags);
NS_IMETHOD_(nsIFrame*) GetFrameForPoint(const nsPoint &aPoint);
@ -147,7 +147,8 @@ nsSVGInnerSVGFrame::GetType() const
// nsISVGChildFrame methods
NS_IMETHODIMP
nsSVGInnerSVGFrame::PaintSVG(nsSVGRenderState *aContext, nsIntRect *aDirtyRect)
nsSVGInnerSVGFrame::PaintSVG(nsSVGRenderState *aContext,
const nsIntRect *aDirtyRect)
{
gfxContextAutoSaveRestore autoSR;

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

@ -54,7 +54,8 @@ PRBool
nsSVGIntegrationUtils::UsingEffectsForFrame(const nsIFrame* aFrame)
{
const nsStyleSVGReset *style = aFrame->GetStyleSVGReset();
return style->mFilter || style->mClipPath || style->mMask;
return (style->mFilter || style->mClipPath || style->mMask) &&
!aFrame->IsFrameOfType(nsIFrame::eSVG);
}
// Get the union the frame border-box rects over all continuations,

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

@ -53,6 +53,9 @@ class nsIDOMSVGMatrix;
class nsSVGIntegrationUtils
{
public:
/**
* Returns true if a non-SVG frame has SVG effects.
*/
static PRBool
UsingEffectsForFrame(const nsIFrame* aFrame);

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

@ -204,7 +204,7 @@ nsSVGMarkerFrame::PaintMark(nsSVGRenderState *aContext,
// The CTM of each frame referencing us may be different.
SVGFrame->NotifySVGChanged(nsISVGChildFrame::SUPPRESS_INVALIDATION |
nsISVGChildFrame::TRANSFORM_CHANGED);
nsSVGUtils::PaintChildWithEffects(aContext, nsnull, kid);
nsSVGUtils::PaintFrameWithEffects(aContext, nsnull, kid);
}
}

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

@ -103,7 +103,7 @@ nsSVGMaskFrame::ComputeMaskAlpha(nsSVGRenderState *aContext,
for (nsIFrame* kid = mFrames.FirstChild(); kid;
kid = kid->GetNextSibling()) {
nsSVGUtils::PaintChildWithEffects(aContext, nsnull, kid);
nsSVGUtils::PaintFrameWithEffects(aContext, nsnull, kid);
}
gfxRect clipExtents = gfx->GetClipExtents();

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

@ -448,7 +448,7 @@ public:
virtual nsIFrame* HitTest(nsDisplayListBuilder* aBuilder, nsPoint aPt,
HitTestState* aState);
virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx,
const nsRect& aDirtyRect);
const nsRect& aDirtyRect);
NS_DISPLAY_DECL_NAME("SVGEventReceiver")
};
@ -462,7 +462,7 @@ nsDisplaySVG::HitTest(nsDisplayListBuilder* aBuilder, nsPoint aPt,
void
nsDisplaySVG::Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx,
const nsRect& aDirtyRect)
const nsRect& aDirtyRect)
{
static_cast<nsSVGOuterSVGFrame*>(mFrame)->
Paint(*aCtx, aDirtyRect, aBuilder->ToReferenceFrame(mFrame));
@ -572,11 +572,7 @@ nsSVGOuterSVGFrame::Paint(nsIRenderingContext& aRenderingContext,
}
#endif
// paint children:
for (nsIFrame* kid = mFrames.FirstChild(); kid;
kid = kid->GetNextSibling()) {
nsSVGUtils::PaintChildWithEffects(&ctx, &dirtyRect, kid);
}
nsSVGUtils::PaintFrameWithEffects(&ctx, &dirtyRect, this);
#ifdef XP_MACOSX
if (mEnableBitmapFallback) {
@ -758,6 +754,12 @@ nsSVGOuterSVGFrame::NotifyViewportChange()
already_AddRefed<nsIDOMSVGMatrix>
nsSVGOuterSVGFrame::GetCanvasTM()
{
if (!GetMatrixPropagation()) {
nsIDOMSVGMatrix *retval;
NS_NewSVGMatrix(&retval);
return retval;
}
if (!mCanvasTM) {
nsSVGSVGElement *svgElement = static_cast<nsSVGSVGElement*>(mContent);

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

@ -114,7 +114,7 @@ nsSVGPathGeometryFrame::GetType() const
NS_IMETHODIMP
nsSVGPathGeometryFrame::PaintSVG(nsSVGRenderState *aContext,
nsIntRect *aDirtyRect)
const nsIntRect *aDirtyRect)
{
if (!GetStyleVisibility()->IsVisible())
return NS_OK;

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

@ -101,7 +101,8 @@ public:
protected:
// nsISVGChildFrame interface:
NS_IMETHOD PaintSVG(nsSVGRenderState *aContext, nsIntRect *aDirtyRect);
NS_IMETHOD PaintSVG(nsSVGRenderState *aContext,
const nsIntRect *aDirtyRect);
NS_IMETHOD_(nsIFrame*) GetFrameForPoint(const nsPoint &aPoint);
NS_IMETHOD_(nsRect) GetCoveredRegion();
NS_IMETHOD UpdateCoveredRegion();

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

@ -293,7 +293,7 @@ nsSVGPatternFrame::PaintPattern(gfxASurface** surface,
mPaintLoopFlag = PR_TRUE;
for (nsIFrame* kid = firstKid; kid;
kid = kid->GetNextSibling()) {
nsSVGUtils::PaintChildWithEffects(&tmpState, nsnull, kid);
nsSVGUtils::PaintFrameWithEffects(&tmpState, nsnull, kid);
}
mPaintLoopFlag = PR_FALSE;
}

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

@ -66,7 +66,7 @@ public:
#endif
// nsISVGChildFrame interface:
NS_IMETHOD PaintSVG(nsSVGRenderState* aContext, nsIntRect *aDirtyRect);
NS_IMETHOD PaintSVG(nsSVGRenderState* aContext, const nsIntRect *aDirtyRect);
NS_IMETHODIMP_(nsIFrame*) GetFrameForPoint(const nsPoint &aPoint);
NS_IMETHODIMP_(nsRect) GetCoveredRegion();
NS_IMETHOD UpdateCoveredRegion();
@ -100,7 +100,8 @@ nsSVGSwitchFrame::GetType() const
}
NS_IMETHODIMP
nsSVGSwitchFrame::PaintSVG(nsSVGRenderState* aContext, nsIntRect *aDirtyRect)
nsSVGSwitchFrame::PaintSVG(nsSVGRenderState* aContext,
const nsIntRect *aDirtyRect)
{
const nsStyleDisplay *display = mStyleContext->GetStyleDisplay();
if (display->mOpacity == 0.0)
@ -108,7 +109,7 @@ nsSVGSwitchFrame::PaintSVG(nsSVGRenderState* aContext, nsIntRect *aDirtyRect)
nsIFrame *kid = GetActiveChildFrame();
if (kid) {
nsSVGUtils::PaintChildWithEffects(aContext, aDirtyRect, kid);
nsSVGUtils::PaintFrameWithEffects(aContext, aDirtyRect, kid);
}
return NS_OK;
}

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

@ -213,7 +213,8 @@ nsSVGTextFrame::NotifyRedrawUnsuspended()
}
NS_IMETHODIMP
nsSVGTextFrame::PaintSVG(nsSVGRenderState* aContext, nsIntRect *aDirtyRect)
nsSVGTextFrame::PaintSVG(nsSVGRenderState* aContext,
const nsIntRect *aDirtyRect)
{
UpdateGlyphPositioning(PR_TRUE);

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

@ -79,7 +79,8 @@ public:
NS_IMETHOD NotifyRedrawUnsuspended();
// Override these four to ensure that UpdateGlyphPositioning is called
// to bring glyph positions up to date
NS_IMETHOD PaintSVG(nsSVGRenderState* aContext, nsIntRect *aDirtyRect);
NS_IMETHOD PaintSVG(nsSVGRenderState* aContext,
const nsIntRect *aDirtyRect);
NS_IMETHOD_(nsIFrame*) GetFrameForPoint(const nsPoint & aPoint);
NS_IMETHOD UpdateCoveredRegion();
NS_IMETHOD InitialUpdate();

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

@ -962,8 +962,8 @@ public:
};
void
nsSVGUtils::PaintChildWithEffects(nsSVGRenderState *aContext,
nsIntRect *aDirtyRect,
nsSVGUtils::PaintFrameWithEffects(nsSVGRenderState *aContext,
const nsIntRect *aDirtyRect,
nsIFrame *aFrame)
{
nsISVGChildFrame *svgChildFrame;

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

@ -333,8 +333,8 @@ public:
/* Paint SVG frame with SVG effects - aDirtyRect is the area being
* redrawn, in device pixel coordinates relative to the outer svg */
static void
PaintChildWithEffects(nsSVGRenderState *aContext,
nsIntRect *aDirtyRect,
PaintFrameWithEffects(nsSVGRenderState *aContext,
const nsIntRect *aDirtyRect,
nsIFrame *aFrame);
/* Hit testing - check if point hits the clipPath of indicated