[gtk/wip/baedert/css-values: 2/13] csscolorvalue: Don't resolve literal color values



commit 37e0422c04f0552e3114c37373cdbeb3185046f5
Author: Timm Bäder <mail baedert org>
Date:   Thu Jan 9 10:22:53 2020 +0100

    csscolorvalue: Don't resolve literal color values

 gtk/gtkcsscolorvalue.c | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkcsscolorvalue.c b/gtk/gtkcsscolorvalue.c
index dbb63ae780..b8cd6c1dab 100644
--- a/gtk/gtkcsscolorvalue.c
+++ b/gtk/gtkcsscolorvalue.c
@@ -136,7 +136,7 @@ gtk_css_value_color_compute (GtkCssValue      *value,
                              GtkCssStyle      *style,
                              GtkCssStyle      *parent_style)
 {
-  GtkCssValue *resolved, *current;
+  GtkCssValue *resolved;
 
   /* The computed value of the ‘currentColor’ keyword is the computed
    * value of the ‘color’ property. If the ‘currentColor’ keyword is
@@ -144,20 +144,31 @@ gtk_css_value_color_compute (GtkCssValue      *value,
    */
   if (property_id == GTK_CSS_PROPERTY_COLOR)
     {
+      GtkCssValue *current;
+
       if (parent_style)
         current = gtk_css_style_get_value (parent_style, GTK_CSS_PROPERTY_COLOR);
       else
         current = NULL;
+
+      resolved = _gtk_css_color_value_resolve (value,
+                                               provider,
+                                               current,
+                                               NULL);
+    }
+  else if (value->type == COLOR_TYPE_LITERAL)
+    {
+      resolved = _gtk_css_value_ref (value->last_value);
     }
   else
     {
-      current = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_COLOR);
+      GtkCssValue *current = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_COLOR);
+
+      resolved = _gtk_css_color_value_resolve (value,
+                                               provider,
+                                               current,
+                                               NULL);
     }
-  
-  resolved = _gtk_css_color_value_resolve (value,
-                                           provider,
-                                           current,
-                                           NULL);
 
   if (resolved == NULL)
     return gtk_css_value_color_get_fallback (property_id, provider, style, parent_style);


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