Make box_at_point detection consider absolute children too

svn path=/trunk/netsurf/; revision=2651
This commit is contained in:
John Mark Bell 2006-06-26 20:16:24 +00:00
parent 553d6066d0
commit 58dc86655e

View File

@ -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;