72 css_computed_style *style;
73 enum css_cursor_e cursor;
74 lwc_string **cursor_uris;
84 cursor = css_computed_cursor(style, &cursor_uris);
105 case CSS_CURSOR_CROSSHAIR:
108 case CSS_CURSOR_POINTER:
111 case CSS_CURSOR_MOVE:
114 case CSS_CURSOR_E_RESIZE:
117 case CSS_CURSOR_W_RESIZE:
120 case CSS_CURSOR_N_RESIZE:
123 case CSS_CURSOR_S_RESIZE:
126 case CSS_CURSOR_NE_RESIZE:
129 case CSS_CURSOR_SW_RESIZE:
132 case CSS_CURSOR_SE_RESIZE:
135 case CSS_CURSOR_NW_RESIZE:
138 case CSS_CURSOR_TEXT:
141 case CSS_CURSOR_WAIT:
144 case CSS_CURSOR_PROGRESS:
147 case CSS_CURSOR_HELP:
170 int scroll_mouse_x, scroll_mouse_y;
175 scroll_mouse_x = x - box_x ;
180 scroll_mouse_x, scroll_mouse_y);
185 scroll_mouse_y = y - box_y;
188 scroll_mouse_x, scroll_mouse_y);
217 dx, &idx, &pixel_offset);
244 struct dom_node *src,
245 struct dom_node *dst)
249 if (!dom_string_isequal(corestring_dom___ns_key_image_coords_node_data,
250 key) || coords == NULL) {
255 case DOM_NODE_CLONED:
256 newcoords = calloc(1,
sizeof(*newcoords));
257 if (newcoords != NULL) {
258 *newcoords = *coords;
259 if (dom_node_set_user_data(dst,
260 corestring_dom___ns_key_image_coords_node_data,
263 &oldcoords) == DOM_NO_ERR) {
269 case DOM_NODE_DELETED:
273 case DOM_NODE_RENAMED:
274 case DOM_NODE_IMPORTED:
275 case DOM_NODE_ADOPTED:
279 NSLOG(netsurf, INFO,
"User data operation not handled.");
298 int scroll_mouse_x, scroll_mouse_y, box_x, box_y;
306 scroll_mouse_x =
x - box_x;
311 scroll_mouse_x, scroll_mouse_y);
316 scroll_mouse_y =
y - box_y;
318 scroll_mouse_x, scroll_mouse_y);
360 if (status != NULL) {
458 int scroll_mouse_x = 0, scroll_mouse_y = 0;
475 scroll_mouse_x =
x - box_x ;
487 scroll_mouse_y =
y - box_y;
496 if (status != NULL) {
696 (css_computed_visibility(
box->
style) ==
697 CSS_VISIBILITY_HIDDEN)) {
764 padding_left = box_x +
768 padding_top = box_y +
773 if ((
x > padding_left) &&
774 (
x < padding_right) &&
776 (
y < padding_bottom)) {
789 (
y > (padding_bottom -
809 }
while (
box != NULL);
814 assert(man->
node != NULL);
850 NSLOG(netsurf, ERROR,
"%s",
867 dom_html_input_element_set_checked(
886 coords = calloc(1,
sizeof(*coords));
887 if (coords == NULL) {
892 if (dom_node_set_user_data(
894 corestring_dom___ns_key_image_coords_node_data,
897 &oldcoords) != DOM_NO_ERR) {
906 static char status_buffer[200];
908 snprintf(status_buffer,
909 sizeof status_buffer,
937 sel_owner.
none =
true;
1005 (x * scale) - pos_x,
1006 (y * scale) - pos_y);
1010 (x * scale) - pos_x,
1011 (y * scale) - pos_y);
1038 sel_owner.
none =
true;
1074 if (scheme != NULL) {
1075 if (scheme == corestring_lwc_javascript) {
1078 lwc_string_unref(scheme);
1097 static char status_buffer[200];
1112 snprintf(status_buffer,
1113 sizeof status_buffer,
1118 snprintf(status_buffer,
1119 sizeof status_buffer,
1124 if (url_s != NULL) {
1199 true, 0, 0, 0, NULL);
1202 sel_owner.
none =
true;
1247 sel_owner.
none =
true;
1252 sel_owner.
none =
false;
1259 sel_owner.
none =
true;
1373 }
else if (mas.
iframe != NULL) {
1379 }
else if (mas.
link.
url != NULL) {
1434 lwc_string_data(
path),
1435 lwc_string_length(
path));
1436 lwc_string_unref(
path);
1501 assert(0 &&
"Unknown content related drag type");
1611 switch(scrollbar_data->
msg) {
1625 .
x0 = scrollbar_data->
x0,
1626 .y0 = scrollbar_data->
y0,
1627 .x1 = scrollbar_data->
x1,
1628 .y1 = scrollbar_data->
y1
1631 drag_owner.scrollbar = scrollbar_data->
scrollbar;
1637 drag_owner.no_owner =
true;
1653 assert(html != NULL);
1658 switch (drag_type) {
1660 assert(drag_owner.
no_owner ==
true);
1671 assert(drag_owner.
no_owner ==
true);
1696 assert(html != NULL);
1698 switch (focus_type) {
1700 assert(focus_owner.
self ==
true);
1718 if (textarea_lost_focus) {
1719 msg_data.
caret.
type = CONTENT_CARET_REMOVE;
1721 msg_data.
caret.
type = CONTENT_CARET_HIDE;
1731 msg_data.
caret.
type = CONTENT_CARET_SET_POS;
1748 bool changed =
false;
1751 assert(html != NULL);
1796 switch (selection_type) {
1798 assert(selection_owner.
none ==
true);
1802 assert(selection_owner.
none ==
false);
1811 msg_data.
selection.read_only = read_only;
struct box * box_at_point(const css_unit_ctx *unit_len_ctx, struct box *box, const int x, const int y, int *box_x, int *box_y)
Find the boxes at a point.
void box_coords(struct box *box, int *x, int *y)
Find the absolute coordinates of a box.
struct box * box_pick_text_box(struct html_content *html, int x, int y, int dir, int *dx, int *dy)
Peform pick text on browser window contents to locate the box under the mouse pointer,...
HTML Box tree inspection interface.
nserror box_textarea_keypress(html_content *html, struct box *box, uint32_t key)
Handle form textarea keypress input.
Box tree treeview box replacement (interface).
Browser window creation and manipulation interface.
browser_drag_type
type of browser window drag in progess
void browser_window_page_drag_start(struct browser_window *bw, int x, int y)
Start drag scrolling the contents of the browser window.
nserror browser_window_navigate(struct browser_window *bw, struct nsurl *url, struct nsurl *referrer, enum browser_window_nav_flags flags, char *post_urlenc, struct fetch_multipart_data *post_multipart, struct hlcache_handle *parent)
Start fetching a page in a browser window.
float browser_window_get_scale(struct browser_window *bw)
Gets the scale of a browser window.
void browser_window_mouse_click(struct browser_window *bw, browser_mouse_state mouse, int x, int y)
Handle mouse clicks in a browser window.
void browser_window_get_position(struct browser_window *bw, bool root, int *pos_x, int *pos_y)
Get the position of the current browser window with respect to the root or parent browser window.
struct hlcache_handle * browser_window_get_content(struct browser_window *bw)
Get a cache handle for the content within a browser window.
struct browser_window * browser_window_find_target(struct browser_window *bw, const char *target, browser_mouse_state mouse)
Locate a browser window in the specified stack according.
@ BW_NAVIGATE_DOWNLOAD
download rather than render the uri
@ BW_NAVIGATE_HISTORY
this will form a new history node (don't set for back/reload/etc)
browser_drag_type browser_window_get_drag_type(struct browser_window *bw)
Get type of any current drag for a browser window.
void browser_window_mouse_track(struct browser_window *bw, browser_mouse_state mouse, int x, int y)
Handle non-click mouse action in a browser window.
void font_plot_style_from_css(const css_unit_ctx *unit_len_ctx, const css_computed_style *css, plot_font_style_t *fstyle)
Populate a font style using data from a computed CSS style.
Internal font handling interfaces.
void content_mouse_action(hlcache_handle *h, struct browser_window *bw, browser_mouse_state mouse, int x, int y)
Handle mouse clicks and movements in a content window.
void content_broadcast(struct content *c, content_msg msg, const union content_msg_data *data)
Send a message to all users.
void content_request_redraw(struct hlcache_handle *h, int x, int y, int width, int height)
Request a redraw of an area of a content.
void content_clear_selection(hlcache_handle *h)
Tell a content that any selection it has, or one of its objects has, must be cleared.
bool content_keypress(struct hlcache_handle *h, uint32_t key)
Handle keypresses.
void content_mouse_track(hlcache_handle *h, struct browser_window *bw, browser_mouse_state mouse, int x, int y)
Handle mouse movements in a content window.
nsurl * content_get_url(struct content *c)
Retrieve URL associated with content.
@ CONTENT_HTML
content is HTML
@ CONTENT_MSG_SELECTMENU
Create a select menu.
@ CONTENT_MSG_GADGETCLICK
A gadget has been clicked on (mainly for file)
@ CONTENT_MSG_STATUS
new status string
@ CONTENT_MSG_DRAGSAVE
Allow drag saving of content.
@ CONTENT_MSG_POINTER
Wants a specific mouse pointer set.
@ CONTENT_MSG_SELECTION
A selection made or cleared.
@ CONTENT_MSG_DRAG
A drag started or ended.
@ CONTENT_MSG_SAVELINK
Allow URL to be saved.
@ CONTENT_MSG_CARET
Caret movement / hiding.
Useful interned string pointers (interface).
bool selection_click(struct selection *s, struct browser_window *top, browser_mouse_state mouse, unsigned idx)
Handles mouse clicks (including drag starts) in or near a selection.
bool selection_clear(struct selection *s, bool redraw)
Clears the current selection, optionally causing the screen to be updated.
bool selection_copy_to_clipboard(struct selection *s)
Copy the selected contents to the clipboard.
bool selection_dragging_start(struct selection *s)
void selection_track(struct selection *s, browser_mouse_state mouse, unsigned idx)
Handles movements related to the selection, eg.
bool selection_active(struct selection *s)
determine if a selecion is active
bool selection_dragging(struct selection *s)
void selection_select_all(struct selection *s)
Selects all the text within the box subtree controlled by this selection object, updating the screen ...
Text selection within browser windows (interface).
bool textarea_clear_selection(struct textarea *ta)
Clear any selection in the textarea.
textarea_mouse_status textarea_mouse_action(struct textarea *ta, browser_mouse_state mouse, int x, int y)
Handles all kinds of mouse action.
Single/Multi-line UTF-8 text area interface.
textarea_mouse_status
Text area mouse input status flags.
@ TEXTAREA_MOUSE_EDITOR
Hover: caret pointer.
nserror
Enumeration of error codes.
bool browser_window_frame_resize_start(struct browser_window *bw, browser_mouse_state mouse, int x, int y, browser_pointer_shape *pointer)
Frame and frameset creation and manipulation (interface).
struct netsurf_table * guit
The global interface table.
Interface to core interface table.
High-level resource cache interface.
bool html_exec(struct content *c, const char *src, size_t srclen)
execute some text as a script element
bool fire_dom_keyboard_event(dom_string *type, dom_node *target, bool bubbles, bool cancelable, uint32_t key)
Construct a keyboard event and fire it at the DOM.
void html__redraw_a_box(struct html_content *html, struct box *box)
Redraw a box.
bool fire_generic_dom_event(dom_string *type, dom_node *target, bool bubbles, bool cancelable)
Construct an event and fire it at the DOM.
nsurl * imagemap_get(struct html_content *c, const char *key, unsigned long x, unsigned long y, unsigned long click_x, unsigned long click_y, const char **target)
Retrieve url associated with imagemap entry.
Interface to HTML imagemap.
Public content interface.
content_type content_get_type(struct hlcache_handle *h)
Retrieve computed type of content.
Interface to platform-specific layout operation table.
Interface to platform-specific miscellaneous browser operation table.
Core mouse and pointer states.
browser_pointer_shape
Mouse pointer type.
@ BROWSER_POINTER_PROGRESS
@ BROWSER_POINTER_DEFAULT
browser_mouse_state
Mouse state.
@ BROWSER_MOUSE_PRESS_1
button 1 pressed
@ BROWSER_MOUSE_CLICK_2
button 2 clicked.
@ BROWSER_MOUSE_PRESS_2
button 2 pressed
@ BROWSER_MOUSE_CLICK_1
button 1 clicked.
@ BROWSER_MOUSE_MOD_2
2nd modifier key pressed (eg.
@ BROWSER_MOUSE_MOD_1
1st modifier key pressed (eg.
@ BROWSER_MOUSE_DRAG_1
start of button 1 drag
@ BROWSER_MOUSE_DRAG_2
start of button 2 drag
static void html_overflow_scroll_drag_end(struct scrollbar *scrollbar, browser_mouse_state mouse, int x, int y)
End overflow scroll scrollbar drags.
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.
bool html_keypress(struct content *c, uint32_t key)
Handle keypresses.
void html_overflow_scroll_callback(void *client_data, struct scrollbar_msg_data *scrollbar_data)
Callback for in-page scrollbars.
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
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
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
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
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.
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
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
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
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
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.
static void html_box_drag_start(struct box *box, int x, int y)
Start drag scrolling the contents of a box.
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
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
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.
static browser_pointer_shape get_pointer_shape(struct box *box, bool imagemap)
Get pointer shape for given box.
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
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.
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.
static bool is_javascript_navigate_url(nsurl *url)
determine if a url has a javascript scheme
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.
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
HTML content user interaction handling.
Interface to javascript engine functions.
Interface to key press operations.
#define NSLOG(catname, level, logmsg, args...)
const char * messages_get_errorcode(nserror code)
lookup of a message by errorcode from the standard Messages hash.
const char * messages_get(const char *key)
Fast lookup of a message by key from the standard Messages hash.
Localised message support (interface).
nserror nsurl_get_utf8(const nsurl *url, char **url_s, size_t *url_l)
Get a UTF-8 string (for human readable IDNs) from a NetSurf URL object.
const char * nsurl_access(const nsurl *url)
Access a NetSurf URL object as a string.
lwc_string * nsurl_get_component(const nsurl *url, nsurl_component part)
Get part of a URL as a lwc_string, from a NetSurf URL object.
struct nsurl nsurl
NetSurf URL object.
Private data for text/html content.
@ HTML_DRAG_SELECTION
No drag.
@ HTML_DRAG_CONTENT_SELECTION
Not own; drag in textarea widget.
@ HTML_DRAG_TEXTAREA_SELECTION
Not own; drag in scrollbar widget.
@ HTML_DRAG_SCROLLBAR
Own; Text selection.
@ HTML_DRAG_TEXTAREA_SCROLLBAR
Not own; drag in textarea widget.
@ HTML_DRAG_CONTENT_SCROLL
Not own; drag in child content.
@ HTML_FOCUS_SELF
Focus is our own.
@ HTML_FOCUS_TEXTAREA
Focus belongs to textarea.
@ HTML_FOCUS_CONTENT
Focus belongs to child content.
@ HTML_SELECTION_SELF
Selection in one of our textareas.
@ HTML_SELECTION_TEXTAREA
No selection.
@ HTML_SELECTION_CONTENT
Selection in this html content.
Interface to utility string handling.
int width
border-width (pixels)
struct box_border border[4]
Border: TOP, RIGHT, BOTTOM, LEFT.
int width
Width of content box (excluding padding etc.).
struct scrollbar * scroll_x
Horizontal scroll.
size_t byte_offset
Byte offset within a textual representation of this content.
const char * title
Title, or NULL.
struct box * children
First child box, or NULL.
int height
Height of content box (excluding padding etc.).
int margin[4]
Margin: TOP, RIGHT, BOTTOM, LEFT.
char * usemap
(Image)map to use with this object, or NULL if none
const char * target
Link target, or NULL.
struct scrollbar * scroll_y
Vertical scroll.
box_type type
Type of box.
struct nsurl * href
Link, or NULL.
struct browser_window * iframe
Iframe's browser_window, or NULL if none.
css_computed_style * style
Style for this box.
size_t length
Length of text.
struct hlcache_handle * object
Object in this box (usually an image), or NULL if none.
char * text
Text, or NULL if none.
int padding[4]
Padding: TOP, RIGHT, BOTTOM, LEFT.
int x
Coordinate of left padding edge relative to parent box, or relative to ancestor that contains this bo...
struct form_control * gadget
Form control data, or NULL if not a form control.
struct dom_node * node
DOM node that generated this box or NULL.
int y
Coordinate of top padding edge, relative as for x.
Content which corresponds to a single URL.
nserror(* position)(const struct plot_font_style *fstyle, const char *string, size_t length, int x, size_t *char_offset, int *actual_x)
Find the position in a string where an x coordinate falls.
Data specific to CONTENT_HTML.
struct selection * sel
HTML content's own text selection object.
union html_drag_owner drag_owner
Widget capturing all mouse events.
html_focus_type focus_type
Current input focus target type.
struct browser_window * bw
Browser window containing this document, or NULL if not open.
html_drag_type drag_type
Current drag type.
union html_focus_owner focus_owner
Current input focus target.
html_selection_type selection_type
Current selection state.
struct form_control * visible_select_menu
Open core-handled form SELECT menu, or NULL if none currently open.
union html_selection_owner selection_owner
Current selection owner.
css_unit_ctx unit_len_ctx
CSS length conversion context for document.
struct box * layout
Box tree, or NULL.
bool reflowing
Whether a layout (reflow) is in progress.
local structure containing all the mouse action state information
struct form_control * control
enum mouse_action_state::@141::@147 action
struct dom_node * node
dom node
hlcache_handle * object
non html object
@ ACTION_NOSEND
do not send status and pointer message
struct mouse_action_state::@145 scroll
scrollbar
struct mouse_action_state::@144 gadget
gadget
const char * status
status text
struct browser_window * iframe
iframe
struct mouse_action_state::@146 text
text in box
struct mouse_action_state::@141 result
struct box * drag_candidate
candidate box for drag operation
browser_pointer_shape pointer
pointer shape
struct mouse_action_state::@142 html_object
html object
struct mouse_action_state::@143 link
link either from href or imagemap
struct gui_layout_table * layout
Layout table.
Interface to HTML searching.
struct rect rect
Rectangle coordinates.
Extra data for some content_msg messages.
const struct rect * clip
Carret clip rect.
struct content_msg_data::@110 gadget_click
CONTENT_MSG_GADGETCLICK - User clicked on a form gadget.
browser_pointer_shape pointer
CONTENT_MSG_POINTER - Mouse pointer to set.
struct content_msg_data::@107 caret
CONTENT_MSG_CARET - set caret position or, hide caret.
struct content_msg_data::@105 savelink
CONTENT_MSG_SAVELINK - Save a URL.
bool selection
false for selection cleared
struct hlcache_handle * content
if NULL, save the content generating the message
struct content_msg_data::@104 dragsave
CONTENT_MSG_DRAGSAVE - Drag save a content.
struct content_msg_data::@108 drag
CONTENT_MSG_DRAG - Drag start or end.
struct content_msg_data::@109 select_menu
CONTENT_MSG_SELECTMENU - Create select menu at pointer.
struct form_control * gadget
enum content_msg_data::@104::@112 type
const char * explicit_status_text
CONTENT_MSG_STATUS - Status message update.
struct content_msg_data::@107::@114 pos
With CONTENT_CARET_SET_POS.
struct scrollbar * scrollbar
For getting at selections in this content or things in this content.
Option reading and saving interface.
#define nsoption_bool(OPTION)
Get the value of a boolean option.
Interface to a number of general purpose functionality.
#define fallthrough
switch fall through
static nserror path(const struct redraw_context *ctx, const plot_style_t *pstyle, const float *p, unsigned int n, const float transform[6])
Plots a path.
static nserror clip(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.