[prev in list] [next in list] [prev in thread] [next in thread]
List: konq-bugs
Subject: [Bug 91240] konqueror sends commands to X server,
From: Martin Koller <m.koller () surfeu ! at>
Date: 2006-12-31 0:37:47
Message-ID: 20061231003747.9501.qmail () ktown ! kde ! org
[Download RAW message or body]
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=91240
m.koller surfeu at changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
------- Additional Comments From m.koller surfeu at 2006-12-31 01:37 -------
SVN commit 618069 by mkoller:
BUG: 91240
Pause animations whenever a HTML view is hidden and resume animations
when it's shown again. This greatly reduces CPU usage when there are
a lot of animated images in hidden tabs or minimized windows
M +5 -0 khtmlview.cpp
M +33 -0 misc/loader.cpp
M +4 -0 misc/loader.h
--- branches/KDE/3.5/kdelibs/khtml/khtmlview.cpp #618068:618069
@ -50,6 +50,7 @
#include "css/csshelper.h"
#include "misc/htmlhashes.h"
#include "misc/helper.h"
+#include "misc/loader.h"
#include "khtml_settings.h"
#include "khtml_printsettings.h"
@ -571,11 +572,15 @
void KHTMLView::hideEvent(QHideEvent* e)
{
QScrollView::hideEvent(e);
+ if ( m_part && m_part->xmlDocImpl() )
+ m_part->xmlDocImpl()->docLoader()->pauseAnimations();
}
void KHTMLView::showEvent(QShowEvent* e)
{
QScrollView::showEvent(e);
+ if ( m_part && m_part->xmlDocImpl() )
+ m_part->xmlDocImpl()->docLoader()->resumeAnimations();
}
void KHTMLView::resizeEvent (QResizeEvent* e)
--- branches/KDE/3.5/kdelibs/khtml/misc/loader.cpp #618068:618069
@ -794,6 +794,17 @
}
}
+void CachedImage::pauseAnimations()
+{
+ if ( m ) m->pause();
+}
+
+void CachedImage::resumeAnimations()
+{
+ if ( m ) m->unpause();
+}
+
+
void CachedImage::deleteMovie()
{
delete m; m = 0;
@ -1088,6 +1099,28 @
}
}
+void DocLoader::pauseAnimations()
+{
+ for ( QPtrDictIterator<CachedObject> it( m_docObjects ); it.current(); ++it )
+ if ( it.current()->type() == CachedObject::Image )
+ {
+ CachedImage *img = const_cast<CachedImage*>( static_cast<const CachedImage *>( it.current() ) );
+
+ img->pauseAnimations();
+ }
+}
+
+void DocLoader::resumeAnimations()
+{
+ for ( QPtrDictIterator<CachedObject> it( m_docObjects ); it.current(); ++it )
+ if ( it.current()->type() == CachedObject::Image )
+ {
+ CachedImage *img = const_cast<CachedImage*>( static_cast<const CachedImage *>( it.current() ) );
+
+ img->resumeAnimations();
+ }
+}
+
// ------------------------------------------------------------------------------------------
Loader::Loader() : QObject()
--- branches/KDE/3.5/kdelibs/khtml/misc/loader.h #618068:618069
@ -287,6 +287,8 @
#endif
void setShowAnimations( KHTMLSettings::KAnimationAdvice );
+ void pauseAnimations();
+ void resumeAnimations();
virtual bool schedule() const { return true; }
@ -363,6 +365,8 @
void setAutoloadImages( bool );
void setCachePolicy( KIO::CacheControl cachePolicy ) { m_cachePolicy = cachePolicy; }
void setShowAnimations( KHTMLSettings::KAnimationAdvice );
+ void pauseAnimations();
+ void resumeAnimations();
void insertCachedObject( CachedObject* o ) const;
void removeCachedObject( CachedObject* o) const { m_docObjects.remove( o ); }
_______________________________________________
Konq-bugs mailing list
Konq-bugs@mail.kde.org
https://mail.kde.org/mailman/listinfo/konq-bugs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic