summaryrefslogtreecommitdiff
path: root/src/parse
diff options
context:
space:
mode:
Diffstat (limited to 'src/parse')
-rw-r--r--src/parse/properties/aural.c25
-rw-r--r--src/parse/properties/background.c14
-rw-r--r--src/parse/properties/generated_list.c33
-rw-r--r--src/parse/properties/ui.c13
4 files changed, 67 insertions, 18 deletions
diff --git a/src/parse/properties/aural.c b/src/parse/properties/aural.c
index e87d7e3..b5b3c90 100644
--- a/src/parse/properties/aural.c
+++ b/src/parse/properties/aural.c
@@ -949,7 +949,14 @@ css_error parse_play_during(css_language *c,
int modifiers;
value = PLAY_DURING_URI;
- uri = token->idata;
+
+ error = c->sheet->resolve(c->sheet->resolve_pw,
+ c->sheet->dictionary, c->sheet->url,
+ token->idata, &uri);
+ if (error != CSS_OK) {
+ *ctx = orig_ctx;
+ return error;
+ }
for (modifiers = 0; modifiers < 2; modifiers++) {
consumeWhitespace(vector, ctx);
@@ -999,7 +1006,7 @@ css_error parse_play_during(css_language *c,
memcpy((*result)->bytecode, &opv, sizeof(opv));
if ((flags & FLAG_INHERIT) == false &&
(value & PLAY_DURING_TYPE_MASK) == PLAY_DURING_URI) {
- lwc_context_string_ref(c->sheet->dictionary, uri);
+ /* Don't ref URI -- we want to pass ownership to the bytecode */
memcpy((uint8_t *) (*result)->bytecode + sizeof(opv),
&uri, sizeof(lwc_string *));
}
@@ -1814,6 +1821,7 @@ css_error parse_cue_common(css_language *c,
uint16_t value = 0;
uint32_t opv;
uint32_t required_size;
+ lwc_string *uri = NULL;
/* URI | IDENT (none, inherit) */
token = parserutils_vector_iterate(vector, ctx);
@@ -1831,6 +1839,14 @@ css_error parse_cue_common(css_language *c,
value = CUE_AFTER_NONE;
} else if (token->type == CSS_TOKEN_URI) {
value = CUE_AFTER_URI;
+
+ error = c->sheet->resolve(c->sheet->resolve_pw,
+ c->sheet->dictionary, c->sheet->url,
+ token->idata, &uri);
+ if (error != CSS_OK) {
+ *ctx = orig_ctx;
+ return error;
+ }
} else {
*ctx = orig_ctx;
return CSS_INVALID;
@@ -1852,10 +1868,9 @@ css_error parse_cue_common(css_language *c,
/* Copy the bytecode to it */
memcpy((*result)->bytecode, &opv, sizeof(opv));
if ((flags & FLAG_INHERIT) == false && value == CUE_AFTER_URI) {
- lwc_context_string_ref(c->sheet->dictionary, token->idata);
+ /* Don't ref URI -- we want to pass ownership to the bytecode */
memcpy((uint8_t *) (*result)->bytecode + sizeof(opv),
- &token->idata,
- sizeof(lwc_string *));
+ &uri, sizeof(lwc_string *));
}
return CSS_OK;
diff --git a/src/parse/properties/background.c b/src/parse/properties/background.c
index 0ee4dbb..bec2b2f 100644
--- a/src/parse/properties/background.c
+++ b/src/parse/properties/background.c
@@ -400,6 +400,7 @@ css_error parse_background_image(css_language *c,
uint16_t value = 0;
uint32_t opv;
uint32_t required_size;
+ lwc_string *uri = NULL;
/* URI | IDENT (none, inherit) */
token = parserutils_vector_iterate(vector, ctx);
@@ -417,6 +418,14 @@ css_error parse_background_image(css_language *c,
value = BACKGROUND_IMAGE_NONE;
} else if (token->type == CSS_TOKEN_URI) {
value = BACKGROUND_IMAGE_URI;
+
+ error = c->sheet->resolve(c->sheet->resolve_pw,
+ c->sheet->dictionary, c->sheet->url,
+ token->idata, &uri);
+ if (error != CSS_OK) {
+ *ctx = orig_ctx;
+ return error;
+ }
} else {
*ctx = orig_ctx;
return CSS_INVALID;
@@ -438,10 +447,9 @@ css_error parse_background_image(css_language *c,
/* Copy the bytecode to it */
memcpy((*result)->bytecode, &opv, sizeof(opv));
if ((flags & FLAG_INHERIT) == false && value == BACKGROUND_IMAGE_URI) {
- lwc_context_string_ref(c->sheet->dictionary, token->idata);
+ /* Don't ref URI -- we want to pass ownership to the bytecode */
memcpy((uint8_t *) (*result)->bytecode + sizeof(opv),
- &token->idata,
- sizeof(lwc_string *));
+ &uri, sizeof(lwc_string *));
}
return CSS_OK;
diff --git a/src/parse/properties/generated_list.c b/src/parse/properties/generated_list.c
index 1183558..3efe305 100644
--- a/src/parse/properties/generated_list.c
+++ b/src/parse/properties/generated_list.c
@@ -378,6 +378,7 @@ css_error parse_list_style_image(css_language *c,
uint16_t value = 0;
uint32_t opv;
uint32_t required_size;
+ lwc_string *uri = NULL;
/* URI | IDENT (none, inherit) */
token = parserutils_vector_iterate(vector, ctx);
@@ -395,6 +396,14 @@ css_error parse_list_style_image(css_language *c,
value = LIST_STYLE_IMAGE_NONE;
} else if (token->type == CSS_TOKEN_URI) {
value = LIST_STYLE_IMAGE_URI;
+
+ error = c->sheet->resolve(c->sheet->resolve_pw,
+ c->sheet->dictionary, c->sheet->url,
+ token->idata, &uri);
+ if (error != CSS_OK) {
+ *ctx = orig_ctx;
+ return error;
+ }
} else {
*ctx = orig_ctx;
return CSS_INVALID;
@@ -416,10 +425,9 @@ css_error parse_list_style_image(css_language *c,
/* Copy the bytecode to it */
memcpy((*result)->bytecode, &opv, sizeof(opv));
if ((flags & FLAG_INHERIT) == false && value == LIST_STYLE_IMAGE_URI) {
- lwc_context_string_ref(c->sheet->dictionary, token->idata);
+ /* Don't ref URI -- we want to pass ownership to the bytecode */
memcpy((uint8_t *) (*result)->bytecode + sizeof(opv),
- &token->idata,
- sizeof(lwc_string *));
+ &uri, sizeof(lwc_string *));
}
return CSS_OK;
@@ -874,6 +882,8 @@ css_error parse_content_list(css_language *c,
offset += sizeof(token->idata);
} else if (token->type == CSS_TOKEN_URI) {
+ lwc_string *uri;
+
opv = CONTENT_URI;
if (first == false) {
@@ -886,13 +896,20 @@ css_error parse_content_list(css_language *c,
}
if (buffer != NULL) {
- lwc_context_string_ref(c->sheet->dictionary,
- token->idata);
- memcpy(buffer + offset, &token->idata,
- sizeof(token->idata));
+ error = c->sheet->resolve(c->sheet->resolve_pw,
+ c->sheet->dictionary, c->sheet->url,
+ token->idata, &uri);
+ if (error != CSS_OK) {
+ *ctx = orig_ctx;
+ return error;
+ }
+
+ /* Don't ref URI -- we want to pass ownership
+ * to the bytecode */
+ memcpy(buffer + offset, &uri, sizeof(uri));
}
- offset += sizeof(token->idata);
+ offset += sizeof(uri);
} else if (token->type == CSS_TOKEN_FUNCTION &&
token->ilower == c->strings[ATTR]) {
opv = CONTENT_ATTR;
diff --git a/src/parse/properties/ui.c b/src/parse/properties/ui.c
index 118e835..4a6c34f 100644
--- a/src/parse/properties/ui.c
+++ b/src/parse/properties/ui.c
@@ -204,7 +204,15 @@ css_error parse_cursor(css_language *c,
/* URI* */
while (token != NULL && token->type == CSS_TOKEN_URI) {
- lwc_string *uri = token->idata;
+ lwc_string *uri;
+
+ error = c->sheet->resolve(c->sheet->resolve_pw,
+ c->sheet->dictionary, c->sheet->url,
+ token->idata, &uri);
+ if (error != CSS_OK) {
+ *ctx = orig_ctx;
+ return error;
+ }
if (first == false) {
opv = CURSOR_URI;
@@ -212,7 +220,8 @@ css_error parse_cursor(css_language *c,
ptr += sizeof(opv);
}
- lwc_context_string_ref(c->sheet->dictionary, uri);
+ /* Don't ref URI -- we want to pass ownership to the
+ * bytecode */
memcpy(ptr, &uri, sizeof(uri));
ptr += sizeof(uri);