diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2009-05-28 18:06:49 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2009-05-28 18:06:49 +0000 |
commit | 798f421a886205ffafdca4a14f80b0bb9f6e626d (patch) | |
tree | ebcecec3497b78ae7556c876f186953d9fd64644 /render/layout.c | |
parent | a070f24913c5afc756232915cd9b6d7525f08ad0 (diff) | |
download | netsurf-798f421a886205ffafdca4a14f80b0bb9f6e626d.tar.gz netsurf-798f421a886205ffafdca4a14f80b0bb9f6e626d.tar.bz2 |
When computing relative offset values for floats, use block formatting context for containing block, rather than parent.
svn path=/trunk/netsurf/; revision=7614
Diffstat (limited to 'render/layout.c')
-rw-r--r-- | render/layout.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/render/layout.c b/render/layout.c index 525a21845..fe787772a 100644 --- a/render/layout.c +++ b/render/layout.c @@ -3458,11 +3458,20 @@ void layout_position_relative(struct box *root, struct box *fp, int fx, int fy) void layout_compute_relative_offset(struct box *box, int *x, int *y) { int left, right, top, bottom; + struct box *containing_block; assert(box && box->parent && box->style && box->style->position == CSS_POSITION_RELATIVE); - layout_compute_offsets(box, box->parent, &top, &right, &bottom, &left); + if (box->float_container && (box->style->float_ == CSS_FLOAT_LEFT || + box->style->float_ == CSS_FLOAT_RIGHT)) { + containing_block = box->float_container; + } else { + containing_block = box->parent; + } + + layout_compute_offsets(box, containing_block, + &top, &right, &bottom, &left); if (left == AUTO && right == AUTO) left = right = 0; @@ -3475,7 +3484,7 @@ void layout_compute_relative_offset(struct box *box, int *x, int *y) else { /* over constrained => examine direction property * of containing block */ - if (box->parent->style) { + if (containing_block->style) { if (box->parent->style->direction == CSS_DIRECTION_LTR) /* left wins */ |