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 514268 - style[not(@type="text/css")] elements are not ignored
style[not(@type="text/css")] elements are not ignored
Status: RESOLVED FIXED
Product: librsvg
Classification: Core
Component: general
2.20.x
Other Linux
: Normal normal
: ---
Assigned To: librsvg maintainers
librsvg maintainers
Depends on:
Blocks:
 
 
Reported: 2008-02-04 11:50 UTC by Petr Pisar
Modified: 2012-11-16 11:21 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test case (364 bytes, image/svg+xml)
2008-02-04 11:53 UTC, Petr Pisar
  Details
lookup the mimetype from 'type' and 'contentStyleType' (1.18 KB, patch)
2012-11-16 07:58 UTC, David Liang
none Details | Review

Description Petr Pisar 2008-02-04 11:50:43 UTC
According http://www.w3.org/TR/SVG/styling.html#StyleElement a style element requires attribute type with value "text/css". Therefore not conforming elements should be ignored.

Current (2.20.0) librsvg doesn't respect the specification.
Comment 1 Petr Pisar 2008-02-04 11:53:25 UTC
Created attachment 104375 [details]
test case

The rectangle (spreaded across whole cavnas) should be black because style element has no @type="text/css".
Comment 2 Peter Moulder 2008-02-18 04:58:13 UTC
The relevant text from the linked-to section of the (v1.1) spec is “Authors must supply a value for this attribute; there is no default value.”

Thus, I believe that the correct behaviour when encountering a <style> element with no type attribute is as specified at <http://www.w3.org/TR/SVG11/implnote.html#ErrorProcessing>: don't render anything after the first error (so don't render the rectangle at all, in this example), and instead render an obvious error indication such as “a translucent colored pattern such as a checkerboard”, and possibly also some text that mentions “a line number and character number at which the error was encountered”.

For a command-line tool like rsvg-convert, I suggest that reasonable behaviour would be to write an error message to stderr and exit with non-zero status.

The importance of strict error handling is so that authors (of the SVG or the tool that generated the SVG) are as likely as possible to fix things so that SVG files render the same everywhere rather than different viewers handling the error differently.  Permissive error handling should be left for ‘tidy’-like tools that produce correct (and hence more portable) SVG as output.
Comment 3 Christian Persch 2012-01-12 23:09:16 UTC
Fixed on master.
Comment 4 David Liang 2012-11-16 07:58:24 UTC
Created attachment 229114 [details] [review]
lookup the mimetype from 'type' and 'contentStyleType'

Hi,

https://bugzilla.novell.com/show_bug.cgi?id=789728.
I did some investigations and found it was related to this bug.

According to http://www.w3.org/TR/SVG/styling.html#StyleElement,
'type' in 'style' -->  ‘contentStyleType’ in 'svg' should be looked up
to determine the mime type, if both were not found, 'text/css' would 
be the default mime type.

A proper patch is attached.
Comment 5 Peter Moulder 2012-11-16 11:21:28 UTC
If anyone else is interested in how “Authors must supply a value for this attribute; there is no default value” turned into the current spec text, it turns out that this is a change in the SVG spec introduced with erratum http://www.w3.org/2003/01/REC-SVG11-20030114-errata#clarify-content-style-type-behavior .

[The word "clarify" in the erratum entry is wrong: the 2003 versions of http://www.w3.org/TR/2003/REC-SVG11-20030114/styling.html#StyleElement with #DefaultStyleSheetLanguage is very clear in specifying a different behaviour from that introduced for this erratum.  Perhaps there should be an erratum for the erratum...]