From 570510b0762d9bb02f9dc64497c8802bc2a1649d Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Mon, 23 Mar 2009 01:02:59 +0000 Subject: Completely change the approach used for presentational hints. This one stands a chance of working sanely. While this compiles, please don't expect it to link. svn path=/trunk/libcss/; revision=6820 --- include/libcss/errors.h | 3 +- include/libcss/hint.h | 92 +++----------------------------------- include/libcss/properties.h | 105 ++++++++++++++++++++++++++++++++++++++++++++ include/libcss/select.h | 5 ++- 4 files changed, 118 insertions(+), 87 deletions(-) (limited to 'include') diff --git a/include/libcss/errors.h b/include/libcss/errors.h index 2a36492..3177400 100644 --- a/include/libcss/errors.h +++ b/include/libcss/errors.h @@ -20,7 +20,8 @@ typedef enum css_error { CSS_NEEDDATA = 5, CSS_BADCHARSET = 6, CSS_EOF = 7, - CSS_IMPORTS_PENDING = 8 + CSS_IMPORTS_PENDING = 8, + CSS_PROPERTY_NOT_SET = 9 } css_error; /* Convert a libcss error value to a string */ diff --git a/include/libcss/hint.h b/include/libcss/hint.h index 366b254..8e960e9 100644 --- a/include/libcss/hint.h +++ b/include/libcss/hint.h @@ -22,97 +22,19 @@ typedef struct css_hint_length { css_unit unit; } css_hint_length; -/** - * Typed colour object for use in presentational hints - */ -typedef struct css_hint_typed_colour { - uint8_t type; - css_colour color; -} css_hint_typed_colour; - -/** - * Typed length object for use in presentational hints - */ -typedef struct css_hint_typed_length { - uint8_t type; - css_hint_length length; -} css_hint_typed_length; - -/** - * Typed string object for use in presentational hints - */ -typedef struct css_hint_typed_string { - uint8_t type; - lwc_string *string; -} css_hint_typed_string; - -/** - * Presentational hint border - */ -typedef struct css_hint_border { - css_hint_typed_length width; - css_hint_typed_colour color; - uint8_t style; -} css_hint_border; - /** * Presentational hints - * - * \todo There's no way to flag that a property isn't set here. */ typedef struct css_hint { - css_hint_typed_colour background_color; - - css_hint_typed_string background_image; - - uint8_t border_collapse; - - css_hint_border border_bottom; - css_hint_border border_left; - css_hint_border border_right; - css_hint_border border_top; + uint8_t status; - struct { - uint8_t type; - css_hint_length h; - css_hint_length v; - } border_spacing; - - uint8_t caption_side; - - uint8_t clear; - - css_hint_typed_colour color; - - uint8_t _float; - - css_hint_typed_string font_family; - - css_hint_typed_length font_size; - - css_hint_typed_length height; - - uint8_t list_style_type; - - css_hint_typed_length margin_bottom; - css_hint_typed_length margin_left; - css_hint_typed_length margin_right; - css_hint_typed_length margin_top; - - uint8_t overflow; - - css_hint_typed_length padding_bottom; - css_hint_typed_length padding_left; - css_hint_typed_length padding_right; - css_hint_typed_length padding_top; - - uint8_t text_align; - - css_hint_typed_length vertical_align; - - uint8_t white_space; + css_colour color; + int32_t integer; + css_hint_length length1; + css_hint_length length2; + lwc_string *string; - css_hint_typed_length width; + /** \todo Support clip/content/counter-{increment,reset}? */ } css_hint; #endif diff --git a/include/libcss/properties.h b/include/libcss/properties.h index 6e7efa8..ffc3d06 100644 --- a/include/libcss/properties.h +++ b/include/libcss/properties.h @@ -8,6 +8,111 @@ #ifndef libcss_properties_h_ #define libcss_properties_h_ +enum css_properties { + CSS_PROP_AZIMUTH = 0x000, + CSS_PROP_BACKGROUND_ATTACHMENT = 0x001, + CSS_PROP_BACKGROUND_COLOR = 0x002, + CSS_PROP_BACKGROUND_IMAGE = 0x003, + CSS_PROP_BACKGROUND_POSITION = 0x004, + CSS_PROP_BACKGROUND_REPEAT = 0x005, + CSS_PROP_BORDER_COLLAPSE = 0x006, + CSS_PROP_BORDER_SPACING = 0x007, + CSS_PROP_BORDER_TOP_COLOR = 0x008, + CSS_PROP_BORDER_RIGHT_COLOR = 0x009, + CSS_PROP_BORDER_BOTTOM_COLOR = 0x00a, + CSS_PROP_BORDER_LEFT_COLOR = 0x00b, + CSS_PROP_BORDER_TOP_STYLE = 0x00c, + CSS_PROP_BORDER_RIGHT_STYLE = 0x00d, + CSS_PROP_BORDER_BOTTOM_STYLE = 0x00e, + CSS_PROP_BORDER_LEFT_STYLE = 0x00f, + CSS_PROP_BORDER_TOP_WIDTH = 0x010, + CSS_PROP_BORDER_RIGHT_WIDTH = 0x011, + CSS_PROP_BORDER_BOTTOM_WIDTH = 0x012, + CSS_PROP_BORDER_LEFT_WIDTH = 0x013, + CSS_PROP_BOTTOM = 0x014, + CSS_PROP_CAPTION_SIDE = 0x015, + CSS_PROP_CLEAR = 0x016, + CSS_PROP_CLIP = 0x017, + CSS_PROP_COLOR = 0x018, + CSS_PROP_CONTENT = 0x019, + CSS_PROP_COUNTER_INCREMENT = 0x01a, + CSS_PROP_COUNTER_RESET = 0x01b, + CSS_PROP_CUE_AFTER = 0x01c, + CSS_PROP_CUE_BEFORE = 0x01d, + CSS_PROP_CURSOR = 0x01e, + CSS_PROP_DIRECTION = 0x01f, + CSS_PROP_DISPLAY = 0x020, + CSS_PROP_ELEVATION = 0x021, + CSS_PROP_EMPTY_CELLS = 0x022, + CSS_PROP_FLOAT = 0x023, + CSS_PROP_FONT_FAMILY = 0x024, + CSS_PROP_FONT_SIZE = 0x025, + CSS_PROP_FONT_STYLE = 0x026, + CSS_PROP_FONT_VARIANT = 0x027, + CSS_PROP_FONT_WEIGHT = 0x028, + CSS_PROP_HEIGHT = 0x029, + CSS_PROP_LEFT = 0x02a, + CSS_PROP_LETTER_SPACING = 0x02b, + CSS_PROP_LINE_HEIGHT = 0x02c, + CSS_PROP_LIST_STYLE_IMAGE = 0x02d, + CSS_PROP_LIST_STYLE_POSITION = 0x02e, + CSS_PROP_LIST_STYLE_TYPE = 0x02f, + CSS_PROP_MARGIN_TOP = 0x030, + CSS_PROP_MARGIN_RIGHT = 0x031, + CSS_PROP_MARGIN_BOTTOM = 0x032, + CSS_PROP_MARGIN_LEFT = 0x033, + CSS_PROP_MAX_HEIGHT = 0x034, + CSS_PROP_MAX_WIDTH = 0x035, + CSS_PROP_MIN_HEIGHT = 0x036, + CSS_PROP_MIN_WIDTH = 0x037, + CSS_PROP_ORPHANS = 0x038, + CSS_PROP_OUTLINE_COLOR = 0x039, + CSS_PROP_OUTLINE_STYLE = 0x03a, + CSS_PROP_OUTLINE_WIDTH = 0x03b, + CSS_PROP_OVERFLOW = 0x03c, + CSS_PROP_PADDING_TOP = 0x03d, + CSS_PROP_PADDING_RIGHT = 0x03e, + CSS_PROP_PADDING_BOTTOM = 0x03f, + CSS_PROP_PADDING_LEFT = 0x040, + CSS_PROP_PAGE_BREAK_AFTER = 0x041, + CSS_PROP_PAGE_BREAK_BEFORE = 0x042, + CSS_PROP_PAGE_BREAK_INSIDE = 0x043, + CSS_PROP_PAUSE_AFTER = 0x044, + CSS_PROP_PAUSE_BEFORE = 0x045, + CSS_PROP_PITCH_RANGE = 0x046, + CSS_PROP_PITCH = 0x047, + CSS_PROP_PLAY_DURING = 0x048, + CSS_PROP_POSITION = 0x049, + CSS_PROP_QUOTES = 0x04a, + CSS_PROP_RICHNESS = 0x04b, + CSS_PROP_RIGHT = 0x04c, + CSS_PROP_SPEAK_HEADER = 0x04d, + CSS_PROP_SPEAK_NUMERAL = 0x04e, + CSS_PROP_SPEAK_PUNCTUATION = 0x04f, + CSS_PROP_SPEAK = 0x050, + CSS_PROP_SPEECH_RATE = 0x051, + CSS_PROP_STRESS = 0x052, + CSS_PROP_TABLE_LAYOUT = 0x053, + CSS_PROP_TEXT_ALIGN = 0x054, + CSS_PROP_TEXT_DECORATION = 0x055, + CSS_PROP_TEXT_INDENT = 0x056, + CSS_PROP_TEXT_TRANSFORM = 0x057, + CSS_PROP_TOP = 0x058, + CSS_PROP_UNICODE_BIDI = 0x059, + CSS_PROP_VERTICAL_ALIGN = 0x05a, + CSS_PROP_VISIBILITY = 0x05b, + CSS_PROP_VOICE_FAMILY = 0x05c, + CSS_PROP_VOLUME = 0x05d, + CSS_PROP_WHITE_SPACE = 0x05e, + CSS_PROP_WIDOWS = 0x05f, + CSS_PROP_WIDTH = 0x060, + CSS_PROP_WORD_SPACING = 0x061, + CSS_PROP_Z_INDEX = 0x062, + + CSS_N_PROPERTIES = CSS_PROP_Z_INDEX + 1 +}; + + enum css_background_attachment { CSS_BACKGROUND_ATTACHMENT_INHERIT = 0x0, CSS_BACKGROUND_ATTACHMENT_FIXED = 0x1, diff --git a/include/libcss/select.h b/include/libcss/select.h index 44befcd..ea67d25 100644 --- a/include/libcss/select.h +++ b/include/libcss/select.h @@ -61,6 +61,9 @@ typedef struct css_select_handler { css_error (*node_is_focus)(void *pw, void *node, bool *match); css_error (*node_is_lang)(void *pw, void *node, lwc_string *lang, bool *match); + + css_error (*node_presentational_hint)(void *pw, void *node, + uint32_t property, css_hint *hint); } css_select_handler; css_error css_select_ctx_create(css_allocator_fn alloc, void *pw, @@ -80,7 +83,7 @@ css_error css_select_ctx_get_sheet(css_select_ctx *ctx, uint32_t index, css_error css_select_style(css_select_ctx *ctx, void *node, uint32_t pseudo_element, uint64_t media, - const css_hint *hints, css_computed_style *result, + css_computed_style *result, css_select_handler *handler, void *pw); #endif -- cgit v1.2.3