[gtk+/wip/cssvalue: 93/142] css: Add <time> type to css number stuff



commit 829db89be6bf775249a0086b3ecc172c77f728ee
Author: Benjamin Otte <otte redhat com>
Date:   Sun Apr 1 04:02:34 2012 +0200

    css: Add <time> type to css number stuff

 gtk/gtkcssnumbervalue.c   |    6 ++++++
 gtk/gtkcssparser.c        |    4 +++-
 gtk/gtkcssparserprivate.h |    3 ++-
 gtk/gtkcsstypesprivate.h  |    5 ++++-
 4 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkcssnumbervalue.c b/gtk/gtkcssnumbervalue.c
index fded8c7..e7c04d9 100644
--- a/gtk/gtkcssnumbervalue.c
+++ b/gtk/gtkcssnumbervalue.c
@@ -76,6 +76,8 @@ gtk_css_value_number_print (const GtkCssValue *number,
     /* [GTK_CSS_DEG] = */ "deg",
     /* [GTK_CSS_GRAD] = */ "grad",
     /* [GTK_CSS_TURN] = */ "turn",
+    /* [GTK_CSS_S] = */ "s",
+    /* [GTK_CSS_MS] = */ "ms",
   };
 
   g_ascii_dtostr (buf, sizeof (buf), number->value);
@@ -167,6 +169,7 @@ _gtk_css_number_value_compute (GtkCssValue     *number,
     case GTK_CSS_NUMBER:
     case GTK_CSS_PX:
     case GTK_CSS_DEG:
+    case GTK_CSS_S:
       return _gtk_css_value_ref (number);
     case GTK_CSS_PT:
       return _gtk_css_number_value_new (number->value * 96.0 / 72.0,
@@ -206,6 +209,9 @@ _gtk_css_number_value_compute (GtkCssValue     *number,
     case GTK_CSS_TURN:
       return _gtk_css_number_value_new (number->value * 360.0,
                                         GTK_CSS_DEG);
+    case GTK_CSS_MS:
+      return _gtk_css_number_value_new (number->value / 1000.0,
+                                        GTK_CSS_S);
     }
 }
 
diff --git a/gtk/gtkcssparser.c b/gtk/gtkcssparser.c
index 1d2ec8f..c50a9bb 100644
--- a/gtk/gtkcssparser.c
+++ b/gtk/gtkcssparser.c
@@ -572,7 +572,9 @@ _gtk_css_parser_read_number (GtkCssParser           *parser,
     { "rad",  GTK_CSS_RAD,     GTK_CSS_PARSE_ANGLE  },
     { "deg",  GTK_CSS_DEG,     GTK_CSS_PARSE_ANGLE  },
     { "grad", GTK_CSS_GRAD,    GTK_CSS_PARSE_ANGLE  },
-    { "turn", GTK_CSS_TURN,    GTK_CSS_PARSE_ANGLE  }
+    { "turn", GTK_CSS_TURN,    GTK_CSS_PARSE_ANGLE  },
+    { "s",    GTK_CSS_S,       GTK_CSS_PARSE_TIME   },
+    { "ms",   GTK_CSS_MS,      GTK_CSS_PARSE_TIME   }
   };
   char *end, *unit;
 
diff --git a/gtk/gtkcssparserprivate.h b/gtk/gtkcssparserprivate.h
index dd9e228..faeeda2 100644
--- a/gtk/gtkcssparserprivate.h
+++ b/gtk/gtkcssparserprivate.h
@@ -30,7 +30,8 @@ typedef enum /*< skip >*/ {
   GTK_CSS_PARSE_NUMBER = (1 << 2),
   GTK_CSS_NUMBER_AS_PIXELS = (1 << 3),
   GTK_CSS_PARSE_LENGTH = (1 << 4),
-  GTK_CSS_PARSE_ANGLE = (1 << 5)
+  GTK_CSS_PARSE_ANGLE = (1 << 5),
+  GTK_CSS_PARSE_TIME = (1 << 6)
 } GtkCssNumberParseFlags;
 
 typedef struct _GtkCssParser GtkCssParser;
diff --git a/gtk/gtkcsstypesprivate.h b/gtk/gtkcsstypesprivate.h
index 0295cb7..637c3cd 100644
--- a/gtk/gtkcsstypesprivate.h
+++ b/gtk/gtkcsstypesprivate.h
@@ -174,7 +174,10 @@ typedef enum /*< skip >*/ {
   GTK_CSS_RAD,
   GTK_CSS_DEG,
   GTK_CSS_GRAD,
-  GTK_CSS_TURN
+  GTK_CSS_TURN,
+  /* CSS term: <time> */
+  GTK_CSS_S,
+  GTK_CSS_MS,
 } GtkCssUnit;
 
 typedef struct _GtkCssNumber GtkCssNumber;



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