diff options
Diffstat (limited to 'render/box.c')
-rw-r--r-- | render/box.c | 16 |
1 files changed, 16 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; + } +} + |