[gtk/css-lookup-caching: 16/26] cssnode: Reused cached lookups
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/css-lookup-caching: 16/26] cssnode: Reused cached lookups
- Date: Thu, 13 Feb 2020 23:14:31 +0000 (UTC)
commit c131520e7f239265a31a5d1435eb664e9edba203
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Feb 10 19:32:25 2020 -0500
cssnode: Reused cached lookups
When we determine that the lookup won't change,
reuse the cached lookup by passing it to
to gtk_css_static_style_new_compute.
gtk/gtkcssnode.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkcssnode.c b/gtk/gtkcssnode.c
index 5e6d320380..899f527356 100644
--- a/gtk/gtkcssnode.c
+++ b/gtk/gtkcssnode.c
@@ -364,6 +364,7 @@ gtk_css_node_create_style (GtkCssNode *cssnode,
const GtkCssNodeDeclaration *decl;
GtkCssStyle *style;
GtkCssChange style_change;
+ GtkCssLookup *lookup;
style_change = gtk_css_static_style_get_change (GTK_CSS_STATIC_STYLE (static_style));
@@ -378,13 +379,19 @@ gtk_css_node_create_style (GtkCssNode *cssnode,
created_styles++;
- if (change & GTK_CSS_CHANGE_NEEDS_RECOMPUTE)
+ if ((change & GTK_CSS_CHANGE_SOURCE) == 0 &&
+ (change & style_change) == 0)
+ lookup = gtk_css_static_style_get_lookup (GTK_CSS_STATIC_STYLE (static_style));
+ else
+ lookup = NULL;
+
+ if ((change & GTK_CSS_CHANGE_NEEDS_RECOMPUTE) != 0)
style_change = 0;
style = gtk_css_static_style_new_compute (gtk_css_node_get_style_provider (cssnode),
filter,
cssnode,
- NULL,
+ lookup,
style_change);
store_in_global_parent_cache (cssnode, decl, style);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]