[gtk+/composite-templates] css: Pass relevant properties to css lookup code



commit 551c59debbde6883e1923a02b5ddfa8a01325889
Author: Benjamin Otte <otte redhat com>
Date:   Fri Aug 24 17:31:57 2012 +0200

    css: Pass relevant properties to css lookup code
    
    This is not used yet in this patch.

 gtk/gtkcsslookup.c        |   18 ++++++++++++++----
 gtk/gtkcsslookupprivate.h |    2 +-
 gtk/gtkstylecontext.c     |    2 +-
 3 files changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkcsslookup.c b/gtk/gtkcsslookup.c
index e0f0af7..67d7b1c 100644
--- a/gtk/gtkcsslookup.c
+++ b/gtk/gtkcsslookup.c
@@ -36,14 +36,22 @@ struct _GtkCssLookup {
 };
 
 GtkCssLookup *
-_gtk_css_lookup_new (void)
+_gtk_css_lookup_new (const GtkBitmask *relevant)
 {
   GtkCssLookup *lookup;
   guint n = _gtk_css_style_property_get_n_properties ();
 
   lookup = g_malloc0 (sizeof (GtkCssLookup) + sizeof (GtkCssLookupValue) * n);
-  lookup->missing = _gtk_bitmask_new ();
-  lookup->missing = _gtk_bitmask_invert_range (lookup->missing, 0, n);
+
+  if (relevant)
+    {
+      lookup->missing = _gtk_bitmask_copy (relevant);
+    }
+  else
+    {
+      lookup->missing = _gtk_bitmask_new ();
+      lookup->missing = _gtk_bitmask_invert_range (lookup->missing, 0, n);
+    }
 
   return lookup;
 }
@@ -169,11 +177,13 @@ _gtk_css_lookup_resolve (GtkCssLookup         *lookup,
                                             lookup->values[i].computed,
                                             0,
                                             lookup->values[i].section);
-      else
+      else if (lookup->values[i].value ||
+               _gtk_bitmask_get (lookup->missing, i))
         _gtk_css_computed_values_compute_value (values,
                                                 context,
                                                 i,
                                                 lookup->values[i].value,
                                                 lookup->values[i].section);
+      /* else not a relevant property */
     }
 }
diff --git a/gtk/gtkcsslookupprivate.h b/gtk/gtkcsslookupprivate.h
index 3e8824c..72b0b18 100644
--- a/gtk/gtkcsslookupprivate.h
+++ b/gtk/gtkcsslookupprivate.h
@@ -29,7 +29,7 @@ G_BEGIN_DECLS
 
 typedef struct _GtkCssLookup GtkCssLookup;
 
-GtkCssLookup *          _gtk_css_lookup_new                     (void);
+GtkCssLookup *          _gtk_css_lookup_new                     (const GtkBitmask   *relevant);
 void                    _gtk_css_lookup_free                    (GtkCssLookup       *lookup);
 
 const GtkBitmask *      _gtk_css_lookup_get_missing             (const GtkCssLookup *lookup);
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index a98f194..d1042b9 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -902,7 +902,7 @@ build_properties (GtkStyleContext *context,
 
   priv = context->priv;
 
-  lookup = _gtk_css_lookup_new ();
+  lookup = _gtk_css_lookup_new (NULL);
 
   if (_gtk_css_matcher_init (&matcher, path, state))
     _gtk_style_provider_private_lookup (GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),



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