From 58e2d033ece8c60f495ddba9a93ecab793a7a50f Mon Sep 17 00:00:00 2001 From: James Bursa Date: Sun, 18 Jul 2004 17:38:01 +0000 Subject: [project @ 2004-07-18 17:38:01 by bursa] Improve form control interaction code. Replace box_under_area() with simpler box_at_point(). Detect objects for menu once on menu opening. Remove obsolete text selection code. svn path=/import/netsurf/; revision=1096 --- render/box.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'render/box.c') diff --git a/render/box.c b/render/box.c index ef3b60283..145c3a18b 100644 --- a/render/box.c +++ b/render/box.c @@ -2785,3 +2785,33 @@ struct box *box_at_point(struct box *box, int x, int y, return 0; } + + +/** + * Find the box containing an object at the given coordinates, if any. + * + * \param c content to search, must have type CONTENT_HTML + * \param x coordinates in document units + * \param y coordinates in document units + */ + +struct box *box_object_at_point(struct content *c, int x, int y) +{ + struct box *box = c->data.html.layout; + int box_x = 0, box_y = 0; + struct content *content = c; + struct box *object_box = 0; + + assert(c->type == CONTENT_HTML); + + while ((box = box_at_point(box, x, y, &box_x, &box_y, &content))) { + if (box->style && + box->style->visibility == CSS_VISIBILITY_HIDDEN) + continue; + + if (box->object) + object_box = box; + } + + return object_box; +} -- cgit v1.2.3