diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-01-10 10:04:22 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-01-10 14:50:13 -0500 |
commit | 4f6ea7c418fb06c88c425012e3541305906f048d (patch) | |
tree | b04320f8e2ef2854e619ac07848eeb8d285f76be /gtk/gtkcssvalue.c | |
parent | ba8f39a90a4a2c4380c46e848f892cdb33ffac0c (diff) | |
download | gtk+-matthiasc/css-values.tar.gz |
wip: static valuesmatthiasc/css-values
Determine whether a css value is 'static' at creation
time. Static values don't need to have compute() called,
since their value is always the same, so we can just
ref them.
Diffstat (limited to 'gtk/gtkcssvalue.c')
-rw-r--r-- | gtk/gtkcssvalue.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gtk/gtkcssvalue.c b/gtk/gtkcssvalue.c index 63a23b0f6c..c925668657 100644 --- a/gtk/gtkcssvalue.c +++ b/gtk/gtkcssvalue.c @@ -80,6 +80,7 @@ _gtk_css_value_alloc (const GtkCssValueClass *klass, value->class = klass; value->ref_count = 1; + value->is_static = FALSE; count_value (klass->type_name, 1); @@ -133,7 +134,10 @@ _gtk_css_value_compute (GtkCssValue *value, GtkCssStyle *style, GtkCssStyle *parent_style) { - return value->class->compute (value, property_id, provider, style, parent_style); + if (value->is_static) + return _gtk_css_value_ref (value); + else + return value->class->compute (value, property_id, provider, style, parent_style); } gboolean |