[gtk+/wip/save-is-child: 2/4] stylecontext: Don't cache the root values
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/save-is-child: 2/4] stylecontext: Don't cache the root values
- Date: Sun, 12 Oct 2014 23:19:28 +0000 (UTC)
commit d9f487b2dbcdf909041a91d580e825b843737f89
Author: Benjamin Otte <otte redhat com>
Date: Sat Oct 11 20:02:27 2014 +0200
stylecontext: Don't cache the root values
Those are the ones that are special and get animated. Caching them only
causes confusion.
gtk/gtkstylecontext.c | 40 +++++++++++++++++++++-------------------
1 files changed, 21 insertions(+), 19 deletions(-)
---
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index e48aedd..5705ec6 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -704,6 +704,17 @@ gtk_style_context_impl_get_property (GObject *object,
}
}
+/* returns TRUE if someone called gtk_style_context_save() but hasn’t
+ * called gtk_style_context_restore() yet.
+ * In those situations we don’t 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 hasn’t
- * called gtk_style_context_restore() yet.
- * In those situations we don’t 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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]