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
This commit is contained in:
Matt Watson 2015-03-10 17:25:38 -07:00 committed by Cosimo Cecchi
parent e2838a7e06
commit 2e1e00c3de

View File

@ -3198,11 +3198,13 @@ parse_shadow_property (StThemeNode *node,
gdouble *yoffset, gdouble *yoffset,
gdouble *blur, gdouble *blur,
gdouble *spread, gdouble *spread,
gboolean *inset) gboolean *inset,
gboolean *is_none)
{ {
GetFromTermResult result; GetFromTermResult result;
CRTerm *term; CRTerm *term;
int n_offsets = 0; int n_offsets = 0;
*is_none = FALSE;
/* default values */ /* default values */
color->red = 0x0; color->green = 0x0; color->blue = 0x0; color->alpha = 0xff; 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) for (term = decl->value; term; term = term->next)
{ {
/* if we found "none", we're all set with the default values */ /* 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; return VALUE_FOUND;
}
if (term->type == TERM_NUMBER) 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. * 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 * 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 gboolean
st_theme_node_lookup_shadow (StThemeNode *node, st_theme_node_lookup_shadow (StThemeNode *node,
@ -3338,6 +3343,7 @@ st_theme_node_lookup_shadow (StThemeNode *node,
gdouble blur = 0.; gdouble blur = 0.;
gdouble spread = 0.; gdouble spread = 0.;
gboolean inset = FALSE; gboolean inset = FALSE;
gboolean is_none = FALSE;
int i; int i;
@ -3356,9 +3362,13 @@ st_theme_node_lookup_shadow (StThemeNode *node,
&yoffset, &yoffset,
&blur, &blur,
&spread, &spread,
&inset); &inset,
&is_none);
if (result == VALUE_FOUND) if (result == VALUE_FOUND)
{ {
if (is_none)
return FALSE;
*shadow = st_shadow_new (&color, *shadow = st_shadow_new (&color,
xoffset, yoffset, xoffset, yoffset,
blur, spread, blur, spread,