css: Fix handling of percentage for line-height
authorMatthias Clasen <mclasen@redhat.com>
Mon, 18 Oct 2021 20:45:10 +0000 (16:45 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 18 Oct 2021 20:53:46 +0000 (16:53 -0400)
We weren't doing the right thing here.
This is simpler, and works.

Fixes: #4354
gtk/gtkcsslineheightvalue.c

index c9104cee24bbf6211e06ca6aea361800faef508f..4472f503bcbd761229cb563de039b72a63b10003 100644 (file)
@@ -52,19 +52,11 @@ gtk_css_value_line_height_compute (GtkCssValue      *value,
   if (gtk_css_number_value_get_dimension (height) == GTK_CSS_DIMENSION_PERCENTAGE)
     {
       double factor;
-      GtkCssValue *val;
       GtkCssValue *computed;
 
-      factor =  _gtk_css_number_value_get (height, 1);
-      val = gtk_css_dimension_value_new (factor, GTK_CSS_EM);
+      factor = _gtk_css_number_value_get (height, 1);
+      computed = gtk_css_number_value_multiply (style->core->font_size, factor);
 
-      computed = _gtk_css_value_compute (val,
-                                         GTK_CSS_PROPERTY_FONT_SIZE,
-                                         provider,
-                                         style,
-                                         parent_style);
-
-      _gtk_css_value_unref (val);
       _gtk_css_value_unref (height);
 
       return computed;