summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2015-04-27 19:15:43 +0200
committerBenjamin Otte <otte@redhat.com>2015-04-27 19:17:03 +0200
commit3e5280ae4dfd1950dbd56a781dcdcf34a26d4294 (patch)
treee3d28e8f0e957410020b68621ebe36eb23522281
parent136a32112fc7df1eff461b3687d3626dbbbc6d33 (diff)
downloadgtk+-3e5280ae4dfd1950dbd56a781dcdcf34a26d4294.tar.gz
stylecontext: Clear style property more frequently
We want to clear the style property cache whenever things change in the tree, not as we previously did only when those changes actually lead to a different CSS style.
-rw-r--r--gtk/gtkcsswidgetnode.c19
-rw-r--r--gtk/gtkstylecontext.c4
-rw-r--r--gtk/gtkstylecontextprivate.h1
3 files changed, 21 insertions, 3 deletions
diff --git a/gtk/gtkcsswidgetnode.c b/gtk/gtkcsswidgetnode.c
index 70ae532ecd..4e67b51c3c 100644
--- a/gtk/gtkcsswidgetnode.c
+++ b/gtk/gtkcsswidgetnode.c
@@ -77,6 +77,24 @@ gtk_css_widget_node_queue_callback (GtkWidget *widget,
return G_SOURCE_CONTINUE;
}
+static GtkCssStyle *
+gtk_css_widget_node_update_style (GtkCssNode *cssnode,
+ GtkCssChange change,
+ gint64 timestamp,
+ GtkCssStyle *style)
+{
+ GtkCssWidgetNode *widget_node = GTK_CSS_WIDGET_NODE (cssnode);
+
+ if (widget_node->widget != NULL)
+ {
+ GtkStyleContext *context = _gtk_widget_peek_style_context (widget_node->widget);
+ if (context)
+ gtk_style_context_clear_property_cache (context);
+ }
+
+ return GTK_CSS_NODE_CLASS (gtk_css_widget_node_parent_class)->update_style (cssnode, change, timestamp, style);
+}
+
static void
gtk_css_widget_node_queue_validate (GtkCssNode *node)
{
@@ -249,6 +267,7 @@ gtk_css_widget_node_class_init (GtkCssWidgetNodeClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = gtk_css_widget_node_finalize;
+ node_class->update_style = gtk_css_widget_node_update_style;
node_class->validate = gtk_css_widget_node_validate;
node_class->queue_validate = gtk_css_widget_node_queue_validate;
node_class->dequeue_validate = gtk_css_widget_node_dequeue_validate;
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 3786e356d5..db75a288fc 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -254,7 +254,7 @@ gtk_style_context_class_init (GtkStyleContextClass *klass)
GTK_PARAM_READWRITE));
}
-static void
+void
gtk_style_context_clear_property_cache (GtkStyleContext *context)
{
GtkStyleContextPrivate *priv = context->priv;
@@ -2417,8 +2417,6 @@ gtk_style_context_validate (GtkStyleContext *context,
{
if (!_gtk_bitmask_is_empty (changes))
gtk_style_context_do_invalidate (context, changes);
-
- gtk_style_context_clear_property_cache (context);
}
/**
diff --git a/gtk/gtkstylecontextprivate.h b/gtk/gtkstylecontextprivate.h
index 331eb60f69..40fd4f171f 100644
--- a/gtk/gtkstylecontextprivate.h
+++ b/gtk/gtkstylecontextprivate.h
@@ -47,6 +47,7 @@ const GValue * _gtk_style_context_peek_style_property (GtkStyleContext *c
GParamSpec *pspec);
void gtk_style_context_validate (GtkStyleContext *context,
const GtkBitmask*changes);
+void gtk_style_context_clear_property_cache (GtkStyleContext *context);
gboolean _gtk_style_context_check_region_name (const gchar *str);
gboolean _gtk_style_context_resolve_color (GtkStyleContext *context,