summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
Diffstat (limited to 'render')
-rw-r--r--render/box_construct.c14
-rw-r--r--render/html.c20
-rw-r--r--render/html.h2
3 files changed, 26 insertions, 10 deletions
diff --git a/render/box_construct.c b/render/box_construct.c
index a9d642449..57046120f 100644
--- a/render/box_construct.c
+++ b/render/box_construct.c
@@ -456,8 +456,8 @@ bool box_construct_element(xmlNode *n, struct content *content,
xmlFree(s);
}
}
-
-
+
+
/* fetch any background image for this box */
if (style->background_image.type == CSS_BACKGROUND_IMAGE_URI) {
if (!html_fetch_object(content, style->background_image.uri,
@@ -663,13 +663,7 @@ struct css_style * box_get_style(struct content *c,
style_new = talloc_memdup(c, &css_blank_style, sizeof *style_new);
if (!style_new)
return 0;
-
- for (i = 0; i != stylesheet_count; i++) {
- if (stylesheet[i]) {
- assert(stylesheet[i]->type == CONTENT_CSS);
- css_get_style(stylesheet[i], n, style_new);
- }
- }
+ css_get_style(c->data.html.working_stylesheet, n, style_new);
css_cascade(style, style_new);
/* style_new isn't needed past this point */
@@ -701,7 +695,7 @@ struct css_style * box_get_style(struct content *c,
}
}
- if (((s = (char *) xmlGetProp(n, (const xmlChar *) "bgcolor"))) &&
+ if (((s = (char *) xmlGetProp(n, (const xmlChar *) "bgcolor"))) &&
(style->background_color == TRANSPARENT)) {
unsigned int r, g, b;
if (s[0] == '#' && sscanf(s + 1, "%2x%2x%2x", &r, &g, &b) == 3)
diff --git a/render/html.c b/render/html.c
index 583faf138..93b986ba5 100644
--- a/render/html.c
+++ b/render/html.c
@@ -628,6 +628,24 @@ bool html_find_stylesheets(struct content *c, xmlNode *head)
/* content_broadcast(c, CONTENT_MSG_STATUS, msg_data); */
/* } */
+ css_set_origin(c->data.html.stylesheet_content[STYLESHEET_BASE],
+ CSS_ORIGIN_UA);
+ if (c->data.html.stylesheet_content[STYLESHEET_ADBLOCK])
+ css_set_origin(c->data.html.stylesheet_content[
+ STYLESHEET_ADBLOCK], CSS_ORIGIN_UA);
+ if (c->data.html.stylesheet_content[STYLESHEET_STYLE])
+ css_set_origin(c->data.html.stylesheet_content[
+ STYLESHEET_STYLE], CSS_ORIGIN_AUTHOR);
+ for (i = STYLESHEET_START; i != c->data.html.stylesheet_count; i++)
+ css_set_origin(c->data.html.stylesheet_content[i],
+ CSS_ORIGIN_AUTHOR);
+
+ c->data.html.working_stylesheet = css_make_working_stylesheet(
+ c->data.html.stylesheet_content,
+ c->data.html.stylesheet_count);
+ if (!c->data.html.working_stylesheet)
+ return false;
+
return true;
}
@@ -1137,6 +1155,8 @@ void html_destroy(struct content *c)
}
}
+ talloc_free(c->data.html.working_stylesheet);
+
/*if (c->data.html.style)
css_free_style(c->data.html.style);*/
diff --git a/render/html.h b/render/html.h
index 38b65b950..3bc71d834 100644
--- a/render/html.h
+++ b/render/html.h
@@ -69,6 +69,8 @@ struct content_html_data {
/** Stylesheets. Each may be 0. */
struct content **stylesheet_content;
struct css_style *style; /**< Base style. */
+ /** Working stylesheet. */
+ struct css_working_stylesheet *working_stylesheet;
/** Number of entries in object. */
unsigned int object_count;