From daf8c22d1b005acde3831cbcba37835efa426fb8 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 29 Jan 2009 22:57:32 +0000 Subject: Only get top margin if box has style. svn path=/trunk/netsurf/; revision=6295 --- render/layout.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'render/layout.c') diff --git a/render/layout.c b/render/layout.c index 709f516be..ba18502a5 100644 --- a/render/layout.c +++ b/render/layout.c @@ -327,20 +327,10 @@ bool layout_block_context(struct box *block, struct content *content) box->style->clear); /* Get top margin */ - switch (box->style->margin[TOP].margin) { - case CSS_MARGIN_LENGTH: - box->margin[TOP] = css_len2px(&box->style->margin[TOP]. - value.length, box->style); - break; - case CSS_MARGIN_PERCENT: - box->margin[TOP] = box->parent->width * - box->style->margin[TOP].value.percent / - 100; - break; - case CSS_MARGIN_AUTO: - default: - box->margin[TOP] = 0; - break; + if (box->style) { + layout_find_dimensions(box->parent->width, box, + box->style, NULL, NULL, NULL, NULL, + box->margin, NULL, NULL); } if (max_pos_margin < box->margin[TOP]) -- cgit v1.2.3