summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--desktop/browser.c34
-rw-r--r--desktop/browser.h4
-rw-r--r--desktop/textinput.c2
-rw-r--r--render/form.c3
-rw-r--r--render/form.h3
-rw-r--r--render/html.c3
6 files changed, 25 insertions, 24 deletions
diff --git a/desktop/browser.c b/desktop/browser.c
index 052e8bad8..0cb541358 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -842,6 +842,8 @@ void browser_window_destroy_internal(struct browser_window *bw)
{
assert(bw);
+ LOG(("Destroying window"));
+
if ((bw->children) || (bw->iframes))
browser_window_destroy_children(bw);
if (bw->loading_content) {
@@ -1212,6 +1214,8 @@ void browser_window_mouse_action_html(struct browser_window *bw,
gadget_box = box;
gadget_box_x = box_x;
gadget_box_y = box_y;
+ if (gadget->form)
+ target = gadget->form->target;
}
if (box->title)
@@ -1285,11 +1289,11 @@ void browser_window_mouse_action_html(struct browser_window *bw,
status = status_buffer;
pointer = GUI_POINTER_POINT;
if (mouse & BROWSER_MOUSE_CLICK_1)
- browser_form_submit(bw, gadget->form,
- gadget, false);
+ browser_form_submit(bw, target, gadget->form,
+ gadget);
else if (mouse & BROWSER_MOUSE_CLICK_2)
- browser_form_submit(bw, gadget->form,
- gadget, true);
+ browser_form_submit(bw, "_blank", gadget->form,
+ gadget);
} else {
status = messages_get("FormBadSubmit");
}
@@ -2210,12 +2214,12 @@ gui_pointer_shape get_pointer_shape(css_cursor cursor)
* Collect controls and submit a form.
*/
-void browser_form_submit(struct browser_window *bw, struct form *form,
- struct form_control *submit_button, bool new_window)
+void browser_form_submit(struct browser_window *bw, const char *target,
+ struct form *form, struct form_control *submit_button)
{
char *data = 0, *url = 0;
struct form_successful_control *success;
- struct browser_window *target;
+ struct browser_window *bw_form;
assert(form);
assert(bw->current_content->type == CONTENT_HTML);
@@ -2225,14 +2229,8 @@ void browser_form_submit(struct browser_window *bw, struct form *form,
return;
}
- if (new_window) {
- target = browser_window_create(NULL, bw, NULL, false);
- /* any error has already been reported */
- if (!target)
- return;
- } else {
- target = bw;
- }
+ bw_form = browser_window_find_target(bw, target);
+ assert(bw);
switch (form->method) {
case method_GET:
@@ -2255,7 +2253,7 @@ void browser_form_submit(struct browser_window *bw, struct form *form,
else {
sprintf(url, "%s?%s", form->action, data);
}
- browser_window_go(target, url, bw->current_content->url,
+ browser_window_go(bw_form, url, bw->current_content->url,
true);
break;
@@ -2266,13 +2264,13 @@ void browser_form_submit(struct browser_window *bw, struct form *form,
warn_user("NoMemory", 0);
return;
}
- browser_window_go_post(target, form->action, data, 0,
+ browser_window_go_post(bw_form, form->action, data, 0,
true, bw->current_content->url,
false);
break;
case method_POST_MULTIPART:
- browser_window_go_post(target, form->action, 0, success,
+ browser_window_go_post(bw_form, form->action, 0, success,
true, bw->current_content->url,
false);
break;
diff --git a/desktop/browser.h b/desktop/browser.h
index e64e0ae21..c7bbaf8e3 100644
--- a/desktop/browser.h
+++ b/desktop/browser.h
@@ -209,8 +209,8 @@ bool browser_window_paste_text(struct browser_window *bw, const char *utf8,
void browser_window_form_select(struct browser_window *bw,
struct form_control *control, int item);
void browser_redraw_box(struct content *c, struct box *box);
-void browser_form_submit(struct browser_window *bw, struct form *form,
- struct form_control *submit_button, bool new_window);
+void browser_form_submit(struct browser_window *bw, const char *target,
+ struct form *form, struct form_control *submit_button);
void browser_window_redraw_rect(struct browser_window *bw, int x, int y,
int width, int height);
diff --git a/desktop/textinput.c b/desktop/textinput.c
index d8965725b..b03bc0999 100644
--- a/desktop/textinput.c
+++ b/desktop/textinput.c
@@ -920,7 +920,7 @@ void browser_window_input_callback(struct browser_window *bw,
case 10:
case 13: /* Return/Enter hit */
if (form)
- browser_form_submit(bw, form, 0, false);
+ browser_form_submit(bw, 0, form, 0);
return;
case 11: { /* Shift + Tab */
diff --git a/render/form.c b/render/form.c
index b9aa654a0..191985694 100644
--- a/render/form.c
+++ b/render/form.c
@@ -38,7 +38,7 @@ static char *form_acceptable_charset(struct form *form);
* \return a new structure, or 0 on memory exhaustion
*/
-struct form *form_new(char *action, form_method method, char *charset,
+struct form *form_new(char *action, char *target, form_method method, char *charset,
char *doc_charset)
{
struct form *form;
@@ -47,6 +47,7 @@ struct form *form_new(char *action, form_method method, char *charset,
if (!form)
return 0;
form->action = action;
+ form->target = target;
form->method = method;
form->accept_charsets = charset;
form->document_charset = doc_charset;
diff --git a/render/form.h b/render/form.h
index f691eea8f..edc7fb68f 100644
--- a/render/form.h
+++ b/render/form.h
@@ -30,6 +30,7 @@ typedef enum {
/** HTML form. */
struct form {
char *action; /**< Absolute URL to submit to. */
+ char *target; /**< Target to submit to. */
form_method method; /**< Method and enctype. */
char *accept_charsets; /**< Charset to submit form in */
char *document_charset; /**< Charset of document containing form */
@@ -103,7 +104,7 @@ struct form_successful_control {
struct form_successful_control *next; /**< Next in linked list. */
};
-struct form *form_new(char *action, form_method method, char *charset,
+struct form *form_new(char *action, char *target, form_method method, char *charset,
char *doc_charset);
struct form_control *form_new_control(form_control_type type);
void form_add_control(struct form *form, struct form_control *control);
diff --git a/render/html.c b/render/html.c
index c00bf0948..ddf097cb3 100644
--- a/render/html.c
+++ b/render/html.c
@@ -503,7 +503,8 @@ bool html_head(struct content *c, xmlNode *head)
for (node = head->children; node != 0; node = node->next) {
if (node->type != XML_ELEMENT_NODE)
continue;
-
+
+ LOG(("Node: %s", node->name));
if (!c->title && strcmp(node->name, "title") == 0) {
xmlChar *title = xmlNodeGetContent(node);
if (!title)