css: Handle 'currentColor' special value
Computes to the value of the 'color' property, or when used on that property, is treated as 'inherit'.
This commit is contained in:
@ -173,6 +173,14 @@ rgba_value_parse (GtkCssParser *parser,
|
||||
GtkSymbolicColor *symbolic;
|
||||
GdkRGBA rgba;
|
||||
|
||||
if (_gtk_css_parser_try (parser, "currentcolor", TRUE))
|
||||
{
|
||||
g_value_unset (value);
|
||||
g_value_init (value, GTK_TYPE_CSS_SPECIAL_VALUE);
|
||||
g_value_set_enum (value, GTK_CSS_CURRENT_COLOR);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
symbolic = _gtk_css_parser_read_symbolic_color (parser);
|
||||
if (symbolic == NULL)
|
||||
return FALSE;
|
||||
@ -215,7 +223,12 @@ rgba_value_compute (GValue *computed,
|
||||
{
|
||||
GdkRGBA rgba, white = { 1, 1, 1, 1 };
|
||||
|
||||
if (G_VALUE_HOLDS (specified, GTK_TYPE_SYMBOLIC_COLOR))
|
||||
if (G_VALUE_HOLDS (specified, GTK_TYPE_CSS_SPECIAL_VALUE))
|
||||
{
|
||||
g_assert (g_value_get_enum (specified) == GTK_CSS_CURRENT_COLOR);
|
||||
g_value_copy (_gtk_style_context_peek_property (context, "color"), computed);
|
||||
}
|
||||
else if (G_VALUE_HOLDS (specified, GTK_TYPE_SYMBOLIC_COLOR))
|
||||
{
|
||||
if (_gtk_style_context_resolve_color (context,
|
||||
g_value_get_boxed (specified),
|
||||
|
Reference in New Issue
Block a user