Skip to content

Commit

Permalink
Merge remote-tracking branch 'torusrxxx/CSS' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
ArneBab committed Dec 15, 2024
2 parents bf3833e + 44d057b commit bb745b9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 24 deletions.
44 changes: 20 additions & 24 deletions src/freenet/client/filter/CSSTokenizerFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,10 @@ public static <T> T[] concat(T[] a, T[] b) {
allelementVerifiers.add("border-left-width");
allelementVerifiers.add("border-right-width");
allelementVerifiers.add("border-radius");
allelementVerifiers.add("border-top-radius");
allelementVerifiers.add("border-bottom-radius");
allelementVerifiers.add("border-left-radius");
allelementVerifiers.add("border-right-radius");
allelementVerifiers.add("border-bottom-left-radius");
allelementVerifiers.add("border-bottom-right-radius");
allelementVerifiers.add("border-top-left-radius");
allelementVerifiers.add("border-top-right-radius");
allelementVerifiers.add("border-image-source");
allelementVerifiers.add("border-image-slice");
allelementVerifiers.add("border-image-width");
Expand All @@ -184,6 +184,7 @@ public static <T> T[] concat(T[] a, T[] b) {
allelementVerifiers.add("break-before");
allelementVerifiers.add("break-after");
allelementVerifiers.add("break-inside");
allelementVerifiers.add("color-scheme");
allelementVerifiers.add("column-count");
allelementVerifiers.add("column-fill");
allelementVerifiers.add("column-gap");
Expand Down Expand Up @@ -249,6 +250,7 @@ public static <T> T[] concat(T[] a, T[] b) {
allelementVerifiers.add("margin-right");
allelementVerifiers.add("margin-top");
allelementVerifiers.add("margin");
allelementVerifiers.add("math-style");
allelementVerifiers.add("max-block-size");
allelementVerifiers.add("max-height");
allelementVerifiers.add("max-inline-size");
Expand Down Expand Up @@ -393,8 +395,6 @@ public static <T> T[] concat(T[] a, T[] b) {

// <background-clip> <background-origin>
auxilaryVerifiers[61]=new CSSPropertyVerifier(Arrays.asList("border-box", "padding-box", "content-box"),null,null,null,true);
// <border-radius>
auxilaryVerifiers[64]=new CSSPropertyVerifier(null,Arrays.asList("le", "pe"),null,null,true);

// <text-decoration-color>
auxilaryVerifiers[73]=new CSSPropertyVerifier(null, Arrays.asList("co"), null, null, true);
Expand Down Expand Up @@ -741,27 +741,12 @@ else if("border".equalsIgnoreCase(element))
else if("border-radius".equalsIgnoreCase(element))
{
auxilaryVerifiers[65]=new CSSPropertyVerifier(Arrays.asList("/"),null,null,null,true);
elementVerifiers.put(element,new CSSPropertyVerifier(null,ElementInfo.VISUALMEDIA,null,Arrays.asList("64<1,4>", "64<1,4> 65 64<1,4>")));
elementVerifiers.put(element,new CSSPropertyVerifier(null,ElementInfo.VISUALMEDIA,null,Arrays.asList("40<1,4>", "40<1,4> 65 40<1,4>")));
allelementVerifiers.remove(element);
}
else if("border-top-radius".equalsIgnoreCase(element))
else if("border-bottom-left-radius".equalsIgnoreCase(element) || "border-bottom-right-radius".equalsIgnoreCase(element) || "border-top-left-radius".equalsIgnoreCase(element) || "border-top-right-radius".equalsIgnoreCase(element))
{
elementVerifiers.put(element,new CSSPropertyVerifier(null,ElementInfo.VISUALMEDIA,null,Arrays.asList("64<1,2>")));
allelementVerifiers.remove(element);
}
else if("border-bottom-radius".equalsIgnoreCase(element))
{
elementVerifiers.put(element,new CSSPropertyVerifier(null,ElementInfo.VISUALMEDIA,null,Arrays.asList("64<1,2>")));
allelementVerifiers.remove(element);
}
else if("border-left-radius".equalsIgnoreCase(element))
{
elementVerifiers.put(element,new CSSPropertyVerifier(null,ElementInfo.VISUALMEDIA,null,Arrays.asList("64<1,2>")));
allelementVerifiers.remove(element);
}
else if("border-right-radius".equalsIgnoreCase(element))
{
elementVerifiers.put(element,new CSSPropertyVerifier(null,ElementInfo.VISUALMEDIA,null,Arrays.asList("64<1,2>")));
elementVerifiers.put(element,new CSSPropertyVerifier(null,ElementInfo.VISUALMEDIA,null,Arrays.asList("40<1,2>")));
allelementVerifiers.remove(element);
}
else if("border-image-source".equalsIgnoreCase(element))
Expand Down Expand Up @@ -854,6 +839,12 @@ else if("break-inside".equalsIgnoreCase(element))
{
elementVerifiers.put(element,new CSSPropertyVerifier(Arrays.asList("auto","avoid","avoid-page", "avoid-column"),ElementInfo.VISUALPAGEDMEDIA));
allelementVerifiers.remove(element);
}
else if("color-scheme".equalsIgnoreCase(element))
{
auxilaryVerifiers[81]=new CSSPropertyVerifier(Arrays.asList("light","dark","only"),null,null,null,true);
elementVerifiers.put(element,new CSSPropertyVerifier(Arrays.asList("normal"),ElementInfo.VISUALMEDIA,null,Arrays.asList("81<1,3>")));
allelementVerifiers.remove(element);
}
else if("column-count".equalsIgnoreCase(element))
{
Expand Down Expand Up @@ -1270,6 +1261,11 @@ else if("margin".equalsIgnoreCase(element))
elementVerifiers.put(element,new CSSPropertyVerifier(null,ElementInfo.VISUALMEDIA,null,Arrays.asList("36<1,4>")));
allelementVerifiers.remove(element);
}
else if("math-style".equalsIgnoreCase(element))
{
elementVerifiers.put(element,new CSSPropertyVerifier(Arrays.asList("normal","compact"),ElementInfo.VISUALMEDIA));
allelementVerifiers.remove(element);
}
else if("max-block-size".equalsIgnoreCase(element))
{
elementVerifiers.put(element,new CSSPropertyVerifier(Arrays.asList("none"),ElementInfo.VISUALMEDIA,Arrays.asList("le","pe")));
Expand Down
5 changes: 5 additions & 0 deletions test/freenet/client/filter/CSSParserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,11 @@ public class CSSParserTest {
propertyTests.put("#x { text-shadow: 1px 1px 2px 1px black; }", "#x { }");
// not possible to parse a comma separated list?
//propertyTests.put("#x { text-shadow: 1px 1px 2px red, 0 0 1em blue, 0 0 0.2em blue; }", "#x { text-shadow: 1px 1px 2px red, 0 0 1em blue, 0 0 0.2em blue; }");

// dark mode
propertyTests.put(":root { color-scheme: light dark; }", ":root { color-scheme: light dark; }");
propertyTests.put(":root { color-scheme: only light; }", ":root { color-scheme: only light; }");

}

FilterMIMEType cssMIMEType;
Expand Down

0 comments on commit bb745b9

Please sign in to comment.