From 330a3bb64c58ff12d8ac7d08de74f3064c670a75 Mon Sep 17 00:00:00 2001 From: James Bursa Date: Mon, 26 Apr 2004 13:45:52 +0000 Subject: [project @ 2004-04-26 13:45:52 by bursa] Fix box_coords(). svn path=/import/netsurf/; revision=804 --- render/box.c | 16 +++++++++++++--- render/box.h | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'render') diff --git a/render/box.c b/render/box.c index c7edf9e7e..5ba11d26f 100644 --- a/render/box.c +++ b/render/box.c @@ -2281,14 +2281,24 @@ bool plugin_decode(struct content* content, char* url, struct box* box, /** * Find the absolute coordinates of a box. + * + * \param box the box to calculate coordinates of + * \param x updated to x coordinate + * \param y updated to y coordinate */ -void box_coords(struct box *box, unsigned long *x, unsigned long *y) +void box_coords(struct box *box, int *x, int *y) { *x = box->x; *y = box->y; - while (box->parent != 0) { - box = box->parent; + while (box->parent) { + if (box->type == BOX_FLOAT_LEFT || + box->type == BOX_FLOAT_RIGHT) { + do { + box = box->parent; + } while (!box->float_children); + } else + box = box->parent; *x += box->x; *y += box->y; } diff --git a/render/box.h b/render/box.h index d807e430c..0b1831c6f 100644 --- a/render/box.h +++ b/render/box.h @@ -212,6 +212,6 @@ struct box * box_create(struct css_style * style, void box_add_child(struct box * parent, struct box * child); void box_insert_sibling(struct box *box, struct box *new_box); void box_free(struct box *box); -void box_coords(struct box *box, unsigned long *x, unsigned long *y); +void box_coords(struct box *box, int *x, int *y); #endif -- cgit v1.2.3