* Thu Sep 18 2008 Kevin Kofler <Kevin@tigcc.ticalc.org> 4.1.1-12

- make "Stop Animations" work again in Konqueror (KDE 4 regression kde#157789)
This commit is contained in:
Kevin Kofler 2008-09-19 00:00:20 +00:00
parent 2be06caa01
commit b00824f449
2 changed files with 208 additions and 1 deletions

View File

@ -0,0 +1,199 @@
diff -ur kdelibs-4.1.1/khtml/imload/animprovider.cpp kdelibs-4.1.1-kde#157789/khtml/imload/animprovider.cpp
--- kdelibs-4.1.1/khtml/imload/animprovider.cpp 2008-05-21 13:06:09.000000000 +0200
+++ kdelibs-4.1.1-kde#157789/khtml/imload/animprovider.cpp 2008-09-19 01:00:47.000000000 +0200
@@ -38,6 +38,8 @@
void AnimProvider::switchFrame()
{
+ if (animationAdvice == KHTMLSettings::KAnimationDisabled)
+ return;
shouldSwitchFrame = true;
image->notifyPerformUpdate();
}
@@ -47,6 +49,11 @@
ImageManager::animTimer()->destroyed(this);
}
+void AnimProvider::setShowAnimations(KHTMLSettings::KAnimationAdvice newAdvice)
+{
+ animationAdvice = newAdvice;
+}
+
}
// kate: indent-width 4; replace-tabs on; tab-width 4; space-indent on;
diff -ur kdelibs-4.1.1/khtml/imload/animprovider.h kdelibs-4.1.1-kde#157789/khtml/imload/animprovider.h
--- kdelibs-4.1.1/khtml/imload/animprovider.h 2008-05-21 13:06:09.000000000 +0200
+++ kdelibs-4.1.1-kde#157789/khtml/imload/animprovider.h 2008-09-19 01:04:49.000000000 +0200
@@ -25,6 +25,8 @@
#ifndef ANIM_PROVIDER_H
#define ANIM_PROVIDER_H
+#include <khtml_settings.h>
+
class QPainter;
namespace khtmlImLoad {
@@ -44,11 +46,13 @@
PixmapPlane* curFrame;
Image* image;
bool shouldSwitchFrame; //Set by AnimTimer
+ KHTMLSettings::KAnimationAdvice animationAdvice;
void nextFrame(); //Helper that goes to next frame or wraps around
public:
AnimProvider(PixmapPlane* plane, Image* img):frame0(plane), curFrame(plane),
- image(img), shouldSwitchFrame(false)
+ image(img), shouldSwitchFrame(false),
+ animationAdvice(KHTMLSettings::KAnimationEnabled)
{}
void switchFrame();
@@ -62,6 +66,11 @@
//Must be implemented to paint the given region. Note that clipping to the
//overall canvas will be performed already
virtual void paint(int dx, int dy, QPainter* p, int sx, int sy, int width, int height) = 0;
+
+ /**
+ Enables or disables animations
+ */
+ void setShowAnimations(KHTMLSettings::KAnimationAdvice);
};
}
diff -ur kdelibs-4.1.1/khtml/imload/decoders/gifloader.cpp kdelibs-4.1.1-kde#157789/khtml/imload/decoders/gifloader.cpp
--- kdelibs-4.1.1/khtml/imload/decoders/gifloader.cpp 2008-05-21 13:06:09.000000000 +0200
+++ kdelibs-4.1.1-kde#157789/khtml/imload/decoders/gifloader.cpp 2008-09-19 01:00:59.000000000 +0200
@@ -212,7 +212,11 @@
++frame;
if (frame >= frameInfo.size())
+ {
+ if (animationAdvice == KHTMLSettings::KAnimationLoopOnce)
+ animationAdvice = KHTMLSettings::KAnimationDisabled;
frame = 0;
+ }
nextFrame();
}
diff -ur kdelibs-4.1.1/khtml/imload/image.cpp kdelibs-4.1.1-kde#157789/khtml/imload/image.cpp
--- kdelibs-4.1.1/khtml/imload/image.cpp 2008-05-21 13:06:09.000000000 +0200
+++ kdelibs-4.1.1-kde#157789/khtml/imload/image.cpp 2008-09-19 01:12:02.000000000 +0200
@@ -48,6 +48,7 @@
inError = false;
width = height = 0;
+ animationAdvice = KHTMLSettings::KAnimationEnabled;
noUpdates();
}
@@ -214,6 +215,12 @@
}
else
{
+ for (PixmapPlane* cur = original; cur; cur = cur->nextFrame)
+ {
+ if (cur->animProvider)
+ cur->animProvider->setShowAnimations(animationAdvice);
+ }
+
fullyDecoded = true;
owner->imageDone(this);
}
@@ -452,6 +459,19 @@
return original->parent->format.hasAlpha();
}
+void Image::setShowAnimations(KHTMLSettings::KAnimationAdvice newAdvice)
+{
+ if (animationAdvice != newAdvice)
+ {
+ animationAdvice = newAdvice;
+ for (PixmapPlane* cur = original; cur; cur = cur->nextFrame)
+ {
+ if (cur->animProvider)
+ cur->animProvider->setShowAnimations(newAdvice);
+ }
+ }
+}
+
}
// kate: indent-width 4; replace-tabs on; tab-width 4; space-indent on;
diff -ur kdelibs-4.1.1/khtml/imload/image.h kdelibs-4.1.1-kde#157789/khtml/imload/image.h
--- kdelibs-4.1.1/khtml/imload/image.h 2008-05-21 13:06:09.000000000 +0200
+++ kdelibs-4.1.1-kde#157789/khtml/imload/image.h 2008-09-19 01:09:46.000000000 +0200
@@ -30,6 +30,8 @@
#include <QTimer>
#include <QPair>
#include <QMap>
+
+#include <khtml_settings.h>
#include "imageformat.h"
@@ -92,6 +94,11 @@
(but see CanvasImage)
*/
QImage* qimage() const;
+
+ /**
+ Enables or disables animations
+ */
+ void setShowAnimations(KHTMLSettings::KAnimationAdvice);
private:
//Interface to the loader.
friend class ImageLoader;
@@ -165,6 +172,7 @@
int width, height;
PixmapPlane* original;
QMap<QPair<int, int>, PixmapPlane*> scaled;
+ KHTMLSettings::KAnimationAdvice animationAdvice;
};
diff -ur kdelibs-4.1.1/khtml/misc/loader.cpp kdelibs-4.1.1-kde#157789/khtml/misc/loader.cpp
--- kdelibs-4.1.1/khtml/misc/loader.cpp 2008-08-28 10:08:06.000000000 +0200
+++ kdelibs-4.1.1-kde#157789/khtml/misc/loader.cpp 2008-09-19 01:03:07.000000000 +0200
@@ -422,7 +422,7 @@
m_status = Unknown;
imgSource = 0;
setAccept( acceptHeader );
- m_showAnimations = dl->showAnimations();
+ i->setShowAnimations(dl->showAnimations());
m_loading = true;
if ( KHTMLGlobal::defaultHTMLSettings()->isAdFiltered( url.string() ) ) {
@@ -807,30 +807,8 @@
void CachedImage::setShowAnimations( KHTMLSettings::KAnimationAdvice showAnimations )
{
- (void) showAnimations;
-#if 0
- m_showAnimations = showAnimations;
- if ( (m_showAnimations == KHTMLSettings::KAnimationDisabled) && imgSource ) {
-#ifdef __GNUC__
-#warning QDataSource
-#endif
- // imgSource->cleanBuffer();
- delete p;
- p = new QPixmap(m->framePixmap());
-#ifdef __GNUC__
-#warning QMovie requires different API now
-#endif
- //m->disconnectUpdate( this, SLOT( movieUpdated( const QRect &) ));
- //m->disconnectStatus( this, SLOT( movieStatus( int ) ));
- // m->disconnectResize( this, SLOT( movieResize( const QSize& ) ) );
- QTimer::singleShot(0, this, SLOT( deleteMovie()));
- imgSource = 0;
- }
-#endif
-
-#ifdef __GNUC__
-#warning "Use largeimagelib to disable animation"
-#endif
+ if (i)
+ i->setShowAnimations(showAnimations);
}
// void CachedImage::deleteMovie()

View File

@ -2,7 +2,7 @@
Summary: K Desktop Environment 4 - Libraries
Version: 4.1.1
Release: 11%{?dist}
Release: 12%{?dist}
%if 0%{?fedora} > 8
Name: kdelibs
@ -80,6 +80,10 @@ Patch18: kdelibs-4.1.0-kstandarddirs.patch
# fix running commands in kglobalconfig before KComponentData init (#455130)
Patch19: kdelibs-4.1.0-#455130.patch
Patch20: kdelibs-4.1.1-cmake.patch
# make "Stop Animations" work again in Konqueror
# https://bugs.kde.org/show_bug.cgi?id=157789
# submitted upstream (attached to above bug report)
Patch21: kdelibs-4.1.1-kde#157789.patch
## upstream patches
Patch100: kdelibs-4.1.1-kde#169447-khtml-regression.patch
@ -216,6 +220,7 @@ sed -i -e "s|@@VERSION_RELEASE@@|%{version}-%{release}|" kio/kio/kprotocolmanage
%patch18 -p1 -b .kstandarddirs
%patch19 -p1 -b .#455130
%patch20 -p1 -b .cmake
%patch21 -p1 -b .kde#157789
## upstream patches
%patch100 -p0 -b .kde#169447-khtml-regression
@ -387,6 +392,9 @@ rm -rf %{buildroot}
%changelog
* Thu Sep 18 2008 Kevin Kofler <Kevin@tigcc.ticalc.org> 4.1.1-12
- make "Stop Animations" work again in Konqueror (KDE 4 regression kde#157789)
* Thu Sep 18 2008 Than Ngo <than@redhat.com> 4.1.1-11
- apply upstream patch to fix the regression
- drop the kdelibs-4.1.1-bz#461725-regression.patch