From 419517f0aa62055e6fe7fdd401fdb3cddd6c0fd6 Mon Sep 17 00:00:00 2001 From: James Bursa Date: Sun, 7 Aug 2005 21:28:48 +0000 Subject: [project @ 2005-08-07 21:28:48 by bursa] Improvements to frames. Fix bug with BR at end of inline container. svn path=/import/netsurf/; revision=1843 --- render/box_construct.c | 25 ++----------------------- render/html.c | 15 ++++++++++----- render/layout.c | 11 ++++++++--- render/table.c | 4 ++++ 4 files changed, 24 insertions(+), 31 deletions(-) (limited to 'render') diff --git a/render/box_construct.c b/render/box_construct.c index 3b518dfd6..f0625520c 100644 --- a/render/box_construct.c +++ b/render/box_construct.c @@ -1462,11 +1462,9 @@ bool box_frameset(BOX_SPECIAL_PARAMS) struct box *row_box; struct box *cell_box; struct box *frameset_box; - struct box *object_box; struct css_style *style = box->style; struct css_style *row_style; struct css_style *cell_style; - struct css_style *object_style; struct box_multi_length *row_height = 0, *col_width = 0; xmlNode *c; url_func_result res; @@ -1564,7 +1562,6 @@ bool box_frameset(BOX_SPECIAL_PARAMS) sizeof *style); if (!cell_style) return false; - css_cascade(cell_style, &css_blank_style); cell_style->overflow = CSS_OVERFLOW_AUTO; cell_box = box_create(cell_style, 0, 0, 0, content); @@ -1587,24 +1584,6 @@ bool box_frameset(BOX_SPECIAL_PARAMS) continue; } - object_style = talloc_memdup(content, style, - sizeof *style); - if (!object_style) - return false; - if (col_width && col_width[col].type == LENGTH_PX) { - object_style->width.width = CSS_WIDTH_LENGTH; - object_style->width.value.length.unit = - CSS_UNIT_PX; - object_style->width.value.length.value = - object_width; - } - - object_box = box_create(object_style, 0, 0, 0, content); - if (!object_box) - return false; - object_box->type = BOX_BLOCK; - box_add_child(cell_box, object_box); - if (!(s = (char *) xmlGetProp(c, (const xmlChar *) "src"))) { c = c->next; @@ -1628,7 +1607,7 @@ bool box_frameset(BOX_SPECIAL_PARAMS) LOG(("frame, url '%s'", url)); if (!html_fetch_object(content, url, - object_box, 0, + cell_box, 0, object_width, object_height, false)) return false; free(url); @@ -1669,7 +1648,7 @@ bool box_iframe(BOX_SPECIAL_PARAMS) /* start fetch */ ok = html_fetch_object(content, url, box, 0, - content->available_width, 1000, false); + content->available_width, 0, false); free(url); return ok; diff --git a/render/html.c b/render/html.c index 935f72a46..1fd7308a6 100644 --- a/render/html.c +++ b/render/html.c @@ -972,11 +972,16 @@ void html_object_done(struct box *box, struct content *object, return; } - box->object = object; - - if (box->width != UNKNOWN_WIDTH && - object->available_width != box->width) - content_reformat(object, box->width, box->height); + if (object->type == CONTENT_HTML) { + /* patch in the HTML object's box tree */ + box->children = object->data.html.layout; + object->data.html.layout->parent = box; + } else { + box->object = object; + if (box->width != UNKNOWN_WIDTH && + object->available_width != box->width) + content_reformat(object, box->width, box->height); + } /* invalidate parent min, max widths */ for (b = box->parent; b; b = b->parent) diff --git a/render/layout.c b/render/layout.c index 2e5cec984..6e0f68835 100644 --- a/render/layout.c +++ b/render/layout.c @@ -997,6 +997,7 @@ bool layout_line(struct box *first, int width, int *y, struct box *b; struct box *split_box = 0; struct box *d; + struct box *br_box = 0; bool move_y = false; int space_before = 0, space_after = 0; unsigned int inline_count = 0; @@ -1243,6 +1244,7 @@ bool layout_line(struct box *first, int width, int *y, } else if (b->type == BOX_BR) { b->x = x; b->width = 0; + br_box = b; b = b->next; split_box = 0; move_y = true; @@ -1436,10 +1438,9 @@ bool layout_line(struct box *first, int width, int *y, assert(b != first || (move_y && 0 < used_height && (left || right))); /* handle clearance for br */ - if (b->prev->type == BOX_BR && - b->prev->style->clear != CSS_CLEAR_NONE) { + if (br_box && br_box->style->clear != CSS_CLEAR_NONE) { int clear_y = layout_clear(cont->float_children, - b->prev->style->clear); + br_box->style->clear); if (used_height < clear_y - cy) used_height = clear_y - cy; } @@ -2388,6 +2389,10 @@ void layout_calculate_descendant_bboxes(struct box *box) layout_calculate_descendant_bboxes(child); + if (child->style && + child->style->overflow != CSS_OVERFLOW_VISIBLE) + continue; + if (child->x + child->descendant_x0 < box->descendant_x0) box->descendant_x0 = child->x + child->descendant_x0; if (box->descendant_x1 < child->x + child->descendant_x1) diff --git a/render/table.c b/render/table.c index 892596dad..df48ac803 100644 --- a/render/table.c +++ b/render/table.c @@ -44,6 +44,10 @@ bool table_calculate_column_types(struct box *table) struct column *col; struct box *row_group, *row, *cell; + if (table->col) + /* table->col already constructed, for example frameset table */ + return true; + table->col = col = talloc_array(table, struct column, table->columns); if (!col) return false; -- cgit v1.2.3