summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2009-01-27 13:21:50 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2009-01-27 13:21:50 +0000
commit619e5b96318ed18693e8f9761643c87c9c033a84 (patch)
tree4e4e28608a44490ba706ad144fc9fef8e681221a /render
parent83d696ace70af1e1ae6189d72f53baf6a1aa1e72 (diff)
downloadnetsurf-619e5b96318ed18693e8f9761643c87c9c033a84.tar.gz
netsurf-619e5b96318ed18693e8f9761643c87c9c033a84.tar.bz2
Once a float has been placed below current line,
ensure that subsequent floats are also placed below. Make place_float_below() consider float height when searching for available space. svn path=/trunk/netsurf/; revision=6287
Diffstat (limited to 'render')
-rw-r--r--render/layout.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/render/layout.c b/render/layout.c
index 5f0b4a4ff..c6eb81ab1 100644
--- a/render/layout.c
+++ b/render/layout.c
@@ -1540,6 +1540,7 @@ bool layout_line(struct box *first, int *width, int *y,
struct box *d;
struct box *br_box = 0;
bool move_y = false;
+ bool place_below = false;
int space_before = 0, space_after = 0;
unsigned int inline_count = 0;
unsigned int i;
@@ -1873,17 +1874,19 @@ bool layout_line(struct box *first, int *width, int *y,
d->padding[BOTTOM] + d->border[BOTTOM] +
d->margin[BOTTOM];
+ if (b->width > (x1 - x0) - x)
+ place_below = true;
if (d->style && (d->style->clear == CSS_CLEAR_NONE ||
(d->style->clear == CSS_CLEAR_LEFT &&
left == 0) ||
(d->style->clear == CSS_CLEAR_RIGHT &&
right == 0)) &&
- (b->width <= (x1 - x0) - x ||
+ (!place_below ||
(left == 0 && right == 0 && x == 0)) &&
cy >= cont->clear_level) {
/* + not cleared or,
* cleared and there are no floats to clear
- * + fits next to this line or,
+ * + fits without needing to be placed below or,
* this line is empty with no floats
* + current y, cy, is below the clear level
*
@@ -2420,14 +2423,15 @@ void place_float_below(struct box *c, int width, int cx, int y,
struct box *cont)
{
int x0, x1, yy = y;
- struct box * left;
- struct box * right;
+ struct box *left;
+ struct box *right;
LOG(("c %p, width %i, cx %i, y %i, cont %p", c, width, cx, y, cont));
do {
y = yy;
x0 = cx;
x1 = cx + width;
- find_sides(cont->float_children, y, y, &x0, &x1, &left, &right);
+ find_sides(cont->float_children, y, y + c->height, &x0, &x1,
+ &left, &right);
if (left != 0 && right != 0) {
yy = (left->y + left->height <
right->y + right->height ?