From 511891d27c94afc892ecc0d203a39827cb834e78 Mon Sep 17 00:00:00 2001 From: Richard Wilson Date: Wed, 23 Mar 2005 18:14:38 +0000 Subject: [project @ 2005-03-23 18:14:38 by rjw] Fix incorrect background position calculations. Modify CSS parser to pass all background-position testcases. svn path=/import/netsurf/; revision=1574 --- render/html_redraw.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'render') diff --git a/render/html_redraw.c b/render/html_redraw.c index f0b8d54be..2fc4a5bfd 100644 --- a/render/html_redraw.c +++ b/render/html_redraw.c @@ -701,7 +701,6 @@ bool html_redraw_file(int x, int y, int width, int height, bool html_redraw_background(int x, int y, struct box *box, float scale, colour background_colour) { - int image_width, image_height; bool repeat_x = false; bool repeat_y = false; @@ -718,10 +717,6 @@ bool html_redraw_background(int x, int y, else if (!option_background_images) return true;*/ - /* get the image dimensions for our positioning and scaling */ - image_width = box->background->width * scale; - image_height = box->background->height * scale; - /* handle background-repeat */ switch (box->style->background_repeat) { case CSS_BACKGROUND_REPEAT_REPEAT: @@ -743,7 +738,8 @@ bool html_redraw_background(int x, int y, switch (box->style->background_position.horz.pos) { case CSS_BACKGROUND_POSITION_PERCENT: x += (box->padding[LEFT] + box->width + - box->padding[RIGHT] - image_width) * + box->padding[RIGHT] - + box->background->width) * scale * box->style->background_position.horz. value.percent / 100; break; @@ -758,12 +754,13 @@ bool html_redraw_background(int x, int y, switch (box->style->background_position.vert.pos) { case CSS_BACKGROUND_POSITION_PERCENT: y += (box->padding[TOP] + box->height + - box->padding[BOTTOM] - image_height) * + box->padding[BOTTOM] - + box->background->height) * scale * box->style->background_position.vert. value.percent / 100; break; case CSS_BACKGROUND_POSITION_LENGTH: - y -= (int) (css_len2px(&box->style->background_position. + y += (int) (css_len2px(&box->style->background_position. vert.value.length, box->style) * scale); break; default: @@ -771,7 +768,9 @@ bool html_redraw_background(int x, int y, } /* and plot the image */ - return plot.bitmap_tile(x, y, image_width, image_height, + return plot.bitmap_tile(x, y, + box->background->width * scale, + box->background->height * scale, box->background->bitmap, background_colour, repeat_x, repeat_y); -- cgit v1.2.3