summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2008-03-09 01:34:49 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2008-03-09 01:34:49 +0000
commit1dc8770cbb4b8f9aeaaa8c131c7d1fc3eb726541 (patch)
treea533716d01004f23e8d7afaeb0316bb90e7f18e9 /render
parent201dabcb9bf6b8f8f08c50a849746993331893c0 (diff)
downloadnetsurf-1dc8770cbb4b8f9aeaaa8c131c7d1fc3eb726541.tar.gz
netsurf-1dc8770cbb4b8f9aeaaa8c131c7d1fc3eb726541.tar.bz2
Fix clear CSS property support when applied on floats.
svn path=/trunk/netsurf/; revision=3902
Diffstat (limited to 'render')
-rw-r--r--render/layout.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/render/layout.c b/render/layout.c
index 371228297..5e53afee8 100644
--- a/render/layout.c
+++ b/render/layout.c
@@ -828,12 +828,12 @@ int layout_clear(struct box *fl, css_clear clear)
for (; fl; fl = fl->next_float) {
if ((clear == CSS_CLEAR_LEFT || clear == CSS_CLEAR_BOTH) &&
fl->type == BOX_FLOAT_LEFT)
- if (y < fl->y + fl->height + 1)
- y = fl->y + fl->height + 1;
+ if (y < fl->y + fl->height)
+ y = fl->y + fl->height;
if ((clear == CSS_CLEAR_RIGHT || clear == CSS_CLEAR_BOTH) &&
fl->type == BOX_FLOAT_RIGHT)
- if (y < fl->y + fl->height + 1)
- y = fl->y + fl->height + 1;
+ if (y < fl->y + fl->height)
+ y = fl->y + fl->height;
}
return y;
}
@@ -1365,7 +1365,22 @@ bool layout_line(struct box *first, int *width, int *y,
d->padding[TOP] + d->height +
d->padding[BOTTOM] + d->border[BOTTOM] +
d->margin[BOTTOM];
- if (b->width <= (x1 - x0) - x ||
+ if (d->style && d->style->clear != CSS_CLEAR_NONE) {
+ /* to be cleared below existing floats */
+ if (b->type == BOX_FLOAT_LEFT) {
+ b->x = cx;
+ x0 += b->width;
+ left = b;
+ } else {
+ b->x = cx + *width - b->width;
+ x1 -= b->width;
+ right = b;
+ }
+ b->y = layout_clear(cont->float_children,
+ d->style->clear);
+ if (b->y < cy)
+ b->y = cy;
+ } else if (b->width <= (x1 - x0) - x ||
(left == 0 && right == 0 && x == 0)) {
/* fits next to this line, or this line is empty
* with no floats */