From 87066f9f8dbad2416c53f70497aeb7c940ccb239 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 26 Apr 2017 20:48:54 +0100 Subject: simplify the browser window operations by removing scroll API The browser window scrollingAPI was duplicated in window operation table, this simplifies it to a single set_scroll API. --- include/netsurf/browser_window.h | 20 -------------------- include/netsurf/window.h | 31 +++++++++++++------------------ 2 files changed, 13 insertions(+), 38 deletions(-) (limited to 'include/netsurf') diff --git a/include/netsurf/browser_window.h b/include/netsurf/browser_window.h index c56cf5571..567e314c5 100644 --- a/include/netsurf/browser_window.h +++ b/include/netsurf/browser_window.h @@ -572,26 +572,6 @@ void browser_window_get_position(struct browser_window *bw, bool root, */ void browser_window_set_position(struct browser_window *bw, int x, int y); -/** - * Scroll the browser window to display the passed area - * - * \param bw browser window to scroll - * \param rect area to display - */ -void browser_window_scroll_visible(struct browser_window *bw, - const struct rect *rect); - -/** - * Set scroll offsets for a browser window. - * - * \param bw The browser window - * \param x The x scroll offset to set - * \param y The y scroll offset to set - * - * \todo Do we really need this and browser_window_scroll_visible? - * Ditto for gui_window_* variants. - */ -void browser_window_set_scroll(struct browser_window *bw, int x, int y); /** * Set drag type for a browser window, and inform front end diff --git a/include/netsurf/window.h b/include/netsurf/window.h index b9a68639c..81fc0676b 100644 --- a/include/netsurf/window.h +++ b/include/netsurf/window.h @@ -136,11 +136,20 @@ struct gui_window_table { /** * Set the scroll position of a browser window. * - * \param g gui_window to scroll - * \param sx point to place at top-left of window - * \param sy point to place at top-left of window + * scrolls the viewport to ensure the specified rectangle of + * the content is shown. + * If the rectangle is of zero size i.e. x0 == x1 and y0 == y1 + * the contents will be scrolled so the specified point in the + * content is at the top of the viewport. + * If the size of the rectangle is non zero the frontend may + * add padding or center the defined area or it may simply + * align as in the zero size rectangle + * + * \param gw gui_window to scroll + * \param rect The rectangle to ensure is shown. + * \return NSERROR_OK on success or apropriate error code. */ - void (*set_scroll)(struct gui_window *g, int sx, int sy); + nserror (*set_scroll)(struct gui_window *gw, const struct rect *rect); /** @@ -267,20 +276,6 @@ struct gui_window_table { */ nserror (*save_link)(struct gui_window *g, struct nsurl *url, const char *title); - /** - * Scrolls the specified area of a browser window into view. - * - * @todo investigate if this can be merged with set_scroll - * which is what the default implementation used by most - * toolkits uses. - * - * \param g gui_window to scroll - * \param x0 left point to ensure visible - * \param y0 bottom point to ensure visible - * \param x1 right point to ensure visible - * \param y1 top point to ensure visible - */ - void (*scroll_visible)(struct gui_window *g, int x0, int y0, int x1, int y1); /** * Starts drag scrolling of a browser window -- cgit v1.2.3