Author: tlsa
Date: Thu Jan 22 09:39:06 2009
New Revision: 6174

URL: http://source.netsurf-browser.org?rev=6174&view=rev
Log:
Handle clear before working out available width for tables and blocks that 
cause a new block formatting context.

Modified:
    trunk/netsurf/render/layout.c

Modified: trunk/netsurf/render/layout.c
URL: 
http://source.netsurf-browser.org/trunk/netsurf/render/layout.c?rev=6174&r1=6173&r2=6174&view=diff
==============================================================================
--- trunk/netsurf/render/layout.c (original)
+++ trunk/netsurf/render/layout.c Thu Jan 22 09:39:06 2009
@@ -319,6 +319,12 @@
                        goto advance_to_next_box;
                }
 
+               /* Clearance. */
+               y = 0;
+               if (box->style && box->style->clear != CSS_CLEAR_NONE)
+                       y = layout_clear(block->float_children,
+                                       box->style->clear);
+
                inset = 0;
                available_width = box->parent->width;
                 if (box->type == BOX_BLOCK || box->object) {
@@ -328,11 +334,12 @@
                                /* box establishes new block formatting context
                                 * so available width may be diminished due to
                                 * floats. */
-                               int x0, x1;
+                               int x0, x1, top;
                                struct box *left, *right;
+                               top = cy > y ? cy : y;
                                x0 = cx;
                                x1 = cx + box->parent->width;
-                               find_sides(block->float_children, cy, cy,
+                               find_sides(block->float_children, top, top,
                                                &x0, &x1, &left, &right);
                                inset = x0 - cx;
                                if (box->style->width.width == CSS_WIDTH_AUTO) {
@@ -345,11 +352,12 @@
                        layout_block_add_scrollbar(box, BOTTOM);
                } else if (box->type == BOX_TABLE) {
                        if (box->style->width.width == CSS_WIDTH_AUTO) {
-                               int x0, x1;
+                               int x0, x1, top;
                                struct box *left, *right;
+                               top = cy > y ? cy : y;
                                x0 = cx;
                                x1 = cx + box->parent->width;
-                               find_sides(block->float_children, cy, cy,
+                               find_sides(block->float_children, top, top,
                                                &x0, &x1, &left, &right);
                                available_width = x1 - x0 > 0 ? x1 - x0 : 0;
                        }
@@ -371,12 +379,6 @@
                        max_pos_margin = box->margin[TOP];
                else if (max_neg_margin < -box->margin[TOP])
                        max_neg_margin = -box->margin[TOP];
-
-               /* Clearance. */
-               y = 0;
-               if (box->style && box->style->clear != CSS_CLEAR_NONE)
-                       y = layout_clear(block->float_children,
-                                       box->style->clear);
 
                if (box->type != BOX_BLOCK || y ||
                                box->border[TOP] || box->padding[TOP]) {


_______________________________________________
netsurf-commits mailing list
[email protected]
http://vlists.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to