mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-25 13:37:02 +03:00
Make box_at_point detection consider absolute children too
svn path=/trunk/netsurf/; revision=2651
This commit is contained in:
parent
553d6066d0
commit
58dc86655e
13
render/box.c
13
render/box.c
@ -211,7 +211,7 @@ void box_free(struct box *box)
|
|||||||
next = child->next;
|
next = child->next;
|
||||||
box_free(child);
|
box_free(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (child = box->absolute_children; child; child = next) {
|
for (child = box->absolute_children; child; child = next) {
|
||||||
next = child->next;
|
next = child->next;
|
||||||
box_free(child);
|
box_free(child);
|
||||||
@ -331,7 +331,16 @@ struct box *box_at_point(struct box *box, int x, int y,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* consider floats first, since they will often overlap other boxes */
|
/* consider absolute children first */
|
||||||
|
for (child = box->absolute_children; child; child = child->next) {
|
||||||
|
if (box_contains_point(child, x - bx, y - by)) {
|
||||||
|
*box_x = bx + child->x - child->scroll_x;
|
||||||
|
*box_y = by + child->y - child->scroll_y;
|
||||||
|
return child;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* consider floats second, since they will often overlap other boxes */
|
||||||
for (child = box->float_children; child; child = child->next_float) {
|
for (child = box->float_children; child; child = child->next_float) {
|
||||||
if (box_contains_point(child, x - bx, y - by)) {
|
if (box_contains_point(child, x - bx, y - by)) {
|
||||||
*box_x = bx + child->x - child->scroll_x;
|
*box_x = bx + child->x - child->scroll_x;
|
||||||
|
Loading…
Reference in New Issue
Block a user