CSS: Update for change to libcss select style API.

LibCSS now takes the client media spec, rather than just the
media type we're selecting for.

Signed-off-by: Michael Drake <michael.drake@codethink.co.uk>
This commit is contained in:
Michael Drake 2019-05-04 12:02:55 +01:00
parent 637b4e5fc0
commit 920d6fa23d
5 changed files with 6 additions and 3 deletions

View File

@ -255,7 +255,7 @@ static void nscss_dom_user_data_handler(dom_node_operation operation,
* or NULL on failure
*/
css_select_results *nscss_get_style(nscss_select_ctx *ctx, dom_node *n,
uint64_t media, const css_stylesheet *inline_style)
const css_media *media, const css_stylesheet *inline_style)
{
css_computed_style *composed;
css_select_results *styles;

View File

@ -45,7 +45,7 @@ css_stylesheet *nscss_create_inline_style(const uint8_t *data, size_t len,
const char *charset, const char *url, bool allow_quirks);
css_select_results *nscss_get_style(nscss_select_ctx *ctx, dom_node *n,
uint64_t media, const css_stylesheet *inline_style);
const css_media *media, const css_stylesheet *inline_style);
css_computed_style *nscss_get_blank_style(nscss_select_ctx *ctx,
const css_computed_style *parent);

View File

@ -1373,7 +1373,7 @@ css_select_results *box_get_style(html_content *c,
ctx.parent_style = parent_style;
/* Select style for element */
styles = nscss_get_style(&ctx, n, CSS_MEDIA_SCREEN, inline_style);
styles = nscss_get_style(&ctx, n, &c->media, inline_style);
/* No longer need inline style */
if (inline_style != NULL)

View File

@ -950,6 +950,7 @@ html_create_html_data(html_content *c, const http_parameter *params)
c->stylesheet_count = 0;
c->stylesheets = NULL;
c->select_ctx = NULL;
c->media.type = CSS_MEDIA_SCREEN;
c->universal = NULL;
c->num_objects = 0;
c->object_list = NULL;

View File

@ -156,6 +156,8 @@ typedef struct html_content {
struct html_stylesheet *stylesheets;
/**< Style selection context */
css_select_ctx *select_ctx;
/**< Style selection media specification */
css_media media;
/**< Universal selector */
lwc_string *universal;