summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
Diffstat (limited to 'render')
-rw-r--r--render/box.c16
-rw-r--r--render/box.h2
2 files changed, 14 insertions, 4 deletions
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