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"
46#include "desktop/frames.h"
47#include "desktop/scrollbar.h"
48#include "desktop/selection.h"
49#include "desktop/textarea.h"
50#include "javascript/js.h"
52
53#include "html/box.h"
54#include "html/box_textarea.h"
55#include "html/box_inspect.h"
56#include "html/font.h"
57#include "html/form_internal.h"
58#include "html/private.h"
59#include "html/imagemap.h"
60#include "html/interaction.h"
61
62/**
63 * Get pointer shape for given box
64 *
65 * \param box box in question
66 * \param imagemap whether an imagemap applies to the box
67 */
68
70{
72 css_computed_style *style;
73 enum css_cursor_e cursor;
74 lwc_string **cursor_uris;
75
77 style = box->children->style;
78 else
79 style = box->style;
80
81 if (style == NULL)
83
84 cursor = css_computed_cursor(style, &cursor_uris);
85
86 switch (cursor) {
87 case CSS_CURSOR_AUTO:
88 if (box->href || (box->gadget &&
91 imagemap) {
92 /* link */
93 pointer = BROWSER_POINTER_POINT;
94 } else if (box->gadget &&
98 /* text input */
99 pointer = BROWSER_POINTER_CARET;
100 } else {
101 /* html content doesn't mind */
102 pointer = BROWSER_POINTER_AUTO;
103 }
104 break;
105 case CSS_CURSOR_CROSSHAIR:
106 pointer = BROWSER_POINTER_CROSS;
107 break;
108 case CSS_CURSOR_POINTER:
109 pointer = BROWSER_POINTER_POINT;
110 break;
111 case CSS_CURSOR_MOVE:
112 pointer = BROWSER_POINTER_MOVE;
113 break;
114 case CSS_CURSOR_E_RESIZE:
115 pointer = BROWSER_POINTER_RIGHT;
116 break;
117 case CSS_CURSOR_W_RESIZE:
118 pointer = BROWSER_POINTER_LEFT;
119 break;
120 case CSS_CURSOR_N_RESIZE:
121 pointer = BROWSER_POINTER_UP;
122 break;
123 case CSS_CURSOR_S_RESIZE:
124 pointer = BROWSER_POINTER_DOWN;
125 break;
126 case CSS_CURSOR_NE_RESIZE:
127 pointer = BROWSER_POINTER_RU;
128 break;
129 case CSS_CURSOR_SW_RESIZE:
130 pointer = BROWSER_POINTER_LD;
131 break;
132 case CSS_CURSOR_SE_RESIZE:
133 pointer = BROWSER_POINTER_RD;
134 break;
135 case CSS_CURSOR_NW_RESIZE:
136 pointer = BROWSER_POINTER_LU;
137 break;
138 case CSS_CURSOR_TEXT:
139 pointer = BROWSER_POINTER_CARET;
140 break;
141 case CSS_CURSOR_WAIT:
142 pointer = BROWSER_POINTER_WAIT;
143 break;
144 case CSS_CURSOR_PROGRESS:
145 pointer = BROWSER_POINTER_PROGRESS;
146 break;
147 case CSS_CURSOR_HELP:
148 pointer = BROWSER_POINTER_HELP;
149 break;
150 default:
151 pointer = BROWSER_POINTER_DEFAULT;
152 break;
153 }
154
155 return pointer;
156}
157
158
159/**
160 * Start drag scrolling the contents of a box
161 *
162 * \param box the box to be scrolled
163 * \param x x ordinate of initial mouse position
164 * \param y y ordinate
165 */
166
167static void html_box_drag_start(struct box *box, int x, int y)
168{
169 int box_x, box_y;
170 int scroll_mouse_x, scroll_mouse_y;
171
172 box_coords(box, &box_x, &box_y);
173
174 if (box->scroll_x != NULL) {
175 scroll_mouse_x = x - box_x ;
176 scroll_mouse_y = y - (box_y + box->padding[TOP] +
180 scroll_mouse_x, scroll_mouse_y);
181 } else if (box->scroll_y != NULL) {
182 scroll_mouse_x = x - (box_x + box->padding[LEFT] +
183 box->width + box->padding[RIGHT] -
185 scroll_mouse_y = y - box_y;
186
188 scroll_mouse_x, scroll_mouse_y);
189 }
190}
191
192
193/**
194 * End overflow scroll scrollbar drags
195 *
196 * \param html html content
197 * \param mouse state of mouse buttons and modifier keys
198 * \param x coordinate of mouse
199 * \param y coordinate of mouse
200 * \param dir Direction of drag
201 */
202static size_t html_selection_drag_end(struct html_content *html,
203 browser_mouse_state mouse, int x, int y, int dir)
204{
205 int pixel_offset;
206 struct box *box;
207 int dx, dy;
208 size_t idx = 0;
209
210 box = box_pick_text_box(html, x, y, dir, &dx, &dy);
211 if (box) {
212 plot_font_style_t fstyle;
213
215
216 guit->layout->position(&fstyle, box->text, box->length,
217 dx, &idx, &pixel_offset);
218
219 idx += box->byte_offset;
220 }
221
222 return idx;
223}
224
225
226/**
227 * Helper for file gadgets to store their filename.
228 *
229 * Stores the filename unencoded on the dom node associated with the
230 * gadget.
231 *
232 * \todo Get rid of this crap eventually
233 *
234 * \param operation DOM operation
235 * \param key DOM node key being considerd
236 * \param _data The data assocated with the key
237 * \param src The source DOM node.
238 * \param dst The destination DOM node.
239 */
240static void
241html__image_coords_dom_user_data_handler(dom_node_operation operation,
242 dom_string *key,
243 void *_data,
244 struct dom_node *src,
245 struct dom_node *dst)
246{
247 struct image_input_coords *oldcoords, *coords = _data, *newcoords;
248
249 if (!dom_string_isequal(corestring_dom___ns_key_image_coords_node_data,
250 key) || coords == NULL) {
251 return;
252 }
253
254 switch (operation) {
255 case DOM_NODE_CLONED:
256 newcoords = calloc(1, sizeof(*newcoords));
257 if (newcoords != NULL) {
258 *newcoords = *coords;
259 if (dom_node_set_user_data(dst,
260 corestring_dom___ns_key_image_coords_node_data,
261 newcoords,
263 &oldcoords) == DOM_NO_ERR) {
264 free(oldcoords);
265 }
266 }
267 break;
268
269 case DOM_NODE_DELETED:
270 free(coords);
271 break;
272
273 case DOM_NODE_RENAMED:
274 case DOM_NODE_IMPORTED:
275 case DOM_NODE_ADOPTED:
276 break;
277
278 default:
279 NSLOG(netsurf, INFO, "User data operation not handled.");
280 assert(0);
281 }
282}
283
284
285/**
286 * End overflow scroll scrollbar drags
287 *
288 * \param scrollbar scrollbar widget
289 * \param mouse state of mouse buttons and modifier keys
290 * \param x coordinate of mouse
291 * \param y coordinate of mouse
292 */
293static void
296 int x, int y)
297{
298 int scroll_mouse_x, scroll_mouse_y, box_x, box_y;
300 struct box *box;
301
302 box = data->box;
303 box_coords(box, &box_x, &box_y);
304
306 scroll_mouse_x = x - box_x;
307 scroll_mouse_y = y - (box_y + box->padding[TOP] +
311 scroll_mouse_x, scroll_mouse_y);
312 } else {
313 scroll_mouse_x = x - (box_x + box->padding[LEFT] +
314 box->width + box->padding[RIGHT] -
316 scroll_mouse_y = y - box_y;
318 scroll_mouse_x, scroll_mouse_y);
319 }
320}
321
322
323/**
324 * handle html mouse action when select menu is open
325 *
326 */
327static nserror
329 struct browser_window *bw,
331 int x, int y)
332{
333 struct box *box;
334 int box_x = 0;
335 int box_y = 0;
336 const char *status;
337 int width, height;
338 struct hlcache_handle *bw_content;
339 browser_drag_type bw_drag_type;
340
341 assert(html->visible_select_menu != NULL);
342
343 bw_drag_type = browser_window_get_drag_type(bw);
344 if (bw_drag_type != DRAGGING_NONE && !mouse) {
345 /* drag end: select menu */
347 }
348
349 box = html->visible_select_menu->box;
350 box_coords(box, &box_x, &box_y);
351
352 box_x -= box->border[LEFT].width;
353 box_y += box->height + box->border[BOTTOM].width +
355
357 mouse,
358 x - box_x,
359 y - box_y);
360 if (status != NULL) {
361 /* set status if menu still open */
362 union content_msg_data msg_data;
363 msg_data.explicit_status_text = status;
364 content_broadcast((struct content *)html,
366 &msg_data);
367 return NSERROR_OK;
368 }
369
370 /* close menu and redraw where it was */
372
373 html->visible_select_menu = NULL;
374
375 bw_content = browser_window_get_content(bw);
376 content_request_redraw(bw_content,
377 box_x,
378 box_y,
379 width,
380 height);
381 return NSERROR_OK;
382}
383
384
385/**
386 * handle html mouse action when a selection drag is being performed
387 *
388 */
389static nserror
391 struct browser_window *bw,
393 int x, int y)
394{
395 struct box *box;
396 int dir = -1;
397 int dx, dy;
398 size_t idx;
399 union html_drag_owner drag_owner;
400 int pixel_offset;
401 plot_font_style_t fstyle;
402
403 if (!mouse) {
404 /* End of selection drag */
405 if (selection_dragging_start(html->sel)) {
406 dir = 1;
407 }
408
409 idx = html_selection_drag_end(html, mouse, x, y, dir);
410
411 if (idx != 0) {
412 selection_track(html->sel, mouse, idx);
413 }
414
415 drag_owner.no_owner = true;
416 html_set_drag_type(html, HTML_DRAG_NONE, drag_owner, NULL);
417
418 return NSERROR_OK;
419 }
420
421 if (selection_dragging_start(html->sel)) {
422 dir = 1;
423 }
424
425 box = box_pick_text_box(html, x, y, dir, &dx, &dy);
426 if (box != NULL) {
428
429 guit->layout->position(&fstyle,
430 box->text,
431 box->length,
432 dx,
433 &idx,
434 &pixel_offset);
435
436 selection_track(html->sel, mouse, box->byte_offset + idx);
437 }
438 return NSERROR_OK;
439}
440
441
442/**
443 * handle html mouse action when a scrollbar drag is being performed
444 *
445 */
446static nserror
448 struct browser_window *bw,
450 int x, int y)
451{
452 struct scrollbar *scr;
453 struct html_scrollbar_data *data;
454 struct box *box;
455 int box_x = 0;
456 int box_y = 0;
457 const char *status;
458 int scroll_mouse_x = 0, scroll_mouse_y = 0;
459 scrollbar_mouse_status scrollbar_status;
460
461 scr = html->drag_owner.scrollbar;
462
463 if (!mouse) {
464 /* drag end: scrollbar */
465 html_overflow_scroll_drag_end(scr, mouse, x, y);
466 }
467
468 data = scrollbar_get_data(scr);
469
470 box = data->box;
471
472 box_coords(box, &box_x, &box_y);
473
474 if (scrollbar_is_horizontal(scr)) {
475 scroll_mouse_x = x - box_x ;
476 scroll_mouse_y = y - (box_y + box->padding[TOP] +
479 scrollbar_status = scrollbar_mouse_action(scr,
480 mouse,
481 scroll_mouse_x,
482 scroll_mouse_y);
483 } else {
484 scroll_mouse_x = x - (box_x + box->padding[LEFT] +
485 box->width + box->padding[RIGHT] -
487 scroll_mouse_y = y - box_y;
488
489 scrollbar_status = scrollbar_mouse_action(scr,
490 mouse,
491 scroll_mouse_x,
492 scroll_mouse_y);
493 }
494 status = scrollbar_mouse_status_to_message(scrollbar_status);
495
496 if (status != NULL) {
497 union content_msg_data msg_data;
498
499 msg_data.explicit_status_text = status;
500 content_broadcast((struct content *)html,
502 &msg_data);
503 }
504
505 return NSERROR_OK;
506}
507
508
509/**
510 * handle mouse actions while dragging in a text area
511 */
512static nserror
514 struct browser_window *bw,
516 int x, int y)
517{
518 struct box *box;
519 int box_x = 0;
520 int box_y = 0;
521
522 box = html->drag_owner.textarea;
523
524 assert(box->gadget != NULL);
525 assert(box->gadget->type == GADGET_TEXTAREA ||
528
529 box_coords(box, &box_x, &box_y);
531 mouse,
532 x - box_x,
533 y - box_y);
534
535 /* TODO: Set appropriate statusbar message */
536 return NSERROR_OK;
537}
538
539
540/**
541 * handle mouse actions while dragging in a content
542 */
543static nserror
545 struct browser_window *bw,
547 int x, int y)
548{
549 struct box *box;
550 int box_x = 0;
551 int box_y = 0;
552
553 box = html->drag_owner.content;
554 assert(box->object != NULL);
555
556 box_coords(box, &box_x, &box_y);
558 bw, mouse,
559 x - box_x,
560 y - box_y);
561 return NSERROR_OK;
562}
563
564
565/**
566 * local structure containing all the mouse action state information
567 */
569 struct {
570 const char *status; /**< status text */
571 browser_pointer_shape pointer; /**< pointer shape */
572 enum {
574 ACTION_NOSEND, /**< do not send status and pointer message */
580
581 /** dom node */
582 struct dom_node *node;
583
584 /** html object */
585 struct {
586 struct box *box;
587 int pos_x;
588 int pos_y;
590
591 /** non html object */
593
594 /** iframe */
596
597 /** link either from href or imagemap */
598 struct {
599 struct box *box;
601 const char *target;
604
605 /** gadget */
606 struct {
608 struct box *box;
609 int box_x;
610 int box_y;
611 const char *target;
613
614 /** title */
615 const char *title;
616
617 /** candidate box for drag operation */
619
620 /** scrollbar */
621 struct {
622 struct scrollbar *bar;
626
627 /** text in box */
628 struct {
629 struct box *box;
630 int box_x;
632};
633
634
635/**
636 * iterate the box tree for deepest node at coordinates
637 *
638 * extracts mouse action node information by descending through
639 * visible boxes setting more specific values for:
640 *
641 * box - deepest box at point
642 * html_object_box - html object
643 * html_object_pos_x - html object
644 * html_object_pos_y - html object
645 * object - non html object
646 * iframe - iframe
647 * url - href or imagemap
648 * target - href or imagemap or gadget
649 * url_box - href or imagemap
650 * imagemap - imagemap
651 * gadget - gadget
652 * gadget_box - gadget
653 * gadget_box_x - gadget
654 * gadget_box_y - gadget
655 * title - title
656 * pointer
657 *
658 * drag_candidate - first box with scroll
659 * padding_left - box with scroll
660 * padding_right
661 * padding_top
662 * padding_bottom
663 * scrollbar - inside padding box stops decent
664 * scroll_mouse_x - inside padding box stops decent
665 * scroll_mouse_y - inside padding box stops decent
666 *
667 * text_box - text box
668 * text_box_x - text_box
669 */
670static nserror
672 int x, int y,
673 struct mouse_action_state *man)
674{
675 struct box *box;
676 int box_x = 0;
677 int box_y = 0;
678
679 /* initialise the mouse action state data */
680 memset(man, 0, sizeof(struct mouse_action_state));
681 man->node = html->layout->node; /* Default dom node to the <HTML> */
683
684 /* search the box tree for a link, imagemap, form control, or
685 * box with scrollbars
686 */
687 box = html->layout;
688
689 /* Consider the margins of the html page now */
690 box_x = box->margin[LEFT];
691 box_y = box->margin[TOP];
692
693 do {
694 /* skip hidden boxes */
695 if ((box->style != NULL) &&
696 (css_computed_visibility(box->style) ==
697 CSS_VISIBILITY_HIDDEN)) {
698 goto next_box;
699 }
700
701 if (box->node != NULL) {
702 man->node = box->node;
703 }
704
705 if (box->object) {
707 man->html_object.box = box;
708 man->html_object.pos_x = box_x;
709 man->html_object.pos_y = box_y;
710 } else {
711 man->object = box->object;
712 }
713 }
714
715 if (box->iframe) {
716 man->iframe = box->iframe;
717 }
718
719 if (box->href) {
720 man->link.url = box->href;
721 man->link.target = box->target;
722 man->link.box = box;
723 man->link.is_imagemap = false;
724 }
725
726 if (box->usemap) {
727 man->link.url = imagemap_get(html,
728 box->usemap,
729 box_x,
730 box_y,
731 x, y,
732 &man->link.target);
733 man->link.box = box;
734 man->link.is_imagemap = true;
735 }
736
737 if (box->gadget) {
738 man->gadget.control = box->gadget;
739 man->gadget.box = box;
740 man->gadget.box_x = box_x;
741 man->gadget.box_y = box_y;
742 if (box->gadget->form) {
743 man->gadget.target = box->gadget->form->target;
744 }
745 }
746
747 if (box->title) {
748 man->title = box->title;
749 }
750
751 man->result.pointer = get_pointer_shape(box, false);
752
753 if ((box->scroll_x != NULL) ||
754 (box->scroll_y != NULL)) {
755 int padding_left;
756 int padding_right;
757 int padding_top;
758 int padding_bottom;
759
760 if (man->drag_candidate == NULL) {
761 man->drag_candidate = box;
762 }
763
764 padding_left = box_x +
766 padding_right = padding_left + box->padding[LEFT] +
768 padding_top = box_y +
770 padding_bottom = padding_top + box->padding[TOP] +
772
773 if ((x > padding_left) &&
774 (x < padding_right) &&
775 (y > padding_top) &&
776 (y < padding_bottom)) {
777 /* mouse inside padding box */
778
779 if ((box->scroll_y != NULL) &&
780 (x > (padding_right - SCROLLBAR_WIDTH))) {
781 /* mouse above vertical box scroll */
782
783 man->scroll.bar = box->scroll_y;
784 man->scroll.mouse_x = x - (padding_right - SCROLLBAR_WIDTH);
785 man->scroll.mouse_y = y - padding_top;
786 break;
787
788 } else if ((box->scroll_x != NULL) &&
789 (y > (padding_bottom -
790 SCROLLBAR_WIDTH))) {
791 /* mouse above horizontal box scroll */
792
793 man->scroll.bar = box->scroll_x;
794 man->scroll.mouse_x = x - padding_left;
795 man->scroll.mouse_y = y - (padding_bottom - SCROLLBAR_WIDTH);
796 break;
797 }
798 }
799 }
800
801 if (box->text && !box->object) {
802 man->text.box = box;
803 man->text.box_x = box_x;
804 }
805
806 next_box:
807 /* iterate to next box */
808 box = box_at_point(&html->unit_len_ctx, box, x, y, &box_x, &box_y);
809 } while (box != NULL);
810
811 /* use of box_x, box_y, or content below this point is probably a
812 * mistake; they will refer to the last box returned by box_at_point */
813
814 assert(man->node != NULL);
815
816 return NSERROR_OK;
817}
818
819
820/**
821 * process mouse activity on a form gadget
822 */
823static nserror
826 int x, int y,
827 struct mouse_action_state *mas)
828{
829 struct content *c = (struct content *)html;
830 textarea_mouse_status ta_status;
831 union content_msg_data msg_data;
832 nserror res;
833 bool click;
837
838 switch (mas->gadget.control->type) {
839 case GADGET_SELECT:
840 mas->result.status = messages_get("FormSelect");
842 if (mouse & BROWSER_MOUSE_CLICK_1 &&
843 nsoption_bool(core_select_menu)) {
845 res = form_open_select_menu(c,
846 mas->gadget.control,
848 c);
849 if (res != NSERROR_OK) {
850 NSLOG(netsurf, ERROR, "%s",
852 html->visible_select_menu = NULL;
853 }
855 } else if (mouse & BROWSER_MOUSE_CLICK_1) {
856 msg_data.select_menu.gadget = mas->gadget.control;
859 &msg_data);
860 }
861 break;
862
863 case GADGET_CHECKBOX:
864 mas->result.status = messages_get("FormCheckbox");
865 if (mouse & BROWSER_MOUSE_CLICK_1) {
867 dom_html_input_element_set_checked(
868 (dom_html_input_element *)(mas->gadget.control->node),
869 mas->gadget.control->selected);
870 html__redraw_a_box(html, mas->gadget.box);
871 }
872 break;
873
874 case GADGET_RADIO:
875 mas->result.status = messages_get("FormRadio");
876 if (mouse & BROWSER_MOUSE_CLICK_1) {
878 }
879 break;
880
881 case GADGET_IMAGE:
882 /* This falls through to SUBMIT */
883 if (mouse & BROWSER_MOUSE_CLICK_1) {
884 struct image_input_coords *coords, *oldcoords;
885 /** \todo Find a way to not ignore errors */
886 coords = calloc(1, sizeof(*coords));
887 if (coords == NULL) {
888 return NSERROR_OK;
889 }
890 coords->x = x - mas->gadget.box_x;
891 coords->y = y - mas->gadget.box_y;
892 if (dom_node_set_user_data(
893 mas->gadget.control->node,
894 corestring_dom___ns_key_image_coords_node_data,
895 coords,
897 &oldcoords) != DOM_NO_ERR) {
898 return NSERROR_OK;
899 }
900 free(oldcoords);
901 }
903
904 case GADGET_SUBMIT:
905 if (mas->gadget.control->form) {
906 static char status_buffer[200];
907
908 snprintf(status_buffer,
909 sizeof status_buffer,
910 messages_get("FormSubmit"),
911 mas->gadget.control->form->action);
912 mas->result.status = status_buffer;
914 false);
915 if (mouse & (BROWSER_MOUSE_CLICK_1 |
917 mas->result.action = ACTION_SUBMIT;
918 }
919 } else {
920 mas->result.status = messages_get("FormBadSubmit");
921 }
922 break;
923
924 case GADGET_TEXTBOX:
925 case GADGET_PASSWORD:
926 case GADGET_TEXTAREA:
927 if (mas->gadget.control->type == GADGET_TEXTAREA) {
928 mas->result.status = messages_get("FormTextarea");
929 } else {
930 mas->result.status = messages_get("FormTextbox");
931 }
932
933 if (click &&
935 html->selection_owner.textarea != mas->gadget.box)) {
936 union html_selection_owner sel_owner;
937 sel_owner.none = true;
940 sel_owner,
941 true);
942 }
943
944 ta_status = textarea_mouse_action(mas->gadget.control->data.text.ta,
945 mouse,
946 x - mas->gadget.box_x,
947 y - mas->gadget.box_y);
948
949 if (ta_status & TEXTAREA_MOUSE_EDITOR) {
950 mas->result.pointer = get_pointer_shape(mas->gadget.box, false);
951 } else {
953 mas->result.status = scrollbar_mouse_status_to_message(ta_status >> 3);
954 }
955 break;
956
957 case GADGET_HIDDEN:
958 /* not possible: no box generated */
959 break;
960
961 case GADGET_RESET:
962 mas->result.status = messages_get("FormReset");
963 break;
964
965 case GADGET_FILE:
966 mas->result.status = messages_get("FormFile");
967 if (mouse & BROWSER_MOUSE_CLICK_1) {
968 msg_data.gadget_click.gadget = mas->gadget.control;
971 &msg_data);
972 }
973 break;
974
975 case GADGET_BUTTON:
976 /* This gadget cannot be activated */
977 mas->result.status = messages_get("FormButton");
978 break;
979 }
980
981 return NSERROR_OK;
982}
983
984
985/**
986 * process mouse activity on an iframe
987 */
988static nserror
991 int x, int y,
992 struct mouse_action_state *mas)
993{
994 int pos_x, pos_y;
995 float scale;
996
997 scale = browser_window_get_scale(bw);
998
999 browser_window_get_position(mas->iframe, false, &pos_x, &pos_y);
1000
1001 if (mouse & BROWSER_MOUSE_CLICK_1 ||
1002 mouse & BROWSER_MOUSE_CLICK_2) {
1004 mouse,
1005 (x * scale) - pos_x,
1006 (y * scale) - pos_y);
1007 } else {
1009 mouse,
1010 (x * scale) - pos_x,
1011 (y * scale) - pos_y);
1012 }
1013 mas->result.action = ACTION_NOSEND;
1014
1015 return NSERROR_OK;
1016}
1017
1018
1019/**
1020 * process mouse activity on an html object
1021 */
1022static nserror
1024 struct browser_window *bw,
1025 browser_mouse_state mouse,
1026 int x, int y,
1027 struct mouse_action_state *mas)
1028{
1029 bool click;
1030 click = mouse & (BROWSER_MOUSE_PRESS_1 | BROWSER_MOUSE_PRESS_2 |
1033
1034 if (click &&
1036 html->selection_owner.content != mas->html_object.box)) {
1037 union html_selection_owner sel_owner;
1038 sel_owner.none = true;
1039 html_set_selection(html, HTML_SELECTION_NONE, sel_owner, true);
1040 }
1041
1042 if (mouse & BROWSER_MOUSE_CLICK_1 ||
1043 mouse & BROWSER_MOUSE_CLICK_2) {
1045 bw,
1046 mouse,
1047 x - mas->html_object.pos_x,
1048 y - mas->html_object.pos_y);
1049 } else {
1051 bw,
1052 mouse,
1053 x - mas->html_object.pos_x,
1054 y - mas->html_object.pos_y);
1055 }
1056
1057 mas->result.action = ACTION_NOSEND;
1058 return NSERROR_OK;
1059}
1060
1061
1062/**
1063 * determine if a url has a javascript scheme
1064 *
1065 * \param urm The url to check.
1066 * \return true if the url is a javascript scheme else false
1067 */
1069{
1070 bool is_js = false;
1071 lwc_string *scheme;
1072
1073 scheme = nsurl_get_component(url, NSURL_SCHEME);
1074 if (scheme != NULL) {
1075 if (scheme == corestring_lwc_javascript) {
1076 is_js = true;
1077 }
1078 lwc_string_unref(scheme);
1079 }
1080 return is_js;
1081}
1082
1083
1084/**
1085 * process mouse activity on a link
1086 */
1087static nserror
1089 struct browser_window *bw,
1090 browser_mouse_state mouse,
1091 int x, int y,
1092 struct mouse_action_state *mas)
1093{
1094 nserror res;
1095 char *url_s = NULL;
1096 size_t url_l = 0;
1097 static char status_buffer[200];
1098 union content_msg_data msg_data;
1099
1100 if (nsoption_bool(display_decoded_idn) == true) {
1101 res = nsurl_get_utf8(mas->link.url, &url_s, &url_l);
1102 if (res != NSERROR_OK) {
1103 /* Unable to obtain a decoded IDN. This is not
1104 * a fatal error. Ensure the string pointer
1105 * is NULL so we use the encoded version.
1106 */
1107 url_s = NULL;
1108 }
1109 }
1110
1111 if (mas->title) {
1112 snprintf(status_buffer,
1113 sizeof status_buffer,
1114 "%s: %s",
1115 url_s ? url_s : nsurl_access(mas->link.url),
1116 mas->title);
1117 } else {
1118 snprintf(status_buffer,
1119 sizeof status_buffer,
1120 "%s",
1121 url_s ? url_s : nsurl_access(mas->link.url));
1122 }
1123
1124 if (url_s != NULL) {
1125 free(url_s);
1126 }
1127
1128 mas->result.status = status_buffer;
1129
1131 mas->link.is_imagemap);
1132
1133 if (mouse & BROWSER_MOUSE_CLICK_1 &&
1134 mouse & BROWSER_MOUSE_MOD_1) {
1135 /* force download of link */
1137 mas->link.url,
1138 content_get_url((struct content *)html),
1140 NULL,
1141 NULL,
1142 NULL);
1143
1144 } else if (mouse & BROWSER_MOUSE_CLICK_2 &&
1145 mouse & BROWSER_MOUSE_MOD_1) {
1146 msg_data.savelink.url = mas->link.url;
1147 msg_data.savelink.title = mas->title;
1148 content_broadcast((struct content *)html,
1150 &msg_data);
1151
1152 } else if (mouse & (BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_CLICK_2)) {
1154 mas->result.action = ACTION_JS;
1155 } else {
1156 mas->result.action = ACTION_GO;
1157 }
1158 }
1159
1160 return NSERROR_OK;
1161}
1162
1163
1164
1165/**
1166 * process mouse activity if it is not anything else
1167 */
1168static nserror
1170 struct browser_window *bw,
1171 browser_mouse_state mouse,
1172 int x, int y,
1173 struct mouse_action_state *mas)
1174{
1175 struct content *c = (struct content *)html;
1176 bool done = false;
1177
1178 /* frame resizing */
1179 if (browser_window_frame_resize_start(bw, mouse, x, y, &mas->result.pointer)) {
1181 mas->result.status = messages_get("FrameDrag");
1182 }
1183 done = true;
1184 }
1185
1186 /* if clicking in the main page, remove the selection from any
1187 * text areas */
1188 if (!done) {
1189 union html_selection_owner sel_owner;
1190 bool click;
1191 click = mouse & (BROWSER_MOUSE_PRESS_1 | BROWSER_MOUSE_PRESS_2 |
1194
1195 if (click && html->focus_type != HTML_FOCUS_SELF) {
1196 union html_focus_owner fo;
1197 fo.self = true;
1199 true, 0, 0, 0, NULL);
1200 }
1201 if (click && html->selection_type != HTML_SELECTION_SELF) {
1202 sel_owner.none = true;
1204 sel_owner, true);
1205 }
1206
1207 if (mas->text.box) {
1208 int pixel_offset;
1209 size_t idx;
1210 plot_font_style_t fstyle;
1211
1213 mas->text.box->style,
1214 &fstyle);
1215
1216 guit->layout->position(&fstyle,
1217 mas->text.box->text,
1218 mas->text.box->length,
1219 x - mas->text.box_x,
1220 &idx,
1221 &pixel_offset);
1222
1223 if (selection_click(html->sel,
1224 html->bw,
1225 mouse,
1226 mas->text.box->byte_offset + idx)) {
1227 /* key presses must be directed at the
1228 * main browser window, paste text
1229 * operations ignored */
1230 html_drag_type drag_type;
1231 union html_drag_owner drag_owner;
1232
1233 if (selection_dragging(html->sel)) {
1234 drag_type = HTML_DRAG_SELECTION;
1235 drag_owner.no_owner = true;
1236 html_set_drag_type(html,
1237 drag_type,
1238 drag_owner,
1239 NULL);
1240 mas->result.status = messages_get("Selecting");
1241 }
1242
1243 done = true;
1244 }
1245
1246 } else if (mouse & BROWSER_MOUSE_PRESS_1) {
1247 sel_owner.none = true;
1248 selection_clear(html->sel, true);
1249 }
1250
1251 if (selection_active(html->sel)) {
1252 sel_owner.none = false;
1253 html_set_selection(html,
1255 sel_owner,
1256 true);
1257 } else if (click &&
1259 sel_owner.none = true;
1260 html_set_selection(html,
1262 sel_owner,
1263 true);
1264 }
1265 }
1266
1267 if (!done) {
1268 union content_msg_data msg_data;
1269 if (mas->title) {
1270 mas->result.status = mas->title;
1271 }
1272
1273 if (mouse & BROWSER_MOUSE_DRAG_1) {
1274 if (mouse & BROWSER_MOUSE_MOD_2) {
1276 msg_data.dragsave.content = NULL;
1279 &msg_data);
1280 } else {
1281 if (mas->drag_candidate == NULL) {
1283 x, y);
1284 } else {
1286 x, y);
1287 }
1289 }
1290 } else if (mouse & BROWSER_MOUSE_DRAG_2) {
1291 if (mouse & BROWSER_MOUSE_MOD_2) {
1293 msg_data.dragsave.content = NULL;
1296 &msg_data);
1297 } else {
1298 if (mas->drag_candidate == NULL) {
1300 x, y);
1301 } else {
1303 x, y);
1304 }
1306 }
1307 }
1308 }
1309
1310 if (mouse && mouse < BROWSER_MOUSE_MOD_1) {
1311 /* ensure key presses still act on the browser window */
1312 union html_focus_owner fo;
1313 fo.self = true;
1314 html_set_focus(html, HTML_FOCUS_SELF, fo, true, 0, 0, 0, NULL);
1315 }
1316
1317 return NSERROR_OK;
1318}
1319
1320
1321/**
1322 * handle non dragging mouse actions
1323 */
1324static nserror
1326 struct browser_window *bw,
1327 browser_mouse_state mouse,
1328 int x, int y)
1329{
1330 nserror res;
1331 struct content *c = (struct content *)html;
1332 union content_msg_data msg_data;
1333 lwc_string *path;
1334
1335 /**
1336 * computed state
1337 *
1338 * not on heap to avoid allocation or stack because it is large
1339 */
1340 static struct mouse_action_state mas;
1341
1342 res = get_mouse_action_node(html, x, y, &mas);
1343 if (res != NSERROR_OK) {
1344 return res;
1345 }
1346
1347 if (mas.scroll.bar) {
1350 mouse,
1351 mas.scroll.mouse_x,
1352 mas.scroll.mouse_y));
1354
1355 } else if (mas.gadget.control) {
1356 res = gadget_mouse_action(html, mouse, x, y, &mas);
1357
1358 } else if ((mas.object != NULL) && (mouse & BROWSER_MOUSE_MOD_2)) {
1359
1360 if (mouse & BROWSER_MOUSE_DRAG_2) {
1361 msg_data.dragsave.type = CONTENT_SAVE_NATIVE;
1362 msg_data.dragsave.content = mas.object;
1364
1365 } else if (mouse & BROWSER_MOUSE_DRAG_1) {
1366 msg_data.dragsave.type = CONTENT_SAVE_ORIG;
1367 msg_data.dragsave.content = mas.object;
1369 }
1370
1371 /* \todo should have a drag-saving object msg */
1372
1373 } else if (mas.iframe != NULL) {
1374 res = iframe_mouse_action(bw, mouse, x, y, &mas);
1375
1376 } else if (mas.html_object.box != NULL) {
1377 res = html_object_mouse_action(html, bw, mouse, x, y, &mas);
1378
1379 } else if (mas.link.url != NULL) {
1380 res = link_mouse_action(html, bw, mouse, x, y, &mas);
1381
1382 } else {
1383 res = default_mouse_action(html, bw, mouse, x, y, &mas);
1384
1385 }
1386 if (res != NSERROR_OK) {
1387 return res;
1388 }
1389
1390 /* send status and pointer message */
1391 if (mas.result.action != ACTION_NOSEND) {
1392 msg_data.explicit_status_text = mas.result.status;
1394
1395 msg_data.pointer = mas.result.pointer;
1397 }
1398
1399 /* fire dom click event */
1400 if (mouse & BROWSER_MOUSE_CLICK_1) {
1401 fire_generic_dom_event(corestring_dom_click, mas.node, true, true);
1402 }
1403
1404 /* deferred actions that can cause this browser_window to be destroyed
1405 * and must therefore be done after set_status/pointer
1406 */
1407 switch (mas.result.action) {
1408 case ACTION_SUBMIT:
1411 mas.gadget.target,
1412 mouse),
1413 mas.gadget.control->form,
1414 mas.gadget.control);
1415 break;
1416
1417 case ACTION_GO:
1420 mas.link.target,
1421 mouse),
1422 mas.link.url,
1423 content_get_url(c),
1425 NULL,
1426 NULL,
1427 NULL);
1428 break;
1429
1430 case ACTION_JS:
1432 if (path != NULL) {
1433 html_exec(c,
1434 lwc_string_data(path),
1435 lwc_string_length(path));
1436 lwc_string_unref(path);
1437 }
1438 break;
1439
1440 case ACTION_NOSEND:
1441 case ACTION_NONE:
1442 res = NSERROR_OK;
1443 break;
1444 }
1445
1446 return res;
1447}
1448
1449
1450/* exported interface documented in html/interaction.h */
1452 struct browser_window *bw,
1453 browser_mouse_state mouse,
1454 int x, int y)
1455{
1456 return html_mouse_action(c, bw, mouse, x, y);
1457}
1458
1459
1460/* exported interface documented in html/interaction.h */
1461nserror
1463 struct browser_window *bw,
1464 browser_mouse_state mouse,
1465 int x, int y)
1466{
1467 html_content *html = (html_content *)c;
1468 nserror res = NSERROR_OK;
1469
1470 /* handle open select menu */
1471 if (html->visible_select_menu != NULL) {
1472 return mouse_action_select_menu(html, bw, mouse, x, y);
1473 }
1474
1475 /* handle content drag */
1476 switch (html->drag_type) {
1478 res = mouse_action_drag_selection(html, bw, mouse, x, y);
1479 break;
1480
1482 res = mouse_action_drag_scrollbar(html, bw, mouse, x, y);
1483 break;
1484
1487 res = mouse_action_drag_textarea(html, bw, mouse, x, y);
1488 break;
1489
1492 res = mouse_action_drag_content(html, bw, mouse, x, y);
1493 break;
1494
1495 case HTML_DRAG_NONE:
1496 res = mouse_action_drag_none(html, bw, mouse, x, y);
1497 break;
1498
1499 default:
1500 /* Unknown content related drag type */
1501 assert(0 && "Unknown content related drag type");
1502 }
1503
1504 if (res != NSERROR_OK) {
1505 NSLOG(netsurf, ERROR, "%s", messages_get_errorcode(res));
1506 }
1507
1508 return res;
1509}
1510
1511
1512/**
1513 * Handle keypresses.
1514 *
1515 * \param c content of type HTML
1516 * \param key The UCS4 character codepoint
1517 * \return true if key handled, false otherwise
1518 */
1519bool html_keypress(struct content *c, uint32_t key)
1520{
1521 html_content *html = (html_content *) c;
1522 struct selection *sel = html->sel;
1523
1524 /** \todo
1525 * At the moment, the front end interface for keypress only gives
1526 * us a UCS4 key value. This doesn't doesn't have all the information
1527 * we need to fill out the event properly. We don't get to know about
1528 * modifier keys, and things like CTRL+C are passed in as
1529 * \ref NS_KEY_COPY_SELECTION, a magic value outside the valid Unicode
1530 * range.
1531 *
1532 * We need to:
1533 *
1534 * 1. Update the front end interface so that both press and release
1535 * events reach the core.
1536 * 2. Stop encoding the special keys like \ref NS_KEY_COPY_SELECTION as
1537 * magic values in the front ends, so we just get the events, e.g.:
1538 * 1. Press ctrl
1539 * 2. Press c
1540 * 3. Release c
1541 * 4. Release ctrl
1542 * 3. Pass all the new info to the DOM KeyboardEvent events.
1543 * 4. If there is a focused element, fire the event at that, instead of
1544 * `html->layout->node`.
1545 * 5. Rebuild the \ref NS_KEY_COPY_SELECTION values from the info we
1546 * now get given, and use that for the code below this
1547 * \ref fire_dom_keyboard_event call.
1548 * 6. Move the code after this \ref fire_dom_keyboard_event call into
1549 * the default action handler for DOM events.
1550 *
1551 * This will mean that if the JavaScript event listener does
1552 * `event.preventDefault()` then we won't handle the event when
1553 * we're not supposed to.
1554 */
1555 if (html->layout != NULL && html->layout->node != NULL) {
1556 fire_dom_keyboard_event(corestring_dom_keydown,
1557 html->layout->node, true, true, key);
1558 }
1559
1560 switch (html->focus_type) {
1561 case HTML_FOCUS_CONTENT:
1562 return content_keypress(html->focus_owner.content->object, key);
1563
1565 if (box_textarea_keypress(html, html->focus_owner.textarea, key) == NSERROR_OK) {
1566 return true;
1567 } else {
1568 return false;
1569 }
1570
1571 default:
1572 /* Deal with it below */
1573 break;
1574 }
1575
1576 switch (key) {
1579 return true;
1580
1582 selection_clear(sel, true);
1583 return true;
1584
1585 case NS_KEY_SELECT_ALL:
1587 return true;
1588
1589 case NS_KEY_ESCAPE:
1590 /* if there's no selection, leave Escape for the caller */
1591 return selection_clear(sel, true);
1592 }
1593
1594 return false;
1595}
1596
1597
1598/**
1599 * Callback for in-page scrollbars.
1600 */
1601void html_overflow_scroll_callback(void *client_data,
1602 struct scrollbar_msg_data *scrollbar_data)
1603{
1604 struct html_scrollbar_data *data = client_data;
1605 html_content *html = (html_content *)data->c;
1606 struct box *box = data->box;
1607 union content_msg_data msg_data;
1608 html_drag_type drag_type;
1609 union html_drag_owner drag_owner;
1610
1611 switch(scrollbar_data->msg) {
1613
1614 if (html->reflowing == true) {
1615 /* Can't redraw during layout, and it will
1616 * be redrawn after layout anyway. */
1617 break;
1618 }
1619
1620 html__redraw_a_box(html, box);
1621 break;
1623 {
1624 struct rect rect = {
1625 .x0 = scrollbar_data->x0,
1626 .y0 = scrollbar_data->y0,
1627 .x1 = scrollbar_data->x1,
1628 .y1 = scrollbar_data->y1
1629 };
1630 drag_type = HTML_DRAG_SCROLLBAR;
1631 drag_owner.scrollbar = scrollbar_data->scrollbar;
1632 html_set_drag_type(html, drag_type, drag_owner, &rect);
1633 }
1634 break;
1636 drag_type = HTML_DRAG_NONE;
1637 drag_owner.no_owner = true;
1638 html_set_drag_type(html, drag_type, drag_owner, NULL);
1639
1640 msg_data.pointer = BROWSER_POINTER_AUTO;
1641 content_broadcast(data->c, CONTENT_MSG_POINTER, &msg_data);
1642 break;
1643 }
1644}
1645
1646
1647/* Documented in html_internal.h */
1649 union html_drag_owner drag_owner, const struct rect *rect)
1650{
1651 union content_msg_data msg_data;
1652
1653 assert(html != NULL);
1654
1655 html->drag_type = drag_type;
1656 html->drag_owner = drag_owner;
1657
1658 switch (drag_type) {
1659 case HTML_DRAG_NONE:
1660 assert(drag_owner.no_owner == true);
1661 msg_data.drag.type = CONTENT_DRAG_NONE;
1662 break;
1663
1667 msg_data.drag.type = CONTENT_DRAG_SCROLL;
1668 break;
1669
1671 assert(drag_owner.no_owner == true);
1675 msg_data.drag.type = CONTENT_DRAG_SELECTION;
1676 break;
1677 }
1678 msg_data.drag.rect = rect;
1679
1680 /* Inform of the content's drag status change */
1681 content_broadcast((struct content *)html, CONTENT_MSG_DRAG, &msg_data);
1682}
1683
1684/* Documented in html_internal.h */
1686 union html_focus_owner focus_owner, bool hide_caret,
1687 int x, int y, int height, const struct rect *clip)
1688{
1689 union content_msg_data msg_data;
1690 int x_off = 0;
1691 int y_off = 0;
1692 struct rect cr;
1693 bool textarea_lost_focus = html->focus_type == HTML_FOCUS_TEXTAREA &&
1694 focus_type != HTML_FOCUS_TEXTAREA;
1695
1696 assert(html != NULL);
1697
1698 switch (focus_type) {
1699 case HTML_FOCUS_SELF:
1700 assert(focus_owner.self == true);
1701 if (html->focus_type == HTML_FOCUS_SELF)
1702 /* Don't need to tell anyone anything */
1703 return;
1704 break;
1705
1706 case HTML_FOCUS_CONTENT:
1707 box_coords(focus_owner.content, &x_off, &y_off);
1708 break;
1709
1711 box_coords(focus_owner.textarea, &x_off, &y_off);
1712 break;
1713 }
1714
1715 html->focus_type = focus_type;
1716 html->focus_owner = focus_owner;
1717
1718 if (textarea_lost_focus) {
1719 msg_data.caret.type = CONTENT_CARET_REMOVE;
1720 } else if (focus_type != HTML_FOCUS_SELF && hide_caret) {
1721 msg_data.caret.type = CONTENT_CARET_HIDE;
1722 } else {
1723 if (clip != NULL) {
1724 cr = *clip;
1725 cr.x0 += x_off;
1726 cr.y0 += y_off;
1727 cr.x1 += x_off;
1728 cr.y1 += y_off;
1729 }
1730
1731 msg_data.caret.type = CONTENT_CARET_SET_POS;
1732 msg_data.caret.pos.x = x + x_off;
1733 msg_data.caret.pos.y = y + y_off;
1734 msg_data.caret.pos.height = height;
1735 msg_data.caret.pos.clip = (clip == NULL) ? NULL : &cr;
1736 }
1737
1738 /* Inform of the content's drag status change */
1739 content_broadcast((struct content *)html, CONTENT_MSG_CARET, &msg_data);
1740}
1741
1742/* Documented in html_internal.h */
1744 union html_selection_owner selection_owner, bool read_only)
1745{
1746 union content_msg_data msg_data;
1747 struct box *box;
1748 bool changed = false;
1749 bool same_type = html->selection_type == selection_type;
1750
1751 assert(html != NULL);
1752
1753 if ((selection_type == HTML_SELECTION_NONE &&
1755 (selection_type != HTML_SELECTION_NONE &&
1757 /* Existance of selection has changed, and we'll need to
1758 * inform our owner */
1759 changed = true;
1760
1761 /* Clear any existing selection */
1762 if (html->selection_type != HTML_SELECTION_NONE) {
1763 switch (html->selection_type) {
1765 if (same_type)
1766 break;
1767 selection_clear(html->sel, true);
1768 break;
1770 if (same_type && html->selection_owner.textarea ==
1771 selection_owner.textarea)
1772 break;
1775 break;
1777 if (same_type && html->selection_owner.content ==
1778 selection_owner.content)
1779 break;
1780 box = html->selection_owner.content;
1782 break;
1783 default:
1784 break;
1785 }
1786 }
1787
1788 html->selection_type = selection_type;
1789 html->selection_owner = selection_owner;
1790
1791 if (!changed)
1792 /* Don't need to report lack of change to owner */
1793 return;
1794
1795 /* Prepare msg */
1796 switch (selection_type) {
1798 assert(selection_owner.none == true);
1799 msg_data.selection.selection = false;
1800 break;
1802 assert(selection_owner.none == false);
1806 msg_data.selection.selection = true;
1807 break;
1808 default:
1809 break;
1810 }
1811 msg_data.selection.read_only = read_only;
1812
1813 /* Inform of the content's selection status change */
1815 &msg_data);
1816}
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).
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:112
@ BROWSER_POINTER_CARET
Definition: mouse.h:115
@ BROWSER_POINTER_RD
Definition: mouse.h:124
@ BROWSER_POINTER_WAIT
Definition: mouse.h:127
@ BROWSER_POINTER_UP
Definition: mouse.h:117
@ BROWSER_POINTER_LEFT
Definition: mouse.h:119
@ BROWSER_POINTER_LD
Definition: mouse.h:122
@ BROWSER_POINTER_DOWN
Definition: mouse.h:118
@ BROWSER_POINTER_AUTO
Definition: mouse.h:132
@ BROWSER_POINTER_POINT
Definition: mouse.h:114
@ BROWSER_POINTER_RIGHT
Definition: mouse.h:120
@ BROWSER_POINTER_PROGRESS
Definition: mouse.h:131
@ BROWSER_POINTER_LU
Definition: mouse.h:123
@ BROWSER_POINTER_MOVE
Definition: mouse.h:126
@ BROWSER_POINTER_HELP
Definition: mouse.h:128
@ BROWSER_POINTER_DEFAULT
Definition: mouse.h:113
@ BROWSER_POINTER_CROSS
Definition: mouse.h:125
@ BROWSER_POINTER_MENU
Definition: mouse.h:116
@ BROWSER_POINTER_RU
Definition: mouse.h:121
browser_mouse_state
Mouse state.
Definition: mouse.h:43
@ BROWSER_MOUSE_PRESS_1
button 1 pressed
Definition: mouse.h:50
@ BROWSER_MOUSE_CLICK_2
button 2 clicked.
Definition: mouse.h:57
@ BROWSER_MOUSE_PRESS_2
button 2 pressed
Definition: mouse.h:52
@ BROWSER_MOUSE_CLICK_1
button 1 clicked.
Definition: mouse.h:55
@ BROWSER_MOUSE_MOD_2
2nd modifier key pressed (eg.
Definition: mouse.h:80
@ BROWSER_MOUSE_MOD_1
1st modifier key pressed (eg.
Definition: mouse.h:78
@ BROWSER_MOUSE_DRAG_1
start of button 1 drag
Definition: mouse.h:65
@ BROWSER_MOUSE_DRAG_2
start of button 2 drag
Definition: mouse.h:67
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:294
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:1451
bool html_keypress(struct content *c, uint32_t key)
Handle keypresses.
Definition: interaction.c:1519
void html_overflow_scroll_callback(void *client_data, struct scrollbar_msg_data *scrollbar_data)
Callback for in-page scrollbars.
Definition: interaction.c:1601
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:1325
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:1023
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:328
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:1088
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:1648
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:544
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:513
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:390
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:1169
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:241
static void html_box_drag_start(struct box *box, int x, int y)
Start drag scrolling the contents of a box.
Definition: interaction.c:167
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:447
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:989
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:202
static browser_pointer_shape get_pointer_shape(struct box *box, bool imagemap)
Get pointer shape for given box.
Definition: interaction.c:69
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:671
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:1685
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:1462
static bool is_javascript_navigate_url(nsurl *url)
determine if a url has a javascript scheme
Definition: interaction.c:1068
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:1743
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:824
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:568
struct form_control * control
Definition: interaction.c:607
enum mouse_action_state::@141::@147 action
const char * target
Definition: interaction.c:601
struct dom_node * node
dom node
Definition: interaction.c:582
struct scrollbar * bar
Definition: interaction.c:622
hlcache_handle * object
non html object
Definition: interaction.c:592
@ ACTION_NOSEND
do not send status and pointer message
Definition: interaction.c:574
struct mouse_action_state::@145 scroll
scrollbar
struct mouse_action_state::@144 gadget
gadget
const char * status
status text
Definition: interaction.c:570
struct browser_window * iframe
iframe
Definition: interaction.c:595
struct mouse_action_state::@146 text
text in box
struct mouse_action_state::@141 result
struct box * drag_candidate
candidate box for drag operation
Definition: interaction.c:618
struct box * box
Definition: interaction.c:586
browser_pointer_shape pointer
pointer shape
Definition: interaction.c:571
struct mouse_action_state::@142 html_object
html object
const char * title
title
Definition: interaction.c:615
struct mouse_action_state::@143 link
link either from href or imagemap
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