[gtk+/wip/cssstyle: 21/27] cssstaticstyle: Move function
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/cssstyle: 21/27] cssstaticstyle: Move function
- Date: Wed, 24 Dec 2014 02:21:09 +0000 (UTC)
commit 579775f8b1cdcdd946b3b21aecd84c7e61405385
Author: Benjamin Otte <otte redhat com>
Date: Wed Dec 17 05:52:13 2014 +0100
cssstaticstyle: Move function
We want the new() return values to be immutable, so we have to move the
code that modifes them.
gtk/gtkcssstaticstyle.c | 29 +++++++++++++++++++++++++++--
gtk/gtkcssstaticstyleprivate.h | 7 ++++++-
gtk/gtkstylecontext.c | 26 +++++++++++---------------
3 files changed, 44 insertions(+), 18 deletions(-)
---
diff --git a/gtk/gtkcssstaticstyle.c b/gtk/gtkcssstaticstyle.c
index 82066cf..2819fdb 100644
--- a/gtk/gtkcssstaticstyle.c
+++ b/gtk/gtkcssstaticstyle.c
@@ -177,9 +177,34 @@ gtk_css_static_style_set_value (GtkCssStaticStyle *style,
}
GtkCssStyle *
-gtk_css_static_style_new (void)
+gtk_css_static_style_new_compute (GtkStyleProviderPrivate *provider,
+ const GtkCssMatcher *matcher,
+ int scale,
+ GtkCssStyle *parent,
+ GtkCssChange *out_change)
{
- return g_object_new (GTK_TYPE_CSS_STATIC_STYLE, NULL);
+ GtkCssStaticStyle *result;
+ GtkCssLookup *lookup;
+
+ lookup = _gtk_css_lookup_new (NULL);
+
+ if (matcher)
+ _gtk_style_provider_private_lookup (provider,
+ matcher,
+ lookup,
+ out_change);
+
+ result = g_object_new (GTK_TYPE_CSS_STATIC_STYLE, NULL);
+
+ _gtk_css_lookup_resolve (lookup,
+ provider,
+ scale,
+ result,
+ parent);
+
+ _gtk_css_lookup_free (lookup);
+
+ return GTK_CSS_STYLE (result);
}
GtkCssStyle *
diff --git a/gtk/gtkcssstaticstyleprivate.h b/gtk/gtkcssstaticstyleprivate.h
index a18127b..09e2818 100644
--- a/gtk/gtkcssstaticstyleprivate.h
+++ b/gtk/gtkcssstaticstyleprivate.h
@@ -20,6 +20,7 @@
#ifndef __GTK_CSS_STATIC_STYLE_PRIVATE_H__
#define __GTK_CSS_STATIC_STYLE_PRIVATE_H__
+#include "gtk/gtkcssmatcherprivate.h"
#include "gtk/gtkcssstyleprivate.h"
G_BEGIN_DECLS
@@ -54,7 +55,11 @@ struct _GtkCssStaticStyleClass
GType gtk_css_static_style_get_type (void) G_GNUC_CONST;
-GtkCssStyle * gtk_css_static_style_new (void);
+GtkCssStyle * gtk_css_static_style_new_compute (GtkStyleProviderPrivate *provider,
+ const GtkCssMatcher *matcher,
+ int scale,
+ GtkCssStyle *parent,
+ GtkCssChange *out_change);
GtkCssStyle * gtk_css_static_style_copy (GtkCssStaticStyle *original,
const GtkBitmask *properties_to_not_copy);
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 7dd3a78..a9bdcc5 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -722,29 +722,25 @@ build_properties (GtkStyleContext *context,
GtkStyleContextPrivate *priv;
GtkCssMatcher matcher;
GtkWidgetPath *path;
- GtkCssLookup *lookup;
GtkCssStyle *style;
priv = context->priv;
- style = gtk_css_static_style_new ();
-
path = create_query_path (context, decl);
- lookup = _gtk_css_lookup_new (NULL);
if (_gtk_css_matcher_init (&matcher, path))
- _gtk_style_provider_private_lookup (GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),
- &matcher,
- lookup,
- out_change);
-
- _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);
+ style = gtk_css_static_style_new_compute (GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),
+ &matcher,
+ priv->scale,
+ priv->parent ? style_values_lookup (priv->parent) : NULL,
+ out_change);
+ else
+ style = gtk_css_static_style_new_compute (GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),
+ NULL,
+ priv->scale,
+ priv->parent ? style_values_lookup (priv->parent) : NULL,
+ out_change);
- _gtk_css_lookup_free (lookup);
gtk_widget_path_free (path);
return style;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]