diff options
author | bptato <nincsnevem662@gmail.com> | 2022-11-29 00:42:34 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2022-11-29 00:42:34 +0100 |
commit | f65667797376e65d8e19e1aa514d160210013540 (patch) | |
tree | d11f8ba5c47f7e8758f922baaf5755a621c38802 /src/css | |
parent | d1f6224997b8fb7203a13c42c95dc7814edfb6fd (diff) | |
download | chawan-f65667797376e65d8e19e1aa514d160210013540.tar.gz |
Fix initial values for left, right, top, bottom
Diffstat (limited to 'src/css')
-rw-r--r-- | src/css/values.nim | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/css/values.nim b/src/css/values.nim index 86faf75b..6ede0fd9 100644 --- a/src/css/values.nim +++ b/src/css/values.nim @@ -429,6 +429,9 @@ func cssLength(d: CSSDeclaration): CSSLength = if isToken(d): let tok = CSSToken(d.value[0]) case tok.tokenType + of CSS_NUMBER_TOKEN: + if tok.nvalue == 0: + return CSSLength(num: 0, unit: UNIT_PX) of CSS_PERCENTAGE_TOKEN: return cssLength(tok.nvalue, "%") of CSS_DIMENSION_TOKEN: @@ -682,7 +685,9 @@ func getInitialColor(t: CSSPropertyType): RGBAColor = func getInitialLength(t: CSSPropertyType): CSSLength = case t - of PROPERTY_WIDTH, PROPERTY_HEIGHT, PROPERTY_WORD_SPACING, PROPERTY_LINE_HEIGHT: + of PROPERTY_WIDTH, PROPERTY_HEIGHT, PROPERTY_WORD_SPACING, + PROPERTY_LINE_HEIGHT, PROPERTY_LEFT, PROPERTY_RIGHT, PROPERTY_TOP, + PROPERTY_BOTTOM: return CSSLength(auto: true) else: return CSSLength() |