summaryrefslogtreecommitdiff
path: root/gtk/gtkcssnumbervalue.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2016-02-05 14:42:41 +0100
committerBenjamin Otte <otte@redhat.com>2016-02-05 14:52:09 +0100
commite35e6abbb2ea824afd6db2d54d10666cd23ad54c (patch)
tree8af2d1b39e8a5568a501521729ed17d3791e19f9 /gtk/gtkcssnumbervalue.c
parent56b1b08bb8239ffa2431969cd037f0f7241a7c64 (diff)
downloadgtk+-e35e6abbb2ea824afd6db2d54d10666cd23ad54c.tar.gz
css: Properly convert em, ex and rem to pixels
The previous code converted to pt.
Diffstat (limited to 'gtk/gtkcssnumbervalue.c')
-rw-r--r--gtk/gtkcssnumbervalue.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gtk/gtkcssnumbervalue.c b/gtk/gtkcssnumbervalue.c
index 2524d46524..17322e316f 100644
--- a/gtk/gtkcssnumbervalue.c
+++ b/gtk/gtkcssnumbervalue.c
@@ -127,16 +127,17 @@ gtk_css_value_number_compute (GtkCssValue *number,
return _gtk_css_number_value_new (number->value * 96.0 * 0.039370078740157477,
GTK_CSS_PX);
case GTK_CSS_EM:
- return _gtk_css_number_value_new (number->value *
+ return _gtk_css_number_value_new (number->value * 96.0 / 72.0 *
get_base_font_size (property_id, provider, style, parent_style),
GTK_CSS_PX);
case GTK_CSS_EX:
/* for now we pretend ex is half of em */
- return _gtk_css_number_value_new (number->value * 0.5 *
+ return _gtk_css_number_value_new (number->value * 0.5 * 96.0 / 72.0 *
get_base_font_size (property_id, provider, style, parent_style),
GTK_CSS_PX);
case GTK_CSS_REM:
- return _gtk_css_number_value_new (number->value * _gtk_css_font_size_get_default (provider),
+ return _gtk_css_number_value_new (number->value * 96.0 / 72.0 *
+ _gtk_css_font_size_get_default (provider),
GTK_CSS_PX);
case GTK_CSS_RAD:
return _gtk_css_number_value_new (number->value * 360.0 / (2 * G_PI),