diff options
author | James Bursa <james@netsurf-browser.org> | 2004-04-13 23:20:23 +0000 |
---|---|---|
committer | James Bursa <james@netsurf-browser.org> | 2004-04-13 23:20:23 +0000 |
commit | 5e41f0465ce996377cf9559b0f2910e473b3e6f3 (patch) | |
tree | 0fe4b9fa7ed14d02873351eb4575dfffcce87820 /render/layout.c | |
parent | 31c76750f9e81512dbdcf0c14a5ff07830e52798 (diff) | |
download | netsurf-5e41f0465ce996377cf9559b0f2910e473b3e6f3.tar.gz netsurf-5e41f0465ce996377cf9559b0f2910e473b3e6f3.tar.bz2 |
[project @ 2004-04-13 23:20:23 by bursa]
Table layout fix and table-float interaction changes.
svn path=/import/netsurf/; revision=778
Diffstat (limited to 'render/layout.c')
-rw-r--r-- | render/layout.c | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/render/layout.c b/render/layout.c index f3dea0d9e..e58534c99 100644 --- a/render/layout.c +++ b/render/layout.c @@ -112,6 +112,8 @@ void layout_block_context(struct box *block) block->type == BOX_INLINE_BLOCK || block->type == BOX_TABLE_CELL); + gui_multitask(); + box = margin_box = block->children; cx = block->padding[LEFT]; cy = block->padding[TOP]; @@ -175,7 +177,34 @@ void layout_block_context(struct box *block) box->width = box->parent->width; layout_inline_container(box, box->width, block, cx, cy); } else if (box->type == BOX_TABLE) { - /** \todo move down to avoid floats if necessary */ + /* Move down to avoid floats if necessary. */ + int x0, x1; + struct box *left, *right; + y = cy; + while (1) { + x0 = cx; + x1 = cx + box->parent->width; + find_sides(block->float_children, y, + y + box->height, + &x0, &x1, &left, &right); + if (box->width <= x1 - x0) + break; + if (!left && !right) + break; + else if (!left) + y = right->y + right->height + 1; + else if (!right) + y = left->y + left->height + 1; + else if (left->y + left->height < + right->y + right->height) + y = left->y + left->height + 1; + else + y = right->y + right->height + 1; + } + box->x += x0 - cx; + cx = x0; + box->y += y - cy; + cy = y; } /* Advance to next box. */ @@ -1066,10 +1095,10 @@ void layout_table(struct box *table, int available_width) /* space between min and max: fill it exactly */ float scale = (float) (auto_width - min_width) / (float) (max_width - min_width); - fprintf(stderr, "filling, scale %f\n", scale); + /* fprintf(stderr, "filling, scale %f\n", scale); */ for (i = 0; i < columns; i++) { - col[i].width = col[i].min + - (col[i].max - col[i].min) * scale; + col[i].width = col[i].min + (int) (0.5 + + (col[i].max - col[i].min) * scale); } table_width = auto_width; } |