Bug 483765. Remove incorrect scaling when painting non-SVG content with an SVG filter, so such content renders properly when zooming. r=jwatt

--HG--
extra : rebase_source : 7106820dfb7f2b96b88348ea08e68c5d4377d863
This commit is contained in:
Robert O'Callahan 2009-03-18 13:37:01 +13:00
parent e694f71dd3
commit 2414bbf369
11 changed files with 67 additions and 28 deletions

View File

@ -3,11 +3,9 @@
http://creativecommons.org/licenses/publicdomain/
-->
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
xmlns:svg="http://www.w3.org/2000/svg">
<body style="margin:0">
<div style="position:absolute; top:0; left:0; clip-path: url(#c1); width:500px; height:500px; background:lime;"></div>
<div style="clip-path: url(#c1); width:500px; height:500px; background:lime;"></div>
<svg:svg height="0">
<svg:clipPath id="c1" clipPathUnits="objectBoundingBox">
<svg:rect x="0.5" y="0" width="0.5" height="1"/>

View File

@ -3,8 +3,8 @@
http://creativecommons.org/licenses/publicdomain/
-->
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<body style="margin:0">
<div style="clip-path: url(#c1); width:500px; height:200px; background:lime;">
<div style="height:200px;"/>

View File

@ -3,8 +3,7 @@
http://creativecommons.org/licenses/publicdomain/
-->
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
xmlns:svg="http://www.w3.org/2000/svg">
<body style="margin:0">
<div style="clip-path: url(#c1); width:500px; height:200px; background:lime;">
<div style="height:200px;"/>

View File

@ -0,0 +1,15 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/licenses/publicdomain/
-->
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:svg="http://www.w3.org/2000/svg" reftest-zoom="2">
<body style="margin:0">
<div style="clip-path: url(#c1); width:250px; height:250px; background:lime;"></div>
<svg:svg height="0">
<svg:clipPath id="c1" clipPathUnits="objectBoundingBox">
<svg:rect x="0.5" y="0" width="0.5" height="1"/>
</svg:clipPath>
</svg:svg>
</body>
</html>

View File

@ -6,8 +6,8 @@
xmlns:xlink="http://www.w3.org/1999/xlink">
<filter id="f1">
<feFlood flood-color="black" result="black"/>
<feGaussianBlur in="SourceAlpha" stdDeviation="10"/>
<feComposite in="black" operator="in"/>
<feComposite in="SourceAlpha" operator="in"/>
<feOffset dx="10" dy="10"/>
<feComposite in="SourceGraphic"/>
</filter>
<rect x="50" y="50" width="200" height="200" fill="lime" filter="url(#f1)"/>

Before

Width:  |  Height:  |  Size: 527 B

After

Width:  |  Height:  |  Size: 508 B

View File

@ -3,16 +3,14 @@
http://creativecommons.org/licenses/publicdomain/
-->
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
xmlns:svg="http://www.w3.org/2000/svg">
<body style="margin:0">
<div style="background:lime; width:200px; height:200px; margin:50px; filter:url(#f1)"/>
<svg:svg height="0">
<svg:filter id="f1">
<svg:feFlood flood-color="black" result="black"/>
<svg:feGaussianBlur in="SourceAlpha" stdDeviation="10"/>
<svg:feComposite in="black" operator="in"/>
<svg:feComposite in="SourceAlpha" operator="in"/>
<svg:feOffset dx="10" dy="10"/>
<svg:feComposite in="SourceGraphic"/>
</svg:filter>
</svg:svg>

View File

@ -0,0 +1,18 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/licenses/publicdomain/
-->
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:svg="http://www.w3.org/2000/svg" reftest-zoom="2">
<body style="margin:0">
<div style="background:lime; width:100px; height:100px; margin:25px; filter:url(#f1)"/>
<svg:svg height="0">
<svg:filter id="f1">
<svg:feFlood flood-color="black" result="black"/>
<svg:feComposite in="SourceAlpha" operator="in"/>
<svg:feOffset dx="5" dy="5"/>
<svg:feComposite in="SourceGraphic"/>
</svg:filter>
</svg:svg>
</body>
</html>

View File

@ -3,11 +3,9 @@
http://creativecommons.org/licenses/publicdomain/
-->
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
xmlns:svg="http://www.w3.org/2000/svg">
<body style="margin:0">
<div style="mask: url(#m1); width:500px; height:500px; background:lime;"></div>
<svg:svg height="0">
<svg:mask id="m1" maskUnits="objectBoundingBox" maskContentUnits="objectBoundingBox">
<svg:linearGradient id="g" gradientUnits="objectBoundingBox" x2="0" y2="1">

View File

@ -0,0 +1,20 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/licenses/publicdomain/
-->
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:svg="http://www.w3.org/2000/svg" reftest-zoom="2">
<body style="margin:0">
<div style="mask: url(#m1); width:250px; height:250px; background:lime;"></div>
<svg:svg height="0">
<svg:mask id="m1" maskUnits="objectBoundingBox" maskContentUnits="objectBoundingBox">
<svg:linearGradient id="g" gradientUnits="objectBoundingBox" x2="0" y2="1">
<svg:stop stop-color="white" offset="0"/>
<svg:stop stop-color="white" stop-opacity="0" offset="1"/>
</svg:linearGradient>
<svg:circle cx="0.25" cy="0.25" r="0.25" id="circle" fill="white"/>
<svg:rect x="0.5" y="0" width="0.5" height="1" fill="url(#g)"/>
</svg:mask>
</svg:svg>
</body>
</html>

View File

@ -10,9 +10,11 @@
== clipPath-html-05-extref.xhtml clipPath-html-05-ref.xhtml
== clipPath-html-06.xhtml clipPath-html-06-ref.xhtml
== clipPath-html-06-extref.xhtml clipPath-html-06-ref.xhtml
== clipPath-html-zoomed-01.xhtml clipPath-html-01-ref.svg
== filter-html-01.xhtml filter-html-01-ref.svg
== filter-html-01-extref.xhtml filter-html-01-ref.svg
== filter-html-zoomed-01.xhtml filter-html-01-ref.svg
== mask-html-01.xhtml mask-html-01-ref.svg
== mask-html-01-extref-01.xhtml mask-html-01-ref.svg
== mask-html-01-extref-02.xhtml mask-html-01-ref.svg
== mask-html-zoomed-01.xhtml mask-html-01-ref.svg

View File

@ -209,15 +209,6 @@ public:
const nsIntRect* aDirtyRect)
{
nsIRenderingContext* ctx = aContext->GetRenderingContext(aTarget);
gfxContext* gfxCtx = aContext->GetGfxContext();
// We're expected to paint with 1 unit equal to 1 CSS pixel. But
// mInnerList->Paint expects 1 unit to equal 1 device pixel. So
// adjust.
gfxFloat scale =
nsPresContext::AppUnitsToFloatCSSPixels(aTarget->PresContext()->AppUnitsPerDevPixel());
gfxCtx->Scale(scale, scale);
nsIRenderingContext::AutoPushTranslation push(ctx, -mOffset.x, -mOffset.y);
nsRect dirty;
if (aDirtyRect) {