Bug 806432 - When creating the offscreen surface into which group opacity, mask or non-trivial-clipPath are painted, use the non-transformed visual overflow rect. r=roc.

This commit is contained in:
Jonathan Watt 2012-12-21 21:40:06 +00:00
parent 1b80273d20
commit 1816c977f0
6 changed files with 76 additions and 1 deletions

View File

@ -0,0 +1,23 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<title>Testcase for clip-path on elements that are transformed</title>
<!-- From https://bugzilla.mozilla.org/show_bug.cgi?id=806432 -->
<clipPath id="cp" clipPathUnits="userSpaceOnUse">
<!-- Two duplicate rects are used to make us take the non-trivial-clipPath
code path when painting this SVG file.
-->
<rect x="0" y="0" width="100" height="100"/>
<rect x="0" y="0" width="100" height="100"/>
</clipPath>
<rect width="100%" height="100%" fill="lime"/>
<rect x="10" y="10" width="100" height="100" fill="red"/>
<rect width="100" height="100" transform="translate(10,10)" fill="lime" clip-path="url(#cp)"/>
</svg>

After

Width:  |  Height:  |  Size: 831 B

View File

@ -0,0 +1,19 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<title>Testcase for mask on elements that are transformed</title>
<!-- From https://bugzilla.mozilla.org/show_bug.cgi?id=806432 -->
<mask id="m" maskUnits="userSpaceOnUse" maskContentUnits="userSpaceOnUse">
<rect x="0" y="0" width="100" height="100" fill="white"/>
</mask>
<rect width="100%" height="100%" fill="lime"/>
<rect x="10" y="10" width="100" height="100" fill="red"/>
<rect width="100" height="100" transform="translate(10,10)" fill="lime" mask="url(#m)"/>
</svg>

After

Width:  |  Height:  |  Size: 670 B

View File

@ -0,0 +1,7 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<rect x="10" y="10" width="100" height="100" fill="blue" opacity="0.5"/>
</svg>

After

Width:  |  Height:  |  Size: 255 B

View File

@ -0,0 +1,22 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<title>Testcase for opacity on elements that are transformed</title>
<!-- From https://bugzilla.mozilla.org/show_bug.cgi?id=806432 -->
<filter id="f">
<feOffset dx="0.0001"/>
</filter>
<!-- The filter is purely to force the element to be rendered via the
nsSVGIntegrationUtils code path. (A mask or non-trivial clipPath that
have no effect would do just as well.)
-->
<rect width="100" height="100" transform="translate(10,10)" fill="blue" opacity="0.5" filter="url(#f)"/>
</svg>

After

Width:  |  Height:  |  Size: 691 B

View File

@ -30,6 +30,7 @@ include svg-integration/reftest.list
== clip-02b.svg clip-02-ref.svg
== clipPath-advanced-01.svg pass.svg
fuzzy-if(/^Windows\x20NT\x206\.1/.test(http.oscpu),1,2) == clipPath-and-shape-rendering-01.svg clipPath-and-shape-rendering-01-ref.svg # bug 614840
== clipPath-and-transform-01.svg pass.svg
== clipPath-basic-01.svg pass.svg
== clipPath-basic-02.svg pass.svg
== clipPath-basic-03.svg pass.svg
@ -177,6 +178,7 @@ fuzzy-if(Android,9,980) == gradient-live-01d.svg gradient-live-01-ref.svg
== mask-extref-dataURI-01.svg pass.svg
== mask-containing-masked-content-01.svg pass.svg
== mask-transformed-01.svg mask-transformed-01-ref.svg
== mask-transformed-02.svg pass.svg
pref(layout.css.masking.enabled,true) == mask-type-01.svg mask-type-01-ref.svg
pref(layout.css.masking.enabled,true) == mask-type-02.svg mask-type-01-ref.svg
pref(layout.css.masking.enabled,true) == mask-type-03.svg mask-type-01-ref.svg
@ -199,6 +201,7 @@ random-if(gtk2Widget) == objectBoundingBox-and-fePointLight-02.svg objectBoundin
== opacity-and-gradient-01.svg pass.svg
== opacity-and-gradient-02.svg opacity-and-gradient-02-ref.svg
== opacity-and-pattern-01.svg pass.svg
== opacity-and-transform-01.svg opacity-and-transform-01-ref.svg
== outer-svg-border-and-padding-01.svg outer-svg-border-and-padding-01-ref.svg
== path-01.svg path-01-ref.svg
== path-02.svg pass.svg

View File

@ -477,7 +477,8 @@ nsSVGIntegrationUtils::PaintFramesWithEffects(nsRenderingContext* aCtx,
if (opacity != 1.0f || maskFrame || (clipPathFrame && !isTrivialClip)) {
complexEffects = true;
gfx->Save();
aCtx->IntersectClip(aFrame->GetVisualOverflowRect() + svgGeomFramePos);
aCtx->IntersectClip(aFrame->GetVisualOverflowRectRelativeToSelf() +
svgGeomFramePos);
gfx->PushGroup(gfxASurface::CONTENT_COLOR_ALPHA);
}