char *attr_style = NULL;
char *attr_hspace = NULL;
char *attr_vspace = NULL;
+
+ char *css_float = NULL;
+ char *css_margin_left = NULL;
+ char *css_margin_right = NULL;
+ char *css_margin_top = NULL;
+ char *css_margin_bottom = NULL;
+ char *css_display = NULL;
+ char *css_valign = NULL;
+
#ifndef IMG_NOT_CONVERT_FILENAME
device_table *spec = ixhtml10->spec;
#endif
css_property_t *margin_right_prop = chxj_css_get_property_value(doc, style, "margin-right");
css_property_t *margin_top_prop = chxj_css_get_property_value(doc, style, "margin-top");
css_property_t *margin_bottom_prop = chxj_css_get_property_value(doc, style, "margin-bottom");
+
+
css_property_t *cur;
for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
attr_height = apr_pstrdup(doc->pool, cur->value);
attr_width = apr_pstrdup(doc->pool, cur->value);
}
for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
- attr_align = apr_pstrdup(doc->pool, cur->value);
- }
- for (cur = margin_left_prop->next; cur != margin_left_prop; cur = cur->next) {
- attr_hspace = apr_pstrdup(doc->pool, cur->value);
+ css_valign = apr_pstrdup(doc->pool, cur->value);
}
+
if (! attr_hspace) {
+ for (cur = margin_left_prop->next; cur != margin_left_prop; cur = cur->next) {
+ css_margin_left = apr_pstrdup(doc->pool, cur->value);
+ }
for (cur = margin_right_prop->next; cur != margin_right_prop; cur = cur->next) {
- attr_hspace = apr_pstrdup(doc->pool, cur->value);
+ css_margin_right = apr_pstrdup(doc->pool, cur->value);
}
}
- for (cur = margin_top_prop->next; cur != margin_top_prop; cur = cur->next) {
- attr_vspace = apr_pstrdup(doc->pool, cur->value);
- }
+
if (! attr_vspace) {
+ for (cur = margin_top_prop->next; cur != margin_top_prop; cur = cur->next) {
+ css_margin_top = apr_pstrdup(doc->pool, cur->value);
+ }
for (cur = margin_bottom_prop->next; cur != margin_bottom_prop; cur = cur->next) {
- attr_vspace = apr_pstrdup(doc->pool, cur->value);
+ css_margin_bottom = apr_pstrdup(doc->pool, cur->value);
+ }
+ }
+
+ css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
+ for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
+ css_float = apr_pstrdup(doc->pool, cur->value);
+ }
+ css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
+ for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
+ char *tmp = apr_pstrdup(doc->pool, cur->value);
+ char *tmpp = strstr(tmp, "none");
+ if(tmpp){
+ css_display = apr_pstrdup(doc->pool, tmp);
}
}
}
}
+
+ if(!css_display){
W_L("<img");
if (attr_src) {
W_V(attr_src);
W_L("\"");
}
- if (attr_align || attr_hspace || attr_vspace) {
+ if (attr_align || attr_hspace || attr_vspace || css_float || css_margin_left || css_margin_right || css_margin_top || css_margin_bottom || css_valign ) {
W_L(" style=\"");
if (attr_align) {
if (STRCASEEQ('t','T',"top", attr_align)) {
+ css_valign = NULL;
W_L("vertical-align:top;");
}
else if (STRCASEEQ('m','M',"middle", attr_align) || STRCASEEQ('c','C',"center",attr_align)) {
+ css_valign = NULL;
W_L("vertical-align:middle;");
}
else if (STRCASEEQ('b','B',"bottom", attr_align)) {
+ css_valign = NULL;
W_L("vertical-align:bottom;");
}
else if (STRCASEEQ('l','L',"left", attr_align)) {
+ css_float = NULL;
W_L("float:left;");
}
else if (STRCASEEQ('r','R',"right", attr_align)) {
+ css_float = NULL;
W_L("float:right;");
}
+ }
+
+
+ if(css_float){
+ W_L("float:");
+ W_V(css_float);
+ W_L(";");
}
+ if(css_valign){
+ W_L("vertical-align:");
+ W_V(css_valign);
+ W_L(";");
+ }
+
if (attr_hspace) {
W_L("margin-left:");
W_V(attr_hspace);
W_V(attr_hspace);
W_L(";");
}
+ else{
+ if(css_margin_left){
+ W_L("margin-left:");
+ W_V(css_margin_left);
+ W_L(";");
+ }
+ if(css_margin_right){
+ W_L("margin-right:");
+ W_V(css_margin_right);
+ W_L(";");
+ }
+ }
if (attr_vspace) {
W_L("margin-top:");
W_V(attr_vspace);
W_V(attr_vspace);
W_L(";");
}
+ else{
+ if(css_margin_top){
+ W_L("margin-top:");
+ W_V(css_margin_top);
+ W_L(";");
+ }
+ if(css_margin_bottom){
+ W_L("margin-bottom:");
+ W_V(css_margin_bottom);
+ W_L(";");
+ }
+ }
W_L("\"");
}
if (attr_width) {
W_L(" alt=\"\"");
}
W_L(" />");
+ }
return ixhtml10->out;
}
char *attr_align = NULL;
char *attr_alt = NULL;
char *attr_style = NULL;
+ char *attr_hspace = NULL;
+ char *attr_vspace = NULL;
+
+ char *css_float = NULL;
+ char *css_margin_left = NULL;
+ char *css_margin_right = NULL;
+ char *css_margin_top = NULL;
+ char *css_margin_bottom = NULL;
+ char *css_display = NULL;
+ char *css_valign = NULL;
+
#ifndef IMG_NOT_CONVERT_FILENAME
device_table *spec = jxhtml->spec;
#endif
if (value) {
if (STRCASEEQ('t','T',"top", value) ||
STRCASEEQ('m','M',"middle",value) ||
- STRCASEEQ('b','B',"bottom",value) ||
- STRCASEEQ('l','L',"left", value) ||
- STRCASEEQ('r','R',"right", value)) {
- attr_align = value;
+ STRCASEEQ('b','B',"bottom",value)){
+ css_valign = value;
+ }else if (STRCASEEQ('l','L',"left", value) || STRCASEEQ('r','R',"right", value)) {
+ css_float = value;
}
else if (STRCASEEQ('c','C',"center",value)) {
- attr_align = apr_pstrdup(doc->pool, "middle");
+ css_valign = apr_pstrdup(doc->pool, "middle");
}
}
}
/*----------------------------------------------------------------------*/
/* CHTML 1.0 */
/*----------------------------------------------------------------------*/
- /* ignore */
+ attr_hspace = value;
}
else if (STRCASEEQ('v','V',"vspace",name)) {
/*----------------------------------------------------------------------*/
/* CHTML 1.0 */
/*----------------------------------------------------------------------*/
- /* ignore */
+ attr_vspace = value;
}
else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
/*----------------------------------------------------------------------*/
css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
+ css_property_t *margin_left_prop = chxj_css_get_property_value(doc, style, "margin-left");
+ css_property_t *margin_right_prop = chxj_css_get_property_value(doc, style, "margin-right");
+ css_property_t *margin_top_prop = chxj_css_get_property_value(doc, style, "margin-top");
+ css_property_t *margin_bottom_prop = chxj_css_get_property_value(doc, style, "margin-bottom");
+
+
css_property_t *cur;
for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
attr_height = apr_pstrdup(doc->pool, cur->value);
for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
attr_width = apr_pstrdup(doc->pool, cur->value);
}
- for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
- attr_align = apr_pstrdup(doc->pool, cur->value);
+ if(!css_valign){
+ for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
+ css_valign = apr_pstrdup(doc->pool, cur->value);
+ }
+ }
+ if (! attr_hspace) {
+ for (cur = margin_left_prop->next; cur != margin_left_prop; cur = cur->next) {
+ css_margin_left = apr_pstrdup(doc->pool, cur->value);
+ }
+ for (cur = margin_right_prop->next; cur != margin_right_prop; cur = cur->next) {
+ css_margin_right = apr_pstrdup(doc->pool, cur->value);
+ }
+ }
+ if (! attr_vspace) {
+ for (cur = margin_top_prop->next; cur != margin_top_prop; cur = cur->next) {
+ css_margin_top = apr_pstrdup(doc->pool, cur->value);
+ }
+ for (cur = margin_bottom_prop->next; cur != margin_bottom_prop; cur = cur->next) {
+ css_margin_bottom = apr_pstrdup(doc->pool, cur->value);
+ }
+ }
+ if(!css_float){
+ css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
+ for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
+ css_float = apr_pstrdup(doc->pool, cur->value);
+ }
+ }
+
+ css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
+ for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
+ char *tmp = apr_pstrdup(doc->pool, cur->value);
+ char *tmpp = strstr(tmp, "none");
+ if(tmpp){
+ css_display = apr_pstrdup(doc->pool, tmp);
+ }
}
}
}
W_V(attr_src);
W_L("\"");
}
- if (attr_align) {
- W_L(" align=\"");
- W_V(attr_align);
+ if (attr_hspace || attr_vspace || css_float || css_margin_left || css_margin_right || css_margin_top || css_margin_bottom || css_valign || css_display) {
+ W_L(" style=\"");
+ if(css_float){
+ W_L("float:");
+ W_V(css_float);
+ W_L(";");
+ }
+ if(css_valign){
+ W_L("vertical-align:");
+ W_V(css_valign);
+ W_L(";");
+ }
+ if (attr_hspace) {
+ W_L("margin-left:");
+ W_V(attr_hspace);
+ W_L(";");
+ W_L("margin-right:");
+ W_V(attr_hspace);
+ W_L(";");
+ }
+ else{
+ if(css_margin_left){
+ W_L("margin-left:");
+ W_V(css_margin_left);
+ W_L(";");
+ }
+ if(css_margin_right){
+ W_L("margin-right:");
+ W_V(css_margin_right);
+ W_L(";");
+ }
+ }
+ if (attr_vspace) {
+ W_L("margin-top:");
+ W_V(attr_vspace);
+ W_L(";");
+ W_L("margin-bottom:");
+ W_V(attr_vspace);
+ W_L(";");
+ }
+ else{
+ if(css_margin_top){
+ W_L("margin-top:");
+ W_V(css_margin_top);
+ W_L(";");
+ }
+ if(css_margin_bottom){
+ W_L("margin-bottom:");
+ W_V(css_margin_bottom);
+ W_L(";");
+ }
+ }
+ if(css_display){
+ W_L("display:none;");
+ }
W_L("\"");
}
+
if (attr_width) {
W_L(" width=\"");
W_V(attr_width);
char *attr_style = NULL;
char *attr_hspace = NULL;
char *attr_vspace = NULL;
+
+ char *css_margin_left = NULL;
+ char *css_margin_right = NULL;
+ char *css_margin_top = NULL;
+ char *css_margin_bottom = NULL;
+ char *css_display = NULL;
+ char *css_valign = NULL;
+
#ifndef IMG_NOT_CONVERT_FILENAME
device_table *spec = xhtml->spec;
if (value) {
if (STRCASEEQ('t','T',"top", value) ||
STRCASEEQ('m','M',"middle",value) ||
- STRCASEEQ('b','B',"bottom",value) ||
- STRCASEEQ('l','L',"left", value) ||
- STRCASEEQ('r','R',"right", value)) {
+ STRCASEEQ('b','B',"bottom",value)) {
+ css_valign = value;
+ }
+ else if( STRCASEEQ('l','L',"left", value) ||
+ STRCASEEQ('r','R',"right", value)) {
attr_align = value;
}
else if (STRCASEEQ('c','C',"center", value)) {
- attr_align = apr_pstrdup(doc->pool, "middle");
+ css_valign = apr_pstrdup(doc->pool, "middle");
}
}
}
css_property_t *height_prop = chxj_css_get_property_value(doc, style, "height");
css_property_t *width_prop = chxj_css_get_property_value(doc, style, "width");
css_property_t *valign_prop = chxj_css_get_property_value(doc, style, "vertical-align");
+ css_property_t *margin_left_prop = chxj_css_get_property_value(doc, style, "margin-left");
+ css_property_t *margin_right_prop = chxj_css_get_property_value(doc, style, "margin-right");
+ css_property_t *margin_top_prop = chxj_css_get_property_value(doc, style, "margin-top");
+ css_property_t *margin_bottom_prop = chxj_css_get_property_value(doc, style, "margin-bottom");
+
css_property_t *cur;
for (cur = height_prop->next; cur != height_prop; cur = cur->next) {
attr_height = apr_pstrdup(doc->pool, cur->value);
for (cur = width_prop->next; cur != width_prop; cur = cur->next) {
attr_width = apr_pstrdup(doc->pool, cur->value);
}
- for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
- attr_align = apr_pstrdup(doc->pool, cur->value);
+ if(!css_valign){
+ for (cur = valign_prop->next; cur != valign_prop; cur = cur->next) {
+ css_valign = apr_pstrdup(doc->pool, cur->value);
+ }
+ }
+
+ if (! attr_hspace) {
+ for (cur = margin_left_prop->next; cur != margin_left_prop; cur = cur->next) {
+ css_margin_left = apr_pstrdup(doc->pool, cur->value);
+ }
+ for (cur = margin_right_prop->next; cur != margin_right_prop; cur = cur->next) {
+ css_margin_right = apr_pstrdup(doc->pool, cur->value);
+ }
+ }
+
+ if (! attr_vspace) {
+ for (cur = margin_top_prop->next; cur != margin_top_prop; cur = cur->next) {
+ css_margin_top = apr_pstrdup(doc->pool, cur->value);
+ }
+ for (cur = margin_bottom_prop->next; cur != margin_bottom_prop; cur = cur->next) {
+ css_margin_bottom = apr_pstrdup(doc->pool, cur->value);
+ }
+ }
+
+ // float:[left|right] -> align
+ if(!attr_align){
+ css_property_t *float_prop = chxj_css_get_property_value(doc, style, "float");
+ for (cur = float_prop->next; cur != float_prop; cur = cur->next) {
+ attr_align = apr_pstrdup(doc->pool, cur->value);
+ }
+ }
+ css_property_t *display_prop = chxj_css_get_property_value(doc, style, "display");
+ for (cur = display_prop->next; cur != display_prop; cur = cur->next) {
+ char *tmp = apr_pstrdup(doc->pool, cur->value);
+ char *tmpp = strstr(tmp, "none");
+ if(tmpp){
+ css_display = apr_pstrdup(doc->pool, tmp);
+ }
}
}
}
W_V(attr_height);
W_L("\"");
}
- if (attr_hspace) {
- W_L(" hspace=\"");
- W_V(attr_hspace);
- W_L("\"");
- }
- if (attr_vspace) {
- W_L(" vspace=\"");
- W_V(attr_vspace);
+ if (attr_hspace || attr_vspace || css_margin_left || css_margin_right || css_margin_top || css_margin_bottom || css_valign || css_display) {
+ W_L(" style=\"");
+ if(css_valign){
+ W_L("vertical-align:");
+ W_V(css_valign);
+ W_L(";");
+ }
+ if (attr_hspace) {
+ W_L("margin-left:");
+ W_V(attr_hspace);
+ W_L(";");
+ W_L("margin-right:");
+ W_V(attr_hspace);
+ W_L(";");
+ }
+ else{
+ if(css_margin_left){
+ W_L("margin-left:");
+ W_V(css_margin_left);
+ W_L(";");
+ }
+ if(css_margin_right){
+ W_L("margin-right:");
+ W_V(css_margin_right);
+ W_L(";");
+ }
+ }
+ if (attr_vspace) {
+ W_L("margin-top:");
+ W_V(attr_vspace);
+ W_L(";");
+ W_L("margin-bottom:");
+ W_V(attr_vspace);
+ W_L(";");
+ }
+ else{
+ if(css_margin_top){
+ W_L("margin-top:");
+ W_V(css_margin_top);
+ W_L(";");
+ }
+ if(css_margin_bottom){
+ W_L("margin-bottom:");
+ W_V(css_margin_bottom);
+ W_L(";");
+ }
+ }
+ if(css_display){
+ W_L("display:none;");
+ }
W_L("\"");
}
if (attr_alt) {