aboutsummaryrefslogtreecommitdiffstats
path: root/src/layout
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-04-06 15:43:07 +0200
committerbptato <nincsnevem662@gmail.com>2024-04-06 15:45:07 +0200
commitf037d5ecadbdfeadf9c684341964d9c350a9cff4 (patch)
treeaf71201f5f2e85ae61ec2ead580676fbea4a43c6 /src/layout
parent3ad695494afb513789e6dd27bc854711d8bdd0f6 (diff)
downloadchawan-f037d5ecadbdfeadf9c684341964d9c350a9cff4.tar.gz
css, layout: flexbox fixes
* do not re-resolve FlexPendingItem sizes; it's pointless and it breaks percentage sizes * fix some bugs in `flex' shorthand parsing * add `flex-flow' shorthand
Diffstat (limited to 'src/layout')
-rw-r--r--src/layout/engine.nim8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/layout/engine.nim b/src/layout/engine.nim
index 54b349d0..8084efc9 100644
--- a/src/layout/engine.nim
+++ b/src/layout/engine.nim
@@ -2114,7 +2114,6 @@ type
child: BlockBox
builder: BoxBuilder
weights: array[FlexWeightType, float64]
- space: AvailableSpace
sizes: ResolvedSizes
FlexMainContext = object
@@ -2163,8 +2162,7 @@ proc redistributeWidth(mctx: var FlexMainContext; sizes: ResolvedSizes) =
diff += w - maxw
it.weights[wt] = 0
w = maxw
- it.space.w = stretch(w)
- it.sizes = lctx.resolveSizes(it.space, builder.computed)
+ it.sizes.space.w = stretch(w)
totalWeight += it.weights[wt]
#TODO we should call this only on freeze, and then put another loop to
# the end for non-freezed items
@@ -2205,8 +2203,7 @@ proc redistributeHeight(mctx: var FlexMainContext; sizes: ResolvedSizes) =
diff += h - maxh
it.weights[wt] = 0
h = maxh
- it.space.h = stretch(h)
- it.sizes = lctx.resolveSizes(it.space, builder.computed)
+ it.sizes.space.h = stretch(h)
totalWeight += it.weights[wt]
it.child = lctx.layoutFlexChild(builder, it.sizes)
mctx.maxSize.h = max(mctx.maxSize.h, it.child.size.h)
@@ -2311,7 +2308,6 @@ proc layoutFlex(bctx: var BlockContext; box: BlockBox; builder: BlockBoxBuilder;
child: child,
builder: builder,
weights: [grow, shrink],
- space: sizes.space,
sizes: childSizes
))
inc i # need to increment index here for needsGrow