fix: apply ios workarounds and rendering issues and improve image generation performance - #585
fix: apply ios workarounds and rendering issues and improve image generation performance#585FoHoOV wants to merge 34 commits into
Conversation
BREAKING CHANGE: filter callbacks must return keep, unwrap, or remove.
|
👋 @FoHoOV 💖 Thanks for opening this pull request! 💖 Please follow the contributing guidelines. And we use semantic commit messages to streamline the release process. Examples of commit messages with semantic prefixes:
Things that will help get your PR across the finish line:
We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can. |
|
@FoHoOV Please provide us with more info about this pull request title. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #585 +/- ##
=======================================
Coverage 66.50% 66.50%
=======================================
Files 10 10
Lines 612 612
Branches 150 150
=======================================
Hits 407 407
Misses 144 144
Partials 61 61 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This project did not work out of the box for our use case, particularly because most of our users are on iOS.
I initially cloned the repository without preserving its Git history and reworked the implementation to make it compatible with our codebase. These changes have now been tested successfully in production with our user-base, so I am opening this pull request to contribute the relevant improvements upstream.
I also maintain a separate fork with its own build and release process because the original project appears to be unmaintained.
This PR reworks DOM cloning, rendering, resource caching, and iOS-specific compatibility.
I know the pr title is not good, because it cannot capture all of this in one PR title, but as I said, this is all the changes we did in our application in one go :D
Breaking changes
filteris now called for the root element and every descendant. It must returnkeep,unwrap, orremove. Boolean return values are no longer supported.backgroundColoroption. Usestyle.backgroundColorinstead.width,height, and layout-affectingstylevalues are applied before capture, and filtering may change the resulting bounds.Cache.includeQueryParamsnow defaults totrue.Features
Export a reusable, caller-owned
Cachefor images, fonts, stylesheets, and external SVG resources. This avoids retaining fetched resource data globally for the lifetime of the application.Add tri-state filtering with support for:
keep: preserve the element and its children.unwrap: remove the element while preserving its children.remove: remove the element and its descendants.Inline definitions referenced by external SVG
<use>elements, including their transitive dependencies.Capture browser-computed styles from a live, off-screen clone before serialization.
Bug fixes
width,height,object-fit, and related styles when replacing video frames or posters with images.Performance
should fix most ios related issues #569, #556, #579 (but with correct external references) and other similar iOS related issues.