Bug 216018

Summary: [CG] REGRESSION (Big Sur): A GIF image with a finite loopCount loops an extra cycle
Product: WebKit Reporter: Said Abou-Hallawa <sabouhallawa>
Component: ImagesAssignee: Said Abou-Hallawa <sabouhallawa>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, cdumez, cmarcelo, ews-watchlist, simon.fraser, thorton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch none

Description Said Abou-Hallawa 2020-08-31 16:41:44 PDT
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.
Comment 1 Said Abou-Hallawa 2020-08-31 16:56:57 PDT
Created attachment 407637 [details]
Patch
Comment 2 Said Abou-Hallawa 2020-08-31 16:58:45 PDT
Created attachment 407638 [details]
Patch
Comment 3 Said Abou-Hallawa 2020-08-31 16:59:21 PDT
<rdar://problem/66660579>
Comment 4 Alexey Proskuryakov 2020-08-31 18:40:35 PDT
Comment on attachment 407638 [details]
Patch

Can this behavior be tested?
Comment 5 Said Abou-Hallawa 2020-08-31 18:47:14 PDT
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.
Comment 6 Said Abou-Hallawa 2020-09-01 16:04:38 PDT
Created attachment 407717 [details]
Patch
Comment 7 EWS 2020-09-01 20:13:33 PDT
Committed r266449: <https://trac.webkit.org/changeset/266449>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 407717 [details].
Comment 8 Said Abou-Hallawa 2020-09-02 01:04:58 PDT
Reverted r266449 for reason:

Underlying frameworks do not work correctly for loopCount >= 1.

Committed r266452: <https://trac.webkit.org/changeset/266452>
Comment 9 Said Abou-Hallawa 2020-09-03 15:10:59 PDT
<rdar://problem/68304035>
Comment 10 Said Abou-Hallawa 2020-09-10 01:09:44 PDT
Created attachment 408420 [details]
Patch
Comment 11 EWS 2020-09-10 08:57:58 PDT
Committed r266827: <https://trac.webkit.org/changeset/266827>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 408420 [details].