aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-10-07 22:04:16 +0200
committerbptato <nincsnevem662@gmail.com>2024-10-07 22:04:50 +0200
commit3b73117b263ea6ae9fdff7005383bb969c593c4f (patch)
tree26554786847acda2ff4f703ea5b56175092268a7 /src
parente7874dc0a04dacf142254b9c882ffc702181ff53 (diff)
downloadchawan-3b73117b263ea6ae9fdff7005383bb969c593c4f.tar.gz
layout: small cleanup
the length check is not needed, we do that outside the loop already
Diffstat (limited to 'src')
-rw-r--r--src/layout/engine.nim25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/layout/engine.nim b/src/layout/engine.nim
index 2fef28de..e0567d2a 100644
--- a/src/layout/engine.nim
+++ b/src/layout/engine.nim
@@ -1763,12 +1763,11 @@ proc preLayoutTableRow(pctx: var TableContext; row, parent: BlockBox;
# Add spacing.
ctx.width += pctx.inlineSpacing
# Figure out this cell's effect on the column's width.
- # Four cases exits:
+ # Four cases exist:
# 1. colwidth already fixed, cell width is fixed: take maximum
# 2. colwidth already fixed, cell width is auto: take colwidth
# 3. colwidth is not fixed, cell width is fixed: take cell width
# 4. neither of colwidth or cell width are fixed: take maximum
- if ctx.reflow.len <= i: ctx.reflow.setLen(i + 1)
if pctx.cols[i].wspecified:
if space.w.isDefinite():
# A specified column already exists; we take the larger width.
@@ -1777,19 +1776,17 @@ proc preLayoutTableRow(pctx: var TableContext; row, parent: BlockBox;
ctx.reflow[i] = true
if pctx.cols[i].width != w:
wrapper.reflow = true
+ elif space.w.isDefinite():
+ # This is the first specified column. Replace colwidth with whatever
+ # we have.
+ ctx.reflow[i] = true
+ pctx.cols[i].wspecified = true
+ pctx.cols[i].width = w
+ elif w > pctx.cols[i].width:
+ pctx.cols[i].width = w
+ ctx.reflow[i] = true
else:
- if space.w.isDefinite():
- # This is the first specified column. Replace colwidth with whatever
- # we have.
- ctx.reflow[i] = true
- pctx.cols[i].wspecified = true
- pctx.cols[i].width = w
- else:
- if w > pctx.cols[i].width:
- pctx.cols[i].width = w
- ctx.reflow[i] = true
- else:
- wrapper.reflow = true
+ wrapper.reflow = true
if pctx.cols[i].minwidth < minw:
pctx.cols[i].minwidth = minw
if pctx.cols[i].width < minw: