From e851bbcf37cc72afe07d1294331abb636272064a Mon Sep 17 00:00:00 2001 From: James Bursa Date: Wed, 3 Sep 2003 17:52:45 +0000 Subject: [project @ 2003-09-03 17:52:45 by bursa] Add box_coords(). svn path=/import/netsurf/; revision=264 --- render/box.c | 16 ++++++++++++++++ render/box.h | 1 + 2 files changed, 17 insertions(+) (limited to 'render') diff --git a/render/box.c b/render/box.c index 256b5c0bf..e13282e9b 100644 --- a/render/box.c +++ b/render/box.c @@ -1832,3 +1832,19 @@ bool plugin_decode(struct content* content, char* url, struct box* box, return true; } + +/** + * Find the absolute coordinates of a box. + */ + +void box_coords(struct box *box, unsigned long *x, unsigned long *y) +{ + *x = box->x; + *y = box->y; + while (box->parent != 0) { + box = box->parent; + *x += box->x; + *y += box->y; + } +} + diff --git a/render/box.h b/render/box.h index 177c1395b..a00daee48 100644 --- a/render/box.h +++ b/render/box.h @@ -167,5 +167,6 @@ struct page_elements void xml_to_box(xmlNode *n, struct content *c); void box_dump(struct box * box, unsigned int depth); void box_free(struct box *box); +void box_coords(struct box *box, unsigned long *x, unsigned long *y); #endif -- cgit v1.2.3