Skip to content

Commit

Permalink
Add CSS property color-scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
torusrxxx committed Dec 4, 2024
1 parent ee55011 commit 99ec4e6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/freenet/client/filter/CSSTokenizerFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 @@ -837,6 +838,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
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 99ec4e6

Please sign in to comment.