aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/css/cssvalues.nim4
-rw-r--r--src/css/mediaquery.nim15
-rw-r--r--src/css/sheet.nim5
3 files changed, 6 insertions, 18 deletions
diff --git a/src/css/cssvalues.nim b/src/css/cssvalues.nim
index 9bb063b3..19b50966 100644
--- a/src/css/cssvalues.nim
+++ b/src/css/cssvalues.nim
@@ -1091,7 +1091,7 @@ func cssLineHeight(cval: CSSComponentValue): Opt[CSSLength] =
of cttNumber:
return cssLength(tok.nvalue * 100, "%")
of cttIdent:
- if tok.value == "normal":
+ if tok.value.equalsIgnoreCase("normal"):
return ok(CSSLengthAuto)
else:
return cssLength(tok, has_auto = false)
@@ -1161,7 +1161,7 @@ func cssImage(cval: CSSComponentValue): Opt[CSSContent] =
if isToken(cval):
#TODO bg-image only
let tok = getToken(cval)
- if tok.tokenType == cttIdent and tok.value == "none":
+ if tok.tokenType == cttIdent and tok.value.equalsIgnoreCase("none"):
return ok(CSSContent(t: ContentImage, s: ""))
let url = cssURL(cval)
if url.isSome:
diff --git a/src/css/mediaquery.nim b/src/css/mediaquery.nim
index 277813b4..73649e8f 100644
--- a/src/css/mediaquery.nim
+++ b/src/css/mediaquery.nim
@@ -79,23 +79,12 @@ func `$`*(mf: MediaFeature): string =
return "hover: " & $mf.b
of mftPrefersColorScheme:
return "prefers-color-scheme: " & $mf.b
- of mftWidth:
- result &= $mf.lengthrange.s.a
- result &= " <"
- if mf.lengthrange.aeq:
- result &= "="
- result &= " width <"
- if mf.lengthrange.beq:
- result &= "="
- result &= " "
- result &= $mf.lengthrange.s.b
- of mftHeight:
+ of mftWidth, mftHeight:
result &= $mf.lengthrange.s.a
result &= " <"
if mf.lengthrange.aeq:
result &= "="
- result &= " width "
- result &= "<"
+ result &= ' ' & $mf.t & " <"
if mf.lengthrange.beq:
result &= "="
result &= " "
diff --git a/src/css/sheet.nim b/src/css/sheet.nim
index 579e7f9e..bbf5e572 100644
--- a/src/css/sheet.nim
+++ b/src/css/sheet.nim
@@ -5,6 +5,7 @@ import css/cssvalues
import css/mediaquery
import css/selectorparser
import html/catom
+import utils/twtstr
type
CSSRuleBase* = ref object of RootObj
@@ -193,8 +194,7 @@ proc addRule(stylesheet: CSSStylesheet; rule: CSSQualifiedRule) =
inc stylesheet.len
proc addAtRule(stylesheet: CSSStylesheet; atrule: CSSAtRule) =
- case atrule.name
- of "media":
+ if atrule.name.equalsIgnoreCase("media"):
if atrule.oblock == nil:
# invalid at-rule
return
@@ -212,7 +212,6 @@ proc addAtRule(stylesheet: CSSStylesheet; atrule: CSSAtRule) =
media.children.addRule(CSSQualifiedRule(rule))
stylesheet.mqList.add(media)
stylesheet.len = media.children.len
- else: discard #TODO
proc parseStylesheet*(ibuf: string; factory: CAtomFactory): CSSStylesheet =
let raw = parseStylesheet(ibuf)