diff options
author | Adrian Lees <adrian@aemulor.com> | 2009-01-30 05:06:30 +0000 |
---|---|---|
committer | Adrian Lees <adrian@aemulor.com> | 2009-01-30 05:06:30 +0000 |
commit | 03a1aac36a914317e3d7d82912fd1d2147e07c80 (patch) | |
tree | 24a07872a5616afbbd5b4c811cb24f8f210a30bf /render | |
parent | daf8c22d1b005acde3831cbcba37835efa426fb8 (diff) | |
download | netsurf-03a1aac36a914317e3d7d82912fd1d2147e07c80.tar.gz netsurf-03a1aac36a914317e3d7d82912fd1d2147e07c80.tar.bz2 |
Selection- and link-related functions now on menu; other menu changes as per t's plan
svn path=/trunk/netsurf/; revision=6296
Diffstat (limited to 'render')
-rw-r--r-- | render/box.c | 30 | ||||
-rw-r--r-- | render/box.h | 1 |
2 files changed, 31 insertions, 0 deletions
diff --git a/render/box.c b/render/box.c index da82bf3f0..08272d166 100644 --- a/render/box.c +++ b/render/box.c @@ -482,6 +482,36 @@ struct box *box_object_at_point(struct content *c, int x, int y) /** + * Find the box containing an href 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_href_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 *href_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->href) + href_box = box; + } + + return href_box; +} + + +/** * Find a box based upon its id attribute. * * \param box box tree to search diff --git a/render/box.h b/render/box.h index 7bee3813d..5d31a198b 100644 --- a/render/box.h +++ b/render/box.h @@ -297,6 +297,7 @@ struct box *box_at_point(struct box *box, int x, int y, int *box_x, int *box_y, struct content **content); struct box *box_object_at_point(struct content *c, int x, int y); +struct box *box_href_at_point(struct content *c, int x, int y); struct box *box_find_by_id(struct box *box, const char *id); bool box_visible(struct box *box); void box_dump(FILE *stream, struct box *box, unsigned int depth); |