[gtk+] styleproperty: Fix 'currentColor'



commit 4a33eb1aae4672ef9a249a099b0191a882859704
Author: Benjamin Otte <otte redhat com>
Date:   Thu Jan 12 04:35:36 2012 +0100

    styleproperty: Fix 'currentColor'
    
    It was always looking at the 'color' keyword for the parent context
    instead of only doing that when used with the 'color' property.
    
    Tested by border-color-default.ui reftest.

 gtk/gtkcssstylepropertyimpl.c |   24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkcssstylepropertyimpl.c b/gtk/gtkcssstylepropertyimpl.c
index 2cb5ac1..fbc0fc2 100644
--- a/gtk/gtkcssstylepropertyimpl.c
+++ b/gtk/gtkcssstylepropertyimpl.c
@@ -58,15 +58,27 @@ restart:
 
   if (G_VALUE_HOLDS (specified, GTK_TYPE_CSS_SPECIAL_VALUE))
     {
-      GtkStyleContext *parent = gtk_style_context_get_parent (context);
       g_assert (g_value_get_enum (specified) == GTK_CSS_CURRENT_COLOR);
 
-      if (parent)
-        g_value_copy (_gtk_style_context_peek_property (parent, "color"), computed);
+      /* The computed value of the âcurrentColorâ keyword is the computed
+       * value of the âcolorâ property. If the âcurrentColorâ keyword is
+       * set on the âcolorâ property itself, it is treated as âcolor: inheritâ. 
+       */
+      if (g_str_equal (_gtk_style_property_get_name (GTK_STYLE_PROPERTY (property)), "color"))
+        {
+          GtkStyleContext *parent = gtk_style_context_get_parent (context);
+
+          if (parent)
+            g_value_copy (_gtk_style_context_peek_property (parent, "color"), computed);
+          else
+            _gtk_css_style_compute_value (computed,
+                                          context,
+                                          _gtk_css_style_property_get_initial_value (property));
+        }
       else
-        _gtk_css_style_compute_value (computed,
-                                      context,
-                                      _gtk_css_style_property_get_initial_value (property));
+        {
+          g_value_copy (_gtk_style_context_peek_property (context, "color"), computed);
+        }
     }
   else if (G_VALUE_HOLDS (specified, GTK_TYPE_SYMBOLIC_COLOR))
     {



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