[librsvg] bgo#764808 - start off with state->current_color = black

commit aec5f5c34a233cae4d21284f55c2af2e4ddb0b3b
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Apr 12 16:52:51 2016 -0500

    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.

 rsvg-styles.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/rsvg-styles.c b/rsvg-styles.c
index 4639f51..948333e 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;

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