From 201dabcb9bf6b8f8f08c50a849746993331893c0 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sat, 8 Mar 2008 20:30:40 +0000 Subject: Round percentage width to nearest pixel with integers. svn path=/trunk/netsurf/; revision=3901 --- render/layout.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'render/layout.c') diff --git a/render/layout.c b/render/layout.c index fb21c10f3..371228297 100644 --- a/render/layout.c +++ b/render/layout.c @@ -738,8 +738,9 @@ void layout_find_dimensions(int available_width, style); break; case CSS_WIDTH_PERCENT: - *width = 0.5 + (available_width * - style->width.value.percent / 100.0); + /* Round to nearest pixel */ + *width = (style->width.value.percent * + available_width + 50) / 100; /* gadget widths include margins, * borders and padding */ if (box->gadget) { -- cgit v1.2.3