From 4075648e7a6c2c0881ecb758d61a461ea303789b Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Tue, 6 Sep 2011 18:07:30 +0000 Subject: Content interface to get at contextual content at point. svn path=/trunk/netsurf/; revision=12753 --- content/content.c | 16 ++++++++++++++++ content/content.h | 2 ++ content/content_protected.h | 2 ++ 3 files changed, 20 insertions(+) (limited to 'content') diff --git a/content/content.c b/content/content.c index 4c87f0eb5..f2d06b639 100644 --- a/content/content.c +++ b/content/content.c @@ -701,6 +701,22 @@ struct selection *content_get_selection(hlcache_handle *h) } +void content_get_contextual_content(struct hlcache_handle *h, + int x, int y, struct contextual_content *data) +{ + struct content *c = hlcache_handle_get_content(h); + assert(c != 0); + + if (c->handler->get_contextual_content != NULL) { + c->handler->get_contextual_content(c, x, y, data); + return; + } else { + data->object = h; + return; + } +} + + void content_add_error(struct content *c, const char *token, unsigned int line) { diff --git a/content/content.h b/content/content.h index 1b2a8d097..21c8954c9 100644 --- a/content/content.h +++ b/content/content.h @@ -158,6 +158,8 @@ void content_open(struct hlcache_handle *h, struct browser_window *bw, struct object_params *params); void content_close(struct hlcache_handle *h); struct selection *content_get_selection(struct hlcache_handle *h); +void content_get_contextual_content(struct hlcache_handle *h, + int x, int y, struct contextual_content *data); /* Member accessors */ content_type content_get_type(struct hlcache_handle *c); diff --git a/content/content_protected.h b/content/content_protected.h index a1d6c7076..d9a021f3e 100644 --- a/content/content_protected.h +++ b/content/content_protected.h @@ -65,6 +65,8 @@ struct content_handler { struct object_params *params); void (*close)(struct content *c); struct selection * (*get_selection)(struct content *c); + void (*get_contextual_content)(struct content *c, int x, int y, + struct contextual_content *data); nserror (*clone)(const struct content *old, struct content **newc); bool (*matches_quirks)(const struct content *c, bool quirks); content_type (*type)(void); -- cgit v1.2.3