Commit 20dd6a3a authored by Hiroyuki Ikezoe's avatar Hiroyuki Ikezoe

Handle !important directive.

Fix for bug #61406.

RsvgState keeps style information with "!important" in hash table.
parent 8e37c2a2
......@@ -252,37 +252,6 @@ _rsvg_css_hand_normalize_length (const RsvgLength * in, gdouble pixels_per_inch,
return 0;
}
gboolean
rsvg_css_param_match (const char *str, const char *param_name)
{
int i;
for (i = 0; str[i] != '\0' && param_name[i] != '\0'; i++)
if (param_name[i] != str[i])
return FALSE;
return str[i] == ':' && param_name[i] == '\0';
}
int
rsvg_css_param_arg_offset (const char *str)
{
int i;
int found;
found = -1;
i = 0;
while (str[i] != '\0') {
for (; str[i] != '\0' && str[i] != ':'; i++);
if (str[i] != '\0')
i++;
for (; str[i] == ' '; i++);
if (str[i] != '\0')
found = i;
}
if (found == -1)
found = i;
return found;
}
static gint
rsvg_css_clip_rgb_percent (gdouble in_percent)
{
......
......@@ -45,9 +45,6 @@ G_BEGIN_DECLS
int rsvg_css_parse_aspect_ratio (const char *str);
gboolean rsvg_css_param_match (const char *str, const char *param_name);
int rsvg_css_param_arg_offset (const char *str);
guint32 rsvg_css_parse_color (const char *str, gboolean * inherit);
guint rsvg_css_parse_opacity (const char *str);
double rsvg_css_parse_angle (const char *str);
......
......@@ -53,7 +53,10 @@ instance_init (RsvgHandle * self)
self->priv->dpi_x = rsvg_internal_dpi_x;
self->priv->dpi_y = rsvg_internal_dpi_y;
self->priv->css_props = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
self->priv->css_props = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
(GDestroyNotify) g_hash_table_destroy);
self->priv->ctxt = NULL;
self->priv->currentnode = NULL;
......
This diff is collapsed.
......@@ -235,6 +235,8 @@ struct _RsvgState {
TextRenderingProperty text_rendering_type;
gboolean has_text_rendering_type;
GHashTable *styles;
};
RsvgState *rsvg_state_new ();
......@@ -248,7 +250,6 @@ void rsvg_state_override (RsvgState * dst, const RsvgState * src);
void rsvg_state_finalize (RsvgState * state);
void rsvg_parse_style_pairs (RsvgHandle * ctx, RsvgState * state, RsvgPropertyBag * atts);
void rsvg_parse_style_pair (RsvgHandle * ctx, RsvgState * state, const char *key, const char *val);
void rsvg_parse_style (RsvgHandle * ctx, RsvgState * state, const char *str);
void rsvg_parse_cssbuffer (RsvgHandle * ctx, const char *buff, size_t buflen);
......
......@@ -95,6 +95,9 @@ static const FixtureData fixtures[] =
{"/styles/!important", "379629", "fixtures/styles/bug379629.svg", "#base_shadow", "stroke-width", .expected.length = {POINTS_LENGTH(5.), 'i'}},
{"/styles/!important/class", "614606", "fixtures/styles/bug614606.svg", "#path6306", "fill", .expected.color = 0xff0000 /* red */ },
{"/styles/!important/element", "614606", "fixtures/styles/bug614606.svg", "#path6308", "fill", .expected.color = 0x000000},
{"/styles/!important/#id prior than class", NULL, "fixtures/styles/important.svg", "#red", "fill", .expected.color = 0xff0000 },
{"/styles/!important/class prior than type", NULL, "fixtures/styles/important.svg", "#blue", "fill", .expected.color = 0x0000ff },
{"/styles/!important/presentation attribute is invalid", NULL, "fixtures/styles/important.svg", "#white", "fill", .expected.color = 0xffffff },
{"/styles/selectors/descendant", "338160", "fixtures/styles/bug338160.svg", "#base_shadow", "stroke-width", .expected.length = {2., '\0'}},
};
static const gint n_fixtures = G_N_ELEMENTS (fixtures);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment