[gtk+/wip/cssvalue: 127/165] symboliccolor: Parse 'currentColor' everywhere



commit b170cb74be8abd3e28af938576a0883a16b9d359
Author: Benjamin Otte <otte redhat com>
Date:   Thu Apr 5 22:22:52 2012 +0200

    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 e9cbd4d..8efcbe4 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 d00da9a..32c27ab 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 3315fbf..b1a097e 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 6da51b0..f51e321 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 994b230..a660b88 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 };



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]