[gtk/wip/baedert/css-values: 4/7] cssvalue: Don't call compute() for already computed css values



commit ab78c1923644d6ea532982815a8deb55169c88ae
Author: Timm Bäder <mail baedert org>
Date:   Sat Jan 11 12:56:40 2020 +0100

    cssvalue: Don't call compute() for already computed css values
    
    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 | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/gtk/gtkcssvalue.c b/gtk/gtkcssvalue.c
index 25554be6b3..87deca7545 100644
--- a/gtk/gtkcssvalue.c
+++ b/gtk/gtkcssvalue.c
@@ -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);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]