From b0ea2a46e922722025b6e267f2cccc3dbce54e68 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Fri, 23 Sep 2011 15:48:40 +0000 Subject: Use layout_find_dimensions to get inline object width/height. svn path=/trunk/netsurf/; revision=12866 --- render/layout.c | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) (limited to 'render') diff --git a/render/layout.c b/render/layout.c index a55793e89..0fdeb7e01 100644 --- a/render/layout.c +++ b/render/layout.c @@ -2256,8 +2256,6 @@ bool layout_line(struct box *first, int *width, int *y, #endif for (x = 0, b = first; x <= x1 - x0 && b != 0; b = b->next) { - enum css_width_e wtype; - enum css_height_e htype; css_fixed value = 0; css_unit unit = CSS_UNIT_PX; @@ -2414,27 +2412,9 @@ bool layout_line(struct box *first, int *width, int *y, /* inline replaced, 10.3.2 and 10.6.2 */ assert(b->style); - /* calculate box width */ - wtype = css_computed_width(b->style, &value, &unit); - if (wtype == CSS_WIDTH_SET) { - if (unit == CSS_UNIT_PCT) { - b->width = FPCT_OF_INT_TOINT(value, *width); - } else { - b->width = FIXTOINT(nscss_len2px(value, unit, - b->style)); - } - } else { - b->width = AUTO; - } - - /* height */ - htype = css_computed_height(b->style, &value, &unit); - if (htype == CSS_HEIGHT_SET) { - b->height = FIXTOINT(nscss_len2px(value, unit, - b->style)); - } else { - b->height = AUTO; - } + layout_find_dimensions(*width, -1, b, b->style, + &b->width, &b->height, NULL, NULL, + NULL, NULL, NULL); if (b->object && !(b->flags & REPLACE_DIM)) { layout_get_object_dimensions(b, &b->width, &b->height, @@ -2462,7 +2442,8 @@ bool layout_line(struct box *first, int *width, int *y, if (b->object && content_get_type(b->object) == CONTENT_HTML && b->width != content_get_available_width(b->object)) { - htype = css_computed_height(b->style, &value, &unit); + enum css_height_e htype = css_computed_height(b->style, + &value, &unit); content_reformat(b->object, false, b->width, b->height); -- cgit v1.2.3