From 51da8cb263be618ec30f365a0b492c39f006a7cc Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Thu, 5 Apr 2012 22:22:52 +0200 Subject: [PATCH] symboliccolor: Parse 'currentColor' everywhere --- gtk/gtkcssshadowvalue.c | 5 +---- gtk/gtkcssshorthandpropertyimpl.c | 13 +++---------- gtk/gtkcssstylefuncs.c | 26 ++++++-------------------- gtk/gtkcssstylepropertyimpl.c | 13 +++---------- gtk/gtksymboliccolor.c | 3 +++ 5 files changed, 16 insertions(+), 44 deletions(-) diff --git a/gtk/gtkcssshadowvalue.c b/gtk/gtkcssshadowvalue.c index e9cbd4db43..8efcbe4741 100644 --- a/gtk/gtkcssshadowvalue.c +++ b/gtk/gtkcssshadowvalue.c @@ -236,10 +236,7 @@ _gtk_css_shadow_value_parse (GtkCssParser *parser) { GtkSymbolicColor *symbolic; - if (_gtk_css_parser_try (parser, "currentcolor", TRUE)) - symbolic = gtk_symbolic_color_ref (_gtk_symbolic_color_get_current_color ()); - else - symbolic = _gtk_css_parser_read_symbolic_color (parser); + symbolic = _gtk_css_parser_read_symbolic_color (parser); if (symbolic == NULL) goto fail; diff --git a/gtk/gtkcssshorthandpropertyimpl.c b/gtk/gtkcssshorthandpropertyimpl.c index b86b76110b..5ce3096756 100644 --- a/gtk/gtkcssshorthandpropertyimpl.c +++ b/gtk/gtkcssshorthandpropertyimpl.c @@ -221,16 +221,9 @@ parse_border_color (GtkCssShorthandProperty *shorthand, for (i = 0; i < 4; i++) { - if (_gtk_css_parser_try (parser, "currentcolor", TRUE)) - { - symbolic = gtk_symbolic_color_ref (_gtk_symbolic_color_get_current_color ()); - } - else - { - symbolic = _gtk_css_parser_read_symbolic_color (parser); - if (symbolic == NULL) - return FALSE; - } + symbolic = _gtk_css_parser_read_symbolic_color (parser); + if (symbolic == NULL) + return FALSE; values[i] = _gtk_css_value_new_take_symbolic_color (symbolic); diff --git a/gtk/gtkcssstylefuncs.c b/gtk/gtkcssstylefuncs.c index 3315fbfdbc..b1a097e90d 100644 --- a/gtk/gtkcssstylefuncs.c +++ b/gtk/gtkcssstylefuncs.c @@ -169,16 +169,9 @@ rgba_value_parse (GtkCssParser *parser, GtkSymbolicColor *symbolic; GdkRGBA rgba; - if (_gtk_css_parser_try (parser, "currentcolor", TRUE)) - { - symbolic = gtk_symbolic_color_ref (_gtk_symbolic_color_get_current_color ()); - } - else - { - symbolic = _gtk_css_parser_read_symbolic_color (parser); - if (symbolic == NULL) - return FALSE; - } + symbolic = _gtk_css_parser_read_symbolic_color (parser); + if (symbolic == NULL) + return FALSE; if (gtk_symbolic_color_resolve (symbolic, NULL, &rgba)) { @@ -312,16 +305,9 @@ symbolic_color_value_parse (GtkCssParser *parser, { GtkSymbolicColor *symbolic; - if (_gtk_css_parser_try (parser, "currentcolor", TRUE)) - { - symbolic = gtk_symbolic_color_ref (_gtk_symbolic_color_get_current_color ()); - } - else - { - symbolic = _gtk_css_parser_read_symbolic_color (parser); - if (symbolic == NULL) - return FALSE; - } + symbolic = _gtk_css_parser_read_symbolic_color (parser); + if (symbolic == NULL) + return FALSE; g_value_take_boxed (value, symbolic); return TRUE; diff --git a/gtk/gtkcssstylepropertyimpl.c b/gtk/gtkcssstylepropertyimpl.c index 2f365ead22..58be0bc143 100644 --- a/gtk/gtkcssstylepropertyimpl.c +++ b/gtk/gtkcssstylepropertyimpl.c @@ -183,16 +183,9 @@ color_parse (GtkCssStyleProperty *property, { GtkSymbolicColor *symbolic; - if (_gtk_css_parser_try (parser, "currentcolor", TRUE)) - { - symbolic = gtk_symbolic_color_ref (_gtk_symbolic_color_get_current_color ()); - } - else - { - symbolic = _gtk_css_parser_read_symbolic_color (parser); - if (symbolic == NULL) - return NULL; - } + symbolic = _gtk_css_parser_read_symbolic_color (parser); + if (symbolic == NULL) + return NULL; return _gtk_css_value_new_take_symbolic_color (symbolic); } diff --git a/gtk/gtksymboliccolor.c b/gtk/gtksymboliccolor.c index 994b2302f0..a660b8813d 100644 --- a/gtk/gtksymboliccolor.c +++ b/gtk/gtksymboliccolor.c @@ -1039,6 +1039,9 @@ _gtk_css_parser_read_symbolic_color (GtkCssParser *parser) 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)) { GdkRGBA transparent = { 0, 0, 0, 0 };