]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkcsspositionvalue.c
docs: Typo fix
[~andy/gtk] / gtk / gtkcsspositionvalue.c
index 6f33de73a1e2a2c7881fb1d4fd9fcc402ebd84ab..8f09db72f2517cb11675c62614b45e2443330bcb 100644 (file)
@@ -173,8 +173,8 @@ _gtk_css_position_value_new (GtkCssValue *x,
   return result;
 }
 
-GtkCssValue *
-_gtk_css_position_value_parse (GtkCssParser *parser)
+static GtkCssValue *
+position_value_parse (GtkCssParser *parser, gboolean try)
 {
   static const struct {
     const char *name;
@@ -224,7 +224,11 @@ _gtk_css_position_value_parse (GtkCssParser *parser)
             return NULL;
         }
       else
-        return NULL;
+        {
+          if (!try)
+            _gtk_css_parser_error (parser, "Unrecognized position value");
+          return NULL;
+        }
     }
 
   for (second = 0; names[second].name != NULL; second++)
@@ -242,7 +246,8 @@ _gtk_css_position_value_parse (GtkCssParser *parser)
         {
           if (missing != &y)
             {
-              _gtk_css_parser_error (parser, "Invalid combination of values");
+              if (!try)
+                _gtk_css_parser_error (parser, "Invalid combination of values");
               _gtk_css_value_unref (y);
               return NULL;
             }
@@ -266,7 +271,8 @@ _gtk_css_position_value_parse (GtkCssParser *parser)
       if ((names[first].horizontal && !names[second].vertical) ||
           (!names[first].horizontal && !names[second].horizontal))
         {
-          _gtk_css_parser_error (parser, "Invalid combination of values");
+          if (!try)
+            _gtk_css_parser_error (parser, "Invalid combination of values");
           _gtk_css_value_unref (x);
           _gtk_css_value_unref (y);
           return NULL;
@@ -276,6 +282,18 @@ _gtk_css_position_value_parse (GtkCssParser *parser)
   return _gtk_css_position_value_new (x, y);
 }
 
+GtkCssValue *
+_gtk_css_position_value_parse (GtkCssParser *parser)
+{
+  return position_value_parse (parser, FALSE);
+}
+
+GtkCssValue *
+_gtk_css_position_value_try_parse (GtkCssParser *parser)
+{
+  return position_value_parse (parser, TRUE);
+}
+
 double
 _gtk_css_position_value_get_x (const GtkCssValue *position,
                                double             one_hundred_percent)