css: Add <time> type to css number stuff

This commit is contained in:
Benjamin Otte 2012-04-01 04:02:34 +02:00
parent 68b7d3e410
commit 662d6787f3
4 changed files with 15 additions and 3 deletions

View File

@ -76,6 +76,8 @@ gtk_css_value_number_print (const GtkCssValue *number,
/* [GTK_CSS_DEG] = */ "deg",
/* [GTK_CSS_GRAD] = */ "grad",
/* [GTK_CSS_TURN] = */ "turn",
/* [GTK_CSS_S] = */ "s",
/* [GTK_CSS_MS] = */ "ms",
};
g_ascii_dtostr (buf, sizeof (buf), number->value);
@ -167,6 +169,7 @@ _gtk_css_number_value_compute (GtkCssValue *number,
case GTK_CSS_NUMBER:
case GTK_CSS_PX:
case GTK_CSS_DEG:
case GTK_CSS_S:
return _gtk_css_value_ref (number);
case GTK_CSS_PT:
return _gtk_css_number_value_new (number->value * 96.0 / 72.0,
@ -206,6 +209,9 @@ _gtk_css_number_value_compute (GtkCssValue *number,
case GTK_CSS_TURN:
return _gtk_css_number_value_new (number->value * 360.0,
GTK_CSS_DEG);
case GTK_CSS_MS:
return _gtk_css_number_value_new (number->value / 1000.0,
GTK_CSS_S);
}
}

View File

@ -572,7 +572,9 @@ _gtk_css_parser_read_number (GtkCssParser *parser,
{ "rad", GTK_CSS_RAD, GTK_CSS_PARSE_ANGLE },
{ "deg", GTK_CSS_DEG, GTK_CSS_PARSE_ANGLE },
{ "grad", GTK_CSS_GRAD, GTK_CSS_PARSE_ANGLE },
{ "turn", GTK_CSS_TURN, GTK_CSS_PARSE_ANGLE }
{ "turn", GTK_CSS_TURN, GTK_CSS_PARSE_ANGLE },
{ "s", GTK_CSS_S, GTK_CSS_PARSE_TIME },
{ "ms", GTK_CSS_MS, GTK_CSS_PARSE_TIME }
};
char *end, *unit;

View File

@ -30,7 +30,8 @@ typedef enum /*< skip >*/ {
GTK_CSS_PARSE_NUMBER = (1 << 2),
GTK_CSS_NUMBER_AS_PIXELS = (1 << 3),
GTK_CSS_PARSE_LENGTH = (1 << 4),
GTK_CSS_PARSE_ANGLE = (1 << 5)
GTK_CSS_PARSE_ANGLE = (1 << 5),
GTK_CSS_PARSE_TIME = (1 << 6)
} GtkCssNumberParseFlags;
typedef struct _GtkCssParser GtkCssParser;

View File

@ -176,7 +176,10 @@ typedef enum /*< skip >*/ {
GTK_CSS_RAD,
GTK_CSS_DEG,
GTK_CSS_GRAD,
GTK_CSS_TURN
GTK_CSS_TURN,
/* CSS term: <time> */
GTK_CSS_S,
GTK_CSS_MS,
} GtkCssUnit;
typedef struct _GtkCssNumber GtkCssNumber;