[gtk+/wip/cssstyle: 6/27] stylecontext: Always pass the static style



commit 8506d9847c1e921b8d9ba832b460626237d79480
Author: Benjamin Otte <otte redhat com>
Date:   Mon Oct 27 00:25:18 2014 +0100

    stylecontext: Always pass the static style
    
    ... to build_properties.
    There is always one available, so we can insist on that one.
    
    This simplifies a bunch of code.

 gtk/gtkcssanimatedstyle.c        |   18 ------------------
 gtk/gtkcssanimatedstyleprivate.h |    7 -------
 gtk/gtkcsslookup.c               |   31 +++++++++----------------------
 gtk/gtkcsslookupprivate.h        |    4 ++--
 gtk/gtkstylecontext.c            |    9 ++++-----
 5 files changed, 15 insertions(+), 54 deletions(-)
---
diff --git a/gtk/gtkcssanimatedstyle.c b/gtk/gtkcssanimatedstyle.c
index 1d20c14..efbce24 100644
--- a/gtk/gtkcssanimatedstyle.c
+++ b/gtk/gtkcssanimatedstyle.c
@@ -127,24 +127,6 @@ gtk_css_animated_style_new (void)
 }
 
 void
-gtk_css_animated_style_compute_value (GtkCssAnimatedStyle     *style,
-                                      GtkStyleProviderPrivate *provider,
-                                      int                      scale,
-                                      GtkCssStyle             *parent_style,
-                                      guint                    id,
-                                      GtkCssValue             *specified,
-                                      GtkCssSection           *section)
-{
-  gtk_internal_return_if_fail (GTK_IS_CSS_ANIMATED_STYLE (style));
-  gtk_internal_return_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider));
-  gtk_internal_return_if_fail (parent_style == NULL || GTK_IS_CSS_STYLE (parent_style));
-
-  gtk_css_static_style_compute_value (GTK_CSS_STATIC_STYLE (style->style),
-                                      provider, scale, parent_style,
-                                      id, specified, section);
-}
-
-void
 gtk_css_animated_style_set_animated_value (GtkCssAnimatedStyle *style,
                                            guint                id,
                                            GtkCssValue         *value)
diff --git a/gtk/gtkcssanimatedstyleprivate.h b/gtk/gtkcssanimatedstyleprivate.h
index 141050f..ac8be9a 100644
--- a/gtk/gtkcssanimatedstyleprivate.h
+++ b/gtk/gtkcssanimatedstyleprivate.h
@@ -54,13 +54,6 @@ GType                   gtk_css_animated_style_get_type         (void) G_GNUC_CO
 
 GtkCssStyle *           gtk_css_animated_style_new              (void);
 
-void                    gtk_css_animated_style_compute_value    (GtkCssAnimatedStyle    *style,
-                                                                 GtkStyleProviderPrivate*provider,
-                                                                int                     scale,
-                                                                 GtkCssStyle            *parent_style,
-                                                                 guint                   id,
-                                                                 GtkCssValue            *specified,
-                                                                 GtkCssSection          *section);
 void                    gtk_css_animated_style_set_animated_value(GtkCssAnimatedStyle   *style,
                                                                  guint                   id,
                                                                  GtkCssValue            *value);
diff --git a/gtk/gtkcsslookup.c b/gtk/gtkcsslookup.c
index 0d0920f..c482231 100644
--- a/gtk/gtkcsslookup.c
+++ b/gtk/gtkcsslookup.c
@@ -19,8 +19,6 @@
 
 #include "gtkcsslookupprivate.h"
 
-#include "gtkcssanimatedstyleprivate.h"
-#include "gtkcssstaticstyleprivate.h"
 #include "gtkcssstylepropertyprivate.h"
 #include "gtkcsstypesprivate.h"
 #include "gtkprivatetypebuiltins.h"
@@ -108,14 +106,14 @@ void
 _gtk_css_lookup_resolve (GtkCssLookup            *lookup,
                          GtkStyleProviderPrivate *provider,
                         int                      scale,
-                         GtkCssStyle             *style,
+                         GtkCssStaticStyle       *style,
                          GtkCssStyle             *parent_style)
 {
   guint i, n;
 
   g_return_if_fail (lookup != NULL);
   g_return_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider));
-  g_return_if_fail (GTK_IS_CSS_STYLE (style));
+  g_return_if_fail (GTK_IS_CSS_STATIC_STYLE (style));
   g_return_if_fail (parent_style == NULL || GTK_IS_CSS_STYLE (parent_style));
 
   n = _gtk_css_style_property_get_n_properties ();
@@ -124,24 +122,13 @@ _gtk_css_lookup_resolve (GtkCssLookup            *lookup,
     {
       if (lookup->values[i].value ||
           _gtk_bitmask_get (lookup->missing, i))
-        {
-          if (GTK_IS_CSS_ANIMATED_STYLE (style))
-            gtk_css_animated_style_compute_value (GTK_CSS_ANIMATED_STYLE (style),
-                                                  provider,
-                                                  scale,
-                                                  parent_style,
-                                                  i,
-                                                  lookup->values[i].value,
-                                                  lookup->values[i].section);
-          else
-            gtk_css_static_style_compute_value (GTK_CSS_STATIC_STYLE (style),
-                                                provider,
-                                                scale,
-                                                parent_style,
-                                                i,
-                                                lookup->values[i].value,
-                                                lookup->values[i].section);
-        }
+        gtk_css_static_style_compute_value (GTK_CSS_STATIC_STYLE (style),
+                                            provider,
+                                            scale,
+                                            parent_style,
+                                            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 2b0c021..62c6a30 100644
--- a/gtk/gtkcsslookupprivate.h
+++ b/gtk/gtkcsslookupprivate.h
@@ -20,7 +20,7 @@
 
 #include <glib-object.h>
 #include "gtk/gtkbitmaskprivate.h"
-#include "gtk/gtkcssstyleprivate.h"
+#include "gtk/gtkcssstaticstyleprivate.h"
 #include "gtk/gtkcsssection.h"
 
 
@@ -51,7 +51,7 @@ void                    _gtk_css_lookup_set                     (GtkCssLookup
 void                    _gtk_css_lookup_resolve                 (GtkCssLookup               *lookup,
                                                                  GtkStyleProviderPrivate    *provider,
                                                                 int                         scale,
-                                                                 GtkCssStyle                *style,
+                                                                 GtkCssStaticStyle          *style,
                                                                  GtkCssStyle                *parent_style);
 
 static inline const GtkBitmask *
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 7758e91..b765290 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -694,7 +694,7 @@ build_properties (GtkStyleContext             *context,
   _gtk_css_lookup_resolve (lookup, 
                            GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),
                           priv->scale,
-                           style,
+                           GTK_CSS_STATIC_STYLE (style),
                            priv->parent ? style_values_lookup (priv->parent) : NULL);
 
   _gtk_css_lookup_free (lookup);
@@ -727,19 +727,18 @@ style_values_lookup (GtkStyleContext *context)
 
   if (gtk_style_context_is_saved (context))
     {
-<<<<<<< HEAD
       values = gtk_css_static_style_new ();
       g_hash_table_insert (priv->style_values,
                            gtk_css_node_declaration_ref (info->decl),
                            g_object_ref (values));
-    
+
       build_properties (context, values, info->decl, NULL, NULL);
     }
   else
     {
       values = gtk_css_animated_style_new ();
 
-      build_properties (context, values, info->decl, NULL, &priv->relevant_changes);
+      build_properties (context, GTK_CSS_ANIMATED_STYLE (values)->style, info->decl, NULL, 
&priv->relevant_changes);
       /* These flags are always relevant */
       priv->relevant_changes |= GTK_CSS_CHANGE_SOURCE;
     }
@@ -2830,7 +2829,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, current, info->decl, changes, NULL);
+       build_properties (context, GTK_CSS_ANIMATED_STYLE (current)->style, info->decl, changes, NULL);
 
       gtk_style_context_update_cache (context, parent_changes);
     }


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