NetSurf
Data Structures | Functions
interaction.c File Reference

implementation of user interaction with a CONTENT_HTML. More...

#include <assert.h>
#include <stdbool.h>
#include <string.h>
#include <dom/dom.h>
#include "utils/corestrings.h"
#include "utils/messages.h"
#include "utils/utils.h"
#include "utils/log.h"
#include "utils/nsoption.h"
#include "netsurf/content.h"
#include "netsurf/browser_window.h"
#include "netsurf/mouse.h"
#include "netsurf/misc.h"
#include "netsurf/layout.h"
#include "netsurf/keypress.h"
#include "content/hlcache.h"
#include "content/textsearch.h"
#include "desktop/frames.h"
#include "desktop/scrollbar.h"
#include "desktop/selection.h"
#include "desktop/textarea.h"
#include "javascript/js.h"
#include "desktop/gui_internal.h"
#include "html/box.h"
#include "html/box_textarea.h"
#include "html/box_inspect.h"
#include "html/font.h"
#include "html/form_internal.h"
#include "html/private.h"
#include "html/imagemap.h"
#include "html/interaction.h"
Include dependency graph for interaction.c:

Go to the source code of this file.

Data Structures

struct  mouse_action_state
 local structure containing all the mouse action state information More...
 

Functions

static browser_pointer_shape get_pointer_shape (struct box *box, bool imagemap)
 Get pointer shape for given box. More...
 
static void html_box_drag_start (struct box *box, int x, int y)
 Start drag scrolling the contents of a box. More...
 
static size_t html_selection_drag_end (struct html_content *html, browser_mouse_state mouse, int x, int y, int dir)
 End overflow scroll scrollbar drags. More...
 
static void html__image_coords_dom_user_data_handler (dom_node_operation operation, dom_string *key, void *_data, struct dom_node *src, struct dom_node *dst)
 Helper for file gadgets to store their filename. More...
 
static void html_overflow_scroll_drag_end (struct scrollbar *scrollbar, browser_mouse_state mouse, int x, int y)
 End overflow scroll scrollbar drags. More...
 
static nserror mouse_action_select_menu (html_content *html, struct browser_window *bw, browser_mouse_state mouse, int x, int y)
 handle html mouse action when select menu is open More...
 
static nserror mouse_action_drag_selection (html_content *html, struct browser_window *bw, browser_mouse_state mouse, int x, int y)
 handle html mouse action when a selection drag is being performed More...
 
static nserror mouse_action_drag_scrollbar (html_content *html, struct browser_window *bw, browser_mouse_state mouse, int x, int y)
 handle html mouse action when a scrollbar drag is being performed More...
 
static nserror mouse_action_drag_textarea (html_content *html, struct browser_window *bw, browser_mouse_state mouse, int x, int y)
 handle mouse actions while dragging in a text area More...
 
static nserror mouse_action_drag_content (html_content *html, struct browser_window *bw, browser_mouse_state mouse, int x, int y)
 handle mouse actions while dragging in a content More...
 
static nserror get_mouse_action_node (html_content *html, int x, int y, struct mouse_action_state *man)
 iterate the box tree for deepest node at coordinates More...
 
static nserror gadget_mouse_action (html_content *html, browser_mouse_state mouse, int x, int y, struct mouse_action_state *mas)
 process mouse activity on a form gadget More...
 
static nserror iframe_mouse_action (struct browser_window *bw, browser_mouse_state mouse, int x, int y, struct mouse_action_state *mas)
 process mouse activity on an iframe More...
 
static nserror html_object_mouse_action (html_content *html, struct browser_window *bw, browser_mouse_state mouse, int x, int y, struct mouse_action_state *mas)
 process mouse activity on an html object More...
 
static bool is_javascript_navigate_url (nsurl *url)
 determine if a url has a javascript scheme More...
 
static nserror link_mouse_action (html_content *html, struct browser_window *bw, browser_mouse_state mouse, int x, int y, struct mouse_action_state *mas)
 process mouse activity on a link More...
 
