diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2006-06-29 15:53:17 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2006-06-29 15:53:17 +0000 |
commit | b427a005b695431125d1b8b85187da2e6a2f7c20 (patch) | |
tree | 16260710fd5e2bb8eaf4733b7678786ba512edb0 | |
parent | 25537a488a3eaa2fc014f6d723389c7990f5411d (diff) | |
download | netsurf-b427a005b695431125d1b8b85187da2e6a2f7c20.tar.gz netsurf-b427a005b695431125d1b8b85187da2e6a2f7c20.tar.bz2 |
Properly take account of padding on containing block.
svn path=/trunk/netsurf/; revision=2673
-rw-r--r-- | render/layout.c | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/render/layout.c b/render/layout.c index ac0c755a2..0af725bc0 100644 --- a/render/layout.c +++ b/render/layout.c @@ -2486,9 +2486,24 @@ bool layout_absolute(struct box *box, struct content *content) assert(box->type == BOX_BLOCK || box->type == BOX_TABLE); + if (containing_block->type == BOX_BLOCK || + containing_block->type == BOX_INLINE_BLOCK || + containing_block->type == BOX_TABLE_CELL) { + /* Block level container => temporarily increase containing + * block dimensions to include padding (we restore this + * again at the end) */ + containing_block->width += containing_block->padding[LEFT] + + containing_block->padding[RIGHT]; + containing_block->height += containing_block->padding[TOP] + + containing_block->padding[BOTTOM]; + } else { + /** \todo inline containers */ + } + layout_compute_offsets(box, containing_block, &top, &right, &bottom, &left); - layout_find_dimensions(containing_block->width, box->style, + + layout_find_dimensions(available_width, box->style, &width, &height, margin, padding, border); /* 10.3.7 */ @@ -2616,10 +2631,9 @@ bool layout_absolute(struct box *box, struct content *content) if (containing_block->type == BOX_BLOCK || containing_block->type == BOX_INLINE_BLOCK || containing_block->type == BOX_TABLE_CELL) { - /* Block-level ancestor => compensate for ancestor's - * l,r padding */ - box->x += containing_block->padding[RIGHT] - - containing_block->padding[LEFT]; + /* Block-level ancestor => reset container's width */ + containing_block->width -= containing_block->padding[LEFT] + + containing_block->padding[RIGHT]; } else { /** \todo inline ancestors */ } @@ -2739,10 +2753,9 @@ bool layout_absolute(struct box *box, struct content *content) if (containing_block->type == BOX_BLOCK || containing_block->type == BOX_INLINE_BLOCK || containing_block->type == BOX_TABLE_CELL) { - /* Block-level ancestor => compensate for ancestor's - * t,b padding */ - box->y += containing_block->padding[BOTTOM] - - containing_block->padding[TOP]; + /* Block-level ancestor => reset container's height */ + containing_block->height -= containing_block->padding[TOP] + + containing_block->padding[BOTTOM]; } else { /** \todo Inline ancestors */ } |