Cache the resulting `TextRun` of a box tree layout in text nodes. This allows reusing shaping results between box tree layouts. Currently, these shaping results were stored in a cache in the `Font`, but this avoids having to hash the entire string. In addition to avoiding the performance cost of that hash, this opens up the path to two future changes: 1. Only caching short strings: This further reduces the performance cost of the shaping cache and matches what Blink does. 2. Moving line breaking out of shaping: This should reduce the memory usage of unbreakable shaped text slices and also allow for more easily implementing break-anywhere type CSS features. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Simon Sapin <simon@igalia.com>
mrobinson marked this pull request as ready for review
May 7, 2026 18:18mrobinson deleted the inline-3-reuse-shaping-results branch
May 7, 2026 19:09