summaryrefslogtreecommitdiff
path: root/src/parse/properties/background.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-07-01 10:35:37 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-07-01 10:35:37 +0000
commit94ff706d99220d915be8cedcda6b93ead998f5b8 (patch)
treef28b6eec02fb023351dbeb2610d19d7c76580757 /src/parse/properties/background.c
parent5099ad82bbfc21bd45408bf5ca069df3ecfd0e8d (diff)
downloadlibcss-94ff706d99220d915be8cedcda6b93ead998f5b8.tar.gz
libcss-94ff706d99220d915be8cedcda6b93ead998f5b8.tar.bz2
Make all URIs absolute
svn path=/trunk/libcss/; revision=8228
Diffstat (limited to 'src/parse/properties/background.c')
-rw-r--r--src/parse/properties/background.c14
1 files changed, 11 insertions, 3 deletions
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;