From 08ed4c207f7f8688075c84e4b3cd5ab73470c246 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 5 Jan 2011 19:36:05 +0000 Subject: Update to new libcss API for simultanious selection for base element and its pseudo elements. svn path=/trunk/netsurf/; revision=11215 --- css/select.c | 24 +++++++++--------------- css/select.h | 5 ++--- 2 files changed, 11 insertions(+), 18 deletions(-) (limited to 'css') diff --git a/css/select.c b/css/select.c index 9d7a2d8ba..be090c0db 100644 --- a/css/select.c +++ b/css/select.c @@ -167,36 +167,30 @@ css_stylesheet *nscss_create_inline_style(const uint8_t *data, size_t len, * * \param html HTML document * \param n Element to select for - * \param pseudo_element Pseudo element to select for, instead * \param media Permitted media types * \param inline_style Inline style associated with element, or NULL * \param alloc Memory allocation function * \param pw Private word for allocator - * \return Pointer to partial computed style, or NULL on failure + * \return Pointer to selection results (containing partial computed styles), + * or NULL on failure */ -css_computed_style *nscss_get_style(struct content *html, xmlNode *n, - uint32_t pseudo_element, uint64_t media, - const css_stylesheet *inline_style, +css_select_results *nscss_get_style(struct content *html, xmlNode *n, + uint64_t media, const css_stylesheet *inline_style, css_allocator_fn alloc, void *pw) { - css_computed_style *style; + css_select_results *styles; css_error error; assert(html->type == CONTENT_HTML); - error = css_computed_style_create(alloc, pw, &style); - if (error != CSS_OK) - return NULL; - - error = css_select_style(html->data.html.select_ctx, n, - pseudo_element, media, inline_style, style, - &selection_handler, html); + error = css_select_style(html->data.html.select_ctx, n, media, + inline_style, &selection_handler, html, &styles); if (error != CSS_OK) { - css_computed_style_destroy(style); + css_select_results_destroy(styles); return NULL; } - return style; + return styles; } /** diff --git a/css/select.h b/css/select.h index 770548d84..21b53867d 100644 --- a/css/select.h +++ b/css/select.h @@ -31,9 +31,8 @@ css_stylesheet *nscss_create_inline_style(const uint8_t *data, size_t len, const char *charset, const char *url, bool allow_quirks, css_allocator_fn alloc, void *pw); -css_computed_style *nscss_get_style(struct content *html, xmlNode *n, - uint32_t pseudo_element, uint64_t media, - const css_stylesheet *inline_style, +css_select_results *nscss_get_style(struct content *html, xmlNode *n, + uint64_t media, const css_stylesheet *inline_style, css_allocator_fn alloc, void *pw); css_computed_style *nscss_get_blank_style(struct content *html, -- cgit v1.2.3