summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2012-09-08 15:59:55 +0100
committerMichael Drake <tlsa@netsurf-browser.org>2012-09-08 15:59:55 +0100
commit3e549fde3eb07bf9bc696a701035de29d8b2cd96 (patch)
tree9575514c730816e7a43eed699788cf93a1d3f640
parentba7fba824d8b3dfcaa7da4c74a3d7d5c75c811e6 (diff)
downloadnetsurf-3e549fde3eb07bf9bc696a701035de29d8b2cd96.tar.gz
netsurf-3e549fde3eb07bf9bc696a701035de29d8b2cd96.tar.bz2
Update to use latest libdom. Fixes handling of text input with no maxlength set.
-rw-r--r--render/form.c3
-rw-r--r--render/html_forms.c15
2 files changed, 13 insertions, 5 deletions
diff --git a/render/form.c b/render/form.c
index f0596b3d2..05d4042a2 100644
--- a/render/form.c
+++ b/render/form.c
@@ -200,9 +200,6 @@ struct form_control *form_new_control(void *node, form_control_type type)
control->node = node;
control->type = type;
- /* Default max length of input to something insane */
- control->maxlength = UINT_MAX;
-
return control;
}
diff --git a/render/html_forms.c b/render/html_forms.c
index fc2bcaf8a..f5c6600cd 100644
--- a/render/html_forms.c
+++ b/render/html_forms.c
@@ -332,10 +332,21 @@ parse_input_element(struct form *forms, dom_html_input_element *input)
if (control->type == GADGET_PASSWORD ||
control->type == GADGET_TEXTBOX) {
- unsigned long maxlength;
+ long maxlength;
if (dom_html_input_element_get_max_length(
- input, &maxlength) == DOM_NO_ERR) {
+ input, &maxlength) != DOM_NO_ERR) {
+ maxlength = -1;
+ }
+
+ if (maxlength >= 0) {
+ /* Got valid maxlength */
control->maxlength = maxlength;
+ } else {
+ /* Input has no maxlength attr, or
+ * dom_html_input_element_get_max_length failed.
+ *
+ * Set it to something insane. */
+ control->maxlength = UINT_MAX;
}
}