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 +- desktop/textinput.c | 4 +- render/box.c | 27 ++++--- render/box.h | 12 ++- render/box_construct.c | 214 ++++++++++++++++++++++++++++--------------------- render/box_normalise.c | 20 ++--- render/html.c | 3 +- 8 files changed, 175 insertions(+), 134 deletions(-) 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, diff --git a/desktop/textinput.c b/desktop/textinput.c index 497467563..ea8d7d227 100644 --- a/desktop/textinput.c +++ b/desktop/textinput.c @@ -1985,8 +1985,8 @@ struct box *textarea_insert_break(struct browser_window *bw, return NULL; } - new_br = box_create(text_box->style, false, 0, 0, text_box->title, 0, - current_content); + new_br = box_create(NULL, text_box->style, false, 0, 0, text_box->title, + 0, current_content); new_text = talloc(current_content, struct box); if (!new_text) { warn_user("NoMemory", 0); diff --git a/render/box.c b/render/box.c index e4292d20b..613b8c355 100644 --- a/render/box.c +++ b/render/box.c @@ -95,18 +95,23 @@ free_box_style(struct box *b) /** * Create a box tree node. * - * \param style style for the box (not copied) - * \param href href for the box (not copied), or 0 - * \param target target for the box (not copied), or 0 - * \param title title for the box (not copied), or 0 - * \param id id for the box (not copied), or 0 - * \param context context for allocations + * \param styles selection results for the box, or NULL + * \param style computed style for the box (not copied), or 0 + * \param style_owned whether style is owned by this box + * \param href href for the box (not copied), or 0 + * \param target target for the box (not copied), or 0 + * \param title title for the box (not copied), or 0 + * \param id id for the box (not copied), or 0 + * \param context context for allocations * \return allocated and initialised box, or 0 on memory exhaustion + * + * styles is always owned by the box, if it is set. + * style is only owned by the box in the case of implied boxes. */ -struct box * box_create(css_computed_style *style, bool style_owned, - char *href, const char *target, char *title, char *id, - void *context) +struct box * box_create(css_select_results *styles, css_computed_style *style, + bool style_owned, char *href, const char *target, char *title, + char *id, void *context) { unsigned int i; struct box *box; @@ -120,6 +125,7 @@ struct box * box_create(css_computed_style *style, bool style_owned, talloc_set_destructor(box, free_box_style); box->type = BOX_INLINE; + box->styles = styles; box->style = style; box->x = box->y = 0; box->width = UNKNOWN_WIDTH; @@ -278,6 +284,8 @@ void box_free_box(struct box *box) scroll_destroy(box->scroll_x); if (box->scroll_y != NULL) scroll_destroy(box->scroll_y); + if (box->styles != NULL) + css_select_results_destroy(box->styles); } talloc_free(box); @@ -1402,3 +1410,4 @@ bool box_hscrollbar_present(const struct box * const box) box->padding[LEFT] + box->width + box->padding[RIGHT] + box->border[RIGHT].width < box->descendant_x1; } + diff --git a/render/box.h b/render/box.h index fd1dd5e8c..f8c85627b 100644 --- a/render/box.h +++ b/render/box.h @@ -133,7 +133,13 @@ struct box { /** Type of box. */ box_type type; - /** Style for this box. 0 for INLINE_CONTAINER and FLOAT_*. */ + /** Computed styles for elements and their pseudo elements. NULL on + * non-element boxes. */ + css_select_results *styles; + + /** Style for this box. 0 for INLINE_CONTAINER and FLOAT_*. Pointer into + * a box's 'styles' select results, except for implied boxes, where it + * is a pointer to an owned computed style. */ css_computed_style *style; /** Coordinate of left padding edge relative to parent box, or relative @@ -295,8 +301,8 @@ extern const char *TARGET_BLANK; #define UNKNOWN_MAX_WIDTH INT_MAX void *box_style_alloc(void *ptr, size_t len, void *pw); -struct box * box_create(css_computed_style *style, bool style_owned, - char *href, const char *target, char *title, +struct box * box_create(css_select_results *styles, css_computed_style *style, + bool style_owned, char *href, const char *target, char *title, char *id, void *context); void box_add_child(struct box *parent, struct box *child); void box_insert_sibling(struct box *box, struct box *new_box); diff --git a/render/box_construct.c b/render/box_construct.c index 5b6a96099..484b8221e 100644 --- a/render/box_construct.c +++ b/render/box_construct.c @@ -104,14 +104,13 @@ bool box_construct_element(xmlNode *n, struct content *content, struct box *parent, struct box **inline_container, char *href, const char *target, char *title); void box_construct_after(xmlNode *n, struct content *content, - struct box *box, const css_computed_style *style); + struct box *box, const css_computed_style *after_style); bool box_construct_text(xmlNode *n, struct content *content, const css_computed_style *parent_style, struct box *parent, struct box **inline_container, char *href, const char *target, char *title); -static css_computed_style * box_get_style(struct content *c, - const css_computed_style *parent_style, xmlNode *n, - enum css_pseudo_element pseudo_element); +static css_select_results * box_get_style(struct content *c, + const css_computed_style *parent_style, xmlNode *n); static void box_text_transform(char *s, unsigned int len, enum css_text_transform_e tt); #define BOX_SPECIAL_PARAMS xmlNode *n, struct content *content, \ @@ -289,7 +288,7 @@ bool box_construct_element(xmlNode *n, struct content *content, struct box *box = 0; struct box *inline_container_c; struct box *inline_end; - css_computed_style *style = 0; + css_select_results *styles = NULL; struct element_entry *element; xmlChar *title0; xmlNode *c; @@ -308,9 +307,8 @@ bool box_construct_element(xmlNode *n, struct content *content, */ parent->strip_leading_newline = 0; - style = box_get_style(content, parent_style, n, - CSS_PSEUDO_ELEMENT_NONE); - if (!style) + styles = box_get_style(content, parent_style, n); + if (!styles) return false; /* extract title attribute, if present */ @@ -335,17 +333,19 @@ bool box_construct_element(xmlNode *n, struct content *content, return false; /* create box for this element */ - box = box_create(style, true, href, target, title, id, content); + box = box_create(styles, styles->styles[CSS_PSEUDO_ELEMENT_NONE], false, + href, target, title, id, content); if (!box) return false; /* set box type from computed display */ - if ((css_computed_position(style) == CSS_POSITION_ABSOLUTE || - css_computed_position(style) == CSS_POSITION_FIXED) && - (css_computed_display_static(style) == + if ((css_computed_position(box->style) == CSS_POSITION_ABSOLUTE || + css_computed_position(box->style) == + CSS_POSITION_FIXED) && + (css_computed_display_static(box->style) == CSS_DISPLAY_INLINE || - css_computed_display_static(style) == + css_computed_display_static(box->style) == CSS_DISPLAY_INLINE_BLOCK || - css_computed_display_static(style) == + css_computed_display_static(box->style) == CSS_DISPLAY_INLINE_TABLE)) { /* Special case for absolute positioning: make absolute inlines * into inline block so that the boxes are constructed in an @@ -354,7 +354,7 @@ bool box_construct_element(xmlNode *n, struct content *content, box->type = box_map[CSS_DISPLAY_INLINE_BLOCK]; } else { /* Normal mapping */ - box->type = box_map[css_computed_display(style, + box->type = box_map[css_computed_display(box->style, n->parent == NULL)]; } @@ -374,7 +374,8 @@ bool box_construct_element(xmlNode *n, struct content *content, if (box->type == BOX_NONE || css_computed_display(box->style, n->parent == NULL) == CSS_DISPLAY_NONE) { /* Free style and invalidate box's style pointer */ - css_computed_style_destroy(style); + css_select_results_destroy(styles); + box->styles = NULL; box->style = NULL; /* If this box has an associated gadget, invalidate the @@ -396,10 +397,11 @@ bool box_construct_element(xmlNode *n, struct content *content, (box->type == BOX_INLINE || box->type == BOX_BR || box->type == BOX_INLINE_BLOCK || - css_computed_float(style) == CSS_FLOAT_LEFT || - css_computed_float(style) == CSS_FLOAT_RIGHT)) { + css_computed_float(box->style) == CSS_FLOAT_LEFT || + css_computed_float(box->style) == CSS_FLOAT_RIGHT)) { /* this is the first inline in a block: make a container */ - *inline_container = box_create(0, false, 0, 0, 0, 0, content); + *inline_container = box_create(NULL, 0, false, 0, 0, 0, 0, + content); if (!*inline_container) return false; @@ -414,13 +416,13 @@ bool box_construct_element(xmlNode *n, struct content *content, if (convert_children && n->children) { for (c = n->children; c; c = c->next) - if (!convert_xml_to_box(c, content, style, + if (!convert_xml_to_box(c, content, box->style, parent, inline_container, href, target, title)) return false; - inline_end = box_create(style, false, href, target, title, id, - content); + inline_end = box_create(NULL, box->style, false, href, + target, title, id, content); if (!inline_end) return false; @@ -441,25 +443,26 @@ bool box_construct_element(xmlNode *n, struct content *content, inline_container_c = 0; for (c = n->children; convert_children && c; c = c->next) - if (!convert_xml_to_box(c, content, style, box, + if (!convert_xml_to_box(c, content, box->style, box, &inline_container_c, href, target, title)) return false; } else { /* list item: compute marker, then treat as non-inline box */ - if (css_computed_display(style, n->parent == NULL) == + if (css_computed_display(box->style, n->parent == NULL) == CSS_DISPLAY_LIST_ITEM) { lwc_string *image_uri; struct box *marker; - marker = box_create(style, false, 0, 0, title, 0, content); + marker = box_create(NULL, box->style, false, 0, 0, + title, 0, content); if (!marker) return false; marker->type = BOX_BLOCK; /** \todo marker content (list-style-type) */ - switch (css_computed_list_style_type(style)) { + switch (css_computed_list_style_type(box->style)) { case CSS_LIST_STYLE_TYPE_DISC: /* 2022 BULLET */ marker->text = (char *) "\342\200\242"; @@ -521,13 +524,13 @@ bool box_construct_element(xmlNode *n, struct content *content, break; } - if (css_computed_list_style_image(style, &image_uri) == + if (css_computed_list_style_image(box->style, + &image_uri) == CSS_LIST_STYLE_IMAGE_URI && image_uri != NULL) { if (!html_fetch_object(content, lwc_string_data(image_uri), - marker, - image_types, + marker, image_types, content->available_width, 1000, false)) return false; @@ -539,13 +542,15 @@ bool box_construct_element(xmlNode *n, struct content *content, /* float: insert a float box between the parent and * current node. Note: new parent will be the float */ - if (css_computed_float(style) == CSS_FLOAT_LEFT || - css_computed_float(style) == CSS_FLOAT_RIGHT) { - parent = box_create(0, false, href, target, title, 0, content); + if (css_computed_float(box->style) == CSS_FLOAT_LEFT || + css_computed_float(box->style) == + CSS_FLOAT_RIGHT) { + parent = box_create(NULL, 0, false, href, target, title, + 0, content); if (!parent) return false; - if (css_computed_float(style) == CSS_FLOAT_LEFT) + if (css_computed_float(box->style) == CSS_FLOAT_LEFT) parent->type = BOX_FLOAT_LEFT; else parent->type = BOX_FLOAT_RIGHT; @@ -559,12 +564,12 @@ bool box_construct_element(xmlNode *n, struct content *content, inline_container_c = 0; for (c = n->children; convert_children && c; c = c->next) - if (!convert_xml_to_box(c, content, style, box, + if (!convert_xml_to_box(c, content, box->style, box, &inline_container_c, href, target, title)) return false; - if (css_computed_float(style) == CSS_FLOAT_NONE) + if (css_computed_float(box->style) == CSS_FLOAT_NONE) /* new inline container unless this is a float */ *inline_container = 0; } @@ -585,7 +590,7 @@ bool box_construct_element(xmlNode *n, struct content *content, } /* fetch any background image for this box */ - if (css_computed_background_image(style, &bgimage_uri) == + if (css_computed_background_image(box->style, &bgimage_uri) == CSS_BACKGROUND_IMAGE_IMAGE && bgimage_uri != NULL) { if (!html_fetch_object(content, @@ -603,7 +608,8 @@ bool box_construct_element(xmlNode *n, struct content *content, * of many sites depend on. As such, only bother if box is a * block for now. */ if (box->type == BOX_BLOCK) { - box_construct_after(n, content, box, style); + box_construct_after(n, content, box, + box->styles->styles[CSS_PSEUDO_ELEMENT_AFTER]); } return true; @@ -613,10 +619,10 @@ bool box_construct_element(xmlNode *n, struct content *content, /** * Construct the box required for an :after pseudo element. * - * \param n XML node of type XML_ELEMENT_NODE - * \param content content of type CONTENT_HTML that is being processed - * \param box box which may have an :after s - * \param style box's style + * \param n XML node of type XML_ELEMENT_NODE + * \param content content of type CONTENT_HTML that is being processed + * \param box box which may have an :after s + * \param after_style complete computed style for after pseudo element * * TODO: * This is currently incomplete. It just does enough to support the clearfix @@ -629,26 +635,27 @@ bool box_construct_element(xmlNode *n, struct content *content, */ void box_construct_after(xmlNode *n, struct content *content, - struct box *box, const css_computed_style *style) + struct box *box, const css_computed_style *after_style) { struct box *after = 0; - css_computed_style *after_style = 0; const css_computed_content_item *c_item; - after_style = box_get_style(content, style, n, - CSS_PSEUDO_ELEMENT_AFTER); - if (!after_style) + if (after_style == NULL || + css_computed_content(after_style, &c_item) == + CSS_CONTENT_NORMAL) { + /* No pseudo element */ return; + } /* create box for this element */ - if (css_computed_content(after_style, &c_item) != CSS_CONTENT_NORMAL && - css_computed_display(after_style, n->parent == NULL) == + if (css_computed_display(after_style, n->parent == NULL) == CSS_DISPLAY_BLOCK) { - /* :after exists */ - after = box_create(after_style, true, NULL, NULL, NULL, NULL, - content); - if (!after) { - css_computed_style_destroy(after_style); + /* currently only support block level after elements */ + + /** \todo Not wise to drop const from the computed style */ + after = box_create(NULL, (css_computed_style *)after_style, + false, NULL, NULL, NULL, NULL, content); + if (after == NULL) { return; } @@ -677,8 +684,6 @@ void box_construct_after(xmlNode *n, struct content *content, } box_add_child(box, after); - } else { - css_computed_style_destroy(after_style); } } @@ -743,7 +748,8 @@ bool box_construct_text(xmlNode *n, struct content *content, if (!*inline_container) { /* this is the first inline node: make a container */ - *inline_container = box_create(0, false, 0, 0, 0, 0, content); + *inline_container = box_create(NULL, 0, false, 0, 0, 0, + 0, content); if (!*inline_container) { free(text); return false; @@ -755,8 +761,8 @@ bool box_construct_text(xmlNode *n, struct content *content, } /** \todo Dropping const here is not clever */ - box = box_create((css_computed_style *) parent_style, false, - href, target, title, 0, content); + box = box_create(NULL, (css_computed_style *) parent_style, + false, href, target, title, 0, content); if (!box) { free(text); return false; @@ -856,8 +862,8 @@ bool box_construct_text(xmlNode *n, struct content *content, current[len] = 0; if (!*inline_container) { - *inline_container = box_create(0, false, 0, 0, 0, 0, - content); + *inline_container = box_create(NULL, 0, false, + 0, 0, 0, 0, content); if (!*inline_container) { free(text); return false; @@ -870,8 +876,9 @@ bool box_construct_text(xmlNode *n, struct content *content, } /** \todo Dropping const isn't clever */ - box = box_create((css_computed_style *) parent_style, false, - href, target, title, 0, content); + box = box_create(NULL, + (css_computed_style *) parent_style, + false, href, target, title, 0, content); if (!box) { free(text); return false; @@ -914,17 +921,15 @@ bool box_construct_text(xmlNode *n, struct content *content, * \param c content of type CONTENT_HTML that is being processed * \param parent_style style at this point in xml tree, or NULL for root * \param n node in xml tree - * \param pseudo_element type of (pseudo) element to select for * \return the new style, or NULL on memory exhaustion */ -css_computed_style *box_get_style(struct content *c, - const css_computed_style *parent_style, - xmlNode *n, enum css_pseudo_element pseudo_element) +css_select_results *box_get_style(struct content *c, + const css_computed_style *parent_style, xmlNode *n) { char *s; + int pseudo_element; css_stylesheet *inline_style = NULL; - css_computed_style *partial; - css_computed_style *style; + css_select_results *styles; /* Firstly, construct inline stylesheet, if any */ if ((s = (char *) xmlGetProp(n, (const xmlChar *) "style")) && @@ -942,16 +947,15 @@ css_computed_style *box_get_style(struct content *c, } /* Select partial style for element */ - partial = nscss_get_style(c, n, pseudo_element, - CSS_MEDIA_SCREEN, inline_style, - box_style_alloc, NULL); + styles = nscss_get_style(c, n, CSS_MEDIA_SCREEN, inline_style, + box_style_alloc, NULL); /* No longer need inline style */ if (inline_style != NULL) css_stylesheet_destroy(inline_style); /* Failed selecting partial style -- bail out */ - if (partial == NULL) + if (styles == NULL || styles->styles[CSS_PSEUDO_ELEMENT_NONE] == NULL) return NULL; /* If there's a parent style, compose with partial to obtain @@ -959,20 +963,43 @@ css_computed_style *box_get_style(struct content *c, if (parent_style != NULL) { css_error error; - error = css_computed_style_compose(parent_style, partial, - nscss_compute_font_size, NULL, partial); + /* Complete the computed style, by composing with the parent + * element's style */ + error = css_computed_style_compose(parent_style, + styles->styles[CSS_PSEUDO_ELEMENT_NONE], + nscss_compute_font_size, NULL, + styles->styles[CSS_PSEUDO_ELEMENT_NONE]); if (error != CSS_OK) { - css_computed_style_destroy(partial); + css_select_results_destroy(styles); return NULL; } + } - style = partial; - } else { - /* No parent style, so partial must be fully computed */ - style = partial; + for (pseudo_element = CSS_PSEUDO_ELEMENT_NONE + 1; + pseudo_element < CSS_PSEUDO_ELEMENT_COUNT; + pseudo_element++) { + css_error error; + + if (styles->styles[pseudo_element] == NULL) + /* There were no rules concerning this pseudo element */ + continue; + + /* Complete the pseudo element's computed style, by composing + * with the base element's style */ + error = css_computed_style_compose( + styles->styles[CSS_PSEUDO_ELEMENT_NONE], + styles->styles[pseudo_element], + nscss_compute_font_size, NULL, + styles->styles[pseudo_element]); + if (error != CSS_OK) { + /* TODO: perhaps this shouldn't be quite so + * catastrophic? */ + css_select_results_destroy(styles); + return NULL; + } } - return style; + return styles; } @@ -1832,14 +1859,15 @@ bool box_input(BOX_SPECIAL_PARAMS) if (!box_button(n, content, box, 0)) goto no_memory; - inline_container = box_create(0, false, 0, 0, 0, 0, content); + inline_container = box_create(NULL, 0, false, 0, 0, 0, 0, + content); if (!inline_container) goto no_memory; inline_container->type = BOX_INLINE_CONTAINER; - inline_box = box_create(box->style, false, 0, 0, box->title, 0, - content); + inline_box = box_create(NULL, box->style, false, 0, 0, + box->title, 0, content); if (!inline_box) goto no_memory; @@ -1924,11 +1952,12 @@ bool box_input_text(BOX_SPECIAL_PARAMS, bool password) box->type = BOX_INLINE_BLOCK; - inline_container = box_create(0, false, 0, 0, 0, 0, content); + inline_container = box_create(NULL, 0, false, 0, 0, 0, 0, content); if (!inline_container) return false; inline_container->type = BOX_INLINE_CONTAINER; - inline_box = box_create(box->style, false, 0, 0, box->title, 0, content); + inline_box = box_create(NULL, box->style, false, 0, 0, box->title, 0, + content); if (!inline_box) return false; inline_box->type = BOX_TEXT; @@ -2023,11 +2052,12 @@ bool box_select(BOX_SPECIAL_PARAMS) box->gadget = gadget; gadget->box = box; - inline_container = box_create(0, false, 0, 0, 0, 0, content); + inline_container = box_create(NULL, 0, false, 0, 0, 0, 0, content); if (!inline_container) goto no_memory; inline_container->type = BOX_INLINE_CONTAINER; - inline_box = box_create(box->style, false, 0, 0, box->title, 0, content); + inline_box = box_create(NULL, box->style, false, 0, 0, box->title, 0, + content); if (!inline_box) goto no_memory; inline_box->type = BOX_TEXT; @@ -2146,7 +2176,8 @@ bool box_textarea(BOX_SPECIAL_PARAMS) return false; box->gadget->box = box; - inline_container = box_create(0, false, 0, 0, box->title, 0, content); + inline_container = box_create(NULL, 0, false, 0, 0, box->title, 0, + content); if (!inline_container) return false; inline_container->type = BOX_INLINE_CONTAINER; @@ -2198,8 +2229,8 @@ bool box_textarea(BOX_SPECIAL_PARAMS) return false; } - inline_box = box_create(box->style, false, 0, 0, box->title, 0, - content); + inline_box = box_create(NULL, box->style, false, 0, 0, + box->title, 0, content); if (!inline_box) { xmlFree(string); xmlBufferFree(buf); @@ -2216,7 +2247,8 @@ bool box_textarea(BOX_SPECIAL_PARAMS) break; /* BOX_BR */ - br_box = box_create(box->style, false, 0, 0, box->title, 0, content); + br_box = box_create(NULL, box->style, false, 0, 0, box->title, + 0, content); if (!br_box) { xmlFree(string); xmlBufferFree(buf); diff --git a/render/box_normalise.c b/render/box_normalise.c index e082a9a6f..b4c005c8e 100644 --- a/render/box_normalise.c +++ b/render/box_normalise.c @@ -153,8 +153,8 @@ bool box_normalise_block(struct box *block, struct content *c) if (style == NULL) return false; - table = box_create(style, true, block->href, block->target, - NULL, NULL, c); + table = box_create(NULL, style, true, block->href, + block->target, NULL, NULL, c); if (table == NULL) { css_computed_style_destroy(style); return false; @@ -249,7 +249,7 @@ bool box_normalise_table(struct box *table, struct content * c) return false; } - row_group = box_create(style, true, table->href, + row_group = box_create(NULL, style, true, table->href, table->target, NULL, NULL, c); if (row_group == NULL) { css_computed_style_destroy(style); @@ -329,7 +329,7 @@ bool box_normalise_table(struct box *table, struct content * c) return false; } - row_group = box_create(style, true, table->href, + row_group = box_create(NULL, style, true, table->href, table->target, NULL, NULL, c); if (row_group == NULL) { css_computed_style_destroy(style); @@ -346,7 +346,7 @@ bool box_normalise_table(struct box *table, struct content * c) return false; } - row = box_create(style, true, row_group->href, + row = box_create(NULL, style, true, row_group->href, row_group->target, NULL, NULL, c); if (row == NULL) { css_computed_style_destroy(style); @@ -455,7 +455,7 @@ bool box_normalise_table_spans(struct box *table, struct span_info *spans, if (style == NULL) return false; - cell = box_create(style, true, + cell = box_create(NULL, style, true, table_row->href, table_row->target, NULL, NULL, c); @@ -556,7 +556,7 @@ bool box_normalise_table_row_group(struct box *row_group, if (style == NULL) return false; - row = box_create(style, true, row_group->href, + row = box_create(NULL, style, true, row_group->href, row_group->target, NULL, NULL, c); if (row == NULL) { css_computed_style_destroy(style); @@ -625,7 +625,7 @@ bool box_normalise_table_row_group(struct box *row_group, return false; } - row = box_create(style, true, row_group->href, + row = box_create(NULL, style, true, row_group->href, row_group->target, NULL, NULL, c); if (row == NULL) { css_computed_style_destroy(style); @@ -683,8 +683,8 @@ bool box_normalise_table_row(struct box *row, if (style == NULL) return false; - cell = box_create(style, true, row->href, row->target, - NULL, NULL, c); + cell = box_create(NULL, style, true, row->href, + row->target, NULL, NULL, c); if (cell == NULL) { css_computed_style_destroy(style); return false; diff --git a/render/html.c b/render/html.c index db6409ec7..a624d9e16 100644 --- a/render/html.c +++ b/render/html.c @@ -1587,7 +1587,8 @@ void html_object_failed(struct box *box, struct content *content, if (box->next) { /* split this inline container into two inline * containers */ - ic = box_create(0, false, 0, 0, 0, 0, content); + ic = box_create(NULL, 0, false, 0, 0, 0, 0, + content); if (!ic) { union content_msg_data msg_data; -- cgit v1.2.3