Ignore clear property on floats when there are no floats to clear.

svn path=/trunk/netsurf/; revision=5402
This commit is contained in:
Michael Drake 2008-09-22 23:45:51 +00:00
parent 8c4cbd2b1b
commit 4fad8726a4
1 changed files with 11 additions and 5 deletions

View File

@ -1609,13 +1609,19 @@ bool layout_line(struct box *first, int *width, int *y,
d->padding[BOTTOM] + d->border[BOTTOM] + d->padding[BOTTOM] + d->border[BOTTOM] +
d->margin[BOTTOM]; d->margin[BOTTOM];
if (d->style && d->style->clear == CSS_CLEAR_NONE && if (d->style && (d->style->clear == CSS_CLEAR_NONE ||
(d->style->clear != CSS_CLEAR_NONE &&
left == 0 && right == 0)) &&
(b->width <= (x1 - x0) - x || (b->width <= (x1 - x0) - x ||
(left == 0 && right == 0 && x == 0)) && (left == 0 && right == 0 && x == 0)) &&
cy >= cont->clear_level) { cy >= cont->clear_level) {
/* not cleared /* + not cleared or,
* fits next to this line, or this line is * cleared and there are no floats to clear
* empty with no floats */ * + fits next to this line or,
* this line is empty with no floats and
* + current y, cy, is below the clear level
*
* Float affects current line */
if (b->type == BOX_FLOAT_LEFT) { if (b->type == BOX_FLOAT_LEFT) {
b->x = cx + x0; b->x = cx + x0;
x0 += b->width; x0 += b->width;
@ -1627,7 +1633,7 @@ bool layout_line(struct box *first, int *width, int *y,
} }
b->y = cy; b->y = cy;
} else { } else {
/* cleared or doesn't fit */ /* cleared or doesn't fit on line */
/* place below into next available space */ /* place below into next available space */
fy = (cy > cont->clear_level) ? cy : fy = (cy > cont->clear_level) ? cy :
cont->clear_level; cont->clear_level;