summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-05-27 00:28:14 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-05-27 00:28:14 +0000
commit62efdd1bb64dcdec770c43df5e8ea2c56cf6bdb4 (patch)
tree0b82d07076f05978c7a77b2ea4b917e2b1558d53 /src
parent090da931105b942a42a610f0cb92c9f2cd3e7cfc (diff)
downloadlibcss-62efdd1bb64dcdec770c43df5e8ea2c56cf6bdb4.tar.gz
libcss-62efdd1bb64dcdec770c43df5e8ea2c56cf6bdb4.tar.bz2
Split out table-related property parsers
svn path=/trunk/libcss/; revision=7569
Diffstat (limited to 'src')
-rw-r--r--src/parse/properties/Makefile2
-rw-r--r--src/parse/properties/properties.c123
-rw-r--r--src/parse/properties/table.c137
3 files changed, 138 insertions, 124 deletions
diff --git a/src/parse/properties/Makefile b/src/parse/properties/Makefile
index b3546be..d0df0dd 100644
--- a/src/parse/properties/Makefile
+++ b/src/parse/properties/Makefile
@@ -1,4 +1,4 @@
# Sources
-DIR_SOURCES := aural.c background.c border_outline.c boxsizing.c font.c generated_list.c margin.c padding.c page.c positioning.c properties.c text.c utils.c
+DIR_SOURCES := aural.c background.c border_outline.c boxsizing.c font.c generated_list.c margin.c padding.c page.c positioning.c properties.c table.c text.c utils.c
include build/makefiles/Makefile.subdir
diff --git a/src/parse/properties/properties.c b/src/parse/properties/properties.c
index b55c785..a707549 100644
--- a/src/parse/properties/properties.c
+++ b/src/parse/properties/properties.c
@@ -119,47 +119,6 @@ const css_prop_handler property_handlers[LAST_PROP + 1 - FIRST_PROP] =
parse_z_index,
};
-css_error parse_caption_side(css_language *c,
- const parserutils_vector *vector, int *ctx,
- css_style **result)
-{
- css_error error;
- const css_token *ident;
- uint8_t flags = 0;
- uint16_t value = 0;
- uint32_t opv;
-
- /* IDENT (top, bottom, 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->ilower == c->strings[INHERIT]) {
- flags |= FLAG_INHERIT;
- } else if (ident->ilower == c->strings[TOP]) {
- value = CAPTION_SIDE_TOP;
- } else if (ident->ilower == c->strings[BOTTOM]) {
- value = CAPTION_SIDE_BOTTOM;
- } else
- return CSS_INVALID;
-
- opv = buildOPV(CSS_PROP_CAPTION_SIDE, flags, value);
-
- /* Allocate result */
- error = css_stylesheet_style_create(c->sheet, sizeof(opv), result);
- if (error != CSS_OK)
- return error;
-
- /* Copy the bytecode to it */
- memcpy((*result)->bytecode, &opv, sizeof(opv));
-
- return CSS_OK;
-}
-
css_error parse_clip(css_language *c,
const parserutils_vector *vector, int *ctx,
css_style **result)
@@ -676,47 +635,6 @@ css_error parse_display(css_language *c,
return CSS_OK;
}
-css_error parse_empty_cells(css_language *c,
- const parserutils_vector *vector, int *ctx,
- css_style **result)
-{
- css_error error;
- const css_token *ident;
- uint8_t flags = 0;
- uint16_t value = 0;
- uint32_t opv;
-
- /* IDENT (show, hide, 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->ilower == c->strings[INHERIT]) {
- flags |= FLAG_INHERIT;
- } else if (ident->ilower == c->strings[SHOW]) {
- value = EMPTY_CELLS_SHOW;
- } else if (ident->ilower == c->strings[HIDE]) {
- value = EMPTY_CELLS_HIDE;
- } else
- return CSS_INVALID;
-
- opv = buildOPV(CSS_PROP_EMPTY_CELLS, flags, value);
-
- /* Allocate result */
- error = css_stylesheet_style_create(c->sheet, sizeof(opv), result);
- if (error != CSS_OK)
- return error;
-
- /* Copy the bytecode to it */
- memcpy((*result)->bytecode, &opv, sizeof(opv));
-
- return CSS_OK;
-}
-
css_error parse_overflow(css_language *c,
const parserutils_vector *vector, int *ctx,
css_style **result)
@@ -762,47 +680,6 @@ css_error parse_overflow(css_language *c,
return CSS_OK;
}
-css_error parse_table_layout(css_language *c,
- const parserutils_vector *vector, int *ctx,
- css_style **result)
-{
- css_error error;
- const css_token *ident;
- uint8_t flags = 0;
- uint16_t value = 0;
- uint32_t opv;
-
- /* IDENT (auto, fixed, 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->ilower == c->strings[INHERIT]) {
- flags |= FLAG_INHERIT;
- } else if (ident->ilower == c->strings[AUTO]) {
- value = TABLE_LAYOUT_AUTO;
- } else if (ident->ilower == c->strings[FIXED]) {
- value = TABLE_LAYOUT_FIXED;
- } else
- return CSS_INVALID;
-
- opv = buildOPV(CSS_PROP_TABLE_LAYOUT, flags, value);
-
- /* Allocate result */
- error = css_stylesheet_style_create(c->sheet, sizeof(opv), result);
- if (error != CSS_OK)
- return error;
-
- /* Copy the bytecode to it */
- memcpy((*result)->bytecode, &opv, sizeof(opv));
-
- return CSS_OK;
-}
-
css_error parse_visibility(css_language *c,
const parserutils_vector *vector, int *ctx,
css_style **result)
diff --git a/src/parse/properties/table.c b/src/parse/properties/table.c
new file mode 100644
index 0000000..e1249f8
--- /dev/null
+++ b/src/parse/properties/table.c
@@ -0,0 +1,137 @@
+/*
+ * This file is part of LibCSS.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2009 John-Mark Bell <jmb@netsurf-browser.org>
+ */
+
+#include <string.h>
+
+#include "bytecode/bytecode.h"
+#include "bytecode/opcodes.h"
+#include "parse/properties/properties.h"
+#include "parse/properties/utils.h"
+
+css_error parse_caption_side(css_language *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ css_error error;
+ const css_token *ident;
+ uint8_t flags = 0;
+ uint16_t value = 0;
+ uint32_t opv;
+
+ /* IDENT (top, bottom, 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->ilower == c->strings[INHERIT]) {
+ flags |= FLAG_INHERIT;
+ } else if (ident->ilower == c->strings[TOP]) {
+ value = CAPTION_SIDE_TOP;
+ } else if (ident->ilower == c->strings[BOTTOM]) {
+ value = CAPTION_SIDE_BOTTOM;
+ } else
+ return CSS_INVALID;
+
+ opv = buildOPV(CSS_PROP_CAPTION_SIDE, flags, value);
+
+ /* Allocate result */
+ error = css_stylesheet_style_create(c->sheet, sizeof(opv), result);
+ if (error != CSS_OK)
+ return error;
+
+ /* Copy the bytecode to it */
+ memcpy((*result)->bytecode, &opv, sizeof(opv));
+
+ return CSS_OK;
+}
+
+css_error parse_empty_cells(css_language *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ css_error error;
+ const css_token *ident;
+ uint8_t flags = 0;
+ uint16_t value = 0;
+ uint32_t opv;
+
+ /* IDENT (show, hide, 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->ilower == c->strings[INHERIT]) {
+ flags |= FLAG_INHERIT;
+ } else if (ident->ilower == c->strings[SHOW]) {
+ value = EMPTY_CELLS_SHOW;
+ } else if (ident->ilower == c->strings[HIDE]) {
+ value = EMPTY_CELLS_HIDE;
+ } else
+ return CSS_INVALID;
+
+ opv = buildOPV(CSS_PROP_EMPTY_CELLS, flags, value);
+
+ /* Allocate result */
+ error = css_stylesheet_style_create(c->sheet, sizeof(opv), result);
+ if (error != CSS_OK)
+ return error;
+
+ /* Copy the bytecode to it */
+ memcpy((*result)->bytecode, &opv, sizeof(opv));
+
+ return CSS_OK;
+}
+
+css_error parse_table_layout(css_language *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style **result)
+{
+ css_error error;
+ const css_token *ident;
+ uint8_t flags = 0;
+ uint16_t value = 0;
+ uint32_t opv;
+
+ /* IDENT (auto, fixed, 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->ilower == c->strings[INHERIT]) {
+ flags |= FLAG_INHERIT;
+ } else if (ident->ilower == c->strings[AUTO]) {
+ value = TABLE_LAYOUT_AUTO;
+ } else if (ident->ilower == c->strings[FIXED]) {
+ value = TABLE_LAYOUT_FIXED;
+ } else
+ return CSS_INVALID;
+
+ opv = buildOPV(CSS_PROP_TABLE_LAYOUT, flags, value);
+
+ /* Allocate result */
+ error = css_stylesheet_style_create(c->sheet, sizeof(opv), result);
+ if (error != CSS_OK)
+ return error;
+
+ /* Copy the bytecode to it */
+ memcpy((*result)->bytecode, &opv, sizeof(opv));
+
+ return CSS_OK;
+}
+