css: Simplify compute for font variations
authorMatthias Clasen <mclasen@redhat.com>
Fri, 10 Jan 2020 06:36:23 +0000 (01:36 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 10 Jan 2020 20:49:00 +0000 (15:49 -0500)
Just like font features, font variations are stored
as a hash table mapping strings to pure number values,
which never change during compute.

gtk/gtkcssfontvariationsvalue.c

index ed6dfd8e3bc5d08427feb94db8fcf6092727e8a3..e15a8c715b869d4533d3aa6c865afcee1e4fbe52 100644 (file)
@@ -56,29 +56,7 @@ gtk_css_value_font_variations_compute (GtkCssValue      *specified,
                                        GtkCssStyle      *style,
                                        GtkCssStyle      *parent_style)
 {
-  GHashTableIter iter;
-  gpointer name, coord;
-  GtkCssValue *computed_coord;
-  GtkCssValue *result;
-  gboolean changes = FALSE;
-
-  result = gtk_css_font_variations_value_new_empty ();
-
-  g_hash_table_iter_init (&iter, specified->axes);
-  while (g_hash_table_iter_next (&iter, &name, &coord))
-    {
-      computed_coord = _gtk_css_value_compute (coord, property_id, provider, style, parent_style);
-      changes |= computed_coord != coord;
-      gtk_css_font_variations_value_add_axis (result, name, computed_coord);
-    }
-
-  if (!changes)
-    {
-      _gtk_css_value_unref (result);
-      result = _gtk_css_value_ref (specified);
-    }
-
-  return result;
+  return _gtk_css_value_ref (specified);
 }
 
 static gboolean