about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-12-15 21:40:37 +0100
committerbptato <nincsnevem662@gmail.com>2024-12-15 22:47:20 +0100
commit0971ad855c59866b29659fa4d9c249c3919b600c (patch)
tree22f8ce2761186e71925cc9c9b27d653fb1dc38d2 /src
parente5afb660476c97c97259a72cf4d6f3bbfdbff9fe (diff)
downloadchawan-0971ad855c59866b29659fa4d9c249c3919b600c.tar.gz
layout: do not allow canpx for scFitContent
The test case attached is undefined in CSS 2.1, but css-sizing-3
wants us to just ignore the width property (I think).
Diffstat (limited to 'src')
-rw-r--r--src/css/layout.nim4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/css/layout.nim b/src/css/layout.nim
index a833126c..c737f9f8 100644
--- a/src/css/layout.nim
+++ b/src/css/layout.nim
@@ -144,7 +144,7 @@ func px(l: CSSLength; lctx: LayoutContext; p: LayoutUnit = 0):
   return px(l, lctx.attrs, p)
 
 func canpx(l: CSSLength; sc: SizeConstraint): bool =
-  return l.u != cuAuto and (l.u != cuPerc or sc.isDefinite())
+  return l.u != cuAuto and (l.u != cuPerc or sc.t == scStretch)
 
 # Note: for margins only
 # For percentages, use 0 for indefinite, and containing box's size for
@@ -909,7 +909,7 @@ func spx(l: CSSLength; lctx: LayoutContext; p: SizeConstraint;
 proc resolveContentWidth(sizes: var ResolvedSizes; widthpx: LayoutUnit;
     parentWidth: SizeConstraint; computed: CSSValues;
     isauto = false) =
-  if not sizes.space.w.isDefinite() or not parentWidth.isDefinite():
+  if not sizes.space.w.isDefinite() or parentWidth.t != scStretch:
     # width is indefinite, so no conflicts can be resolved here.
     return
   let total = widthpx + sizes.margin[dtHorizontal].sum() +