|
|
@ -314,8 +314,6 @@ public class HtmlHelper {
|
|
|
|
boolean display_hidden = prefs.getBoolean("display_hidden", false);
|
|
|
|
boolean display_hidden = prefs.getBoolean("display_hidden", false);
|
|
|
|
boolean disable_tracking = prefs.getBoolean("disable_tracking", true);
|
|
|
|
boolean disable_tracking = prefs.getBoolean("disable_tracking", true);
|
|
|
|
boolean parse_classes = prefs.getBoolean("parse_classes", false);
|
|
|
|
boolean parse_classes = prefs.getBoolean("parse_classes", false);
|
|
|
|
boolean experiments = prefs.getBoolean("experiments", false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// https://chromium.googlesource.com/chromium/blink/+/master/Source/core/css/html.css
|
|
|
|
// https://chromium.googlesource.com/chromium/blink/+/master/Source/core/css/html.css
|
|
|
|
|
|
|
|
|
|
|
@ -754,13 +752,13 @@ public class HtmlHelper {
|
|
|
|
// Subscript/Superscript
|
|
|
|
// Subscript/Superscript
|
|
|
|
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sub
|
|
|
|
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sub
|
|
|
|
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sup
|
|
|
|
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sup
|
|
|
|
if (!experiments || !view)
|
|
|
|
if (!view)
|
|
|
|
for (Element subp : document.select("sub,sup"))
|
|
|
|
for (Element subp : document.select("sub,sup"))
|
|
|
|
subp.tagName("small");
|
|
|
|
subp.tagName("small");
|
|
|
|
|
|
|
|
|
|
|
|
// Lists
|
|
|
|
// Lists
|
|
|
|
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/li
|
|
|
|
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/li
|
|
|
|
if (!experiments || !view) {
|
|
|
|
if (!view) {
|
|
|
|
for (Element li : document.select("li")) {
|
|
|
|
for (Element li : document.select("li")) {
|
|
|
|
li.tagName("span");
|
|
|
|
li.tagName("span");
|
|
|
|
Element parent = li.parent();
|
|
|
|
Element parent = li.parent();
|
|
|
@ -1779,14 +1777,12 @@ public class HtmlHelper {
|
|
|
|
|
|
|
|
|
|
|
|
static Spanned fromDocument(Context context, @NonNull Document document, @Nullable Html.ImageGetter imageGetter, @Nullable Html.TagHandler tagHandler) {
|
|
|
|
static Spanned fromDocument(Context context, @NonNull Document document, @Nullable Html.ImageGetter imageGetter, @Nullable Html.TagHandler tagHandler) {
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
|
|
boolean experiments = prefs.getBoolean("experiments", false);
|
|
|
|
|
|
|
|
boolean debug = prefs.getBoolean("debug", false);
|
|
|
|
boolean debug = prefs.getBoolean("debug", false);
|
|
|
|
int colorAccent = Helper.resolveColor(context, R.attr.colorAccent);
|
|
|
|
int colorAccent = Helper.resolveColor(context, R.attr.colorAccent);
|
|
|
|
int dp3 = Helper.dp2pixels(context, 3);
|
|
|
|
int dp3 = Helper.dp2pixels(context, 3);
|
|
|
|
int dp6 = Helper.dp2pixels(context, 6);
|
|
|
|
int dp6 = Helper.dp2pixels(context, 6);
|
|
|
|
int dp24 = Helper.dp2pixels(context, 24);
|
|
|
|
int dp24 = Helper.dp2pixels(context, 24);
|
|
|
|
|
|
|
|
|
|
|
|
if (experiments) {
|
|
|
|
|
|
|
|
// https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements
|
|
|
|
// https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements
|
|
|
|
NodeTraversor.traverse(new NodeVisitor() {
|
|
|
|
NodeTraversor.traverse(new NodeVisitor() {
|
|
|
|
private int pre = 0;
|
|
|
|
private int pre = 0;
|
|
|
@ -2066,8 +2062,6 @@ public class HtmlHelper {
|
|
|
|
ssb.insert(i, "|");
|
|
|
|
ssb.insert(i, "|");
|
|
|
|
|
|
|
|
|
|
|
|
return reverseSpans(ssb);
|
|
|
|
return reverseSpans(ssb);
|
|
|
|
} else
|
|
|
|
|
|
|
|
return fromHtml(document.html(), imageGetter, null);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static Spanned fromHtml(@NonNull String html) {
|
|
|
|
static Spanned fromHtml(@NonNull String html) {
|
|
|
|