static nserror default_mouse_action (html_content *html, struct browser_window *bw, browser_mouse_state mouse, int x, int y, struct mouse_action_state *mas)
 process mouse activity if it is not anything else More...
 
static nserror mouse_action_drag_none (html_content *html, struct browser_window *bw, browser_mouse_state mouse, int x, int y)
 handle non dragging mouse actions More...
 
nserror html_mouse_track (struct content *c, struct browser_window *bw, browser_mouse_state mouse, int x, int y)
 Handle mouse tracking (including drags) in an HTML content window. More...
 
nserror html_mouse_action (struct content *c, struct browser_window *bw, browser_mouse_state mouse, int x, int y)
 Handle mouse clicks and movements in an HTML content window. More...
 
bool html_keypress (struct content *c, uint32_t key)
 Handle keypresses. More...
 
void html_overflow_scroll_callback (void *client_data, struct scrollbar_msg_data *scrollbar_data)
 Callback for in-page scrollbars. More...
 
void html_set_drag_type (html_content *html, html_drag_type drag_type, union html_drag_owner drag_owner, const struct rect *rect)
 Set our drag status, and inform whatever owns the content. More...
 
void html_set_focus (html_content *html, html_focus_type focus_type, union html_focus_owner focus_owner, bool hide_caret, int x, int y, int height, const struct rect *clip)
 Set our input focus, and inform whatever owns the content. More...
 
void html_set_selection (html_content *html, html_selection_type selection_type, union html_selection_owner selection_owner, bool read_only)
 Set our selection status, and inform whatever owns the content. More...
 

Detailed Description

implementation of user interaction with a CONTENT_HTML.

Definition in file interaction.c.

Function Documentation

◆ default_mouse_action()

static nserror default_mouse_action ( html_content html,
struct browser_window bw,
browser_mouse_state  mouse,
int  x,
int  y,
struct mouse_action_state mas 
)
static

process mouse activity if it is not anything else

Definition at line 1169 of file interaction.c.

References mouse_action_state::box, mouse_action_state::box_x, BROWSER_MOUSE_CLICK_1, BROWSER_MOUSE_CLICK_2, BROWSER_MOUSE_DRAG_1, BROWSER_MOUSE_DRAG_2, BROWSER_MOUSE_MOD_1, BROWSER_MOUSE_MOD_2, BROWSER_MOUSE_PRESS_1, BROWSER_MOUSE_PRESS_2, BROWSER_POINTER_MOVE, browser_window_frame_resize_start(), browser_window_page_drag_start(), html_content::bw, box::byte_offset, content_msg_data::content, content_broadcast(), CONTENT_MSG_DRAGSAVE, content_msg_data::CONTENT_SAVE_COMPLETE, content_msg_data::CONTENT_SAVE_SOURCE, mouse_action_state::drag_candidate, content_msg_data::dragsave, html_content::focus_type, font_plot_style_from_css(), guit, html_box_drag_start(), HTML_DRAG_SELECTION, HTML_FOCUS_SELF, HTML_SELECTION_NONE, HTML_SELECTION_SELF, html_set_drag_type(), html_set_focus(), html_set_selection(), netsurf_table::layout, box::length, messages_get(), html_drag_owner::no_owner, html_selection_owner::none, NSERROR_OK, mouse_action_state::pointer, gui_layout_table::position, mouse_action_state::result, html_content::sel, selection_active(), selection_clear(), selection_click(), selection_dragging(), html_content::selection_type, html_focus_owner::self, mouse_action_state::status, box::style, box::text, mouse_action_state::text, mouse_action_state::title, content_msg_data::type, html_content::unit_len_ctx, content_msg_data::x, and content_msg_data::y.

Referenced by mouse_action_drag_none().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gadget_mouse_action()

static nserror gadget_mouse_action ( html_content html,
browser_mouse_state  mouse,
int  x,
int  y,
struct mouse_action_state mas 
)
static

process mouse activity on a form gadget

Todo:
Find a way to not ignore errors

Definition at line 824 of file interaction.c.

