|
|
|
@ -106,6 +106,7 @@ import java.util.Arrays;
|
|
|
|
|
import java.util.Collections;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.LinkedHashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Locale;
|
|
|
|
|
import java.util.Map;
|
|
|
|
@ -548,15 +549,22 @@ public class HtmlHelper {
|
|
|
|
|
if (!TextUtils.isEmpty(style)) {
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
|
|
|
|
|
Map<String, String> kv = new LinkedHashMap<>();
|
|
|
|
|
String[] params = style.split(";");
|
|
|
|
|
for (String param : params) {
|
|
|
|
|
int colon = param.indexOf(':');
|
|
|
|
|
if (colon > 0) {
|
|
|
|
|
if (colon <= 0)
|
|
|
|
|
continue;
|
|
|
|
|
String key = param.substring(0, colon).trim().toLowerCase(Locale.ROOT);
|
|
|
|
|
String value = param.substring(colon + 1).toLowerCase(Locale.ROOT)
|
|
|
|
|
.replace("!important", "")
|
|
|
|
|
.trim()
|
|
|
|
|
.replaceAll("\\s+", " ");
|
|
|
|
|
kv.put(key, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (String key : kv.keySet()) {
|
|
|
|
|
String value = kv.get(key);
|
|
|
|
|
switch (key) {
|
|
|
|
|
case "color":
|
|
|
|
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/color
|
|
|
|
@ -674,10 +682,13 @@ public class HtmlHelper {
|
|
|
|
|
if (element.parent() != null && !display_hidden) {
|
|
|
|
|
Float s = getFontSize(value, 1.0f);
|
|
|
|
|
if (s != null && s == 0) {
|
|
|
|
|
if (!"table".equals(element.tagName()) ||
|
|
|
|
|
!"fixed".endsWith(kv.get("table-layout"))) {
|
|
|
|
|
Log.i("Removing no height/width " + element.tagName());
|
|
|
|
|
element.remove();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "margin":
|
|
|
|
@ -732,7 +743,6 @@ public class HtmlHelper {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sb.length() == 0)
|
|
|
|
|
element.removeAttr("style");
|
|
|
|
|