mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-23 23:09:39 +03:00
[project @ 2005-05-24 20:21:47 by bursa]
Convert remaining BOX_INLINEs in forms to BOX_TEXT. svn path=/import/netsurf/; revision=1736
This commit is contained in:
parent
fd99b1e906
commit
69d6e0685f
@ -90,7 +90,7 @@ void browser_window_textarea_click(struct browser_window *bw,
|
||||
if (inline_container->y + inline_container->height < y) {
|
||||
/* below the bottom of the textarea: place caret at end */
|
||||
text_box = inline_container->last;
|
||||
assert(text_box->type == BOX_INLINE);
|
||||
assert(text_box->type == BOX_TEXT);
|
||||
assert(text_box->text);
|
||||
/** \todo handle errors */
|
||||
nsfont_position_in_string(text_box->style, text_box->text,
|
||||
@ -113,7 +113,7 @@ void browser_window_textarea_click(struct browser_window *bw,
|
||||
if (!text_box) {
|
||||
/* past last text box */
|
||||
text_box = inline_container->last;
|
||||
assert(text_box->type == BOX_INLINE);
|
||||
assert(text_box->type == BOX_TEXT);
|
||||
assert(text_box->text);
|
||||
nsfont_position_in_string(text_box->style,
|
||||
text_box->text,
|
||||
@ -132,7 +132,7 @@ void browser_window_textarea_click(struct browser_window *bw,
|
||||
else
|
||||
text_box = text_box->prev;
|
||||
}
|
||||
assert(text_box->type == BOX_INLINE);
|
||||
assert(text_box->type == BOX_TEXT);
|
||||
assert(text_box->text);
|
||||
nsfont_position_in_string(text_box->style,
|
||||
text_box->text,
|
||||
@ -230,7 +230,7 @@ void browser_window_textarea_callback(struct browser_window *bw,
|
||||
|
||||
/* delete space by merging with previous text box */
|
||||
prev = text_box->prev;
|
||||
assert(prev->type == BOX_INLINE);
|
||||
assert(prev->type == BOX_TEXT);
|
||||
assert(prev->text);
|
||||
|
||||
char_offset = prev->length; /* caret at join */
|
||||
@ -271,7 +271,7 @@ void browser_window_textarea_callback(struct browser_window *bw,
|
||||
/* delete space by merging with next text box */
|
||||
|
||||
next = text_box->next;
|
||||
assert(next->type == BOX_INLINE);
|
||||
assert(next->type == BOX_TEXT);
|
||||
assert(next->text);
|
||||
|
||||
if (!textbox_insert(bw, text_box, text_box->length,
|
||||
@ -309,12 +309,12 @@ void browser_window_textarea_callback(struct browser_window *bw,
|
||||
struct box *next;
|
||||
|
||||
/* run back to start of line */
|
||||
while (text_box->prev && text_box->prev->type == BOX_INLINE)
|
||||
while (text_box->prev && text_box->prev->type == BOX_TEXT)
|
||||
text_box = text_box->prev;
|
||||
|
||||
/* run forwards to end */
|
||||
next = text_box->next;
|
||||
while (next && next->type == BOX_INLINE) {
|
||||
while (next && next->type == BOX_TEXT) {
|
||||
box_unlink_and_free(text_box);
|
||||
text_box = next;
|
||||
next = text_box->next;
|
||||
@ -398,13 +398,13 @@ void browser_window_textarea_callback(struct browser_window *bw,
|
||||
return;
|
||||
|
||||
case KEY_LINE_START:
|
||||
while (text_box->prev && text_box->prev->type == BOX_INLINE)
|
||||
while (text_box->prev && text_box->prev->type == BOX_TEXT)
|
||||
text_box = text_box->prev;
|
||||
char_offset = 0;
|
||||
break;
|
||||
|
||||
case KEY_LINE_END:
|
||||
while (text_box->next && text_box->next->type == BOX_INLINE)
|
||||
while (text_box->next && text_box->next->type == BOX_TEXT)
|
||||
text_box = text_box->next;
|
||||
char_offset = text_box->length;
|
||||
break;
|
||||
@ -467,7 +467,7 @@ void browser_window_textarea_callback(struct browser_window *bw,
|
||||
|
||||
/* box_dump(textarea, 0); */
|
||||
/* for (struct box *t = inline_container->children; t; t = t->next) {
|
||||
assert(t->type == BOX_INLINE);
|
||||
assert(t->type == BOX_TEXT);
|
||||
assert(t->text);
|
||||
assert(t->font);
|
||||
assert(t->parent == inline_container);
|
||||
|
@ -1799,7 +1799,7 @@ bool box_input(BOX_SPECIAL_PARAMS)
|
||||
inline_box = box_create(box->style, 0, box->title, 0, content);
|
||||
if (!inline_box)
|
||||
goto no_memory;
|
||||
inline_box->type = BOX_INLINE;
|
||||
inline_box->type = BOX_TEXT;
|
||||
if (box->gadget->value != NULL)
|
||||
inline_box->text = talloc_strdup(content,
|
||||
box->gadget->value);
|
||||
@ -1826,7 +1826,7 @@ bool box_input(BOX_SPECIAL_PARAMS)
|
||||
inline_box = box_create(box->style, 0, box->title, 0, content);
|
||||
if (!inline_box)
|
||||
goto no_memory;
|
||||
inline_box->type = BOX_INLINE;
|
||||
inline_box->type = BOX_TEXT;
|
||||
if ((s = (char *) xmlGetProp(n, (const xmlChar *) "value")))
|
||||
inline_box->text = talloc_strdup(content, s);
|
||||
else
|
||||
@ -1941,7 +1941,7 @@ bool box_input_text(BOX_SPECIAL_PARAMS, bool password)
|
||||
inline_box = box_create(box->style, 0, box->title, 0, content);
|
||||
if (!inline_box)
|
||||
return 0;
|
||||
inline_box->type = BOX_INLINE;
|
||||
inline_box->type = BOX_TEXT;
|
||||
if (password) {
|
||||
inline_box->length = strlen(box->gadget->value);
|
||||
inline_box->text = talloc_array(content, char,
|
||||
@ -2082,7 +2082,7 @@ bool box_select(BOX_SPECIAL_PARAMS)
|
||||
inline_box = box_create(box->style, 0, box->title, 0, content);
|
||||
if (!inline_box)
|
||||
goto no_memory;
|
||||
inline_box->type = BOX_INLINE;
|
||||
inline_box->type = BOX_TEXT;
|
||||
box_add_child(inline_container, inline_box);
|
||||
box_add_child(box, inline_container);
|
||||
|
||||
@ -2173,10 +2173,10 @@ no_memory:
|
||||
bool box_textarea(BOX_SPECIAL_PARAMS)
|
||||
{
|
||||
/* A textarea is an INLINE_BLOCK containing a single INLINE_CONTAINER,
|
||||
* which contains the text as runs of INLINE separated by BR. There is
|
||||
* at least one INLINE. The first and last boxes are INLINE.
|
||||
* which contains the text as runs of TEXT separated by BR. There is
|
||||
* at least one TEXT. The first and last boxes are TEXT.
|
||||
* Consecutive BR may not be present. These constraints are satisfied
|
||||
* by using a 0-length INLINE for blank lines. */
|
||||
* by using a 0-length TEXT for blank lines. */
|
||||
|
||||
xmlChar *text, *current;
|
||||
struct box *inline_container, *inline_box, *br_box;
|
||||
@ -2204,7 +2204,7 @@ bool box_textarea(BOX_SPECIAL_PARAMS)
|
||||
|
||||
current = text = xmlNodeGetContent(n);
|
||||
while (1) {
|
||||
/* BOX_INLINE */
|
||||
/* BOX_TEXT */
|
||||
len = strcspn(current, "\r\n");
|
||||
s = talloc_strndup(content, current, len);
|
||||
if (!s) {
|
||||
@ -2215,7 +2215,7 @@ bool box_textarea(BOX_SPECIAL_PARAMS)
|
||||
inline_box = box_create(box->style, 0, box->title, 0, content);
|
||||
if (!inline_box)
|
||||
return false;
|
||||
inline_box->type = BOX_INLINE;
|
||||
inline_box->type = BOX_TEXT;
|
||||
inline_box->text = s;
|
||||
inline_box->length = len;
|
||||
box_add_child(inline_container, inline_box);
|
||||
|
Loading…
Reference in New Issue
Block a user