From 25537a488a3eaa2fc014f6d723389c7990f5411d Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Thu, 29 Jun 2006 11:55:21 +0000 Subject: Position specifiers are relative to containing block's padding edge for absolutely positioned boxes. Compensate for this. svn path=/trunk/netsurf/; revision=2672 --- render/layout.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'render') diff --git a/render/layout.c b/render/layout.c index fab0ebc18..ac0c755a2 100644 --- a/render/layout.c +++ b/render/layout.c @@ -2613,6 +2613,16 @@ bool layout_absolute(struct box *box, struct content *content) containing_block->width)); box->x = left + margin[LEFT] + border[LEFT]; + 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]; + } else { + /** \todo inline ancestors */ + } box->width = width; box->height = height; @@ -2726,6 +2736,16 @@ bool layout_absolute(struct box *box, struct content *content) containing_block->height)); box->y = top + margin[TOP] + border[TOP]; + 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]; + } else { + /** \todo Inline ancestors */ + } box->height = height; return true; -- cgit v1.2.3