Commit 0e7691c1 authored by Benjamin Otte's avatar Benjamin Otte

css: Add rem unit

Good luck, Lapo.
parent f7ec9c98
......@@ -117,29 +117,27 @@ gtk_css_value_number_compute (GtkCssValue *number,
case GTK_CSS_PC:
return _gtk_css_number_value_new (number->value * 96.0 / 72.0 * 12.0,
GTK_CSS_PX);
break;
case GTK_CSS_IN:
return _gtk_css_number_value_new (number->value * 96.0,
GTK_CSS_PX);
break;
case GTK_CSS_CM:
return _gtk_css_number_value_new (number->value * 96.0 * 0.39370078740157477,
GTK_CSS_PX);
break;
case GTK_CSS_MM:
return _gtk_css_number_value_new (number->value * 96.0 * 0.039370078740157477,
GTK_CSS_PX);
break;
case GTK_CSS_EM:
return _gtk_css_number_value_new (number->value *
get_base_font_size (property_id, provider, style, parent_style),
GTK_CSS_PX);
break;
case GTK_CSS_EX:
/* for now we pretend ex is half of em */
return _gtk_css_number_value_new (number->value * 0.5 *
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),
GTK_CSS_PX);
case GTK_CSS_RAD:
return _gtk_css_number_value_new (number->value * 360.0 / (2 * G_PI),
GTK_CSS_DEG);
......@@ -191,6 +189,7 @@ gtk_css_value_number_print (const GtkCssValue *number,
/* [GTK_CSS_PT] = */ "pt",
/* [GTK_CSS_EM] = */ "em",
/* [GTK_CSS_EX] = */ "ex",
/* [GTK_CSS_REM] = */ "rem",
/* [GTK_CSS_PC] = */ "pc",
/* [GTK_CSS_IN] = */ "in",
/* [GTK_CSS_CM] = */ "cm",
......
......@@ -617,6 +617,7 @@ _gtk_css_number_value_parse (GtkCssParser *parser,
{ "pt", GTK_CSS_PT, GTK_CSS_PARSE_LENGTH },
{ "em", GTK_CSS_EM, GTK_CSS_PARSE_LENGTH },
{ "ex", GTK_CSS_EX, GTK_CSS_PARSE_LENGTH },
{ "rem", GTK_CSS_REM, GTK_CSS_PARSE_LENGTH },
{ "pc", GTK_CSS_PC, GTK_CSS_PARSE_LENGTH },
{ "in", GTK_CSS_IN, GTK_CSS_PARSE_LENGTH },
{ "cm", GTK_CSS_CM, GTK_CSS_PARSE_LENGTH },
......
......@@ -348,6 +348,7 @@ typedef enum /*< skip >*/ {
GTK_CSS_PT,
GTK_CSS_EM,
GTK_CSS_EX,
GTK_CSS_REM,
GTK_CSS_PC,
GTK_CSS_IN,
GTK_CSS_CM,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment