Repository navigation
fast: Measure text that reaches prepaint unmeasured instead of panicking - #83
Merged
huacnlee merged 2 commits intoOct 22, 2026
Merged
Conversation
Text whose measurement was neither carried over nor taken by Taffy reached
TextLayout::prepaint with no measurement, and upstream's unwrap there
aborted the app ("measurement has not been performed on ..."). The gaps
that caused it are fixed (longbridge#46, longbridge#68); this is a safety net so that the next
one degrades a frame rather than crashing.
TextLayout::prepaint now forwards to fast::text::prepaint_text, which
measures unmeasured text as plain text in the text style in effect at the
prepaint bounds (unconstrained when the width is zero), and paint skips
text that is still not measured and prepainted. Both cases are logged once
as an error, then at debug level.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep the elements' prepaint parameters as upstream names them and drop TextLayout::prepaint, which only forwarded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TextLayout::prepaintunwraps the text's measurement and panics withmeasurement has not been performed on …when there is none. That happens when a text node is marked for remeasuring but no layout computed that frame reaches it, while its element is still prepainted. Two such gaps caused crashes so far:This PR adds a safety net, so the next such gap degrades one frame instead of aborting the app.
Changes
error!the first time in the process,debug!after that.script/upstream-allowlist:elements/text.rsremoved160 → 164.Test plan
fast::tests::text::text_reaching_prepaint_unmeasured_is_measured_there_and_painted: aStyledTextwhose node never joins the computed tree. It panics without the fix and passes with it.cargo test -p gpui --lib fast::tests::: 280 passed.script/check-upstream: 0 violations.v0.1.8(without fast: Restore reparented retained children #68) with a fuzz repro of a list whose rows switch structure, the panic reproduces without this change and is gone with it.Risk
For the frames that fall back, rich text loses its runs (colors, font overrides, decorations) and may wrap differently from its laid-out size.
🤖 Generated with Claude Code