You need to
before you can comment on or make changes to this bug.
Please add APNG support to WebKit. Firefox and Opera already supports this.
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.
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.
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.
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+
Bug 43828 tracks APNG support in Safari (as mentioned above, that's blocked on ImageIO).
Created an attachment (id=192943) [details]
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.
(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.
> + [GTK] [wx] Add APNG support
This issue is not specific to the GTK and wx ports, so it shouldn't have these prefixes.
> +#ifdef PNG_APNG_SUPPORTED
This should read:
Also, all the code introduced to support APNG should be behind this compile flag.
> + , 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.
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.
(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.
Created an attachment (id=196541) [details]
New code is now in
#if ENABLE(APNG) && defined(PNG_APNG_SUPPORTED)
Also added this ENABLE_APNG flag into Source/WTF/wtf/FeatureDefines.h
(From update of attachment 196541 [details])
Did any port actually agree to maintain this? If not, there is no point.
(In reply to comment #11)
> Created an attachment (id=196541) [details] [details]
> New code is now in
> #if ENABLE(APNG) && defined(PNG_APNG_SUPPORTED)
> 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.
(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.