[gtk/css-lookup-caching: 11/26] lookup: Add a getter



commit 29f5767c1fec1e76c5b378a631d3dd7d36c8766d
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Feb 10 18:27:15 2020 -0500

    lookup: Add a getter
    
    This will make it easier to change the internals
    in the next commits.

 gtk/gtkcsslookupprivate.h | 7 +++++++
 gtk/gtkcssstaticstyle.c   | 5 +++--
 2 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkcsslookupprivate.h b/gtk/gtkcsslookupprivate.h
index aab2a3d197..49c2c0b1e9 100644
--- a/gtk/gtkcsslookupprivate.h
+++ b/gtk/gtkcsslookupprivate.h
@@ -58,6 +58,13 @@ gtk_css_lookup_get_set_values (const GtkCssLookup *lookup)
   return lookup->set_values;
 }
 
+static inline GtkCssLookupValue *
+gtk_css_lookup_get (GtkCssLookup *lookup,
+                    guint         id)
+{
+  return &lookup->values[id];
+} 
+
 G_END_DECLS
 
 #endif /* __GTK_CSS_LOOKUP_PRIVATE_H__ */
diff --git a/gtk/gtkcssstaticstyle.c b/gtk/gtkcssstaticstyle.c
index e8d7d6367d..c1ecbe4e97 100644
--- a/gtk/gtkcssstaticstyle.c
+++ b/gtk/gtkcssstaticstyle.c
@@ -207,12 +207,13 @@ gtk_css_ ## NAME ## _values_new_compute (GtkCssStaticStyle *sstyle, \
   for (i = 0; i < G_N_ELEMENTS (NAME ## _props); i++) \
     { \
       guint id = NAME ## _props[i]; \
+      GtkCssLookupValue *value = gtk_css_lookup_get (lookup, id); \
       gtk_css_static_style_compute_value (sstyle, \
                                           provider, \
                                           parent_style, \
                                           id, \
-                                          lookup->values[id].value, \
-                                          lookup->values[id].section); \
+                                          value ? value->value : NULL, \
+                                          value ? value->section : NULL); \
     } \
 } \
 static GtkBitmask * gtk_css_ ## NAME ## _values_mask; \


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