summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2008-03-09 14:10:05 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2008-03-09 14:10:05 +0000
commit920be778044e1fb8e1e5aefa2d97b0a8847c11ab (patch)
tree158dc60402ff320e103f07e6e6f0d1b5ebb12c45 /render
parent1dc8770cbb4b8f9aeaaa8c131c7d1fc3eb726541 (diff)
downloadnetsurf-920be778044e1fb8e1e5aefa2d97b0a8847c11ab.tar.gz
netsurf-920be778044e1fb8e1e5aefa2d97b0a8847c11ab.tar.bz2
When floats have clear right or left set, as well as being put below floats on that side, they should still follow normal behaviour with respect to floats on the other side.
svn path=/trunk/netsurf/; revision=3904
Diffstat (limited to 'render')
-rw-r--r--render/layout.c49
1 files changed, 29 insertions, 20 deletions
diff --git a/render/layout.c b/render/layout.c
index 5e53afee8..a539e62f7 100644
--- a/render/layout.c
+++ b/render/layout.c
@@ -1033,6 +1033,7 @@ bool layout_line(struct box *first, int *width, int *y,
int x0 = 0;
int x1 = *width;
int x, h, x_previous;
+ int fy;
struct box *left;
struct box *right;
struct box *b;
@@ -1365,25 +1366,13 @@ 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 (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 */
+
+ if (d->style && d->style->clear == CSS_CLEAR_NONE &&
+ (b->width <= (x1 - x0) - x ||
+ (left == 0 && right == 0 && x == 0))) {
+ /* not cleared
+ * fits next to this line, or this line is
+ * empty with no floats */
if (b->type == BOX_FLOAT_LEFT) {
b->x = cx + x0;
x0 += b->width;
@@ -1395,9 +1384,29 @@ bool layout_line(struct box *first, int *width, int *y,
}
b->y = cy;
} else {
- /* doesn't fit: place below */
+ /* cleared or doesn't fit */
+ /* place below into next available space */
place_float_below(b, *width,
cx, cy + height, cont);
+ 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;
+ }
+ fy = layout_clear(cont->float_children,
+ d->style->clear);
+ if (b->y < fy)
+ b->y = fy;
+
+ }
}
if (cont->float_children == b) {
LOG(("float %p already placed", b));