summaryrefslogtreecommitdiff
path: root/render/html_redraw.c
diff options
context:
space:
mode:
authorRichard Wilson <rjw@netsurf-browser.org>2005-03-23 18:14:38 +0000
committerRichard Wilson <rjw@netsurf-browser.org>2005-03-23 18:14:38 +0000
commit511891d27c94afc892ecc0d203a39827cb834e78 (patch)
tree58da177b9f957b5eed4fd28d0c7c83ddb21d1f0e /render/html_redraw.c
parentc16c3ffa2f478b7432c5641b15e713356419dc36 (diff)
downloadnetsurf-511891d27c94afc892ecc0d203a39827cb834e78.tar.gz
netsurf-511891d27c94afc892ecc0d203a39827cb834e78.tar.bz2
[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
Diffstat (limited to 'render/html_redraw.c')
-rw-r--r--render/html_redraw.c17
1 files changed, 8 insertions, 9 deletions
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);