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 +- src/bytecode/bytecode.h | 105 +---------------------- src/parse/properties.c | 203 +++++++++++++++++++++++--------------------- src/select/computed.c | 2 +- src/select/dispatch.c | 200 +++++++++++++++++++++---------------------- src/select/dispatch.h | 4 +- src/select/properties.h | 198 ++++++++++++++++++++++++++++++++++++++++++ src/select/select.c | 47 +++++++--- src/select/select.h | 2 +- src/utils/errors.c | 3 + test/dump.h | 198 +++++++++++++++++++++--------------------- test/select-auto.c | 22 ++++- 15 files changed, 682 insertions(+), 507 deletions(-) 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 diff --git a/src/bytecode/bytecode.h b/src/bytecode/bytecode.h index a0810e2..4235ab2 100644 --- a/src/bytecode/bytecode.h +++ b/src/bytecode/bytecode.h @@ -12,110 +12,9 @@ #include #include +#include -typedef enum opcode { - OP_AZIMUTH = 0x000, - OP_BACKGROUND_ATTACHMENT = 0x001, - OP_BACKGROUND_COLOR = 0x002, - OP_BACKGROUND_IMAGE = 0x003, - OP_BACKGROUND_POSITION = 0x004, - OP_BACKGROUND_REPEAT = 0x005, - OP_BORDER_COLLAPSE = 0x006, - OP_BORDER_SPACING = 0x007, - OP_BORDER_TOP_COLOR = 0x008, - OP_BORDER_RIGHT_COLOR = 0x009, - OP_BORDER_BOTTOM_COLOR = 0x00a, - OP_BORDER_LEFT_COLOR = 0x00b, - OP_BORDER_TOP_STYLE = 0x00c, - OP_BORDER_RIGHT_STYLE = 0x00d, - OP_BORDER_BOTTOM_STYLE = 0x00e, - OP_BORDER_LEFT_STYLE = 0x00f, - OP_BORDER_TOP_WIDTH = 0x010, - OP_BORDER_RIGHT_WIDTH = 0x011, - OP_BORDER_BOTTOM_WIDTH = 0x012, - OP_BORDER_LEFT_WIDTH = 0x013, - OP_BOTTOM = 0x014, - OP_CAPTION_SIDE = 0x015, - OP_CLEAR = 0x016, - OP_CLIP = 0x017, - OP_COLOR = 0x018, - OP_CONTENT = 0x019, - OP_COUNTER_INCREMENT = 0x01a, - OP_COUNTER_RESET = 0x01b, - OP_CUE_AFTER = 0x01c, - OP_CUE_BEFORE = 0x01d, - OP_CURSOR = 0x01e, - OP_DIRECTION = 0x01f, - OP_DISPLAY = 0x020, - OP_ELEVATION = 0x021, - OP_EMPTY_CELLS = 0x022, - OP_FLOAT = 0x023, - OP_FONT_FAMILY = 0x024, - OP_FONT_SIZE = 0x025, - OP_FONT_STYLE = 0x026, - OP_FONT_VARIANT = 0x027, - OP_FONT_WEIGHT = 0x028, - OP_HEIGHT = 0x029, - OP_LEFT = 0x02a, - OP_LETTER_SPACING = 0x02b, - OP_LINE_HEIGHT = 0x02c, - OP_LIST_STYLE_IMAGE = 0x02d, - OP_LIST_STYLE_POSITION = 0x02e, - OP_LIST_STYLE_TYPE = 0x02f, - OP_MARGIN_TOP = 0x030, - OP_MARGIN_RIGHT = 0x031, - OP_MARGIN_BOTTOM = 0x032, - OP_MARGIN_LEFT = 0x033, - OP_MAX_HEIGHT = 0x034, - OP_MAX_WIDTH = 0x035, - OP_MIN_HEIGHT = 0x036, - OP_MIN_WIDTH = 0x037, - OP_ORPHANS = 0x038, - OP_OUTLINE_COLOR = 0x039, - OP_OUTLINE_STYLE = 0x03a, - OP_OUTLINE_WIDTH = 0x03b, - OP_OVERFLOW = 0x03c, - OP_PADDING_TOP = 0x03d, - OP_PADDING_RIGHT = 0x03e, - OP_PADDING_BOTTOM = 0x03f, - OP_PADDING_LEFT = 0x040, - OP_PAGE_BREAK_AFTER = 0x041, - OP_PAGE_BREAK_BEFORE = 0x042, - OP_PAGE_BREAK_INSIDE = 0x043, - OP_PAUSE_AFTER = 0x044, - OP_PAUSE_BEFORE = 0x045, - OP_PITCH_RANGE = 0x046, - OP_PITCH = 0x047, - OP_PLAY_DURING = 0x048, - OP_POSITION = 0x049, - OP_QUOTES = 0x04a, - OP_RICHNESS = 0x04b, - OP_RIGHT = 0x04c, - OP_SPEAK_HEADER = 0x04d, - OP_SPEAK_NUMERAL = 0x04e, - OP_SPEAK_PUNCTUATION = 0x04f, - OP_SPEAK = 0x050, - OP_SPEECH_RATE = 0x051, - OP_STRESS = 0x052, - OP_TABLE_LAYOUT = 0x053, - OP_TEXT_ALIGN = 0x054, - OP_TEXT_DECORATION = 0x055, - OP_TEXT_INDENT = 0x056, - OP_TEXT_TRANSFORM = 0x057, - OP_TOP = 0x058, - OP_UNICODE_BIDI = 0x059, - OP_VERTICAL_ALIGN = 0x05a, - OP_VISIBILITY = 0x05b, - OP_VOICE_FAMILY = 0x05c, - OP_VOLUME = 0x05d, - OP_WHITE_SPACE = 0x05e, - OP_WIDOWS = 0x05f, - OP_WIDTH = 0x060, - OP_WORD_SPACING = 0x061, - OP_Z_INDEX = 0x062, - - N_OPCODES = OP_Z_INDEX + 1 -} opcode; +typedef enum css_properties opcode; enum flag { FLAG_IMPORTANT = (1<<0), diff --git a/src/parse/properties.c b/src/parse/properties.c index f54b3f9..c40b223 100644 --- a/src/parse/properties.c +++ b/src/parse/properties.c @@ -596,7 +596,7 @@ css_error parse_azimuth(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_AZIMUTH, flags, value); + opv = buildOPV(CSS_PROP_AZIMUTH, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == AZIMUTH_ANGLE) @@ -647,7 +647,7 @@ css_error parse_background_attachment(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_BACKGROUND_ATTACHMENT, flags, value); + opv = buildOPV(CSS_PROP_BACKGROUND_ATTACHMENT, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, sizeof(opv), result); @@ -697,7 +697,7 @@ css_error parse_background_color(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_BACKGROUND_COLOR, flags, value); + opv = buildOPV(CSS_PROP_BACKGROUND_COLOR, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == BACKGROUND_COLOR_SET) @@ -750,7 +750,7 @@ css_error parse_background_image(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_BACKGROUND_IMAGE, flags, value); + opv = buildOPV(CSS_PROP_BACKGROUND_IMAGE, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == BACKGROUND_IMAGE_URI) @@ -893,7 +893,7 @@ css_error parse_background_position(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_BACKGROUND_POSITION, flags, value[0] | value[1]); + opv = buildOPV(CSS_PROP_BACKGROUND_POSITION, flags, value[0] | value[1]); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false) { @@ -960,7 +960,7 @@ css_error parse_background_repeat(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_BACKGROUND_REPEAT, flags, value); + opv = buildOPV(CSS_PROP_BACKGROUND_REPEAT, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, sizeof(opv), result); @@ -978,7 +978,7 @@ css_error parse_border_bottom_color(css_language *c, css_style **result) { return parse_border_side_color(c, vector, ctx, - OP_BORDER_BOTTOM_COLOR, result); + CSS_PROP_BORDER_BOTTOM_COLOR, result); } css_error parse_border_bottom_style(css_language *c, @@ -986,7 +986,7 @@ css_error parse_border_bottom_style(css_language *c, css_style **result) { return parse_border_side_style(c, vector, ctx, - OP_BORDER_BOTTOM_STYLE, result); + CSS_PROP_BORDER_BOTTOM_STYLE, result); } css_error parse_border_bottom_width(css_language *c, @@ -994,7 +994,7 @@ css_error parse_border_bottom_width(css_language *c, css_style **result) { return parse_border_side_width(c, vector, ctx, - OP_BORDER_BOTTOM_WIDTH, result); + CSS_PROP_BORDER_BOTTOM_WIDTH, result); } css_error parse_border_collapse(css_language *c, @@ -1025,7 +1025,7 @@ css_error parse_border_collapse(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_BORDER_COLLAPSE, flags, value); + opv = buildOPV(CSS_PROP_BORDER_COLLAPSE, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, sizeof(opv), result); @@ -1043,7 +1043,7 @@ css_error parse_border_left_color(css_language *c, css_style **result) { return parse_border_side_color(c, vector, ctx, - OP_BORDER_LEFT_COLOR, result); + CSS_PROP_BORDER_LEFT_COLOR, result); } css_error parse_border_left_style(css_language *c, @@ -1051,7 +1051,7 @@ css_error parse_border_left_style(css_language *c, css_style **result) { return parse_border_side_style(c, vector, ctx, - OP_BORDER_LEFT_STYLE, result); + CSS_PROP_BORDER_LEFT_STYLE, result); } css_error parse_border_left_width(css_language *c, @@ -1059,7 +1059,7 @@ css_error parse_border_left_width(css_language *c, css_style **result) { return parse_border_side_width(c, vector, ctx, - OP_BORDER_LEFT_WIDTH, result); + CSS_PROP_BORDER_LEFT_WIDTH, result); } css_error parse_border_right_color(css_language *c, @@ -1067,7 +1067,7 @@ css_error parse_border_right_color(css_language *c, css_style **result) { return parse_border_side_color(c, vector, ctx, - OP_BORDER_RIGHT_COLOR, result); + CSS_PROP_BORDER_RIGHT_COLOR, result); } css_error parse_border_right_style(css_language *c, @@ -1075,7 +1075,7 @@ css_error parse_border_right_style(css_language *c, css_style **result) { return parse_border_side_style(c, vector, ctx, - OP_BORDER_RIGHT_STYLE, result); + CSS_PROP_BORDER_RIGHT_STYLE, result); } css_error parse_border_right_width(css_language *c, @@ -1083,7 +1083,7 @@ css_error parse_border_right_width(css_language *c, css_style **result) { return parse_border_side_width(c, vector, ctx, - OP_BORDER_RIGHT_WIDTH, result); + CSS_PROP_BORDER_RIGHT_WIDTH, result); } css_error parse_border_spacing(css_language *c, @@ -1156,7 +1156,7 @@ css_error parse_border_spacing(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_BORDER_SPACING, flags, value); + opv = buildOPV(CSS_PROP_BORDER_SPACING, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == BORDER_SPACING_SET) @@ -1189,7 +1189,7 @@ css_error parse_border_top_color(css_language *c, css_style **result) { return parse_border_side_color(c, vector, ctx, - OP_BORDER_TOP_COLOR, result); + CSS_PROP_BORDER_TOP_COLOR, result); } css_error parse_border_top_style(css_language *c, @@ -1197,7 +1197,7 @@ css_error parse_border_top_style(css_language *c, css_style **result) { return parse_border_side_style(c, vector, ctx, - OP_BORDER_TOP_STYLE, result); + CSS_PROP_BORDER_TOP_STYLE, result); } css_error parse_border_top_width(css_language *c, @@ -1205,7 +1205,7 @@ css_error parse_border_top_width(css_language *c, css_style **result) { return parse_border_side_width(c, vector, ctx, - OP_BORDER_TOP_WIDTH, result); + CSS_PROP_BORDER_TOP_WIDTH, result); } css_error parse_bottom(css_language *c, @@ -1250,7 +1250,7 @@ css_error parse_bottom(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_BOTTOM, flags, value); + opv = buildOPV(CSS_PROP_BOTTOM, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == BOTTOM_SET) @@ -1301,7 +1301,7 @@ css_error parse_caption_side(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_CAPTION_SIDE, flags, value); + opv = buildOPV(CSS_PROP_CAPTION_SIDE, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, sizeof(opv), result); @@ -1346,7 +1346,7 @@ css_error parse_clear(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_CLEAR, flags, value); + opv = buildOPV(CSS_PROP_CLEAR, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, sizeof(opv), result); @@ -1450,7 +1450,7 @@ css_error parse_clip(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_CLIP, flags, value); + opv = buildOPV(CSS_PROP_CLIP, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && @@ -1514,7 +1514,7 @@ css_error parse_color(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_COLOR, flags, value); + opv = buildOPV(CSS_PROP_COLOR, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == COLOR_SET) @@ -1590,7 +1590,7 @@ css_error parse_content(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_CONTENT, flags, value); + opv = buildOPV(CSS_PROP_CONTENT, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, required_size, result); @@ -1706,7 +1706,7 @@ css_error parse_counter_increment(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_COUNTER_INCREMENT, flags, value); + opv = buildOPV(CSS_PROP_COUNTER_INCREMENT, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, required_size, result); @@ -1874,7 +1874,7 @@ css_error parse_counter_reset(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_COUNTER_RESET, flags, value); + opv = buildOPV(CSS_PROP_COUNTER_RESET, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, required_size, result); @@ -1994,7 +1994,7 @@ css_error parse_cue_after(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_CUE_AFTER, flags, value); + opv = buildOPV(CSS_PROP_CUE_AFTER, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == CUE_AFTER_URI) @@ -2049,7 +2049,7 @@ css_error parse_cue_before(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_CUE_BEFORE, flags, value); + opv = buildOPV(CSS_PROP_CUE_BEFORE, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == CUE_BEFORE_URI) @@ -2222,7 +2222,7 @@ css_error parse_cursor(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_CURSOR, flags, value); + opv = buildOPV(CSS_PROP_CURSOR, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, required_size, result); @@ -2366,7 +2366,7 @@ css_error parse_direction(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_DIRECTION, flags, value); + opv = buildOPV(CSS_PROP_DIRECTION, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, sizeof(opv), result); @@ -2438,7 +2438,7 @@ css_error parse_display(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_DISPLAY, flags, value); + opv = buildOPV(CSS_PROP_DISPLAY, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, sizeof(opv), result); @@ -2521,7 +2521,7 @@ css_error parse_elevation(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_ELEVATION, flags, value); + opv = buildOPV(CSS_PROP_ELEVATION, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == ELEVATION_ANGLE) @@ -2572,7 +2572,7 @@ css_error parse_empty_cells(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_EMPTY_CELLS, flags, value); + opv = buildOPV(CSS_PROP_EMPTY_CELLS, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, sizeof(opv), result); @@ -2615,7 +2615,7 @@ css_error parse_float(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_FLOAT, flags, value); + opv = buildOPV(CSS_PROP_FLOAT, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, sizeof(opv), result); @@ -2774,7 +2774,7 @@ css_error parse_font_family(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_FONT_FAMILY, flags, value); + opv = buildOPV(CSS_PROP_FONT_FAMILY, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, required_size, result); @@ -3069,7 +3069,7 @@ css_error parse_font_size(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_FONT_SIZE, flags, value); + opv = buildOPV(CSS_PROP_FONT_SIZE, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == FONT_SIZE_DIMENSION) @@ -3122,7 +3122,7 @@ css_error parse_font_style(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_FONT_STYLE, flags, value); + opv = buildOPV(CSS_PROP_FONT_STYLE, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, sizeof(opv), result); @@ -3163,7 +3163,7 @@ css_error parse_font_variant(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_FONT_VARIANT, flags, value); + opv = buildOPV(CSS_PROP_FONT_VARIANT, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, sizeof(opv), result); @@ -3228,7 +3228,7 @@ css_error parse_font_weight(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_FONT_WEIGHT, flags, value); + opv = buildOPV(CSS_PROP_FONT_WEIGHT, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, sizeof(opv), result); @@ -3287,7 +3287,7 @@ css_error parse_height(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_HEIGHT, flags, value); + opv = buildOPV(CSS_PROP_HEIGHT, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == HEIGHT_SET) @@ -3352,7 +3352,7 @@ css_error parse_left(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_LEFT, flags, value); + opv = buildOPV(CSS_PROP_LEFT, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == LEFT_SET) @@ -3418,7 +3418,7 @@ css_error parse_letter_spacing(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_LETTER_SPACING, flags, value); + opv = buildOPV(CSS_PROP_LETTER_SPACING, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == LETTER_SPACING_SET) @@ -3499,7 +3499,7 @@ css_error parse_line_height(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_LINE_HEIGHT, flags, value); + opv = buildOPV(CSS_PROP_LINE_HEIGHT, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == LINE_HEIGHT_NUMBER) @@ -3558,7 +3558,7 @@ css_error parse_list_style_image(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_LIST_STYLE_IMAGE, flags, value); + opv = buildOPV(CSS_PROP_LIST_STYLE_IMAGE, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == LIST_STYLE_IMAGE_URI) @@ -3609,7 +3609,7 @@ css_error parse_list_style_position(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_LIST_STYLE_POSITION, flags, value); + opv = buildOPV(CSS_PROP_LIST_STYLE_POSITION, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, sizeof(opv), result); @@ -3653,7 +3653,7 @@ css_error parse_list_style_type(css_language *c, return error; } - opv = buildOPV(OP_LIST_STYLE_TYPE, flags, value); + opv = buildOPV(CSS_PROP_LIST_STYLE_TYPE, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, sizeof(opv), result); @@ -3670,28 +3670,29 @@ css_error parse_margin_bottom(css_language *c, const parserutils_vector *vector, int *ctx, css_style **result) { - return parse_margin_side(c, vector, ctx, OP_MARGIN_BOTTOM, result); + return parse_margin_side(c, vector, ctx, + CSS_PROP_MARGIN_BOTTOM, result); } css_error parse_margin_left(css_language *c, const parserutils_vector *vector, int *ctx, css_style **result) { - return parse_margin_side(c, vector, ctx, OP_MARGIN_LEFT, result); + return parse_margin_side(c, vector, ctx, CSS_PROP_MARGIN_LEFT, result); } css_error parse_margin_right(css_language *c, const parserutils_vector *vector, int *ctx, css_style **result) { - return parse_margin_side(c, vector, ctx, OP_MARGIN_RIGHT, result); + return parse_margin_side(c, vector, ctx, CSS_PROP_MARGIN_RIGHT, result); } css_error parse_margin_top(css_language *c, const parserutils_vector *vector, int *ctx, css_style **result) { - return parse_margin_side(c, vector, ctx, OP_MARGIN_TOP, result); + return parse_margin_side(c, vector, ctx, CSS_PROP_MARGIN_TOP, result); } css_error parse_max_height(css_language *c, @@ -3740,7 +3741,7 @@ css_error parse_max_height(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_MAX_HEIGHT, flags, value); + opv = buildOPV(CSS_PROP_MAX_HEIGHT, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == MAX_HEIGHT_SET) @@ -3809,7 +3810,7 @@ css_error parse_max_width(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_MAX_WIDTH, flags, value); + opv = buildOPV(CSS_PROP_MAX_WIDTH, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == MAX_WIDTH_SET) @@ -3874,7 +3875,7 @@ css_error parse_min_height(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_MIN_HEIGHT, flags, value); + opv = buildOPV(CSS_PROP_MIN_HEIGHT, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == MIN_HEIGHT_SET) @@ -3939,7 +3940,7 @@ css_error parse_min_width(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_MIN_WIDTH, flags, value); + opv = buildOPV(CSS_PROP_MIN_WIDTH, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == MIN_WIDTH_SET) @@ -4001,7 +4002,7 @@ css_error parse_orphans(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_ORPHANS, flags, value); + opv = buildOPV(CSS_PROP_ORPHANS, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == ORPHANS_SET) @@ -4059,7 +4060,7 @@ css_error parse_outline_color(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_OUTLINE_COLOR, flags, value); + opv = buildOPV(CSS_PROP_OUTLINE_COLOR, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == OUTLINE_COLOR_SET) @@ -4090,7 +4091,7 @@ css_error parse_outline_style(css_language *c, /* Parse as a border style */ error = parse_border_side_style(c, vector, ctx, - OP_OUTLINE_STYLE, result); + CSS_PROP_OUTLINE_STYLE, result); if (error != CSS_OK) return error; @@ -4111,7 +4112,7 @@ css_error parse_outline_width(css_language *c, { /* Parse as border width */ return parse_border_side_width(c, vector, ctx, - OP_OUTLINE_WIDTH, result); + CSS_PROP_OUTLINE_WIDTH, result); } css_error parse_overflow(css_language *c, @@ -4146,7 +4147,7 @@ css_error parse_overflow(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_OVERFLOW, flags, value); + opv = buildOPV(CSS_PROP_OVERFLOW, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, sizeof(opv), result); @@ -4163,28 +4164,32 @@ css_error parse_padding_bottom(css_language *c, const parserutils_vector *vector, int *ctx, css_style **result) { - return parse_padding_side(c, vector, ctx, OP_PADDING_BOTTOM, result); + return parse_padding_side(c, vector, ctx, + CSS_PROP_PADDING_BOTTOM, result); } css_error parse_padding_left(css_language *c, const parserutils_vector *vector, int *ctx, css_style **result) { - return parse_padding_side(c, vector, ctx, OP_PADDING_LEFT, result); + return parse_padding_side(c, vector, ctx, + CSS_PROP_PADDING_LEFT, result); } css_error parse_padding_right(css_language *c, const parserutils_vector *vector, int *ctx, css_style **result) { - return parse_padding_side(c, vector, ctx, OP_PADDING_RIGHT, result); + return parse_padding_side(c, vector, ctx, + CSS_PROP_PADDING_RIGHT, result); } css_error parse_padding_top(css_language *c, const parserutils_vector *vector, int *ctx, css_style **result) { - return parse_padding_side(c, vector, ctx, OP_PADDING_TOP, result); + return parse_padding_side(c, vector, ctx, + CSS_PROP_PADDING_TOP, result); } css_error parse_page_break_after(css_language *c, @@ -4221,7 +4226,7 @@ css_error parse_page_break_after(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_PAGE_BREAK_AFTER, flags, value); + opv = buildOPV(CSS_PROP_PAGE_BREAK_AFTER, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, sizeof(opv), result); @@ -4268,7 +4273,7 @@ css_error parse_page_break_before(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_PAGE_BREAK_BEFORE, flags, value); + opv = buildOPV(CSS_PROP_PAGE_BREAK_BEFORE, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, sizeof(opv), result); @@ -4309,7 +4314,7 @@ css_error parse_page_break_inside(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_PAGE_BREAK_INSIDE, flags, value); + opv = buildOPV(CSS_PROP_PAGE_BREAK_INSIDE, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, sizeof(opv), result); @@ -4364,7 +4369,7 @@ css_error parse_pause_after(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_PAUSE_AFTER, flags, value); + opv = buildOPV(CSS_PROP_PAUSE_AFTER, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == PAUSE_AFTER_SET) @@ -4429,7 +4434,7 @@ css_error parse_pause_before(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_PAUSE_BEFORE, flags, value); + opv = buildOPV(CSS_PROP_PAUSE_BEFORE, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == PAUSE_BEFORE_SET) @@ -4491,7 +4496,7 @@ css_error parse_pitch_range(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_PITCH_RANGE, flags, value); + opv = buildOPV(CSS_PROP_PITCH_RANGE, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == PITCH_RANGE_SET) @@ -4574,7 +4579,7 @@ css_error parse_pitch(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_PITCH, flags, value); + opv = buildOPV(CSS_PROP_PITCH, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == PITCH_FREQUENCY) @@ -4658,7 +4663,7 @@ css_error parse_play_during(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_PLAY_DURING, flags, value); + opv = buildOPV(CSS_PROP_PLAY_DURING, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && @@ -4714,7 +4719,7 @@ css_error parse_position(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_POSITION, flags, value); + opv = buildOPV(CSS_PROP_POSITION, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, sizeof(opv), result); @@ -4804,7 +4809,7 @@ css_error parse_quotes(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_QUOTES, flags, value); + opv = buildOPV(CSS_PROP_QUOTES, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, required_size, result); @@ -4924,7 +4929,7 @@ css_error parse_richness(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_RICHNESS, flags, value); + opv = buildOPV(CSS_PROP_RICHNESS, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == RICHNESS_SET) @@ -4987,7 +4992,7 @@ css_error parse_right(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_RIGHT, flags, value); + opv = buildOPV(CSS_PROP_RIGHT, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == RIGHT_SET) @@ -5038,7 +5043,7 @@ css_error parse_speak_header(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_SPEAK_HEADER, flags, value); + opv = buildOPV(CSS_PROP_SPEAK_HEADER, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, sizeof(opv), result); @@ -5079,7 +5084,7 @@ css_error parse_speak_numeral(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_SPEAK_NUMERAL, flags, value); + opv = buildOPV(CSS_PROP_SPEAK_NUMERAL, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, sizeof(opv), result); @@ -5120,7 +5125,7 @@ css_error parse_speak_punctuation(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_SPEAK_PUNCTUATION, flags, value); + opv = buildOPV(CSS_PROP_SPEAK_PUNCTUATION, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, sizeof(opv), result); @@ -5163,7 +5168,7 @@ css_error parse_speak(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_SPEAK, flags, value); + opv = buildOPV(CSS_PROP_SPEAK, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, sizeof(opv), result); @@ -5239,7 +5244,7 @@ css_error parse_speech_rate(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_SPEECH_RATE, flags, value); + opv = buildOPV(CSS_PROP_SPEECH_RATE, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == SPEECH_RATE_SET) @@ -5298,7 +5303,7 @@ css_error parse_stress(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_STRESS, flags, value); + opv = buildOPV(CSS_PROP_STRESS, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == STRESS_SET) @@ -5347,7 +5352,7 @@ css_error parse_table_layout(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_TABLE_LAYOUT, flags, value); + opv = buildOPV(CSS_PROP_TABLE_LAYOUT, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, sizeof(opv), result); @@ -5392,7 +5397,7 @@ css_error parse_text_align(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_TEXT_ALIGN, flags, value); + opv = buildOPV(CSS_PROP_TEXT_ALIGN, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, sizeof(opv), result); @@ -5463,7 +5468,7 @@ css_error parse_text_decoration(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_TEXT_DECORATION, flags, value); + opv = buildOPV(CSS_PROP_TEXT_DECORATION, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, sizeof(opv), result); @@ -5514,7 +5519,7 @@ css_error parse_text_indent(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_TEXT_INDENT, flags, value); + opv = buildOPV(CSS_PROP_TEXT_INDENT, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == TEXT_INDENT_SET) @@ -5569,7 +5574,7 @@ css_error parse_text_transform(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_TEXT_TRANSFORM, flags, value); + opv = buildOPV(CSS_PROP_TEXT_TRANSFORM, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, sizeof(opv), result); @@ -5624,7 +5629,7 @@ css_error parse_top(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_TOP, flags, value); + opv = buildOPV(CSS_PROP_TOP, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == TOP_SET) @@ -5677,7 +5682,7 @@ css_error parse_unicode_bidi(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_UNICODE_BIDI, flags, value); + opv = buildOPV(CSS_PROP_UNICODE_BIDI, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, sizeof(opv), result); @@ -5762,7 +5767,7 @@ css_error parse_vertical_align(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_VERTICAL_ALIGN, flags, value); + opv = buildOPV(CSS_PROP_VERTICAL_ALIGN, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == VERTICAL_ALIGN_SET) @@ -5815,7 +5820,7 @@ css_error parse_visibility(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_VISIBILITY, flags, value); + opv = buildOPV(CSS_PROP_VISIBILITY, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, sizeof(opv), result); @@ -5958,7 +5963,7 @@ css_error parse_voice_family(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_VOICE_FAMILY, flags, value); + opv = buildOPV(CSS_PROP_VOICE_FAMILY, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, required_size, result); @@ -6245,7 +6250,7 @@ css_error parse_volume(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_VOLUME, flags, value); + opv = buildOPV(CSS_PROP_VOLUME, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == VOLUME_NUMBER) @@ -6305,7 +6310,7 @@ css_error parse_white_space(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_WHITE_SPACE, flags, value); + opv = buildOPV(CSS_PROP_WHITE_SPACE, flags, value); /* Allocate result */ error = css_stylesheet_style_create(c->sheet, sizeof(opv), result); @@ -6357,7 +6362,7 @@ css_error parse_widows(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_WIDOWS, flags, value); + opv = buildOPV(CSS_PROP_WIDOWS, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == WIDOWS_SET) @@ -6424,7 +6429,7 @@ css_error parse_width(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_WIDTH, flags, value); + opv = buildOPV(CSS_PROP_WIDTH, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == WIDTH_SET) @@ -6490,7 +6495,7 @@ css_error parse_word_spacing(css_language *c, if (error != CSS_OK) return error; - opv = buildOPV(OP_WORD_SPACING, flags, value); + opv = buildOPV(CSS_PROP_WORD_SPACING, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == WORD_SPACING_SET) @@ -6552,7 +6557,7 @@ css_error parse_z_index(css_language *c, } else return CSS_INVALID; - opv = buildOPV(OP_Z_INDEX, flags, value); + opv = buildOPV(CSS_PROP_Z_INDEX, flags, value); required_size = sizeof(opv); if ((flags & FLAG_INHERIT) == false && value == Z_INDEX_SET) diff --git a/src/select/computed.c b/src/select/computed.c index e5605da..7829b23 100644 --- a/src/select/computed.c +++ b/src/select/computed.c @@ -110,7 +110,7 @@ css_error css_computed_style_compose(const css_computed_style *parent, size_t i; /* Iterate through the properties */ - for (i = 0; i < N_OPCODES; i++) { + for (i = 0; i < CSS_N_PROPERTIES; i++) { /* Skip any in extension blocks if the block does not exist */ if (prop_dispatch[i].group == GROUP_UNCOMMON && parent->uncommon == NULL && diff --git a/src/select/dispatch.c b/src/select/dispatch.c index 97ce4a4..98cf6ea 100644 --- a/src/select/dispatch.c +++ b/src/select/dispatch.c @@ -11,105 +11,105 @@ /** * Dispatch table for properties, indexed by opcode */ -struct prop_table prop_dispatch[N_OPCODES] = { - { cascade_azimuth, initial_azimuth, compose_azimuth, 1, GROUP_AURAL}, - { cascade_background_attachment, initial_background_attachment, compose_background_attachment, 0, GROUP_NORMAL }, - { cascade_background_color, initial_background_color, compose_background_color, 0, GROUP_NORMAL }, - { cascade_background_image, initial_background_image, compose_background_image, 0, GROUP_NORMAL }, - { cascade_background_position, initial_background_position, compose_background_position, 0, GROUP_NORMAL }, - { cascade_background_repeat, initial_background_repeat, compose_background_repeat, 0, GROUP_NORMAL }, - { cascade_border_collapse, initial_border_collapse, compose_border_collapse, 1, GROUP_NORMAL }, - { cascade_border_spacing, initial_border_spacing, compose_border_spacing, 1, GROUP_UNCOMMON }, - { cascade_border_top_color, initial_border_top_color, compose_border_top_color, 0, GROUP_NORMAL }, - { cascade_border_right_color, initial_border_right_color, compose_border_right_color, 0, GROUP_NORMAL }, - { cascade_border_bottom_color, initial_border_bottom_color, compose_border_bottom_color, 0, GROUP_NORMAL }, - { cascade_border_left_color, initial_border_left_color, compose_border_left_color, 0, GROUP_NORMAL }, - { cascade_border_top_style, initial_border_top_style, compose_border_top_style, 0, GROUP_NORMAL }, - { cascade_border_right_style, initial_border_right_style, compose_border_right_style, 0, GROUP_NORMAL }, - { cascade_border_bottom_style, initial_border_bottom_style, compose_border_bottom_style, 0, GROUP_NORMAL }, - { cascade_border_left_style, initial_border_left_style, compose_border_left_style, 0, GROUP_NORMAL }, - { cascade_border_top_width, initial_border_top_width, compose_border_top_width, 0, GROUP_NORMAL }, - { cascade_border_right_width, initial_border_right_width, compose_border_right_width, 0, GROUP_NORMAL }, - { cascade_border_bottom_width, initial_border_bottom_width, compose_border_bottom_width, 0, GROUP_NORMAL }, - { cascade_border_left_width, initial_border_left_width, compose_border_left_width, 0, GROUP_NORMAL }, - { cascade_bottom, initial_bottom, compose_bottom, 0, GROUP_NORMAL }, - { cascade_caption_side, initial_caption_side, compose_caption_side, 1, GROUP_NORMAL }, - { cascade_clear, initial_clear, compose_clear, 0, GROUP_NORMAL }, - { cascade_clip, initial_clip, compose_clip, 0, GROUP_UNCOMMON }, - { cascade_color, initial_color, compose_color, 1, GROUP_NORMAL }, - { cascade_content, initial_content, compose_content, 0, GROUP_UNCOMMON }, - { cascade_counter_increment, initial_counter_increment, compose_counter_increment, 0, GROUP_UNCOMMON }, - { cascade_counter_reset, initial_counter_reset, compose_counter_reset, 0, GROUP_UNCOMMON }, - { cascade_cue_after, initial_cue_after, compose_cue_after, 0, GROUP_AURAL }, - { cascade_cue_before, initial_cue_before, compose_cue_before, 0, GROUP_AURAL }, - { cascade_cursor, initial_cursor, compose_cursor, 1, GROUP_UNCOMMON }, - { cascade_direction, initial_direction, compose_direction, 1, GROUP_NORMAL }, - { cascade_display, initial_display, compose_display, 0, GROUP_NORMAL }, - { cascade_elevation, initial_elevation, compose_elevation, 1, GROUP_AURAL }, - { cascade_empty_cells, initial_empty_cells, compose_empty_cells, 1, GROUP_NORMAL }, - { cascade_float, initial_float, compose_float, 0, GROUP_NORMAL }, - { cascade_font_family, initial_font_family, compose_font_family, 1, GROUP_NORMAL }, - { cascade_font_size, initial_font_size, compose_font_size, 1, GROUP_NORMAL }, - { cascade_font_style, initial_font_style, compose_font_style, 1, GROUP_NORMAL }, - { cascade_font_variant, initial_font_variant, compose_font_variant, 1, GROUP_NORMAL }, - { cascade_font_weight, initial_font_weight, compose_font_weight, 1, GROUP_NORMAL }, - { cascade_height, initial_height, compose_height, 0, GROUP_NORMAL }, - { cascade_left, initial_left, compose_left, 0, GROUP_NORMAL }, - { cascade_letter_spacing, initial_letter_spacing, compose_letter_spacing, 1, GROUP_UNCOMMON }, - { cascade_line_height, initial_line_height, compose_line_height, 1, GROUP_NORMAL }, - { cascade_list_style_image, initial_list_style_image, compose_list_style_image, 1, GROUP_NORMAL }, - { cascade_list_style_position, initial_list_style_position, compose_list_style_position, 1, GROUP_NORMAL }, - { cascade_list_style_type, initial_list_style_type, compose_list_style_type, 1, GROUP_NORMAL }, - { cascade_margin_top, initial_margin_top, compose_margin_top, 0, GROUP_NORMAL }, - { cascade_margin_right, initial_margin_right, compose_margin_right, 0, GROUP_NORMAL }, - { cascade_margin_bottom, initial_margin_bottom, compose_margin_bottom, 0, GROUP_NORMAL }, - { cascade_margin_left, initial_margin_left, compose_margin_left, 0, GROUP_NORMAL }, - { cascade_max_height, initial_max_height, compose_max_height, 0, GROUP_NORMAL }, - { cascade_max_width, initial_max_width, compose_max_width, 0, GROUP_NORMAL }, - { cascade_min_height, initial_min_height, compose_min_height, 0, GROUP_NORMAL }, - { cascade_min_width, initial_min_width, compose_min_width, 0, GROUP_NORMAL }, - { cascade_orphans, initial_orphans, compose_orphans, 1, GROUP_PAGE }, - { cascade_outline_color, initial_outline_color, compose_outline_color, 0, GROUP_UNCOMMON }, - { cascade_outline_style, initial_outline_style, compose_outline_style, 0, GROUP_NORMAL }, - { cascade_outline_width, initial_outline_width, compose_outline_width, 0, GROUP_UNCOMMON }, - { cascade_overflow, initial_overflow, compose_overflow, 0, GROUP_NORMAL }, - { cascade_padding_top, initial_padding_top, compose_padding_top, 0, GROUP_NORMAL }, - { cascade_padding_right, initial_padding_right, compose_padding_right, 0, GROUP_NORMAL }, - { cascade_padding_bottom, initial_padding_bottom, compose_padding_bottom, 0, GROUP_NORMAL }, - { cascade_padding_left, initial_padding_left, compose_padding_left, 0, GROUP_NORMAL }, - { cascade_page_break_after, initial_page_break_after, compose_page_break_after, 0, GROUP_PAGE }, - { cascade_page_break_before, initial_page_break_before, compose_page_break_before, 0, GROUP_PAGE }, - { cascade_page_break_inside, initial_page_break_inside, compose_page_break_inside, 1, GROUP_PAGE }, - { cascade_pause_after, initial_pause_after, compose_pause_after, 0, GROUP_AURAL }, - { cascade_pause_before, initial_pause_before, compose_pause_before, 0, GROUP_AURAL }, - { cascade_pitch_range, initial_pitch_range, compose_pitch_range, 1, GROUP_AURAL }, - { cascade_pitch, initial_pitch, compose_pitch, 1, GROUP_AURAL }, - { cascade_play_during, initial_play_during, compose_play_during, 0, GROUP_AURAL }, - { cascade_position, initial_position, compose_position, 0, GROUP_NORMAL }, - { cascade_quotes, initial_quotes, compose_quotes, 1, GROUP_UNCOMMON }, - { cascade_richness, initial_richness, compose_richness, 1, GROUP_AURAL }, - { cascade_right, initial_right, compose_right, 0, GROUP_NORMAL }, - { cascade_speak_header, initial_speak_header, compose_speak_header, 1, GROUP_AURAL }, - { cascade_speak_numeral, initial_speak_numeral, compose_speak_numeral, 1, GROUP_AURAL }, - { cascade_speak_punctuation, initial_speak_punctuation, compose_speak_punctuation, 1, GROUP_AURAL }, - { cascade_speak, initial_speak, compose_speak, 1, GROUP_AURAL }, - { cascade_speech_rate, initial_speech_rate, compose_speech_rate, 1, GROUP_AURAL }, - { cascade_stress, initial_stress, compose_stress, 1, GROUP_AURAL }, - { cascade_table_layout, initial_table_layout, compose_table_layout, 0, GROUP_NORMAL }, - { cascade_text_align, initial_text_align, compose_text_align, 1, GROUP_NORMAL }, - { cascade_text_decoration, initial_text_decoration, compose_text_decoration, 0, GROUP_NORMAL }, - { cascade_text_indent, initial_text_indent, compose_text_indent, 1, GROUP_NORMAL }, - { cascade_text_transform, initial_text_transform, compose_text_transform, 1, GROUP_NORMAL }, - { cascade_top, initial_top, compose_top, 0, GROUP_NORMAL }, - { cascade_unicode_bidi, initial_unicode_bidi, compose_unicode_bidi, 0, GROUP_NORMAL }, - { cascade_vertical_align, initial_vertical_align, compose_vertical_align, 0, GROUP_NORMAL }, - { cascade_visibility, initial_visibility, compose_visibility, 1, GROUP_NORMAL }, - { cascade_voice_family, initial_voice_family, compose_voice_family, 1, GROUP_AURAL }, - { cascade_volume, initial_volume, compose_volume, 1, GROUP_AURAL }, - { cascade_white_space, initial_white_space, compose_white_space, 1, GROUP_NORMAL }, - { cascade_widows, initial_widows, compose_widows, 1, GROUP_PAGE }, - { cascade_width, initial_width, compose_width, 0, GROUP_NORMAL }, - { cascade_word_spacing, initial_word_spacing, compose_word_spacing, 1, GROUP_UNCOMMON }, - { cascade_z_index, initial_z_index, compose_z_index, 0, GROUP_NORMAL } +struct prop_table prop_dispatch[CSS_N_PROPERTIES] = { + { cascade_azimuth, set_azimuth_from_hint, initial_azimuth, compose_azimuth, 1, GROUP_AURAL}, + { cascade_background_attachment, set_background_attachment_from_hint, initial_background_attachment, compose_background_attachment, 0, GROUP_NORMAL }, + { cascade_background_color, set_background_color_from_hint, initial_background_color, compose_background_color, 0, GROUP_NORMAL }, + { cascade_background_image, set_background_image_from_hint, initial_background_image, compose_background_image, 0, GROUP_NORMAL }, + { cascade_background_position, set_background_position_from_hint, initial_background_position, compose_background_position, 0, GROUP_NORMAL }, + { cascade_background_repeat, set_background_repeat_from_hint, initial_background_repeat, compose_background_repeat, 0, GROUP_NORMAL }, + { cascade_border_collapse, set_border_collapse_from_hint, initial_border_collapse, compose_border_collapse, 1, GROUP_NORMAL }, + { cascade_border_spacing, set_border_spacing_from_hint, initial_border_spacing, compose_border_spacing, 1, GROUP_UNCOMMON }, + { cascade_border_top_color, set_border_top_color_from_hint, initial_border_top_color, compose_border_top_color, 0, GROUP_NORMAL }, + { cascade_border_right_color, set_border_right_color_from_hint, initial_border_right_color, compose_border_right_color, 0, GROUP_NORMAL }, + { cascade_border_bottom_color, set_border_bottom_color_from_hint, initial_border_bottom_color, compose_border_bottom_color, 0, GROUP_NORMAL }, + { cascade_border_left_color, set_border_left_color_from_hint, initial_border_left_color, compose_border_left_color, 0, GROUP_NORMAL }, + { cascade_border_top_style, set_border_top_style_from_hint, initial_border_top_style, compose_border_top_style, 0, GROUP_NORMAL }, + { cascade_border_right_style, set_border_right_style_from_hint, initial_border_right_style, compose_border_right_style, 0, GROUP_NORMAL }, + { cascade_border_bottom_style, set_border_bottom_style_from_hint, initial_border_bottom_style, compose_border_bottom_style, 0, GROUP_NORMAL }, + { cascade_border_left_style, set_border_left_style_from_hint, initial_border_left_style, compose_border_left_style, 0, GROUP_NORMAL }, + { cascade_border_top_width, set_border_top_width_from_hint, initial_border_top_width, compose_border_top_width, 0, GROUP_NORMAL }, + { cascade_border_right_width, set_border_right_width_from_hint, initial_border_right_width, compose_border_right_width, 0, GROUP_NORMAL }, + { cascade_border_bottom_width, set_border_bottom_width_from_hint, initial_border_bottom_width, compose_border_bottom_width, 0, GROUP_NORMAL }, + { cascade_border_left_width, set_border_left_width_from_hint, initial_border_left_width, compose_border_left_width, 0, GROUP_NORMAL }, + { cascade_bottom, set_bottom_from_hint, initial_bottom, compose_bottom, 0, GROUP_NORMAL }, + { cascade_caption_side, set_caption_side_from_hint, initial_caption_side, compose_caption_side, 1, GROUP_NORMAL }, + { cascade_clear, set_clear_from_hint, initial_clear, compose_clear, 0, GROUP_NORMAL }, + { cascade_clip, set_clip_from_hint, initial_clip, compose_clip, 0, GROUP_UNCOMMON }, + { cascade_color, set_color_from_hint, initial_color, compose_color, 1, GROUP_NORMAL }, + { cascade_content, set_content_from_hint, initial_content, compose_content, 0, GROUP_UNCOMMON }, + { cascade_counter_increment, set_counter_increment_from_hint, initial_counter_increment, compose_counter_increment, 0, GROUP_UNCOMMON }, + { cascade_counter_reset, set_counter_reset_from_hint, initial_counter_reset, compose_counter_reset, 0, GROUP_UNCOMMON }, + { cascade_cue_after, set_cue_after_from_hint, initial_cue_after, compose_cue_after, 0, GROUP_AURAL }, + { cascade_cue_before, set_cue_before_from_hint, initial_cue_before, compose_cue_before, 0, GROUP_AURAL }, + { cascade_cursor, set_cursor_from_hint, initial_cursor, compose_cursor, 1, GROUP_UNCOMMON }, + { cascade_direction, set_direction_from_hint, initial_direction, compose_direction, 1, GROUP_NORMAL }, + { cascade_display, set_display_from_hint, initial_display, compose_display, 0, GROUP_NORMAL }, + { cascade_elevation, set_elevation_from_hint, initial_elevation, compose_elevation, 1, GROUP_AURAL }, + { cascade_empty_cells, set_empty_cells_from_hint, initial_empty_cells, compose_empty_cells, 1, GROUP_NORMAL }, + { cascade_float, set_float_from_hint, initial_float, compose_float, 0, GROUP_NORMAL }, + { cascade_font_family, set_font_family_from_hint, initial_font_family, compose_font_family, 1, GROUP_NORMAL }, + { cascade_font_size, set_font_size_from_hint, initial_font_size, compose_font_size, 1, GROUP_NORMAL }, + { cascade_font_style, set_font_style_from_hint, initial_font_style, compose_font_style, 1, GROUP_NORMAL }, + { cascade_font_variant, set_font_variant_from_hint, initial_font_variant, compose_font_variant, 1, GROUP_NORMAL }, + { cascade_font_weight, set_font_weight_from_hint, initial_font_weight, compose_font_weight, 1, GROUP_NORMAL }, + { cascade_height, set_height_from_hint, initial_height, compose_height, 0, GROUP_NORMAL }, + { cascade_left, set_left_from_hint, initial_left, compose_left, 0, GROUP_NORMAL }, + { cascade_letter_spacing, set_letter_spacing_from_hint, initial_letter_spacing, compose_letter_spacing, 1, GROUP_UNCOMMON }, + { cascade_line_height, set_line_height_from_hint, initial_line_height, compose_line_height, 1, GROUP_NORMAL }, + { cascade_list_style_image, set_list_style_image_from_hint, initial_list_style_image, compose_list_style_image, 1, GROUP_NORMAL }, + { cascade_list_style_position, set_list_style_position_from_hint, initial_list_style_position, compose_list_style_position, 1, GROUP_NORMAL }, + { cascade_list_style_type, set_list_style_type_from_hint, initial_list_style_type, compose_list_style_type, 1, GROUP_NORMAL }, + { cascade_margin_top, set_margin_top_from_hint, initial_margin_top, compose_margin_top, 0, GROUP_NORMAL }, + { cascade_margin_right, set_margin_right_from_hint, initial_margin_right, compose_margin_right, 0, GROUP_NORMAL }, + { cascade_margin_bottom, set_margin_bottom_from_hint, initial_margin_bottom, compose_margin_bottom, 0, GROUP_NORMAL }, + { cascade_margin_left, set_margin_left_from_hint, initial_margin_left, compose_margin_left, 0, GROUP_NORMAL }, + { cascade_max_height, set_max_height_from_hint, initial_max_height, compose_max_height, 0, GROUP_NORMAL }, + { cascade_max_width, set_max_width_from_hint, initial_max_width, compose_max_width, 0, GROUP_NORMAL }, + { cascade_min_height, set_min_height_from_hint, initial_min_height, compose_min_height, 0, GROUP_NORMAL }, + { cascade_min_width, set_min_width_from_hint, initial_min_width, compose_min_width, 0, GROUP_NORMAL }, + { cascade_orphans, set_orphans_from_hint, initial_orphans, compose_orphans, 1, GROUP_PAGE }, + { cascade_outline_color, set_outline_color_from_hint, initial_outline_color, compose_outline_color, 0, GROUP_UNCOMMON }, + { cascade_outline_style, set_outline_style_from_hint, initial_outline_style, compose_outline_style, 0, GROUP_NORMAL }, + { cascade_outline_width, set_outline_width_from_hint, initial_outline_width, compose_outline_width, 0, GROUP_UNCOMMON }, + { cascade_overflow, set_overflow_from_hint, initial_overflow, compose_overflow, 0, GROUP_NORMAL }, + { cascade_padding_top, set_padding_top_from_hint, initial_padding_top, compose_padding_top, 0, GROUP_NORMAL }, + { cascade_padding_right, set_padding_right_from_hint, initial_padding_right, compose_padding_right, 0, GROUP_NORMAL }, + { cascade_padding_bottom, set_padding_bottom_from_hint, initial_padding_bottom, compose_padding_bottom, 0, GROUP_NORMAL }, + { cascade_padding_left, set_padding_left_from_hint, initial_padding_left, compose_padding_left, 0, GROUP_NORMAL }, + { cascade_page_break_after, set_page_break_after_from_hint, initial_page_break_after, compose_page_break_after, 0, GROUP_PAGE }, + { cascade_page_break_before, set_page_break_before_from_hint, initial_page_break_before, compose_page_break_before, 0, GROUP_PAGE }, + { cascade_page_break_inside, set_page_break_inside_from_hint, initial_page_break_inside, compose_page_break_inside, 1, GROUP_PAGE }, + { cascade_pause_after, set_pause_after_from_hint, initial_pause_after, compose_pause_after, 0, GROUP_AURAL }, + { cascade_pause_before, set_pause_before_from_hint, initial_pause_before, compose_pause_before, 0, GROUP_AURAL }, + { cascade_pitch_range, set_pitch_range_from_hint, initial_pitch_range, compose_pitch_range, 1, GROUP_AURAL }, + { cascade_pitch, set_pitch_from_hint, initial_pitch, compose_pitch, 1, GROUP_AURAL }, + { cascade_play_during, set_play_during_from_hint, initial_play_during, compose_play_during, 0, GROUP_AURAL }, + { cascade_position, set_position_from_hint, initial_position, compose_position, 0, GROUP_NORMAL }, + { cascade_quotes, set_quotes_from_hint, initial_quotes, compose_quotes, 1, GROUP_UNCOMMON }, + { cascade_richness, set_richness_from_hint, initial_richness, compose_richness, 1, GROUP_AURAL }, + { cascade_right, set_right_from_hint, initial_right, compose_right, 0, GROUP_NORMAL }, + { cascade_speak_header, set_speak_header_from_hint, initial_speak_header, compose_speak_header, 1, GROUP_AURAL }, + { cascade_speak_numeral, set_speak_numeral_from_hint, initial_speak_numeral, compose_speak_numeral, 1, GROUP_AURAL }, + { cascade_speak_punctuation, set_speak_punctuation_from_hint, initial_speak_punctuation, compose_speak_punctuation, 1, GROUP_AURAL }, + { cascade_speak, set_speak_from_hint, initial_speak, compose_speak, 1, GROUP_AURAL }, + { cascade_speech_rate, set_speech_rate_from_hint, initial_speech_rate, compose_speech_rate, 1, GROUP_AURAL }, + { cascade_stress, set_stress_from_hint, initial_stress, compose_stress, 1, GROUP_AURAL }, + { cascade_table_layout, set_table_layout_from_hint, initial_table_layout, compose_table_layout, 0, GROUP_NORMAL }, + { cascade_text_align, set_text_align_from_hint, initial_text_align, compose_text_align, 1, GROUP_NORMAL }, + { cascade_text_decoration, set_text_decoration_from_hint, initial_text_decoration, compose_text_decoration, 0, GROUP_NORMAL }, + { cascade_text_indent, set_text_indent_from_hint, initial_text_indent, compose_text_indent, 1, GROUP_NORMAL }, + { cascade_text_transform, set_text_transform_from_hint, initial_text_transform, compose_text_transform, 1, GROUP_NORMAL }, + { cascade_top, set_top_from_hint, initial_top, compose_top, 0, GROUP_NORMAL }, + { cascade_unicode_bidi, set_unicode_bidi_from_hint, initial_unicode_bidi, compose_unicode_bidi, 0, GROUP_NORMAL }, + { cascade_vertical_align, set_vertical_align_from_hint, initial_vertical_align, compose_vertical_align, 0, GROUP_NORMAL }, + { cascade_visibility, set_visibility_from_hint, initial_visibility, compose_visibility, 1, GROUP_NORMAL }, + { cascade_voice_family, set_voice_family_from_hint, initial_voice_family, compose_voice_family, 1, GROUP_AURAL }, + { cascade_volume, set_volume_from_hint, initial_volume, compose_volume, 1, GROUP_AURAL }, + { cascade_white_space, set_white_space_from_hint, initial_white_space, compose_white_space, 1, GROUP_NORMAL }, + { cascade_widows, set_widows_from_hint, initial_widows, compose_widows, 1, GROUP_PAGE }, + { cascade_width, set_width_from_hint, initial_width, compose_width, 0, GROUP_NORMAL }, + { cascade_word_spacing, set_word_spacing_from_hint, initial_word_spacing, compose_word_spacing, 1, GROUP_UNCOMMON }, + { cascade_z_index, set_z_index_from_hint, initial_z_index, compose_z_index, 0, GROUP_NORMAL } }; diff --git a/src/select/dispatch.h b/src/select/dispatch.h index a5f7a7a..e38a89d 100644 --- a/src/select/dispatch.h +++ b/src/select/dispatch.h @@ -30,6 +30,8 @@ enum prop_group { extern struct prop_table { css_error (*cascade)(uint32_t opv, css_style *style, css_select_state *state); + css_error (*set_from_hint)(const css_hint *hint, + css_computed_style *style); css_error (*initial)(css_computed_style *style); css_error (*compose)(const css_computed_style *parent, const css_computed_style *child, @@ -37,6 +39,6 @@ extern struct prop_table { uint32_t inherited : 1, group : 2; -} prop_dispatch[N_OPCODES]; +} prop_dispatch[CSS_N_PROPERTIES]; #endif diff --git a/src/select/properties.h b/src/select/properties.h index d6af879..6f1f453 100644 --- a/src/select/properties.h +++ b/src/select/properties.h @@ -16,594 +16,792 @@ css_error cascade_azimuth(uint32_t opv, css_style *style, css_select_state *state); +css_error set_azimuth_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_azimuth(css_computed_style *style); css_error compose_azimuth(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_background_attachment(uint32_t opv, css_style *style, css_select_state *state); +css_error set_background_attachment_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_background_attachment(css_computed_style *style); css_error compose_background_attachment(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_background_color(uint32_t opv, css_style *style, css_select_state *state); +css_error set_background_color_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_background_color(css_computed_style *style); css_error compose_background_color(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_background_image(uint32_t opv, css_style *style, css_select_state *state); +css_error set_background_image_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_background_image(css_computed_style *style); css_error compose_background_image(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_background_position(uint32_t opv, css_style *style, css_select_state *state); +css_error set_background_position_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_background_position(css_computed_style *style); css_error compose_background_position(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_background_repeat(uint32_t opv, css_style *style, css_select_state *state); +css_error set_background_repeat_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_background_repeat(css_computed_style *style); css_error compose_background_repeat(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_border_collapse(uint32_t opv, css_style *style, css_select_state *state); +css_error set_border_collapse_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_border_collapse(css_computed_style *style); css_error compose_border_collapse(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_border_spacing(uint32_t opv, css_style *style, css_select_state *state); +css_error set_border_spacing_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_border_spacing(css_computed_style *style); css_error compose_border_spacing(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_border_top_color(uint32_t opv, css_style *style, css_select_state *state); +css_error set_border_top_color_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_border_top_color(css_computed_style *style); css_error compose_border_top_color(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_border_right_color(uint32_t opv, css_style *style, css_select_state *state); +css_error set_border_right_color_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_border_right_color(css_computed_style *style); css_error compose_border_right_color(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_border_bottom_color(uint32_t opv, css_style *style, css_select_state *state); +css_error set_border_bottom_color_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_border_bottom_color(css_computed_style *style); css_error compose_border_bottom_color(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_border_left_color(uint32_t opv, css_style *style, css_select_state *state); +css_error set_border_left_color_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_border_left_color(css_computed_style *style); css_error compose_border_left_color(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_border_top_style(uint32_t opv, css_style *style, css_select_state *state); +css_error set_border_top_style_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_border_top_style(css_computed_style *style); css_error compose_border_top_style(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_border_right_style(uint32_t opv, css_style *style, css_select_state *state); +css_error set_border_right_style_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_border_right_style(css_computed_style *style); css_error compose_border_right_style(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_border_bottom_style(uint32_t opv, css_style *style, css_select_state *state); +css_error set_border_bottom_style_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_border_bottom_style(css_computed_style *style); css_error compose_border_bottom_style(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_border_left_style(uint32_t opv, css_style *style, css_select_state *state); +css_error set_border_left_style_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_border_left_style(css_computed_style *style); css_error compose_border_left_style(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_border_top_width(uint32_t opv, css_style *style, css_select_state *state); +css_error set_border_top_width_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_border_top_width(css_computed_style *style); css_error compose_border_top_width(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_border_right_width(uint32_t opv, css_style *style, css_select_state *state); +css_error set_border_right_width_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_border_right_width(css_computed_style *style); css_error compose_border_right_width(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_border_bottom_width(uint32_t opv, css_style *style, css_select_state *state); +css_error set_border_bottom_width_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_border_bottom_width(css_computed_style *style); css_error compose_border_bottom_width(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_border_left_width(uint32_t opv, css_style *style, css_select_state *state); +css_error set_border_left_width_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_border_left_width(css_computed_style *style); css_error compose_border_left_width(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_bottom(uint32_t opv, css_style *style, css_select_state *state); +css_error set_bottom_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_bottom(css_computed_style *style); css_error compose_bottom(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_caption_side(uint32_t opv, css_style *style, css_select_state *state); +css_error set_caption_side_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_caption_side(css_computed_style *style); css_error compose_caption_side(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_clear(uint32_t opv, css_style *style, css_select_state *state); +css_error set_clear_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_clear(css_computed_style *style); css_error compose_clear(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_clip(uint32_t opv, css_style *style, css_select_state *state); +css_error set_clip_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_clip(css_computed_style *style); css_error compose_clip(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_color(uint32_t opv, css_style *style, css_select_state *state); +css_error set_color_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_color(css_computed_style *style); css_error compose_color(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_content(uint32_t opv, css_style *style, css_select_state *state); +css_error set_content_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_content(css_computed_style *style); css_error compose_content(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_counter_increment(uint32_t opv, css_style *style, css_select_state *state); +css_error set_counter_increment_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_counter_increment(css_computed_style *style); css_error compose_counter_increment(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_counter_reset(uint32_t opv, css_style *style, css_select_state *state); +css_error set_counter_reset_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_counter_reset(css_computed_style *style); css_error compose_counter_reset(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_cue_after(uint32_t opv, css_style *style, css_select_state *state); +css_error set_cue_after_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_cue_after(css_computed_style *style); css_error compose_cue_after(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_cue_before(uint32_t opv, css_style *style, css_select_state *state); +css_error set_cue_before_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_cue_before(css_computed_style *style); css_error compose_cue_before(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_cursor(uint32_t opv, css_style *style, css_select_state *state); +css_error set_cursor_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_cursor(css_computed_style *style); css_error compose_cursor(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_direction(uint32_t opv, css_style *style, css_select_state *state); +css_error set_direction_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_direction(css_computed_style *style); css_error compose_direction(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_display(uint32_t opv, css_style *style, css_select_state *state); +css_error set_display_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_display(css_computed_style *style); css_error compose_display(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_elevation(uint32_t opv, css_style *style, css_select_state *state); +css_error set_elevation_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_elevation(css_computed_style *style); css_error compose_elevation(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_empty_cells(uint32_t opv, css_style *style, css_select_state *state); +css_error set_empty_cells_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_empty_cells(css_computed_style *style); css_error compose_empty_cells(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_float(uint32_t opv, css_style *style, css_select_state *state); +css_error set_float_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_float(css_computed_style *style); css_error compose_float(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_font_family(uint32_t opv, css_style *style, css_select_state *state); +css_error set_font_family_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_font_family(css_computed_style *style); css_error compose_font_family(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_font_size(uint32_t opv, css_style *style, css_select_state *state); +css_error set_font_size_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_font_size(css_computed_style *style); css_error compose_font_size(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_font_style(uint32_t opv, css_style *style, css_select_state *state); +css_error set_font_style_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_font_style(css_computed_style *style); css_error compose_font_style(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_font_variant(uint32_t opv, css_style *style, css_select_state *state); +css_error set_font_variant_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_font_variant(css_computed_style *style); css_error compose_font_variant(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_font_weight(uint32_t opv, css_style *style, css_select_state *state); +css_error set_font_weight_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_font_weight(css_computed_style *style); css_error compose_font_weight(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_height(uint32_t opv, css_style *style, css_select_state *state); +css_error set_height_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_height(css_computed_style *style); css_error compose_height(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_left(uint32_t opv, css_style *style, css_select_state *state); +css_error set_left_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_left(css_computed_style *style); css_error compose_left(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_letter_spacing(uint32_t opv, css_style *style, css_select_state *state); +css_error set_letter_spacing_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_letter_spacing(css_computed_style *style); css_error compose_letter_spacing(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_line_height(uint32_t opv, css_style *style, css_select_state *state); +css_error set_line_height_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_line_height(css_computed_style *style); css_error compose_line_height(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_list_style_image(uint32_t opv, css_style *style, css_select_state *state); +css_error set_list_style_image_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_list_style_image(css_computed_style *style); css_error compose_list_style_image(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_list_style_position(uint32_t opv, css_style *style, css_select_state *state); +css_error set_list_style_position_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_list_style_position(css_computed_style *style); css_error compose_list_style_position(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_list_style_type(uint32_t opv, css_style *style, css_select_state *state); +css_error set_list_style_type_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_list_style_type(css_computed_style *style); css_error compose_list_style_type(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_margin_top(uint32_t opv, css_style *style, css_select_state *state); +css_error set_margin_top_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_margin_top(css_computed_style *style); css_error compose_margin_top(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_margin_right(uint32_t opv, css_style *style, css_select_state *state); +css_error set_margin_right_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_margin_right(css_computed_style *style); css_error compose_margin_right(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_margin_bottom(uint32_t opv, css_style *style, css_select_state *state); +css_error set_margin_bottom_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_margin_bottom(css_computed_style *style); css_error compose_margin_bottom(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_margin_left(uint32_t opv, css_style *style, css_select_state *state); +css_error set_margin_left_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_margin_left(css_computed_style *style); css_error compose_margin_left(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_max_height(uint32_t opv, css_style *style, css_select_state *state); +css_error set_max_height_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_max_height(css_computed_style *style); css_error compose_max_height(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_max_width(uint32_t opv, css_style *style, css_select_state *state); +css_error set_max_width_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_max_width(css_computed_style *style); css_error compose_max_width(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_min_height(uint32_t opv, css_style *style, css_select_state *state); +css_error set_min_height_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_min_height(css_computed_style *style); css_error compose_min_height(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_min_width(uint32_t opv, css_style *style, css_select_state *state); +css_error set_min_width_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_min_width(css_computed_style *style); css_error compose_min_width(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_orphans(uint32_t opv, css_style *style, css_select_state *state); +css_error set_orphans_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_orphans(css_computed_style *style); css_error compose_orphans(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_outline_color(uint32_t opv, css_style *style, css_select_state *state); +css_error set_outline_color_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_outline_color(css_computed_style *style); css_error compose_outline_color(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_outline_style(uint32_t opv, css_style *style, css_select_state *state); +css_error set_outline_style_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_outline_style(css_computed_style *style); css_error compose_outline_style(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_outline_width(uint32_t opv, css_style *style, css_select_state *state); +css_error set_outline_width_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_outline_width(css_computed_style *style); css_error compose_outline_width(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_overflow(uint32_t opv, css_style *style, css_select_state *state); +css_error set_overflow_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_overflow(css_computed_style *style); css_error compose_overflow(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_padding_top(uint32_t opv, css_style *style, css_select_state *state); +css_error set_padding_top_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_padding_top(css_computed_style *style); css_error compose_padding_top(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_padding_right(uint32_t opv, css_style *style, css_select_state *state); +css_error set_padding_right_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_padding_right(css_computed_style *style); css_error compose_padding_right(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_padding_bottom(uint32_t opv, css_style *style, css_select_state *state); +css_error set_padding_bottom_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_padding_bottom(css_computed_style *style); css_error compose_padding_bottom(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_padding_left(uint32_t opv, css_style *style, css_select_state *state); +css_error set_padding_left_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_padding_left(css_computed_style *style); css_error compose_padding_left(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_page_break_after(uint32_t opv, css_style *style, css_select_state *state); +css_error set_page_break_after_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_page_break_after(css_computed_style *style); css_error compose_page_break_after(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_page_break_before(uint32_t opv, css_style *style, css_select_state *state); +css_error set_page_break_before_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_page_break_before(css_computed_style *style); css_error compose_page_break_before(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_page_break_inside(uint32_t opv, css_style *style, css_select_state *state); +css_error set_page_break_inside_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_page_break_inside(css_computed_style *style); css_error compose_page_break_inside(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_pause_after(uint32_t opv, css_style *style, css_select_state *state); +css_error set_pause_after_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_pause_after(css_computed_style *style); css_error compose_pause_after(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_pause_before(uint32_t opv, css_style *style, css_select_state *state); +css_error set_pause_before_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_pause_before(css_computed_style *style); css_error compose_pause_before(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_pitch_range(uint32_t opv, css_style *style, css_select_state *state); +css_error set_pitch_range_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_pitch_range(css_computed_style *style); css_error compose_pitch_range(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_pitch(uint32_t opv, css_style *style, css_select_state *state); +css_error set_pitch_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_pitch(css_computed_style *style); css_error compose_pitch(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_play_during(uint32_t opv, css_style *style, css_select_state *state); +css_error set_play_during_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_play_during(css_computed_style *style); css_error compose_play_during(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_position(uint32_t opv, css_style *style, css_select_state *state); +css_error set_position_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_position(css_computed_style *style); css_error compose_position(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_quotes(uint32_t opv, css_style *style, css_select_state *state); +css_error set_quotes_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_quotes(css_computed_style *style); css_error compose_quotes(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_richness(uint32_t opv, css_style *style, css_select_state *state); +css_error set_richness_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_richness(css_computed_style *style); css_error compose_richness(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_right(uint32_t opv, css_style *style, css_select_state *state); +css_error set_right_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_right(css_computed_style *style); css_error compose_right(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_speak_header(uint32_t opv, css_style *style, css_select_state *state); +css_error set_speak_header_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_speak_header(css_computed_style *style); css_error compose_speak_header(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_speak_numeral(uint32_t opv, css_style *style, css_select_state *state); +css_error set_speak_numeral_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_speak_numeral(css_computed_style *style); css_error compose_speak_numeral(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_speak_punctuation(uint32_t opv, css_style *style, css_select_state *state); +css_error set_speak_punctuation_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_speak_punctuation(css_computed_style *style); css_error compose_speak_punctuation(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_speak(uint32_t opv, css_style *style, css_select_state *state); +css_error set_speak_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_speak(css_computed_style *style); css_error compose_speak(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_speech_rate(uint32_t opv, css_style *style, css_select_state *state); +css_error set_speech_rate_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_speech_rate(css_computed_style *style); css_error compose_speech_rate(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_stress(uint32_t opv, css_style *style, css_select_state *state); +css_error set_stress_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_stress(css_computed_style *style); css_error compose_stress(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_table_layout(uint32_t opv, css_style *style, css_select_state *state); +css_error set_table_layout_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_table_layout(css_computed_style *style); css_error compose_table_layout(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_text_align(uint32_t opv, css_style *style, css_select_state *state); +css_error set_text_align_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_text_align(css_computed_style *style); css_error compose_text_align(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_text_decoration(uint32_t opv, css_style *style, css_select_state *state); +css_error set_text_decoration_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_text_decoration(css_computed_style *style); css_error compose_text_decoration(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_text_indent(uint32_t opv, css_style *style, css_select_state *state); +css_error set_text_indent_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_text_indent(css_computed_style *style); css_error compose_text_indent(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_text_transform(uint32_t opv, css_style *style, css_select_state *state); +css_error set_text_transform_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_text_transform(css_computed_style *style); css_error compose_text_transform(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_top(uint32_t opv, css_style *style, css_select_state *state); +css_error set_top_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_top(css_computed_style *style); css_error compose_top(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_unicode_bidi(uint32_t opv, css_style *style, css_select_state *state); +css_error set_unicode_bidi_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_unicode_bidi(css_computed_style *style); css_error compose_unicode_bidi(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_vertical_align(uint32_t opv, css_style *style, css_select_state *state); +css_error set_vertical_align_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_vertical_align(css_computed_style *style); css_error compose_vertical_align(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_visibility(uint32_t opv, css_style *style, css_select_state *state); +css_error set_visibility_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_visibility(css_computed_style *style); css_error compose_visibility(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_voice_family(uint32_t opv, css_style *style, css_select_state *state); +css_error set_voice_family_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_voice_family(css_computed_style *style); css_error compose_voice_family(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_volume(uint32_t opv, css_style *style, css_select_state *state); +css_error set_volume_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_volume(css_computed_style *style); css_error compose_volume(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_white_space(uint32_t opv, css_style *style, css_select_state *state); +css_error set_white_space_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_white_space(css_computed_style *style); css_error compose_white_space(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_widows(uint32_t opv, css_style *style, css_select_state *state); +css_error set_widows_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_widows(css_computed_style *style); css_error compose_widows(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_width(uint32_t opv, css_style *style, css_select_state *state); +css_error set_width_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_width(css_computed_style *style); css_error compose_width(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_word_spacing(uint32_t opv, css_style *style, css_select_state *state); +css_error set_word_spacing_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_word_spacing(css_computed_style *style); css_error compose_word_spacing(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); css_error cascade_z_index(uint32_t opv, css_style *style, css_select_state *state); +css_error set_z_index_from_hint(const css_hint *hint, + css_computed_style *style); css_error initial_z_index(css_computed_style *style); css_error compose_z_index(const css_computed_style *parent, const css_computed_style *child, diff --git a/src/select/select.c b/src/select/select.c index 7b83f90..453289c 100644 --- a/src/select/select.c +++ b/src/select/select.c @@ -240,7 +240,6 @@ css_error css_select_ctx_get_sheet(css_select_ctx *ctx, uint32_t index, * \param node Node to select style for * \param pseudo_element Pseudo element to select for, instead * \param media Currently active media types - * \param hint Presentational hints, or NULL for none * \param result Pointer to style to populate (assumed clean) * \param handler Dispatch table of handler functions * \param pw Client-specific private data for handler functions @@ -257,11 +256,12 @@ 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) { uint32_t i; css_error error; + css_hint hint; css_select_state state; if (ctx == NULL || node == NULL || result == NULL || handler == NULL) @@ -288,23 +288,44 @@ css_error css_select_style(css_select_ctx *ctx, void *node, } } - /** \todo take account of presentational hints: - * - * foreach property in hints: - * if !state.property.set || (state.property.origin == UA || - * (state.property.origin == USER && - * !state.property.important)): - * result.property = property - * state.property.set = true - */ - UNUSED(hints); + /* Take account of presentational hints */ + /** \todo Optimisation: merge this loop and the next together */ + for (i = 0; i < CSS_N_PROPERTIES; i++) { + /* If the existing property value came from an author + * stylesheet or a user sheet using !important, then leave + * it alone. */ + if (state.props[i].set && + (state.props[i].origin == CSS_ORIGIN_AUTHOR || + state.props[i].important)) + continue; + + /* Retrieve this property's hint from the client */ + error = handler->node_presentational_hint(pw, node, i, &hint); + if (error != CSS_OK && error != CSS_PROPERTY_NOT_SET) + goto cleanup; + + /* Ignore if there isn't one */ + if (error != CSS_OK) + continue; + + /* Set it in the result */ + error = prop_dispatch[i].set_from_hint(&hint, result); + if (error != CSS_OK) + goto cleanup; + + /* Keep selection state in sync with reality */ + state.props[i].set = 1; + state.props[i].specificity = 0; + state.props[i].origin = CSS_ORIGIN_AUTHOR; + state.props[i].important = 0; + } /* Finally, fix up any remaining unset properties. * Those properties which are inherited need to be set as inherit. * Those which are not inherited need to be set to their default value. */ /** \todo If node is tree root, everything should be defaulted. */ - for (i = 0; i < N_OPCODES; i++) { + for (i = 0; i < CSS_N_PROPERTIES; i++) { /* Do nothing if this property is set */ if (state.props[i].set) continue; diff --git a/src/select/select.h b/src/select/select.h index e232a0b..1b3c702 100644 --- a/src/select/select.h +++ b/src/select/select.h @@ -52,7 +52,7 @@ typedef struct css_select_state { lwc_string *before; lwc_string *after; - prop_state props[N_OPCODES]; + prop_state props[CSS_N_PROPERTIES]; } css_select_state; static inline void advance_bytecode(css_style *style, uint32_t n_bytes) diff --git a/src/utils/errors.c b/src/utils/errors.c index c53a442..e759d78 100644 --- a/src/utils/errors.c +++ b/src/utils/errors.c @@ -47,6 +47,9 @@ const char *css_error_to_string(css_error error) case CSS_IMPORTS_PENDING: result = "Imports pending"; break; + case CSS_PROPERTY_NOT_SET: + result = "Property not set"; + break; } return result; diff --git a/test/dump.h b/test/dump.h index ac780a9..54a6512 100644 --- a/test/dump.h +++ b/test/dump.h @@ -596,7 +596,7 @@ void dump_bytecode(css_style *style, char **ptr) value = getValue(opv); switch (op) { - case OP_AZIMUTH: + case CSS_PROP_AZIMUTH: switch (value & ~AZIMUTH_BEHIND) { case AZIMUTH_ANGLE: { @@ -645,7 +645,7 @@ void dump_bytecode(css_style *style, char **ptr) if (value & AZIMUTH_BEHIND) *ptr += sprintf(*ptr, " behind"); break; - case OP_BACKGROUND_ATTACHMENT: + case CSS_PROP_BACKGROUND_ATTACHMENT: switch (value) { case BACKGROUND_ATTACHMENT_FIXED: *ptr += sprintf(*ptr, "fixed"); @@ -655,11 +655,11 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_BORDER_TOP_COLOR: - case OP_BORDER_RIGHT_COLOR: - case OP_BORDER_BOTTOM_COLOR: - case OP_BORDER_LEFT_COLOR: - case OP_BACKGROUND_COLOR: + case CSS_PROP_BORDER_TOP_COLOR: + case CSS_PROP_BORDER_RIGHT_COLOR: + case CSS_PROP_BORDER_BOTTOM_COLOR: + case CSS_PROP_BORDER_LEFT_COLOR: + case CSS_PROP_BACKGROUND_COLOR: assert(BACKGROUND_COLOR_TRANSPARENT == BORDER_COLOR_TRANSPARENT); assert(BACKGROUND_COLOR_SET == @@ -679,10 +679,10 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_BACKGROUND_IMAGE: - case OP_CUE_AFTER: - case OP_CUE_BEFORE: - case OP_LIST_STYLE_IMAGE: + case CSS_PROP_BACKGROUND_IMAGE: + case CSS_PROP_CUE_AFTER: + case CSS_PROP_CUE_BEFORE: + case CSS_PROP_LIST_STYLE_IMAGE: assert(BACKGROUND_IMAGE_NONE == CUE_AFTER_NONE); assert(BACKGROUND_IMAGE_URI == CUE_AFTER_URI); assert(BACKGROUND_IMAGE_NONE == CUE_BEFORE_NONE); @@ -709,7 +709,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_BACKGROUND_POSITION: + case CSS_PROP_BACKGROUND_POSITION: switch (value & 0xf0) { case BACKGROUND_POSITION_HORZ_SET: { @@ -754,7 +754,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_BACKGROUND_REPEAT: + case CSS_PROP_BACKGROUND_REPEAT: switch (value) { case BACKGROUND_REPEAT_NO_REPEAT: *ptr += sprintf(*ptr, "no-repeat"); @@ -770,7 +770,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_BORDER_COLLAPSE: + case CSS_PROP_BORDER_COLLAPSE: switch (value) { case BORDER_COLLAPSE_SEPARATE: *ptr += sprintf(*ptr, "separate"); @@ -780,7 +780,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_BORDER_SPACING: + case CSS_PROP_BORDER_SPACING: switch (value) { case BORDER_SPACING_SET: { @@ -800,11 +800,11 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_BORDER_TOP_STYLE: - case OP_BORDER_RIGHT_STYLE: - case OP_BORDER_BOTTOM_STYLE: - case OP_BORDER_LEFT_STYLE: - case OP_OUTLINE_STYLE: + case CSS_PROP_BORDER_TOP_STYLE: + case CSS_PROP_BORDER_RIGHT_STYLE: + case CSS_PROP_BORDER_BOTTOM_STYLE: + case CSS_PROP_BORDER_LEFT_STYLE: + case CSS_PROP_OUTLINE_STYLE: assert(BORDER_STYLE_NONE == OUTLINE_STYLE_NONE); assert(BORDER_STYLE_HIDDEN == OUTLINE_STYLE_HIDDEN); @@ -858,11 +858,11 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_BORDER_TOP_WIDTH: - case OP_BORDER_RIGHT_WIDTH: - case OP_BORDER_BOTTOM_WIDTH: - case OP_BORDER_LEFT_WIDTH: - case OP_OUTLINE_WIDTH: + case CSS_PROP_BORDER_TOP_WIDTH: + case CSS_PROP_BORDER_RIGHT_WIDTH: + case CSS_PROP_BORDER_BOTTOM_WIDTH: + case CSS_PROP_BORDER_LEFT_WIDTH: + case CSS_PROP_OUTLINE_WIDTH: assert(BORDER_WIDTH_SET == OUTLINE_WIDTH_SET); assert(BORDER_WIDTH_THIN == OUTLINE_WIDTH_THIN); assert(BORDER_WIDTH_MEDIUM == @@ -892,16 +892,16 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_MARGIN_TOP: - case OP_MARGIN_RIGHT: - case OP_MARGIN_BOTTOM: - case OP_MARGIN_LEFT: - case OP_BOTTOM: - case OP_LEFT: - case OP_RIGHT: - case OP_TOP: - case OP_HEIGHT: - case OP_WIDTH: + case CSS_PROP_MARGIN_TOP: + case CSS_PROP_MARGIN_RIGHT: + case CSS_PROP_MARGIN_BOTTOM: + case CSS_PROP_MARGIN_LEFT: + case CSS_PROP_BOTTOM: + case CSS_PROP_LEFT: + case CSS_PROP_RIGHT: + case CSS_PROP_TOP: + case CSS_PROP_HEIGHT: + case CSS_PROP_WIDTH: assert(BOTTOM_SET == LEFT_SET); assert(BOTTOM_AUTO == LEFT_AUTO); assert(BOTTOM_SET == RIGHT_SET); @@ -931,7 +931,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_CAPTION_SIDE: + case CSS_PROP_CAPTION_SIDE: switch (value) { case CAPTION_SIDE_TOP: *ptr += sprintf(*ptr, "top"); @@ -941,7 +941,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_CLEAR: + case CSS_PROP_CLEAR: switch (value) { case CLEAR_NONE: *ptr += sprintf(*ptr, "none"); @@ -957,7 +957,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_CLIP: + case CSS_PROP_CLIP: if ((value & CLIP_SHAPE_MASK) == CLIP_SHAPE_RECT) { *ptr += sprintf(*ptr, "rect("); @@ -1012,7 +1012,7 @@ void dump_bytecode(css_style *style, char **ptr) } else *ptr += sprintf(*ptr, "auto"); break; - case OP_COLOR: + case CSS_PROP_COLOR: switch (value) { case COLOR_SET: { @@ -1024,7 +1024,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_CONTENT: + case CSS_PROP_CONTENT: if (value == CONTENT_NORMAL) { *ptr += sprintf(*ptr, "normal"); break; @@ -1095,8 +1095,8 @@ void dump_bytecode(css_style *style, char **ptr) *ptr += sprintf(*ptr, " "); } break; - case OP_COUNTER_INCREMENT: - case OP_COUNTER_RESET: + case CSS_PROP_COUNTER_INCREMENT: + case CSS_PROP_COUNTER_RESET: assert(COUNTER_INCREMENT_NONE == COUNTER_RESET_NONE); assert(COUNTER_INCREMENT_NAMED == @@ -1131,7 +1131,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_CURSOR: + case CSS_PROP_CURSOR: while (value == CURSOR_URI) { lwc_string *he = *((lwc_string **) @@ -1199,7 +1199,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_DIRECTION: + case CSS_PROP_DIRECTION: switch (value) { case DIRECTION_LTR: *ptr += sprintf(*ptr, "ltr"); @@ -1209,7 +1209,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_DISPLAY: + case CSS_PROP_DISPLAY: switch (value) { case DISPLAY_INLINE: *ptr += sprintf(*ptr, "inline"); @@ -1261,7 +1261,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_ELEVATION: + case CSS_PROP_ELEVATION: switch (value) { case ELEVATION_ANGLE: { @@ -1290,7 +1290,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_EMPTY_CELLS: + case CSS_PROP_EMPTY_CELLS: switch (value) { case EMPTY_CELLS_SHOW: *ptr += sprintf(*ptr, "show"); @@ -1300,7 +1300,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_FLOAT: + case CSS_PROP_FLOAT: switch (value) { case FLOAT_LEFT: *ptr += sprintf(*ptr, "left"); @@ -1313,7 +1313,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_FONT_FAMILY: + case CSS_PROP_FONT_FAMILY: while (value != FONT_FAMILY_END) { switch (value) { case FONT_FAMILY_STRING: @@ -1352,7 +1352,7 @@ void dump_bytecode(css_style *style, char **ptr) *ptr += sprintf(*ptr, ", "); } break; - case OP_FONT_SIZE: + case CSS_PROP_FONT_SIZE: switch (value) { case FONT_SIZE_DIMENSION: { @@ -1393,7 +1393,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_FONT_STYLE: + case CSS_PROP_FONT_STYLE: switch (value) { case FONT_STYLE_NORMAL: *ptr += sprintf(*ptr, "normal"); @@ -1406,7 +1406,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_FONT_VARIANT: + case CSS_PROP_FONT_VARIANT: switch (value) { case FONT_VARIANT_NORMAL: *ptr += sprintf(*ptr, "normal"); @@ -1416,7 +1416,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_FONT_WEIGHT: + case CSS_PROP_FONT_WEIGHT: switch (value) { case FONT_WEIGHT_NORMAL: *ptr += sprintf(*ptr, "normal"); @@ -1459,8 +1459,8 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_LETTER_SPACING: - case OP_WORD_SPACING: + case CSS_PROP_LETTER_SPACING: + case CSS_PROP_WORD_SPACING: assert(LETTER_SPACING_SET == WORD_SPACING_SET); assert(LETTER_SPACING_NORMAL == WORD_SPACING_NORMAL); @@ -1481,7 +1481,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_LINE_HEIGHT: + case CSS_PROP_LINE_HEIGHT: switch (value) { case LINE_HEIGHT_NUMBER: { @@ -1505,7 +1505,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_LIST_STYLE_POSITION: + case CSS_PROP_LIST_STYLE_POSITION: switch (value) { case LIST_STYLE_POSITION_INSIDE: *ptr += sprintf(*ptr, "inside"); @@ -1515,7 +1515,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_LIST_STYLE_TYPE: + case CSS_PROP_LIST_STYLE_TYPE: switch (value) { case LIST_STYLE_TYPE_DISC: *ptr += sprintf(*ptr, "disc"); @@ -1564,8 +1564,8 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_MAX_HEIGHT: - case OP_MAX_WIDTH: + case CSS_PROP_MAX_HEIGHT: + case CSS_PROP_MAX_WIDTH: assert(MAX_HEIGHT_SET == MAX_WIDTH_SET); assert(MAX_HEIGHT_NONE == MAX_WIDTH_NONE); @@ -1585,15 +1585,15 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_PADDING_TOP: - case OP_PADDING_RIGHT: - case OP_PADDING_BOTTOM: - case OP_PADDING_LEFT: - case OP_MIN_HEIGHT: - case OP_MIN_WIDTH: - case OP_PAUSE_AFTER: - case OP_PAUSE_BEFORE: - case OP_TEXT_INDENT: + case CSS_PROP_PADDING_TOP: + case CSS_PROP_PADDING_RIGHT: + case CSS_PROP_PADDING_BOTTOM: + case CSS_PROP_PADDING_LEFT: + case CSS_PROP_MIN_HEIGHT: + case CSS_PROP_MIN_WIDTH: + case CSS_PROP_PAUSE_AFTER: + case CSS_PROP_PAUSE_BEFORE: + case CSS_PROP_TEXT_INDENT: assert(MIN_HEIGHT_SET == MIN_WIDTH_SET); assert(MIN_HEIGHT_SET == PADDING_SET); assert(MIN_HEIGHT_SET == PAUSE_AFTER_SET); @@ -1613,11 +1613,11 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_ORPHANS: - case OP_PITCH_RANGE: - case OP_RICHNESS: - case OP_STRESS: - case OP_WIDOWS: + case CSS_PROP_ORPHANS: + case CSS_PROP_PITCH_RANGE: + case CSS_PROP_RICHNESS: + case CSS_PROP_STRESS: + case CSS_PROP_WIDOWS: assert(ORPHANS_SET == PITCH_RANGE_SET); assert(ORPHANS_SET == RICHNESS_SET); assert(ORPHANS_SET == STRESS_SET); @@ -1633,7 +1633,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_OUTLINE_COLOR: + case CSS_PROP_OUTLINE_COLOR: switch (value) { case OUTLINE_COLOR_SET: { @@ -1648,7 +1648,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_OVERFLOW: + case CSS_PROP_OVERFLOW: switch (value) { case OVERFLOW_VISIBLE: *ptr += sprintf(*ptr, "visible"); @@ -1664,8 +1664,8 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_PAGE_BREAK_AFTER: - case OP_PAGE_BREAK_BEFORE: + case CSS_PROP_PAGE_BREAK_AFTER: + case CSS_PROP_PAGE_BREAK_BEFORE: assert(PAGE_BREAK_AFTER_AUTO == PAGE_BREAK_BEFORE_AUTO); assert(PAGE_BREAK_AFTER_ALWAYS == @@ -1695,7 +1695,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_PAGE_BREAK_INSIDE: + case CSS_PROP_PAGE_BREAK_INSIDE: switch (value) { case PAGE_BREAK_INSIDE_AUTO: *ptr += sprintf(*ptr, "auto"); @@ -1705,7 +1705,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_PITCH: + case CSS_PROP_PITCH: switch (value) { case PITCH_FREQUENCY: { @@ -1734,7 +1734,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_PLAY_DURING: + case CSS_PROP_PLAY_DURING: switch (value) { case PLAY_DURING_URI: { @@ -1760,7 +1760,7 @@ void dump_bytecode(css_style *style, char **ptr) if (value & PLAY_DURING_REPEAT) *ptr += sprintf(*ptr, " repeat"); break; - case OP_POSITION: + case CSS_PROP_POSITION: switch (value) { case POSITION_STATIC: *ptr += sprintf(*ptr, "static"); @@ -1776,7 +1776,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_QUOTES: + case CSS_PROP_QUOTES: switch (value) { case QUOTES_STRING: while (value != QUOTES_NONE) { @@ -1805,7 +1805,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_SPEAK_HEADER: + case CSS_PROP_SPEAK_HEADER: switch (value) { case SPEAK_HEADER_ONCE: *ptr += sprintf(*ptr, "once"); @@ -1815,7 +1815,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_SPEAK_NUMERAL: + case CSS_PROP_SPEAK_NUMERAL: switch (value) { case SPEAK_NUMERAL_DIGITS: *ptr += sprintf(*ptr, "digits"); @@ -1825,7 +1825,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_SPEAK_PUNCTUATION: + case CSS_PROP_SPEAK_PUNCTUATION: switch (value) { case SPEAK_PUNCTUATION_CODE: *ptr += sprintf(*ptr, "code"); @@ -1835,7 +1835,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_SPEAK: + case CSS_PROP_SPEAK: switch (value) { case SPEAK_NORMAL: *ptr += sprintf(*ptr, "normal"); @@ -1848,7 +1848,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_SPEECH_RATE: + case CSS_PROP_SPEECH_RATE: switch (value) { case SPEECH_RATE_SET: { @@ -1880,7 +1880,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_TABLE_LAYOUT: + case CSS_PROP_TABLE_LAYOUT: switch (value) { case TABLE_LAYOUT_AUTO: *ptr += sprintf(*ptr, "auto"); @@ -1890,7 +1890,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_TEXT_ALIGN: + case CSS_PROP_TEXT_ALIGN: switch (value) { case TEXT_ALIGN_LEFT: *ptr += sprintf(*ptr, "left"); @@ -1906,7 +1906,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_TEXT_DECORATION: + case CSS_PROP_TEXT_DECORATION: if (value == TEXT_DECORATION_NONE) *ptr += sprintf(*ptr, "none"); @@ -1919,7 +1919,7 @@ void dump_bytecode(css_style *style, char **ptr) if (value & TEXT_DECORATION_BLINK) *ptr += sprintf(*ptr, " blink"); break; - case OP_TEXT_TRANSFORM: + case CSS_PROP_TEXT_TRANSFORM: switch (value) { case TEXT_TRANSFORM_CAPITALIZE: *ptr += sprintf(*ptr, "capitalize"); @@ -1935,7 +1935,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_UNICODE_BIDI: + case CSS_PROP_UNICODE_BIDI: switch (value) { case UNICODE_BIDI_NORMAL: *ptr += sprintf(*ptr, "normal"); @@ -1948,7 +1948,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_VERTICAL_ALIGN: + case CSS_PROP_VERTICAL_ALIGN: switch (value) { case VERTICAL_ALIGN_SET: { @@ -1986,7 +1986,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_VISIBILITY: + case CSS_PROP_VISIBILITY: switch (value) { case VISIBILITY_VISIBLE: *ptr += sprintf(*ptr, "visible"); @@ -1999,7 +1999,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_VOICE_FAMILY: + case CSS_PROP_VOICE_FAMILY: while (value != VOICE_FAMILY_END) { switch (value) { case VOICE_FAMILY_STRING: @@ -2032,7 +2032,7 @@ void dump_bytecode(css_style *style, char **ptr) *ptr += sprintf(*ptr, ", "); } break; - case OP_VOLUME: + case CSS_PROP_VOLUME: switch (value) { case VOLUME_NUMBER: { @@ -2071,7 +2071,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_WHITE_SPACE: + case CSS_PROP_WHITE_SPACE: switch (value) { case WHITE_SPACE_NORMAL: *ptr += sprintf(*ptr, "normal"); @@ -2090,7 +2090,7 @@ void dump_bytecode(css_style *style, char **ptr) break; } break; - case OP_Z_INDEX: + case CSS_PROP_Z_INDEX: switch (value) { case Z_INDEX_SET: { diff --git a/test/select-auto.c b/test/select-auto.c index a0e63da..86c9f89 100644 --- a/test/select-auto.c +++ b/test/select-auto.c @@ -112,6 +112,8 @@ static css_error node_is_active(void *pw, void *node, bool *match); static css_error node_is_focus(void *pw, void *node, bool *match); static css_error node_is_lang(void *pw, void *node, lwc_string *lang, bool *match); +static css_error node_presentational_hint(void *pw, void *node, + uint32_t property, css_hint *hint); static css_select_handler select_handler = { node_name, @@ -132,7 +134,8 @@ static css_select_handler select_handler = { node_is_hover, node_is_active, node_is_focus, - node_is_lang + node_is_lang, + node_presentational_hint }; static void *myrealloc(void *data, size_t len, void *pw) @@ -151,6 +154,9 @@ int main(int argc, char **argv) return 1; } + printf("css_hint: %lu\n", sizeof(css_hint)); + printf("computed: %lu\n", sizeof(css_computed_style)); + assert(css_initialise(argv[1], myrealloc, NULL) == CSS_OK); memset(&ctx, 0, sizeof(ctx)); @@ -631,8 +637,7 @@ void run_test(line_ctx *ctx, const char *exp, size_t explen) testnum++; assert(css_select_style(select, ctx->target, ctx->pseudo_element, - ctx->media, NULL, computed, &select_handler, ctx) == - CSS_OK); + ctx->media, computed, &select_handler, ctx) == CSS_OK); dump_computed_style(computed, buf, &buflen); @@ -1052,3 +1057,14 @@ css_error node_is_lang(void *pw, void *n, return CSS_OK; } +css_error node_presentational_hint(void *pw, void *node, + uint32_t property, css_hint *hint) +{ + UNUSED(pw); + UNUSED(node); + UNUSED(property); + UNUSED(hint); + + return CSS_OK; +} + -- cgit v1.2.3