Skip to content

TextBlock re-shapes its text when only the measure constraint changes #25410

Open

Description

@MartinZikmund

What would you like to be added? 💡

TextBlock.MeasureOverride should keep its current text layout when the TextBlock is measured again only because its parent offers a different constraint, and that layout can't depend on the constraint. This is the case for a single unwrapped, untrimmed line. Arrange already does this check (UnicodeText.IsLayoutValidFor); measure always re-parses and re-shapes the text.

Why is this needed? 🤔

Multi-pass layouts measure TextBlocks several times under different constraints: Grid star sizing, panels that re-measure, constraint flips between states. Each of those measures shapes the text again.

In the ListViewItemPresenter chrome adopted by #25389, the multi-select check box's border thickness changes on every selection. That gives its check glyph a different available size each time (113x17 vs 116x20), so the glyph is re-shaped in measure and again in its centered arrange at every toggle.

For which platforms 📱💻🖥️

Skia (all heads)

Anything else we need to know? 💬

Found while profiling GridView multi-select for #25389.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/performancekind/enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions