about summary refs log tree commit diff stats
path: root/src/css
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2025-03-11 18:07:42 +0100
committerbptato <nincsnevem662@gmail.com>2025-03-11 18:07:42 +0100
commit5e67b2798f4d8645360879bd487c5a2a8b33e9a9 (patch)
treed90014142092bf4da871c8d471ecae8c808baa20 /src/css
parent57b8dc6ae606a0f1499349b591269d6430bb234d (diff)
downloadchawan-5e67b2798f4d8645360879bd487c5a2a8b33e9a9.tar.gz
layout: small cleanup
Diffstat (limited to 'src/css')
-rw-r--r--src/css/layout.nim20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/css/layout.nim b/src/css/layout.nim
index b28aecc8..3ec833da 100644
--- a/src/css/layout.nim
+++ b/src/css/layout.nim
@@ -2422,18 +2422,16 @@ proc preLayoutTableRows(tctx: var TableContext; table: BlockBox) =
   var tfoot: seq[BlockBox] = @[]
   for child in table.children:
     let child = BlockBox(child)
-    case child.computed{"display"}
-    of DisplayTableRow: tbody.add(child)
-    of DisplayTableHeaderGroup:
-      for it in child.children:
-        thead.add(BlockBox(it))
-    of DisplayTableRowGroup:
-      for it in child.children:
-        tbody.add(BlockBox(it))
-    of DisplayTableFooterGroup:
+    let display = child.computed{"display"}
+    if display == DisplayTableRow:
+      tbody.add(child)
+    else:
       for it in child.children:
-        tfoot.add(BlockBox(it))
-    else: assert false, $child.computed{"display"}
+        case display
+        of DisplayTableHeaderGroup: thead.add(BlockBox(it))
+        of DisplayTableRowGroup: tbody.add(BlockBox(it))
+        of DisplayTableFooterGroup: tfoot.add(BlockBox(it))
+        else: assert false, $child.computed{"display"}
   tctx.preLayoutTableRows(thead, table)
   tctx.preLayoutTableRows(tbody, table)
   tctx.preLayoutTableRows(tfoot, table)