symboliccolor: Parse 'currentColor' everywhere

This commit is contained in:
Benjamin Otte 2012-04-05 22:22:52 +02:00
parent 83be7e5dbd
commit 51da8cb263
5 changed files with 16 additions and 44 deletions

View File

@ -236,10 +236,7 @@ _gtk_css_shadow_value_parse (GtkCssParser *parser)
{ {
GtkSymbolicColor *symbolic; GtkSymbolicColor *symbolic;
if (_gtk_css_parser_try (parser, "currentcolor", TRUE)) symbolic = _gtk_css_parser_read_symbolic_color (parser);
symbolic = gtk_symbolic_color_ref (_gtk_symbolic_color_get_current_color ());
else
symbolic = _gtk_css_parser_read_symbolic_color (parser);
if (symbolic == NULL) if (symbolic == NULL)
goto fail; goto fail;

View File

@ -221,16 +221,9 @@ parse_border_color (GtkCssShorthandProperty *shorthand,
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
if (_gtk_css_parser_try (parser, "currentcolor", TRUE)) symbolic = _gtk_css_parser_read_symbolic_color (parser);
{ if (symbolic == NULL)
symbolic = gtk_symbolic_color_ref (_gtk_symbolic_color_get_current_color ()); return FALSE;
}
else
{
symbolic = _gtk_css_parser_read_symbolic_color (parser);
if (symbolic == NULL)
return FALSE;
}
values[i] = _gtk_css_value_new_take_symbolic_color (symbolic); values[i] = _gtk_css_value_new_take_symbolic_color (symbolic);

View File

@ -169,16 +169,9 @@ rgba_value_parse (GtkCssParser *parser,
GtkSymbolicColor *symbolic; GtkSymbolicColor *symbolic;
GdkRGBA rgba; GdkRGBA rgba;
if (_gtk_css_parser_try (parser, "currentcolor", TRUE)) symbolic = _gtk_css_parser_read_symbolic_color (parser);
{ if (symbolic == NULL)
symbolic = gtk_symbolic_color_ref (_gtk_symbolic_color_get_current_color ()); return FALSE;
}
else
{
symbolic = _gtk_css_parser_read_symbolic_color (parser);
if (symbolic == NULL)
return FALSE;
}
if (gtk_symbolic_color_resolve (symbolic, NULL, &rgba)) if (gtk_symbolic_color_resolve (symbolic, NULL, &rgba))
{ {
@ -312,16 +305,9 @@ symbolic_color_value_parse (GtkCssParser *parser,
{ {
GtkSymbolicColor *symbolic; GtkSymbolicColor *symbolic;
if (_gtk_css_parser_try (parser, "currentcolor", TRUE)) symbolic = _gtk_css_parser_read_symbolic_color (parser);
{ if (symbolic == NULL)
symbolic = gtk_symbolic_color_ref (_gtk_symbolic_color_get_current_color ()); return FALSE;
}
else
{
symbolic = _gtk_css_parser_read_symbolic_color (parser);
if (symbolic == NULL)
return FALSE;
}
g_value_take_boxed (value, symbolic); g_value_take_boxed (value, symbolic);
return TRUE; return TRUE;

View File

@ -183,16 +183,9 @@ color_parse (GtkCssStyleProperty *property,
{ {
GtkSymbolicColor *symbolic; GtkSymbolicColor *symbolic;
if (_gtk_css_parser_try (parser, "currentcolor", TRUE)) symbolic = _gtk_css_parser_read_symbolic_color (parser);
{ if (symbolic == NULL)
symbolic = gtk_symbolic_color_ref (_gtk_symbolic_color_get_current_color ()); return NULL;
}
else
{
symbolic = _gtk_css_parser_read_symbolic_color (parser);
if (symbolic == NULL)
return NULL;
}
return _gtk_css_value_new_take_symbolic_color (symbolic); return _gtk_css_value_new_take_symbolic_color (symbolic);
} }

View File

@ -1039,6 +1039,9 @@ _gtk_css_parser_read_symbolic_color (GtkCssParser *parser)
g_return_val_if_fail (parser != NULL, NULL); g_return_val_if_fail (parser != NULL, NULL);
if (_gtk_css_parser_try (parser, "currentColor", TRUE))
return gtk_symbolic_color_ref (_gtk_symbolic_color_get_current_color ());
if (_gtk_css_parser_try (parser, "transparent", TRUE)) if (_gtk_css_parser_try (parser, "transparent", TRUE))
{ {
GdkRGBA transparent = { 0, 0, 0, 0 }; GdkRGBA transparent = { 0, 0, 0, 0 };