diff options
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 |