summaryrefslogtreecommitdiff
path: root/gtk/gtkcssnodestylecache.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2016-01-16 04:55:58 +0100
committerBenjamin Otte <otte@redhat.com>2016-01-16 23:58:37 +0100
commitc904efef5381a7b058ed17c077059707909e86d1 (patch)
tree39cb33da644d7f93289f6b83a23f527f3b0c84e3 /gtk/gtkcssnodestylecache.c
parent024429f76fc605e834fef3ca654a0d0cdaac1dfa (diff)
downloadgtk+-c904efef5381a7b058ed17c077059707909e86d1.tar.gz
cssnode: Redo GTK_DEBUG=no-css-cache
Previously this setting would just invalidate the whole CSS tree and thereby hopefully avoid all cache usage. Now, we actually don't cause extra invalidations anymore, but instead avoid ever inserting anything into the cache when this setting is set.
Diffstat (limited to 'gtk/gtkcssnodestylecache.c')
-rw-r--r--gtk/gtkcssnodestylecache.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gtk/gtkcssnodestylecache.c b/gtk/gtkcssnodestylecache.c
index 8c250bcac6..b07776d666 100644
--- a/gtk/gtkcssnodestylecache.c
+++ b/gtk/gtkcssnodestylecache.c
@@ -19,6 +19,7 @@
#include "gtkcssnodestylecacheprivate.h"
+#include "gtkdebug.h"
#include "gtkcssstaticstyleprivate.h"
struct _GtkCssNodeStyleCache {
@@ -78,6 +79,18 @@ may_be_stored_in_cache (GtkCssStyle *style)
{
GtkCssChange change;
+ /* If you run your application with
+ * GTK_DEBUG=no-css-cache
+ * no caching will happen. This is slow (in particular
+ * when animating), but useful for figuring out bugs.
+ *
+ * We achieve that by disallowing any inserts into caches here.
+ */
+#ifdef G_ENABLE_DEBUG
+ if (GTK_DEBUG_CHECK (NO_CSS_CACHE))
+ return FALSE;
+#endif
+
if (!GTK_IS_CSS_STATIC_STYLE (style))
return FALSE;