Bug 17022 - Add APNG support
: Add APNG support
Status: NEW
: WebKit
Images
: 528+ (Nightly build)
: All All
: P3 Enhancement
Assigned To:
: http://wiki.mozilla.org/APNG_Specific...
:
:
:
  Show dependency treegraph
 
Reported: 2008-01-26 09:26 PST by
Modified: 2013-04-11 02:32 PST (History)


Attachments
Add APNG support, re-bundle libpng with APNG patch (945.32 KB, patch)
2009-05-28 20:11 PST, Mark Steele
no flags Review Patch | Details | Formatted Diff | Diff
v01_apng_webkit.patch (22.76 KB, patch)
2013-03-13 10:13 PST, Max Stepin
abarth: review-
Review Patch | Details | Formatted Diff | Diff
v02_apng_webkit.patch (23.60 KB, patch)
2013-04-04 15:32 PST, Max Stepin
benjamin: review-
Review Patch | Details | Formatted Diff | Diff


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2008-01-26 09:26:20 PST
Please add APNG support to WebKit. Firefox and Opera already supports this.
------- Comment #1 From 2008-01-26 11:09:57 PST -------
WebKit uses the platform's underlying image libraries for format support, so APNG would need to be implemented there for WebKit to decode it.  This would require ImageIO on Mac/Windows to support it (<rdar://problem/5618737>), and QImage for Qt.  Only the Gtk and wx ports make use of the bare basic image decoders in the WebKit source tree.
------- Comment #2 From 2008-01-26 11:15:04 PST -------
Closer inspection shows that our in-tree PNG decoder is just a wrapper around libpng.  For the Gtk and wx ports to support APNG we would need libpng to support it.
------- Comment #3 From 2008-01-30 08:10:06 PST -------
Incidentally there are patches available for libpng to support apng, but they are still waiting for approval. Time will tell whether WebKit needs to ship a fork of libpng or upstream supports this in the future.

http://littlesvr.ca/apng/
------- Comment #4 From 2009-05-28 20:11:43 PST -------
Created an attachment (id=30764) [details]
Add APNG support, re-bundle libpng with APNG patch

Rough patch to PNGImageDecoder to support APNG.
Bundle libpng with APNG patch.
A few things are missing/broken, but basic support works on Webkit/GTK+
------- Comment #5 From 2010-08-11 02:28:35 PST -------
Bug 43828 tracks APNG support in Safari (as mentioned above, that's blocked on ImageIO).
------- Comment #6 From 2011-04-12 18:01:01 PST -------
want!
------- Comment #7 From 2013-03-13 10:13:50 PST -------
Created an attachment (id=192943) [details]
v01_apng_webkit.patch

If external libpng supports APNG extension, ask libpng to decode animation frames. 

Some Linux distros (Arch, Gentoo, Mageia, etc) ship with apng-patched libpng as a system library. With this patch WebKit would take advantage of that and request libpng to read APNG frames.
------- Comment #8 From 2013-03-20 22:55:22 PST -------
(From update of attachment 192943 [details])
View in context: https://bugs.webkit.org/attachment.cgi?id=192943&action=review

We shouldn't land this patch unless one or more WebKit work wishes to enable this code.  If we're going to accept this patch, we'll also need a number of tests.

> Source/WebCore/ChangeLog:3
> +        [GTK] [wx] Add APNG support

This issue is not specific to the GTK and wx ports, so it shouldn't have these prefixes.

> Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp:108
> +#ifdef PNG_APNG_SUPPORTED

This should read:

#if ENABLE(APNG)

Also, all the code introduced to support APNG should be behind this compile flag.

> Source/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp:241
> +    , m_frameIsHidden(false)
> +    , m_curFrame(0)
> +    , m_loopsCount(0)
> +    , m_delayNum(1)
> +    , m_delayDen(1)
> +    , m_dispose(0)
> +    , m_blend(0)

All this state as well.
------- Comment #9 From 2013-04-01 09:30:35 PST -------
Please do NOT add "apng" support to Webkit. "gif" was a first mistake in design of the web - these days luckily being replaced by proper video one after another. Adding apng works against the combined efforts to build a clean (flash free, GIF free) web where images are images (displayed by webkit itself) and animations are animations (displayed by gstreamer or a similar library which specializes on rendering animations).

Seperation of responsibilities and specialization is the foundation of open source and provides clean, stream-lined concepts. The PNG-developers do not disapprove of apng without a reason.
------- Comment #10 From 2013-04-01 10:07:58 PST -------
(In reply to comment #8)
> We shouldn't land this patch unless one or more WebKit work wishes to enable this code.  If we're going to accept this patch, we'll also need a number of tests.

From Midori's perspective, I'd encourage enabling APNG - if WebKitGTK/ Epiphany team agree. In Archlinux it could work out of the box.
------- Comment #11 From 2013-04-04 15:32:14 PST -------
Created an attachment (id=196541) [details]
v02_apng_webkit.patch

New code is now in 

#if ENABLE(APNG) && defined(PNG_APNG_SUPPORTED)
#endif

Also added this ENABLE_APNG flag into Source/WTF/wtf/FeatureDefines.h
------- Comment #12 From 2013-04-04 15:44:03 PST -------
(From update of attachment 196541 [details])
No tests?

Did any port actually agree to maintain this? If not, there is no point.
------- Comment #13 From 2013-04-07 13:40:55 PST -------
(In reply to comment #11)
> Created an attachment (id=196541) [details] [details]
> v02_apng_webkit.patch
> 
> New code is now in 
> 
> #if ENABLE(APNG) && defined(PNG_APNG_SUPPORTED)
> #endif
> 
> Also added this ENABLE_APNG flag into Source/WTF/wtf/FeatureDefines.h

I would suggest setting ENABLE_APNG based on defined(PNG_APNG_SUPPORTED), that way you don't have to check for both, and ENABLE_APNG will only be set when APNG is supported.
------- Comment #14 From 2013-04-11 02:32:05 PST -------
(In reply to comment #12)
> (From update of attachment 196541 [details] [details])
> No tests?
> 
> Did any port actually agree to maintain this? If not, there is no point.

Hopefully it will not require much maintaince. Though it will need tests, and someone should run a bot with it enabled. I guess for GTK and Qt it will depend on the libpng available on the system.