[librsvg: 1/2] gitlab#112 - Apply style attributes for SVG elements
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 1/2] gitlab#112 - Apply style attributes for SVG elements
- Date: Sat, 24 Feb 2018 02:22:50 +0000 (UTC)
commit 1d7004b51b38c09c02892e7c0e5cafbae594d11c
Author: Federico Mena Quintero <federico gnome org>
Date: Fri Feb 23 20:05:52 2018 -0600
gitlab#112 - Apply style attributes for SVG elements
We were applying them only for the toplevel <svg> element; they need
to be applied for all <svg> elements in the drawing.
https://gitlab.gnome.org/GNOME/librsvg/issues/112
librsvg/rsvg-base.c | 10 ++++------
.../reftests/bugs/112-svg-delayed-attributes-ref.png | Bin 0 -> 81 bytes
.../fixtures/reftests/bugs/112-svg-delayed-attributes.svg | 6 ++++++
3 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/librsvg/rsvg-base.c b/librsvg/rsvg-base.c
index 94990400..d1b249c8 100644
--- a/librsvg/rsvg-base.c
+++ b/librsvg/rsvg-base.c
@@ -848,6 +848,10 @@ rsvg_end_element (void *data, const xmlChar * xmlname)
handle->priv->handler = NULL;
}
+ if (handle->priv->currentnode && rsvg_node_get_type (handle->priv->currentnode) ==
RSVG_NODE_TYPE_SVG) {
+ rsvg_node_svg_apply_atts (handle->priv->currentnode, handle);
+ }
+
if (handle->priv->currentnode && topmost_element_name_is (handle, name)) {
RsvgNode *parent;
@@ -856,12 +860,6 @@ rsvg_end_element (void *data, const xmlChar * xmlname)
handle->priv->currentnode = parent;
pop_element_name (handle);
}
-
- /* FIXMEchpe: shouldn't this check that currentnode == treebase or sth like that? */
- if (handle->priv->treebase && !strcmp (name, "svg")) {
- g_assert (rsvg_node_get_type (handle->priv->treebase) == RSVG_NODE_TYPE_SVG);
- rsvg_node_svg_apply_atts (handle->priv->treebase, handle);
- }
}
}
diff --git a/tests/fixtures/reftests/bugs/112-svg-delayed-attributes-ref.png
b/tests/fixtures/reftests/bugs/112-svg-delayed-attributes-ref.png
new file mode 100644
index 00000000..2bfc1999
Binary files /dev/null and b/tests/fixtures/reftests/bugs/112-svg-delayed-attributes-ref.png differ
diff --git a/tests/fixtures/reftests/bugs/112-svg-delayed-attributes.svg
b/tests/fixtures/reftests/bugs/112-svg-delayed-attributes.svg
new file mode 100644
index 00000000..9c494345
--- /dev/null
+++ b/tests/fixtures/reftests/bugs/112-svg-delayed-attributes.svg
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" fill="red" width="16" height="16">
+ <svg fill="lime">
+ <rect width="16" height="16"/>
+ </svg>
+</svg>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]