NetSurf
interaction.c
Go to the documentation of this file.
1/*
2 * Copyright 2006 James Bursa <bursa@users.sourceforge.net>
3 * Copyright 2006 Richard Wilson <info@tinct.net>
4 * Copyright 2008 Michael Drake <tlsa@netsurf-browser.org>
5 * Copyright 2009 Paul Blokus <paul_pl@users.sourceforge.net>
6 *
7 * This file is part of NetSurf, http://www.netsurf-browser.org/
8 *
9 * NetSurf is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 2 of the License.
12 *
13 * NetSurf is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22/**
23 * \file
24 * implementation of user interaction with a CONTENT_HTML.
25 */
26
27#include <assert.h>
28#include <stdbool.h>
29#include <string.h>
30
31#include <dom/dom.h>
32
33#include "utils/corestrings.h"
34#include "utils/messages.h"
35#include "utils/utils.h"
36#include "utils/log.h"
37#include "utils/nsoption.h"
38#include "netsurf/content.h"
40#include "netsurf/mouse.h"
41#include "netsurf/misc.h"
42#include "netsurf/layout.h"
43#include "netsurf/keypress.h"
44#include "content/hlcache.h"
45#include "content/textsearch.h"
47#include "desktop/frames.h"
48#include "desktop/scrollbar.h"
49#include "desktop/selection.h"
50#include "desktop/textarea.h"
51#include "javascript/js.h"
53
54#include "html/box.h"
55#include "html/box_textarea.h"
56#include "html/box_inspect.h"
57#include "html/font.h"
58#include "html/form_internal.h"
59#include "html/private.h"
60#include "html/imagemap.h"
61#include "html/interaction.h"
62
63/**
64 * Get pointer shape for given box
65 *
66 * \param box box in question
67 * \param imagemap whether an imagemap applies to the box
68 */
69
71{
73 css_computed_style *style;
74 enum css_cursor_e cursor;
75 lwc_string **cursor_uris;
76
78 style = box->children->style;
79 else
80 style = box->style;
81
82 if (style == NULL)
84
85 cursor = css_computed_cursor(style, &cursor_uris);
86
87 switch (cursor) {
88 case CSS_CURSOR_AUTO:
89 if (box->href || (box->gadget &&
92 imagemap) {
93 /* link */
94 pointer = BROWSER_POINTER_POINT;
95 } else if (box->gadget &&
99 /* text input */
100 pointer = BROWSER_POINTER_CARET;
101 } else {
102 /* html content doesn't mind */
103 pointer = BROWSER_POINTER_AUTO;
104 }
105 break;
106 case CSS_CURSOR_CROSSHAIR:
107 pointer = BROWSER_POINTER_CROSS;
108 break;
109 case CSS_CURSOR_POINTER:
110 pointer = BROWSER_POINTER_POINT;
111 break;
112 case CSS_CURSOR_MOVE:
113 pointer = BROWSER_POINTER_MOVE;
114 break;
115 case CSS_CURSOR_E_RESIZE:
116 pointer = BROWSER_POINTER_RIGHT;
117 break;
118 case CSS_CURSOR_W_RESIZE:
119 pointer = BROWSER_POINTER_LEFT;
120 break;
121 case CSS_CURSOR_N_RESIZE:
122 pointer = BROWSER_POINTER_UP;
123 break;
124 case CSS_CURSOR_S_RESIZE:
125 pointer = BROWSER_POINTER_DOWN;
126 break;
127 case CSS_CURSOR_NE_RESIZE:
128 pointer = BROWSER_POINTER_RU;
129 break;
130 case CSS_CURSOR_SW_RESIZE:
131 pointer = BROWSER_POINTER_LD;
132 break;
133 case CSS_CURSOR_SE_RESIZE:
134 pointer = BROWSER_POINTER_RD;
135 break;
136 case CSS_CURSOR_NW_RESIZE:
137 pointer = BROWSER_POINTER_LU;
138 break;
139 case CSS_CURSOR_TEXT:
140 pointer = BROWSER_POINTER_CARET;
141 break;
142 case CSS_CURSOR_WAIT:
143 pointer = BROWSER_POINTER_WAIT;
144 break;
145 case CSS_CURSOR_PROGRESS:
146 pointer = BROWSER_POINTER_PROGRESS;
147 break;
148 case CSS_CURSOR_HELP:
149 pointer = BROWSER_POINTER_HELP;
150 break;
151 default:
152 pointer = BROWSER_POINTER_DEFAULT;
153 break;
154 }
155
156 return pointer;
157}
158
159
160/**
161 * Start drag scrolling the contents of a box
162 *
163 * \param box the box to be scrolled
164 * \param x x ordinate of initial mouse position
165 * \param y y ordinate
166 */
167
168static void html_box_drag_start(struct box *box, int x, int y)
169{
170 int box_x, box_y;
171 int scroll_mouse_x, scroll_mouse_y;
172
173 box_coords(box, &box_x, &box_y);
174
175 if (box->scroll_x != NULL) {
176 scroll_mouse_x = x - box_x ;
177 scroll_mouse_y = y - (box_y + box->padding[TOP] +
181 scroll_mouse_x, scroll_mouse_y);
182 } else if (box->scroll_y != NULL) {
183 scroll_mouse_x = x - (box_x + box->padding[LEFT] +
184 box->width + box->padding[RIGHT] -
186 scroll_mouse_y = y - box_y;
187
189 scroll_mouse_x, scroll_mouse_y);
190 }
191}
192
193
194/**
195 * End overflow scroll scrollbar drags
196 *
197 * \param html html content
198 * \param mouse state of mouse buttons and modifier keys
199 * \param x coordinate of mouse
200 * \param y coordinate of mouse
201 * \param dir Direction of drag
202 */
203static size_t html_selection_drag_end(struct html_content *html,
204 browser_mouse_state mouse, int x, int y, int dir)
205{
206 int pixel_offset;
207 struct box *box;
208 int dx, dy;
209 size_t idx = 0;
210
211 box = box_pick_text_box(html, x, y, dir, &dx, &dy);
212 if (box) {
213 plot_font_style_t fstyle;
214
216
217 guit->layout->position(&fstyle, box->text, box->length,
218 dx, &idx, &pixel_offset);
219
220 idx += box->byte_offset;
221 }
222
223 return idx;
224}
225
226
227/**
228 * Helper for file gadgets to store their filename.
229 *
230 * Stores the filename unencoded on the dom node associated with the
231 * gadget.
232 *
233 * \todo Get rid of this crap eventually
234 *
235 * \param operation DOM operation
236 * \param key DOM node key being considerd
237 * \param _data The data assocated with the key
238 * \param src The source DOM node.
239 * \param dst The destination DOM node.
240 */
241static void
242html__image_coords_dom_user_data_handler(dom_node_operation operation,
243 dom_string *key,
244 void *_data,
245 struct dom_node *src,
246 struct dom_node *dst)
247{
248 struct image_input_coords *oldcoords, *coords = _data, *newcoords;
249
250 if (!dom_string_isequal(corestring_dom___ns_key_image_coords_node_data,
251 key) || coords == NULL) {
252 return;
253 }
254
255 switch (operation) {
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,
262 newcoords,
264 &oldcoords) == DOM_NO_ERR) {
265 free(oldcoords);
266 }
267 }
268 break;
269
270 case DOM_NODE_DELETED:
271 free(coords);
272 break;
273
274 case DOM_NODE_RENAMED:
275 case DOM_NODE_IMPORTED:
276 case DOM_NODE_ADOPTED:
277 break;
278
279 default:
280 NSLOG(netsurf, INFO, "User data operation not handled.");
281 assert(0);
282 }
283}
284
285
286/**
287 * End overflow scroll scrollbar drags
288 *
289 * \param scrollbar scrollbar widget
290 * \param mouse state of mouse buttons and modifier keys
291 * \param x coordinate of mouse
292 * \param y coordinate of mouse
293 */
294static void
297 int x, int y)
298{
299 int scroll_mouse_x, scroll_mouse_y, box_x, box_y;
301 struct box *box;
302
303 box = data->box;
304 box_coords(box, &box_x, &box_y);
305
307 scroll_mouse_x = x - box_x;
308 scroll_mouse_y = y - (box_y + box->padding[TOP] +
312 scroll_mouse_x, scroll_mouse_y);
313 } else {
314 scroll_mouse_x = x - (box_x + box->padding[LEFT] +
315 box->width + box->padding[RIGHT] -
317 scroll_mouse_y = y - box_y;
319 scroll_mouse_x, scroll_mouse_y);
320 }
321}
322
323
324/**
325 * handle html mouse action when select menu is open
326 *
327 */
328static nserror
330 struct browser_window *bw,
332 int x, int y)
333{
334 struct box *box;
335 int box_x = 0;
336 int box_y = 0;
337 const char *status;
338 int width, height;
339 struct hlcache_handle *bw_content;
340 browser_drag_type bw_drag_type;
341
342 assert(html->visible_select_menu != NULL);
343
344 bw_drag_type = browser_window_get_drag_type(bw);
345 if (bw_drag_type != DRAGGING_NONE && !mouse) {
346 /* drag end: select menu */
348 }
349
350 box = html->visible_select_menu->box;
351 box_coords(box, &box_x, &box_y);
352
353 box_x -= box->border[LEFT].width;
354 box_y += box->height + box->border[BOTTOM].width +
356
358 mouse,
359 x - box_x,
360 y - box_y);
361 if (status != NULL) {
362 /* set status if menu still open */
363 union content_msg_data msg_data;
364 msg_data.explicit_status_text = status;
365 content_broadcast((struct content *)html,
367 &msg_data);
368 return NSERROR_OK;
369 }
370
371 /* close menu and redraw where it was */
373
374 html->visible_select_menu = NULL;
375
376 bw_content = browser_window_get_content(bw);
377 content_request_redraw(bw_content,
378 box_x,
379 box_y,
380 width,
381 height);
382 return NSERROR_OK;
383}
384
385
386/**
387 * handle html mouse action when a selection drag is being performed
388 *
389 */
390static nserror
392 struct browser_window *bw,
394 int x, int y)
395{
396 struct box *box;
397 int dir = -1;
398 int dx, dy;
399 size_t idx;
400 union html_drag_owner drag_owner;
401 int pixel_offset;
402 plot_font_style_t fstyle;
403
404 if (!mouse) {
405 /* End of selection drag */
406 if (selection_dragging_start(html->sel)) {
407 dir = 1;
408 }
409
410 idx = html_selection_drag_end(html, mouse, x, y, dir);
411
412 if (idx != 0) {
413 selection_track(html->sel, mouse, idx);
414 }
415
416 drag_owner.no_owner = true;
417 html_set_drag_type(html, HTML_DRAG_NONE, drag_owner, NULL);
418
419 return NSERROR_OK;
420 }
421
422 if (selection_dragging_start(html->sel)) {
423 dir = 1;
424 }
425
426 box = box_pick_text_box(html, x, y, dir, &dx, &dy);
427 if (box != NULL) {
429
430 guit->layout->position(&fstyle,
431 box->text,
432 box->length,
433 dx,
434 &idx,
435 &pixel_offset);
436
437 selection_track(html->sel, mouse, box->byte_offset + idx);
438 }
439 return NSERROR_OK;
440}
441
442
443/**
444 * handle html mouse action when a scrollbar drag is being performed
445 *
446 */
447static nserror
449 struct browser_window *bw,
451 int x, int y)
452{
453 struct scrollbar *scr;
454 struct html_scrollbar_data *data;
455 struct box *box;
456 int box_x = 0;
457 int box_y = 0;
458 const char *status;
459 int scroll_mouse_x = 0, scroll_mouse_y = 0;
460 scrollbar_mouse_status scrollbar_status;
461
462 scr = html->drag_owner.scrollbar;
463
464 if (!mouse) {
465 /* drag end: scrollbar */
466 html_overflow_scroll_drag_end(scr, mouse, x, y);
467 }
468
469 data = scrollbar_get_data(scr);
470
471 box = data->box;
472
473 box_coords(box, &box_x, &box_y);
474
475 if (scrollbar_is_horizontal(scr)) {
476 scroll_mouse_x = x - box_x ;
477 scroll_mouse_y = y - (box_y + box->padding[TOP] +
480 scrollbar_status = scrollbar_mouse_action(scr,
481 mouse,
482 scroll_mouse_x,
483 scroll_mouse_y);
484 } else {
485 scroll_mouse_x = x - (box_x + box->padding[LEFT] +
486 box->width + box->padding[RIGHT] -
488 scroll_mouse_y = y - box_y;
489
490 scrollbar_status = scrollbar_mouse_action(scr,
491 mouse,
492 scroll_mouse_x,
493 scroll_mouse_y);
494 }
495 status = scrollbar_mouse_status_to_message(scrollbar_status);
496
497 if (status != NULL) {
498 union content_msg_data msg_data;
499
500 msg_data.explicit_status_text = status;
501 content_broadcast((struct content *)html,
503 &msg_data);
504 }
505
506 return NSERROR_OK;
507}
508
509
510/**
511 * handle mouse actions while dragging in a text area
512 */
513static nserror
515 struct browser_window *bw,
517 int x, int y)
518{
519 struct box *box;
520 int box_x = 0;
521 int box_y = 0;
522
523 box = html->drag_owner.textarea;
524
525 assert(box->gadget != NULL);
526 assert(box->gadget->type == GADGET_TEXTAREA ||
529
530 box_coords(box, &box_x, &box_y);
532 mouse,
533 x - box_x,
534 y - box_y);
535
536 /* TODO: Set appropriate statusbar message */
537 return NSERROR_OK;
538}
539
540
541/**
542 * handle mouse actions while dragging in a content
543 */
544static nserror
546 struct browser_window *bw,
548 int x, int y)
549{
550 struct box *box;
551 int box_x = 0;
552 int box_y = 0;
553
554 box = html->drag_owner.content;
555 assert(box->object != NULL);
556
557 box_coords(box, &box_x, &box_y);
559 bw, mouse,
560 x - box_x,
561 y - box_y);
562 return NSERROR_OK;
563}
564
565
566/**
567 * local structure containing all the mouse action state information
568 */
570 struct {
571 const char *status; /**< status text */
572 browser_pointer_shape pointer; /**< pointer shape */
573 enum {
574 ACTION_NONE, /**< default of no action */
575 ACTION_NOSEND, /**< do not send status and pointer message */
576 ACTION_SUBMIT, /**< submit form */
577 ACTION_NAVIGATE, /**< navigate to link url */
578 ACTION_JS, /**< execute link as script */
579 ACTION_BACK, /**< navigate back in history */
580 ACTION_FORWARD, /**< navigate forward in history */
583
584 /** dom node */
585 struct dom_node *node;
586
587 /** html object */
588 struct {
589 struct box *box;
590 int pos_x;
591 int pos_y;
593
594 /** non html object */
596
597 /** iframe */
599
600 /** link either from href or imagemap */
601 struct {
602 struct box *box;
604 const char *target;
607
608 /** gadget */
609 struct {
611 struct box *box;
612 int box_x;
613 int box_y;
614 const char *target;
616
617 /** title */
618 const char *title;
619
620 /** candidate box for drag operation */
622
623 /** scrollbar */
624 struct {
625 struct scrollbar *bar;
629
630 /** text in box */
631 struct {
632 struct box *box;
633 int box_x;
635};
636
637
638/**
639 * iterate the box tree for deepest node at coordinates
640 *
641 * extracts mouse action node information by descending through
642 * visible boxes setting more specific values for:
643 *
644 * box - deepest box at point
645 * html_object_box - html object
646 * html_object_pos_x - html object
647 * html_object_pos_y - html object
648 * object - non html object
649 * iframe - iframe
650 * url - href or imagemap
651 * target - href or imagemap or gadget
652 * url_box - href or imagemap
653 * imagemap - imagemap
654 * gadget - gadget
655 * gadget_box - gadget
656 * gadget_box_x - gadget
657 * gadget_box_y - gadget
658 * title - title
659 * pointer
660 *
661 * drag_candidate - first box with scroll
662 * padding_left - box with scroll
663 * padding_right
664 * padding_top
665 * padding_bottom
666 * scrollbar - inside padding box stops decent
667 * scroll_mouse_x - inside padding box stops decent
668 * scroll_mouse_y - inside padding box stops decent
669 *
670 * text_box - text box
671 * text_box_x - text_box
672 */
673static nserror
675 int x, int y,
676 struct mouse_action_state *man)
677{
678 struct box *box;
679 int box_x = 0;
680 int box_y = 0;
681
682 /* initialise the mouse action state data */
683 memset(man, 0, sizeof(struct mouse_action_state));
684 man->node = html->layout->node; /* Default dom node to the <HTML> */
686
687 /* search the box tree for a link, imagemap, form control, or
688 * box with scrollbars
689 */
690 box = html->layout;
691
692 /* Consider the margins of the html page now */
693 box_x = box->margin[LEFT];
694 box_y = box->margin[TOP];
695
696 do {
697 /* skip hidden boxes */
698 if ((box->style != NULL) &&
699 (css_computed_visibility(box->style) ==
700 CSS_VISIBILITY_HIDDEN)) {
701 goto next_box;
702 }
703
704 if (box->node != NULL) {
705 man->node = box->node;
706 }
707
708 if (box->object) {
710 man->html_object.box = box;
711 man->html_object.pos_x = box_x;
712 man->html_object.pos_y = box_y;
713 } else {
714 man->object = box->object;
715 }
716 }
717
718 if (box->iframe) {
719 man->iframe = box->iframe;
720 }
721
722 if (box->href) {
723 man->link.url = box->href;
724 man->link.target = box->target;
725 man->link.box = box;
726 man->link.is_imagemap = false;
727 }
728
729 if (box->usemap) {
730 man->link.url = imagemap_get(html,
731 box->usemap,
732 box_x,
733 box_y,
734 x, y,
735 &man->link.target);
736 man->link.box = box;
737 man->link.is_imagemap = true;
738 }
739
740 if (box->gadget) {
741 man->gadget.control = box->gadget;
742 man->gadget.box = box;
743 man->gadget.box_x = box_x;
744 man->gadget.box_y = box_y;
745 if (box->gadget->form) {
746 man->gadget.target = box->gadget->form->target;
747 }
748 }
749
750 if (box->title) {
751 man->title = box->title;
752 }
753
754 man->result.pointer = get_pointer_shape(box, false);
755
756 if ((box->scroll_x != NULL) ||
757 (box->scroll_y != NULL)) {
758 int padding_left;
759 int padding_right;
760 int padding_top;
761 int padding_bottom;
762
763 if (man->drag_candidate == NULL) {
764 man->drag_candidate = box;
765 }
766
767 padding_left = box_x +
769 padding_right = padding_left + box->padding[LEFT] +
771 padding_top = box_y +
773 padding_bottom = padding_top + box->padding[TOP] +
775
776 if ((x > padding_left) &&
777 (x < padding_right) &&
778 (y > padding_top) &&
779 (y < padding_bottom)) {
780 /* mouse inside padding box */
781
782 if ((box->scroll_y != NULL) &&
783 (x > (padding_right - SCROLLBAR_WIDTH))) {
784 /* mouse above vertical box scroll */
785
786 man->scroll.bar = box->scroll_y;
787 man->scroll.mouse_x = x - (padding_right - SCROLLBAR_WIDTH);
788 man->scroll.mouse_y = y - padding_top;
789 break;
790
791 } else if ((box->scroll_x != NULL) &&
792 (y > (padding_bottom -
793 SCROLLBAR_WIDTH))) {
794 /* mouse above horizontal box scroll */
795
796 man->scroll.bar = box->scroll_x;
797 man->scroll.mouse_x = x - padding_left;
798 man->scroll.mouse_y = y - (padding_bottom - SCROLLBAR_WIDTH);
799 break;
800 }
801 }
802 }
803
804 if (box->text && !box->object) {
805 man->text.box = box;
806 man->text.box_x = box_x;
807 }
808
809 next_box:
810 /* iterate to next box */
811 box = box_at_point(&html->unit_len_ctx, box, x, y, &box_x, &box_y);
812 } while (box != NULL);
813
814 /* use of box_x, box_y, or content below this point is probably a
815 * mistake; they will refer to the last box returned by box_at_point */
816
817 assert(man->node != NULL);
818
819 return NSERROR_OK;
820}
821
822
823/**
824 * process mouse activity on a form gadget
825 */
826static nserror
829 int x, int y,
830 struct mouse_action_state *mas)
831{
832 struct content *c = (struct content *)html;
833 textarea_mouse_status ta_status;
834 union content_msg_data msg_data;
835 nserror res;
836 bool click;
840
841 switch (mas->gadget.control->type) {
842 case GADGET_SELECT:
843 mas->result.status = messages_get("FormSelect");
845 if (mouse & BROWSER_MOUSE_CLICK_1 &&
846 nsoption_bool(core_select_menu)) {
848 res = form_open_select_menu(c,
849 mas->gadget.control,
851 c);
852 if (res != NSERROR_OK) {
853 NSLOG(netsurf, ERROR, "%s",
855 html->visible_select_menu = NULL;
856 }
858 } else if (mouse & BROWSER_MOUSE_CLICK_1) {
859 msg_data.select_menu.gadget = mas->gadget.control;
862 &msg_data);
863 }
864 break;
865
866 case GADGET_CHECKBOX:
867 mas->result.status = messages_get("FormCheckbox");
868 if (mouse & BROWSER_MOUSE_CLICK_1) {
870 dom_html_input_element_set_checked(
871 (dom_html_input_element *)(mas->gadget.control->node),
872 mas->gadget.control->selected);
873 html__redraw_a_box(html, mas->gadget.box);
874 }
875 break;
876
877 case GADGET_RADIO:
878 mas->result.status = messages_get("FormRadio");
879 if (mouse & BROWSER_MOUSE_CLICK_1) {
881 }
882 break;
883
884 case GADGET_IMAGE:
885 /* This falls through to SUBMIT */
886 if (mouse & BROWSER_MOUSE_CLICK_1) {
887 struct image_input_coords *coords, *oldcoords;
888 /** \todo Find a way to not ignore errors */
889 coords = calloc(1, sizeof(*coords));
890 if (coords == NULL) {
891 return NSERROR_OK;
892 }
893 coords->x = x - mas->gadget.box_x;
894 coords->y = y - mas->gadget.box_y;
895 if (dom_node_set_user_data(
896 mas->gadget.control->node,
897 corestring_dom___ns_key_image_coords_node_data,
898 coords,
900 &oldcoords) != DOM_NO_ERR) {
901 return NSERROR_OK;
902 }
903 free(oldcoords);
904 }
906
907 case GADGET_SUBMIT:
908 if (mas->gadget.control->form) {
909 static char status_buffer[200];
910
911 snprintf(status_buffer,
912 sizeof status_buffer,
913 messages_get("FormSubmit"),
914 mas->gadget.control->form->action);
915 mas->result.status = status_buffer;
917 false);
918 if (mouse & (BROWSER_MOUSE_CLICK_1 |
920 mas->result.action = ACTION_SUBMIT;
921 }
922 } else {
923 mas->result.status = messages_get("FormBadSubmit");
924 }
925 break;
926
927 case GADGET_TEXTBOX:
928 case GADGET_PASSWORD:
929 case GADGET_TEXTAREA:
930 if (mas->gadget.control->type == GADGET_TEXTAREA) {
931 mas->result.status = messages_get("FormTextarea");
932 } else {
933 mas->result.status = messages_get("FormTextbox");
934 }
935
936 if (click &&
938 html->selection_owner.textarea != mas->gadget.box)) {
939 union html_selection_owner sel_owner;
940 sel_owner.none = true;
943 sel_owner,
944 true);
945 }
946
947 ta_status = textarea_mouse_action(mas->gadget.control->data.text.ta,
948 mouse,
949 x - mas->gadget.box_x,
950 y - mas->gadget.box_y);
951
952 if (ta_status & TEXTAREA_MOUSE_EDITOR) {
953 mas->result.pointer = get_pointer_shape(mas->gadget.box, false);
954 } else {
956 mas->result.status = scrollbar_mouse_status_to_message(ta_status >> 3);
957 }
958 break;
959
960 case GADGET_HIDDEN:
961 /* not possible: no box generated */
962 break;
963
964 case GADGET_RESET:
965 mas->result.status = messages_get("FormReset");
966 break;
967
968 case GADGET_FILE:
969 mas->result.status = messages_get("FormFile");
970 if (mouse & BROWSER_MOUSE_CLICK_1) {
971 msg_data.gadget_click.gadget = mas->gadget.control;
974 &msg_data);
975 }
976 break;
977
978 case GADGET_BUTTON:
979 /* This gadget cannot be activated */
980 mas->result.status = messages_get("FormButton");
981 break;
982 }
983
984 return NSERROR_OK;
985}
986
987
988/**
989 * process mouse activity on an iframe
990 */
991static nserror
994 int x, int y,
995 struct mouse_action_state *mas)
996{
997 int pos_x, pos_y;
998 float scale;
999
1000 scale = browser_window_get_scale(bw);
1001
1002 browser_window_get_position(mas->iframe, false, &pos_x, &pos_y);
1003
1004 if (mouse & BROWSER_MOUSE_CLICK_1 ||
1005 mouse & BROWSER_MOUSE_CLICK_2) {
1007 mouse,
1008 (x * scale) - pos_x,
1009 (y * scale) - pos_y);
1010 } else {
1012 mouse,
1013 (x * scale) - pos_x,
1014 (y * scale) - pos_y);
1015 }
1016 mas->result.action = ACTION_NOSEND;
1017
1018 return NSERROR_OK;
1019}
1020
1021
1022/**
1023 * process mouse activity on an html object
1024 */
1025static nserror
1027 struct browser_window *bw,
1028 browser_mouse_state mouse,
1029 int x, int y,
1030 struct mouse_action_state *mas)
1031{
1032 bool click;
1033 click = mouse & (BROWSER_MOUSE_PRESS_1 | BROWSER_MOUSE_PRESS_2 |
1036
1037 if (click &&
1039 html->selection_owner.content != mas->html_object.box)) {
1040 union html_selection_owner sel_owner;
1041 sel_owner.none = true;
1042 html_set_selection(html, HTML_SELECTION_NONE, sel_owner, true);
1043 }
1044
1045 if (mouse & BROWSER_MOUSE_CLICK_1 ||
1046 mouse & BROWSER_MOUSE_CLICK_2) {
1048 bw,
1049 mouse,
1050 x - mas->html_object.pos_x,
1051 y - mas->html_object.pos_y);
1052 } else {
1054 bw,
1055 mouse,
1056 x - mas->html_object.pos_x,
1057 y - mas->html_object.pos_y);
1058 }
1059
1060 mas->result.action = ACTION_NOSEND;
1061 return NSERROR_OK;
1062}
1063
1064
1065/**
1066 * determine if a url has a javascript scheme
1067 *
1068 * \param urm The url to check.
1069 * \return true if the url is a javascript scheme else false
1070 */
1072{
1073 bool is_js = false;
1074 lwc_string *scheme;
1075
1076 scheme = nsurl_get_component(url, NSURL_SCHEME);
1077 if (scheme != NULL) {
1078 if (scheme == corestring_lwc_javascript) {
1079 is_js = true;
1080 }
1081 lwc_string_unref(scheme);
1082 }
1083 return is_js;
1084}
1085
1086
1087/**
1088 * process mouse activity on a link
1089 */
1090static nserror
1092 struct browser_window *bw,
1093 browser_mouse_state mouse,
1094 int x, int y,
1095 struct mouse_action_state *mas)
1096{
1097 nserror res;
1098 char *url_s = NULL;
1099 size_t url_l = 0;
1100 static char status_buffer[200];
1101 union content_msg_data msg_data;
1102
1103 if (nsoption_bool(display_decoded_idn) == true) {
1104 res = nsurl_get_utf8(mas->link.url, &url_s, &url_l);
1105 if (res != NSERROR_OK) {
1106 /* Unable to obtain a decoded IDN. This is not
1107 * a fatal error. Ensure the string pointer
1108 * is NULL so we use the encoded version.
1109 */
1110 url_s = NULL;
1111 }
1112 }
1113
1114 if (mas->title) {
1115 snprintf(status_buffer,
1116 sizeof status_buffer,
1117 "%s: %s",
1118 url_s ? url_s : nsurl_access(mas->link.url),
1119 mas->title);
1120 } else {
1121 snprintf(status_buffer,
1122 sizeof status_buffer,
1123 "%s",
1124 url_s ? url_s : nsurl_access(mas->link.url));
1125 }
1126
1127 if (url_s != NULL) {
1128 free(url_s);
1129 }
1130
1131 mas->result.status = status_buffer;
1132
1134 mas->link.is_imagemap);
1135
1136 if (mouse & BROWSER_MOUSE_CLICK_1 &&
1137 mouse & BROWSER_MOUSE_MOD_1) {
1138 /* force download of link */
1140 mas->link.url,
1141 content_get_url((struct content *)html),
1143 NULL,
1144 NULL,
1145 NULL);
1146
1147 } else if (mouse & BROWSER_MOUSE_CLICK_2 &&
1148 mouse & BROWSER_MOUSE_MOD_1) {
1149 msg_data.savelink.url = mas->link.url;
1150 msg_data.savelink.title = mas->title;
1151 content_broadcast((struct content *)html,
1153 &msg_data);
1154
1155 } else if (mouse & (BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_CLICK_2)) {
1157 mas->result.action = ACTION_JS;
1158 } else {
1159 mas->result.action = ACTION_NAVIGATE;
1160 }
1161 }
1162
1163 return NSERROR_OK;
1164}
1165
1166
1167static nserror
1169{
1170 if (mouse && mouse < BROWSER_MOUSE_MOD_1) {
1171 /* ensure key presses still act on the browser window */
1172 union html_focus_owner fo;
1173 fo.self = true;
1174 html_set_focus(html, HTML_FOCUS_SELF, fo, true, 0, 0, 0, NULL);
1175 }
1176
1177 return NSERROR_OK;
1178}
1179
1180
1181/**
1182 * process mouse activity if it is not anything else
1183 */
1184static nserror
1186 struct browser_window *bw,
1187 browser_mouse_state mouse,
1188 int x, int y,
1189 struct mouse_action_state *mas)
1190{
1191 struct content *c = (struct content *)html;
1192
1193 /* frame resizing */
1194 if (browser_window_frame_resize_start(bw, mouse, x, y, &mas->result.pointer)) {
1196 mas->result.status = messages_get("FrameDrag");
1197 }
1198 return default_mouse_action_focus(html, mouse);
1199 }
1200
1201 /* clicking in the main page removes the selection from any text areas.
1202 */
1203 union html_selection_owner sel_owner;
1204 bool click;
1205 click = mouse & (BROWSER_MOUSE_PRESS_1 | BROWSER_MOUSE_PRESS_2 |
1208
1209 if (click && html->focus_type != HTML_FOCUS_SELF) {
1210 union html_focus_owner fo;
1211 fo.self = true;
1212 html_set_focus(html, HTML_FOCUS_SELF, fo, true, 0, 0, 0, NULL);
1213 }
1214 if (click && html->selection_type != HTML_SELECTION_SELF) {
1215 sel_owner.none = true;
1216 html_set_selection(html, HTML_SELECTION_NONE, sel_owner, true);
1217 }
1218
1219 if (mas->text.box) {
1220 int pixel_offset;
1221 size_t idx;
1222 plot_font_style_t fstyle;
1223
1225 mas->text.box->style,
1226 &fstyle);
1227
1228 guit->layout->position(&fstyle,
1229 mas->text.box->text,
1230 mas->text.box->length,
1231 x - mas->text.box_x,
1232 &idx,
1233 &pixel_offset);
1234
1235 if (selection_click(html->sel,
1236 html->bw,
1237 mouse,
1238 mas->text.box->byte_offset + idx)) {
1239 /* key presses must be directed at the
1240 * main browser window, paste text
1241 * operations ignored */
1242 html_drag_type drag_type;
1243 union html_drag_owner drag_owner;
1244
1245 if (selection_dragging(html->sel)) {
1246 drag_type = HTML_DRAG_SELECTION;
1247 drag_owner.no_owner = true;
1248 html_set_drag_type(html,
1249 drag_type,
1250 drag_owner,
1251 NULL);
1252 mas->result.status = messages_get("Selecting");
1253 }
1254
1255 if (selection_active(html->sel)) {
1256 sel_owner.none = false;
1258 sel_owner, true);
1259 } else if (click && html->selection_type != HTML_SELECTION_NONE) {
1260 sel_owner.none = true;
1262 sel_owner, true);
1263 }
1264
1265 return default_mouse_action_focus(html, mouse);
1266 }
1267
1268 } else if (mouse & BROWSER_MOUSE_PRESS_1) {
1269 sel_owner.none = true;
1270 selection_clear(html->sel, true);
1271 }
1272
1273 if (selection_active(html->sel)) {
1274 sel_owner.none = false;
1275 html_set_selection(html, HTML_SELECTION_SELF, sel_owner, true);
1276 } else if (click && html->selection_type != HTML_SELECTION_NONE) {
1277 sel_owner.none = true;
1278 html_set_selection(html, HTML_SELECTION_NONE, sel_owner, true);
1279 }
1280
1281 if (mas->title) {
1282 mas->result.status = mas->title;
1283 }
1284
1285 if (mouse & BROWSER_MOUSE_DRAG_1) {
1286 if (mouse & BROWSER_MOUSE_MOD_2) {
1287 union content_msg_data msg_data;
1289 msg_data.dragsave.content = NULL;
1291 } else {
1292 if (mas->drag_candidate == NULL) {
1294 } else {
1296 }
1298 }
1299 } else if (mouse & BROWSER_MOUSE_DRAG_2) {
1300 if (mouse & BROWSER_MOUSE_MOD_2) {
1301 union content_msg_data msg_data;
1303 msg_data.dragsave.content = NULL;
1305 } else {
1306 if (mas->drag_candidate == NULL) {
1308 } else {
1310 }
1312 }
1313 }
1314
1315
1316 return default_mouse_action_focus(html, mouse);
1317}
1318
1319
1320/**
1321 * handle non dragging mouse actions
1322 */
1323static nserror
1325 struct browser_window *bw,
1326 browser_mouse_state mouse,
1327 int x, int y)
1328{
1329 nserror res;
1330 struct content *c = (struct content *)html;
1331 union content_msg_data msg_data;
1332 lwc_string *path;
1333
1334 /**
1335 * computed state
1336 *
1337 * not on heap to avoid allocation or stack because it is large
1338 */
1339 static struct mouse_action_state mas;
1340
1341 res = get_mouse_action_node(html, x, y, &mas);
1342 if (res != NSERROR_OK) {
1343 return res;
1344 }
1345
1346 if (mouse & BROWSER_MOUSE_CLICK_4) {
1348 } else if (mouse & BROWSER_MOUSE_CLICK_5) {
1350 } else if (mas.scroll.bar) {
1353 mouse,
1354 mas.scroll.mouse_x,
1355 mas.scroll.mouse_y));
1357
1358 } else if (mas.gadget.control) {
1359 res = gadget_mouse_action(html, mouse, x, y, &mas);
1360
1361 } else if ((mas.object != NULL) && (mouse & BROWSER_MOUSE_MOD_2)) {
1362
1363 if (mouse & BROWSER_MOUSE_DRAG_2) {
1364 msg_data.dragsave.type = CONTENT_SAVE_NATIVE;
1365 msg_data.dragsave.content = mas.object;
1367
1368 } else if (mouse & BROWSER_MOUSE_DRAG_1) {
1369 msg_data.dragsave.type = CONTENT_SAVE_ORIG;
1370 msg_data.dragsave.content = mas.object;
1372 }
1373
1374 /* \todo should have a drag-saving object msg */
1375
1376 } else if (mas.iframe != NULL) {
1377 res = iframe_mouse_action(bw, mouse, x, y, &mas);
1378
1379 } else if (mas.html_object.box != NULL) {
1380 res = html_object_mouse_action(html, bw, mouse, x, y, &mas);
1381
1382 } else if (mas.link.url != NULL) {
1383 res = link_mouse_action(html, bw, mouse, x, y, &mas);
1384
1385 } else {
1386 res = default_mouse_action(html, bw, mouse, x, y, &mas);
1387
1388 }
1389 if (res != NSERROR_OK) {
1390 return res;
1391 }
1392
1393 /* send status and pointer message */
1394 if (mas.result.action != ACTION_NOSEND) {
1395 msg_data.explicit_status_text = mas.result.status;
1397
1398 msg_data.pointer = mas.result.pointer;
1400 }
1401
1402 /* fire dom click event */
1403 if (mouse & BROWSER_MOUSE_CLICK_1) {
1404 fire_generic_dom_event(corestring_dom_click, mas.node, true, true);
1405 }
1406
1407 /* deferred actions that can cause this browser_window to be destroyed
1408 * and must therefore be done after set_status/pointer
1409 */
1410 switch (mas.result.action) {
1411 case ACTION_SUBMIT:
1414 mas.gadget.target,
1415 mouse),
1416 mas.gadget.control->form,
1417 mas.gadget.control);
1418 break;
1419
1420 case ACTION_NAVIGATE:
1423 mas.link.target,
1424 mouse),
1425 mas.link.url,
1426 content_get_url(c),
1428 NULL,
1429 NULL,
1430 NULL);
1431 break;
1432
1433 case ACTION_JS:
1435 if (path != NULL) {
1436 html_exec(c,
1437 lwc_string_data(path),
1438 lwc_string_length(path));
1439 lwc_string_unref(path);
1440 }
1441 break;
1442
1443 case ACTION_BACK:
1444 res = browser_window_history_back(bw, false);
1445 break;
1446
1447 case ACTION_FORWARD:
1448 res = browser_window_history_forward(bw, false);
1449 break;
1450
1451 case ACTION_NOSEND:
1452 case ACTION_NONE:
1453 res = NSERROR_OK;
1454 break;
1455 }
1456
1457 return res;
1458}
1459
1460
1461/* exported interface documented in html/interaction.h */
1463 struct browser_window *bw,
1464 browser_mouse_state mouse,
1465 int x, int y)
1466{
1467 return html_mouse_action(c, bw, mouse, x, y);
1468}
1469
1470
1471/* exported interface documented in html/interaction.h */
1472nserror
1474 struct browser_window *bw,
1475 browser_mouse_state mouse,
1476 int x, int y)
1477{
1478 html_content *html = (html_content *)c;
1479 nserror res = NSERROR_OK;
1480
1481 /* handle open select menu */
1482 if (html->visible_select_menu != NULL) {
1483 return mouse_action_select_menu(html, bw, mouse, x, y);
1484 }
1485
1486 /* handle content drag */
1487 switch (html->drag_type) {
1489 res = mouse_action_drag_selection(html, bw, mouse, x, y);
1490 break;
1491
1493 res = mouse_action_drag_scrollbar(html, bw, mouse, x, y);
1494 break;
1495
1498 res = mouse_action_drag_textarea(html, bw, mouse, x, y);
1499 break;
1500
1503 res = mouse_action_drag_content(html, bw, mouse, x, y);
1504 break;
1505
1506 case HTML_DRAG_NONE:
1507 res = mouse_action_drag_none(html, bw, mouse, x, y);
1508 break;
1509
1510 default:
1511 /* Unknown content related drag type */
1512 assert(0 && "Unknown content related drag type");
1513 }
1514
1515 if (res != NSERROR_OK) {
1516 NSLOG(netsurf, ERROR, "%s", messages_get_errorcode(res));
1517 }
1518
1519 return res;
1520}
1521
1522
1523/**
1524 * Handle keypresses.
1525 *
1526 * \param c content of type HTML
1527 * \param key The UCS4 character codepoint
1528 * \return true if key handled, false otherwise
1529 */
1530bool html_keypress(struct content *c, uint32_t key)
1531{
1532 html_content *html = (html_content *) c;
1533 struct selection *sel = html->sel;
1534
1535 /** \todo
1536 * At the moment, the front end interface for keypress only gives
1537 * us a UCS4 key value. This doesn't doesn't have all the information
1538 * we need to fill out the event properly. We don't get to know about
1539 * modifier keys, and things like CTRL+C are passed in as
1540 * \ref NS_KEY_COPY_SELECTION, a magic value outside the valid Unicode
1541 * range.
1542 *
1543 * We need to:
1544 *
1545 * 1. Update the front end interface so that both press and release
1546 * events reach the core.
1547 * 2. Stop encoding the special keys like \ref NS_KEY_COPY_SELECTION as
1548 * magic values in the front ends, so we just get the events, e.g.:
1549 * 1. Press ctrl
1550 * 2. Press c
1551 * 3. Release c
1552 * 4. Release ctrl
1553 * 3. Pass all the new info to the DOM KeyboardEvent events.
1554 * 4. If there is a focused element, fire the event at that, instead of
1555 * `html->layout->node`.
1556 * 5. Rebuild the \ref NS_KEY_COPY_SELECTION values from the info we
1557 * now get given, and use that for the code below this
1558 * \ref fire_dom_keyboard_event call.
1559 * 6. Move the code after this \ref fire_dom_keyboard_event call into
1560 * the default action handler for DOM events.
1561 *
1562 * This will mean that if the JavaScript event listener does
1563 * `event.preventDefault()` then we won't handle the event when
1564 * we're not supposed to.
1565 */
1566 if (html->layout != NULL && html->layout->node != NULL) {
1567 fire_dom_keyboard_event(corestring_dom_keydown,
1568 html->layout->node, true, true, key);
1569 }
1570
1571 switch (html->focus_type) {
1572 case HTML_FOCUS_CONTENT:
1573 return content_keypress(html->focus_owner.content->object, key);
1574
1576 if (box_textarea_keypress(html, html->focus_owner.textarea, key) == NSERROR_OK) {
1577 return true;
1578 } else {
1579 return false;
1580 }
1581
1582 default:
1583 /* Deal with it below */
1584 break;
1585 }
1586
1587 switch (key) {
1590 return true;
1591
1593 selection_clear(sel, true);
1594 return true;
1595
1596 case NS_KEY_SELECT_ALL:
1598 return true;
1599
1600 case NS_KEY_ESCAPE:
1601 /* if there's no selection, leave Escape for the caller */
1602 return selection_clear(sel, true);
1603 }
1604
1605 return false;
1606}
1607
1608
1609/**
1610 * Callback for in-page scrollbars.
1611 */
1612void html_overflow_scroll_callback(void *client_data,
1613 struct scrollbar_msg_data *scrollbar_data)
1614{
1615 struct html_scrollbar_data *data = client_data;
1616 html_content *html = (html_content *)data->c;
1617 struct box *box = data->box;
1618 union content_msg_data msg_data;
1619 html_drag_type drag_type;
1620 union html_drag_owner drag_owner;
1621
1622 switch(scrollbar_data->msg) {
1624
1625 if (html->reflowing == true) {
1626 /* Can't redraw during layout, and it will
1627 * be redrawn after layout anyway. */
1628 break;
1629 }
1630
1631 html__redraw_a_box(html, box);
1632 break;
1634 {
1635 struct rect rect = {
1636 .x0 = scrollbar_data->x0,
1637 .y0 = scrollbar_data->y0,
1638 .x1 = scrollbar_data->x1,
1639 .y1 = scrollbar_data->y1
1640 };
1641 drag_type = HTML_DRAG_SCROLLBAR;
1642 drag_owner.scrollbar = scrollbar_data->scrollbar;
1643 html_set_drag_type(html, drag_type, drag_owner, &rect);
1644 }
1645 break;
1647 drag_type = HTML_DRAG_NONE;
1648 drag_owner.no_owner = true;
1649 html_set_drag_type(html, drag_type, drag_owner, NULL);
1650
1651 msg_data.pointer = BROWSER_POINTER_AUTO;
1652 content_broadcast(data->c, CONTENT_MSG_POINTER, &msg_data);
1653 break;
1654 }
1655}
1656
1657
1658/* Documented in html_internal.h */
1660 union html_drag_owner drag_owner, const struct rect *rect)
1661{
1662 union content_msg_data msg_data;
1663
1664 assert(html != NULL);
1665
1666 html->drag_type = drag_type;
1667 html->drag_owner = drag_owner;
1668
1669 switch (drag_type) {
1670 case HTML_DRAG_NONE:
1671 assert(drag_owner.no_owner == true);
1672 msg_data.drag.type = CONTENT_DRAG_NONE;
1673 break;
1674
1678 msg_data.drag.type = CONTENT_DRAG_SCROLL;
1679 break;
1680
1682 assert(drag_owner.no_owner == true);
1686 msg_data.drag.type = CONTENT_DRAG_SELECTION;
1687 break;
1688 }
1689 msg_data.drag.rect = rect;
1690
1691 /* Inform of the content's drag status change */
1692 content_broadcast((struct content *)html, CONTENT_MSG_DRAG, &msg_data);
1693}
1694
1695/* Documented in html_internal.h */
1697 union html_focus_owner focus_owner, bool hide_caret,
1698 int x, int y, int height, const struct rect *clip)
1699{
1700 union content_msg_data msg_data;
1701 int x_off = 0;
1702 int y_off = 0;
1703 struct rect cr;
1704 bool textarea_lost_focus = html->focus_type == HTML_FOCUS_TEXTAREA &&
1705 focus_type != HTML_FOCUS_TEXTAREA;
1706
1707 assert(html != NULL);
1708
1709 switch (focus_type) {
1710 case HTML_FOCUS_SELF:
1711 assert(focus_owner.self == true);
1712 if (html->focus_type == HTML_FOCUS_SELF)
1713 /* Don't need to tell anyone anything */
1714 return;
1715 break;
1716
1717 case HTML_FOCUS_CONTENT:
1718 box_coords(focus_owner.content, &x_off, &y_off);
1719 break;
1720
1722 box_coords(focus_owner.textarea, &x_off, &y_off);
1723 break;
1724 }
1725
1726 html->focus_type = focus_type;
1727 html->focus_owner = focus_owner;
1728
1729 if (textarea_lost_focus) {
1730 msg_data.caret.type = CONTENT_CARET_REMOVE;
1731 } else if (focus_type != HTML_FOCUS_SELF && hide_caret) {
1732 msg_data.caret.type = CONTENT_CARET_HIDE;
1733 } else {
1734 if (clip != NULL) {
1735 cr = *clip;
1736 cr.x0 += x_off;
1737 cr.y0 += y_off;
1738 cr.x1 += x_off;
1739 cr.y1 += y_off;
1740 }
1741
1742 msg_data.caret.type = CONTENT_CARET_SET_POS;
1743 msg_data.caret.pos.x = x + x_off;
1744 msg_data.caret.pos.y = y + y_off;
1745 msg_data.caret.pos.height = height;
1746 msg_data.caret.pos.clip = (clip == NULL) ? NULL : &cr;
1747 }
1748
1749 /* Inform of the content's drag status change */
1750 content_broadcast((struct content *)html, CONTENT_MSG_CARET, &msg_data);
1751}
1752
1753/* Documented in html_internal.h */
1755 union html_selection_owner selection_owner, bool read_only)
1756{
1757 union content_msg_data msg_data;
1758 struct box *box;
1759 bool changed = false;
1760 bool same_type = html->selection_type == selection_type;
1761
1762 assert(html != NULL);
1763
1764 if ((selection_type == HTML_SELECTION_NONE &&
1766 (selection_type != HTML_SELECTION_NONE &&
1768 /* Existance of selection has changed, and we'll need to
1769 * inform our owner */
1770 changed = true;
1771
1772 /* Clear any existing selection */
1773 if (html->selection_type != HTML_SELECTION_NONE) {
1774 switch (html->selection_type) {
1776 if (same_type)
1777 break;
1778 selection_clear(html->sel, true);
1779 break;
1781 if (same_type && html->selection_owner.textarea ==
1782 selection_owner.textarea)
1783 break;
1786 break;
1788 if (same_type && html->selection_owner.content ==
1789 selection_owner.content)
1790 break;
1791 box = html->selection_owner.content;
1793 break;
1794 default:
1795 break;
1796 }
1797 }
1798
1799 html->selection_type = selection_type;
1800 html->selection_owner = selection_owner;
1801
1802 if (!changed)
1803 /* Don't need to report lack of change to owner */
1804 return;
1805
1806 /* Prepare msg */
1807 switch (selection_type) {
1809 assert(selection_owner.none == true);
1810 msg_data.selection.selection = false;
1811 break;
1813 assert(selection_owner.none == false);
1817 msg_data.selection.selection = true;
1818 break;
1819 default:
1820 break;
1821 }
1822 msg_data.selection.read_only = read_only;
1823
1824 /* Inform of the content's selection status change */
1826 &msg_data);
1827}
Box interface.
@ BOX_FLOAT_LEFT
Definition: box.h:63
@ BOX_FLOAT_RIGHT
Definition: box.h:64
@ TOP
Definition: box.h:98
@ BOTTOM
Definition: box.h:98
@ LEFT
Definition: box.h:98
@ RIGHT
Definition: box.h:98
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.
Definition: box_inspect.c:583
void box_coords(struct box *box, int *x, int *y)
Find the absolute coordinates of a box.
Definition: box_inspect.c:549
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,...
Definition: box_inspect.c:850
HTML Box tree inspection interface.
nserror box_textarea_keypress(html_content *html, struct box *box, uint32_t key)
Handle form textarea keypress input.
Definition: box_textarea.c:43
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
@ DRAGGING_NONE
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.
Definition: font.c:135
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.
Definition: content.c:421
void content_broadcast(struct content *c, content_msg msg, const union content_msg_data *data)
Send a message to all users.
Definition: content.c:752
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.
Definition: content.c:450
void content_clear_selection(hlcache_handle *h)
Tell a content that any selection it has, or one of its objects has, must be cleared.
Definition: content.c:847
bool content_keypress(struct hlcache_handle *h, uint32_t key)
Handle keypresses.
Definition: content.c:437
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.
Definition: content.c:398
nsurl * content_get_url(struct content *c)
Retrieve URL associated with content.
Definition: content.c:1051
@ CONTENT_HTML
content is HTML
Definition: content_type.h:58
@ CONTENT_MSG_SELECTMENU
Create a select menu.
Definition: content_type.h:173
@ CONTENT_MSG_GADGETCLICK
A gadget has been clicked on (mainly for file)
Definition: content_type.h:176
@ CONTENT_MSG_STATUS
new status string
Definition: content_type.h:128
@ CONTENT_MSG_DRAGSAVE
Allow drag saving of content.
Definition: content_type.h:155
@ CONTENT_MSG_POINTER
Wants a specific mouse pointer set.
Definition: content_type.h:161
@ CONTENT_MSG_SELECTION
A selection made or cleared.
Definition: content_type.h:164
@ CONTENT_MSG_DRAG
A drag started or ended.
Definition: content_type.h:170
@ CONTENT_MSG_SAVELINK
Allow URL to be saved.
Definition: content_type.h:158
@ CONTENT_MSG_CARET
Caret movement / hiding.
Definition: content_type.h:167
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.
Definition: selection.c:319
bool selection_clear(struct selection *s, bool redraw)
Clears the current selection, optionally causing the screen to be updated.
Definition: selection.c:518
bool selection_copy_to_clipboard(struct selection *s)
Copy the selected contents to the clipboard.
Definition: selection.c:484
bool selection_dragging_start(struct selection *s)
Definition: selection.c:596
void selection_track(struct selection *s, browser_mouse_state mouse, unsigned idx)
Handles movements related to the selection, eg.
Definition: selection.c:420
bool selection_active(struct selection *s)
determine if a selecion is active
Definition: selection.c:586
bool selection_dragging(struct selection *s)
Definition: selection.c:591
void selection_select_all(struct selection *s)
Selects all the text within the box subtree controlled by this selection object, updating the screen ...
Definition: selection.c:542
Text selection within browser windows (interface).
bool textarea_clear_selection(struct textarea *ta)
Clear any selection in the textarea.
Definition: textarea.c:3205
textarea_mouse_status textarea_mouse_action(struct textarea *ta, browser_mouse_state mouse, int x, int y)
Handles all kinds of mouse action.
Definition: textarea.c:3069
Single/Multi-line UTF-8 text area interface.
textarea_mouse_status
Text area mouse input status flags.
Definition: textarea.h:130
@ TEXTAREA_MOUSE_EDITOR
Hover: caret pointer.
Definition: textarea.h:133
nserror
Enumeration of error codes.
Definition: errors.h:29
@ NSERROR_OK
No error.
Definition: errors.h:30
void form_select_menu_callback(void *client_data, int x, int y, int width, int height)
Callback for the core select menu.
Definition: form.c:1974
void form_select_get_dimensions(struct form_control *control, int *width, int *height)
Get the dimensions of a select menu.
Definition: form.c:1965
void form_select_mouse_drag_end(struct form_control *control, browser_mouse_state mouse, int x, int y)
Handle mouse drag end for the currently opened select menu.
Definition: form.c:1924
const char * form_select_mouse_action(struct form_control *control, browser_mouse_state mouse, int x, int y)
Handle mouse action for the currently opened select menu.
Definition: form.c:1874
nserror form_open_select_menu(void *client_data, struct form_control *control, select_menu_redraw_callback callback, struct content *c)
Open a select menu for a select form control, creating it if necessary.
Definition: form.c:1569
void form_radio_set(struct form_control *radio)
Set a radio form control and clear the others in the group.
Definition: form.c:1994
nserror form_submit(nsurl *page_url, struct browser_window *target, struct form *form, struct form_control *submit_button)
navigate browser window based on form submission.
Definition: form.c:2047
Interface to form handling functions internal to HTML content handler.
@ GADGET_SUBMIT
Definition: form_internal.h:56
@ GADGET_TEXTAREA
Definition: form_internal.h:53
@ GADGET_HIDDEN
Definition: form_internal.h:48
@ GADGET_RESET
Definition: form_internal.h:57
@ GADGET_BUTTON
Definition: form_internal.h:59
@ GADGET_IMAGE
Definition: form_internal.h:54
@ GADGET_PASSWORD
Definition: form_internal.h:55
@ GADGET_CHECKBOX
Definition: form_internal.h:51
@ GADGET_FILE
Definition: form_internal.h:58
@ GADGET_SELECT
Definition: form_internal.h:52
@ GADGET_TEXTBOX
Definition: form_internal.h:49
@ GADGET_RADIO
Definition: form_internal.h:50
bool browser_window_frame_resize_start(struct browser_window *bw, browser_mouse_state mouse, int x, int y, browser_pointer_shape *pointer)
Definition: frames.c:1039
Frame and frameset creation and manipulation (interface).
struct netsurf_table * guit
The global interface table.
Definition: gui_factory.c:50
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
Definition: html.c:2090
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.
Definition: html.c:133
void html__redraw_a_box(struct html_content *html, struct box *box)
Redraw a box.
Definition: html.c:1130
bool fire_generic_dom_event(dom_string *type, dom_node *target, bool bubbles, bool cancelable)
Construct an event and fire it at the DOM.
Definition: html.c:111
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.
Definition: imagemap.c:737
Interface to HTML imagemap.
Public content interface.
content_type content_get_type(struct hlcache_handle *h)
Retrieve computed type of content.
Definition: content.c:1061
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.
Definition: mouse.h:135
@ BROWSER_POINTER_CARET
Definition: mouse.h:138
@ BROWSER_POINTER_RD
Definition: mouse.h:147
@ BROWSER_POINTER_WAIT
Definition: mouse.h:150
@ BROWSER_POINTER_UP
Definition: mouse.h:140
@ BROWSER_POINTER_LEFT
Definition: mouse.h:142
@ BROWSER_POINTER_LD
Definition: mouse.h:145
@ BROWSER_POINTER_DOWN
Definition: mouse.h:141
@ BROWSER_POINTER_AUTO
Definition: mouse.h:155
@ BROWSER_POINTER_POINT
Definition: mouse.h:137
@ BROWSER_POINTER_RIGHT
Definition: mouse.h:143
@ BROWSER_POINTER_PROGRESS
Definition: mouse.h:154
@ BROWSER_POINTER_LU
Definition: mouse.h:146
@ BROWSER_POINTER_MOVE
Definition: mouse.h:149
@ BROWSER_POINTER_HELP
Definition: mouse.h:151
@ BROWSER_POINTER_DEFAULT
Definition: mouse.h:136
@ BROWSER_POINTER_CROSS
Definition: mouse.h:148
@ BROWSER_POINTER_MENU
Definition: mouse.h:139
@ BROWSER_POINTER_RU
Definition: mouse.h:144
browser_mouse_state
Mouse state: 1 is primary mouse button.
Definition: mouse.h:52
@ BROWSER_MOUSE_CLICK_4
button 4 clicked.
Definition: mouse.h:76
@ BROWSER_MOUSE_PRESS_1
primary button pressed
Definition: mouse.h:59
@ BROWSER_MOUSE_CLICK_2
button 2 clicked.
Definition: mouse.h:72
@ BROWSER_MOUSE_PRESS_2
auxillary button pressed
Definition: mouse.h:61
@ BROWSER_MOUSE_CLICK_1
button 1 clicked.
Definition: mouse.h:70
@ BROWSER_MOUSE_MOD_2
2nd modifier key pressed (eg.
Definition: mouse.h:101
@ BROWSER_MOUSE_MOD_1
1st modifier key pressed (eg.
Definition: mouse.h:99
@ BROWSER_MOUSE_DRAG_1
start of button 1 drag
Definition: mouse.h:86
@ BROWSER_MOUSE_CLICK_5
button 5 clicked.
Definition: mouse.h:78
@ BROWSER_MOUSE_DRAG_2
start of button 2 drag
Definition: mouse.h:88
static void html_overflow_scroll_drag_end(struct scrollbar *scrollbar, browser_mouse_state mouse, int x, int y)
End overflow scroll scrollbar drags.
Definition: interaction.c:295
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.
Definition: interaction.c:1462
static nserror default_mouse_action_focus(html_content *html, browser_mouse_state mouse)
Definition: interaction.c:1168
bool html_keypress(struct content *c, uint32_t key)
Handle keypresses.
Definition: interaction.c:1530
void html_overflow_scroll_callback(void *client_data, struct scrollbar_msg_data *scrollbar_data)
Callback for in-page scrollbars.
Definition: interaction.c:1612
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
Definition: interaction.c:1324
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
Definition: interaction.c:1026
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
Definition: interaction.c:329
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
Definition: interaction.c:1091
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.
Definition: interaction.c:1659
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
Definition: interaction.c:545
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
Definition: interaction.c:514
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
Definition: interaction.c:391
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
Definition: interaction.c:1185
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.
Definition: interaction.c:242
static void html_box_drag_start(struct box *box, int x, int y)
Start drag scrolling the contents of a box.
Definition: interaction.c:168
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
Definition: interaction.c:448
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
Definition: interaction.c:992
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.
Definition: interaction.c:203
static browser_pointer_shape get_pointer_shape(struct box *box, bool imagemap)
Get pointer shape for given box.
Definition: interaction.c:70
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
Definition: interaction.c:674
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.
Definition: interaction.c:1696
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.
Definition: interaction.c:1473
static bool is_javascript_navigate_url(nsurl *url)
determine if a url has a javascript scheme
Definition: interaction.c:1071
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.
Definition: interaction.c:1754
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
Definition: interaction.c:827
HTML content user interaction handling.
Interface to javascript engine functions.
Interface to key press operations.
@ NS_KEY_SELECT_ALL
Definition: keypress.h:32
@ NS_KEY_COPY_SELECTION
Definition: keypress.h:33
@ NS_KEY_CLEAR_SELECTION
Definition: keypress.h:45
@ NS_KEY_ESCAPE
Definition: keypress.h:47
#define NSLOG(catname, level, logmsg, args...)
Definition: log.h:116
const char * messages_get_errorcode(nserror code)
lookup of a message by errorcode from the standard Messages hash.
Definition: messages.c:248
const char * messages_get(const char *key)
Fast lookup of a message by key from the standard Messages hash.
Definition: messages.c:241
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.
@ NSURL_SCHEME
Definition: nsurl.h:45
@ NSURL_PATH
Definition: nsurl.h:52
struct nsurl nsurl
NetSurf URL object.
Definition: nsurl.h:31
Private data for text/html content.
html_drag_type
Definition: private.h:39
@ HTML_DRAG_SELECTION
No drag.
Definition: private.h:41
@ HTML_DRAG_CONTENT_SELECTION
Not own; drag in textarea widget.
Definition: private.h:45
@ HTML_DRAG_TEXTAREA_SELECTION
Not own; drag in scrollbar widget.
Definition: private.h:43
@ HTML_DRAG_NONE
Definition: private.h:40
@ HTML_DRAG_SCROLLBAR
Own; Text selection.
Definition: private.h:42
@ HTML_DRAG_TEXTAREA_SCROLLBAR
Not own; drag in textarea widget.
Definition: private.h:44
@ HTML_DRAG_CONTENT_SCROLL
Not own; drag in child content.
Definition: private.h:46
html_focus_type
Definition: private.h:75
@ HTML_FOCUS_SELF
Focus is our own.
Definition: private.h:76
@ HTML_FOCUS_TEXTAREA
Focus belongs to textarea.
Definition: private.h:78
@ HTML_FOCUS_CONTENT
Focus belongs to child content.
Definition: private.h:77
html_selection_type
Definition: private.h:59
@ HTML_SELECTION_SELF
Selection in one of our textareas.
Definition: private.h:62
@ HTML_SELECTION_NONE
Definition: private.h:60
@ HTML_SELECTION_TEXTAREA
No selection.
Definition: private.h:61
@ HTML_SELECTION_CONTENT
Selection in this html content.
Definition: private.h:63
int width
Definition: gui.c:160
int height
Definition: gui.c:161
bool scrollbar_is_horizontal(struct scrollbar *s)
Check orientation of the scrollbar.
Definition: scrollbar.c:695
const char * scrollbar_mouse_status_to_message(scrollbar_mouse_status status)
Get a status bar message from a scrollbar mouse input status.
Definition: scrollbar.c:889
scrollbar_mouse_status scrollbar_mouse_action(struct scrollbar *s, browser_mouse_state mouse, int x, int y)
Handle mouse actions other then drag ends.
Definition: scrollbar.c:769
int scrollbar_get_offset(struct scrollbar *s)
Get the current scroll offset to the visible part of the full area.
Definition: scrollbar.c:628
void * scrollbar_get_data(struct scrollbar *s)
Get the scrollbar's client data.
Definition: scrollbar.c:1004
void scrollbar_start_content_drag(struct scrollbar *s, int x, int y)
Called when the content is being dragged to the scrollbars have to adjust.
Definition: scrollbar.c:981
void scrollbar_mouse_drag_end(struct scrollbar *s, browser_mouse_state mouse, int x, int y)
Handle end of mouse drags.
Definition: scrollbar.c:933
Scrollbar widget interface.
scrollbar_mouse_status
Scrollbar mouse input status flags.
Definition: scrollbar.h:70
@ SCROLLBAR_MSG_MOVED
the scroll value has changed
Definition: scrollbar.h:47
@ SCROLLBAR_MSG_SCROLL_START
a scrollbar drag has started, all mouse events should be passed to the scrollbar regardless of the co...
Definition: scrollbar.h:48
@ SCROLLBAR_MSG_SCROLL_FINISHED
cancel a scrollbar drag
Definition: scrollbar.h:53
#define SCROLLBAR_WIDTH
Definition: scrollbar.h:32
Interface to utility string handling.
int width
border-width (pixels)
Definition: box.h:107
Node in box tree.
Definition: box.h:177
struct box_border border[4]
Border: TOP, RIGHT, BOTTOM, LEFT.
Definition: box.h:327
int width
Width of content box (excluding padding etc.).
Definition: box.h:289
struct scrollbar * scroll_x
Horizontal scroll.
Definition: box.h:332
size_t byte_offset
Byte offset within a textual representation of this content.
Definition: box.h:370
const char * title
Title, or NULL.
Definition: box.h:386
struct box * children
First child box, or NULL.
Definition: box.h:226
int height
Height of content box (excluding padding etc.).
Definition: box.h:293
int margin[4]
Margin: TOP, RIGHT, BOTTOM, LEFT.
Definition: box.h:317
char * usemap
(Image)map to use with this object, or NULL if none
Definition: box.h:429
const char * target
Link target, or NULL.
Definition: box.h:381
struct scrollbar * scroll_y
Vertical scroll.
Definition: box.h:337
box_type type
Type of box.
Definition: box.h:181
struct nsurl * href
Link, or NULL.
Definition: box.h:376
struct browser_window * iframe
Iframe's browser_window, or NULL if none.
Definition: box.h:452
css_computed_style * style
Style for this box.
Definition: box.h:205
size_t length
Length of text.
Definition: box.h:360
struct hlcache_handle * object
Object in this box (usually an image), or NULL if none.
Definition: box.h:441
char * text
Text, or NULL if none.
Definition: box.h:355
int padding[4]
Padding: TOP, RIGHT, BOTTOM, LEFT.
Definition: box.h:322
int x
Coordinate of left padding edge relative to parent box, or relative to ancestor that contains this bo...
Definition: box.h:280
struct form_control * gadget
Form control data, or NULL if not a form control.
Definition: box.h:423
struct dom_node * node
DOM node that generated this box or NULL.
Definition: box.h:191
int y
Coordinate of top padding edge, relative as for x.
Definition: box.h:284
Browser window data.
Content which corresponds to a single URL.
Form control.
Definition: form_internal.h:73
struct form_textarea_data data
form_control_type type
Type of control.
Definition: form_internal.h:79
struct form * form
Containing form.
Definition: form_internal.h:81
void * node
Corresponding DOM node.
Definition: form_internal.h:74
bool selected
Whether control is selected.
Definition: form_internal.h:94
struct box * box
Box for control.
Definition: form_internal.h:89
char * target
Target to submit to.
char * action
Absolute URL to submit to.
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.
Definition: layout.h:63
High-level cache handle.
Definition: hlcache.c:66
Data specific to CONTENT_HTML.
Definition: private.h:93
struct selection * sel
HTML content's own text selection object.
Definition: private.h:205
union html_drag_owner drag_owner
Widget capturing all mouse events.
Definition: private.h:192
html_focus_type focus_type
Current input focus target type.
Definition: private.h:200
struct browser_window * bw
Browser window containing this document, or NULL if not open.
Definition: private.h:177
html_drag_type drag_type
Current drag type.
Definition: private.h:190
union html_focus_owner focus_owner
Current input focus target.
Definition: private.h:202
html_selection_type selection_type
Current selection state.
Definition: private.h:195
struct form_control * visible_select_menu
Open core-handled form SELECT menu, or NULL if none currently open.
Definition: private.h:211
union html_selection_owner selection_owner
Current selection owner.
Definition: private.h:197
css_unit_ctx unit_len_ctx
CSS length conversion context for document.
Definition: private.h:163
struct box * layout
Box tree, or NULL.
Definition: private.h:140
bool reflowing
Whether a layout (reflow) is in progress.
Definition: private.h:122
Context for scrollbar.
Definition: interaction.h:32
struct box * box
Definition: interaction.h:34
struct content * c
Definition: interaction.h:33
local structure containing all the mouse action state information
Definition: interaction.c:569
@ ACTION_BACK
navigate back in history
Definition: interaction.c:579
struct form_control * control
Definition: interaction.c:610
enum mouse_action_state::@141::@147 action
const char * target
Definition: interaction.c:604
struct dom_node * node
dom node
Definition: interaction.c:585
@ ACTION_JS
execute link as script
Definition: interaction.c:578
struct scrollbar * bar
Definition: interaction.c:625
hlcache_handle * object
non html object
Definition: interaction.c:595
@ ACTION_NOSEND
do not send status and pointer message
Definition: interaction.c:575
struct mouse_action_state::@145 scroll
scrollbar
struct mouse_action_state::@144 gadget
gadget
const char * status
status text
Definition: interaction.c:571
struct browser_window * iframe
iframe
Definition: interaction.c:598
struct mouse_action_state::@146 text
text in box
struct mouse_action_state::@141 result
@ ACTION_NONE
default of no action
Definition: interaction.c:574
@ ACTION_NAVIGATE
navigate to link url
Definition: interaction.c:577
struct box * drag_candidate
candidate box for drag operation
Definition: interaction.c:621
struct box * box
Definition: interaction.c:589
@ ACTION_FORWARD
navigate forward in history
Definition: interaction.c:580
browser_pointer_shape pointer
pointer shape
Definition: interaction.c:572
struct mouse_action_state::@142 html_object
html object
const char * title
title
Definition: interaction.c:618
struct mouse_action_state::@143 link
link either from href or imagemap
@ ACTION_SUBMIT
submit form
Definition: interaction.c:576
struct gui_layout_table * layout
Layout table.
Definition: gui_table.h:163
Font style for plotting.
Definition: plot_style.h:111
Rectangle coordinates.
Definition: types.h:40
int x0
Definition: types.h:41
int y0
Top left.
Definition: types.h:41
int x1
Definition: types.h:42
int y1
Bottom right.
Definition: types.h:42
scrollbar message context data
Definition: scrollbar.h:59
struct scrollbar * scrollbar
Definition: scrollbar.h:60
scrollbar_msg msg
Definition: scrollbar.h:61
Scrollbar context.
Definition: scrollbar.c:44
Interface to HTML searching.
struct rect rect
Rectangle coordinates.
Extra data for some content_msg messages.
Definition: content.h:60
int x
Carret x-coord.
Definition: content.h:110
const struct rect * clip
Carret clip rect.
Definition: content.h:215
struct content_msg_data::@110 gadget_click
CONTENT_MSG_GADGETCLICK - User clicked on a form gadget.
int height
Carret height.
Definition: content.h:110
browser_pointer_shape pointer
CONTENT_MSG_POINTER - Mouse pointer to set.
Definition: content.h:192
struct content_msg_data::@107 caret
CONTENT_MSG_CARET - set caret position or, hide caret.
const char * title
Definition: content.h:186
struct content_msg_data::@105 savelink
CONTENT_MSG_SAVELINK - Save a URL.
@ CONTENT_SAVE_COMPLETE
Definition: content.h:174
bool selection
false for selection cleared
Definition: content.h:198
struct hlcache_handle * content
if NULL, save the content generating the message
Definition: content.h:178
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
Definition: content.h:235
enum content_msg_data::@104::@112 type
int y
Carret y-coord.
Definition: content.h:110
struct nsurl * url
Definition: content.h:185
@ CONTENT_DRAG_SELECTION
Definition: content.h:226
const struct rect * rect
Definition: content.h:228
const char * explicit_status_text
CONTENT_MSG_STATUS - Status message update.
Definition: content.h:128
struct content_msg_data::@107::@114 pos
With CONTENT_CARET_SET_POS.
For drags we don't own.
Definition: private.h:52
bool no_owner
Definition: private.h:53
struct box * textarea
Definition: private.h:56
struct scrollbar * scrollbar
Definition: private.h:55
struct box * content
Definition: private.h:54
For directing input.
Definition: private.h:84
struct box * textarea
Definition: private.h:86
struct box * content
Definition: private.h:87
For getting at selections in this content or things in this content.
Definition: private.h:69
struct box * content
Definition: private.h:72
struct box * textarea
Definition: private.h:71
Option reading and saving interface.
#define nsoption_bool(OPTION)
Get the value of a boolean option.
Definition: nsoption.h:304
Interface to a number of general purpose functionality.
#define fallthrough
switch fall through
Definition: utils.h:119
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.
Definition: plot.c:821
static nserror clip(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.
Definition: plot.c:357