References form::action, mouse_action_state::action, mouse_action_state::box, mouse_action_state::box_x, mouse_action_state::box_y, BROWSER_MOUSE_CLICK_1, BROWSER_MOUSE_CLICK_2, BROWSER_MOUSE_DRAG_1, BROWSER_MOUSE_DRAG_2, BROWSER_MOUSE_PRESS_1, BROWSER_MOUSE_PRESS_2, BROWSER_POINTER_DEFAULT, BROWSER_POINTER_MENU, content_broadcast(), CONTENT_MSG_GADGETCLICK, CONTENT_MSG_SELECTMENU, mouse_action_state::control, form_control::data, fallthrough, form_control::form, form_open_select_menu(), form_radio_set(), form_select_menu_callback(), content_msg_data::gadget, mouse_action_state::gadget, GADGET_BUTTON, GADGET_CHECKBOX, content_msg_data::gadget_click, GADGET_FILE, GADGET_HIDDEN, GADGET_IMAGE, GADGET_PASSWORD, GADGET_RADIO, GADGET_RESET, GADGET_SELECT, GADGET_SUBMIT, GADGET_TEXTAREA, GADGET_TEXTBOX, get_pointer_shape(), html__image_coords_dom_user_data_handler(), html__redraw_a_box(), HTML_SELECTION_NONE, HTML_SELECTION_TEXTAREA, html_set_selection(), messages_get(), messages_get_errorcode(), form_control::node, html_selection_owner::none, NSERROR_OK, NSLOG, nsoption_bool, mouse_action_state::pointer, mouse_action_state::result, scrollbar_mouse_status_to_message(), content_msg_data::select_menu, form_control::selected, html_content::selection_owner, html_content::selection_type, mouse_action_state::status, html_selection_owner::textarea, textarea_mouse_action(), TEXTAREA_MOUSE_EDITOR, form_control::type, html_content::visible_select_menu, image_input_coords::x, and image_input_coords::y.

Referenced by mouse_action_drag_none().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_mouse_action_node()

static nserror get_mouse_action_node ( html_content html,
int  x,
int  y,
struct mouse_action_state man 
)
static

iterate the box tree for deepest node at coordinates

extracts mouse action node information by descending through visible boxes setting more specific values for:

box - deepest box at point html_object_box - html object html_object_pos_x - html object html_object_pos_y - html object object - non html object iframe - iframe url - href or imagemap target - href or imagemap or gadget url_box - href or imagemap imagemap - imagemap gadget - gadget gadget_box - gadget gadget_box_x - gadget gadget_box_y - gadget title - title pointer

drag_candidate - first box with scroll padding_left - box with scroll padding_right padding_top padding_bottom scrollbar - inside padding box stops decent scroll_mouse_x - inside padding box stops decent scroll_mouse_y - inside padding box stops decent

text_box - text box text_box_x - text_box

Definition at line 671 of file interaction.c.

References mouse_action_state::bar, BOTTOM, mouse_action_state::box, box_at_point(), mouse_action_state::box_x, mouse_action_state::box_y, BROWSER_POINTER_DEFAULT, content_get_type(), CONTENT_HTML, mouse_action_state::control, mouse_action_state::drag_candidate, form_control::form, box::gadget, mouse_action_state::gadget, get_pointer_shape(), box::height, box::href, mouse_action_state::html_object, box::iframe, mouse_action_state::iframe, imagemap_get(), mouse_action_state::is_imagemap, html_content::layout, LEFT, mouse_action_state::link, box::margin, mouse_action_state::mouse_x, mouse_action_state::mouse_y, box::node, mouse_action_state::node, NSERROR_OK, box::object, mouse_action_state::object, box::padding, mouse_action_state::pointer, mouse_action_state::pos_x, mouse_action_state::pos_y, mouse_action_state::result, RIGHT, mouse_action_state::scroll, box::scroll_x, box::scroll_y, scrollbar_get_offset(), SCROLLBAR_WIDTH, box::style, box::target, form::target, mouse_action_state::target, box::text, mouse_action_state::text, box::title, mouse_action_state::title, TOP, html_content::unit_len_ctx, mouse_action_state::url, box::usemap, box::width, box::x, and box::y.

