Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breaking: Always use AttributedStringBox instead of AttributedString in TextLayoutManager #46104

Closed
wants to merge 1 commit into from

Commits on Aug 20, 2024

  1. Breaking: Always use AttributedStringBox instead of AttributedString …

    …in TextLayoutManager (facebook#46104)
    
    Summary:
    Pull Request resolved: facebook#46104
    
    We want to use `PrecomputedText` to store glyph-level measurements on underlying Android Spannable. This means we need to consistently reuse the same Spannable, instead of recreating them on measurement.
    
    We have an opaque cache ID used by Android, for spannables originating from uncontrolled TextInput on UI-thread side. We also have `AttributedStringBox`, for a kind of similar purpose on iOS, which allows passing opaque pointer to the `TextLayoutManager`. This is only used for the `measure` function.
    
    This change makes us consistently use `AttributedStringBox` at the TextLayoutManager boundary, to let us migrate calls across TextLayoutManager to all pass opaque handle to underlying Spannable we will store, instead of passing the AttributedString each time. For now, every place previously passing an AttributedString value still passes one.
    
    There were also some egregious cases of accepting very large structures by value, causing unneeded copies. I changed the APIs to accept anything potentially larger than two pointers to pass by reference instead.
    
    This change is technically breaking, to any 3p code calling into TextLayoutManager (IIRC live-markdown exposed prefabs for this, but should be able to adapt fairly easily).
    
    Changelog:
    [General][Breaking] - Always use AttributedStringBox instead of AttributedString in TextLayoutManager
    
    Differential Revision: D61484999
    NickGerleman authored and facebook-github-bot committed Aug 20, 2024
    Configuration menu
    Copy the full SHA
    611530c View commit details
    Browse the repository at this point in the history