From da32cba556960b56abff3d8bfbdbd64a6be74999 Mon Sep 17 00:00:00 2001 From: Edwin Flores Date: Fri, 17 Feb 2012 16:33:23 -0800 Subject: [PATCH] Bug 725918 patch 2: Fixed wrong assertion in nsSVGGlyphFrame. r=longsonr --- layout/reftests/svg/reftest.list | 1 + layout/reftests/svg/text-layout-06-ref.svg | 10 ++++++++++ layout/reftests/svg/text-layout-06.svg | 9 +++++++++ layout/svg/base/src/nsSVGGlyphFrame.cpp | 18 +++++++++++------- layout/svg/crashtests/725918-1.svg | 4 ++++ layout/svg/crashtests/crashtests.list | 1 + 6 files changed, 36 insertions(+), 7 deletions(-) create mode 100644 layout/reftests/svg/text-layout-06-ref.svg create mode 100644 layout/reftests/svg/text-layout-06.svg create mode 100644 layout/svg/crashtests/725918-1.svg diff --git a/layout/reftests/svg/reftest.list b/layout/reftests/svg/reftest.list index defd30e3c084..e46701f32794 100644 --- a/layout/reftests/svg/reftest.list +++ b/layout/reftests/svg/reftest.list @@ -242,6 +242,7 @@ fails-if(Android) random-if(gtk2Widget) != text-language-01.xhtml text-language- == text-layout-03.svg text-layout-03-ref.svg == text-layout-04.svg text-layout-04-ref.svg == text-layout-05.svg text-layout-05-ref.svg +== text-layout-06.svg text-layout-06-ref.svg == text-scale-01.svg text-scale-01-ref.svg == text-stroke-scaling-01.svg text-stroke-scaling-01-ref.svg == stroke-dasharray-and-pathLength-01.svg pass.svg diff --git a/layout/reftests/svg/text-layout-06-ref.svg b/layout/reftests/svg/text-layout-06-ref.svg new file mode 100644 index 000000000000..b4276007cc12 --- /dev/null +++ b/layout/reftests/svg/text-layout-06-ref.svg @@ -0,0 +1,10 @@ + + + Reference to check fill and stroke handling + + A B + A B + diff --git a/layout/reftests/svg/text-layout-06.svg b/layout/reftests/svg/text-layout-06.svg new file mode 100644 index 000000000000..5e8e49b91df9 --- /dev/null +++ b/layout/reftests/svg/text-layout-06.svg @@ -0,0 +1,9 @@ + + + Testcase to check fill and stroke handling + + A B + diff --git a/layout/svg/base/src/nsSVGGlyphFrame.cpp b/layout/svg/base/src/nsSVGGlyphFrame.cpp index 9a44d5457821..c745a7f3d44b 100644 --- a/layout/svg/base/src/nsSVGGlyphFrame.cpp +++ b/layout/svg/base/src/nsSVGGlyphFrame.cpp @@ -900,21 +900,25 @@ nsSVGGlyphFrame::SetupCairoState(gfxContext *aContext, nsRefPtr *aSt nsSVGPaintServerFrame *ps = GetPaintServer(&style->mStroke, nsSVGEffects::StrokeProperty()); + nsRefPtr strokePattern; + if (ps) { // Gradient or Pattern: can get pattern directly from frame - *aStrokePattern = ps->GetPaintServerPattern(this, opacity); + strokePattern = ps->GetPaintServerPattern(this, opacity); + } - NS_ASSERTION(*aStrokePattern, "No pattern returned from paint server"); - } else { + if (!strokePattern) { nscolor color; nsSVGUtils::GetFallbackOrPaintColor(aContext, GetStyleContext(), &nsStyleSVG::mStroke, &opacity, &color); - *aStrokePattern = new gfxPattern(gfxRGBA(NS_GET_R(color) / 255.0, - NS_GET_G(color) / 255.0, - NS_GET_B(color) / 255.0, - NS_GET_A(color) / 255.0 * opacity)); + strokePattern = new gfxPattern(gfxRGBA(NS_GET_R(color) / 255.0, + NS_GET_G(color) / 255.0, + NS_GET_B(color) / 255.0, + NS_GET_A(color) / 255.0 * opacity)); } + + strokePattern.swap(*aStrokePattern); } if (SetupCairoFill(aContext)) { diff --git a/layout/svg/crashtests/725918-1.svg b/layout/svg/crashtests/725918-1.svg new file mode 100644 index 000000000000..5ebdf33f6918 --- /dev/null +++ b/layout/svg/crashtests/725918-1.svg @@ -0,0 +1,4 @@ + + t + + diff --git a/layout/svg/crashtests/crashtests.list b/layout/svg/crashtests/crashtests.list index ea35804fa5cd..ed07648dd113 100644 --- a/layout/svg/crashtests/crashtests.list +++ b/layout/svg/crashtests/crashtests.list @@ -123,3 +123,4 @@ load 709920-1.svg load 709920-2.svg load 713413-1.svg load 722003-1.svg +load 725918-1.svg