From 287986b28a9290cc46ef585bfcc47782ea55cc70 Mon Sep 17 00:00:00 2001 From: James Bursa Date: Mon, 22 Sep 2003 21:55:08 +0000 Subject: [project @ 2003-09-22 21:55:08 by bursa] Experimental textarea editing code. svn path=/import/netsurf/; revision=309 --- render/box.c | 7 ++----- render/box.h | 8 +++++--- render/layout.c | 2 -- render/layout.h | 2 ++ 4 files changed, 9 insertions(+), 10 deletions(-) (limited to 'render') diff --git a/render/box.c b/render/box.c index c8c435179..e5e363fbd 100644 --- a/render/box.c +++ b/render/box.c @@ -709,8 +709,7 @@ struct result box_textarea(xmlNode *n, struct status *status, /* split the content at newlines and make an inline container with an * inline box for each line */ current = content = xmlNodeGetContent(n); - current += strspn(current, "\r\n"); /* skip any initial CR, LF */ - while (*current) { + do { size_t len = strcspn(current, "\r\n"); char old = current[len]; current[len] = 0; @@ -727,7 +726,7 @@ struct result box_textarea(xmlNode *n, struct status *status, current[len] = old; current += len; current += strspn(current, "\r\n"); - } + } while (*current); xmlFree(content); if ((s = (char *) xmlGetProp(n, (const xmlChar *) "name"))) @@ -1444,8 +1443,6 @@ void gadget_free(struct gui_gadget* g) xmlFree(g->data.checkbox.value); break; case GADGET_TEXTAREA: - if (g->data.textarea.text != 0) - xmlFree(g->data.textarea.text); break; case GADGET_TEXTBOX: gui_remove_gadget(g); diff --git a/render/box.h b/render/box.h index 2422f2032..9e2321ec2 100644 --- a/render/box.h +++ b/render/box.h @@ -39,6 +39,8 @@ struct formoption { struct formoption* next; }; +struct box; + struct gui_gadget { enum { GADGET_HIDDEN = 0, GADGET_TEXTBOX, GADGET_RADIO, GADGET_CHECKBOX, GADGET_SELECT, GADGET_TEXTAREA, GADGET_ACTIONBUTTON, @@ -86,9 +88,9 @@ struct gui_gadget { char* value; } radio; struct { - int cols; - int rows; - char* text; + struct box *caret_inline_container; + struct box *caret_text_box; + int caret_char_offset; } textarea; } data; }; diff --git a/render/layout.c b/render/layout.c index a759caf72..7ee46b898 100644 --- a/render/layout.c +++ b/render/layout.c @@ -31,8 +31,6 @@ static void layout_node(struct box * box, unsigned long width, struct box * cont, unsigned long cx, unsigned long cy); -static void layout_block(struct box * box, unsigned long width, struct box * cont, - unsigned long cx, unsigned long cy); static unsigned long layout_block_children(struct box * box, unsigned long width, struct box * cont, unsigned long cx, unsigned long cy); static void find_sides(struct box * fl, unsigned long y0, unsigned long y1, diff --git a/render/layout.h b/render/layout.h index 6e8ea6481..4a70cc7e4 100644 --- a/render/layout.h +++ b/render/layout.h @@ -13,5 +13,7 @@ */ void layout_document(struct box * box, unsigned long width); +void layout_block(struct box * box, unsigned long width, struct box * cont, + unsigned long cx, unsigned long cy); #endif -- cgit v1.2.3