Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/fca421e2047a55f3cf575c92943c1116ec58da3c
...commit
http://git.netsurf-browser.org/netsurf.git/commit/fca421e2047a55f3cf575c92943c1116ec58da3c
...tree
http://git.netsurf-browser.org/netsurf.git/tree/fca421e2047a55f3cf575c92943c1116ec58da3c
The branch, master has been updated
via fca421e2047a55f3cf575c92943c1116ec58da3c (commit)
from 92fff918ccbcb62a7406fe88894153f36370ef99 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=fca421e2047a55f3cf575c92943c1116ec58da3c
commit fca421e2047a55f3cf575c92943c1116ec58da3c
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>
remove user warning and propogate error return
diff --git a/content/handlers/html/box_textarea.c
b/content/handlers/html/box_textarea.c
index f0ba9f9..8b4fdf9 100644
--- a/content/handlers/html/box_textarea.c
+++ b/content/handlers/html/box_textarea.c
@@ -38,13 +38,13 @@
#include "html/form_internal.h"
-bool box_textarea_keypress(html_content *html, struct box *box, uint32_t key)
+nserror box_textarea_keypress(html_content *html, struct box *box, uint32_t
key)
{
struct form_control *gadget = box->gadget;
struct textarea *ta = gadget->data.text.ta;
struct form* form = box->gadget->form;
struct content *c = (struct content *) html;
- nserror res;
+ nserror res = NSERROR_OK;
assert(ta != NULL);
@@ -57,12 +57,8 @@ bool box_textarea_keypress(html_content *html, struct box
*box, uint32_t key)
html->bw,
form,
NULL);
- if (res != NSERROR_OK) {
-
guit->misc->warning(messages_get_errorcode(res), NULL);
- }
-
}
- return true;
+ break;
case NS_KEY_TAB:
{
@@ -70,20 +66,20 @@ bool box_textarea_keypress(html_content *html, struct box
*box, uint32_t key)
/* Find next text entry field that is actually
* displayed (i.e. has an associated box) */
for (next_input = gadget->next;
- next_input &&
- ((next_input->type != GADGET_TEXTBOX &&
- next_input->type != GADGET_TEXTAREA &&
- next_input->type != GADGET_PASSWORD) ||
- !next_input->box);
- next_input = next_input->next)
+ next_input &&
+ ((next_input->type != GADGET_TEXTBOX &&
+ next_input->type != GADGET_TEXTAREA &&
+ next_input->type != GADGET_PASSWORD) ||
+ !next_input->box);
+ next_input = next_input->next)
;
- if (!next_input)
- return true;
- textarea_set_caret(ta, -1);
- textarea_set_caret(next_input->data.text.ta, 0);
+ if (next_input != NULL) {
+ textarea_set_caret(ta, -1);
+ textarea_set_caret(next_input->data.text.ta, 0);
+ }
}
- return true;
+ break;
case NS_KEY_SHIFT_TAB:
{
@@ -91,28 +87,31 @@ bool box_textarea_keypress(html_content *html, struct box
*box, uint32_t key)
/* Find previous text entry field that is actually
* displayed (i.e. has an associated box) */
for (prev_input = gadget->prev;
- prev_input &&
- ((prev_input->type != GADGET_TEXTBOX &&
- prev_input->type != GADGET_TEXTAREA &&
- prev_input->type != GADGET_PASSWORD) ||
- !prev_input->box);
- prev_input = prev_input->prev)
+ prev_input &&
+ ((prev_input->type != GADGET_TEXTBOX &&
+ prev_input->type != GADGET_TEXTAREA &&
+ prev_input->type != GADGET_PASSWORD) ||
+ !prev_input->box);
+ prev_input = prev_input->prev)
;
- if (!prev_input)
- return true;
- textarea_set_caret(ta, -1);
- textarea_set_caret(prev_input->data.text.ta, 0);
+ if (prev_input != NULL) {
+ textarea_set_caret(ta, -1);
+ textarea_set_caret(prev_input->data.text.ta, 0);
+ }
}
- return true;
+ break;
default:
/* Pass to textarea widget */
+ if (!textarea_keypress(ta, key)) {
+ res = NSERROR_INVALID;
+ }
break;
}
}
- return textarea_keypress(ta, key);
+ return res;
}
diff --git a/content/handlers/html/box_textarea.h
b/content/handlers/html/box_textarea.h
index 822fc8b..219ef23 100644
--- a/content/handlers/html/box_textarea.h
+++ b/content/handlers/html/box_textarea.h
@@ -45,8 +45,8 @@ bool box_textarea_create_textarea(struct html_content *html,
* \param html html content object
* \param box box with textarea widget
* \param key keypress
- * \return true iff keypress handled
+ * \return NSERROR_OK iff keypress handled
*/
-bool box_textarea_keypress(struct html_content *html, struct box *box,
uint32_t key);
+nserror box_textarea_keypress(struct html_content *html, struct box *box,
uint32_t key);
#endif
diff --git a/content/handlers/html/html_interaction.c
b/content/handlers/html/html_interaction.c
index d31ad1d..1eedf1b 100644
--- a/content/handlers/html/html_interaction.c
+++ b/content/handlers/html/html_interaction.c
@@ -1119,16 +1119,17 @@ bool html_keypress(struct content *c, uint32_t key)
{
html_content *html = (html_content *) c;
struct selection *sel = &html->sel;
- struct box *box;
switch (html->focus_type) {
case HTML_FOCUS_CONTENT:
- box = html->focus_owner.content;
- return content_keypress(box->object, key);
+ return content_keypress(html->focus_owner.content->object, key);
case HTML_FOCUS_TEXTAREA:
- box = html->focus_owner.textarea;
- return box_textarea_keypress(html, box, key);
+ if (box_textarea_keypress(html, html->focus_owner.textarea,
key) == NSERROR_OK) {
+ return true;
+ } else {
+ return false;
+ }
default:
/* Deal with it below */
-----------------------------------------------------------------------
Summary of changes:
content/handlers/html/box_textarea.c | 59 +++++++++++++++---------------
content/handlers/html/box_textarea.h | 4 +-
content/handlers/html/html_interaction.c | 11 +++---
3 files changed, 37 insertions(+), 37 deletions(-)
diff --git a/content/handlers/html/box_textarea.c
b/content/handlers/html/box_textarea.c
index f0ba9f9..8b4fdf9 100644
--- a/content/handlers/html/box_textarea.c
+++ b/content/handlers/html/box_textarea.c
@@ -38,13 +38,13 @@
#include "html/form_internal.h"
-bool box_textarea_keypress(html_content *html, struct box *box, uint32_t key)
+nserror box_textarea_keypress(html_content *html, struct box *box, uint32_t
key)
{
struct form_control *gadget = box->gadget;
struct textarea *ta = gadget->data.text.ta;
struct form* form = box->gadget->form;
struct content *c = (struct content *) html;
- nserror res;
+ nserror res = NSERROR_OK;
assert(ta != NULL);
@@ -57,12 +57,8 @@ bool box_textarea_keypress(html_content *html, struct box
*box, uint32_t key)
html->bw,
form,
NULL);
- if (res != NSERROR_OK) {
-
guit->misc->warning(messages_get_errorcode(res), NULL);
- }
-
}
- return true;
+ break;
case NS_KEY_TAB:
{
@@ -70,20 +66,20 @@ bool box_textarea_keypress(html_content *html, struct box
*box, uint32_t key)
/* Find next text entry field that is actually
* displayed (i.e. has an associated box) */
for (next_input = gadget->next;
- next_input &&
- ((next_input->type != GADGET_TEXTBOX &&
- next_input->type != GADGET_TEXTAREA &&
- next_input->type != GADGET_PASSWORD) ||
- !next_input->box);
- next_input = next_input->next)
+ next_input &&
+ ((next_input->type != GADGET_TEXTBOX &&
+ next_input->type != GADGET_TEXTAREA &&
+ next_input->type != GADGET_PASSWORD) ||
+ !next_input->box);
+ next_input = next_input->next)
;
- if (!next_input)
- return true;
- textarea_set_caret(ta, -1);
- textarea_set_caret(next_input->data.text.ta, 0);
+ if (next_input != NULL) {
+ textarea_set_caret(ta, -1);
+ textarea_set_caret(next_input->data.text.ta, 0);
+ }
}
- return true;
+ break;
case NS_KEY_SHIFT_TAB:
{
@@ -91,28 +87,31 @@ bool box_textarea_keypress(html_content *html, struct box
*box, uint32_t key)
/* Find previous text entry field that is actually
* displayed (i.e. has an associated box) */
for (prev_input = gadget->prev;
- prev_input &&
- ((prev_input->type != GADGET_TEXTBOX &&
- prev_input->type != GADGET_TEXTAREA &&
- prev_input->type != GADGET_PASSWORD) ||
- !prev_input->box);
- prev_input = prev_input->prev)
+ prev_input &&
+ ((prev_input->type != GADGET_TEXTBOX &&
+ prev_input->type != GADGET_TEXTAREA &&
+ prev_input->type != GADGET_PASSWORD) ||
+ !prev_input->box);
+ prev_input = prev_input->prev)
;
- if (!prev_input)
- return true;
- textarea_set_caret(ta, -1);
- textarea_set_caret(prev_input->data.text.ta, 0);
+ if (prev_input != NULL) {
+ textarea_set_caret(ta, -1);
+ textarea_set_caret(prev_input->data.text.ta, 0);
+ }
}
- return true;
+ break;
default:
/* Pass to textarea widget */
+ if (!textarea_keypress(ta, key)) {
+ res = NSERROR_INVALID;
+ }
break;
}
}
- return textarea_keypress(ta, key);
+ return res;
}
diff --git a/content/handlers/html/box_textarea.h
b/content/handlers/html/box_textarea.h
index 822fc8b..219ef23 100644
--- a/content/handlers/html/box_textarea.h
+++ b/content/handlers/html/box_textarea.h
@@ -45,8 +45,8 @@ bool box_textarea_create_textarea(struct html_content *html,
* \param html html content object
* \param box box with textarea widget
* \param key keypress
- * \return true iff keypress handled
+ * \return NSERROR_OK iff keypress handled
*/
-bool box_textarea_keypress(struct html_content *html, struct box *box,
uint32_t key);
+nserror box_textarea_keypress(struct html_content *html, struct box *box,
uint32_t key);
#endif
diff --git a/content/handlers/html/html_interaction.c
b/content/handlers/html/html_interaction.c
index d31ad1d..1eedf1b 100644
--- a/content/handlers/html/html_interaction.c
+++ b/content/handlers/html/html_interaction.c
@@ -1119,16 +1119,17 @@ bool html_keypress(struct content *c, uint32_t key)
{
html_content *html = (html_content *) c;
struct selection *sel = &html->sel;
- struct box *box;
switch (html->focus_type) {
case HTML_FOCUS_CONTENT:
- box = html->focus_owner.content;
- return content_keypress(box->object, key);
+ return content_keypress(html->focus_owner.content->object, key);
case HTML_FOCUS_TEXTAREA:
- box = html->focus_owner.textarea;
- return box_textarea_keypress(html, box, key);
+ if (box_textarea_keypress(html, html->focus_owner.textarea,
key) == NSERROR_OK) {
+ return true;
+ } else {
+ return false;
+ }
default:
/* Deal with it below */
--
NetSurf Browser
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org