mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-23 14:59:47 +03:00
[project @ 2003-12-11 19:06:39 by bursa]
Fix submit outside form crash. svn path=/import/netsurf/; revision=426
This commit is contained in:
parent
9805610091
commit
086d66c9a1
@ -500,7 +500,8 @@ int browser_window_gadget_click(struct browser_window* bw, unsigned long click_x
|
||||
gui_redraw_gadget(bw, g);
|
||||
break;
|
||||
case GADGET_SUBMIT:
|
||||
browser_form_submit(bw, g->form, g);
|
||||
if (g->form)
|
||||
browser_form_submit(bw, g->form, g);
|
||||
break;
|
||||
case GADGET_TEXTAREA:
|
||||
browser_window_textarea_click(bw,
|
||||
@ -525,7 +526,8 @@ int browser_window_gadget_click(struct browser_window* bw, unsigned long click_x
|
||||
box_coords(click_boxes[i].box, &x, &y);
|
||||
g->data.image.mx = click_x - x;
|
||||
g->data.image.my = click_y - y;
|
||||
browser_form_submit(bw, g->form, g);
|
||||
if (g->form)
|
||||
browser_form_submit(bw, g->form, g);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1017,7 +1019,8 @@ void browser_window_input_callback(struct browser_window *bw, char key, void *p)
|
||||
char_offset--;
|
||||
} else if (key == 10 || key == 13) {
|
||||
/* Return/Enter hit */
|
||||
browser_form_submit(bw, form, 0);
|
||||
if (form)
|
||||
browser_form_submit(bw, form, 0);
|
||||
/*TODO: remove caret from new page */
|
||||
} else if (key == 9) {
|
||||
/* Tab */
|
||||
@ -1533,6 +1536,8 @@ void browser_form_submit(struct browser_window *bw, struct form *form,
|
||||
char *data, *url, *url1;
|
||||
struct form_successful_control *success;
|
||||
|
||||
assert(form);
|
||||
|
||||
success = form_successful_controls(form, submit_button);
|
||||
|
||||
switch (form->method) {
|
||||
|
@ -766,6 +766,8 @@ struct result box_textarea(xmlNode *n, struct status *status,
|
||||
box->gadget->type = GADGET_TEXTAREA;
|
||||
if (status->current_form)
|
||||
form_add_control(status->current_form, box->gadget);
|
||||
else
|
||||
box->gadget->form = 0;
|
||||
style->display = CSS_DISPLAY_INLINE_BLOCK;
|
||||
|
||||
/* split the content at newlines and make an inline container with an
|
||||
@ -817,6 +819,8 @@ struct result box_select(xmlNode *n, struct status *status,
|
||||
gadget->type = GADGET_SELECT;
|
||||
if (status->current_form)
|
||||
form_add_control(status->current_form, gadget);
|
||||
else
|
||||
gadget->form = 0;
|
||||
|
||||
gadget->data.select.multiple = false;
|
||||
if ((s = (char *) xmlGetProp(n, (const xmlChar *) "multiple"))) {
|
||||
@ -1022,6 +1026,8 @@ struct result box_input(xmlNode *n, struct status *status,
|
||||
if (gadget != 0) {
|
||||
if (status->current_form)
|
||||
form_add_control(status->current_form, gadget);
|
||||
else
|
||||
gadget->form = 0;
|
||||
gadget->name = (char *) xmlGetProp(n, (const xmlChar *) "name");
|
||||
add_gadget_element(status->elements, gadget);
|
||||
}
|
||||
@ -1103,6 +1109,8 @@ struct result box_button(xmlNode *n, struct status *status,
|
||||
|
||||
if (status->current_form)
|
||||
form_add_control(status->current_form, box->gadget);
|
||||
else
|
||||
box->gadget->form = 0;
|
||||
box->gadget->box = box;
|
||||
box->gadget->name = (char *) xmlGetProp(n, (const xmlChar *) "name");
|
||||
box->gadget->value = (char *) xmlGetProp(n, (const xmlChar *) "value");
|
||||
|
Loading…
Reference in New Issue
Block a user