From d9280e8d72fceceff632b98ab400c9979eec0965 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Fri, 25 Feb 2011 19:14:38 +0000 Subject: Fix bug #2076786: do not apply fallback content to failed objects svn path=/trunk/netsurf/; revision=11797 --- render/box.c | 24 ++------------- render/box.h | 1 - render/box_construct.c | 10 ------ render/html.c | 82 ++------------------------------------------------ 4 files changed, 4 insertions(+), 113 deletions(-) (limited to 'render') diff --git a/render/box.c b/render/box.c index 8c7e30d08..9021f3842 100644 --- a/render/box.c +++ b/render/box.c @@ -163,7 +163,6 @@ struct box * box_create(css_select_results *styles, css_computed_style *style, box->children = NULL; box->last = NULL; box->parent = NULL; - box->fallback = NULL; box->inline_end = NULL; box->float_children = NULL; box->float_container = NULL; @@ -888,22 +887,11 @@ struct box *box_find_by_id(struct box *box, const char *id) bool box_visible(struct box *box) { - struct box *fallback; - /* visibility: hidden */ if (box->style && css_computed_visibility(box->style) == CSS_VISIBILITY_HIDDEN) return false; - /* check if a fallback */ - while (box->parent) { - for (fallback = box->parent->fallback; fallback; - fallback = fallback->next) - if (fallback == box) - return false; - box = box->parent; - } - return true; } @@ -1019,13 +1007,6 @@ void box_dump(FILE *stream, struct box *box, unsigned int depth) c->prev, prev); box_dump(stream, c, depth + 1); } - if (box->fallback) { - for (i = 0; i != depth; i++) - fprintf(stream, " "); - fprintf(stream, "fallback:\n"); - for (c = box->fallback; c; c = c->next) - box_dump(stream, c, depth + 1); - } } /* Box tree duplication below @@ -1054,9 +1035,8 @@ int box_compare_dict_elements(const struct box_dict_element *a, } /** Duplication of a box tree. We assume that all the content is fetched, -fallbacks have been applied where necessary and we reuse a lot of content -like strings, fetched objects etc - just replicating all we need to create -two different layouts. +and we reuse a lot of content like strings, fetched objects etc - just +replicating all we need to create two different layouts. \return true on success, false on lack of memory */ struct box* box_duplicate_tree(struct box *root, struct content *c) diff --git a/render/box.h b/render/box.h index 7cde3728f..b4151ca3b 100644 --- a/render/box.h +++ b/render/box.h @@ -212,7 +212,6 @@ struct box { struct box *children; /**< First child box, or 0. */ struct box *last; /**< Last child box, or 0. */ struct box *parent; /**< Parent box, or 0. */ - struct box *fallback; /**< Fallback children for object, or 0. */ /** INLINE_END box corresponding to this INLINE box, or INLINE box * corresponding to this INLINE_END box. */ struct box *inline_end; diff --git a/render/box_construct.c b/render/box_construct.c index 42b9929ca..6f91629fd 100644 --- a/render/box_construct.c +++ b/render/box_construct.c @@ -1198,7 +1198,6 @@ bool box_object(BOX_SPECIAL_PARAMS) struct object_param *param; xmlChar *codebase, *classid, *data; xmlNode *c; - struct box *inline_container = 0; if (box->style && css_computed_display(box->style, n->parent == NULL) == CSS_DISPLAY_NONE) @@ -1325,15 +1324,6 @@ bool box_object(BOX_SPECIAL_PARAMS) box, 0, content->available_width, 1000, false)) return false; - /* convert children and place into fallback */ - for (c = n->children; c; c = c->next) { - if (!convert_xml_to_box(c, content, box->style, box, - &inline_container, 0, 0, 0)) - return false; - } - box->fallback = box->children; - box->children = box->last = 0; - *convert_children = false; return true; } diff --git a/render/html.c b/render/html.c index 3ea0b9aa8..dce873c4f 100644 --- a/render/html.c +++ b/render/html.c @@ -1545,91 +1545,13 @@ void html_object_done(struct box *box, hlcache_handle *object, * \param box box containing object which failed to load * \param content document of type CONTENT_HTML * \param background the object was the background image for the box - * - * Any fallback content for the object is made visible. */ void html_object_failed(struct box *box, struct content *content, bool background) { - struct box *b, *ic; - - if (background) - return; - if (!box->fallback) - return; - - /* make fallback boxes into children or siblings, as appropriate */ - if (box->type != BOX_INLINE) { - /* easy case: fallbacks become children */ - assert(box->type == BOX_BLOCK || - box->type == BOX_TABLE_CELL || - box->type == BOX_INLINE_BLOCK); - box->children = box->fallback; - box->last = box->children; - while (box->last->next) - box->last = box->last->next; - box->fallback = 0; - box_normalise_block(box, content); - } else { - assert(box->parent->type == BOX_INLINE_CONTAINER); - if (box->fallback->type == BOX_INLINE_CONTAINER && - !box->fallback->next) { - /* the fallback is a single inline container: splice - * it into this inline container */ - for (b = box->fallback->children; b; b = b->next) - b->parent = box->parent; - box->fallback->last->next = box->next; - if (!box->next) - box->parent->last = box->fallback->last; - box->next = box->fallback->children; - box->next->prev = box; - box->fallback = 0; - } else { - if (box->next) { - /* split this inline container into two inline - * containers */ - ic = box_create(NULL, 0, false, 0, 0, 0, 0, - content); - if (!ic) { - union content_msg_data msg_data; - - msg_data.error = - messages_get("NoMemory"); - content_broadcast(content, - CONTENT_MSG_ERROR, - msg_data); - return; - } - ic->type = BOX_INLINE_CONTAINER; - box_insert_sibling(box->parent, ic); - ic->children = box->next; - ic->last = box->parent->last; - ic->children->prev = 0; - box->next = 0; - box->parent->last = box; - for (b = ic->children; b; b = b->next) - b->parent = ic; - } - /* insert the fallback after the parent */ - for (b = box->fallback; b->next; b = b->next) - b->parent = box->parent->parent; - b->parent = box->parent->parent; - /* [b is the last fallback box] */ - b->next = box->parent->next; - if (b->next) - b->next->prev = b; - box->parent->next = box->fallback; - box->fallback->prev = box->parent; - box->fallback = 0; - box_normalise_block(box->parent->parent, content); - } - } - - /* invalidate parent min, max widths */ - for (b = box->parent; b; b = b->parent) - b->max_width = UNKNOWN_MAX_WIDTH; - box->width = UNKNOWN_WIDTH; + /* Nothing to do */ + return; } -- cgit v1.2.3