[librsvg] Apply style attributes of svg element at the end of svg element tag.



commit dd8e5b13dbae2603693ff5ce78ab6ce3da3cb1ed
Author: Hiroyuki Ikezoe <poincare ikezoe net>
Date:   Tue Jun 8 19:47:53 2010 +0900

    Apply style attributes of svg element at the end of svg element tag.
    
    Because svg element's presentation attributes does not apply
    when drawing SVG which has no "style" element.
    
    Fix for bug #620693.

 rsvg-base.c                         |    2 +-
 tests/fixtures/styles/bug620693.svg |    4 ++++
 tests/styles.c                      |    1 +
 3 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/rsvg-base.c b/rsvg-base.c
index 5e45962..e80c4fb 100644
--- a/rsvg-base.c
+++ b/rsvg-base.c
@@ -690,7 +690,7 @@ rsvg_end_element (void *data, const xmlChar * name)
             && !strcmp ((const char *) name, ctx->priv->currentnode->type->str))
             rsvg_pop_def_group (ctx);
 
-        if (ctx->priv->treebase && !strcmp ((const char *)name, "style"))
+        if (ctx->priv->treebase && !strcmp ((const char *)name, "svg"))
             _rsvg_node_svg_apply_atts ((RsvgNodeSvg *)ctx->priv->treebase, ctx);
     }
 }
diff --git a/tests/fixtures/styles/bug620693.svg b/tests/fixtures/styles/bug620693.svg
new file mode 100644
index 0000000..7a0e1fd
--- /dev/null
+++ b/tests/fixtures/styles/bug620693.svg
@@ -0,0 +1,4 @@
+<?xml version="1.0" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg"; id="svg" viewBox="-5 -5 10 10" stroke="#f00" fill="none" stroke-width="2">
+<circle r="4"/>
+</svg>
diff --git a/tests/styles.c b/tests/styles.c
index f41713f..4c0e5a6 100644
--- a/tests/styles.c
+++ b/tests/styles.c
@@ -95,6 +95,7 @@ static const FixtureData fixtures[] =
     {"/styles/selectors/2 or more selectors (fill)", "592207", "styles/bug592207.svg", "#target", "fill", .expected.color = 0xff0000},
     {"/styles/selectors/2 or more selectors (stroke)", "592207", "styles/bug592207.svg", "#target", "stroke", .expected.color = 0x0000ff},
     {"/styles/svg-element-style", "615701", "styles/svg-class.svg", "#svg", "fill", .expected.color = 0x0000ff},
+    {"/styles/presentation attribute in svg element", "620693", "styles/bug620693.svg", "#svg", "stroke", .expected.color = 0xff0000},
     {"/styles/!important", "379629", "styles/bug379629.svg", "#base_shadow", "stroke", .expected.color = 0xffc0cb /* pink */},
     {"/styles/!important", "379629", "styles/bug379629.svg", "#base_shadow", "stroke-width", .expected.length = {POINTS_LENGTH(5.), 'i'}},
     {"/styles/!important/class", "614606", "styles/bug614606.svg", "#path6306", "fill", .expected.color = 0xff0000 /* red */ },



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