From 0455ab1c5445ba34b63e5a8618427dd6099e949c Mon Sep 17 00:00:00 2001 From: James Bursa Date: Sun, 31 Jul 2005 11:21:46 +0000 Subject: [project @ 2005-07-31 11:21:46 by bursa] Fix certain cases of relative positioning, and make the recursion more efficient (don't recurse for BOX_TEXT). svn path=/import/netsurf/; revision=1831 --- render/layout.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/render/layout.c b/render/layout.c index 02b91d1e8..97bfdb71c 100644 --- a/render/layout.c +++ b/render/layout.c @@ -126,6 +126,8 @@ bool layout_document(struct content *content, int width, int height) doc->children->margin[BOTTOM]); } + layout_position_relative(doc); + layout_calculate_descendant_bboxes(doc); return ret; @@ -316,9 +318,6 @@ bool layout_block_context(struct box *block, struct content *content) if (block->height == AUTO) block->height = cy - block->padding[TOP]; - /* and position blocks relatively */ - layout_position_relative(block); - return true; } @@ -539,16 +538,15 @@ void layout_position_relative(struct box *root) for (box = root->children; box; box = box->next) { int x, y; + if (box->type == BOX_TEXT) + continue; + /* recurse first */ layout_position_relative(box); - /* Ignore things we're not interested in. - * TEXT boxes are ignored, regardless of whether - * they're relatively positioned. */ + /* Ignore things we're not interested in. */ if (!box->style || (box->style && - box->style->position != - CSS_POSITION_RELATIVE) || - box->type == BOX_TEXT) + box->style->position != CSS_POSITION_RELATIVE)) continue; layout_compute_relative_offset(box, &x, &y); -- cgit v1.2.3