diff options
-rw-r--r-- | src/css.hh | 29 | ||||
-rw-r--r-- | src/cssparser.hh | 29 | ||||
-rw-r--r-- | src/styleengine.cc | 2 |
3 files changed, 30 insertions, 30 deletions
@@ -14,6 +14,35 @@ typedef enum { CSS_PRIMARY_LAST, } CssPrimaryOrder; +/* + * Lengths are represented as int in the following way: + * + * +---+ - - - +---+---+- - - - - -+---+---+---+---+ + * | integer part | decimal fraction | type | + * +---+ - - - +---+---+- - - - - -+---+---+---+---+ + * n-1 19 18 3 2 1 0 + * + * | <------ fixed point value ------> | + * + * where type is one of the CSS_LENGTH_TYPE_* values. + */ + +typedef int CssLength; + +enum { + CSS_LENGTH_TYPE_PX, + CSS_LENGTH_TYPE_MM, /* "cm", "in", "pt" and "pc" are converted into + millimeters. */ + CSS_LENGTH_TYPE_EM, + CSS_LENGTH_TYPE_EX, + CSS_LENGTH_TYPE_PERCENTAGE, + CSS_LENGTH_TYPE_AUTO /* This can be used as a simple value. */ +}; + +#define CSS_CREATE_LENGTH(v, t) ( ( (int)((v) * (1 << 19)) & ~7 ) | (t) ) +#define CSS_LENGTH_VALUE(l) ( ( (float)((l) & ~7) ) / (1 << 19) ) +#define CSS_LENGTH_TYPE(l) ((l) & 7) + class CssProperty { public: typedef union { diff --git a/src/cssparser.hh b/src/cssparser.hh index fc9cbccd..5089d9bb 100644 --- a/src/cssparser.hh +++ b/src/cssparser.hh @@ -49,35 +49,6 @@ typedef struct { } CssPropertyInfo; -/* - * Lengths are represented as int in the following way: - * - * +---+ - - - +---+---+- - - - - -+---+---+---+---+ - * | integer part | decimal fraction | type | - * +---+ - - - +---+---+- - - - - -+---+---+---+---+ - * n-1 19 18 3 2 1 0 - * - * | <------ fixed point value ------> | - * - * where type is one of the CSS_LENGTH_TYPE_* values. - */ - -typedef int CssLength; - -enum { - CSS_LENGTH_TYPE_PX, - CSS_LENGTH_TYPE_MM, /* "cm", "in", "pt" and "pc" are converted into - millimeters. */ - CSS_LENGTH_TYPE_EM, - CSS_LENGTH_TYPE_EX, - CSS_LENGTH_TYPE_PERCENTAGE, - CSS_LENGTH_TYPE_AUTO /* This can be used as a simple value. */ -}; - -#define CSS_CREATE_LENGTH(v, t) ( ( (int)((v) * (1 << 19)) & ~7 ) | (t) ) -#define CSS_LENGTH_VALUE(l) ( ( (float)((l) & ~7) ) / (1 << 19) ) -#define CSS_LENGTH_TYPE(l) ((l) & 7) - void a_Css_init (void); void a_Css_freeall (void); diff --git a/src/styleengine.cc b/src/styleengine.cc index f89e60eb..bb6022f4 100644 --- a/src/styleengine.cc +++ b/src/styleengine.cc @@ -11,7 +11,7 @@ #include <stdio.h> #include <math.h> -#include "cssparser.hh" +#include "css.hh" #include "styleengine.hh" using namespace dw::core::style; |