Skip to content

Implement white space collapsing#176

Open
afishhh wants to merge 5 commits into
masterfrom
whitespace-collapse
Open

Implement white space collapsing#176
afishhh wants to merge 5 commits into
masterfrom
whitespace-collapse

Conversation

@afishhh
Copy link
Copy Markdown
Owner

@afishhh afishhh commented May 22, 2026

See https://drafts.csswg.org/css-text-4/#white-space-phase-1
See doc comment of subrandr::layout::inline::WhiteSpaceCollapseInternalDoc for implementation sketch.

TODO:

  • Implement preserve-spaces and use it for WebVTT.

White space hanging is future work but I already have a prototype locally.

Note that white-space-collapse: collapse does not have an internal use, it's here as part of my goal of supporting CSS defaults so that a future layout (C) API can use actual CSS defaults as a default ComputedStyle.

@afishhh afishhh force-pushed the whitespace-collapse branch 3 times, most recently from 9b9e34c to b854416 Compare May 23, 2026 11:58
@afishhh afishhh marked this pull request as ready for review May 23, 2026 12:26
afishhh added 5 commits May 24, 2026 00:51
Storing span length gets problematic if one wants to start modifying the
item list while building it (like when collapsing whitespace).

Instead signal the end of a span with a separate `SpanEnd` item.
This actually slightly simplifies the iteration code and makes spans
smaller so is probably worth doing anyway.
@afishhh afishhh force-pushed the whitespace-collapse branch from b854416 to 6ebe476 Compare May 23, 2026 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant