[gtk/css-lookup-caching: 14/26] Pass a lookup to gtk_css_static_style_new_compute
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/css-lookup-caching: 14/26] Pass a lookup to gtk_css_static_style_new_compute
- Date: Thu, 13 Feb 2020 23:14:21 +0000 (UTC)
commit 40684ca4aef1ca61833fc6cc51ab42caab4c55c6
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Feb 10 19:15:44 2020 -0500
Pass a lookup to gtk_css_static_style_new_compute
Allow passing a lookup to gtk_css_static_Style_new_compute
to bypass the matching and just resolve the style based
on that lookup.
Update all callers to pass NULL for now.
gtk/gtkcssnode.c | 1 +
gtk/gtkcssstaticstyle.c | 25 ++++++++++++++++---------
gtk/gtkcssstaticstyleprivate.h | 1 +
3 files changed, 18 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtkcssnode.c b/gtk/gtkcssnode.c
index 4932447955..837f364af0 100644
--- a/gtk/gtkcssnode.c
+++ b/gtk/gtkcssnode.c
@@ -385,6 +385,7 @@ gtk_css_node_create_style (GtkCssNode *cssnode,
style = gtk_css_static_style_new_compute (gtk_css_node_get_style_provider (cssnode),
filter,
cssnode,
+ NULL,
style_change);
store_in_global_parent_cache (cssnode, decl, style);
diff --git a/gtk/gtkcssstaticstyle.c b/gtk/gtkcssstaticstyle.c
index a71a47d0b5..04c4984183 100644
--- a/gtk/gtkcssstaticstyle.c
+++ b/gtk/gtkcssstaticstyle.c
@@ -707,6 +707,7 @@ gtk_css_static_style_get_default (void)
default_style = gtk_css_static_style_new_compute (GTK_STYLE_PROVIDER (settings),
&filter,
NULL,
+ NULL,
0);
g_object_set_data_full (G_OBJECT (settings), I_("gtk-default-style"),
default_style, clear_default_style);
@@ -993,20 +994,26 @@ GtkCssStyle *
gtk_css_static_style_new_compute (GtkStyleProvider *provider,
const GtkCountingBloomFilter *filter,
GtkCssNode *node,
+ GtkCssLookup *lookup,
GtkCssChange change)
{
GtkCssStaticStyle *result;
- GtkCssLookup *lookup;
GtkCssNode *parent;
- lookup = gtk_css_lookup_new ();
-
- if (node)
- gtk_style_provider_lookup (provider,
- filter,
- node,
- lookup,
- change == 0 ? &change : NULL);
+ if (lookup != NULL && change != 0)
+ {
+ gtk_css_lookup_ref (lookup);
+ }
+ else
+ {
+ lookup = gtk_css_lookup_new ();
+ if (node)
+ gtk_style_provider_lookup (provider,
+ filter,
+ node,
+ lookup,
+ change == 0 ? &change : NULL);
+ }
result = g_object_new (GTK_TYPE_CSS_STATIC_STYLE, NULL);
diff --git a/gtk/gtkcssstaticstyleprivate.h b/gtk/gtkcssstaticstyleprivate.h
index 0244c8ee44..a3b62f59b1 100644
--- a/gtk/gtkcssstaticstyleprivate.h
+++ b/gtk/gtkcssstaticstyleprivate.h
@@ -58,6 +58,7 @@ GtkCssStyle * gtk_css_static_style_get_default (void);
GtkCssStyle * gtk_css_static_style_new_compute (GtkStyleProvider *provider,
const GtkCountingBloomFilter *filter,
GtkCssNode *node,
+ GtkCssLookup *lookup,
GtkCssChange change);
GtkCssChange gtk_css_static_style_get_change (GtkCssStaticStyle *style);
GtkCssLookup * gtk_css_static_style_get_lookup (GtkCssStaticStyle *style);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]