From 81b02d9b8f7643923823c4b7014a0e3fd4c923fa Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Thu, 13 Nov 2008 17:02:53 +0100 Subject: move CssLength stuff to css.hh --- src/css.hh | 29 +++++++++++++++++++++++++++++ src/cssparser.hh | 29 ----------------------------- src/styleengine.cc | 2 +- 3 files changed, 30 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/css.hh b/src/css.hh index 6b4fcc84..edc19c42 100644 --- a/src/css.hh +++ b/src/css.hh @@ -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 #include -#include "cssparser.hh" +#include "css.hh" #include "styleengine.hh" using namespace dw::core::style; -- cgit v1.2.3