1 Description: Support the button element as defined in HTML 4.01
2 Origin: upstream, http://www.sic.med.tohoku.ac.jp/~satodai/w3m-dev/201009.month/4411.html
3 Bug-Debian: http://bugs.debian.org/136810
6 ===================================================================
7 RCS file: /cvsroot/w3m/w3m/file.c,v
8 retrieving revision 1.264
10 --- w3m.orig/file.c 3 Aug 2010 10:02:16 -0000 1.264
11 +++ w3m/file.c 17 Sep 2010 12:18:55 -0000
13 bcopy((void *)&obuf->anchor, (void *)&obuf->bp.anchor,
14 sizeof(obuf->anchor));
15 obuf->bp.img_alt = obuf->img_alt;
16 + obuf->bp.input_alt = obuf->input_alt;
17 obuf->bp.in_bold = obuf->in_bold;
18 obuf->bp.in_italic = obuf->in_italic;
19 obuf->bp.in_under = obuf->in_under;
21 bcopy((void *)&obuf->bp.anchor, (void *)&obuf->anchor,
22 sizeof(obuf->anchor));
23 obuf->img_alt = obuf->bp.img_alt;
24 + obuf->input_alt = obuf->bp.input_alt;
25 obuf->in_bold = obuf->bp.in_bold;
26 obuf->in_italic = obuf->bp.in_italic;
27 obuf->in_under = obuf->bp.in_under;
29 Str line = obuf->line, pass = NULL;
30 char *hidden_anchor = NULL, *hidden_img = NULL, *hidden_bold = NULL,
31 *hidden_under = NULL, *hidden_italic = NULL, *hidden_strike = NULL,
32 - *hidden_ins = NULL, *hidden = NULL;
33 + *hidden_ins = NULL, *hidden_input, *hidden = NULL;
37 @@ -2759,6 +2761,12 @@
41 + if (obuf->input_alt.in) {
42 + if ((hidden_input = has_hidden_link(obuf, HTML_INPUT_ALT)) != NULL) {
43 + if (!hidden || hidden_input < hidden)
44 + hidden = hidden_input;
48 if ((hidden_bold = has_hidden_link(obuf, HTML_B)) != NULL) {
49 if (!hidden || hidden_bold < hidden)
51 Strcat_charp(line, "</a>");
52 if (obuf->img_alt && !hidden_img)
53 Strcat_charp(line, "</img_alt>");
54 + if (obuf->input_alt.in && !hidden_input)
55 + Strcat_charp(line, "</input_alt>");
56 if (obuf->in_bold && !hidden_bold)
57 Strcat_charp(line, "</b>");
58 if (obuf->in_italic && !hidden_italic)
59 @@ -3020,6 +3030,18 @@
60 Strcat_charp(tmp, "\">");
61 push_tag(obuf, tmp->ptr, HTML_IMG_ALT);
63 + if (!hidden_input && obuf->input_alt.in) {
65 + if (obuf->input_alt.hseq > 0)
66 + obuf->input_alt.hseq = - obuf->input_alt.hseq;
67 + tmp = Sprintf("<INPUT_ALT hseq=\"%d\" fid=\"%d\" name=\"%s\" type=\"%s\" value=\"%s\">",
68 + obuf->input_alt.hseq,
69 + obuf->input_alt.fid,
70 + obuf->input_alt.name->ptr,
71 + obuf->input_alt.type->ptr,
72 + obuf->input_alt.value->ptr);
73 + push_tag(obuf, tmp->ptr, HTML_INPUT_ALT);
75 if (!hidden_bold && obuf->in_bold)
76 push_tag(obuf, "<B>", HTML_B);
77 if (!hidden_italic && obuf->in_italic)
78 @@ -3730,6 +3752,63 @@
82 +process_button(struct parsed_tag *tag)
85 + char *p, *q, *r, *qq = NULL;
88 + if (cur_form_id < 0) {
89 + char *s = "<form_int method=internal action=none>";
90 + tmp = process_form(parse_tag(&s, TRUE));
96 + parsedtag_get_value(tag, ATTR_TYPE, &p);
98 + parsedtag_get_value(tag, ATTR_VALUE, &q);
100 + parsedtag_get_value(tag, ATTR_NAME, &r);
103 + if (v == FORM_UNKNOWN)
108 + case FORM_INPUT_SUBMIT:
109 + case FORM_INPUT_BUTTON:
112 + case FORM_INPUT_RESET:
118 + qq = html_quote(q);
122 + // Strcat_charp(tmp, "<pre_int>");
123 + Strcat(tmp, Sprintf("<input_alt hseq=\"%d\" fid=\"%d\" type=%s "
124 + "name=\"%s\" value=\"%s\">",
125 + cur_hseq++, cur_form_id, p, html_quote(r), qq));
130 +process_n_button(void)
132 + Str tmp = Strnew();
133 + Strcat_charp(tmp, "</input_alt>");
134 + // Strcat_charp(tmp, "</pre_int>");
139 process_select(struct parsed_tag *tag)
142 @@ -4859,7 +4938,35 @@
143 if (i > obuf->bottom_margin)
144 obuf->bottom_margin = i;
146 + if (parsedtag_get_value(tag, ATTR_HSEQ, &hseq)) {
147 + obuf->input_alt.hseq = hseq;
149 + if (parsedtag_get_value(tag, ATTR_FID, &i)) {
150 + obuf->input_alt.fid = i;
152 + if (parsedtag_get_value(tag, ATTR_TYPE, &p)) {
153 + obuf->input_alt.type = Strnew_charp(p);
155 + if (parsedtag_get_value(tag, ATTR_VALUE, &p)) {
156 + obuf->input_alt.value = Strnew_charp(p);
158 + if (parsedtag_get_value(tag, ATTR_NAME, &p)) {
159 + obuf->input_alt.name = Strnew_charp(p);
161 + obuf->input_alt.in = 1;
163 + case HTML_N_INPUT_ALT:
164 + if (obuf->input_alt.in) {
165 + if (!close_effect0(obuf, HTML_INPUT_ALT))
166 + push_tag(obuf, "</input_alt>", HTML_N_INPUT_ALT);
167 + obuf->input_alt.hseq = 0;
168 + obuf->input_alt.fid = -1;
169 + obuf->input_alt.in = 0;
170 + obuf->input_alt.type = NULL;
171 + obuf->input_alt.name = NULL;
172 + obuf->input_alt.value = NULL;
176 close_anchor(h_env, obuf);
178 @@ -4968,6 +5075,16 @@
180 close_anchor(h_env, obuf);
181 tmp = process_input(tag);
183 + HTMLlineproc1(tmp->ptr, h_env);
186 + tmp = process_button(tag);
188 + HTMLlineproc1(tmp->ptr, h_env);
190 + case HTML_N_BUTTON:
191 + tmp = process_n_button();
193 HTMLlineproc1(tmp->ptr, h_env);
195 @@ -5680,6 +5797,21 @@
196 putHmarker(buf->hmarklist, currentLn(buf),
199 + else if (hseq < 0) {
204 + if (buf->hmarklist &&
205 + h < buf->hmarklist->nmark &&
206 + buf->hmarklist->marks[h].invalid) {
207 + buf->hmarklist->marks[h].pos = hpos;
208 + buf->hmarklist->marks[h].line = currentLn(buf);
209 + buf->hmarklist->marks[h].invalid = 0;
215 form->target = buf->baseTarget;
217 @@ -6747,6 +6879,12 @@
218 obuf->nobr_level = 0;
219 bzero((void *)&obuf->anchor, sizeof(obuf->anchor));
221 + obuf->input_alt.hseq = 0;
222 + obuf->input_alt.fid = -1;
223 + obuf->input_alt.in = 0;
224 + obuf->input_alt.type = NULL;
225 + obuf->input_alt.name = NULL;
226 + obuf->input_alt.value = NULL;
230 @@ -6782,6 +6920,15 @@
231 push_tag(obuf, "</img_alt>", HTML_N_IMG_ALT);
232 obuf->img_alt = NULL;
234 + if (obuf->input_alt.in) {
235 + push_tag(obuf, "</input_alt>", HTML_N_INPUT_ALT);
236 + obuf->input_alt.hseq = 0;
237 + obuf->input_alt.fid = -1;
238 + obuf->input_alt.in = 0;
239 + obuf->input_alt.type = NULL;
240 + obuf->input_alt.name = NULL;
241 + obuf->input_alt.value = NULL;
244 push_tag(obuf, "</b>", HTML_N_B);
247 ===================================================================
248 RCS file: /cvsroot/w3m/w3m/fm.h,v
249 retrieving revision 1.149
251 --- w3m.orig/fm.h 20 Aug 2010 09:47:09 -0000 1.149
252 +++ w3m/fm.h 17 Sep 2010 12:18:55 -0000
254 #define INIT_BUFFER_WIDTH ((_INIT_BUFFER_WIDTH > 0) ? _INIT_BUFFER_WIDTH : 0)
255 #define FOLD_BUFFER_WIDTH (FoldLine ? (INIT_BUFFER_WIDTH + 1) : -1)
257 +struct input_alt_attr {
261 + Str type, name, value;
271 + struct input_alt_attr input_alt;
272 char fontstat[FONTSTAT_SIZE];
279 + struct input_alt_attr input_alt;
280 char fontstat[FONTSTAT_SIZE];
281 char fontstat_stack[FONT_STACK_SIZE][FONTSTAT_SIZE];
284 ===================================================================
285 RCS file: /cvsroot/w3m/w3m/html.c,v
286 retrieving revision 1.32
287 diff -u -r1.32 html.c
288 --- w3m.orig/html.c 14 Aug 2010 01:29:40 -0000 1.32
289 +++ w3m/html.c 17 Sep 2010 12:18:55 -0000
293 #define MAXA_INPUT MAXA_CORE + 12
294 +unsigned char ALST_BUTTON[] =
295 + { ATTR_TYPE, ATTR_VALUE, ATTR_NAME, ATTR_CORE };
296 +#define MAXA_BUTTON MAXA_CORE + 3
297 unsigned char ALST_TEXTAREA[] =
298 { ATTR_COLS, ATTR_ROWS, ATTR_NAME, ATTR_READONLY, ATTR_CORE };
299 #define MAXA_TEXTAREA MAXA_CORE + 4
300 @@ -247,24 +250,24 @@
301 {"/bdo", NULL, 0, TFLG_END}, /* 121 HTML_N_BDO */
302 {"big", ALST_NOP, MAXA_NOP, 0}, /* 122 HTML_BIG */
303 {"/big", NULL, 0, TFLG_END}, /* 123 HTML_N_BIG */
304 - {"button", ALST_NOP, MAXA_NOP, 0}, /* 124 HTML_BUTTON */
305 - {"fieldset", ALST_NOP, MAXA_NOP, 0}, /* 125 HTML_FIELDSET */
306 - {"/fieldset", NULL, 0, TFLG_END}, /* 126 HTML_N_FIELDSET */
307 - {"iframe", ALST_NOP, MAXA_NOP, 0}, /* 127 HTML_IFRAME */
308 - {"label", ALST_NOP, MAXA_NOP, 0}, /* 128 HTML_LABEL */
309 - {"/label", NULL, 0, TFLG_END}, /* 129 HTML_N_LABEL */
310 - {"legend", ALST_NOP, MAXA_NOP, 0}, /* 130 HTML_LEGEND */
311 - {"/legend", NULL, 0, TFLG_END}, /* 131 HTML_N_LEGEND */
312 - {"noscript", ALST_NOP, MAXA_NOP, 0}, /* 132 HTML_NOSCRIPT */
313 - {"/noscript", NULL, 0, TFLG_END}, /* 133 HTML_N_NOSCRIPT */
314 - {"object", ALST_NOP, MAXA_NOP, 0}, /* 134 HTML_OBJECT */
315 - {"optgroup", ALST_NOP, MAXA_NOP, 0}, /* 135 HTML_OPTGROUP */
316 - {"/optgroup", NULL, 0, TFLG_END}, /* 136 HTML_N_OPTGROUP */
317 - {"param", ALST_NOP, MAXA_NOP, 0}, /* 137 HTML_PARAM */
318 - {"small", ALST_NOP, MAXA_NOP, 0}, /* 138 HTML_SMALL */
319 - {"/small", NULL, 0, TFLG_END}, /* 139 HTML_N_SMALL */
320 + {"button", ALST_BUTTON, MAXA_BUTTON, 0}, /* 124 HTML_BUTTON */
321 + {"/button", NULL, 0, TFLG_END}, /* 125 HTML_N_BUTTON */
322 + {"fieldset", ALST_NOP, MAXA_NOP, 0}, /* 126 HTML_FIELDSET */
323 + {"/fieldset", NULL, 0, TFLG_END}, /* 127 HTML_N_FIELDSET */
324 + {"iframe", ALST_NOP, MAXA_NOP, 0}, /* 128 HTML_IFRAME */
325 + {"label", ALST_NOP, MAXA_NOP, 0}, /* 129 HTML_LABEL */
326 + {"/label", NULL, 0, TFLG_END}, /* 130 HTML_N_LABEL */
327 + {"legend", ALST_NOP, MAXA_NOP, 0}, /* 131 HTML_LEGEND */
328 + {"/legend", NULL, 0, TFLG_END}, /* 132 HTML_N_LEGEND */
329 + {"noscript", ALST_NOP, MAXA_NOP, 0}, /* 133 HTML_NOSCRIPT */
330 + {"/noscript", NULL, 0, TFLG_END}, /* 134 HTML_N_NOSCRIPT */
331 + {"object", ALST_NOP, MAXA_NOP, 0}, /* 135 HTML_OBJECT */
332 + {"optgroup", ALST_NOP, MAXA_NOP, 0}, /* 136 HTML_OPTGROUP */
333 + {"/optgroup", NULL, 0, TFLG_END}, /* 137 HTML_N_OPTGROUP */
334 + {"param", ALST_NOP, MAXA_NOP, 0}, /* 138 HTML_PARAM */
335 + {"small", ALST_NOP, MAXA_NOP, 0}, /* 139 HTML_SMALL */
336 + {"/small", NULL, 0, TFLG_END}, /* 140 HTML_N_SMALL */
338 - {NULL, NULL, 0, 0}, /* 140 Undefined */
339 {NULL, NULL, 0, 0}, /* 141 Undefined */
340 {NULL, NULL, 0, 0}, /* 142 Undefined */
341 {NULL, NULL, 0, 0}, /* 143 Undefined */
343 ===================================================================
344 RCS file: /cvsroot/w3m/w3m/html.h,v
345 retrieving revision 1.31
346 diff -u -r1.31 html.h
347 --- w3m.orig/html.h 14 Aug 2010 01:29:40 -0000 1.31
348 +++ w3m/html.h 17 Sep 2010 12:18:55 -0000
349 @@ -214,21 +214,22 @@
351 #define HTML_N_BIG 123
352 #define HTML_BUTTON 124
353 -#define HTML_FIELDSET 125
354 -#define HTML_N_FIELDSET 126
355 -#define HTML_IFRAME 127
356 -#define HTML_LABEL 128
357 -#define HTML_N_LABEL 129
358 -#define HTML_LEGEND 130
359 -#define HTML_N_LEGEND 131
360 -#define HTML_NOSCRIPT 132
361 -#define HTML_N_NOSCRIPT 133
362 -#define HTML_OBJECT 134
363 -#define HTML_OPTGROUP 135
364 -#define HTML_N_OPTGROUP 136
365 -#define HTML_PARAM 137
366 -#define HTML_SMALL 138
367 -#define HTML_N_SMALL 139
368 +#define HTML_N_BUTTON 125
369 +#define HTML_FIELDSET 126
370 +#define HTML_N_FIELDSET 127
371 +#define HTML_IFRAME 128
372 +#define HTML_LABEL 129
373 +#define HTML_N_LABEL 130
374 +#define HTML_LEGEND 131
375 +#define HTML_N_LEGEND 132
376 +#define HTML_NOSCRIPT 133
377 +#define HTML_N_NOSCRIPT 134
378 +#define HTML_OBJECT 135
379 +#define HTML_OPTGROUP 136
380 +#define HTML_N_OPTGROUP 137
381 +#define HTML_PARAM 138
382 +#define HTML_SMALL 139
383 +#define HTML_N_SMALL 140
386 #define HTML_SELECT_INT 160
388 ===================================================================
389 RCS file: /cvsroot/w3m/w3m/proto.h,v
390 retrieving revision 1.104
391 diff -u -r1.104 proto.h
392 --- w3m.orig/proto.h 25 Jul 2010 09:55:05 -0000 1.104
393 +++ w3m/proto.h 17 Sep 2010 12:18:55 -0000
395 extern Str process_img(struct parsed_tag *tag, int width);
396 extern Str process_anchor(struct parsed_tag *tag, char *tagbuf);
397 extern Str process_input(struct parsed_tag *tag);
398 +extern Str process_button(struct parsed_tag *tag);
399 +extern Str process_n_button(void);
400 extern Str process_select(struct parsed_tag *tag);
401 extern Str process_n_select(void);
402 extern void feed_select(char *str);
404 ===================================================================
405 RCS file: /cvsroot/w3m/w3m/table.c,v
406 retrieving revision 1.58
407 diff -u -r1.58 table.c
408 --- w3m.orig/table.c 9 Aug 2010 11:59:19 -0000 1.58
409 +++ w3m/table.c 17 Sep 2010 12:18:55 -0000
410 @@ -2878,6 +2878,14 @@
411 tmp = process_input(tag);
412 feed_table1(tbl, tmp, mode, width);
415 + tmp = process_button(tag);
416 + feed_table1(tbl, tmp, mode, width);
418 + case HTML_N_BUTTON:
419 + tmp = process_n_button();
420 + feed_table1(tbl, tmp, mode, width);
423 tmp = process_select(tag);
426 ===================================================================
427 RCS file: /cvsroot/w3m/w3m/tagtable.tab,v
428 retrieving revision 1.14
429 diff -u -r1.14 tagtable.tab
430 --- w3m.orig/tagtable.tab 14 Aug 2010 01:29:40 -0000 1.14
431 +++ w3m/tagtable.tab 17 Sep 2010 12:18:55 -0000
436 +/button HTML_N_BUTTON
437 fieldset HTML_FIELDSET
438 /fieldset HTML_N_FIELDSET