r5628 jmb - /trunk/libcss/src/stylesheet.c
by netsurf@semichrome.net
Author: jmb
Date: Fri Oct 24 21:04:58 2008
New Revision: 5628
URL: http://source.netsurf-browser.org?rev=5628&view=rev
Log:
Fix memory corruption. This took far too long to debug. Bah.
Modified:
trunk/libcss/src/stylesheet.c
Modified: trunk/libcss/src/stylesheet.c
URL: http://source.netsurf-browser.org/trunk/libcss/src/stylesheet.c?rev=5628&...
==============================================================================
--- trunk/libcss/src/stylesheet.c (original)
+++ trunk/libcss/src/stylesheet.c Fri Oct 24 21:04:58 2008
@@ -535,7 +535,8 @@
if (cur != NULL) {
/* Already have a style, so append to the end of the bytecode */
css_style *temp = sheet->alloc(cur,
- cur->length + style->length, sheet->pw);
+ sizeof(css_style) + cur->length + style->length,
+ sheet->pw);
if (temp == NULL)
return CSS_NOMEM;
14 years, 3 months
r5627 jmb - in /trunk/libcss: docs/Bytecode src/bytecode/Makefile src/bytecode/bytecode.h src/bytecode/dump.c src/parse/css21.c src/parse/css21props.c src/stylesheet.c
by netsurf@semichrome.net
Author: jmb
Date: Fri Oct 24 20:24:03 2008
New Revision: 5627
URL: http://source.netsurf-browser.org?rev=5627&view=rev
Log:
A bunch of property parsers.
Split out !important parsing into a separate function.
Support for dumping bytecode to a file handle in some kind of human-readable format.
Strings can be represented in the bytecode as a pointer, length pair rather than embedding the string data into the bytecode -- all strings are interned by the core syntax parser.
Add todo relating to early destruction of parser object (it shouldn't be needed once parsing is complete). Note documented issue surrounding interned string dictionary, however.
In general, it seems wasteful to create a new dictionary containing string representations of keywords for every single parser instance. It would be better to have one central (statically allocated?) dictionary for this and then each parser instance can have a smaller dictionary containing any unknown strings contained within the stylesheet being parsed (e.g. string constants or URLs).
Added:
trunk/libcss/src/bytecode/Makefile
trunk/libcss/src/bytecode/dump.c
Modified:
trunk/libcss/docs/Bytecode
trunk/libcss/src/bytecode/bytecode.h
trunk/libcss/src/parse/css21.c
trunk/libcss/src/parse/css21props.c
trunk/libcss/src/stylesheet.c
Modified: trunk/libcss/docs/Bytecode
URL: http://source.netsurf-browser.org/trunk/libcss/docs/Bytecode?rev=5627&r1=...
==============================================================================
--- trunk/libcss/docs/Bytecode (original)
+++ trunk/libcss/docs/Bytecode Fri Oct 24 20:24:03 2008
@@ -32,9 +32,9 @@
Integers wider than 32 bits are not supported.
Doubles are not supported.
-Strings are stored unterminated UTF8, preceded by 32bits of byte length, and
-followed by 0-3 bytes of padding for alignment. The padding bytes must be
-zero. The padding is not included in the byte length.
+Strings are stored as <pointer,length> pairs, as per css_string.
+Pointer's width is the native width of a pointer on the platform.
+Length's width is the native width of a size_t on the platform.
CSS dimensions are stored as two 32bit values: <length, units>.
Length is a 32bit integer and unit is as follows:
Added: trunk/libcss/src/bytecode/Makefile
URL: http://source.netsurf-browser.org/trunk/libcss/src/bytecode/Makefile?rev=...
==============================================================================
--- trunk/libcss/src/bytecode/Makefile (added)
+++ trunk/libcss/src/bytecode/Makefile Fri Oct 24 20:24:03 2008
@@ -1,0 +1,49 @@
+# Child makefile fragment
+#
+# Toolchain is provided by top-level makefile
+#
+# Variables provided by top-level makefile
+#
+# COMPONENT The name of the component
+# EXPORT The location of the export directory
+# TOP The location of the source tree root
+# RELEASEDIR The place to put release objects
+# DEBUGDIR The place to put debug objects
+#
+# do_include Canned command sequence to include a child makefile
+#
+# Variables provided by parent makefile:
+#
+# DIR The name of the directory we're in, relative to $(TOP)
+#
+# Variables we can manipulate:
+#
+# ITEMS_CLEAN The list of items to remove for "make clean"
+# ITEMS_DISTCLEAN The list of items to remove for "make distclean"
+# TARGET_TESTS The list of target names to run for "make test"
+#
+# SOURCES The list of sources to build for $(COMPONENT)
+#
+# Plus anything from the toolchain
+
+# Push parent directory onto the directory stack
+sp := $(sp).x
+dirstack_$(sp) := $(d)
+d := $(DIR)
+
+# Manipulate include paths
+CFLAGS := $(CFLAGS) -I$(d)
+
+# Sources
+SRCS_$(d) := dump.c
+
+# Append to sources for component
+SOURCES += $(addprefix $(d), $(SRCS_$(d)))
+
+# Now include any children we may have
+MAKE_INCLUDES := $(wildcard $(d)*/Makefile)
+$(eval $(foreach INC, $(MAKE_INCLUDES), $(call do_include,$(INC))))
+
+# Finally, pop off the directory stack
+d := $(dirstack_$(sp))
+sp := $(basename $(sp))
Modified: trunk/libcss/src/bytecode/bytecode.h
URL: http://source.netsurf-browser.org/trunk/libcss/src/bytecode/bytecode.h?re...
==============================================================================
--- trunk/libcss/src/bytecode/bytecode.h (original)
+++ trunk/libcss/src/bytecode/bytecode.h Fri Oct 24 20:24:03 2008
@@ -9,6 +9,7 @@
#define css_bytecode_bytecode_h_
#include <inttypes.h>
+#include <stdio.h>
#include <libcss/types.h>
@@ -163,6 +164,8 @@
return getFlags(OPV) & 0x2;
}
+void css_bytecode_dump(void *bytecode, uint32_t length, FILE *fp);
+
#endif
Added: trunk/libcss/src/bytecode/dump.c
URL: http://source.netsurf-browser.org/trunk/libcss/src/bytecode/dump.c?rev=56...
==============================================================================
--- trunk/libcss/src/bytecode/dump.c (added)
+++ trunk/libcss/src/bytecode/dump.c Fri Oct 24 20:24:03 2008
@@ -1,0 +1,229 @@
+/*
+ * This file is part of LibCSS.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2008 John-Mark Bell <jmb(a)netsurf-browser.org>
+ */
+
+#include "bytecode/bytecode.h"
+#include "bytecode/opcodes.h"
+
+/**
+ * Opcode names, indexed by opcode
+ */
+static const char *opcode_names[] = {
+ "azimuth",
+ "background-attachment",
+ "background-color",
+ "background-image",
+ "background-position",
+ "background-repeat",
+ "border-collapse",
+ "border-spacing",
+ "border-trbl-color",
+ "border-trbl-style",
+ "border-trbl-width",
+ "bottom",
+ "caption-side",
+ "clear",
+ "clip",
+ "color",
+ "content",
+ "counter-increment",
+ "counter-reset",
+ "cue-after",
+ "cue-before",
+ "cursor",
+ "direction",
+ "display",
+ "elevation",
+ "empty-cells",
+ "float",
+ "font-family",
+ "font-size",
+ "font-style",
+ "font-variant",
+ "font-weight",
+ "height",
+ "left",
+ "letter-spacing",
+ "line-height",
+ "list-style-image",
+ "list-style-position",
+ "list-style-type",
+ "margin-trbl",
+ "max-height",
+ "max-width",
+ "min-height",
+ "min-width",
+ "orphans",
+ "outline-color",
+ "outline-style",
+ "outline-width",
+ "overflow",
+ "padding-trbl",
+ "page-break-after",
+ "page-break-before",
+ "page-break-inside",
+ "pause-after",
+ "pause-before",
+ "pitch-range",
+ "pitch",
+ "play-during",
+ "position",
+ "quotes",
+ "richness",
+ "right",
+ "speak-header",
+ "speak-numeral",
+ "speak-punctuation",
+ "speak",
+ "speech-rate",
+ "stress",
+ "table-layout",
+ "text-align",
+ "text-decoration",
+ "text-indent",
+ "text-transform",
+ "top",
+ "unicode-bidi",
+ "vertical-align",
+ "visibility",
+ "voice-family",
+ "volume",
+ "white-space",
+ "widows",
+ "width",
+ "word-spacing",
+ "z-index",
+};
+
+/**
+ * Dump a CSS bytecode stream to the given file handle
+ *
+ * \param bytecode The stream to dump
+ * \param length Length, in bytes, of bytecode
+ * \param fp File handle to output to
+ */
+void css_bytecode_dump(void *bytecode, uint32_t length, FILE *fp)
+{
+ uint32_t offset = 0;
+
+#define ADVANCE(n) do { \
+ offset += (n); \
+ bytecode = ((uint8_t *) bytecode) + (n); \
+} while(0)
+
+ while (offset < length) {
+ opcode op;
+ uint8_t flags;
+ uint16_t value;
+ uint32_t opv = *((uint32_t *) bytecode);
+
+ ADVANCE(sizeof(opv));
+
+ op = getOpcode(opv);
+
+ fprintf(fp, "%s: ", opcode_names[op]);
+
+ flags = getFlags(opv);
+
+ if (flags & FLAG_INHERIT) {
+ fprintf(fp, "inherit");
+ } else {
+ value = getValue(opv);
+
+ switch (op) {
+ case OP_BACKGROUND_ATTACHMENT:
+ switch (value) {
+ case BACKGROUND_ATTACHMENT_FIXED:
+ fprintf(fp, "fixed");
+ break;
+ case BACKGROUND_ATTACHMENT_SCROLL:
+ fprintf(fp, "scroll");
+ break;
+ }
+ break;
+ case OP_BACKGROUND_COLOR:
+ switch (value) {
+ case BACKGROUND_COLOR_TRANSPARENT:
+ fprintf(fp, "transparent");
+ break;
+ case BACKGROUND_COLOR_SET:
+ {
+ uint32_t colour =
+ *((uint32_t *) bytecode);
+ ADVANCE(sizeof(colour));
+ fprintf(fp, "#%08x", colour);
+ }
+ break;
+ }
+ break;
+ case OP_BACKGROUND_IMAGE:
+ switch (value) {
+ case BACKGROUND_IMAGE_NONE:
+ fprintf(fp, "none");
+ break;
+ case BACKGROUND_IMAGE_URI:
+ {
+ uint8_t *ptr =
+ *((uint8_t **) bytecode);
+ ADVANCE(sizeof(ptr));
+ size_t len =
+ *((size_t *) bytecode);
+ ADVANCE(sizeof(len));
+ fprintf(fp, "url('%.*s')", (int) len,
+ (char *) ptr);
+ }
+ break;
+ }
+ break;
+ case OP_BACKGROUND_REPEAT:
+ switch (value) {
+ case BACKGROUND_REPEAT_NO_REPEAT:
+ fprintf(fp, "no-repeat");
+ break;
+ case BACKGROUND_REPEAT_REPEAT_X:
+ fprintf(fp, "repeat-x");
+ break;
+ case BACKGROUND_REPEAT_REPEAT_Y:
+ fprintf(fp, "repeat-y");
+ break;
+ case BACKGROUND_REPEAT_REPEAT:
+ fprintf(fp, "repeat");
+ break;
+ }
+ break;
+ case OP_CLEAR:
+ switch (value) {
+ case CLEAR_NONE:
+ fprintf(fp, "none");
+ break;
+ case CLEAR_LEFT:
+ fprintf(fp, "left");
+ break;
+ case CLEAR_RIGHT:
+ fprintf(fp, "right");
+ break;
+ case CLEAR_BOTH:
+ fprintf(fp, "both");
+ break;
+ }
+ break;
+ default:
+ fprintf(fp, "Unknown opcode %x", op);
+ break;
+ }
+ }
+
+ if (flags & FLAG_IMPORTANT)
+ fprintf(fp, " !important");
+
+ fprintf(fp, "; ");
+ }
+
+#undef ADVANCE
+
+}
+
+
Modified: trunk/libcss/src/parse/css21.c
URL: http://source.netsurf-browser.org/trunk/libcss/src/parse/css21.c?rev=5627...
==============================================================================
--- trunk/libcss/src/parse/css21.c (original)
+++ trunk/libcss/src/parse/css21.c Fri Oct 24 20:24:03 2008
@@ -19,8 +19,10 @@
#include "utils/utils.h"
enum {
+ /* At-rules */
CHARSET, IMPORT, MEDIA, PAGE,
+ /* Properties */
FIRST_PROP,
AZIMUTH = FIRST_PROP, BACKGROUND_ATTACHMENT, BACKGROUND_COLOR,
@@ -45,13 +47,20 @@
TOP, UNICODE_BIDI, VERTICAL_ALIGN, VISIBILITY, VOICE_FAMILY, VOLUME,
WHITE_SPACE, WIDOWS, WIDTH, WORD_SPACING, Z_INDEX,
+ LAST_PROP = Z_INDEX,
+
+ /* Other keywords */
+ INHERIT, IMPORTANT, NONE, BOTH, FIXED, SCROLL, TRANSPARENT,
+ NO_REPEAT, REPEAT_X, REPEAT_Y, REPEAT,
+
LAST_KNOWN
};
+/* Must be synchronised with above enum */
static struct {
const char *ptr;
size_t len;
-} stringmap[] = {
+} stringmap[LAST_KNOWN] = {
{ "charset", SLEN("charset") },
{ "import", SLEN("import") },
{ "media", SLEN("media") },
@@ -155,7 +164,19 @@
{ "widows", SLEN("widows") },
{ "width", SLEN("width") },
{ "word-spacing", SLEN("word-spacing") },
- { "z-index", SLEN("z-index") }
+ { "z-index", SLEN("z-index") },
+
+ { "inherit", SLEN("inherit") },
+ { "important", SLEN("important") },
+ { "none", SLEN("none") },
+ { "both", SLEN("both") },
+ { "fixed", SLEN("fixed") },
+ { "scroll", SLEN("scroll") },
+ { "transparent", SLEN("transparent") },
+ { "no-repeat", SLEN("no-repeat") },
+ { "repeat-x", SLEN("repeat-x") },
+ { "repeat-y", SLEN("repeat-y") },
+ { "repeat", SLEN("repeat") },
};
typedef struct context_entry {
@@ -1071,11 +1092,11 @@
/* Find property index */
/** \todo improve on this linear search */
- for (i = FIRST_PROP; i < LAST_KNOWN; i++) {
+ for (i = FIRST_PROP; i <= LAST_PROP; i++) {
if (property->lower.ptr == c->strings[i])
break;
}
- if (i == LAST_KNOWN)
+ if (i == LAST_PROP + 1)
return CSS_INVALID;
/* Get handler */
Modified: trunk/libcss/src/parse/css21props.c
URL: http://source.netsurf-browser.org/trunk/libcss/src/parse/css21props.c?rev...
==============================================================================
--- trunk/libcss/src/parse/css21props.c (original)
+++ trunk/libcss/src/parse/css21props.c Fri Oct 24 20:24:03 2008
@@ -309,6 +309,13 @@
const parserutils_vector *vector, int *ctx,
css_style **result);
+static inline css_error parse_important(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ uint8_t *result);
+static inline css_error parse_colour_specifier(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ uint32_t *result);
+
/**
* Type of property handler function
*/
@@ -319,7 +326,7 @@
/**
* Dispatch table of property handlers, indexed by property enum
*/
-static const css_prop_handler property_handlers[LAST_KNOWN - FIRST_PROP] =
+static const css_prop_handler property_handlers[LAST_PROP + 1 - FIRST_PROP] =
{
parse_azimuth,
parse_background_attachment,
@@ -426,6 +433,7 @@
const parserutils_vector *vector, int *ctx,
css_style **result)
{
+ /** \todo azimuth */
UNUSED(c);
UNUSED(vector);
UNUSED(ctx);
@@ -438,10 +446,39 @@
const parserutils_vector *vector, int *ctx,
css_style **result)
{
- UNUSED(c);
- UNUSED(vector);
- UNUSED(ctx);
- UNUSED(result);
+ css_error error;
+ const css_token *ident;
+ uint8_t flags = 0;
+ uint16_t value = 0;
+ uint32_t opv;
+
+ /* IDENT (fixed, scroll, inherit) */
+ ident = parserutils_vector_iterate(vector, ctx);
+ if (ident == NULL || ident->type != CSS_TOKEN_IDENT)
+ return CSS_INVALID;
+
+ error = parse_important(c, vector, ctx, &flags);
+ if (error != CSS_OK)
+ return error;
+
+ if (ident->lower.ptr == c->strings[INHERIT]) {
+ flags |= FLAG_INHERIT;
+ } else if (ident->lower.ptr == c->strings[FIXED]) {
+ value = BACKGROUND_ATTACHMENT_FIXED;
+ } else if (ident->lower.ptr == c->strings[SCROLL]) {
+ value = BACKGROUND_ATTACHMENT_SCROLL;
+ } else
+ return CSS_INVALID;
+
+ opv = buildOPV(OP_BACKGROUND_ATTACHMENT, flags, value);
+
+ /* Allocate result */
+ *result = css_stylesheet_style_create(c->sheet, sizeof(opv));
+ if (*result == NULL)
+ return CSS_NOMEM;
+
+ /* Copy the bytecode to it */
+ memcpy((*result)->bytecode, &opv, sizeof(opv));
return CSS_OK;
}
@@ -450,10 +487,56 @@
const parserutils_vector *vector, int *ctx,
css_style **result)
{
- UNUSED(c);
- UNUSED(vector);
- UNUSED(ctx);
- UNUSED(result);
+ css_error error;
+ const css_token *token;
+ uint8_t flags = 0;
+ uint16_t value = 0;
+ uint32_t opv;
+ uint32_t colour = 0;
+ uint32_t required_size;
+
+ /* colour | IDENT (transparent, inherit) */
+ token= parserutils_vector_peek(vector, *ctx);
+ if (token == NULL)
+ return CSS_INVALID;
+
+ if (token->type == CSS_TOKEN_IDENT &&
+ token->lower.ptr == c->strings[INHERIT]) {
+ parserutils_vector_iterate(vector, ctx);
+ flags |= FLAG_INHERIT;
+ } else if (token->type == CSS_TOKEN_IDENT &&
+ token->lower.ptr == c->strings[TRANSPARENT]) {
+ parserutils_vector_iterate(vector, ctx);
+ value = BACKGROUND_COLOR_TRANSPARENT;
+ } else {
+ error = parse_colour_specifier(c, vector, ctx, &colour);
+ if (error != CSS_OK)
+ return CSS_INVALID;
+
+ value = BACKGROUND_COLOR_SET;
+ }
+
+ error = parse_important(c, vector, ctx, &flags);
+ if (error != CSS_OK)
+ return error;
+
+ opv = buildOPV(OP_BACKGROUND_COLOR, flags, value);
+
+ required_size = sizeof(opv);
+ if (value == BACKGROUND_COLOR_SET)
+ required_size += sizeof(colour);
+
+ /* Allocate result */
+ *result = css_stylesheet_style_create(c->sheet, required_size);
+ if (*result == NULL)
+ return CSS_NOMEM;
+
+ /* Copy the bytecode to it */
+ memcpy((*result)->bytecode, &opv, sizeof(opv));
+ if (value == BACKGROUND_COLOR_SET) {
+ memcpy(((uint8_t *) (*result)->bytecode) + sizeof(opv),
+ &colour, sizeof(colour));
+ }
return CSS_OK;
}
@@ -462,10 +545,54 @@
const parserutils_vector *vector, int *ctx,
css_style **result)
{
- UNUSED(c);
- UNUSED(vector);
- UNUSED(ctx);
- UNUSED(result);
+ css_error error;
+ const css_token *token;
+ uint8_t flags = 0;
+ uint16_t value = 0;
+ uint32_t opv;
+ uint32_t required_size;
+
+ /* URI | IDENT (none, inherit) */
+ token = parserutils_vector_iterate(vector, ctx);
+ if (token == NULL || (token->type != CSS_TOKEN_IDENT &&
+ token->type != CSS_TOKEN_URI))
+ return CSS_INVALID;
+
+ error = parse_important(c, vector, ctx, &flags);
+ if (error != CSS_OK)
+ return error;
+
+ if (token->type == CSS_TOKEN_IDENT &&
+ token->lower.ptr == c->strings[INHERIT]) {
+ flags |= FLAG_INHERIT;
+ } else if (token->type == CSS_TOKEN_IDENT &&
+ token->lower.ptr == c->strings[NONE]) {
+ value = BACKGROUND_IMAGE_NONE;
+ } else if (token->type == CSS_TOKEN_URI) {
+ value = BACKGROUND_IMAGE_URI;
+ } else
+ return CSS_INVALID;
+
+ opv = buildOPV(OP_BACKGROUND_IMAGE, flags, value);
+
+ required_size = sizeof(opv);
+ if (value == BACKGROUND_IMAGE_URI)
+ required_size += sizeof(uint8_t *) + sizeof(size_t);
+
+ /* Allocate result */
+ *result = css_stylesheet_style_create(c->sheet, required_size);
+ if (*result == NULL)
+ return CSS_NOMEM;
+
+ /* Copy the bytecode to it */
+ memcpy((*result)->bytecode, &opv, sizeof(opv));
+ if (value == BACKGROUND_IMAGE_URI) {
+ memcpy((uint8_t *) (*result)->bytecode + sizeof(opv),
+ &token->data.ptr, sizeof(uint8_t *));
+ memcpy((uint8_t *) (*result)->bytecode + sizeof(opv) +
+ sizeof(uint8_t *),
+ &token->data.len, sizeof(size_t));
+ }
return CSS_OK;
}
@@ -474,6 +601,7 @@
const parserutils_vector *vector, int *ctx,
css_style **result)
{
+ /** \todo background-position */
UNUSED(c);
UNUSED(vector);
UNUSED(ctx);
@@ -486,10 +614,43 @@
const parserutils_vector *vector, int *ctx,
css_style **result)
{
- UNUSED(c);
- UNUSED(vector);
- UNUSED(ctx);
- UNUSED(result);
+ css_error error;
+ const css_token *ident;
+ uint8_t flags = 0;
+ uint16_t value = 0;
+ uint32_t opv;
+
+ /* IDENT (no-repeat, repeat-x, repeat-y, repeat, inherit) */
+ ident = parserutils_vector_iterate(vector, ctx);
+ if (ident == NULL || ident->type != CSS_TOKEN_IDENT)
+ return CSS_INVALID;
+
+ error = parse_important(c, vector, ctx, &flags);
+ if (error != CSS_OK)
+ return error;
+
+ if (ident->lower.ptr == c->strings[INHERIT]) {
+ flags |= FLAG_INHERIT;
+ } else if (ident->lower.ptr == c->strings[NO_REPEAT]) {
+ value = BACKGROUND_REPEAT_NO_REPEAT;
+ } else if (ident->lower.ptr == c->strings[REPEAT_X]) {
+ value = BACKGROUND_REPEAT_REPEAT_X;
+ } else if (ident->lower.ptr == c->strings[REPEAT_Y]) {
+ value = BACKGROUND_REPEAT_REPEAT_Y;
+ } else if (ident->lower.ptr == c->strings[REPEAT]) {
+ value = BACKGROUND_REPEAT_REPEAT;
+ } else
+ return CSS_INVALID;
+
+ opv = buildOPV(OP_BACKGROUND_REPEAT, flags, value);
+
+ /* Allocate result */
+ *result = css_stylesheet_style_create(c->sheet, sizeof(opv));
+ if (*result == NULL)
+ return CSS_NOMEM;
+
+ /* Copy the bytecode to it */
+ memcpy((*result)->bytecode, &opv, sizeof(opv));
return CSS_OK;
}
@@ -690,7 +851,8 @@
const parserutils_vector *vector, int *ctx,
css_style **result)
{
- const css_token *token, *ident;
+ css_error error;
+ const css_token *ident;
uint8_t flags = 0;
uint16_t value = 0;
uint32_t opv;
@@ -700,41 +862,19 @@
if (ident == NULL || ident->type != CSS_TOKEN_IDENT)
return CSS_INVALID;
- /** \todo break this !important stuff into a utility function */
- consumeWhitespace(vector, ctx);
-
- token = parserutils_vector_iterate(vector, ctx);
- if (token != NULL && tokenIsChar(token, '!')) {
- consumeWhitespace(vector, ctx);
-
- token = parserutils_vector_iterate(vector, ctx);
- if (token == NULL || token->type != CSS_TOKEN_IDENT)
- return CSS_INVALID;
-
- /** \todo compare pointer to interned version. */
- if (token->lower.len == 9 &&
- strncmp((char *) token->lower.ptr,
- "important", 9) == 0)
- flags |= FLAG_IMPORTANT;
- } else if (token != NULL)
- return CSS_INVALID;
-
-
- /** \todo ugh. compare pointers to interned versions, already */
- if (ident->lower.len == 7 &&
- strncmp((char *) ident->lower.ptr, "inherit", 7) == 0) {
+ error = parse_important(c, vector, ctx, &flags);
+ if (error != CSS_OK)
+ return error;
+
+ if (ident->lower.ptr == c->strings[INHERIT]) {
flags |= FLAG_INHERIT;
- } else if (ident->lower.len == 5 &&
- strncmp((char *) ident->lower.ptr, "right", 5) == 0) {
+ } else if (ident->lower.ptr == c->strings[RIGHT]) {
value = CLEAR_RIGHT;
- } else if (ident->lower.len == 4 &&
- strncmp((char *) ident->lower.ptr, "left", 4) == 0) {
+ } else if (ident->lower.ptr == c->strings[LEFT]) {
value = CLEAR_LEFT;
- } else if (ident->lower.len == 4 &&
- strncmp((char *) ident->lower.ptr, "both", 4) == 0) {
+ } else if (ident->lower.ptr == c->strings[BOTH]) {
value = CLEAR_BOTH;
- } else if (ident->lower.len == 4 &&
- strncmp((char *) ident->lower.ptr, "none", 4) == 0) {
+ } else if (ident->lower.ptr == c->strings[NONE]) {
value = CLEAR_NONE;
} else
return CSS_INVALID;
@@ -1664,4 +1804,48 @@
return CSS_OK;
}
+css_error parse_important(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ uint8_t *result)
+{
+ const css_token *token;
+
+ consumeWhitespace(vector, ctx);
+
+ token = parserutils_vector_iterate(vector, ctx);
+ if (token != NULL && tokenIsChar(token, '!')) {
+ consumeWhitespace(vector, ctx);
+
+ token = parserutils_vector_iterate(vector, ctx);
+ if (token == NULL || token->type != CSS_TOKEN_IDENT)
+ return CSS_INVALID;
+
+ if (token->lower.ptr == c->strings[IMPORTANT])
+ *result |= FLAG_IMPORTANT;
+ } else if (token != NULL)
+ return CSS_INVALID;
+
+ return CSS_OK;
+}
+
+css_error parse_colour_specifier(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ uint32_t *result)
+{
+ const css_token *token;
+
+ UNUSED(c);
+ UNUSED(result);
+
+ /** \todo Parse colours */
+
+ /* For now, consume everything up to the end of the declaration or !,
+ * whichever comes first */
+ while ((token = parserutils_vector_peek(vector, *ctx)) != NULL &&
+ tokenIsChar(token, '!') == false)
+ parserutils_vector_iterate(vector, ctx);
+
+ return CSS_OK;
+}
+
#endif
Modified: trunk/libcss/src/stylesheet.c
URL: http://source.netsurf-browser.org/trunk/libcss/src/stylesheet.c?rev=5627&...
==============================================================================
--- trunk/libcss/src/stylesheet.c (original)
+++ trunk/libcss/src/stylesheet.c Fri Oct 24 20:24:03 2008
@@ -8,6 +8,7 @@
#include <string.h>
#include "stylesheet.h"
+#include "bytecode/bytecode.h"
#include "parse/css21.h"
#include "utils/utils.h"
@@ -158,6 +159,13 @@
return CSS_BADPARM;
return css_parser_completed(sheet->parser);
+
+ /** \todo We can destroy the parser here as it won't be needed
+ * Note, however, that, if we do so, then the dictionary of
+ * strings created by the parser *must* be preserved (and, ideally,
+ * created by us in the first place) because our stylesheet
+ * datastructures contain pointers to strings stored in this
+ * dictionary. */
}
/**
@@ -530,6 +538,9 @@
cur->length + style->length, sheet->pw);
if (temp == NULL)
return CSS_NOMEM;
+
+ /* Ensure bytecode pointer is correct */
+ temp->bytecode = ((uint8_t *) temp + sizeof(css_style));
/** \todo Can we optimise the bytecode here? */
memcpy((uint8_t *) temp->bytecode + temp->length,
@@ -666,6 +677,12 @@
if (i != rule->data.selector.selector_count - 1)
fprintf(target, ", ");
}
+ fprintf(target, " { ");
+ if (rule->data.selector.style != NULL) {
+ css_bytecode_dump(rule->data.selector.style->bytecode,
+ rule->data.selector.style->length, target);
+ }
+ fprintf(target, "}");
break;
case CSS_RULE_CHARSET:
case CSS_RULE_IMPORT:
14 years, 3 months
r5626 tlsa - /trunk/netsurfweb/documentation/roinfo.en
by netsurf@semichrome.net
Author: tlsa
Date: Thu Oct 23 10:48:03 2008
New Revision: 5626
URL: http://source.netsurf-browser.org?rev=5626&view=rev
Log:
Fix ttf2f link.
Modified:
trunk/netsurfweb/documentation/roinfo.en
Modified: trunk/netsurfweb/documentation/roinfo.en
URL: http://source.netsurf-browser.org/trunk/netsurfweb/documentation/roinfo.e...
==============================================================================
--- trunk/netsurfweb/documentation/roinfo.en (original)
+++ trunk/netsurfweb/documentation/roinfo.en Thu Oct 23 10:48:03 2008
@@ -142,7 +142,7 @@
<p>If you see the codes 0091, 0092, 0096, or others starting 009, that indicates that the page is not specifying the character set that it is using correctly. Installing fonts won't help. We haven't yet decided what the best way to work around this problem is.</p>
-<p>Any font supplied with a correctly designed "Encoding" file should work. In practice, native fonts covering anything other than Latin 1 are rare. The solution is to convert TrueType fonts using <a href="http://moose.mine.nu/ttf2f_latest.zip">TTF2f</a> (this currently produces fonts suitable for RISC OS 5 only).</p>
+<p>Any font supplied with a correctly designed "Encoding" file should work. In practice, native fonts covering anything other than Latin 1 are rare. The solution is to convert TrueType fonts using <a href="http://jmb.drobe.co.uk/ttf2f-003.zip">TTF2f</a> (this currently produces fonts suitable for RISC OS 5 only).</p>
<p>After installing new fonts, NetSurf will need restarting so that it detects them.</p>
14 years, 3 months
r5625 jmb - in /trunk/libcss/src: bytecode/bytecode.h parse/css21.c parse/css21props.c stylesheet.c stylesheet.h
by netsurf@semichrome.net
Author: jmb
Date: Wed Oct 22 19:28:20 2008
New Revision: 5625
URL: http://source.netsurf-browser.org?rev=5625&view=rev
Log:
Something approximating a parser for clear.
Provide API to create/destroy css_styles and append them to css_rules.
Modified:
trunk/libcss/src/bytecode/bytecode.h
trunk/libcss/src/parse/css21.c
trunk/libcss/src/parse/css21props.c
trunk/libcss/src/stylesheet.c
trunk/libcss/src/stylesheet.h
Modified: trunk/libcss/src/bytecode/bytecode.h
URL: http://source.netsurf-browser.org/trunk/libcss/src/bytecode/bytecode.h?re...
==============================================================================
--- trunk/libcss/src/bytecode/bytecode.h (original)
+++ trunk/libcss/src/bytecode/bytecode.h Wed Oct 22 19:28:20 2008
@@ -99,6 +99,11 @@
OP_Z_INDEX = 0x053,
} opcode;
+enum flag {
+ FLAG_IMPORTANT = (1<<0),
+ FLAG_INHERIT = (1<<1),
+};
+
typedef enum unit {
UNIT_PX = 0,
UNIT_EX = 1,
Modified: trunk/libcss/src/parse/css21.c
URL: http://source.netsurf-browser.org/trunk/libcss/src/parse/css21.c?rev=5625...
==============================================================================
--- trunk/libcss/src/parse/css21.c (original)
+++ trunk/libcss/src/parse/css21.c Wed Oct 22 19:28:20 2008
@@ -1067,7 +1067,7 @@
css_error error;
css_prop_handler handler = NULL;
int i = 0;
- css_style *style;
+ css_style *style = NULL;
/* Find property index */
/** \todo improve on this linear search */
@@ -1087,8 +1087,18 @@
if (error != CSS_OK)
return error;
- /** \todo append style to rule */
- UNUSED(rule);
+ /** \todo we should probably assert this, but until we've implemented
+ * all the property parsers, this will have to suffice. */
+ if (style != NULL) {
+ /* Append style to rule */
+ error = css_stylesheet_rule_append_style(c->sheet, rule, style);
+ if (error != CSS_OK) {
+ css_stylesheet_style_destroy(c->sheet, style);
+ return error;
+ }
+ }
+
+ /* Style owned or destroyed by stylesheet, so forget about it */
return CSS_OK;
}
Modified: trunk/libcss/src/parse/css21props.c
URL: http://source.netsurf-browser.org/trunk/libcss/src/parse/css21props.c?rev...
==============================================================================
--- trunk/libcss/src/parse/css21props.c (original)
+++ trunk/libcss/src/parse/css21props.c Wed Oct 22 19:28:20 2008
@@ -690,10 +690,64 @@
const parserutils_vector *vector, int *ctx,
css_style **result)
{
- UNUSED(c);
- UNUSED(vector);
- UNUSED(ctx);
- UNUSED(result);
+ const css_token *token, *ident;
+ uint8_t flags = 0;
+ uint16_t value = 0;
+ uint32_t opv;
+
+ /* IDENT (left, right, both, none, inherit) */
+ ident = parserutils_vector_iterate(vector, ctx);
+ if (ident == NULL || ident->type != CSS_TOKEN_IDENT)
+ return CSS_INVALID;
+
+ /** \todo break this !important stuff into a utility function */
+ consumeWhitespace(vector, ctx);
+
+ token = parserutils_vector_iterate(vector, ctx);
+ if (token != NULL && tokenIsChar(token, '!')) {
+ consumeWhitespace(vector, ctx);
+
+ token = parserutils_vector_iterate(vector, ctx);
+ if (token == NULL || token->type != CSS_TOKEN_IDENT)
+ return CSS_INVALID;
+
+ /** \todo compare pointer to interned version. */
+ if (token->lower.len == 9 &&
+ strncmp((char *) token->lower.ptr,
+ "important", 9) == 0)
+ flags |= FLAG_IMPORTANT;
+ } else if (token != NULL)
+ return CSS_INVALID;
+
+
+ /** \todo ugh. compare pointers to interned versions, already */
+ if (ident->lower.len == 7 &&
+ strncmp((char *) ident->lower.ptr, "inherit", 7) == 0) {
+ flags |= FLAG_INHERIT;
+ } else if (ident->lower.len == 5 &&
+ strncmp((char *) ident->lower.ptr, "right", 5) == 0) {
+ value = CLEAR_RIGHT;
+ } else if (ident->lower.len == 4 &&
+ strncmp((char *) ident->lower.ptr, "left", 4) == 0) {
+ value = CLEAR_LEFT;
+ } else if (ident->lower.len == 4 &&
+ strncmp((char *) ident->lower.ptr, "both", 4) == 0) {
+ value = CLEAR_BOTH;
+ } else if (ident->lower.len == 4 &&
+ strncmp((char *) ident->lower.ptr, "none", 4) == 0) {
+ value = CLEAR_NONE;
+ } else
+ return CSS_INVALID;
+
+ opv = buildOPV(OP_CLEAR, flags, value);
+
+ /* Allocate result */
+ *result = css_stylesheet_style_create(c->sheet, sizeof(opv));
+ if (*result == NULL)
+ return CSS_NOMEM;
+
+ /* Copy the bytecode to it */
+ memcpy((*result)->bytecode, &opv, sizeof(opv));
return CSS_OK;
}
Modified: trunk/libcss/src/stylesheet.c
URL: http://source.netsurf-browser.org/trunk/libcss/src/stylesheet.c?rev=5625&...
==============================================================================
--- trunk/libcss/src/stylesheet.c (original)
+++ trunk/libcss/src/stylesheet.c Wed Oct 22 19:28:20 2008
@@ -269,6 +269,45 @@
******************************************************************************/
/**
+ * Create a style
+ *
+ * \param sheet The stylesheet context
+ * \param len The required length of the style
+ * \return Pointer to style, or NULL on error
+ */
+css_style *css_stylesheet_style_create(css_stylesheet *sheet, uint32_t len)
+{
+ css_style *style;
+
+ if (sheet == NULL || len == 0)
+ return NULL;
+
+ style = sheet->alloc(NULL, sizeof(css_style) + len, sheet->pw);
+ if (style == NULL)
+ return NULL;
+
+ /* DIY variable-sized data member */
+ style->bytecode = ((uint8_t *) style + sizeof(css_style));
+ style->length = len;
+
+ return style;
+}
+
+/**
+ * Destroy a style
+ *
+ * \param sheet The stylesheet context
+ * \param style The style to destroy
+ */
+void css_stylesheet_style_destroy(css_stylesheet *sheet, css_style *style)
+{
+ UNUSED(sheet);
+ UNUSED(style);
+
+ /** \todo destroy style */
+}
+
+/**
* Create a selector
*
* \param sheet The stylesheet context
@@ -458,6 +497,59 @@
/* Set selector's rule field */
selector->rule = rule;
+ return CSS_OK;
+}
+
+/**
+ * Append a style to a CSS rule
+ *
+ * \param sheet The stylesheet context
+ * \param rule The rule to add to (must be CSS_RULE_SELECTOR or CSS_RULE_PAGE)
+ * \param style The style to add
+ * \return CSS_OK on success, appropriate error otherwise
+ */
+css_error css_stylesheet_rule_append_style(css_stylesheet *sheet,
+ css_rule *rule, css_style *style)
+{
+ css_style *cur;
+
+ if (sheet == NULL || rule == NULL || style == NULL)
+ return CSS_BADPARM;
+
+ if (rule->type != CSS_RULE_SELECTOR && rule->type != CSS_RULE_PAGE)
+ return CSS_INVALID;
+
+ if (rule->type == CSS_RULE_SELECTOR)
+ cur = rule->data.selector.style;
+ else
+ cur = rule->data.page.style;
+
+ if (cur != NULL) {
+ /* Already have a style, so append to the end of the bytecode */
+ css_style *temp = sheet->alloc(cur,
+ cur->length + style->length, sheet->pw);
+ if (temp == NULL)
+ return CSS_NOMEM;
+
+ /** \todo Can we optimise the bytecode here? */
+ memcpy((uint8_t *) temp->bytecode + temp->length,
+ style->bytecode, style->length);
+
+ cur = temp;
+ cur->length += style->length;
+
+ /* Done with style */
+ css_stylesheet_style_destroy(sheet, style);
+ } else {
+ /* No current style, so use this one */
+ cur = style;
+ }
+
+ if (rule->type == CSS_RULE_SELECTOR)
+ rule->data.selector.style = cur;
+ else
+ rule->data.page.style = cur;
+
return CSS_OK;
}
Modified: trunk/libcss/src/stylesheet.h
URL: http://source.netsurf-browser.org/trunk/libcss/src/stylesheet.h?rev=5625&...
==============================================================================
--- trunk/libcss/src/stylesheet.h (original)
+++ trunk/libcss/src/stylesheet.h Wed Oct 22 19:28:20 2008
@@ -21,6 +21,7 @@
typedef struct css_rule css_rule;
typedef struct css_selector css_selector;
+/** \todo would a parserutils_buffer be better here? */
typedef struct css_style {
uint32_t length; /**< Length, in bytes, of bytecode */
void *bytecode; /**< Pointer to bytecode */
@@ -152,6 +153,9 @@
void *pw; /**< Private word */
};
+css_style *css_stylesheet_style_create(css_stylesheet *sheet, uint32_t len);
+void css_stylesheet_style_destroy(css_stylesheet *sheet, css_style *style);
+
css_selector *css_stylesheet_selector_create(css_stylesheet *sheet,
css_selector_type type, const css_string *name,
const css_string *value);
@@ -170,7 +174,9 @@
css_error css_stylesheet_rule_add_selector(css_stylesheet *sheet,
css_rule *rule, css_selector *selector);
-/** \todo something about adding style declarations to a rule */
+css_error css_stylesheet_rule_append_style(css_stylesheet *sheet,
+ css_rule *rule, css_style *style);
+
/** \todo registering other rule-type data with css_rules */
css_error css_stylesheet_add_rule(css_stylesheet *sheet, css_rule *rule);
14 years, 3 months
r5624 jmb - in /trunk/libcss/src: bytecode/opcodes.h parse/css21props.c
by netsurf@semichrome.net
Author: jmb
Date: Wed Oct 22 17:27:32 2008
New Revision: 5624
URL: http://source.netsurf-browser.org?rev=5624&view=rev
Log:
Actually include the opcodes header.
Fix typos.
Modified:
trunk/libcss/src/bytecode/opcodes.h
trunk/libcss/src/parse/css21props.c
Modified: trunk/libcss/src/bytecode/opcodes.h
URL: http://source.netsurf-browser.org/trunk/libcss/src/bytecode/opcodes.h?rev...
==============================================================================
--- trunk/libcss/src/bytecode/opcodes.h (original)
+++ trunk/libcss/src/bytecode/opcodes.h Wed Oct 22 17:27:32 2008
@@ -51,7 +51,7 @@
};
enum op_background_position {
- BACKGROUND_POSITION_HORZ_SET = 0x0080
+ BACKGROUND_POSITION_HORZ_SET = 0x0080,
BACKGROUND_POSITION_HORZ_RIGHT = 0x0000,
BACKGROUND_POSITION_HORZ_CENTER = 0x0010,
BACKGROUND_POSITION_HORZ_LEFT = 0x0020,
@@ -406,7 +406,7 @@
PAGE_BREAK_AFTER_AVOID = 0x0002,
PAGE_BREAK_AFTER_LEFT = 0x0003,
PAGE_BREAK_AFTER_RIGHT = 0x0004,
-}
+};
enum op_page_break_before {
PAGE_BREAK_BEFORE_AUTO = 0x0000,
Modified: trunk/libcss/src/parse/css21props.c
URL: http://source.netsurf-browser.org/trunk/libcss/src/parse/css21props.c?rev...
==============================================================================
--- trunk/libcss/src/parse/css21props.c (original)
+++ trunk/libcss/src/parse/css21props.c Wed Oct 22 17:27:32 2008
@@ -9,6 +9,7 @@
#define css_parse_css21props_c_
#include "bytecode/bytecode.h"
+#include "bytecode/opcodes.h"
static css_error parse_azimuth(css_css21 *c,
const parserutils_vector *vector, int *ctx,
14 years, 3 months
r5623 jmb - in /trunk/libcss/src/bytecode: bytecode.h opcodes.h
by netsurf@semichrome.net
Author: jmb
Date: Wed Oct 22 17:21:19 2008
New Revision: 5623
URL: http://source.netsurf-browser.org?rev=5623&view=rev
Log:
Something approximating an enumeration of the opcode-specific value field.
Some type-related pedantry, too.
Added:
trunk/libcss/src/bytecode/opcodes.h
Modified:
trunk/libcss/src/bytecode/bytecode.h
Modified: trunk/libcss/src/bytecode/bytecode.h
URL: http://source.netsurf-browser.org/trunk/libcss/src/bytecode/bytecode.h?re...
==============================================================================
--- trunk/libcss/src/bytecode/bytecode.h (original)
+++ trunk/libcss/src/bytecode/bytecode.h Wed Oct 22 17:21:19 2008
@@ -128,12 +128,12 @@
SHAPE_RECT = 0
} shape;
-static inline uint32_t buildOPV(uint16_t opcode, uint8_t flags, uint16_t value)
+static inline uint32_t buildOPV(opcode opcode, uint8_t flags, uint16_t value)
{
return (opcode & 0x3ff) | (flags << 10) | ((value & 0x3fff) << 18);
}
-static inline uint16_t getOpcode(uint32_t OPV)
+static inline opcode getOpcode(uint32_t OPV)
{
return (OPV & 0x3ff);
}
Added: trunk/libcss/src/bytecode/opcodes.h
URL: http://source.netsurf-browser.org/trunk/libcss/src/bytecode/opcodes.h?rev...
==============================================================================
--- trunk/libcss/src/bytecode/opcodes.h (added)
+++ trunk/libcss/src/bytecode/opcodes.h Wed Oct 22 17:21:19 2008
@@ -1,0 +1,631 @@
+/*
+ * This file is part of LibCSS.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2008 John-Mark Bell <jmb(a)netsurf-browser.org>
+ */
+
+#ifndef css_bytecode_opcodes_h_
+#define css_bytecode_opcodes_h_
+
+#include <inttypes.h>
+
+enum side {
+ SIDE_TOP = 0x0000,
+ SIDE_RIGHT = 0x0100,
+ SIDE_BOTTOM = 0x0200,
+ SIDE_LEFT = 0x0300,
+};
+
+enum op_azimuth {
+ AZIMUTH_ANGLE = 0x0080,
+
+ AZIMUTH_LEFTWARDS = 0x0040,
+ AZIMUTH_RIGHTWARDS = 0x0041,
+
+ AZIMUTH_BEHIND = (1<<5),
+ AZIMUTH_LEFT_SIDE = 0x0000,
+ AZIMUTH_FAR_LEFT = 0x0001,
+ AZIMUTH_LEFT = 0x0002,
+ AZIMUTH_CENTER_LEFT = 0x0003,
+ AZIMUTH_CENTER = 0x0004,
+ AZIMUTH_CENTER_RIGHT = 0x0005,
+ AZIMUTH_RIGHT = 0x0006,
+ AZIMUTH_FAR_RIGHT = 0x0007,
+ AZIMUTH_RIGHT_SIDE = 0x0008,
+};
+
+enum op_background_attachment {
+ BACKGROUND_ATTACHMENT_FIXED = 0x0000,
+ BACKGROUND_ATTACHMENT_SCROLL = 0x0001,
+};
+
+enum op_background_color {
+ BACKGROUND_COLOR_TRANSPARENT = 0x0000,
+ BACKGROUND_COLOR_SET = 0x0080,
+};
+
+enum op_background_image {
+ BACKGROUND_IMAGE_URI = 0x0080,
+ BACKGROUND_IMAGE_NONE = 0x0000,
+};
+
+enum op_background_position {
+ BACKGROUND_POSITION_HORZ_SET = 0x0080
+ BACKGROUND_POSITION_HORZ_RIGHT = 0x0000,
+ BACKGROUND_POSITION_HORZ_CENTER = 0x0010,
+ BACKGROUND_POSITION_HORZ_LEFT = 0x0020,
+
+ BACKGROUND_POSITION_VERT_SET = 0x0008,
+ BACKGROUND_POSITION_VERT_BOTTOM = 0x0000,
+ BACKGROUND_POSITION_VERT_CENTER = 0x0001,
+ BACKGROUND_POSITION_VERT_TOP = 0x0002,
+};
+
+enum op_background_repeat {
+ BACKGROUND_REPEAT_NO_REPEAT = 0x0000,
+ BACKGROUND_REPEAT_REPEAT_X = 0x0001,
+ BACKGROUND_REPEAT_REPEAT_Y = 0x0002,
+ BACKGROUND_REPEAT_REPEAT = 0x0003,
+};
+
+enum op_border_collapse {
+ BORDER_COLLAPSE_SEPARATE = 0x0000,
+ BORDER_COLLAPSE_COLLAPSE = 0x0001,
+};
+
+enum op_border_spacing {
+ BORDER_SPACING_SET = 0x0000,
+};
+
+enum op_border_color {
+ BORDER_COLOR_SET = 0x0000,
+ BORDER_COLOR_TRANSPARENT = 0x0001,
+};
+
+enum op_border_style {
+ BORDER_STYLE_NONE = 0x0000,
+ BORDER_STYLE_HIDDEN = 0x0001,
+ BORDER_STYLE_DOTTED = 0x0002,
+ BORDER_STYLE_DASHED = 0x0003,
+ BORDER_STYLE_SOLID = 0x0004,
+ BORDER_STYLE_DOUBLE = 0x0005,
+ BORDER_STYLE_GROOVE = 0x0006,
+ BORDER_STYLE_RIDGE = 0x0007,
+ BORDER_STYLE_INSET = 0x0008,
+ BORDER_STYLE_OUTSET = 0x0009,
+};
+
+enum op_border_width {
+ BORDER_WIDTH_SET = 0x0080,
+ BORDER_WIDTH_THIN = 0x0000,
+ BORDER_WIDTH_MEDIUM = 0x0001,
+ 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,
+};
+
+enum op_caption_side {
+ CAPTION_SIDE_TOP = 0x0000,
+ CAPTION_SIDE_BOTTOM = 0x0001,
+};
+
+enum op_clear {
+ CLEAR_NONE = 0x0000,
+ CLEAR_LEFT = 0x0001,
+ CLEAR_RIGHT = 0x0002,
+ CLEAR_BOTH = 0x0003,
+};
+
+enum op_clip {
+ CLIP_SHAPE = 0x0080,
+ CLIP_AUTO = 0x0000,
+};
+
+enum op_color {
+ COLOR_SET = 0x0000,
+};
+
+enum op_content {
+ CONTENT_STRING = 0x0080,
+ CONTENT_URI = 0x0081,
+ CONTENT_COUNTER = 0x0082,
+ CONTENT_ATTR = 0x0083,
+
+ CONTENT_NORMAL = 0x0000,
+ CONTENT_NONE = 0x0001,
+ CONTENT_OPEN_QUOTE = 0x0002,
+ CONTENT_CLOSE_QUOTE = 0x0003,
+ CONTENT_NO_OPEN_QUOTE = 0x0004,
+ CONTENT_NO_CLOSE_QUOTE = 0x0005,
+};
+
+enum op_counter_increment {
+ COUNTER_INCREMENT_STRING = 0x0080,
+ COUNTER_INCREMENT_INTEGER = 0x0081,
+
+ COUNTER_INCREMENT_NONE = 0x0000,
+};
+
+enum op_counter_reset {
+ COUNTER_RESET_STRING = 0x0080,
+ COUNTER_RESET_INTEGER = 0x0081,
+
+ COUNTER_RESET_NONE = 0x0000,
+};
+
+enum op_cue_after {
+ CUE_AFTER_URI = 0x0080,
+ CUE_AFTER_NONE = 0x0000,
+};
+
+enum op_cue_before {
+ CUE_BEFORE_URI = 0x0080,
+ CUE_BEFORE_NONE = 0x0000,
+};
+
+enum op_cursor {
+ CURSOR_URI = 0x0080,
+
+ CURSOR_AUTO = 0x0000,
+ CURSOR_CROSSHAIR = 0x0001,
+ CURSOR_DEFAULT = 0x0002,
+ CURSOR_POINTER = 0x0003,
+ CURSOR_MOVE = 0x0004,
+ CURSOR_E_RESIZE = 0x0005,
+ CURSOR_NE_RESIZE = 0x0006,
+ CURSOR_NW_RESIZE = 0x0007,
+ CURSOR_N_RESIZE = 0x0008,
+ CURSOR_SE_RESIZE = 0x0009,
+ CURSOR_SW_RESIZE = 0x000a,
+ CURSOR_S_RESIZE = 0x000b,
+ CURSOR_W_RESIZE = 0x000c,
+ CURSOR_TEXT = 0x000d,
+ CURSOR_WAIT = 0x000e,
+ CURSOR_HELP = 0x000f,
+ CURSOR_PROGRESS = 0x0010,
+};
+
+enum op_direction {
+ DIRECTION_LTR = 0x0000,
+ DIRECTION_RTL = 0x0001,
+};
+
+enum op_display {
+ DISPLAY_INLINE = 0x0000,
+ DISPLAY_BLOCK = 0x0001,
+ DISPLAY_LIST_ITEM = 0x0002,
+ DISPLAY_RUN_IN = 0x0003,
+ DISPLAY_INLINE_BLOCK = 0x0004,
+ DISPLAY_TABLE = 0x0005,
+ DISPLAY_INLINE_TABLE = 0x0006,
+ DISPLAY_TABLE_ROW_GROUP = 0x0007,
+ DISPLAY_TABLE_HEADER_GROUP = 0x0008,
+ DISPLAY_TABLE_FOOTER_GROUP = 0x0009,
+ DISPLAY_TABLE_ROW = 0x000a,
+ DISPLAY_TABLE_COLUMN_GROUP = 0x000b,
+ DISPLAY_TABLE_COLUMN = 0x000c,
+ DISPLAY_TABLE_CELL = 0x000d,
+ DISPLAY_TABLE_CAPTION = 0x000e,
+ DISPLAY_NONE = 0x000f,
+};
+
+enum op_elevation {
+ ELEVATION_ANGLE = 0x0080,
+ ELEVATION_BELOW = 0x0000,
+ ELEVATION_LEVEL = 0x0001,
+ ELEVATION_ABOVE = 0x0002,
+ ELEVATION_HIGHER = 0x0003,
+ ELEVATION_LOWER = 0x0004,
+};
+
+enum op_empty_cells {
+ EMPTY_CELLS_SHOW = 0x0000,
+ EMPTY_CELLS_HIDE = 0x0001,
+};
+
+enum op_float {
+ FLOAT_LEFT = 0x0000,
+ FLOAT_RIGHT = 0x0001,
+ FLOAT_NONE = 0x0002,
+};
+
+enum op_font_family {
+ FONT_FAMILY_STRING = 0x0080,
+
+ FONT_FAMILY_END = 0x0000,
+
+ FONT_FAMILY_SERIF = 0x0001,
+ FONT_FAMILY_SANS_SERIF = 0x0002,
+ FONT_FAMILY_CURSIVE = 0x0003,
+ FONT_FAMILY_FANTASY = 0x0004,
+ FONT_FAMILY_MONOSPACE = 0x0005,
+};
+
+enum op_font_size {
+ FONT_SIZE_DIMENSION = 0x0080,
+
+ FONT_SIZE_XX_SMALL = 0x0000,
+ FONT_SIZE_X_SMALL = 0x0001,
+ FONT_SIZE_SMALL = 0x0002,
+ FONT_SIZE_MEDIUM = 0x0003,
+ FONT_SIZE_LARGE = 0x0004,
+ FONT_SIZE_X_LARGE = 0x0005,
+ FONT_SIZE_XX_LARGE = 0x0006,
+ FONT_SIZE_LARGER = 0x0007,
+ FONT_SIZE_SMALLER = 0x0008,
+};
+
+enum op_font_style {
+ FONT_STYLE_NORMAL = 0x0000,
+ FONT_STYLE_ITALIC = 0x0001,
+ FONT_STYLE_OBLIQUE = 0x0002,
+};
+
+enum op_font_variant {
+ FONT_VARIANT_NORMAL = 0x0000,
+ FONT_VARIANT_SMALL_CAPS = 0x0001,
+};
+
+enum op_font_weight {
+ FONT_WEIGHT_NORMAL = 0x0000,
+ FONT_WEIGHT_BOLD = 0x0001,
+ FONT_WEIGHT_BOLDER = 0x0002,
+ FONT_WEIGHT_LIGHTER = 0x0003,
+ FONT_WEIGHT_100 = 0x0004,
+ FONT_WEIGHT_200 = 0x0005,
+ FONT_WEIGHT_300 = 0x0006,
+ FONT_WEIGHT_400 = 0x0007,
+ FONT_WEIGHT_500 = 0x0008,
+ FONT_WEIGHT_600 = 0x0009,
+ FONT_WEIGHT_700 = 0x000a,
+ FONT_WEIGHT_800 = 0x000b,
+ FONT_WEIGHT_900 = 0x000c,
+};
+
+enum op_height {
+ HEIGHT_SET = 0x0080,
+ HEIGHT_AUTO = 0x0000,
+};
+
+enum op_left {
+ LEFT_SET = 0x0080,
+ LEFT_AUTO = 0x0000,
+};
+
+enum op_letter_spacing {
+ LETTER_SPACING_SET = 0x0080,
+ LETTER_SPACING_NORMAL = 0x0000,
+};
+
+enum op_line_height {
+ LINE_HEIGHT_NUMBER = 0x0080,
+ LINE_HEIGHT_DIMENSION = 0x0081,
+ LINE_HEIGHT_NORMAL = 0x0000
+};
+
+enum op_list_style_image {
+ LIST_STYLE_IMAGE_URI = 0x0080,
+ LIST_STYLE_IMAGE_NONE = 0x0000,
+};
+
+enum op_list_style_position {
+ LIST_STYLE_POSITION_INSIDE = 0x0000,
+ LIST_STYLE_POSITION_OUTSIDE = 0x0001,
+};
+
+enum op_list_style_type {
+ LIST_STYLE_TYPE_DISC = 0x0000,
+ LIST_STYLE_TYPE_CIRCLE = 0x0001,
+ LIST_STYLE_TYPE_SQUARE = 0x0002,
+ LIST_STYLE_TYPE_DECIMAL = 0x0003,
+ LIST_STYLE_TYPE_DECIMAL_LEADING_ZERO = 0x0004,
+ LIST_STYLE_TYPE_LOWER_ROMAN = 0x0005,
+ LIST_STYLE_TYPE_UPPER_ROMAN = 0x0006,
+ LIST_STYLE_TYPE_LOWER_GREEK = 0x0007,
+ LIST_STYLE_TYPE_UPPER_GREEK = 0x0008,
+ LIST_STYLE_TYPE_LOWER_LATIN = 0x0009,
+ LIST_STYLE_TYPE_UPPER_LATIN = 0x000a,
+ LIST_STYLE_TYPE_ARMENIAN = 0x000b,
+ LIST_STYLE_TYPE_GEORGIAN = 0x000c,
+ LIST_STYLE_TYPE_LOWER_ALPHA = 0x000d,
+ LIST_STYLE_TYPE_UPPER_ALPHA = 0x000e,
+ LIST_STYLE_TYPE_NONE = 0x000f,
+};
+
+enum op_margin {
+ MARGIN_SET = 0x0080,
+ MARGIN_AUTO = 0x0000,
+};
+
+enum op_max_height {
+ MAX_HEIGHT_SET = 0x0080,
+ MAX_HEIGHT_NONE = 0x0000,
+};
+
+enum op_max_width {
+ MAX_WIDTH_SET = 0x0080,
+ MAX_WIDTH_NONE = 0x0000,
+};
+
+enum op_min_height {
+ MIN_HEIGHT_SET = 0x0000,
+};
+
+enum op_min_width {
+ MIN_WIDTH_SET = 0x0000,
+};
+
+enum op_orphans {
+ ORPHANS_SET = 0x0000,
+};
+
+enum op_outline_color {
+ OUTLINE_COLOR_SET = 0x0080,
+ OUTLINE_COLOR_INVERT = 0x0000,
+};
+
+enum op_outline_style {
+ OUTLINE_STYLE_NONE = 0x0000,
+ OUTLINE_STYLE_HIDDEN = 0x0001,
+ OUTLINE_STYLE_DOTTED = 0x0002,
+ OUTLINE_STYLE_DASHED = 0x0003,
+ OUTLINE_STYLE_SOLID = 0x0004,
+ OUTLINE_STYLE_DOUBLE = 0x0005,
+ OUTLINE_STYLE_GROOVE = 0x0006,
+ OUTLINE_STYLE_RIDGE = 0x0007,
+ OUTLINE_STYLE_INSET = 0x0008,
+ OUTLINE_STYLE_OUTSET = 0x0009,
+};
+
+enum op_outline_width {
+ OUTLINE_WIDTH_SET = 0x0080,
+ OUTLINE_WIDTH_THIN = 0x0000,
+ OUTLINE_WIDTH_MEDIUM = 0x0001,
+ OUTLINE_WIDTH_THICK = 0x0002,
+};
+
+enum op_overflow {
+ OVERFLOW_VISIBLE = 0x0000,
+ OVERFLOW_HIDDEN = 0x0001,
+ OVERFLOW_SCROLL = 0x0002,
+ OVERFLOW_AUTO = 0x0003,
+};
+
+enum op_padding {
+ PADDING_SET = 0x0000,
+};
+
+enum op_page_break_after {
+ PAGE_BREAK_AFTER_AUTO = 0x0000,
+ PAGE_BREAK_AFTER_ALWAYS = 0x0001,
+ PAGE_BREAK_AFTER_AVOID = 0x0002,
+ PAGE_BREAK_AFTER_LEFT = 0x0003,
+ PAGE_BREAK_AFTER_RIGHT = 0x0004,
+}
+
+enum op_page_break_before {
+ PAGE_BREAK_BEFORE_AUTO = 0x0000,
+ PAGE_BREAK_BEFORE_ALWAYS = 0x0001,
+ PAGE_BREAK_BEFORE_AVOID = 0x0002,
+ PAGE_BREAK_BEFORE_LEFT = 0x0003,
+ PAGE_BREAK_BEFORE_RIGHT = 0x0004,
+};
+
+enum op_page_break_inside {
+ PAGE_BREAK_INSIDE_AUTO = 0x0000,
+ PAGE_BREAK_INSIDE_ALWAYS = 0x0001,
+};
+
+enum op_pause_after {
+ PAUSE_AFTER_SET = 0x0000,
+};
+
+enum op_pause_before {
+ PAUSE_BEFORE_SET = 0x0000,
+};
+
+enum op_pitch_range {
+ PITCH_RANGE_SET = 0x0000,
+};
+
+enum op_pitch {
+ PITCH_FREQUENCY = 0x0080,
+
+ PITCH_X_LOW = 0x0000,
+ PITCH_LOW = 0x0001,
+ PITCH_MEDIUM = 0x0002,
+ PITCH_HIGH = 0x0003,
+ PITCH_X_HIGH = 0x0004,
+};
+
+enum op_play_during {
+ PLAY_DURING_URI = 0x0080,
+ PLAY_DURING_MIX = (1<<6),
+ PLAY_DURING_REPEAT = (1<<5),
+
+ PLAY_DURING_AUTO = 0x0000,
+ PLAY_DURING_NONE = 0x0001,
+};
+
+enum op_position {
+ POSITION_STATIC = 0x0000,
+ POSITION_RELATIVE = 0x0001,
+ POSITION_ABSOLUTE = 0x0002,
+ POSITION_FIXED = 0x0003,
+};
+
+enum op_quotes {
+ QUOTES_STRING = 0x0080,
+
+ QUOTES_NONE = 0x0000,
+};
+
+enum op_richness {
+ RICHNESS_SET = 0x0000,
+};
+
+enum op_right {
+ RIGHT_SET = 0x0080,
+
+ RIGHT_AUTO = 0x0000,
+};
+
+enum op_speak_header {
+ SPEAK_HEADER_ONCE = 0x0000,
+ SPEAK_HEADER_ALWAYS = 0x0001,
+};
+
+enum op_speak_numeral {
+ SPEAK_NUMERAL_DIGITS = 0x0000,
+ SPEAK_NUMERAL_CONTINUOUS = 0x0001,
+};
+
+enum op_speak_punctuation {
+ SPEAK_PUNCTUATION_CODE = 0x0000,
+ SPEAK_PUNCTUATION_NONE = 0x0001,
+};
+
+enum op_speak {
+ SPEAK_NORMAL = 0x0000,
+ SPEAK_NONE = 0x0001,
+ SPEAK_SPELL_OUT = 0x0002,
+};
+
+enum op_speech_rate {
+ SPEECH_RATE_SET = 0x0080,
+
+ SPEECH_RATE_X_SLOW = 0x0000,
+ SPEECH_RATE_SLOW = 0x0001,
+ SPEECH_RATE_MEDIUM = 0x0002,
+ SPEECH_RATE_FAST = 0x0003,
+ SPEECH_RATE_X_FAST = 0x0004,
+ SPEECH_RATE_FASTER = 0x0005,
+ SPEECH_RATE_SLOWER = 0x0006,
+};
+
+enum op_stress {
+ STRESS_SET = 0x0000,
+};
+
+enum op_table_layout {
+ TABLE_LAYOUT_AUTO = 0x0000,
+ TABLE_LAYOUT_FIXED = 0x0001,
+};
+
+enum op_text_align {
+ TEXT_ALIGN_LEFT = 0x0000,
+ TEXT_ALIGN_RIGHT = 0x0001,
+ TEXT_ALIGN_CENTER = 0x0002,
+ TEXT_ALIGN_JUSTIFY = 0x0003,
+};
+
+enum op_text_decoration {
+ TEXT_DECORATION_NONE = 0x0000,
+
+ TEXT_DECORATION_BLINK = (1<<3),
+ TEXT_DECORATION_LINE_THROUGH = (1<<2),
+ TEXT_DECORATION_OVERLINE = (1<<1),
+ TEXT_DECORATION_UNDERLINE = (1<<0),
+};
+
+enum op_text_indent {
+ TEXT_INDENT_SET = 0x0000,
+};
+
+enum op_text_transform {
+ TEXT_TRANSFORM_CAPITALIZE = 0x0000,
+ TEXT_TRANSFORM_UPPERCASE = 0x0001,
+ TEXT_TRANSFORM_LOWERCASE = 0x0002,
+ TEXT_TRANSFORM_NONE = 0x0003,
+};
+
+enum op_top {
+ TOP_SET = 0x0080,
+
+ TOP_AUTO = 0x0000,
+};
+
+enum op_unicode_bidi {
+ UNICODE_BIDI_NORMAL = 0x0000,
+ UNICODE_BIDI_EMBED = 0x0001,
+ UNICODE_BIDI_BIDI_OVERRIDE = 0x0002,
+};
+
+enum op_vertical_align {
+ VERTICAL_ALIGN_SET = 0x0080,
+
+ VERTICAL_ALIGN_BASELINE = 0x0000,
+ VERTICAL_ALIGN_SUB = 0x0001,
+ VERTICAL_ALIGN_SUPER = 0x0002,
+ VERTICAL_ALIGN_TOP = 0x0003,
+ VERTICAL_ALIGN_TEXT_TOP = 0x0004,
+ VERTICAL_ALIGN_MIDDLE = 0x0005,
+ VERTICAL_ALIGN_BOTTOM = 0x0006,
+ VERTICAL_ALIGN_TEXT_BOTTOM = 0x0007,
+};
+
+enum op_visibility {
+ VISIBILITY_VISIBLE = 0x0000,
+ VISIBILITY_HIDDEN = 0x0001,
+ VISIBILITY_COLLAPSE = 0x0002,
+};
+
+enum op_voice_family {
+ VOICE_FAMILY_SET = 0x0080,
+
+ VOICE_FAMILY_END = 0x0000,
+
+ VOICE_FAMILY_MALE = 0x0001,
+ VOICE_FAMILY_FEMALE = 0x0002,
+ VOICE_FAMILY_CHILD = 0x0003,
+};
+
+enum op_volume {
+ VOLUME_NUMBER = 0x0080,
+ VOLUME_DIMENSION = 0x0081,
+
+ VOLUME_SILENT = 0x0000,
+ VOLUME_X_SOFT = 0x0001,
+ VOLUME_SOFT = 0x0002,
+ VOLUME_MEDIUM = 0x0003,
+ VOLUME_LOUD = 0x0004,
+ VOLUME_X_LOUD = 0x0005,
+};
+
+enum op_white_space {
+ WHITE_SPACE_NORMAL = 0x0000,
+ WHITE_SPACE_PRE = 0x0001,
+ WHITE_SPACE_NOWRAP = 0x0002,
+ WHITE_SPACE_PRE_WRAP = 0x0003,
+ WHITE_SPACE_PRE_LINE = 0x0004,
+};
+
+enum op_widows {
+ WIDOWS_SET = 0x0000,
+};
+
+enum op_width {
+ WIDTH_SET = 0x0080,
+
+ WIDTH_AUTO = 0x0000,
+};
+
+enum op_word_spacing {
+ WORD_SPACING_SET = 0x0080,
+
+ WORD_SPACING_NORMAL = 0x0000,
+};
+
+enum op_z_index {
+ Z_INDEX_SET = 0x0080,
+
+ Z_INDEX_AUTO = 0x0000,
+};
+
+#endif
+
14 years, 3 months
r5621 jmb - in /trunk/libcss/src: bytecode/ bytecode/bytecode.h parse/css21props.c
by netsurf@semichrome.net
Author: jmb
Date: Wed Oct 22 07:47:34 2008
New Revision: 5621
URL: http://source.netsurf-browser.org?rev=5621&view=rev
Log:
Bytecode stuff
Added:
trunk/libcss/src/bytecode/
trunk/libcss/src/bytecode/bytecode.h
Modified:
trunk/libcss/src/parse/css21props.c
Added: trunk/libcss/src/bytecode/bytecode.h
URL: http://source.netsurf-browser.org/trunk/libcss/src/bytecode/bytecode.h?re...
==============================================================================
--- trunk/libcss/src/bytecode/bytecode.h (added)
+++ trunk/libcss/src/bytecode/bytecode.h Wed Oct 22 07:47:34 2008
@@ -1,0 +1,164 @@
+/*
+ * This file is part of LibCSS.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2008 John-Mark Bell <jmb(a)netsurf-browser.org>
+ */
+
+#ifndef css_bytecode_bytecode_h_
+#define css_bytecode_bytecode_h_
+
+#include <inttypes.h>
+
+#include <libcss/types.h>
+
+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_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,
+} opcode;
+
+typedef enum unit {
+ UNIT_PX = 0,
+ UNIT_EX = 1,
+ UNIT_EM = 2,
+ UNIT_IN = 3,
+ UNIT_CM = 4,
+ UNIT_MM = 5,
+ UNIT_PT = 6,
+ UNIT_PC = 7,
+
+ UNIT_PCT = (1 << 8),
+
+ UNIT_DEG = (1 << 9) + 0,
+ UNIT_GRAD = (1 << 9) + 1,
+ UNIT_RAD = (1 << 9) + 2,
+
+ UNIT_MS = (1 << 10) + 0,
+ UNIT_S = (1 << 10) + 1,
+
+ UNIT_HZ = (1 << 11) + 0,
+ UNIT_KHZ = (1 << 11) + 1
+} unit;
+
+typedef uint32_t colour;
+
+typedef enum shape {
+ SHAPE_RECT = 0
+} shape;
+
+static inline uint32_t buildOPV(uint16_t opcode, uint8_t flags, uint16_t value)
+{
+ return (opcode & 0x3ff) | (flags << 10) | ((value & 0x3fff) << 18);
+}
+
+static inline uint16_t getOpcode(uint32_t OPV)
+{
+ return (OPV & 0x3ff);
+}
+
+static inline uint8_t getFlags(uint32_t OPV)
+{
+ return ((OPV >> 10) & 0xff);
+}
+
+static inline uint16_t getValue(uint32_t OPV)
+{
+ return (OPV >> 18);
+}
+
+static inline bool isImportant(uint32_t OPV)
+{
+ return getFlags(OPV) & 0x1;
+}
+
+static inline bool isInherit(uint32_t OPV)
+{
+ return getFlags(OPV) & 0x2;
+}
+
+#endif
+
+
+
Modified: trunk/libcss/src/parse/css21props.c
URL: http://source.netsurf-browser.org/trunk/libcss/src/parse/css21props.c?rev...
==============================================================================
--- trunk/libcss/src/parse/css21props.c (original)
+++ trunk/libcss/src/parse/css21props.c Wed Oct 22 07:47:34 2008
@@ -7,6 +7,8 @@
#ifndef css_parse_css21props_c_
#define css_parse_css21props_c_
+
+#include "bytecode/bytecode.h"
static css_error parse_azimuth(css_css21 *c,
const parserutils_vector *vector, int *ctx,
14 years, 3 months
r5620 jmb - in /trunk/libcss: build/mkprops.pl src/parse/css21.c src/parse/css21props.c src/stylesheet.h
by netsurf@semichrome.net
Author: jmb
Date: Wed Oct 22 06:50:57 2008
New Revision: 5620
URL: http://source.netsurf-browser.org?rev=5620&view=rev
Log:
Parse common part of declarations.
Stub out handlers for properties.
Added:
trunk/libcss/build/mkprops.pl (with props)
trunk/libcss/src/parse/css21props.c
Modified:
trunk/libcss/src/parse/css21.c
trunk/libcss/src/stylesheet.h
Added: trunk/libcss/build/mkprops.pl
URL: http://source.netsurf-browser.org/trunk/libcss/build/mkprops.pl?rev=5620&...
==============================================================================
--- trunk/libcss/build/mkprops.pl (added)
+++ trunk/libcss/build/mkprops.pl Wed Oct 22 06:50:57 2008
@@ -1,0 +1,73 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+# Auto-generate stub handlers for CSS properties.
+
+my @PROPS = split(/ /, "azimuth background_attachment background_color background_image background_position background_repeat border_bottom_color border_bottom_style border_bottom_width border_collapse border_left_color border_left_style border_left_width border_right_color border_right_style border_right_width border_spacing border_top_color border_top_style border_top_width bottom caption_side clear clip color content counter_increment counter_reset cue_after cue_before cursor direction display elevation empty_cells float font_family font_size font_style font_variant font_weight height left letter_spacing line_height list_style_image list_style_position list_style_type margin_bottom margin_left margin_right margin_top max_height max_width min_height min_width orphans outline_color outline_style outline_width overflow padding_bottom padding_left padding_right padding_top page_break_after page_break_before page_break_inside pause_after pause_before pitch_range pitch play_during position quotes richness right speak_header speak_numeral speak_punctuation speak speech_rate stress table_layout text_align text_decoration text_indent text_transform top unicode_bidi vertical_align visibility voice_family volume white_space widows width word_spacing z_index");
+
+print <<EOF
+/*
+ * This file is part of LibCSS.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2008 John-Mark Bell <jmb\(a)netsurf-browser.org>
+ */
+
+#ifndef css_parse_css21props_c_
+#define css_parse_css21props_c_
+
+EOF
+;
+
+foreach my $prop (@PROPS) {
+print <<EOF
+static css_error parse_$prop(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+EOF
+}
+
+print <<EOF
+
+/**
+ * Type of property handler function
+ */
+typedef css_error (*css_prop_handler)(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+
+/**
+ * Dispatch table of property handlers, indexed by property enum
+ */
+static const css_prop_handler property_handlers[LAST_KNOWN - FIRST_PROP] =
+{
+EOF
+;
+
+foreach my $prop (@PROPS) {
+ print "\tparse_$prop,\n";
+}
+
+print "};\n";
+
+foreach my $prop (@PROPS) {
+print <<EOF
+
+css_error parse_$prop(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+EOF
+}
+
+print "\n#endif\n";
+
Propchange: trunk/libcss/build/mkprops.pl
------------------------------------------------------------------------------
svn:executable = *
Modified: trunk/libcss/src/parse/css21.c
URL: http://source.netsurf-browser.org/trunk/libcss/src/parse/css21.c?rev=5620...
==============================================================================
--- trunk/libcss/src/parse/css21.c (original)
+++ trunk/libcss/src/parse/css21.c Wed Oct 22 06:50:57 2008
@@ -20,6 +20,30 @@
enum {
CHARSET, IMPORT, MEDIA, PAGE,
+
+ FIRST_PROP,
+
+ AZIMUTH = FIRST_PROP, BACKGROUND_ATTACHMENT, BACKGROUND_COLOR,
+ BACKGROUND_IMAGE, BACKGROUND_POSITION, BACKGROUND_REPEAT,
+ BORDER_BOTTOM_COLOR, BORDER_BOTTOM_STYLE, BORDER_BOTTOM_WIDTH,
+ BORDER_COLLAPSE, BORDER_LEFT_COLOR, BORDER_LEFT_STYLE,
+ BORDER_LEFT_WIDTH, BORDER_RIGHT_COLOR, BORDER_RIGHT_STYLE,
+ BORDER_RIGHT_WIDTH, BORDER_SPACING, BORDER_TOP_COLOR, BORDER_TOP_STYLE,
+ BORDER_TOP_WIDTH, BOTTOM, CAPTION_SIDE, CLEAR, CLIP, COLOR, CONTENT,
+ COUNTER_INCREMENT, COUNTER_RESET, CUE_AFTER, CUE_BEFORE, CURSOR,
+ DIRECTION, DISPLAY, ELEVATION, EMPTY_CELLS, FLOAT, FONT_FAMILY,
+ FONT_SIZE, FONT_STYLE, FONT_VARIANT, FONT_WEIGHT, HEIGHT, LEFT,
+ LETTER_SPACING, LINE_HEIGHT, LIST_STYLE_IMAGE, LIST_STYLE_POSITION,
+ LIST_STYLE_TYPE, MARGIN_BOTTOM, MARGIN_LEFT, MARGIN_RIGHT, MARGIN_TOP,
+ MAX_HEIGHT, MAX_WIDTH, MIN_HEIGHT, MIN_WIDTH, ORPHANS, OUTLINE_COLOR,
+ OUTLINE_STYLE, OUTLINE_WIDTH, OVERFLOW, PADDING_BOTTOM, PADDING_LEFT,
+ PADDING_RIGHT, PADDING_TOP, PAGE_BREAK_AFTER, PAGE_BREAK_BEFORE,
+ PAGE_BREAK_INSIDE, PAUSE_AFTER, PAUSE_BEFORE, PITCH_RANGE, PITCH,
+ PLAY_DURING, POSITION, QUOTES, RICHNESS, RIGHT, SPEAK_HEADER,
+ SPEAK_NUMERAL, SPEAK_PUNCTUATION, SPEAK, SPEECH_RATE, STRESS,
+ TABLE_LAYOUT, TEXT_ALIGN, TEXT_DECORATION, TEXT_INDENT, TEXT_TRANSFORM,
+ TOP, UNICODE_BIDI, VERTICAL_ALIGN, VISIBILITY, VOICE_FAMILY, VOLUME,
+ WHITE_SPACE, WIDOWS, WIDTH, WORD_SPACING, Z_INDEX,
LAST_KNOWN
};
@@ -32,11 +56,111 @@
{ "import", SLEN("import") },
{ "media", SLEN("media") },
{ "page", SLEN("page") },
+
+ { "azimuth", SLEN("azimuth") },
+ { "background-attachment", SLEN("background-attachment") },
+ { "background-color", SLEN("background-color") },
+ { "background-image", SLEN("background-image") },
+ { "background-position", SLEN("background-position") },
+ { "background-repeat", SLEN("background-repeat") },
+ { "border-bottom-color", SLEN("border-bottom-color") },
+ { "border-bottom-style", SLEN("border-bottom-style") },
+ { "border-bottom-width", SLEN("border-bottom-width") },
+ { "border-collapse", SLEN("border-collapse") },
+ { "border-left-color", SLEN("border-left-color") },
+ { "border-left-style", SLEN("border-left-style") },
+ { "border-left-width", SLEN("border-left-width") },
+ { "border-right-color", SLEN("border-right-color") },
+ { "border-right-style", SLEN("border-right-style") },
+ { "border-right-width", SLEN("border-right-width") },
+ { "border-spacing", SLEN("border-spacing") },
+ { "border-top-color", SLEN("border-top-color") },
+ { "border-top-style", SLEN("border-top-style") },
+ { "border-top-width", SLEN("border-top-width") },
+ { "bottom", SLEN("bottom") },
+ { "caption-side", SLEN("caption-side") },
+ { "clear", SLEN("clear") },
+ { "clip", SLEN("clip") },
+ { "color", SLEN("color") },
+ { "content", SLEN("content") },
+ { "counter-increment", SLEN("counter-increment") },
+ { "counter-reset", SLEN("counter-reset") },
+ { "cue-after", SLEN("cue-after") },
+ { "cue-before", SLEN("cue-before") },
+ { "cursor", SLEN("cursor") },
+ { "direction", SLEN("direction") },
+ { "display", SLEN("display") },
+ { "elevation", SLEN("elevation") },
+ { "empty-cells", SLEN("empty-cells") },
+ { "float", SLEN("float") },
+ { "font-family", SLEN("font-family") },
+ { "font-size", SLEN("font-size") },
+ { "font-style", SLEN("font-style") },
+ { "font-variant", SLEN("font-variant") },
+ { "font-weight", SLEN("font-weight") },
+ { "height", SLEN("height") },
+ { "left", SLEN("left") },
+ { "letter-spacing", SLEN("letter-spacing") },
+ { "line-height", SLEN("line-height") },
+ { "list-style-image", SLEN("list-style-image") },
+ { "list-style-position", SLEN("list-style-position") },
+ { "list-style-type", SLEN("list-style-type") },
+ { "margin-bottom", SLEN("margin-bottom") },
+ { "margin-left", SLEN("margin-left") },
+ { "margin-right", SLEN("margin-right") },
+ { "margin-top", SLEN("margin-top") },
+ { "max-height", SLEN("max-height") },
+ { "max-width", SLEN("max-width") },
+ { "min-height", SLEN("min-height") },
+ { "min-width", SLEN("min-width") },
+ { "orphans", SLEN("orphans") },
+ { "outline-color", SLEN("outline-color") },
+ { "outline-style", SLEN("outline-style") },
+ { "outline-width", SLEN("outline-width") },
+ { "overflow", SLEN("overflow") },
+ { "padding-bottom", SLEN("padding-bottom") },
+ { "padding-left", SLEN("padding-left") },
+ { "padding-right", SLEN("padding-right") },
+ { "padding-top", SLEN("padding-top") },
+ { "page-break-after", SLEN("page-break-after") },
+ { "page-break-before", SLEN("page-break-before") },
+ { "page-break-inside", SLEN("page-break-inside") },
+ { "pause-after", SLEN("pause-after") },
+ { "pause-before", SLEN("pause-before") },
+ { "pitch-range", SLEN("pitch-range") },
+ { "pitch", SLEN("pitch") },
+ { "play-during", SLEN("play-during") },
+ { "position", SLEN("position") },
+ { "quotes", SLEN("quotes") },
+ { "richness", SLEN("richness") },
+ { "right", SLEN("right") },
+ { "speak-header", SLEN("speak-header") },
+ { "speak-numeral", SLEN("speak-numeral") },
+ { "speak-punctuation", SLEN("speak-punctuation") },
+ { "speak", SLEN("speak") },
+ { "speech-rate", SLEN("speech-rate") },
+ { "stress", SLEN("stress") },
+ { "table-layout", SLEN("table-layout") },
+ { "text-align", SLEN("text-align") },
+ { "text-decoration", SLEN("text-decoration") },
+ { "text-indent", SLEN("text-indent") },
+ { "text-transform", SLEN("text-transform") },
+ { "top", SLEN("top") },
+ { "unicode-bidi", SLEN("unicode-bidi") },
+ { "vertical-align", SLEN("vertical-align") },
+ { "visibility", SLEN("visibility") },
+ { "voice-family", SLEN("voice-family") },
+ { "volume", SLEN("volume") },
+ { "white-space", SLEN("white-space") },
+ { "widows", SLEN("widows") },
+ { "width", SLEN("width") },
+ { "word-spacing", SLEN("word-spacing") },
+ { "z-index", SLEN("z-index") }
};
typedef struct context_entry {
css_parser_event type; /**< Type of entry */
- const uint8_t *data; /**< Pointer to interned string */
+ void *data; /**< Data for context */
} context_entry;
/**
@@ -113,6 +237,11 @@
static inline css_error parseSelectorList(css_css21 *c,
const parserutils_vector *vector, css_rule *rule);
+/* Declaration parsing */
+static inline css_error parseProperty(css_css21 *c,
+ const css_token *property, const parserutils_vector *vector,
+ int *ctx, css_rule *rule);
+
/* Helpers */
static inline void consumeWhitespace(const parserutils_vector *vector,
int *ctx);
@@ -294,6 +423,8 @@
return error;
}
+ entry.data = rule;
+
perror = parserutils_stack_push(c->context, (void *) &entry);
if (perror != PARSERUTILS_OK) {
css_stylesheet_rule_destroy(c->sheet, rule);
@@ -475,19 +606,46 @@
css_error handleDeclaration(css_css21 *c, const parserutils_vector *vector)
{
- UNUSED(c);
- UNUSED(vector);
+ css_error error;
+ const css_token *token, *ident;
+ int ctx = 0;
+ context_entry *entry;
+ css_rule *rule;
/* Locations where declarations are permitted:
*
* + In @page
* + In ruleset
*/
+ entry = parserutils_stack_get_current(c->context);
+ if (entry == NULL || (entry->type != CSS_PARSER_START_RULESET &&
+ entry->type != CSS_PARSER_START_ATRULE))
+ return CSS_INVALID;
+
+ rule = entry->data;
+ if (rule == NULL || (rule->type != CSS_RULE_SELECTOR &&
+ rule->type != CSS_RULE_PAGE))
+ return CSS_INVALID;
/* IDENT ws ':' ws value
*
* In CSS 2.1, value is any1, so '{' or ATKEYWORD => parse error
*/
+ ident = parserutils_vector_iterate(vector, &ctx);
+ if (ident == NULL || ident->type != CSS_TOKEN_IDENT)
+ return CSS_INVALID;
+
+ consumeWhitespace(vector, &ctx);
+
+ token = parserutils_vector_iterate(vector, &ctx);
+ if (token == NULL || tokenIsChar(token, ':') == false)
+ return CSS_INVALID;
+
+ consumeWhitespace(vector, &ctx);
+
+ error = parseProperty(c, ident, vector, &ctx, rule);
+ if (error != CSS_OK)
+ return error;
return CSS_OK;
}
@@ -898,6 +1056,44 @@
}
/******************************************************************************
+ * Property parsing functions *
+ ******************************************************************************/
+
+#include "css21props.c"
+
+css_error parseProperty(css_css21 *c, const css_token *property,
+ const parserutils_vector *vector, int *ctx, css_rule *rule)
+{
+ css_error error;
+ css_prop_handler handler = NULL;
+ int i = 0;
+ css_style *style;
+
+ /* Find property index */
+ /** \todo improve on this linear search */
+ for (i = FIRST_PROP; i < LAST_KNOWN; i++) {
+ if (property->lower.ptr == c->strings[i])
+ break;
+ }
+ if (i == LAST_KNOWN)
+ return CSS_INVALID;
+
+ /* Get handler */
+ handler = property_handlers[i - FIRST_PROP];
+ assert(handler != NULL);
+
+ /* Call it */
+ error = handler(c, vector, ctx, &style);
+ if (error != CSS_OK)
+ return error;
+
+ /** \todo append style to rule */
+ UNUSED(rule);
+
+ return CSS_OK;
+}
+
+/******************************************************************************
* Helper functions *
******************************************************************************/
Added: trunk/libcss/src/parse/css21props.c
URL: http://source.netsurf-browser.org/trunk/libcss/src/parse/css21props.c?rev...
==============================================================================
--- trunk/libcss/src/parse/css21props.c (added)
+++ trunk/libcss/src/parse/css21props.c Wed Oct 22 06:50:57 2008
@@ -1,0 +1,1610 @@
+/*
+ * This file is part of LibCSS.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2008 John-Mark Bell <jmb(a)netsurf-browser.org>
+ */
+
+#ifndef css_parse_css21props_c_
+#define css_parse_css21props_c_
+
+static css_error parse_azimuth(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_background_attachment(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_background_color(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_background_image(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_background_position(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_background_repeat(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_border_bottom_color(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_border_bottom_style(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_border_bottom_width(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_border_collapse(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_border_left_color(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_border_left_style(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_border_left_width(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_border_right_color(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_border_right_style(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_border_right_width(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_border_spacing(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_border_top_color(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_border_top_style(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_border_top_width(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_bottom(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_caption_side(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_clear(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_clip(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_color(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_content(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_counter_increment(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_counter_reset(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_cue_after(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_cue_before(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_cursor(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_direction(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_display(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_elevation(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_empty_cells(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_float(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_font_family(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_font_size(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_font_style(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_font_variant(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_font_weight(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_height(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_left(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_letter_spacing(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_line_height(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_list_style_image(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_list_style_position(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_list_style_type(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_margin_bottom(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_margin_left(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_margin_right(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_margin_top(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_max_height(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_max_width(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_min_height(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_min_width(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_orphans(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_outline_color(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_outline_style(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_outline_width(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_overflow(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_padding_bottom(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_padding_left(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_padding_right(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_padding_top(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_page_break_after(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_page_break_before(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_page_break_inside(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_pause_after(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_pause_before(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_pitch_range(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_pitch(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_play_during(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_position(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_quotes(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_richness(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_right(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_speak_header(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_speak_numeral(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_speak_punctuation(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_speak(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_speech_rate(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_stress(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_table_layout(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_text_align(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_text_decoration(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_text_indent(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_text_transform(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_top(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_unicode_bidi(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_vertical_align(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_visibility(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_voice_family(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_volume(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_white_space(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_widows(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_width(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_word_spacing(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+static css_error parse_z_index(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+
+/**
+ * Type of property handler function
+ */
+typedef css_error (*css_prop_handler)(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result);
+
+/**
+ * Dispatch table of property handlers, indexed by property enum
+ */
+static const css_prop_handler property_handlers[LAST_KNOWN - FIRST_PROP] =
+{
+ parse_azimuth,
+ parse_background_attachment,
+ parse_background_color,
+ parse_background_image,
+ parse_background_position,
+ parse_background_repeat,
+ parse_border_bottom_color,
+ parse_border_bottom_style,
+ parse_border_bottom_width,
+ parse_border_collapse,
+ parse_border_left_color,
+ parse_border_left_style,
+ parse_border_left_width,
+ parse_border_right_color,
+ parse_border_right_style,
+ parse_border_right_width,
+ parse_border_spacing,
+ parse_border_top_color,
+ parse_border_top_style,
+ parse_border_top_width,
+ parse_bottom,
+ parse_caption_side,
+ parse_clear,
+ parse_clip,
+ parse_color,
+ parse_content,
+ parse_counter_increment,
+ parse_counter_reset,
+ parse_cue_after,
+ parse_cue_before,
+ parse_cursor,
+ parse_direction,
+ parse_display,
+ parse_elevation,
+ parse_empty_cells,
+ parse_float,
+ parse_font_family,
+ parse_font_size,
+ parse_font_style,
+ parse_font_variant,
+ parse_font_weight,
+ parse_height,
+ parse_left,
+ parse_letter_spacing,
+ parse_line_height,
+ parse_list_style_image,
+ parse_list_style_position,
+ parse_list_style_type,
+ parse_margin_bottom,
+ parse_margin_left,
+ parse_margin_right,
+ parse_margin_top,
+ parse_max_height,
+ parse_max_width,
+ parse_min_height,
+ parse_min_width,
+ parse_orphans,
+ parse_outline_color,
+ parse_outline_style,
+ parse_outline_width,
+ parse_overflow,
+ parse_padding_bottom,
+ parse_padding_left,
+ parse_padding_right,
+ parse_padding_top,
+ parse_page_break_after,
+ parse_page_break_before,
+ parse_page_break_inside,
+ parse_pause_after,
+ parse_pause_before,
+ parse_pitch_range,
+ parse_pitch,
+ parse_play_during,
+ parse_position,
+ parse_quotes,
+ parse_richness,
+ parse_right,
+ parse_speak_header,
+ parse_speak_numeral,
+ parse_speak_punctuation,
+ parse_speak,
+ parse_speech_rate,
+ parse_stress,
+ parse_table_layout,
+ parse_text_align,
+ parse_text_decoration,
+ parse_text_indent,
+ parse_text_transform,
+ parse_top,
+ parse_unicode_bidi,
+ parse_vertical_align,
+ parse_visibility,
+ parse_voice_family,
+ parse_volume,
+ parse_white_space,
+ parse_widows,
+ parse_width,
+ parse_word_spacing,
+ parse_z_index,
+};
+
+css_error parse_azimuth(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_background_attachment(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_background_color(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_background_image(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_background_position(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_background_repeat(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_border_bottom_color(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_border_bottom_style(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_border_bottom_width(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_border_collapse(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_border_left_color(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_border_left_style(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_border_left_width(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_border_right_color(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_border_right_style(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_border_right_width(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_border_spacing(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_border_top_color(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_border_top_style(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_border_top_width(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_bottom(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_caption_side(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_clear(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_clip(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_color(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_content(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_counter_increment(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_counter_reset(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_cue_after(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_cue_before(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_cursor(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_direction(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_display(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_elevation(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_empty_cells(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_float(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_font_family(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_font_size(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_font_style(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_font_variant(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_font_weight(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_height(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_left(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_letter_spacing(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_line_height(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_list_style_image(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_list_style_position(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_list_style_type(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_margin_bottom(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_margin_left(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_margin_right(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_margin_top(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_max_height(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_max_width(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_min_height(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_min_width(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_orphans(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_outline_color(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_outline_style(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_outline_width(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_overflow(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_padding_bottom(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_padding_left(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_padding_right(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_padding_top(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_page_break_after(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_page_break_before(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_page_break_inside(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_pause_after(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_pause_before(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_pitch_range(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_pitch(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_play_during(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_position(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_quotes(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_richness(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_right(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_speak_header(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_speak_numeral(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_speak_punctuation(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_speak(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_speech_rate(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_stress(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_table_layout(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_text_align(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_text_decoration(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_text_indent(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_text_transform(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_top(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_unicode_bidi(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_vertical_align(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_visibility(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_voice_family(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_volume(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_white_space(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_widows(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_width(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_word_spacing(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+css_error parse_z_index(css_css21 *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ UNUSED(c);
+ UNUSED(vector);
+ UNUSED(ctx);
+ UNUSED(result);
+
+ return CSS_OK;
+}
+
+#endif
Modified: trunk/libcss/src/stylesheet.h
URL: http://source.netsurf-browser.org/trunk/libcss/src/stylesheet.h?rev=5620&...
==============================================================================
--- trunk/libcss/src/stylesheet.h (original)
+++ trunk/libcss/src/stylesheet.h Wed Oct 22 06:50:57 2008
@@ -20,7 +20,11 @@
typedef struct css_rule css_rule;
typedef struct css_selector css_selector;
-typedef struct css_style css_style;
+
+typedef struct css_style {
+ uint32_t length; /**< Length, in bytes, of bytecode */
+ void *bytecode; /**< Pointer to bytecode */
+} css_style;
typedef enum css_selector_type {
CSS_SELECTOR_ELEMENT,
@@ -160,14 +164,13 @@
css_error css_stylesheet_selector_combine(css_stylesheet *sheet,
css_combinator type, css_selector *a, css_selector *b);
-/** \todo something about adding style declarations to a selector */
-
css_rule *css_stylesheet_rule_create(css_stylesheet *sheet, css_rule_type type);
void css_stylesheet_rule_destroy(css_stylesheet *sheet, css_rule *rule);
css_error css_stylesheet_rule_add_selector(css_stylesheet *sheet,
css_rule *rule, css_selector *selector);
+/** \todo something about adding style declarations to a rule */
/** \todo registering other rule-type data with css_rules */
css_error css_stylesheet_add_rule(css_stylesheet *sheet, css_rule *rule);
14 years, 3 months
r5619 jmb - /trunk/libcss/docs/Bytecode
by netsurf@semichrome.net
Author: jmb
Date: Tue Oct 21 19:07:03 2008
New Revision: 5619
URL: http://source.netsurf-browser.org?rev=5619&view=rev
Log:
In hindsight, it's more likely that opcodes will be added than flags, so use 10 bits for the opcode and 8 for flags.
Modified:
trunk/libcss/docs/Bytecode
Modified: trunk/libcss/docs/Bytecode
URL: http://source.netsurf-browser.org/trunk/libcss/docs/Bytecode?rev=5619&r1=...
==============================================================================
--- trunk/libcss/docs/Bytecode (original)
+++ trunk/libcss/docs/Bytecode Tue Oct 21 19:07:03 2008
@@ -8,11 +8,11 @@
<opcode+flags+value> is 32 bits wide:
bits 18-13: value
- bits 8-17 : flags
- bits 0-7 : opcode
-
-The 10 bits of flag data are defined as follows:
- bits 2-9: MBZ
+ bits 10-17 : flags
+ bits 0-9 : opcode
+
+The 8 bits of flag data are defined as follows:
+ bits 2-7: MBZ
bit 1 : value is inherit
bit 0 : value is important
@@ -1062,5 +1062,5 @@
bits 0-6: 0000000 => auto,
other => rffe.
-54-ff - Reserved for future expansion.
-
+54-3ff - Reserved for future expansion.
+
14 years, 3 months