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