diff options
author | Vincent Sanders <vince@kyllikki.org> | 2014-11-02 15:46:42 +0000 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2014-11-02 15:46:42 +0000 |
commit | c31c4babe172ab581a3196536d47fc2558a01acd (patch) | |
tree | 62d8630490f7969d0e690ba881d7b956e53d7561 /desktop/browser.h | |
parent | 1794ac0d333acc61eda3424141d4722b7eab9a2b (diff) | |
download | netsurf-c31c4babe172ab581a3196536d47fc2558a01acd.tar.gz netsurf-c31c4babe172ab581a3196536d47fc2558a01acd.tar.bz2 |
Change contextual content retrieval to browser features.
Update the API which allows frontends to acquire the page features
(images, link urls or form elements) present at the given coordinates
within a browser window.
By making this an explicit browser_window API and using the browser.h
header for the associated data structure with a more appropriate API
naming the usage is much more obvious and contained.
Additionally the link url is now passed around as a nsurl stopping it
being converted from nsurl to text and back again several times.
Diffstat (limited to 'desktop/browser.h')
-rw-r--r-- | desktop/browser.h | 44 |
1 files changed, 35 insertions, 9 deletions
diff --git a/desktop/browser.h b/desktop/browser.h index 5a1d70d7b..1d896dd72 100644 --- a/desktop/browser.h +++ b/desktop/browser.h @@ -117,6 +117,27 @@ enum browser_window_nav_flags { }; /** + * Page features at a specific spatial location. + */ +struct browser_window_features { + /** URL of a link or NULL. */ + struct nsurl *link; + + /** Object at position or NULL. */ + struct hlcache_handle *object; + + /** handle of top level content. */ + struct hlcache_handle *main; + + /** type of form feature. */ + enum { + CTX_FORM_NONE, + CTX_FORM_TEXT, + CTX_FORM_FILE + } form_features; +}; + +/** * Create and open a new root browser window with the given page. * * \param flags Flags to control operation @@ -302,17 +323,22 @@ void browser_window_set_scale(struct browser_window *bw, float scale, bool all); float browser_window_get_scale(struct browser_window *bw); /** - * Get access to any content, link URLs and objects (images) currently - * at the given (x, y) coordinates. + * Get access to any page features at the given coordinates. * - * \param bw browser window to look inside - * \param x x-coordinate of point of interest - * \param y y-coordinate of point of interest - * \param data pointer to contextual_content struct. Its fields are updated - * with pointers to any relevent content, or set to NULL if none. + * Fetches page features like content, link URLs and objects (images) + * at the specified co-ordinates within the browsing context. + * + * Fields within the supplied features structure are updated with + * pointers to any relevent content, or set to NULL if none. + * + * \param[in] bw browser window to examine. + * \param[in] x x-coordinate of point of interest + * \param[in] y y-coordinate of point of interest + * \param[out] data Feature structure to update. + * \return NSERROR_OK or appropriate error code on faliure. */ -void browser_window_get_contextual_content(struct browser_window *bw, - int x, int y, struct contextual_content *data); +nserror browser_window_get_features(struct browser_window *bw, + int x, int y, struct browser_window_features *data); /** * Send a scroll request to a browser window at a particular point. The |