From 9fb05c695509c73295a27703be95f05b9f3c2cb1 Mon Sep 17 00:00:00 2001 From: "longsonr%gmail.com" Date: Thu, 16 Nov 2006 10:22:51 +0000 Subject: [PATCH] Bug 354295 - change fill='url(#invalidurl)' behaviour to match Opera/Safari --- layout/svg/base/src/nsSVGGeometryFrame.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/layout/svg/base/src/nsSVGGeometryFrame.cpp b/layout/svg/base/src/nsSVGGeometryFrame.cpp index f43f00bf8b74..eed8436b7144 100644 --- a/layout/svg/base/src/nsSVGGeometryFrame.cpp +++ b/layout/svg/base/src/nsSVGGeometryFrame.cpp @@ -50,6 +50,8 @@ NS_INTERFACE_MAP_END_INHERITING(nsSVGGeometryFrameBase) //---------------------------------------------------------------------- +static const nscolor sInvalidPaintColour = NS_RGB(0, 0, 0); + nsSVGGeometryFrame::nsSVGGeometryFrame(nsStyleContext* aContext) : nsSVGGeometryFrameBase(aContext) { @@ -277,8 +279,7 @@ nsSVGGeometryFrame::HasStroke() return PR_FALSE; if (GetStyleSVG()->mStroke.mType == eStyleSVGPaintType_Color || - (GetStyleSVG()->mStroke.mType == eStyleSVGPaintType_Server && - (GetStateBits() & NS_STATE_SVG_STROKE_PSERVER))) + GetStyleSVG()->mStroke.mType == eStyleSVGPaintType_Server) return PR_TRUE; return PR_FALSE; @@ -296,8 +297,7 @@ nsSVGGeometryFrame::HasFill() } if (GetStyleSVG()->mFill.mType == eStyleSVGPaintType_Color || - (GetStyleSVG()->mFill.mType == eStyleSVGPaintType_Server && - (GetStateBits() & NS_STATE_SVG_FILL_PSERVER))) + GetStyleSVG()->mFill.mType == eStyleSVGPaintType_Server) return PR_TRUE; return PR_FALSE; @@ -349,6 +349,11 @@ nsSVGGeometryFrame::SetupCairoFill(nsISVGRendererCanvas *aCanvas, return ps->SetupPaintServer(aCanvas, aCtx, this, GetStyleSVG()->mFillOpacity, aClosure); + } else if (GetStyleSVG()->mFill.mType == eStyleSVGPaintType_Server) { + // should have a paint server but something has gone wrong configuring it. + SetupCairoColor(aCtx, + sInvalidPaintColour, + 1.0f); } else SetupCairoColor(aCtx, GetStyleSVG()->mFill.mPaint.mColor, @@ -426,6 +431,11 @@ nsSVGGeometryFrame::SetupCairoStroke(nsISVGRendererCanvas *aCanvas, return ps->SetupPaintServer(aCanvas, aCtx, this, GetStyleSVG()->mStrokeOpacity, aClosure); + } else if (GetStyleSVG()->mFill.mType == eStyleSVGPaintType_Server) { + // should have a paint server but something has gone wrong configuring it. + SetupCairoColor(aCtx, + sInvalidPaintColour, + 1.0f); } else SetupCairoColor(aCtx, GetStyleSVG()->mStroke.mPaint.mColor,