Referenced by mouse_action_drag_none().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_pointer_shape()

static browser_pointer_shape get_pointer_shape ( struct box box,
bool  imagemap 
)
static

◆ html__image_coords_dom_user_data_handler()

static void html__image_coords_dom_user_data_handler ( dom_node_operation  operation,
dom_string *  key,
void *  _data,
struct dom_node *  src,
struct dom_node *  dst 
)
static

Helper for file gadgets to store their filename.

Stores the filename unencoded on the dom node associated with the gadget.

Todo:
Get rid of this crap eventually
Parameters
operationDOM operation
keyDOM node key being considerd
_dataThe data assocated with the key
srcThe source DOM node.
dstThe destination DOM node.

Definition at line 241 of file interaction.c.

References html__image_coords_dom_user_data_handler(), and NSLOG.

Referenced by gadget_mouse_action(), and html__image_coords_dom_user_data_handler().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ html_box_drag_start()

static void html_box_drag_start ( struct box box,
int  x,
int  y 
)
static

Start drag scrolling the contents of a box.

Parameters
boxthe box to be scrolled
xx ordinate of initial mouse position
yy ordinate

Definition at line 167 of file interaction.c.

References BOTTOM, box_coords(), box::height, LEFT, box::padding, RIGHT, box::scroll_x, box::scroll_y, scrollbar_start_content_drag(), SCROLLBAR_WIDTH, TOP, and box::width.

Referenced by default_mouse_action().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ html_keypress()

bool html_keypress ( struct content c,
uint32_t  key 
)

Handle keypresses.

Parameters
ccontent of type HTML
keyThe UCS4 character codepoint
Returns
true if key handled, false otherwise
Todo:
At the moment, the front end interface for keypress only gives us a UCS4 key value. This doesn't doesn't have all the information we need to fill out the event properly. We don't get to know about modifier keys, and things like CTRL+C are passed in as NS_KEY_COPY_SELECTION, a magic value outside the valid Unicode range.

We need to:

  1. Update the front end interface so that both press and release events reach the core.
  2. Stop encoding the special keys like NS_KEY_COPY_SELECTION as magic values in the front ends, so we just get the events, e.g.:
    1. Press ctrl
    2. Press c
    3. Release c
    4. Release ctrl
  3. Pass all the new info to the DOM KeyboardEvent events.
  4. If there is a focused element, fire the event at that, instead of html->layout->node.
  5. Rebuild the NS_KEY_COPY_SELECTION values from the info we now get given, and use that for the code below this fire_dom_keyboard_event call.
  6. Move the code after this fire_dom_keyboard_event call into the default action handler for DOM events.

This will mean that if the JavaScript event listener does event.preventDefault() then we won't handle the event when we're not supposed to.

Definition at line 1519 of file interaction.c.

References box_textarea_keypress(), html_focus_owner::content, content_keypress(), fire_dom_keyboard_event(), html_content::focus_owner, html_content::focus_type, HTML_FOCUS_CONTENT, HTML_FOCUS_TEXTAREA, html_content::layout, box::node, NS_KEY_CLEAR_SELECTION, NS_KEY_COPY_SELECTION, NS_KEY_ESCAPE, NS_KEY_SELECT_ALL, NSERROR_OK, box::object, html_content::sel, selection_clear(), selection_copy_to_clipboard(), selection_select_all(), and html_focus_owner::textarea.

Here is the call graph for this function:

◆ html_mouse_action()

nserror html_mouse_action ( struct content c,
struct browser_window bw,
browser_mouse_state  mouse,
int  x,
int  y 
)

Handle mouse clicks and movements in an HTML content window.

