about summary refs log tree commit diff stats
path: root/src/layout
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-05-30 22:25:56 +0200
committerbptato <nincsnevem662@gmail.com>2024-05-30 22:28:00 +0200
commita78fa4ee235006239bf9e81d8d83adc59415b524 (patch)
tree7349f5ad87e357fe7f91a61870043da0c9e9f743 /src/layout
parent4af483ee6a6a3ab5853174c2399dc8942d8b2026 (diff)
downloadchawan-a78fa4ee235006239bf9e81d8d83adc59415b524.tar.gz
layout: fix a width sizing bug
As expected, the mystery line was just hiding another bug. (In
particular, indefinite containing size constraints were not denied in
resolveContentWidth, so it only (accidentally) worked with stretched
sizes.)
Diffstat (limited to 'src/layout')
-rw-r--r--src/layout/engine.nim5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/layout/engine.nim b/src/layout/engine.nim
index 4d532364..ba9248ca 100644
--- a/src/layout/engine.nim
+++ b/src/layout/engine.nim
@@ -859,7 +859,7 @@ func spx(l: CSSLength; lctx: LayoutContext; p: SizeConstraint;
 proc resolveContentWidth(sizes: var ResolvedSizes; widthpx: LayoutUnit;
     containingWidth: SizeConstraint; computed: CSSComputedValues;
     isauto = false) =
-  if not sizes.space.w.isDefinite():
+  if not sizes.space.w.isDefinite() or not containingWidth.isDefinite():
     # width is indefinite, so no conflicts can be resolved here.
     return
   let total = widthpx + sizes.margin.dimSum(dtHorizontal) +
@@ -940,9 +940,6 @@ proc resolveBlockWidth(sizes: var ResolvedSizes;
     sizes.maxWidth = maxWidth
     if sizes.space.w.t in {scStretch, scFitContent} and
         maxWidth < sizes.space.w.u or sizes.space.w.t == scMaxContent:
-      # Warning: the following line seems to make no sense, but *is* needed.
-      #TODO figure out why.
-      sizes.space.w = stretch(maxWidth)
       if sizes.space.w.t == scStretch:
         # available width would stretch over max-width
         sizes.space.w = stretch(maxWidth)