aboutsummaryrefslogtreecommitdiffstats
path: root/src/css
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2025-01-26 23:02:58 +0100
committerbptato <nincsnevem662@gmail.com>2025-01-26 23:25:32 +0100
commit06c421ac216b9d7f163048f89f1987c1d21e371e (patch)
tree91c6f445064fdd2a0123d21348004fd9c9a63165 /src/css
parent65e2ffcb88e657783cc93342a93b75a0e8dbcf24 (diff)
downloadchawan-06c421ac216b9d7f163048f89f1987c1d21e371e.tar.gz
layout: remove obsolete comment, improve struct packing
Diffstat (limited to 'src/css')
-rw-r--r--src/css/layout.nim20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/css/layout.nim b/src/css/layout.nim
index e8f6470f..3349b87b 100644
--- a/src/css/layout.nim
+++ b/src/css/layout.nim
@@ -213,14 +213,12 @@ type
type
LineBoxState = object
atomStates: seq[InlineAtomState]
- baseline: LUnit
hasExclusion: bool
charwidth: int
# Set at the end of layoutText. It helps determine the beginning of the
# next inline box.
widthAfterWhitespace: LUnit
- # minimum height to fit all inline atoms
- minHeight: LUnit
+ minHeight: LUnit # minimum height to fit all inline atoms
paddingTodo: seq[tuple[box: InlineBox; i: int]]
atoms: seq[InlineAtom]
size: Size
@@ -228,8 +226,9 @@ type
offsety: LUnit # offset of line in root box
height: LUnit # height used for painting; does not include padding
intrh: LUnit # intrinsic minimum height
- unpositionedFloats: seq[UnpositionedFloat]
totalFloatWidth: LUnit
+ baseline: LUnit
+ unpositionedFloats: seq[UnpositionedFloat]
InlineAtomState = object
vertalign: CSSVerticalAlign
@@ -244,17 +243,17 @@ type
bctx: ptr BlockContext
bfcOffset: Offset
lbstate: LineBoxState
- hasshy: bool
lctx: LayoutContext
whitespacenum: int
- whitespaceIsLF: bool
whitespaceFragment: InlineBox
word: InlineAtom
wrappos: int # position of last wrapping opportunity, or -1
- textFragmentSeen: bool
lastTextFragment: InlineBox
- firstBaselineSet: bool
padding: RelativeRect
+ hasshy: bool
+ whitespaceIsLF: bool
+ textFragmentSeen: bool
+ firstBaselineSet: bool
InlineState = object
box: InlineBox
@@ -1635,9 +1634,6 @@ proc addOuterBlock(ictx: var InlineContext; state: var InlineState;
else:
bctx.marginTodo.append(sizes.margin.top)
child.state = BoxLayoutState(offset: offset)
- # In the second pass, floats are already positioned - even those
- # that come after this box. So do not clear in the second pass.
- #TODO this feels very hacky and wrong.
bctx[].layout(child, sizes, canClear = true)
bctx.marginTodo.append(sizes.margin.bottom)
let textAlign = state.box.computed{"text-align"}
@@ -1852,10 +1848,10 @@ type
coli: int
colspan: int
rowspan: int
- reflow: bool
grown: int # number of remaining rows
real: CellWrapper # for filler wrappers
last: bool # is this the last filler?
+ reflow: bool
height: LUnit
baseline: LUnit