2 * Copyright (C) 2005-2011 Atsushi Konno All rights reserved.
3 * Copyright (C) 2005 QSDN,Inc. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 #include "chxj_iphone.h"
18 #include "chxj_hdml.h"
19 #include "chxj_dump.h"
20 #include "chxj_img_conv.h"
21 #include "chxj_qr_code.h"
22 #include "chxj_encoding.h"
23 #include "chxj_url_encode.h"
24 #include "chxj_str_util.h"
25 #include "chxj_header_inf.h"
26 #include "chxj_jreserved_tag.h"
27 #include "chxj_conv_z2h.h"
28 #include "chxj_google.h"
31 #define GET_IPHONE(X) ((iphone_t *)(X))
34 #define W_L(X) do { iphone->out = BUFFERED_WRITE_LITERAL(iphone->out, &doc->buf, (X)); } while(0)
35 #define W_V(X) do { iphone->out = (X) ? BUFFERED_WRITE_VALUE(iphone->out, &doc->buf, (X)) \
36 : BUFFERED_WRITE_LITERAL(iphone->out, &doc->buf, ""); } while(0)
38 #define W_NLCODE() do { char *nlcode = TO_NLCODE(iphone->conf); W_V(nlcode); } while (0)
40 #define BLINK_KEYFRAME \
41 "@-webkit-keyframes blink {" \
51 "-webkit-animation-name: blink;" \
52 "-webkit-animation-duration: 0.6s;" \
53 "-webkit-animation-iteration-count:infinite;" \
54 "-webkit-animation-timing-function:ease-in-out;" \
55 "-webkit-animation-direction: alternate;" \
56 "-webkit-animation-delay: 0s;"
60 static char *s_iphone_start_html_tag (void *pdoc, Node *node);
61 static char *s_iphone_end_html_tag (void *pdoc, Node *node);
62 static char *s_iphone_start_meta_tag (void *pdoc, Node *node);
63 static char *s_iphone_end_meta_tag (void *pdoc, Node *node);
64 static char *s_iphone_start_head_tag (void *pdoc, Node *node);
65 static char *s_iphone_end_head_tag (void *pdoc, Node *node);
66 static char *s_iphone_start_title_tag (void *pdoc, Node *node);
67 static char *s_iphone_end_title_tag (void *pdoc, Node *node);
68 static char *s_iphone_start_base_tag (void *pdoc, Node *node);
69 static char *s_iphone_end_base_tag (void *pdoc, Node *node);
70 static char *s_iphone_start_body_tag (void *pdoc, Node *node);
71 static char *s_iphone_end_body_tag (void *pdoc, Node *node);
72 static char *s_iphone_start_a_tag (void *pdoc, Node *node);
73 static char *s_iphone_end_a_tag (void *pdoc, Node *node);
74 static char *s_iphone_start_pre_tag (void *pdoc, Node *node);
75 static char *s_iphone_end_pre_tag (void *pdoc, Node *node);
76 static char *s_iphone_start_p_tag (void *pdoc, Node *node);
77 static char *s_iphone_end_p_tag (void *pdoc, Node *node);
78 static char *s_iphone_start_ul_tag (void *pdoc, Node *node);
79 static char *s_iphone_end_ul_tag (void *pdoc, Node *node);
80 static char *s_iphone_start_ol_tag (void *pdoc, Node *node);
81 static char *s_iphone_end_ol_tag (void *pdoc, Node *node);
82 static char *s_iphone_start_li_tag (void *pdoc, Node *node);
83 static char *s_iphone_end_li_tag (void *pdoc, Node *node);
84 static char *s_iphone_start_br_tag (void *pdoc, Node *node);
85 static char *s_iphone_end_br_tag (void *pdoc, Node *node);
87 static char *s_iphone_start_table_tag (void *pdoc, Node *node);
88 static char *s_iphone_end_table_tag (void *pdoc, Node *node);
89 static char *s_iphone_start_tr_tag (void *pdoc, Node *node);
90 static char *s_iphone_end_tr_tag (void *pdoc, Node *node);
91 static char *s_iphone_start_td_or_th_tag (void *pdoc, Node *node,char *tagName);
92 static char *s_iphone_end_td_or_th_tag (void *pdoc, Node *node,char *tagName);
93 static char *s_iphone_start_td_tag (void *pdoc, Node *node);
94 static char *s_iphone_end_td_tag (void *pdoc, Node *node);
95 static char *s_iphone_start_th_tag (void *pdoc, Node *node);
96 static char *s_iphone_end_th_tag (void *pdoc, Node *node);
98 static char *s_iphone_start_font_tag (void *pdoc, Node *node);
99 static char *s_iphone_end_font_tag (void *pdoc, Node *node);
100 static char *s_iphone_start_form_tag (void *pdoc, Node *node);
101 static char *s_iphone_end_form_tag (void *pdoc, Node *node);
102 static char *s_iphone_start_input_tag (void *pdoc, Node *node);
103 static char *s_iphone_end_input_tag (void *pdoc, Node *node);
104 static char *s_iphone_start_center_tag (void *pdoc, Node *node);
105 static char *s_iphone_end_center_tag (void *pdoc, Node *node);
106 static char *s_iphone_start_hr_tag (void *pdoc, Node *node);
107 static char *s_iphone_end_hr_tag (void *pdoc, Node *node);
108 static char *s_iphone_start_img_tag (void *pdoc, Node *node);
109 static char *s_iphone_end_img_tag (void *pdoc, Node *node);
110 static char *s_iphone_start_select_tag (void *pdoc, Node *node);
111 static char *s_iphone_end_select_tag (void *pdoc, Node *node);
112 static char *s_iphone_start_option_tag (void *pdoc, Node *node);
113 static char *s_iphone_end_option_tag (void *pdoc, Node *node);
114 static char *s_iphone_start_div_tag (void *pdoc, Node *node);
115 static char *s_iphone_end_div_tag (void *pdoc, Node *node);
116 static char *s_iphone_start_textarea_tag (void *pdoc, Node *node);
117 static char *s_iphone_end_textarea_tag (void *pdoc, Node *node);
118 static char *s_iphone_start_b_tag (void *pdoc, Node *node);
119 static char *s_iphone_end_b_tag (void *pdoc, Node *node);
120 static char *s_iphone_chxjif_tag (void *pdoc, Node *node);
121 static char *s_iphone_text_tag (void *pdoc, Node *node);
122 static char *s_iphone_start_blockquote_tag (void *pdoc, Node *node);
123 static char *s_iphone_end_blockquote_tag (void *pdoc, Node *node);
124 static char *s_iphone_start_dir_tag (void *pdoc, Node *node);
125 static char *s_iphone_end_dir_tag (void *pdoc, Node *node);
126 static char *s_iphone_start_dl_tag (void *pdoc, Node *node);
127 static char *s_iphone_end_dl_tag (void *pdoc, Node *node);
128 static char *s_iphone_start_dt_tag (void *pdoc, Node *node);
129 static char *s_iphone_end_dt_tag (void *pdoc, Node *node);
130 static char *s_iphone_start_dd_tag (void *pdoc, Node *node);
131 static char *s_iphone_end_dd_tag (void *pdoc, Node *node);
132 static char *s_iphone_start_h1_tag (void *pdoc, Node *node);
133 static char *s_iphone_end_h1_tag (void *pdoc, Node *node);
134 static char *s_iphone_start_h2_tag (void *pdoc, Node *node);
135 static char *s_iphone_end_h2_tag (void *pdoc, Node *node);
136 static char *s_iphone_start_h3_tag (void *pdoc, Node *node);
137 static char *s_iphone_end_h3_tag (void *pdoc, Node *node);
138 static char *s_iphone_start_h4_tag (void *pdoc, Node *node);
139 static char *s_iphone_end_h4_tag (void *pdoc, Node *node);
140 static char *s_iphone_start_h5_tag (void *pdoc, Node *node);
141 static char *s_iphone_end_h5_tag (void *pdoc, Node *node);
142 static char *s_iphone_start_h6_tag (void *pdoc, Node *node);
143 static char *s_iphone_end_h6_tag (void *pdoc, Node *node);
144 static char *s_iphone_start_menu_tag (void *pdoc, Node *node);
145 static char *s_iphone_end_menu_tag (void *pdoc, Node *node);
146 static char *s_iphone_start_plaintext_tag (void *pdoc, Node *node);
147 static char *s_iphone_start_plaintext_tag_inner (void *pdoc, Node *node);
148 static char *s_iphone_end_plaintext_tag (void *pdoc, Node *node);
149 static char *s_iphone_start_blink_tag (void *pdoc, Node *node);
150 static char *s_iphone_end_blink_tag (void *pdoc, Node *node);
151 static char *s_iphone_start_marquee_tag (void *pdoc, Node *node);
152 static char *s_iphone_end_marquee_tag (void *pdoc, Node *node);
153 static char *s_iphone_newline_mark (void *pdoc, Node *node);
154 static char *s_iphone_link_tag (void *pdoc, Node *node);
155 static char *s_iphone_start_span_tag (void *pdoc, Node *node);
156 static char *s_iphone_end_span_tag (void *pdoc, Node *node);
157 static char *s_iphone_style_tag (void *pdoc, Node *node);
158 static char *s_iphone_start_object_tag (void *pdoc, Node *node);
159 static char *s_iphone_end_object_tag (void *pdoc, Node *node);
160 static char *s_iphone_start_param_tag (void *pdoc, Node *node);
161 static char *s_iphone_start_caption_tag (void *pdoc, Node *node);
162 static char *s_iphone_end_caption_tag (void *pdoc, Node *node);
164 static void s_init_iphone(iphone_t *iphone, Doc *doc, request_rec *r, device_table *spec);
166 static int s_iphone_search_emoji(iphone_t *iphone, char *txt, char **rslt);
168 static css_prop_list_t *s_iphone_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
169 static css_prop_list_t *s_iphone_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
170 static char *s_iphone_create_style_data(apr_pool_t *pool, const char *style_data);
174 tag_handler iphone_handler[] = {
177 s_iphone_start_html_tag,
178 s_iphone_end_html_tag,
182 s_iphone_start_meta_tag,
183 s_iphone_end_meta_tag,
187 s_iphone_start_textarea_tag,
188 s_iphone_end_textarea_tag,
192 s_iphone_start_p_tag,
197 s_iphone_start_pre_tag,
198 s_iphone_end_pre_tag,
202 s_iphone_start_ul_tag,
207 s_iphone_start_li_tag,
212 s_iphone_start_ol_tag,
217 s_iphone_start_h1_tag,
222 s_iphone_start_h2_tag,
227 s_iphone_start_h3_tag,
232 s_iphone_start_h4_tag,
237 s_iphone_start_h5_tag,
242 s_iphone_start_h6_tag,
247 s_iphone_start_head_tag,
248 s_iphone_end_head_tag,
252 s_iphone_start_title_tag,
253 s_iphone_end_title_tag,
257 s_iphone_start_base_tag,
258 s_iphone_end_base_tag,
262 s_iphone_start_body_tag,
263 s_iphone_end_body_tag,
267 s_iphone_start_a_tag,
272 s_iphone_start_br_tag,
277 s_iphone_start_table_tag,
278 s_iphone_end_table_tag,
282 s_iphone_start_tr_tag,
287 s_iphone_start_td_tag,
297 s_iphone_start_font_tag,
298 s_iphone_end_font_tag,
302 s_iphone_start_form_tag,
303 s_iphone_end_form_tag,
307 s_iphone_start_input_tag,
308 s_iphone_end_input_tag,
312 s_iphone_start_center_tag,
313 s_iphone_end_center_tag,
317 s_iphone_start_hr_tag,
322 s_iphone_start_img_tag,
323 s_iphone_end_img_tag,
327 s_iphone_start_select_tag,
328 s_iphone_end_select_tag,
332 s_iphone_start_option_tag,
333 s_iphone_end_option_tag,
337 s_iphone_start_div_tag,
338 s_iphone_end_div_tag,
367 s_iphone_start_span_tag,
368 s_iphone_end_span_tag,
377 s_iphone_start_th_tag,
382 s_iphone_start_b_tag,
392 s_iphone_start_dt_tag,
407 s_iphone_start_blockquote_tag,
408 s_iphone_end_blockquote_tag,
412 s_iphone_start_dir_tag,
413 s_iphone_end_dir_tag,
417 s_iphone_start_dl_tag,
422 s_iphone_start_dd_tag,
427 s_iphone_start_menu_tag,
428 s_iphone_end_menu_tag,
432 s_iphone_start_plaintext_tag,
433 s_iphone_end_plaintext_tag,
437 s_iphone_start_blink_tag,
438 s_iphone_end_blink_tag,
442 s_iphone_start_marquee_tag,
443 s_iphone_end_marquee_tag,
452 s_iphone_newline_mark,
457 s_iphone_start_object_tag,
458 s_iphone_end_object_tag,
462 s_iphone_start_param_tag,
467 s_iphone_start_caption_tag,
468 s_iphone_end_caption_tag,
474 * converts from CHTML5.0 to IPHONE.
476 * @param r [i] Requet_rec is appointed.
477 * @param spec [i] The result of the device specification processing which
478 * was done in advance is appointed.
479 * @param src [i] The character string before the converting is appointed.
480 * @return The character string after the converting is returned.
489 chxjconvrule_entry *entryp,
500 /*--------------------------------------------------------------------------*/
502 /*--------------------------------------------------------------------------*/
504 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
506 DBG(r,"REQ[%X] I found qrcode xml",TO_ADDR(r));
510 /*--------------------------------------------------------------------------*/
511 /* The CHTML structure is initialized. */
512 /*--------------------------------------------------------------------------*/
513 s_init_iphone(&iphone, &doc, r, spec);
515 iphone.entryp = entryp;
516 iphone.cookie = cookie;
517 iphone.head_tag_out = 0;
518 if (strcasecmp(spec->output_encoding,"UTF-8") == 0 ){
519 apr_table_setn(r->headers_out,HTTP_X_CHXJ_SET_CONTENT_TYPE,"application/xhtml+xml; charset=UTF-8");
521 chxj_set_content_type(r, chxj_header_inf_set_content_type(r, "application/xhtml+xml; charset=Windows-31J"));
523 /*--------------------------------------------------------------------------*/
524 /* The character string of the input is analyzed. */
525 /*--------------------------------------------------------------------------*/
526 qs_init_malloc(&doc);
527 qs_init_root_node(&doc);
529 ss = apr_pcalloc(r->pool, srclen + 1);
531 memset(ss, 0, srclen + 1);
532 memcpy(ss, src, srclen);
534 if (IS_CSS_ON(iphone.entryp)) {
535 /* current property list */
536 iphone.css_prop_stack = chxj_new_prop_list_stack(&doc);
539 chxj_dump_out("[src] CHTML -> IPHONE", ss, srclen);
542 qs_parse_string(&doc,ss,strlen(ss));
544 chxj_buffered_write_init(r->pool, &doc.buf);
545 /*--------------------------------------------------------------------------*/
546 /* It converts it from CHTML to IPHONE. */
547 /*--------------------------------------------------------------------------*/
548 chxj_node_convert(spec,r,(void*)&iphone, &doc, qs_get_root(&doc), 0);
549 iphone.out = chxj_buffered_write_flush(iphone.out, &doc.buf);
550 dst = apr_pstrcat(r->pool, (! iphone.prev_style_data) ? "" : iphone.prev_style_data,
551 s_iphone_create_style_data(doc.pool, iphone.style_data),
553 chxj_buffered_write_terminate(&doc.buf);
556 qs_all_free(&doc,QX_LOGMARK);
559 return apr_pstrdup(r->pool,ss);
562 dst = apr_psprintf(r->pool, "\n");
564 *dstlen = strlen(dst);
567 chxj_dump_out("[dst] CHTML -> IPHONE", dst, *dstlen);
575 * The IPHONE structure is initialized.
577 * @param iphone [i/o] The pointer to the IPHONE structure that wants to be
578 * initialized is specified.
579 * @param doc [i] The Doc structure that should be set to the initialized
580 * IPHONE structure is specified.
581 * @param r [i] To use POOL, the pointer to request_rec is specified.
582 * @param spec [i] The pointer to the device_table
585 s_init_iphone(iphone_t *iphone, Doc *doc, request_rec *r, device_table *spec)
587 memset(doc, 0, sizeof(Doc));
588 memset(iphone, 0, sizeof(iphone_t));
593 iphone->out = qs_alloc_zero_byte_string(r->pool);
594 iphone->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
595 iphone->doc->parse_mode = PARSE_MODE_CHTML;
596 iphone->prev_style_data = NULL;
597 iphone->style_data = NULL;
598 iphone->blink_keyframe_out = 0;
603 * Corresponding EMOJI to a current character-code is retrieved.
604 * The substitution character string is stored in the rslt pointer if agreeing.
606 * @param iphone [i] The pointer to the IPHONE structure is specified.
607 * @param txt [i] The character string to want to examine whether it is
608 * EMOJI is specified.
609 * @param rslt [o] The pointer to the pointer that stores the result is
611 * @return When corresponding EMOJI exists, it returns it excluding 0.
614 s_iphone_search_emoji(iphone_t *iphone, char *txt, char **rslt)
626 if (! spec) DBG(r,"REQ[%X] spec is NULL",TO_ADDR(r));
628 for (ee = iphone->conf->emoji;
632 unsigned char hex1byte;
633 unsigned char hex2byte;
636 DBG(r,"REQ[%X] emoji->imode is NULL",TO_ADDR(r));
640 hex1byte = ee->imode->hex1byte & 0xff;
641 hex2byte = ee->imode->hex2byte & 0xff;
643 if (ee->imode->string
644 && strlen(ee->imode->string) > 0
645 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
646 if (spec == NULL || spec->emoji_type == NULL) {
647 if (ee->iphone != NULL && ee->iphone->string != NULL) {
648 if (iphone->conf->use_emoji_image
649 && iphone->conf->emoji_image_url
650 && (spec->html_spec_type == CHXJ_SPEC_iPhone2
651 || strcasecmp(ee->iphone->string,"image") == 0)) {
652 *rslt = apr_psprintf(r->pool, "<img src=\"%s/%d\" />",iphone->conf->emoji_image_url, ee->no);
654 else if (strncasecmp(ee->iphone->string, "raw:", 4) == 0) {
655 *rslt = apr_psprintf(r->pool,"%s", &(ee->iphone->string[4]));
658 *rslt = apr_psprintf(r->pool,"%s;", ee->iphone->string);
661 return strlen(ee->imode->string);
667 && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
668 && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
669 if (spec == NULL || spec->emoji_type == NULL) {
670 if (ee->iphone != NULL && ee->iphone->string != NULL) {
671 if (iphone->conf->use_emoji_image
672 && iphone->conf->emoji_image_url
673 && (spec->html_spec_type == CHXJ_SPEC_iPhone2
674 || strcasecmp(ee->iphone->string,"image") == 0)) {
675 *rslt = apr_psprintf(r->pool, "<img src=\"%s/%d\" />",iphone->conf->emoji_image_url, ee->no);
677 else if (strncasecmp(ee->iphone->string, "raw:", 4) == 0) {
678 *rslt = apr_psprintf(r->pool,"%s", &(ee->iphone->string[4]));
681 *rslt = apr_psprintf(r->pool,"%s;", ee->iphone->string);
696 chxj_iphone_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
710 DBG(r,"REQ[%X] start %s()",TO_ADDR(r),__func__);
711 memset(doc, 0, sizeof(Doc));
712 memset(iphone, 0, sizeof(iphone_t));
717 iphone->out = qs_alloc_zero_byte_string(r->pool);
718 iphone->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
719 iphone->doc->parse_mode = PARSE_MODE_CHTML;
721 apr_pool_create(&pool, r->pool);
723 chxj_buffered_write_init(pool, &doc->buf);
725 for (ii=0; ii<len; ii++) {
729 rtn = s_iphone_search_emoji(iphone, (char *)&src[ii], &out);
736 if (is_sjis_kanji(src[ii])) {
737 two_byte[0] = src[ii+0];
738 two_byte[1] = src[ii+1];
744 one_byte[0] = src[ii+0];
749 iphone->out = chxj_buffered_write_flush(iphone->out, &doc->buf);
751 DBG(r,"REQ[%X] end %s()",TO_ADDR(r),__func__);
757 * It is a handler who processes the HTML tag.
759 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
760 * destination is specified.
761 * @param node [i] The HTML tag node is specified.
762 * @return The conversion result is returned.
765 s_iphone_start_html_tag(void *pdoc, Node *UNUSED(node))
772 iphone = GET_IPHONE(pdoc);
775 DBG(r,"REQ[%X] start %s()",TO_ADDR(r),__func__);
777 W_L("<?xml version=\"1.0\" encoding=\"");
778 W_V(iphone->spec->output_encoding);
781 W_L("<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.1//EN\" \"http://www.openmobilealliance.org/tech/DTD/xhtml-mobile11.dtd\">");
785 /*--------------------------------------------------------------------------*/
787 /*--------------------------------------------------------------------------*/
788 W_L("<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"ja\" xml:lang=\"ja\">");
790 iphone->start_html_flag = 1;
792 DBG(r,"REQ[%X] end %s()",TO_ADDR(r),__func__);
799 * It is a handler who processes the HTML tag.
801 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
802 * destination is specified.
803 * @param node [i] The HTML tag node is specified.
804 * @return The conversion result is returned.
807 s_iphone_end_html_tag(void *pdoc, Node *UNUSED(child))
809 iphone_t *iphone = GET_IPHONE(pdoc);
810 Doc *doc = iphone->doc;
819 * It is a handler who processes the META tag.
821 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
822 * destination is specified.
823 * @param node [i] The META tag node is specified.
824 * @return The conversion result is returned.
827 s_iphone_start_meta_tag(void *pdoc, Node *node)
833 int content_type_flag;
836 iphone = GET_IPHONE(pdoc);
840 content_type_flag = 0;
843 /*--------------------------------------------------------------------------*/
845 /*--------------------------------------------------------------------------*/
846 for (attr = qs_get_attr(doc,node);
848 attr = qs_get_next_attr(doc,attr)) {
849 char *name = qs_get_attr_name(doc,attr);
850 char *value = qs_get_attr_value(doc,attr);
854 if (strcasecmp(name, "http-equiv") == 0 && value && *value) {
855 /*----------------------------------------------------------------------*/
857 /*----------------------------------------------------------------------*/
858 W_L(" http-equiv=\"");
861 if (STRCASEEQ('c','C',"content-type",value)) {
862 content_type_flag = 1;
864 if (STRCASEEQ('r','R',"refresh",value)) {
872 if (strcasecmp(name, "content") == 0 && value && *value) {
873 /*----------------------------------------------------------------------*/
875 /*----------------------------------------------------------------------*/
876 if (content_type_flag) {
880 W_V(chxj_header_inf_set_content_type(r, "application/xhtml+xml; charset=SHIFT_JIS"));
889 buf = apr_pstrdup(r->pool, value);
891 url = strchr(buf, ';');
893 sec = apr_pstrdup(r->pool, buf);
896 url = chxj_encoding_parameter(r, url, 1);
917 if (strcasecmp(name, "name") == 0 && value && *value) {
933 * It is a handler who processes the META tag.
935 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
936 * destination is specified.
937 * @param node [i] The META tag node is specified.
938 * @return The conversion result is returned.
941 s_iphone_end_meta_tag(void *pdoc, Node *UNUSED(child))
943 iphone_t *iphone = GET_IPHONE(pdoc);
950 * It is a handler who processes the HEAD tag.
952 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
953 * destination is specified.
954 * @param node [i] The HEAD tag node is specified.
955 * @return The conversion result is returned.
958 s_iphone_start_head_tag(void *pdoc, Node *node)
966 iphone = GET_IPHONE(pdoc);
969 iphone->head_tag_out = 1;
973 /* search <meta name="viewport"> */
974 int found_viewport = 0;
975 for (child = qs_get_child_node(doc,node);
977 child = qs_get_next_node(doc,child)) {
978 char *name = qs_get_node_name(doc,child);
982 if (strcasecmp("meta",name) == 0) {
983 for (attr = qs_get_attr(doc,child);
985 attr = qs_get_next_attr(doc,attr)) {
986 char *aname = qs_get_attr_name(doc,attr);
987 char *avalue = qs_get_attr_value(doc,attr);
988 if (STRCASEEQ('n','N',"name",aname)) {
989 if (STRCASEEQ('v','V',"viewport",avalue)) {
991 DBG(r, "REQ[%X] viewport Found!!",TO_ADDR(r));
1002 if (found_viewport) {
1007 if (!found_viewport) {
1009 W_L("name=\"viewport\" ");
1010 W_L("id=\"iphone-viewport\" ");
1011 W_L("content=\"width=");
1012 char *ww = apr_psprintf(r->pool, "%d", (int)((double)iphone->spec->width * (double)1.5));
1014 W_L(",user-scalable=no,maximum-scale=0.6667\" />");
1015 W_L("<meta name=\"format-detection\" content=\"telephone=no\" />");
1022 * It is a handler who processes the HEAD tag.
1024 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
1025 * destination is specified.
1026 * @param node [i] The HEAD tag node is specified.
1027 * @return The conversion result is returned.
1030 s_iphone_end_head_tag(void *pdoc, Node *UNUSED(child))
1036 iphone = GET_IPHONE(pdoc);
1043 W_L(BLINK_KEYFRAME);
1047 iphone->out = chxj_buffered_write_flush(iphone->out, &doc->buf);
1048 iphone->prev_style_data = apr_pstrdup(doc->pool, iphone->out);
1049 iphone->out = qs_alloc_zero_byte_string(r->pool);
1057 * It is a handler who processes the TITLE tag.
1059 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
1060 * destination is specified.
1061 * @param node [i] The TITLE tag node is specified.
1062 * @return The conversion result is returned.
1065 s_iphone_start_title_tag(void *pdoc, Node *node)
1071 iphone = GET_IPHONE(pdoc);
1076 if (iphone->conf->use_google_analytics) {
1077 iphone->pagetitle = "";
1079 for (child = qs_get_child_node(doc,node);
1081 child = qs_get_next_node(doc,child)) {
1082 char *textval = qs_get_node_value(doc,child);
1083 iphone->pagetitle = apr_pstrcat(doc->r->pool, iphone->pagetitle, textval, NULL);
1091 * It is a handler who processes the TITLE tag.
1093 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
1094 * destination is specified.
1095 * @param node [i] The TITLE tag node is specified.
1096 * @return The conversion result is returned.
1099 s_iphone_end_title_tag(void *pdoc, Node *UNUSED(child))
1105 iphone = GET_IPHONE(pdoc);
1115 * It is a handler who processes the BASE tag.
1117 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
1118 * destination is specified.
1119 * @param node [i] The BASE tag node is specified.
1120 * @return The conversion result is returned.
1123 s_iphone_start_base_tag(void *pdoc, Node *node)
1130 iphone = GET_IPHONE(pdoc);
1135 /*--------------------------------------------------------------------------*/
1136 /* Get Attributes */
1137 /*--------------------------------------------------------------------------*/
1138 for (attr = qs_get_attr(doc,node);
1140 attr = qs_get_next_attr(doc,attr)) {
1141 char *name = qs_get_attr_name(doc,attr);
1142 char *value = qs_get_attr_value(doc,attr);
1143 if (STRCASEEQ('h','H',"href",name)) {
1155 * It is a handler who processes the BASE tag.
1157 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
1158 * destination is specified.
1159 * @param node [i] The BASE tag node is specified.
1160 * @return The conversion result is returned.
1163 s_iphone_end_base_tag(void *pdoc, Node *UNUSED(child))
1165 iphone_t *iphone = GET_IPHONE(pdoc);
1171 * It is a handler who processes the BODY tag.
1173 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
1174 * destination is specified.
1175 * @param node [i] The BODY tag node is specified.
1176 * @return The conversion result is returned.
1179 s_iphone_start_body_tag(void *pdoc, Node *node)
1185 char *attr_bgcolor = NULL;
1186 char *attr_text = NULL;
1187 char *attr_link = NULL;
1188 char *attr_vlink = NULL;
1189 char *attr_alink = NULL;
1190 char *attr_style = NULL;
1191 char *attr_background = NULL;
1192 char *style_data = NULL;
1194 iphone = GET_IPHONE(pdoc);
1199 /*--------------------------------------------------------------------------*/
1200 /* Get Attributes */
1201 /*--------------------------------------------------------------------------*/
1202 for (attr = qs_get_attr(doc,node);
1204 attr = qs_get_next_attr(doc,attr)) {
1205 char *name = qs_get_attr_name(doc,attr);
1206 char *value = qs_get_attr_value(doc,attr);
1207 if (STRCASEEQ('b','B',"bgcolor",name) && value && *value) {
1208 /*----------------------------------------------------------------------*/
1210 /*----------------------------------------------------------------------*/
1211 attr_bgcolor = value;
1213 else if (STRCASEEQ('t','T',"text",name) && value && *value) {
1214 /*----------------------------------------------------------------------*/
1216 /*----------------------------------------------------------------------*/
1219 else if (STRCASEEQ('l','L',"link",name) && value && *value) {
1220 /*----------------------------------------------------------------------*/
1222 /*----------------------------------------------------------------------*/
1225 else if (STRCASEEQ('a','A',"alink",name)) {
1226 /*----------------------------------------------------------------------*/
1228 /*----------------------------------------------------------------------*/
1231 else if (STRCASEEQ('v','V',"vlink",name)) {
1232 /*----------------------------------------------------------------------*/
1234 /*----------------------------------------------------------------------*/
1237 else if (STRCASEEQ('b','B',"background",name) && value && *value) {
1238 /*----------------------------------------------------------------------*/
1240 /*----------------------------------------------------------------------*/
1241 attr_background = value;
1243 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1248 if (IS_CSS_ON(iphone->entryp)) {
1249 css_prop_list_t *style = s_iphone_nopush_and_get_now_style(pdoc, node, attr_style);
1251 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1252 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1253 css_property_t *bgimage_prop = chxj_css_get_property_value(doc, style, "background-image");
1254 css_property_t *cur;
1255 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1256 if (cur->value && *cur->value) {
1257 attr_text = apr_pstrdup(doc->pool, cur->value);
1260 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1261 if (cur->value && *cur->value) {
1262 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1265 for (cur = bgimage_prop->next; cur != bgimage_prop; cur = cur->next) {
1266 if (cur->value && *cur->value) {
1267 char *tmp = apr_pstrdup(doc->pool, cur->value);
1268 char *tmps = strstr(tmp,"(");
1270 char *tmpe = strstr(tmp,")");
1271 size_t len = strlen(tmps) - strlen(tmpe) -1 ;
1273 attr_background = apr_pstrndup(doc->pool, tmps,len);
1278 if (iphone->style) {
1279 css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, iphone->style);
1280 css_selector_t *cur_sel;
1281 for (cur_sel = pseudos->selector_head.next; cur_sel != &pseudos->selector_head; cur_sel = cur_sel->next) {
1282 if (cur_sel->name && strcasecmp(cur_sel->name, "a:link") == 0) {
1283 css_property_t *cur;
1284 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1285 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1286 attr_link = apr_pstrdup(doc->pool, cur->value);
1290 else if (cur_sel->name && strcasecmp(cur_sel->name, "a:visited") == 0) {
1291 css_property_t *cur;
1292 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1293 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1294 attr_vlink = apr_pstrdup(doc->pool, cur->value);
1304 if (attr_bgcolor || attr_text) {
1307 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1308 W_L("background-color:");
1313 attr_text = chxj_css_rgb_func_to_value(doc->pool, attr_text);
1321 attr_link = chxj_css_rgb_func_to_value(doc->pool, attr_link);
1327 attr_vlink = chxj_css_rgb_func_to_value(doc->pool, attr_vlink);
1333 attr_alink = chxj_css_rgb_func_to_value(doc->pool, attr_alink);
1334 style_data = apr_pstrcat(doc->pool, (style_data) ? style_data : "",
1335 apr_psprintf(doc->pool, "a:focus { color:%s; }", attr_alink), NULL);
1337 if (attr_background) {
1338 W_L(" background=\"");
1339 W_V(attr_background);
1343 iphone->style_data = apr_pstrcat(doc->pool, (iphone->style_data) ? iphone->style_data : "",
1353 * It is a handler who processes the BODY tag.
1355 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
1356 * destination is specified.
1357 * @param node [i] The BODY tag node is specified.
1358 * @return The conversion result is returned.
1361 s_iphone_end_body_tag(void *pdoc, Node *UNUSED(child))
1367 iphone = GET_IPHONE(pdoc);
1371 if (iphone->conf->use_google_analytics) {
1372 char *src = chxj_google_analytics_get_image_url(r, iphone->pagetitle);
1378 W_L("</div></body>");
1379 if (IS_CSS_ON(iphone->entryp)) {
1380 chxj_css_pop_prop_list(iphone->css_prop_stack);
1387 * It is a handler who processes the A tag.
1389 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
1390 * destination is specified.
1391 * @param node [i] The A tag node is specified.
1392 * @return The conversion result is returned.
1395 s_iphone_start_a_tag(void *pdoc, Node *node)
1401 char *attr_style = NULL;
1402 char *attr_id = NULL;
1403 char *attr_name = NULL;
1405 iphone = GET_IPHONE(pdoc);
1410 /*--------------------------------------------------------------------------*/
1411 /* Get Attributes */
1412 /*--------------------------------------------------------------------------*/
1413 for (attr = qs_get_attr(doc,node);
1415 attr = qs_get_next_attr(doc,attr)) {
1416 char *name = qs_get_attr_name(doc,attr);
1417 char *value = qs_get_attr_value(doc,attr);
1418 if (STRCASEEQ('i','I',"id",name)){
1419 attr_id = chxj_jreserved_to_safe_tag(r, value, iphone->entryp);
1421 else if (STRCASEEQ('n','N',"name",name)) {
1422 attr_name = chxj_jreserved_to_safe_tag(r, value, iphone->entryp);
1424 else if (STRCASEEQ('h','H',"href",name)) {
1425 /*----------------------------------------------------------------------*/
1427 /*----------------------------------------------------------------------*/
1428 value = chxj_encoding_parameter(r, value, 1);
1429 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1430 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, iphone->entryp, 1);
1436 else if (STRCASEEQ('a','A',"accesskey",name)) {
1437 /*----------------------------------------------------------------------*/
1439 /*----------------------------------------------------------------------*/
1442 else if (STRCASEEQ('c','C',"cti",name)) {
1443 /*----------------------------------------------------------------------*/
1445 /*----------------------------------------------------------------------*/
1448 else if (STRCASEEQ('i','I',"ijam",name)) {
1449 /*----------------------------------------------------------------------*/
1451 /*----------------------------------------------------------------------*/
1454 else if (STRCASEEQ('u','U',"utn",name)) {
1455 /*----------------------------------------------------------------------*/
1457 /* It is special only for CHTML. */
1458 /*----------------------------------------------------------------------*/
1461 else if (STRCASEEQ('t','T',"telbook",name)) {
1462 /*----------------------------------------------------------------------*/
1464 /*----------------------------------------------------------------------*/
1467 else if (STRCASEEQ('k','K',"kana",name)) {
1468 /*----------------------------------------------------------------------*/
1470 /*----------------------------------------------------------------------*/
1473 else if (STRCASEEQ('e','E',"email",name)) {
1474 /*----------------------------------------------------------------------*/
1476 /*----------------------------------------------------------------------*/
1479 else if (STRCASEEQ('i','I',"ista",name)) {
1480 /*----------------------------------------------------------------------*/
1482 /*----------------------------------------------------------------------*/
1485 else if (STRCASEEQ('i','I',"ilet",name)) {
1486 /*----------------------------------------------------------------------*/
1488 /*----------------------------------------------------------------------*/
1491 else if (STRCASEEQ('i','I',"iswf",name)) {
1492 /*----------------------------------------------------------------------*/
1494 /*----------------------------------------------------------------------*/
1497 else if (STRCASEEQ('i','I',"irst",name)) {
1498 /*----------------------------------------------------------------------*/
1500 /*----------------------------------------------------------------------*/
1503 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1504 /*----------------------------------------------------------------------*/
1506 /*----------------------------------------------------------------------*/
1522 if (IS_CSS_ON(iphone->entryp)) {
1523 s_iphone_nopush_and_get_now_style(pdoc, node, attr_style);
1531 * It is a handler who processes the A tag.
1533 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
1534 * destination is specified.
1535 * @param node [i] The A tag node is specified.
1536 * @return The conversion result is returned.
1539 s_iphone_end_a_tag(void *pdoc, Node *UNUSED(child))
1545 iphone = GET_IPHONE(pdoc);
1551 if (IS_CSS_ON(iphone->entryp)) {
1552 chxj_css_pop_prop_list(iphone->css_prop_stack);
1560 * It is a handler who processes the BR tag.
1562 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
1563 * destination is specified.
1564 * @param node [i] The BR tag node is specified.
1565 * @return The conversion result is returned.
1568 s_iphone_start_br_tag(void *pdoc, Node *node)
1575 iphone = GET_IPHONE(pdoc);
1579 char *attr_style = NULL;
1580 char *attr_clear = NULL;
1582 /*--------------------------------------------------------------------------*/
1583 /* Get Attributes */
1584 /*--------------------------------------------------------------------------*/
1585 for (attr = qs_get_attr(doc,node);
1587 attr = qs_get_next_attr(doc,attr)) {
1588 char *name = qs_get_attr_name(doc,attr);
1589 char *value = qs_get_attr_value(doc,attr);
1590 if (STRCASEEQ('c','C',"clear",name)) {
1591 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1595 else if (STRCASEEQ('s','S',"style",name)) {
1596 attr_style = apr_pstrdup(doc->buf.pool, value);
1599 if (IS_CSS_ON(iphone->entryp)) {
1600 css_prop_list_t *style = s_iphone_nopush_and_get_now_style(pdoc, node, attr_style);
1602 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
1603 css_property_t *cur;
1604 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
1605 if (cur->value && *cur->value) {
1606 if ( STRCASEEQ('l','L',"left", cur->value)
1607 || STRCASEEQ('r','R',"right", cur->value)) {
1608 attr_clear = apr_pstrdup(doc->pool, cur->value);
1610 else if(STRCASEEQ('b','B',"both" ,cur->value)) {
1611 attr_clear = apr_pstrdup(doc->pool, "all");
1629 * It is a handler who processes the BR tag.
1631 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
1632 * destination is specified.
1633 * @param node [i] The BR tag node is specified.
1634 * @return The conversion result is returned.
1637 s_iphone_end_br_tag(void *pdoc, Node *UNUSED(child))
1639 iphone_t *iphone = GET_IPHONE(pdoc);
1644 * It is a handler who processes the TABLE tag.
1646 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
1647 * destination is specified.
1648 * @param node [i] The TR tag node is specified.
1649 * @return The conversion result is returned.
1652 s_iphone_start_table_tag(void *pdoc, Node *node)
1659 char *attr_style = NULL;
1660 char *attr_align = NULL;
1661 char *attr_width = NULL;
1662 char *attr_height = NULL;
1663 char *attr_bgcolor = NULL;
1664 char *attr_border_width = NULL;
1665 char *attr_border_color = NULL;
1667 iphone = GET_IPHONE(pdoc);
1671 /*--------------------------------------------------------------------------*/
1672 /* Get Attributes */
1673 /*--------------------------------------------------------------------------*/
1674 for (attr = qs_get_attr(doc,node);
1676 attr = qs_get_next_attr(doc,attr)) {
1677 char *name = qs_get_attr_name(doc,attr);
1678 char *val = qs_get_attr_value(doc,attr);
1679 if (STRCASEEQ('a','A',"align",name)) {
1680 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1681 attr_align = apr_pstrdup(doc->buf.pool, val);
1684 else if (STRCASEEQ('h','H',"height",name) && val && *val) {
1685 attr_height = apr_pstrdup(doc->buf.pool, val);
1687 else if (STRCASEEQ('w','W',"width",name) && val && *val) {
1688 attr_width = apr_pstrdup(doc->buf.pool, val);
1690 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1691 attr_style = apr_pstrdup(doc->buf.pool, val);
1693 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1694 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1695 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1697 else if (STRCASEEQ('b','B',"border",name) && val && *val) {
1698 attr_border_width = apr_pstrdup(doc->buf.pool, val);
1700 else if (STRCASEEQ('b','B',"bordercolor",name) && val && *val) {
1701 attr_border_color = apr_pstrdup(doc->buf.pool, val);
1702 attr_border_color = chxj_css_rgb_func_to_value(doc->pool, attr_border_color);
1706 if (IS_CSS_ON(iphone->entryp)) {
1707 css_prop_list_t *style = s_iphone_nopush_and_get_now_style(pdoc, node, attr_style);
1709 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
1710 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
1711 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
1712 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1713 css_property_t *border_width_prop = chxj_css_get_property_value(doc, style, "border-width");
1714 css_property_t *border_color_prop = chxj_css_get_property_value(doc, style, "border-color");
1716 css_property_t *cur;
1717 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
1718 char *tmp = apr_pstrdup(doc->pool, cur->value);
1719 char *tmpp = strstr(tmp, "px");
1721 size_t len = strlen(tmp) - strlen(tmpp);
1722 attr_width = apr_pstrndup(doc->pool, tmp,len);
1725 attr_width = apr_pstrdup(doc->pool, tmp);
1728 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
1729 char *tmp = apr_pstrdup(doc->pool, cur->value);
1730 char *tmpp = strstr(tmp, "px");
1732 size_t len = strlen(tmp) - strlen(tmpp);
1733 attr_height = apr_pstrndup(doc->pool, tmp,len);
1736 attr_height = apr_pstrdup(doc->pool, tmp);
1739 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1740 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1741 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1744 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1745 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1746 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1748 for (cur = border_width_prop->next; cur != border_width_prop; cur = cur->next) {
1749 char *tmp = apr_pstrdup(doc->pool, cur->value);
1750 char *tmpp = strstr(tmp, "px");
1752 size_t len = strlen(tmp) - strlen(tmpp);
1753 attr_border_width = apr_pstrndup(doc->pool, tmp,len);
1756 attr_border_width = apr_pstrdup(doc->pool, tmp);
1759 for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
1760 attr_border_color = apr_pstrdup(doc->pool, cur->value);
1761 attr_border_color = chxj_css_rgb_func_to_value(doc->pool, attr_border_color);
1782 if (attr_bgcolor && *attr_bgcolor){
1787 if (attr_border_width || attr_border_color ){
1788 W_L(" style=\"border:");
1789 if (attr_border_width){
1790 W_V(attr_border_width);
1797 if (attr_border_color && *attr_border_color){
1799 W_V(attr_border_color);
1809 * It is a handler who processes the TABLE tag.
1811 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
1812 * destination is specified.
1813 * @param node [i] The TR tag node is specified.
1814 * @return The conversion result is returned.
1817 s_iphone_end_table_tag(void *pdoc, Node *UNUSED(node))
1823 iphone = GET_IPHONE(pdoc);
1833 * It is a handler who processes the TR tag.
1835 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
1836 * destination is specified.
1837 * @param node [i] The TR tag node is specified.
1838 * @return The conversion result is returned.
1841 s_iphone_start_tr_tag(void *pdoc, Node *node)
1849 char *attr_style = NULL;
1850 char *attr_align = NULL;
1851 char *attr_valign = NULL;
1852 char *attr_bgcolor = NULL;
1854 iphone = GET_IPHONE(pdoc);
1858 /*--------------------------------------------------------------------------*/
1859 /* Get Attributes */
1860 /*--------------------------------------------------------------------------*/
1861 for (attr = qs_get_attr(doc,node);
1863 attr = qs_get_next_attr(doc,attr)) {
1864 char *name = qs_get_attr_name(doc,attr);
1865 char *val = qs_get_attr_value(doc,attr);
1866 if (STRCASEEQ('a','A',"align",name)) {
1867 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1868 attr_align = apr_pstrdup(doc->buf.pool, val);
1871 else if (STRCASEEQ('v','V',"valign",name) && val && *val) {
1872 if (val && (STRCASEEQ('t','T',"top",val) || STRCASEEQ('m','M',"middle",val) || STRCASEEQ('b','B',"bottom",val))) {
1873 attr_valign = apr_pstrdup(doc->buf.pool, val);
1876 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
1877 attr_style = apr_pstrdup(doc->buf.pool, val);
1879 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
1880 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
1881 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1885 if (IS_CSS_ON(iphone->entryp)) {
1886 css_prop_list_t *style = s_iphone_nopush_and_get_now_style(pdoc, node, attr_style);
1888 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
1889 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
1890 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1892 css_property_t *cur;
1893 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
1894 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
1895 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
1898 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
1899 if (cur->value && (STRCASEEQ('t','T',"top",cur->value) || STRCASEEQ('m','M',"middle",cur->value) || STRCASEEQ('b','B',"bottom",cur->value))) {
1900 attr_valign = apr_pstrdup(doc->buf.pool, cur->value);
1903 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1904 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1905 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1921 if (attr_bgcolor && *attr_bgcolor){
1932 * It is a handler who processes the TR tag.
1934 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
1935 * destination is specified.
1936 * @param node [i] The TR tag node is specified.
1937 * @return The conversion result is returned.
1940 s_iphone_end_tr_tag(void *pdoc, Node *UNUSED(child))
1946 iphone = GET_IPHONE(pdoc);
1955 * It is a handler who processes the TD tag.
1957 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
1958 * destination is specified.
1959 * @param node [i] The TR tag node is specified.
1960 * @return The conversion result is returned.
1963 s_iphone_start_td_or_th_tag(void *pdoc, Node *node,char *tagName)
1971 char *attr_style = NULL;
1972 char *attr_align = NULL;
1973 char *attr_valign = NULL;
1974 char *attr_bgcolor = NULL;
1975 char *attr_colspan = NULL;
1976 char *attr_rowspan = NULL;
1977 char *attr_width = NULL;
1978 char *attr_height = NULL;
1980 iphone = GET_IPHONE(pdoc);
1984 /*--------------------------------------------------------------------------*/
1985 /* Get Attributes */
1986 /*--------------------------------------------------------------------------*/
1987 for (attr = qs_get_attr(doc,node);
1989 attr = qs_get_next_attr(doc,attr)) {
1990 char *name = qs_get_attr_name(doc,attr);
1991 char *val = qs_get_attr_value(doc,attr);
1992 if (STRCASEEQ('a','A',"align",name)) {
1993 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
1994 attr_align = apr_pstrdup(doc->buf.pool, val);
1997 else if (STRCASEEQ('v','V',"valign",name) && val && *val) {
1998 if (val && (STRCASEEQ('t','T',"top",val) || STRCASEEQ('m','M',"middle",val) || STRCASEEQ('b','B',"bottom",val))) {
1999 attr_valign = apr_pstrdup(doc->buf.pool, val);
2002 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
2003 attr_style = apr_pstrdup(doc->buf.pool, val);
2005 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
2006 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
2007 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
2009 else if (STRCASEEQ('c','C',"colspan",name) && val && *val) {
2010 attr_colspan = apr_pstrdup(doc->buf.pool, val);
2012 else if (STRCASEEQ('r','R',"rowspan",name) && val && *val) {
2013 attr_rowspan = apr_pstrdup(doc->buf.pool, val);
2015 else if (STRCASEEQ('w','W',"width",name) && val && *val) {
2016 char *tmp = strstr(val, "%");
2018 attr_width = apr_pstrdup(doc->buf.pool, val);
2021 attr_width = apr_psprintf(doc->buf.pool,"%spx",val);
2024 else if (STRCASEEQ('h','H',"height",name) && val && *val) {
2025 char *tmp = strstr(val, "%");
2027 attr_height = apr_pstrdup(doc->buf.pool, val);
2030 attr_height = apr_psprintf(doc->buf.pool,"%spx",val);
2035 if (IS_CSS_ON(iphone->entryp)) {
2036 css_prop_list_t *style = s_iphone_nopush_and_get_now_style(pdoc, node, attr_style);
2038 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
2039 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
2040 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
2041 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2042 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2044 css_property_t *cur;
2045 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
2046 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
2047 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
2050 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
2051 if (cur->value && (STRCASEEQ('t','T',"top",cur->value) || STRCASEEQ('m','M',"middle",cur->value) || STRCASEEQ('b','B',"bottom",cur->value))) {
2052 attr_valign = apr_pstrdup(doc->buf.pool, cur->value);
2055 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
2056 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
2057 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
2059 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2060 attr_width = apr_pstrdup(doc->pool, cur->value);
2062 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2063 attr_height = apr_pstrdup(doc->pool, cur->value);
2090 if (attr_bgcolor && *attr_bgcolor){
2095 if (attr_width || attr_height ){
2115 * It is a handler who processes the TD tag.
2117 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
2118 * destination is specified.
2119 * @param node [i] The TR tag node is specified.
2120 * @return The conversion result is returned.
2123 s_iphone_end_td_or_th_tag(void *pdoc, Node *UNUSED(child),char *tagName)
2129 iphone = GET_IPHONE(pdoc);
2140 * It is a handler who processes the TD tag.
2142 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
2143 * destination is specified.
2144 * @param node [i] The TD tag node is specified.
2145 * @return The conversion result is returned.
2148 s_iphone_start_td_tag(void *pdoc, Node *node)
2150 return s_iphone_start_td_or_th_tag(pdoc,node,"td");
2153 * It is a handler who processes the TD tag.
2155 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
2156 * destination is specified.
2157 * @param node [i] The TD tag node is specified.
2158 * @return The conversion result is returned.
2161 s_iphone_end_td_tag(void *pdoc, Node *node)
2163 return s_iphone_end_td_or_th_tag(pdoc,node,"td");
2167 * It is a handler who processes the TD tag.
2169 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
2170 * destination is specified.
2171 * @param node [i] The TD tag node is specified.
2172 * @return The conversion result is returned.
2175 s_iphone_start_th_tag(void *pdoc, Node *node)
2177 return s_iphone_start_td_or_th_tag(pdoc,node,"th");
2180 * It is a handler who processes the TD tag.
2182 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
2183 * destination is specified.
2184 * @param node [i] The TD tag node is specified.
2185 * @return The conversion result is returned.
2188 s_iphone_end_th_tag(void *pdoc, Node *node)
2190 return s_iphone_end_td_or_th_tag(pdoc,node,"th");
2194 * It is a handler who processes the FONT tag.
2196 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
2197 * destination is specified.
2198 * @param node [i] The FONT tag node is specified.
2199 * @return The conversion result is returned.
2202 s_iphone_start_font_tag(void *pdoc, Node *node)
2208 char *attr_color = NULL;
2209 char *attr_size = NULL;
2210 char *attr_style = NULL;
2212 iphone = GET_IPHONE(pdoc);
2216 /*--------------------------------------------------------------------------*/
2217 /* Get Attributes */
2218 /*--------------------------------------------------------------------------*/
2219 for (attr = qs_get_attr(doc,node);
2221 attr = qs_get_next_attr(doc,attr)) {
2222 char *name = qs_get_attr_name(doc,attr);
2223 char *value = qs_get_attr_value(doc,attr);
2224 if (STRCASEEQ('c','C',"color",name) && value && *value) {
2225 attr_color = apr_pstrdup(doc->buf.pool, value);
2227 else if (STRCASEEQ('s','S',"size",name) && value && *value) {
2228 /*----------------------------------------------------------------------*/
2230 /*----------------------------------------------------------------------*/
2231 attr_size = apr_pstrdup(doc->buf.pool, value);
2233 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2234 attr_style = apr_pstrdup(doc->buf.pool, value);
2237 if (IS_CSS_ON(iphone->entryp)) {
2238 css_prop_list_t *style = s_iphone_nopush_and_get_now_style(pdoc, node, attr_style);
2240 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2241 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
2242 css_property_t *cur;
2243 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2244 if (cur->value && *cur->value) {
2245 attr_color = apr_pstrdup(doc->pool, cur->value);
2248 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
2249 if (cur->value && *cur->value) {
2250 attr_size = apr_pstrdup(doc->pool, cur->value);
2251 if (STRCASEEQ('x','X',"xx-small",attr_size)) {
2252 attr_size = apr_pstrdup(doc->pool, "1");
2254 else if (STRCASEEQ('x','X',"x-small",attr_size)) {
2255 attr_size = apr_pstrdup(doc->pool, "2");
2257 else if (STRCASEEQ('s','S',"small",attr_size)) {
2258 attr_size = apr_pstrdup(doc->pool, "3");
2260 else if (STRCASEEQ('m','M',"medium",attr_size)) {
2261 attr_size = apr_pstrdup(doc->pool, "4");
2263 else if (STRCASEEQ('l','L',"large",attr_size)) {
2264 attr_size = apr_pstrdup(doc->pool, "5");
2266 else if (STRCASEEQ('x','X',"x-large",attr_size)) {
2267 attr_size = apr_pstrdup(doc->pool, "6");
2269 else if (STRCASEEQ('x','X',"xx-large",attr_size)) {
2270 attr_size = apr_pstrdup(doc->pool, "7");
2276 iphone_flags_t *flg = (iphone_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
2277 memset(flg, 0, sizeof(*flg));
2279 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2280 W_L("<font color=\"");
2283 flg->font_color_flag = 1;
2286 flg->font_size_flag = 1;
2287 switch(*attr_size) {
2288 case '1': W_L("<span style=\"font-size: xx-small\">"); break;
2289 case '2': W_L("<span style=\"font-size: x-small\">"); break;
2290 case '3': W_L("<span style=\"font-size: small\">"); break;
2291 case '4': W_L("<span style=\"font-size: medium\">"); break;
2292 case '5': W_L("<span style=\"font-size: large\">"); break;
2293 case '6': W_L("<span style=\"font-size: x-large\">"); break;
2294 case '7': W_L("<span style=\"font-size: xx-large\">"); break;
2296 if (*(attr_size + 1) == '1') {
2297 W_L("<span style=\"font-size: small\">");
2300 if (*(attr_size + 1) == '2') {
2301 W_L("<span style=\"font-size: x-small\">");
2304 if (*(attr_size + 1) == '3') {
2305 W_L("<span style=\"font-size: xx-small\">");
2308 flg->font_size_flag = 0;
2312 if (*(attr_size + 1) == '1') {
2313 W_L("<span style=\"font-size: large\">");
2316 if (*(attr_size + 1) == '2') {
2317 W_L("<span style=\"font-size: x-large\">");
2320 if (*(attr_size + 1) == '3') {
2321 W_L("<span style=\"font-size: xx-large\">");
2324 flg->font_size_flag = 0;
2328 WRN(doc->r, "invlalid font size. [%s] != (1|2|3|4|5|6|7|+1|+2|+3|-1|-2|-3)", attr_size);
2329 flg->font_size_flag = 0;
2332 node->userData = flg;
2338 * It is a handler who processes the FONT tag.
2340 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
2341 * destination is specified.
2342 * @param node [i] The FONT tag node is specified.
2343 * @return The conversion result is returned.
2346 s_iphone_end_font_tag(void *pdoc, Node *node)
2352 iphone = GET_IPHONE(pdoc);
2356 iphone_flags_t *flg = (iphone_flags_t *)node->userData;
2357 if (flg && flg->font_size_flag) {
2360 if (flg && flg->font_color_flag) {
2363 if (IS_CSS_ON(iphone->entryp)) {
2364 chxj_css_pop_prop_list(iphone->css_prop_stack);
2372 * It is a handler who processes the FORM tag.
2374 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
2375 * destination is specified.
2376 * @param node [i] The FORM tag node is specified.
2377 * @return The conversion result is returned.
2380 s_iphone_start_form_tag(void *pdoc, Node *node)
2386 char *attr_action = NULL;
2387 char *attr_method = NULL;
2388 char *attr_style = NULL;
2389 char *attr_color = NULL;
2390 char *attr_align = NULL;
2391 char *attr_name = NULL;
2392 char *css_clear = NULL;
2393 char *new_hidden_tag = NULL;
2395 iphone = GET_IPHONE(pdoc);
2399 /*--------------------------------------------------------------------------*/
2400 /* Get Attributes */
2401 /*--------------------------------------------------------------------------*/
2402 for (attr = qs_get_attr(doc,node);
2404 attr = qs_get_next_attr(doc,attr)) {
2405 char *name = qs_get_attr_name(doc,attr);
2406 char *value = qs_get_attr_value(doc,attr);
2410 if (strcasecmp(name, "action") == 0) {
2411 /*--------------------------------------------------------------------*/
2413 /*--------------------------------------------------------------------*/
2414 attr_action = value;
2420 if (strcasecmp(name, "method") == 0) {
2421 /*--------------------------------------------------------------------*/
2423 /*--------------------------------------------------------------------*/
2424 attr_method = value;
2430 if (strcasecmp(name, "name") == 0) {
2431 /*--------------------------------------------------------------------*/
2433 /*--------------------------------------------------------------------*/
2440 if (strcasecmp(name, "style") == 0) {
2449 if (IS_CSS_ON(iphone->entryp)) {
2450 css_prop_list_t *style = s_iphone_nopush_and_get_now_style(pdoc, node, attr_style);
2452 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2453 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2454 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
2455 css_property_t *cur;
2456 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2457 if (STRCASEEQ('l','L',"left", cur->value)) {
2458 attr_align = apr_pstrdup(doc->pool, "left");
2460 else if (STRCASEEQ('c','C',"center",cur->value)) {
2461 attr_align = apr_pstrdup(doc->pool, "center");
2463 else if (STRCASEEQ('r','R',"right",cur->value)) {
2464 attr_align = apr_pstrdup(doc->pool, "right");
2467 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2468 attr_color = apr_pstrdup(doc->pool, cur->value);
2470 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
2471 css_clear = apr_pstrdup(doc->pool, cur->value);
2476 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
2480 attr_action = chxj_encoding_parameter(r, attr_action, 1);
2481 attr_action = chxj_add_cookie_parameter(r, attr_action, iphone->cookie);
2483 char *old_qs = NULL;
2484 q = strchr(attr_action, '?');
2486 new_hidden_tag = chxj_form_action_to_hidden_tag(r, doc->pool, attr_action, 1, post_flag, &old_qs, CHXJ_FALSE, CHXJ_TRUE, iphone->entryp);
2487 if (new_hidden_tag || old_qs) {
2517 iphone_flags_t *flg = (iphone_flags_t *)apr_palloc(doc->pool, sizeof(iphone_flags_t));
2518 memset(flg, 0, sizeof(*flg));
2520 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2521 W_L("<font color=\"");
2524 flg->with_font_flag = 1;
2527 W_L("<div align=\"");
2530 flg->with_div_flag = 1;
2532 node->userData = flg;
2533 if (new_hidden_tag) {
2534 W_V(new_hidden_tag);
2541 * It is a handler who processes the FORM tag.
2543 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
2544 * destination is specified.
2545 * @param node [i] The FORM tag node is specified.
2546 * @return The conversion result is returned.
2549 s_iphone_end_form_tag(void *pdoc, Node *node)
2551 iphone_t *iphone = GET_IPHONE(pdoc);
2552 Doc *doc = iphone->doc;
2554 iphone_flags_t *flg = (iphone_flags_t *)node->userData;
2555 if (flg && flg->with_div_flag) {
2558 if (flg && flg->with_font_flag) {
2562 if (IS_CSS_ON(iphone->entryp)) {
2563 chxj_css_pop_prop_list(iphone->css_prop_stack);
2570 s_iphone_istyle_to_wap_input_format(apr_pool_t *p, const char *s)
2574 case '1': return apr_psprintf(p, ""*<ja:h>"");
2575 case '2': return apr_psprintf(p, ""*<ja:hk>"");
2576 case '3': return apr_psprintf(p, ""*<ja:en>"");
2577 case '4': return apr_psprintf(p, ""*<ja:n>"");
2579 return apr_pstrdup(p, "");
2583 return apr_pstrdup(p,"");
2588 * It is a handler who processes the INPUT tag.
2590 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
2591 * destination is specified.
2592 * @param node [i] The INPUT tag node is specified.
2593 * @return The conversion result is returned.
2596 s_iphone_start_input_tag(void *pdoc, Node *node)
2602 char *attr_accesskey = NULL;
2603 char *attr_max_length = NULL;
2604 char *attr_type = NULL;
2605 char *attr_name = NULL;
2606 char *attr_value = NULL;
2607 char *attr_istyle = NULL;
2608 char *attr_size = NULL;
2609 char *attr_checked = NULL;
2610 char *attr_style = NULL;
2612 iphone = GET_IPHONE(pdoc);
2616 /*--------------------------------------------------------------------------*/
2617 /* Get Attributes */
2618 /*--------------------------------------------------------------------------*/
2619 for (attr = qs_get_attr(doc,node);
2621 attr = qs_get_next_attr(doc,attr)) {
2622 char *name = qs_get_attr_name(doc,attr);
2623 char *value = qs_get_attr_value(doc,attr);
2624 if (STRCASEEQ('t','T',"type",name) && value && *value) {
2625 char *tmp_type = qs_trim_string(doc->buf.pool, value);
2626 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
2627 STRCASEEQ('p','P',"password",tmp_type) ||
2628 STRCASEEQ('c','C',"checkbox",tmp_type) ||
2629 STRCASEEQ('r','R',"radio", tmp_type) ||
2630 STRCASEEQ('h','H',"hidden", tmp_type) ||
2631 STRCASEEQ('s','S',"submit", tmp_type) ||
2632 STRCASEEQ('r','R',"reset", tmp_type))) {
2633 attr_type = tmp_type;
2636 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
2639 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
2642 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
2643 attr_istyle = value;
2645 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
2646 attr_max_length = value;
2648 else if (STRCASEEQ('c','C',"checked", name)) {
2649 attr_checked = value;
2651 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
2652 attr_accesskey = value;
2654 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
2657 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2662 if (IS_CSS_ON(iphone->entryp)) {
2663 css_prop_list_t *style = s_iphone_nopush_and_get_now_style(pdoc, node, attr_style);
2665 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
2666 css_property_t *cur;
2667 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
2668 if (strcasestr(cur->value, "<ja:n>")) {
2671 else if (strcasestr(cur->value, "<ja:en>")) {
2674 else if (strcasestr(cur->value, "<ja:hk>")) {
2677 else if (strcasestr(cur->value, "<ja:h>")) {
2692 W_V(chxj_jreserved_to_safe_tag(r, attr_name, iphone->entryp));
2697 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
2700 if (attr_istyle && (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4')) {
2701 if (attr_type && STRCASEEQ('t','T',"text",attr_type)) {
2706 if (*attr_istyle == '4') {
2707 attr_type = apr_pstrdup(r->pool, "number");
2716 /*--------------------------------------------------------------------------*/
2717 /* The figure is default for the password. */
2718 /*--------------------------------------------------------------------------*/
2719 if (attr_max_length && *attr_max_length) {
2720 if (chxj_chk_numeric(attr_max_length) == 0) {
2721 W_L(" maxlength=\"");
2722 W_V(attr_max_length);
2727 W_L(" checked=\"checked\"");
2735 * It is a handler who processes the INPUT tag.
2737 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
2738 * destination is specified.
2739 * @param node [i] The INPUT tag node is specified.
2740 * @return The conversion result is returned.
2743 s_iphone_end_input_tag(void *pdoc, Node *UNUSED(child))
2745 iphone_t *iphone = GET_IPHONE(pdoc);
2751 * It is a handler who processes the CENTER tag.
2753 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
2754 * destination is specified.
2755 * @param node [i] The CENTER tag node is specified.
2756 * @return The conversion result is returned.
2759 s_iphone_start_center_tag(void *pdoc, Node *node)
2764 char *attr_style = NULL;
2765 char *attr_color = NULL;
2766 char *attr_size = NULL;
2768 iphone = GET_IPHONE(pdoc);
2771 for (attr = qs_get_attr(doc,node);
2773 attr = qs_get_next_attr(doc,attr)) {
2774 char *name = qs_get_attr_name(doc,attr);
2775 char *value = qs_get_attr_value(doc,attr);
2776 if (STRCASEEQ('s','S',"style",name) && value && *value) {
2780 if (IS_CSS_ON(iphone->entryp)) {
2781 css_prop_list_t *style = s_iphone_nopush_and_get_now_style(pdoc, node, attr_style);
2783 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2784 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
2785 css_property_t *cur;
2786 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2787 if (cur->value && *cur->value) {
2788 attr_color = apr_pstrdup(doc->pool, cur->value);
2791 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
2792 if (cur->value && *cur->value) {
2793 attr_size = apr_pstrdup(doc->pool, cur->value);
2800 if (attr_size || attr_color) {
2808 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2822 * It is a handler who processes the CENTER tag.
2824 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
2825 * destination is specified.
2826 * @param node [i] The CENTER tag node is specified.
2827 * @return The conversion result is returned.
2830 s_iphone_end_center_tag(void *pdoc, Node *UNUSED(node))
2836 iphone = GET_IPHONE(pdoc);
2841 if (IS_CSS_ON(iphone->entryp)) {
2842 chxj_css_pop_prop_list(iphone->css_prop_stack);
2849 * It is a handler who processes the li tag.
2851 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
2852 * destination is specified.
2853 * @param node [i] The li tag node is specified.
2854 * @return The conversion result is returned.
2857 s_iphone_start_li_tag(void *pdoc, Node *node)
2863 char *attr_type = NULL;
2864 char *attr_value = NULL;
2865 char *attr_style = NULL;
2867 iphone = GET_IPHONE(pdoc);
2871 for (attr = qs_get_attr(doc,node);
2873 attr = qs_get_next_attr(doc,attr)) {
2874 char *name = qs_get_attr_name(doc,attr);
2875 char *value = qs_get_attr_value(doc,attr);
2876 if (STRCASEEQ('t','T',"type",name)) {
2877 if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('s','S',"square",value) || STRCASEEQ('c','C',"circle",value))) {
2878 if (*value == '1') {
2879 attr_type = apr_pstrdup(doc->pool, "decimal");
2881 else if (*value == 'a') {
2882 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2884 else if (*value == 'A') {
2885 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2892 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
2895 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
2899 if (IS_CSS_ON(iphone->entryp)) {
2900 css_prop_list_t *style = s_iphone_nopush_and_get_now_style(pdoc, node, attr_style);
2902 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
2903 css_property_t *cur;
2904 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
2905 if (STRCASEEQ('d','D',"decimal", cur->value)) {
2906 attr_type = apr_pstrdup(doc->pool, "decimal");
2908 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
2909 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
2911 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
2912 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
2914 else if (STRCASEEQ('d','D',"disc", cur->value)) {
2915 attr_type = apr_pstrdup(doc->pool, "disc");
2917 else if (STRCASEEQ('s','S',"square", cur->value)) {
2918 attr_type = apr_pstrdup(doc->pool, "square");
2920 else if (STRCASEEQ('c','C',"circle", cur->value)) {
2921 attr_type = apr_pstrdup(doc->pool, "circle");
2931 W_L("list-style-type:");
2947 * It is a handler who processes the li tag.
2949 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
2950 * destination is specified.
2951 * @param node [i] The li tag node is specified.
2952 * @return The conversion result is returned.
2955 s_iphone_end_li_tag(void *pdoc, Node *UNUSED(child))
2961 iphone = GET_IPHONE(pdoc);
2965 if (IS_CSS_ON(iphone->entryp)) {
2966 chxj_css_pop_prop_list(iphone->css_prop_stack);
2974 * It is a handler who processes the OL tag.
2976 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
2977 * destination is specified.
2978 * @param node [i] The OL tag node is specified.
2979 * @return The conversion result is returned.
2982 s_iphone_start_ol_tag(void *pdoc, Node *node)
2988 char *attr_style = NULL;
2989 char *attr_start = NULL;
2990 char *attr_type = NULL;
2991 char *css_clear = NULL;
2993 iphone = GET_IPHONE(pdoc);
2997 /*--------------------------------------------------------------------------*/
2998 /* Get Attributes */
2999 /*--------------------------------------------------------------------------*/
3000 for (attr = qs_get_attr(doc,node);
3002 attr = qs_get_next_attr(doc,attr)) {
3003 char *name = qs_get_attr_name(doc,attr);
3004 char *value = qs_get_attr_value(doc,attr);
3005 if (STRCASEEQ('t','T',"type",name) && value) {
3006 if (*value == '1') {
3007 attr_type = apr_pstrdup(doc->pool, "decimal");
3009 else if (*value == 'a') {
3010 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3012 else if (*value == 'A') {
3013 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3016 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
3019 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3023 if (IS_CSS_ON(iphone->entryp)) {
3024 css_prop_list_t *style = s_iphone_nopush_and_get_now_style(pdoc, node, attr_style);
3026 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3027 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3029 css_property_t *cur;
3030 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3031 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3032 attr_type = apr_pstrdup(doc->pool, "decimal");
3034 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3035 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3037 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3038 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3041 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3042 css_clear = apr_pstrdup(doc->pool, cur->value);
3047 if (attr_type || css_clear) {
3050 W_L("list-style-type:");
3073 * It is a handler who processes the OL tag.
3075 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
3076 * destination is specified.
3077 * @param node [i] The OL tag node is specified.
3078 * @return The conversion result is returned.
3081 s_iphone_end_ol_tag(void *pdoc, Node *UNUSED(child))
3087 iphone = GET_IPHONE(pdoc);
3092 if (IS_CSS_ON(iphone->entryp)) {
3093 chxj_css_pop_prop_list(iphone->css_prop_stack);
3100 * It is a handler who processes the P tag.
3102 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
3103 * destination is specified.
3104 * @param node [i] The P tag node is specified.
3105 * @return The conversion result is returned.
3108 s_iphone_start_p_tag(void *pdoc, Node *node)
3114 char *attr_align = NULL;
3115 char *attr_style = NULL;
3116 char *attr_color = NULL;
3117 char *attr_blink = NULL;
3118 char *css_clear = NULL;
3120 iphone = GET_IPHONE(pdoc);
3124 for (attr = qs_get_attr(doc,node);
3126 attr = qs_get_next_attr(doc,attr)) {
3127 char *nm = qs_get_attr_name(doc,attr);
3128 char *val = qs_get_attr_value(doc,attr);
3129 if (STRCASEEQ('a','A',"align", nm)) {
3130 /*----------------------------------------------------------------------*/
3131 /* CHTML 1.0 (W3C version 3.2) */
3132 /*----------------------------------------------------------------------*/
3133 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
3134 attr_align = apr_pstrdup(doc->buf.pool, val);
3138 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
3139 attr_style = apr_pstrdup(doc->buf.pool, val);
3142 if (IS_CSS_ON(iphone->entryp)) {
3143 css_prop_list_t *style = s_iphone_nopush_and_get_now_style(pdoc, node, attr_style);
3145 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
3146 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3147 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
3148 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3149 css_property_t *cur;
3150 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
3151 if (STRCASEEQ('l','L',"left",cur->value)) {
3152 attr_align = apr_pstrdup(doc->pool, "left");
3154 else if (STRCASEEQ('c','C',"center",cur->value)) {
3155 attr_align = apr_pstrdup(doc->pool, "center");
3157 else if (STRCASEEQ('r','R',"right",cur->value)) {
3158 attr_align = apr_pstrdup(doc->pool, "right");
3161 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3162 if (cur->value && *cur->value) {
3163 attr_color = apr_pstrdup(doc->pool, cur->value);
3166 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
3167 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
3168 attr_blink = apr_pstrdup(doc->pool, cur->value);
3171 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3172 css_clear = apr_pstrdup(doc->pool, cur->value);
3177 if ((attr_align && *attr_align) || (attr_color && *attr_color) || (attr_blink && *attr_blink) || css_clear) {
3185 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3191 W_L("text-decoration:");
3208 * It is a handler who processes the P tag.
3210 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
3211 * destination is specified.
3212 * @param node [i] The P tag node is specified.
3213 * @return The conversion result is returned.
3216 s_iphone_end_p_tag(void *pdoc, Node *UNUSED(child))
3218 iphone_t *iphone = GET_IPHONE(pdoc);
3219 Doc *doc = iphone->doc;
3222 if (IS_CSS_ON(iphone->entryp)) {
3223 chxj_css_pop_prop_list(iphone->css_prop_stack);
3230 * It is a handler who processes the PRE tag.
3232 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
3233 * destination is specified.
3234 * @param node [i] The PRE tag node is specified.
3235 * @return The conversion result is returned.
3238 s_iphone_start_pre_tag(void *pdoc, Node *node)
3240 iphone_t *iphone = GET_IPHONE(pdoc);
3241 Doc *doc = iphone->doc;
3243 char *attr_style = NULL;
3244 char *css_clear = NULL;
3246 for (attr = qs_get_attr(doc,node);
3248 attr = qs_get_next_attr(doc,attr)) {
3249 char *nm = qs_get_attr_name(doc,attr);
3250 char *val = qs_get_attr_value(doc,attr);
3251 if (val && STRCASEEQ('s','S',"style", nm)) {
3256 if (IS_CSS_ON(iphone->entryp)) {
3257 css_prop_list_t *style = s_iphone_nopush_and_get_now_style(pdoc, node, attr_style);
3259 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3261 css_property_t *cur;
3262 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3263 css_clear = apr_pstrdup(doc->pool, cur->value);
3283 * It is a handler who processes the PRE tag.
3285 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
3286 * destination is specified.
3287 * @param node [i] The PRE tag node is specified.
3288 * @return The conversion result is returned.
3291 s_iphone_end_pre_tag(void *pdoc, Node *UNUSED(child))
3293 iphone_t *iphone = GET_IPHONE(pdoc);
3294 Doc *doc = iphone->doc;
3298 if (IS_CSS_ON(iphone->entryp)) {
3299 chxj_css_pop_prop_list(iphone->css_prop_stack);
3307 * It is a handler who processes the UL tag.
3309 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
3310 * destination is specified.
3311 * @param node [i] The UL tag node is specified.
3312 * @return The conversion result is returned.
3315 s_iphone_start_ul_tag(void *pdoc, Node *node)
3317 iphone_t *iphone = GET_IPHONE(pdoc);
3318 Doc *doc = iphone->doc;
3320 char *attr_type = NULL;
3321 char *attr_style = NULL;
3322 char *css_clear = NULL;
3324 /*--------------------------------------------------------------------------*/
3325 /* Get Attributes */
3326 /*--------------------------------------------------------------------------*/
3327 for (attr = qs_get_attr(doc,node);
3329 attr = qs_get_next_attr(doc,attr)) {
3330 char *name = qs_get_attr_name(doc,attr);
3331 char *value = qs_get_attr_value(doc,attr);
3332 if (STRCASEEQ('t','T',"type",name)) {
3333 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
3337 else if (value && *value && STRCASEEQ('s','S',"style", name)) {
3341 if (IS_CSS_ON(iphone->entryp)) {
3342 css_prop_list_t *style = s_iphone_nopush_and_get_now_style(pdoc, node, attr_style);
3344 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3345 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3347 css_property_t *cur;
3348 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3349 if (STRCASEEQ('d','D',"disc",cur->value)) {
3350 attr_type = apr_pstrdup(doc->pool, "disc");
3352 else if (STRCASEEQ('c','C',"circle",cur->value)) {
3353 attr_type = apr_pstrdup(doc->pool, "circle");
3355 else if (STRCASEEQ('s','S',"square",cur->value)) {
3356 attr_type = apr_pstrdup(doc->pool, "square");
3359 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3360 css_clear = apr_pstrdup(doc->pool, cur->value);
3365 if (attr_type || css_clear) {
3368 W_L("list-style-type:");
3385 * It is a handler who processes the UL tag.
3387 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
3388 * destination is specified.
3389 * @param node [i] The UL tag node is specified.
3390 * @return The conversion result is returned.
3393 s_iphone_end_ul_tag(void *pdoc, Node *UNUSED(child))
3395 iphone_t *iphone = GET_IPHONE(pdoc);
3396 Doc *doc = iphone->doc;
3399 if (IS_CSS_ON(iphone->entryp)) {
3400 chxj_css_pop_prop_list(iphone->css_prop_stack);
3407 * It is a handler who processes the HR tag.
3409 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
3410 * destination is specified.
3411 * @param node [i] The HR tag node is specified.
3412 * @return The conversion result is returned.
3415 s_iphone_start_hr_tag(void *pdoc, Node *node)
3421 char *attr_align = NULL;
3422 char *attr_size = NULL;
3423 char *attr_width = NULL;
3424 char *attr_noshade = NULL;
3425 char *attr_style = NULL;
3426 char *attr_color = NULL;
3427 char *attr_bgcolor = NULL;
3429 char *style_border_color = NULL;
3430 char *css_clear = NULL;
3432 iphone = GET_IPHONE(pdoc);
3436 for (attr = qs_get_attr(doc,node);
3438 attr = qs_get_next_attr(doc,attr)) {
3439 char *name = qs_get_attr_name (doc,attr);
3440 char *value = qs_get_attr_value(doc,attr);
3444 if (strcasecmp(name, "align") == 0) {
3445 /*--------------------------------------------------------------------*/
3447 /*--------------------------------------------------------------------*/
3448 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3449 if (value[0] == 'c' || value[0] == 'C') {
3450 attr_align = apr_pstrdup(doc->pool, "none");
3461 if (strcasecmp(name, "size") == 0) {
3462 /*--------------------------------------------------------------------*/
3464 /*--------------------------------------------------------------------*/
3465 if (value && *value) {
3469 else if (strcasecmp(name, "style") == 0) {
3470 if (value && *value) {
3478 if (strcasecmp(name, "width") == 0) {
3479 /*--------------------------------------------------------------------*/
3481 /*--------------------------------------------------------------------*/
3482 if (value && *value) {
3490 if (strcasecmp(name, "noshade") == 0) {
3491 /*--------------------------------------------------------------------*/
3493 /*--------------------------------------------------------------------*/
3494 attr_noshade = apr_pstrdup(doc->pool, "noshade");
3500 if (strcasecmp(name, "color") == 0 && value && *value) {
3501 /*--------------------------------------------------------------------*/
3503 /*--------------------------------------------------------------------*/
3512 if (IS_CSS_ON(iphone->entryp)) {
3513 css_prop_list_t *style = s_iphone_nopush_and_get_now_style(pdoc, node, attr_style);
3515 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
3516 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
3517 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
3519 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
3520 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
3521 css_property_t *border_color_prop = chxj_css_get_property_value(doc, style, "border-color");
3522 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3523 css_property_t *cur;
3525 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
3526 if (STRCASEEQ('s','S',"solid",cur->value)) {
3527 attr_noshade = "noshade";
3530 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
3531 attr_size = apr_pstrdup(doc->pool, cur->value);
3533 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
3534 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3537 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
3538 attr_align = apr_pstrdup(doc->pool,cur->value);
3543 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
3544 char *tmp = apr_pstrdup(doc->pool, cur->value);
3545 char *tmpp = strstr(tmp, "px");
3547 attr_width = apr_pstrdup(doc->pool, tmp);
3550 tmpp = strstr(tmp, "%");
3552 attr_width = apr_pstrdup(doc->pool, tmp);
3557 for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
3558 char *tmp = apr_pstrdup(doc->pool, cur->value);
3560 style_border_color = apr_pstrdup(doc->pool, tmp);
3563 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3564 css_clear = apr_pstrdup(doc->pool, cur->value);
3569 if (attr_align || attr_size || attr_width || attr_noshade || style_border_color || css_clear || attr_bgcolor) {
3579 if (chxj_chk_numeric(attr_size) == 0) {
3587 if (!strstr(attr_width, "px") && !strstr(attr_width, "%")) {
3593 W_L("border-style:solid;");
3595 if(style_border_color){
3596 W_L("border-color:");
3597 W_V(style_border_color);
3601 W_L("background-color:");
3625 * It is a handler who processes the HR tag.
3627 * @param iphone [i/o] The pointer to the IPHONE structure at the output
3628 * destination is specified.
3629 * @param node [i] The HR tag node is specified.
3630 * @return The conversion result is returned.
3633 s_iphone_end_hr_tag(void *pdoc, Node *UNUSED(child))
3635 iphone_t *iphone = GET_IPHONE(pdoc);
3641 * It is a handler who processes the IMG tag.
3643 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
3644 * destination is specified.
3645 * @param node [i] The IMG tag node is specified.
3646 * @return The conversion result is returned.
3649 s_iphone_start_img_tag(void *pdoc, Node *node)
3651 iphone_t *iphone = GET_IPHONE(pdoc);
3652 Doc *doc = iphone->doc;
3653 request_rec *r = doc->r;
3655 char *attr_src = NULL;
3656 char *attr_height = NULL;
3657 char *attr_width = NULL;
3658 char *attr_alt = NULL;
3659 char *attr_style = NULL;
3660 char *attr_hspace = NULL;
3661 char *attr_vspace = NULL;
3663 char *css_float = NULL;
3664 char *css_margin_left = NULL;
3665 char *css_margin_right = NULL;
3666 char *css_margin_top = NULL;
3667 char *css_margin_bottom = NULL;
3668 char *css_display = NULL;
3669 char *css_valign = NULL;
3671 #ifndef IMG_NOT_CONVERT_FILENAME
3672 device_table *spec = iphone->spec;
3675 /*--------------------------------------------------------------------------*/
3676 /* Get Attributes */
3677 /*--------------------------------------------------------------------------*/
3678 for (attr = qs_get_attr(doc,node);
3680 attr = qs_get_next_attr(doc,attr)) {
3681 char *name = qs_get_attr_name(doc,attr);
3682 char *value = qs_get_attr_value(doc,attr);
3683 if (STRCASEEQ('s','S',"src",name)) {
3684 /*----------------------------------------------------------------------*/
3686 /*----------------------------------------------------------------------*/
3687 #ifdef IMG_NOT_CONVERT_FILENAME
3688 value = chxj_encoding_parameter(r, value, 1);
3689 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, iphone->entryp, 1);
3690 value = chxj_add_cookie_no_update_parameter(r, value, 1);
3691 value = chxj_img_rewrite_parameter(r,iphone->conf,value);
3694 value = chxj_img_conv(r, spec, value);
3695 value = chxj_encoding_parameter(r, value, 1);
3696 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, iphone->entryp, 1);
3697 value = chxj_add_cookie_no_update_parameter(r, value, 1);
3698 value = chxj_img_rewrite_parameter(r,iphone->conf,value);
3702 else if (STRCASEEQ('a','A',"align",name)) {
3703 /*----------------------------------------------------------------------*/
3705 /*----------------------------------------------------------------------*/
3707 if (STRCASEEQ('t','T',"top", value) ||
3708 STRCASEEQ('m','M',"middle",value) ||
3709 STRCASEEQ('b','B',"bottom",value)){
3711 }else if (STRCASEEQ('l','L',"left", value) || STRCASEEQ('r','R',"right", value)) {
3714 else if (STRCASEEQ('c','C',"center",value)) {
3715 css_valign = apr_pstrdup(doc->pool, "middle");
3719 else if (STRCASEEQ('w','W',"width",name) && value && *value) {
3720 /*----------------------------------------------------------------------*/
3722 /*----------------------------------------------------------------------*/
3725 else if (STRCASEEQ('h','H',"height",name) && value && *value) {
3726 /*----------------------------------------------------------------------*/
3728 /*----------------------------------------------------------------------*/
3729 attr_height = value;
3731 else if (STRCASEEQ('h','H',"hspace",name)) {
3732 /*----------------------------------------------------------------------*/
3734 /*----------------------------------------------------------------------*/
3735 attr_hspace = value;
3737 else if (STRCASEEQ('v','V',"vspace",name)) {
3738 /*----------------------------------------------------------------------*/
3740 /*----------------------------------------------------------------------*/
3741 attr_vspace = value;
3743 else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
3744 /*----------------------------------------------------------------------*/
3746 /*----------------------------------------------------------------------*/
3749 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
3750 /*----------------------------------------------------------------------*/
3752 /*----------------------------------------------------------------------*/
3757 if (IS_CSS_ON(iphone->entryp)) {
3758 css_prop_list_t *style = s_iphone_nopush_and_get_now_style(pdoc, node, attr_style);
3760 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
3761 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
3762 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
3763 css_property_t *margin_left_prop = chxj_css_get_property_value(doc, style, "margin-left");
3764 css_property_t *margin_right_prop = chxj_css_get_property_value(doc, style, "margin-right");
3765 css_property_t *margin_top_prop = chxj_css_get_property_value(doc, style, "margin-top");
3766 css_property_t *margin_bottom_prop = chxj_css_get_property_value(doc, style, "margin-bottom");
3769 css_property_t *cur;
3770 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
3771 attr_height = apr_pstrdup(doc->pool, cur->value);
3773 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
3774 attr_width = apr_pstrdup(doc->pool, cur->value);
3777 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
3778 css_valign = apr_pstrdup(doc->pool, cur->value);
3781 if (! attr_hspace) {
3782 for (cur = margin_left_prop->next; cur != margin_left_prop; cur = cur->next) {
3783 css_margin_left = apr_pstrdup(doc->pool, cur->value);
3785 for (cur = margin_right_prop->next; cur != margin_right_prop; cur = cur->next) {
3786 css_margin_right = apr_pstrdup(doc->pool, cur->value);
3789 if (! attr_vspace) {
3790 for (cur = margin_top_prop->next; cur != margin_top_prop; cur = cur->next) {
3791 css_margin_top = apr_pstrdup(doc->pool, cur->value);
3793 for (cur = margin_bottom_prop->next; cur != margin_bottom_prop; cur = cur->next) {
3794 css_margin_bottom = apr_pstrdup(doc->pool, cur->value);
3798 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
3799 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
3800 css_float = apr_pstrdup(doc->pool, cur->value);
3804 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
3805 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
3806 char *tmp = apr_pstrdup(doc->pool, cur->value);
3807 char *tmpp = strstr(tmp, "none");
3809 css_display = apr_pstrdup(doc->pool, tmp);
3821 if (attr_hspace || attr_vspace || css_float || css_margin_left || css_margin_right || css_margin_top || css_margin_bottom || css_valign || css_display) {
3829 W_L("vertical-align:");
3834 W_L("margin-left:");
3837 W_L("margin-right:");
3842 if(css_margin_left){
3843 W_L("margin-left:");
3844 W_V(css_margin_left);
3847 if(css_margin_right){
3848 W_L("margin-right:");
3849 W_V(css_margin_right);
3857 W_L("margin-bottom:");
3864 W_V(css_margin_top);
3867 if(css_margin_bottom){
3868 W_L("margin-bottom:");
3869 W_V(css_margin_bottom);
3874 W_L("display:none;");
3903 * It is a handler who processes the IMG tag.
3905 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
3906 * destination is specified.
3907 * @param node [i] The IMG tag node is specified.
3908 * @return The conversion result is returned.
3911 s_iphone_end_img_tag(void *pdoc, Node *UNUSED(child))
3913 iphone_t *iphone = GET_IPHONE(pdoc);
3919 * It is a handler who processes the SELECT tag.
3921 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
3922 * destination is specified.
3923 * @param node [i] The SELECT tag node is specified.
3924 * @return The conversion result is returned.
3927 s_iphone_start_select_tag(void *pdoc, Node *node)
3929 iphone_t *iphone = GET_IPHONE(pdoc);
3930 Doc *doc = iphone->doc;
3934 char *multiple = NULL;
3935 char *attr_style = NULL;
3938 for (attr = qs_get_attr(doc,node);
3940 attr = qs_get_next_attr(doc,attr)) {
3941 char *nm = qs_get_attr_name(doc,attr);
3942 char *val = qs_get_attr_value(doc,attr);
3943 if (STRCASEEQ('s','S',"size",nm)) {
3944 /*----------------------------------------------------------------------*/
3945 /* CHTML 1.0 version 2.0 */
3946 /*----------------------------------------------------------------------*/
3947 size = apr_pstrdup(doc->buf.pool, val);
3949 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
3950 /*----------------------------------------------------------------------*/
3951 /* CHTML 1.0 version 2.0 */
3952 /*----------------------------------------------------------------------*/
3953 attr_style = apr_pstrdup(doc->buf.pool, val);
3955 else if (STRCASEEQ('n','N',"name",nm)) {
3956 /*----------------------------------------------------------------------*/
3957 /* CHTML 1.0 version 2.0 */
3958 /*----------------------------------------------------------------------*/
3959 name = apr_pstrdup(doc->buf.pool, val);
3961 else if (STRCASEEQ('m','M',"multiple", nm)) {
3962 /*----------------------------------------------------------------------*/
3963 /* CHTML 1.0 version 2.0 */
3964 /*----------------------------------------------------------------------*/
3965 multiple = apr_pstrdup(doc->buf.pool, val);
3968 if (size && *size) {
3973 if (name && *name) {
3979 W_L(" multiple=\"multiple\"");
3983 if (IS_CSS_ON(iphone->entryp)) {
3984 s_iphone_nopush_and_get_now_style(pdoc, node, attr_style);
3992 * It is a handler who processes the SELECT tag.
3994 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
3995 * destination is specified.
3996 * @param node [i] The SELECT tag node is specified.
3997 * @return The conversion result is returned.
4000 s_iphone_end_select_tag(void *pdoc, Node *UNUSED(child))
4002 iphone_t *iphone = GET_IPHONE(pdoc);
4003 Doc *doc = iphone->doc;
4006 if (IS_CSS_ON(iphone->entryp)) {
4007 chxj_css_pop_prop_list(iphone->css_prop_stack);
4014 * It is a handler who processes the OPTION tag.
4016 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
4017 * destination is specified.
4018 * @param node [i] The OPTION tag node is specified.
4019 * @return The conversion result is returned.
4022 s_iphone_start_option_tag(void *pdoc, Node *node)
4024 iphone_t *iphone = GET_IPHONE(pdoc);
4025 Doc *doc = iphone->doc;
4028 char *selected = NULL;
4030 char *attr_style = NULL;
4033 for (attr = qs_get_attr(doc,node);
4035 attr = qs_get_next_attr(doc,attr)) {
4036 char *nm = qs_get_attr_name(doc,attr);
4037 char *val = qs_get_attr_value(doc,attr);
4038 if (STRCASEEQ('s','S',"selected",nm)) {
4039 /*----------------------------------------------------------------------*/
4040 /* CHTML 1.0 version 2.0 */
4041 /*----------------------------------------------------------------------*/
4042 selected = apr_pstrdup(doc->buf.pool, val);
4044 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
4045 /*----------------------------------------------------------------------*/
4046 /* CHTML 1.0 version 2.0 */
4047 /*----------------------------------------------------------------------*/
4048 attr_style = apr_pstrdup(doc->buf.pool, val);
4050 else if (STRCASEEQ('v','V',"value",nm)) {
4051 /*----------------------------------------------------------------------*/
4052 /* CHTML 1.0 version 2.0 */
4053 /*----------------------------------------------------------------------*/
4054 value = apr_pstrdup(doc->buf.pool, val);
4063 W_L(" selected=\"selected\"");
4067 if (IS_CSS_ON(iphone->entryp)) {
4068 s_iphone_nopush_and_get_now_style(pdoc, node, attr_style);
4076 * It is a handler who processes the OPTION tag.
4078 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
4079 * destination is specified.
4080 * @param node [i] The OPTION tag node is specified.
4081 * @return The conversion result is returned.
4084 s_iphone_end_option_tag(void *pdoc, Node *UNUSED(child))
4086 iphone_t *iphone = GET_IPHONE(pdoc);
4087 Doc *doc = iphone->doc;
4090 if (IS_CSS_ON(iphone->entryp)) {
4091 chxj_css_pop_prop_list(iphone->css_prop_stack);
4099 * It is a handler who processes the DIV tag.
4101 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
4102 * destination is specified.
4103 * @param node [i] The DIV tag node is specified.
4104 * @return The conversion result is returned.
4107 s_iphone_start_div_tag(void *pdoc, Node *node)
4113 char *attr_style = NULL;
4114 char *attr_align = NULL;
4115 char *attr_display = NULL;
4116 char *attr_decoration = NULL;
4117 char *attr_wap_marquee_style = NULL;
4118 char *attr_wap_marquee_dir = NULL;
4119 char *attr_wap_marquee_loop = NULL;
4120 char *attr_wap_marquee_speed = NULL;
4121 char *attr_color = NULL;
4122 char *attr_bgcolor = NULL;
4123 char *attr_font_size = NULL;
4124 char *css_clear = NULL;
4126 iphone = GET_IPHONE(pdoc);
4130 for (attr = qs_get_attr(doc,node);
4132 attr = qs_get_next_attr(doc,attr)) {
4133 char *nm = qs_get_attr_name(doc,attr);
4134 char *val = qs_get_attr_value(doc,attr);
4135 if (STRCASEEQ('a','A',"align",nm)) {
4136 /*----------------------------------------------------------------------*/
4137 /* CHTML 1.0 (W3C version 3.2) */
4138 /*----------------------------------------------------------------------*/
4139 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
4140 attr_align = apr_pstrdup(doc->buf.pool, val);
4143 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
4144 attr_style = apr_pstrdup(doc->buf.pool, val);
4148 if (IS_CSS_ON(iphone->entryp)) {
4149 css_prop_list_t *style = s_iphone_nopush_and_get_now_style(pdoc, node, attr_style);
4151 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
4152 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
4153 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4154 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
4155 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4156 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
4157 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
4158 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4160 css_property_t *cur;
4161 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
4162 if (strcasecmp("-wap-marquee", cur->value) == 0) {
4163 attr_display = apr_pstrdup(doc->pool, cur->value);
4166 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
4167 if (STRCASEEQ('b','B',"blink", cur->value)) {
4168 attr_decoration = apr_pstrdup(doc->pool, cur->value);
4171 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4172 attr_color = apr_pstrdup(doc->pool, cur->value);
4174 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
4175 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
4176 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
4178 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
4179 char *ss = strchr(cur->value, '#');
4181 ss = strstr(cur->value, "rgb");
4184 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
4185 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
4188 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
4189 attr_align = apr_pstrdup(doc->pool, cur->value);
4191 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4192 if ( STRCASEEQ('x','X',"xx-small",cur->value)
4193 || STRCASEEQ('x','X',"x-small",cur->value)
4194 || STRCASEEQ('s','S',"small",cur->value)
4195 || STRCASEEQ('m','M',"medium",cur->value)
4196 || STRCASEEQ('l','L',"large",cur->value)
4197 || STRCASEEQ('x','X',"x-large",cur->value)
4198 || STRCASEEQ('x','X',"xx-large",cur->value)) {
4199 attr_font_size = apr_pstrdup(doc->pool, cur->value);
4203 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4204 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4205 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4206 css_property_t *wap_marquee_speed_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-speed");
4207 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
4208 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
4209 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
4212 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
4213 if (STRCASEEQ('l','L',"ltr",cur->value)) {
4214 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
4216 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
4217 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
4220 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
4221 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
4222 attr_wap_marquee_loop = "infinite";
4225 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
4228 for (cur = wap_marquee_speed_prop->next; cur != wap_marquee_speed_prop; cur = cur->next) {
4229 attr_wap_marquee_speed = apr_pstrdup(doc->pool, cur->value);
4232 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4233 css_clear = apr_pstrdup(doc->pool, cur->value);
4241 || attr_wap_marquee_style
4242 || attr_wap_marquee_dir
4243 || attr_wap_marquee_loop
4244 || attr_wap_marquee_speed
4257 W_L("overflow:-webkit-marquee;");
4259 if (attr_decoration) {
4260 if (STRCASEEQ('b','B',"blink",attr_decoration)) {
4262 if (iphone->blink_keyframe_out == 0) {
4263 iphone->style_data = apr_pstrcat(doc->pool, (iphone->style_data) ? iphone->style_data : "",
4266 iphone->blink_keyframe_out = 1;
4270 W_L("text-decoration:");
4271 W_V(attr_decoration);
4275 if (attr_wap_marquee_style) {
4276 W_L("-webkit-marquee-style:");
4277 W_V(attr_wap_marquee_style);
4280 if (attr_wap_marquee_dir) {
4281 W_L("-webkit-marquee-direction:");
4282 if (STRCASEEQ('r','R',"rtl",attr_wap_marquee_dir)) {
4285 else if (STRCASEEQ('l','L',"ltr",attr_wap_marquee_dir)) {
4290 if (attr_wap_marquee_loop) {
4291 W_L("-webkit-marquee-repetition:");
4292 W_V(attr_wap_marquee_loop);
4295 if (attr_wap_marquee_speed) {
4296 W_L("-webkit-marquee-speed:");
4297 W_V(attr_wap_marquee_speed);
4306 W_L("background-color:");
4310 if (attr_font_size) {
4312 W_V(attr_font_size);
4328 * It is a handler who processes the DIV tag.
4330 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
4331 * destination is specified.
4332 * @param node [i] The DIV tag node is specified.
4333 * @return The conversion result is returned.
4336 s_iphone_end_div_tag(void *pdoc, Node *UNUSED(child))
4342 iphone = GET_IPHONE(pdoc);
4347 if (IS_CSS_ON(iphone->entryp)) {
4348 chxj_css_pop_prop_list(iphone->css_prop_stack);
4355 s_iphone_chxjif_tag(void *pdoc, Node *node)
4362 iphone = GET_IPHONE(pdoc);
4366 for (child = qs_get_child_node(doc, node);
4368 child = qs_get_next_node(doc, child)) {
4370 s_iphone_chxjif_tag(iphone, child);
4377 * It is a handler who processes the TEXTARE tag.
4379 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
4380 * destination is specified.
4381 * @param node [i] The TEXTAREA tag node is specified.
4382 * @return The conversion result is returned.
4385 s_iphone_start_textarea_tag(void *pdoc, Node *node)
4391 char *attr_accesskey = NULL;
4392 char *attr_name = NULL;
4393 char *attr_rows = NULL;
4394 char *attr_cols = NULL;
4395 char *attr_istyle = NULL;
4396 char *attr_style = NULL;
4399 iphone = GET_IPHONE(pdoc);
4403 iphone->textarea_flag++;
4404 for (attr = qs_get_attr(doc,node);
4406 attr = qs_get_next_attr(doc,attr)) {
4407 char *name = qs_get_attr_name(doc,attr);
4408 char *value = qs_get_attr_value(doc,attr);
4409 if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
4410 attr_accesskey = value;
4412 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
4413 attr_istyle = value;
4415 else if (STRCASEEQ('n','N',"name", name) && value && *value) {
4418 else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
4421 else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
4424 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4428 if (IS_CSS_ON(iphone->entryp)) {
4429 css_prop_list_t *style = s_iphone_nopush_and_get_now_style(pdoc, node, attr_style);
4431 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
4432 css_property_t *cur;
4433 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
4434 if (strcasestr(cur->value, "<ja:n>")) {
4437 else if (strcasestr(cur->value, "<ja:en>")) {
4440 else if (strcasestr(cur->value, "<ja:hk>")) {
4443 else if (strcasestr(cur->value, "<ja:h>")) {
4471 * It is a handler who processes the TEXTAREA tag.
4473 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
4474 * destination is specified.
4475 * @param node [i] The TEXTAREA tag node is specified.
4476 * @return The conversion result is returned.
4479 s_iphone_end_textarea_tag(void *pdoc, Node *UNUSED(child))
4485 iphone = GET_IPHONE(pdoc);
4490 iphone->textarea_flag--;
4497 * It is a handler who processes the B tag.
4499 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
4500 * destination is specified.
4501 * @param node [i] The B tag node is specified.
4502 * @return The conversion result is returned.
4505 s_iphone_start_b_tag(void* pdoc, Node* UNUSED(node))
4511 iphone = GET_IPHONE(pdoc);
4521 * It is a handler who processes the B tag.
4523 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
4524 * destination is specified.
4525 * @param node [i] The B tag node is specified.
4526 * @return The conversion result is returned.
4529 s_iphone_end_b_tag(void* pdoc, Node* UNUSED(child))
4531 iphone_t* iphone = GET_IPHONE(pdoc);
4532 Doc* doc = iphone->doc;
4539 s_iphone_text_tag(void* pdoc, Node* child)
4550 apr_size_t z2h_input_len;
4552 iphone = GET_IPHONE(pdoc);
4556 textval = qs_get_node_value(doc,child);
4557 if (strlen(textval) == 0) {
4561 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
4562 memset(tmp, 0, qs_get_node_size(doc,child)+1);
4564 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
4565 memset(one_byte, 0, sizeof(one_byte));
4568 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
4570 int rtn = s_iphone_search_emoji(iphone, &textval[ii], &out);
4572 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
4577 if (is_sjis_kanji(textval[ii])) {
4578 one_byte[0] = textval[ii+0];
4579 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4580 one_byte[0] = textval[ii+1];
4581 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4585 if (iphone->pre_flag) {
4586 one_byte[0] = textval[ii+0];
4587 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4590 if (iphone->textarea_flag) {
4591 one_byte[0] = textval[ii+0];
4592 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4595 if (textval[ii] != '\r' && textval[ii] != '\n') {
4596 one_byte[0] = textval[ii+0];
4597 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4601 z2h_input_len = strlen(tdst);
4602 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, iphone->entryp);
4610 * It is a handler who processes the BLOCKQUOTE tag.
4612 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
4613 * destination is specified.
4614 * @param node [i] The BLOCKQUOTE tag node is specified.
4615 * @return The conversion result is returned.
4618 s_iphone_start_blockquote_tag(void *pdoc, Node *node)
4623 char *attr_style = NULL;
4624 char *attr_color = NULL;
4625 char *attr_size = NULL;
4626 char *css_clear = NULL;
4628 iphone = GET_IPHONE(pdoc);
4630 for (attr = qs_get_attr(doc,node);
4632 attr = qs_get_next_attr(doc,attr)) {
4633 char *nm = qs_get_attr_name(doc,attr);
4634 char *val = qs_get_attr_value(doc,attr);
4635 if (val && STRCASEEQ('s','S',"style", nm)) {
4639 if (IS_CSS_ON(iphone->entryp)) {
4640 css_prop_list_t *style = s_iphone_nopush_and_get_now_style(pdoc, node, attr_style);
4642 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4643 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4644 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4646 css_property_t *cur;
4647 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4648 if (cur->value && *cur->value) {
4649 attr_color = apr_pstrdup(doc->pool, cur->value);
4652 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4653 if (cur->value && *cur->value) {
4654 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4655 attr_size = apr_pstrdup(doc->pool, cur->value);
4657 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4658 attr_size = apr_pstrdup(doc->pool, cur->value);
4660 else if (STRCASEEQ('s','S',"small",cur->value)) {
4661 attr_size = apr_pstrdup(doc->pool, cur->value);
4663 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4664 attr_size = apr_pstrdup(doc->pool, cur->value);
4666 else if (STRCASEEQ('l','L',"large",cur->value)) {
4667 attr_size = apr_pstrdup(doc->pool, cur->value);
4669 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4670 attr_size = apr_pstrdup(doc->pool, cur->value);
4672 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4673 attr_size = apr_pstrdup(doc->pool, cur->value);
4677 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4678 css_clear = apr_pstrdup(doc->pool, cur->value);
4683 if (attr_color || attr_size || css_clear) {
4686 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4709 * It is a handler who processes the BLOCKQUOTE tag.
4711 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
4712 * destination is specified.
4713 * @param node [i] The BLOCKQUOTE tag node is specified.
4714 * @return The conversion result is returned.
4717 s_iphone_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
4719 iphone_t *iphone = GET_IPHONE(pdoc);
4720 Doc *doc = iphone->doc;
4721 W_L("</blockquote>");
4722 if (IS_CSS_ON(iphone->entryp)) {
4723 chxj_css_pop_prop_list(iphone->css_prop_stack);
4730 * It is a handler who processes the DIR tag.
4732 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
4733 * destination is specified.
4734 * @param node [i] The DIR tag node is specified.
4735 * @return The conversion result is returned.
4738 s_iphone_start_dir_tag(void *pdoc, Node *node)
4740 iphone_t *iphone = GET_IPHONE(pdoc);
4741 Doc *doc = iphone->doc;
4743 char *attr_style = NULL;
4744 char *attr_color = NULL;
4745 char *attr_type = NULL;
4746 char *attr_size = NULL;
4747 for (attr = qs_get_attr(doc,node);
4749 attr = qs_get_next_attr(doc,attr)) {
4750 char *name = qs_get_attr_name(doc,attr);
4751 char *value = qs_get_attr_value(doc,attr);
4752 if (STRCASEEQ('t','T',"type",name)) {
4753 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
4757 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4761 if (IS_CSS_ON(iphone->entryp)) {
4762 css_prop_list_t *style = s_iphone_nopush_and_get_now_style(pdoc, node, attr_style);
4764 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4765 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4766 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
4767 css_property_t *cur;
4768 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4769 if (cur->value && *cur->value) {
4770 attr_color = apr_pstrdup(doc->pool, cur->value);
4773 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
4774 if (cur->value && *cur->value) {
4775 attr_type = apr_pstrdup(doc->pool, cur->value);
4778 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4779 if (cur->value && *cur->value) {
4780 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4781 attr_size = apr_pstrdup(doc->pool, cur->value);
4783 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4784 attr_size = apr_pstrdup(doc->pool, cur->value);
4786 else if (STRCASEEQ('s','S',"small",cur->value)) {
4787 attr_size = apr_pstrdup(doc->pool, cur->value);
4789 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4790 attr_size = apr_pstrdup(doc->pool, cur->value);
4792 else if (STRCASEEQ('l','L',"large",cur->value)) {
4793 attr_size = apr_pstrdup(doc->pool, cur->value);
4795 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4796 attr_size = apr_pstrdup(doc->pool, cur->value);
4798 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4799 attr_size = apr_pstrdup(doc->pool, cur->value);
4806 if (attr_type || attr_color || attr_size) {
4809 W_L("list-style-type:");
4814 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4832 * It is a handler who processes the DIR tag.
4834 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
4835 * destination is specified.
4836 * @param node [i] The DIR tag node is specified.
4837 * @return The conversion result is returned.
4840 s_iphone_end_dir_tag(void *pdoc, Node *UNUSED(child))
4842 iphone_t *iphone = GET_IPHONE(pdoc);
4843 Doc *doc = iphone->doc;
4845 if (IS_CSS_ON(iphone->entryp)) {
4846 chxj_css_pop_prop_list(iphone->css_prop_stack);
4853 * It is a handler who processes the DL tag.
4855 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
4856 * destination is specified.
4857 * @param node [i] The DL tag node is specified.
4858 * @return The conversion result is returned.
4861 s_iphone_start_dl_tag(void *pdoc, Node *node)
4863 iphone_t *iphone = GET_IPHONE(pdoc);
4864 Doc *doc = iphone->doc;
4866 char *attr_style = NULL;
4867 char *attr_color = NULL;
4868 char *attr_size = NULL;
4869 char *css_clear = NULL;
4871 for (attr = qs_get_attr(doc,node);
4873 attr = qs_get_next_attr(doc,attr)) {
4874 char *name = qs_get_attr_name(doc,attr);
4875 char *value = qs_get_attr_value(doc,attr);
4876 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4880 if (IS_CSS_ON(iphone->entryp)) {
4881 css_prop_list_t *style = s_iphone_nopush_and_get_now_style(pdoc, node, attr_style);
4883 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4884 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
4885 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4887 css_property_t *cur;
4888 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4889 if (cur->value && *cur->value) {
4890 attr_color = apr_pstrdup(doc->pool, cur->value);
4893 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
4894 if (cur->value && *cur->value) {
4895 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
4896 attr_size = apr_pstrdup(doc->pool, cur->value);
4898 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
4899 attr_size = apr_pstrdup(doc->pool, cur->value);
4901 else if (STRCASEEQ('s','S',"small",cur->value)) {
4902 attr_size = apr_pstrdup(doc->pool, cur->value);
4904 else if (STRCASEEQ('m','M',"medium",cur->value)) {
4905 attr_size = apr_pstrdup(doc->pool, cur->value);
4907 else if (STRCASEEQ('l','L',"large",cur->value)) {
4908 attr_size = apr_pstrdup(doc->pool, cur->value);
4910 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
4911 attr_size = apr_pstrdup(doc->pool, cur->value);
4913 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
4914 attr_size = apr_pstrdup(doc->pool, cur->value);
4918 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4919 css_clear = apr_pstrdup(doc->pool, cur->value);
4924 if (attr_color || attr_size || css_clear) {
4927 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
4950 * It is a handler who processes the DL tag.
4952 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
4953 * destination is specified.
4954 * @param node [i] The DL tag node is specified.
4955 * @return The conversion result is returned.
4958 s_iphone_end_dl_tag(void *pdoc, Node *UNUSED(child))
4960 iphone_t *iphone = GET_IPHONE(pdoc);
4961 Doc *doc = iphone->doc;
4963 if (IS_CSS_ON(iphone->entryp)) {
4964 chxj_css_pop_prop_list(iphone->css_prop_stack);
4971 * It is a handler who processes the DT tag.
4973 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
4974 * destination is specified.
4975 * @param node [i] The DT tag node is specified.
4976 * @return The conversion result is returned.
4979 s_iphone_start_dt_tag(void *pdoc, Node *node)
4981 iphone_t *iphone = GET_IPHONE(pdoc);
4982 Doc *doc = iphone->doc;
4984 char *attr_style = NULL;
4985 char *attr_color = NULL;
4986 char *attr_size = NULL;
4987 for (attr = qs_get_attr(doc,node);
4989 attr = qs_get_next_attr(doc,attr)) {
4990 char *name = qs_get_attr_name(doc,attr);
4991 char *value = qs_get_attr_value(doc,attr);
4992 if (STRCASEEQ('s','S',"style", name) && value && *value) {
4996 if (IS_CSS_ON(iphone->entryp)) {
4997 css_prop_list_t *style = s_iphone_nopush_and_get_now_style(pdoc, node, attr_style);
4999 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5000 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5001 css_property_t *cur;
5002 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5003 if (cur->value && *cur->value) {
5004 attr_color = apr_pstrdup(doc->pool, cur->value);
5007 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5008 if (cur->value && *cur->value) {
5009 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5010 attr_size = apr_pstrdup(doc->pool, cur->value);
5012 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5013 attr_size = apr_pstrdup(doc->pool, cur->value);
5015 else if (STRCASEEQ('s','S',"small",cur->value)) {
5016 attr_size = apr_pstrdup(doc->pool, cur->value);
5018 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5019 attr_size = apr_pstrdup(doc->pool, cur->value);
5021 else if (STRCASEEQ('l','L',"large",cur->value)) {
5022 attr_size = apr_pstrdup(doc->pool, cur->value);
5024 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5025 attr_size = apr_pstrdup(doc->pool, cur->value);
5027 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5028 attr_size = apr_pstrdup(doc->pool, cur->value);
5035 if (attr_color || attr_size) {
5038 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5056 * It is a handler who processes the DT tag.
5058 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
5059 * destination is specified.
5060 * @param node [i] The DT tag node is specified.
5061 * @return The conversion result is returned.
5064 s_iphone_end_dt_tag(void *pdoc, Node *UNUSED(child))
5066 iphone_t *iphone = GET_IPHONE(pdoc);
5067 Doc *doc = iphone->doc;
5069 if (IS_CSS_ON(iphone->entryp)) {
5070 chxj_css_pop_prop_list(iphone->css_prop_stack);
5077 * It is a handler who processes the DD tag.
5079 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
5080 * destination is specified.
5081 * @param node [i] The DD tag node is specified.
5082 * @return The conversion result is returned.
5085 s_iphone_start_dd_tag(void *pdoc, Node *node)
5087 iphone_t *iphone = GET_IPHONE(pdoc);
5088 Doc *doc = iphone->doc;
5090 char *attr_style = NULL;
5091 char *attr_color = NULL;
5092 char *attr_size = NULL;
5093 for (attr = qs_get_attr(doc,node);
5095 attr = qs_get_next_attr(doc,attr)) {
5096 char *name = qs_get_attr_name(doc,attr);
5097 char *value = qs_get_attr_value(doc,attr);
5098 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5102 if (IS_CSS_ON(iphone->entryp)) {
5103 css_prop_list_t *style = s_iphone_nopush_and_get_now_style(pdoc, node, attr_style);
5105 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5106 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5107 css_property_t *cur;
5108 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5109 if (cur->value && *cur->value) {
5110 attr_color = apr_pstrdup(doc->pool, cur->value);
5113 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5114 if (cur->value && *cur->value) {
5115 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5116 attr_size = apr_pstrdup(doc->pool, cur->value);
5118 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5119 attr_size = apr_pstrdup(doc->pool, cur->value);
5121 else if (STRCASEEQ('s','S',"small",cur->value)) {
5122 attr_size = apr_pstrdup(doc->pool, cur->value);
5124 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5125 attr_size = apr_pstrdup(doc->pool, cur->value);
5127 else if (STRCASEEQ('l','L',"large",cur->value)) {
5128 attr_size = apr_pstrdup(doc->pool, cur->value);
5130 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5131 attr_size = apr_pstrdup(doc->pool, cur->value);
5133 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5134 attr_size = apr_pstrdup(doc->pool, cur->value);
5141 if (attr_color || attr_size) {
5144 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5162 * It is a handler who processes the DD tag.
5164 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
5165 * destination is specified.
5166 * @param node [i] The DD tag node is specified.
5167 * @return The conversion result is returned.
5170 s_iphone_end_dd_tag(void *pdoc, Node *UNUSED(child))
5172 iphone_t *iphone = GET_IPHONE(pdoc);
5173 Doc *doc = iphone->doc;
5175 if (IS_CSS_ON(iphone->entryp)) {
5176 chxj_css_pop_prop_list(iphone->css_prop_stack);
5183 * It is a handler who processes the H1 tag.
5185 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
5186 * destination is specified.
5187 * @param node [i] The H1 tag node is specified.
5188 * @return The conversion result is returned.
5191 s_iphone_start_h1_tag(void *pdoc, Node *node)
5197 char *attr_style = NULL;
5198 char *attr_align = NULL;
5199 char *css_clear = NULL;
5201 iphone = GET_IPHONE(pdoc);
5205 for (attr = qs_get_attr(doc,node);
5207 attr = qs_get_next_attr(doc,attr)) {
5208 char *name = qs_get_attr_name(doc,attr);
5209 char *value = qs_get_attr_value(doc,attr);
5210 if (STRCASEEQ('a','A',"align", name)) {
5211 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5215 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5219 if (IS_CSS_ON(iphone->entryp)) {
5220 css_prop_list_t *style = s_iphone_nopush_and_get_now_style(pdoc, node, attr_style);
5222 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5223 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5224 css_property_t *cur;
5225 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5226 if (STRCASEEQ('l','L',"left", cur->value)) {
5227 attr_align = apr_pstrdup(doc->pool, "left");
5229 else if (STRCASEEQ('c','C',"center",cur->value)) {
5230 attr_align = apr_pstrdup(doc->pool, "center");
5232 else if (STRCASEEQ('r','R',"right",cur->value)) {
5233 attr_align = apr_pstrdup(doc->pool, "right");
5236 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5237 if (STRCASEEQ('b','B',"both", cur->value)) {
5238 css_clear = apr_pstrdup(doc->pool, "both");
5240 else if (STRCASEEQ('r','R',"right", cur->value)) {
5241 css_clear = apr_pstrdup(doc->pool, "right");
5243 else if (STRCASEEQ('l','L',"left", cur->value)) {
5244 css_clear = apr_pstrdup(doc->pool, "left");
5250 if (attr_align || css_clear ) {
5271 * It is a handler who processes the H1 tag.
5273 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
5274 * destination is specified.
5275 * @param node [i] The H1 tag node is specified.
5276 * @return The conversion result is returned.
5279 s_iphone_end_h1_tag(void *pdoc, Node *UNUSED(child))
5285 iphone = GET_IPHONE(pdoc);
5290 if (IS_CSS_ON(iphone->entryp)) {
5291 chxj_css_pop_prop_list(iphone->css_prop_stack);
5299 * It is a handler who processes the H2 tag.
5301 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
5302 * destination is specified.
5303 * @param node [i] The H1 tag node is specified.
5304 * @return The conversion result is returned.
5307 s_iphone_start_h2_tag(void *pdoc, Node *node)
5313 char *attr_style = NULL;
5314 char *attr_align = NULL;
5315 char *css_clear = NULL;
5317 iphone = GET_IPHONE(pdoc);
5321 for (attr = qs_get_attr(doc,node);
5323 attr = qs_get_next_attr(doc,attr)) {
5324 char *name = qs_get_attr_name(doc,attr);
5325 char *value = qs_get_attr_value(doc,attr);
5326 if (STRCASEEQ('a','A',"align", name)) {
5327 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5331 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5335 if (IS_CSS_ON(iphone->entryp)) {
5336 css_prop_list_t *style = s_iphone_nopush_and_get_now_style(pdoc, node, attr_style);
5338 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5339 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5340 css_property_t *cur;
5341 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5342 if (STRCASEEQ('l','L',"left", cur->value)) {
5343 attr_align = apr_pstrdup(doc->pool, "left");
5345 else if (STRCASEEQ('c','C',"center",cur->value)) {
5346 attr_align = apr_pstrdup(doc->pool, "center");
5348 else if (STRCASEEQ('r','R',"right",cur->value)) {
5349 attr_align = apr_pstrdup(doc->pool, "right");
5352 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5353 if (STRCASEEQ('b','B',"both", cur->value)) {
5354 css_clear = apr_pstrdup(doc->pool, "both");
5356 else if (STRCASEEQ('r','R',"right", cur->value)) {
5357 css_clear = apr_pstrdup(doc->pool, "right");
5359 else if (STRCASEEQ('l','L',"left", cur->value)) {
5360 css_clear = apr_pstrdup(doc->pool, "left");
5366 if (attr_align || css_clear ) {
5387 * It is a handler who processes the H2 tag.
5389 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
5390 * destination is specified.
5391 * @param node [i] The H1 tag node is specified.
5392 * @return The conversion result is returned.
5395 s_iphone_end_h2_tag(void *pdoc, Node *UNUSED(child))
5401 iphone = GET_IPHONE(pdoc);
5406 if (IS_CSS_ON(iphone->entryp)) {
5407 chxj_css_pop_prop_list(iphone->css_prop_stack);
5414 * It is a handler who processes the H3 tag.
5416 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
5417 * destination is specified.
5418 * @param node [i] The H1 tag node is specified.
5419 * @return The conversion result is returned.
5422 s_iphone_start_h3_tag(void *pdoc, Node *node)
5428 char *attr_style = NULL;
5429 char *attr_align = NULL;
5430 char *css_clear = NULL;
5432 iphone = GET_IPHONE(pdoc);
5436 for (attr = qs_get_attr(doc,node);
5438 attr = qs_get_next_attr(doc,attr)) {
5439 char *name = qs_get_attr_name(doc,attr);
5440 char *value = qs_get_attr_value(doc,attr);
5441 if (STRCASEEQ('a','A',"align", name)) {
5442 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5446 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5450 if (IS_CSS_ON(iphone->entryp)) {
5451 css_prop_list_t *style = s_iphone_nopush_and_get_now_style(pdoc, node, attr_style);
5453 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5454 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5455 css_property_t *cur;
5456 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5457 if (STRCASEEQ('l','L',"left", cur->value)) {
5458 attr_align = apr_pstrdup(doc->pool, "left");
5460 else if (STRCASEEQ('c','C',"center",cur->value)) {
5461 attr_align = apr_pstrdup(doc->pool, "center");
5463 else if (STRCASEEQ('r','R',"right",cur->value)) {
5464 attr_align = apr_pstrdup(doc->pool, "right");
5467 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5468 if (STRCASEEQ('b','B',"both", cur->value)) {
5469 css_clear = apr_pstrdup(doc->pool, "both");
5471 else if (STRCASEEQ('r','R',"right", cur->value)) {
5472 css_clear = apr_pstrdup(doc->pool, "right");
5474 else if (STRCASEEQ('l','L',"left", cur->value)) {
5475 css_clear = apr_pstrdup(doc->pool, "left");
5481 if (attr_align || css_clear ) {
5502 * It is a handler who processes the H3 tag.
5504 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
5505 * destination is specified.
5506 * @param node [i] The H1 tag node is specified.
5507 * @return The conversion result is returned.
5510 s_iphone_end_h3_tag(void *pdoc, Node *UNUSED(child))
5516 iphone = GET_IPHONE(pdoc);
5521 if (IS_CSS_ON(iphone->entryp)) {
5522 chxj_css_pop_prop_list(iphone->css_prop_stack);
5529 * It is a handler who processes the H4 tag.
5531 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
5532 * destination is specified.
5533 * @param node [i] The H1 tag node is specified.
5534 * @return The conversion result is returned.
5537 s_iphone_start_h4_tag(void *pdoc, Node *node)
5543 char *attr_style = NULL;
5544 char *attr_align = NULL;
5545 char *css_clear = NULL;
5547 iphone = GET_IPHONE(pdoc);
5551 for (attr = qs_get_attr(doc,node);
5553 attr = qs_get_next_attr(doc,attr)) {
5554 char *name = qs_get_attr_name(doc,attr);
5555 char *value = qs_get_attr_value(doc,attr);
5556 if (STRCASEEQ('a','A',"align", name)) {
5557 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5561 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5565 if (IS_CSS_ON(iphone->entryp)) {
5566 css_prop_list_t *style = s_iphone_nopush_and_get_now_style(pdoc, node, attr_style);
5568 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5569 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5570 css_property_t *cur;
5571 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5572 if (STRCASEEQ('l','L',"left", cur->value)) {
5573 attr_align = apr_pstrdup(doc->pool, "left");
5575 else if (STRCASEEQ('c','C',"center",cur->value)) {
5576 attr_align = apr_pstrdup(doc->pool, "center");
5578 else if (STRCASEEQ('r','R',"right",cur->value)) {
5579 attr_align = apr_pstrdup(doc->pool, "right");
5582 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5583 if (STRCASEEQ('b','B',"both", cur->value)) {
5584 css_clear = apr_pstrdup(doc->pool, "both");
5586 else if (STRCASEEQ('r','R',"right", cur->value)) {
5587 css_clear = apr_pstrdup(doc->pool, "right");
5589 else if (STRCASEEQ('l','L',"left", cur->value)) {
5590 css_clear = apr_pstrdup(doc->pool, "left");
5596 if (attr_align || css_clear ) {
5617 * It is a handler who processes the H4 tag.
5619 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
5620 * destination is specified.
5621 * @param node [i] The H1 tag node is specified.
5622 * @return The conversion result is returned.
5625 s_iphone_end_h4_tag(void *pdoc, Node *UNUSED(child))
5631 iphone = GET_IPHONE(pdoc);
5636 if (IS_CSS_ON(iphone->entryp)) {
5637 chxj_css_pop_prop_list(iphone->css_prop_stack);
5645 * It is a handler who processes the H5 tag.
5647 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
5648 * destination is specified.
5649 * @param node [i] The H1 tag node is specified.
5650 * @return The conversion result is returned.
5653 s_iphone_start_h5_tag(void *pdoc, Node *node)
5659 char *attr_style = NULL;
5660 char *attr_align = NULL;
5661 char *css_clear = NULL;
5663 iphone = GET_IPHONE(pdoc);
5667 for (attr = qs_get_attr(doc,node);
5669 attr = qs_get_next_attr(doc,attr)) {
5670 char *name = qs_get_attr_name(doc,attr);
5671 char *value = qs_get_attr_value(doc,attr);
5672 if (STRCASEEQ('a','A',"align", name)) {
5673 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5677 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5681 if (IS_CSS_ON(iphone->entryp)) {
5682 css_prop_list_t *style = s_iphone_nopush_and_get_now_style(pdoc, node, attr_style);
5684 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5685 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5686 css_property_t *cur;
5687 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5688 if (STRCASEEQ('l','L',"left", cur->value)) {
5689 attr_align = apr_pstrdup(doc->pool, "left");
5691 else if (STRCASEEQ('c','C',"center",cur->value)) {
5692 attr_align = apr_pstrdup(doc->pool, "center");
5694 else if (STRCASEEQ('r','R',"right",cur->value)) {
5695 attr_align = apr_pstrdup(doc->pool, "right");
5698 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5699 if (STRCASEEQ('b','B',"both", cur->value)) {
5700 css_clear = apr_pstrdup(doc->pool, "both");
5702 else if (STRCASEEQ('r','R',"right", cur->value)) {
5703 css_clear = apr_pstrdup(doc->pool, "right");
5705 else if (STRCASEEQ('l','L',"left", cur->value)) {
5706 css_clear = apr_pstrdup(doc->pool, "left");
5712 if (attr_align || css_clear ) {
5733 * It is a handler who processes the H5 tag.
5735 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
5736 * destination is specified.
5737 * @param node [i] The H1 tag node is specified.
5738 * @return The conversion result is returned.
5741 s_iphone_end_h5_tag(void *pdoc, Node *UNUSED(child))
5747 iphone = GET_IPHONE(pdoc);
5752 if (IS_CSS_ON(iphone->entryp)) {
5753 chxj_css_pop_prop_list(iphone->css_prop_stack);
5761 * It is a handler who processes the H6 tag.
5763 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
5764 * destination is specified.
5765 * @param node [i] The H1 tag node is specified.
5766 * @return The conversion result is returned.
5769 s_iphone_start_h6_tag(void *pdoc, Node *node)
5775 char *attr_style = NULL;
5776 char *attr_align = NULL;
5777 char *css_clear = NULL;
5779 iphone = GET_IPHONE(pdoc);
5783 for (attr = qs_get_attr(doc,node);
5785 attr = qs_get_next_attr(doc,attr)) {
5786 char *name = qs_get_attr_name(doc,attr);
5787 char *value = qs_get_attr_value(doc,attr);
5788 if (STRCASEEQ('a','A',"align", name)) {
5789 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5793 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5797 if (IS_CSS_ON(iphone->entryp)) {
5798 css_prop_list_t *style = s_iphone_nopush_and_get_now_style(pdoc, node, attr_style);
5800 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5801 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5802 css_property_t *cur;
5803 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5804 if (STRCASEEQ('l','L',"left", cur->value)) {
5805 attr_align = apr_pstrdup(doc->pool, "left");
5807 else if (STRCASEEQ('c','C',"center",cur->value)) {
5808 attr_align = apr_pstrdup(doc->pool, "center");
5810 else if (STRCASEEQ('r','R',"right",cur->value)) {
5811 attr_align = apr_pstrdup(doc->pool, "right");
5814 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5815 if (STRCASEEQ('b','B',"both", cur->value)) {
5816 css_clear = apr_pstrdup(doc->pool, "both");
5818 else if (STRCASEEQ('r','R',"right", cur->value)) {
5819 css_clear = apr_pstrdup(doc->pool, "right");
5821 else if (STRCASEEQ('l','L',"left", cur->value)) {
5822 css_clear = apr_pstrdup(doc->pool, "left");
5828 if (attr_align || css_clear ) {
5849 * It is a handler who processes the H6 tag.
5851 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
5852 * destination is specified.
5853 * @param node [i] The H1 tag node is specified.
5854 * @return The conversion result is returned.
5857 s_iphone_end_h6_tag(void *pdoc, Node *UNUSED(child))
5863 iphone = GET_IPHONE(pdoc);
5868 if (IS_CSS_ON(iphone->entryp)) {
5869 chxj_css_pop_prop_list(iphone->css_prop_stack);
5877 * It is a handler who processes the MENU tag.
5879 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
5880 * destination is specified.
5881 * @param node [i] The MENU tag node is specified.
5882 * @return The conversion result is returned.
5885 s_iphone_start_menu_tag(void *pdoc, Node *node)
5887 iphone_t *iphone = GET_IPHONE(pdoc);
5888 Doc *doc = iphone->doc;
5890 char *attr_style = NULL;
5891 char *attr_color = NULL;
5892 char *attr_type = NULL;
5893 char *attr_size = NULL;
5894 for (attr = qs_get_attr(doc,node);
5896 attr = qs_get_next_attr(doc,attr)) {
5897 char *name = qs_get_attr_name(doc,attr);
5898 char *value = qs_get_attr_value(doc,attr);
5899 if (STRCASEEQ('t','T',"type",name)) {
5900 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
5904 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
5908 if (IS_CSS_ON(iphone->entryp)) {
5909 css_prop_list_t *style = s_iphone_nopush_and_get_now_style(pdoc, node, attr_style);
5911 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5912 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5913 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
5914 css_property_t *cur;
5915 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5916 if (cur->value && *cur->value) {
5917 attr_color = apr_pstrdup(doc->pool, cur->value);
5920 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5921 if (cur->value && *cur->value) {
5922 attr_type = apr_pstrdup(doc->pool, cur->value);
5925 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5926 if (cur->value && *cur->value) {
5927 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5928 attr_size = apr_pstrdup(doc->pool, cur->value);
5930 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5931 attr_size = apr_pstrdup(doc->pool, cur->value);
5933 else if (STRCASEEQ('s','S',"small",cur->value)) {
5934 attr_size = apr_pstrdup(doc->pool, cur->value);
5936 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5937 attr_size = apr_pstrdup(doc->pool, cur->value);
5939 else if (STRCASEEQ('l','L',"large",cur->value)) {
5940 attr_size = apr_pstrdup(doc->pool, cur->value);
5942 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5943 attr_size = apr_pstrdup(doc->pool, cur->value);
5945 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5946 attr_size = apr_pstrdup(doc->pool, cur->value);
5953 if (attr_type || attr_color || attr_size) {
5956 W_L("list-style-type:");
5961 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5979 * It is a handler who processes the MENU tag.
5981 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
5982 * destination is specified.
5983 * @param node [i] The MENU tag node is specified.
5984 * @return The conversion result is returned.
5987 s_iphone_end_menu_tag(void *pdoc, Node *UNUSED(child))
5989 iphone_t *iphone = GET_IPHONE(pdoc);
5990 Doc *doc = iphone->doc;
5992 if (IS_CSS_ON(iphone->entryp)) {
5993 chxj_css_pop_prop_list(iphone->css_prop_stack);
6000 * It is a handler who processes the PLAINTEXT tag.
6002 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
6003 * destination is specified.
6004 * @param node [i] The PLAINTEXT tag node is specified.
6005 * @return The conversion result is returned.
6008 s_iphone_start_plaintext_tag(void *pdoc, Node *node)
6013 iphone = GET_IPHONE(pdoc);
6016 s_iphone_start_plaintext_tag_inner(pdoc,node);
6021 s_iphone_start_plaintext_tag_inner(void *pdoc, Node *node)
6026 iphone = GET_IPHONE(pdoc);
6028 for (child = qs_get_child_node(doc, node);
6030 child = qs_get_next_node(doc, child)) {
6032 s_iphone_start_plaintext_tag_inner(pdoc, child);
6039 * It is a handler who processes the PLAINTEXT tag.
6041 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
6042 * destination is specified.
6043 * @param node [i] The PLAINTEXT tag node is specified.
6044 * @return The conversion result is returned.
6047 s_iphone_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
6049 iphone_t *iphone = GET_IPHONE(pdoc);
6055 * It is a handler who processes the BLINK tag.
6057 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
6058 * destination is specified.
6059 * @param node [i] The BLINK tag node is specified.
6060 * @return The conversion result is returned.
6063 s_iphone_start_blink_tag(void *pdoc, Node *node)
6065 iphone_t *iphone = GET_IPHONE(pdoc);
6066 Doc *doc = iphone->doc;
6068 char *attr_style = NULL;
6069 char *attr_color = NULL;
6070 char *attr_size = NULL;
6071 for (attr = qs_get_attr(doc,node);
6073 attr = qs_get_next_attr(doc,attr)) {
6074 char *name = qs_get_attr_name(doc,attr);
6075 char *value = qs_get_attr_value(doc,attr);
6076 if (STRCASEEQ('s','S',"style", name) && value && *value) {
6080 if (IS_CSS_ON(iphone->entryp)) {
6081 css_prop_list_t *style = s_iphone_nopush_and_get_now_style(pdoc, node, attr_style);
6083 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6084 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6085 css_property_t *cur;
6086 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6087 if (cur->value && *cur->value) {
6088 attr_color = apr_pstrdup(doc->pool, cur->value);
6091 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6092 if (cur->value && *cur->value) {
6093 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
6094 attr_size = apr_pstrdup(doc->pool, cur->value);
6096 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
6097 attr_size = apr_pstrdup(doc->pool, cur->value);
6099 else if (STRCASEEQ('s','S',"small",cur->value)) {
6100 attr_size = apr_pstrdup(doc->pool, cur->value);
6102 else if (STRCASEEQ('m','M',"medium",cur->value)) {
6103 attr_size = apr_pstrdup(doc->pool, cur->value);
6105 else if (STRCASEEQ('l','L',"large",cur->value)) {
6106 attr_size = apr_pstrdup(doc->pool, cur->value);
6108 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
6109 attr_size = apr_pstrdup(doc->pool, cur->value);
6111 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
6112 attr_size = apr_pstrdup(doc->pool, cur->value);
6122 if (iphone->blink_keyframe_out == 0) {
6123 iphone->style_data = apr_pstrcat(doc->pool, (iphone->style_data) ? iphone->style_data : "",
6126 iphone->blink_keyframe_out = 1;
6129 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6147 * It is a handler who processes the BLINK tag.
6149 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
6150 * destination is specified.
6151 * @param node [i] The BLINK tag node is specified.
6152 * @return The conversion result is returned.
6155 s_iphone_end_blink_tag(void *pdoc, Node *UNUSED(child))
6157 iphone_t *iphone = GET_IPHONE(pdoc);
6158 Doc *doc = iphone->doc;
6160 if (IS_CSS_ON(iphone->entryp)) {
6161 chxj_css_pop_prop_list(iphone->css_prop_stack);
6168 * It is a handler who processes the MARQUEE tag.
6170 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
6171 * destination is specified.
6172 * @param node [i] The MARQUEE tag node is specified.
6173 * @return The conversion result is returned.
6176 s_iphone_start_marquee_tag(void *pdoc, Node *node)
6178 iphone_t *iphone = GET_IPHONE(pdoc);
6179 Doc *doc = iphone->doc;
6181 char *attr_style = NULL;
6182 char *attr_color = NULL;
6183 char *attr_size = NULL;
6184 char *attr_wap_marquee_loop = NULL;
6185 char *attr_wap_marquee_style = NULL;
6186 char *attr_wap_marquee_dir = NULL;
6187 char *attr_wap_marquee_speed = NULL;
6188 char *attr_bgcolor = NULL;
6189 /*--------------------------------------------------------------------------*/
6190 /* Get Attributes */
6191 /*--------------------------------------------------------------------------*/
6192 for (attr = qs_get_attr(doc,node);
6194 attr = qs_get_next_attr(doc,attr)) {
6195 char *name = qs_get_attr_name(doc,attr);
6196 char *value = qs_get_attr_value(doc,attr);
6197 if (STRCASEEQ('d','D',"direction", name)) {
6199 if (STRCASEEQ('l','L',"left",value)) {
6200 attr_wap_marquee_dir = "rtl";
6202 else if (STRCASEEQ('r','R',"right",value)) {
6203 attr_wap_marquee_dir = "ltr";
6207 else if (STRCASEEQ('b','B',"behavior",name)) {
6208 if (value && *value) {
6209 attr_wap_marquee_style = value;
6212 else if (STRCASEEQ('l','L',"loop",name)) {
6213 if (value && *value) {
6214 if(strcmp(value,"0") == 0 || strcmp(value,"-1") == 0){
6215 attr_wap_marquee_loop = "infinite";
6218 attr_wap_marquee_loop = value;
6222 else if (STRCASEEQ('b','B',"bgcolor",name)) {
6223 if (value && *value) {
6224 attr_bgcolor = value;
6227 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
6231 if (IS_CSS_ON(iphone->entryp)) {
6232 css_prop_list_t *style = s_iphone_nopush_and_get_now_style(pdoc, node, attr_style);
6234 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6235 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6236 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
6237 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
6238 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
6239 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
6240 css_property_t *wap_marquee_speed_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-speed");
6241 css_property_t *cur;
6242 if (!attr_wap_marquee_style) {
6243 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
6244 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
6245 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
6249 if (!attr_wap_marquee_dir) {
6250 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
6251 if (STRCASEEQ('l','L',"ltr",cur->value)) {
6252 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
6254 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
6255 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
6259 if (!attr_wap_marquee_loop) {
6260 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
6261 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
6262 attr_wap_marquee_loop = "infinite";
6265 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
6269 if (!attr_wap_marquee_speed) {
6270 for (cur = wap_marquee_speed_prop->next; cur != wap_marquee_speed_prop; cur = cur->next) {
6271 attr_wap_marquee_speed = apr_pstrdup(doc->pool, cur->value);
6274 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6275 if (cur->value && *cur->value) {
6276 attr_color = apr_pstrdup(doc->pool, cur->value);
6279 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
6280 if (cur->value && *cur->value) {
6281 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
6284 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6285 if (cur->value && *cur->value) {
6286 if ( STRCASEEQ('x','X',"xx-small",cur->value)
6287 || STRCASEEQ('x','X',"x-small", cur->value)
6288 || STRCASEEQ('s','S',"small", cur->value)
6289 || STRCASEEQ('m','M',"medium", cur->value)
6290 || STRCASEEQ('l','L',"large", cur->value)
6291 || STRCASEEQ('x','X',"x-large", cur->value)
6292 || STRCASEEQ('x','X',"xx-large",cur->value)) {
6293 attr_size = apr_pstrdup(doc->pool, cur->value);
6300 W_L("<div style=\"");
6301 W_L("overflow:-webkit-marquee;");
6302 if (attr_wap_marquee_dir) {
6303 W_L("-webkit-marquee-direction:");
6304 if (STRCASEEQ('r','R',"rtl",attr_wap_marquee_dir)) {
6307 else if (STRCASEEQ('l','L',"ltr",attr_wap_marquee_dir)) {
6312 if (attr_wap_marquee_style) {
6313 W_L("-webkit-marquee-style:");
6314 W_V(attr_wap_marquee_style);
6317 if (attr_wap_marquee_loop) {
6318 W_L("-webkit-marquee-repetition:");
6319 W_V(attr_wap_marquee_loop);
6322 if (attr_wap_marquee_speed) {
6323 W_L("-webkit-marquee-speed:");
6324 W_V(attr_wap_marquee_speed);
6328 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
6329 W_L("background-color:");
6334 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6352 * It is a handler who processes the MARQUEE tag.
6354 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
6355 * destination is specified.
6356 * @param node [i] The MARQUEE tag node is specified.
6357 * @return The conversion result is returned.
6360 s_iphone_end_marquee_tag(void *pdoc, Node *UNUSED(node))
6362 iphone_t *iphone = GET_IPHONE(pdoc);
6363 Doc *doc = iphone->doc;
6365 if (IS_CSS_ON(iphone->entryp)) {
6366 chxj_css_pop_prop_list(iphone->css_prop_stack);
6373 * It is handler who processes the New Line Code.
6376 s_iphone_newline_mark(void *pdoc, Node *UNUSED(node))
6378 iphone_t *iphone = GET_IPHONE(pdoc);
6379 if (iphone->start_html_flag) {
6380 Doc *doc = iphone->doc;
6388 * It is a handler who processes the LINK tag.
6390 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
6391 * destination is specified.
6392 * @param node [i] The LINK tag node is specified.
6393 * @return The conversion result is returned.
6396 s_iphone_link_tag(void *pdoc, Node *node)
6405 iphone = GET_IPHONE(pdoc);
6408 if (! IS_CSS_ON(iphone->entryp)) {
6412 for (attr = qs_get_attr(doc,node);
6414 attr = qs_get_next_attr(doc,attr)) {
6415 char *name = qs_get_attr_name(doc,attr);
6416 char *value = qs_get_attr_value(doc,attr);
6417 if (STRCASEEQ('r','R',"rel", name)) {
6418 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
6422 else if (STRCASEEQ('h','H',"href", name)) {
6423 if (value && *value) {
6427 else if (STRCASEEQ('t','T',"type", name)) {
6428 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
6434 if (rel && href && type) {
6435 DBG(doc->r,"REQ[%X] start load CSS. url:[%s]", TO_ADDR(doc->r),href);
6436 iphone->style = chxj_css_parse_from_uri(doc->r, doc->pool, iphone->style, href);
6437 DBG(doc->r,"REQ[%X] end load CSS. url:[%s]", TO_ADDR(doc->r),href);
6444 static css_prop_list_t *
6445 s_iphone_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
6447 iphone_t *iphone = GET_IPHONE(pdoc);
6448 Doc *doc = iphone->doc;
6449 css_prop_list_t *last_css = NULL;
6450 if (IS_CSS_ON(iphone->entryp)) {
6451 css_prop_list_t *dup_css;
6452 css_selector_t *selector;
6454 last_css = chxj_css_get_last_prop_list(iphone->css_prop_stack);
6455 dup_css = chxj_dup_css_prop_list(doc, last_css);
6456 selector = chxj_css_find_selector(doc, iphone->style, node);
6458 chxj_css_prop_list_merge_property(doc, dup_css, selector);
6460 chxj_css_push_prop_list(iphone->css_prop_stack, dup_css);
6461 last_css = chxj_css_get_last_prop_list(iphone->css_prop_stack);
6463 if (style_attr_value) {
6464 css_stylesheet_t *ssheet = chxj_css_parse_style_attr(doc, NULL, apr_pstrdup(doc->pool, node->name), NULL, NULL, apr_pstrdup(doc->pool, style_attr_value));
6466 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
6474 static css_prop_list_t *
6475 s_iphone_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
6477 iphone_t *iphone = GET_IPHONE(pdoc);
6478 Doc *doc = iphone->doc;
6479 css_prop_list_t *last_css = NULL;
6480 if (IS_CSS_ON(iphone->entryp)) {
6481 css_prop_list_t *dup_css;
6482 css_selector_t *selector;
6484 last_css = chxj_css_get_last_prop_list(iphone->css_prop_stack);
6485 dup_css = chxj_dup_css_prop_list(doc, last_css);
6486 selector = chxj_css_find_selector(doc, iphone->style, node);
6488 chxj_css_prop_list_merge_property(doc, dup_css, selector);
6492 if (style_attr_value) {
6493 css_stylesheet_t *ssheet = chxj_css_parse_style_attr(doc, NULL, apr_pstrdup(doc->pool, node->name), NULL, NULL, apr_pstrdup(doc->pool, style_attr_value));
6495 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
6504 * It is a handler who processes the SPAN tag.
6506 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6507 * destination is specified.
6508 * @param node [i] The SPAN tag node is specified.
6509 * @return The conversion result is returned.
6512 s_iphone_start_span_tag(void *pdoc, Node *node)
6517 char *attr_style = NULL;
6518 char *attr_color = NULL;
6519 char *attr_size = NULL;
6520 char *attr_align = NULL;
6521 char *attr_blink = NULL;
6522 char *attr_marquee = NULL;
6523 char *attr_marquee_dir = NULL;
6524 char *attr_marquee_style = NULL;
6525 char *attr_marquee_loop = NULL;
6526 char *attr_marquee_speed = NULL;
6527 char *css_bgcolor = NULL;
6529 iphone = GET_IPHONE(pdoc);
6532 for (attr = qs_get_attr(doc,node);
6534 attr = qs_get_next_attr(doc,attr)) {
6535 char *nm = qs_get_attr_name(doc,attr);
6536 char *val = qs_get_attr_value(doc,attr);
6537 if (val && STRCASEEQ('s','S',"style", nm)) {
6541 if (IS_CSS_ON(iphone->entryp)) {
6542 css_prop_list_t *style = s_iphone_nopush_and_get_now_style(pdoc, node, attr_style);
6544 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6545 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6546 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
6547 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
6548 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
6549 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
6550 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
6551 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
6552 css_property_t *marquee_speed_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-speed");
6553 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
6555 css_property_t *cur;
6556 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6557 attr_color = apr_pstrdup(doc->pool, cur->value);
6559 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6560 if (cur->value && *cur->value) {
6561 if ( STRCASEEQ('x','X',"xx-small",cur->value)
6562 || STRCASEEQ('x','X',"x-small", cur->value)
6563 || STRCASEEQ('s','S',"small", cur->value)
6564 || STRCASEEQ('m','M',"medium", cur->value)
6565 || STRCASEEQ('l','L',"large", cur->value)
6566 || STRCASEEQ('x','X',"x-large", cur->value)
6567 || STRCASEEQ('x','X',"xx-large",cur->value)) {
6568 attr_size = apr_pstrdup(doc->pool, cur->value);
6572 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
6573 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
6574 attr_blink = apr_pstrdup(doc->pool, cur->value);
6577 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
6578 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
6579 attr_marquee = apr_pstrdup(doc->pool, cur->value);
6582 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
6583 if (cur->value && *cur->value) {
6584 if ( STRCASEEQ('l','L',"ltr",cur->value)
6585 || STRCASEEQ('r','R',"rtl",cur->value)) {
6586 attr_marquee_dir = apr_pstrdup(doc->pool, cur->value);
6590 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
6591 if (cur->value && *cur->value) {
6592 if ( STRCASEEQ('s','S',"scroll",cur->value)
6593 || STRCASEEQ('s','S',"slide",cur->value)
6594 || STRCASEEQ('a','A',"alternate",cur->value)) {
6595 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
6599 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
6600 if (cur->value && *cur->value) {
6601 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
6602 attr_marquee_loop = "infinite";
6605 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
6609 for (cur = marquee_speed_prop->next; cur != marquee_speed_prop; cur = cur->next) {
6610 if (cur->value && *cur->value) {
6611 attr_marquee_speed = apr_pstrdup(doc->pool, cur->value);
6614 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
6615 if (STRCASEEQ('l','L',"left", cur->value)) {
6616 attr_align = apr_pstrdup(doc->pool, "left");
6618 else if (STRCASEEQ('c','C',"center",cur->value)) {
6619 attr_align = apr_pstrdup(doc->pool, "center");
6621 else if (STRCASEEQ('r','R',"right",cur->value)) {
6622 attr_align = apr_pstrdup(doc->pool, "right");
6625 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
6626 if (cur->value && *cur->value) {
6627 css_bgcolor = apr_pstrdup(doc->pool, cur->value);
6636 W_L("overflow:-webkit-marquee;");
6637 if (attr_marquee_style) {
6638 W_L("-webkit-marquee-style:");
6639 W_V(attr_marquee_style);
6642 if (attr_marquee_dir) {
6643 W_L("-webkit-marquee-direction:");
6644 if (STRCASEEQ('r','R',"rtl",attr_marquee_dir)) {
6647 else if (STRCASEEQ('l','L',"ltr",attr_marquee_dir)) {
6652 if (attr_marquee_loop) {
6653 W_L("-webkit-marquee-repetition:");
6654 W_V(attr_marquee_loop);
6657 if (attr_marquee_speed) {
6658 W_L("-webkit-marquee-speed:");
6659 W_V(attr_marquee_speed);
6666 if (attr_color || attr_size || attr_align || attr_blink || attr_marquee || css_bgcolor) {
6669 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6686 if (iphone->blink_keyframe_out == 0) {
6687 iphone->style_data = apr_pstrcat(doc->pool, (iphone->style_data) ? iphone->style_data : "",
6690 iphone->blink_keyframe_out = 1;
6694 W_L("background-color:");
6706 * It is a handler who processes the SPAN tag.
6708 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6709 * destination is specified.
6710 * @param node [i] The SPAN tag node is specified.
6711 * @return The conversion result is returned.
6714 s_iphone_end_span_tag(void *pdoc, Node *UNUSED(node))
6716 iphone_t *iphone = GET_IPHONE(pdoc);
6717 Doc *doc = iphone->doc;
6721 if (IS_CSS_ON(iphone->entryp)) {
6722 chxj_css_pop_prop_list(iphone->css_prop_stack);
6729 * It is a handler who processes the STYLE tag.
6731 * @param pdoc [i/o] The pointer to the SoftBank XHTML structure at the output
6732 * destination is specified.
6733 * @param node [i] The STYLE tag node is specified.
6734 * @return The conversion result is returned.
6737 s_iphone_style_tag(void *pdoc, Node *node)
6746 iphone = GET_IPHONE(pdoc);
6749 if (! IS_CSS_ON(iphone->entryp)) {
6753 for (attr = qs_get_attr(doc,node);
6755 attr = qs_get_next_attr(doc,attr)) {
6756 char *name = qs_get_attr_name(doc,attr);
6757 char *value = qs_get_attr_value(doc,attr);
6758 if (STRCASEEQ('t','T',"type", name)) {
6759 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
6766 for (child = qs_get_child_node(doc, node);
6768 child = qs_get_next_node(doc, child)) {
6769 char *name = qs_get_node_name(doc, child);
6770 if (STRCASEEQ('t','T',"text", name)) {
6771 char *value = qs_get_node_value(doc, child);
6772 if (value && *value) {
6773 style = apr_pstrcat(doc->r->pool, style, value, NULL);
6777 if (strlen(style) > 0) {
6778 DBG(doc->r,"REQ[%X] start load CSS. buf:[%s]", TO_ADDR(doc->r),style);
6779 iphone->style = chxj_css_parse_style_value(doc, iphone->style, style);
6780 DBG(doc->r,"REQ[%X] end load CSS. value:[%s]", TO_ADDR(doc->r),style);
6788 s_iphone_create_style_data(apr_pool_t *pool, const char *style_data)
6793 return apr_pstrcat(pool, "<style type=\"text/css\"><![CDATA[",style_data, "]]></style>", NULL);
6797 * It is a handler who processes the OBJECT tag.
6799 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6800 * destination is specified.
6801 * @param node [i] The OBJECT tag node is specified.
6802 * @return The conversion result is returned.
6805 s_iphone_start_object_tag(void *pdoc, Node *node)
6807 iphone_t *iphone = GET_IPHONE(pdoc);
6808 Doc *doc = iphone->doc;
6811 char *attr_id = NULL;
6812 char *attr_width = NULL;
6813 char *attr_height = NULL;
6814 char *attr_data = NULL;
6815 char *attr_type = NULL;
6816 char *attr_declare = NULL;
6817 char *attr_classid = NULL;
6818 char *attr_codebase = NULL;
6820 /*--------------------------------------------------------------------------*/
6821 /* Get Attributes */
6822 /*--------------------------------------------------------------------------*/
6823 for (attr = qs_get_attr(doc,node);
6825 attr = qs_get_next_attr(doc,attr)) {
6826 char *name = qs_get_attr_name(doc,attr);
6827 char *value = qs_get_attr_value(doc,attr);
6828 if (STRCASEEQ('i','I',"id",name)) {
6829 attr_id = apr_pstrdup(doc->pool, value);
6831 else if (STRCASEEQ('w','W',"width",name)) {
6832 attr_width = apr_pstrdup(doc->pool, value);
6834 else if (STRCASEEQ('h','H',"height",name)) {
6835 attr_height = apr_pstrdup(doc->pool, value);
6837 else if (STRCASEEQ('d','D',"data",name)) {
6838 attr_data = apr_pstrdup(doc->pool, value);
6840 else if (STRCASEEQ('t','T',"type",name)) {
6841 attr_type = apr_pstrdup(doc->pool, value);
6843 else if (STRCASEEQ('d','D',"declare",name)) {
6844 attr_declare = apr_pstrdup(doc->pool, value);
6846 else if (STRCASEEQ('c','C',"classid",name)) {
6847 attr_classid = apr_pstrdup(doc->pool, value);
6849 else if (STRCASEEQ('c','C',"codebase",name)) {
6850 attr_codebase = apr_pstrdup(doc->pool, value);
6882 W_L(" declare=\"declare\"");
6890 W_L(" codebase=\"");
6899 * It is a handler who processes the OBJECT tag.
6901 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6902 * destination is specified.
6903 * @param node [i] The OBJECT tag node is specified.
6904 * @return The conversion result is returned.
6907 s_iphone_end_object_tag(void *pdoc, Node *UNUSED(node))
6909 iphone_t *iphone = GET_IPHONE(pdoc);
6910 Doc *doc = iphone->doc;
6916 * It is a handler who processes the OBJECT tag.
6918 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6919 * destination is specified.
6920 * @param node [i] The OBJECT tag node is specified.
6921 * @return The conversion result is returned.
6924 s_iphone_start_param_tag(void *pdoc, Node *node)
6926 iphone_t *iphone = GET_IPHONE(pdoc);
6927 Doc *doc = iphone->doc;
6930 char *attr_name = NULL;
6931 char *attr_value = NULL;
6932 char *attr_valuetype = NULL;
6934 /*--------------------------------------------------------------------------*/
6935 /* Get Attributes */
6936 /*--------------------------------------------------------------------------*/
6937 for (attr = qs_get_attr(doc,node);
6939 attr = qs_get_next_attr(doc,attr)) {
6940 char *name = qs_get_attr_name(doc,attr);
6941 char *value = qs_get_attr_value(doc,attr);
6942 if (STRCASEEQ('n','N',"name",name)) {
6943 attr_name = apr_pstrdup(doc->pool, value);
6945 else if (STRCASEEQ('v','V',"value",name)) {
6946 attr_value = apr_pstrdup(doc->pool, value);
6948 else if (STRCASEEQ('v','V',"valuetype",name)) {
6949 attr_valuetype = apr_pstrdup(doc->pool, value);
6965 W_L(" valuetype=\"");
6966 W_V(attr_valuetype);
6973 * It is a handler who processes the CAPTION tag.
6975 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
6976 * destination is specified.
6977 * @param node [i] The CAPTION tag node is specified.
6978 * @return The conversion result is returned.
6981 s_iphone_start_caption_tag(void *pdoc, Node *node)
6987 char *attr_style = NULL;
6988 char *attr_align = NULL;
6990 iphone = GET_IPHONE(pdoc);
6994 for (attr = qs_get_attr(doc,node);
6996 attr = qs_get_next_attr(doc,attr)) {
6997 char *name = qs_get_attr_name(doc,attr);
6998 char *value = qs_get_attr_value(doc,attr);
6999 if (STRCASEEQ('a','A',"align", name)) {
7001 (STRCASEEQ('l','L',"left",value)
7002 || STRCASEEQ('r','R',"right",value)
7003 || STRCASEEQ('t','T',"top",value)
7004 || STRCASEEQ('b','B',"bottom",value)
7009 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
7027 * It is a handler who processes the CAPTION tag.
7029 * @param pdoc [i/o] The pointer to the IPHONE structure at the output
7030 * destination is specified.
7031 * @param node [i] The CAPTION tag node is specified.
7032 * @return The conversion result is returned.
7035 s_iphone_end_caption_tag(void *pdoc, Node *UNUSED(child))
7037 iphone_t* iphone = GET_IPHONE(pdoc);
7038 Doc* doc = iphone->doc;