|
|
|
@ -45,4 +45,44 @@ public class BackgroundUtil {
|
|
|
|
|
} |
|
|
|
|
return backgroundRules; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 将块元素的背景属性转换成mp |
|
|
|
|
* |
|
|
|
|
* @param props |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
public static Map<String, String> parseBgAttr4BlockTag(ChainedProperties props) { |
|
|
|
|
Map<String, String> backgroundRules = new HashMap<String, String>(); |
|
|
|
|
String value = props.getPropertyFromChain("div", "bgcolor"); |
|
|
|
|
if (value != null) { |
|
|
|
|
backgroundRules.put("background-color", value); |
|
|
|
|
} |
|
|
|
|
value = props.getPropertyFromChain("div", "background-size"); |
|
|
|
|
if (value != null) { |
|
|
|
|
backgroundRules.put("background-size", value); |
|
|
|
|
} |
|
|
|
|
value = props.getPropertyFromChain("div", "background"); |
|
|
|
|
if (value != null) { |
|
|
|
|
Map<String, String> backgroundStyles = CSSUtils.processBackground(value); |
|
|
|
|
backgroundRules.putAll(backgroundStyles); |
|
|
|
|
} |
|
|
|
|
value = props.getPropertyFromChain("div", "background-color"); |
|
|
|
|
if (value != null) { |
|
|
|
|
backgroundRules.put("background-color", value); |
|
|
|
|
} |
|
|
|
|
value = props.getPropertyFromChain("div", "background-position"); |
|
|
|
|
if (value != null) { |
|
|
|
|
backgroundRules.put("background-position", value); |
|
|
|
|
} |
|
|
|
|
value = props.getPropertyFromChain("div", "background-repeat"); |
|
|
|
|
if (value != null) { |
|
|
|
|
backgroundRules.put("background-repeat", value); |
|
|
|
|
} |
|
|
|
|
value = props.getPropertyFromChain("div", "background-image"); |
|
|
|
|
if (value != null) { |
|
|
|
|
backgroundRules.put("background-image", value); |
|
|
|
|
} |
|
|
|
|
return backgroundRules; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|