diff options
author | Vincent Sanders <vince@netsurf-browser.org> | 2018-05-11 13:15:17 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2018-05-11 13:18:54 +0100 |
commit | 216fb88f58227f94e87d9e9926b599161a8e65bb (patch) | |
tree | 67f7dd0a4ecaf28a7a37552c5c81193b7ba9a5bf /content/handlers/html/html_interaction.c | |
parent | dc9e7c989f1a259a8fee9a6e1a4c6be6186f7c31 (diff) | |
download | netsurf-216fb88f58227f94e87d9e9926b599161a8e65bb.tar.gz netsurf-216fb88f58227f94e87d9e9926b599161a8e65bb.tar.bz2 |
clean up html content handler header use
Improve header use in preperation for making browser window a corewindow
Diffstat (limited to 'content/handlers/html/html_interaction.c')
-rw-r--r-- | content/handlers/html/html_interaction.c | 74 |
1 files changed, 39 insertions, 35 deletions
diff --git a/content/handlers/html/html_interaction.c b/content/handlers/html/html_interaction.c index 898f55bc2..648d27467 100644 --- a/content/handlers/html/html_interaction.c +++ b/content/handlers/html/html_interaction.c @@ -294,6 +294,45 @@ html__image_coords_dom_user_data_handler(dom_node_operation operation, } } + +/** + * End overflow scroll scrollbar drags + * + * \param scrollbar scrollbar widget + * \param mouse state of mouse buttons and modifier keys + * \param x coordinate of mouse + * \param y coordinate of mouse + */ +static void +html_overflow_scroll_drag_end(struct scrollbar *scrollbar, + browser_mouse_state mouse, + int x, int y) +{ + int scroll_mouse_x, scroll_mouse_y, box_x, box_y; + struct html_scrollbar_data *data = scrollbar_get_data(scrollbar); + struct box *box; + + box = data->box; + box_coords(box, &box_x, &box_y); + + if (scrollbar_is_horizontal(scrollbar)) { + scroll_mouse_x = x - box_x; + scroll_mouse_y = y - (box_y + box->padding[TOP] + + box->height + box->padding[BOTTOM] - + SCROLLBAR_WIDTH); + scrollbar_mouse_drag_end(scrollbar, mouse, + scroll_mouse_x, scroll_mouse_y); + } else { + scroll_mouse_x = x - (box_x + box->padding[LEFT] + + box->width + box->padding[RIGHT] - + SCROLLBAR_WIDTH); + scroll_mouse_y = y - box_y; + scrollbar_mouse_drag_end(scrollbar, mouse, + scroll_mouse_x, scroll_mouse_y); + } +} + + /** * Handle mouse clicks and movements in an HTML content window. * @@ -1227,41 +1266,6 @@ void html_overflow_scroll_callback(void *client_data, } -/** - * End overflow scroll scrollbar drags - * - * \param scrollbar scrollbar widget - * \param mouse state of mouse buttons and modifier keys - * \param x coordinate of mouse - * \param y coordinate of mouse - */ -void html_overflow_scroll_drag_end(struct scrollbar *scrollbar, - browser_mouse_state mouse, int x, int y) -{ - int scroll_mouse_x, scroll_mouse_y, box_x, box_y; - struct html_scrollbar_data *data = scrollbar_get_data(scrollbar); - struct box *box; - - box = data->box; - box_coords(box, &box_x, &box_y); - - if (scrollbar_is_horizontal(scrollbar)) { - scroll_mouse_x = x - box_x; - scroll_mouse_y = y - (box_y + box->padding[TOP] + - box->height + box->padding[BOTTOM] - - SCROLLBAR_WIDTH); - scrollbar_mouse_drag_end(scrollbar, mouse, - scroll_mouse_x, scroll_mouse_y); - } else { - scroll_mouse_x = x - (box_x + box->padding[LEFT] + - box->width + box->padding[RIGHT] - - SCROLLBAR_WIDTH); - scroll_mouse_y = y - box_y; - scrollbar_mouse_drag_end(scrollbar, mouse, - scroll_mouse_x, scroll_mouse_y); - } -} - /* Documented in html_internal.h */ void html_set_drag_type(html_content *html, html_drag_type drag_type, union html_drag_owner drag_owner, const struct rect *rect) |