From 7abfb18656d7ecf389b10b1a75d2f1e8f5f2a718 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Sun, 18 Jul 2021 21:20:40 +0100 Subject: LibWeb: Implement CSS color parsing from Tokens This was broken when we switched away from using StringStyleValues. While I was at it, I have implemented hsl/a() and the percentage syntax for rgb/a(). As a bonus, added `colors.html` as a test page for the various CSS color syntaxes, since nothing was testing rgb() or rgba() before. Much of the parsing code in LibGFX/Color.h seems to be centered around CSS color values, but this is not used by the new Parser. (And can't be used, because it requires a String value and we have a list of Tokens of some kind instead.) Maybe that should be removed from there when the new CSS parser is operational. --- Base/res/html/misc/colors.html | 29 +++++++++++++++++++++++++++++ Base/res/html/misc/welcome.html | 1 + 2 files changed, 30 insertions(+) create mode 100644 Base/res/html/misc/colors.html (limited to 'Base/res') diff --git a/Base/res/html/misc/colors.html b/Base/res/html/misc/colors.html new file mode 100644 index 0000000000..df0d67de1a --- /dev/null +++ b/Base/res/html/misc/colors.html @@ -0,0 +1,29 @@ + + + CSS test + + + +
This is green, using a named color.
+
This is green, using #0F0.
+
This is green, using #00ff00.
+
This is green, using rgb(0, 255, 0).
+
This is green, using rgb(0%, 100%, 0%).
+
This is green, using rgb(-5%, 120%, -42%).
+
This is green, using rgba(0, 255, 0, 1).
+
This is green, using rgba(0%, 100%, 0%, 1).
+
This is green, using hsl(120, 100%, 50%).
+
This is green, using hsla(120, 100%, 50%, 1).
+ + diff --git a/Base/res/html/misc/welcome.html b/Base/res/html/misc/welcome.html index fdaafa4972..e13f9b9f84 100644 --- a/Base/res/html/misc/welcome.html +++ b/Base/res/html/misc/welcome.html @@ -114,6 +114,7 @@
  • form
  • borders
  • css
  • +
  • css colors
  • acid1
  • acid2
  • attribute selectors
  • -- cgit v1.2.3