NetSurf
|
HTML content user interaction handling. More...
#include "desktop/search.h"
Go to the source code of this file.
Data Structures | |
struct | html_scrollbar_data |
Context for scrollbar. More... | |
Functions | |
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_search (struct content *c, void *context, search_flags_t flags, const char *string) |
void | html_search_clear (struct content *c) |
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_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... | |
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... | |
HTML content user interaction handling.
Definition in file interaction.h.
bool html_keypress | ( | struct content * | c, |
uint32_t | key | ||
) |
Handle keypresses.
c | content of type HTML |
key | The UCS4 character codepoint |
We need to:
html->layout->node
.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.
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.
c | content of type html |
bw | browser window |
mouse | state of mouse buttons and modifier keys |
x | x coordinate of mouse |
y | y coordinate of mouse |
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().
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.
c | content of type html |
bw | browser window |
mouse | state of mouse buttons and modifier keys |
x | coordinate of mouse |
y | coordinate of mouse |
Definition at line 1451 of file interaction.c.
References html_mouse_action().
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().
void html_search | ( | struct content * | c, |
void * | context, | ||
search_flags_t | flags, | ||
const char * | string | ||
) |
void html_search_clear | ( | struct content * | c | ) |
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.
html | HTML content |
drag_type | Type of drag |
drag_owner | What owns the drag |
rect | Pointer 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().
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.
html | HTML content |
focus_type | Type of input focus |
focus_owner | What owns the focus |
hide_caret | True iff caret to be hidden |
x | Carret x-coord rel to owner |
y | Carret y-coord rel to owner |
height | Carret height |
clip | Carret 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().
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.
html | HTML content |
selection_type | Type of selection |
selection_owner | What owns the selection |
read_only | True 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().