about summary refs log tree commit diff stats
path: root/src/css/cssvalues.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2025-01-15 22:40:10 +0100
committerbptato <nincsnevem662@gmail.com>2025-01-15 22:40:10 +0100
commit5bbced41ec3531c57ecba6095357be691fabcaf9 (patch)
tree97f5bd9e3be2ea081bbbfed554b5ab40b0c41a02 /src/css/cssvalues.nim
parentf9b6a0f06bc4f84543a24c8264e02ac89cfc2b4a (diff)
downloadchawan-5bbced41ec3531c57ecba6095357be691fabcaf9.tar.gz
cssparser: enumize CSSFunction name
Diffstat (limited to 'src/css/cssvalues.nim')
-rw-r--r--src/css/cssvalues.nim9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/css/cssvalues.nim b/src/css/cssvalues.nim
index a2c661d6..8fba787b 100644
--- a/src/css/cssvalues.nim
+++ b/src/css/cssvalues.nim
@@ -1013,9 +1013,9 @@ func cssColor*(val: CSSComponentValue): Opt[CSSColor] =
     else: discard
   elif val of CSSFunction:
     let f = CSSFunction(val)
-    if f.name.equalsIgnoreCase("rgb") or f.name.equalsIgnoreCase("rgba"):
+    if f.name in {cftRgb, cftRgba}:
       return parseARGB(f.value)
-    elif f.name.equalsIgnoreCase("-cha-ansi"):
+    elif f.name == cftChaAnsi:
       return parseANSI(f.value)
   return err()
 
@@ -1214,8 +1214,7 @@ func cssURL*(cval: CSSComponentValue; src = false): Option[string] =
       return some(tok.value)
   elif cval of CSSFunction:
     let fun = CSSFunction(cval)
-    if fun.name.equalsIgnoreCase("url") or
-        src and fun.name.equalsIgnoreCase("src"):
+    if fun.name == cftUrl or src and fun.name == cftSrc:
       for x in fun.value:
         if not (x of CSSToken):
           break
@@ -1299,7 +1298,7 @@ proc parseValue(cvals: openArray[CSSComponentValue];
   inc i
   if cval of CSSFunction:
     let fun = CSSFunction(cval)
-    if fun.name.equalsIgnoreCase("var"):
+    if fun.name == cftVar:
       if cvals.skipBlanks(i) < cvals.len:
         return err()
       return fun.parseVar(entry, attrs, factory)