From b010a257712b3d104035cbfc15aba8f517ffacb5 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Fri, 4 Jun 2010 09:35:08 +0000 Subject: + Refactor input handling from browser window code into content handlers. + Disentangle all box tree manipulation from browser window code and put it where it belongs. + Move other content specific and other irrelevant code from browser window handling to appropriate places. + Put mouse state enum in new mouse header, since it's not just used by browser window code, and it is used by treeview windows on the treeview branch. svn path=/trunk/netsurf/; revision=10561 --- render/html.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'render/html.c') diff --git a/render/html.c b/render/html.c index c818d6e36..9367d78fb 100644 --- a/render/html.c +++ b/render/html.c @@ -1,5 +1,6 @@ /* * Copyright 2007 James Bursa + * Copyright 2010 Michael Drake * * This file is part of NetSurf, http://www.netsurf-browser.org/ * @@ -1740,6 +1741,25 @@ void html_reformat(struct content *c, int width, int height) } +/** + * Redraw a box. + * + * \param c content containing the box, of type CONTENT_HTML + * \param box box to redraw + */ + +void html_redraw_a_box(hlcache_handle *h, struct box *box) +{ + int x, y; + + box_coords(box, &x, &y); + + content_request_redraw(h, x, y, + box->padding[LEFT] + box->width + box->padding[RIGHT], + box->padding[TOP] + box->height + box->padding[BOTTOM]); +} + + /** * Destroy a CONTENT_HTML and free all resources it owns. */ @@ -2190,3 +2210,28 @@ hlcache_handle *html_get_favicon(hlcache_handle *h) return c->data.html.favicon; } + + +/** + * Retrieve layout coordinates of box with given id + * + * \param h HTML document to search + * \param frag_id String containing an element id + * \param x Updated to global x coord iff id found + * \param y Updated to global y coord iff id found + * \return true iff id found + */ +bool html_get_id_offset(hlcache_handle *h, char *frag_id, int *x, int *y) +{ + struct box *pos; + struct box *layout = html_get_box_tree(h); + + if (content_get_type(h) != CONTENT_HTML) + return false; + + if ((pos = box_find_by_id(layout, frag_id)) != 0) { + box_coords(pos, x, y); + return true; + } + return false; +} -- cgit v1.2.3