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

Restore broken functionality and simplify the implementation in src/display/text_layer.js #18052

Merged

Commits on May 7, 2024

  1. Unify the ReadableStream and TextContent code-paths in `src/displ…

    …ay/text_layer.js`
    
    The only reason that this code still accepts `TextContent` is for backward-compatibility purposes, so we can simplify the implementation by always using a `ReadableStream` internally.
    Snuffleupagus committed May 7, 2024
    Configuration menu
    Copy the full SHA
    049848b View commit details
    Browse the repository at this point in the history
  2. Ensure that the textLayer styleCache is always cleared, even on fai…

    …lure
    
    By also moving it to the `TextLayerRenderTask`-instance, we can avoid a bit of manual parameter passing.
    Snuffleupagus committed May 7, 2024
    Configuration menu
    Copy the full SHA
    30840e4 View commit details
    Browse the repository at this point in the history
  3. Restore the MAX_TEXT_DIVS_TO_RENDER limit in the textLayer

    This limit is currently completely non-functional, since the check happens *after* the entire textLayer has been parsed and appended to the DOM. It seems that this has been *accidentally* broken ever since the introduction of `ReadableStream` support.
    The reason that this hasn't caused noticeable textLayer-related performance issues in practice is probably because we nowadays manage to coalesce the textLayer into fewer overall DOM elements, whereas years ago many PDF documents ended up with one DOM element *per* glyph.
    
    By moving this check, and thus restoring the functionality, we're also able to remove the `render` helper function and simplify the code.
    Snuffleupagus committed May 7, 2024
    Configuration menu
    Copy the full SHA
    8d86e18 View commit details
    Browse the repository at this point in the history