NetSurf
|
Form handling functions (implementation). More...
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <dom/dom.h>
#include "utils/corestrings.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/talloc.h"
#include "utils/url.h"
#include "utils/utf8.h"
#include "utils/ascii.h"
#include "netsurf/browser_window.h"
#include "netsurf/inttypes.h"
#include "netsurf/mouse.h"
#include "netsurf/plotters.h"
#include "netsurf/misc.h"
#include "content/fetch.h"
#include "content/hlcache.h"
#include "css/utils.h"
#include "desktop/knockout.h"
#include "desktop/scrollbar.h"
#include "desktop/textarea.h"
#include "html/html.h"
#include "html/private.h"
#include "html/layout.h"
#include "html/box.h"
#include "html/box_inspect.h"
#include "html/font.h"
#include "html/form_internal.h"
Go to the source code of this file.
Data Structures | |
struct | form_select_menu |
Macros | |
#define | MAX_SELECT_HEIGHT 210 |
#define | SELECT_LINE_SPACING 0.2 |
#define | SELECT_BORDER_WIDTH 1 |
#define | SELECT_SELECTED_COLOUR 0xDB9370 |
#define | FETCH_DATA_INT_VALUE_SIZE 20 |
string allocation size for numeric values in multipart data More... | |
Functions | |
static char * | form_encode_item (const char *item, uint32_t len, const char *charset, const char *fallback) |
Convert a string from UTF-8 to the specified charset As a final fallback, this will attempt to convert to ISO-8859-1. More... | |
static nserror | fetch_data_list_add_sname (const char *name, const char *ksfx, int value, struct fetch_multipart_data ***fetch_data_next_ptr) |
append split key name and integer value to a multipart data list More... | |
static nserror | fetch_data_list_add (dom_string *name, dom_string *value, const char *rawfile, const char *form_charset, const char *docu_charset, struct fetch_multipart_data ***fetch_data_next_ptr) |
append DOM string name/value pair to a multipart data list More... | |
static nserror | form_dom_to_data_textarea (dom_html_text_area_element *text_area_element, const char *form_charset, const char *doc_charset, struct fetch_multipart_data ***fetch_data_next_ptr) |
process form HTMLTextAreaElement into multipart data. More... | |
static nserror | form_dom_to_data_select_option (dom_html_option_element *option_element, dom_string *keyname, const char *form_charset, const char *docu_charset, struct fetch_multipart_data ***fetch_data_next_ptr) |
static nserror | form_dom_to_data_select (dom_html_select_element *select_element, const char *form_charset, const char *doc_charset, struct fetch_multipart_data ***fetch_data_next_ptr) |
process form HTMLSelectElement into multipart data. More... | |
static nserror | form_dom_to_data_input_submit (dom_html_input_element *input_element, dom_string *inputname, const char *charset, const char *document_charset, dom_html_element **submit_button, struct fetch_multipart_data ***fetch_data_next_ptr) |
static nserror | form_dom_to_data_input_image (dom_html_input_element *input_element, dom_string *inputname, const char *charset, const char *document_charset, dom_html_element **submit_button, struct fetch_multipart_data ***fetch_data_next_ptr) |
static nserror | form_dom_to_data_input_checkbox (dom_html_input_element *input_element, dom_string *inputname, const char *charset, const char *document_charset, struct fetch_multipart_data ***fetch_data_next_ptr) |
static nserror | form_dom_to_data_input_file (dom_html_input_element *input_element, dom_string *inputname, const char *charset, const char *document_charset, struct fetch_multipart_data ***fetch_data_next_ptr) |
static nserror | form_dom_to_data_input_text (dom_html_input_element *input_element, dom_string *inputname, const char *charset, const char *document_charset, struct fetch_multipart_data ***fetch_data_next_ptr) |
static nserror | form_dom_to_data_input (dom_html_input_element *input_element, const char *charset, const char *document_charset, dom_html_element **submit_button, struct fetch_multipart_data ***fetch_data_next_ptr) |
process form input element into multipart data. More... | |
static nserror | form_dom_to_data_button (dom_html_button_element *button_element, const char *form_charset, const char *doc_charset, dom_html_element **submit_button, struct fetch_multipart_data ***fetch_data_next_ptr) |
process form HTMLButtonElement into multipart data. More... | |
static char * | form_acceptable_charset (struct form *form) |
Find an acceptable character set encoding with which to submit the form. More... | |
static nserror | form_dom_to_data (struct form *form, struct form_control *submit_control, struct fetch_multipart_data **fetch_data_out) |
Construct multipart data list from 'successful' controls via the DOM. More... | |
static nserror | form_url_encode (struct form *form, struct fetch_multipart_data *control, char **encoded_out) |
Encode controls using application/x-www-form-urlencoded. More... | |
static void | form_select_menu_scroll_callback (void *client_data, struct scrollbar_msg_data *scrollbar_data) |
Callback for the select menus scroll. More... | |
static nserror | form__select_process_selection (html_content *html, struct form_control *control, int item) |
Process a selection from a form select menu. More... | |
static void | form_select_menu_clicked (struct form_control *control, int x, int y) |
Handle a click on the area of the currently opened select menu. More... | |
void | form_add_control (struct form *form, struct form_control *control) |
Add a control to the list of controls in a form. More... | |
void | form_free_control (struct form_control *control) |
Free a struct form_control. More... | |
bool | form_add_option (struct form_control *control, char *value, char *text, bool selected, void *node) |
Add an option to a form select control. More... | |
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. More... | |
void | form_free_select_menu (struct form_control *control) |
Destroy a select menu and free allocated memory. More... | |
bool | form_redraw_select_menu (struct form_control *control, int x, int y, float scale, const struct rect *clip, const struct redraw_context *ctx) |
Redraw an opened select menu. More... | |
bool | form_clip_inside_select_menu (struct form_control *control, float scale, const struct rect *clip) |
Check whether a clipping rectangle is completely contained in the select menu. More... | |
nserror | form_select_process_selection (struct form_control *control, int item) |
Process a selection from a form select menu. More... | |
struct form_option * | form_select_get_option (struct form_control *control, int item) |
get a form select menus option. More... | |
char * | form_control_get_name (struct form_control *control) |
Get a form control name. More... | |
nserror | form_control_bounding_rect (struct form_control *control, struct rect *r) |
Get a form control bounding rectangle. More... | |
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. More... | |
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. More... | |
void | form_select_get_dimensions (struct form_control *control, int *width, int *height) |
Get the dimensions of a select menu. More... | |
void | form_select_menu_callback (void *client_data, int x, int y, int width, int height) |
Callback for the core select menu. More... | |
void | form_radio_set (struct form_control *radio) |
Set a radio form control and clear the others in the group. More... | |
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. More... | |
void | form_gadget_update_value (struct form_control *control, char *value) |
Update gadget value. More... | |
void | form_gadget_sync_with_dom (struct form_control *control) |
Synchronise this gadget with its associated DOM node. More... | |
struct form * | form_new (void *node, const char *action, const char *target, form_method method, const char *charset, const char *doc_charset) |
Create a struct form. More... | |
void | form_free (struct form *form) |
Free a form and any controls it owns. More... | |
struct form_control * | form_new_control (void *node, form_control_type type) |
Create a struct form_control. More... | |
Variables | |
static plot_style_t | plot_style_fill_selected |
static plot_font_style_t | plot_fstyle_entry |
Form handling functions (implementation).
Definition in file form.c.
#define FETCH_DATA_INT_VALUE_SIZE 20 |
|
static |
append DOM string name/value pair to a multipart data list
name | key name |
value | the value to associate with the key |
rawfile | the raw file value to associate with the key. |
form_charset | The form character set |
docu_charset | The document character set for fallback |
fetch_data_next_ptr | The multipart data list being constructed. |
Definition at line 232 of file form.c.
References fetch_multipart_data::file, form_encode_item(), fetch_multipart_data::name, fetch_multipart_data::next, NSERROR_NOMEM, NSERROR_OK, NSLOG, fetch_multipart_data::rawfile, and fetch_multipart_data::value.
Referenced by form_dom_to_data_button(), form_dom_to_data_input_checkbox(), form_dom_to_data_input_file(), form_dom_to_data_input_submit(), form_dom_to_data_input_text(), form_dom_to_data_select_option(), and form_dom_to_data_textarea().
|
static |
append split key name and integer value to a multipart data list
name | key name |
ksfx | key name suffix |
value | The value to encode |
fetch_data_next_ptr | The multipart data list to append to. |
Definition at line 177 of file form.c.
References FETCH_DATA_INT_VALUE_SIZE, fetch_multipart_data::name, fetch_multipart_data::next, NSERROR_NOMEM, NSERROR_OK, NSLOG, and fetch_multipart_data::value.
Referenced by form_dom_to_data_input_image().
|
static |
Process a selection from a form select menu.
html | The html content handle for the form |
control | form control with menu |
item | index of item selected from the menu |
Definition at line 1313 of file form.c.
References html_content::bctx, form_control::box, box::children, count(), form_control::data, html__redraw_a_box(), box::length, messages_get(), form_option::next, form_option::node, NSERROR_NOMEM, NSERROR_OK, form_option::selected, talloc_free(), talloc_strdup(), box::text, and box::width.
Referenced by form_select_menu_clicked(), and form_select_process_selection().
|
static |
Find an acceptable character set encoding with which to submit the form.
form | The form |
Definition at line 976 of file form.c.
References form::accept_charsets, ascii_is_space(), ascii_to_upper(), form::document_charset, and strndup().
Referenced by form_dom_to_data().
void form_add_control | ( | struct form * | form, |
struct form_control * | control | ||
) |
Add a control to the list of controls in a form.
form | The form to add the control to |
control | The control to add |
Definition at line 1433 of file form.c.
References form::controls, form_control::form, form::last_control, form_control::next, and form_control::prev.
Referenced by parse_button_element(), parse_input_element(), parse_select_element(), and parse_textarea_element().
bool form_add_option | ( | struct form_control * | control, |
char * | value, | ||
char * | text, | ||
bool | selected, | ||
void * | node | ||
) |
Add an option to a form select control.
control | form control of type GADGET_SELECT |
value | value of option, used directly (not copied) |
text | text for option, used directly (not copied) |
selected | this option is selected |
node | the DOM node this option is associated with |
Definition at line 1529 of file form.c.
References form_control::data, GADGET_SELECT, form_option::initial_selected, form_option::node, form_option::selected, text(), form_option::text, form_control::type, and form_option::value.
Referenced by box_select_add_option().
bool form_clip_inside_select_menu | ( | struct form_control * | control, |
float | scale, | ||
const struct rect * | clip | ||
) |
Check whether a clipping rectangle is completely contained in the select menu.
control | the select menu to check the clipping rectangle for |
scale | the current browser window scale |
clip | the clipping rectangle |
Definition at line 1807 of file form.c.
References clip(), form_control::data, form_select_menu::height, height, form_select_menu::width, and width.
Referenced by html_redraw().
nserror form_control_bounding_rect | ( | struct form_control * | control, |
struct rect * | r | ||
) |
Get a form control bounding rectangle.
[in] | control | The form control |
[out] | r | The rectangle to place the bounds in. |
Definition at line 1865 of file form.c.
References form_control::box, box_bounds(), and NSERROR_OK.
char * form_control_get_name | ( | struct form_control * | control | ) |
Get a form control name.
control | The form control |
Definition at line 1858 of file form.c.
References form_control::name.
|
static |
Construct multipart data list from 'successful' controls via the DOM.
All text strings in the successful controls list will be in the charset most appropriate for submission. Therefore, no utf8_to_* processing should be performed upon them.
See HTML 4.01 section 17.13.2.
[in] | form | form to search for successful controls |
[in] | submit_button | control used to submit the form, if any |
[out] | fetch_data_out | updated to point to linked list of fetch_multipart_data, NULL if no controls |
Definition at line 1054 of file form.c.
References form::document_charset, fetch_multipart_data_destroy(), form_acceptable_charset(), form_dom_to_data_button(), form_dom_to_data_input(), form_dom_to_data_select(), form_dom_to_data_textarea(), form_control::node, form::node, NSERROR_DOM, NSERROR_NOMEM, NSERROR_OK, and NSLOG.
Referenced by form_submit().
|
static |
process form HTMLButtonElement into multipart data.
https://html.spec.whatwg.org/multipage/form-elements.html#the-button-element
button_element | The form button DOM element to convert. |
form_charset | The form character set |
doc_charset | The document character set for fallback |
submit_button | The DOM element of the button submitting the form |
fetch_data_next_ptr | The multipart data list being constructed. |
Definition at line 875 of file form.c.
References fetch_data_list_add(), NSERROR_DOM, NSERROR_OK, and NSLOG.
Referenced by form_dom_to_data().
|
static |
process form input element into multipart data.
input_element | The form input DOM element to convert. |
charset | The form character set |
document_charset | The document character set for fallback |
submit_button | The DOM element of the button submitting the form |
had_submit | A boolean value indicating if the submit button has already been processed in the form element enumeration. |
fetch_data_next_ptr | The multipart data list being constructed. |
Definition at line 750 of file form.c.
References form_dom_to_data_input_checkbox(), form_dom_to_data_input_file(), form_dom_to_data_input_image(), form_dom_to_data_input_submit(), form_dom_to_data_input_text(), NSERROR_DOM, NSERROR_OK, and NSLOG.
Referenced by form_dom_to_data().
|
static |
Definition at line 613 of file form.c.
References fetch_data_list_add(), NSERROR_DOM, NSERROR_OK, and NSLOG.
Referenced by form_dom_to_data_input().
|
static |
Definition at line 663 of file form.c.
References fetch_data_list_add(), NSERROR_DOM, and NSLOG.
Referenced by form_dom_to_data_input().
|
static |
Definition at line 556 of file form.c.
References fetch_data_list_add_sname(), form_encode_item(), NSERROR_DOM, NSERROR_NOMEM, NSERROR_OK, NSLOG, image_input_coords::x, and image_input_coords::y.
Referenced by form_dom_to_data_input().
|
static |
Definition at line 516 of file form.c.
References fetch_data_list_add(), NSERROR_DOM, NSERROR_OK, and NSLOG.
Referenced by form_dom_to_data_input().
|
static |
Definition at line 707 of file form.c.
References fetch_data_list_add(), NSERROR_DOM, and NSLOG.
Referenced by form_dom_to_data_input().
|
static |
process form HTMLSelectElement into multipart data.
select_element | The form select DOM element to convert. |
form_charset | The form character set |
doc_charset | The document character set for fallback |
fetch_data_next_ptr | The multipart data list being constructed. |
Definition at line 423 of file form.c.
References form_dom_to_data_select_option(), NSERROR_DOM, NSERROR_OK, NSLOG, and options.
Referenced by form_dom_to_data().
|
static |
Definition at line 371 of file form.c.
References fetch_data_list_add(), NSERROR_DOM, NSERROR_OK, NSLOG, and fetch_multipart_data::value.
Referenced by form_dom_to_data_select().
|
static |
process form HTMLTextAreaElement into multipart data.
text_area_element | The form select DOM element to convert. |
form_charset | The form character set |
doc_charset | The document character set for fallback |
fetch_data_next_ptr | The multipart data list being constructed. |
Definition at line 306 of file form.c.
References fetch_data_list_add(), NSERROR_DOM, NSERROR_OK, and NSLOG.
Referenced by form_dom_to_data().
|
static |
Convert a string from UTF-8 to the specified charset As a final fallback, this will attempt to convert to ISO-8859-1.
item | String to convert |
len | Length of string to convert |
charset | Destination charset |
fallback | Fallback charset (may be NULL), used iff converting to charset fails |
Definition at line 107 of file form.c.
References NSERROR_BAD_ENCODING, NSERROR_NOMEM, and utf8_to_enc().
Referenced by fetch_data_list_add(), and form_dom_to_data_input_image().
void form_free | ( | struct form * | form | ) |
Free a form and any controls it owns.
form | The form to free |
Definition at line 2329 of file form.c.
References form::accept_charsets, form::action, form::controls, form::document_charset, form_free_control(), form_control::next, and form::target.
Referenced by html_destroy().
void form_free_control | ( | struct form_control * | control | ) |
Free a struct form_control.
control | structure to free |
Definition at line 1455 of file form.c.
References form::controls, form_control::data, form_control::form, form_free_select_menu(), GADGET_PASSWORD, GADGET_SELECT, GADGET_TEXTAREA, GADGET_TEXTBOX, form_control::initial_value, form::last_control, form_control::last_synced_value, form_control::name, form_control::next, form_option::next, form_control::node_value, NSLOG, form_option::text, textarea_destroy(), form_control::type, form_control::value, and form_option::value.
Referenced by box_free_box(), box_select(), form_free(), invent_fake_gadget(), parse_button_element(), and parse_input_element().
void form_free_select_menu | ( | struct form_control * | control | ) |
Destroy a select menu and free allocated memory.
control | the select form control owning the select menu being destroyed. |
Definition at line 1645 of file form.c.
References form_control::data, and scrollbar_destroy().
Referenced by form_free_control().
void form_gadget_sync_with_dom | ( | struct form_control * | control | ) |
Synchronise this gadget with its associated DOM node.
If the DOM has changed and the gadget has not, the DOM's new value is imported into the gadget. If the gadget's value has changed and the DOM's has not, the gadget's value is pushed into the DOM. If both have changed, the gadget's value wins.
control | The form gadget to synchronise |
Definition at line 2170 of file form.c.
References form_control::data, GADGET_HIDDEN, GADGET_PASSWORD, GADGET_TEXTAREA, GADGET_TEXTBOX, form_control::last_synced_value, form_control::node, form_control::node_value, strndup(), form_control::syncing, textarea_set_text(), form_control::type, fetch_multipart_data::value, and form_control::value.
Referenced by form_gadget_update_value(), html_texty_element_update(), and parse_input_element().
void form_gadget_update_value | ( | struct form_control * | control, |
char * | value | ||
) |
Update gadget value.
Definition at line 2128 of file form.c.
References form_gadget_sync_with_dom(), GADGET_FILE, GADGET_HIDDEN, GADGET_PASSWORD, GADGET_TEXTAREA, GADGET_TEXTBOX, form_control::node, form_control::type, fetch_multipart_data::value, and form_control::value.
Referenced by box_textarea_callback(), and html__set_file_gadget_filename().
struct form * form_new | ( | void * | node, |
const char * | action, | ||
const char * | target, | ||
form_method | method, | ||
const char * | charset, | ||
const char * | doc_charset | ||
) |
Create a struct form.
node | DOM node associated with form |
action | URL to submit form to, or NULL for default |
target | Target frame of form, or NULL for default |
method | method and enctype |
charset | acceptable encodings for form submission, or NULL |
doc_charset | encoding of containing document, or NULL |
Definition at line 2276 of file form.c.
References form::accept_charsets, form::action, form::document_charset, form::method, form::node, and form::target.
Referenced by parse_form_element().
struct form_control * form_new_control | ( | void * | node, |
form_control_type | type | ||
) |
Create a struct form_control.
node | Associated DOM node |
type | control type |
Definition at line 2349 of file form.c.
References form_control::node, form_control::type, and type.
Referenced by invent_fake_gadget(), parse_button_element(), parse_input_element(), parse_select_element(), and parse_textarea_element().
nserror form_open_select_menu | ( | void * | client_data, |
struct form_control * | control, | ||
select_menu_redraw_callback | redraw_callback, | ||
struct content * | c | ||
) |
Open a select menu for a select form control, creating it if necessary.
client_data | data passed to the redraw callback |
control | The select form control for which the menu is being opened |
redraw_callback | The callback to redraw the select menu. |
c | The content the select menu is opening for. |
Definition at line 1569 of file form.c.
References box::border, form_control::box, form_select_menu::c, form_select_menu::callback, form_select_menu::client_data, form_control::data, form_select_menu::f_size, font_plot_style_from_css(), form_select_menu_scroll_callback(), form_select_menu::height, LEFT, form_select_menu::line_height, MAX_SELECT_HEIGHT, NSERROR_NOMEM, NSERROR_OK, box::padding, PLOT_STYLE_SCALE, RIGHT, form_select_menu::scrollbar, scrollbar_create(), SELECT_LINE_SPACING, plot_font_style::size, box::style, html_content::unit_len_ctx, box_border::width, box::width, and form_select_menu::width.
Referenced by gadget_mouse_action().
void form_radio_set | ( | struct form_control * | radio | ) |
Set a radio form control and clear the others in the group.
radio | form control of type GADGET_RADIO |
Definition at line 1994 of file form.c.
References form_control::box, form::controls, form_control::form, GADGET_RADIO, form_control::html, html__redraw_a_box(), form_control::name, form_control::next, form_control::node, form_control::selected, and form_control::type.
Referenced by gadget_mouse_action().
bool form_redraw_select_menu | ( | struct form_control * | control, |
int | x, | ||
int | y, | ||
float | scale, | ||
const struct rect * | clip, | ||
const struct redraw_context * | ctx | ||
) |
Redraw an opened select menu.
control | the select menu being redrawn |
x | the X coordinate to draw the menu at |
y | the Y coordinate to draw the menu at |
scale | current redraw scale |
clip | clipping rectangle |
ctx | current redraw context |
Definition at line 1656 of file form.c.
References box::border, form_control::box, clip(), plotter_table::clip, form_control::data, form_select_menu::f_size, form_select_menu::height, height, LEFT, form_select_menu::line_height, line_height(), form_option::next, NSERROR_OK, box::padding, redraw_context::plot, plot_fstyle_entry, plot_style_fill_lightwbasec, plot_style_fill_selected, plot_style_stroke_darkwbasec, plotter_table::rectangle, form_select_menu::scrollbar, scrollbar_get_offset(), scrollbar_redraw(), SCROLLBAR_WIDTH, SELECT_BORDER_WIDTH, SELECT_LINE_SPACING, form_option::selected, plot_font_style::size, form_option::text, plotter_table::text, box_border::width, form_select_menu::width, width, rect::x0, rect::x1, rect::y0, and rect::y1.
Referenced by html_redraw().
void form_select_get_dimensions | ( | struct form_control * | control, |
int * | width, | ||
int * | height | ||
) |
Get the dimensions of a select menu.
control | the select menu to get the dimensions of |
width | gets updated to menu width |
height | gets updated to menu height |
Definition at line 1965 of file form.c.
References form_control::data, height, and width.
Referenced by mouse_action_select_menu().
struct form_option * form_select_get_option | ( | struct form_control * | control, |
int | item | ||
) |
get a form select menus option.
control | The form control. |
item | The index of the menu entry to return. |
Definition at line 1844 of file form.c.
References form_control::data, and form_option::next.
Referenced by gui_window_create_form_select_menu(), and ro_gui_window_prepare_form_select_menu().
void form_select_menu_callback | ( | void * | client_data, |
int | x, | ||
int | y, | ||
int | width, | ||
int | height | ||
) |
Callback for the core select menu.
Definition at line 1974 of file form.c.
References box::border, BOTTOM, form_control::box, box_coords(), form_select_menu::client_data, content__request_redraw(), box::height, height, LEFT, box::padding, TOP, html_content::visible_select_menu, box_border::width, width, box::x, and box::y.
Referenced by gadget_mouse_action().
|
static |
Handle a click on the area of the currently opened select menu.
control | the select menu which received the click |
x | X coordinate of click |
y | Y coordinate of click |
Definition at line 1400 of file form.c.
References form_select_menu::c, form_select_menu::callback, form_select_menu::client_data, form_control::data, form__select_process_selection(), form_select_menu::height, form_select_menu::line_height, line_height(), form_option::next, form_select_menu::scrollbar, scrollbar_get_offset(), SELECT_LINE_SPACING, and form_select_menu::width.
Referenced by form_select_mouse_action(), and form_select_mouse_drag_end().
|
static |
Callback for the select menus scroll.
Definition at line 1263 of file form.c.
References browser_window_set_drag_type(), html_content::bw, form_select_menu::c, form_select_menu::callback, form_select_menu::client_data, form_control::data, DRAGGING_CONTENT_SCROLLBAR, DRAGGING_NONE, form_select_menu::height, scrollbar_msg_data::msg, form_select_menu::scroll_capture, SCROLLBAR_MSG_MOVED, SCROLLBAR_MSG_SCROLL_FINISHED, SCROLLBAR_MSG_SCROLL_START, form_select_menu::width, scrollbar_msg_data::x0, rect::x0, scrollbar_msg_data::x1, scrollbar_msg_data::y0, and scrollbar_msg_data::y1.
Referenced by form_open_select_menu().
const char * form_select_mouse_action | ( | struct form_control * | control, |
enum browser_mouse_state | mouse, | ||
int | x, | ||
int | y | ||
) |
Handle mouse action for the currently opened select menu.
control | the select menu which received the mouse action |
mouse | current mouse state |
x | X coordinate of click |
y | Y coordinate of click |
Definition at line 1874 of file form.c.
References BROWSER_MOUSE_CLICK_1, BROWSER_MOUSE_CLICK_2, form_control::data, form_select_menu_clicked(), form_select_menu::height, messages_get(), form_select_menu::scroll_capture, form_select_menu::scrollbar, scrollbar_mouse_action(), scrollbar_mouse_status_to_message(), SCROLLBAR_WIDTH, and form_select_menu::width.
Referenced by mouse_action_select_menu().
void form_select_mouse_drag_end | ( | struct form_control * | control, |
enum browser_mouse_state | mouse, | ||
int | x, | ||
int | y | ||
) |
Handle mouse drag end for the currently opened select menu.
control | the select menu which received the mouse drag end |
mouse | current mouse state |
x | X coordinate of drag end |
y | Y coordinate of drag end |
Definition at line 1924 of file form.c.
References box::border, BOTTOM, form_control::box, box_coords(), form_control::data, form_select_menu_clicked(), box::height, form_select_menu::height, LEFT, box::padding, form_select_menu::scroll_capture, form_select_menu::scrollbar, scrollbar_mouse_drag_end(), SCROLLBAR_WIDTH, TOP, box_border::width, and form_select_menu::width.
Referenced by mouse_action_select_menu().
nserror form_select_process_selection | ( | struct form_control * | control, |
int | item | ||
) |
Process a selection from a form select menu.
control | form control with menu. |
item | index of item selected from the menu. |
Definition at line 1834 of file form.c.
References form__select_process_selection(), and form_control::html.
Referenced by nsgtk_select_menu_clicked(), and ro_gui_window_process_form_select_menu().
nserror form_submit | ( | struct nsurl * | page_url, |
struct browser_window * | target, | ||
struct form * | form, | ||
struct form_control * | submit_button | ||
) |
navigate browser window based on form submission.
page_url | content url |
target | The browsing context in which the navigation will occour. |
form | The form to submit. |
submit_button | The control used to submit the form. |
Definition at line 2047 of file form.c.
References form::action, browser_window_navigate(), BW_NAVIGATE_HISTORY, form_control::data, fetch_multipart_data_destroy(), form_dom_to_data(), form_url_encode(), form::method, method_GET, method_POST_MULTIPART, method_POST_URLENC, NSERROR_OK, nsurl_create(), nsurl_replace_query(), and nsurl_unref().
Referenced by box_textarea_keypress(), and mouse_action_drag_none().
|
static |
Encode controls using application/x-www-form-urlencoded.
[in] | form | form to which successful controls relate |
[in] | control | linked list of fetch_multipart_data |
[out] | encoded_out | URL-encoded form data |
Definition at line 1197 of file form.c.
References fetch_multipart_data::name, fetch_multipart_data::next, NSERROR_NOMEM, NSERROR_OK, url_escape(), and fetch_multipart_data::value.
Referenced by form_submit().
|
static |
Definition at line 84 of file form.c.
Referenced by form_redraw_select_menu().
|
static |
Definition at line 79 of file form.c.
Referenced by form_redraw_select_menu().