[librsvg] bgo#786372 - In the style element, the type attribute should default to "text/css"
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] bgo#786372 - In the style element, the type attribute should default to "text/css"
- Date: Thu, 17 Aug 2017 20:29:07 +0000 (UTC)
commit caf234cf0453cc9a1b1ad9144562c2f0f309c79f
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 ++++++++++++++-
.../bugs/786372-default-style-type-ref.png | Bin 0 -> 287 bytes
.../reftests/bugs/786372-default-style-type.svg | 1 +
3 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/rsvg-base.c b/rsvg-base.c
index e821d8d..6ebed89 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;
diff --git a/tests/fixtures/reftests/bugs/786372-default-style-type-ref.png
b/tests/fixtures/reftests/bugs/786372-default-style-type-ref.png
new file mode 100644
index 0000000..f3bf76a
Binary files /dev/null and b/tests/fixtures/reftests/bugs/786372-default-style-type-ref.png differ
diff --git a/tests/fixtures/reftests/bugs/786372-default-style-type.svg
b/tests/fixtures/reftests/bugs/786372-default-style-type.svg
new file mode 100644
index 0000000..780aac6
--- /dev/null
+++ b/tests/fixtures/reftests/bugs/786372-default-style-type.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24
24"><defs><style>.a{fill:#010101;}.b{fill:none;}</style></defs><title>Icont set</title><path class="a"
d="M17.15,15.56c-2-.46-3.87-.87-3-2.58,2.75-5.2.73-8-2.18-8S7.06,7.89,9.82,13c.93,1.72-1,2.12-3,2.58C5.06,16,5,16.86,5,18.42V19H19v-.57C19,16.87,18.95,16,17.15,15.56Z"/><path
class="b" d="M0,0H24V24H0Z"/></svg>
\ No newline at end of file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]