about summary refs log tree commit diff stats
path: root/src/css
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-05-18 19:37:14 +0200
committerbptato <nincsnevem662@gmail.com>2024-05-18 19:37:14 +0200
commit47d08bff7e4f82fb622e30eee770c74904dac93c (patch)
tree49957b66d6657a11f49c4ca5647197d69c2dab40 /src/css
parent1fc146069f0a66f82f236e65f1fd12fc50b92ce2 (diff)
downloadchawan-47d08bff7e4f82fb622e30eee770c74904dac93c.tar.gz
css: stub overflow
The renderer cannot handle it yet, but at least this fixes pages that
expect overflow: hidden (etc.) to establish a new BFC.
Diffstat (limited to 'src/css')
-rw-r--r--src/css/cssvalues.nim16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/css/cssvalues.nim b/src/css/cssvalues.nim
index 86d5630c..8751ba50 100644
--- a/src/css/cssvalues.nim
+++ b/src/css/cssvalues.nim
@@ -99,6 +99,7 @@ type
     cptFlexGrow = "flex-grow"
     cptFlexShrink = "flex-shrink"
     cptFlexBasis = "flex-basis"
+    cptOverflow = "overflow"
 
   CSSValueType* = enum
     cvtNone = ""
@@ -131,6 +132,7 @@ type
     cvtFlexDirection = "flexDirection"
     cvtFlexWrap = "flexWrap"
     cvtNumber = "number"
+    cvtOverflow = "overflow"
 
   CSSGlobalType = enum
     cgtNoglobal = ""
@@ -293,6 +295,13 @@ type
     FlexWrapWrap = "wrap"
     FlexWrapWrapReverse = "wrap-reverse"
 
+  CSSOverflow* = enum
+    OverflowVisible = "visible"
+    OverflowHidden = "hidden"
+    OverflowClip = "clip"
+    OverflowScroll = "scroll"
+    OverflowAuto = "auto"
+
 type
   CSSLength* = object
     num*: float64
@@ -376,6 +385,8 @@ type
       flexDirection*: CSSFlexDirection
     of cvtFlexWrap:
       flexWrap*: CSSFlexWrap
+    of cvtOverflow:
+      overflow*: CSSOverflow
     of cvtNone: discard
 
   CSSComputedValues* = ref array[CSSPropertyType, CSSComputedValue]
@@ -466,7 +477,8 @@ const ValueTypes = [
   cptFlexWrap: cvtFlexWrap,
   cptFlexGrow: cvtNumber,
   cptFlexShrink: cvtNumber,
-  cptFlexBasis: cvtLength
+  cptFlexBasis: cvtLength,
+  cptOverflow: cvtOverflow
 ]
 
 const InheritedProperties = {
@@ -550,6 +562,7 @@ func `$`*(val: CSSComputedValue): string =
   of cvtBgcolorIsCanvas: return $val.bgcolorIsCanvas
   of cvtFlexDirection: return $val.flexDirection
   of cvtFlexWrap: return $val.flexWrap
+  of cvtOverflow: return $val.overflow
   of cvtNumber: return $val.number
 
 macro `{}`*(vals: CSSComputedValues; s: static string): untyped =
@@ -1284,6 +1297,7 @@ proc parseValue(cvals: openArray[CSSComponentValue]; t: CSSPropertyType):
     return_new flexDirection, ?parseIdent[CSSFlexDirection](cval)
   of cvtFlexWrap: return_new flexWrap, ?parseIdent[CSSFlexWrap](cval)
   of cvtNumber: return_new number, ?cssNumber(cval, t == cptFlexGrow)
+  of cvtOverflow: return_new overflow, ?parseIdent[CSSOverflow](cval)
   of cvtNone: return err()
 
 func getInitialColor(t: CSSPropertyType): CellColor =