[project @ 2004-08-01 14:13:47 by jmb]

Internal representation and parsing of most CSS2 properties.

svn path=/import/netsurf/; revision=1172
This commit is contained in:
John Mark Bell 2004-08-01 14:13:47 +00:00
parent 9e1dbe3a36
commit 3b660a7e33
4 changed files with 1884 additions and 70 deletions

772
css/css.c

File diff suppressed because it is too large Load Diff

236
css/css.h
View File

@ -72,41 +72,105 @@ struct css_background_position {
} value;
};
struct css_border_width {
enum { CSS_BORDER_WIDTH_INHERIT,
CSS_BORDER_WIDTH_LENGTH } width;
struct css_length value;
};
typedef enum {
CSS_LIST_STYLE_IMAGE_INHERIT,
CSS_LIST_STYLE_IMAGE_NONE,
CSS_LIST_STYLE_IMAGE_URI
} css_list_style_image_type;
typedef enum {
CSS_OUTLINE_COLOR_INHERIT,
CSS_OUTLINE_COLOR_COLOR,
CSS_OUTLINE_COLOR_INVERT
} css_outline_color_type;
typedef enum {
CSS_VERTICAL_ALIGN_INHERIT,
CSS_VERTICAL_ALIGN_BASELINE,
CSS_VERTICAL_ALIGN_SUB,
CSS_VERTICAL_ALIGN_SUPER,
CSS_VERTICAL_ALIGN_TOP,
CSS_VERTICAL_ALIGN_TEXT_TOP,
CSS_VERTICAL_ALIGN_MIDDLE,
CSS_VERTICAL_ALIGN_BOTTOM,
CSS_VERTICAL_ALIGN_TEXT_BOTTOM,
CSS_VERTICAL_ALIGN_LENGTH,
CSS_VERTICAL_ALIGN_PERCENT
} css_vertical_align_type;
/** Representation of a complete CSS 2 style. */
struct css_style {
colour background_color;
/* background properties */
css_background_attachment background_attachment;
colour background_color;
struct {
css_background_image_type type;
char *uri;
} background_image;
struct {
struct css_background_position horz;
struct css_background_position vert;
} background_position;
css_background_repeat background_repeat;
/* borders */
struct {
colour color;
struct {
enum { CSS_BORDER_WIDTH_INHERIT,
CSS_BORDER_WIDTH_LENGTH } width;
struct css_length value;
} width;
struct css_border_width width;
css_border_style style;
} border[4]; /**< top, right, bottom, left */
css_border_collapse border_collapse;
struct {
enum { CSS_BORDER_SPACING_INHERIT,
CSS_BORDER_SPACING_LENGTH } border_spacing;
struct css_length horz;
struct css_length vert;
} border_spacing;
struct {
enum { CSS_BOTTOM_INHERIT,
CSS_BOTTOM_AUTO,
CSS_BOTTOM_PERCENT,
CSS_BOTTOM_LENGTH } bottom;
union {
struct css_length length;
float percent;
} value;
} bottom;
css_caption_side caption_side;
css_clear clear;
struct {
enum { CSS_CLIP_INHERIT,
CSS_CLIP_AUTO,
CSS_CLIP_RECT } clip;
struct {
enum { CSS_CLIP_RECT_AUTO,
CSS_CLIP_RECT_LENGTH } rect;
struct css_length value;
} rect[4]; /**< top, right, bottom, left */
} clip;
colour color;
/** \todo content and counters */
css_cursor cursor;
css_direction direction;
css_display display;
css_empty_cells empty_cells;
css_float float_;
/* font properties */
css_font_family font_family;
struct {
enum { CSS_FONT_SIZE_INHERIT,
CSS_FONT_SIZE_ABSOLUTE,
@ -118,11 +182,9 @@ struct css_style {
float percent;
} value;
} font_size;
css_font_family font_family;
css_font_weight font_weight;
css_font_style font_style;
css_font_variant font_variant;
css_font_weight font_weight;
struct {
enum { CSS_HEIGHT_INHERIT,
@ -131,6 +193,24 @@ struct css_style {
struct css_length length;
} height;
struct {
enum { CSS_LEFT_INHERIT,
CSS_LEFT_AUTO,
CSS_LEFT_PERCENT,
CSS_LEFT_LENGTH } left;
union {
struct css_length length;
float percent;
} value;
} left;
struct {
enum { CSS_LETTER_SPACING_INHERIT,
CSS_LETTER_SPACING_NORMAL,
CSS_LETTER_SPACING_LENGTH } letter_spacing;
struct css_length length;
} letter_spacing;
struct {
enum { CSS_LINE_HEIGHT_INHERIT,
CSS_LINE_HEIGHT_ABSOLUTE,
@ -143,6 +223,15 @@ struct css_style {
} value;
} line_height;
/* list properties */
struct {
css_list_style_image_type type;
char *uri;
} list_style_image;
css_list_style_position list_style_position;
css_list_style_type list_style_type;
/* margins */
struct {
enum { CSS_MARGIN_INHERIT,
CSS_MARGIN_LENGTH,
@ -154,8 +243,64 @@ struct css_style {
} value;
} margin[4]; /**< top, right, bottom, left */
/* min/max width/height */
struct {
enum { CSS_MAX_HEIGHT_INHERIT,
CSS_MAX_HEIGHT_NONE,
CSS_MAX_HEIGHT_LENGTH,
CSS_MAX_HEIGHT_PERCENT } max_height;
union {
struct css_length length;
float percent;
} value;
} max_height;
struct {
enum { CSS_MAX_WIDTH_INHERIT,
CSS_MAX_WIDTH_NONE,
CSS_MAX_WIDTH_LENGTH,
CSS_MAX_WIDTH_PERCENT } max_width;
union {
struct css_length length;
float percent;
} value;
} max_width;
struct {
enum { CSS_MIN_HEIGHT_INHERIT,
CSS_MIN_HEIGHT_LENGTH,
CSS_MIN_HEIGHT_PERCENT } min_height;
union {
struct css_length length;
float percent;
} value;
} min_height;
struct {
enum { CSS_MIN_WIDTH_INHERIT,
CSS_MIN_WIDTH_LENGTH,
CSS_MIN_WIDTH_PERCENT } min_width;
union {
struct css_length length;
float percent;
} value;
} min_width;
struct {
enum { CSS_ORPHANS_INHERIT,
CSS_ORPHANS_INTEGER } orphans;
int value;
} orphans;
struct {
struct {
css_outline_color_type color;
colour value;
} color;
struct css_border_width width;
css_border_style style;
} outline;
css_overflow overflow;
/* padding */
struct {
enum { CSS_PADDING_INHERIT,
CSS_PADDING_LENGTH,
@ -166,6 +311,28 @@ struct css_style {
} value;
} padding[4]; /**< top, right, bottom, left */
css_page_break_after page_break_after;
css_page_break_before page_break_before;
css_page_break_inside page_break_inside;
css_position position;
/** \todo quotes */
struct {
enum { CSS_RIGHT_INHERIT,
CSS_RIGHT_AUTO,
CSS_RIGHT_PERCENT,
CSS_RIGHT_LENGTH } right;
union {
struct css_length length;
float percent;
} value;
} right;
css_table_layout table_layout;
/* text properties */
css_text_align text_align;
css_text_decoration text_decoration;
struct {
@ -179,8 +346,37 @@ struct css_style {
} text_indent;
css_text_transform text_transform;
struct {
enum { CSS_TOP_INHERIT,
CSS_TOP_AUTO,
CSS_TOP_PERCENT,
CSS_TOP_LENGTH } top;
union {
struct css_length length;
float percent;
} value;
} top;
css_unicode_bidi unicode_bidi;
struct {
css_vertical_align_type type;
union {
struct css_length length;
float percent;
} value;
} vertical_align;
css_visibility visibility;
css_white_space white_space;
struct {
enum { CSS_WIDOWS_INHERIT,
CSS_WIDOWS_INTEGER } widows;
int value;
} widows;
struct {
enum { CSS_WIDTH_INHERIT,
CSS_WIDTH_AUTO,
@ -192,7 +388,19 @@ struct css_style {
} value;
} width;
css_white_space white_space;
struct {
enum { CSS_WORD_SPACING_INHERIT,
CSS_WORD_SPACING_NORMAL,
CSS_WORD_SPACING_LENGTH } word_spacing;
struct css_length length;
} word_spacing;
struct {
enum { CSS_Z_INDEX_INHERIT,
CSS_Z_INDEX_AUTO,
CSS_Z_INDEX_INTEGER } z_index;
int value;
} z_index;
};
struct css_stylesheet;

View File

@ -1,21 +1,29 @@
css_unit em ex px in cm mm pt pc
css_background_attachment inherit fixed scroll
css_background_repeat inherit repeat repeat-x repeat-y no-repeat
css_border_collapse inherit collapse separate
css_border_style inherit none hidden dotted dashed solid double groove ridge inset outset
css_caption_side inherit top bottom
css_clear inherit none both left right
css_cursor inherit auto crosshair default pointer move e-resize ne-resize nw-resize n-resize se-resize sw-resize s-resize w-resize text wait help
css_direction inherit ltr rtl
css_display inherit inline block list-item run-in inline-block table inline-table table-row-group table-header-group table-footer-group table-row table-column-group table-column table-cell table-caption none
css_empty_cells inherit show hide
css_float inherit none left right
css_font_family inherit sans-serif serif monospace cursive fantasy
css_font_style inherit normal italic oblique
css_font_variant inherit normal small-caps
css_font_weight inherit normal bold bolder lighter 100 200 300 400 500 600 700 800 900
css_letter_spacing normal length
css_list_style_position outside inside
css_list_style_type disc circle square decimal lower-alpha lower-roman upper-alpha upper-roman none
css_list_style_position inherit outside inside
css_list_style_type inherit disc circle square decimal lower-alpha lower-roman upper-alpha upper-roman none
css_overflow inherit visible hidden scroll auto
css_page_break_after inherit auto always avoid left right
css_page_break_before inherit auto always avoid left right
css_page_break_inside inherit avoid auto
css_position inherit static relative absolute fixed
css_table_layout inherit auto fixed
css_text_align inherit left right center justify
css_text_transform inherit none capitalize lowercase uppercase
css_vertical_align baseline bottom middle sub super text-bottom text-top top percent
css_visibility inherit visible hidden
css_white_space inherit normal nowrap pre
css_unicode_bidi inherit normal embed bidi-override
css_visibility inherit visible hidden collapse
css_white_space inherit normal nowrap pre pre-wrap pre-line

File diff suppressed because it is too large Load Diff