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



commit b1b452b09bd4d0f71746aee7874dfe5143ea08ce
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 57e0852..dfd8ccf 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -681,10 +681,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;
@@ -695,7 +726,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),
@@ -743,13 +774,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;
     }
@@ -776,7 +807,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;
@@ -2657,7 +2688,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);
     }
@@ -2836,7 +2867,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]