This function handles both hovering and clicking. It is important that the code path is identical (except that hovering doesn't carry out the action), so that the status bar reflects exactly what will happen. Having separate code paths opens the possibility that an attacker will make the status bar show some harmless action where clicking will be harmful.

Parameters
ccontent of type html
bwbrowser window
mousestate of mouse buttons and modifier keys
xx coordinate of mouse
yy coordinate of mouse
Returns
NSERROR_OK or appropriate error code.

Definition at line 1462 of file interaction.c.

References html_content::drag_type, HTML_DRAG_CONTENT_SCROLL, HTML_DRAG_CONTENT_SELECTION, HTML_DRAG_NONE, HTML_DRAG_SCROLLBAR, HTML_DRAG_SELECTION, HTML_DRAG_TEXTAREA_SCROLLBAR, HTML_DRAG_TEXTAREA_SELECTION, messages_get_errorcode(), mouse_action_drag_content(), mouse_action_drag_none(), mouse_action_drag_scrollbar(), mouse_action_drag_selection(), mouse_action_drag_textarea(), mouse_action_select_menu(), NSERROR_OK, NSLOG, and html_content::visible_select_menu.

Referenced by html_mouse_track().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ html_mouse_track()

nserror html_mouse_track ( struct content c,
struct browser_window bw,
browser_mouse_state  mouse,
int  x,
int  y 
)

Handle mouse tracking (including drags) in an HTML content window.

Parameters
ccontent of type html
bwbrowser window
mousestate of mouse buttons and modifier keys
xcoordinate of mouse
ycoordinate of mouse

Definition at line 1451 of file interaction.c.

References html_mouse_action().

Here is the call graph for this function:

◆ html_object_mouse_action()

static nserror html_object_mouse_action ( html_content html,
struct browser_window bw,
browser_mouse_state  mouse,
int  x,
int  y,
struct mouse_action_state mas 
)
static

process mouse activity on an html object

Definition at line 1023 of file interaction.c.

References mouse_action_state::action, mouse_action_state::box, BROWSER_MOUSE_CLICK_1, BROWSER_MOUSE_CLICK_2, BROWSER_MOUSE_DRAG_1, BROWSER_MOUSE_DRAG_2, BROWSER_MOUSE_PRESS_1, BROWSER_MOUSE_PRESS_2, html_selection_owner::content, content_mouse_action(), content_mouse_track(), mouse_action_state::html_object, HTML_SELECTION_CONTENT, HTML_SELECTION_NONE, html_set_selection(), html_selection_owner::none, NSERROR_OK, box::object, mouse_action_state::pos_x, mouse_action_state::pos_y, mouse_action_state::result, html_content::selection_owner, and html_content::selection_type.

Referenced by mouse_action_drag_none().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ html_overflow_scroll_callback()

void html_overflow_scroll_callback ( void *  client_data,
struct scrollbar_msg_data scrollbar_data 
)

Callback for in-page scrollbars.

Definition at line 1601 of file interaction.c.

References html_scrollbar_data::box, BROWSER_POINTER_AUTO, html_scrollbar_data::c, content_broadcast(), CONTENT_MSG_POINTER, html__redraw_a_box(), HTML_DRAG_NONE, HTML_DRAG_SCROLLBAR, html_set_drag_type(), scrollbar_msg_data::msg, html_content::reflowing, scrollbar_msg_data::scrollbar, SCROLLBAR_MSG_MOVED, SCROLLBAR_MSG_SCROLL_FINISHED, SCROLLBAR_MSG_SCROLL_START, scrollbar_msg_data::x0, rect::x0, scrollbar_msg_data::x1, scrollbar_msg_data::y0, and scrollbar_msg_data::y1.

Referenced by box_handle_scrollbars().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ html_overflow_scroll_drag_end()

static void html_overflow_scroll_drag_end ( struct scrollbar scrollbar,
browser_mouse_state  mouse,
int  x,
int  y 
)
static

End overflow scroll scrollbar drags.

Parameters
scrollbarscrollbar widget
mousestate of mouse buttons and modifier keys
xcoordinate of mouse
ycoordinate of mouse

Definition at line 294 of file interaction.c.

References BOTTOM, html_scrollbar_data::box, box_coords(), box::height, LEFT, box::padding, RIGHT, scrollbar_get_data(), scrollbar_is_horizontal(), scrollbar_mouse_drag_end(), SCROLLBAR_WIDTH, TOP, box::width, box::x, and box::y.

Referenced by mouse_action_drag_scrollbar().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ html_selection_drag_end()

static size_t html_selection_drag_end ( struct html_content html,
browser_mouse_state  mouse,
int  x,
int  y,
int  dir 
)
static

End overflow scroll scrollbar drags.

Parameters
htmlhtml content
mousestate of mouse buttons and modifier keys
xcoordinate of mouse
ycoordinate of mouse
dirDirection of drag

Definition at line 202 of file interaction.c.

References box_pick_text_box(), box::byte_offset, font_plot_style_from_css(), guit, netsurf_table::layout, box::length, gui_layout_table::position, box::style, box::text, html_content::unit_len_ctx, box::x, and box::y.

Referenced by mouse_action_drag_selection().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ html_set_drag_type()

void html_set_drag_type ( html_content html,
html_drag_type  drag_type,
union html_drag_owner  drag_owner,
const struct rect rect 
)

Set our drag status, and inform whatever owns the content.

Parameters
htmlHTML content
drag_typeType of drag
drag_ownerWhat owns the drag
rectPointer movement bounds

Definition at line 1648 of file interaction.c.

References content_broadcast(), content_msg_data::CONTENT_DRAG_NONE, content_msg_data::CONTENT_DRAG_SCROLL, content_msg_data::CONTENT_DRAG_SELECTION, CONTENT_MSG_DRAG, content_msg_data::drag, html_content::drag_owner, html_content::drag_type, fallthrough, HTML_DRAG_CONTENT_SCROLL, HTML_DRAG_CONTENT_SELECTION, HTML_DRAG_NONE, HTML_DRAG_SCROLLBAR, HTML_DRAG_SELECTION, HTML_DRAG_TEXTAREA_SCROLLBAR, HTML_DRAG_TEXTAREA_SELECTION, html_drag_owner::no_owner, content_msg_data::rect, and content_msg_data::type.

Referenced by box_textarea_callback(), default_mouse_action(), html_object_callback(), html_overflow_scroll_callback(), and mouse_action_drag_selection().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ html_set_focus()

void html_set_focus ( html_content html,
html_focus_type  focus_type,
union html_focus_owner  focus_owner,
bool  hide_caret,
int  x,
int  y,
int  height,
const struct rect clip 
)

Set our input focus, and inform whatever owns the content.

Parameters
htmlHTML content
focus_typeType of input focus
focus_ownerWhat owns the focus
hide_caretTrue iff caret to be hidden
xCarret x-coord rel to owner
yCarret y-coord rel to owner
heightCarret height
clipCarret clip rect

Definition at line 1685 of file interaction.c.

References box_coords(), content_msg_data::caret, content_msg_data::clip, clip(), html_focus_owner::content, content_broadcast(), CONTENT_MSG_CARET, html_content::focus_owner, html_content::focus_type, content_msg_data::height, height, HTML_FOCUS_CONTENT, HTML_FOCUS_SELF, HTML_FOCUS_TEXTAREA, content_msg_data::pos, html_focus_owner::self, html_focus_owner::textarea, content_msg_data::type, content_msg_data::x, rect::x0, rect::x1, content_msg_data::y, rect::y0, and rect::y1.

Referenced by box_textarea_callback(), default_mouse_action(), and html_object_callback().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ html_set_selection()

void html_set_selection ( html_content html,
html_selection_type  selection_type,
union html_selection_owner  selection_owner,
bool  read_only 
)

Set our selection status, and inform whatever owns the content.

Parameters
htmlHTML content
selection_typeType of selection
selection_ownerWhat owns the selection
read_onlyTrue iff selection is read only

Definition at line 1743 of file interaction.c.

References html_selection_owner::content, content_broadcast(), content_clear_selection(), CONTENT_MSG_SELECTION, form_control::data, fallthrough, box::gadget, HTML_SELECTION_CONTENT, HTML_SELECTION_NONE, HTML_SELECTION_SELF, HTML_SELECTION_TEXTAREA, html_selection_owner::none, box::object, html_content::sel, content_msg_data::selection, selection_clear(), html_content::selection_owner, html_content::selection_type, html_selection_owner::textarea, and textarea_clear_selection().

Referenced by box_textarea_callback(), default_mouse_action(), gadget_mouse_action(), html_object_callback(), and html_object_mouse_action().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ iframe_mouse_action()

static nserror iframe_mouse_action ( struct browser_window bw,
browser_mouse_state  mouse,
int  x,
int  y,
struct mouse_action_state mas 
)
static

process mouse activity on an iframe

Definition at line 989 of file interaction.c.

References mouse_action_state::action, BROWSER_MOUSE_CLICK_1, BROWSER_MOUSE_CLICK_2, browser_window_get_position(), browser_window_get_scale(), browser_window_mouse_click(), browser_window_mouse_track(), mouse_action_state::iframe, NSERROR_OK, and mouse_action_state::result.

Referenced by mouse_action_drag_none().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_javascript_navigate_url()

static bool is_javascript_navigate_url ( nsurl url)
static

determine if a url has a javascript scheme

Parameters
urmThe url to check.
Returns
true if the url is a javascript scheme else false

Definition at line 1068 of file interaction.c.

References nsurl_get_component(), and NSURL_SCHEME.

Referenced by link_mouse_action().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ link_mouse_action()

static nserror link_mouse_action ( html_content html,
struct browser_window bw,
browser_mouse_state  mouse,
int  x,
int  y,
struct mouse_action_state mas 
)
static

process mouse activity on a link

Definition at line 1088 of file interaction.c.

References mouse_action_state::action, mouse_action_state::box, BROWSER_MOUSE_CLICK_1, BROWSER_MOUSE_CLICK_2, BROWSER_MOUSE_MOD_1, browser_window_navigate(), BW_NAVIGATE_DOWNLOAD, content_broadcast(), content_get_url(), CONTENT_MSG_SAVELINK, get_pointer_shape(), mouse_action_state::is_imagemap, is_javascript_navigate_url(), mouse_action_state::link, NSERROR_OK, nsoption_bool, nsurl_access(), nsurl_get_utf8(), mouse_action_state::pointer, mouse_action_state::result, content_msg_data::savelink, mouse_action_state::status, content_msg_data::title, mouse_action_state::title, content_msg_data::url, and mouse_action_state::url.

Referenced by mouse_action_drag_none().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mouse_action_drag_content()

static nserror mouse_action_drag_content ( html_content html,
struct browser_window bw,
browser_mouse_state  mouse,
int  x,
int  y 
)
static

handle mouse actions while dragging in a content

Definition at line 544 of file interaction.c.

References box_coords(), html_drag_owner::content, content_mouse_track(), html_content::drag_owner, NSERROR_OK, box::object, box::x, and box::y.

Referenced by html_mouse_action().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mouse_action_drag_none()

static nserror mouse_action_drag_none ( html_content html,
struct browser_window bw,
browser_mouse_state  mouse,
int  x,
int  y 
)
static

handle non dragging mouse actions

computed state

not on heap to avoid allocation or stack because it is large

Definition at line 1325 of file interaction.c.

References mouse_action_state::action, mouse_action_state::ACTION_GO, mouse_action_state::ACTION_JS, mouse_action_state::ACTION_NONE, mouse_action_state::ACTION_NOSEND, mouse_action_state::ACTION_SUBMIT, mouse_action_state::bar, mouse_action_state::box, BROWSER_MOUSE_CLICK_1, BROWSER_MOUSE_DRAG_1, BROWSER_MOUSE_DRAG_2, BROWSER_MOUSE_MOD_2, BROWSER_POINTER_DEFAULT, browser_window_find_target(), browser_window_navigate(), BW_NAVIGATE_HISTORY, content_msg_data::content, content_broadcast(), content_get_url(), CONTENT_MSG_DRAGSAVE, CONTENT_MSG_POINTER, CONTENT_MSG_STATUS, mouse_action_state::control, default_mouse_action(), content_msg_data::dragsave, content_msg_data::explicit_status_text, fire_generic_dom_event(), form_control::form, form_submit(), mouse_action_state::gadget, gadget_mouse_action(), get_mouse_action_node(), html_exec(), mouse_action_state::html_object, html_object_mouse_action(), mouse_action_state::iframe, iframe_mouse_action(), mouse_action_state::link, link_mouse_action(), mouse_action_state::mouse_x, mouse_action_state::mouse_y, mouse_action_state::node, NSERROR_OK, nsurl_get_component(), NSURL_PATH, mouse_action_state::object, path(), content_msg_data::pointer, mouse_action_state::pointer, mouse_action_state::result, mouse_action_state::scroll, scrollbar_mouse_action(), scrollbar_mouse_status_to_message(), mouse_action_state::status, mouse_action_state::target, content_msg_data::type, and mouse_action_state::url.

Referenced by html_mouse_action().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mouse_action_drag_scrollbar()

static nserror mouse_action_drag_scrollbar ( html_content html,
struct browser_window bw,
browser_mouse_state  mouse,
int  x,
int  y 
)
static

handle html mouse action when a scrollbar drag is being performed

Definition at line 447 of file interaction.c.

References BOTTOM, html_scrollbar_data::box, box_coords(), content_broadcast(), CONTENT_MSG_STATUS, html_content::drag_owner, content_msg_data::explicit_status_text, box::height, html_overflow_scroll_drag_end(), LEFT, NSERROR_OK, box::padding, RIGHT, html_drag_owner::scrollbar, scrollbar_get_data(), scrollbar_is_horizontal(), scrollbar_mouse_action(), scrollbar_mouse_status_to_message(), SCROLLBAR_WIDTH, TOP, box::width, box::x, and box::y.

Referenced by html_mouse_action().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mouse_action_drag_selection()

static nserror mouse_action_drag_selection ( html_content html,
struct browser_window bw,
browser_mouse_state  mouse,
int  x,
int  y 
)
static

handle html mouse action when a selection drag is being performed

Definition at line 390 of file interaction.c.

References box_pick_text_box(), box::byte_offset, font_plot_style_from_css(), guit, HTML_DRAG_NONE, html_selection_drag_end(), html_set_drag_type(), netsurf_table::layout, box::length, html_drag_owner::no_owner, NSERROR_OK, gui_layout_table::position, html_content::sel, selection_dragging_start(), selection_track(), box::style, box::text, and html_content::unit_len_ctx.

Referenced by html_mouse_action().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mouse_action_drag_textarea()

static nserror mouse_action_drag_textarea ( html_content html,
struct browser_window bw,
browser_mouse_state  mouse,
int  x,
int  y 
)
static

handle mouse actions while dragging in a text area

Definition at line 513 of file interaction.c.

References box_coords(), form_control::data, html_content::drag_owner, box::gadget, GADGET_PASSWORD, GADGET_TEXTAREA, GADGET_TEXTBOX, NSERROR_OK, html_drag_owner::textarea, textarea_mouse_action(), form_control::type, box::x, and box::y.

Referenced by html_mouse_action().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mouse_action_select_menu()

static nserror mouse_action_select_menu ( html_content html,
struct browser_window bw,
browser_mouse_state  mouse,
int  x,
int  y 
)
static

handle html mouse action when select menu is open

Definition at line 328 of file interaction.c.

References box::border, BOTTOM, form_control::box, box_coords(), browser_window_get_content(), browser_window_get_drag_type(), content_broadcast(), CONTENT_MSG_STATUS, content_request_redraw(), DRAGGING_NONE, content_msg_data::explicit_status_text, form_select_get_dimensions(), form_select_mouse_action(), form_select_mouse_drag_end(), box::height, height, LEFT, NSERROR_OK, box::padding, TOP, html_content::visible_select_menu, box_border::width, and width.

Referenced by html_mouse_action().

Here is the call graph for this function:
Here is the caller graph for this function: