73 css_computed_style *style;
74 enum css_cursor_e cursor;
75 lwc_string **cursor_uris;
85 cursor = css_computed_cursor(style, &cursor_uris);
106 case CSS_CURSOR_CROSSHAIR:
109 case CSS_CURSOR_POINTER:
112 case CSS_CURSOR_MOVE:
115 case CSS_CURSOR_E_RESIZE:
118 case CSS_CURSOR_W_RESIZE:
121 case CSS_CURSOR_N_RESIZE:
124 case CSS_CURSOR_S_RESIZE:
127 case CSS_CURSOR_NE_RESIZE:
130 case CSS_CURSOR_SW_RESIZE:
133 case CSS_CURSOR_SE_RESIZE:
136 case CSS_CURSOR_NW_RESIZE:
139 case CSS_CURSOR_TEXT:
142 case CSS_CURSOR_WAIT:
145 case CSS_CURSOR_PROGRESS:
148 case CSS_CURSOR_HELP:
171 int scroll_mouse_x, scroll_mouse_y;
176 scroll_mouse_x = x - box_x ;
181 scroll_mouse_x, scroll_mouse_y);
186 scroll_mouse_y = y - box_y;
189 scroll_mouse_x, scroll_mouse_y);
218 dx, &idx, &pixel_offset);
245 struct dom_node *src,
246 struct dom_node *dst)
250 if (!dom_string_isequal(corestring_dom___ns_key_image_coords_node_data,
251 key) || coords == NULL) {
256 case DOM_NODE_CLONED:
257 newcoords = calloc(1,
sizeof(*newcoords));
258 if (newcoords != NULL) {
259 *newcoords = *coords;
260 if (dom_node_set_user_data(dst,
261 corestring_dom___ns_key_image_coords_node_data,
264 &oldcoords) == DOM_NO_ERR) {
270 case DOM_NODE_DELETED:
274 case DOM_NODE_RENAMED:
275 case DOM_NODE_IMPORTED:
276 case DOM_NODE_ADOPTED:
280 NSLOG(netsurf, INFO,
"User data operation not handled.");
299 int scroll_mouse_x, scroll_mouse_y, box_x, box_y;
307 scroll_mouse_x =
x - box_x;
312 scroll_mouse_x, scroll_mouse_y);
317 scroll_mouse_y =
y - box_y;
319 scroll_mouse_x, scroll_mouse_y);
361 if (status != NULL) {
459 int scroll_mouse_x = 0, scroll_mouse_y = 0;
476 scroll_mouse_x =
x - box_x ;
488 scroll_mouse_y =
y - box_y;
497 if (status != NULL) {
699 (css_computed_visibility(
box->
style) ==
700 CSS_VISIBILITY_HIDDEN)) {
767 padding_left = box_x +
771 padding_top = box_y +
776 if ((
x > padding_left) &&
777 (
x < padding_right) &&
779 (
y < padding_bottom)) {
792 (
y > (padding_bottom -
812 }
while (
box != NULL);
817 assert(man->
node != NULL);
853 NSLOG(netsurf, ERROR,
"%s",
870 dom_html_input_element_set_checked(
889 coords = calloc(1,
sizeof(*coords));
890 if (coords == NULL) {
895 if (dom_node_set_user_data(
897 corestring_dom___ns_key_image_coords_node_data,
900 &oldcoords) != DOM_NO_ERR) {
909 static char status_buffer[200];
911 snprintf(status_buffer,
912 sizeof status_buffer,
940 sel_owner.
none =
true;
1008 (x * scale) - pos_x,
1009 (y * scale) - pos_y);
1013 (x * scale) - pos_x,
1014 (y * scale) - pos_y);
1041 sel_owner.
none =
true;
1077 if (scheme != NULL) {
1078 if (scheme == corestring_lwc_javascript) {
1081 lwc_string_unref(scheme);
1100 static char status_buffer[200];
1115 snprintf(status_buffer,
1116 sizeof status_buffer,
1121 snprintf(status_buffer,
1122 sizeof status_buffer,
1127 if (url_s != NULL) {
1215 sel_owner.
none =
true;
1256 sel_owner.
none =
false;
1260 sel_owner.
none =
true;
1269 sel_owner.
none =
true;
1274 sel_owner.
none =
false;
1277 sel_owner.
none =
true;
1376 }
else if (mas.
iframe != NULL) {
1382 }
else if (mas.
link.
url != NULL) {
1437 lwc_string_data(
path),
1438 lwc_string_length(
path));
1439 lwc_string_unref(
path);
1512 assert(0 &&
"Unknown content related drag type");
1622 switch(scrollbar_data->
msg) {
1636 .
x0 = scrollbar_data->
x0,
1637 .y0 = scrollbar_data->
y0,
1638 .x1 = scrollbar_data->
x1,
1639 .y1 = scrollbar_data->
y1
1642 drag_owner.scrollbar = scrollbar_data->
scrollbar;
1648 drag_owner.no_owner =
true;
1664 assert(html != NULL);
1669 switch (drag_type) {
1671 assert(drag_owner.
no_owner ==
true);
1682 assert(drag_owner.
no_owner ==
true);
1707 assert(html != NULL);
1709 switch (focus_type) {
1711 assert(focus_owner.
self ==
true);
1729 if (textarea_lost_focus) {
1730 msg_data.
caret.
type = CONTENT_CARET_REMOVE;
1732 msg_data.
caret.
type = CONTENT_CARET_HIDE;
1742 msg_data.
caret.
type = CONTENT_CARET_SET_POS;
1759 bool changed =
false;
1762 assert(html != NULL);
1807 switch (selection_type) {
1809 assert(selection_owner.
none ==
true);
1813 assert(selection_owner.
none ==
false);
1822 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).
nserror browser_window_history_forward(struct browser_window *bw, bool new_window)
Go forward in the history.
nserror browser_window_history_back(struct browser_window *bw, bool new_window)
Go back in the history.
Interface to browser history operations.
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: 1 is primary mouse button.
@ BROWSER_MOUSE_CLICK_4
button 4 clicked.
@ BROWSER_MOUSE_PRESS_1
primary button pressed
@ BROWSER_MOUSE_CLICK_2
button 2 clicked.
@ BROWSER_MOUSE_PRESS_2
auxillary button 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_CLICK_5
button 5 clicked.
@ 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.
static nserror default_mouse_action_focus(html_content *html, browser_mouse_state mouse)
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
@ ACTION_BACK
navigate back in history
struct form_control * control
enum mouse_action_state::@141::@147 action
struct dom_node * node
dom node
@ ACTION_JS
execute link as script
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
@ ACTION_NONE
default of no action
@ ACTION_NAVIGATE
navigate to link url
struct box * drag_candidate
candidate box for drag operation
@ ACTION_FORWARD
navigate forward in history
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
@ ACTION_SUBMIT
submit form
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.