From 12925abce6fe92f6a0eb5fa10bf830942257ee5c Mon Sep 17 00:00:00 2001 From: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Thu, 19 Dec 2024 14:43:28 +0000 Subject: [PATCH 1/4] Init --- src/main/javacc/CSS3Parser.jj | 1 + .../java/org/htmlunit/cssparser/parser/CSS3ParserTest.java | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/main/javacc/CSS3Parser.jj b/src/main/javacc/CSS3Parser.jj index ed1d82c..aafad31 100644 --- a/src/main/javacc/CSS3Parser.jj +++ b/src/main/javacc/CSS3Parser.jj @@ -1593,6 +1593,7 @@ LexicalUnit term(LexicalUnit prev) : ) | t = { value = LexicalUnitImpl.createString(prev, unescape(t.image, false)); } | t = "progid:" { value = LexicalUnitImpl.createIdent(prev, skipUnit().trim()); } + | t = { value = LexicalUnitImpl.createSlash(prev); } | ( t = diff --git a/src/test/java/org/htmlunit/cssparser/parser/CSS3ParserTest.java b/src/test/java/org/htmlunit/cssparser/parser/CSS3ParserTest.java index 3a1c3be..5140f23 100644 --- a/src/test/java/org/htmlunit/cssparser/parser/CSS3ParserTest.java +++ b/src/test/java/org/htmlunit/cssparser/parser/CSS3ParserTest.java @@ -1155,6 +1155,12 @@ public void hslVariousErrors() throws Exception { "foreground: hsl(10, 20%, 30)"); } + @Test + public void modernColorSyntax() throws Exception { + color("foreground: oklch(55% 0.2308 256.91 / 0.5)", "foreground: oklch(55% 0.2308 256.91 / 0.5)"); + color("foreground: oklch(from var(--text-color-secondary) l c h / 0.1)", "foreground: oklch(from var(--text-color-secondary) l c h / 0.1)"); + } + private void color(final String expected, final String cssText) throws Exception { color(0, expected, cssText); } From 30e677bb57d7449b7b4d534cf1288bfd3b49ddde Mon Sep 17 00:00:00 2001 From: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Thu, 19 Dec 2024 14:48:16 +0000 Subject: [PATCH 2/4] Update CSS3ParserTest.java --- .../java/org/htmlunit/cssparser/parser/CSS3ParserTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/java/org/htmlunit/cssparser/parser/CSS3ParserTest.java b/src/test/java/org/htmlunit/cssparser/parser/CSS3ParserTest.java index 5140f23..6d431a6 100644 --- a/src/test/java/org/htmlunit/cssparser/parser/CSS3ParserTest.java +++ b/src/test/java/org/htmlunit/cssparser/parser/CSS3ParserTest.java @@ -1887,7 +1887,7 @@ public void malformedDeclaration() throws Exception { final String expected = "Error in declaration. (Invalid token \"}\". Was expecting one of: , \":\".)" + " Error in declaration. (Invalid token \";\". Was expecting one of: , \":\".)" + " Error in expression. (Invalid token \"}\". Was expecting one of: , , \"inherit\", " - + ", , \"-\", \"+\", , , , , , " + + ", , \"/\", \"-\", \"+\", , , , , , " + ", , , , " + ", , , , , , , " + ", , , , " @@ -1895,7 +1895,7 @@ public void malformedDeclaration() throws Exception { + ", , , , , " + ", , , \"progid:\".)" + " Error in expression. (Invalid token \";\". Was expecting one of: , , \"inherit\", " - + ", , \"-\", \"+\", , , , , , " + + ", , \"/\", \"-\", \"+\", , , , , , " + ", , , , " + ", , , , , , , " + ", , , , " @@ -2192,7 +2192,7 @@ public void unexpectedEndOfString() throws Exception { assertEquals(1, errorHandler.getErrorCount()); final String expected = "Error in expression. " + "(Invalid token \"\\'\". Was expecting one of: , , \"inherit\", " - + ", , \"-\", \"+\", , , , , , " + + ", , \"/\", \"-\", \"+\", , , , , , " + ", , , , " + ", , , , , , , " + ", , , , " From 5eb842339835845b342b7662544bd842f8e84a4c Mon Sep 17 00:00:00 2001 From: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Thu, 19 Dec 2024 14:49:15 +0000 Subject: [PATCH 3/4] Update CSS3Parser.jj --- src/main/javacc/CSS3Parser.jj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/javacc/CSS3Parser.jj b/src/main/javacc/CSS3Parser.jj index aafad31..af9eac5 100644 --- a/src/main/javacc/CSS3Parser.jj +++ b/src/main/javacc/CSS3Parser.jj @@ -1593,7 +1593,7 @@ LexicalUnit term(LexicalUnit prev) : ) | t = { value = LexicalUnitImpl.createString(prev, unescape(t.image, false)); } | t = "progid:" { value = LexicalUnitImpl.createIdent(prev, skipUnit().trim()); } - | t = { value = LexicalUnitImpl.createSlash(prev); } + | t = { value = LexicalUnitImpl.createSlash(prev); } | ( t = From ec9c6c5e2dce0848885dd37ad58a8853b5199062 Mon Sep 17 00:00:00 2001 From: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Thu, 19 Dec 2024 14:52:39 +0000 Subject: [PATCH 4/4] Update CSS3Parser.jj --- src/main/javacc/CSS3Parser.jj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/javacc/CSS3Parser.jj b/src/main/javacc/CSS3Parser.jj index af9eac5..e61c3b4 100644 --- a/src/main/javacc/CSS3Parser.jj +++ b/src/main/javacc/CSS3Parser.jj @@ -1593,7 +1593,7 @@ LexicalUnit term(LexicalUnit prev) : ) | t = { value = LexicalUnitImpl.createString(prev, unescape(t.image, false)); } | t = "progid:" { value = LexicalUnitImpl.createIdent(prev, skipUnit().trim()); } - | t = { value = LexicalUnitImpl.createSlash(prev); } + | t = { value = LexicalUnitImpl.createSlash(prev); } | ( t =