feat(AccessKit Disable GIFs): Pause animated webp images #1867
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This applies Disable GIFs to animated WebP images—but not, if possible, to non-animated WebP images—by downloading them and parsing them with the new WebCodecs API.
This intentionally keeps our current behavior of assuming, sometimes incorrectly, that any gif (or gifv) image is animated, as checking if an image is animated involves fetching it, which is kind of expensive.
ImageDecoder is feature detected; in Firefox 128, this falls back to not affecting webp images.
Supersedes #1402 (which vendored a library to do this), #1563 (which paused and put labels on webp images regardless of whether they were animated or not), and #1709 (earlier, essentially-equivalent version of this PR).
Resolves #1401.
Testing steps
Animated WebP: https://www.tumblr.com/changes/758172275271991296/threaded-replies-are-here
Animated GIF: https://www.tumblr.com/@radar/757906400962920448, https://www.tumblr.com/april-codes/700206746833240064
Non-animated GIF: https://www.tumblr.com/@radar/753920129042153472
Non-animated WebP: https://www.tumblr.com/minmos/744793127262601216/front-facing-egrets-making-me-lose-control-of, https://www.tumblr.com/@radar/755279084134744066, https://www.tumblr.com/@radar/750568043810340864
Confirm that: