diff options
author | James Bursa <james@netsurf-browser.org> | 2003-09-03 17:52:45 +0000 |
---|---|---|
committer | James Bursa <james@netsurf-browser.org> | 2003-09-03 17:52:45 +0000 |
commit | e851bbcf37cc72afe07d1294331abb636272064a (patch) | |
tree | 62abba013c162df0deb6748813f3c0782077a4e6 /render | |
parent | cdf0601420e087afd14aabca4b00224b59f0660a (diff) | |
download | netsurf-e851bbcf37cc72afe07d1294331abb636272064a.tar.gz netsurf-e851bbcf37cc72afe07d1294331abb636272064a.tar.bz2 |
[project @ 2003-09-03 17:52:45 by bursa]
Add box_coords().
svn path=/import/netsurf/; revision=264
Diffstat (limited to 'render')
-rw-r--r-- | render/box.c | 16 | ||||
-rw-r--r-- | render/box.h | 1 |
2 files changed, 17 insertions, 0 deletions
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 |