diff options
| author | bptato <nincsnevem662@gmail.com> | 2024-12-03 18:42:12 +0100 |
|---|---|---|
| committer | bptato <nincsnevem662@gmail.com> | 2024-12-03 18:42:12 +0100 |
| commit | 541828e3014f47730a49cd95cbd15f340cf8be07 (patch) | |
| tree | 2a51925aea70af5218fa66c7d0cd31ccd3fb217d /src/css/layout.nim | |
| parent | 772b0a79e565a9c413766a0eb6b760d8d5cdd870 (diff) | |
| download | chawan-541828e3014f47730a49cd95cbd15f340cf8be07.tar.gz | |
cssvalues: optimize CSSComputedValues size
Roughly halves the object's size, and gets rid of a large number of
allocations.
It could be compressed further into a bitmap, but I'm not sure if it's
worth the complexity.
Diffstat (limited to 'src/css/layout.nim')
| -rw-r--r-- | src/css/layout.nim | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/css/layout.nim b/src/css/layout.nim index fcf95c05..fe5afdcc 100644 --- a/src/css/layout.nim +++ b/src/css/layout.nim @@ -1105,7 +1105,7 @@ proc resolveFloatSizes(lctx: LayoutContext; space: AvailableSpace; ) sizes.space.h = maxContent() for dim in DimensionType: - let length = computed[CvalSizeMap[dim]].length + let length = computed.objs[CvalSizeMap[dim]].length if length.canpx(space[dim]): let u = length.spx(lctx, space[dim], computed, paddingSum[dim]) sizes.space[dim] = stretch(minClamp(u, sizes.minMaxSizes[dim])) @@ -1126,7 +1126,7 @@ proc resolveFlexItemSizes(lctx: LayoutContext; space: AvailableSpace; ) if dim != dtHorizontal: sizes.space.h = maxContent() - let length = computed[CvalSizeMap[dim]].length + let length = computed.objs[CvalSizeMap[dim]].length if length.canpx(space[dim]): let u = length.spx(lctx, space[dim], computed, paddingSum[dim]) sizes.space[dim] = SizeConstraint( @@ -1140,7 +1140,7 @@ proc resolveFlexItemSizes(lctx: LayoutContext; space: AvailableSpace; # been specified. sizes.space[dim] = maxContent() let odim = dim.opposite() - let olength = computed[CvalSizeMap[odim]].length + let olength = computed.objs[CvalSizeMap[odim]].length if olength.canpx(space[odim]): let u = olength.spx(lctx, space[odim], computed, paddingSum[odim]) sizes.space[odim] = stretch(minClamp(u, sizes.minMaxSizes[odim])) |