Commit 3e5280ae authored by Benjamin Otte's avatar Benjamin Otte

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.
parent 136a3211
......@@ -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;
......
......@@ -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);
}
/**
......
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment