diff options
-rw-r--r-- | css/css.c | 6 | ||||
-rw-r--r-- | css/css.h | 3 | ||||
-rw-r--r-- | css/ruleset.c | 8 | ||||
-rw-r--r-- | render/box.c | 2 |
4 files changed, 14 insertions, 5 deletions
@@ -883,11 +883,13 @@ bool css_match_detail(const struct css_selector *detail, /** * Parse a stand-alone CSS property list. * + * \param c parent content * \param style css_style to update * \param str property list, as found in HTML style attributes */ -void css_parse_property_list(struct css_style * style, char * str) +void css_parse_property_list(struct content *c, struct css_style * style, + char * str) { unsigned char *source_data; unsigned char *current, *end, *token_text; @@ -895,7 +897,7 @@ void css_parse_property_list(struct css_style * style, char * str) unsigned int i; int token; void *parser; - struct css_parser_params param = {true, 0, 0, false, false}; + struct css_parser_params param = {true, c, 0, false, false}; struct css_parser_token token_data; const struct css_parser_token token_start = { "{", 1 }; const struct css_parser_token token_end = { "}", 1 }; @@ -348,7 +348,8 @@ void css_cascade(struct css_style * const style, const struct css_style * const apply); void css_merge(struct css_style * const style, const struct css_style * const apply); -void css_parse_property_list(struct css_style * style, char * str); +void css_parse_property_list(struct content *c, struct css_style * style, + char * str); colour named_colour(const char *name); void css_dump_style(const struct css_style * const style); void css_dump_stylesheet(const struct css_stylesheet * stylesheet); diff --git a/css/ruleset.c b/css/ruleset.c index 345b86225..a3d43c679 100644 --- a/css/ruleset.c +++ b/css/ruleset.c @@ -539,7 +539,13 @@ void parse_background_image(struct css_style * const s, const struct css_node * else *(t + 1) = 0; - s->background_image.uri = url_join(url, v->stylesheet->url); + /* for inline style attributes, the stylesheet + * content is the parent HTML content + */ + if (v->stylesheet->type == CONTENT_HTML) + s->background_image.uri = url_join(url, v->stylesheet->data.html.base_url); + else + s->background_image.uri = url_join(url, v->stylesheet->url); free(url); if (!s->background_image.uri) return; s->background_image.type = CSS_BACKGROUND_IMAGE_URI; diff --git a/render/box.c b/render/box.c index 32c5209eb..23975e6ec 100644 --- a/render/box.c +++ b/render/box.c @@ -734,7 +734,7 @@ struct css_style * box_get_style(struct content *c, if ((s = (char *) xmlGetProp(n, (const xmlChar *) "style"))) { struct css_style astyle; memcpy(&astyle, &css_empty_style, sizeof(struct css_style)); - css_parse_property_list(&astyle, s); + css_parse_property_list(c, &astyle, s); css_cascade(style, &astyle); xmlFree(s); } |