|
|
@ -1795,7 +1795,7 @@ public class HtmlHelper {
|
|
|
|
if (tag == null
|
|
|
|
if (tag == null
|
|
|
|
? eselector.getLocalName() == null
|
|
|
|
? eselector.getLocalName() == null
|
|
|
|
: tag.equalsIgnoreCase(eselector.getLocalName()))
|
|
|
|
: tag.equalsIgnoreCase(eselector.getLocalName()))
|
|
|
|
style = mergeStyles(style, srule.getStyle().getCssText());
|
|
|
|
style = mergeStyles(style, srule.getStyle().getCssText(), false);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case Selector.SAC_CONDITIONAL_SELECTOR:
|
|
|
|
case Selector.SAC_CONDITIONAL_SELECTOR:
|
|
|
|
if (!TextUtils.isEmpty(clazz)) {
|
|
|
|
if (!TextUtils.isEmpty(clazz)) {
|
|
|
@ -1805,7 +1805,7 @@ public class HtmlHelper {
|
|
|
|
String value = ccondition.getValue();
|
|
|
|
String value = ccondition.getValue();
|
|
|
|
for (String cls : clazz.split("\\s+"))
|
|
|
|
for (String cls : clazz.split("\\s+"))
|
|
|
|
if (cls.equalsIgnoreCase(value)) {
|
|
|
|
if (cls.equalsIgnoreCase(value)) {
|
|
|
|
style = mergeStyles(style, srule.getStyle().getCssText());
|
|
|
|
style = mergeStyles(style, srule.getStyle().getCssText(), false);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1842,6 +1842,10 @@ public class HtmlHelper {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static String mergeStyles(String base, String style) {
|
|
|
|
static String mergeStyles(String base, String style) {
|
|
|
|
|
|
|
|
return mergeStyles(base, style, true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static String mergeStyles(String base, String style, boolean element) {
|
|
|
|
Map<String, String> result = new HashMap<>();
|
|
|
|
Map<String, String> result = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
|
|
// Base style
|
|
|
|
// Base style
|
|
|
@ -1873,18 +1877,19 @@ public class HtmlHelper {
|
|
|
|
//https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Cascade_and_inheritance#controlling_inheritance
|
|
|
|
//https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Cascade_and_inheritance#controlling_inheritance
|
|
|
|
boolean initial = false; // no value
|
|
|
|
boolean initial = false; // no value
|
|
|
|
boolean inherit = false; // parent value
|
|
|
|
boolean inherit = false; // parent value
|
|
|
|
switch (value) {
|
|
|
|
if (element)
|
|
|
|
case "inherit":
|
|
|
|
switch (value) {
|
|
|
|
inherit = true;
|
|
|
|
case "inherit":
|
|
|
|
break;
|
|
|
|
inherit = true;
|
|
|
|
case "initial":
|
|
|
|
break;
|
|
|
|
initial = true;
|
|
|
|
case "initial":
|
|
|
|
break;
|
|
|
|
initial = true;
|
|
|
|
case "unset":
|
|
|
|
break;
|
|
|
|
case "revert":
|
|
|
|
case "unset":
|
|
|
|
inherit = !STYLE_NO_INHERIT.contains(key);
|
|
|
|
case "revert":
|
|
|
|
break;
|
|
|
|
inherit = !STYLE_NO_INHERIT.contains(key);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (initial || inherit)
|
|
|
|
if (initial || inherit)
|
|
|
|
Log.i("CSS " + value + "=" + key);
|
|
|
|
Log.i("CSS " + value + "=" + key);
|
|
|
@ -1900,7 +1905,8 @@ public class HtmlHelper {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (String key : baseParams.keySet())
|
|
|
|
for (String key : baseParams.keySet())
|
|
|
|
result.put(key, baseParams.get(key));
|
|
|
|
if (!STYLE_NO_INHERIT.contains(key) || element)
|
|
|
|
|
|
|
|
result.put(key, baseParams.get(key));
|
|
|
|
|
|
|
|
|
|
|
|
return TextUtils.join(";", result.values());
|
|
|
|
return TextUtils.join(";", result.values());
|
|
|
|
}
|
|
|
|
}
|
|
|
|