char *attr_wap_marquee_dir = NULL;
char *attr_wap_marquee_loop = NULL;
char *attr_color = NULL;
+ char *attr_bgcolor = NULL;
char *attr_font_size = NULL;
for (attr = qs_get_attr(doc,node);
css_property_t *color_prop = chxj_css_get_property_value(doc, style, "color");
css_property_t *text_align_prop = chxj_css_get_property_value(doc, style, "text-align");
css_property_t *font_size_prop = chxj_css_get_property_value(doc, style, "font-size");
+ css_property_t *background_color_prop = chxj_css_get_property_value(doc, style, "background-color");
+ css_property_t *background_prop = chxj_css_get_property_value(doc, style, "background");
css_property_t *cur;
for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
attr_decoration = apr_pstrdup(doc->pool, cur->value);
}
}
+ for (cur = background_color_prop->next; cur != background_color_prop; cur = cur->next) {
+ attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
+ attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
+ }
+ for (cur = background_prop->next; cur != background_prop; cur = cur->next) {
+ char *ss = strchr(cur->value, '#');
+ if (ss) {
+ attr_bgcolor = apr_pstrdup(doc->pool, cur->value);
+ attr_bgcolor = chxj_css_rgb_func_to_value(doc->pool, attr_bgcolor);
+ }
+ }
for (cur = color_prop->next; cur != color_prop; cur = cur->next) {
attr_color = apr_pstrdup(doc->pool, cur->value);
}
}
}
W_L("<div");
- if (attr_align || attr_display || attr_decoration || attr_wap_marquee_style || attr_wap_marquee_dir || attr_wap_marquee_loop || attr_color || attr_font_size) {
+ if (attr_align
+ || attr_display
+ || attr_decoration
+ || attr_wap_marquee_style
+ || attr_wap_marquee_dir
+ || attr_wap_marquee_loop
+ || attr_color
+ || attr_bgcolor
+ || attr_font_size) {
W_L(" style=\"");
if (attr_align) {
W_L("text-align:");
W_V(attr_color);
W_L(";");
}
+ if (attr_bgcolor) {
+ W_L("background-color:");
+ W_V(attr_bgcolor);
+ W_L(";");
+ }
if (attr_font_size) {
W_L("font-size:");
W_V(attr_font_size);
#include "chxj_apache.c"
#include "chxj_dbm.c"
#include "chxj_str_util.c"
+#include "chxj_dump_string.c"
#include <iconv.h>
#include "chxj_serf.h"
#include "chxj_css.h"
void test_xhtml_div_tag_with_css_040();
void test_xhtml_div_tag_with_css_041();
void test_xhtml_div_tag_with_css_042();
+void test_xhtml_div_tag_with_css_043();
+void test_xhtml_div_tag_with_css_044();
void test_xhtml_dt_tag_with_css_001();
void test_xhtml_dt_tag_with_css_002();
CU_add_test(xhtml_suite, "test div with css 040", test_xhtml_div_tag_with_css_040);
CU_add_test(xhtml_suite, "test div with css 041", test_xhtml_div_tag_with_css_041);
CU_add_test(xhtml_suite, "test div with css 042", test_xhtml_div_tag_with_css_042);
+ CU_add_test(xhtml_suite, "test div with css 043", test_xhtml_div_tag_with_css_043);
+ CU_add_test(xhtml_suite, "test div with css 044", test_xhtml_div_tag_with_css_044);
CU_add_test(xhtml_suite, "test dt with css 001", test_xhtml_dt_tag_with_css_001);
CU_add_test(xhtml_suite, "test dt with css 002", test_xhtml_dt_tag_with_css_002);
}
void test_xhtml_form_tag_006()
{
-#define TEST_STRING "<form action></form>"
-#define RESULT_STRING "<form action=\"\"><input type=\"hidden\" name=\"_chxj_cc\" value=\"test_cookie_id\"></form>"
+#define TEST_STRING "<html><form action></form></html>"
+#define RESULT_STRING "<?xml version=\"1.0\" encoding=\"Windows-31J\"?>" \
+ "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML Basic 1.0//EN\" \"http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd\">" \
+ "<html xmlns=\"http://www.w3.org/1999/xhtml\">" \
+ "<form action=\"\"></form></html>"
char *ret;
char *tmp;
device_table spec;
void test_xhtml_form_tag_009()
{
#define TEST_STRING "<form method=\"post\" action=\"hogehoge\"></form>"
-#define RESULT_STRING "<form action=\"hogehoge\" method=\"post\"><input type=\"hidden\" name=\"_chxj_cc\" value=\"test_cookie_id\"></form>"
+#define RESULT_STRING "<form action=\"hogehoge\" method=\"post\"></form>"
char *ret;
char *tmp;
device_table spec;
#undef RESULT_STRING
}
+char *test_chxj_serf_get141(request_rec *r, apr_pool_t *ppool, const char *uri_path, int ss, apr_size_t *len)
+{
+ static char *css = "a:focus { display: none }\n"
+ "a:link { display: none }\n"
+ "a { display: none }\n"
+ "hr { display: none }\n"
+ "a:visited { display:none }\n"
+ "div { background:#ffffff; }\n";
+
+ *len = strlen(css);
+ call_check = 1;
+ return css;
+}
+void test_xhtml_div_tag_with_css_043()
+{
+#define TEST_STRING "<html><head><link rel=\"stylesheet\" href=\"http://localhost/a.css\" type=\"text/css\" />" \
+ "</head><body><div>あいう</div></body></html>"
+#define RESULT_STRING "<?xml version=\"1.0\" encoding=\"Windows-31J\"?>" \
+ "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML Basic 1.0//EN\" \"http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd\">" \
+ "<html xmlns=\"http://www.w3.org/1999/xhtml\">" \
+ "<head></head><body><div style=\"background-color:#ffffff;\">あいう</div></body></html>"
+ char *ret;
+ char *tmp;
+ device_table spec;
+ chxjconvrule_entry entry;
+ cookie_t cookie;
+ apr_size_t destlen;
+ APR_INIT;
+ chxj_serf_get = test_chxj_serf_get141;
+ call_check = 0;
+
+ COOKIE_INIT(cookie);
+
+ SPEC_INIT(spec);
+ destlen = sizeof(TEST_STRING)-1;
+ entry.action |= CONVRULE_CSS_ON_BIT;
+
+ tmp = chxj_encoding(&r, TEST_STRING, &destlen);
+ ret = chxj_convert_xhtml_mobile_1_0(&r, &spec, tmp, destlen, &destlen, &entry, &cookie);
+ ret = chxj_rencoding(&r, ret, &destlen);
+ fprintf(stderr, "actual:[%s]\n", ret);
+ fprintf(stderr, "expect:[%s]\n", RESULT_STRING);
+ CU_ASSERT(ret != NULL);
+ CU_ASSERT(strcmp(RESULT_STRING, ret) == 0);
+ CU_ASSERT(destlen == sizeof(RESULT_STRING)-1);
+ CU_ASSERT(call_check == 1);
+
+ APR_TERM;
+#undef TEST_STRING
+#undef RESULT_STRING
+}
+void test_xhtml_div_tag_with_css_044()
+{
+#define TEST_STRING "<html><head>" \
+ "</head><body><div style=\"background:#ffffff;\">あいう</div></body></html>"
+#define RESULT_STRING "<?xml version=\"1.0\" encoding=\"Windows-31J\"?>" \
+ "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML Basic 1.0//EN\" \"http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd\">" \
+ "<html xmlns=\"http://www.w3.org/1999/xhtml\">" \
+ "<head></head><body><div style=\"background-color:#ffffff;\">あいう</div></body></html>"
+ char *ret;
+ char *tmp;
+ device_table spec;
+ chxjconvrule_entry entry;
+ cookie_t cookie;
+ apr_size_t destlen;
+ APR_INIT;
+ chxj_serf_get = test_chxj_serf_get141;
+ call_check = 0;
+
+ COOKIE_INIT(cookie);
+
+ SPEC_INIT(spec);
+ destlen = sizeof(TEST_STRING)-1;
+ entry.action |= CONVRULE_CSS_ON_BIT;
+
+ tmp = chxj_encoding(&r, TEST_STRING, &destlen);
+ ret = chxj_convert_xhtml_mobile_1_0(&r, &spec, tmp, destlen, &destlen, &entry, &cookie);
+ ret = chxj_rencoding(&r, ret, &destlen);
+ fprintf(stderr, "actual:[%s]\n", ret);
+ fprintf(stderr, "expect:[%s]\n", RESULT_STRING);
+ CU_ASSERT(ret != NULL);
+ CU_ASSERT(strcmp(RESULT_STRING, ret) == 0);
+ CU_ASSERT(destlen == sizeof(RESULT_STRING)-1);
+ CU_ASSERT(call_check == 0);
+
+ APR_TERM;
+#undef TEST_STRING
+#undef RESULT_STRING
+}
/*===========================================================================*/
/* dt tag with CSS */