about summary refs log tree commit diff stats
path: root/src/css/cssvalues.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-11-09 18:26:45 +0100
committerbptato <nincsnevem662@gmail.com>2024-11-09 18:38:00 +0100
commit0dcaa77525327f7ce56e8cd32328973ac1bf2793 (patch)
tree8fb3720082bfaab5903bfc9714bdf2edfaf77709 /src/css/cssvalues.nim
parenta1dfab6f5882d0ba86cf0709ca05bc193289a599 (diff)
downloadchawan-0dcaa77525327f7ce56e8cd32328973ac1bf2793.tar.gz
renderdocument: basic stacking context support
negative z-index and inline positioning are still not respected, but
better than nothing I guess.
Diffstat (limited to 'src/css/cssvalues.nim')
-rw-r--r--src/css/cssvalues.nim10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/css/cssvalues.nim b/src/css/cssvalues.nim
index 158847b6..bfe65804 100644
--- a/src/css/cssvalues.nim
+++ b/src/css/cssvalues.nim
@@ -98,6 +98,7 @@ type
     cptFlexShrink = "flex-shrink"
     cptFlexBasis = "flex-basis"
     cptOverflow = "overflow"
+    cptZIndex = "z-index"
 
   CSSValueType* = enum
     cvtNone = ""
@@ -456,7 +457,8 @@ const ValueTypes = [
   cptFlexGrow: cvtNumber,
   cptFlexShrink: cvtNumber,
   cptFlexBasis: cvtLength,
-  cptOverflow: cvtOverflow
+  cptOverflow: cvtOverflow,
+  cptZIndex: cvtInteger
 ]
 
 const InheritedProperties = {
@@ -466,6 +468,11 @@ const InheritedProperties = {
   cptVisibility, cptTextTransform
 }
 
+#TODO implement sticky
+const PositionStaticLike* = {
+  PositionStatic, PositionSticky
+}
+
 func shorthandType(s: string): CSSShorthandType =
   return parseEnumNoCase[CSSShorthandType](s).get(cstNone)
 
@@ -1184,6 +1191,7 @@ proc parseValue(cvals: openArray[CSSComponentValue]; t: CSSPropertyType):
     of cptFontWeight: return_new integer, ?cssFontWeight(cval)
     of cptChaColspan: return_new integer, ?cssInteger(cval, 1 .. 1000)
     of cptChaRowspan: return_new integer, ?cssInteger(cval, 0 .. 65534)
+    of cptZIndex: return_new integer, ?cssInteger(cval, -65534 .. 65534)
     else: assert false
   of cvtTextDecoration: return_new textdecoration, ?cssTextDecoration(cvals)
   of cvtWordBreak: return_new wordBreak, ?parseIdent[CSSWordBreak](cval)