summaryrefslogtreecommitdiff
path: root/src/parse/properties
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-06-18 20:07:47 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-06-18 20:07:47 +0000
commit4ff509a419cf48774d31f27e11a59edef1fd52d2 (patch)
tree42b86995bf3d9bb890e20a703b94acc0f2e538da /src/parse/properties
parent2e21ea7e931bc501a6af8f1761d68407fb232731 (diff)
downloadlibcss-4ff509a419cf48774d31f27e11a59edef1fd52d2.tar.gz
libcss-4ff509a419cf48774d31f27e11a59edef1fd52d2.tar.bz2
Centralise !important handling.
Document background-attachment parser and make it behave correctly. svn path=/trunk/libcss/; revision=7856
Diffstat (limited to 'src/parse/properties')
-rw-r--r--src/parse/properties/aural.c79
-rw-r--r--src/parse/properties/background.c47
-rw-r--r--src/parse/properties/border_outline.c24
-rw-r--r--src/parse/properties/display_sizing.c32
-rw-r--r--src/parse/properties/effects_stacking.c16
-rw-r--r--src/parse/properties/font.c27
-rw-r--r--src/parse/properties/generated_list.c45
-rw-r--r--src/parse/properties/margin.c4
-rw-r--r--src/parse/properties/padding.c4
-rw-r--r--src/parse/properties/page.c20
-rw-r--r--src/parse/properties/positioning.c20
-rw-r--r--src/parse/properties/table.c12
-rw-r--r--src/parse/properties/text.c40
-rw-r--r--src/parse/properties/ui.c8
-rw-r--r--src/parse/properties/utils.c46
-rw-r--r--src/parse/properties/utils.h3
16 files changed, 24 insertions, 403 deletions
diff --git a/src/parse/properties/aural.c b/src/parse/properties/aural.c
index c548ff1..20ac59f 100644
--- a/src/parse/properties/aural.c
+++ b/src/parse/properties/aural.c
@@ -147,10 +147,6 @@ css_error parse_azimuth(css_language *c,
value = AZIMUTH_ANGLE;
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(CSS_PROP_AZIMUTH, flags, value);
required_size = sizeof(opv);
@@ -191,10 +187,6 @@ css_error parse_cue_after(css_language *c,
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->ilower == c->strings[INHERIT]) {
flags |= FLAG_INHERIT;
@@ -246,10 +238,6 @@ css_error parse_cue_before(css_language *c,
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->ilower == c->strings[INHERIT]) {
flags |= FLAG_INHERIT;
@@ -350,10 +338,6 @@ css_error parse_elevation(css_language *c,
value = ELEVATION_ANGLE;
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(CSS_PROP_ELEVATION, flags, value);
required_size = sizeof(opv);
@@ -415,10 +399,6 @@ css_error parse_pause_after(css_language *c,
value = PAUSE_AFTER_SET;
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(CSS_PROP_PAUSE_AFTER, flags, value);
required_size = sizeof(opv);
@@ -480,10 +460,6 @@ css_error parse_pause_before(css_language *c,
value = PAUSE_BEFORE_SET;
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(CSS_PROP_PAUSE_BEFORE, flags, value);
required_size = sizeof(opv);
@@ -525,10 +501,6 @@ css_error parse_pitch_range(css_language *c,
token->type != CSS_TOKEN_NUMBER))
return CSS_INVALID;
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
if (token->ilower == c->strings[INHERIT]) {
flags |= FLAG_INHERIT;
} else if (token->type == CSS_TOKEN_NUMBER) {
@@ -625,10 +597,6 @@ css_error parse_pitch(css_language *c,
value = PITCH_FREQUENCY;
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(CSS_PROP_PITCH, flags, value);
required_size = sizeof(opv);
@@ -709,10 +677,6 @@ css_error parse_play_during(css_language *c,
}
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(CSS_PROP_PLAY_DURING, flags, value);
required_size = sizeof(opv);
@@ -755,10 +719,6 @@ css_error parse_richness(css_language *c,
token->type != CSS_TOKEN_NUMBER))
return CSS_INVALID;
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
if (token->ilower == c->strings[INHERIT]) {
flags |= FLAG_INHERIT;
} else if (token->type == CSS_TOKEN_NUMBER) {
@@ -812,10 +772,6 @@ css_error parse_speak_header(css_language *c,
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[ONCE]) {
@@ -853,10 +809,6 @@ css_error parse_speak_numeral(css_language *c,
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[DIGITS]) {
@@ -894,10 +846,6 @@ css_error parse_speak_punctuation(css_language *c,
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[CODE]) {
@@ -935,10 +883,6 @@ css_error parse_speak(css_language *c,
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[NORMAL]) {
@@ -983,10 +927,6 @@ css_error parse_speech_rate(css_language *c,
token->type != CSS_TOKEN_NUMBER))
return CSS_INVALID;
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
if (token->type == CSS_TOKEN_IDENT &&
token->ilower == c->strings[INHERIT]) {
flags |= FLAG_INHERIT;
@@ -1065,10 +1005,6 @@ css_error parse_stress(css_language *c,
token->type != CSS_TOKEN_NUMBER))
return CSS_INVALID;
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
if (token->ilower == c->strings[INHERIT]) {
flags |= FLAG_INHERIT;
} else if (token->type == CSS_TOKEN_NUMBER) {
@@ -1232,10 +1168,6 @@ css_error parse_voice_family(css_language *c,
required_size += sizeof(opv);
}
- error = parse_important(c, vector, &temp_ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(CSS_PROP_VOICE_FAMILY, flags, value);
/* Allocate result */
@@ -1435,13 +1367,6 @@ css_error parse_voice_family(css_language *c,
ptr += sizeof(opv);
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK) {
- css_stylesheet_style_destroy(c->sheet, *result);
- *result = NULL;
- return error;
- }
-
return CSS_OK;
}
@@ -1522,10 +1447,6 @@ css_error parse_volume(css_language *c,
value = VOLUME_DIMENSION;
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(CSS_PROP_VOLUME, flags, value);
required_size = sizeof(opv);
diff --git a/src/parse/properties/background.c b/src/parse/properties/background.c
index 46ddf73..491b092 100644
--- a/src/parse/properties/background.c
+++ b/src/parse/properties/background.c
@@ -13,10 +13,25 @@
#include "parse/properties/properties.h"
#include "parse/properties/utils.h"
+/**
+ * Parse background-attachment
+ *
+ * \param c Parsing context
+ * \param vector Vector of tokens to process
+ * \param ctx Pointer to vector iteration context
+ * \param result Pointer to location to receive resulting style
+ * \return CSS_OK on success,
+ * CSS_NOMEM on memory exhaustion,
+ * CSS_INVALID if the input is not a valid background-attachment
+ *
+ * Post condition: \a *ctx is updated with the next token to process
+ * If the input is invalid, then \a *ctx remains unchanged.
+ */
css_error parse_background_attachment(css_language *c,
const parserutils_vector *vector, int *ctx,
css_style **result)
{
+ int orig_ctx = *ctx;
css_error error;
const css_token *ident;
uint8_t flags = 0;
@@ -25,12 +40,10 @@ css_error parse_background_attachment(css_language *c,
/* IDENT (fixed, scroll, inherit) */
ident = parserutils_vector_iterate(vector, ctx);
- if (ident == NULL || ident->type != CSS_TOKEN_IDENT)
+ if (ident == NULL || ident->type != CSS_TOKEN_IDENT) {
+ *ctx = orig_ctx;
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;
@@ -38,15 +51,19 @@ css_error parse_background_attachment(css_language *c,
value = BACKGROUND_ATTACHMENT_FIXED;
} else if (ident->ilower == c->strings[SCROLL]) {
value = BACKGROUND_ATTACHMENT_SCROLL;
- } else
+ } else {
+ *ctx = orig_ctx;
return CSS_INVALID;
+ }
opv = buildOPV(CSS_PROP_BACKGROUND_ATTACHMENT, flags, value);
/* Allocate result */
error = css_stylesheet_style_create(c->sheet, sizeof(opv), result);
- if (error != CSS_OK)
+ if (error != CSS_OK) {
+ *ctx = orig_ctx;
return error;
+ }
/* Copy the bytecode to it */
memcpy((*result)->bytecode, &opv, sizeof(opv));
@@ -87,10 +104,6 @@ css_error parse_background_color(css_language *c,
value = BACKGROUND_COLOR_SET;
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(CSS_PROP_BACKGROUND_COLOR, flags, value);
required_size = sizeof(opv);
@@ -129,10 +142,6 @@ css_error parse_background_image(css_language *c,
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->ilower == c->strings[INHERIT]) {
flags |= FLAG_INHERIT;
@@ -283,10 +292,6 @@ css_error parse_background_position(css_language *c,
}
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(CSS_PROP_BACKGROUND_POSITION, flags, value[0] | value[1]);
required_size = sizeof(opv);
@@ -337,10 +342,6 @@ css_error parse_background_repeat(css_language *c,
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[NO_REPEAT]) {
diff --git a/src/parse/properties/border_outline.c b/src/parse/properties/border_outline.c
index 72b6b7b..8d31dc5 100644
--- a/src/parse/properties/border_outline.c
+++ b/src/parse/properties/border_outline.c
@@ -61,10 +61,6 @@ css_error parse_border_collapse(css_language *c,
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[COLLAPSE]) {
@@ -201,10 +197,6 @@ css_error parse_border_spacing(css_language *c,
value = BORDER_SPACING_SET;
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(CSS_PROP_BORDER_SPACING, flags, value);
required_size = sizeof(opv);
@@ -290,10 +282,6 @@ css_error parse_outline_color(css_language *c,
value = OUTLINE_COLOR_SET;
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(CSS_PROP_OUTLINE_COLOR, flags, value);
required_size = sizeof(opv);
@@ -382,10 +370,6 @@ css_error parse_border_side_color(css_language *c,
value = BORDER_COLOR_SET;
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(op, flags, value);
required_size = sizeof(opv);
@@ -423,10 +407,6 @@ css_error parse_border_side_style(css_language *c,
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[NONE]) {
@@ -516,10 +496,6 @@ css_error parse_border_side_width(css_language *c,
value = BORDER_WIDTH_SET;
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(op, flags, value);
required_size = sizeof(opv);
diff --git a/src/parse/properties/display_sizing.c b/src/parse/properties/display_sizing.c
index 057b3a1..900e580 100644
--- a/src/parse/properties/display_sizing.c
+++ b/src/parse/properties/display_sizing.c
@@ -30,10 +30,6 @@ css_error parse_display(css_language *c,
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[INLINE]) {
@@ -126,10 +122,6 @@ css_error parse_height(css_language *c,
value = HEIGHT_SET;
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(CSS_PROP_HEIGHT, flags, value);
required_size = sizeof(opv);
@@ -207,10 +199,6 @@ css_error parse_line_height(css_language *c,
value = LINE_HEIGHT_DIMENSION;
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(CSS_PROP_LINE_HEIGHT, flags, value);
required_size = sizeof(opv);
@@ -280,10 +268,6 @@ css_error parse_max_height(css_language *c,
value = MAX_HEIGHT_SET;
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(CSS_PROP_MAX_HEIGHT, flags, value);
required_size = sizeof(opv);
@@ -349,10 +333,6 @@ css_error parse_max_width(css_language *c,
value = MAX_WIDTH_SET;
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(CSS_PROP_MAX_WIDTH, flags, value);
required_size = sizeof(opv);
@@ -414,10 +394,6 @@ css_error parse_min_height(css_language *c,
value = MIN_HEIGHT_SET;
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(CSS_PROP_MIN_HEIGHT, flags, value);
required_size = sizeof(opv);
@@ -479,10 +455,6 @@ css_error parse_min_width(css_language *c,
value = MIN_WIDTH_SET;
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(CSS_PROP_MIN_WIDTH, flags, value);
required_size = sizeof(opv);
@@ -548,10 +520,6 @@ css_error parse_width(css_language *c,
value = WIDTH_SET;
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(CSS_PROP_WIDTH, flags, value);
required_size = sizeof(opv);
diff --git a/src/parse/properties/effects_stacking.c b/src/parse/properties/effects_stacking.c
index 9659f80..6bcd862 100644
--- a/src/parse/properties/effects_stacking.c
+++ b/src/parse/properties/effects_stacking.c
@@ -100,10 +100,6 @@ css_error parse_clip(css_language *c,
return CSS_INVALID;
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(CSS_PROP_CLIP, flags, value);
required_size = sizeof(opv);
@@ -151,10 +147,6 @@ css_error parse_overflow(css_language *c,
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[VISIBLE]) {
@@ -196,10 +188,6 @@ css_error parse_visibility(css_language *c,
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[VISIBLE]) {
@@ -242,10 +230,6 @@ css_error parse_z_index(css_language *c,
token->type != CSS_TOKEN_NUMBER))
return CSS_INVALID;
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
if (token->type == CSS_TOKEN_IDENT &&
token->ilower == c->strings[INHERIT]) {
flags |= FLAG_INHERIT;
diff --git a/src/parse/properties/font.c b/src/parse/properties/font.c
index 1d1e37a..17cac76 100644
--- a/src/parse/properties/font.c
+++ b/src/parse/properties/font.c
@@ -154,10 +154,6 @@ css_error parse_font_family(css_language *c,
required_size += sizeof(opv);
}
- error = parse_important(c, vector, &temp_ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(CSS_PROP_FONT_FAMILY, flags, value);
/* Allocate result */
@@ -366,13 +362,6 @@ css_error parse_font_family(css_language *c,
ptr += sizeof(opv);
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK) {
- css_stylesheet_style_destroy(c->sheet, *result);
- *result = NULL;
- return error;
- }
-
return CSS_OK;
}
@@ -451,10 +440,6 @@ css_error parse_font_size(css_language *c,
value = FONT_SIZE_DIMENSION;
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(CSS_PROP_FONT_SIZE, flags, value);
required_size = sizeof(opv);
@@ -493,10 +478,6 @@ css_error parse_font_style(css_language *c,
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[NORMAL]) {
@@ -536,10 +517,6 @@ css_error parse_font_variant(css_language *c,
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[NORMAL]) {
@@ -579,10 +556,6 @@ css_error parse_font_weight(css_language *c,
token->type != CSS_TOKEN_NUMBER))
return CSS_INVALID;
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
if (token->ilower == c->strings[INHERIT]) {
flags |= FLAG_INHERIT;
} else if (token->type == CSS_TOKEN_NUMBER) {
diff --git a/src/parse/properties/generated_list.c b/src/parse/properties/generated_list.c
index 6c9c1c7..970da2a 100644
--- a/src/parse/properties/generated_list.c
+++ b/src/parse/properties/generated_list.c
@@ -69,10 +69,6 @@ css_error parse_content(css_language *c,
required_size += len;
}
- error = parse_important(c, vector, &temp_ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(CSS_PROP_CONTENT, flags, value);
/* Allocate result */
@@ -101,11 +97,6 @@ css_error parse_content(css_language *c,
return error;
}
- /* Ensure we skip past !important */
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
return CSS_OK;
}
@@ -185,10 +176,6 @@ css_error parse_counter_increment(css_language *c,
required_size += sizeof(opv);
}
- error = parse_important(c, vector, &temp_ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(CSS_PROP_COUNTER_INCREMENT, flags, value);
/* Allocate result */
@@ -270,10 +257,6 @@ css_error parse_counter_increment(css_language *c,
ptr += sizeof(opv);
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
return CSS_OK;
}
@@ -353,10 +336,6 @@ css_error parse_counter_reset(css_language *c,
required_size += sizeof(opv);
}
- error = parse_important(c, vector, &temp_ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(CSS_PROP_COUNTER_RESET, flags, value);
/* Allocate result */
@@ -438,10 +417,6 @@ css_error parse_counter_reset(css_language *c,
ptr += sizeof(opv);
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
return CSS_OK;
}
@@ -462,10 +437,6 @@ css_error parse_list_style_image(css_language *c,
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->ilower == c->strings[INHERIT]) {
flags |= FLAG_INHERIT;
@@ -515,10 +486,6 @@ css_error parse_list_style_position(css_language *c,
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[INSIDE]) {
@@ -560,10 +527,6 @@ css_error parse_list_style_type(css_language *c,
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 {
@@ -658,10 +621,6 @@ css_error parse_quotes(css_language *c,
required_size += sizeof(opv);
}
- error = parse_important(c, vector, &temp_ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(CSS_PROP_QUOTES, flags, value);
/* Allocate result */
@@ -736,10 +695,6 @@ css_error parse_quotes(css_language *c,
ptr += sizeof(opv);
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
return CSS_OK;
}
diff --git a/src/parse/properties/margin.c b/src/parse/properties/margin.c
index d719d3a..9cf0b83 100644
--- a/src/parse/properties/margin.c
+++ b/src/parse/properties/margin.c
@@ -83,10 +83,6 @@ css_error parse_margin_side(css_language *c,
value = MARGIN_SET;
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(op, flags, value);
required_size = sizeof(opv);
diff --git a/src/parse/properties/padding.c b/src/parse/properties/padding.c
index cf33f35..d2a5bc4 100644
--- a/src/parse/properties/padding.c
+++ b/src/parse/properties/padding.c
@@ -86,10 +86,6 @@ css_error parse_padding_side(css_language *c,
value = PADDING_SET;
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(op, flags, value);
required_size = sizeof(opv);
diff --git a/src/parse/properties/page.c b/src/parse/properties/page.c
index f997276..49031cf 100644
--- a/src/parse/properties/page.c
+++ b/src/parse/properties/page.c
@@ -30,10 +30,6 @@ css_error parse_orphans(css_language *c,
token->type != CSS_TOKEN_NUMBER))
return CSS_INVALID;
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
if (token->ilower == c->strings[INHERIT]) {
flags |= FLAG_INHERIT;
} else if (token->type == CSS_TOKEN_NUMBER) {
@@ -87,10 +83,6 @@ css_error parse_page_break_after(css_language *c,
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]) {
@@ -134,10 +126,6 @@ css_error parse_page_break_before(css_language *c,
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]) {
@@ -181,10 +169,6 @@ css_error parse_page_break_inside(css_language *c,
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]) {
@@ -225,10 +209,6 @@ css_error parse_widows(css_language *c,
token->type != CSS_TOKEN_NUMBER))
return CSS_INVALID;
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
if (token->ilower == c->strings[INHERIT]) {
flags |= FLAG_INHERIT;
} else if (token->type == CSS_TOKEN_NUMBER) {
diff --git a/src/parse/properties/positioning.c b/src/parse/properties/positioning.c
index 4882a45..c280f4b 100644
--- a/src/parse/properties/positioning.c
+++ b/src/parse/properties/positioning.c
@@ -59,10 +59,6 @@ css_error parse_position(css_language *c,
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[STATIC]) {
@@ -104,10 +100,6 @@ css_error parse_clear(css_language *c,
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[RIGHT]) {
@@ -149,10 +141,6 @@ css_error parse_float(css_language *c,
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[LEFT]) {
@@ -245,10 +233,6 @@ css_error parse_vertical_align(css_language *c,
value = VERTICAL_ALIGN_SET;
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(CSS_PROP_VERTICAL_ALIGN, flags, value);
required_size = sizeof(opv);
@@ -310,10 +294,6 @@ css_error parse_side(css_language *c,
value = BOTTOM_SET;
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(op, flags, value);
required_size = sizeof(opv);
diff --git a/src/parse/properties/table.c b/src/parse/properties/table.c
index e1249f8..43a8a58 100644
--- a/src/parse/properties/table.c
+++ b/src/parse/properties/table.c
@@ -27,10 +27,6 @@ css_error parse_caption_side(css_language *c,
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]) {
@@ -68,10 +64,6 @@ css_error parse_empty_cells(css_language *c,
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]) {
@@ -109,10 +101,6 @@ css_error parse_table_layout(css_language *c,
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]) {
diff --git a/src/parse/properties/text.c b/src/parse/properties/text.c
index 3e9dc72..0c2a4c3 100644
--- a/src/parse/properties/text.c
+++ b/src/parse/properties/text.c
@@ -41,10 +41,6 @@ css_error parse_color(css_language *c,
value = COLOR_SET;
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(CSS_PROP_COLOR, flags, value);
required_size = sizeof(opv);
@@ -81,10 +77,6 @@ css_error parse_direction(css_language *c,
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[LTR]) {
@@ -146,10 +138,6 @@ css_error parse_letter_spacing(css_language *c,
value = LETTER_SPACING_SET;
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(CSS_PROP_LETTER_SPACING, flags, value);
required_size = sizeof(opv);
@@ -188,10 +176,6 @@ css_error parse_text_align(css_language *c,
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[LEFT]) {
@@ -272,10 +256,6 @@ css_error parse_text_decoration(css_language *c,
}
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(CSS_PROP_TEXT_DECORATION, flags, value);
/* Allocate result */
@@ -323,10 +303,6 @@ css_error parse_text_indent(css_language *c,
value = TEXT_INDENT_SET;
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(CSS_PROP_TEXT_INDENT, flags, value);
required_size = sizeof(opv);
@@ -365,10 +341,6 @@ css_error parse_text_transform(css_language *c,
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[CAPITALIZE]) {
@@ -410,10 +382,6 @@ css_error parse_unicode_bidi(css_language *c,
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[NORMAL]) {
@@ -453,10 +421,6 @@ css_error parse_white_space(css_language *c,
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[NORMAL]) {
@@ -524,10 +488,6 @@ css_error parse_word_spacing(css_language *c,
value = WORD_SPACING_SET;
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(CSS_PROP_WORD_SPACING, flags, value);
required_size = sizeof(opv);
diff --git a/src/parse/properties/ui.c b/src/parse/properties/ui.c
index 1a3d1d8..882c3b0 100644
--- a/src/parse/properties/ui.c
+++ b/src/parse/properties/ui.c
@@ -158,10 +158,6 @@ css_error parse_cursor(css_language *c,
return CSS_INVALID;
}
- error = parse_important(c, vector, &temp_ctx, &flags);
- if (error != CSS_OK)
- return error;
-
opv = buildOPV(CSS_PROP_CURSOR, flags, value);
/* Allocate result */
@@ -271,10 +267,6 @@ css_error parse_cursor(css_language *c,
return CSS_INVALID;
}
- error = parse_important(c, vector, ctx, &flags);
- if (error != CSS_OK)
- return error;
-
return CSS_OK;
}
diff --git a/src/parse/properties/utils.c b/src/parse/properties/utils.c
index b0a4c1b..bc1fd30 100644
--- a/src/parse/properties/utils.c
+++ b/src/parse/properties/utils.c
@@ -13,52 +13,6 @@
#include "parse/properties/utils.h"
/**
- * Parse !important
- *
- * \param c Parsing context
- * \param vector Vector of tokens to process
- * \param ctx Pointer to vector iteration context
- * \param result Pointer to location to receive result
- * \return CSS_OK on success,
- * CSS_INVALID if "S* ! S* important" is not at the start of the vector
- *
- * Post condition: \a *ctx is updated with the next token to process
- * If the input is invalid, then \a *ctx remains unchanged.
- */
-css_error parse_important(css_language *c,
- const parserutils_vector *vector, int *ctx,
- uint8_t *result)
-{
- int orig_ctx = *ctx;
- 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) {
- *ctx = orig_ctx;
- return CSS_INVALID;
- }
-
- if (token->ilower == c->strings[IMPORTANT]) {
- *result |= FLAG_IMPORTANT;
- } else {
- *ctx = orig_ctx;
- return CSS_INVALID;
- }
- } else if (token != NULL) {
- *ctx = orig_ctx;
- return CSS_INVALID;
- }
-
- return CSS_OK;
-}
-
-/**
* Parse a colour specifier
*
* \param c Parsing context
diff --git a/src/parse/properties/utils.h b/src/parse/properties/utils.h
index 923ffb5..c04a2aa 100644
--- a/src/parse/properties/utils.h
+++ b/src/parse/properties/utils.h
@@ -10,9 +10,6 @@
#include "parse/language.h"
-css_error parse_important(css_language *c,
- const parserutils_vector *vector, int *ctx,
- uint8_t *result);
css_error parse_colour_specifier(css_language *c,
const parserutils_vector *vector, int *ctx,
uint32_t *result);