SVG masks fail to render (or even display)
OpenPublic

Description

Author: kelvinsong10

Description:
Test file

Any SVG element that has an SVG mask will disappear silently.

See https://commons.wikimedia.org/wiki/File:SVG_mask.svg for an example—there should be a pink rectangle with an opacity gradient (not a square, not a solid color, and certainly not nothing at all). Try viewing in Inkscape or Firefox to see the correct version.


Version: unspecified
Severity: normal

Attached: mask.svg

bzimport added a project: Wikimedia-SVG-rendering.Via ConduitNov 22 2014, 2:00 AM
bzimport added a subscriber: Unknown Object (MLST).
bzimport set Reference to bz53899.
bzimport created this task.Via LegacySep 8 2013, 1:54 AM
Bawolff added a comment.Via ConduitSep 8 2013, 1:23 PM

Upstream issue with rsvg

Perhelion added a comment.Via ConduitSep 8 2013, 7:18 PM

Thats not true, RSVG supports simple mask fully. Mask with gradients only partialy. For example https://commons.wikimedia.org/wiki/File:SVG_mask_gradient_bug.svg

bzimport added a comment.Via ConduitSep 8 2013, 7:40 PM

kelvinsong10 wrote:

So, the same thing that can be achieved with Clipping paths. The whole point of masks is so you can apply opacity gradients/blurs!!! As it stands, the RSVG-supported masks are useless.

Perhelion added a comment.Via ConduitSep 8 2013, 7:44 PM

I removed the maskUnits="userSpaceOnUse" (in the mask tag) and the mask is working for this file!?

W3C cite: "If attribute ‘maskUnits’ is not specified, then the effect is as if a value of 'objectBoundingBox' were specified."

bzimport added a comment.Via ConduitSep 8 2013, 8:32 PM

kelvinsong10 wrote:

Okay, I tried what you did, and it works!!! (The reason I reverted you at the file is because you didn't fix the mask—you flattened the masks and applied the opacity gradient directly to the pink rectangle). Sounds like an Inkscape bug then, as mask behavior doesn't seem to be seriously affected by removal of this property.

Aklapper added a comment.Via ConduitSep 9 2013, 2:01 PM

(In reply to comment #5)

Sounds like an Inkscape bug then

In that case, upstreaming it with a testcase would be welcome:
http://inkscape.org/report_bugs.php

Bawolff added a comment.Via ConduitSep 9 2013, 5:12 PM

Created attachment 13260
The original test case with default attributes filled in

In that case, upstreaming it with a testcase would be welcome:
http://inkscape.org/report_bugs.php

Re-opening. maskUnits is part of the spec, the fact its broken in rsvg is a bug in rsvg.

The fact that in this particular svg, the unit types in use don't make much of a difference doesn't mean this isn't a bug.

It appears rsvg does not have the correct defaults for the x, y, width and height attribute on <mask> when using userSpaceOnUse. According to the spec, I believe the correct defaults are -10%, -10%, 120%, 120% respectively. [1] (Assuming I interpreted spec correctly. I'm not really all that familiar with the details of the svg spec)

Attaching an svg with these defaults filled in, appears to make the file work fine for rsvg.

[1] http://www.w3.org/TR/SVG11/masking.html#MaskElementMaskUnitsAttribute

Attached: maskFixed.svg

Bawolff added a comment.Via ConduitSep 9 2013, 10:35 PM

(In reply to comment #7)

It appears rsvg does not have the correct defaults for the x, y, width and
height attribute on <mask> when using userSpaceOnUse. According to the spec,
I
believe the correct defaults are -10%, -10%, 120%, 120% respectively. [1]
(Assuming I interpreted spec correctly. I'm not really all that familiar with
the details of the svg spec)

I have a 4 line patch to rsvg that I think fixes the issue (Think being the operative word. I'm a c newb). I just spent 4 hours trying to make the thing compile at all, so I'm going to sleep on it, and then test it a bunch to make sure it actually works like I think it does. If so I'll file a bug/patch upstream and see what happens.

Aklapper added a comment.Via ConduitSep 18 2013, 5:24 PM

(In reply to comment #9)

I have a 4 line patch to rsvg that I think fixes the issue (Think being the
operative word. I'm a c newb). I just spent 4 hours trying to make the thing
compile at all, so I'm going to sleep on it, and then test it a bunch to make
sure it actually works like I think it does. If so I'll file a bug/patch
upstream and see what happens.

bawolff: Did you have time for that? Is there an upstream URL?

Bawolff added a comment.Via ConduitSep 18 2013, 11:04 PM

(In reply to comment #10)

(In reply to comment #9)
> I have a 4 line patch to rsvg that I think fixes the issue (Think being the
> operative word. I'm a c newb). I just spent 4 hours trying to make the thing
> compile at all, so I'm going to sleep on it, and then test it a bunch to make
> sure it actually works like I think it does. If so I'll file a bug/patch
> upstream and see what happens.

bawolff: Did you have time for that? Is there an upstream URL?

Sorry not yet. Ill try to do that soon. My free time to do wiki stuff has somewhat evaporated.

Aklapper added a comment.Via ConduitNov 22 2013, 3:37 PM

bawolff: Understanding that you're busy, could you please share your untested four lines here so someone else would have the chance to test / improve a potential patch?

Bawolff added a comment.Via ConduitNov 25 2013, 12:15 PM

Created attachment 13897
patch to librsvg to change default mask size

(In reply to comment #12)

bawolff: Understanding that you're busy, could you please share your untested
four lines here so someone else would have the chance to test / improve a
potential patch?

Sorry, I meant to get back to this bug way before now, but I kind of forgot about this.

See the relavent section of the svg spec for where the numbers I chose came from.

Before submitting this upstream, I wanted to compile the patch on rsvg master (I was having trouble generating the build script, although I haven't put much effort into that. I did test on a modified version of the librsvg-2.39.0 tarball and it seemed to work well).

I also wanted to create a minimal test case for this before submitting upstream, which I haven't gotten around to yet.

Attached: file_53899.txt

waldyrious added a subscriber: waldyrious.Via WebSun, Jul 19, 6:55 PM

How does this relate to T8250?

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptVia HeraldSun, Jul 19, 6:55 PM

Add Comment