[gtk/line-height-percentage] css: Fix handling of percentage for line-height




commit 551247b7346e9d0be9d7393a44b9b06f80bf4ee6
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Oct 18 16:45:10 2021 -0400

    css: Fix handling of percentage for line-height
    
    We weren't doing the right thing here.
    This is simpler, and works.
    
    Fixes: #3254

 gtk/gtkcsslineheightvalue.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
---
diff --git a/gtk/gtkcsslineheightvalue.c b/gtk/gtkcsslineheightvalue.c
index c9104cee24..4472f503bc 100644
--- a/gtk/gtkcsslineheightvalue.c
+++ b/gtk/gtkcsslineheightvalue.c
@@ -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;


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