summaryrefslogtreecommitdiff
path: root/render/html_interaction.c
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2011-08-31 17:53:40 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2011-08-31 17:53:40 +0000
commit6e3e168d08a6d9ae12d33f65ffcdae20306e9d06 (patch)
tree1f8ac1f32f7ac9135df7bd6056096592ced5749f /render/html_interaction.c
parent5af7a9c03c71cae313853a3550d34c9f4e42f4f8 (diff)
downloadnetsurf-6e3e168d08a6d9ae12d33f65ffcdae20306e9d06.tar.gz
netsurf-6e3e168d08a6d9ae12d33f65ffcdae20306e9d06.tar.bz2
Avoid instance of using bw->current_content outside desktop/.
svn path=/trunk/netsurf/; revision=12690
Diffstat (limited to 'render/html_interaction.c')
-rw-r--r--render/html_interaction.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/render/html_interaction.c b/render/html_interaction.c
index 98fb4c9cb..ceea4bf08 100644
--- a/render/html_interaction.c
+++ b/render/html_interaction.c
@@ -48,6 +48,39 @@ static gui_pointer_shape get_pointer_shape(struct browser_window *bw,
struct box *box, bool imagemap);
static void html_box_drag_start(struct box *box, int x, int y);
+
+/**
+ * End overflow scroll scrollbar drags
+ *
+ * \param h html content's high level cache entry
+ * \param mouse state of mouse buttons and modifier keys
+ * \param x coordinate of mouse
+ * \param y coordinate of mouse
+ */
+static size_t html_selection_drag_end(struct html_content *html,
+ browser_mouse_state mouse, int x, int y, int dir)
+{
+ int pixel_offset;
+ struct box *box;
+ int dx, dy;
+ size_t idx = 0;
+
+ box = box_pick_text_box(html, x, y, dir, &dx, &dy);
+ if (box) {
+ plot_font_style_t fstyle;
+
+ font_plot_style_from_css(box->style, &fstyle);
+
+ nsfont.font_position_in_string(&fstyle, box->text, box->length,
+ dx, &idx, &pixel_offset);
+
+ idx += box->byte_offset;
+ }
+
+ return idx;
+}
+
+
/**
* Handle mouse tracking (including drags) in an HTML content window.
*
@@ -62,7 +95,6 @@ void html_mouse_track(struct content *c, struct browser_window *bw,
browser_mouse_state mouse, int x, int y)
{
html_content *html = (html_content*) c;
- hlcache_handle *h = bw->current_content;
if (bw->drag_type == DRAGGING_SELECTION && !mouse) {
int dir = -1;
@@ -71,7 +103,7 @@ void html_mouse_track(struct content *c, struct browser_window *bw,
if (selection_dragging_start(&html->sel))
dir = 1;
- idx = html_selection_drag_end(h, mouse, x, y, dir);
+ idx = html_selection_drag_end(html, mouse, x, y, dir);
if (idx != 0)
selection_track(&html->sel, mouse, idx);
@@ -88,7 +120,7 @@ void html_mouse_track(struct content *c, struct browser_window *bw,
if (selection_dragging_start(&html->sel))
dir = 1;
- box = box_pick_text_box(h, x, y, dir, &dx, &dy);
+ box = box_pick_text_box(html, x, y, dir, &dx, &dy);
if (box) {
int pixel_offset;
@@ -870,38 +902,6 @@ void html_overflow_scroll_drag_end(struct scrollbar *scrollbar,
/**
- * End overflow scroll scrollbar drags
- *
- * \param h html content's high level cache entry
- * \param mouse state of mouse buttons and modifier keys
- * \param x coordinate of mouse
- * \param y coordinate of mouse
- */
-size_t html_selection_drag_end(hlcache_handle *h, browser_mouse_state mouse,
- int x, int y, int dir)
-{
- int pixel_offset;
- struct box *box;
- int dx, dy;
- size_t idx = 0;
-
- box = box_pick_text_box(h, x, y, dir, &dx, &dy);
- if (box) {
- plot_font_style_t fstyle;
-
- font_plot_style_from_css(box->style, &fstyle);
-
- nsfont.font_position_in_string(&fstyle, box->text, box->length,
- dx, &idx, &pixel_offset);
-
- idx += box->byte_offset;
- }
-
- return idx;
-}
-
-
-/**
* Start drag scrolling the contents of a box
*
* \param box the box to be scrolled