summaryrefslogtreecommitdiff
path: root/src/stylesheet.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/stylesheet.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/stylesheet.c')
-rw-r--r--src/stylesheet.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/stylesheet.c b/src/stylesheet.c
index 9afed2b..bfd159f 100644
--- a/src/stylesheet.c
+++ b/src/stylesheet.c
@@ -31,6 +31,8 @@ static css_error _remove_selectors(css_stylesheet *sheet, css_rule *rule);
* \param dict Dictionary in which to intern strings
* \param alloc Memory (de)allocation function
* \param alloc_pw Client private data for alloc
+ * \param resolve URL resolution function
+ * \param resolve_pw Client private data for resolve
* \param stylesheet Pointer to location to receive stylesheet
* \return CSS_OK on success,
* CSS_BADPARM on bad parameters,
@@ -41,6 +43,7 @@ css_error css_stylesheet_create(css_language_level level,
css_origin origin, uint64_t media, bool allow_quirks,
bool inline_style, lwc_context *dict,
css_allocator_fn alloc, void *alloc_pw,
+ css_url_resolution_fn resolve, void *resolve_pw,
css_stylesheet **stylesheet)
{
css_parser_optparams params;
@@ -48,7 +51,8 @@ css_error css_stylesheet_create(css_language_level level,
css_stylesheet *sheet;
size_t len;
- if (url == NULL || alloc == NULL || stylesheet == NULL)
+ if (url == NULL || alloc == NULL ||
+ resolve == NULL || stylesheet == NULL)
return CSS_BADPARM;
sheet = alloc(NULL, sizeof(css_stylesheet), alloc_pw);
@@ -115,6 +119,7 @@ css_error css_stylesheet_create(css_language_level level,
return CSS_NOMEM;
}
memcpy(sheet->url, url, len);
+ sheet->url[len] = '\0';
if (title != NULL) {
len = strlen(title) + 1;
@@ -128,11 +133,15 @@ css_error css_stylesheet_create(css_language_level level,
return CSS_NOMEM;
}
memcpy(sheet->title, title, len);
+ sheet->title[len] = '\0';
}
sheet->origin = origin;
sheet->media = media;
+ sheet->resolve = resolve;
+ sheet->resolve_pw = resolve_pw;
+
sheet->alloc = alloc;
sheet->pw = alloc_pw;