Skip to content
Permalink
Browse files
[Qt] Non animated gifs are animated in QtWebKit
https://bugs.webkit.org/show_bug.cgi?id=35955

Properly map Qt animated and non-animated values to WebCore's
understanding of animated and non-animated images. Currently
we can not map anything to the cAnimationLoopNone value.

* manual-tests/qt/qt-anim.gif: Added.
* manual-tests/qt/qt-gif-test.html: Added.
* manual-tests/qt/qt-noanim.gif: Added.
* platform/graphics/qt/ImageDecoderQt.cpp:
(WebCore::ImageDecoderQt::repetitionCount):

Canonical link: https://commits.webkit.org/47069@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@55774 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
zecke committed Mar 10, 2010
1 parent 9d11289 commit 936b8cc9630d2820c05446c9e6fb9a111f78f3d1
Showing 5 changed files with 44 additions and 2 deletions.
@@ -1,3 +1,20 @@
2010-03-10 Holger Hans Peter Freyther <zecke@selfish.org>

Reviewed by Simon Hausmann.

[Qt] Non animated gifs are animated in QtWebKit
https://bugs.webkit.org/show_bug.cgi?id=35955

Properly map Qt animated and non-animated values to WebCore's
understanding of animated and non-animated images. Currently
we can not map anything to the cAnimationLoopNone value.

* manual-tests/qt/qt-anim.gif: Added.
* manual-tests/qt/qt-gif-test.html: Added.
* manual-tests/qt/qt-noanim.gif: Added.
* platform/graphics/qt/ImageDecoderQt.cpp:
(WebCore::ImageDecoderQt::repetitionCount):

2010-03-07 Holger Hans Peter Freyther <zecke@selfish.org>

Reviewed by Darin Adler.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,12 @@
<html>
<body>
<div>
<img src="qt-anim.gif">
<p>This should animate</p>
</div>
<div>
<img src="qt-noanim.gif">
<p>This should not animate and you should see a cross</p>
</div
</body>
</html>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -115,8 +115,21 @@ size_t ImageDecoderQt::frameCount()

int ImageDecoderQt::repetitionCount() const
{
if (m_reader && m_reader->supportsAnimation())
m_repetitionCount = qMax(0, m_reader->loopCount());
if (m_reader && m_reader->supportsAnimation()) {
m_repetitionCount = m_reader->loopCount();

// Qt and WebCore have a incompatible understanding of
// the loop count and we can not completely map everything.
// Qt | WebCore | description
// -1 | 0 | infinite animation
// 0 | cAnimationLoopOnce | show every frame once
// n | n | no idea if that is supported
// n/a | cAnimationNone | show only the first frame
if (m_repetitionCount == -1)
m_repetitionCount = 0;
else if (m_repetitionCount == 0)
m_repetitionCount = cAnimationLoopOnce;
}

return m_repetitionCount;
}

0 comments on commit 936b8cc

Please sign in to comment.