[gnome-shell] st: fix "text-shadow: none" to correctly draw no shadow



commit 2e1e00c3de747b9208fcd8fd6a1b713d99adc932
Author: Matt Watson <mattdangerw gmail com>
Date:   Tue Mar 10 17:25:38 2015 -0700

    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 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/src/st/st-theme-node.c b/src/st/st-theme-node.c
index 6608efb..877cf1d 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,


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