From 6efe60ee1d00d61362a52c92b2c6404b88321769 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sun, 11 Sep 2016 12:19:56 +0100 Subject: simplify box_extract_link interface and improve documentation --- render/box.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'render/box.h') diff --git a/render/box.h b/render/box.h index c3f95c21c..79ff44da2 100644 --- a/render/box.h +++ b/render/box.h @@ -100,6 +100,7 @@ struct object_param; struct html_content; struct nsurl; struct dom_node; +struct dom_string; struct rect; #define UNKNOWN_WIDTH INT_MAX @@ -334,8 +335,18 @@ struct box *box_pick_text_box(struct html_content *html, struct box *box_find_by_id(struct box *box, lwc_string *id); bool box_visible(struct box *box); void box_dump(FILE *stream, struct box *box, unsigned int depth, bool style); -bool box_extract_link(const struct html_content *content, - const char *rel, struct nsurl *base, struct nsurl **result); + +/** + * Extract a URL from a relative link, handling junk like whitespace and + * attempting to read a real URL from "javascript:" links. + * + * \param content html content + * \param ds rel relative URL text taken from page + * \param base base for relative URLs + * \param result updated to target URL on heap, unchanged if extract failed + * \return true on success, false on memory exhaustion + */ +bool box_extract_link(const struct html_content *content, const struct dom_string *dsrel, struct nsurl *base, struct nsurl **result); bool box_handle_scrollbars(struct content *c, struct box *box, bool bottom, bool right); -- cgit v1.2.3