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_android.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_ANDROID(X) ((android_t *)(X))
34 #define W_L(X) do { android->out = BUFFERED_WRITE_LITERAL(android->out, &doc->buf, (X)); } while(0)
35 #define W_V(X) do { android->out = (X) ? BUFFERED_WRITE_VALUE(android->out, &doc->buf, (X)) \
36 : BUFFERED_WRITE_LITERAL(android->out, &doc->buf, ""); } while(0)
38 #define W_NLCODE() do { char *nlcode = TO_NLCODE(android->conf); W_V(nlcode); } while (0)
40 #define BLINK_KEYFRAME \
41 "\n@-webkit-keyframes blink {\n" \
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_android_start_html_tag (void *pdoc, Node *node);
61 static char *s_android_end_html_tag (void *pdoc, Node *node);
62 static char *s_android_start_meta_tag (void *pdoc, Node *node);
63 static char *s_android_end_meta_tag (void *pdoc, Node *node);
64 static char *s_android_start_head_tag (void *pdoc, Node *node);
65 static char *s_android_end_head_tag (void *pdoc, Node *node);
66 static char *s_android_start_title_tag (void *pdoc, Node *node);
67 static char *s_android_end_title_tag (void *pdoc, Node *node);
68 static char *s_android_start_base_tag (void *pdoc, Node *node);
69 static char *s_android_end_base_tag (void *pdoc, Node *node);
70 static char *s_android_start_body_tag (void *pdoc, Node *node);
71 static char *s_android_end_body_tag (void *pdoc, Node *node);
72 static char *s_android_start_a_tag (void *pdoc, Node *node);
73 static char *s_android_end_a_tag (void *pdoc, Node *node);
74 static char *s_android_start_pre_tag (void *pdoc, Node *node);
75 static char *s_android_end_pre_tag (void *pdoc, Node *node);
76 static char *s_android_start_p_tag (void *pdoc, Node *node);
77 static char *s_android_end_p_tag (void *pdoc, Node *node);
78 static char *s_android_start_ul_tag (void *pdoc, Node *node);
79 static char *s_android_end_ul_tag (void *pdoc, Node *node);
80 static char *s_android_start_ol_tag (void *pdoc, Node *node);
81 static char *s_android_end_ol_tag (void *pdoc, Node *node);
82 static char *s_android_start_li_tag (void *pdoc, Node *node);
83 static char *s_android_end_li_tag (void *pdoc, Node *node);
84 static char *s_android_start_br_tag (void *pdoc, Node *node);
85 static char *s_android_end_br_tag (void *pdoc, Node *node);
87 static char *s_android_start_table_tag (void *pdoc, Node *node);
88 static char *s_android_end_table_tag (void *pdoc, Node *node);
89 static char *s_android_start_tr_tag (void *pdoc, Node *node);
90 static char *s_android_end_tr_tag (void *pdoc, Node *node);
91 static char *s_android_start_td_or_th_tag (void *pdoc, Node *node,char *tagName);
92 static char *s_android_end_td_or_th_tag (void *pdoc, Node *node,char *tagName);
93 static char *s_android_start_td_tag (void *pdoc, Node *node);
94 static char *s_android_end_td_tag (void *pdoc, Node *node);
95 static char *s_android_start_th_tag (void *pdoc, Node *node);
96 static char *s_android_end_th_tag (void *pdoc, Node *node);
98 static char *s_android_start_font_tag (void *pdoc, Node *node);
99 static char *s_android_end_font_tag (void *pdoc, Node *node);
100 static char *s_android_start_form_tag (void *pdoc, Node *node);
101 static char *s_android_end_form_tag (void *pdoc, Node *node);
102 static char *s_android_start_input_tag (void *pdoc, Node *node);
103 static char *s_android_end_input_tag (void *pdoc, Node *node);
104 static char *s_android_start_center_tag (void *pdoc, Node *node);
105 static char *s_android_end_center_tag (void *pdoc, Node *node);
106 static char *s_android_start_hr_tag (void *pdoc, Node *node);
107 static char *s_android_end_hr_tag (void *pdoc, Node *node);
108 static char *s_android_start_img_tag (void *pdoc, Node *node);
109 static char *s_android_end_img_tag (void *pdoc, Node *node);
110 static char *s_android_start_select_tag (void *pdoc, Node *node);
111 static char *s_android_end_select_tag (void *pdoc, Node *node);
112 static char *s_android_start_option_tag (void *pdoc, Node *node);
113 static char *s_android_end_option_tag (void *pdoc, Node *node);
114 static char *s_android_start_div_tag (void *pdoc, Node *node);
115 static char *s_android_end_div_tag (void *pdoc, Node *node);
116 static char *s_android_start_textarea_tag (void *pdoc, Node *node);
117 static char *s_android_end_textarea_tag (void *pdoc, Node *node);
118 static char *s_android_start_b_tag (void *pdoc, Node *node);
119 static char *s_android_end_b_tag (void *pdoc, Node *node);
120 static char *s_android_chxjif_tag (void *pdoc, Node *node);
121 static char *s_android_text_tag (void *pdoc, Node *node);
122 static char *s_android_start_blockquote_tag (void *pdoc, Node *node);
123 static char *s_android_end_blockquote_tag (void *pdoc, Node *node);
124 static char *s_android_start_dir_tag (void *pdoc, Node *node);
125 static char *s_android_end_dir_tag (void *pdoc, Node *node);
126 static char *s_android_start_dl_tag (void *pdoc, Node *node);
127 static char *s_android_end_dl_tag (void *pdoc, Node *node);
128 static char *s_android_start_dt_tag (void *pdoc, Node *node);
129 static char *s_android_end_dt_tag (void *pdoc, Node *node);
130 static char *s_android_start_dd_tag (void *pdoc, Node *node);
131 static char *s_android_end_dd_tag (void *pdoc, Node *node);
132 static char *s_android_start_h1_tag (void *pdoc, Node *node);
133 static char *s_android_end_h1_tag (void *pdoc, Node *node);
134 static char *s_android_start_h2_tag (void *pdoc, Node *node);
135 static char *s_android_end_h2_tag (void *pdoc, Node *node);
136 static char *s_android_start_h3_tag (void *pdoc, Node *node);
137 static char *s_android_end_h3_tag (void *pdoc, Node *node);
138 static char *s_android_start_h4_tag (void *pdoc, Node *node);
139 static char *s_android_end_h4_tag (void *pdoc, Node *node);
140 static char *s_android_start_h5_tag (void *pdoc, Node *node);
141 static char *s_android_end_h5_tag (void *pdoc, Node *node);
142 static char *s_android_start_h6_tag (void *pdoc, Node *node);
143 static char *s_android_end_h6_tag (void *pdoc, Node *node);
144 static char *s_android_start_menu_tag (void *pdoc, Node *node);
145 static char *s_android_end_menu_tag (void *pdoc, Node *node);
146 static char *s_android_start_plaintext_tag (void *pdoc, Node *node);
147 static char *s_android_start_plaintext_tag_inner (void *pdoc, Node *node);
148 static char *s_android_end_plaintext_tag (void *pdoc, Node *node);
149 static char *s_android_start_blink_tag (void *pdoc, Node *node);
150 static char *s_android_end_blink_tag (void *pdoc, Node *node);
151 static char *s_android_start_marquee_tag (void *pdoc, Node *node);
152 static char *s_android_end_marquee_tag (void *pdoc, Node *node);
153 static char *s_android_newline_mark (void *pdoc, Node *node);
154 static char *s_android_link_tag (void *pdoc, Node *node);
155 static char *s_android_start_span_tag (void *pdoc, Node *node);
156 static char *s_android_end_span_tag (void *pdoc, Node *node);
157 static char *s_android_style_tag (void *pdoc, Node *node);
158 static char *s_android_start_object_tag (void *pdoc, Node *node);
159 static char *s_android_end_object_tag (void *pdoc, Node *node);
160 static char *s_android_start_param_tag (void *pdoc, Node *node);
161 static char *s_android_start_caption_tag (void *pdoc, Node *node);
162 static char *s_android_end_caption_tag (void *pdoc, Node *node);
164 static void s_init_android(android_t *android, Doc *doc, request_rec *r, device_table *spec);
166 static int s_android_search_emoji(android_t *android, char *txt, char **rslt);
168 static css_prop_list_t *s_android_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
169 static css_prop_list_t *s_android_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
170 static char *s_android_create_style_data(apr_pool_t *pool, const char *style_data);
174 tag_handler android_handler[] = {
177 s_android_start_html_tag,
178 s_android_end_html_tag,
182 s_android_start_meta_tag,
183 s_android_end_meta_tag,
187 s_android_start_textarea_tag,
188 s_android_end_textarea_tag,
192 s_android_start_p_tag,
197 s_android_start_pre_tag,
198 s_android_end_pre_tag,
202 s_android_start_ul_tag,
203 s_android_end_ul_tag,
207 s_android_start_li_tag,
208 s_android_end_li_tag,
212 s_android_start_ol_tag,
213 s_android_end_ol_tag,
217 s_android_start_h1_tag,
218 s_android_end_h1_tag,
222 s_android_start_h2_tag,
223 s_android_end_h2_tag,
227 s_android_start_h3_tag,
228 s_android_end_h3_tag,
232 s_android_start_h4_tag,
233 s_android_end_h4_tag,
237 s_android_start_h5_tag,
238 s_android_end_h5_tag,
242 s_android_start_h6_tag,
243 s_android_end_h6_tag,
247 s_android_start_head_tag,
248 s_android_end_head_tag,
252 s_android_start_title_tag,
253 s_android_end_title_tag,
257 s_android_start_base_tag,
258 s_android_end_base_tag,
262 s_android_start_body_tag,
263 s_android_end_body_tag,
267 s_android_start_a_tag,
272 s_android_start_br_tag,
273 s_android_end_br_tag,
277 s_android_start_table_tag,
278 s_android_end_table_tag,
282 s_android_start_tr_tag,
283 s_android_end_tr_tag,
287 s_android_start_td_tag,
288 s_android_end_td_tag,
297 s_android_start_font_tag,
298 s_android_end_font_tag,
302 s_android_start_form_tag,
303 s_android_end_form_tag,
307 s_android_start_input_tag,
308 s_android_end_input_tag,
312 s_android_start_center_tag,
313 s_android_end_center_tag,
317 s_android_start_hr_tag,
318 s_android_end_hr_tag,
322 s_android_start_img_tag,
323 s_android_end_img_tag,
327 s_android_start_select_tag,
328 s_android_end_select_tag,
332 s_android_start_option_tag,
333 s_android_end_option_tag,
337 s_android_start_div_tag,
338 s_android_end_div_tag,
342 s_android_chxjif_tag,
347 s_android_chxjif_tag,
367 s_android_start_span_tag,
368 s_android_end_span_tag,
377 s_android_start_th_tag,
378 s_android_end_th_tag,
382 s_android_start_b_tag,
392 s_android_start_dt_tag,
393 s_android_end_dt_tag,
407 s_android_start_blockquote_tag,
408 s_android_end_blockquote_tag,
412 s_android_start_dir_tag,
413 s_android_end_dir_tag,
417 s_android_start_dl_tag,
418 s_android_end_dl_tag,
422 s_android_start_dd_tag,
423 s_android_end_dd_tag,
427 s_android_start_menu_tag,
428 s_android_end_menu_tag,
432 s_android_start_plaintext_tag,
433 s_android_end_plaintext_tag,
437 s_android_start_blink_tag,
438 s_android_end_blink_tag,
442 s_android_start_marquee_tag,
443 s_android_end_marquee_tag,
452 s_android_newline_mark,
457 s_android_start_object_tag,
458 s_android_end_object_tag,
462 s_android_start_param_tag,
467 s_android_start_caption_tag,
468 s_android_end_caption_tag,
474 * converts from CHTML5.0 to ANDROID.
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.
483 chxj_convert_android(
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_android(&android, &doc, r, spec);
515 android.entryp = entryp;
516 android.cookie = cookie;
517 android.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(android.entryp)) {
535 /* current property list */
536 android.css_prop_stack = chxj_new_prop_list_stack(&doc);
539 chxj_dump_out("[src] CHTML -> ANDROID", 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 ANDROID. */
547 /*--------------------------------------------------------------------------*/
548 chxj_node_convert(spec,r,(void*)&android, &doc, qs_get_root(&doc), 0);
549 android.out = chxj_buffered_write_flush(android.out, &doc.buf);
550 dst = apr_pstrcat(r->pool, (! android.prev_style_data) ? "" : android.prev_style_data,
551 s_android_create_style_data(doc.pool, android.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 -> ANDROID", dst, *dstlen);
575 * The ANDROID structure is initialized.
577 * @param android [i/o] The pointer to the ANDROID structure that wants to be
578 * initialized is specified.
579 * @param doc [i] The Doc structure that should be set to the initialized
580 * ANDROID 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_android(android_t *android, Doc *doc, request_rec *r, device_table *spec)
587 memset(doc, 0, sizeof(Doc));
588 memset(android, 0, sizeof(android_t));
592 android->spec = spec;
593 android->out = qs_alloc_zero_byte_string(r->pool);
594 android->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
595 android->doc->parse_mode = PARSE_MODE_CHTML;
596 android->prev_style_data = NULL;
597 android->style_data = NULL;
598 android->blink_keyframe_out = 0;
599 android->charset_out = 0;
604 * Corresponding EMOJI to a current character-code is retrieved.
605 * The substitution character string is stored in the rslt pointer if agreeing.
607 * @param android [i] The pointer to the ANDROID structure is specified.
608 * @param txt [i] The character string to want to examine whether it is
609 * EMOJI is specified.
610 * @param rslt [o] The pointer to the pointer that stores the result is
612 * @return When corresponding EMOJI exists, it returns it excluding 0.
615 s_android_search_emoji(android_t *android, char *txt, char **rslt)
622 spec = android->spec;
627 if (! spec) DBG(r,"REQ[%X] spec is NULL",TO_ADDR(r));
629 if (spec->html_spec_type == CHXJ_SPEC_docomo_android) {
630 /*=======================================================================*/
632 /*=======================================================================*/
633 for (ee = android->conf->emoji;
636 if (ee->imode == NULL) {
637 DBG(r,"REQ[%X] emoji->imode is NULL",TO_ADDR(r));
641 if (ee->imode->string != NULL
642 && strlen(ee->imode->string) > 0
643 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
645 if (spec == NULL || spec->emoji_type == NULL) {
646 *rslt = apr_palloc(r->pool, 3);
647 (*rslt)[0] = ee->imode->hex1byte & 0xff;
648 (*rslt)[1] = ee->imode->hex2byte & 0xff;
651 return strlen(ee->imode->string);
658 else if (spec->html_spec_type == CHXJ_SPEC_au_android) {
659 /*=======================================================================*/
661 /*=======================================================================*/
662 for (ee = android->conf->emoji;
665 unsigned char hex1byte;
666 unsigned char hex2byte;
668 DBG(r,"REQ[%X] emoji->imode is NULL",TO_ADDR(r));
672 if (ee->imode->string != NULL
673 && strlen(ee->imode->string) > 0
674 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
675 if (spec == NULL || spec->emoji_type == NULL) {
676 if (ee->ezweb != NULL && ee->ezweb->typeA != NULL) {
677 if (android->conf->use_emoji_image
678 && android->conf->emoji_image_url
679 && strcasecmp(ee->ezweb->typeA,"image") == 0) {
680 *rslt = apr_psprintf(r->pool, "<img src=\"%s/%d\" />",android->conf->emoji_image_url, ee->no);
682 else if (strncasecmp(ee->ezweb->typeA,"raw:",4) == 0) {
683 *rslt = apr_psprintf(r->pool,"%s",&(ee->ezweb->typeA[4]));
686 *rslt = apr_psprintf(r->pool,
691 return strlen(ee->imode->string);
694 if (strcasecmp(android->spec->emoji_type, "a") == 0) {
695 if (ee->ezweb != NULL && ee->ezweb->typeA != NULL) {
696 if (android->conf->use_emoji_image
697 && android->conf->emoji_image_url
698 && strcasecmp(ee->ezweb->typeA,"image") == 0) {
699 *rslt = apr_psprintf(r->pool, "<img src=\"%s/%d\" />",android->conf->emoji_image_url, ee->no);
701 else if (strncasecmp(ee->ezweb->typeA,"raw:",4) == 0) {
702 *rslt = apr_psprintf(r->pool,"%s",&(ee->ezweb->typeA[4]));
705 *rslt = apr_psprintf(r->pool,
710 return strlen(ee->imode->string);
713 if (strcasecmp(android->spec->emoji_type, "b") == 0) {
714 if (ee->ezweb != NULL && ee->ezweb->typeB != NULL) {
715 if (android->conf->use_emoji_image
716 && android->conf->emoji_image_url
717 && strcasecmp(ee->ezweb->typeB,"image") == 0) {
718 *rslt = apr_psprintf(r->pool, "<img src=\"%s/%d\" />",android->conf->emoji_image_url, ee->no);
720 else if (strncasecmp(ee->ezweb->typeB,"raw:",4) == 0) {
721 *rslt = apr_psprintf(r->pool,"%s",&(ee->ezweb->typeB[4]));
724 *rslt = apr_psprintf(r->pool,
729 return strlen(ee->imode->string);
732 if (strcasecmp(android->spec->emoji_type, "c") == 0) {
733 if (ee->ezweb != NULL && ee->ezweb->typeC != NULL) {
734 if (android->conf->use_emoji_image
735 && android->conf->emoji_image_url
736 && strcasecmp(ee->ezweb->typeC,"image") == 0) {
737 *rslt = apr_psprintf(r->pool, "<img src=\"%s/%d\" />",android->conf->emoji_image_url, ee->no);
739 else if (strncasecmp(ee->ezweb->typeC,"raw:",4) == 0) {
740 *rslt = apr_psprintf(r->pool,"%s",&(ee->ezweb->typeC[4]));
743 *rslt = apr_psprintf(r->pool,
748 return strlen(ee->imode->string);
751 if (strcasecmp(android->spec->emoji_type, "d") == 0) {
752 if (ee->ezweb != NULL && ee->ezweb->typeD != NULL) {
753 if (android->conf->use_emoji_image
754 && android->conf->emoji_image_url
755 && strcasecmp(ee->ezweb->typeD,"image") == 0) {
756 *rslt = apr_psprintf(r->pool, "<img src=\"%s/%d\" />",android->conf->emoji_image_url, ee->no);
758 else if (strncasecmp(ee->ezweb->typeD,"raw:",4) == 0) {
759 *rslt = apr_psprintf(r->pool,"%s",&(ee->ezweb->typeD[4]));
762 *rslt = apr_psprintf(r->pool,
767 return strlen(ee->imode->string);
770 if (ee->ezweb != NULL && ee->ezweb->typeA != NULL) {
771 if (android->conf->use_emoji_image
772 && android->conf->emoji_image_url
773 && strcasecmp(ee->ezweb->typeA,"image") == 0) {
774 *rslt = apr_psprintf(r->pool, "<img src=\"%s/%d\" />",android->conf->emoji_image_url, ee->no);
776 else if (strncasecmp(ee->ezweb->typeA,"raw:",4) == 0) {
777 *rslt = apr_psprintf(r->pool,"%s",&(ee->ezweb->typeA[4]));
780 *rslt = apr_psprintf(r->pool,
785 return strlen(ee->imode->string);
789 hex1byte = ee->imode->hex1byte & 0xff;
790 hex2byte = ee->imode->hex2byte & 0xff;
792 && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
793 && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
794 if (spec == NULL || spec->emoji_type == NULL) {
795 if (ee->ezweb != NULL && ee->ezweb->typeA != NULL) {
796 if (android->conf->use_emoji_image
797 && android->conf->emoji_image_url
798 && strcasecmp(ee->ezweb->typeA,"image") == 0) {
799 *rslt = apr_psprintf(r->pool, "<img src=\"%s/%d\" />",android->conf->emoji_image_url, ee->no);
801 else if (strncasecmp(ee->ezweb->typeA,"raw:",4) == 0) {
802 *rslt = apr_psprintf(r->pool,"%s",&(ee->ezweb->typeA[4]));
805 *rslt = apr_psprintf(r->pool,
806 "<img localsrc=\"%s\">",
813 if (strcasecmp(android->spec->emoji_type, "a") == 0) {
814 if (ee->ezweb != NULL && ee->ezweb->typeA != NULL) {
815 if (android->conf->use_emoji_image
816 && android->conf->emoji_image_url
817 && strcasecmp(ee->ezweb->typeA,"image") == 0) {
818 *rslt = apr_psprintf(r->pool, "<img src=\"%s/%d\" />",android->conf->emoji_image_url, ee->no);
820 else if (strncasecmp(ee->ezweb->typeA,"raw:",4) == 0) {
821 *rslt = apr_psprintf(r->pool,"%s",&(ee->ezweb->typeA[4]));
824 *rslt = apr_psprintf(r->pool,
825 "<img localsrc=\"%s\">",
832 if (strcasecmp(android->spec->emoji_type, "b") == 0) {
833 if (ee->ezweb != NULL && ee->ezweb->typeB != NULL) {
834 if (android->conf->use_emoji_image
835 && android->conf->emoji_image_url
836 && strcasecmp(ee->ezweb->typeB,"image") == 0) {
837 *rslt = apr_psprintf(r->pool, "<img src=\"%s/%d\" />",android->conf->emoji_image_url, ee->no);
839 else if (strncasecmp(ee->ezweb->typeB,"raw:",4) == 0) {
840 *rslt = apr_psprintf(r->pool,"%s",&(ee->ezweb->typeB[4]));
843 *rslt = apr_psprintf(r->pool,
844 "<img localsrc=\"%s\">",
851 if (strcasecmp(android->spec->emoji_type, "c") == 0) {
852 if (ee->ezweb != NULL && ee->ezweb->typeC != NULL) {
853 if (android->conf->use_emoji_image
854 && android->conf->emoji_image_url
855 && strcasecmp(ee->ezweb->typeC,"image") == 0) {
856 *rslt = apr_psprintf(r->pool, "<img src=\"%s/%d\" />",android->conf->emoji_image_url, ee->no);
858 else if (strncasecmp(ee->ezweb->typeC,"raw:",4) == 0) {
859 *rslt = apr_psprintf(r->pool,"%s",&(ee->ezweb->typeC[4]));
862 *rslt = apr_psprintf(r->pool,
863 "<img localsrc=\"%s\">",
870 if (strcasecmp(android->spec->emoji_type, "d") == 0) {
871 if (ee->ezweb != NULL && ee->ezweb->typeD != NULL) {
872 if (android->conf->use_emoji_image
873 && android->conf->emoji_image_url
874 && strcasecmp(ee->ezweb->typeD,"image") == 0) {
875 *rslt = apr_psprintf(r->pool, "<img src=\"%s/%d\" />",android->conf->emoji_image_url, ee->no);
877 else if (strncasecmp(ee->ezweb->typeD,"raw:",4) == 0) {
878 *rslt = apr_psprintf(r->pool,"%s",&(ee->ezweb->typeD[4]));
881 *rslt = apr_psprintf(r->pool,
882 "<img localsrc=\"%s\">",
889 if (ee->ezweb != NULL && ee->ezweb->typeA != NULL) {
890 if (android->conf->use_emoji_image
891 && android->conf->emoji_image_url
892 && strcasecmp(ee->ezweb->typeA,"image") == 0) {
893 *rslt = apr_psprintf(r->pool, "<img src=\"%s/%d\" />",android->conf->emoji_image_url, ee->no);
895 else if (strncasecmp(ee->ezweb->typeA,"raw:",4) == 0) {
896 *rslt = apr_psprintf(r->pool,"%s",&(ee->ezweb->typeA[4]));
899 *rslt = apr_psprintf(r->pool,
900 "<img localsrc=\"%s\">",
910 else if (spec->html_spec_type == CHXJ_SPEC_softbank_android) {
911 /*=======================================================================*/
913 /*=======================================================================*/
914 for (ee = android->conf->emoji;
918 unsigned char hex1byte;
919 unsigned char hex2byte;
922 DBG(r,"REQ[%X] emoji->imode is NULL",TO_ADDR(r));
926 hex1byte = ee->imode->hex1byte & 0xff;
927 hex2byte = ee->imode->hex2byte & 0xff;
929 if (ee->imode->string
930 && strlen(ee->imode->string) > 0
931 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
932 if (spec == NULL || spec->emoji_type == NULL) {
933 if (ee->iphone != NULL && ee->iphone->string != NULL) {
934 if (android->conf->use_emoji_image
935 && android->conf->emoji_image_url
936 && (spec->html_spec_type == CHXJ_SPEC_iPhone2
937 || strcasecmp(ee->iphone->string,"image") == 0)) {
938 *rslt = apr_psprintf(r->pool, "<img src=\"%s/%d\" />",android->conf->emoji_image_url, ee->no);
940 else if (strncasecmp(ee->iphone->string, "raw:", 4) == 0) {
941 *rslt = apr_psprintf(r->pool,"%s", &(ee->iphone->string[4]));
944 *rslt = apr_psprintf(r->pool,"%s;", ee->iphone->string);
947 return strlen(ee->imode->string);
953 && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
954 && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
955 if (spec == NULL || spec->emoji_type == NULL) {
956 if (ee->iphone != NULL && ee->iphone->string != NULL) {
957 if (android->conf->use_emoji_image
958 && android->conf->emoji_image_url
959 && (spec->html_spec_type == CHXJ_SPEC_iPhone2
960 || strcasecmp(ee->iphone->string,"image") == 0)) {
961 *rslt = apr_psprintf(r->pool, "<img src=\"%s/%d\" />",android->conf->emoji_image_url, ee->no);
963 else if (strncasecmp(ee->iphone->string, "raw:", 4) == 0) {
964 *rslt = apr_psprintf(r->pool,"%s", &(ee->iphone->string[4]));
967 *rslt = apr_psprintf(r->pool,"%s;", ee->iphone->string);
977 else if (spec->html_spec_type == CHXJ_SPEC_android) {
978 /*=======================================================================*/
980 /*=======================================================================*/
981 for (ee = android->conf->emoji;
985 unsigned char hex1byte;
986 unsigned char hex2byte;
989 DBG(r,"REQ[%X] emoji->imode is NULL",TO_ADDR(r));
993 hex1byte = ee->imode->hex1byte & 0xff;
994 hex2byte = ee->imode->hex2byte & 0xff;
996 if (ee->imode->string
997 && strlen(ee->imode->string) > 0
998 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
999 if (spec == NULL || spec->emoji_type == NULL) {
1000 if (ee->android != NULL && ee->android->string != NULL) {
1001 if (android->conf->use_emoji_image
1002 && android->conf->emoji_image_url
1003 && strcasecmp(ee->android->string,"image") == 0) {
1004 *rslt = apr_psprintf(r->pool, "<img src=\"%s/%d\" />",android->conf->emoji_image_url, ee->no);
1006 else if (strncasecmp(ee->android->string, "raw:", 4) == 0) {
1007 *rslt = apr_psprintf(r->pool,"%s", &(ee->android->string[4]));
1009 else if (strcasecmp(ee->android->string, "image") != 0) {
1010 *rslt = apr_psprintf(r->pool,"%s;", ee->android->string);
1013 ERR(r, "Please set ChxjUseEmojiImage and ChxjEmojiImageUrl directives.");
1016 return strlen(ee->imode->string);
1022 && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
1023 && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
1024 if (spec == NULL || spec->emoji_type == NULL) {
1025 if (ee->android != NULL && ee->android->string != NULL) {
1026 if (android->conf->use_emoji_image
1027 && android->conf->emoji_image_url
1028 && strcasecmp(ee->android->string,"image") == 0) {
1029 *rslt = apr_psprintf(r->pool, "<img src=\"%s/%d\" />",android->conf->emoji_image_url, ee->no);
1031 else if (strncasecmp(ee->android->string, "raw:", 4) == 0) {
1032 *rslt = apr_psprintf(r->pool,"%s", &(ee->android->string[4]));
1035 *rslt = apr_psprintf(r->pool,"%s;", ee->android->string);
1050 chxj_android_emoji_only_converter(request_rec *r, device_table *spec, const char *src, apr_size_t len)
1055 android_t __android;
1061 android = &__android;
1064 DBG(r,"REQ[%X] start %s()",TO_ADDR(r),__func__);
1065 memset(doc, 0, sizeof(Doc));
1066 memset(android, 0, sizeof(android_t));
1070 android->spec = spec;
1071 android->out = qs_alloc_zero_byte_string(r->pool);
1072 android->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
1073 android->doc->parse_mode = PARSE_MODE_CHTML;
1075 apr_pool_create(&pool, r->pool);
1077 chxj_buffered_write_init(pool, &doc->buf);
1079 for (ii=0; ii<len; ii++) {
1083 rtn = s_android_search_emoji(android, (char *)&src[ii], &out);
1090 if (is_sjis_kanji(src[ii])) {
1091 two_byte[0] = src[ii+0];
1092 two_byte[1] = src[ii+1];
1098 one_byte[0] = src[ii+0];
1103 android->out = chxj_buffered_write_flush(android->out, &doc->buf);
1105 DBG(r,"REQ[%X] end %s()",TO_ADDR(r),__func__);
1106 return android->out;
1111 * It is a handler who processes the HTML tag.
1113 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
1114 * destination is specified.
1115 * @param node [i] The HTML tag node is specified.
1116 * @return The conversion result is returned.
1119 s_android_start_html_tag(void *pdoc, Node *UNUSED(node))
1126 android = GET_ANDROID(pdoc);
1129 DBG(r,"REQ[%X] start %s()",TO_ADDR(r),__func__);
1131 W_L("<?xml version=\"1.0\" encoding=\"");
1132 W_V(android->spec->output_encoding);
1135 W_L("<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.1//EN\" \"http://www.openmobilealliance.org/tech/DTD/xhtml-mobile11.dtd\">");
1139 /*--------------------------------------------------------------------------*/
1140 /* start HTML tag */
1141 /*--------------------------------------------------------------------------*/
1142 W_L("<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"ja\" xml:lang=\"ja\">");
1144 android->start_html_flag = 1;
1146 DBG(r,"REQ[%X] end %s()",TO_ADDR(r),__func__);
1148 return android->out;
1153 * It is a handler who processes the HTML tag.
1155 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
1156 * destination is specified.
1157 * @param node [i] The HTML tag node is specified.
1158 * @return The conversion result is returned.
1161 s_android_end_html_tag(void *pdoc, Node *UNUSED(child))
1163 android_t *android = GET_ANDROID(pdoc);
1164 Doc *doc = android->doc;
1168 return android->out;
1173 * It is a handler who processes the META tag.
1175 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
1176 * destination is specified.
1177 * @param node [i] The META tag node is specified.
1178 * @return The conversion result is returned.
1181 s_android_start_meta_tag(void *pdoc, Node *node)
1187 int content_type_flag;
1190 android = GET_ANDROID(pdoc);
1194 content_type_flag = 0;
1197 /*--------------------------------------------------------------------------*/
1198 /* Get Attributes */
1199 /*--------------------------------------------------------------------------*/
1200 for (attr = qs_get_attr(doc,node);
1202 attr = qs_get_next_attr(doc,attr)) {
1203 char *name = qs_get_attr_name(doc,attr);
1204 char *value = qs_get_attr_value(doc,attr);
1208 if (strcasecmp(name, "http-equiv") == 0 && value && *value) {
1209 /*----------------------------------------------------------------------*/
1211 /*----------------------------------------------------------------------*/
1212 W_L(" http-equiv=\"");
1215 if (STRCASEEQ('c','C',"content-type",value)) {
1216 content_type_flag = 1;
1218 if (STRCASEEQ('r','R',"refresh",value)) {
1226 if (strcasecmp(name, "content") == 0 && value && *value) {
1227 /*----------------------------------------------------------------------*/
1229 /*----------------------------------------------------------------------*/
1230 if (content_type_flag) {
1234 W_V(chxj_header_inf_set_content_type(r, "application/xhtml+xml; charset=SHIFT_JIS"));
1243 buf = apr_pstrdup(r->pool, value);
1245 url = strchr(buf, ';');
1247 sec = apr_pstrdup(r->pool, buf);
1250 url = chxj_encoding_parameter(r, url, 1);
1271 if (strcasecmp(name, "name") == 0 && value && *value) {
1283 if (content_type_flag) {
1284 android->charset_out = 1;
1286 return android->out;
1291 * It is a handler who processes the META tag.
1293 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
1294 * destination is specified.
1295 * @param node [i] The META tag node is specified.
1296 * @return The conversion result is returned.
1299 s_android_end_meta_tag(void *pdoc, Node *UNUSED(child))
1301 android_t *android = GET_ANDROID(pdoc);
1303 return android->out;
1308 * It is a handler who processes the HEAD tag.
1310 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
1311 * destination is specified.
1312 * @param node [i] The HEAD tag node is specified.
1313 * @return The conversion result is returned.
1316 s_android_start_head_tag(void *pdoc, Node *node)
1324 android = GET_ANDROID(pdoc);
1327 android->head_tag_out = 1;
1331 /* search <meta name="viewport"> */
1332 int found_viewport = 0;
1333 for (child = qs_get_child_node(doc,node);
1335 child = qs_get_next_node(doc,child)) {
1336 char *name = qs_get_node_name(doc,child);
1340 if (strcasecmp("meta",name) == 0) {
1341 for (attr = qs_get_attr(doc,child);
1343 attr = qs_get_next_attr(doc,attr)) {
1344 char *aname = qs_get_attr_name(doc,attr);
1345 char *avalue = qs_get_attr_value(doc,attr);
1346 if (STRCASEEQ('n','N',"name",aname)) {
1347 if (STRCASEEQ('v','V',"viewport",avalue)) {
1349 DBG(r, "REQ[%X] viewport Found!!",TO_ADDR(r));
1360 if (found_viewport) {
1365 if (!found_viewport) {
1367 W_L("name=\"viewport\" ");
1368 W_L("id=\"android-viewport\" ");
1369 W_L("content=\"width=");
1370 char *ww = apr_psprintf(r->pool, "%d", (int)((double)android->spec->width * (double)1.5) - ADJUST_WIDTH_FOR_ANDROID);
1372 W_L(",user-scalable=no,maximum-scale=0.6667\" />");
1373 W_L("<meta name=\"format-detection\" content=\"telephone=no\" />");
1375 if (!android->charset_out) {
1376 W_L("<meta http-equiv=\"Content-Type\" content=\"application/xhtml+xml; charset=UTF-8\" />");
1377 W_L("<meta charset=\"UTF-8\" />");
1378 android->charset_out = 1;
1380 return android->out;
1385 * It is a handler who processes the HEAD tag.
1387 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
1388 * destination is specified.
1389 * @param node [i] The HEAD tag node is specified.
1390 * @return The conversion result is returned.
1393 s_android_end_head_tag(void *pdoc, Node *UNUSED(child))
1399 android = GET_ANDROID(pdoc);
1403 android->out = chxj_buffered_write_flush(android->out, &doc->buf);
1404 android->prev_style_data = apr_pstrdup(doc->pool, android->out);
1405 android->out = qs_alloc_zero_byte_string(r->pool);
1408 return android->out;
1413 * It is a handler who processes the TITLE tag.
1415 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
1416 * destination is specified.
1417 * @param node [i] The TITLE tag node is specified.
1418 * @return The conversion result is returned.
1421 s_android_start_title_tag(void *pdoc, Node *node)
1427 android = GET_ANDROID(pdoc);
1432 if (android->conf->use_google_analytics) {
1433 android->pagetitle = "";
1435 for (child = qs_get_child_node(doc,node);
1437 child = qs_get_next_node(doc,child)) {
1438 char *textval = qs_get_node_value(doc,child);
1439 android->pagetitle = apr_pstrcat(doc->r->pool, android->pagetitle, textval, NULL);
1443 return android->out;
1448 * It is a handler who processes the TITLE tag.
1450 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
1451 * destination is specified.
1452 * @param node [i] The TITLE tag node is specified.
1453 * @return The conversion result is returned.
1456 s_android_end_title_tag(void *pdoc, Node *UNUSED(child))
1462 android = GET_ANDROID(pdoc);
1467 return android->out;
1472 * It is a handler who processes the BASE tag.
1474 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
1475 * destination is specified.
1476 * @param node [i] The BASE tag node is specified.
1477 * @return The conversion result is returned.
1480 s_android_start_base_tag(void *pdoc, Node *node)
1487 android = GET_ANDROID(pdoc);
1492 /*--------------------------------------------------------------------------*/
1493 /* Get Attributes */
1494 /*--------------------------------------------------------------------------*/
1495 for (attr = qs_get_attr(doc,node);
1497 attr = qs_get_next_attr(doc,attr)) {
1498 char *name = qs_get_attr_name(doc,attr);
1499 char *value = qs_get_attr_value(doc,attr);
1500 if (STRCASEEQ('h','H',"href",name)) {
1507 return android->out;
1512 * It is a handler who processes the BASE tag.
1514 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
1515 * destination is specified.
1516 * @param node [i] The BASE tag node is specified.
1517 * @return The conversion result is returned.
1520 s_android_end_base_tag(void *pdoc, Node *UNUSED(child))
1522 android_t *android = GET_ANDROID(pdoc);
1523 return android->out;
1528 * It is a handler who processes the BODY tag.
1530 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
1531 * destination is specified.
1532 * @param node [i] The BODY tag node is specified.
1533 * @return The conversion result is returned.
1536 s_android_start_body_tag(void *pdoc, Node *node)
1542 char *attr_bgcolor = NULL;
1543 char *attr_text = NULL;
1544 char *attr_link = NULL;
1545 char *attr_vlink = NULL;
1546 char *attr_alink = NULL;
1547 char *attr_style = NULL;
1548 char *attr_background = NULL;
1549 char *style_data = NULL;
1551 android = GET_ANDROID(pdoc);
1556 /*--------------------------------------------------------------------------*/
1557 /* Get Attributes */
1558 /*--------------------------------------------------------------------------*/
1559 for (attr = qs_get_attr(doc,node);
1561 attr = qs_get_next_attr(doc,attr)) {
1562 char *name = qs_get_attr_name(doc,attr);
1563 char *value = qs_get_attr_value(doc,attr);
1564 if (STRCASEEQ('b','B',"bgcolor",name) && value && *value) {
1565 /*----------------------------------------------------------------------*/
1567 /*----------------------------------------------------------------------*/
1568 attr_bgcolor = value;
1570 else if (STRCASEEQ('t','T',"text",name) && value && *value) {
1571 /*----------------------------------------------------------------------*/
1573 /*----------------------------------------------------------------------*/
1576 else if (STRCASEEQ('l','L',"link",name) && value && *value) {
1577 /*----------------------------------------------------------------------*/
1579 /*----------------------------------------------------------------------*/
1582 else if (STRCASEEQ('a','A',"alink",name)) {
1583 /*----------------------------------------------------------------------*/
1585 /*----------------------------------------------------------------------*/
1588 else if (STRCASEEQ('v','V',"vlink",name)) {
1589 /*----------------------------------------------------------------------*/
1591 /*----------------------------------------------------------------------*/
1594 else if (STRCASEEQ('b','B',"background",name) && value && *value) {
1595 /*----------------------------------------------------------------------*/
1597 /*----------------------------------------------------------------------*/
1598 attr_background = value;
1600 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1605 if (IS_CSS_ON(android->entryp)) {
1606 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
1608 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1609 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1610 css_property_t *bgimage_prop = chxj_css_get_property_value(doc, style, "background-image");
1611 css_property_t *cur;
1612 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1613 if (cur->value && *cur->value) {
1614 attr_text = apr_pstrdup(doc->pool, cur->value);
1617 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1618 if (cur->value && *cur->value) {
1619 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1622 for (cur = bgimage_prop->next; cur != bgimage_prop; cur = cur->next) {
1623 if (cur->value && *cur->value) {
1624 char *tmp = apr_pstrdup(doc->pool, cur->value);
1625 char *tmps = strstr(tmp,"(");
1627 char *tmpe = strstr(tmp,")");
1628 size_t len = strlen(tmps) - strlen(tmpe) -1 ;
1630 attr_background = apr_pstrndup(doc->pool, tmps,len);
1635 if (android->style) {
1636 css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, android->style);
1637 css_selector_t *cur_sel;
1638 for (cur_sel = pseudos->selector_head.next; cur_sel != &pseudos->selector_head; cur_sel = cur_sel->next) {
1639 if (cur_sel->name && strcasecmp(cur_sel->name, "a:link") == 0) {
1640 css_property_t *cur;
1641 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1642 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1643 attr_link = apr_pstrdup(doc->pool, cur->value);
1647 else if (cur_sel->name && strcasecmp(cur_sel->name, "a:visited") == 0) {
1648 css_property_t *cur;
1649 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1650 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1651 attr_vlink = apr_pstrdup(doc->pool, cur->value);
1661 if (attr_bgcolor || attr_text) {
1664 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1665 W_L("background-color:");
1670 attr_text = chxj_css_rgb_func_to_value(doc->pool, attr_text);
1678 attr_link = chxj_css_rgb_func_to_value(doc->pool, attr_link);
1684 attr_vlink = chxj_css_rgb_func_to_value(doc->pool, attr_vlink);
1690 attr_alink = chxj_css_rgb_func_to_value(doc->pool, attr_alink);
1691 style_data = apr_pstrcat(doc->pool, (style_data) ? style_data : "",
1692 apr_psprintf(doc->pool, "a:focus { color:%s; }", attr_alink), NULL);
1694 if (attr_background) {
1695 W_L(" background=\"");
1696 W_V(attr_background);
1700 android->style_data = apr_pstrcat(doc->pool, (android->style_data) ? android->style_data : "",
1705 return android->out;
1710 * It is a handler who processes the BODY tag.
1712 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
1713 * destination is specified.
1714 * @param node [i] The BODY tag node is specified.
1715 * @return The conversion result is returned.
1718 s_android_end_body_tag(void *pdoc, Node *UNUSED(child))
1724 android = GET_ANDROID(pdoc);
1728 if (android->conf->use_google_analytics) {
1729 char *src = chxj_google_analytics_get_image_url(r, android->pagetitle);
1734 W_L("</div></body>");
1735 if (IS_CSS_ON(android->entryp)) {
1736 chxj_css_pop_prop_list(android->css_prop_stack);
1738 return android->out;
1743 * It is a handler who processes the A tag.
1745 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
1746 * destination is specified.
1747 * @param node [i] The A tag node is specified.
1748 * @return The conversion result is returned.
1751 s_android_start_a_tag(void *pdoc, Node *node)
1757 char *attr_style = NULL;
1758 char *attr_id = NULL;
1759 char *attr_name = NULL;
1761 android = GET_ANDROID(pdoc);
1766 /*--------------------------------------------------------------------------*/
1767 /* Get Attributes */
1768 /*--------------------------------------------------------------------------*/
1769 for (attr = qs_get_attr(doc,node);
1771 attr = qs_get_next_attr(doc,attr)) {
1772 char *name = qs_get_attr_name(doc,attr);
1773 char *value = qs_get_attr_value(doc,attr);
1774 if (STRCASEEQ('i','I',"id",name)){
1775 attr_id = chxj_jreserved_to_safe_tag(r, value, android->entryp);
1777 else if (STRCASEEQ('n','N',"name",name)) {
1778 attr_name = chxj_jreserved_to_safe_tag(r, value, android->entryp);
1780 else if (STRCASEEQ('h','H',"href",name)) {
1781 /*----------------------------------------------------------------------*/
1783 /*----------------------------------------------------------------------*/
1784 value = chxj_encoding_parameter(r, value, 1);
1785 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1786 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, android->entryp, 1);
1792 else if (STRCASEEQ('a','A',"accesskey",name)) {
1793 /*----------------------------------------------------------------------*/
1795 /*----------------------------------------------------------------------*/
1798 else if (STRCASEEQ('c','C',"cti",name)) {
1799 /*----------------------------------------------------------------------*/
1801 /*----------------------------------------------------------------------*/
1804 else if (STRCASEEQ('i','I',"ijam",name)) {
1805 /*----------------------------------------------------------------------*/
1807 /*----------------------------------------------------------------------*/
1810 else if (STRCASEEQ('u','U',"utn",name)) {
1811 /*----------------------------------------------------------------------*/
1813 /* It is special only for CHTML. */
1814 /*----------------------------------------------------------------------*/
1817 else if (STRCASEEQ('t','T',"telbook",name)) {
1818 /*----------------------------------------------------------------------*/
1820 /*----------------------------------------------------------------------*/
1823 else if (STRCASEEQ('k','K',"kana",name)) {
1824 /*----------------------------------------------------------------------*/
1826 /*----------------------------------------------------------------------*/
1829 else if (STRCASEEQ('e','E',"email",name)) {
1830 /*----------------------------------------------------------------------*/
1832 /*----------------------------------------------------------------------*/
1835 else if (STRCASEEQ('i','I',"ista",name)) {
1836 /*----------------------------------------------------------------------*/
1838 /*----------------------------------------------------------------------*/
1841 else if (STRCASEEQ('i','I',"ilet",name)) {
1842 /*----------------------------------------------------------------------*/
1844 /*----------------------------------------------------------------------*/
1847 else if (STRCASEEQ('i','I',"iswf",name)) {
1848 /*----------------------------------------------------------------------*/
1850 /*----------------------------------------------------------------------*/
1853 else if (STRCASEEQ('i','I',"irst",name)) {
1854 /*----------------------------------------------------------------------*/
1856 /*----------------------------------------------------------------------*/
1859 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1860 /*----------------------------------------------------------------------*/
1862 /*----------------------------------------------------------------------*/
1878 if (IS_CSS_ON(android->entryp)) {
1879 s_android_nopush_and_get_now_style(pdoc, node, attr_style);
1882 return android->out;
1887 * It is a handler who processes the A tag.
1889 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
1890 * destination is specified.
1891 * @param node [i] The A tag node is specified.
1892 * @return The conversion result is returned.
1895 s_android_end_a_tag(void *pdoc, Node *UNUSED(child))
1901 android = GET_ANDROID(pdoc);
1907 if (IS_CSS_ON(android->entryp)) {
1908 chxj_css_pop_prop_list(android->css_prop_stack);
1911 return android->out;
1916 * It is a handler who processes the BR tag.
1918 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
1919 * destination is specified.
1920 * @param node [i] The BR tag node is specified.
1921 * @return The conversion result is returned.
1924 s_android_start_br_tag(void *pdoc, Node *node)
1931 android = GET_ANDROID(pdoc);
1935 char *attr_style = NULL;
1936 char *attr_clear = NULL;
1938 /*--------------------------------------------------------------------------*/
1939 /* Get Attributes */
1940 /*--------------------------------------------------------------------------*/
1941 for (attr = qs_get_attr(doc,node);
1943 attr = qs_get_next_attr(doc,attr)) {
1944 char *name = qs_get_attr_name(doc,attr);
1945 char *value = qs_get_attr_value(doc,attr);
1946 if (STRCASEEQ('c','C',"clear",name)) {
1947 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1951 else if (STRCASEEQ('s','S',"style",name)) {
1952 attr_style = apr_pstrdup(doc->buf.pool, value);
1955 if (IS_CSS_ON(android->entryp)) {
1956 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
1958 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
1959 css_property_t *cur;
1960 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
1961 if (cur->value && *cur->value) {
1962 if ( STRCASEEQ('l','L',"left", cur->value)
1963 || STRCASEEQ('r','R',"right", cur->value)) {
1964 attr_clear = apr_pstrdup(doc->pool, cur->value);
1966 else if(STRCASEEQ('b','B',"both" ,cur->value)) {
1967 attr_clear = apr_pstrdup(doc->pool, "all");
1980 return android->out;
1985 * It is a handler who processes the BR tag.
1987 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
1988 * destination is specified.
1989 * @param node [i] The BR tag node is specified.
1990 * @return The conversion result is returned.
1993 s_android_end_br_tag(void *pdoc, Node *UNUSED(child))
1995 android_t *android = GET_ANDROID(pdoc);
1996 return android->out;
2000 * It is a handler who processes the TABLE tag.
2002 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
2003 * destination is specified.
2004 * @param node [i] The TR tag node is specified.
2005 * @return The conversion result is returned.
2008 s_android_start_table_tag(void *pdoc, Node *node)
2015 char *attr_style = NULL;
2016 char *attr_align = NULL;
2017 char *attr_width = NULL;
2018 char *attr_height = NULL;
2019 char *attr_bgcolor = NULL;
2020 char *attr_border_width = NULL;
2021 char *attr_border_color = NULL;
2023 android = GET_ANDROID(pdoc);
2027 /*--------------------------------------------------------------------------*/
2028 /* Get Attributes */
2029 /*--------------------------------------------------------------------------*/
2030 for (attr = qs_get_attr(doc,node);
2032 attr = qs_get_next_attr(doc,attr)) {
2033 char *name = qs_get_attr_name(doc,attr);
2034 char *val = qs_get_attr_value(doc,attr);
2035 if (STRCASEEQ('a','A',"align",name)) {
2036 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2037 attr_align = apr_pstrdup(doc->buf.pool, val);
2040 else if (STRCASEEQ('h','H',"height",name) && val && *val) {
2041 attr_height = apr_pstrdup(doc->buf.pool, val);
2043 else if (STRCASEEQ('w','W',"width",name) && val && *val) {
2044 attr_width = apr_pstrdup(doc->buf.pool, val);
2046 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
2047 attr_style = apr_pstrdup(doc->buf.pool, val);
2049 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
2050 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
2051 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
2053 else if (STRCASEEQ('b','B',"border",name) && val && *val) {
2054 attr_border_width = apr_pstrdup(doc->buf.pool, val);
2056 else if (STRCASEEQ('b','B',"bordercolor",name) && val && *val) {
2057 attr_border_color = apr_pstrdup(doc->buf.pool, val);
2058 attr_border_color = chxj_css_rgb_func_to_value(doc->pool, attr_border_color);
2062 if (IS_CSS_ON(android->entryp)) {
2063 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
2065 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2066 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2067 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
2068 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
2069 css_property_t *border_width_prop = chxj_css_get_property_value(doc, style, "border-width");
2070 css_property_t *border_color_prop = chxj_css_get_property_value(doc, style, "border-color");
2072 css_property_t *cur;
2073 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2074 char *tmp = apr_pstrdup(doc->pool, cur->value);
2075 char *tmpp = strstr(tmp, "px");
2077 size_t len = strlen(tmp) - strlen(tmpp);
2078 attr_width = apr_pstrndup(doc->pool, tmp,len);
2081 attr_width = apr_pstrdup(doc->pool, tmp);
2084 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2085 char *tmp = apr_pstrdup(doc->pool, cur->value);
2086 char *tmpp = strstr(tmp, "px");
2088 size_t len = strlen(tmp) - strlen(tmpp);
2089 attr_height = apr_pstrndup(doc->pool, tmp,len);
2092 attr_height = apr_pstrdup(doc->pool, tmp);
2095 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
2096 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
2097 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
2100 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
2101 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
2102 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
2104 for (cur = border_width_prop->next; cur != border_width_prop; cur = cur->next) {
2105 char *tmp = apr_pstrdup(doc->pool, cur->value);
2106 char *tmpp = strstr(tmp, "px");
2108 size_t len = strlen(tmp) - strlen(tmpp);
2109 attr_border_width = apr_pstrndup(doc->pool, tmp,len);
2112 attr_border_width = apr_pstrdup(doc->pool, tmp);
2115 for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
2116 attr_border_color = apr_pstrdup(doc->pool, cur->value);
2117 attr_border_color = chxj_css_rgb_func_to_value(doc->pool, attr_border_color);
2138 if (attr_bgcolor && *attr_bgcolor){
2143 if (attr_border_width || attr_border_color ){
2144 W_L(" style=\"border:");
2145 if (attr_border_width){
2146 W_V(attr_border_width);
2153 if (attr_border_color && *attr_border_color){
2155 W_V(attr_border_color);
2161 return android->out;
2165 * It is a handler who processes the TABLE tag.
2167 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
2168 * destination is specified.
2169 * @param node [i] The TR tag node is specified.
2170 * @return The conversion result is returned.
2173 s_android_end_table_tag(void *pdoc, Node *UNUSED(node))
2179 android = GET_ANDROID(pdoc);
2181 r = android->doc->r;
2184 return android->out;
2189 * It is a handler who processes the TR tag.
2191 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
2192 * destination is specified.
2193 * @param node [i] The TR tag node is specified.
2194 * @return The conversion result is returned.
2197 s_android_start_tr_tag(void *pdoc, Node *node)
2205 char *attr_style = NULL;
2206 char *attr_align = NULL;
2207 char *attr_valign = NULL;
2208 char *attr_bgcolor = NULL;
2210 android = GET_ANDROID(pdoc);
2214 /*--------------------------------------------------------------------------*/
2215 /* Get Attributes */
2216 /*--------------------------------------------------------------------------*/
2217 for (attr = qs_get_attr(doc,node);
2219 attr = qs_get_next_attr(doc,attr)) {
2220 char *name = qs_get_attr_name(doc,attr);
2221 char *val = qs_get_attr_value(doc,attr);
2222 if (STRCASEEQ('a','A',"align",name)) {
2223 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2224 attr_align = apr_pstrdup(doc->buf.pool, val);
2227 else if (STRCASEEQ('v','V',"valign",name) && val && *val) {
2228 if (val && (STRCASEEQ('t','T',"top",val) || STRCASEEQ('m','M',"middle",val) || STRCASEEQ('b','B',"bottom",val))) {
2229 attr_valign = apr_pstrdup(doc->buf.pool, val);
2232 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
2233 attr_style = apr_pstrdup(doc->buf.pool, val);
2235 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
2236 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
2237 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
2241 if (IS_CSS_ON(android->entryp)) {
2242 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
2244 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
2245 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
2246 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
2248 css_property_t *cur;
2249 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
2250 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
2251 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
2254 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
2255 if (cur->value && (STRCASEEQ('t','T',"top",cur->value) || STRCASEEQ('m','M',"middle",cur->value) || STRCASEEQ('b','B',"bottom",cur->value))) {
2256 attr_valign = apr_pstrdup(doc->buf.pool, cur->value);
2259 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
2260 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
2261 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
2277 if (attr_bgcolor && *attr_bgcolor){
2283 return android->out;
2288 * It is a handler who processes the TR tag.
2290 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
2291 * destination is specified.
2292 * @param node [i] The TR tag node is specified.
2293 * @return The conversion result is returned.
2296 s_android_end_tr_tag(void *pdoc, Node *UNUSED(child))
2302 android = GET_ANDROID(pdoc);
2304 r = android->doc->r;
2307 return android->out;
2311 * It is a handler who processes the TD tag.
2313 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
2314 * destination is specified.
2315 * @param node [i] The TR tag node is specified.
2316 * @return The conversion result is returned.
2319 s_android_start_td_or_th_tag(void *pdoc, Node *node,char *tagName)
2327 char *attr_style = NULL;
2328 char *attr_align = NULL;
2329 char *attr_valign = NULL;
2330 char *attr_bgcolor = NULL;
2331 char *attr_colspan = NULL;
2332 char *attr_rowspan = NULL;
2333 char *attr_width = NULL;
2334 char *attr_height = NULL;
2336 android = GET_ANDROID(pdoc);
2340 /*--------------------------------------------------------------------------*/
2341 /* Get Attributes */
2342 /*--------------------------------------------------------------------------*/
2343 for (attr = qs_get_attr(doc,node);
2345 attr = qs_get_next_attr(doc,attr)) {
2346 char *name = qs_get_attr_name(doc,attr);
2347 char *val = qs_get_attr_value(doc,attr);
2348 if (STRCASEEQ('a','A',"align",name)) {
2349 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2350 attr_align = apr_pstrdup(doc->buf.pool, val);
2353 else if (STRCASEEQ('v','V',"valign",name) && val && *val) {
2354 if (val && (STRCASEEQ('t','T',"top",val) || STRCASEEQ('m','M',"middle",val) || STRCASEEQ('b','B',"bottom",val))) {
2355 attr_valign = apr_pstrdup(doc->buf.pool, val);
2358 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
2359 attr_style = apr_pstrdup(doc->buf.pool, val);
2361 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
2362 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
2363 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
2365 else if (STRCASEEQ('c','C',"colspan",name) && val && *val) {
2366 attr_colspan = apr_pstrdup(doc->buf.pool, val);
2368 else if (STRCASEEQ('r','R',"rowspan",name) && val && *val) {
2369 attr_rowspan = apr_pstrdup(doc->buf.pool, val);
2371 else if (STRCASEEQ('w','W',"width",name) && val && *val) {
2372 char *tmp = strstr(val, "%");
2374 attr_width = apr_pstrdup(doc->buf.pool, val);
2377 attr_width = apr_psprintf(doc->buf.pool,"%spx",val);
2380 else if (STRCASEEQ('h','H',"height",name) && val && *val) {
2381 char *tmp = strstr(val, "%");
2383 attr_height = apr_pstrdup(doc->buf.pool, val);
2386 attr_height = apr_psprintf(doc->buf.pool,"%spx",val);
2391 if (IS_CSS_ON(android->entryp)) {
2392 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
2394 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
2395 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
2396 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
2397 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2398 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2400 css_property_t *cur;
2401 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
2402 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
2403 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
2406 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
2407 if (cur->value && (STRCASEEQ('t','T',"top",cur->value) || STRCASEEQ('m','M',"middle",cur->value) || STRCASEEQ('b','B',"bottom",cur->value))) {
2408 attr_valign = apr_pstrdup(doc->buf.pool, cur->value);
2411 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
2412 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
2413 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
2415 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2416 attr_width = apr_pstrdup(doc->pool, cur->value);
2418 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2419 attr_height = apr_pstrdup(doc->pool, cur->value);
2446 if (attr_bgcolor && *attr_bgcolor){
2451 if (attr_width || attr_height ){
2466 return android->out;
2471 * It is a handler who processes the TD tag.
2473 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
2474 * destination is specified.
2475 * @param node [i] The TR tag node is specified.
2476 * @return The conversion result is returned.
2479 s_android_end_td_or_th_tag(void *pdoc, Node *UNUSED(child),char *tagName)
2485 android = GET_ANDROID(pdoc);
2487 r = android->doc->r;
2492 return android->out;
2496 * It is a handler who processes the TD tag.
2498 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
2499 * destination is specified.
2500 * @param node [i] The TD tag node is specified.
2501 * @return The conversion result is returned.
2504 s_android_start_td_tag(void *pdoc, Node *node)
2506 return s_android_start_td_or_th_tag(pdoc,node,"td");
2509 * It is a handler who processes the TD tag.
2511 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
2512 * destination is specified.
2513 * @param node [i] The TD tag node is specified.
2514 * @return The conversion result is returned.
2517 s_android_end_td_tag(void *pdoc, Node *node)
2519 return s_android_end_td_or_th_tag(pdoc,node,"td");
2523 * It is a handler who processes the TD tag.
2525 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
2526 * destination is specified.
2527 * @param node [i] The TD tag node is specified.
2528 * @return The conversion result is returned.
2531 s_android_start_th_tag(void *pdoc, Node *node)
2533 return s_android_start_td_or_th_tag(pdoc,node,"th");
2536 * It is a handler who processes the TD tag.
2538 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
2539 * destination is specified.
2540 * @param node [i] The TD tag node is specified.
2541 * @return The conversion result is returned.
2544 s_android_end_th_tag(void *pdoc, Node *node)
2546 return s_android_end_td_or_th_tag(pdoc,node,"th");
2550 * It is a handler who processes the FONT tag.
2552 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
2553 * destination is specified.
2554 * @param node [i] The FONT tag node is specified.
2555 * @return The conversion result is returned.
2558 s_android_start_font_tag(void *pdoc, Node *node)
2564 char *attr_color = NULL;
2565 char *attr_size = NULL;
2566 char *attr_style = NULL;
2568 android = GET_ANDROID(pdoc);
2572 /*--------------------------------------------------------------------------*/
2573 /* Get Attributes */
2574 /*--------------------------------------------------------------------------*/
2575 for (attr = qs_get_attr(doc,node);
2577 attr = qs_get_next_attr(doc,attr)) {
2578 char *name = qs_get_attr_name(doc,attr);
2579 char *value = qs_get_attr_value(doc,attr);
2580 if (STRCASEEQ('c','C',"color",name) && value && *value) {
2581 attr_color = apr_pstrdup(doc->buf.pool, value);
2583 else if (STRCASEEQ('s','S',"size",name) && value && *value) {
2584 /*----------------------------------------------------------------------*/
2586 /*----------------------------------------------------------------------*/
2587 attr_size = apr_pstrdup(doc->buf.pool, value);
2589 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2590 attr_style = apr_pstrdup(doc->buf.pool, value);
2593 if (IS_CSS_ON(android->entryp)) {
2594 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
2596 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2597 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
2598 css_property_t *cur;
2599 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2600 if (cur->value && *cur->value) {
2601 attr_color = apr_pstrdup(doc->pool, cur->value);
2604 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
2605 if (cur->value && *cur->value) {
2606 attr_size = apr_pstrdup(doc->pool, cur->value);
2607 if (STRCASEEQ('x','X',"xx-small",attr_size)) {
2608 attr_size = apr_pstrdup(doc->pool, "1");
2610 else if (STRCASEEQ('x','X',"x-small",attr_size)) {
2611 attr_size = apr_pstrdup(doc->pool, "2");
2613 else if (STRCASEEQ('s','S',"small",attr_size)) {
2614 attr_size = apr_pstrdup(doc->pool, "3");
2616 else if (STRCASEEQ('m','M',"medium",attr_size)) {
2617 attr_size = apr_pstrdup(doc->pool, "4");
2619 else if (STRCASEEQ('l','L',"large",attr_size)) {
2620 attr_size = apr_pstrdup(doc->pool, "5");
2622 else if (STRCASEEQ('x','X',"x-large",attr_size)) {
2623 attr_size = apr_pstrdup(doc->pool, "6");
2625 else if (STRCASEEQ('x','X',"xx-large",attr_size)) {
2626 attr_size = apr_pstrdup(doc->pool, "7");
2632 android_flags_t *flg = (android_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
2633 memset(flg, 0, sizeof(*flg));
2635 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2636 W_L("<font color=\"");
2639 flg->font_color_flag = 1;
2642 flg->font_size_flag = 1;
2643 switch(*attr_size) {
2644 case '1': W_L("<span style=\"font-size: xx-small\">"); break;
2645 case '2': W_L("<span style=\"font-size: x-small\">"); break;
2646 case '3': W_L("<span style=\"font-size: small\">"); break;
2647 case '4': W_L("<span style=\"font-size: medium\">"); break;
2648 case '5': W_L("<span style=\"font-size: large\">"); break;
2649 case '6': W_L("<span style=\"font-size: x-large\">"); break;
2650 case '7': W_L("<span style=\"font-size: xx-large\">"); break;
2652 if (*(attr_size + 1) == '1') {
2653 W_L("<span style=\"font-size: small\">");
2656 if (*(attr_size + 1) == '2') {
2657 W_L("<span style=\"font-size: x-small\">");
2660 if (*(attr_size + 1) == '3') {
2661 W_L("<span style=\"font-size: xx-small\">");
2664 flg->font_size_flag = 0;
2668 if (*(attr_size + 1) == '1') {
2669 W_L("<span style=\"font-size: large\">");
2672 if (*(attr_size + 1) == '2') {
2673 W_L("<span style=\"font-size: x-large\">");
2676 if (*(attr_size + 1) == '3') {
2677 W_L("<span style=\"font-size: xx-large\">");
2680 flg->font_size_flag = 0;
2684 WRN(doc->r, "invlalid font size. [%s] != (1|2|3|4|5|6|7|+1|+2|+3|-1|-2|-3)", attr_size);
2685 flg->font_size_flag = 0;
2688 node->userData = flg;
2689 return android->out;
2694 * It is a handler who processes the FONT tag.
2696 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
2697 * destination is specified.
2698 * @param node [i] The FONT tag node is specified.
2699 * @return The conversion result is returned.
2702 s_android_end_font_tag(void *pdoc, Node *node)
2708 android = GET_ANDROID(pdoc);
2710 r = android->doc->r;
2712 android_flags_t *flg = (android_flags_t *)node->userData;
2713 if (flg && flg->font_size_flag) {
2716 if (flg && flg->font_color_flag) {
2719 if (IS_CSS_ON(android->entryp)) {
2720 chxj_css_pop_prop_list(android->css_prop_stack);
2723 return android->out;
2728 * It is a handler who processes the FORM tag.
2730 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
2731 * destination is specified.
2732 * @param node [i] The FORM tag node is specified.
2733 * @return The conversion result is returned.
2736 s_android_start_form_tag(void *pdoc, Node *node)
2742 char *attr_action = NULL;
2743 char *attr_method = NULL;
2744 char *attr_style = NULL;
2745 char *attr_color = NULL;
2746 char *attr_align = NULL;
2747 char *attr_name = NULL;
2748 char *css_clear = NULL;
2749 char *new_hidden_tag = NULL;
2751 android = GET_ANDROID(pdoc);
2755 /*--------------------------------------------------------------------------*/
2756 /* Get Attributes */
2757 /*--------------------------------------------------------------------------*/
2758 for (attr = qs_get_attr(doc,node);
2760 attr = qs_get_next_attr(doc,attr)) {
2761 char *name = qs_get_attr_name(doc,attr);
2762 char *value = qs_get_attr_value(doc,attr);
2766 if (strcasecmp(name, "action") == 0) {
2767 /*--------------------------------------------------------------------*/
2769 /*--------------------------------------------------------------------*/
2770 attr_action = value;
2776 if (strcasecmp(name, "method") == 0) {
2777 /*--------------------------------------------------------------------*/
2779 /*--------------------------------------------------------------------*/
2780 attr_method = value;
2786 if (strcasecmp(name, "name") == 0) {
2787 /*--------------------------------------------------------------------*/
2789 /*--------------------------------------------------------------------*/
2796 if (strcasecmp(name, "style") == 0) {
2805 if (IS_CSS_ON(android->entryp)) {
2806 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
2808 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2809 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2810 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
2811 css_property_t *cur;
2812 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2813 if (STRCASEEQ('l','L',"left", cur->value)) {
2814 attr_align = apr_pstrdup(doc->pool, "left");
2816 else if (STRCASEEQ('c','C',"center",cur->value)) {
2817 attr_align = apr_pstrdup(doc->pool, "center");
2819 else if (STRCASEEQ('r','R',"right",cur->value)) {
2820 attr_align = apr_pstrdup(doc->pool, "right");
2823 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2824 attr_color = apr_pstrdup(doc->pool, cur->value);
2826 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
2827 css_clear = apr_pstrdup(doc->pool, cur->value);
2832 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
2836 attr_action = chxj_encoding_parameter(r, attr_action, 1);
2837 attr_action = chxj_add_cookie_parameter(r, attr_action, android->cookie);
2839 char *old_qs = NULL;
2840 q = strchr(attr_action, '?');
2842 new_hidden_tag = chxj_form_action_to_hidden_tag(r, doc->pool, attr_action, 1, post_flag, &old_qs, CHXJ_FALSE, CHXJ_TRUE, android->entryp);
2843 if (new_hidden_tag || old_qs) {
2873 android_flags_t *flg = (android_flags_t *)apr_palloc(doc->pool, sizeof(android_flags_t));
2874 memset(flg, 0, sizeof(*flg));
2876 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2877 W_L("<font color=\"");
2880 flg->with_font_flag = 1;
2883 W_L("<div align=\"");
2886 flg->with_div_flag = 1;
2888 node->userData = flg;
2889 if (new_hidden_tag) {
2890 W_V(new_hidden_tag);
2892 return android->out;
2897 * It is a handler who processes the FORM tag.
2899 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
2900 * destination is specified.
2901 * @param node [i] The FORM tag node is specified.
2902 * @return The conversion result is returned.
2905 s_android_end_form_tag(void *pdoc, Node *node)
2907 android_t *android = GET_ANDROID(pdoc);
2908 Doc *doc = android->doc;
2910 android_flags_t *flg = (android_flags_t *)node->userData;
2911 if (flg && flg->with_div_flag) {
2914 if (flg && flg->with_font_flag) {
2918 if (IS_CSS_ON(android->entryp)) {
2919 chxj_css_pop_prop_list(android->css_prop_stack);
2922 return android->out;
2926 s_android_istyle_to_wap_input_format(apr_pool_t *p, const char *s)
2930 case '1': return apr_psprintf(p, ""*<ja:h>"");
2931 case '2': return apr_psprintf(p, ""*<ja:hk>"");
2932 case '3': return apr_psprintf(p, ""*<ja:en>"");
2933 case '4': return apr_psprintf(p, ""*<ja:n>"");
2935 return apr_pstrdup(p, "");
2939 return apr_pstrdup(p,"");
2944 * It is a handler who processes the INPUT tag.
2946 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
2947 * destination is specified.
2948 * @param node [i] The INPUT tag node is specified.
2949 * @return The conversion result is returned.
2952 s_android_start_input_tag(void *pdoc, Node *node)
2958 char *attr_accesskey = NULL;
2959 char *attr_max_length = NULL;
2960 char *attr_type = NULL;
2961 char *attr_name = NULL;
2962 char *attr_value = NULL;
2963 char *attr_istyle = NULL;
2964 char *attr_size = NULL;
2965 char *attr_checked = NULL;
2966 char *attr_style = NULL;
2968 android = GET_ANDROID(pdoc);
2972 /*--------------------------------------------------------------------------*/
2973 /* Get Attributes */
2974 /*--------------------------------------------------------------------------*/
2975 for (attr = qs_get_attr(doc,node);
2977 attr = qs_get_next_attr(doc,attr)) {
2978 char *name = qs_get_attr_name(doc,attr);
2979 char *value = qs_get_attr_value(doc,attr);
2980 if (STRCASEEQ('t','T',"type",name) && value && *value) {
2981 char *tmp_type = qs_trim_string(doc->buf.pool, value);
2982 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
2983 STRCASEEQ('p','P',"password",tmp_type) ||
2984 STRCASEEQ('c','C',"checkbox",tmp_type) ||
2985 STRCASEEQ('r','R',"radio", tmp_type) ||
2986 STRCASEEQ('h','H',"hidden", tmp_type) ||
2987 STRCASEEQ('s','S',"submit", tmp_type) ||
2988 STRCASEEQ('r','R',"reset", tmp_type))) {
2989 attr_type = tmp_type;
2992 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
2995 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
2998 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
2999 attr_istyle = value;
3001 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
3002 attr_max_length = value;
3004 else if (STRCASEEQ('c','C',"checked", name)) {
3005 attr_checked = value;
3007 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
3008 attr_accesskey = value;
3010 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
3013 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3018 if (IS_CSS_ON(android->entryp)) {
3019 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
3021 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
3022 css_property_t *cur;
3023 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
3024 if (strcasestr(cur->value, "<ja:n>")) {
3027 else if (strcasestr(cur->value, "<ja:en>")) {
3030 else if (strcasestr(cur->value, "<ja:hk>")) {
3033 else if (strcasestr(cur->value, "<ja:h>")) {
3048 W_V(chxj_jreserved_to_safe_tag(r, attr_name, android->entryp));
3053 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
3056 if (attr_istyle && (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4')) {
3057 if (attr_type && STRCASEEQ('t','T',"text",attr_type)) {
3062 if (*attr_istyle == '4') {
3063 attr_type = apr_pstrdup(r->pool, "number");
3072 /*--------------------------------------------------------------------------*/
3073 /* The figure is default for the password. */
3074 /*--------------------------------------------------------------------------*/
3075 if (attr_max_length && *attr_max_length) {
3076 if (chxj_chk_numeric(attr_max_length) == 0) {
3077 W_L(" maxlength=\"");
3078 W_V(attr_max_length);
3083 W_L(" checked=\"checked\"");
3086 return android->out;
3091 * It is a handler who processes the INPUT tag.
3093 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
3094 * destination is specified.
3095 * @param node [i] The INPUT tag node is specified.
3096 * @return The conversion result is returned.
3099 s_android_end_input_tag(void *pdoc, Node *UNUSED(child))
3101 android_t *android = GET_ANDROID(pdoc);
3102 return android->out;
3107 * It is a handler who processes the CENTER tag.
3109 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
3110 * destination is specified.
3111 * @param node [i] The CENTER tag node is specified.
3112 * @return The conversion result is returned.
3115 s_android_start_center_tag(void *pdoc, Node *node)
3120 char *attr_style = NULL;
3121 char *attr_color = NULL;
3122 char *attr_size = NULL;
3124 android = GET_ANDROID(pdoc);
3127 for (attr = qs_get_attr(doc,node);
3129 attr = qs_get_next_attr(doc,attr)) {
3130 char *name = qs_get_attr_name(doc,attr);
3131 char *value = qs_get_attr_value(doc,attr);
3132 if (STRCASEEQ('s','S',"style",name) && value && *value) {
3136 if (IS_CSS_ON(android->entryp)) {
3137 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
3139 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3140 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
3141 css_property_t *cur;
3142 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3143 if (cur->value && *cur->value) {
3144 attr_color = apr_pstrdup(doc->pool, cur->value);
3147 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
3148 if (cur->value && *cur->value) {
3149 attr_size = apr_pstrdup(doc->pool, cur->value);
3156 if (attr_size || attr_color) {
3164 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3173 return android->out;
3178 * It is a handler who processes the CENTER tag.
3180 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
3181 * destination is specified.
3182 * @param node [i] The CENTER tag node is specified.
3183 * @return The conversion result is returned.
3186 s_android_end_center_tag(void *pdoc, Node *UNUSED(node))
3192 android = GET_ANDROID(pdoc);
3197 if (IS_CSS_ON(android->entryp)) {
3198 chxj_css_pop_prop_list(android->css_prop_stack);
3200 return android->out;
3205 * It is a handler who processes the li tag.
3207 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
3208 * destination is specified.
3209 * @param node [i] The li tag node is specified.
3210 * @return The conversion result is returned.
3213 s_android_start_li_tag(void *pdoc, Node *node)
3219 char *attr_type = NULL;
3220 char *attr_value = NULL;
3221 char *attr_style = NULL;
3223 android = GET_ANDROID(pdoc);
3227 for (attr = qs_get_attr(doc,node);
3229 attr = qs_get_next_attr(doc,attr)) {
3230 char *name = qs_get_attr_name(doc,attr);
3231 char *value = qs_get_attr_value(doc,attr);
3232 if (STRCASEEQ('t','T',"type",name)) {
3233 if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('s','S',"square",value) || STRCASEEQ('c','C',"circle",value))) {
3234 if (*value == '1') {
3235 attr_type = apr_pstrdup(doc->pool, "decimal");
3237 else if (*value == 'a') {
3238 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3240 else if (*value == 'A') {
3241 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3248 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
3251 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3255 if (IS_CSS_ON(android->entryp)) {
3256 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
3258 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3259 css_property_t *cur;
3260 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3261 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3262 attr_type = apr_pstrdup(doc->pool, "decimal");
3264 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3265 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3267 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3268 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3270 else if (STRCASEEQ('d','D',"disc", cur->value)) {
3271 attr_type = apr_pstrdup(doc->pool, "disc");
3273 else if (STRCASEEQ('s','S',"square", cur->value)) {
3274 attr_type = apr_pstrdup(doc->pool, "square");
3276 else if (STRCASEEQ('c','C',"circle", cur->value)) {
3277 attr_type = apr_pstrdup(doc->pool, "circle");
3287 W_L("list-style-type:");
3298 return android->out;
3303 * It is a handler who processes the li tag.
3305 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
3306 * destination is specified.
3307 * @param node [i] The li tag node is specified.
3308 * @return The conversion result is returned.
3311 s_android_end_li_tag(void *pdoc, Node *UNUSED(child))
3317 android = GET_ANDROID(pdoc);
3321 if (IS_CSS_ON(android->entryp)) {
3322 chxj_css_pop_prop_list(android->css_prop_stack);
3325 return android->out;
3330 * It is a handler who processes the OL tag.
3332 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
3333 * destination is specified.
3334 * @param node [i] The OL tag node is specified.
3335 * @return The conversion result is returned.
3338 s_android_start_ol_tag(void *pdoc, Node *node)
3344 char *attr_style = NULL;
3345 char *attr_start = NULL;
3346 char *attr_type = NULL;
3347 char *css_clear = NULL;
3349 android = GET_ANDROID(pdoc);
3353 /*--------------------------------------------------------------------------*/
3354 /* Get Attributes */
3355 /*--------------------------------------------------------------------------*/
3356 for (attr = qs_get_attr(doc,node);
3358 attr = qs_get_next_attr(doc,attr)) {
3359 char *name = qs_get_attr_name(doc,attr);
3360 char *value = qs_get_attr_value(doc,attr);
3361 if (STRCASEEQ('t','T',"type",name) && value) {
3362 if (*value == '1') {
3363 attr_type = apr_pstrdup(doc->pool, "decimal");
3365 else if (*value == 'a') {
3366 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3368 else if (*value == 'A') {
3369 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3372 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
3375 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3379 if (IS_CSS_ON(android->entryp)) {
3380 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
3382 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3383 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3385 css_property_t *cur;
3386 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3387 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3388 attr_type = apr_pstrdup(doc->pool, "decimal");
3390 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3391 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3393 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3394 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3397 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3398 css_clear = apr_pstrdup(doc->pool, cur->value);
3403 if (attr_type || css_clear) {
3406 W_L("list-style-type:");
3424 return android->out;
3429 * It is a handler who processes the OL tag.
3431 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
3432 * destination is specified.
3433 * @param node [i] The OL tag node is specified.
3434 * @return The conversion result is returned.
3437 s_android_end_ol_tag(void *pdoc, Node *UNUSED(child))
3443 android = GET_ANDROID(pdoc);
3448 if (IS_CSS_ON(android->entryp)) {
3449 chxj_css_pop_prop_list(android->css_prop_stack);
3451 return android->out;
3456 * It is a handler who processes the P tag.
3458 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
3459 * destination is specified.
3460 * @param node [i] The P tag node is specified.
3461 * @return The conversion result is returned.
3464 s_android_start_p_tag(void *pdoc, Node *node)
3470 char *attr_align = NULL;
3471 char *attr_style = NULL;
3472 char *attr_color = NULL;
3473 char *attr_blink = NULL;
3474 char *css_clear = NULL;
3476 android = GET_ANDROID(pdoc);
3480 for (attr = qs_get_attr(doc,node);
3482 attr = qs_get_next_attr(doc,attr)) {
3483 char *nm = qs_get_attr_name(doc,attr);
3484 char *val = qs_get_attr_value(doc,attr);
3485 if (STRCASEEQ('a','A',"align", nm)) {
3486 /*----------------------------------------------------------------------*/
3487 /* CHTML 1.0 (W3C version 3.2) */
3488 /*----------------------------------------------------------------------*/
3489 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
3490 attr_align = apr_pstrdup(doc->buf.pool, val);
3494 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
3495 attr_style = apr_pstrdup(doc->buf.pool, val);
3498 if (IS_CSS_ON(android->entryp)) {
3499 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
3501 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
3502 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3503 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
3504 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3505 css_property_t *cur;
3506 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
3507 if (STRCASEEQ('l','L',"left",cur->value)) {
3508 attr_align = apr_pstrdup(doc->pool, "left");
3510 else if (STRCASEEQ('c','C',"center",cur->value)) {
3511 attr_align = apr_pstrdup(doc->pool, "center");
3513 else if (STRCASEEQ('r','R',"right",cur->value)) {
3514 attr_align = apr_pstrdup(doc->pool, "right");
3517 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3518 if (cur->value && *cur->value) {
3519 attr_color = apr_pstrdup(doc->pool, cur->value);
3522 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
3523 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
3524 attr_blink = apr_pstrdup(doc->pool, cur->value);
3527 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3528 css_clear = apr_pstrdup(doc->pool, cur->value);
3533 if ((attr_align && *attr_align) || (attr_color && *attr_color) || (attr_blink && *attr_blink) || css_clear) {
3541 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3547 W_L("text-decoration:");
3559 return android->out;
3564 * It is a handler who processes the P tag.
3566 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
3567 * destination is specified.
3568 * @param node [i] The P tag node is specified.
3569 * @return The conversion result is returned.
3572 s_android_end_p_tag(void *pdoc, Node *UNUSED(child))
3574 android_t *android = GET_ANDROID(pdoc);
3575 Doc *doc = android->doc;
3578 if (IS_CSS_ON(android->entryp)) {
3579 chxj_css_pop_prop_list(android->css_prop_stack);
3581 return android->out;
3586 * It is a handler who processes the PRE tag.
3588 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
3589 * destination is specified.
3590 * @param node [i] The PRE tag node is specified.
3591 * @return The conversion result is returned.
3594 s_android_start_pre_tag(void *pdoc, Node *node)
3596 android_t *android = GET_ANDROID(pdoc);
3597 Doc *doc = android->doc;
3599 char *attr_style = NULL;
3600 char *css_clear = NULL;
3602 for (attr = qs_get_attr(doc,node);
3604 attr = qs_get_next_attr(doc,attr)) {
3605 char *nm = qs_get_attr_name(doc,attr);
3606 char *val = qs_get_attr_value(doc,attr);
3607 if (val && STRCASEEQ('s','S',"style", nm)) {
3612 if (IS_CSS_ON(android->entryp)) {
3613 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
3615 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3617 css_property_t *cur;
3618 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3619 css_clear = apr_pstrdup(doc->pool, cur->value);
3624 android->pre_flag++;
3634 return android->out;
3639 * It is a handler who processes the PRE tag.
3641 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
3642 * destination is specified.
3643 * @param node [i] The PRE tag node is specified.
3644 * @return The conversion result is returned.
3647 s_android_end_pre_tag(void *pdoc, Node *UNUSED(child))
3649 android_t *android = GET_ANDROID(pdoc);
3650 Doc *doc = android->doc;
3653 android->pre_flag--;
3654 if (IS_CSS_ON(android->entryp)) {
3655 chxj_css_pop_prop_list(android->css_prop_stack);
3658 return android->out;
3663 * It is a handler who processes the UL tag.
3665 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
3666 * destination is specified.
3667 * @param node [i] The UL tag node is specified.
3668 * @return The conversion result is returned.
3671 s_android_start_ul_tag(void *pdoc, Node *node)
3673 android_t *android = GET_ANDROID(pdoc);
3674 Doc *doc = android->doc;
3676 char *attr_type = NULL;
3677 char *attr_style = NULL;
3678 char *css_clear = NULL;
3680 /*--------------------------------------------------------------------------*/
3681 /* Get Attributes */
3682 /*--------------------------------------------------------------------------*/
3683 for (attr = qs_get_attr(doc,node);
3685 attr = qs_get_next_attr(doc,attr)) {
3686 char *name = qs_get_attr_name(doc,attr);
3687 char *value = qs_get_attr_value(doc,attr);
3688 if (STRCASEEQ('t','T',"type",name)) {
3689 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
3693 else if (value && *value && STRCASEEQ('s','S',"style", name)) {
3697 if (IS_CSS_ON(android->entryp)) {
3698 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
3700 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3701 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3703 css_property_t *cur;
3704 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3705 if (STRCASEEQ('d','D',"disc",cur->value)) {
3706 attr_type = apr_pstrdup(doc->pool, "disc");
3708 else if (STRCASEEQ('c','C',"circle",cur->value)) {
3709 attr_type = apr_pstrdup(doc->pool, "circle");
3711 else if (STRCASEEQ('s','S',"square",cur->value)) {
3712 attr_type = apr_pstrdup(doc->pool, "square");
3715 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3716 css_clear = apr_pstrdup(doc->pool, cur->value);
3721 if (attr_type || css_clear) {
3724 W_L("list-style-type:");
3736 return android->out;
3741 * It is a handler who processes the UL tag.
3743 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
3744 * destination is specified.
3745 * @param node [i] The UL tag node is specified.
3746 * @return The conversion result is returned.
3749 s_android_end_ul_tag(void *pdoc, Node *UNUSED(child))
3751 android_t *android = GET_ANDROID(pdoc);
3752 Doc *doc = android->doc;
3755 if (IS_CSS_ON(android->entryp)) {
3756 chxj_css_pop_prop_list(android->css_prop_stack);
3758 return android->out;
3763 * It is a handler who processes the HR tag.
3765 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
3766 * destination is specified.
3767 * @param node [i] The HR tag node is specified.
3768 * @return The conversion result is returned.
3771 s_android_start_hr_tag(void *pdoc, Node *node)
3777 char *attr_align = NULL;
3778 char *attr_size = NULL;
3779 char *attr_width = NULL;
3780 char *attr_noshade = NULL;
3781 char *attr_style = NULL;
3782 char *attr_color = NULL;
3783 char *attr_bgcolor = NULL;
3785 char *style_border_color = NULL;
3786 char *css_clear = NULL;
3788 android = GET_ANDROID(pdoc);
3792 for (attr = qs_get_attr(doc,node);
3794 attr = qs_get_next_attr(doc,attr)) {
3795 char *name = qs_get_attr_name (doc,attr);
3796 char *value = qs_get_attr_value(doc,attr);
3800 if (strcasecmp(name, "align") == 0) {
3801 /*--------------------------------------------------------------------*/
3803 /*--------------------------------------------------------------------*/
3804 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3805 if (value[0] == 'c' || value[0] == 'C') {
3806 attr_align = apr_pstrdup(doc->pool, "none");
3817 if (strcasecmp(name, "size") == 0) {
3818 /*--------------------------------------------------------------------*/
3820 /*--------------------------------------------------------------------*/
3821 if (value && *value) {
3825 else if (strcasecmp(name, "style") == 0) {
3826 if (value && *value) {
3834 if (strcasecmp(name, "width") == 0) {
3835 /*--------------------------------------------------------------------*/
3837 /*--------------------------------------------------------------------*/
3838 if (value && *value) {
3846 if (strcasecmp(name, "noshade") == 0) {
3847 /*--------------------------------------------------------------------*/
3849 /*--------------------------------------------------------------------*/
3850 attr_noshade = apr_pstrdup(doc->pool, "noshade");
3856 if (strcasecmp(name, "color") == 0 && value && *value) {
3857 /*--------------------------------------------------------------------*/
3859 /*--------------------------------------------------------------------*/
3868 if (IS_CSS_ON(android->entryp)) {
3869 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
3871 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
3872 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
3873 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
3875 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
3876 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
3877 css_property_t *border_color_prop = chxj_css_get_property_value(doc, style, "border-color");
3878 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3879 css_property_t *cur;
3881 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
3882 if (STRCASEEQ('s','S',"solid",cur->value)) {
3883 attr_noshade = "noshade";
3886 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
3887 attr_size = apr_pstrdup(doc->pool, cur->value);
3889 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
3890 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3893 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
3894 attr_align = apr_pstrdup(doc->pool,cur->value);
3899 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
3900 char *tmp = apr_pstrdup(doc->pool, cur->value);
3901 char *tmpp = strstr(tmp, "px");
3903 attr_width = apr_pstrdup(doc->pool, tmp);
3906 tmpp = strstr(tmp, "%");
3908 attr_width = apr_pstrdup(doc->pool, tmp);
3913 for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
3914 char *tmp = apr_pstrdup(doc->pool, cur->value);
3916 style_border_color = apr_pstrdup(doc->pool, tmp);
3919 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3920 css_clear = apr_pstrdup(doc->pool, cur->value);
3925 if (attr_align || attr_size || attr_width || attr_noshade || style_border_color || css_clear || attr_bgcolor) {
3935 if (chxj_chk_numeric(attr_size) == 0) {
3943 if (!strstr(attr_width, "px") && !strstr(attr_width, "%")) {
3949 W_L("border-style:solid;");
3951 if(style_border_color){
3952 W_L("border-color:");
3953 W_V(style_border_color);
3957 W_L("background-color:");
3976 return android->out;
3981 * It is a handler who processes the HR tag.
3983 * @param android [i/o] The pointer to the ANDROID structure at the output
3984 * destination is specified.
3985 * @param node [i] The HR tag node is specified.
3986 * @return The conversion result is returned.
3989 s_android_end_hr_tag(void *pdoc, Node *UNUSED(child))
3991 android_t *android = GET_ANDROID(pdoc);
3992 return android->out;
3997 * It is a handler who processes the IMG tag.
3999 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
4000 * destination is specified.
4001 * @param node [i] The IMG tag node is specified.
4002 * @return The conversion result is returned.
4005 s_android_start_img_tag(void *pdoc, Node *node)
4007 android_t *android = GET_ANDROID(pdoc);
4008 Doc *doc = android->doc;
4009 request_rec *r = doc->r;
4011 char *attr_src = NULL;
4012 char *attr_height = NULL;
4013 char *attr_width = NULL;
4014 char *attr_alt = NULL;
4015 char *attr_style = NULL;
4016 char *attr_hspace = NULL;
4017 char *attr_vspace = NULL;
4019 char *css_float = NULL;
4020 char *css_margin_left = NULL;
4021 char *css_margin_right = NULL;
4022 char *css_margin_top = NULL;
4023 char *css_margin_bottom = NULL;
4024 char *css_display = NULL;
4025 char *css_valign = NULL;
4027 #ifndef IMG_NOT_CONVERT_FILENAME
4028 device_table *spec = android->spec;
4031 /*--------------------------------------------------------------------------*/
4032 /* Get Attributes */
4033 /*--------------------------------------------------------------------------*/
4034 for (attr = qs_get_attr(doc,node);
4036 attr = qs_get_next_attr(doc,attr)) {
4037 char *name = qs_get_attr_name(doc,attr);
4038 char *value = qs_get_attr_value(doc,attr);
4039 if (STRCASEEQ('s','S',"src",name)) {
4040 /*----------------------------------------------------------------------*/
4042 /*----------------------------------------------------------------------*/
4043 #ifdef IMG_NOT_CONVERT_FILENAME
4044 value = chxj_encoding_parameter(r, value, 1);
4045 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, android->entryp, 1);
4046 value = chxj_add_cookie_no_update_parameter(r, value, 1);
4047 value = chxj_img_rewrite_parameter(r,android->conf,value);
4050 value = chxj_img_conv(r, spec, value);
4051 value = chxj_encoding_parameter(r, value, 1);
4052 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, android->entryp, 1);
4053 value = chxj_add_cookie_no_update_parameter(r, value, 1);
4054 value = chxj_img_rewrite_parameter(r,android->conf,value);
4058 else if (STRCASEEQ('a','A',"align",name)) {
4059 /*----------------------------------------------------------------------*/
4061 /*----------------------------------------------------------------------*/
4063 if (STRCASEEQ('t','T',"top", value) ||
4064 STRCASEEQ('m','M',"middle",value) ||
4065 STRCASEEQ('b','B',"bottom",value)){
4067 }else if (STRCASEEQ('l','L',"left", value) || STRCASEEQ('r','R',"right", value)) {
4070 else if (STRCASEEQ('c','C',"center",value)) {
4071 css_valign = apr_pstrdup(doc->pool, "middle");
4075 else if (STRCASEEQ('w','W',"width",name) && value && *value) {
4076 /*----------------------------------------------------------------------*/
4078 /*----------------------------------------------------------------------*/
4081 else if (STRCASEEQ('h','H',"height",name) && value && *value) {
4082 /*----------------------------------------------------------------------*/
4084 /*----------------------------------------------------------------------*/
4085 attr_height = value;
4087 else if (STRCASEEQ('h','H',"hspace",name)) {
4088 /*----------------------------------------------------------------------*/
4090 /*----------------------------------------------------------------------*/
4091 attr_hspace = value;
4093 else if (STRCASEEQ('v','V',"vspace",name)) {
4094 /*----------------------------------------------------------------------*/
4096 /*----------------------------------------------------------------------*/
4097 attr_vspace = value;
4099 else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
4100 /*----------------------------------------------------------------------*/
4102 /*----------------------------------------------------------------------*/
4105 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4106 /*----------------------------------------------------------------------*/
4108 /*----------------------------------------------------------------------*/
4113 if (IS_CSS_ON(android->entryp)) {
4114 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
4116 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
4117 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
4118 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
4119 css_property_t *margin_left_prop = chxj_css_get_property_value(doc, style, "margin-left");
4120 css_property_t *margin_right_prop = chxj_css_get_property_value(doc, style, "margin-right");
4121 css_property_t *margin_top_prop = chxj_css_get_property_value(doc, style, "margin-top");
4122 css_property_t *margin_bottom_prop = chxj_css_get_property_value(doc, style, "margin-bottom");
4125 css_property_t *cur;
4126 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
4127 attr_height = apr_pstrdup(doc->pool, cur->value);
4129 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
4130 attr_width = apr_pstrdup(doc->pool, cur->value);
4133 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
4134 css_valign = apr_pstrdup(doc->pool, cur->value);
4137 if (! attr_hspace) {
4138 for (cur = margin_left_prop->next; cur != margin_left_prop; cur = cur->next) {
4139 css_margin_left = apr_pstrdup(doc->pool, cur->value);
4141 for (cur = margin_right_prop->next; cur != margin_right_prop; cur = cur->next) {
4142 css_margin_right = apr_pstrdup(doc->pool, cur->value);
4145 if (! attr_vspace) {
4146 for (cur = margin_top_prop->next; cur != margin_top_prop; cur = cur->next) {
4147 css_margin_top = apr_pstrdup(doc->pool, cur->value);
4149 for (cur = margin_bottom_prop->next; cur != margin_bottom_prop; cur = cur->next) {
4150 css_margin_bottom = apr_pstrdup(doc->pool, cur->value);
4154 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
4155 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
4156 css_float = apr_pstrdup(doc->pool, cur->value);
4160 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
4161 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
4162 char *tmp = apr_pstrdup(doc->pool, cur->value);
4163 char *tmpp = strstr(tmp, "none");
4165 css_display = apr_pstrdup(doc->pool, tmp);
4177 if (attr_hspace || attr_vspace || css_float || css_margin_left || css_margin_right || css_margin_top || css_margin_bottom || css_valign || css_display) {
4185 W_L("vertical-align:");
4190 W_L("margin-left:");
4193 W_L("margin-right:");
4198 if(css_margin_left){
4199 W_L("margin-left:");
4200 W_V(css_margin_left);
4203 if(css_margin_right){
4204 W_L("margin-right:");
4205 W_V(css_margin_right);
4213 W_L("margin-bottom:");
4220 W_V(css_margin_top);
4223 if(css_margin_bottom){
4224 W_L("margin-bottom:");
4225 W_V(css_margin_bottom);
4230 W_L("display:none;");
4254 return android->out;
4259 * It is a handler who processes the IMG tag.
4261 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
4262 * destination is specified.
4263 * @param node [i] The IMG tag node is specified.
4264 * @return The conversion result is returned.
4267 s_android_end_img_tag(void *pdoc, Node *UNUSED(child))
4269 android_t *android = GET_ANDROID(pdoc);
4270 return android->out;
4275 * It is a handler who processes the SELECT tag.
4277 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
4278 * destination is specified.
4279 * @param node [i] The SELECT tag node is specified.
4280 * @return The conversion result is returned.
4283 s_android_start_select_tag(void *pdoc, Node *node)
4285 android_t *android = GET_ANDROID(pdoc);
4286 Doc *doc = android->doc;
4290 char *multiple = NULL;
4291 char *attr_style = NULL;
4294 for (attr = qs_get_attr(doc,node);
4296 attr = qs_get_next_attr(doc,attr)) {
4297 char *nm = qs_get_attr_name(doc,attr);
4298 char *val = qs_get_attr_value(doc,attr);
4299 if (STRCASEEQ('s','S',"size",nm)) {
4300 /*----------------------------------------------------------------------*/
4301 /* CHTML 1.0 version 2.0 */
4302 /*----------------------------------------------------------------------*/
4303 size = apr_pstrdup(doc->buf.pool, val);
4305 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
4306 /*----------------------------------------------------------------------*/
4307 /* CHTML 1.0 version 2.0 */
4308 /*----------------------------------------------------------------------*/
4309 attr_style = apr_pstrdup(doc->buf.pool, val);
4311 else if (STRCASEEQ('n','N',"name",nm)) {
4312 /*----------------------------------------------------------------------*/
4313 /* CHTML 1.0 version 2.0 */
4314 /*----------------------------------------------------------------------*/
4315 name = apr_pstrdup(doc->buf.pool, val);
4317 else if (STRCASEEQ('m','M',"multiple", nm)) {
4318 /*----------------------------------------------------------------------*/
4319 /* CHTML 1.0 version 2.0 */
4320 /*----------------------------------------------------------------------*/
4321 multiple = apr_pstrdup(doc->buf.pool, val);
4324 if (size && *size) {
4329 if (name && *name) {
4335 W_L(" multiple=\"multiple\"");
4339 if (IS_CSS_ON(android->entryp)) {
4340 s_android_nopush_and_get_now_style(pdoc, node, attr_style);
4343 return android->out;
4348 * It is a handler who processes the SELECT tag.
4350 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
4351 * destination is specified.
4352 * @param node [i] The SELECT tag node is specified.
4353 * @return The conversion result is returned.
4356 s_android_end_select_tag(void *pdoc, Node *UNUSED(child))
4358 android_t *android = GET_ANDROID(pdoc);
4359 Doc *doc = android->doc;
4362 if (IS_CSS_ON(android->entryp)) {
4363 chxj_css_pop_prop_list(android->css_prop_stack);
4366 return android->out;
4370 * It is a handler who processes the OPTION tag.
4372 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
4373 * destination is specified.
4374 * @param node [i] The OPTION tag node is specified.
4375 * @return The conversion result is returned.
4378 s_android_start_option_tag(void *pdoc, Node *node)
4380 android_t *android = GET_ANDROID(pdoc);
4381 Doc *doc = android->doc;
4384 char *selected = NULL;
4386 char *attr_style = NULL;
4389 for (attr = qs_get_attr(doc,node);
4391 attr = qs_get_next_attr(doc,attr)) {
4392 char *nm = qs_get_attr_name(doc,attr);
4393 char *val = qs_get_attr_value(doc,attr);
4394 if (STRCASEEQ('s','S',"selected",nm)) {
4395 /*----------------------------------------------------------------------*/
4396 /* CHTML 1.0 version 2.0 */
4397 /*----------------------------------------------------------------------*/
4398 selected = apr_pstrdup(doc->buf.pool, val);
4400 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
4401 /*----------------------------------------------------------------------*/
4402 /* CHTML 1.0 version 2.0 */
4403 /*----------------------------------------------------------------------*/
4404 attr_style = apr_pstrdup(doc->buf.pool, val);
4406 else if (STRCASEEQ('v','V',"value",nm)) {
4407 /*----------------------------------------------------------------------*/
4408 /* CHTML 1.0 version 2.0 */
4409 /*----------------------------------------------------------------------*/
4410 value = apr_pstrdup(doc->buf.pool, val);
4419 W_L(" selected=\"selected\"");
4423 if (IS_CSS_ON(android->entryp)) {
4424 s_android_nopush_and_get_now_style(pdoc, node, attr_style);
4427 return android->out;
4432 * It is a handler who processes the OPTION tag.
4434 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
4435 * destination is specified.
4436 * @param node [i] The OPTION tag node is specified.
4437 * @return The conversion result is returned.
4440 s_android_end_option_tag(void *pdoc, Node *UNUSED(child))
4442 android_t *android = GET_ANDROID(pdoc);
4443 Doc *doc = android->doc;
4446 if (IS_CSS_ON(android->entryp)) {
4447 chxj_css_pop_prop_list(android->css_prop_stack);
4450 return android->out;
4455 * It is a handler who processes the DIV tag.
4457 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
4458 * destination is specified.
4459 * @param node [i] The DIV tag node is specified.
4460 * @return The conversion result is returned.
4463 s_android_start_div_tag(void *pdoc, Node *node)
4469 char *attr_style = NULL;
4470 char *attr_align = NULL;
4471 char *attr_display = NULL;
4472 char *attr_decoration = NULL;
4473 char *attr_wap_marquee_style = NULL;
4474 char *attr_wap_marquee_dir = NULL;
4475 char *attr_wap_marquee_loop = NULL;
4476 char *attr_wap_marquee_speed = NULL;
4477 char *attr_color = NULL;
4478 char *attr_bgcolor = NULL;
4479 char *attr_font_size = NULL;
4480 char *css_clear = NULL;
4482 android = GET_ANDROID(pdoc);
4486 for (attr = qs_get_attr(doc,node);
4488 attr = qs_get_next_attr(doc,attr)) {
4489 char *nm = qs_get_attr_name(doc,attr);
4490 char *val = qs_get_attr_value(doc,attr);
4491 if (STRCASEEQ('a','A',"align",nm)) {
4492 /*----------------------------------------------------------------------*/
4493 /* CHTML 1.0 (W3C version 3.2) */
4494 /*----------------------------------------------------------------------*/
4495 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
4496 attr_align = apr_pstrdup(doc->buf.pool, val);
4499 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
4500 attr_style = apr_pstrdup(doc->buf.pool, val);
4504 if (IS_CSS_ON(android->entryp)) {
4505 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
4507 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
4508 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
4509 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4510 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
4511 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4512 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
4513 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
4514 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4516 css_property_t *cur;
4517 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
4518 if (strcasecmp("-wap-marquee", cur->value) == 0) {
4519 attr_display = apr_pstrdup(doc->pool, cur->value);
4522 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
4523 if (STRCASEEQ('b','B',"blink", cur->value)) {
4524 attr_decoration = apr_pstrdup(doc->pool, cur->value);
4527 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4528 attr_color = apr_pstrdup(doc->pool, cur->value);
4530 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
4531 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
4532 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
4534 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
4535 char *ss = strchr(cur->value, '#');
4537 ss = strstr(cur->value, "rgb");
4540 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
4541 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
4544 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
4545 attr_align = apr_pstrdup(doc->pool, cur->value);
4547 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4548 if ( STRCASEEQ('x','X',"xx-small",cur->value)
4549 || STRCASEEQ('x','X',"x-small",cur->value)
4550 || STRCASEEQ('s','S',"small",cur->value)
4551 || STRCASEEQ('m','M',"medium",cur->value)
4552 || STRCASEEQ('l','L',"large",cur->value)
4553 || STRCASEEQ('x','X',"x-large",cur->value)
4554 || STRCASEEQ('x','X',"xx-large",cur->value)) {
4555 attr_font_size = apr_pstrdup(doc->pool, cur->value);
4559 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4560 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4561 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4562 css_property_t *wap_marquee_speed_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-speed");
4563 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
4564 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
4565 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
4568 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
4569 if (STRCASEEQ('l','L',"ltr",cur->value)) {
4570 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
4572 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
4573 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
4576 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
4577 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
4578 attr_wap_marquee_loop = "infinite";
4581 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
4584 for (cur = wap_marquee_speed_prop->next; cur != wap_marquee_speed_prop; cur = cur->next) {
4585 attr_wap_marquee_speed = apr_pstrdup(doc->pool, cur->value);
4588 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4589 css_clear = apr_pstrdup(doc->pool, cur->value);
4597 || attr_wap_marquee_style
4598 || attr_wap_marquee_dir
4599 || attr_wap_marquee_loop
4600 || attr_wap_marquee_speed
4613 W_L("overflow:-webkit-marquee;");
4615 if (attr_decoration) {
4616 if (STRCASEEQ('b','B',"blink",attr_decoration)) {
4618 if (android->blink_keyframe_out == 0) {
4619 android->style_data = apr_pstrcat(doc->pool, (android->style_data) ? android->style_data : "",
4622 android->blink_keyframe_out = 1;
4626 W_L("text-decoration:");
4627 W_V(attr_decoration);
4631 if (attr_wap_marquee_style) {
4632 W_L("-webkit-marquee-style:");
4633 W_V(attr_wap_marquee_style);
4636 if (attr_wap_marquee_dir) {
4637 W_L("-webkit-marquee-direction:");
4638 if (STRCASEEQ('r','R',"rtl",attr_wap_marquee_dir)) {
4641 else if (STRCASEEQ('l','L',"ltr",attr_wap_marquee_dir)) {
4646 if (attr_wap_marquee_loop) {
4647 W_L("-webkit-marquee-repetition:");
4648 W_V(attr_wap_marquee_loop);
4651 if (attr_wap_marquee_speed) {
4652 W_L("-webkit-marquee-speed:");
4653 W_V(attr_wap_marquee_speed);
4662 W_L("background-color:");
4666 if (attr_font_size) {
4668 W_V(attr_font_size);
4679 return android->out;
4684 * It is a handler who processes the DIV tag.
4686 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
4687 * destination is specified.
4688 * @param node [i] The DIV tag node is specified.
4689 * @return The conversion result is returned.
4692 s_android_end_div_tag(void *pdoc, Node *UNUSED(child))
4698 android = GET_ANDROID(pdoc);
4703 if (IS_CSS_ON(android->entryp)) {
4704 chxj_css_pop_prop_list(android->css_prop_stack);
4706 return android->out;
4711 s_android_chxjif_tag(void *pdoc, Node *node)
4718 android = GET_ANDROID(pdoc);
4722 for (child = qs_get_child_node(doc, node);
4724 child = qs_get_next_node(doc, child)) {
4726 s_android_chxjif_tag(android, child);
4733 * It is a handler who processes the TEXTARE tag.
4735 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
4736 * destination is specified.
4737 * @param node [i] The TEXTAREA tag node is specified.
4738 * @return The conversion result is returned.
4741 s_android_start_textarea_tag(void *pdoc, Node *node)
4747 char *attr_accesskey = NULL;
4748 char *attr_name = NULL;
4749 char *attr_rows = NULL;
4750 char *attr_cols = NULL;
4751 char *attr_istyle = NULL;
4752 char *attr_style = NULL;
4755 android = GET_ANDROID(pdoc);
4759 android->textarea_flag++;
4760 for (attr = qs_get_attr(doc,node);
4762 attr = qs_get_next_attr(doc,attr)) {
4763 char *name = qs_get_attr_name(doc,attr);
4764 char *value = qs_get_attr_value(doc,attr);
4765 if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
4766 attr_accesskey = value;
4768 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
4769 attr_istyle = value;
4771 else if (STRCASEEQ('n','N',"name", name) && value && *value) {
4774 else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
4777 else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
4780 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4784 if (IS_CSS_ON(android->entryp)) {
4785 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
4787 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
4788 css_property_t *cur;
4789 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
4790 if (strcasestr(cur->value, "<ja:n>")) {
4793 else if (strcasestr(cur->value, "<ja:en>")) {
4796 else if (strcasestr(cur->value, "<ja:hk>")) {
4799 else if (strcasestr(cur->value, "<ja:h>")) {
4822 return android->out;
4827 * It is a handler who processes the TEXTAREA tag.
4829 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
4830 * destination is specified.
4831 * @param node [i] The TEXTAREA tag node is specified.
4832 * @return The conversion result is returned.
4835 s_android_end_textarea_tag(void *pdoc, Node *UNUSED(child))
4841 android = GET_ANDROID(pdoc);
4846 android->textarea_flag--;
4848 return android->out;
4853 * It is a handler who processes the B tag.
4855 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
4856 * destination is specified.
4857 * @param node [i] The B tag node is specified.
4858 * @return The conversion result is returned.
4861 s_android_start_b_tag(void* pdoc, Node* UNUSED(node))
4867 android = GET_ANDROID(pdoc);
4872 return android->out;
4877 * It is a handler who processes the B tag.
4879 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
4880 * destination is specified.
4881 * @param node [i] The B tag node is specified.
4882 * @return The conversion result is returned.
4885 s_android_end_b_tag(void* pdoc, Node* UNUSED(child))
4887 android_t* android = GET_ANDROID(pdoc);
4888 Doc* doc = android->doc;
4891 return android->out;
4895 s_android_text_tag(void* pdoc, Node* child)
4906 apr_size_t z2h_input_len;
4908 android = GET_ANDROID(pdoc);
4912 textval = qs_get_node_value(doc,child);
4913 if (strlen(textval) == 0) {
4914 return android->out;
4917 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
4918 memset(tmp, 0, qs_get_node_size(doc,child)+1);
4920 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
4921 memset(one_byte, 0, sizeof(one_byte));
4924 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
4926 int rtn = s_android_search_emoji(android, &textval[ii], &out);
4928 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
4933 if (is_sjis_kanji(textval[ii])) {
4934 one_byte[0] = textval[ii+0];
4935 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4936 one_byte[0] = textval[ii+1];
4937 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4941 if (android->pre_flag) {
4942 one_byte[0] = textval[ii+0];
4943 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4946 if (android->textarea_flag) {
4947 one_byte[0] = textval[ii+0];
4948 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4951 if (textval[ii] != '\r' && textval[ii] != '\n') {
4952 one_byte[0] = textval[ii+0];
4953 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4957 z2h_input_len = strlen(tdst);
4958 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, android->entryp);
4961 return android->out;
4966 * It is a handler who processes the BLOCKQUOTE tag.
4968 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
4969 * destination is specified.
4970 * @param node [i] The BLOCKQUOTE tag node is specified.
4971 * @return The conversion result is returned.
4974 s_android_start_blockquote_tag(void *pdoc, Node *node)
4979 char *attr_style = NULL;
4980 char *attr_color = NULL;
4981 char *attr_size = NULL;
4982 char *css_clear = NULL;
4984 android = GET_ANDROID(pdoc);
4986 for (attr = qs_get_attr(doc,node);
4988 attr = qs_get_next_attr(doc,attr)) {
4989 char *nm = qs_get_attr_name(doc,attr);
4990 char *val = qs_get_attr_value(doc,attr);
4991 if (val && STRCASEEQ('s','S',"style", nm)) {
4995 if (IS_CSS_ON(android->entryp)) {
4996 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
4998 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4999 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
5000 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5002 css_property_t *cur;
5003 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5004 if (cur->value && *cur->value) {
5005 attr_color = apr_pstrdup(doc->pool, cur->value);
5008 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
5009 if (cur->value && *cur->value) {
5010 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5011 attr_size = apr_pstrdup(doc->pool, cur->value);
5013 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5014 attr_size = apr_pstrdup(doc->pool, cur->value);
5016 else if (STRCASEEQ('s','S',"small",cur->value)) {
5017 attr_size = apr_pstrdup(doc->pool, cur->value);
5019 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5020 attr_size = apr_pstrdup(doc->pool, cur->value);
5022 else if (STRCASEEQ('l','L',"large",cur->value)) {
5023 attr_size = apr_pstrdup(doc->pool, cur->value);
5025 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5026 attr_size = apr_pstrdup(doc->pool, cur->value);
5028 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5029 attr_size = apr_pstrdup(doc->pool, cur->value);
5033 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5034 css_clear = apr_pstrdup(doc->pool, cur->value);
5039 if (attr_color || attr_size || css_clear) {
5042 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5060 return android->out;
5065 * It is a handler who processes the BLOCKQUOTE tag.
5067 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
5068 * destination is specified.
5069 * @param node [i] The BLOCKQUOTE tag node is specified.
5070 * @return The conversion result is returned.
5073 s_android_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
5075 android_t *android = GET_ANDROID(pdoc);
5076 Doc *doc = android->doc;
5077 W_L("</blockquote>");
5078 if (IS_CSS_ON(android->entryp)) {
5079 chxj_css_pop_prop_list(android->css_prop_stack);
5081 return android->out;
5086 * It is a handler who processes the DIR tag.
5088 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
5089 * destination is specified.
5090 * @param node [i] The DIR tag node is specified.
5091 * @return The conversion result is returned.
5094 s_android_start_dir_tag(void *pdoc, Node *node)
5096 android_t *android = GET_ANDROID(pdoc);
5097 Doc *doc = android->doc;
5099 char *attr_style = NULL;
5100 char *attr_color = NULL;
5101 char *attr_type = NULL;
5102 char *attr_size = NULL;
5103 for (attr = qs_get_attr(doc,node);
5105 attr = qs_get_next_attr(doc,attr)) {
5106 char *name = qs_get_attr_name(doc,attr);
5107 char *value = qs_get_attr_value(doc,attr);
5108 if (STRCASEEQ('t','T',"type",name)) {
5109 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
5113 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
5117 if (IS_CSS_ON(android->entryp)) {
5118 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
5120 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5121 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5122 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
5123 css_property_t *cur;
5124 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5125 if (cur->value && *cur->value) {
5126 attr_color = apr_pstrdup(doc->pool, cur->value);
5129 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5130 if (cur->value && *cur->value) {
5131 attr_type = apr_pstrdup(doc->pool, cur->value);
5134 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5135 if (cur->value && *cur->value) {
5136 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5137 attr_size = apr_pstrdup(doc->pool, cur->value);
5139 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5140 attr_size = apr_pstrdup(doc->pool, cur->value);
5142 else if (STRCASEEQ('s','S',"small",cur->value)) {
5143 attr_size = apr_pstrdup(doc->pool, cur->value);
5145 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5146 attr_size = apr_pstrdup(doc->pool, cur->value);
5148 else if (STRCASEEQ('l','L',"large",cur->value)) {
5149 attr_size = apr_pstrdup(doc->pool, cur->value);
5151 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5152 attr_size = apr_pstrdup(doc->pool, cur->value);
5154 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5155 attr_size = apr_pstrdup(doc->pool, cur->value);
5162 if (attr_type || attr_color || attr_size) {
5165 W_L("list-style-type:");
5170 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5183 return android->out;
5188 * It is a handler who processes the DIR tag.
5190 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
5191 * destination is specified.
5192 * @param node [i] The DIR tag node is specified.
5193 * @return The conversion result is returned.
5196 s_android_end_dir_tag(void *pdoc, Node *UNUSED(child))
5198 android_t *android = GET_ANDROID(pdoc);
5199 Doc *doc = android->doc;
5201 if (IS_CSS_ON(android->entryp)) {
5202 chxj_css_pop_prop_list(android->css_prop_stack);
5204 return android->out;
5209 * It is a handler who processes the DL tag.
5211 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
5212 * destination is specified.
5213 * @param node [i] The DL tag node is specified.
5214 * @return The conversion result is returned.
5217 s_android_start_dl_tag(void *pdoc, Node *node)
5219 android_t *android = GET_ANDROID(pdoc);
5220 Doc *doc = android->doc;
5222 char *attr_style = NULL;
5223 char *attr_color = NULL;
5224 char *attr_size = NULL;
5225 char *css_clear = NULL;
5227 for (attr = qs_get_attr(doc,node);
5229 attr = qs_get_next_attr(doc,attr)) {
5230 char *name = qs_get_attr_name(doc,attr);
5231 char *value = qs_get_attr_value(doc,attr);
5232 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5236 if (IS_CSS_ON(android->entryp)) {
5237 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
5239 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5240 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5241 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5243 css_property_t *cur;
5244 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5245 if (cur->value && *cur->value) {
5246 attr_color = apr_pstrdup(doc->pool, cur->value);
5249 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5250 if (cur->value && *cur->value) {
5251 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5252 attr_size = apr_pstrdup(doc->pool, cur->value);
5254 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5255 attr_size = apr_pstrdup(doc->pool, cur->value);
5257 else if (STRCASEEQ('s','S',"small",cur->value)) {
5258 attr_size = apr_pstrdup(doc->pool, cur->value);
5260 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5261 attr_size = apr_pstrdup(doc->pool, cur->value);
5263 else if (STRCASEEQ('l','L',"large",cur->value)) {
5264 attr_size = apr_pstrdup(doc->pool, cur->value);
5266 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5267 attr_size = apr_pstrdup(doc->pool, cur->value);
5269 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5270 attr_size = apr_pstrdup(doc->pool, cur->value);
5274 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5275 css_clear = apr_pstrdup(doc->pool, cur->value);
5280 if (attr_color || attr_size || css_clear) {
5283 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5301 return android->out;
5306 * It is a handler who processes the DL tag.
5308 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
5309 * destination is specified.
5310 * @param node [i] The DL tag node is specified.
5311 * @return The conversion result is returned.
5314 s_android_end_dl_tag(void *pdoc, Node *UNUSED(child))
5316 android_t *android = GET_ANDROID(pdoc);
5317 Doc *doc = android->doc;
5319 if (IS_CSS_ON(android->entryp)) {
5320 chxj_css_pop_prop_list(android->css_prop_stack);
5322 return android->out;
5327 * It is a handler who processes the DT tag.
5329 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
5330 * destination is specified.
5331 * @param node [i] The DT tag node is specified.
5332 * @return The conversion result is returned.
5335 s_android_start_dt_tag(void *pdoc, Node *node)
5337 android_t *android = GET_ANDROID(pdoc);
5338 Doc *doc = android->doc;
5340 char *attr_style = NULL;
5341 char *attr_color = NULL;
5342 char *attr_size = NULL;
5343 for (attr = qs_get_attr(doc,node);
5345 attr = qs_get_next_attr(doc,attr)) {
5346 char *name = qs_get_attr_name(doc,attr);
5347 char *value = qs_get_attr_value(doc,attr);
5348 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5352 if (IS_CSS_ON(android->entryp)) {
5353 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
5355 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5356 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5357 css_property_t *cur;
5358 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5359 if (cur->value && *cur->value) {
5360 attr_color = apr_pstrdup(doc->pool, cur->value);
5363 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5364 if (cur->value && *cur->value) {
5365 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5366 attr_size = apr_pstrdup(doc->pool, cur->value);
5368 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5369 attr_size = apr_pstrdup(doc->pool, cur->value);
5371 else if (STRCASEEQ('s','S',"small",cur->value)) {
5372 attr_size = apr_pstrdup(doc->pool, cur->value);
5374 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5375 attr_size = apr_pstrdup(doc->pool, cur->value);
5377 else if (STRCASEEQ('l','L',"large",cur->value)) {
5378 attr_size = apr_pstrdup(doc->pool, cur->value);
5380 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5381 attr_size = apr_pstrdup(doc->pool, cur->value);
5383 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5384 attr_size = apr_pstrdup(doc->pool, cur->value);
5391 if (attr_color || attr_size) {
5394 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5407 return android->out;
5412 * It is a handler who processes the DT tag.
5414 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
5415 * destination is specified.
5416 * @param node [i] The DT tag node is specified.
5417 * @return The conversion result is returned.
5420 s_android_end_dt_tag(void *pdoc, Node *UNUSED(child))
5422 android_t *android = GET_ANDROID(pdoc);
5423 Doc *doc = android->doc;
5425 if (IS_CSS_ON(android->entryp)) {
5426 chxj_css_pop_prop_list(android->css_prop_stack);
5428 return android->out;
5433 * It is a handler who processes the DD tag.
5435 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
5436 * destination is specified.
5437 * @param node [i] The DD tag node is specified.
5438 * @return The conversion result is returned.
5441 s_android_start_dd_tag(void *pdoc, Node *node)
5443 android_t *android = GET_ANDROID(pdoc);
5444 Doc *doc = android->doc;
5446 char *attr_style = NULL;
5447 char *attr_color = NULL;
5448 char *attr_size = NULL;
5449 for (attr = qs_get_attr(doc,node);
5451 attr = qs_get_next_attr(doc,attr)) {
5452 char *name = qs_get_attr_name(doc,attr);
5453 char *value = qs_get_attr_value(doc,attr);
5454 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5458 if (IS_CSS_ON(android->entryp)) {
5459 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
5461 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5462 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5463 css_property_t *cur;
5464 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5465 if (cur->value && *cur->value) {
5466 attr_color = apr_pstrdup(doc->pool, cur->value);
5469 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5470 if (cur->value && *cur->value) {
5471 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5472 attr_size = apr_pstrdup(doc->pool, cur->value);
5474 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5475 attr_size = apr_pstrdup(doc->pool, cur->value);
5477 else if (STRCASEEQ('s','S',"small",cur->value)) {
5478 attr_size = apr_pstrdup(doc->pool, cur->value);
5480 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5481 attr_size = apr_pstrdup(doc->pool, cur->value);
5483 else if (STRCASEEQ('l','L',"large",cur->value)) {
5484 attr_size = apr_pstrdup(doc->pool, cur->value);
5486 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5487 attr_size = apr_pstrdup(doc->pool, cur->value);
5489 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5490 attr_size = apr_pstrdup(doc->pool, cur->value);
5497 if (attr_color || attr_size) {
5500 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5513 return android->out;
5518 * It is a handler who processes the DD tag.
5520 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
5521 * destination is specified.
5522 * @param node [i] The DD tag node is specified.
5523 * @return The conversion result is returned.
5526 s_android_end_dd_tag(void *pdoc, Node *UNUSED(child))
5528 android_t *android = GET_ANDROID(pdoc);
5529 Doc *doc = android->doc;
5531 if (IS_CSS_ON(android->entryp)) {
5532 chxj_css_pop_prop_list(android->css_prop_stack);
5534 return android->out;
5539 * It is a handler who processes the H1 tag.
5541 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
5542 * destination is specified.
5543 * @param node [i] The H1 tag node is specified.
5544 * @return The conversion result is returned.
5547 s_android_start_h1_tag(void *pdoc, Node *node)
5553 char *attr_style = NULL;
5554 char *attr_align = NULL;
5555 char *css_clear = NULL;
5557 android = GET_ANDROID(pdoc);
5561 for (attr = qs_get_attr(doc,node);
5563 attr = qs_get_next_attr(doc,attr)) {
5564 char *name = qs_get_attr_name(doc,attr);
5565 char *value = qs_get_attr_value(doc,attr);
5566 if (STRCASEEQ('a','A',"align", name)) {
5567 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5571 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5575 if (IS_CSS_ON(android->entryp)) {
5576 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
5578 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5579 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5580 css_property_t *cur;
5581 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5582 if (STRCASEEQ('l','L',"left", cur->value)) {
5583 attr_align = apr_pstrdup(doc->pool, "left");
5585 else if (STRCASEEQ('c','C',"center",cur->value)) {
5586 attr_align = apr_pstrdup(doc->pool, "center");
5588 else if (STRCASEEQ('r','R',"right",cur->value)) {
5589 attr_align = apr_pstrdup(doc->pool, "right");
5592 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5593 if (STRCASEEQ('b','B',"both", cur->value)) {
5594 css_clear = apr_pstrdup(doc->pool, "both");
5596 else if (STRCASEEQ('r','R',"right", cur->value)) {
5597 css_clear = apr_pstrdup(doc->pool, "right");
5599 else if (STRCASEEQ('l','L',"left", cur->value)) {
5600 css_clear = apr_pstrdup(doc->pool, "left");
5606 if (attr_align || css_clear ) {
5622 return android->out;
5627 * It is a handler who processes the H1 tag.
5629 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
5630 * destination is specified.
5631 * @param node [i] The H1 tag node is specified.
5632 * @return The conversion result is returned.
5635 s_android_end_h1_tag(void *pdoc, Node *UNUSED(child))
5641 android = GET_ANDROID(pdoc);
5646 if (IS_CSS_ON(android->entryp)) {
5647 chxj_css_pop_prop_list(android->css_prop_stack);
5650 return android->out;
5655 * It is a handler who processes the H2 tag.
5657 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
5658 * destination is specified.
5659 * @param node [i] The H1 tag node is specified.
5660 * @return The conversion result is returned.
5663 s_android_start_h2_tag(void *pdoc, Node *node)
5669 char *attr_style = NULL;
5670 char *attr_align = NULL;
5671 char *css_clear = NULL;
5673 android = GET_ANDROID(pdoc);
5677 for (attr = qs_get_attr(doc,node);
5679 attr = qs_get_next_attr(doc,attr)) {
5680 char *name = qs_get_attr_name(doc,attr);
5681 char *value = qs_get_attr_value(doc,attr);
5682 if (STRCASEEQ('a','A',"align", name)) {
5683 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5687 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5691 if (IS_CSS_ON(android->entryp)) {
5692 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
5694 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5695 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5696 css_property_t *cur;
5697 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5698 if (STRCASEEQ('l','L',"left", cur->value)) {
5699 attr_align = apr_pstrdup(doc->pool, "left");
5701 else if (STRCASEEQ('c','C',"center",cur->value)) {
5702 attr_align = apr_pstrdup(doc->pool, "center");
5704 else if (STRCASEEQ('r','R',"right",cur->value)) {
5705 attr_align = apr_pstrdup(doc->pool, "right");
5708 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5709 if (STRCASEEQ('b','B',"both", cur->value)) {
5710 css_clear = apr_pstrdup(doc->pool, "both");
5712 else if (STRCASEEQ('r','R',"right", cur->value)) {
5713 css_clear = apr_pstrdup(doc->pool, "right");
5715 else if (STRCASEEQ('l','L',"left", cur->value)) {
5716 css_clear = apr_pstrdup(doc->pool, "left");
5722 if (attr_align || css_clear ) {
5738 return android->out;
5743 * It is a handler who processes the H2 tag.
5745 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
5746 * destination is specified.
5747 * @param node [i] The H1 tag node is specified.
5748 * @return The conversion result is returned.
5751 s_android_end_h2_tag(void *pdoc, Node *UNUSED(child))
5757 android = GET_ANDROID(pdoc);
5762 if (IS_CSS_ON(android->entryp)) {
5763 chxj_css_pop_prop_list(android->css_prop_stack);
5765 return android->out;
5770 * It is a handler who processes the H3 tag.
5772 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
5773 * destination is specified.
5774 * @param node [i] The H1 tag node is specified.
5775 * @return The conversion result is returned.
5778 s_android_start_h3_tag(void *pdoc, Node *node)
5784 char *attr_style = NULL;
5785 char *attr_align = NULL;
5786 char *css_clear = NULL;
5788 android = GET_ANDROID(pdoc);
5792 for (attr = qs_get_attr(doc,node);
5794 attr = qs_get_next_attr(doc,attr)) {
5795 char *name = qs_get_attr_name(doc,attr);
5796 char *value = qs_get_attr_value(doc,attr);
5797 if (STRCASEEQ('a','A',"align", name)) {
5798 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5802 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5806 if (IS_CSS_ON(android->entryp)) {
5807 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
5809 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5810 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5811 css_property_t *cur;
5812 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5813 if (STRCASEEQ('l','L',"left", cur->value)) {
5814 attr_align = apr_pstrdup(doc->pool, "left");
5816 else if (STRCASEEQ('c','C',"center",cur->value)) {
5817 attr_align = apr_pstrdup(doc->pool, "center");
5819 else if (STRCASEEQ('r','R',"right",cur->value)) {
5820 attr_align = apr_pstrdup(doc->pool, "right");
5823 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5824 if (STRCASEEQ('b','B',"both", cur->value)) {
5825 css_clear = apr_pstrdup(doc->pool, "both");
5827 else if (STRCASEEQ('r','R',"right", cur->value)) {
5828 css_clear = apr_pstrdup(doc->pool, "right");
5830 else if (STRCASEEQ('l','L',"left", cur->value)) {
5831 css_clear = apr_pstrdup(doc->pool, "left");
5837 if (attr_align || css_clear ) {
5853 return android->out;
5858 * It is a handler who processes the H3 tag.
5860 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
5861 * destination is specified.
5862 * @param node [i] The H1 tag node is specified.
5863 * @return The conversion result is returned.
5866 s_android_end_h3_tag(void *pdoc, Node *UNUSED(child))
5872 android = GET_ANDROID(pdoc);
5877 if (IS_CSS_ON(android->entryp)) {
5878 chxj_css_pop_prop_list(android->css_prop_stack);
5880 return android->out;
5885 * It is a handler who processes the H4 tag.
5887 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
5888 * destination is specified.
5889 * @param node [i] The H1 tag node is specified.
5890 * @return The conversion result is returned.
5893 s_android_start_h4_tag(void *pdoc, Node *node)
5899 char *attr_style = NULL;
5900 char *attr_align = NULL;
5901 char *css_clear = NULL;
5903 android = GET_ANDROID(pdoc);
5907 for (attr = qs_get_attr(doc,node);
5909 attr = qs_get_next_attr(doc,attr)) {
5910 char *name = qs_get_attr_name(doc,attr);
5911 char *value = qs_get_attr_value(doc,attr);
5912 if (STRCASEEQ('a','A',"align", name)) {
5913 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5917 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5921 if (IS_CSS_ON(android->entryp)) {
5922 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
5924 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5925 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5926 css_property_t *cur;
5927 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5928 if (STRCASEEQ('l','L',"left", cur->value)) {
5929 attr_align = apr_pstrdup(doc->pool, "left");
5931 else if (STRCASEEQ('c','C',"center",cur->value)) {
5932 attr_align = apr_pstrdup(doc->pool, "center");
5934 else if (STRCASEEQ('r','R',"right",cur->value)) {
5935 attr_align = apr_pstrdup(doc->pool, "right");
5938 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5939 if (STRCASEEQ('b','B',"both", cur->value)) {
5940 css_clear = apr_pstrdup(doc->pool, "both");
5942 else if (STRCASEEQ('r','R',"right", cur->value)) {
5943 css_clear = apr_pstrdup(doc->pool, "right");
5945 else if (STRCASEEQ('l','L',"left", cur->value)) {
5946 css_clear = apr_pstrdup(doc->pool, "left");
5952 if (attr_align || css_clear ) {
5968 return android->out;
5973 * It is a handler who processes the H4 tag.
5975 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
5976 * destination is specified.
5977 * @param node [i] The H1 tag node is specified.
5978 * @return The conversion result is returned.
5981 s_android_end_h4_tag(void *pdoc, Node *UNUSED(child))
5987 android = GET_ANDROID(pdoc);
5992 if (IS_CSS_ON(android->entryp)) {
5993 chxj_css_pop_prop_list(android->css_prop_stack);
5996 return android->out;
6001 * It is a handler who processes the H5 tag.
6003 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
6004 * destination is specified.
6005 * @param node [i] The H1 tag node is specified.
6006 * @return The conversion result is returned.
6009 s_android_start_h5_tag(void *pdoc, Node *node)
6015 char *attr_style = NULL;
6016 char *attr_align = NULL;
6017 char *css_clear = NULL;
6019 android = GET_ANDROID(pdoc);
6023 for (attr = qs_get_attr(doc,node);
6025 attr = qs_get_next_attr(doc,attr)) {
6026 char *name = qs_get_attr_name(doc,attr);
6027 char *value = qs_get_attr_value(doc,attr);
6028 if (STRCASEEQ('a','A',"align", name)) {
6029 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
6033 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
6037 if (IS_CSS_ON(android->entryp)) {
6038 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
6040 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
6041 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
6042 css_property_t *cur;
6043 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
6044 if (STRCASEEQ('l','L',"left", cur->value)) {
6045 attr_align = apr_pstrdup(doc->pool, "left");
6047 else if (STRCASEEQ('c','C',"center",cur->value)) {
6048 attr_align = apr_pstrdup(doc->pool, "center");
6050 else if (STRCASEEQ('r','R',"right",cur->value)) {
6051 attr_align = apr_pstrdup(doc->pool, "right");
6054 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
6055 if (STRCASEEQ('b','B',"both", cur->value)) {
6056 css_clear = apr_pstrdup(doc->pool, "both");
6058 else if (STRCASEEQ('r','R',"right", cur->value)) {
6059 css_clear = apr_pstrdup(doc->pool, "right");
6061 else if (STRCASEEQ('l','L',"left", cur->value)) {
6062 css_clear = apr_pstrdup(doc->pool, "left");
6068 if (attr_align || css_clear ) {
6084 return android->out;
6089 * It is a handler who processes the H5 tag.
6091 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
6092 * destination is specified.
6093 * @param node [i] The H1 tag node is specified.
6094 * @return The conversion result is returned.
6097 s_android_end_h5_tag(void *pdoc, Node *UNUSED(child))
6103 android = GET_ANDROID(pdoc);
6108 if (IS_CSS_ON(android->entryp)) {
6109 chxj_css_pop_prop_list(android->css_prop_stack);
6112 return android->out;
6117 * It is a handler who processes the H6 tag.
6119 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
6120 * destination is specified.
6121 * @param node [i] The H1 tag node is specified.
6122 * @return The conversion result is returned.
6125 s_android_start_h6_tag(void *pdoc, Node *node)
6131 char *attr_style = NULL;
6132 char *attr_align = NULL;
6133 char *css_clear = NULL;
6135 android = GET_ANDROID(pdoc);
6139 for (attr = qs_get_attr(doc,node);
6141 attr = qs_get_next_attr(doc,attr)) {
6142 char *name = qs_get_attr_name(doc,attr);
6143 char *value = qs_get_attr_value(doc,attr);
6144 if (STRCASEEQ('a','A',"align", name)) {
6145 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
6149 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
6153 if (IS_CSS_ON(android->entryp)) {
6154 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
6156 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
6157 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
6158 css_property_t *cur;
6159 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
6160 if (STRCASEEQ('l','L',"left", cur->value)) {
6161 attr_align = apr_pstrdup(doc->pool, "left");
6163 else if (STRCASEEQ('c','C',"center",cur->value)) {
6164 attr_align = apr_pstrdup(doc->pool, "center");
6166 else if (STRCASEEQ('r','R',"right",cur->value)) {
6167 attr_align = apr_pstrdup(doc->pool, "right");
6170 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
6171 if (STRCASEEQ('b','B',"both", cur->value)) {
6172 css_clear = apr_pstrdup(doc->pool, "both");
6174 else if (STRCASEEQ('r','R',"right", cur->value)) {
6175 css_clear = apr_pstrdup(doc->pool, "right");
6177 else if (STRCASEEQ('l','L',"left", cur->value)) {
6178 css_clear = apr_pstrdup(doc->pool, "left");
6184 if (attr_align || css_clear ) {
6200 return android->out;
6205 * It is a handler who processes the H6 tag.
6207 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
6208 * destination is specified.
6209 * @param node [i] The H1 tag node is specified.
6210 * @return The conversion result is returned.
6213 s_android_end_h6_tag(void *pdoc, Node *UNUSED(child))
6219 android = GET_ANDROID(pdoc);
6224 if (IS_CSS_ON(android->entryp)) {
6225 chxj_css_pop_prop_list(android->css_prop_stack);
6228 return android->out;
6233 * It is a handler who processes the MENU tag.
6235 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
6236 * destination is specified.
6237 * @param node [i] The MENU tag node is specified.
6238 * @return The conversion result is returned.
6241 s_android_start_menu_tag(void *pdoc, Node *node)
6243 android_t *android = GET_ANDROID(pdoc);
6244 Doc *doc = android->doc;
6246 char *attr_style = NULL;
6247 char *attr_color = NULL;
6248 char *attr_type = NULL;
6249 char *attr_size = NULL;
6250 for (attr = qs_get_attr(doc,node);
6252 attr = qs_get_next_attr(doc,attr)) {
6253 char *name = qs_get_attr_name(doc,attr);
6254 char *value = qs_get_attr_value(doc,attr);
6255 if (STRCASEEQ('t','T',"type",name)) {
6256 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
6260 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
6264 if (IS_CSS_ON(android->entryp)) {
6265 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
6267 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6268 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6269 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
6270 css_property_t *cur;
6271 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6272 if (cur->value && *cur->value) {
6273 attr_color = apr_pstrdup(doc->pool, cur->value);
6276 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
6277 if (cur->value && *cur->value) {
6278 attr_type = apr_pstrdup(doc->pool, cur->value);
6281 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6282 if (cur->value && *cur->value) {
6283 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
6284 attr_size = apr_pstrdup(doc->pool, cur->value);
6286 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
6287 attr_size = apr_pstrdup(doc->pool, cur->value);
6289 else if (STRCASEEQ('s','S',"small",cur->value)) {
6290 attr_size = apr_pstrdup(doc->pool, cur->value);
6292 else if (STRCASEEQ('m','M',"medium",cur->value)) {
6293 attr_size = apr_pstrdup(doc->pool, cur->value);
6295 else if (STRCASEEQ('l','L',"large",cur->value)) {
6296 attr_size = apr_pstrdup(doc->pool, cur->value);
6298 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
6299 attr_size = apr_pstrdup(doc->pool, cur->value);
6301 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
6302 attr_size = apr_pstrdup(doc->pool, cur->value);
6309 if (attr_type || attr_color || attr_size) {
6312 W_L("list-style-type:");
6317 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6330 return android->out;
6335 * It is a handler who processes the MENU tag.
6337 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
6338 * destination is specified.
6339 * @param node [i] The MENU tag node is specified.
6340 * @return The conversion result is returned.
6343 s_android_end_menu_tag(void *pdoc, Node *UNUSED(child))
6345 android_t *android = GET_ANDROID(pdoc);
6346 Doc *doc = android->doc;
6348 if (IS_CSS_ON(android->entryp)) {
6349 chxj_css_pop_prop_list(android->css_prop_stack);
6351 return android->out;
6356 * It is a handler who processes the PLAINTEXT tag.
6358 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
6359 * destination is specified.
6360 * @param node [i] The PLAINTEXT tag node is specified.
6361 * @return The conversion result is returned.
6364 s_android_start_plaintext_tag(void *pdoc, Node *node)
6369 android = GET_ANDROID(pdoc);
6372 s_android_start_plaintext_tag_inner(pdoc,node);
6373 return android->out;
6377 s_android_start_plaintext_tag_inner(void *pdoc, Node *node)
6382 android = GET_ANDROID(pdoc);
6384 for (child = qs_get_child_node(doc, node);
6386 child = qs_get_next_node(doc, child)) {
6388 s_android_start_plaintext_tag_inner(pdoc, child);
6390 return android->out;
6395 * It is a handler who processes the PLAINTEXT tag.
6397 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
6398 * destination is specified.
6399 * @param node [i] The PLAINTEXT tag node is specified.
6400 * @return The conversion result is returned.
6403 s_android_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
6405 android_t *android = GET_ANDROID(pdoc);
6406 return android->out;
6411 * It is a handler who processes the BLINK tag.
6413 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
6414 * destination is specified.
6415 * @param node [i] The BLINK tag node is specified.
6416 * @return The conversion result is returned.
6419 s_android_start_blink_tag(void *pdoc, Node *node)
6421 android_t *android = GET_ANDROID(pdoc);
6422 Doc *doc = android->doc;
6424 char *attr_style = NULL;
6425 char *attr_color = NULL;
6426 char *attr_size = NULL;
6427 for (attr = qs_get_attr(doc,node);
6429 attr = qs_get_next_attr(doc,attr)) {
6430 char *name = qs_get_attr_name(doc,attr);
6431 char *value = qs_get_attr_value(doc,attr);
6432 if (STRCASEEQ('s','S',"style", name) && value && *value) {
6436 if (IS_CSS_ON(android->entryp)) {
6437 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
6439 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6440 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6441 css_property_t *cur;
6442 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6443 if (cur->value && *cur->value) {
6444 attr_color = apr_pstrdup(doc->pool, cur->value);
6447 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6448 if (cur->value && *cur->value) {
6449 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
6450 attr_size = apr_pstrdup(doc->pool, cur->value);
6452 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
6453 attr_size = apr_pstrdup(doc->pool, cur->value);
6455 else if (STRCASEEQ('s','S',"small",cur->value)) {
6456 attr_size = apr_pstrdup(doc->pool, cur->value);
6458 else if (STRCASEEQ('m','M',"medium",cur->value)) {
6459 attr_size = apr_pstrdup(doc->pool, cur->value);
6461 else if (STRCASEEQ('l','L',"large",cur->value)) {
6462 attr_size = apr_pstrdup(doc->pool, cur->value);
6464 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
6465 attr_size = apr_pstrdup(doc->pool, cur->value);
6467 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
6468 attr_size = apr_pstrdup(doc->pool, cur->value);
6478 if (android->blink_keyframe_out == 0) {
6479 android->style_data = apr_pstrcat(doc->pool, (android->style_data) ? android->style_data : "",
6482 android->blink_keyframe_out = 1;
6485 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6498 return android->out;
6503 * It is a handler who processes the BLINK tag.
6505 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
6506 * destination is specified.
6507 * @param node [i] The BLINK tag node is specified.
6508 * @return The conversion result is returned.
6511 s_android_end_blink_tag(void *pdoc, Node *UNUSED(child))
6513 android_t *android = GET_ANDROID(pdoc);
6514 Doc *doc = android->doc;
6516 if (IS_CSS_ON(android->entryp)) {
6517 chxj_css_pop_prop_list(android->css_prop_stack);
6519 return android->out;
6524 * It is a handler who processes the MARQUEE tag.
6526 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
6527 * destination is specified.
6528 * @param node [i] The MARQUEE tag node is specified.
6529 * @return The conversion result is returned.
6532 s_android_start_marquee_tag(void *pdoc, Node *node)
6534 android_t *android = GET_ANDROID(pdoc);
6535 Doc *doc = android->doc;
6537 char *attr_style = NULL;
6538 char *attr_color = NULL;
6539 char *attr_size = NULL;
6540 char *attr_wap_marquee_loop = NULL;
6541 char *attr_wap_marquee_style = NULL;
6542 char *attr_wap_marquee_dir = NULL;
6543 char *attr_wap_marquee_speed = NULL;
6544 char *attr_bgcolor = NULL;
6545 /*--------------------------------------------------------------------------*/
6546 /* Get Attributes */
6547 /*--------------------------------------------------------------------------*/
6548 for (attr = qs_get_attr(doc,node);
6550 attr = qs_get_next_attr(doc,attr)) {
6551 char *name = qs_get_attr_name(doc,attr);
6552 char *value = qs_get_attr_value(doc,attr);
6553 if (STRCASEEQ('d','D',"direction", name)) {
6555 if (STRCASEEQ('l','L',"left",value)) {
6556 attr_wap_marquee_dir = "rtl";
6558 else if (STRCASEEQ('r','R',"right",value)) {
6559 attr_wap_marquee_dir = "ltr";
6563 else if (STRCASEEQ('b','B',"behavior",name)) {
6564 if (value && *value) {
6565 attr_wap_marquee_style = value;
6568 else if (STRCASEEQ('l','L',"loop",name)) {
6569 if (value && *value) {
6570 if(strcmp(value,"0") == 0 || strcmp(value,"-1") == 0){
6571 attr_wap_marquee_loop = "infinite";
6574 attr_wap_marquee_loop = value;
6578 else if (STRCASEEQ('b','B',"bgcolor",name)) {
6579 if (value && *value) {
6580 attr_bgcolor = value;
6583 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
6587 if (IS_CSS_ON(android->entryp)) {
6588 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
6590 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6591 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6592 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
6593 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
6594 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
6595 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
6596 css_property_t *wap_marquee_speed_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-speed");
6597 css_property_t *cur;
6598 if (!attr_wap_marquee_style) {
6599 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
6600 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
6601 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
6605 if (!attr_wap_marquee_dir) {
6606 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
6607 if (STRCASEEQ('l','L',"ltr",cur->value)) {
6608 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
6610 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
6611 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
6615 if (!attr_wap_marquee_loop) {
6616 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
6617 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
6618 attr_wap_marquee_loop = "infinite";
6621 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
6625 if (!attr_wap_marquee_speed) {
6626 for (cur = wap_marquee_speed_prop->next; cur != wap_marquee_speed_prop; cur = cur->next) {
6627 attr_wap_marquee_speed = apr_pstrdup(doc->pool, cur->value);
6630 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6631 if (cur->value && *cur->value) {
6632 attr_color = apr_pstrdup(doc->pool, cur->value);
6635 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
6636 if (cur->value && *cur->value) {
6637 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
6640 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6641 if (cur->value && *cur->value) {
6642 if ( STRCASEEQ('x','X',"xx-small",cur->value)
6643 || STRCASEEQ('x','X',"x-small", cur->value)
6644 || STRCASEEQ('s','S',"small", cur->value)
6645 || STRCASEEQ('m','M',"medium", cur->value)
6646 || STRCASEEQ('l','L',"large", cur->value)
6647 || STRCASEEQ('x','X',"x-large", cur->value)
6648 || STRCASEEQ('x','X',"xx-large",cur->value)) {
6649 attr_size = apr_pstrdup(doc->pool, cur->value);
6656 W_L("<div style=\"");
6657 W_L("overflow:-webkit-marquee;");
6658 if (attr_wap_marquee_dir) {
6659 W_L("-webkit-marquee-direction:");
6660 if (STRCASEEQ('r','R',"rtl",attr_wap_marquee_dir)) {
6663 else if (STRCASEEQ('l','L',"ltr",attr_wap_marquee_dir)) {
6668 if (attr_wap_marquee_style) {
6669 W_L("-webkit-marquee-style:");
6670 W_V(attr_wap_marquee_style);
6673 if (attr_wap_marquee_loop) {
6674 W_L("-webkit-marquee-repetition:");
6675 W_V(attr_wap_marquee_loop);
6678 if (attr_wap_marquee_speed) {
6679 W_L("-webkit-marquee-speed:");
6680 W_V(attr_wap_marquee_speed);
6684 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
6685 W_L("background-color:");
6690 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6703 return android->out;
6708 * It is a handler who processes the MARQUEE tag.
6710 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
6711 * destination is specified.
6712 * @param node [i] The MARQUEE tag node is specified.
6713 * @return The conversion result is returned.
6716 s_android_end_marquee_tag(void *pdoc, Node *UNUSED(node))
6718 android_t *android = GET_ANDROID(pdoc);
6719 Doc *doc = android->doc;
6721 if (IS_CSS_ON(android->entryp)) {
6722 chxj_css_pop_prop_list(android->css_prop_stack);
6724 return android->out;
6729 * It is handler who processes the New Line Code.
6732 s_android_newline_mark(void *pdoc, Node *UNUSED(node))
6734 android_t *android = GET_ANDROID(pdoc);
6735 if (android->start_html_flag) {
6736 Doc *doc = android->doc;
6739 return android->out;
6744 * It is a handler who processes the LINK tag.
6746 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
6747 * destination is specified.
6748 * @param node [i] The LINK tag node is specified.
6749 * @return The conversion result is returned.
6752 s_android_link_tag(void *pdoc, Node *node)
6761 android = GET_ANDROID(pdoc);
6764 if (! IS_CSS_ON(android->entryp)) {
6765 return android->out;
6768 for (attr = qs_get_attr(doc,node);
6770 attr = qs_get_next_attr(doc,attr)) {
6771 char *name = qs_get_attr_name(doc,attr);
6772 char *value = qs_get_attr_value(doc,attr);
6773 if (STRCASEEQ('r','R',"rel", name)) {
6774 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
6778 else if (STRCASEEQ('h','H',"href", name)) {
6779 if (value && *value) {
6783 else if (STRCASEEQ('t','T',"type", name)) {
6784 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
6790 if (rel && href && type) {
6791 DBG(doc->r,"REQ[%X] start load CSS. url:[%s]", TO_ADDR(doc->r),href);
6792 android->style = chxj_css_parse_from_uri(doc->r, doc->pool, android->style, href);
6793 DBG(doc->r,"REQ[%X] end load CSS. url:[%s]", TO_ADDR(doc->r),href);
6796 return android->out;
6800 static css_prop_list_t *
6801 s_android_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
6803 android_t *android = GET_ANDROID(pdoc);
6804 Doc *doc = android->doc;
6805 css_prop_list_t *last_css = NULL;
6806 if (IS_CSS_ON(android->entryp)) {
6807 css_prop_list_t *dup_css;
6808 css_selector_t *selector;
6810 last_css = chxj_css_get_last_prop_list(android->css_prop_stack);
6811 dup_css = chxj_dup_css_prop_list(doc, last_css);
6812 selector = chxj_css_find_selector(doc, android->style, node);
6814 chxj_css_prop_list_merge_property(doc, dup_css, selector);
6816 chxj_css_push_prop_list(android->css_prop_stack, dup_css);
6817 last_css = chxj_css_get_last_prop_list(android->css_prop_stack);
6819 if (style_attr_value) {
6820 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));
6822 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
6830 static css_prop_list_t *
6831 s_android_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
6833 android_t *android = GET_ANDROID(pdoc);
6834 Doc *doc = android->doc;
6835 css_prop_list_t *last_css = NULL;
6836 if (IS_CSS_ON(android->entryp)) {
6837 css_prop_list_t *dup_css;
6838 css_selector_t *selector;
6840 last_css = chxj_css_get_last_prop_list(android->css_prop_stack);
6841 dup_css = chxj_dup_css_prop_list(doc, last_css);
6842 selector = chxj_css_find_selector(doc, android->style, node);
6844 chxj_css_prop_list_merge_property(doc, dup_css, selector);
6848 if (style_attr_value) {
6849 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));
6851 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
6860 * It is a handler who processes the SPAN tag.
6862 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6863 * destination is specified.
6864 * @param node [i] The SPAN tag node is specified.
6865 * @return The conversion result is returned.
6868 s_android_start_span_tag(void *pdoc, Node *node)
6873 char *attr_style = NULL;
6874 char *attr_color = NULL;
6875 char *attr_size = NULL;
6876 char *attr_align = NULL;
6877 char *attr_blink = NULL;
6878 char *attr_marquee = NULL;
6879 char *attr_marquee_dir = NULL;
6880 char *attr_marquee_style = NULL;
6881 char *attr_marquee_loop = NULL;
6882 char *attr_marquee_speed = NULL;
6883 char *css_bgcolor = NULL;
6885 android = GET_ANDROID(pdoc);
6888 for (attr = qs_get_attr(doc,node);
6890 attr = qs_get_next_attr(doc,attr)) {
6891 char *nm = qs_get_attr_name(doc,attr);
6892 char *val = qs_get_attr_value(doc,attr);
6893 if (val && STRCASEEQ('s','S',"style", nm)) {
6897 if (IS_CSS_ON(android->entryp)) {
6898 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
6900 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6901 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6902 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
6903 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
6904 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
6905 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
6906 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
6907 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
6908 css_property_t *marquee_speed_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-speed");
6909 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
6911 css_property_t *cur;
6912 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6913 attr_color = apr_pstrdup(doc->pool, cur->value);
6915 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6916 if (cur->value && *cur->value) {
6917 if ( STRCASEEQ('x','X',"xx-small",cur->value)
6918 || STRCASEEQ('x','X',"x-small", cur->value)
6919 || STRCASEEQ('s','S',"small", cur->value)
6920 || STRCASEEQ('m','M',"medium", cur->value)
6921 || STRCASEEQ('l','L',"large", cur->value)
6922 || STRCASEEQ('x','X',"x-large", cur->value)
6923 || STRCASEEQ('x','X',"xx-large",cur->value)) {
6924 attr_size = apr_pstrdup(doc->pool, cur->value);
6928 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
6929 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
6930 attr_blink = apr_pstrdup(doc->pool, cur->value);
6933 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
6934 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
6935 attr_marquee = apr_pstrdup(doc->pool, cur->value);
6938 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
6939 if (cur->value && *cur->value) {
6940 if ( STRCASEEQ('l','L',"ltr",cur->value)
6941 || STRCASEEQ('r','R',"rtl",cur->value)) {
6942 attr_marquee_dir = apr_pstrdup(doc->pool, cur->value);
6946 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
6947 if (cur->value && *cur->value) {
6948 if ( STRCASEEQ('s','S',"scroll",cur->value)
6949 || STRCASEEQ('s','S',"slide",cur->value)
6950 || STRCASEEQ('a','A',"alternate",cur->value)) {
6951 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
6955 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
6956 if (cur->value && *cur->value) {
6957 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
6958 attr_marquee_loop = "infinite";
6961 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
6965 for (cur = marquee_speed_prop->next; cur != marquee_speed_prop; cur = cur->next) {
6966 if (cur->value && *cur->value) {
6967 attr_marquee_speed = apr_pstrdup(doc->pool, cur->value);
6970 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
6971 if (STRCASEEQ('l','L',"left", cur->value)) {
6972 attr_align = apr_pstrdup(doc->pool, "left");
6974 else if (STRCASEEQ('c','C',"center",cur->value)) {
6975 attr_align = apr_pstrdup(doc->pool, "center");
6977 else if (STRCASEEQ('r','R',"right",cur->value)) {
6978 attr_align = apr_pstrdup(doc->pool, "right");
6981 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
6982 if (cur->value && *cur->value) {
6983 css_bgcolor = apr_pstrdup(doc->pool, cur->value);
6992 W_L("overflow:-webkit-marquee;");
6993 if (attr_marquee_style) {
6994 W_L("-webkit-marquee-style:");
6995 W_V(attr_marquee_style);
6998 if (attr_marquee_dir) {
6999 W_L("-webkit-marquee-direction:");
7000 if (STRCASEEQ('r','R',"rtl",attr_marquee_dir)) {
7003 else if (STRCASEEQ('l','L',"ltr",attr_marquee_dir)) {
7008 if (attr_marquee_loop) {
7009 W_L("-webkit-marquee-repetition:");
7010 W_V(attr_marquee_loop);
7013 if (attr_marquee_speed) {
7014 W_L("-webkit-marquee-speed:");
7015 W_V(attr_marquee_speed);
7022 if (attr_color || attr_size || attr_align || attr_blink || attr_marquee || css_bgcolor) {
7025 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
7042 if (android->blink_keyframe_out == 0) {
7043 android->style_data = apr_pstrcat(doc->pool, (android->style_data) ? android->style_data : "",
7046 android->blink_keyframe_out = 1;
7050 W_L("background-color:");
7057 return android->out;
7062 * It is a handler who processes the SPAN tag.
7064 * @param pdoc [i/o] The pointer to the JHTML structure at the output
7065 * destination is specified.
7066 * @param node [i] The SPAN tag node is specified.
7067 * @return The conversion result is returned.
7070 s_android_end_span_tag(void *pdoc, Node *UNUSED(node))
7072 android_t *android = GET_ANDROID(pdoc);
7073 Doc *doc = android->doc;
7077 if (IS_CSS_ON(android->entryp)) {
7078 chxj_css_pop_prop_list(android->css_prop_stack);
7080 return android->out;
7085 * It is a handler who processes the STYLE tag.
7087 * @param pdoc [i/o] The pointer to the XHTML structure at the output
7088 * destination is specified.
7089 * @param node [i] The STYLE tag node is specified.
7090 * @return The conversion result is returned.
7093 s_android_style_tag(void *pdoc, Node *node)
7102 android = GET_ANDROID(pdoc);
7105 if (! IS_CSS_ON(android->entryp)) {
7106 return android->out;
7109 for (attr = qs_get_attr(doc,node);
7111 attr = qs_get_next_attr(doc,attr)) {
7112 char *name = qs_get_attr_name(doc,attr);
7113 char *value = qs_get_attr_value(doc,attr);
7114 if (STRCASEEQ('t','T',"type", name)) {
7115 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
7122 for (child = qs_get_child_node(doc, node);
7124 child = qs_get_next_node(doc, child)) {
7125 char *name = qs_get_node_name(doc, child);
7126 if (STRCASEEQ('t','T',"text", name)) {
7127 char *value = qs_get_node_value(doc, child);
7128 if (value && *value) {
7129 style = apr_pstrcat(doc->r->pool, style, value, NULL);
7133 if (strlen(style) > 0) {
7134 DBG(doc->r,"REQ[%X] start load CSS. buf:[%s]", TO_ADDR(doc->r),style);
7135 android->style = chxj_css_parse_style_value(doc, android->style, style);
7136 DBG(doc->r,"REQ[%X] end load CSS. value:[%s]", TO_ADDR(doc->r),style);
7139 return android->out;
7144 s_android_create_style_data(apr_pool_t *pool, const char *style_data)
7149 return apr_pstrcat(pool, "<style type=\"text/css\"><![CDATA[",style_data, "]]></style>", NULL);
7153 * It is a handler who processes the OBJECT tag.
7155 * @param pdoc [i/o] The pointer to the JHTML structure at the output
7156 * destination is specified.
7157 * @param node [i] The OBJECT tag node is specified.
7158 * @return The conversion result is returned.
7161 s_android_start_object_tag(void *pdoc, Node *node)
7163 android_t *android = GET_ANDROID(pdoc);
7164 Doc *doc = android->doc;
7167 char *attr_id = NULL;
7168 char *attr_width = NULL;
7169 char *attr_height = NULL;
7170 char *attr_data = NULL;
7171 char *attr_type = NULL;
7172 char *attr_declare = NULL;
7173 char *attr_classid = NULL;
7174 char *attr_codebase = NULL;
7176 /*--------------------------------------------------------------------------*/
7177 /* Get Attributes */
7178 /*--------------------------------------------------------------------------*/
7179 for (attr = qs_get_attr(doc,node);
7181 attr = qs_get_next_attr(doc,attr)) {
7182 char *name = qs_get_attr_name(doc,attr);
7183 char *value = qs_get_attr_value(doc,attr);
7184 if (STRCASEEQ('i','I',"id",name)) {
7185 attr_id = apr_pstrdup(doc->pool, value);
7187 else if (STRCASEEQ('w','W',"width",name)) {
7188 attr_width = apr_pstrdup(doc->pool, value);
7190 else if (STRCASEEQ('h','H',"height",name)) {
7191 attr_height = apr_pstrdup(doc->pool, value);
7193 else if (STRCASEEQ('d','D',"data",name)) {
7194 attr_data = apr_pstrdup(doc->pool, value);
7196 else if (STRCASEEQ('t','T',"type",name)) {
7197 attr_type = apr_pstrdup(doc->pool, value);
7199 else if (STRCASEEQ('d','D',"declare",name)) {
7200 attr_declare = apr_pstrdup(doc->pool, value);
7202 else if (STRCASEEQ('c','C',"classid",name)) {
7203 attr_classid = apr_pstrdup(doc->pool, value);
7205 else if (STRCASEEQ('c','C',"codebase",name)) {
7206 attr_codebase = apr_pstrdup(doc->pool, value);
7238 W_L(" declare=\"declare\"");
7246 W_L(" codebase=\"");
7252 return android->out;
7255 * It is a handler who processes the OBJECT tag.
7257 * @param pdoc [i/o] The pointer to the JHTML structure at the output
7258 * destination is specified.
7259 * @param node [i] The OBJECT tag node is specified.
7260 * @return The conversion result is returned.
7263 s_android_end_object_tag(void *pdoc, Node *UNUSED(node))
7265 android_t *android = GET_ANDROID(pdoc);
7266 Doc *doc = android->doc;
7269 return android->out;
7272 * It is a handler who processes the OBJECT tag.
7274 * @param pdoc [i/o] The pointer to the JHTML structure at the output
7275 * destination is specified.
7276 * @param node [i] The OBJECT tag node is specified.
7277 * @return The conversion result is returned.
7280 s_android_start_param_tag(void *pdoc, Node *node)
7282 android_t *android = GET_ANDROID(pdoc);
7283 Doc *doc = android->doc;
7286 char *attr_name = NULL;
7287 char *attr_value = NULL;
7288 char *attr_valuetype = NULL;
7290 /*--------------------------------------------------------------------------*/
7291 /* Get Attributes */
7292 /*--------------------------------------------------------------------------*/
7293 for (attr = qs_get_attr(doc,node);
7295 attr = qs_get_next_attr(doc,attr)) {
7296 char *name = qs_get_attr_name(doc,attr);
7297 char *value = qs_get_attr_value(doc,attr);
7298 if (STRCASEEQ('n','N',"name",name)) {
7299 attr_name = apr_pstrdup(doc->pool, value);
7301 else if (STRCASEEQ('v','V',"value",name)) {
7302 attr_value = apr_pstrdup(doc->pool, value);
7304 else if (STRCASEEQ('v','V',"valuetype",name)) {
7305 attr_valuetype = apr_pstrdup(doc->pool, value);
7321 W_L(" valuetype=\"");
7322 W_V(attr_valuetype);
7326 return android->out;
7329 * It is a handler who processes the CAPTION tag.
7331 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
7332 * destination is specified.
7333 * @param node [i] The CAPTION tag node is specified.
7334 * @return The conversion result is returned.
7337 s_android_start_caption_tag(void *pdoc, Node *node)
7343 char *attr_style = NULL;
7344 char *attr_align = NULL;
7346 android = GET_ANDROID(pdoc);
7350 for (attr = qs_get_attr(doc,node);
7352 attr = qs_get_next_attr(doc,attr)) {
7353 char *name = qs_get_attr_name(doc,attr);
7354 char *value = qs_get_attr_value(doc,attr);
7355 if (STRCASEEQ('a','A',"align", name)) {
7357 (STRCASEEQ('l','L',"left",value)
7358 || STRCASEEQ('r','R',"right",value)
7359 || STRCASEEQ('t','T',"top",value)
7360 || STRCASEEQ('b','B',"bottom",value)
7365 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
7378 return android->out;
7383 * It is a handler who processes the CAPTION tag.
7385 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
7386 * destination is specified.
7387 * @param node [i] The CAPTION tag node is specified.
7388 * @return The conversion result is returned.
7391 s_android_end_caption_tag(void *pdoc, Node *UNUSED(child))
7393 android_t* android = GET_ANDROID(pdoc);
7394 Doc* doc = android->doc;
7398 return android->out;