about summary refs log tree commit diff stats
path: root/src/css
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-01-04 01:27:10 +0100
committerbptato <nincsnevem662@gmail.com>2023-01-04 01:27:10 +0100
commit152f8908b0160379396c7fcda27cf9586374951a (patch)
tree5cd7d0fd7e6af58e8e99b017153cbd40fe82617f /src/css
parent181ea25b5626c697cc9b6bd3e42c85ea920be0f3 (diff)
downloadchawan-152f8908b0160379396c7fcda27cf9586374951a.tar.gz
ua.css: fix color, css/values: fix globals
Diffstat (limited to 'src/css')
-rw-r--r--src/css/values.nim9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/css/values.nim b/src/css/values.nim
index 06c8e53f..5e5d807c 100644
--- a/src/css/values.nim
+++ b/src/css/values.nim
@@ -1001,7 +1001,14 @@ template getDefault(t: CSSPropertyType): CSSComputedValue = {.cast(noSideEffect)
 # WARNING: may raise an exception.
 func getComputedValue(d: CSSDeclaration, ptype: CSSPropertyType, vtype: CSSValueType): (CSSComputedValue, CSSGlobalValueType) =
   var val = CSSComputedValue(t: ptype, v: vtype)
-  val.getValueFromDecl(d, vtype, ptype)
+  try:
+    val.getValueFromDecl(d, vtype, ptype)
+  except CSSValueError:
+    let global = cssGlobal(d)
+    if global != VALUE_NOGLOBAL:
+      return (val, cssGlobal(d))
+    else:
+      raise
   return (val, cssGlobal(d))
 
 func lengthShorthand(d: CSSDeclaration, props: array[4, CSSPropertyType]): seq[(CSSComputedValue, CSSGlobalValueType)] =