Author: tlsa
Date: Sun Jan 18 17:41:48 2009
New Revision: 6142

URL: http://source.netsurf-browser.org?rev=6142&view=rev
Log:
Make blocks which establish a new block formatting context use have the correct 
width and position to avoid overlapping floats. Fixes the main problem on the 
amazon.co.uk front page.

Modified:
    trunk/netsurf/render/layout.c

Modified: trunk/netsurf/render/layout.c
URL: 
http://source.netsurf-browser.org/trunk/netsurf/render/layout.c?rev=6142&r1=6141&r2=6142&view=diff
==============================================================================
--- trunk/netsurf/render/layout.c (original)
+++ trunk/netsurf/render/layout.c Sun Jan 18 17:41:48 2009
@@ -364,8 +364,25 @@
                 * establishes a new block context. */
                if (box->type == BOX_BLOCK && box->style &&
                                box->style->overflow != CSS_OVERFLOW_VISIBLE) {
+                       int x0, x1;
+                       struct box *left, *right;
+
                        cy += max_pos_margin - max_neg_margin;
                        box->y += max_pos_margin - max_neg_margin;
+
+                       /* Before calling layout_block_context, find the
+                        * available width */
+                       x0 = cx;
+                       x1 = cx + box->parent->width;
+                       find_sides(block->float_children, cy, cy, &x0, &x1,
+                                       &left, &right);
+                       box->x += x0 - cx;
+                       x1 = box->parent->width - x1 + x0;
+                       if (box->width - x1 > 0)
+                               box->width -= x1;
+                       else
+                               box->width = 0;
+                       cx = x0;
 
                        layout_block_context(box, content);
 


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

Reply via email to