diff options
author | Richard Wilson <rjw@netsurf-browser.org> | 2004-06-23 22:53:50 +0000 |
---|---|---|
committer | Richard Wilson <rjw@netsurf-browser.org> | 2004-06-23 22:53:50 +0000 |
commit | 958f5828d130ec9a219616fbf0447e2b316cf132 (patch) | |
tree | 7156c287fd60dc88f49f01a3fb0035eb868b6ae2 | |
parent | ce0285328afa1b51433d050d7e581a4927ef520a (diff) | |
download | netsurf-958f5828d130ec9a219616fbf0447e2b316cf132.tar.gz netsurf-958f5828d130ec9a219616fbf0447e2b316cf132.tar.bz2 |
[project @ 2004-06-23 22:53:50 by rjw]
Bug fix for vertical positioning.
Padding is now taken into account for %age calculations.
Fix for calculations using internal units rather than OS units.
svn path=/import/netsurf/; revision=1000
-rw-r--r-- | riscos/htmlredraw.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/riscos/htmlredraw.c b/riscos/htmlredraw.c index ca3997d43..9c599a235 100644 --- a/riscos/htmlredraw.c +++ b/riscos/htmlredraw.c @@ -592,11 +592,8 @@ void html_redraw_background(long xi, long yi, int width, int height, } /* Get the image dimensions for our positioning and scaling */ - image_size.x = box->background->width; - image_size.y = box->background->height; - ro_convert_pixels_to_os_units(&image_size, (os_mode)-1); - image_width = image_size.x * scale; - image_height = image_size.y * scale; + image_size.x = box->background->width * scale; + image_size.y = box->background->height * scale; /* handle background-attachment */ switch (box->style->background_attachment) { @@ -643,13 +640,11 @@ void html_redraw_background(long xi, long yi, int width, int height, /* handle background-position */ switch (box->style->background_position.horz.pos) { case CSS_BACKGROUND_POSITION_PERCENT: - multiplier = - box->style->background_position.horz.value.percent / 100; - x += (box->width * multiplier) - - (box->background->width * scale * multiplier); + multiplier = box->style->background_position.horz.value.percent / 100; + x += 2 * (box->width + box->padding[LEFT] + box->padding[RIGHT] - image_size.x) * multiplier; break; case CSS_BACKGROUND_POSITION_LENGTH: - x += len(&box->style->background_position.horz.value.length, box->style) * scale; + x += 2 * len(&box->style->background_position.horz.value.length, box->style) * scale; break; default: break; @@ -657,13 +652,11 @@ void html_redraw_background(long xi, long yi, int width, int height, switch (box->style->background_position.vert.pos) { case CSS_BACKGROUND_POSITION_PERCENT: - multiplier = - box->style->background_position.vert.value.percent / 100; - y += (box->height * multiplier) - - (box->background->height * scale * multiplier); + multiplier = box->style->background_position.vert.value.percent / 100; + y -= 2 * (box->height + box->padding[TOP] + box->padding[BOTTOM] - image_size.y) * multiplier; break; case CSS_BACKGROUND_POSITION_LENGTH: - y += len(&box->style->background_position.vert.value.length, box->style) * scale; + y -= 2 * len(&box->style->background_position.vert.value.length, box->style) * scale; break; default: break; @@ -671,6 +664,11 @@ void html_redraw_background(long xi, long yi, int width, int height, // LOG(("Body [%ld, %ld], Image: [%ld, %ld], Flags: %x", xi, yi, x, y, tinct_options)); + /* convert our sizes into OS units */ +// ro_convert_pixels_to_os_units(&image_size, (os_mode)-1); + image_width = image_size.x * 2; + image_height = image_size.y * 2; + /* and plot the image */ switch (box->background->type) { #ifdef WITH_PNG |