diff options
| author | bptato <nincsnevem662@gmail.com> | 2024-11-19 19:20:41 +0100 |
|---|---|---|
| committer | bptato <nincsnevem662@gmail.com> | 2024-11-19 19:20:41 +0100 |
| commit | 1827b2e7851a99d49d5573ea5a418d21b17791d5 (patch) | |
| tree | 4768a0bfe610d6aea2c7b4c8afb6f19b5dbc9c15 | |
| parent | 58a833789dacd6577fc23c382614652033209d76 (diff) | |
| download | chawan-1827b2e7851a99d49d5573ea5a418d21b17791d5.tar.gz | |
layout: fix intrinsic min width with whitespace: pre
| -rw-r--r-- | src/css/layout.nim | 1 | ||||
| -rw-r--r-- | test/layout/whitespace-pre-sets-intrinsic-min-width.expected | 2 | ||||
| -rw-r--r-- | test/layout/whitespace-pre-sets-intrinsic-min-width.html | 9 |
3 files changed, 12 insertions, 0 deletions
diff --git a/src/css/layout.nim b/src/css/layout.nim index c5347af2..5ad9cce6 100644 --- a/src/css/layout.nim +++ b/src/css/layout.nim @@ -595,6 +595,7 @@ proc finishLine(ictx: var InlineContext; state: var InlineState; wrap: bool; let whitespace = state.fragment.computed{"white-space"} if whitespace == WhitespacePre: ictx.flushWhitespace(state) + ictx.state.xminwidth = max(ictx.state.xminwidth, ictx.lbstate.size.w) elif whitespace == WhitespacePreWrap: ictx.flushWhitespace(state, hang = true) else: diff --git a/test/layout/whitespace-pre-sets-intrinsic-min-width.expected b/test/layout/whitespace-pre-sets-intrinsic-min-width.expected new file mode 100644 index 00000000..41ec778e --- /dev/null +++ b/test/layout/whitespace-pre-sets-intrinsic-min-width.expected @@ -0,0 +1,2 @@ + + cell 1 cell 2 diff --git a/test/layout/whitespace-pre-sets-intrinsic-min-width.html b/test/layout/whitespace-pre-sets-intrinsic-min-width.html new file mode 100644 index 00000000..07c81f25 --- /dev/null +++ b/test/layout/whitespace-pre-sets-intrinsic-min-width.html @@ -0,0 +1,9 @@ +<!DOCTYPE html> +<table> +<tr> +<td> +<pre> +cell 1 +<td width=100%> +<br> +cell 2 |