diff options
| author | bptato <nincsnevem662@gmail.com> | 2024-10-07 22:04:16 +0200 |
|---|---|---|
| committer | bptato <nincsnevem662@gmail.com> | 2024-10-07 22:04:50 +0200 |
| commit | 3b73117b263ea6ae9fdff7005383bb969c593c4f (patch) | |
| tree | 26554786847acda2ff4f703ea5b56175092268a7 /src | |
| parent | e7874dc0a04dacf142254b9c882ffc702181ff53 (diff) | |
| download | chawan-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.nim | 25 |
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: |