diff options
-rw-r--r-- | src/layout/engine.nim | 5 | ||||
-rw-r--r-- | test/layout/max-width-sets-main-width-indefinite-parent.color.expected | 2 | ||||
-rw-r--r-- | test/layout/max-width-sets-main-width-indefinite-parent.html | 4 |
3 files changed, 7 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) diff --git a/test/layout/max-width-sets-main-width-indefinite-parent.color.expected b/test/layout/max-width-sets-main-width-indefinite-parent.color.expected new file mode 100644 index 00000000..9ef30269 --- /dev/null +++ b/test/layout/max-width-sets-main-width-indefinite-parent.color.expected @@ -0,0 +1,2 @@ + [48;2;0;0;255mtesting testing testing testing testing[49m + diff --git a/test/layout/max-width-sets-main-width-indefinite-parent.html b/test/layout/max-width-sets-main-width-indefinite-parent.html new file mode 100644 index 00000000..524a4ebe --- /dev/null +++ b/test/layout/max-width-sets-main-width-indefinite-parent.html @@ -0,0 +1,4 @@ +<table> +<tr> +<td> +<div style="max-width: 100ch; background: blue">testing testing testing testing testing |