From e4c50bd58ada5d87f2eb8ab7b291fbd39999124f Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Fri, 13 Dec 2013 20:25:08 +0000 Subject: Update for new libcss API. --- render/box.c | 18 ------------------ render/box.h | 1 - render/box_construct.c | 6 ++---- render/box_normalise.c | 24 ++++++++---------------- render/html_css.c | 2 +- 5 files changed, 11 insertions(+), 40 deletions(-) (limited to 'render') diff --git a/render/box.c b/render/box.c index e955b4303..295308b5a 100644 --- a/render/box.c +++ b/render/box.c @@ -53,24 +53,6 @@ static bool box_nearest_text_box(struct box *box, int bx, int by, #define box_is_float(box) (box->type == BOX_FLOAT_LEFT || \ box->type == BOX_FLOAT_RIGHT) -/** - * Allocator - * - * \param ptr Pointer to reallocate, or NULL for new allocation - * \param size Number of bytes requires - * \param pw Allocation context - * \return Pointer to allocated block, or NULL on failure - */ -void *box_style_alloc(void *ptr, size_t len, void *pw) -{ - if (len == 0) { - free(ptr); - return NULL; - } - - return realloc(ptr, len); -} - /** * Destructor for box nodes which own styles * diff --git a/render/box.h b/render/box.h index 1ce26c28b..878ebc8d3 100644 --- a/render/box.h +++ b/render/box.h @@ -315,7 +315,6 @@ extern const char *TARGET_BLANK; -void *box_style_alloc(void *ptr, size_t len, void *pw); struct box * box_create(css_select_results *styles, css_computed_style *style, bool style_owned, nsurl *href, const char *target, const char *title, lwc_string *id, void *context); diff --git a/render/box_construct.c b/render/box_construct.c index 3251cc17f..4ce2151cd 100644 --- a/render/box_construct.c +++ b/render/box_construct.c @@ -1442,8 +1442,7 @@ css_select_results *box_get_style(html_content *c, dom_string_byte_length(s), c->encoding, nsurl_access(content_get_url(&c->base)), - c->quirks != DOM_DOCUMENT_QUIRKS_MODE_NONE, - box_style_alloc, NULL); + c->quirks != DOM_DOCUMENT_QUIRKS_MODE_NONE); dom_string_unref(s); @@ -1458,8 +1457,7 @@ css_select_results *box_get_style(html_content *c, ctx.universal = c->universal; /* Select partial style for element */ - styles = nscss_get_style(&ctx, n, CSS_MEDIA_SCREEN, inline_style, - box_style_alloc, NULL); + styles = nscss_get_style(&ctx, n, CSS_MEDIA_SCREEN, inline_style); /* No longer need inline style */ if (inline_style != NULL) diff --git a/render/box_normalise.c b/render/box_normalise.c index 42b20cbb7..5a4b6256a 100644 --- a/render/box_normalise.c +++ b/render/box_normalise.c @@ -156,8 +156,7 @@ bool box_normalise_block(struct box *block, html_content *c) ctx.base_url = c->base_url; ctx.universal = c->universal; - style = nscss_get_blank_style(&ctx, block->style, - box_style_alloc, NULL); + style = nscss_get_blank_style(&ctx, block->style); if (style == NULL) return false; @@ -258,8 +257,7 @@ bool box_normalise_table(struct box *table, html_content * c) ctx.base_url = c->base_url; ctx.universal = c->universal; - style = nscss_get_blank_style(&ctx, table->style, - box_style_alloc, NULL); + style = nscss_get_blank_style(&ctx, table->style); if (style == NULL) { free(col_info.spans); return false; @@ -345,8 +343,7 @@ bool box_normalise_table(struct box *table, html_content * c) ctx.base_url = c->base_url; ctx.universal = c->universal; - style = nscss_get_blank_style(&ctx, table->style, - box_style_alloc, NULL); + style = nscss_get_blank_style(&ctx, table->style); if (style == NULL) { free(col_info.spans); return false; @@ -361,8 +358,7 @@ bool box_normalise_table(struct box *table, html_content * c) } row_group->type = BOX_TABLE_ROW_GROUP; - style = nscss_get_blank_style(&ctx, row_group->style, - box_style_alloc, NULL); + style = nscss_get_blank_style(&ctx, row_group->style); if (style == NULL) { box_free(row_group); free(col_info.spans); @@ -482,8 +478,7 @@ bool box_normalise_table_spans(struct box *table, struct span_info *spans, ctx.universal = c->universal; style = nscss_get_blank_style(&ctx, - table_row->style, - box_style_alloc, NULL); + table_row->style); if (style == NULL) return false; @@ -591,8 +586,7 @@ bool box_normalise_table_row_group(struct box *row_group, ctx.base_url = c->base_url; ctx.universal = c->universal; - style = nscss_get_blank_style(&ctx, row_group->style, - box_style_alloc, NULL); + style = nscss_get_blank_style(&ctx, row_group->style); if (style == NULL) return false; @@ -666,8 +660,7 @@ bool box_normalise_table_row_group(struct box *row_group, ctx.base_url = c->base_url; ctx.universal = c->universal; - style = nscss_get_blank_style(&ctx, row_group->style, - box_style_alloc, NULL); + style = nscss_get_blank_style(&ctx, row_group->style); if (style == NULL) { return false; } @@ -736,8 +729,7 @@ bool box_normalise_table_row(struct box *row, ctx.base_url = c->base_url; ctx.universal = c->universal; - style = nscss_get_blank_style(&ctx, row->style, - box_style_alloc, NULL); + style = nscss_get_blank_style(&ctx, row->style); if (style == NULL) return false; diff --git a/render/html_css.c b/render/html_css.c index bf20dcf14..88c67697d 100644 --- a/render/html_css.c +++ b/render/html_css.c @@ -596,7 +596,7 @@ html_css_new_selection_context(html_content *c, css_select_ctx **ret_select_ctx) } /* Create selection context */ - css_ret = css_select_ctx_create(ns_realloc, c, &select_ctx); + css_ret = css_select_ctx_create(&select_ctx); if (css_ret != CSS_OK) { return css_error_to_nserror(css_ret); } -- cgit v1.2.3