aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-10-14 18:49:55 +0200
committerbptato <nincsnevem662@gmail.com>2023-10-14 18:57:21 +0200
commitab6dad2bcc77450e3ded9f5b303662aae978c4e4 (patch)
tree27c28766585cbc211656bfd77e853d3327ca60a8 /src
parentd1d4c75176686eb1a74a165a2f4e03594e5de44a (diff)
downloadchawan-ab6dad2bcc77450e3ded9f5b303662aae978c4e4.tar.gz
css: fix list style type presentational hints
third time's the charm
Diffstat (limited to 'src')
-rw-r--r--src/css/cascade.nim37
1 files changed, 20 insertions, 17 deletions
diff --git a/src/css/cascade.nim b/src/css/cascade.nim
index 4510078d..1eaa643c 100644
--- a/src/css/cascade.nim
+++ b/src/css/cascade.nim
@@ -177,23 +177,24 @@ func calcPresentationalHints(element: Element): CSSComputedValues =
let i = rowspan.get
if i <= 65534:
set_cv "-cha-rowspan", int(i)
- template map_list_type =
+ template map_list_type_ol =
let ctype = element.attr("type")
if ctype.len > 0:
- if ctype.len == 1:
- case ctype[0]
- of '1': set_cv "list-style-type", LIST_STYLE_TYPE_DECIMAL
- of 'a': set_cv "list-style-type", LIST_STYLE_TYPE_LOWER_ALPHA
- of 'A': set_cv "list-style-type", LIST_STYLE_TYPE_UPPER_ALPHA
- of 'i': set_cv "list-style-type", LIST_STYLE_TYPE_LOWER_ROMAN
- of 'I': set_cv "list-style-type", LIST_STYLE_TYPE_UPPER_ROMAN
- else: discard
- else:
- case ctype.toLowerAscii()
- of "none": set_cv "list-style-type", LIST_STYLE_TYPE_NONE
- of "disc": set_cv "list-style-type", LIST_STYLE_TYPE_DISC
- of "circle": set_cv "list-style-type", LIST_STYLE_TYPE_CIRCLE
- of "square": set_cv "list-style-type", LIST_STYLE_TYPE_SQUARE
+ case ctype[0]
+ of '1': set_cv "list-style-type", LIST_STYLE_TYPE_DECIMAL
+ of 'a': set_cv "list-style-type", LIST_STYLE_TYPE_LOWER_ALPHA
+ of 'A': set_cv "list-style-type", LIST_STYLE_TYPE_UPPER_ALPHA
+ of 'i': set_cv "list-style-type", LIST_STYLE_TYPE_LOWER_ROMAN
+ of 'I': set_cv "list-style-type", LIST_STYLE_TYPE_UPPER_ROMAN
+ else: discard
+ template map_list_type_ul =
+ let ctype = element.attr("type")
+ if ctype.len > 0:
+ case ctype.toLowerAscii()
+ of "none": set_cv "list-style-type", LIST_STYLE_TYPE_NONE
+ of "disc": set_cv "list-style-type", LIST_STYLE_TYPE_DISC
+ of "circle": set_cv "list-style-type", LIST_STYLE_TYPE_CIRCLE
+ of "square": set_cv "list-style-type", LIST_STYLE_TYPE_SQUARE
case element.tagType
of TAG_DIV:
@@ -236,8 +237,10 @@ func calcPresentationalHints(element: Element): CSSComputedValues =
let input = HTMLInputElement(element)
if input.inputType in InputTypeWithSize:
map_size
- of TAG_OL, TAG_UL:
- map_list_type
+ of TAG_OL:
+ map_list_type_ol
+ of TAG_UL:
+ map_list_type_ul
else: discard
proc applyDeclarations(styledNode: StyledNode, parent: CSSComputedValues,