Bug 798839 - Fix scaling of SVG glyphs inheriting outer object pattern under zooming r=roc

This commit is contained in:
Edwin Flores 2013-01-08 11:03:44 +13:00
parent d6e78f7c5d
commit 904e957b56
4 changed files with 61 additions and 3 deletions

View File

@ -6,6 +6,7 @@ pref(gfx.font_rendering.opentype_svg.enabled,true) == svg-glyph-invalid.html
pref(gfx.font_rendering.opentype_svg.enabled,true) == svg-glyph-objectfill-solid.svg svg-glyph-objectfill-solid-ref.svg
pref(gfx.font_rendering.opentype_svg.enabled,true) == svg-glyph-objectstroke-solid.svg svg-glyph-objectstroke-solid-ref.svg
pref(gfx.font_rendering.opentype_svg.enabled,true) == svg-glyph-objectgradient.svg svg-glyph-objectgradient-ref.svg
pref(gfx.font_rendering.opentype_svg.enabled,true) == svg-glyph-objectgradient-zoom.svg svg-glyph-objectgradient-zoom-ref.svg
pref(gfx.font_rendering.opentype_svg.enabled,true) == svg-glyph-objectpattern.svg svg-glyph-objectpattern-ref.svg
pref(gfx.font_rendering.opentype_svg.enabled,true) == clip.html clip-ref.html
pref(gfx.font_rendering.opentype_svg.enabled,true) == svg-glyph-objectopacity.svg svg-glyph-objectopacity-ref.svg

View File

@ -0,0 +1,25 @@
<svg xmlns="http://www.w3.org/2000/svg" reftest-zoom="0.5">
<defs>
<linearGradient id="grad" x1="0" y1="0" x2="800" y2="800" gradientUnits="userSpaceOnUse">
<stop stop-color="purple" offset="0%" />
<stop stop-color="lime" offset="100%" />
</linearGradient>
<radialGradient id="grad2" cx="250" cy="400" r="400" gradientUnits="userSpaceOnUse">
<stop stop-color="red" offset="0%" />
<stop stop-color="blue" offset="100%" />
</radialGradient>
</defs>
<rect x="20" y="20" width="160" height="160" stroke="none"
fill="url(#grad)" />
<rect x="310" y="10" width="180" height="180" fill="url(#grad)"
stroke="none" />
<rect x="20" y="320" width="160" height="160" fill="burlywood"
stroke="url(#grad2)" stroke-width="10" />
<rect x="310" y="310" width="180" height="180" fill="url(#grad2)"
stroke="url(#grad)" stroke-width="20" />
</svg>

After

Width:  |  Height:  |  Size: 900 B

View File

@ -0,0 +1,35 @@
<svg xmlns="http://www.w3.org/2000/svg" reftest-zoom="0.5">
<!--
Test that gradients are inherited from the outer object under zoom
-->
<style type="text/css"><![CDATA[
@font-face {
font-family: "Liberation";
src:url("resources/svg.woff") format("woff");
}
text {
font-family: "Liberation";
font-size: 200px;
stroke-width: 5;
}
]]></style>
<defs>
<linearGradient id="grad" x1="0" y1="0" x2="800" y2="800" gradientUnits="userSpaceOnUse">
<stop stop-color="purple" offset="0%" />
<stop stop-color="lime" offset="100%" />
</linearGradient>
<radialGradient id="grad2" cx="250" cy="400" r="400" gradientUnits="userSpaceOnUse">
<stop stop-color="red" offset="0%" />
<stop stop-color="blue" offset="100%" />
</radialGradient>
</defs>
<text x="0" y="200" fill="url(#grad)" stroke="url(#grad2)">N</text>
<text x="300" y="200" fill="url(#grad)" stroke="url(#grad2)">O</text>
<text x="0" y="500" fill="url(#grad)" stroke="url(#grad2)">P</text>
<text x="300" y="500" fill="url(#grad)" stroke="url(#grad2)">Q</text>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -972,9 +972,6 @@ nsSVGGlyphFrame::SetupCairoStroke(gfxContext *aContext,
return false;
}
gfxContextMatrixAutoSaveRestore matrixRestore(aContext);
aContext->IdentityMatrix();
nsSVGUtils::SetupCairoStrokeHitGeometry(this, aContext, aOuterObjectPaint);
float opacity = nsSVGUtils::GetOpacity(style->mStrokeOpacitySource,
style->mStrokeOpacity,