cssvalue: Don't call compute() for already computed css values
authorTimm Bäder <mail@baedert.org>
Sat, 11 Jan 2020 11:56:40 +0000 (12:56 +0100)
committerTimm Bäder <mail@baedert.org>
Sat, 18 Jan 2020 07:49:51 +0000 (08:49 +0100)
As per the previous commit, this is unnecessary.

Even with the small amount of css values we mark as is_computed, we
already skip computing over 60% of them like this during the startup of
the widget factory.

gtk/gtkcssvalue.c

index 25554be6b309683395c9ad0509b88c8c815a03ee..87deca7545d9220b8e1982813bbadba9e612ccf6 100644 (file)
@@ -140,6 +140,9 @@ _gtk_css_value_compute (GtkCssValue      *value,
                         GtkCssStyle      *style,
                         GtkCssStyle      *parent_style)
 {
+  if (gtk_css_value_is_computed (value))
+    return _gtk_css_value_ref (value);
+
   return value->class->compute (value, property_id, provider, style, parent_style);
 }