From 5a4c8916efe2449f2cf43bef2f7746dd53469046 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Fri, 24 Jun 2011 09:30:33 +0000 Subject: If iframes are reformatted due to containing document reflow, don't need to redraw them since they will be redrawn when the containing document is redrawn. Make iframe handling more robust. svn path=/trunk/netsurf/; revision=12497 --- render/html.c | 6 +++--- render/layout.c | 36 +++++++++++++++--------------------- 2 files changed, 18 insertions(+), 24 deletions(-) (limited to 'render') diff --git a/render/html.c b/render/html.c index fec0f5d43..16b18263c 100644 --- a/render/html.c +++ b/render/html.c @@ -1480,7 +1480,7 @@ nserror html_object_callback(hlcache_handle *object, html_object_done(box, object, o->background); if (c->base.status == CONTENT_STATUS_READY || c->base.status == CONTENT_STATUS_DONE) - content__reformat(&c->base, + content__reformat(&c->base, false, c->base.available_width, c->base.height); } @@ -1581,7 +1581,7 @@ nserror html_object_callback(hlcache_handle *object, event->type == CONTENT_MSG_DONE || event->type == CONTENT_MSG_ERROR)) { /* all objects have arrived */ - content__reformat(&c->base, c->base.available_width, + content__reformat(&c->base, false, c->base.available_width, c->base.height); html_set_status(c, ""); content_set_done(&c->base); @@ -1601,7 +1601,7 @@ nserror html_object_callback(hlcache_handle *object, (c->base.status == CONTENT_STATUS_READY || c->base.status == CONTENT_STATUS_DONE) && (wallclock() > c->base.reformat_time)) { - content__reformat(&c->base, c->base.available_width, + content__reformat(&c->base, false, c->base.available_width, c->base.height); } diff --git a/render/layout.c b/render/layout.c index f9e1d5b2b..81a4df802 100644 --- a/render/layout.c +++ b/render/layout.c @@ -273,12 +273,6 @@ bool layout_block_context(struct box *block, int viewport_height, return true; } - /* special case if the block contains an iframe */ - if (block->iframe) { - browser_window_reformat(block->iframe, block->width, - block->height == AUTO ? 0 : block->height); - } - /* special case if the block contains an radio button or checkbox */ if (block->gadget && (block->gadget->type == GADGET_RADIO || block->gadget->type == GADGET_CHECKBOX)) { @@ -512,11 +506,6 @@ bool layout_block_context(struct box *block, int viewport_height, if (!layout_block_object(box)) return false; - } else if (box->iframe) { - browser_window_reformat(box->iframe, box->width, - box->height == AUTO ? - 0 : box->height); - } else if (box->type == BOX_INLINE_CONTAINER) { box->width = box->parent->width; if (!layout_inline_container(box, box->width, block, @@ -1045,7 +1034,7 @@ bool layout_block_object(struct box *block) #endif if (content_get_type(block->object) == CONTENT_HTML) { - content_reformat(block->object, block->width, 1); + content_reformat(block->object, false, block->width, 1); } else { /* Non-HTML objects */ /* this case handled already in @@ -2515,7 +2504,7 @@ bool layout_line(struct box *first, int *width, int *y, content_get_available_width(b->object)) { htype = css_computed_height(b->style, &value, &unit); - content_reformat(b->object, b->width, b->height); + content_reformat(b->object, false, b->width, b->height); if (htype == CSS_HEIGHT_AUTO) b->height = content_get_height(b->object); @@ -2731,13 +2720,6 @@ bool layout_line(struct box *first, int *width, int *y, b->next_float = cont->float_children; cont->float_children = b; - /* If the iframe's bw is in place, reformat it to the - * new box size */ - if (b->iframe) { - browser_window_reformat(b->iframe, - b->width, b->height); - } - split_box = 0; } } @@ -5007,7 +4989,8 @@ static void layout_update_descendant_bbox(struct box *box, struct box *child, /** - * Recursively calculate the descendant_[xy][01] values for a laid-out box tree. + * Recursively calculate the descendant_[xy][01] values for a laid-out box tree + * and inform iframe browser windows of their size and position. * * \param box tree of boxes to update */ @@ -5031,6 +5014,17 @@ void layout_calculate_descendant_bboxes(struct box *box) box->descendant_y1 = content_get_height(box->object); } + if (box->iframe != NULL) { + int x, y; + box_coords(box, &x, &y); + + browser_window_set_position(box->iframe, x, y); + browser_window_set_dimensions(box->iframe, + box->width, box->height); + browser_window_reformat(box->iframe, true, + box->width, box->height); + } + if (box->type == BOX_INLINE || box->type == BOX_TEXT) return; -- cgit v1.2.3