After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 786372 - Certain black/white SVG files only display black (due to <style> missing a type="text/css" attribute)
Certain black/white SVG files only display black (due to <style> missing a ty...
Product: librsvg
Classification: Core
Component: general
Other Linux
: Normal normal
: ---
Assigned To: Federico Mena Quintero
librsvg maintainers
Depends on:
Reported: 2017-08-16 13:31 UTC by Tomek
Modified: 2017-08-18 09:57 UTC
See Also:
GNOME target: ---
GNOME version: ---

user.svg (369 bytes, image/svg+xml)
2017-08-16 13:31 UTC, Tomek
sitemap.svg (338 bytes, image/svg+xml)
2017-08-16 13:32 UTC, Tomek
5.svg (567 bytes, image/svg+xml)
2017-08-16 13:32 UTC, Tomek

Description Tomek 2017-08-16 13:31:38 UTC
Created attachment 357728 [details]

Image viewer is not showing svgs. See attached samples
Comment 1 Tomek 2017-08-16 13:32:20 UTC
Created attachment 357729 [details]
Comment 2 Tomek 2017-08-16 13:32:42 UTC
Created attachment 357730 [details]
Comment 3 Tomek 2017-08-16 13:33:32 UTC
Ubuntu 17.04
Comment 4 André Klapper 2017-08-16 16:02:38 UTC
Same if you import those SVG files into e.g. GIMP...

I can imagine that all SVG files are correctly displayed but that they are black and have a transparent background. And the background in EOG is black. So you have black on black.
I would have expected a checkered background if this is the case.

(Not "critical" priority by definition.)
Comment 5 Felix Riemann 2017-08-17 19:16:57 UTC
It looks like this may be a bug/limitation in librsvg as the thumbnails in Nautilus are also fully black, as is the display in rsvg-view (which maps transparency to the window background).

Also on zooming you can sometimes see the checkerboard pattern shine through at the image borders.
Comment 6 Federico Mena Quintero 2017-08-17 20:18:53 UTC
Ah, good catch.

The example files have


and later the path elements use the "a" and "b" classes.

However, librsvg expects the <style> to have a type="text/css" attribute; it's ignoring the <style> because it doesn't have that attribute.

The SVG spec in mandates that if the type attribute is not specified, it should default to "text/css".  I'll fix this; the problem is in rsvg_start_style().

(If you add type="text/css" to those <style> tags, the images render correctly.)
Comment 7 Federico Mena Quintero 2017-08-17 20:31:24 UTC
Fixed in b2cc9ce in the librsvg-2.40 branch, and caf234c in the master branch.