summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-02-10 17:54:04 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-02-10 17:54:04 +0000
commitc5e6ed5429156f34a51434581e1639e5ebf182db (patch)
tree44b0f3b440bf5f154cec953ab12fe0d860128b74 /src
parent3caf569a9db0c852d7f149cf796d77ce3858cf32 (diff)
downloadlibcss-c5e6ed5429156f34a51434581e1639e5ebf182db.tar.gz
libcss-c5e6ed5429156f34a51434581e1639e5ebf182db.tar.bz2
Purge side bits. These cause more trouble than they're worth, and it's not as if there's a dearth of opcode space.
svn path=/trunk/libcss/; revision=6410
Diffstat (limited to 'src')
-rw-r--r--src/bytecode/bytecode.h169
-rw-r--r--src/bytecode/opcodes.h8
-rw-r--r--src/parse/properties.c122
-rw-r--r--src/select/properties.c290
-rw-r--r--src/select/select.c43
5 files changed, 455 insertions, 177 deletions
diff --git a/src/bytecode/bytecode.h b/src/bytecode/bytecode.h
index e773613..a0810e2 100644
--- a/src/bytecode/bytecode.h
+++ b/src/bytecode/bytecode.h
@@ -22,82 +22,99 @@ typedef enum opcode {
OP_BACKGROUND_REPEAT = 0x005,
OP_BORDER_COLLAPSE = 0x006,
OP_BORDER_SPACING = 0x007,
- OP_BORDER_TRBL_COLOR = 0x008,
- OP_BORDER_TRBL_STYLE = 0x009,
- OP_BORDER_TRBL_WIDTH = 0x00a,
- OP_BOTTOM = 0x00b,
- OP_CAPTION_SIDE = 0x00c,
- OP_CLEAR = 0x00d,
- OP_CLIP = 0x00e,
- OP_COLOR = 0x00f,
- OP_CONTENT = 0x010,
- OP_COUNTER_INCREMENT = 0x011,
- OP_COUNTER_RESET = 0x012,
- OP_CUE_AFTER = 0x013,
- OP_CUE_BEFORE = 0x014,
- OP_CURSOR = 0x015,
- OP_DIRECTION = 0x016,
- OP_DISPLAY = 0x017,
- OP_ELEVATION = 0x018,
- OP_EMPTY_CELLS = 0x019,
- OP_FLOAT = 0x01a,
- OP_FONT_FAMILY = 0x01b,
- OP_FONT_SIZE = 0x01c,
- OP_FONT_STYLE = 0x01d,
- OP_FONT_VARIANT = 0x01e,
- OP_FONT_WEIGHT = 0x01f,
- OP_HEIGHT = 0x020,
- OP_LEFT = 0x021,
- OP_LETTER_SPACING = 0x022,
- OP_LINE_HEIGHT = 0x023,
- OP_LIST_STYLE_IMAGE = 0x024,
- OP_LIST_STYLE_POSITION = 0x025,
- OP_LIST_STYLE_TYPE = 0x026,
- OP_MARGIN_TRBL = 0x027,
- OP_MAX_HEIGHT = 0x028,
- OP_MAX_WIDTH = 0x029,
- OP_MIN_HEIGHT = 0x02a,
- OP_MIN_WIDTH = 0x02b,
- OP_ORPHANS = 0x02c,
- OP_OUTLINE_COLOR = 0x02d,
- OP_OUTLINE_STYLE = 0x02e,
- OP_OUTLINE_WIDTH = 0x02f,
- OP_OVERFLOW = 0x030,
- OP_PADDING_TRBL = 0x031,
- OP_PAGE_BREAK_AFTER = 0x032,
- OP_PAGE_BREAK_BEFORE = 0x033,
- OP_PAGE_BREAK_INSIDE = 0x034,
- OP_PAUSE_AFTER = 0x035,
- OP_PAUSE_BEFORE = 0x036,
- OP_PITCH_RANGE = 0x037,
- OP_PITCH = 0x038,
- OP_PLAY_DURING = 0x039,
- OP_POSITION = 0x03a,
- OP_QUOTES = 0x03b,
- OP_RICHNESS = 0x03c,
- OP_RIGHT = 0x03d,
- OP_SPEAK_HEADER = 0x03e,
- OP_SPEAK_NUMERAL = 0x03f,
- OP_SPEAK_PUNCTUATION = 0x040,
- OP_SPEAK = 0x041,
- OP_SPEECH_RATE = 0x042,
- OP_STRESS = 0x043,
- OP_TABLE_LAYOUT = 0x044,
- OP_TEXT_ALIGN = 0x045,
- OP_TEXT_DECORATION = 0x046,
- OP_TEXT_INDENT = 0x047,
- OP_TEXT_TRANSFORM = 0x048,
- OP_TOP = 0x049,
- OP_UNICODE_BIDI = 0x04a,
- OP_VERTICAL_ALIGN = 0x04b,
- OP_VISIBILITY = 0x04c,
- OP_VOICE_FAMILY = 0x04d,
- OP_VOLUME = 0x04e,
- OP_WHITE_SPACE = 0x04f,
- OP_WIDOWS = 0x050,
- OP_WIDTH = 0x051,
- OP_WORD_SPACING = 0x052,
- OP_Z_INDEX = 0x053,
+ 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;
enum flag {
diff --git a/src/bytecode/opcodes.h b/src/bytecode/opcodes.h
index f82d129..eb68c48 100644
--- a/src/bytecode/opcodes.h
+++ b/src/bytecode/opcodes.h
@@ -10,13 +10,6 @@
#include <inttypes.h>
-enum side {
- SIDE_TOP = 0x0000,
- SIDE_RIGHT = 0x0100,
- SIDE_BOTTOM = 0x0200,
- SIDE_LEFT = 0x0300,
-};
-
enum op_azimuth {
AZIMUTH_ANGLE = 0x0080,
@@ -103,7 +96,6 @@ enum op_border_width {
BORDER_WIDTH_THICK = 0x0002,
};
-/** \todo merge top, right, left, bottom into one opcode and use side bits? */
enum op_bottom {
BOTTOM_SET = 0x0080,
BOTTOM_AUTO = 0x0000,
diff --git a/src/parse/properties.c b/src/parse/properties.c
index 67479dc..c333a17 100644
--- a/src/parse/properties.c
+++ b/src/parse/properties.c
@@ -322,19 +322,19 @@ static inline css_error parse_unit_specifier(css_language *c,
static inline css_error parse_border_side_color(css_language *c,
const parserutils_vector *vector, int *ctx,
- uint16_t side, css_style **result);
+ uint16_t op, css_style **result);
static inline css_error parse_border_side_style(css_language *c,
const parserutils_vector *vector, int *ctx,
- uint16_t side, css_style **result);
+ uint16_t op, css_style **result);
static inline css_error parse_border_side_width(css_language *c,
const parserutils_vector *vector, int *ctx,
- uint16_t side, css_style **result);
+ uint16_t op, css_style **result);
static inline css_error parse_margin_side(css_language *c,
const parserutils_vector *vector, int *ctx,
- uint16_t side, css_style **result);
+ uint16_t op, css_style **result);
static inline css_error parse_padding_side(css_language *c,
const parserutils_vector *vector, int *ctx,
- uint16_t side, css_style **result);
+ uint16_t op, css_style **result);
static inline css_error parse_list_style_type_value(css_language *c,
const css_token *token, uint16_t *value);
static inline css_error parse_content_list(css_language *c,
@@ -973,21 +973,24 @@ css_error parse_border_bottom_color(css_language *c,
const parserutils_vector *vector, int *ctx,
css_style **result)
{
- return parse_border_side_color(c, vector, ctx, SIDE_BOTTOM, result);
+ return parse_border_side_color(c, vector, ctx,
+ OP_BORDER_BOTTOM_COLOR, result);
}
css_error parse_border_bottom_style(css_language *c,
const parserutils_vector *vector, int *ctx,
css_style **result)
{
- return parse_border_side_style(c, vector, ctx, SIDE_BOTTOM, result);
+ return parse_border_side_style(c, vector, ctx,
+ OP_BORDER_BOTTOM_STYLE, result);
}
css_error parse_border_bottom_width(css_language *c,
const parserutils_vector *vector, int *ctx,
css_style **result)
{
- return parse_border_side_width(c, vector, ctx, SIDE_BOTTOM, result);
+ return parse_border_side_width(c, vector, ctx,
+ OP_BORDER_BOTTOM_WIDTH, result);
}
css_error parse_border_collapse(css_language *c,
@@ -1035,42 +1038,48 @@ css_error parse_border_left_color(css_language *c,
const parserutils_vector *vector, int *ctx,
css_style **result)
{
- return parse_border_side_color(c, vector, ctx, SIDE_LEFT, result);
+ return parse_border_side_color(c, vector, ctx,
+ OP_BORDER_LEFT_COLOR, result);
}
css_error parse_border_left_style(css_language *c,
const parserutils_vector *vector, int *ctx,
css_style **result)
{
- return parse_border_side_style(c, vector, ctx, SIDE_LEFT, result);
+ return parse_border_side_style(c, vector, ctx,
+ OP_BORDER_LEFT_STYLE, result);
}
css_error parse_border_left_width(css_language *c,
const parserutils_vector *vector, int *ctx,
css_style **result)
{
- return parse_border_side_width(c, vector, ctx, SIDE_LEFT, result);
+ return parse_border_side_width(c, vector, ctx,
+ OP_BORDER_LEFT_WIDTH, result);
}
css_error parse_border_right_color(css_language *c,
const parserutils_vector *vector, int *ctx,
css_style **result)
{
- return parse_border_side_color(c, vector, ctx, SIDE_RIGHT, result);
+ return parse_border_side_color(c, vector, ctx,
+ OP_BORDER_RIGHT_COLOR, result);
}
css_error parse_border_right_style(css_language *c,
const parserutils_vector *vector, int *ctx,
css_style **result)
{
- return parse_border_side_style(c, vector, ctx, SIDE_RIGHT, result);
+ return parse_border_side_style(c, vector, ctx,
+ OP_BORDER_RIGHT_STYLE, result);
}
css_error parse_border_right_width(css_language *c,
const parserutils_vector *vector, int *ctx,
css_style **result)
{
- return parse_border_side_width(c, vector, ctx, SIDE_RIGHT, result);
+ return parse_border_side_width(c, vector, ctx,
+ OP_BORDER_RIGHT_WIDTH, result);
}
css_error parse_border_spacing(css_language *c,
@@ -1175,21 +1184,24 @@ css_error parse_border_top_color(css_language *c,
const parserutils_vector *vector, int *ctx,
css_style **result)
{
- return parse_border_side_color(c, vector, ctx, SIDE_TOP, result);
+ return parse_border_side_color(c, vector, ctx,
+ OP_BORDER_TOP_COLOR, result);
}
css_error parse_border_top_style(css_language *c,
const parserutils_vector *vector, int *ctx,
css_style **result)
{
- return parse_border_side_style(c, vector, ctx, SIDE_TOP, result);
+ return parse_border_side_style(c, vector, ctx,
+ OP_BORDER_TOP_STYLE, result);
}
css_error parse_border_top_width(css_language *c,
const parserutils_vector *vector, int *ctx,
css_style **result)
{
- return parse_border_side_width(c, vector, ctx, SIDE_TOP, result);
+ return parse_border_side_width(c, vector, ctx,
+ OP_BORDER_TOP_WIDTH, result);
}
css_error parse_bottom(css_language *c,
@@ -3644,28 +3656,28 @@ css_error parse_margin_bottom(css_language *c,
const parserutils_vector *vector, int *ctx,
css_style **result)
{
- return parse_margin_side(c, vector, ctx, SIDE_BOTTOM, result);
+ return parse_margin_side(c, vector, ctx, OP_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, SIDE_LEFT, result);
+ return parse_margin_side(c, vector, ctx, OP_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, SIDE_RIGHT, result);
+ return parse_margin_side(c, vector, ctx, OP_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, SIDE_TOP, result);
+ return parse_margin_side(c, vector, ctx, OP_MARGIN_TOP, result);
}
css_error parse_max_height(css_language *c,
@@ -4062,28 +4074,22 @@ css_error parse_outline_style(css_language *c,
{
css_error error;
uint32_t opv;
- uint8_t flags;
uint16_t value;
- /* Fake as border-left-style */
- error = parse_border_side_style(c, vector, ctx, SIDE_LEFT, result);
+ /* Parse as a border style */
+ error = parse_border_side_style(c, vector, ctx,
+ OP_OUTLINE_STYLE, result);
if (error != CSS_OK)
return error;
- /* Then change the opcode to outline-style, and clear the side bits */
opv = *((uint32_t *) (*result)->bytecode);
- flags = getFlags(opv);
- value = getValue(opv) & ~SIDE_LEFT;
+ value = getValue(opv);
/* Hidden is invalid */
if (value == BORDER_STYLE_HIDDEN)
return CSS_INVALID;
- opv = buildOPV(OP_OUTLINE_STYLE, flags, value);
-
- *((uint32_t *) (*result)->bytecode) = opv;
-
return CSS_OK;
}
@@ -4091,27 +4097,9 @@ css_error parse_outline_width(css_language *c,
const parserutils_vector *vector, int *ctx,
css_style **result)
{
- css_error error;
- uint32_t opv;
- uint8_t flags;
- uint16_t value;
-
- /* Fake as border-left-width */
- error = parse_border_side_width(c, vector, ctx, SIDE_LEFT, result);
- if (error != CSS_OK)
- return error;
-
- /* Then change the opcode to outline-width, and clear the side bits */
- opv = *((uint32_t *) (*result)->bytecode);
-
- flags = getFlags(opv);
- value = getValue(opv) & ~SIDE_LEFT;
-
- opv = buildOPV(OP_OUTLINE_WIDTH, flags, value);
-
- *((uint32_t *) (*result)->bytecode) = opv;
-
- return CSS_OK;
+ /* Parse as border width */
+ return parse_border_side_width(c, vector, ctx,
+ OP_OUTLINE_WIDTH, result);
}
css_error parse_overflow(css_language *c,
@@ -4163,28 +4151,28 @@ css_error parse_padding_bottom(css_language *c,
const parserutils_vector *vector, int *ctx,
css_style **result)
{
- return parse_padding_side(c, vector, ctx, SIDE_BOTTOM, result);
+ return parse_padding_side(c, vector, ctx, OP_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, SIDE_LEFT, result);
+ return parse_padding_side(c, vector, ctx, OP_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, SIDE_RIGHT, result);
+ return parse_padding_side(c, vector, ctx, OP_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, SIDE_TOP, result);
+ return parse_padding_side(c, vector, ctx, OP_PADDING_TOP, result);
}
css_error parse_page_break_after(css_language *c,
@@ -6827,13 +6815,13 @@ css_error parse_unit_specifier(css_language *c,
css_error parse_border_side_color(css_language *c,
const parserutils_vector *vector, int *ctx,
- uint16_t side, css_style **result)
+ uint16_t op, css_style **result)
{
css_error error;
const css_token *token;
+ uint32_t opv;
uint8_t flags = 0;
uint16_t value = 0;
- uint32_t opv;
uint32_t colour = 0;
uint32_t required_size;
@@ -6862,7 +6850,7 @@ css_error parse_border_side_color(css_language *c,
if (error != CSS_OK)
return error;
- opv = buildOPV(OP_BORDER_TRBL_COLOR, flags, value | side);
+ opv = buildOPV(op, flags, value);
required_size = sizeof(opv);
if ((flags & FLAG_INHERIT) == false && value == BORDER_COLOR_SET)
@@ -6885,7 +6873,7 @@ css_error parse_border_side_color(css_language *c,
css_error parse_border_side_style(css_language *c,
const parserutils_vector *vector, int *ctx,
- uint16_t side, css_style **result)
+ uint16_t op, css_style **result)
{
css_error error;
const css_token *ident;
@@ -6928,7 +6916,7 @@ css_error parse_border_side_style(css_language *c,
} else
return CSS_INVALID;
- opv = buildOPV(OP_BORDER_TRBL_STYLE, flags, value | side);
+ opv = buildOPV(op, flags, value);
/* Allocate result */
error = css_stylesheet_style_create(c->sheet, sizeof(opv), result);
@@ -6943,7 +6931,7 @@ css_error parse_border_side_style(css_language *c,
css_error parse_border_side_width(css_language *c,
const parserutils_vector *vector, int *ctx,
- uint16_t side, css_style **result)
+ uint16_t op, css_style **result)
{
css_error error;
const css_token *token;
@@ -6996,7 +6984,7 @@ css_error parse_border_side_width(css_language *c,
if (error != CSS_OK)
return error;
- opv = buildOPV(OP_BORDER_TRBL_WIDTH, flags, value | side);
+ opv = buildOPV(op, flags, value);
required_size = sizeof(opv);
if ((flags & FLAG_INHERIT) == false && value == BORDER_WIDTH_SET)
@@ -7021,7 +7009,7 @@ css_error parse_border_side_width(css_language *c,
css_error parse_margin_side(css_language *c,
const parserutils_vector *vector, int *ctx,
- uint16_t side, css_style **result)
+ uint16_t op, css_style **result)
{
css_error error;
const css_token *token;
@@ -7061,7 +7049,7 @@ css_error parse_margin_side(css_language *c,
if (error != CSS_OK)
return error;
- opv = buildOPV(OP_MARGIN_TRBL, flags, value | side);
+ opv = buildOPV(op, flags, value);
required_size = sizeof(opv);
if ((flags & FLAG_INHERIT) == false && value == MARGIN_SET)
@@ -7086,7 +7074,7 @@ css_error parse_margin_side(css_language *c,
css_error parse_padding_side(css_language *c,
const parserutils_vector *vector, int *ctx,
- uint16_t side, css_style **result)
+ uint16_t op, css_style **result)
{
css_error error;
const css_token *token;
@@ -7126,7 +7114,7 @@ css_error parse_padding_side(css_language *c,
if (error != CSS_OK)
return error;
- opv = buildOPV(OP_PADDING_TRBL, flags, value | side);
+ opv = buildOPV(op, flags, value);
required_size = sizeof(opv);
if ((flags & FLAG_INHERIT) == false && value == PADDING_SET)
diff --git a/src/select/properties.c b/src/select/properties.c
index 658f668..db3fca9 100644
--- a/src/select/properties.c
+++ b/src/select/properties.c
@@ -149,7 +149,7 @@ static css_error initial_border_spacing(css_computed_style *style)
return CSS_OK;
}
-static css_error cascade_border_color(css_select_ctx *ctx,
+static css_error cascade_border_top_color(css_select_ctx *ctx,
uint32_t opv, css_style *style, css_select_state *state)
{
UNUSED(ctx);
@@ -160,14 +160,14 @@ static css_error cascade_border_color(css_select_ctx *ctx,
return CSS_OK;
}
-static css_error initial_border_color(css_computed_style *style)
+static css_error initial_border_top_color(css_computed_style *style)
{
UNUSED(style);
return CSS_OK;
}
-static css_error cascade_border_style(css_select_ctx *ctx,
+static css_error cascade_border_right_color(css_select_ctx *ctx,
uint32_t opv, css_style *style, css_select_state *state)
{
UNUSED(ctx);
@@ -178,14 +178,14 @@ static css_error cascade_border_style(css_select_ctx *ctx,
return CSS_OK;
}
-static css_error initial_border_style(css_computed_style *style)
+static css_error initial_border_right_color(css_computed_style *style)
{
UNUSED(style);
return CSS_OK;
}
-static css_error cascade_border_width(css_select_ctx *ctx,
+static css_error cascade_border_bottom_color(css_select_ctx *ctx,
uint32_t opv, css_style *style, css_select_state *state)
{
UNUSED(ctx);
@@ -196,7 +196,169 @@ static css_error cascade_border_width(css_select_ctx *ctx,
return CSS_OK;
}
-static css_error initial_border_width(css_computed_style *style)
+static css_error initial_border_bottom_color(css_computed_style *style)
+{
+ UNUSED(style);
+
+ return CSS_OK;
+}
+
+static css_error cascade_border_left_color(css_select_ctx *ctx,
+ uint32_t opv, css_style *style, css_select_state *state)
+{
+ UNUSED(ctx);
+ UNUSED(opv);
+ UNUSED(style);
+ UNUSED(state);
+
+ return CSS_OK;
+}
+
+static css_error initial_border_left_color(css_computed_style *style)
+{
+ UNUSED(style);
+
+ return CSS_OK;
+}
+
+static css_error cascade_border_top_style(css_select_ctx *ctx,
+ uint32_t opv, css_style *style, css_select_state *state)
+{
+ UNUSED(ctx);
+ UNUSED(opv);
+ UNUSED(style);
+ UNUSED(state);
+
+ return CSS_OK;
+}
+
+static css_error initial_border_top_style(css_computed_style *style)
+{
+ UNUSED(style);
+
+ return CSS_OK;
+}
+
+static css_error cascade_border_right_style(css_select_ctx *ctx,
+ uint32_t opv, css_style *style, css_select_state *state)
+{
+ UNUSED(ctx);
+ UNUSED(opv);
+ UNUSED(style);
+ UNUSED(state);
+
+ return CSS_OK;
+}
+
+static css_error initial_border_right_style(css_computed_style *style)
+{
+ UNUSED(style);
+
+ return CSS_OK;
+}
+
+static css_error cascade_border_bottom_style(css_select_ctx *ctx,
+ uint32_t opv, css_style *style, css_select_state *state)
+{
+ UNUSED(ctx);
+ UNUSED(opv);
+ UNUSED(style);
+ UNUSED(state);
+
+ return CSS_OK;
+}
+
+static css_error initial_border_bottom_style(css_computed_style *style)
+{
+ UNUSED(style);
+
+ return CSS_OK;
+}
+
+static css_error cascade_border_left_style(css_select_ctx *ctx,
+ uint32_t opv, css_style *style, css_select_state *state)
+{
+ UNUSED(ctx);
+ UNUSED(opv);
+ UNUSED(style);
+ UNUSED(state);
+
+ return CSS_OK;
+}
+
+static css_error initial_border_left_style(css_computed_style *style)
+{
+ UNUSED(style);
+
+ return CSS_OK;
+}
+
+static css_error cascade_border_top_width(css_select_ctx *ctx,
+ uint32_t opv, css_style *style, css_select_state *state)
+{
+ UNUSED(ctx);
+ UNUSED(opv);
+ UNUSED(style);
+ UNUSED(state);
+
+ return CSS_OK;
+}
+
+static css_error initial_border_top_width(css_computed_style *style)
+{
+ UNUSED(style);
+
+ return CSS_OK;
+}
+
+static css_error cascade_border_right_width(css_select_ctx *ctx,
+ uint32_t opv, css_style *style, css_select_state *state)
+{
+ UNUSED(ctx);
+ UNUSED(opv);
+ UNUSED(style);
+ UNUSED(state);
+
+ return CSS_OK;
+}
+
+static css_error initial_border_right_width(css_computed_style *style)
+{
+ UNUSED(style);
+
+ return CSS_OK;
+}
+
+static css_error cascade_border_bottom_width(css_select_ctx *ctx,
+ uint32_t opv, css_style *style, css_select_state *state)
+{
+ UNUSED(ctx);
+ UNUSED(opv);
+ UNUSED(style);
+ UNUSED(state);
+
+ return CSS_OK;
+}
+
+static css_error initial_border_bottom_width(css_computed_style *style)
+{
+ UNUSED(style);
+
+ return CSS_OK;
+}
+
+static css_error cascade_border_left_width(css_select_ctx *ctx,
+ uint32_t opv, css_style *style, css_select_state *state)
+{
+ UNUSED(ctx);
+ UNUSED(opv);
+ UNUSED(style);
+ UNUSED(state);
+
+ return CSS_OK;
+}
+
+static css_error initial_border_left_width(css_computed_style *style)
{
UNUSED(style);
@@ -707,7 +869,61 @@ static css_error initial_list_style_type(css_computed_style *style)
return CSS_OK;
}
-static css_error cascade_margin(css_select_ctx *ctx,
+static css_error cascade_margin_top(css_select_ctx *ctx,
+ uint32_t opv, css_style *style, css_select_state *state)
+{
+ UNUSED(ctx);
+ UNUSED(opv);
+ UNUSED(style);
+ UNUSED(state);
+
+ return CSS_OK;
+}
+
+static css_error initial_margin_top(css_computed_style *style)
+{
+ UNUSED(style);
+
+ return CSS_OK;
+}
+
+static css_error cascade_margin_right(css_select_ctx *ctx,
+ uint32_t opv, css_style *style, css_select_state *state)
+{
+ UNUSED(ctx);
+ UNUSED(opv);
+ UNUSED(style);
+ UNUSED(state);
+
+ return CSS_OK;
+}
+
+static css_error initial_margin_right(css_computed_style *style)
+{
+ UNUSED(style);
+
+ return CSS_OK;
+}
+
+static css_error cascade_margin_bottom(css_select_ctx *ctx,
+ uint32_t opv, css_style *style, css_select_state *state)
+{
+ UNUSED(ctx);
+ UNUSED(opv);
+ UNUSED(style);
+ UNUSED(state);
+
+ return CSS_OK;
+}
+
+static css_error initial_margin_bottom(css_computed_style *style)
+{
+ UNUSED(style);
+
+ return CSS_OK;
+}
+
+static css_error cascade_margin_left(css_select_ctx *ctx,
uint32_t opv, css_style *style, css_select_state *state)
{
UNUSED(ctx);
@@ -718,7 +934,7 @@ static css_error cascade_margin(css_select_ctx *ctx,
return CSS_OK;
}
-static css_error initial_margin(css_computed_style *style)
+static css_error initial_margin_left(css_computed_style *style)
{
UNUSED(style);
@@ -887,7 +1103,61 @@ static css_error initial_overflow(css_computed_style *style)
return CSS_OK;
}
-static css_error cascade_padding(css_select_ctx *ctx,
+static css_error cascade_padding_top(css_select_ctx *ctx,
+ uint32_t opv, css_style *style, css_select_state *state)
+{
+ UNUSED(ctx);
+ UNUSED(opv);
+ UNUSED(style);
+ UNUSED(state);
+
+ return CSS_OK;
+}
+
+static css_error initial_padding_top(css_computed_style *style)
+{
+ UNUSED(style);
+
+ return CSS_OK;
+}
+
+static css_error cascade_padding_right(css_select_ctx *ctx,
+ uint32_t opv, css_style *style, css_select_state *state)
+{
+ UNUSED(ctx);
+ UNUSED(opv);
+ UNUSED(style);
+ UNUSED(state);
+
+ return CSS_OK;
+}
+
+static css_error initial_padding_right(css_computed_style *style)
+{
+ UNUSED(style);
+
+ return CSS_OK;
+}
+
+static css_error cascade_padding_bottom(css_select_ctx *ctx,
+ uint32_t opv, css_style *style, css_select_state *state)
+{
+ UNUSED(ctx);
+ UNUSED(opv);
+ UNUSED(style);
+ UNUSED(state);
+
+ return CSS_OK;
+}
+
+static css_error initial_padding_bottom(css_computed_style *style)
+{
+ UNUSED(style);
+
+ return CSS_OK;
+}
+
+static css_error cascade_padding_left(css_select_ctx *ctx,
uint32_t opv, css_style *style, css_select_state *state)
{
UNUSED(ctx);
@@ -898,7 +1168,7 @@ static css_error cascade_padding(css_select_ctx *ctx,
return CSS_OK;
}
-static css_error initial_padding(css_computed_style *style)
+static css_error initial_padding_left(css_computed_style *style)
{
UNUSED(style);
diff --git a/src/select/select.c b/src/select/select.c
index 21f3770..74db52f 100644
--- a/src/select/select.c
+++ b/src/select/select.c
@@ -50,14 +50,11 @@ typedef struct css_select_state {
uint32_t current_rule_index; /* Index of current rule */
uint32_t current_specificity; /* Specificity of current rule */
-/** \todo We need a better way of knowing the number of properties
- * Bytecode opcodes cover 84 properties, then there's a
- * further 15 generated from the side bits */
-/* Stylesheet identity is a monotonically increasing number based at 1 and
- * increasing by 1 for every applicable stylesheet encountered, including
- * imports. Imported sheets' identities are below that of the sheet that
- * imported them. */
-#define N_PROPS (99)
+ /* Stylesheet identity is a monotonically increasing number based at 1
+ * and increasing by 1 for every applicable stylesheet encountered,
+ * including imports. Imported sheets' identities are below that of
+ * the sheet that imported them.
+ */
struct {
uint32_t specificity; /* Specificity of property in result */
uint32_t sheet; /* Identity of applicable stylesheet */
@@ -65,8 +62,7 @@ typedef struct css_select_state {
origin : 2, /* Origin of property in result */
important : 1, /* Importance of property in result */
index : 16;/* Index of corresponding rule */
- } props[N_PROPS];
-#undef N_PROPS
+ } props[N_OPCODES];
} css_select_state;
static css_error select_from_sheet(css_select_ctx *ctx,
@@ -104,7 +100,7 @@ static struct prop_table {
css_error (*initial)(css_computed_style *style);
uint32_t inherited : 1;
-} properties[] = {
+} properties[N_OPCODES] = {
{ cascade_azimuth, initial_azimuth, 1 },
{ cascade_background_attachment, initial_background_attachment, 0 },
{ cascade_background_color, initial_background_color, 0 },
@@ -113,9 +109,18 @@ static struct prop_table {
{ cascade_background_repeat, initial_background_repeat, 0 },
{ cascade_border_collapse, initial_border_collapse, 1 },
{ cascade_border_spacing, initial_border_spacing, 1 },
- { cascade_border_color, initial_border_color, 0 },
- { cascade_border_style, initial_border_style, 0 },
- { cascade_border_width, initial_border_width, 0 },
+ { cascade_border_top_color, initial_border_top_color, 0 },
+ { cascade_border_right_color, initial_border_right_color, 0 },
+ { cascade_border_bottom_color, initial_border_bottom_color, 0 },
+ { cascade_border_left_color, initial_border_left_color, 0 },
+ { cascade_border_top_style, initial_border_top_style, 0 },
+ { cascade_border_right_style, initial_border_right_style, 0 },
+ { cascade_border_bottom_style, initial_border_bottom_style, 0 },
+ { cascade_border_left_style, initial_border_left_style, 0 },
+ { cascade_border_top_width, initial_border_top_width, 0 },
+ { cascade_border_right_width, initial_border_right_width, 0 },
+ { cascade_border_bottom_width, initial_border_bottom_width, 0 },
+ { cascade_border_left_width, initial_border_left_width, 0 },
{ cascade_bottom, initial_bottom, 0 },
{ cascade_caption_side, initial_caption_side, 1 },
{ cascade_clear, initial_clear, 0 },
@@ -144,7 +149,10 @@ static struct prop_table {
{ cascade_list_style_image, initial_list_style_image, 1 },
{ cascade_list_style_position, initial_list_style_position, 1 },
{ cascade_list_style_type, initial_list_style_type, 1 },
- { cascade_margin, initial_margin, 0 },
+ { cascade_margin_top, initial_margin_top, 0 },
+ { cascade_margin_right, initial_margin_right, 0 },
+ { cascade_margin_bottom, initial_margin_bottom, 0 },
+ { cascade_margin_left, initial_margin_left, 0 },
{ cascade_max_height, initial_max_height, 0 },
{ cascade_max_width, initial_max_width, 0 },
{ cascade_min_height, initial_min_height, 0 },
@@ -154,7 +162,10 @@ static struct prop_table {
{ cascade_outline_style, initial_outline_style, 0 },
{ cascade_outline_width, initial_outline_width, 0 },
{ cascade_overflow, initial_overflow, 0 },
- { cascade_padding, initial_padding, 0 },
+ { cascade_padding_top, initial_padding_top, 0 },
+ { cascade_padding_right, initial_padding_right, 0 },
+ { cascade_padding_bottom, initial_padding_bottom, 0 },
+ { cascade_padding_left, initial_padding_left, 0 },
{ cascade_page_break_after, initial_page_break_after, 0 },
{ cascade_page_break_before, initial_page_break_before, 0 },
{ cascade_page_break_inside, initial_page_break_inside, 1 },