[gtk+/wip/cssstyle: 9/27] stylecontext: Split function



commit 8455ff026c6b303478d89db0dc51c6ba6943852c
Author: Benjamin Otte <otte redhat com>
Date:   Sun Dec 14 15:46:18 2014 +0100

    stylecontext: Split function

 gtk/gtkstylecontext.c |   45 ++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 38 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 06cf07c..8f6c0d2 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -669,10 +669,41 @@ create_query_path (GtkStyleContext             *context,
 }
 
 static void
+update_properties (GtkStyleContext             *context,
+                   GtkCssStyle                 *style,
+                   const GtkCssNodeDeclaration *decl,
+                   const GtkBitmask            *relevant_changes)
+{
+  GtkStyleContextPrivate *priv;
+  GtkCssMatcher matcher;
+  GtkWidgetPath *path;
+  GtkCssLookup *lookup;
+
+  priv = context->priv;
+
+  path = create_query_path (context, decl);
+  lookup = _gtk_css_lookup_new (relevant_changes);
+
+  if (_gtk_css_matcher_init (&matcher, path))
+    _gtk_style_provider_private_lookup (GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),
+                                        &matcher,
+                                        lookup,
+                                        NULL);
+
+  _gtk_css_lookup_resolve (lookup, 
+                           GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),
+                          priv->scale,
+                           GTK_CSS_STATIC_STYLE (style),
+                           priv->parent ? style_values_lookup (priv->parent) : NULL);
+
+  _gtk_css_lookup_free (lookup);
+  gtk_widget_path_free (path);
+}
+
+static void
 build_properties (GtkStyleContext             *context,
                   GtkCssStyle                 *style,
                   const GtkCssNodeDeclaration *decl,
-                  const GtkBitmask            *relevant_changes,
                   GtkCssChange                *out_change)
 {
   GtkStyleContextPrivate *priv;
@@ -683,7 +714,7 @@ build_properties (GtkStyleContext             *context,
   priv = context->priv;
 
   path = create_query_path (context, decl);
-  lookup = _gtk_css_lookup_new (relevant_changes);
+  lookup = _gtk_css_lookup_new (NULL);
 
   if (_gtk_css_matcher_init (&matcher, path))
     _gtk_style_provider_private_lookup (GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),
@@ -731,13 +762,13 @@ style_values_lookup (GtkStyleContext *context)
                            gtk_css_node_declaration_ref (info->decl),
                            g_object_ref (values));
 
-      build_properties (context, values, info->decl, NULL, NULL);
+      build_properties (context, values, info->decl, NULL);
     }
   else
     {
       values = gtk_css_animated_style_new ();
 
-      build_properties (context, GTK_CSS_ANIMATED_STYLE (values)->style, info->decl, NULL, 
&priv->relevant_changes);
+      build_properties (context, GTK_CSS_ANIMATED_STYLE (values)->style, info->decl, 
&priv->relevant_changes);
       /* These flags are always relevant */
       priv->relevant_changes |= GTK_CSS_CHANGE_SOURCE;
     }
@@ -764,7 +795,7 @@ style_values_lookup_for_state (GtkStyleContext *context,
   decl = gtk_css_node_declaration_ref (context->priv->info->decl);
   gtk_css_node_declaration_set_state (&decl, state);
   values = gtk_css_static_style_new ();
-  build_properties (context, values, decl, NULL, NULL);
+  build_properties (context, values, decl, NULL);
   gtk_css_node_declaration_unref (decl);
 
   return values;
@@ -2649,7 +2680,7 @@ gtk_style_context_update_cache (GtkStyleContext  *context,
       changes = gtk_css_style_compute_dependencies (values, parent_changes);
 
       if (!_gtk_bitmask_is_empty (changes))
-       build_properties (context, values, decl, changes, NULL);
+       update_properties (context, values, decl, changes);
 
       _gtk_bitmask_free (changes);
     }
@@ -2828,7 +2859,7 @@ _gtk_style_context_validate (GtkStyleContext  *context,
     {
       changes = gtk_css_style_compute_dependencies (current, parent_changes);
       if (!_gtk_bitmask_is_empty (changes))
-       build_properties (context, GTK_CSS_ANIMATED_STYLE (current)->style, info->decl, changes, NULL);
+       update_properties (context, GTK_CSS_ANIMATED_STYLE (current)->style, info->decl, changes);
 
       gtk_style_context_update_cache (context, parent_changes);
     }


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