From 2e1e00c3de747b9208fcd8fd6a1b713d99adc932 Mon Sep 17 00:00:00 2001 From: Matt Watson Date: Tue, 10 Mar 2015 17:25:38 -0700 Subject: [PATCH] st: fix "text-shadow: none" to correctly draw no shadow We would incorrectly create a solid black st-shadow with no blur when parsing in a "none" value from css. https://bugzilla.gnome.org/show_bug.cgi?id=783485 --- src/st/st-theme-node.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/st/st-theme-node.c b/src/st/st-theme-node.c index 6608efb9d..877cf1da1 100644 --- a/src/st/st-theme-node.c +++ b/src/st/st-theme-node.c @@ -3198,11 +3198,13 @@ parse_shadow_property (StThemeNode *node, gdouble *yoffset, gdouble *blur, gdouble *spread, - gboolean *inset) + gboolean *inset, + gboolean *is_none) { GetFromTermResult result; CRTerm *term; int n_offsets = 0; + *is_none = FALSE; /* default values */ color->red = 0x0; color->green = 0x0; color->blue = 0x0; color->alpha = 0xff; @@ -3224,8 +3226,10 @@ parse_shadow_property (StThemeNode *node, for (term = decl->value; term; term = term->next) { /* if we found "none", we're all set with the default values */ - if (term_is_none (term)) + if (term_is_none (term)) { + *is_none = TRUE; return VALUE_FOUND; + } if (term->type == TERM_NUMBER) { @@ -3324,7 +3328,8 @@ parse_shadow_property (StThemeNode *node, * See also st_theme_node_get_shadow(), which provides a simpler API. * * Return value: %TRUE if the property was found in the properties for this - * theme node (or in the properties of parent nodes when inheriting.) + * theme node (or in the properties of parent nodes when inheriting.), %FALSE + * if the property was not found, or was explicitly set to 'none'. */ gboolean st_theme_node_lookup_shadow (StThemeNode *node, @@ -3338,6 +3343,7 @@ st_theme_node_lookup_shadow (StThemeNode *node, gdouble blur = 0.; gdouble spread = 0.; gboolean inset = FALSE; + gboolean is_none = FALSE; int i; @@ -3356,9 +3362,13 @@ st_theme_node_lookup_shadow (StThemeNode *node, &yoffset, &blur, &spread, - &inset); + &inset, + &is_none); if (result == VALUE_FOUND) { + if (is_none) + return FALSE; + *shadow = st_shadow_new (&color, xoffset, yoffset, blur, spread,