From 462d0c8340eafb365743ee46003769a6827f3ca3 Mon Sep 17 00:00:00 2001 From: "longsonr%gmail.com" Date: Thu, 7 Feb 2008 11:45:21 +0000 Subject: [PATCH] Bug 368840 - Fallback paint should be used for degenerate objectBoundingBox gradients. r+sr=tor,a1.9=mtschrep git-svn-id: svn://10.0.0.236/trunk@245127 18797224-902f-48f8-a5cc-f745e15eee43 --- .../svg/base/src/nsSVGGeometryFrame.cpp | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/mozilla/layout/svg/base/src/nsSVGGeometryFrame.cpp b/mozilla/layout/svg/base/src/nsSVGGeometryFrame.cpp index a0de2e6f785..e119ca48287 100644 --- a/mozilla/layout/svg/base/src/nsSVGGeometryFrame.cpp +++ b/mozilla/layout/svg/base/src/nsSVGGeometryFrame.cpp @@ -349,8 +349,15 @@ nsSVGGeometryFrame::SetupCairoFill(gfxContext *aContext) if (GetStateBits() & NS_STATE_SVG_FILL_PSERVER) { nsSVGPaintServerFrame *ps = static_cast (GetProperty(nsGkAtoms::fill)); - return ps->SetupPaintServer(aContext, this, opacity); - } else if (GetStyleSVG()->mFill.mType == eStyleSVGPaintType_Server) { + if (ps->SetupPaintServer(aContext, this, opacity)) + return PR_TRUE; + + // On failure, use the fallback colour in case we have an + // objectBoundingBox where the width or height of the object is zero. + // See http://www.w3.org/TR/SVG11/coords.html#ObjectBoundingBox + } + + if (GetStyleSVG()->mFill.mType == eStyleSVGPaintType_Server) { SetupCairoColor(aContext, GetStyleSVG()->mFill.mFallbackColor, opacity); @@ -418,8 +425,15 @@ nsSVGGeometryFrame::SetupCairoStroke(gfxContext *aContext) if (GetStateBits() & NS_STATE_SVG_STROKE_PSERVER) { nsSVGPaintServerFrame *ps = static_cast (GetProperty(nsGkAtoms::stroke)); - return ps->SetupPaintServer(aContext, this, opacity); - } else if (GetStyleSVG()->mStroke.mType == eStyleSVGPaintType_Server) { + if (ps->SetupPaintServer(aContext, this, opacity)) + return PR_TRUE; + + // On failure, use the fallback colour in case we have an + // objectBoundingBox where the width or height of the object is zero. + // See http://www.w3.org/TR/SVG11/coords.html#ObjectBoundingBox + } + + if (GetStyleSVG()->mStroke.mType == eStyleSVGPaintType_Server) { SetupCairoColor(aContext, GetStyleSVG()->mStroke.mFallbackColor, opacity);