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;
ixhtml10 = GET_IXHTML10(pdoc);
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_display = 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 = text_decoration_prop->next; cur != text_decoration_prop; cur = cur->next) {
if (STRCASEEQ('b','B',"blink", cur->value)) {
attr_decoration = 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);
void test_ixhtml10_div_tag_with_css_040();
void test_ixhtml10_div_tag_with_css_041();
void test_ixhtml10_div_tag_with_css_042();
+void test_ixhtml10_div_tag_with_css_043();
+void test_ixhtml10_div_tag_with_css_044();
/* pend */
CU_add_test(ixhtml10_suite, "test div with css 040", test_ixhtml10_div_tag_with_css_040);
CU_add_test(ixhtml10_suite, "test div with css 041", test_ixhtml10_div_tag_with_css_041);
CU_add_test(ixhtml10_suite, "test div with css 042", test_ixhtml10_div_tag_with_css_042);
+ CU_add_test(ixhtml10_suite, "test div with css 043", test_ixhtml10_div_tag_with_css_043);
+ CU_add_test(ixhtml10_suite, "test div with css 044", test_ixhtml10_div_tag_with_css_044);
/* aend */
CU_basic_run_tests();
#undef TEST_STRING
#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_ixhtml10_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=\"Shift_JIS\" ?>" \
+ "<!DOCTYPE html PUBLIC \"-//i-mode group (ja)//DTD XHTML i-XHTML(Locale/Ver.=ja/1.0) 1.0//EN\" \"i-xhtml_4ja_10.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_ixhtml10(&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_ixhtml10_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=\"Shift_JIS\" ?>" \
+ "<!DOCTYPE html PUBLIC \"-//i-mode group (ja)//DTD XHTML i-XHTML(Locale/Ver.=ja/1.0) 1.0//EN\" \"i-xhtml_4ja_10.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_ixhtml10(&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
+}