diff options
author | Vincent Sanders <vince@kyllikki.org> | 2019-11-17 10:40:34 +0000 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2019-11-17 10:40:34 +0000 |
commit | 69236590d08edc9722f48753ebe52f7315cb6b69 (patch) | |
tree | 534139a05ad6512ddbc90c64bf46bc5157f11466 /content/handlers | |
parent | e34f9d3a387fba655a8dcc47d7659655dc4b5fb3 (diff) | |
download | netsurf-69236590d08edc9722f48753ebe52f7315cb6b69.tar.gz netsurf-69236590d08edc9722f48753ebe52f7315cb6b69.tar.bz2 |
change mouse action drag handling to use a more efficient dispatch
Diffstat (limited to 'content/handlers')
-rw-r--r-- | content/handlers/html/interaction.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/content/handlers/html/interaction.c b/content/handlers/html/interaction.c index 9e59aed3f..f68426e14 100644 --- a/content/handlers/html/interaction.c +++ b/content/handlers/html/interaction.c @@ -614,31 +614,34 @@ html_mouse_action(struct content *c, nserror res = NSERROR_OK; + /* handle open select menu */ if (html->visible_select_menu != NULL) { return mouse_action_select_menu(html, bw, mouse, x, y); } - if (html->drag_type == HTML_DRAG_SELECTION) { + /* handle content drag */ + switch (html->drag_type) { + case HTML_DRAG_SELECTION: return mouse_action_drag_selection(html, bw, mouse, x, y); - } - if (html->drag_type == HTML_DRAG_SCROLLBAR) { + case HTML_DRAG_SCROLLBAR: return mouse_action_drag_scrollbar(html, bw, mouse, x, y); - } - - if (html->drag_type == HTML_DRAG_TEXTAREA_SELECTION || - html->drag_type == HTML_DRAG_TEXTAREA_SCROLLBAR) { + case HTML_DRAG_TEXTAREA_SELECTION: + case HTML_DRAG_TEXTAREA_SCROLLBAR: return mouse_action_drag_textarea(html, bw, mouse, x, y); - } - if (html->drag_type == HTML_DRAG_CONTENT_SELECTION || - html->drag_type == HTML_DRAG_CONTENT_SCROLL) { + case HTML_DRAG_CONTENT_SELECTION: + case HTML_DRAG_CONTENT_SCROLL: return mouse_action_drag_content(html, bw, mouse, x, y); - } - /* Content related drags handled by now */ - assert(html->drag_type == HTML_DRAG_NONE); + case HTML_DRAG_NONE: + break; + + default: + /* Unknown content related drag type */ + assert(0); + } /* search the box tree for a link, imagemap, form control, or * box with scrollbars |