summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@gnome.org>2016-04-12 16:52:51 -0500
committerFederico Mena Quintero <federico@gnome.org>2016-04-12 16:52:51 -0500
commitaec5f5c34a233cae4d21284f55c2af2e4ddb0b3b (patch)
treede3128251c40df1118f120f8aea557d4f29f4b80
parent153bcc92746300f5676bc0f32a7dcc1de65b654f (diff)
downloadlibrsvg-aec5f5c34a233cae4d21284f55c2af2e4ddb0b3b.tar.gz
bgo#764808 - start off with state->current_color = black
When SVG comes in with e.g. fill="currentColor", it means that the content is likely being embedded into other content, and expects the CSS to cascade appropriately. For example, if there is an SVG for an equation and it gets inserted into an HTML paragraph of text, then the equation should have the same color as the text. However, librsvg doesn't allow passing in a current-state-of-CSS; it always starts off fresh. So, here we make it start with the current_color being opaque black, instead of transparent (all-bits-zero due to initialization). This will at least make things visible. Later we can explore inheriting the cairo_t's current colors. https://bugzilla.gnome.org/show_bug.cgi?id=764808
-rw-r--r--rsvg-styles.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/rsvg-styles.c b/rsvg-styles.c
index 4639f515..948333eb 100644
--- a/rsvg-styles.c
+++ b/rsvg-styles.c
@@ -119,6 +119,10 @@ rsvg_state_init (RsvgState * state)
state->mask = NULL;
state->opacity = 0xff;
state->baseline_shift = 0.;
+ state->current_color = 0xff000000; /* See bgo#764808; we don't inherit CSS
+ * from the public API, so start off with
+ * opaque black instead of transparent.
+ */
state->fill = rsvg_paint_server_parse (NULL, "#000");
state->fill_opacity = 0xff;
state->stroke_opacity = 0xff;