69 css_computed_style *style;
70 enum css_cursor_e cursor;
71 lwc_string **cursor_uris;
81 cursor = css_computed_cursor(style, &cursor_uris);
102 case CSS_CURSOR_CROSSHAIR:
105 case CSS_CURSOR_POINTER:
108 case CSS_CURSOR_MOVE:
111 case CSS_CURSOR_E_RESIZE:
114 case CSS_CURSOR_W_RESIZE:
117 case CSS_CURSOR_N_RESIZE:
120 case CSS_CURSOR_S_RESIZE:
123 case CSS_CURSOR_NE_RESIZE:
126 case CSS_CURSOR_SW_RESIZE:
129 case CSS_CURSOR_SE_RESIZE:
132 case CSS_CURSOR_NW_RESIZE:
135 case CSS_CURSOR_TEXT:
138 case CSS_CURSOR_WAIT:
141 case CSS_CURSOR_PROGRESS:
144 case CSS_CURSOR_HELP:
167 int scroll_mouse_x, scroll_mouse_y;
172 scroll_mouse_x = x - box_x ;
173 scroll_mouse_y = y - (box_y + box->
padding[
TOP] +
177 scroll_mouse_x, scroll_mouse_y);
182 scroll_mouse_y = y - box_y;
185 scroll_mouse_x, scroll_mouse_y);
214 dx, &idx, &pixel_offset);
257 struct dom_node *src,
258 struct dom_node *dst)
262 if (!dom_string_isequal(corestring_dom___ns_key_image_coords_node_data,
263 key) || coords == NULL) {
268 case DOM_NODE_CLONED:
269 newcoords = calloc(1,
sizeof(*newcoords));
270 if (newcoords != NULL) {
271 *newcoords = *coords;
272 if (dom_node_set_user_data(dst,
273 corestring_dom___ns_key_image_coords_node_data,
276 &oldcoords) == DOM_NO_ERR) {
282 case DOM_NODE_DELETED:
286 case DOM_NODE_RENAMED:
287 case DOM_NODE_IMPORTED:
288 case DOM_NODE_ADOPTED:
292 NSLOG(netsurf, INFO,
"User data operation not handled.");
311 int scroll_mouse_x, scroll_mouse_y, box_x, box_y;
319 scroll_mouse_x = x - box_x;
320 scroll_mouse_y = y - (box_y + box->
padding[
TOP] +
324 scroll_mouse_x, scroll_mouse_y);
329 scroll_mouse_y = y - box_y;
331 scroll_mouse_x, scroll_mouse_y);
356 enum { ACTION_NONE, ACTION_SUBMIT, ACTION_GO } action = ACTION_NONE;
357 const char *
title = 0;
362 char status_buffer[200];
363 const char *status = 0;
366 int box_x = 0, box_y = 0;
367 int gadget_box_x = 0, gadget_box_y = 0;
368 int html_object_pos_x = 0, html_object_pos_y = 0;
370 struct box *url_box = 0;
371 struct box *gadget_box = 0;
372 struct box *text_box = 0;
376 struct box *html_object_box = NULL;
378 struct box *drag_candidate = NULL;
381 int scroll_mouse_x = 0, scroll_mouse_y = 0;
382 int padding_left, padding_right, padding_top, padding_bottom;
409 mouse, x - box_x, y - box_y);
410 if (status != NULL) {
462 box->
style, &fstyle);
466 dx, &idx, &pixel_offset);
486 scroll_mouse_x = x - box_x ;
487 scroll_mouse_y = y - (box_y + box->
padding[
TOP] +
498 scroll_mouse_y = y - box_y;
513 assert(box->
gadget != NULL);
520 x - box_x, y - box_y);
529 assert(box->
object != NULL);
533 x - box_x, y - box_y);
539 assert(box->
object != NULL);
543 x - box_x, y - box_y);
591 if ((box->
style != NULL) &&
592 (css_computed_visibility(box->
style) ==
593 CSS_VISIBILITY_HIDDEN)) {
597 if (box->
node != NULL) {
603 html_object_box =
box;
604 html_object_pos_x = box_x;
605 html_object_pos_y = box_y;
623 box_x, box_y, x, y, &target);
633 gadget_box_x = box_x;
634 gadget_box_y = box_y;
648 if (drag_candidate == NULL) {
649 drag_candidate =
box;
652 padding_left = box_x +
654 padding_right = padding_left + box->
padding[
LEFT] +
656 padding_top = box_y +
658 padding_bottom = padding_top + box->
padding[
TOP] +
661 if ((x > padding_left) &&
662 (x < padding_right) &&
664 (y < padding_bottom)) {
668 (x > (padding_right -
673 scroll_mouse_x = x - (padding_right -
675 scroll_mouse_y = y - padding_top;
678 }
else if ((box->
scroll_x != NULL) &&
679 (y > (padding_bottom -
684 scroll_mouse_x = x - padding_left;
685 scroll_mouse_y = y - (padding_bottom -
697 &box_x, &box_y)) != NULL);
701 assert(node != NULL);
712 switch (gadget->
type) {
723 NSLOG(netsurf, ERROR,
737 if (mouse & BROWSER_MOUSE_CLICK_1) {
739 dom_html_input_element_set_checked(
740 (dom_html_input_element *)(gadget->
node),
747 if (mouse & BROWSER_MOUSE_CLICK_1)
752 if (mouse & BROWSER_MOUSE_CLICK_1) {
755 coords = calloc(1,
sizeof(*coords));
756 if (coords == NULL) {
759 coords->
x = x - gadget_box_x;
760 coords->
y = y - gadget_box_y;
761 if (dom_node_set_user_data(
763 corestring_dom___ns_key_image_coords_node_data,
765 &oldcoords) != DOM_NO_ERR)
772 snprintf(status_buffer,
sizeof status_buffer,
775 status = status_buffer;
777 if (mouse & (BROWSER_MOUSE_CLICK_1 |
779 action = ACTION_SUBMIT;
796 sel_owner.
none =
true;
802 mouse, x - gadget_box_x,
821 if (mouse & BROWSER_MOUSE_CLICK_1) {
858 (y * scale) - pos_y);
862 (y * scale) - pos_y);
864 }
else if (html_object_box) {
869 sel_owner.
none =
true;
877 x - html_object_pos_x,
878 y - html_object_pos_y);
882 x - html_object_pos_x,
883 y - html_object_pos_y);
898 snprintf(status_buffer,
sizeof status_buffer,
"%s: %s",
901 snprintf(status_buffer,
sizeof status_buffer,
"%s",
905 status = status_buffer;
924 mouse & BROWSER_MOUSE_MOD_1) {
953 true, 0, 0, 0, NULL);
957 sel_owner.
none =
true;
967 text_box->
style, &fstyle);
999 sel_owner.
none =
true;
1004 sel_owner.
none =
false;
1009 sel_owner.
none =
true;
1020 if (mouse & BROWSER_MOUSE_MOD_2) {
1022 CONTENT_SAVE_COMPLETE;
1028 if (drag_candidate == NULL) {
1040 if (mouse & BROWSER_MOUSE_MOD_2) {
1042 CONTENT_SAVE_SOURCE;
1048 if (drag_candidate == NULL) {
1065 true, 0, 0, 0, NULL);
1069 if (!iframe && !html_object_box) {
1190 if ((
string != NULL) &&
1193 (html->
search != NULL)) {
1197 }
else if (
string != NULL) {
1204 if (html->
search != NULL) {
1211 if (html->
search == NULL)
1240 if (html->
search != NULL) {
1260 switch(scrollbar_data->
msg) {
1273 struct rect rect = {
1274 .
x0 = scrollbar_data->
x0,
1275 .y0 = scrollbar_data->
y0,
1276 .x1 = scrollbar_data->
x1,
1277 .y1 = scrollbar_data->
y1 1280 drag_owner.scrollbar = scrollbar_data->
scrollbar;
1286 drag_owner.no_owner =
true;
1302 assert(html != NULL);
1307 switch (drag_type) {
1309 assert(drag_owner.
no_owner ==
true);
1320 assert(drag_owner.
no_owner ==
true);
1345 assert(html != NULL);
1347 switch (focus_type) {
1349 assert(focus_owner.
self ==
true);
1367 if (textarea_lost_focus) {
1368 msg_data.
caret.
type = CONTENT_CARET_REMOVE;
1370 msg_data.
caret.
type = CONTENT_CARET_HIDE;
1380 msg_data.
caret.
type = CONTENT_CARET_SET_POS;
1384 msg_data.
caret.
pos.clip = (clip == NULL) ? NULL : &cr;
1397 bool changed =
false;
1400 assert(html != NULL);
1445 switch (selection_type) {
1447 assert(selection_owner.
none ==
true);
1451 assert(selection_owner.
none ==
false);
1460 msg_data.
selection.read_only = read_only;
struct form_control * gadget
Form control data, or 0 if not a form control.
void selection_clear(struct selection *s, bool redraw)
Clears the current selection, optionally causing the screen to be updated.
const char * target
Link target, or 0.
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.
this will form a new history node (don't set for back/reload/etc)
void html_overflow_scroll_callback(void *client_data, struct scrollbar_msg_data *scrollbar_data)
Callback for in-page scrollbars.
browser_drag_type
type of browser window drag in progess
void search_destroy_context(struct search_context *context)
Ends the search process, invalidating all state freeing the list of found boxes.
void selection_select_all(struct selection *s)
Selects all the text within the box subtree controlled by this selection object, updating the screen ...
struct box_border border[4]
Border: TOP, RIGHT, BOTTOM, LEFT.
void html__redraw_a_box(struct html_content *html, struct box *box)
Redraw a box.
browser_mouse_state
Mouse state.
struct content_msg_data::@109 savelink
CONTENT_MSG_SAVELINK - Save a URL.
struct nsurl * href
Link, or 0.
Localised message support (interface).
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.
Not own; drag in textarea widget.
Interface to platform-specific layout operation table.
Public content interface.
A gadget has been clicked on (mainly for file)
int padding[4]
Padding: TOP, RIGHT, BOTTOM, LEFT.
nserror box_textarea_keypress(html_content *html, struct box *box, uint32_t key)
Handle form textarea keypress input.
struct form_control * visible_select_menu
Open core-handled form SELECT menu, or NULL if none currently open.
static void html_box_drag_start(struct box *box, int x, int y)
Start drag scrolling the contents of a box.
html_drag_type drag_type
Current drag type.
float browser_window_get_scale(struct browser_window *bw)
Gets the scale of a browser window.
struct scrollbar * scroll_x
Horizontal scroll.
#define selection_defined(s)
Core mouse and pointer states.
struct content_msg_data::@111::@117 pos
With CONTENT_CARET_SET_POS.
Focus belongs to child content.
Interface to platform-specific miscellaneous browser operation table.
struct content_msg_data::@111 caret
CONTENT_MSG_CARET - set caret position or, hide caret.
static browser_pointer_shape get_pointer_shape(struct box *box, bool imagemap)
Get pointer shape for given box.
void html_search(struct content *c, void *context, search_flags_t flags, const char *string)
Handle search.
int x
Coordinate of left padding edge relative to parent box, or relative to ancestor that contains this bo...
struct search_context * search_create_context(struct content *c, content_type type, void *gui_data)
create a search_context
struct box * layout
Box tree, or NULL.
browser_pointer_shape
Mouse pointer type.
bool textarea_clear_selection(struct textarea *ta)
Clear any selection in the textarea.
void 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.
html_focus_type focus_type
Current input focus target type.
High-level resource cache interface.
int y
Coordinate of top padding edge, relative as for x.
struct scrollbar * scroll_y
Vertical scroll.
bool selection_copy_to_clipboard(struct selection *s)
Copy the selected contents to the clipboard.
union html_drag_owner drag_owner
Widget capturing all mouse events.
#define selection_dragging(s)
Interface to key press operations.
Option reading and saving interface.
#define selection_dragging_start(s)
void content_clear_selection(hlcache_handle *h)
Tell a content that any selection it has, or one of its objects has, must be cleared.
nserror
Enumeration of error codes.
nsurl * content_get_url(struct content *c)
Retrieve URL associated with content.
struct hlcache_handle * browser_window_get_content(struct browser_window *bw)
Get a cache handle for the content within a browser window.
size_t length
Length of text.
struct hlcache_handle * content
if NULL, save the content generating the message
bool browser_window_frame_resize_start(struct browser_window *bw, browser_mouse_state mouse, int x, int y, browser_pointer_shape *pointer)
struct form_control * gadget
struct box * box_at_point(const nscss_len_ctx *len_ctx, struct box *box, const int x, const int y, int *box_x, int *box_y)
Find the boxes at a point.
void 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.
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...
Useful interned string pointers (interface).
Corresponds to a single URL.
struct dom_node * node
DOM node that generated this box or NULL.
Private data for text/html content.
2nd modifier key pressed (eg.
struct content_msg_data::@113 select_menu
CONTENT_MSG_SELECTMENU - Create select menu at pointer.
struct content_msg_data::@112 drag
CONTENT_MSG_DRAG - Drag start or end.
bool reflowing
Whether a layout (reflow) is in progress.
Selection in one of our textareas.
html_selection_type selection_type
Current selection state.
textarea_mouse_status
Text area mouse input status flags.
#define NSLOG(catname, level, logmsg, args...)
browser_pointer_shape pointer
CONTENT_MSG_POINTER - Mouse pointer to set.
void browser_window_page_drag_start(struct browser_window *bw, int x, int y)
Start drag scrolling the contents of the browser window.
Internal font handling interfaces.
Single/Multi-line UTF-8 text area interface.
Not own; drag in child content.
Allow drag saving of content.
A selection made or cleared.
Selection in this html content.
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.
struct content_msg_data::@108 dragsave
CONTENT_MSG_DRAGSAVE - Drag save a content.
Box tree construction and manipulation (interface).
char * search_string
Search string or NULL.
bool selection
false for selection cleared
browser_drag_type browser_window_get_drag_type(struct browser_window *bw)
Get type of any current drag for a browser window.
Focus belongs to textarea.
Not own; drag in scrollbar widget.
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.
const char * title
Title, or 0.
For drags we don't own.
void search_step(struct search_context *context, search_flags_t flags, const char *string)
Begins/continues the search process.
Interface to javascript engine functions.
struct search_context * search
Context for free text search, or NULL if none.
void content_broadcast(struct content *c, content_msg msg, const union content_msg_data *data)
Send a message to all users.
const char * messages_get(const char *key)
Fast lookup of a message by key from the standard Messages hash.
struct box * children
First child box, or 0.
enum content_msg_data::@108::@115 type
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.
static void html_overflow_scroll_drag_end(struct scrollbar *scrollbar, browser_mouse_state mouse, int x, int y)
End overflow scroll scrollbar drags.
int width
border-width (pixels)
union html_focus_owner focus_owner
Current input focus target.
textarea_mouse_status textarea_mouse_action(struct textarea *ta, browser_mouse_state mouse, int x, int y)
Handles all kinds of mouse action.
int height
Height of content box (excluding padding etc.).
Not own; drag in textarea widget.
Frame and frameset creation and manipulation (interface).
box_type type
Type of box.
struct rect rect
Rectangle coordinates.
union html_selection_owner selection_owner
Current selection owner.
void browser_window_mouse_click(struct browser_window *bw, browser_mouse_state mouse, int x, int y)
Handle mouse clicks in a browser window.
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.
bool fire_dom_event(dom_string *type, dom_node *target, bool bubbles, bool cancelable)
Construct an event and fire it at the DOM.
char * text
Text, or 0 if none.
content_type content_get_type(struct hlcache_handle *h)
Retrieve computed type of content.
int width
Width of content box (excluding padding etc.).
struct hlcache_handle * object
Object in this box (usually an image), or 0 if none.
Interface to HTML searching.
struct selection sel
HTML content's own text selection object.
bool selection_click(struct selection *s, browser_mouse_state mouse, unsigned idx)
Handles mouse clicks (including drag starts) in or near a selection.
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.
Interface to a number of general purpose functionality.
Browser window creation and manipulation interface.
void box_coords(struct box *box, int *x, int *y)
Find the absolute coordinates of a box.
const char * nsurl_access(const nsurl *url)
Access a NetSurf URL object as a string.
int margin[4]
Margin: TOP, RIGHT, BOTTOM, LEFT.
Text selection within browser windows (interface).
const char * explicit_status_text
CONTENT_MSG_STATUS - Status message update.
download rather than render the uri
nscss_len_ctx len_ctx
CSS length conversion context for document.
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.
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, or nearest in the given direction if the pointer is not over a text box.
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 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.
Wants a specific mouse pointer set.
void html_search_clear(struct content *c)
Terminate a search.
const char * messages_get_errorcode(nserror code)
lookup of a message by errorcode from the standard Messages hash.
struct content_msg_data::@114 gadget_click
CONTENT_MSG_GADGETCLICK - User clicked on a form gadget.
void selection_track(struct selection *s, browser_mouse_state mouse, unsigned idx)
Handles movements related to the selection, eg.
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.
Data specific to CONTENT_HTML.
1st modifier key pressed (eg.
struct scrollbar * scrollbar
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.
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 nserror clip(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.
Interface to core interface table.
css_computed_style * style
Style for this box.
struct netsurf_table * guit
The global interface table.
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.
struct nsurl nsurl
NetSurf URL object.
For getting at selections in this content or things in this content.
bool content_keypress(struct hlcache_handle *h, uint32_t key)
Handle keypresses.
#define nsoption_bool(OPTION)
Get the value of a boolean option.
void font_plot_style_from_css(const nscss_len_ctx *len_ctx, const css_computed_style *css, plot_font_style_t *fstyle)
Populate a font style using data from a computed CSS style.
Extra data for some content_msg messages.
struct browser_window * iframe
Iframe's browser_window, or NULL if none.
Box tree treeview box replacement (interface).
struct gui_layout_table * layout
Layout table.
bool html_keypress(struct content *c, uint32_t key)
Handle keypresses.
Interface to HTML imagemap.