summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
Diffstat (limited to 'render')
-rw-r--r--render/box.c2
-rw-r--r--render/box_construct.c2
-rw-r--r--render/box_textarea.c2
-rw-r--r--render/form.c23
-rw-r--r--render/form.h102
-rw-r--r--render/form_internal.h125
-rw-r--r--render/html.c2
-rw-r--r--render/html_forms.c2
-rw-r--r--render/html_interaction.c2
-rw-r--r--render/html_redraw.c2
10 files changed, 151 insertions, 113 deletions
diff --git a/render/box.c b/render/box.c
index 3557e6c47..30bafa904 100644
--- a/render/box.c
+++ b/render/box.c
@@ -36,7 +36,7 @@
#include "desktop/scrollbar.h"
#include "utils/nsoption.h"
#include "render/box.h"
-#include "render/form.h"
+#include "render/form_internal.h"
#include "render/html_internal.h"
#include "utils/log.h"
#include "utils/talloc.h"
diff --git a/render/box_construct.c b/render/box_construct.c
index 95d9f6152..3d7be33e5 100644
--- a/render/box_construct.c
+++ b/render/box_construct.c
@@ -49,7 +49,7 @@
#include "render/box.h"
#include "render/box_textarea.h"
-#include "render/form.h"
+#include "render/form_internal.h"
#include "render/html_internal.h"
/**
diff --git a/render/box_textarea.c b/render/box_textarea.c
index 1a431ed88..b129f1257 100644
--- a/render/box_textarea.c
+++ b/render/box_textarea.c
@@ -29,7 +29,7 @@
#include "render/box_textarea.h"
#include "render/font.h"
-#include "render/form.h"
+#include "render/form_internal.h"
bool box_textarea_keypress(html_content *html, struct box *box, uint32_t key)
diff --git a/render/form.c b/render/form.c
index b8656bca9..66c875a00 100644
--- a/render/form.c
+++ b/render/form.c
@@ -54,7 +54,7 @@
#include "render/box.h"
#include "render/font.h"
-#include "render/form.h"
+#include "render/form_internal.h"
#include "render/html.h"
#include "render/html_internal.h"
#include "render/layout.h"
@@ -96,18 +96,7 @@ static void form_select_menu_clicked(struct form_control *control,
static void form_select_menu_scroll_callback(void *client_data,
struct scrollbar_msg_data *scrollbar_data);
-/**
- * Create a struct form.
- *
- * \param node DOM node associated with form
- * \param action URL to submit form to, or NULL for default
- * \param target Target frame of form, or NULL for default
- * \param method method and enctype
- * \param charset acceptable encodings for form submission, or NULL
- * \param doc_charset encoding of containing document, or NULL
- * \param html HTML content containing form
- * \return a new structure, or NULL on memory exhaustion
- */
+/* exported interface documented in render/form_internal.h */
struct form *form_new(void *node, const char *action, const char *target,
form_method method, const char *charset,
const char *doc_charset)
@@ -186,13 +175,7 @@ void form_free(struct form *form)
free(form);
}
-/**
- * Create a struct form_control.
- *
- * \param node Associated DOM node
- * \param type control type
- * \return a new structure, or NULL on memory exhaustion
- */
+/* exported interface documented in render/form_internal.h */
struct form_control *form_new_control(void *node, form_control_type type)
{
struct form_control *control;
diff --git a/render/form.h b/render/form.h
index 66ff2d901..05898e3c5 100644
--- a/render/form.h
+++ b/render/form.h
@@ -31,6 +31,7 @@ struct box;
struct form_control;
struct form_option;
struct form_select_menu;
+struct form;
struct html_content;
struct dom_string;
struct content;
@@ -41,27 +42,7 @@ struct browser_window;
enum browser_mouse_state;
-/** Form submit method. */
-typedef enum {
- method_GET, /**< GET, always url encoded. */
- method_POST_URLENC, /**< POST, url encoded. */
- method_POST_MULTIPART /**< POST, multipart/form-data. */
-} form_method;
-
-/** HTML form. */
-struct form {
- void *node; /**< Corresponding DOM node */
- 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 */
- struct form_control *controls; /**< Linked list of controls. */
- struct form_control *last_control; /**< Last control in list. */
-
- struct form *prev; /**< Previous form in doc. */
-};
/** Type of a struct form_control. */
typedef enum {
@@ -84,6 +65,21 @@ struct form_textarea_data {
struct form_control *gadget;
};
+/** Option in a select. */
+struct form_option {
+ void *node; /**< Corresponding DOM node */
+ bool selected;
+ bool initial_selected;
+ char *value;
+ char *text; /**< NUL terminated. */
+ struct form_option* next;
+};
+
+struct image_input_coords {
+ int x;
+ int y;
+};
+
/** Form control. */
struct form_control {
void *node; /**< Corresponding DOM node */
@@ -129,73 +125,7 @@ struct form_control {
struct form_control *next; /**< Next control in this form. */
};
-/** Option in a select. */
-struct form_option {
- void *node; /**< Corresponding DOM node */
- bool selected;
- bool initial_selected;
- char *value;
- char *text; /**< NUL terminated. */
- struct form_option* next;
-};
-
-struct image_input_coords {
- int x;
- int y;
-};
-/**
- * Called by the select menu when it wants an area to be redrawn. The
- * coordinates are menu origin relative.
- *
- * \param client_data data which was passed to form_open_select_menu
- * \param x X coordinate of redraw rectangle
- * \param y Y coordinate of redraw rectangle
- * \param width width of redraw rectangle
- * \param height height of redraw rectangle
- */
-typedef void(*select_menu_redraw_callback)(void *client_data,
- int x, int y, int width, int height);
-
-struct form *form_new(void *node, const char *action, const char *target,
- form_method method, const char *charset,
- const char *doc_charset);
-void form_free(struct form *form);
-struct form_control *form_new_control(void *node, form_control_type type);
-void form_add_control(struct form *form, struct form_control *control);
-void form_free_control(struct form_control *control);
-bool form_add_option(struct form_control *control, char *value, char *text,
- bool selected, void *node);
-bool form_successful_controls(struct form *form,
- struct form_control *submit_button,
- struct fetch_multipart_data **successful_controls);
-bool form_successful_controls_dom(struct form *form,
- struct form_control *submit_button,
- struct fetch_multipart_data **successful_controls);
-
-bool form_open_select_menu(void *client_data,
- struct form_control *control,
- select_menu_redraw_callback redraw_callback,
- struct content *c);
-void form_select_menu_callback(void *client_data,
- int x, int y, int width, int height);
-void form_free_select_menu(struct form_control *control);
-bool form_redraw_select_menu(struct form_control *control, int x, int y,
- float scale, const struct rect *clip,
- const struct redraw_context *ctx);
-bool form_clip_inside_select_menu(struct form_control *control, float scale,
- const struct rect *clip);
-const char *form_select_mouse_action(struct form_control *control,
- enum browser_mouse_state mouse, int x, int y);
-void form_select_mouse_drag_end(struct form_control *control,
- enum browser_mouse_state mouse, int x, int y);
-void form_select_get_dimensions(struct form_control *control,
- int *width, int *height);
void form_select_process_selection(struct form_control *control, int item);
-void form_submit(struct nsurl *page_url, struct browser_window *target,
- struct form *form, struct form_control *submit_button);
-void form_radio_set(struct form_control *radio);
-
-void form_gadget_update_value(struct form_control *control, char *value);
#endif
diff --git a/render/form_internal.h b/render/form_internal.h
new file mode 100644
index 000000000..e6df14b4e
--- /dev/null
+++ b/render/form_internal.h
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2014 Vincent Sanders <vince@netsurf-browser.org>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * \file
+ * Interface to form handling functions internal to render.
+ */
+
+#ifndef _NETSURF_RENDER_FORM_INTERNAL_H_
+#define _NETSURF_RENDER_FORM_INTERNAL_H_
+
+#include "render/form.h"
+
+/** Form submit method. */
+typedef enum {
+ method_GET, /**< GET, always url encoded. */
+ method_POST_URLENC, /**< POST, url encoded. */
+ method_POST_MULTIPART /**< POST, multipart/form-data. */
+} form_method;
+
+/** HTML form. */
+struct form {
+ void *node; /**< Corresponding DOM node */
+
+ 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 */
+ struct form_control *controls; /**< Linked list of controls. */
+ struct form_control *last_control; /**< Last control in list. */
+
+ struct form *prev; /**< Previous form in doc. */
+};
+
+/**
+ * Called by the select menu when it wants an area to be redrawn. The
+ * coordinates are menu origin relative.
+ *
+ * \param client_data data which was passed to form_open_select_menu
+ * \param x X coordinate of redraw rectangle
+ * \param y Y coordinate of redraw rectangle
+ * \param width width of redraw rectangle
+ * \param height height of redraw rectangle
+ */
+typedef void(*select_menu_redraw_callback)(void *client_data,
+ int x, int y, int width, int height);
+
+/**
+ * Create a struct form.
+ *
+ * \param node DOM node associated with form
+ * \param action URL to submit form to, or NULL for default
+ * \param target Target frame of form, or NULL for default
+ * \param method method and enctype
+ * \param charset acceptable encodings for form submission, or NULL
+ * \param doc_charset encoding of containing document, or NULL
+ * \param html HTML content containing form
+ * \return a new structure, or NULL on memory exhaustion
+ */
+struct form *form_new(void *node, const char *action, const char *target,
+ form_method method, const char *charset,
+ const char *doc_charset);
+void form_free(struct form *form);
+
+/**
+ * Create a struct form_control.
+ *
+ * \param node Associated DOM node
+ * \param type control type
+ * \return a new structure, or NULL on memory exhaustion
+ */
+struct form_control *form_new_control(void *node, form_control_type type);
+
+void form_add_control(struct form *form, struct form_control *control);
+void form_free_control(struct form_control *control);
+bool form_add_option(struct form_control *control, char *value, char *text,
+ bool selected, void *node);
+bool form_successful_controls(struct form *form,
+ struct form_control *submit_button,
+ struct fetch_multipart_data **successful_controls);
+bool form_successful_controls_dom(struct form *form,
+ struct form_control *submit_button,
+ struct fetch_multipart_data **successful_controls);
+
+bool form_open_select_menu(void *client_data,
+ struct form_control *control,
+ select_menu_redraw_callback redraw_callback,
+ struct content *c);
+void form_select_menu_callback(void *client_data,
+ int x, int y, int width, int height);
+void form_free_select_menu(struct form_control *control);
+bool form_redraw_select_menu(struct form_control *control, int x, int y,
+ float scale, const struct rect *clip,
+ const struct redraw_context *ctx);
+bool form_clip_inside_select_menu(struct form_control *control, float scale,
+ const struct rect *clip);
+const char *form_select_mouse_action(struct form_control *control,
+ enum browser_mouse_state mouse, int x, int y);
+void form_select_mouse_drag_end(struct form_control *control,
+ enum browser_mouse_state mouse, int x, int y);
+void form_select_get_dimensions(struct form_control *control,
+ int *width, int *height);
+void form_submit(struct nsurl *page_url, struct browser_window *target,
+ struct form *form, struct form_control *submit_button);
+void form_radio_set(struct form_control *radio);
+
+void form_gadget_update_value(struct form_control *control, char *value);
+
+#endif
diff --git a/render/html.c b/render/html.c
index c7b4200e3..b6bbfa814 100644
--- a/render/html.c
+++ b/render/html.c
@@ -51,7 +51,7 @@
#include "desktop/gui_internal.h"
#include "render/box.h"
-#include "render/form.h"
+#include "render/form_internal.h"
#include "render/html_internal.h"
#include "render/imagemap.h"
#include "render/layout.h"
diff --git a/render/html_forms.c b/render/html_forms.c
index 97a861bf7..fe289f261 100644
--- a/render/html_forms.c
+++ b/render/html_forms.c
@@ -21,7 +21,7 @@
#include "desktop/browser.h"
-#include "render/form.h"
+#include "render/form_internal.h"
#include "render/html_internal.h"
/**
diff --git a/render/html_interaction.c b/render/html_interaction.c
index 9a692cba1..a89cfca7f 100644
--- a/render/html_interaction.c
+++ b/render/html_interaction.c
@@ -50,7 +50,7 @@
#include "render/box.h"
#include "render/box_textarea.h"
#include "render/font.h"
-#include "render/form.h"
+#include "render/form_internal.h"
#include "render/html_internal.h"
#include "render/imagemap.h"
#include "render/search.h"
diff --git a/render/html_redraw.c b/render/html_redraw.c
index f61a0076e..ed06d472f 100644
--- a/render/html_redraw.c
+++ b/render/html_redraw.c
@@ -54,7 +54,7 @@
#include "render/box.h"
#include "render/font.h"
-#include "render/form.h"
+#include "render/form_internal.h"
#include "render/html_internal.h"
#include "render/layout.h"
#include "render/search.h"