stylecontext: Don't cache the root values

Those are the ones that are special and get animated. Caching them only
causes confusion.
This commit is contained in:
Benjamin Otte 2014-10-11 20:02:27 +02:00
parent 0d380f43d6
commit c38095faed

View File

@ -704,6 +704,17 @@ gtk_style_context_impl_get_property (GObject *object,
}
}
/* returns TRUE if someone called gtk_style_context_save() but hasnt
* called gtk_style_context_restore() yet.
* In those situations we dont invalidate the context when somebody
* changes state/regions/classes.
*/
static gboolean
gtk_style_context_is_saved (GtkStyleContext *context)
{
return context->priv->info->next != NULL;
}
static void
style_info_add_to_widget_path (GtkStyleInfo *info,
GtkWidgetPath *path,
@ -810,13 +821,17 @@ style_values_lookup (GtkStyleContext *context)
}
values = _gtk_css_computed_values_new ();
style_info_set_values (info, values);
g_hash_table_insert (priv->style_values,
style_info_copy (info),
values);
style_info_set_values (info, values);
if (gtk_style_context_is_saved (context))
g_hash_table_insert (priv->style_values,
style_info_copy (info),
g_object_ref (values));
build_properties (context, values, info, NULL);
g_object_unref (values);
return values;
}
@ -861,17 +876,6 @@ gtk_style_context_set_invalid (GtkStyleContext *context,
}
}
/* returns TRUE if someone called gtk_style_context_save() but hasnt
* called gtk_style_context_restore() yet.
* In those situations we dont invalidate the context when somebody
* changes state/regions/classes.
*/
static gboolean
gtk_style_context_is_saved (GtkStyleContext *context)
{
return context->priv->info->next != NULL;
}
static void
gtk_style_context_queue_invalidate_internal (GtkStyleContext *context,
GtkCssChange change)
@ -3080,10 +3084,6 @@ _gtk_style_context_validate (GtkStyleContext *context,
if (current)
{
changes = _gtk_css_computed_values_get_difference (values, current);
/* In the case where we keep the cache, we want unanimated values */
if (values != current)
_gtk_css_computed_values_cancel_animations (current);
}
else
{
@ -3094,6 +3094,8 @@ _gtk_style_context_validate (GtkStyleContext *context,
else
{
changes = _gtk_css_computed_values_compute_dependencies (current, parent_changes);
if (!_gtk_bitmask_is_empty (changes))
build_properties (context, current, info, changes);
gtk_style_context_update_cache (context, parent_changes);
}