If the loopCount key/value is present in the GIF Netscape Looping Application Extension, this means loopCount = value + 1. WebKit has been doing this math for long time. Recently the underlying frameworks in macOS and iOS took care of this extra one. All we need is to adopt the new behavior but also to be backward compatible with old versions of macOS and iOS.
Created attachment 407637 [details] Patch
Created attachment 407638 [details] Patch
<rdar://problem/66660579>
Comment on attachment 407638 [details] Patch Can this behavior be tested?
It is tested by fast/images/animated-gif-loop-count.html. Having the EWS passed this test, means the backward-compatible code path is tested on macOS Catalina. I ran this test manually on macOS Big Sur, and it passed as well.
Created attachment 407717 [details] Patch
Committed r266449: <https://trac.webkit.org/changeset/266449> All reviewed patches have been landed. Closing bug and clearing flags on attachment 407717 [details].
Reverted r266449 for reason: Underlying frameworks do not work correctly for loopCount >= 1. Committed r266452: <https://trac.webkit.org/changeset/266452>
<rdar://problem/68304035>
Created attachment 408420 [details] Patch
Committed r266827: <https://trac.webkit.org/changeset/266827> All reviewed patches have been landed. Closing bug and clearing flags on attachment 408420 [details].