Files
rust_browser/tests/goldens/expected/072-white-space-pre-line.layout.txt
Zachary D. Rowitsch 627e2d4839 Implement white-space: pre-line and complete pre-wrap support
Fix pre-line text normalization in box_tree.rs: newlines were being
stripped during box tree construction because pre-line routed through
the normal whitespace collapse branch. Add a preserves_newlines()
branch that splits on \n, collapses spaces within each line, and
rejoins with \n so the inline engine can produce correct line breaks.

Guard is_whitespace_only_run in normalize.rs to preserve \n-containing
text nodes under pre-line, preventing them from being discarded at
block boundaries.

Add 21 unit tests covering pre-line (newline preservation, space
collapsing, wrapping, inheritance, consecutive newlines, whitespace-only
lines, vertical stacking, normalize guard) and pre-wrap (newline/space
preservation, wrapping, tabs). Update golden test 072 expected output.
Promote WPT white-space-letter-spacing-001 from known_fail to pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 00:29:46 -05:00

38 lines
1.8 KiB
Plaintext

LayoutBox node=#1 tag=html box=block
content: (0, 0, 800, 112)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
LayoutBox node=#6 tag=body box=block
content: (8, 8, 784, 96)
padding: 0 0 0 0
border: 0 0 0 0
margin: 8 8 8 8
LayoutBox node=#7 tag=div box=block
content: (8, 8, 784, 96)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
inline_context: 5 lines, height=96, max_width=133.85022
line[0]: rect=(8, 8, 133.85022, 19.2) fragments=4
frag[0]: rect=(8, 9.6, 22.449337, 16) text="This" start=false end=false
frag[1]: rect=(33.50367, 9.6, 19.477238, 16) text="has" start=false end=false
frag[2]: rect=(56.03524, 9.6, 45.427315, 16) text="multiple" start=false end=false
frag[3]: rect=(104.516884, 9.6, 37.333336, 16) text="spaces" start=false end=false
line[1]: rect=(8, 27.2, 18.725403, 19.2) fragments=1
frag[0]: rect=(8, 28.800001, 18.725403, 16) text="but" start=false end=false
line[2]: rect=(8, 46.4, 23.389135, 19.2) fragments=1
frag[0]: rect=(8, 48, 23.389135, 16) text="only" start=false end=false
line[3]: rect=(8, 65.600006, 48.693096, 19.2) fragments=1
frag[0]: rect=(8, 67.200005, 48.693096, 16) text="newlines" start=false end=false
line[4]: rect=(8, 84.8, 113.092514, 19.2) fragments=3
frag[0]: rect=(8, 86.4, 37.509544, 16) text="should" start=false end=false
frag[1]: rect=(48.563877, 86.4, 13.85022, 16) text="be" start=false end=false
frag[2]: rect=(65.46843, 86.4, 55.62408, 16) text="preserved" start=false end=false
LayoutBox node=#8 tag=anonymous box=anon
content: (0, 0, 365.9442, 16)
padding: 0 0 0 0
border: 0 0 0 0
margin: 0 0 0 0
text: "This has multiple sp..."