summaryrefslogtreecommitdiff
path: root/render/html.c
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2010-06-04 09:35:08 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2010-06-04 09:35:08 +0000
commitb010a257712b3d104035cbfc15aba8f517ffacb5 (patch)
treeba220c9c0c2c02ea1a8441ad8ace44d4c0bc5164 /render/html.c
parentbc9fef0a1a7a45a640d37353f97e72006e1e09b6 (diff)
downloadnetsurf-b010a257712b3d104035cbfc15aba8f517ffacb5.tar.gz
netsurf-b010a257712b3d104035cbfc15aba8f517ffacb5.tar.bz2
+ 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
Diffstat (limited to 'render/html.c')
-rw-r--r--render/html.c45
1 files changed, 45 insertions, 0 deletions
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 <bursa@users.sourceforge.net>
+ * Copyright 2010 Michael Drake <tlsa@netsurf-browser.org>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -1741,6 +1742,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;
+}