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 *UNUSED(node))
1427 android = GET_ANDROID(pdoc);
1432 return android->out;
1437 * It is a handler who processes the TITLE tag.
1439 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
1440 * destination is specified.
1441 * @param node [i] The TITLE tag node is specified.
1442 * @return The conversion result is returned.
1445 s_android_end_title_tag(void *pdoc, Node *UNUSED(child))
1451 android = GET_ANDROID(pdoc);
1456 return android->out;
1461 * It is a handler who processes the BASE tag.
1463 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
1464 * destination is specified.
1465 * @param node [i] The BASE tag node is specified.
1466 * @return The conversion result is returned.
1469 s_android_start_base_tag(void *pdoc, Node *node)
1476 android = GET_ANDROID(pdoc);
1481 /*--------------------------------------------------------------------------*/
1482 /* Get Attributes */
1483 /*--------------------------------------------------------------------------*/
1484 for (attr = qs_get_attr(doc,node);
1486 attr = qs_get_next_attr(doc,attr)) {
1487 char *name = qs_get_attr_name(doc,attr);
1488 char *value = qs_get_attr_value(doc,attr);
1489 if (STRCASEEQ('h','H',"href",name)) {
1496 return android->out;
1501 * It is a handler who processes the BASE tag.
1503 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
1504 * destination is specified.
1505 * @param node [i] The BASE tag node is specified.
1506 * @return The conversion result is returned.
1509 s_android_end_base_tag(void *pdoc, Node *UNUSED(child))
1511 android_t *android = GET_ANDROID(pdoc);
1512 return android->out;
1517 * It is a handler who processes the BODY tag.
1519 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
1520 * destination is specified.
1521 * @param node [i] The BODY tag node is specified.
1522 * @return The conversion result is returned.
1525 s_android_start_body_tag(void *pdoc, Node *node)
1531 char *attr_bgcolor = NULL;
1532 char *attr_text = NULL;
1533 char *attr_link = NULL;
1534 char *attr_vlink = NULL;
1535 char *attr_alink = NULL;
1536 char *attr_style = NULL;
1537 char *attr_background = NULL;
1538 char *style_data = NULL;
1540 android = GET_ANDROID(pdoc);
1545 /*--------------------------------------------------------------------------*/
1546 /* Get Attributes */
1547 /*--------------------------------------------------------------------------*/
1548 for (attr = qs_get_attr(doc,node);
1550 attr = qs_get_next_attr(doc,attr)) {
1551 char *name = qs_get_attr_name(doc,attr);
1552 char *value = qs_get_attr_value(doc,attr);
1553 if (STRCASEEQ('b','B',"bgcolor",name) && value && *value) {
1554 /*----------------------------------------------------------------------*/
1556 /*----------------------------------------------------------------------*/
1557 attr_bgcolor = value;
1559 else if (STRCASEEQ('t','T',"text",name) && value && *value) {
1560 /*----------------------------------------------------------------------*/
1562 /*----------------------------------------------------------------------*/
1565 else if (STRCASEEQ('l','L',"link",name) && value && *value) {
1566 /*----------------------------------------------------------------------*/
1568 /*----------------------------------------------------------------------*/
1571 else if (STRCASEEQ('a','A',"alink",name)) {
1572 /*----------------------------------------------------------------------*/
1574 /*----------------------------------------------------------------------*/
1577 else if (STRCASEEQ('v','V',"vlink",name)) {
1578 /*----------------------------------------------------------------------*/
1580 /*----------------------------------------------------------------------*/
1583 else if (STRCASEEQ('b','B',"background",name) && value && *value) {
1584 /*----------------------------------------------------------------------*/
1586 /*----------------------------------------------------------------------*/
1587 attr_background = value;
1589 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1594 if (IS_CSS_ON(android->entryp)) {
1595 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
1597 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
1598 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
1599 css_property_t *bgimage_prop = chxj_css_get_property_value(doc, style, "background-image");
1600 css_property_t *cur;
1601 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
1602 if (cur->value && *cur->value) {
1603 attr_text = apr_pstrdup(doc->pool, cur->value);
1606 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
1607 if (cur->value && *cur->value) {
1608 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
1611 for (cur = bgimage_prop->next; cur != bgimage_prop; cur = cur->next) {
1612 if (cur->value && *cur->value) {
1613 char *tmp = apr_pstrdup(doc->pool, cur->value);
1614 char *tmps = strstr(tmp,"(");
1616 char *tmpe = strstr(tmp,")");
1617 size_t len = strlen(tmps) - strlen(tmpe) -1 ;
1619 attr_background = apr_pstrndup(doc->pool, tmps,len);
1624 if (android->style) {
1625 css_stylesheet_t *pseudos = chxj_find_pseudo_selectors(doc, android->style);
1626 css_selector_t *cur_sel;
1627 for (cur_sel = pseudos->selector_head.next; cur_sel != &pseudos->selector_head; cur_sel = cur_sel->next) {
1628 if (cur_sel->name && strcasecmp(cur_sel->name, "a:link") == 0) {
1629 css_property_t *cur;
1630 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1631 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1632 attr_link = apr_pstrdup(doc->pool, cur->value);
1636 else if (cur_sel->name && strcasecmp(cur_sel->name, "a:visited") == 0) {
1637 css_property_t *cur;
1638 for (cur = cur_sel->property_head.next; cur != &cur_sel->property_head; cur = cur->next) {
1639 if (cur->name && strcasecmp(cur->name, "color") == 0) {
1640 attr_vlink = apr_pstrdup(doc->pool, cur->value);
1650 if (attr_bgcolor || attr_text) {
1653 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
1654 W_L("background-color:");
1659 attr_text = chxj_css_rgb_func_to_value(doc->pool, attr_text);
1667 attr_link = chxj_css_rgb_func_to_value(doc->pool, attr_link);
1673 attr_vlink = chxj_css_rgb_func_to_value(doc->pool, attr_vlink);
1679 attr_alink = chxj_css_rgb_func_to_value(doc->pool, attr_alink);
1680 style_data = apr_pstrcat(doc->pool, (style_data) ? style_data : "",
1681 apr_psprintf(doc->pool, "a:focus { color:%s; }", attr_alink), NULL);
1683 if (attr_background) {
1684 W_L(" background=\"");
1685 W_V(attr_background);
1689 android->style_data = apr_pstrcat(doc->pool, (android->style_data) ? android->style_data : "",
1694 return android->out;
1699 * It is a handler who processes the BODY tag.
1701 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
1702 * destination is specified.
1703 * @param node [i] The BODY tag node is specified.
1704 * @return The conversion result is returned.
1707 s_android_end_body_tag(void *pdoc, Node *UNUSED(child))
1713 android = GET_ANDROID(pdoc);
1717 if (android->conf->use_google_analytics) {
1718 char *src = chxj_google_analytics_get_image_url(r);
1723 W_L("</div></body>");
1724 if (IS_CSS_ON(android->entryp)) {
1725 chxj_css_pop_prop_list(android->css_prop_stack);
1727 return android->out;
1732 * It is a handler who processes the A tag.
1734 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
1735 * destination is specified.
1736 * @param node [i] The A tag node is specified.
1737 * @return The conversion result is returned.
1740 s_android_start_a_tag(void *pdoc, Node *node)
1746 char *attr_style = NULL;
1747 char *attr_id = NULL;
1748 char *attr_name = NULL;
1750 android = GET_ANDROID(pdoc);
1755 /*--------------------------------------------------------------------------*/
1756 /* Get Attributes */
1757 /*--------------------------------------------------------------------------*/
1758 for (attr = qs_get_attr(doc,node);
1760 attr = qs_get_next_attr(doc,attr)) {
1761 char *name = qs_get_attr_name(doc,attr);
1762 char *value = qs_get_attr_value(doc,attr);
1763 if (STRCASEEQ('i','I',"id",name)){
1764 attr_id = chxj_jreserved_to_safe_tag(r, value, android->entryp);
1766 else if (STRCASEEQ('n','N',"name",name)) {
1767 attr_name = chxj_jreserved_to_safe_tag(r, value, android->entryp);
1769 else if (STRCASEEQ('h','H',"href",name)) {
1770 /*----------------------------------------------------------------------*/
1772 /*----------------------------------------------------------------------*/
1773 value = chxj_encoding_parameter(r, value, 1);
1774 if (! chxj_starts_with(value, "mailto:") && ! chxj_starts_with(value, "tel:")) {
1775 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, android->entryp, 1);
1781 else if (STRCASEEQ('a','A',"accesskey",name)) {
1782 /*----------------------------------------------------------------------*/
1784 /*----------------------------------------------------------------------*/
1787 else if (STRCASEEQ('c','C',"cti",name)) {
1788 /*----------------------------------------------------------------------*/
1790 /*----------------------------------------------------------------------*/
1793 else if (STRCASEEQ('i','I',"ijam",name)) {
1794 /*----------------------------------------------------------------------*/
1796 /*----------------------------------------------------------------------*/
1799 else if (STRCASEEQ('u','U',"utn",name)) {
1800 /*----------------------------------------------------------------------*/
1802 /* It is special only for CHTML. */
1803 /*----------------------------------------------------------------------*/
1806 else if (STRCASEEQ('t','T',"telbook",name)) {
1807 /*----------------------------------------------------------------------*/
1809 /*----------------------------------------------------------------------*/
1812 else if (STRCASEEQ('k','K',"kana",name)) {
1813 /*----------------------------------------------------------------------*/
1815 /*----------------------------------------------------------------------*/
1818 else if (STRCASEEQ('e','E',"email",name)) {
1819 /*----------------------------------------------------------------------*/
1821 /*----------------------------------------------------------------------*/
1824 else if (STRCASEEQ('i','I',"ista",name)) {
1825 /*----------------------------------------------------------------------*/
1827 /*----------------------------------------------------------------------*/
1830 else if (STRCASEEQ('i','I',"ilet",name)) {
1831 /*----------------------------------------------------------------------*/
1833 /*----------------------------------------------------------------------*/
1836 else if (STRCASEEQ('i','I',"iswf",name)) {
1837 /*----------------------------------------------------------------------*/
1839 /*----------------------------------------------------------------------*/
1842 else if (STRCASEEQ('i','I',"irst",name)) {
1843 /*----------------------------------------------------------------------*/
1845 /*----------------------------------------------------------------------*/
1848 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
1849 /*----------------------------------------------------------------------*/
1851 /*----------------------------------------------------------------------*/
1867 if (IS_CSS_ON(android->entryp)) {
1868 s_android_nopush_and_get_now_style(pdoc, node, attr_style);
1871 return android->out;
1876 * It is a handler who processes the A tag.
1878 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
1879 * destination is specified.
1880 * @param node [i] The A tag node is specified.
1881 * @return The conversion result is returned.
1884 s_android_end_a_tag(void *pdoc, Node *UNUSED(child))
1890 android = GET_ANDROID(pdoc);
1896 if (IS_CSS_ON(android->entryp)) {
1897 chxj_css_pop_prop_list(android->css_prop_stack);
1900 return android->out;
1905 * It is a handler who processes the BR tag.
1907 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
1908 * destination is specified.
1909 * @param node [i] The BR tag node is specified.
1910 * @return The conversion result is returned.
1913 s_android_start_br_tag(void *pdoc, Node *node)
1920 android = GET_ANDROID(pdoc);
1924 char *attr_style = NULL;
1925 char *attr_clear = NULL;
1927 /*--------------------------------------------------------------------------*/
1928 /* Get Attributes */
1929 /*--------------------------------------------------------------------------*/
1930 for (attr = qs_get_attr(doc,node);
1932 attr = qs_get_next_attr(doc,attr)) {
1933 char *name = qs_get_attr_name(doc,attr);
1934 char *value = qs_get_attr_value(doc,attr);
1935 if (STRCASEEQ('c','C',"clear",name)) {
1936 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('a','A',"all",value))) {
1940 else if (STRCASEEQ('s','S',"style",name)) {
1941 attr_style = apr_pstrdup(doc->buf.pool, value);
1944 if (IS_CSS_ON(android->entryp)) {
1945 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
1947 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
1948 css_property_t *cur;
1949 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
1950 if (cur->value && *cur->value) {
1951 if ( STRCASEEQ('l','L',"left", cur->value)
1952 || STRCASEEQ('r','R',"right", cur->value)) {
1953 attr_clear = apr_pstrdup(doc->pool, cur->value);
1955 else if(STRCASEEQ('b','B',"both" ,cur->value)) {
1956 attr_clear = apr_pstrdup(doc->pool, "all");
1969 return android->out;
1974 * It is a handler who processes the BR tag.
1976 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
1977 * destination is specified.
1978 * @param node [i] The BR tag node is specified.
1979 * @return The conversion result is returned.
1982 s_android_end_br_tag(void *pdoc, Node *UNUSED(child))
1984 android_t *android = GET_ANDROID(pdoc);
1985 return android->out;
1989 * It is a handler who processes the TABLE tag.
1991 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
1992 * destination is specified.
1993 * @param node [i] The TR tag node is specified.
1994 * @return The conversion result is returned.
1997 s_android_start_table_tag(void *pdoc, Node *node)
2004 char *attr_style = NULL;
2005 char *attr_align = NULL;
2006 char *attr_width = NULL;
2007 char *attr_height = NULL;
2008 char *attr_bgcolor = NULL;
2009 char *attr_border_width = NULL;
2010 char *attr_border_color = NULL;
2012 android = GET_ANDROID(pdoc);
2016 /*--------------------------------------------------------------------------*/
2017 /* Get Attributes */
2018 /*--------------------------------------------------------------------------*/
2019 for (attr = qs_get_attr(doc,node);
2021 attr = qs_get_next_attr(doc,attr)) {
2022 char *name = qs_get_attr_name(doc,attr);
2023 char *val = qs_get_attr_value(doc,attr);
2024 if (STRCASEEQ('a','A',"align",name)) {
2025 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2026 attr_align = apr_pstrdup(doc->buf.pool, val);
2029 else if (STRCASEEQ('h','H',"height",name) && val && *val) {
2030 attr_height = apr_pstrdup(doc->buf.pool, val);
2032 else if (STRCASEEQ('w','W',"width",name) && val && *val) {
2033 attr_width = apr_pstrdup(doc->buf.pool, val);
2035 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
2036 attr_style = apr_pstrdup(doc->buf.pool, val);
2038 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
2039 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
2040 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
2042 else if (STRCASEEQ('b','B',"border",name) && val && *val) {
2043 attr_border_width = apr_pstrdup(doc->buf.pool, val);
2045 else if (STRCASEEQ('b','B',"bordercolor",name) && val && *val) {
2046 attr_border_color = apr_pstrdup(doc->buf.pool, val);
2047 attr_border_color = chxj_css_rgb_func_to_value(doc->pool, attr_border_color);
2051 if (IS_CSS_ON(android->entryp)) {
2052 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
2054 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2055 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2056 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
2057 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
2058 css_property_t *border_width_prop = chxj_css_get_property_value(doc, style, "border-width");
2059 css_property_t *border_color_prop = chxj_css_get_property_value(doc, style, "border-color");
2061 css_property_t *cur;
2062 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2063 char *tmp = apr_pstrdup(doc->pool, cur->value);
2064 char *tmpp = strstr(tmp, "px");
2066 size_t len = strlen(tmp) - strlen(tmpp);
2067 attr_width = apr_pstrndup(doc->pool, tmp,len);
2070 attr_width = apr_pstrdup(doc->pool, tmp);
2073 for (cur = height_prop->next; cur != height_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_height = apr_pstrndup(doc->pool, tmp,len);
2081 attr_height = apr_pstrdup(doc->pool, tmp);
2084 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
2085 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
2086 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
2089 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
2090 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
2091 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
2093 for (cur = border_width_prop->next; cur != border_width_prop; cur = cur->next) {
2094 char *tmp = apr_pstrdup(doc->pool, cur->value);
2095 char *tmpp = strstr(tmp, "px");
2097 size_t len = strlen(tmp) - strlen(tmpp);
2098 attr_border_width = apr_pstrndup(doc->pool, tmp,len);
2101 attr_border_width = apr_pstrdup(doc->pool, tmp);
2104 for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
2105 attr_border_color = apr_pstrdup(doc->pool, cur->value);
2106 attr_border_color = chxj_css_rgb_func_to_value(doc->pool, attr_border_color);
2127 if (attr_bgcolor && *attr_bgcolor){
2132 if (attr_border_width || attr_border_color ){
2133 W_L(" style=\"border:");
2134 if (attr_border_width){
2135 W_V(attr_border_width);
2142 if (attr_border_color && *attr_border_color){
2144 W_V(attr_border_color);
2150 return android->out;
2154 * It is a handler who processes the TABLE tag.
2156 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
2157 * destination is specified.
2158 * @param node [i] The TR tag node is specified.
2159 * @return The conversion result is returned.
2162 s_android_end_table_tag(void *pdoc, Node *UNUSED(node))
2168 android = GET_ANDROID(pdoc);
2170 r = android->doc->r;
2173 return android->out;
2178 * It is a handler who processes the TR tag.
2180 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
2181 * destination is specified.
2182 * @param node [i] The TR tag node is specified.
2183 * @return The conversion result is returned.
2186 s_android_start_tr_tag(void *pdoc, Node *node)
2194 char *attr_style = NULL;
2195 char *attr_align = NULL;
2196 char *attr_valign = NULL;
2197 char *attr_bgcolor = NULL;
2199 android = GET_ANDROID(pdoc);
2203 /*--------------------------------------------------------------------------*/
2204 /* Get Attributes */
2205 /*--------------------------------------------------------------------------*/
2206 for (attr = qs_get_attr(doc,node);
2208 attr = qs_get_next_attr(doc,attr)) {
2209 char *name = qs_get_attr_name(doc,attr);
2210 char *val = qs_get_attr_value(doc,attr);
2211 if (STRCASEEQ('a','A',"align",name)) {
2212 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2213 attr_align = apr_pstrdup(doc->buf.pool, val);
2216 else if (STRCASEEQ('v','V',"valign",name) && val && *val) {
2217 if (val && (STRCASEEQ('t','T',"top",val) || STRCASEEQ('m','M',"middle",val) || STRCASEEQ('b','B',"bottom",val))) {
2218 attr_valign = apr_pstrdup(doc->buf.pool, val);
2221 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
2222 attr_style = apr_pstrdup(doc->buf.pool, val);
2224 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
2225 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
2226 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
2230 if (IS_CSS_ON(android->entryp)) {
2231 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
2233 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
2234 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
2235 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
2237 css_property_t *cur;
2238 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
2239 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
2240 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
2243 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
2244 if (cur->value && (STRCASEEQ('t','T',"top",cur->value) || STRCASEEQ('m','M',"middle",cur->value) || STRCASEEQ('b','B',"bottom",cur->value))) {
2245 attr_valign = apr_pstrdup(doc->buf.pool, cur->value);
2248 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
2249 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
2250 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
2266 if (attr_bgcolor && *attr_bgcolor){
2272 return android->out;
2277 * It is a handler who processes the TR tag.
2279 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
2280 * destination is specified.
2281 * @param node [i] The TR tag node is specified.
2282 * @return The conversion result is returned.
2285 s_android_end_tr_tag(void *pdoc, Node *UNUSED(child))
2291 android = GET_ANDROID(pdoc);
2293 r = android->doc->r;
2296 return android->out;
2300 * It is a handler who processes the TD tag.
2302 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
2303 * destination is specified.
2304 * @param node [i] The TR tag node is specified.
2305 * @return The conversion result is returned.
2308 s_android_start_td_or_th_tag(void *pdoc, Node *node,char *tagName)
2316 char *attr_style = NULL;
2317 char *attr_align = NULL;
2318 char *attr_valign = NULL;
2319 char *attr_bgcolor = NULL;
2320 char *attr_colspan = NULL;
2321 char *attr_rowspan = NULL;
2322 char *attr_width = NULL;
2323 char *attr_height = NULL;
2325 android = GET_ANDROID(pdoc);
2329 /*--------------------------------------------------------------------------*/
2330 /* Get Attributes */
2331 /*--------------------------------------------------------------------------*/
2332 for (attr = qs_get_attr(doc,node);
2334 attr = qs_get_next_attr(doc,attr)) {
2335 char *name = qs_get_attr_name(doc,attr);
2336 char *val = qs_get_attr_value(doc,attr);
2337 if (STRCASEEQ('a','A',"align",name)) {
2338 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
2339 attr_align = apr_pstrdup(doc->buf.pool, val);
2342 else if (STRCASEEQ('v','V',"valign",name) && val && *val) {
2343 if (val && (STRCASEEQ('t','T',"top",val) || STRCASEEQ('m','M',"middle",val) || STRCASEEQ('b','B',"bottom",val))) {
2344 attr_valign = apr_pstrdup(doc->buf.pool, val);
2347 else if (STRCASEEQ('s','S',"style",name) && val && *val) {
2348 attr_style = apr_pstrdup(doc->buf.pool, val);
2350 else if (STRCASEEQ('b','B',"bgcolor",name) && val && *val) {
2351 attr_bgcolor = apr_pstrdup(doc->buf.pool, val);
2352 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
2354 else if (STRCASEEQ('c','C',"colspan",name) && val && *val) {
2355 attr_colspan = apr_pstrdup(doc->buf.pool, val);
2357 else if (STRCASEEQ('r','R',"rowspan",name) && val && *val) {
2358 attr_rowspan = apr_pstrdup(doc->buf.pool, val);
2360 else if (STRCASEEQ('w','W',"width",name) && val && *val) {
2361 char *tmp = strstr(val, "%");
2363 attr_width = apr_pstrdup(doc->buf.pool, val);
2366 attr_width = apr_psprintf(doc->buf.pool,"%spx",val);
2369 else if (STRCASEEQ('h','H',"height",name) && val && *val) {
2370 char *tmp = strstr(val, "%");
2372 attr_height = apr_pstrdup(doc->buf.pool, val);
2375 attr_height = apr_psprintf(doc->buf.pool,"%spx",val);
2380 if (IS_CSS_ON(android->entryp)) {
2381 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
2383 css_property_t *align_prop = chxj_css_get_property_value(doc, style, "text-align");
2384 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
2385 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
2386 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
2387 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
2389 css_property_t *cur;
2390 for (cur = align_prop->next; cur != align_prop; cur = cur->next) {
2391 if (cur->value && (STRCASEEQ('l','L',"left",cur->value) || STRCASEEQ('r','R',"right",cur->value) || STRCASEEQ('c','C',"center",cur->value))) {
2392 attr_align = apr_pstrdup(doc->buf.pool, cur->value);
2395 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
2396 if (cur->value && (STRCASEEQ('t','T',"top",cur->value) || STRCASEEQ('m','M',"middle",cur->value) || STRCASEEQ('b','B',"bottom",cur->value))) {
2397 attr_valign = apr_pstrdup(doc->buf.pool, cur->value);
2400 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
2401 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
2402 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
2404 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
2405 attr_width = apr_pstrdup(doc->pool, cur->value);
2407 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
2408 attr_height = apr_pstrdup(doc->pool, cur->value);
2435 if (attr_bgcolor && *attr_bgcolor){
2440 if (attr_width || attr_height ){
2455 return android->out;
2460 * It is a handler who processes the TD tag.
2462 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
2463 * destination is specified.
2464 * @param node [i] The TR tag node is specified.
2465 * @return The conversion result is returned.
2468 s_android_end_td_or_th_tag(void *pdoc, Node *UNUSED(child),char *tagName)
2474 android = GET_ANDROID(pdoc);
2476 r = android->doc->r;
2481 return android->out;
2485 * It is a handler who processes the TD tag.
2487 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
2488 * destination is specified.
2489 * @param node [i] The TD tag node is specified.
2490 * @return The conversion result is returned.
2493 s_android_start_td_tag(void *pdoc, Node *node)
2495 return s_android_start_td_or_th_tag(pdoc,node,"td");
2498 * It is a handler who processes the TD tag.
2500 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
2501 * destination is specified.
2502 * @param node [i] The TD tag node is specified.
2503 * @return The conversion result is returned.
2506 s_android_end_td_tag(void *pdoc, Node *node)
2508 return s_android_end_td_or_th_tag(pdoc,node,"td");
2512 * It is a handler who processes the TD tag.
2514 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
2515 * destination is specified.
2516 * @param node [i] The TD tag node is specified.
2517 * @return The conversion result is returned.
2520 s_android_start_th_tag(void *pdoc, Node *node)
2522 return s_android_start_td_or_th_tag(pdoc,node,"th");
2525 * It is a handler who processes the TD tag.
2527 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
2528 * destination is specified.
2529 * @param node [i] The TD tag node is specified.
2530 * @return The conversion result is returned.
2533 s_android_end_th_tag(void *pdoc, Node *node)
2535 return s_android_end_td_or_th_tag(pdoc,node,"th");
2539 * It is a handler who processes the FONT tag.
2541 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
2542 * destination is specified.
2543 * @param node [i] The FONT tag node is specified.
2544 * @return The conversion result is returned.
2547 s_android_start_font_tag(void *pdoc, Node *node)
2553 char *attr_color = NULL;
2554 char *attr_size = NULL;
2555 char *attr_style = NULL;
2557 android = GET_ANDROID(pdoc);
2561 /*--------------------------------------------------------------------------*/
2562 /* Get Attributes */
2563 /*--------------------------------------------------------------------------*/
2564 for (attr = qs_get_attr(doc,node);
2566 attr = qs_get_next_attr(doc,attr)) {
2567 char *name = qs_get_attr_name(doc,attr);
2568 char *value = qs_get_attr_value(doc,attr);
2569 if (STRCASEEQ('c','C',"color",name) && value && *value) {
2570 attr_color = apr_pstrdup(doc->buf.pool, value);
2572 else if (STRCASEEQ('s','S',"size",name) && value && *value) {
2573 /*----------------------------------------------------------------------*/
2575 /*----------------------------------------------------------------------*/
2576 attr_size = apr_pstrdup(doc->buf.pool, value);
2578 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
2579 attr_style = apr_pstrdup(doc->buf.pool, value);
2582 if (IS_CSS_ON(android->entryp)) {
2583 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
2585 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2586 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
2587 css_property_t *cur;
2588 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2589 if (cur->value && *cur->value) {
2590 attr_color = apr_pstrdup(doc->pool, cur->value);
2593 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
2594 if (cur->value && *cur->value) {
2595 attr_size = apr_pstrdup(doc->pool, cur->value);
2596 if (STRCASEEQ('x','X',"xx-small",attr_size)) {
2597 attr_size = apr_pstrdup(doc->pool, "1");
2599 else if (STRCASEEQ('x','X',"x-small",attr_size)) {
2600 attr_size = apr_pstrdup(doc->pool, "2");
2602 else if (STRCASEEQ('s','S',"small",attr_size)) {
2603 attr_size = apr_pstrdup(doc->pool, "3");
2605 else if (STRCASEEQ('m','M',"medium",attr_size)) {
2606 attr_size = apr_pstrdup(doc->pool, "4");
2608 else if (STRCASEEQ('l','L',"large",attr_size)) {
2609 attr_size = apr_pstrdup(doc->pool, "5");
2611 else if (STRCASEEQ('x','X',"x-large",attr_size)) {
2612 attr_size = apr_pstrdup(doc->pool, "6");
2614 else if (STRCASEEQ('x','X',"xx-large",attr_size)) {
2615 attr_size = apr_pstrdup(doc->pool, "7");
2621 android_flags_t *flg = (android_flags_t *)apr_palloc(doc->pool, sizeof(*flg));
2622 memset(flg, 0, sizeof(*flg));
2624 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2625 W_L("<font color=\"");
2628 flg->font_color_flag = 1;
2631 flg->font_size_flag = 1;
2632 switch(*attr_size) {
2633 case '1': W_L("<span style=\"font-size: xx-small\">"); break;
2634 case '2': W_L("<span style=\"font-size: x-small\">"); break;
2635 case '3': W_L("<span style=\"font-size: small\">"); break;
2636 case '4': W_L("<span style=\"font-size: medium\">"); break;
2637 case '5': W_L("<span style=\"font-size: large\">"); break;
2638 case '6': W_L("<span style=\"font-size: x-large\">"); break;
2639 case '7': W_L("<span style=\"font-size: xx-large\">"); break;
2641 if (*(attr_size + 1) == '1') {
2642 W_L("<span style=\"font-size: small\">");
2645 if (*(attr_size + 1) == '2') {
2646 W_L("<span style=\"font-size: x-small\">");
2649 if (*(attr_size + 1) == '3') {
2650 W_L("<span style=\"font-size: xx-small\">");
2653 flg->font_size_flag = 0;
2657 if (*(attr_size + 1) == '1') {
2658 W_L("<span style=\"font-size: large\">");
2661 if (*(attr_size + 1) == '2') {
2662 W_L("<span style=\"font-size: x-large\">");
2665 if (*(attr_size + 1) == '3') {
2666 W_L("<span style=\"font-size: xx-large\">");
2669 flg->font_size_flag = 0;
2673 WRN(doc->r, "invlalid font size. [%s] != (1|2|3|4|5|6|7|+1|+2|+3|-1|-2|-3)", attr_size);
2674 flg->font_size_flag = 0;
2677 node->userData = flg;
2678 return android->out;
2683 * It is a handler who processes the FONT tag.
2685 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
2686 * destination is specified.
2687 * @param node [i] The FONT tag node is specified.
2688 * @return The conversion result is returned.
2691 s_android_end_font_tag(void *pdoc, Node *node)
2697 android = GET_ANDROID(pdoc);
2699 r = android->doc->r;
2701 android_flags_t *flg = (android_flags_t *)node->userData;
2702 if (flg && flg->font_size_flag) {
2705 if (flg && flg->font_color_flag) {
2708 if (IS_CSS_ON(android->entryp)) {
2709 chxj_css_pop_prop_list(android->css_prop_stack);
2712 return android->out;
2717 * It is a handler who processes the FORM tag.
2719 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
2720 * destination is specified.
2721 * @param node [i] The FORM tag node is specified.
2722 * @return The conversion result is returned.
2725 s_android_start_form_tag(void *pdoc, Node *node)
2731 char *attr_action = NULL;
2732 char *attr_method = NULL;
2733 char *attr_style = NULL;
2734 char *attr_color = NULL;
2735 char *attr_align = NULL;
2736 char *attr_name = NULL;
2737 char *css_clear = NULL;
2738 char *new_hidden_tag = NULL;
2740 android = GET_ANDROID(pdoc);
2744 /*--------------------------------------------------------------------------*/
2745 /* Get Attributes */
2746 /*--------------------------------------------------------------------------*/
2747 for (attr = qs_get_attr(doc,node);
2749 attr = qs_get_next_attr(doc,attr)) {
2750 char *name = qs_get_attr_name(doc,attr);
2751 char *value = qs_get_attr_value(doc,attr);
2755 if (strcasecmp(name, "action") == 0) {
2756 /*--------------------------------------------------------------------*/
2758 /*--------------------------------------------------------------------*/
2759 attr_action = value;
2765 if (strcasecmp(name, "method") == 0) {
2766 /*--------------------------------------------------------------------*/
2768 /*--------------------------------------------------------------------*/
2769 attr_method = value;
2775 if (strcasecmp(name, "name") == 0) {
2776 /*--------------------------------------------------------------------*/
2778 /*--------------------------------------------------------------------*/
2785 if (strcasecmp(name, "style") == 0) {
2794 if (IS_CSS_ON(android->entryp)) {
2795 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
2797 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
2798 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
2799 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
2800 css_property_t *cur;
2801 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
2802 if (STRCASEEQ('l','L',"left", cur->value)) {
2803 attr_align = apr_pstrdup(doc->pool, "left");
2805 else if (STRCASEEQ('c','C',"center",cur->value)) {
2806 attr_align = apr_pstrdup(doc->pool, "center");
2808 else if (STRCASEEQ('r','R',"right",cur->value)) {
2809 attr_align = apr_pstrdup(doc->pool, "right");
2812 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
2813 attr_color = apr_pstrdup(doc->pool, cur->value);
2815 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
2816 css_clear = apr_pstrdup(doc->pool, cur->value);
2821 int post_flag = (attr_method && strcasecmp(attr_method, "post") == 0) ? 1 : 0;
2825 attr_action = chxj_encoding_parameter(r, attr_action, 1);
2826 attr_action = chxj_add_cookie_parameter(r, attr_action, android->cookie);
2828 char *old_qs = NULL;
2829 q = strchr(attr_action, '?');
2831 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);
2832 if (new_hidden_tag || old_qs) {
2862 android_flags_t *flg = (android_flags_t *)apr_palloc(doc->pool, sizeof(android_flags_t));
2863 memset(flg, 0, sizeof(*flg));
2865 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
2866 W_L("<font color=\"");
2869 flg->with_font_flag = 1;
2872 W_L("<div align=\"");
2875 flg->with_div_flag = 1;
2877 node->userData = flg;
2878 if (new_hidden_tag) {
2879 W_V(new_hidden_tag);
2881 return android->out;
2886 * It is a handler who processes the FORM tag.
2888 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
2889 * destination is specified.
2890 * @param node [i] The FORM tag node is specified.
2891 * @return The conversion result is returned.
2894 s_android_end_form_tag(void *pdoc, Node *node)
2896 android_t *android = GET_ANDROID(pdoc);
2897 Doc *doc = android->doc;
2899 android_flags_t *flg = (android_flags_t *)node->userData;
2900 if (flg && flg->with_div_flag) {
2903 if (flg && flg->with_font_flag) {
2907 if (IS_CSS_ON(android->entryp)) {
2908 chxj_css_pop_prop_list(android->css_prop_stack);
2911 return android->out;
2915 s_android_istyle_to_wap_input_format(apr_pool_t *p, const char *s)
2919 case '1': return apr_psprintf(p, ""*<ja:h>"");
2920 case '2': return apr_psprintf(p, ""*<ja:hk>"");
2921 case '3': return apr_psprintf(p, ""*<ja:en>"");
2922 case '4': return apr_psprintf(p, ""*<ja:n>"");
2924 return apr_pstrdup(p, "");
2928 return apr_pstrdup(p,"");
2933 * It is a handler who processes the INPUT tag.
2935 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
2936 * destination is specified.
2937 * @param node [i] The INPUT tag node is specified.
2938 * @return The conversion result is returned.
2941 s_android_start_input_tag(void *pdoc, Node *node)
2947 char *attr_accesskey = NULL;
2948 char *attr_max_length = NULL;
2949 char *attr_type = NULL;
2950 char *attr_name = NULL;
2951 char *attr_value = NULL;
2952 char *attr_istyle = NULL;
2953 char *attr_size = NULL;
2954 char *attr_checked = NULL;
2955 char *attr_style = NULL;
2957 android = GET_ANDROID(pdoc);
2961 /*--------------------------------------------------------------------------*/
2962 /* Get Attributes */
2963 /*--------------------------------------------------------------------------*/
2964 for (attr = qs_get_attr(doc,node);
2966 attr = qs_get_next_attr(doc,attr)) {
2967 char *name = qs_get_attr_name(doc,attr);
2968 char *value = qs_get_attr_value(doc,attr);
2969 if (STRCASEEQ('t','T',"type",name) && value && *value) {
2970 char *tmp_type = qs_trim_string(doc->buf.pool, value);
2971 if (tmp_type && (STRCASEEQ('t','T',"text", tmp_type) ||
2972 STRCASEEQ('p','P',"password",tmp_type) ||
2973 STRCASEEQ('c','C',"checkbox",tmp_type) ||
2974 STRCASEEQ('r','R',"radio", tmp_type) ||
2975 STRCASEEQ('h','H',"hidden", tmp_type) ||
2976 STRCASEEQ('s','S',"submit", tmp_type) ||
2977 STRCASEEQ('r','R',"reset", tmp_type))) {
2978 attr_type = tmp_type;
2981 else if (STRCASEEQ('n','N',"name",name) && value && *value) {
2984 else if (STRCASEEQ('v','V',"value",name) && value && *value) {
2987 else if (STRCASEEQ('i','I',"istyle",name) && value && *value) {
2988 attr_istyle = value;
2990 else if (STRCASEEQ('m','M',"maxlength",name) && value && *value) {
2991 attr_max_length = value;
2993 else if (STRCASEEQ('c','C',"checked", name)) {
2994 attr_checked = value;
2996 else if (STRCASEEQ('a','A',"accesskey", name) && value && *value) {
2997 attr_accesskey = value;
2999 else if (STRCASEEQ('s','S',"size", name) && value && *value) {
3002 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3007 if (IS_CSS_ON(android->entryp)) {
3008 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
3010 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
3011 css_property_t *cur;
3012 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
3013 if (strcasestr(cur->value, "<ja:n>")) {
3016 else if (strcasestr(cur->value, "<ja:en>")) {
3019 else if (strcasestr(cur->value, "<ja:hk>")) {
3022 else if (strcasestr(cur->value, "<ja:h>")) {
3037 W_V(chxj_jreserved_to_safe_tag(r, attr_name, android->entryp));
3042 W_V(chxj_add_slash_to_doublequote(doc->pool, attr_value));
3045 if (attr_istyle && (*attr_istyle == '1' || *attr_istyle == '2' || *attr_istyle == '3' || *attr_istyle == '4')) {
3046 if (attr_type && STRCASEEQ('t','T',"text",attr_type)) {
3051 if (*attr_istyle == '4') {
3052 attr_type = apr_pstrdup(r->pool, "number");
3061 /*--------------------------------------------------------------------------*/
3062 /* The figure is default for the password. */
3063 /*--------------------------------------------------------------------------*/
3064 if (attr_max_length && *attr_max_length) {
3065 if (chxj_chk_numeric(attr_max_length) == 0) {
3066 W_L(" maxlength=\"");
3067 W_V(attr_max_length);
3072 W_L(" checked=\"checked\"");
3075 return android->out;
3080 * It is a handler who processes the INPUT tag.
3082 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
3083 * destination is specified.
3084 * @param node [i] The INPUT tag node is specified.
3085 * @return The conversion result is returned.
3088 s_android_end_input_tag(void *pdoc, Node *UNUSED(child))
3090 android_t *android = GET_ANDROID(pdoc);
3091 return android->out;
3096 * It is a handler who processes the CENTER tag.
3098 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
3099 * destination is specified.
3100 * @param node [i] The CENTER tag node is specified.
3101 * @return The conversion result is returned.
3104 s_android_start_center_tag(void *pdoc, Node *node)
3109 char *attr_style = NULL;
3110 char *attr_color = NULL;
3111 char *attr_size = NULL;
3113 android = GET_ANDROID(pdoc);
3116 for (attr = qs_get_attr(doc,node);
3118 attr = qs_get_next_attr(doc,attr)) {
3119 char *name = qs_get_attr_name(doc,attr);
3120 char *value = qs_get_attr_value(doc,attr);
3121 if (STRCASEEQ('s','S',"style",name) && value && *value) {
3125 if (IS_CSS_ON(android->entryp)) {
3126 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
3128 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3129 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
3130 css_property_t *cur;
3131 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3132 if (cur->value && *cur->value) {
3133 attr_color = apr_pstrdup(doc->pool, cur->value);
3136 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
3137 if (cur->value && *cur->value) {
3138 attr_size = apr_pstrdup(doc->pool, cur->value);
3145 if (attr_size || attr_color) {
3153 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3162 return android->out;
3167 * It is a handler who processes the CENTER tag.
3169 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
3170 * destination is specified.
3171 * @param node [i] The CENTER tag node is specified.
3172 * @return The conversion result is returned.
3175 s_android_end_center_tag(void *pdoc, Node *UNUSED(node))
3181 android = GET_ANDROID(pdoc);
3186 if (IS_CSS_ON(android->entryp)) {
3187 chxj_css_pop_prop_list(android->css_prop_stack);
3189 return android->out;
3194 * It is a handler who processes the li tag.
3196 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
3197 * destination is specified.
3198 * @param node [i] The li tag node is specified.
3199 * @return The conversion result is returned.
3202 s_android_start_li_tag(void *pdoc, Node *node)
3208 char *attr_type = NULL;
3209 char *attr_value = NULL;
3210 char *attr_style = NULL;
3212 android = GET_ANDROID(pdoc);
3216 for (attr = qs_get_attr(doc,node);
3218 attr = qs_get_next_attr(doc,attr)) {
3219 char *name = qs_get_attr_name(doc,attr);
3220 char *value = qs_get_attr_value(doc,attr);
3221 if (STRCASEEQ('t','T',"type",name)) {
3222 if (value && (*value == '1' || *value == 'a' || *value == 'A' || STRCASEEQ('d','D',"disc",value) || STRCASEEQ('s','S',"square",value) || STRCASEEQ('c','C',"circle",value))) {
3223 if (*value == '1') {
3224 attr_type = apr_pstrdup(doc->pool, "decimal");
3226 else if (*value == 'a') {
3227 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3229 else if (*value == 'A') {
3230 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3237 else if (STRCASEEQ('v','V',"value", name) && value && *value) {
3240 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3244 if (IS_CSS_ON(android->entryp)) {
3245 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
3247 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3248 css_property_t *cur;
3249 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3250 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3251 attr_type = apr_pstrdup(doc->pool, "decimal");
3253 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3254 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3256 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3257 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3259 else if (STRCASEEQ('d','D',"disc", cur->value)) {
3260 attr_type = apr_pstrdup(doc->pool, "disc");
3262 else if (STRCASEEQ('s','S',"square", cur->value)) {
3263 attr_type = apr_pstrdup(doc->pool, "square");
3265 else if (STRCASEEQ('c','C',"circle", cur->value)) {
3266 attr_type = apr_pstrdup(doc->pool, "circle");
3276 W_L("list-style-type:");
3287 return android->out;
3292 * It is a handler who processes the li tag.
3294 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
3295 * destination is specified.
3296 * @param node [i] The li tag node is specified.
3297 * @return The conversion result is returned.
3300 s_android_end_li_tag(void *pdoc, Node *UNUSED(child))
3306 android = GET_ANDROID(pdoc);
3310 if (IS_CSS_ON(android->entryp)) {
3311 chxj_css_pop_prop_list(android->css_prop_stack);
3314 return android->out;
3319 * It is a handler who processes the OL tag.
3321 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
3322 * destination is specified.
3323 * @param node [i] The OL tag node is specified.
3324 * @return The conversion result is returned.
3327 s_android_start_ol_tag(void *pdoc, Node *node)
3333 char *attr_style = NULL;
3334 char *attr_start = NULL;
3335 char *attr_type = NULL;
3336 char *css_clear = NULL;
3338 android = GET_ANDROID(pdoc);
3342 /*--------------------------------------------------------------------------*/
3343 /* Get Attributes */
3344 /*--------------------------------------------------------------------------*/
3345 for (attr = qs_get_attr(doc,node);
3347 attr = qs_get_next_attr(doc,attr)) {
3348 char *name = qs_get_attr_name(doc,attr);
3349 char *value = qs_get_attr_value(doc,attr);
3350 if (STRCASEEQ('t','T',"type",name) && value) {
3351 if (*value == '1') {
3352 attr_type = apr_pstrdup(doc->pool, "decimal");
3354 else if (*value == 'a') {
3355 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3357 else if (*value == 'A') {
3358 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3361 else if (STRCASEEQ('s','S',"start",name) && value && *value) {
3364 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
3368 if (IS_CSS_ON(android->entryp)) {
3369 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
3371 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3372 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3374 css_property_t *cur;
3375 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3376 if (STRCASEEQ('d','D',"decimal", cur->value)) {
3377 attr_type = apr_pstrdup(doc->pool, "decimal");
3379 else if (STRCASEEQ('u','U',"upper-alpha", cur->value)) {
3380 attr_type = apr_pstrdup(doc->pool, "upper-alpha");
3382 else if (STRCASEEQ('l','L',"lower-alpha", cur->value)) {
3383 attr_type = apr_pstrdup(doc->pool, "lower-alpha");
3386 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3387 css_clear = apr_pstrdup(doc->pool, cur->value);
3392 if (attr_type || css_clear) {
3395 W_L("list-style-type:");
3413 return android->out;
3418 * It is a handler who processes the OL tag.
3420 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
3421 * destination is specified.
3422 * @param node [i] The OL tag node is specified.
3423 * @return The conversion result is returned.
3426 s_android_end_ol_tag(void *pdoc, Node *UNUSED(child))
3432 android = GET_ANDROID(pdoc);
3437 if (IS_CSS_ON(android->entryp)) {
3438 chxj_css_pop_prop_list(android->css_prop_stack);
3440 return android->out;
3445 * It is a handler who processes the P tag.
3447 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
3448 * destination is specified.
3449 * @param node [i] The P tag node is specified.
3450 * @return The conversion result is returned.
3453 s_android_start_p_tag(void *pdoc, Node *node)
3459 char *attr_align = NULL;
3460 char *attr_style = NULL;
3461 char *attr_color = NULL;
3462 char *attr_blink = NULL;
3463 char *css_clear = NULL;
3465 android = GET_ANDROID(pdoc);
3469 for (attr = qs_get_attr(doc,node);
3471 attr = qs_get_next_attr(doc,attr)) {
3472 char *nm = qs_get_attr_name(doc,attr);
3473 char *val = qs_get_attr_value(doc,attr);
3474 if (STRCASEEQ('a','A',"align", nm)) {
3475 /*----------------------------------------------------------------------*/
3476 /* CHTML 1.0 (W3C version 3.2) */
3477 /*----------------------------------------------------------------------*/
3478 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
3479 attr_align = apr_pstrdup(doc->buf.pool, val);
3483 else if (STRCASEEQ('s','S',"style", nm) && val && *val) {
3484 attr_style = apr_pstrdup(doc->buf.pool, val);
3487 if (IS_CSS_ON(android->entryp)) {
3488 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
3490 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
3491 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
3492 css_property_t *text_deco_prop = chxj_css_get_property_value(doc, style, "text-decoration");
3493 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3494 css_property_t *cur;
3495 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
3496 if (STRCASEEQ('l','L',"left",cur->value)) {
3497 attr_align = apr_pstrdup(doc->pool, "left");
3499 else if (STRCASEEQ('c','C',"center",cur->value)) {
3500 attr_align = apr_pstrdup(doc->pool, "center");
3502 else if (STRCASEEQ('r','R',"right",cur->value)) {
3503 attr_align = apr_pstrdup(doc->pool, "right");
3506 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
3507 if (cur->value && *cur->value) {
3508 attr_color = apr_pstrdup(doc->pool, cur->value);
3511 for (cur = text_deco_prop->next; cur != text_deco_prop; cur = cur->next) {
3512 if (cur->value && *cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
3513 attr_blink = apr_pstrdup(doc->pool, cur->value);
3516 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3517 css_clear = apr_pstrdup(doc->pool, cur->value);
3522 if ((attr_align && *attr_align) || (attr_color && *attr_color) || (attr_blink && *attr_blink) || css_clear) {
3530 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
3536 W_L("text-decoration:");
3548 return android->out;
3553 * It is a handler who processes the P tag.
3555 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
3556 * destination is specified.
3557 * @param node [i] The P tag node is specified.
3558 * @return The conversion result is returned.
3561 s_android_end_p_tag(void *pdoc, Node *UNUSED(child))
3563 android_t *android = GET_ANDROID(pdoc);
3564 Doc *doc = android->doc;
3567 if (IS_CSS_ON(android->entryp)) {
3568 chxj_css_pop_prop_list(android->css_prop_stack);
3570 return android->out;
3575 * It is a handler who processes the PRE tag.
3577 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
3578 * destination is specified.
3579 * @param node [i] The PRE tag node is specified.
3580 * @return The conversion result is returned.
3583 s_android_start_pre_tag(void *pdoc, Node *node)
3585 android_t *android = GET_ANDROID(pdoc);
3586 Doc *doc = android->doc;
3588 char *attr_style = NULL;
3589 char *css_clear = NULL;
3591 for (attr = qs_get_attr(doc,node);
3593 attr = qs_get_next_attr(doc,attr)) {
3594 char *nm = qs_get_attr_name(doc,attr);
3595 char *val = qs_get_attr_value(doc,attr);
3596 if (val && STRCASEEQ('s','S',"style", nm)) {
3601 if (IS_CSS_ON(android->entryp)) {
3602 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
3604 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3606 css_property_t *cur;
3607 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3608 css_clear = apr_pstrdup(doc->pool, cur->value);
3613 android->pre_flag++;
3623 return android->out;
3628 * It is a handler who processes the PRE tag.
3630 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
3631 * destination is specified.
3632 * @param node [i] The PRE tag node is specified.
3633 * @return The conversion result is returned.
3636 s_android_end_pre_tag(void *pdoc, Node *UNUSED(child))
3638 android_t *android = GET_ANDROID(pdoc);
3639 Doc *doc = android->doc;
3642 android->pre_flag--;
3643 if (IS_CSS_ON(android->entryp)) {
3644 chxj_css_pop_prop_list(android->css_prop_stack);
3647 return android->out;
3652 * It is a handler who processes the UL tag.
3654 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
3655 * destination is specified.
3656 * @param node [i] The UL tag node is specified.
3657 * @return The conversion result is returned.
3660 s_android_start_ul_tag(void *pdoc, Node *node)
3662 android_t *android = GET_ANDROID(pdoc);
3663 Doc *doc = android->doc;
3665 char *attr_type = NULL;
3666 char *attr_style = NULL;
3667 char *css_clear = NULL;
3669 /*--------------------------------------------------------------------------*/
3670 /* Get Attributes */
3671 /*--------------------------------------------------------------------------*/
3672 for (attr = qs_get_attr(doc,node);
3674 attr = qs_get_next_attr(doc,attr)) {
3675 char *name = qs_get_attr_name(doc,attr);
3676 char *value = qs_get_attr_value(doc,attr);
3677 if (STRCASEEQ('t','T',"type",name)) {
3678 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
3682 else if (value && *value && STRCASEEQ('s','S',"style", name)) {
3686 if (IS_CSS_ON(android->entryp)) {
3687 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
3689 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
3690 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3692 css_property_t *cur;
3693 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
3694 if (STRCASEEQ('d','D',"disc",cur->value)) {
3695 attr_type = apr_pstrdup(doc->pool, "disc");
3697 else if (STRCASEEQ('c','C',"circle",cur->value)) {
3698 attr_type = apr_pstrdup(doc->pool, "circle");
3700 else if (STRCASEEQ('s','S',"square",cur->value)) {
3701 attr_type = apr_pstrdup(doc->pool, "square");
3704 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3705 css_clear = apr_pstrdup(doc->pool, cur->value);
3710 if (attr_type || css_clear) {
3713 W_L("list-style-type:");
3725 return android->out;
3730 * It is a handler who processes the UL tag.
3732 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
3733 * destination is specified.
3734 * @param node [i] The UL tag node is specified.
3735 * @return The conversion result is returned.
3738 s_android_end_ul_tag(void *pdoc, Node *UNUSED(child))
3740 android_t *android = GET_ANDROID(pdoc);
3741 Doc *doc = android->doc;
3744 if (IS_CSS_ON(android->entryp)) {
3745 chxj_css_pop_prop_list(android->css_prop_stack);
3747 return android->out;
3752 * It is a handler who processes the HR tag.
3754 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
3755 * destination is specified.
3756 * @param node [i] The HR tag node is specified.
3757 * @return The conversion result is returned.
3760 s_android_start_hr_tag(void *pdoc, Node *node)
3766 char *attr_align = NULL;
3767 char *attr_size = NULL;
3768 char *attr_width = NULL;
3769 char *attr_noshade = NULL;
3770 char *attr_style = NULL;
3771 char *attr_color = NULL;
3772 char *attr_bgcolor = NULL;
3774 char *style_border_color = NULL;
3775 char *css_clear = NULL;
3777 android = GET_ANDROID(pdoc);
3781 for (attr = qs_get_attr(doc,node);
3783 attr = qs_get_next_attr(doc,attr)) {
3784 char *name = qs_get_attr_name (doc,attr);
3785 char *value = qs_get_attr_value(doc,attr);
3789 if (strcasecmp(name, "align") == 0) {
3790 /*--------------------------------------------------------------------*/
3792 /*--------------------------------------------------------------------*/
3793 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
3794 if (value[0] == 'c' || value[0] == 'C') {
3795 attr_align = apr_pstrdup(doc->pool, "none");
3806 if (strcasecmp(name, "size") == 0) {
3807 /*--------------------------------------------------------------------*/
3809 /*--------------------------------------------------------------------*/
3810 if (value && *value) {
3814 else if (strcasecmp(name, "style") == 0) {
3815 if (value && *value) {
3823 if (strcasecmp(name, "width") == 0) {
3824 /*--------------------------------------------------------------------*/
3826 /*--------------------------------------------------------------------*/
3827 if (value && *value) {
3835 if (strcasecmp(name, "noshade") == 0) {
3836 /*--------------------------------------------------------------------*/
3838 /*--------------------------------------------------------------------*/
3839 attr_noshade = apr_pstrdup(doc->pool, "noshade");
3845 if (strcasecmp(name, "color") == 0 && value && *value) {
3846 /*--------------------------------------------------------------------*/
3848 /*--------------------------------------------------------------------*/
3857 if (IS_CSS_ON(android->entryp)) {
3858 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
3860 css_property_t *border_style_prop = chxj_css_get_property_value(doc, style, "border-style");
3861 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
3862 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
3864 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
3865 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
3866 css_property_t *border_color_prop = chxj_css_get_property_value(doc, style, "border-color");
3867 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
3868 css_property_t *cur;
3870 for (cur = border_style_prop->next; cur != border_style_prop; cur = cur->next) {
3871 if (STRCASEEQ('s','S',"solid",cur->value)) {
3872 attr_noshade = "noshade";
3875 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
3876 attr_size = apr_pstrdup(doc->pool, cur->value);
3878 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
3879 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
3882 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
3883 attr_align = apr_pstrdup(doc->pool,cur->value);
3888 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
3889 char *tmp = apr_pstrdup(doc->pool, cur->value);
3890 char *tmpp = strstr(tmp, "px");
3892 attr_width = apr_pstrdup(doc->pool, tmp);
3895 tmpp = strstr(tmp, "%");
3897 attr_width = apr_pstrdup(doc->pool, tmp);
3902 for (cur = border_color_prop->next; cur != border_color_prop; cur = cur->next) {
3903 char *tmp = apr_pstrdup(doc->pool, cur->value);
3905 style_border_color = apr_pstrdup(doc->pool, tmp);
3908 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
3909 css_clear = apr_pstrdup(doc->pool, cur->value);
3914 if (attr_align || attr_size || attr_width || attr_noshade || style_border_color || css_clear || attr_bgcolor) {
3924 if (chxj_chk_numeric(attr_size) == 0) {
3932 if (!strstr(attr_width, "px") && !strstr(attr_width, "%")) {
3938 W_L("border-style:solid;");
3940 if(style_border_color){
3941 W_L("border-color:");
3942 W_V(style_border_color);
3946 W_L("background-color:");
3965 return android->out;
3970 * It is a handler who processes the HR tag.
3972 * @param android [i/o] The pointer to the ANDROID structure at the output
3973 * destination is specified.
3974 * @param node [i] The HR tag node is specified.
3975 * @return The conversion result is returned.
3978 s_android_end_hr_tag(void *pdoc, Node *UNUSED(child))
3980 android_t *android = GET_ANDROID(pdoc);
3981 return android->out;
3986 * It is a handler who processes the IMG tag.
3988 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
3989 * destination is specified.
3990 * @param node [i] The IMG tag node is specified.
3991 * @return The conversion result is returned.
3994 s_android_start_img_tag(void *pdoc, Node *node)
3996 android_t *android = GET_ANDROID(pdoc);
3997 Doc *doc = android->doc;
3998 request_rec *r = doc->r;
4000 char *attr_src = NULL;
4001 char *attr_height = NULL;
4002 char *attr_width = NULL;
4003 char *attr_alt = NULL;
4004 char *attr_style = NULL;
4005 char *attr_hspace = NULL;
4006 char *attr_vspace = NULL;
4008 char *css_float = NULL;
4009 char *css_margin_left = NULL;
4010 char *css_margin_right = NULL;
4011 char *css_margin_top = NULL;
4012 char *css_margin_bottom = NULL;
4013 char *css_display = NULL;
4014 char *css_valign = NULL;
4016 #ifndef IMG_NOT_CONVERT_FILENAME
4017 device_table *spec = android->spec;
4020 /*--------------------------------------------------------------------------*/
4021 /* Get Attributes */
4022 /*--------------------------------------------------------------------------*/
4023 for (attr = qs_get_attr(doc,node);
4025 attr = qs_get_next_attr(doc,attr)) {
4026 char *name = qs_get_attr_name(doc,attr);
4027 char *value = qs_get_attr_value(doc,attr);
4028 if (STRCASEEQ('s','S',"src",name)) {
4029 /*----------------------------------------------------------------------*/
4031 /*----------------------------------------------------------------------*/
4032 #ifdef IMG_NOT_CONVERT_FILENAME
4033 value = chxj_encoding_parameter(r, value, 1);
4034 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, android->entryp, 1);
4035 value = chxj_add_cookie_no_update_parameter(r, value);
4036 value = chxj_img_rewrite_parameter(r,android->conf,value);
4039 value = chxj_img_conv(r, spec, value);
4040 value = chxj_encoding_parameter(r, value, 1);
4041 value = chxj_jreserved_tag_to_safe_for_query_string(r, value, android->entryp, 1);
4042 value = chxj_add_cookie_no_update_parameter(r, value);
4043 value = chxj_img_rewrite_parameter(r,android->conf,value);
4047 else if (STRCASEEQ('a','A',"align",name)) {
4048 /*----------------------------------------------------------------------*/
4050 /*----------------------------------------------------------------------*/
4052 if (STRCASEEQ('t','T',"top", value) ||
4053 STRCASEEQ('m','M',"middle",value) ||
4054 STRCASEEQ('b','B',"bottom",value)){
4056 }else if (STRCASEEQ('l','L',"left", value) || STRCASEEQ('r','R',"right", value)) {
4059 else if (STRCASEEQ('c','C',"center",value)) {
4060 css_valign = apr_pstrdup(doc->pool, "middle");
4064 else if (STRCASEEQ('w','W',"width",name) && value && *value) {
4065 /*----------------------------------------------------------------------*/
4067 /*----------------------------------------------------------------------*/
4070 else if (STRCASEEQ('h','H',"height",name) && value && *value) {
4071 /*----------------------------------------------------------------------*/
4073 /*----------------------------------------------------------------------*/
4074 attr_height = value;
4076 else if (STRCASEEQ('h','H',"hspace",name)) {
4077 /*----------------------------------------------------------------------*/
4079 /*----------------------------------------------------------------------*/
4080 attr_hspace = value;
4082 else if (STRCASEEQ('v','V',"vspace",name)) {
4083 /*----------------------------------------------------------------------*/
4085 /*----------------------------------------------------------------------*/
4086 attr_vspace = value;
4088 else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
4089 /*----------------------------------------------------------------------*/
4091 /*----------------------------------------------------------------------*/
4094 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
4095 /*----------------------------------------------------------------------*/
4097 /*----------------------------------------------------------------------*/
4102 if (IS_CSS_ON(android->entryp)) {
4103 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
4105 css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
4106 css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
4107 css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
4108 css_property_t *margin_left_prop = chxj_css_get_property_value(doc, style, "margin-left");
4109 css_property_t *margin_right_prop = chxj_css_get_property_value(doc, style, "margin-right");
4110 css_property_t *margin_top_prop = chxj_css_get_property_value(doc, style, "margin-top");
4111 css_property_t *margin_bottom_prop = chxj_css_get_property_value(doc, style, "margin-bottom");
4114 css_property_t *cur;
4115 for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
4116 attr_height = apr_pstrdup(doc->pool, cur->value);
4118 for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
4119 attr_width = apr_pstrdup(doc->pool, cur->value);
4122 for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
4123 css_valign = apr_pstrdup(doc->pool, cur->value);
4126 if (! attr_hspace) {
4127 for (cur = margin_left_prop->next; cur != margin_left_prop; cur = cur->next) {
4128 css_margin_left = apr_pstrdup(doc->pool, cur->value);
4130 for (cur = margin_right_prop->next; cur != margin_right_prop; cur = cur->next) {
4131 css_margin_right = apr_pstrdup(doc->pool, cur->value);
4134 if (! attr_vspace) {
4135 for (cur = margin_top_prop->next; cur != margin_top_prop; cur = cur->next) {
4136 css_margin_top = apr_pstrdup(doc->pool, cur->value);
4138 for (cur = margin_bottom_prop->next; cur != margin_bottom_prop; cur = cur->next) {
4139 css_margin_bottom = apr_pstrdup(doc->pool, cur->value);
4143 css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
4144 for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
4145 css_float = apr_pstrdup(doc->pool, cur->value);
4149 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
4150 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
4151 char *tmp = apr_pstrdup(doc->pool, cur->value);
4152 char *tmpp = strstr(tmp, "none");
4154 css_display = apr_pstrdup(doc->pool, tmp);
4166 if (attr_hspace || attr_vspace || css_float || css_margin_left || css_margin_right || css_margin_top || css_margin_bottom || css_valign || css_display) {
4174 W_L("vertical-align:");
4179 W_L("margin-left:");
4182 W_L("margin-right:");
4187 if(css_margin_left){
4188 W_L("margin-left:");
4189 W_V(css_margin_left);
4192 if(css_margin_right){
4193 W_L("margin-right:");
4194 W_V(css_margin_right);
4202 W_L("margin-bottom:");
4209 W_V(css_margin_top);
4212 if(css_margin_bottom){
4213 W_L("margin-bottom:");
4214 W_V(css_margin_bottom);
4219 W_L("display:none;");
4243 return android->out;
4248 * It is a handler who processes the IMG tag.
4250 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
4251 * destination is specified.
4252 * @param node [i] The IMG tag node is specified.
4253 * @return The conversion result is returned.
4256 s_android_end_img_tag(void *pdoc, Node *UNUSED(child))
4258 android_t *android = GET_ANDROID(pdoc);
4259 return android->out;
4264 * It is a handler who processes the SELECT tag.
4266 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
4267 * destination is specified.
4268 * @param node [i] The SELECT tag node is specified.
4269 * @return The conversion result is returned.
4272 s_android_start_select_tag(void *pdoc, Node *node)
4274 android_t *android = GET_ANDROID(pdoc);
4275 Doc *doc = android->doc;
4279 char *multiple = NULL;
4280 char *attr_style = NULL;
4283 for (attr = qs_get_attr(doc,node);
4285 attr = qs_get_next_attr(doc,attr)) {
4286 char *nm = qs_get_attr_name(doc,attr);
4287 char *val = qs_get_attr_value(doc,attr);
4288 if (STRCASEEQ('s','S',"size",nm)) {
4289 /*----------------------------------------------------------------------*/
4290 /* CHTML 1.0 version 2.0 */
4291 /*----------------------------------------------------------------------*/
4292 size = apr_pstrdup(doc->buf.pool, val);
4294 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
4295 /*----------------------------------------------------------------------*/
4296 /* CHTML 1.0 version 2.0 */
4297 /*----------------------------------------------------------------------*/
4298 attr_style = apr_pstrdup(doc->buf.pool, val);
4300 else if (STRCASEEQ('n','N',"name",nm)) {
4301 /*----------------------------------------------------------------------*/
4302 /* CHTML 1.0 version 2.0 */
4303 /*----------------------------------------------------------------------*/
4304 name = apr_pstrdup(doc->buf.pool, val);
4306 else if (STRCASEEQ('m','M',"multiple", nm)) {
4307 /*----------------------------------------------------------------------*/
4308 /* CHTML 1.0 version 2.0 */
4309 /*----------------------------------------------------------------------*/
4310 multiple = apr_pstrdup(doc->buf.pool, val);
4313 if (size && *size) {
4318 if (name && *name) {
4324 W_L(" multiple=\"multiple\"");
4328 if (IS_CSS_ON(android->entryp)) {
4329 s_android_nopush_and_get_now_style(pdoc, node, attr_style);
4332 return android->out;
4337 * It is a handler who processes the SELECT tag.
4339 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
4340 * destination is specified.
4341 * @param node [i] The SELECT tag node is specified.
4342 * @return The conversion result is returned.
4345 s_android_end_select_tag(void *pdoc, Node *UNUSED(child))
4347 android_t *android = GET_ANDROID(pdoc);
4348 Doc *doc = android->doc;
4351 if (IS_CSS_ON(android->entryp)) {
4352 chxj_css_pop_prop_list(android->css_prop_stack);
4355 return android->out;
4359 * It is a handler who processes the OPTION tag.
4361 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
4362 * destination is specified.
4363 * @param node [i] The OPTION tag node is specified.
4364 * @return The conversion result is returned.
4367 s_android_start_option_tag(void *pdoc, Node *node)
4369 android_t *android = GET_ANDROID(pdoc);
4370 Doc *doc = android->doc;
4373 char *selected = NULL;
4375 char *attr_style = NULL;
4378 for (attr = qs_get_attr(doc,node);
4380 attr = qs_get_next_attr(doc,attr)) {
4381 char *nm = qs_get_attr_name(doc,attr);
4382 char *val = qs_get_attr_value(doc,attr);
4383 if (STRCASEEQ('s','S',"selected",nm)) {
4384 /*----------------------------------------------------------------------*/
4385 /* CHTML 1.0 version 2.0 */
4386 /*----------------------------------------------------------------------*/
4387 selected = apr_pstrdup(doc->buf.pool, val);
4389 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
4390 /*----------------------------------------------------------------------*/
4391 /* CHTML 1.0 version 2.0 */
4392 /*----------------------------------------------------------------------*/
4393 attr_style = apr_pstrdup(doc->buf.pool, val);
4395 else if (STRCASEEQ('v','V',"value",nm)) {
4396 /*----------------------------------------------------------------------*/
4397 /* CHTML 1.0 version 2.0 */
4398 /*----------------------------------------------------------------------*/
4399 value = apr_pstrdup(doc->buf.pool, val);
4408 W_L(" selected=\"selected\"");
4412 if (IS_CSS_ON(android->entryp)) {
4413 s_android_nopush_and_get_now_style(pdoc, node, attr_style);
4416 return android->out;
4421 * It is a handler who processes the OPTION tag.
4423 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
4424 * destination is specified.
4425 * @param node [i] The OPTION tag node is specified.
4426 * @return The conversion result is returned.
4429 s_android_end_option_tag(void *pdoc, Node *UNUSED(child))
4431 android_t *android = GET_ANDROID(pdoc);
4432 Doc *doc = android->doc;
4435 if (IS_CSS_ON(android->entryp)) {
4436 chxj_css_pop_prop_list(android->css_prop_stack);
4439 return android->out;
4444 * It is a handler who processes the DIV tag.
4446 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
4447 * destination is specified.
4448 * @param node [i] The DIV tag node is specified.
4449 * @return The conversion result is returned.
4452 s_android_start_div_tag(void *pdoc, Node *node)
4458 char *attr_style = NULL;
4459 char *attr_align = NULL;
4460 char *attr_display = NULL;
4461 char *attr_decoration = NULL;
4462 char *attr_wap_marquee_style = NULL;
4463 char *attr_wap_marquee_dir = NULL;
4464 char *attr_wap_marquee_loop = NULL;
4465 char *attr_wap_marquee_speed = NULL;
4466 char *attr_color = NULL;
4467 char *attr_bgcolor = NULL;
4468 char *attr_font_size = NULL;
4469 char *css_clear = NULL;
4471 android = GET_ANDROID(pdoc);
4475 for (attr = qs_get_attr(doc,node);
4477 attr = qs_get_next_attr(doc,attr)) {
4478 char *nm = qs_get_attr_name(doc,attr);
4479 char *val = qs_get_attr_value(doc,attr);
4480 if (STRCASEEQ('a','A',"align",nm)) {
4481 /*----------------------------------------------------------------------*/
4482 /* CHTML 1.0 (W3C version 3.2) */
4483 /*----------------------------------------------------------------------*/
4484 if (val && (STRCASEEQ('l','L',"left",val) || STRCASEEQ('r','R',"right",val) || STRCASEEQ('c','C',"center",val))) {
4485 attr_align = apr_pstrdup(doc->buf.pool, val);
4488 else if (STRCASEEQ('s','S',"style",nm) && val && *val) {
4489 attr_style = apr_pstrdup(doc->buf.pool, val);
4493 if (IS_CSS_ON(android->entryp)) {
4494 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
4496 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
4497 css_property_t *text_decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
4498 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4499 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
4500 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4501 css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
4502 css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
4503 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4505 css_property_t *cur;
4506 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
4507 if (strcasecmp("-wap-marquee", cur->value) == 0) {
4508 attr_display = apr_pstrdup(doc->pool, cur->value);
4511 for (cur = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
4512 if (STRCASEEQ('b','B',"blink", cur->value)) {
4513 attr_decoration = apr_pstrdup(doc->pool, cur->value);
4516 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4517 attr_color = apr_pstrdup(doc->pool, cur->value);
4519 for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
4520 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
4521 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
4523 for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
4524 char *ss = strchr(cur->value, '#');
4526 ss = strstr(cur->value, "rgb");
4529 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
4530 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
4533 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
4534 attr_align = apr_pstrdup(doc->pool, cur->value);
4536 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4537 if ( STRCASEEQ('x','X',"xx-small",cur->value)
4538 || STRCASEEQ('x','X',"x-small",cur->value)
4539 || STRCASEEQ('s','S',"small",cur->value)
4540 || STRCASEEQ('m','M',"medium",cur->value)
4541 || STRCASEEQ('l','L',"large",cur->value)
4542 || STRCASEEQ('x','X',"x-large",cur->value)
4543 || STRCASEEQ('x','X',"xx-large",cur->value)) {
4544 attr_font_size = apr_pstrdup(doc->pool, cur->value);
4548 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
4549 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
4550 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
4551 css_property_t *wap_marquee_speed_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-speed");
4552 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
4553 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
4554 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
4557 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
4558 if (STRCASEEQ('l','L',"ltr",cur->value)) {
4559 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
4561 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
4562 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
4565 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
4566 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
4567 attr_wap_marquee_loop = "infinite";
4570 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
4573 for (cur = wap_marquee_speed_prop->next; cur != wap_marquee_speed_prop; cur = cur->next) {
4574 attr_wap_marquee_speed = apr_pstrdup(doc->pool, cur->value);
4577 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
4578 css_clear = apr_pstrdup(doc->pool, cur->value);
4586 || attr_wap_marquee_style
4587 || attr_wap_marquee_dir
4588 || attr_wap_marquee_loop
4589 || attr_wap_marquee_speed
4602 W_L("overflow:-webkit-marquee;");
4604 if (attr_decoration) {
4605 if (STRCASEEQ('b','B',"blink",attr_decoration)) {
4607 if (android->blink_keyframe_out == 0) {
4608 android->style_data = apr_pstrcat(doc->pool, (android->style_data) ? android->style_data : "",
4611 android->blink_keyframe_out = 1;
4615 W_L("text-decoration:");
4616 W_V(attr_decoration);
4620 if (attr_wap_marquee_style) {
4621 W_L("-webkit-marquee-style:");
4622 W_V(attr_wap_marquee_style);
4625 if (attr_wap_marquee_dir) {
4626 W_L("-webkit-marquee-direction:");
4627 if (STRCASEEQ('r','R',"rtl",attr_wap_marquee_dir)) {
4630 else if (STRCASEEQ('l','L',"ltr",attr_wap_marquee_dir)) {
4635 if (attr_wap_marquee_loop) {
4636 W_L("-webkit-marquee-repetition:");
4637 W_V(attr_wap_marquee_loop);
4640 if (attr_wap_marquee_speed) {
4641 W_L("-webkit-marquee-speed:");
4642 W_V(attr_wap_marquee_speed);
4651 W_L("background-color:");
4655 if (attr_font_size) {
4657 W_V(attr_font_size);
4668 return android->out;
4673 * It is a handler who processes the DIV tag.
4675 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
4676 * destination is specified.
4677 * @param node [i] The DIV tag node is specified.
4678 * @return The conversion result is returned.
4681 s_android_end_div_tag(void *pdoc, Node *UNUSED(child))
4687 android = GET_ANDROID(pdoc);
4692 if (IS_CSS_ON(android->entryp)) {
4693 chxj_css_pop_prop_list(android->css_prop_stack);
4695 return android->out;
4700 s_android_chxjif_tag(void *pdoc, Node *node)
4707 android = GET_ANDROID(pdoc);
4711 for (child = qs_get_child_node(doc, node);
4713 child = qs_get_next_node(doc, child)) {
4715 s_android_chxjif_tag(android, child);
4722 * It is a handler who processes the TEXTARE tag.
4724 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
4725 * destination is specified.
4726 * @param node [i] The TEXTAREA tag node is specified.
4727 * @return The conversion result is returned.
4730 s_android_start_textarea_tag(void *pdoc, Node *node)
4736 char *attr_accesskey = NULL;
4737 char *attr_name = NULL;
4738 char *attr_rows = NULL;
4739 char *attr_cols = NULL;
4740 char *attr_istyle = NULL;
4741 char *attr_style = NULL;
4744 android = GET_ANDROID(pdoc);
4748 android->textarea_flag++;
4749 for (attr = qs_get_attr(doc,node);
4751 attr = qs_get_next_attr(doc,attr)) {
4752 char *name = qs_get_attr_name(doc,attr);
4753 char *value = qs_get_attr_value(doc,attr);
4754 if (STRCASEEQ('a','A',"accesskey",name) && value && *value != 0) {
4755 attr_accesskey = value;
4757 else if (STRCASEEQ('i','I',"istyle", name) && value && (*value == '1' || *value == '2' || *value == '3' || *value == '4')) {
4758 attr_istyle = value;
4760 else if (STRCASEEQ('n','N',"name", name) && value && *value) {
4763 else if (STRCASEEQ('r','R',"rows", name) && value && *value) {
4766 else if (STRCASEEQ('c','C',"cols", name) && value && *value) {
4769 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
4773 if (IS_CSS_ON(android->entryp)) {
4774 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
4776 css_property_t *wap_input_format = chxj_css_get_property_value(doc, style, "-wap-input-format");
4777 css_property_t *cur;
4778 for (cur = wap_input_format->next; cur != wap_input_format; cur = cur->next) {
4779 if (strcasestr(cur->value, "<ja:n>")) {
4782 else if (strcasestr(cur->value, "<ja:en>")) {
4785 else if (strcasestr(cur->value, "<ja:hk>")) {
4788 else if (strcasestr(cur->value, "<ja:h>")) {
4811 return android->out;
4816 * It is a handler who processes the TEXTAREA tag.
4818 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
4819 * destination is specified.
4820 * @param node [i] The TEXTAREA tag node is specified.
4821 * @return The conversion result is returned.
4824 s_android_end_textarea_tag(void *pdoc, Node *UNUSED(child))
4830 android = GET_ANDROID(pdoc);
4835 android->textarea_flag--;
4837 return android->out;
4842 * It is a handler who processes the B tag.
4844 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
4845 * destination is specified.
4846 * @param node [i] The B tag node is specified.
4847 * @return The conversion result is returned.
4850 s_android_start_b_tag(void* pdoc, Node* UNUSED(node))
4856 android = GET_ANDROID(pdoc);
4861 return android->out;
4866 * It is a handler who processes the B tag.
4868 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
4869 * destination is specified.
4870 * @param node [i] The B tag node is specified.
4871 * @return The conversion result is returned.
4874 s_android_end_b_tag(void* pdoc, Node* UNUSED(child))
4876 android_t* android = GET_ANDROID(pdoc);
4877 Doc* doc = android->doc;
4880 return android->out;
4884 s_android_text_tag(void* pdoc, Node* child)
4895 apr_size_t z2h_input_len;
4897 android = GET_ANDROID(pdoc);
4901 textval = qs_get_node_value(doc,child);
4902 if (strlen(textval) == 0) {
4903 return android->out;
4906 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
4907 memset(tmp, 0, qs_get_node_size(doc,child)+1);
4909 tdst = qs_alloc_zero_byte_string(doc->buf.pool);
4910 memset(one_byte, 0, sizeof(one_byte));
4913 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
4915 int rtn = s_android_search_emoji(android, &textval[ii], &out);
4917 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
4922 if (is_sjis_kanji(textval[ii])) {
4923 one_byte[0] = textval[ii+0];
4924 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4925 one_byte[0] = textval[ii+1];
4926 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4930 if (android->pre_flag) {
4931 one_byte[0] = textval[ii+0];
4932 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4935 if (android->textarea_flag) {
4936 one_byte[0] = textval[ii+0];
4937 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4940 if (textval[ii] != '\r' && textval[ii] != '\n') {
4941 one_byte[0] = textval[ii+0];
4942 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
4946 z2h_input_len = strlen(tdst);
4947 tdst = chxj_conv_z2h(r, tdst, &z2h_input_len, android->entryp);
4950 return android->out;
4955 * It is a handler who processes the BLOCKQUOTE tag.
4957 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
4958 * destination is specified.
4959 * @param node [i] The BLOCKQUOTE tag node is specified.
4960 * @return The conversion result is returned.
4963 s_android_start_blockquote_tag(void *pdoc, Node *node)
4968 char *attr_style = NULL;
4969 char *attr_color = NULL;
4970 char *attr_size = NULL;
4971 char *css_clear = NULL;
4973 android = GET_ANDROID(pdoc);
4975 for (attr = qs_get_attr(doc,node);
4977 attr = qs_get_next_attr(doc,attr)) {
4978 char *nm = qs_get_attr_name(doc,attr);
4979 char *val = qs_get_attr_value(doc,attr);
4980 if (val && STRCASEEQ('s','S',"style", nm)) {
4984 if (IS_CSS_ON(android->entryp)) {
4985 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
4987 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
4988 css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
4989 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
4991 css_property_t *cur;
4992 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
4993 if (cur->value && *cur->value) {
4994 attr_color = apr_pstrdup(doc->pool, cur->value);
4997 for (cur = font_size_prop->next; cur != font_size_prop; cur = cur->next) {
4998 if (cur->value && *cur->value) {
4999 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5000 attr_size = apr_pstrdup(doc->pool, cur->value);
5002 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5003 attr_size = apr_pstrdup(doc->pool, cur->value);
5005 else if (STRCASEEQ('s','S',"small",cur->value)) {
5006 attr_size = apr_pstrdup(doc->pool, cur->value);
5008 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5009 attr_size = apr_pstrdup(doc->pool, cur->value);
5011 else if (STRCASEEQ('l','L',"large",cur->value)) {
5012 attr_size = apr_pstrdup(doc->pool, cur->value);
5014 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5015 attr_size = apr_pstrdup(doc->pool, cur->value);
5017 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5018 attr_size = apr_pstrdup(doc->pool, cur->value);
5022 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5023 css_clear = apr_pstrdup(doc->pool, cur->value);
5028 if (attr_color || attr_size || css_clear) {
5031 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5049 return android->out;
5054 * It is a handler who processes the BLOCKQUOTE tag.
5056 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
5057 * destination is specified.
5058 * @param node [i] The BLOCKQUOTE tag node is specified.
5059 * @return The conversion result is returned.
5062 s_android_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
5064 android_t *android = GET_ANDROID(pdoc);
5065 Doc *doc = android->doc;
5066 W_L("</blockquote>");
5067 if (IS_CSS_ON(android->entryp)) {
5068 chxj_css_pop_prop_list(android->css_prop_stack);
5070 return android->out;
5075 * It is a handler who processes the DIR tag.
5077 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
5078 * destination is specified.
5079 * @param node [i] The DIR tag node is specified.
5080 * @return The conversion result is returned.
5083 s_android_start_dir_tag(void *pdoc, Node *node)
5085 android_t *android = GET_ANDROID(pdoc);
5086 Doc *doc = android->doc;
5088 char *attr_style = NULL;
5089 char *attr_color = NULL;
5090 char *attr_type = NULL;
5091 char *attr_size = NULL;
5092 for (attr = qs_get_attr(doc,node);
5094 attr = qs_get_next_attr(doc,attr)) {
5095 char *name = qs_get_attr_name(doc,attr);
5096 char *value = qs_get_attr_value(doc,attr);
5097 if (STRCASEEQ('t','T',"type",name)) {
5098 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
5102 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
5106 if (IS_CSS_ON(android->entryp)) {
5107 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
5109 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5110 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5111 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
5112 css_property_t *cur;
5113 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5114 if (cur->value && *cur->value) {
5115 attr_color = apr_pstrdup(doc->pool, cur->value);
5118 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5119 if (cur->value && *cur->value) {
5120 attr_type = apr_pstrdup(doc->pool, cur->value);
5123 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5124 if (cur->value && *cur->value) {
5125 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5126 attr_size = apr_pstrdup(doc->pool, cur->value);
5128 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5129 attr_size = apr_pstrdup(doc->pool, cur->value);
5131 else if (STRCASEEQ('s','S',"small",cur->value)) {
5132 attr_size = apr_pstrdup(doc->pool, cur->value);
5134 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5135 attr_size = apr_pstrdup(doc->pool, cur->value);
5137 else if (STRCASEEQ('l','L',"large",cur->value)) {
5138 attr_size = apr_pstrdup(doc->pool, cur->value);
5140 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5141 attr_size = apr_pstrdup(doc->pool, cur->value);
5143 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5144 attr_size = apr_pstrdup(doc->pool, cur->value);
5151 if (attr_type || attr_color || attr_size) {
5154 W_L("list-style-type:");
5159 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5172 return android->out;
5177 * It is a handler who processes the DIR tag.
5179 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
5180 * destination is specified.
5181 * @param node [i] The DIR tag node is specified.
5182 * @return The conversion result is returned.
5185 s_android_end_dir_tag(void *pdoc, Node *UNUSED(child))
5187 android_t *android = GET_ANDROID(pdoc);
5188 Doc *doc = android->doc;
5190 if (IS_CSS_ON(android->entryp)) {
5191 chxj_css_pop_prop_list(android->css_prop_stack);
5193 return android->out;
5198 * It is a handler who processes the DL tag.
5200 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
5201 * destination is specified.
5202 * @param node [i] The DL tag node is specified.
5203 * @return The conversion result is returned.
5206 s_android_start_dl_tag(void *pdoc, Node *node)
5208 android_t *android = GET_ANDROID(pdoc);
5209 Doc *doc = android->doc;
5211 char *attr_style = NULL;
5212 char *attr_color = NULL;
5213 char *attr_size = NULL;
5214 char *css_clear = NULL;
5216 for (attr = qs_get_attr(doc,node);
5218 attr = qs_get_next_attr(doc,attr)) {
5219 char *name = qs_get_attr_name(doc,attr);
5220 char *value = qs_get_attr_value(doc,attr);
5221 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5225 if (IS_CSS_ON(android->entryp)) {
5226 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
5228 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5229 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5230 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5232 css_property_t *cur;
5233 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5234 if (cur->value && *cur->value) {
5235 attr_color = apr_pstrdup(doc->pool, cur->value);
5238 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5239 if (cur->value && *cur->value) {
5240 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5241 attr_size = apr_pstrdup(doc->pool, cur->value);
5243 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5244 attr_size = apr_pstrdup(doc->pool, cur->value);
5246 else if (STRCASEEQ('s','S',"small",cur->value)) {
5247 attr_size = apr_pstrdup(doc->pool, cur->value);
5249 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5250 attr_size = apr_pstrdup(doc->pool, cur->value);
5252 else if (STRCASEEQ('l','L',"large",cur->value)) {
5253 attr_size = apr_pstrdup(doc->pool, cur->value);
5255 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5256 attr_size = apr_pstrdup(doc->pool, cur->value);
5258 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5259 attr_size = apr_pstrdup(doc->pool, cur->value);
5263 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5264 css_clear = apr_pstrdup(doc->pool, cur->value);
5269 if (attr_color || attr_size || css_clear) {
5272 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5290 return android->out;
5295 * It is a handler who processes the DL tag.
5297 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
5298 * destination is specified.
5299 * @param node [i] The DL tag node is specified.
5300 * @return The conversion result is returned.
5303 s_android_end_dl_tag(void *pdoc, Node *UNUSED(child))
5305 android_t *android = GET_ANDROID(pdoc);
5306 Doc *doc = android->doc;
5308 if (IS_CSS_ON(android->entryp)) {
5309 chxj_css_pop_prop_list(android->css_prop_stack);
5311 return android->out;
5316 * It is a handler who processes the DT tag.
5318 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
5319 * destination is specified.
5320 * @param node [i] The DT tag node is specified.
5321 * @return The conversion result is returned.
5324 s_android_start_dt_tag(void *pdoc, Node *node)
5326 android_t *android = GET_ANDROID(pdoc);
5327 Doc *doc = android->doc;
5329 char *attr_style = NULL;
5330 char *attr_color = NULL;
5331 char *attr_size = NULL;
5332 for (attr = qs_get_attr(doc,node);
5334 attr = qs_get_next_attr(doc,attr)) {
5335 char *name = qs_get_attr_name(doc,attr);
5336 char *value = qs_get_attr_value(doc,attr);
5337 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5341 if (IS_CSS_ON(android->entryp)) {
5342 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
5344 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5345 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5346 css_property_t *cur;
5347 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5348 if (cur->value && *cur->value) {
5349 attr_color = apr_pstrdup(doc->pool, cur->value);
5352 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5353 if (cur->value && *cur->value) {
5354 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5355 attr_size = apr_pstrdup(doc->pool, cur->value);
5357 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5358 attr_size = apr_pstrdup(doc->pool, cur->value);
5360 else if (STRCASEEQ('s','S',"small",cur->value)) {
5361 attr_size = apr_pstrdup(doc->pool, cur->value);
5363 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5364 attr_size = apr_pstrdup(doc->pool, cur->value);
5366 else if (STRCASEEQ('l','L',"large",cur->value)) {
5367 attr_size = apr_pstrdup(doc->pool, cur->value);
5369 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5370 attr_size = apr_pstrdup(doc->pool, cur->value);
5372 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5373 attr_size = apr_pstrdup(doc->pool, cur->value);
5380 if (attr_color || attr_size) {
5383 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5396 return android->out;
5401 * It is a handler who processes the DT tag.
5403 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
5404 * destination is specified.
5405 * @param node [i] The DT tag node is specified.
5406 * @return The conversion result is returned.
5409 s_android_end_dt_tag(void *pdoc, Node *UNUSED(child))
5411 android_t *android = GET_ANDROID(pdoc);
5412 Doc *doc = android->doc;
5414 if (IS_CSS_ON(android->entryp)) {
5415 chxj_css_pop_prop_list(android->css_prop_stack);
5417 return android->out;
5422 * It is a handler who processes the DD tag.
5424 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
5425 * destination is specified.
5426 * @param node [i] The DD tag node is specified.
5427 * @return The conversion result is returned.
5430 s_android_start_dd_tag(void *pdoc, Node *node)
5432 android_t *android = GET_ANDROID(pdoc);
5433 Doc *doc = android->doc;
5435 char *attr_style = NULL;
5436 char *attr_color = NULL;
5437 char *attr_size = NULL;
5438 for (attr = qs_get_attr(doc,node);
5440 attr = qs_get_next_attr(doc,attr)) {
5441 char *name = qs_get_attr_name(doc,attr);
5442 char *value = qs_get_attr_value(doc,attr);
5443 if (STRCASEEQ('s','S',"style", name) && value && *value) {
5447 if (IS_CSS_ON(android->entryp)) {
5448 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
5450 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
5451 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
5452 css_property_t *cur;
5453 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
5454 if (cur->value && *cur->value) {
5455 attr_color = apr_pstrdup(doc->pool, cur->value);
5458 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
5459 if (cur->value && *cur->value) {
5460 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
5461 attr_size = apr_pstrdup(doc->pool, cur->value);
5463 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
5464 attr_size = apr_pstrdup(doc->pool, cur->value);
5466 else if (STRCASEEQ('s','S',"small",cur->value)) {
5467 attr_size = apr_pstrdup(doc->pool, cur->value);
5469 else if (STRCASEEQ('m','M',"medium",cur->value)) {
5470 attr_size = apr_pstrdup(doc->pool, cur->value);
5472 else if (STRCASEEQ('l','L',"large",cur->value)) {
5473 attr_size = apr_pstrdup(doc->pool, cur->value);
5475 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
5476 attr_size = apr_pstrdup(doc->pool, cur->value);
5478 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
5479 attr_size = apr_pstrdup(doc->pool, cur->value);
5486 if (attr_color || attr_size) {
5489 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
5502 return android->out;
5507 * It is a handler who processes the DD tag.
5509 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
5510 * destination is specified.
5511 * @param node [i] The DD tag node is specified.
5512 * @return The conversion result is returned.
5515 s_android_end_dd_tag(void *pdoc, Node *UNUSED(child))
5517 android_t *android = GET_ANDROID(pdoc);
5518 Doc *doc = android->doc;
5520 if (IS_CSS_ON(android->entryp)) {
5521 chxj_css_pop_prop_list(android->css_prop_stack);
5523 return android->out;
5528 * It is a handler who processes the H1 tag.
5530 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
5531 * destination is specified.
5532 * @param node [i] The H1 tag node is specified.
5533 * @return The conversion result is returned.
5536 s_android_start_h1_tag(void *pdoc, Node *node)
5542 char *attr_style = NULL;
5543 char *attr_align = NULL;
5544 char *css_clear = NULL;
5546 android = GET_ANDROID(pdoc);
5550 for (attr = qs_get_attr(doc,node);
5552 attr = qs_get_next_attr(doc,attr)) {
5553 char *name = qs_get_attr_name(doc,attr);
5554 char *value = qs_get_attr_value(doc,attr);
5555 if (STRCASEEQ('a','A',"align", name)) {
5556 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5560 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5564 if (IS_CSS_ON(android->entryp)) {
5565 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
5567 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5568 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5569 css_property_t *cur;
5570 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5571 if (STRCASEEQ('l','L',"left", cur->value)) {
5572 attr_align = apr_pstrdup(doc->pool, "left");
5574 else if (STRCASEEQ('c','C',"center",cur->value)) {
5575 attr_align = apr_pstrdup(doc->pool, "center");
5577 else if (STRCASEEQ('r','R',"right",cur->value)) {
5578 attr_align = apr_pstrdup(doc->pool, "right");
5581 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5582 if (STRCASEEQ('b','B',"both", cur->value)) {
5583 css_clear = apr_pstrdup(doc->pool, "both");
5585 else if (STRCASEEQ('r','R',"right", cur->value)) {
5586 css_clear = apr_pstrdup(doc->pool, "right");
5588 else if (STRCASEEQ('l','L',"left", cur->value)) {
5589 css_clear = apr_pstrdup(doc->pool, "left");
5595 if (attr_align || css_clear ) {
5611 return android->out;
5616 * It is a handler who processes the H1 tag.
5618 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
5619 * destination is specified.
5620 * @param node [i] The H1 tag node is specified.
5621 * @return The conversion result is returned.
5624 s_android_end_h1_tag(void *pdoc, Node *UNUSED(child))
5630 android = GET_ANDROID(pdoc);
5635 if (IS_CSS_ON(android->entryp)) {
5636 chxj_css_pop_prop_list(android->css_prop_stack);
5639 return android->out;
5644 * It is a handler who processes the H2 tag.
5646 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
5647 * destination is specified.
5648 * @param node [i] The H1 tag node is specified.
5649 * @return The conversion result is returned.
5652 s_android_start_h2_tag(void *pdoc, Node *node)
5658 char *attr_style = NULL;
5659 char *attr_align = NULL;
5660 char *css_clear = NULL;
5662 android = GET_ANDROID(pdoc);
5666 for (attr = qs_get_attr(doc,node);
5668 attr = qs_get_next_attr(doc,attr)) {
5669 char *name = qs_get_attr_name(doc,attr);
5670 char *value = qs_get_attr_value(doc,attr);
5671 if (STRCASEEQ('a','A',"align", name)) {
5672 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5676 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5680 if (IS_CSS_ON(android->entryp)) {
5681 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
5683 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5684 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5685 css_property_t *cur;
5686 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5687 if (STRCASEEQ('l','L',"left", cur->value)) {
5688 attr_align = apr_pstrdup(doc->pool, "left");
5690 else if (STRCASEEQ('c','C',"center",cur->value)) {
5691 attr_align = apr_pstrdup(doc->pool, "center");
5693 else if (STRCASEEQ('r','R',"right",cur->value)) {
5694 attr_align = apr_pstrdup(doc->pool, "right");
5697 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5698 if (STRCASEEQ('b','B',"both", cur->value)) {
5699 css_clear = apr_pstrdup(doc->pool, "both");
5701 else if (STRCASEEQ('r','R',"right", cur->value)) {
5702 css_clear = apr_pstrdup(doc->pool, "right");
5704 else if (STRCASEEQ('l','L',"left", cur->value)) {
5705 css_clear = apr_pstrdup(doc->pool, "left");
5711 if (attr_align || css_clear ) {
5727 return android->out;
5732 * It is a handler who processes the H2 tag.
5734 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
5735 * destination is specified.
5736 * @param node [i] The H1 tag node is specified.
5737 * @return The conversion result is returned.
5740 s_android_end_h2_tag(void *pdoc, Node *UNUSED(child))
5746 android = GET_ANDROID(pdoc);
5751 if (IS_CSS_ON(android->entryp)) {
5752 chxj_css_pop_prop_list(android->css_prop_stack);
5754 return android->out;
5759 * It is a handler who processes the H3 tag.
5761 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
5762 * destination is specified.
5763 * @param node [i] The H1 tag node is specified.
5764 * @return The conversion result is returned.
5767 s_android_start_h3_tag(void *pdoc, Node *node)
5773 char *attr_style = NULL;
5774 char *attr_align = NULL;
5775 char *css_clear = NULL;
5777 android = GET_ANDROID(pdoc);
5781 for (attr = qs_get_attr(doc,node);
5783 attr = qs_get_next_attr(doc,attr)) {
5784 char *name = qs_get_attr_name(doc,attr);
5785 char *value = qs_get_attr_value(doc,attr);
5786 if (STRCASEEQ('a','A',"align", name)) {
5787 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5791 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5795 if (IS_CSS_ON(android->entryp)) {
5796 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
5798 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5799 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5800 css_property_t *cur;
5801 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5802 if (STRCASEEQ('l','L',"left", cur->value)) {
5803 attr_align = apr_pstrdup(doc->pool, "left");
5805 else if (STRCASEEQ('c','C',"center",cur->value)) {
5806 attr_align = apr_pstrdup(doc->pool, "center");
5808 else if (STRCASEEQ('r','R',"right",cur->value)) {
5809 attr_align = apr_pstrdup(doc->pool, "right");
5812 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5813 if (STRCASEEQ('b','B',"both", cur->value)) {
5814 css_clear = apr_pstrdup(doc->pool, "both");
5816 else if (STRCASEEQ('r','R',"right", cur->value)) {
5817 css_clear = apr_pstrdup(doc->pool, "right");
5819 else if (STRCASEEQ('l','L',"left", cur->value)) {
5820 css_clear = apr_pstrdup(doc->pool, "left");
5826 if (attr_align || css_clear ) {
5842 return android->out;
5847 * It is a handler who processes the H3 tag.
5849 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
5850 * destination is specified.
5851 * @param node [i] The H1 tag node is specified.
5852 * @return The conversion result is returned.
5855 s_android_end_h3_tag(void *pdoc, Node *UNUSED(child))
5861 android = GET_ANDROID(pdoc);
5866 if (IS_CSS_ON(android->entryp)) {
5867 chxj_css_pop_prop_list(android->css_prop_stack);
5869 return android->out;
5874 * It is a handler who processes the H4 tag.
5876 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
5877 * destination is specified.
5878 * @param node [i] The H1 tag node is specified.
5879 * @return The conversion result is returned.
5882 s_android_start_h4_tag(void *pdoc, Node *node)
5888 char *attr_style = NULL;
5889 char *attr_align = NULL;
5890 char *css_clear = NULL;
5892 android = GET_ANDROID(pdoc);
5896 for (attr = qs_get_attr(doc,node);
5898 attr = qs_get_next_attr(doc,attr)) {
5899 char *name = qs_get_attr_name(doc,attr);
5900 char *value = qs_get_attr_value(doc,attr);
5901 if (STRCASEEQ('a','A',"align", name)) {
5902 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
5906 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
5910 if (IS_CSS_ON(android->entryp)) {
5911 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
5913 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
5914 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
5915 css_property_t *cur;
5916 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
5917 if (STRCASEEQ('l','L',"left", cur->value)) {
5918 attr_align = apr_pstrdup(doc->pool, "left");
5920 else if (STRCASEEQ('c','C',"center",cur->value)) {
5921 attr_align = apr_pstrdup(doc->pool, "center");
5923 else if (STRCASEEQ('r','R',"right",cur->value)) {
5924 attr_align = apr_pstrdup(doc->pool, "right");
5927 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
5928 if (STRCASEEQ('b','B',"both", cur->value)) {
5929 css_clear = apr_pstrdup(doc->pool, "both");
5931 else if (STRCASEEQ('r','R',"right", cur->value)) {
5932 css_clear = apr_pstrdup(doc->pool, "right");
5934 else if (STRCASEEQ('l','L',"left", cur->value)) {
5935 css_clear = apr_pstrdup(doc->pool, "left");
5941 if (attr_align || css_clear ) {
5957 return android->out;
5962 * It is a handler who processes the H4 tag.
5964 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
5965 * destination is specified.
5966 * @param node [i] The H1 tag node is specified.
5967 * @return The conversion result is returned.
5970 s_android_end_h4_tag(void *pdoc, Node *UNUSED(child))
5976 android = GET_ANDROID(pdoc);
5981 if (IS_CSS_ON(android->entryp)) {
5982 chxj_css_pop_prop_list(android->css_prop_stack);
5985 return android->out;
5990 * It is a handler who processes the H5 tag.
5992 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
5993 * destination is specified.
5994 * @param node [i] The H1 tag node is specified.
5995 * @return The conversion result is returned.
5998 s_android_start_h5_tag(void *pdoc, Node *node)
6004 char *attr_style = NULL;
6005 char *attr_align = NULL;
6006 char *css_clear = NULL;
6008 android = GET_ANDROID(pdoc);
6012 for (attr = qs_get_attr(doc,node);
6014 attr = qs_get_next_attr(doc,attr)) {
6015 char *name = qs_get_attr_name(doc,attr);
6016 char *value = qs_get_attr_value(doc,attr);
6017 if (STRCASEEQ('a','A',"align", name)) {
6018 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
6022 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
6026 if (IS_CSS_ON(android->entryp)) {
6027 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
6029 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
6030 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
6031 css_property_t *cur;
6032 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
6033 if (STRCASEEQ('l','L',"left", cur->value)) {
6034 attr_align = apr_pstrdup(doc->pool, "left");
6036 else if (STRCASEEQ('c','C',"center",cur->value)) {
6037 attr_align = apr_pstrdup(doc->pool, "center");
6039 else if (STRCASEEQ('r','R',"right",cur->value)) {
6040 attr_align = apr_pstrdup(doc->pool, "right");
6043 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
6044 if (STRCASEEQ('b','B',"both", cur->value)) {
6045 css_clear = apr_pstrdup(doc->pool, "both");
6047 else if (STRCASEEQ('r','R',"right", cur->value)) {
6048 css_clear = apr_pstrdup(doc->pool, "right");
6050 else if (STRCASEEQ('l','L',"left", cur->value)) {
6051 css_clear = apr_pstrdup(doc->pool, "left");
6057 if (attr_align || css_clear ) {
6073 return android->out;
6078 * It is a handler who processes the H5 tag.
6080 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
6081 * destination is specified.
6082 * @param node [i] The H1 tag node is specified.
6083 * @return The conversion result is returned.
6086 s_android_end_h5_tag(void *pdoc, Node *UNUSED(child))
6092 android = GET_ANDROID(pdoc);
6097 if (IS_CSS_ON(android->entryp)) {
6098 chxj_css_pop_prop_list(android->css_prop_stack);
6101 return android->out;
6106 * It is a handler who processes the H6 tag.
6108 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
6109 * destination is specified.
6110 * @param node [i] The H1 tag node is specified.
6111 * @return The conversion result is returned.
6114 s_android_start_h6_tag(void *pdoc, Node *node)
6120 char *attr_style = NULL;
6121 char *attr_align = NULL;
6122 char *css_clear = NULL;
6124 android = GET_ANDROID(pdoc);
6128 for (attr = qs_get_attr(doc,node);
6130 attr = qs_get_next_attr(doc,attr)) {
6131 char *name = qs_get_attr_name(doc,attr);
6132 char *value = qs_get_attr_value(doc,attr);
6133 if (STRCASEEQ('a','A',"align", name)) {
6134 if (value && (STRCASEEQ('l','L',"left",value) || STRCASEEQ('r','R',"right",value) || STRCASEEQ('c','C',"center",value))) {
6138 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
6142 if (IS_CSS_ON(android->entryp)) {
6143 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
6145 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "text-align");
6146 css_property_t *clear_prop = chxj_css_get_property_value(doc, style, "clear");
6147 css_property_t *cur;
6148 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
6149 if (STRCASEEQ('l','L',"left", cur->value)) {
6150 attr_align = apr_pstrdup(doc->pool, "left");
6152 else if (STRCASEEQ('c','C',"center",cur->value)) {
6153 attr_align = apr_pstrdup(doc->pool, "center");
6155 else if (STRCASEEQ('r','R',"right",cur->value)) {
6156 attr_align = apr_pstrdup(doc->pool, "right");
6159 for (cur = clear_prop->next; cur != clear_prop; cur = cur->next) {
6160 if (STRCASEEQ('b','B',"both", cur->value)) {
6161 css_clear = apr_pstrdup(doc->pool, "both");
6163 else if (STRCASEEQ('r','R',"right", cur->value)) {
6164 css_clear = apr_pstrdup(doc->pool, "right");
6166 else if (STRCASEEQ('l','L',"left", cur->value)) {
6167 css_clear = apr_pstrdup(doc->pool, "left");
6173 if (attr_align || css_clear ) {
6189 return android->out;
6194 * It is a handler who processes the H6 tag.
6196 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
6197 * destination is specified.
6198 * @param node [i] The H1 tag node is specified.
6199 * @return The conversion result is returned.
6202 s_android_end_h6_tag(void *pdoc, Node *UNUSED(child))
6208 android = GET_ANDROID(pdoc);
6213 if (IS_CSS_ON(android->entryp)) {
6214 chxj_css_pop_prop_list(android->css_prop_stack);
6217 return android->out;
6222 * It is a handler who processes the MENU tag.
6224 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
6225 * destination is specified.
6226 * @param node [i] The MENU tag node is specified.
6227 * @return The conversion result is returned.
6230 s_android_start_menu_tag(void *pdoc, Node *node)
6232 android_t *android = GET_ANDROID(pdoc);
6233 Doc *doc = android->doc;
6235 char *attr_style = NULL;
6236 char *attr_color = NULL;
6237 char *attr_type = NULL;
6238 char *attr_size = NULL;
6239 for (attr = qs_get_attr(doc,node);
6241 attr = qs_get_next_attr(doc,attr)) {
6242 char *name = qs_get_attr_name(doc,attr);
6243 char *value = qs_get_attr_value(doc,attr);
6244 if (STRCASEEQ('t','T',"type",name)) {
6245 if (value && (STRCASEEQ('d','D',"disc",value) || STRCASEEQ('c','C',"circle",value) || STRCASEEQ('s','S',"square",value))) {
6249 else if (STRCASEEQ('s','S',"style", name) && value && *value) {
6253 if (IS_CSS_ON(android->entryp)) {
6254 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
6256 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6257 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6258 css_property_t *list_style_type_prop = chxj_css_get_property_value(doc, style, "list-style-type");
6259 css_property_t *cur;
6260 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6261 if (cur->value && *cur->value) {
6262 attr_color = apr_pstrdup(doc->pool, cur->value);
6265 for (cur = list_style_type_prop->next; cur != list_style_type_prop; cur = cur->next) {
6266 if (cur->value && *cur->value) {
6267 attr_type = apr_pstrdup(doc->pool, cur->value);
6270 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6271 if (cur->value && *cur->value) {
6272 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
6273 attr_size = apr_pstrdup(doc->pool, cur->value);
6275 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
6276 attr_size = apr_pstrdup(doc->pool, cur->value);
6278 else if (STRCASEEQ('s','S',"small",cur->value)) {
6279 attr_size = apr_pstrdup(doc->pool, cur->value);
6281 else if (STRCASEEQ('m','M',"medium",cur->value)) {
6282 attr_size = apr_pstrdup(doc->pool, cur->value);
6284 else if (STRCASEEQ('l','L',"large",cur->value)) {
6285 attr_size = apr_pstrdup(doc->pool, cur->value);
6287 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
6288 attr_size = apr_pstrdup(doc->pool, cur->value);
6290 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
6291 attr_size = apr_pstrdup(doc->pool, cur->value);
6298 if (attr_type || attr_color || attr_size) {
6301 W_L("list-style-type:");
6306 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6319 return android->out;
6324 * It is a handler who processes the MENU tag.
6326 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
6327 * destination is specified.
6328 * @param node [i] The MENU tag node is specified.
6329 * @return The conversion result is returned.
6332 s_android_end_menu_tag(void *pdoc, Node *UNUSED(child))
6334 android_t *android = GET_ANDROID(pdoc);
6335 Doc *doc = android->doc;
6337 if (IS_CSS_ON(android->entryp)) {
6338 chxj_css_pop_prop_list(android->css_prop_stack);
6340 return android->out;
6345 * It is a handler who processes the PLAINTEXT tag.
6347 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
6348 * destination is specified.
6349 * @param node [i] The PLAINTEXT tag node is specified.
6350 * @return The conversion result is returned.
6353 s_android_start_plaintext_tag(void *pdoc, Node *node)
6358 android = GET_ANDROID(pdoc);
6361 s_android_start_plaintext_tag_inner(pdoc,node);
6362 return android->out;
6366 s_android_start_plaintext_tag_inner(void *pdoc, Node *node)
6371 android = GET_ANDROID(pdoc);
6373 for (child = qs_get_child_node(doc, node);
6375 child = qs_get_next_node(doc, child)) {
6377 s_android_start_plaintext_tag_inner(pdoc, child);
6379 return android->out;
6384 * It is a handler who processes the PLAINTEXT tag.
6386 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
6387 * destination is specified.
6388 * @param node [i] The PLAINTEXT tag node is specified.
6389 * @return The conversion result is returned.
6392 s_android_end_plaintext_tag(void *pdoc, Node *UNUSED(child))
6394 android_t *android = GET_ANDROID(pdoc);
6395 return android->out;
6400 * It is a handler who processes the BLINK tag.
6402 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
6403 * destination is specified.
6404 * @param node [i] The BLINK tag node is specified.
6405 * @return The conversion result is returned.
6408 s_android_start_blink_tag(void *pdoc, Node *node)
6410 android_t *android = GET_ANDROID(pdoc);
6411 Doc *doc = android->doc;
6413 char *attr_style = NULL;
6414 char *attr_color = NULL;
6415 char *attr_size = NULL;
6416 for (attr = qs_get_attr(doc,node);
6418 attr = qs_get_next_attr(doc,attr)) {
6419 char *name = qs_get_attr_name(doc,attr);
6420 char *value = qs_get_attr_value(doc,attr);
6421 if (STRCASEEQ('s','S',"style", name) && value && *value) {
6425 if (IS_CSS_ON(android->entryp)) {
6426 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
6428 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6429 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6430 css_property_t *cur;
6431 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6432 if (cur->value && *cur->value) {
6433 attr_color = apr_pstrdup(doc->pool, cur->value);
6436 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6437 if (cur->value && *cur->value) {
6438 if (STRCASEEQ('x','X',"xx-small",cur->value)) {
6439 attr_size = apr_pstrdup(doc->pool, cur->value);
6441 else if (STRCASEEQ('x','X',"x-small",cur->value)) {
6442 attr_size = apr_pstrdup(doc->pool, cur->value);
6444 else if (STRCASEEQ('s','S',"small",cur->value)) {
6445 attr_size = apr_pstrdup(doc->pool, cur->value);
6447 else if (STRCASEEQ('m','M',"medium",cur->value)) {
6448 attr_size = apr_pstrdup(doc->pool, cur->value);
6450 else if (STRCASEEQ('l','L',"large",cur->value)) {
6451 attr_size = apr_pstrdup(doc->pool, cur->value);
6453 else if (STRCASEEQ('x','X',"x-large",cur->value)) {
6454 attr_size = apr_pstrdup(doc->pool, cur->value);
6456 else if (STRCASEEQ('x','X',"xx-large",cur->value)) {
6457 attr_size = apr_pstrdup(doc->pool, cur->value);
6467 if (android->blink_keyframe_out == 0) {
6468 android->style_data = apr_pstrcat(doc->pool, (android->style_data) ? android->style_data : "",
6471 android->blink_keyframe_out = 1;
6474 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6487 return android->out;
6492 * It is a handler who processes the BLINK tag.
6494 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
6495 * destination is specified.
6496 * @param node [i] The BLINK tag node is specified.
6497 * @return The conversion result is returned.
6500 s_android_end_blink_tag(void *pdoc, Node *UNUSED(child))
6502 android_t *android = GET_ANDROID(pdoc);
6503 Doc *doc = android->doc;
6505 if (IS_CSS_ON(android->entryp)) {
6506 chxj_css_pop_prop_list(android->css_prop_stack);
6508 return android->out;
6513 * It is a handler who processes the MARQUEE tag.
6515 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
6516 * destination is specified.
6517 * @param node [i] The MARQUEE tag node is specified.
6518 * @return The conversion result is returned.
6521 s_android_start_marquee_tag(void *pdoc, Node *node)
6523 android_t *android = GET_ANDROID(pdoc);
6524 Doc *doc = android->doc;
6526 char *attr_style = NULL;
6527 char *attr_color = NULL;
6528 char *attr_size = NULL;
6529 char *attr_wap_marquee_loop = NULL;
6530 char *attr_wap_marquee_style = NULL;
6531 char *attr_wap_marquee_dir = NULL;
6532 char *attr_wap_marquee_speed = NULL;
6533 char *attr_bgcolor = NULL;
6534 /*--------------------------------------------------------------------------*/
6535 /* Get Attributes */
6536 /*--------------------------------------------------------------------------*/
6537 for (attr = qs_get_attr(doc,node);
6539 attr = qs_get_next_attr(doc,attr)) {
6540 char *name = qs_get_attr_name(doc,attr);
6541 char *value = qs_get_attr_value(doc,attr);
6542 if (STRCASEEQ('d','D',"direction", name)) {
6544 if (STRCASEEQ('l','L',"left",value)) {
6545 attr_wap_marquee_dir = "rtl";
6547 else if (STRCASEEQ('r','R',"right",value)) {
6548 attr_wap_marquee_dir = "ltr";
6552 else if (STRCASEEQ('b','B',"behavior",name)) {
6553 if (value && *value) {
6554 attr_wap_marquee_style = value;
6557 else if (STRCASEEQ('l','L',"loop",name)) {
6558 if (value && *value) {
6559 if(strcmp(value,"0") == 0 || strcmp(value,"-1") == 0){
6560 attr_wap_marquee_loop = "infinite";
6563 attr_wap_marquee_loop = value;
6567 else if (STRCASEEQ('b','B',"bgcolor",name)) {
6568 if (value && *value) {
6569 attr_bgcolor = value;
6572 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
6576 if (IS_CSS_ON(android->entryp)) {
6577 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
6579 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6580 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6581 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
6582 css_property_t *wap_marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
6583 css_property_t *wap_marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
6584 css_property_t *wap_marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
6585 css_property_t *wap_marquee_speed_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-speed");
6586 css_property_t *cur;
6587 if (!attr_wap_marquee_style) {
6588 for (cur = wap_marquee_style_prop->next; cur != wap_marquee_style_prop; cur = cur->next) {
6589 if (STRCASEEQ('s','S',"scroll", cur->value) || STRCASEEQ('s','S',"slide",cur->value) || STRCASEEQ('a','A',"alternate",cur->value)) {
6590 attr_wap_marquee_style = apr_pstrdup(doc->pool, cur->value);
6594 if (!attr_wap_marquee_dir) {
6595 for (cur = wap_marquee_dir_prop->next; cur != wap_marquee_dir_prop; cur = cur->next) {
6596 if (STRCASEEQ('l','L',"ltr",cur->value)) {
6597 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
6599 else if (STRCASEEQ('r','R',"rtl",cur->value)) {
6600 attr_wap_marquee_dir = apr_pstrdup(doc->pool, cur->value);
6604 if (!attr_wap_marquee_loop) {
6605 for (cur = wap_marquee_loop_prop->next; cur != wap_marquee_loop_prop; cur = cur->next) {
6606 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
6607 attr_wap_marquee_loop = "infinite";
6610 attr_wap_marquee_loop = apr_pstrdup(doc->pool, cur->value);
6614 if (!attr_wap_marquee_speed) {
6615 for (cur = wap_marquee_speed_prop->next; cur != wap_marquee_speed_prop; cur = cur->next) {
6616 attr_wap_marquee_speed = apr_pstrdup(doc->pool, cur->value);
6619 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6620 if (cur->value && *cur->value) {
6621 attr_color = apr_pstrdup(doc->pool, cur->value);
6624 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
6625 if (cur->value && *cur->value) {
6626 attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
6629 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6630 if (cur->value && *cur->value) {
6631 if ( STRCASEEQ('x','X',"xx-small",cur->value)
6632 || STRCASEEQ('x','X',"x-small", cur->value)
6633 || STRCASEEQ('s','S',"small", cur->value)
6634 || STRCASEEQ('m','M',"medium", cur->value)
6635 || STRCASEEQ('l','L',"large", cur->value)
6636 || STRCASEEQ('x','X',"x-large", cur->value)
6637 || STRCASEEQ('x','X',"xx-large",cur->value)) {
6638 attr_size = apr_pstrdup(doc->pool, cur->value);
6645 W_L("<div style=\"");
6646 W_L("overflow:-webkit-marquee;");
6647 if (attr_wap_marquee_dir) {
6648 W_L("-webkit-marquee-direction:");
6649 if (STRCASEEQ('r','R',"rtl",attr_wap_marquee_dir)) {
6652 else if (STRCASEEQ('l','L',"ltr",attr_wap_marquee_dir)) {
6657 if (attr_wap_marquee_style) {
6658 W_L("-webkit-marquee-style:");
6659 W_V(attr_wap_marquee_style);
6662 if (attr_wap_marquee_loop) {
6663 W_L("-webkit-marquee-repetition:");
6664 W_V(attr_wap_marquee_loop);
6667 if (attr_wap_marquee_speed) {
6668 W_L("-webkit-marquee-speed:");
6669 W_V(attr_wap_marquee_speed);
6673 attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
6674 W_L("background-color:");
6679 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
6692 return android->out;
6697 * It is a handler who processes the MARQUEE tag.
6699 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
6700 * destination is specified.
6701 * @param node [i] The MARQUEE tag node is specified.
6702 * @return The conversion result is returned.
6705 s_android_end_marquee_tag(void *pdoc, Node *UNUSED(node))
6707 android_t *android = GET_ANDROID(pdoc);
6708 Doc *doc = android->doc;
6710 if (IS_CSS_ON(android->entryp)) {
6711 chxj_css_pop_prop_list(android->css_prop_stack);
6713 return android->out;
6718 * It is handler who processes the New Line Code.
6721 s_android_newline_mark(void *pdoc, Node *UNUSED(node))
6723 android_t *android = GET_ANDROID(pdoc);
6724 if (android->start_html_flag) {
6725 Doc *doc = android->doc;
6728 return android->out;
6733 * It is a handler who processes the LINK tag.
6735 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
6736 * destination is specified.
6737 * @param node [i] The LINK tag node is specified.
6738 * @return The conversion result is returned.
6741 s_android_link_tag(void *pdoc, Node *node)
6750 android = GET_ANDROID(pdoc);
6753 if (! IS_CSS_ON(android->entryp)) {
6754 return android->out;
6757 for (attr = qs_get_attr(doc,node);
6759 attr = qs_get_next_attr(doc,attr)) {
6760 char *name = qs_get_attr_name(doc,attr);
6761 char *value = qs_get_attr_value(doc,attr);
6762 if (STRCASEEQ('r','R',"rel", name)) {
6763 if (value && *value && STRCASEEQ('s','S',"stylesheet", value)) {
6767 else if (STRCASEEQ('h','H',"href", name)) {
6768 if (value && *value) {
6772 else if (STRCASEEQ('t','T',"type", name)) {
6773 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
6779 if (rel && href && type) {
6780 DBG(doc->r,"REQ[%X] start load CSS. url:[%s]", TO_ADDR(doc->r),href);
6781 android->style = chxj_css_parse_from_uri(doc->r, doc->pool, android->style, href);
6782 DBG(doc->r,"REQ[%X] end load CSS. url:[%s]", TO_ADDR(doc->r),href);
6785 return android->out;
6789 static css_prop_list_t *
6790 s_android_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
6792 android_t *android = GET_ANDROID(pdoc);
6793 Doc *doc = android->doc;
6794 css_prop_list_t *last_css = NULL;
6795 if (IS_CSS_ON(android->entryp)) {
6796 css_prop_list_t *dup_css;
6797 css_selector_t *selector;
6799 last_css = chxj_css_get_last_prop_list(android->css_prop_stack);
6800 dup_css = chxj_dup_css_prop_list(doc, last_css);
6801 selector = chxj_css_find_selector(doc, android->style, node);
6803 chxj_css_prop_list_merge_property(doc, dup_css, selector);
6805 chxj_css_push_prop_list(android->css_prop_stack, dup_css);
6806 last_css = chxj_css_get_last_prop_list(android->css_prop_stack);
6808 if (style_attr_value) {
6809 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));
6811 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
6819 static css_prop_list_t *
6820 s_android_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value)
6822 android_t *android = GET_ANDROID(pdoc);
6823 Doc *doc = android->doc;
6824 css_prop_list_t *last_css = NULL;
6825 if (IS_CSS_ON(android->entryp)) {
6826 css_prop_list_t *dup_css;
6827 css_selector_t *selector;
6829 last_css = chxj_css_get_last_prop_list(android->css_prop_stack);
6830 dup_css = chxj_dup_css_prop_list(doc, last_css);
6831 selector = chxj_css_find_selector(doc, android->style, node);
6833 chxj_css_prop_list_merge_property(doc, dup_css, selector);
6837 if (style_attr_value) {
6838 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));
6840 chxj_css_prop_list_merge_property(doc, last_css, ssheet->selector_head.next);
6849 * It is a handler who processes the SPAN tag.
6851 * @param pdoc [i/o] The pointer to the JHTML structure at the output
6852 * destination is specified.
6853 * @param node [i] The SPAN tag node is specified.
6854 * @return The conversion result is returned.
6857 s_android_start_span_tag(void *pdoc, Node *node)
6862 char *attr_style = NULL;
6863 char *attr_color = NULL;
6864 char *attr_size = NULL;
6865 char *attr_align = NULL;
6866 char *attr_blink = NULL;
6867 char *attr_marquee = NULL;
6868 char *attr_marquee_dir = NULL;
6869 char *attr_marquee_style = NULL;
6870 char *attr_marquee_loop = NULL;
6871 char *attr_marquee_speed = NULL;
6872 char *css_bgcolor = NULL;
6874 android = GET_ANDROID(pdoc);
6877 for (attr = qs_get_attr(doc,node);
6879 attr = qs_get_next_attr(doc,attr)) {
6880 char *nm = qs_get_attr_name(doc,attr);
6881 char *val = qs_get_attr_value(doc,attr);
6882 if (val && STRCASEEQ('s','S',"style", nm)) {
6886 if (IS_CSS_ON(android->entryp)) {
6887 css_prop_list_t *style = s_android_nopush_and_get_now_style(pdoc, node, attr_style);
6889 css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
6890 css_property_t *size_prop = chxj_css_get_property_value(doc, style, "font-size");
6891 css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
6892 css_property_t *decoration_prop = chxj_css_get_property_value(doc, style, "text-decoration");
6893 css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
6894 css_property_t *marquee_dir_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-dir");
6895 css_property_t *marquee_style_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-style");
6896 css_property_t *marquee_loop_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-loop");
6897 css_property_t *marquee_speed_prop = chxj_css_get_property_value(doc, style, "-wap-marquee-speed");
6898 css_property_t *bgcolor_prop = chxj_css_get_property_value(doc, style, "background-color");
6900 css_property_t *cur;
6901 for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
6902 attr_color = apr_pstrdup(doc->pool, cur->value);
6904 for (cur = size_prop->next; cur != size_prop; cur = cur->next) {
6905 if (cur->value && *cur->value) {
6906 if ( STRCASEEQ('x','X',"xx-small",cur->value)
6907 || STRCASEEQ('x','X',"x-small", cur->value)
6908 || STRCASEEQ('s','S',"small", cur->value)
6909 || STRCASEEQ('m','M',"medium", cur->value)
6910 || STRCASEEQ('l','L',"large", cur->value)
6911 || STRCASEEQ('x','X',"x-large", cur->value)
6912 || STRCASEEQ('x','X',"xx-large",cur->value)) {
6913 attr_size = apr_pstrdup(doc->pool, cur->value);
6917 for (cur = decoration_prop->next; cur != decoration_prop; cur = cur->next) {
6918 if (cur->value && STRCASEEQ('b','B',"blink",cur->value)) {
6919 attr_blink = apr_pstrdup(doc->pool, cur->value);
6922 for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
6923 if (cur->value && strcasecmp("-wap-marquee",cur->value) == 0) {
6924 attr_marquee = apr_pstrdup(doc->pool, cur->value);
6927 for (cur = marquee_dir_prop->next; cur != marquee_dir_prop; cur = cur->next) {
6928 if (cur->value && *cur->value) {
6929 if ( STRCASEEQ('l','L',"ltr",cur->value)
6930 || STRCASEEQ('r','R',"rtl",cur->value)) {
6931 attr_marquee_dir = apr_pstrdup(doc->pool, cur->value);
6935 for (cur = marquee_style_prop->next; cur != marquee_style_prop; cur = cur->next) {
6936 if (cur->value && *cur->value) {
6937 if ( STRCASEEQ('s','S',"scroll",cur->value)
6938 || STRCASEEQ('s','S',"slide",cur->value)
6939 || STRCASEEQ('a','A',"alternate",cur->value)) {
6940 attr_marquee_style = apr_pstrdup(doc->pool, cur->value);
6944 for (cur = marquee_loop_prop->next; cur != marquee_loop_prop; cur = cur->next) {
6945 if (cur->value && *cur->value) {
6946 if(strcmp(cur->value,"0") == 0 || strcmp(cur->value,"-1") == 0){
6947 attr_marquee_loop = "infinite";
6950 attr_marquee_loop = apr_pstrdup(doc->pool, cur->value);
6954 for (cur = marquee_speed_prop->next; cur != marquee_speed_prop; cur = cur->next) {
6955 if (cur->value && *cur->value) {
6956 attr_marquee_speed = apr_pstrdup(doc->pool, cur->value);
6959 for (cur = text_align_prop->next; cur != text_align_prop; cur = cur->next) {
6960 if (STRCASEEQ('l','L',"left", cur->value)) {
6961 attr_align = apr_pstrdup(doc->pool, "left");
6963 else if (STRCASEEQ('c','C',"center",cur->value)) {
6964 attr_align = apr_pstrdup(doc->pool, "center");
6966 else if (STRCASEEQ('r','R',"right",cur->value)) {
6967 attr_align = apr_pstrdup(doc->pool, "right");
6970 for (cur = bgcolor_prop->next; cur != bgcolor_prop; cur = cur->next) {
6971 if (cur->value && *cur->value) {
6972 css_bgcolor = apr_pstrdup(doc->pool, cur->value);
6981 W_L("overflow:-webkit-marquee;");
6982 if (attr_marquee_style) {
6983 W_L("-webkit-marquee-style:");
6984 W_V(attr_marquee_style);
6987 if (attr_marquee_dir) {
6988 W_L("-webkit-marquee-direction:");
6989 if (STRCASEEQ('r','R',"rtl",attr_marquee_dir)) {
6992 else if (STRCASEEQ('l','L',"ltr",attr_marquee_dir)) {
6997 if (attr_marquee_loop) {
6998 W_L("-webkit-marquee-repetition:");
6999 W_V(attr_marquee_loop);
7002 if (attr_marquee_speed) {
7003 W_L("-webkit-marquee-speed:");
7004 W_V(attr_marquee_speed);
7011 if (attr_color || attr_size || attr_align || attr_blink || attr_marquee || css_bgcolor) {
7014 attr_color = chxj_css_rgb_func_to_value(doc->pool, attr_color);
7031 if (android->blink_keyframe_out == 0) {
7032 android->style_data = apr_pstrcat(doc->pool, (android->style_data) ? android->style_data : "",
7035 android->blink_keyframe_out = 1;
7039 W_L("background-color:");
7046 return android->out;
7051 * It is a handler who processes the SPAN tag.
7053 * @param pdoc [i/o] The pointer to the JHTML structure at the output
7054 * destination is specified.
7055 * @param node [i] The SPAN tag node is specified.
7056 * @return The conversion result is returned.
7059 s_android_end_span_tag(void *pdoc, Node *UNUSED(node))
7061 android_t *android = GET_ANDROID(pdoc);
7062 Doc *doc = android->doc;
7066 if (IS_CSS_ON(android->entryp)) {
7067 chxj_css_pop_prop_list(android->css_prop_stack);
7069 return android->out;
7074 * It is a handler who processes the STYLE tag.
7076 * @param pdoc [i/o] The pointer to the XHTML structure at the output
7077 * destination is specified.
7078 * @param node [i] The STYLE tag node is specified.
7079 * @return The conversion result is returned.
7082 s_android_style_tag(void *pdoc, Node *node)
7091 android = GET_ANDROID(pdoc);
7094 if (! IS_CSS_ON(android->entryp)) {
7095 return android->out;
7098 for (attr = qs_get_attr(doc,node);
7100 attr = qs_get_next_attr(doc,attr)) {
7101 char *name = qs_get_attr_name(doc,attr);
7102 char *value = qs_get_attr_value(doc,attr);
7103 if (STRCASEEQ('t','T',"type", name)) {
7104 if (value && *value && STRCASEEQ('t','T',"text/css",value)) {
7111 for (child = qs_get_child_node(doc, node);
7113 child = qs_get_next_node(doc, child)) {
7114 char *name = qs_get_node_name(doc, child);
7115 if (STRCASEEQ('t','T',"text", name)) {
7116 char *value = qs_get_node_value(doc, child);
7117 if (value && *value) {
7118 style = apr_pstrcat(doc->r->pool, style, value, NULL);
7122 if (strlen(style) > 0) {
7123 DBG(doc->r,"REQ[%X] start load CSS. buf:[%s]", TO_ADDR(doc->r),style);
7124 android->style = chxj_css_parse_style_value(doc, android->style, style);
7125 DBG(doc->r,"REQ[%X] end load CSS. value:[%s]", TO_ADDR(doc->r),style);
7128 return android->out;
7133 s_android_create_style_data(apr_pool_t *pool, const char *style_data)
7138 return apr_pstrcat(pool, "<style type=\"text/css\"><![CDATA[",style_data, "]]></style>", NULL);
7142 * It is a handler who processes the OBJECT tag.
7144 * @param pdoc [i/o] The pointer to the JHTML structure at the output
7145 * destination is specified.
7146 * @param node [i] The OBJECT tag node is specified.
7147 * @return The conversion result is returned.
7150 s_android_start_object_tag(void *pdoc, Node *node)
7152 android_t *android = GET_ANDROID(pdoc);
7153 Doc *doc = android->doc;
7156 char *attr_id = NULL;
7157 char *attr_width = NULL;
7158 char *attr_height = NULL;
7159 char *attr_data = NULL;
7160 char *attr_type = NULL;
7161 char *attr_declare = NULL;
7162 char *attr_classid = NULL;
7163 char *attr_codebase = NULL;
7165 /*--------------------------------------------------------------------------*/
7166 /* Get Attributes */
7167 /*--------------------------------------------------------------------------*/
7168 for (attr = qs_get_attr(doc,node);
7170 attr = qs_get_next_attr(doc,attr)) {
7171 char *name = qs_get_attr_name(doc,attr);
7172 char *value = qs_get_attr_value(doc,attr);
7173 if (STRCASEEQ('i','I',"id",name)) {
7174 attr_id = apr_pstrdup(doc->pool, value);
7176 else if (STRCASEEQ('w','W',"width",name)) {
7177 attr_width = apr_pstrdup(doc->pool, value);
7179 else if (STRCASEEQ('h','H',"height",name)) {
7180 attr_height = apr_pstrdup(doc->pool, value);
7182 else if (STRCASEEQ('d','D',"data",name)) {
7183 attr_data = apr_pstrdup(doc->pool, value);
7185 else if (STRCASEEQ('t','T',"type",name)) {
7186 attr_type = apr_pstrdup(doc->pool, value);
7188 else if (STRCASEEQ('d','D',"declare",name)) {
7189 attr_declare = apr_pstrdup(doc->pool, value);
7191 else if (STRCASEEQ('c','C',"classid",name)) {
7192 attr_classid = apr_pstrdup(doc->pool, value);
7194 else if (STRCASEEQ('c','C',"codebase",name)) {
7195 attr_codebase = apr_pstrdup(doc->pool, value);
7227 W_L(" declare=\"declare\"");
7235 W_L(" codebase=\"");
7241 return android->out;
7244 * It is a handler who processes the OBJECT tag.
7246 * @param pdoc [i/o] The pointer to the JHTML structure at the output
7247 * destination is specified.
7248 * @param node [i] The OBJECT tag node is specified.
7249 * @return The conversion result is returned.
7252 s_android_end_object_tag(void *pdoc, Node *UNUSED(node))
7254 android_t *android = GET_ANDROID(pdoc);
7255 Doc *doc = android->doc;
7258 return android->out;
7261 * It is a handler who processes the OBJECT tag.
7263 * @param pdoc [i/o] The pointer to the JHTML structure at the output
7264 * destination is specified.
7265 * @param node [i] The OBJECT tag node is specified.
7266 * @return The conversion result is returned.
7269 s_android_start_param_tag(void *pdoc, Node *node)
7271 android_t *android = GET_ANDROID(pdoc);
7272 Doc *doc = android->doc;
7275 char *attr_name = NULL;
7276 char *attr_value = NULL;
7277 char *attr_valuetype = NULL;
7279 /*--------------------------------------------------------------------------*/
7280 /* Get Attributes */
7281 /*--------------------------------------------------------------------------*/
7282 for (attr = qs_get_attr(doc,node);
7284 attr = qs_get_next_attr(doc,attr)) {
7285 char *name = qs_get_attr_name(doc,attr);
7286 char *value = qs_get_attr_value(doc,attr);
7287 if (STRCASEEQ('n','N',"name",name)) {
7288 attr_name = apr_pstrdup(doc->pool, value);
7290 else if (STRCASEEQ('v','V',"value",name)) {
7291 attr_value = apr_pstrdup(doc->pool, value);
7293 else if (STRCASEEQ('v','V',"valuetype",name)) {
7294 attr_valuetype = apr_pstrdup(doc->pool, value);
7310 W_L(" valuetype=\"");
7311 W_V(attr_valuetype);
7315 return android->out;
7318 * It is a handler who processes the CAPTION tag.
7320 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
7321 * destination is specified.
7322 * @param node [i] The CAPTION tag node is specified.
7323 * @return The conversion result is returned.
7326 s_android_start_caption_tag(void *pdoc, Node *node)
7332 char *attr_style = NULL;
7333 char *attr_align = NULL;
7335 android = GET_ANDROID(pdoc);
7339 for (attr = qs_get_attr(doc,node);
7341 attr = qs_get_next_attr(doc,attr)) {
7342 char *name = qs_get_attr_name(doc,attr);
7343 char *value = qs_get_attr_value(doc,attr);
7344 if (STRCASEEQ('a','A',"align", name)) {
7346 (STRCASEEQ('l','L',"left",value)
7347 || STRCASEEQ('r','R',"right",value)
7348 || STRCASEEQ('t','T',"top",value)
7349 || STRCASEEQ('b','B',"bottom",value)
7354 else if (STRCASEEQ('s','S',"style",name) && value && *value) {
7367 return android->out;
7372 * It is a handler who processes the CAPTION tag.
7374 * @param pdoc [i/o] The pointer to the ANDROID structure at the output
7375 * destination is specified.
7376 * @param node [i] The CAPTION tag node is specified.
7377 * @return The conversion result is returned.
7380 s_android_end_caption_tag(void *pdoc, Node *UNUSED(child))
7382 android_t* android = GET_ANDROID(pdoc);
7383 Doc* doc = android->doc;
7387 return android->out;