[librsvg/librsvg-2.40] bgo#786372 - In the style element, the type attribute should default to "text/css"



commit b2cc9ce181be7dbe90cbea3a57db1e841b0fe826
Author: Federico Mena Quintero <federico gnome org>
Date:   Thu Aug 17 15:23:16 2017 -0500

    bgo#786372 - In the style element, the type attribute should default to "text/css"
    
    Per https://www.w3.org/TR/SVG/styling.html#StyleElementTypeAttribute ,
    if a <style> element doesn't specify a "type" attribute, then it
    should be as if type="text/css".  We should really pick up that value
    from the svg element's contentStyleType, but we don't read that yet.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=786372

 rsvg-base.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/rsvg-base.c b/rsvg-base.c
index 26bbc35..edf4b80 100644
--- a/rsvg-base.c
+++ b/rsvg-base.c
@@ -182,7 +182,20 @@ rsvg_start_style (RsvgHandle * ctx, RsvgPropertyBag *atts)
     handler->ctx = ctx;
 
     handler->style = g_string_new (NULL);
-    handler->is_text_css = type && g_ascii_strcasecmp (type, "text/css") == 0;
+
+    /* FIXME: See these:
+     *
+     * https://www.w3.org/TR/SVG/styling.html#StyleElementTypeAttribute
+     * https://www.w3.org/TR/SVG/styling.html#ContentStyleTypeAttribute
+     *
+     * If the "type" attribute is not present, we should fallback to the
+     * "contentStyleType" attribute of the svg element, which in turn
+     * defaults to "text/css".
+     *
+     * See where is_text_css is used to see where we parse the contents
+     * of the style element.
+     */
+    handler->is_text_css = (type == NULL) || (g_ascii_strcasecmp (type, "text/css") == 0);
 
     handler->parent = (RsvgSaxHandlerDefs *) ctx->priv->handler;
     ctx->priv->handler = &handler->super;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]