--Boundary-00=_qzvSHoWBV+PbR/q Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline We've always gotten some trouble from the fact that KHTMLFactory has a dual purpose; being the KParts::Factory (when khtmlpart is dlopened, e.g. in konqueror), and being the repository for a bunch of global things needed by khtml. I've separated those two things, creating a KHTMLGlobal for the global stuff and leaving the KHTMLFactory to being the kparts factory only. It solves some life-cycle issues and allows to remove the ugly bool clone from the constructor. Apart from that the patch is mainly a s/KHTMLFactory::/KHTMLGlobal::/ everywhere since the khtml code only cares about those global things, not about the actual factory. But I also improved the refcounting mechanism which is now in KHTMLGlobal, so that we can debug the famous assert a bit more easily: ref/deref are no more public, the API is now limited to registerPart/deregisterPart and registerDocumentImpl/deregisterDocumentImpl. This allows to be more verbose when the assert fails and to say: konqueror(31854)/khtml KHTMLGlobal::finalCheck: 1 docs not deleted konqueror(31854)/khtml KHTMLGlobal::finalCheck: Document DOM::HTMLDocumentImpl(0x10f8330) wasn't deleted OK, I still have on idea why the documentimpl itself has one ref too many so KHTMLPart::clear() unrefs it but doesn't destroy it, but at least I'm more confident about the KHTMLFactory/KHTMLGlobal side of things now :) OK with me committing? (BTW KHTMLFactory was exported but not installed, it was only used by testkhtml and test_regression, which I ported; this change is completely SC/BC). After that, I'll try to keep debugging the assert, but I'm not sure how.... -- David Faure, faure@kde.org, sponsored by Trolltech to work on KDE, Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org). --Boundary-00=_qzvSHoWBV+PbR/q Content-Type: text/x-diff; charset="us-ascii"; name="khtmlfactory.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="khtmlfactory.diff" Index: khtml_settings.cc =================================================================== --- khtml_settings.cc (revision 741807) +++ khtml_settings.cc (working copy) @@ -59,6 +59,7 @@ struct KPerDomainSettings { #endif }; +QString *KHTMLSettings::avFamilies = 0; typedef QMap PolicyMap; class KHTMLSettingsPrivate Index: khtml_settings.h =================================================================== --- khtml_settings.h (revision 741807) +++ khtml_settings.h (working copy) @@ -222,7 +222,7 @@ public: bool jsPopupBlockerPassivePopup() const; private: - friend class KHTMLFactory; + friend class KHTMLGlobal; QString lookupFont(int i) const; KHTMLSettingsPrivate* const d; Index: khtmlview.cpp =================================================================== --- khtmlview.cpp (revision 741807) +++ khtmlview.cpp (working copy) @@ -247,10 +247,9 @@ public: accessKeysActivated = false; accessKeysPreActivate = false; - // We ref/deref to ensure defaultHTMLSettings is available - KHTMLFactory::ref(); - accessKeysEnabled = KHTMLFactory::defaultHTMLSettings()->accessKeysEnabled(); - KHTMLFactory::deref(); + // defaultHTMLSettings is available since a KHTMLPart has been created first + // and has ref()'ed the factory for us. + accessKeysEnabled = KHTMLGlobal::defaultHTMLSettings()->accessKeysEnabled(); emitCompletedAfterRepaint = CSNone; m_mouseEventsTarget = 0; @@ -555,6 +554,7 @@ void KHTMLView::delayedInit() setHasStaticBackground(); } +// called by KHTMLPart::clear() void KHTMLView::clear() { #ifndef KHTML_NO_CARET @@ -1353,7 +1353,7 @@ void KHTMLView::mouseMoveEvent( QMouseEv case LINK_NEWWINDOW: cursorIcon = "window-new"; break; default: cursorIcon = "dialog-error"; break; } - QPixmap icon_pixmap = KHTMLFactory::iconLoader()->loadIcon( cursorIcon, KIconLoader::Small, 0, KIconLoader::DefaultState, QStringList(), 0, true ); + QPixmap icon_pixmap = KHTMLGlobal::iconLoader()->loadIcon( cursorIcon, KIconLoader::Small, 0, KIconLoader::DefaultState, QStringList(), 0, true ); #if 0 if (d->cursor_icon_widget) Index: testkhtml.cpp =================================================================== --- testkhtml.cpp (revision 741807) +++ testkhtml.cpp (working copy) @@ -20,12 +20,10 @@ #include "dom/html_document.h" #include "dom/dom_exception.h" #include -#define protected public -#include "khtml_factory.h" -#undef protected #include "css/cssstyleselector.h" #include "html/html_imageimpl.h" #include "rendering/render_style.h" +#include "khtml_global.h" #include #include #include @@ -49,9 +47,7 @@ int main(int argc, char *argv[]) ::exit( 1 ); } -#ifndef __KDE_HAVE_GCC_VISIBILITY - KHTMLFactory *fac = new KHTMLFactory(true); -#endif + KHTMLGlobal *fac = new KHTMLGlobal; KXmlGuiWindow *toplevel = new KXmlGuiWindow(); KHTMLPart *doc = new KHTMLPart( toplevel, toplevel, KHTMLPart::BrowserViewGUI ); @@ -127,9 +123,7 @@ int main(int argc, char *argv[]) int ret = a.exec(); -#ifndef __KDE_HAVE_GCC_VISIBILITY - fac->deref(); -#endif + delete fac; return ret; } Index: misc/loader.cpp =================================================================== --- misc/loader.cpp (revision 741807) +++ misc/loader.cpp (working copy) @@ -69,8 +69,9 @@ #include #include #include -#include "khtml_factory.h" -#include "khtml_part.h" + +#include +#include #ifdef IMAGE_TITLES #include @@ -406,7 +407,7 @@ CachedImage::CachedImage(DocLoader* dl, setAccept( acceptHeader ); m_showAnimations = dl->showAnimations(); - if ( KHTMLFactory::defaultHTMLSettings()->isAdFiltered( url.string() ) ) { + if ( KHTMLGlobal::defaultHTMLSettings()->isAdFiltered( url.string() ) ) { m_wasBlocked = true; CachedObject::finish(); } @@ -1118,8 +1119,8 @@ CachedCSSStyleSheet *DocLoader::requestS CachedScript *DocLoader::requestScript( const DOM::DOMString &url, const QString& charset) { DOCLOADER_SECCHECK(true); - if ( ! KHTMLFactory::defaultHTMLSettings()->isJavaScriptEnabled(fullURL.host()) || - KHTMLFactory::defaultHTMLSettings()->isAdFiltered(fullURL.url())) + if ( ! KHTMLGlobal::defaultHTMLSettings()->isJavaScriptEnabled(fullURL.host()) || + KHTMLGlobal::defaultHTMLSettings()->isAdFiltered(fullURL.url())) return 0L; CachedScript* s = Cache::requestObject( this, fullURL, 0 ); @@ -1443,7 +1444,7 @@ void Cache::init() nullPixmap = new QPixmap; if ( !brokenPixmap ) - brokenPixmap = new QPixmap(KHTMLFactory::iconLoader()->loadIcon("image-missing", KIconLoader::Desktop, 16, KIconLoader::DisabledState)); + brokenPixmap = new QPixmap(KHTMLGlobal::iconLoader()->loadIcon("image-missing", KIconLoader::Desktop, 16, KIconLoader::DisabledState)); if ( !blockedPixmap ) { blockedPixmap = new QPixmap(); Index: khtmlview.h =================================================================== Index: khtml_factory_init.cpp =================================================================== --- khtml_factory_init.cpp (revision 741807) +++ khtml_factory_init.cpp (working copy) @@ -1,38 +0,0 @@ -/* This file is part of the KDE project - * - * Copyright (C) 2000 Simon Hausmann - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "khtml_factory.h" - -extern "C" KDE_EXPORT void *init_libkhtmlpart() -{ - // We can't use a plain self() here, because that would - // return the global factory, which might already exist - // at the time init_libkhtmlpart is called! As soon as someone - // does new KHTMLPart() in his application and loads up - // an html document into that part which either embeds - // embeds another KHTMLPart instance via or - // as html frame, then we cannot return self(), as - // what we return here is what the KLibLoader deletes - // in the end, and we don't want the libloader to - // delete our global instance. Anyway, the new - // KHTMLFactory we create here is very cheap :) - // (Simon) - return new KHTMLFactory( true ); -} Index: khtmlpart_p.h =================================================================== --- khtmlpart_p.h (revision 741807) +++ khtmlpart_p.h (working copy) @@ -42,7 +42,7 @@ #include "html/html_formimpl.h" #include "khtml_run.h" -#include "khtml_factory.h" +#include "khtml_global.h" #include "khtml_events.h" #include "khtml_ext.h" #include "khtml_settings.h" @@ -151,7 +151,7 @@ public: m_bLoadEventEmitted = true; m_cachePolicy = KIO::CC_Verify; m_manager = 0L; - m_settings = new KHTMLSettings(*KHTMLFactory::defaultHTMLSettings()); + m_settings = new KHTMLSettings(*KHTMLGlobal::defaultHTMLSettings()); m_bClearing = false; m_bCleared = false; m_zoomFactor = 100; Index: khtml_ext.cpp =================================================================== --- khtml_ext.cpp (revision 741807) +++ khtml_ext.cpp (working copy) @@ -59,7 +59,7 @@ #include #include #include -#include "khtml_factory.h" +#include "khtml_global.h" #include #include #include @@ -611,7 +611,7 @@ KHTMLPopupGUIClient::KHTMLPopupGUIClient action->setSeparator(true); menu->addAction(action); - if ( KHTMLFactory::defaultHTMLSettings()->isAdFilterEnabled() ) { + if ( KHTMLGlobal::defaultHTMLSettings()->isAdFilterEnabled() ) { if ( khtml->d->m_frame->m_type == khtml::ChildFrame::IFrame ) { action = new KAction( i18n( "Block IFrame..." ), this ); d->m_actionCollection->addAction( "blockiframe", action ); @@ -671,7 +671,7 @@ KHTMLPopupGUIClient::KHTMLPopupGUIClient connect( action, SIGNAL(triggered(bool)), this, SLOT( slotViewImage() ) ); partActions.append(action); - if (KHTMLFactory::defaultHTMLSettings()->isAdFilterEnabled()) { + if (KHTMLGlobal::defaultHTMLSettings()->isAdFilterEnabled()) { action = new KAction( i18n( "Block Image..." ), this ); d->m_actionCollection->addAction( "blockimage", action ); connect( action, SIGNAL(triggered(bool)), this, SLOT( slotBlockImage() ) ); @@ -750,7 +750,7 @@ void KHTMLPopupGUIClient::slotSaveImageA void KHTMLPopupGUIClient::slotBlockHost() { QString name=d->m_imageURL.protocol()+"://"+d->m_imageURL.host()+"/*"; - KHTMLFactory::defaultHTMLSettings()->addAdFilter( name ); + KHTMLGlobal::defaultHTMLSettings()->addAdFilter( name ); d->m_khtml->reparseConfiguration(); } @@ -763,7 +763,7 @@ void KHTMLPopupGUIClient::slotBlockImage d->m_imageURL.url(), &ok); if ( ok ) { - KHTMLFactory::defaultHTMLSettings()->addAdFilter( url ); + KHTMLGlobal::defaultHTMLSettings()->addAdFilter( url ); d->m_khtml->reparseConfiguration(); } } @@ -776,7 +776,7 @@ void KHTMLPopupGUIClient::slotBlockIFram d->m_khtml->url().url(), &ok ); if ( ok ) { - KHTMLFactory::defaultHTMLSettings()->addAdFilter( url ); + KHTMLGlobal::defaultHTMLSettings()->addAdFilter( url ); d->m_khtml->reparseConfiguration(); } } Index: khtml_global.h =================================================================== --- khtml_global.h (revision 0) +++ khtml_global.h (revision 0) @@ -0,0 +1,84 @@ +/* This file is part of the KDE project + * + * Copyright (C) 2000 Simon Hausmann + * Copyright (C) 2007 David Faure + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef KHTML_GLOBAL_H +#define KHTML_GLOBAL_H + +#include + +#include +#include + +class KComponentData; +class KIconLoader; +class KAboutData; +class HistoryProvider; +class KHTMLSettings; +class KHTMLPart; + +namespace DOM +{ + class DocumentImpl; +} + +/** + * @internal + * Exported for khtml test programs, but not installed + */ +class KHTML_EXPORT KHTMLGlobal +{ +public: + KHTMLGlobal(); + ~KHTMLGlobal(); + + static void registerPart( KHTMLPart *part ); + static void deregisterPart( KHTMLPart *part ); + + static void registerDocumentImpl( DOM::DocumentImpl *doc ); + static void deregisterDocumentImpl( DOM::DocumentImpl *doc ); + + static const KComponentData &componentData(); + static KIconLoader *iconLoader(); + + static KHTMLSettings *defaultHTMLSettings(); + + // list of visited URLs + static KParts::HistoryProvider *vLinks() { + return KParts::HistoryProvider::self(); + } + + // Called when khtml part is unloaded + static void finalCheck(); + +private: + static void ref(); + static void deref(); +private: + static unsigned long s_refcnt; + static KHTMLGlobal *s_self; + static KComponentData *s_componentData; + static KIconLoader *s_iconLoader; + static KAboutData *s_about; + static KHTMLSettings *s_settings; +}; + +#endif + Index: khtml_part.cpp =================================================================== --- khtml_part.cpp (revision 741807) +++ khtml_part.cpp (working copy) @@ -57,6 +57,7 @@ using namespace DOM; #include "khtmlview.h" #include +#include #include "ecma/kjs_proxy.h" #include "ecma/kjs_window.h" #include "khtml_settings.h" @@ -209,10 +210,10 @@ KHTMLPart::KHTMLPart( QWidget *parentWid : KParts::ReadOnlyPart( parent ) { d = 0; - KHTMLFactory::registerPart( this ); - setComponentData( KHTMLFactory::componentData(), prof == BrowserViewGUI && !parentPart() ); + KHTMLGlobal::registerPart( this ); + setComponentData( KHTMLGlobal::componentData(), prof == BrowserViewGUI && !parentPart() ); // TODO KDE4 - don't load plugins yet - //setComponentData( KHTMLFactory::componentData(), false ); + //setComponentData( KHTMLGlobal::componentData(), false ); init( new KHTMLView( this, parentWidget ), prof ); } @@ -220,10 +221,10 @@ KHTMLPart::KHTMLPart( KHTMLView *view, Q : KParts::ReadOnlyPart( parent ) { d = 0; - KHTMLFactory::registerPart( this ); - setComponentData( KHTMLFactory::componentData(), prof == BrowserViewGUI && !parentPart() ); + KHTMLGlobal::registerPart( this ); + setComponentData( KHTMLGlobal::componentData(), prof == BrowserViewGUI && !parentPart() ); // TODO KDE4 - don't load plugins yet - //setComponentData( KHTMLFactory::componentData(), false ); + //setComponentData( KHTMLGlobal::componentData(), false ); assert( view ); init( view, prof ); } @@ -467,7 +468,7 @@ void KHTMLPart::init( KHTMLView *view, G KHTMLPart::~KHTMLPart() { - //kDebug(6050) << "KHTMLPart::~KHTMLPart " << this; + kDebug(6050) << this; KConfigGroup config( KGlobal::config(), "HTML Settings" ); config.writeEntry( "AutomaticDetectionLanguage", int(d->m_autoDetectLanguage) ); @@ -515,7 +516,7 @@ KHTMLPart::~KHTMLPart() if (!parentPart()) // only delete d->m_frame if the top khtml_part closes delete d->m_frame; delete d; d = 0; - KHTMLFactory::deregisterPart( this ); + KHTMLGlobal::deregisterPart( this ); } bool KHTMLPart::restoreURL( const KUrl &url ) @@ -539,10 +540,10 @@ bool KHTMLPart::restoreURL( const KUrl & d->m_workingURL = url; // set the java(script) flags according to the current host. - d->m_bJScriptEnabled = KHTMLFactory::defaultHTMLSettings()->isJavaScriptEnabled(url.host()); - setDebugScript( KHTMLFactory::defaultHTMLSettings()->isJavaScriptDebugEnabled() ); - d->m_bJavaEnabled = KHTMLFactory::defaultHTMLSettings()->isJavaEnabled(url.host()); - d->m_bPluginsEnabled = KHTMLFactory::defaultHTMLSettings()->isPluginsEnabled(url.host()); + d->m_bJScriptEnabled = KHTMLGlobal::defaultHTMLSettings()->isJavaScriptEnabled(url.host()); + setDebugScript( KHTMLGlobal::defaultHTMLSettings()->isJavaScriptDebugEnabled() ); + d->m_bJavaEnabled = KHTMLGlobal::defaultHTMLSettings()->isJavaEnabled(url.host()); + d->m_bPluginsEnabled = KHTMLGlobal::defaultHTMLSettings()->isPluginsEnabled(url.host()); setUrl(url); @@ -602,7 +603,7 @@ bool KHTMLPart::openUrl( const KUrl &url if (userAgent != KProtocolManager::userAgentForHost(QString())) { if (!d->m_statusBarUALabel) { d->m_statusBarUALabel = new KUrlLabel(d->m_statusBarExtension->statusBar()); - d->m_statusBarUALabel->setFixedHeight(KHTMLFactory::iconLoader()->currentSize(KIconLoader::Small)); + d->m_statusBarUALabel->setFixedHeight(KHTMLGlobal::iconLoader()->currentSize(KIconLoader::Small)); d->m_statusBarUALabel->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); d->m_statusBarUALabel->setUseCursor(false); d->m_statusBarExtension->addStatusBarItem(d->m_statusBarUALabel, 0, false); @@ -752,10 +753,10 @@ bool KHTMLPart::openUrl( const KUrl &url d->m_statusBarText[BarOverrideText] = d->m_statusBarText[BarDefaultText] = QString(); // set the javascript flags according to the current url - d->m_bJScriptEnabled = KHTMLFactory::defaultHTMLSettings()->isJavaScriptEnabled(url.host()); - setDebugScript( KHTMLFactory::defaultHTMLSettings()->isJavaScriptDebugEnabled() ); - d->m_bJavaEnabled = KHTMLFactory::defaultHTMLSettings()->isJavaEnabled(url.host()); - d->m_bPluginsEnabled = KHTMLFactory::defaultHTMLSettings()->isPluginsEnabled(url.host()); + d->m_bJScriptEnabled = KHTMLGlobal::defaultHTMLSettings()->isJavaScriptEnabled(url.host()); + setDebugScript( KHTMLGlobal::defaultHTMLSettings()->isJavaScriptDebugEnabled() ); + d->m_bJavaEnabled = KHTMLGlobal::defaultHTMLSettings()->isJavaEnabled(url.host()); + d->m_bPluginsEnabled = KHTMLGlobal::defaultHTMLSettings()->isPluginsEnabled(url.host()); connect( d->m_job, SIGNAL( speed( KJob*, unsigned long ) ), @@ -1863,10 +1864,10 @@ void KHTMLPart::begin( const KUrl &url, if(url.isValid()) { QString urlString = url.url(); - KHTMLFactory::vLinks()->insert( urlString ); + KHTMLGlobal::vLinks()->insert( urlString ); QString urlString2 = url.prettyUrl(); if ( urlString != urlString2 ) { - KHTMLFactory::vLinks()->insert( urlString2 ); + KHTMLGlobal::vLinks()->insert( urlString2 ); } } @@ -1907,14 +1908,14 @@ void KHTMLPart::begin( const KUrl &url, if (!d->m_doc->attached()) d->m_doc->attach( ); d->m_doc->setBaseURL( KUrl() ); - d->m_doc->docLoader()->setShowAnimations( KHTMLFactory::defaultHTMLSettings()->showAnimations() ); + d->m_doc->docLoader()->setShowAnimations( KHTMLGlobal::defaultHTMLSettings()->showAnimations() ); emit docCreated(); d->m_paUseStylesheet->setItems(QStringList()); d->m_paUseStylesheet->setEnabled( false ); - setAutoloadImages( KHTMLFactory::defaultHTMLSettings()->autoLoadImages() ); - QString userStyleSheet = KHTMLFactory::defaultHTMLSettings()->userStyleSheet(); + setAutoloadImages( KHTMLGlobal::defaultHTMLSettings()->autoLoadImages() ); + QString userStyleSheet = KHTMLGlobal::defaultHTMLSettings()->userStyleSheet(); if ( !userStyleSheet.isEmpty() ) setUserStyleSheet( KUrl( userStyleSheet ) ); @@ -4568,7 +4569,7 @@ KParts::ReadOnlyPart *KHTMLPart::createP { KService::Ptr service = (*it); - KPluginLoader loader( *service, KHTMLFactory::componentData() ); + KPluginLoader loader( *service, KHTMLGlobal::componentData() ); KPluginFactory* const factory = loader.factory(); if ( factory ) { KParts::ReadOnlyPart *res = 0L; @@ -5803,7 +5804,7 @@ void KHTMLPart::slotLoadImages() void KHTMLPart::reparseConfiguration() { - KHTMLSettings *settings = KHTMLFactory::defaultHTMLSettings(); + KHTMLSettings *settings = KHTMLGlobal::defaultHTMLSettings(); settings->init(); setAutoloadImages( settings->autoLoadImages() ); @@ -5819,14 +5820,14 @@ void KHTMLPart::reparseConfiguration() d->m_metaRefreshEnabled = settings->isAutoDelayedActionsEnabled (); delete d->m_settings; - d->m_settings = new KHTMLSettings(*KHTMLFactory::defaultHTMLSettings()); + d->m_settings = new KHTMLSettings(*KHTMLGlobal::defaultHTMLSettings()); QApplication::setOverrideCursor( Qt::WaitCursor ); khtml::CSSStyleSelector::reparseConfiguration(); if(d->m_doc) d->m_doc->updateStyleSelector(); QApplication::restoreOverrideCursor(); - if (KHTMLFactory::defaultHTMLSettings()->isAdFilterEnabled()) + if (KHTMLGlobal::defaultHTMLSettings()->isAdFilterEnabled()) runAdFilter(); } @@ -6649,13 +6650,13 @@ void KHTMLPart::runAdFilter() if ( obj->type() == khtml::CachedObject::Image ) { khtml::CachedImage *image = static_cast(obj); bool wasBlocked = image->m_wasBlocked; - image->m_wasBlocked = KHTMLFactory::defaultHTMLSettings()->isAdFiltered( d->m_doc->completeURL( image->url().string() ) ); + image->m_wasBlocked = KHTMLGlobal::defaultHTMLSettings()->isAdFiltered( d->m_doc->completeURL( image->url().string() ) ); if ( image->m_wasBlocked != wasBlocked ) image->do_notify(QRect(QPoint(0,0), image->pixmap_size())); } } - if ( KHTMLFactory::defaultHTMLSettings()->isHideAdsEnabled() ) { + if ( KHTMLGlobal::defaultHTMLSettings()->isHideAdsEnabled() ) { for ( NodeImpl *nextNode, *node = d->m_doc; node; node = nextNode ) { // We might be deleting 'node' shortly. @@ -6665,7 +6666,7 @@ void KHTMLPart::runAdFilter() node->id() == ID_IFRAME || (node->id() == ID_INPUT && static_cast(node)->inputType() == HTMLInputElementImpl::IMAGE )) { - if ( KHTMLFactory::defaultHTMLSettings()->isAdFiltered( d->m_doc->completeURL( static_cast(node)->getAttribute(ATTR_SRC).string() ) ) ) + if ( KHTMLGlobal::defaultHTMLSettings()->isAdFiltered( d->m_doc->completeURL( static_cast(node)->getAttribute(ATTR_SRC).string() ) ) ) { // We found an IMG, IFRAME or INPUT (of type IMAGE) matching a filter. node->ref(); @@ -7113,7 +7114,7 @@ void KHTMLPart::walletOpened(KWallet::Wa if (!d->m_statusBarWalletLabel) { d->m_statusBarWalletLabel = new KUrlLabel(d->m_statusBarExtension->statusBar()); - d->m_statusBarWalletLabel->setFixedHeight(KHTMLFactory::iconLoader()->currentSize(KIconLoader::Small)); + d->m_statusBarWalletLabel->setFixedHeight(KHTMLGlobal::iconLoader()->currentSize(KIconLoader::Small)); d->m_statusBarWalletLabel->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); d->m_statusBarWalletLabel->setUseCursor(false); d->m_statusBarExtension->addStatusBarItem(d->m_statusBarWalletLabel, 0, false); @@ -7248,7 +7249,7 @@ void KHTMLPart::setSuppressedPopupIndica if ( enable && !d->m_statusBarPopupLabel ) { d->m_statusBarPopupLabel = new KUrlLabel( d->m_statusBarExtension->statusBar() ); - d->m_statusBarPopupLabel->setFixedHeight( KHTMLFactory::iconLoader()->currentSize( KIconLoader::Small) ); + d->m_statusBarPopupLabel->setFixedHeight( KHTMLGlobal::iconLoader()->currentSize( KIconLoader::Small) ); d->m_statusBarPopupLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed )); d->m_statusBarPopupLabel->setUseCursor( false ); d->m_statusBarExtension->addStatusBarItem( d->m_statusBarPopupLabel, 0, false ); Index: khtml_factory.cpp =================================================================== --- khtml_factory.cpp (revision 741807) +++ khtml_factory.cpp (working copy) @@ -1,6 +1,7 @@ /* This file is part of the KDE project * * Copyright (C) 2000 Simon Hausmann + * Copyright (C) 2007 David Faure * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -19,81 +20,24 @@ */ #include "khtml_factory.h" +#include "khtml_global.h" #include "khtml_part.h" -#include "khtml_settings.h" -#include "css/cssstyleselector.h" -#include "html/html_imageimpl.h" -#include "rendering/render_style.h" -#include "rendering/break_lines.h" -#include "misc/loader.h" -#include "misc/arena.h" -#include "misc/paintbuffer.h" - -#include - -#include -#include -#include -#include - -#include - -#include - -KHTMLFactory *KHTMLFactory::s_self = 0; -unsigned long int KHTMLFactory::s_refcnt = 0; -KComponentData *KHTMLFactory::s_componentData = 0; -KIconLoader *KHTMLFactory::s_iconLoader = 0; -KAboutData *KHTMLFactory::s_about = 0; -KHTMLSettings *KHTMLFactory::s_settings = 0; -QLinkedList *KHTMLFactory::s_parts = 0; -QString *KHTMLSettings::avFamilies = 0; - -KHTMLFactory::KHTMLFactory( bool clone ) +KHTMLFactory::KHTMLFactory() { - if ( clone ) - ref(); + kDebug(6000) << this; } KHTMLFactory::~KHTMLFactory() { - if ( s_self == this ) - { - assert( !s_refcnt ); - - delete s_iconLoader; - delete s_componentData; - delete s_about; - delete s_settings; - delete KHTMLSettings::avFamilies; - if ( s_parts ) - { - assert( s_parts->isEmpty() ); - delete s_parts; - } - - s_iconLoader = 0; - s_componentData = 0; - s_about = 0; - s_settings = 0; - s_parts = 0; - KHTMLSettings::avFamilies = 0; - - // clean up static data - khtml::CSSStyleSelector::clear(); - khtml::RenderStyle::cleanup(); - khtml::PaintBuffer::cleanup(); - khtml::Cache::clear(); - khtml::cleanup_thaibreaks(); - khtml::ArenaFinish(); - } - else - deref(); + kDebug(6000) << this; + // Called when khtml part is unloaded; check that we didn't leak anything + KHTMLGlobal::finalCheck(); } -KParts::Part *KHTMLFactory::createPartObject( QWidget *parentWidget, QObject *parent, const char *className, const QStringList & ) +KParts::Part * KHTMLFactory::createPartObject( QWidget *parentWidget, QObject *parent, const char *className, const QStringList &args ) { + Q_UNUSED(args); KHTMLPart::GUIProfile prof = KHTMLPart::DefaultGUI; if ( strcmp( className, "Browser/View" ) == 0 ) prof = KHTMLPart::BrowserViewGUI; @@ -101,106 +45,9 @@ KParts::Part *KHTMLFactory::createPartOb return new KHTMLPart( parentWidget, parent, prof ); } -void KHTMLFactory::ref() -{ - if ( !s_refcnt && !s_self ) - { - // we can't use a staticdeleter here, because that would mean - // that the factory gets deleted from within a qPostRoutine, called - // from the QApplication destructor. That however is too late, because - // we want to destruct a KComponentData object, which involves destructing - // a KConfig object, which might call KGlobal::dirs() (in sync()) which - // probably is not going to work ;-) - // well, perhaps I'm wrong here, but as I'm unsure I try to stay on the - // safe side ;-) -> let's use a simple reference counting scheme - // (Simon) - s_self = new KHTMLFactory; - khtml::Cache::init(); - } - - s_refcnt++; -} - -void KHTMLFactory::deref() -{ - if ( !--s_refcnt && s_self ) - { - delete s_self; - s_self = 0; - } -} - -void KHTMLFactory::registerPart( KHTMLPart *part ) -{ - if ( !s_parts ) - s_parts = new QLinkedList; - - if ( !s_parts->contains( part ) ) - { - s_parts->append( part ); - ref(); - } -} - -void KHTMLFactory::deregisterPart( KHTMLPart *part ) -{ - assert( s_parts ); - - if ( s_parts->removeAll( part ) ) - { - if ( s_parts->isEmpty() ) - { - delete s_parts; - s_parts = 0; - } - deref(); - } -} - -const KComponentData &KHTMLFactory::componentData() -{ - assert( s_self ); - - if ( !s_componentData ) - { - s_about = new KAboutData( "khtml", 0, ki18n( "KHTML" ), "4.0", - ki18n( "Embeddable HTML component" ), - KAboutData::License_LGPL ); - s_about->addAuthor(ki18n("Lars Knoll"), KLocalizedString(), "knoll@kde.org"); - s_about->addAuthor(ki18n("Antti Koivisto"), KLocalizedString(), "koivisto@kde.org"); - s_about->addAuthor(ki18n("Waldo Bastian"), KLocalizedString(), "bastian@kde.org"); - s_about->addAuthor(ki18n("Dirk Mueller"), KLocalizedString(), "mueller@kde.org"); - s_about->addAuthor(ki18n("Peter Kelly"), KLocalizedString(), "pmk@kde.org"); - s_about->addAuthor(ki18n("Torben Weis"), KLocalizedString(), "weis@kde.org"); - s_about->addAuthor(ki18n("Martin Jones"), KLocalizedString(), "mjones@kde.org"); - s_about->addAuthor(ki18n("Simon Hausmann"), KLocalizedString(), "hausmann@kde.org"); - s_about->addAuthor(ki18n("Tobias Anton"), KLocalizedString(), "anton@stud.fbi.fh-darmstadt.de"); - - s_componentData = new KComponentData( s_about ); - } - - return *s_componentData; -} - -KIconLoader *KHTMLFactory::iconLoader() +extern "C" KDE_EXPORT void *init_libkhtmlpart() { - if ( !s_iconLoader ) - { - s_iconLoader = new KIconLoader(componentData().componentName(), componentData().dirs()); - } - - return s_iconLoader; + return new KHTMLFactory; } -KHTMLSettings *KHTMLFactory::defaultHTMLSettings() -{ - assert( s_self ); - if ( !s_settings ) - s_settings = new KHTMLSettings(); - - return s_settings; -} - -using namespace KParts; #include "khtml_factory.moc" - Index: html/htmlparser.cpp =================================================================== --- html/htmlparser.cpp (revision 741807) +++ html/htmlparser.cpp (working copy) @@ -50,7 +50,7 @@ #include #include #include -#include +#include #include #include #include @@ -892,11 +892,11 @@ NodeImpl *KHTMLParser::getElement(Token* break; case ID_INPUT: if ( t->attrs && - KHTMLFactory::defaultHTMLSettings()->isAdFilterEnabled() && - KHTMLFactory::defaultHTMLSettings()->isHideAdsEnabled() && + KHTMLGlobal::defaultHTMLSettings()->isAdFilterEnabled() && + KHTMLGlobal::defaultHTMLSettings()->isHideAdsEnabled() && !strcasecmp( t->attrs->getValue( ATTR_TYPE ), "image" ) ) { - if (KHTMLFactory::defaultHTMLSettings()->isAdFiltered( doc()->completeURL( khtml::parseURL(t->attrs->getValue(ATTR_SRC)).string() ) )) + if (KHTMLGlobal::defaultHTMLSettings()->isAdFiltered( doc()->completeURL( khtml::parseURL(t->attrs->getValue(ATTR_SRC)).string() ) )) return 0; } n = new HTMLInputElementImpl(document, form); @@ -1020,11 +1020,11 @@ NodeImpl *KHTMLParser::getElement(Token* // images case ID_IMG: if (t->attrs&& - KHTMLFactory::defaultHTMLSettings()->isAdFilterEnabled()&& - KHTMLFactory::defaultHTMLSettings()->isHideAdsEnabled()) + KHTMLGlobal::defaultHTMLSettings()->isAdFilterEnabled()&& + KHTMLGlobal::defaultHTMLSettings()->isHideAdsEnabled()) { QString url = doc()->completeURL( khtml::parseURL(t->attrs->getValue(ATTR_SRC)).string() ); - if (KHTMLFactory::defaultHTMLSettings()->isAdFiltered(url)) + if (KHTMLGlobal::defaultHTMLSettings()->isAdFiltered(url)) return 0; } n = new HTMLImageElementImpl(document, form); Index: html/html_documentimpl.cpp =================================================================== --- html/html_documentimpl.cpp (revision 741807) +++ html/html_documentimpl.cpp (working copy) @@ -39,7 +39,7 @@ #include "xml/xml_tokenizer.h" #include "xml/dom2_eventsimpl.h" -#include "khtml_factory.h" +#include #include "rendering/render_object.h" #include "dom/dom_exception.h" @@ -80,12 +80,12 @@ HTMLDocumentImpl::HTMLDocumentImpl(DOMIm m_doAutoFill = false; /* dynamic history stuff to be fixed later (pfeiffer) - connect( KHTMLFactory::vLinks(), SIGNAL( removed( const QString& )), + connect( KHTMLGlobal::vLinks(), SIGNAL( removed( const QString& )), SLOT( slotHistoryChanged() )); */ - connect( KHTMLFactory::vLinks(), SIGNAL( inserted( const QString& ) ), + connect( KHTMLGlobal::vLinks(), SIGNAL( inserted( const QString& ) ), SLOT( slotHistoryChanged() )); - connect( KHTMLFactory::vLinks(), SIGNAL( cleared()), + connect( KHTMLGlobal::vLinks(), SIGNAL( cleared()), SLOT( slotHistoryChanged() )); } Index: CMakeLists.txt =================================================================== --- CMakeLists.txt (revision 741807) +++ CMakeLists.txt (working copy) @@ -251,7 +251,7 @@ set(khtml_LIB_SRCS khtmlview.cpp khtml_part.cpp khtml_run.cpp - khtml_factory.cpp + khtml_global.cpp khtml_settings.cc khtml_events.cpp khtml_ext.cpp @@ -330,7 +330,7 @@ install(TARGETS khtml DESTINATION ${LIB_ ########### khtmlpart ############### -set(khtmlpart_PART_SRCS khtml_factory_init.cpp ) +set(khtmlpart_PART_SRCS khtml_factory.cpp ) kde4_add_plugin(khtmlpart WITH_PREFIX ${khtmlpart_PART_SRCS}) Index: rendering/font.cpp =================================================================== --- rendering/font.cpp (revision 741807) +++ rendering/font.cpp (working copy) @@ -36,7 +36,7 @@ # endif #endif -#include +#include #include #include @@ -430,7 +430,7 @@ bool Font::isFontScalable(QFontDatabase& void Font::update(int logicalDpiY) const { - f.setFamily( fontDef.family.isEmpty() ? KHTMLFactory::defaultHTMLSettings()->stdFontName() : fontDef.family ); + f.setFamily( fontDef.family.isEmpty() ? KHTMLGlobal::defaultHTMLSettings()->stdFontName() : fontDef.family ); f.setItalic( fontDef.italic ); f.setWeight( fontDef.weight ); Index: khtml_global.cpp =================================================================== --- khtml_global.cpp (revision 0) +++ khtml_global.cpp (revision 0) @@ -0,0 +1,245 @@ +/* This file is part of the KDE project + * + * Copyright (C) 2000 Simon Hausmann + * Copyright (C) 2007 David Faure + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "khtml_global.h" +#include "khtml_part.h" +#include "khtml_settings.h" + +#include "css/cssstyleselector.h" +#include "html/html_imageimpl.h" +#include "rendering/render_style.h" +#include "rendering/break_lines.h" +#include "misc/loader.h" +#include "misc/arena.h" +#include "misc/paintbuffer.h" + +#include + +#include +#include +#include +#include + +#include + +#include + +KHTMLGlobal *KHTMLGlobal::s_self = 0; +unsigned long int KHTMLGlobal::s_refcnt = 0; +KComponentData *KHTMLGlobal::s_componentData = 0; +KIconLoader *KHTMLGlobal::s_iconLoader = 0; +KAboutData *KHTMLGlobal::s_about = 0; +KHTMLSettings *KHTMLGlobal::s_settings = 0; + +static QLinkedList *s_parts = 0; +static QLinkedList *s_docs = 0; + +KHTMLGlobal::KHTMLGlobal() +{ + assert(!s_self); + s_self = this; + ref(); + + khtml::Cache::init(); +} + +KHTMLGlobal::~KHTMLGlobal() +{ + kDebug(6000) << this; + if ( s_self == this ) + { + finalCheck(); + delete s_iconLoader; + delete s_componentData; + delete s_about; + delete s_settings; + delete KHTMLSettings::avFamilies; + if (s_parts) { + assert(s_parts->isEmpty()); + delete s_parts; + } + if (s_docs) { + assert(s_docs->isEmpty()); + delete s_docs; + } + + s_iconLoader = 0; + s_componentData = 0; + s_about = 0; + s_settings = 0; + s_parts = 0; + s_docs = 0; + KHTMLSettings::avFamilies = 0; + + // clean up static data + khtml::CSSStyleSelector::clear(); + khtml::RenderStyle::cleanup(); + khtml::PaintBuffer::cleanup(); + khtml::Cache::clear(); + khtml::cleanup_thaibreaks(); + khtml::ArenaFinish(); + } + else + deref(); +} + +void KHTMLGlobal::ref() +{ + if ( !s_refcnt && !s_self ) + { + kDebug(6000) << "Creating KHTMLGlobal instance"; + // we can't use a staticdeleter here, because that would mean + // that the KHTMLGlobal instance gets deleted from within a qPostRoutine, called + // from the QApplication destructor. That however is too late, because + // we want to destruct a KComponentData object, which involves destructing + // a KConfig object, which might call KGlobal::dirs() (in sync()) which + // probably is not going to work ;-) + // well, perhaps I'm wrong here, but as I'm unsure I try to stay on the + // safe side ;-) -> let's use a simple reference counting scheme + // (Simon) + new KHTMLGlobal; // does initial ref() + } else { + ++s_refcnt; + } + kDebug(6000) << "s_refcnt=" << s_refcnt; +} + +void KHTMLGlobal::deref() +{ + kDebug(6000) << "s_refcnt=" << s_refcnt - 1; + if ( !--s_refcnt && s_self ) + { + delete s_self; + s_self = 0; + } +} + +void KHTMLGlobal::registerPart( KHTMLPart *part ) +{ + kDebug() << part; + if ( !s_parts ) + s_parts = new QLinkedList; + + if ( !s_parts->contains( part ) ) { + s_parts->append( part ); + ref(); + } +} + +void KHTMLGlobal::deregisterPart( KHTMLPart *part ) +{ + kDebug() << part; + assert( s_parts ); + + if ( s_parts->removeAll( part ) ) { + if ( s_parts->isEmpty() ) { + delete s_parts; + s_parts = 0; + } + deref(); + } +} + +void KHTMLGlobal::registerDocumentImpl( DOM::DocumentImpl *doc ) +{ + kDebug() << doc; + if ( !s_docs ) + s_docs = new QLinkedList; + + if ( !s_docs->contains( doc ) ) { + s_docs->append( doc ); + ref(); + } +} + +void KHTMLGlobal::deregisterDocumentImpl( DOM::DocumentImpl *doc ) +{ + kDebug() << doc; + assert( s_docs ); + + if ( s_docs->removeAll( doc ) ) { + if ( s_docs->isEmpty() ) { + delete s_docs; + s_docs = 0; + } + deref(); + } +} + +const KComponentData &KHTMLGlobal::componentData() +{ + assert( s_self ); + + if ( !s_componentData ) + { + s_about = new KAboutData( "khtml", 0, ki18n( "KHTML" ), "4.0", + ki18n( "Embeddable HTML component" ), + KAboutData::License_LGPL ); + s_about->addAuthor(ki18n("Lars Knoll"), KLocalizedString(), "knoll@kde.org"); + s_about->addAuthor(ki18n("Antti Koivisto"), KLocalizedString(), "koivisto@kde.org"); + s_about->addAuthor(ki18n("Waldo Bastian"), KLocalizedString(), "bastian@kde.org"); + s_about->addAuthor(ki18n("Dirk Mueller"), KLocalizedString(), "mueller@kde.org"); + s_about->addAuthor(ki18n("Peter Kelly"), KLocalizedString(), "pmk@kde.org"); + s_about->addAuthor(ki18n("Torben Weis"), KLocalizedString(), "weis@kde.org"); + s_about->addAuthor(ki18n("Martin Jones"), KLocalizedString(), "mjones@kde.org"); + s_about->addAuthor(ki18n("Simon Hausmann"), KLocalizedString(), "hausmann@kde.org"); + s_about->addAuthor(ki18n("Tobias Anton"), KLocalizedString(), "anton@stud.fbi.fh-darmstadt.de"); + + s_componentData = new KComponentData( s_about ); + } + + return *s_componentData; +} + +KIconLoader *KHTMLGlobal::iconLoader() +{ + if ( !s_iconLoader ) + { + s_iconLoader = new KIconLoader(componentData().componentName(), componentData().dirs()); + } + + return s_iconLoader; +} + +KHTMLSettings *KHTMLGlobal::defaultHTMLSettings() +{ + assert( s_self ); + if ( !s_settings ) + s_settings = new KHTMLSettings(); + + return s_settings; +} + +void KHTMLGlobal::finalCheck() +{ + kDebug(6000) << "s_refcnt=" << s_refcnt; + if (s_refcnt) { + if (s_parts && !s_parts->isEmpty()) { + kWarning(6000) << s_parts->count() << "parts not deleted"; + kWarning(6000) << "Part" << s_parts->first() << "wasn't deleted"; + } + if (s_docs && !s_docs->isEmpty()) { + kWarning(6000) << s_docs->count() << "docs not deleted"; + kWarning(6000) << "Document" << s_docs->first() << "wasn't deleted"; + } + } + assert( !s_refcnt ); +} Index: css/cssstyleselector.cpp =================================================================== --- css/cssstyleselector.cpp (revision 741807) +++ css/cssstyleselector.cpp (working copy) @@ -36,7 +36,7 @@ #include "xml/dom_restyler.h" #include "dom/css_rule.h" #include "dom/css_value.h" -#include "khtml_factory.h" +#include "khtml_global.h" #include "khtmlpart_p.h" using namespace khtml; using namespace DOM; @@ -929,9 +929,9 @@ static PseudoState checkPseudoState( con cleanpath( u ); } //completeURL( attr.string() ); - bool contains = KHTMLFactory::vLinks()->contains( u ); + bool contains = KHTMLGlobal::vLinks()->contains( u ); if ( !contains && u.count('/')==2 ) - contains = KHTMLFactory::vLinks()->contains( u+'/' ); + contains = KHTMLGlobal::vLinks()->contains( u+'/' ); return contains ? PseudoVisited : PseudoLink; } Index: khtml_factory.h =================================================================== --- khtml_factory.h (revision 741807) +++ khtml_factory.h (working copy) @@ -1,6 +1,7 @@ /* This file is part of the KDE project * * Copyright (C) 2000 Simon Hausmann + * Copyright (C) 2007 David Faure * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -23,60 +24,15 @@ #include #include -#include -#include -#include - -class KComponentData; -class KIconLoader; -class KAboutData; -class HistoryProvider; -class KHTMLSettings; -class KHTMLPart; - -namespace DOM -{ - class DocumentImpl; -} - -class KHTML_EXPORT KHTMLFactory : public KParts::Factory +class KHTMLFactory : public KParts::Factory { Q_OBJECT - friend class DOM::DocumentImpl; - friend class KHTMLViewPrivate; public: - KHTMLFactory( bool clone = false ); + KHTMLFactory(); virtual ~KHTMLFactory(); virtual KParts::Part *createPartObject( QWidget *parentWidget, QObject *parent, const char *className, const QStringList &args ); - - static void registerPart( KHTMLPart *part ); - static void deregisterPart( KHTMLPart *part ); - - static QLinkedList *partList() { return s_parts; } - - static const KComponentData &componentData(); - static KIconLoader *iconLoader(); - - static KHTMLSettings *defaultHTMLSettings(); - - // list of visited URLs - static KParts::HistoryProvider *vLinks() { - return KParts::HistoryProvider::self(); - } - -protected: - static void ref(); - static void deref(); -private: - static unsigned long s_refcnt; - static KHTMLFactory *s_self; - static KComponentData *s_componentData; - static KIconLoader *s_iconLoader; - static KAboutData *s_about; - static KHTMLSettings *s_settings; - static QLinkedList *s_parts; }; #endif Index: test_regression.cpp =================================================================== --- test_regression.cpp (revision 741807) +++ test_regression.cpp (working copy) @@ -217,7 +217,7 @@ public: #include #include -#include "khtml_factory.h" +#include "khtml_global.h" #include #include #include @@ -750,7 +750,7 @@ int main(int argc, char *argv[]) kClearDebugConfig(); // create widgets - KHTMLFactory *fac = new KHTMLFactory(); + KHTMLGlobal *fac = new KHTMLGlobal(); KMainWindow *toplevel = new KMainWindow(); KHTMLPart *part = new KHTMLPart( toplevel, 0, KHTMLPart::BrowserViewGUI ); Index: xml/dom_docimpl.cpp =================================================================== --- xml/dom_docimpl.cpp (revision 741807) +++ xml/dom_docimpl.cpp (working copy) @@ -322,7 +322,7 @@ DocumentImpl::DocumentImpl(DOMImplementa m_view = v; m_renderArena.reset(); - KHTMLFactory::ref(); + KHTMLGlobal::registerDocumentImpl(this); if ( v ) { m_docLoader = new DocLoader(v->part(), this ); @@ -484,7 +484,7 @@ DocumentImpl::~DocumentImpl() m_renderArena.reset(); - KHTMLFactory::deref(); + KHTMLGlobal::deregisterDocumentImpl(this); } @@ -2372,7 +2372,7 @@ bool DocumentImpl::isURLAllowed(const QS KUrl newURL(completeURL(url)); newURL.setRef(QString()); - if (KHTMLFactory::defaultHTMLSettings()->isAdFiltered( newURL.url() )) + if (KHTMLGlobal::defaultHTMLSettings()->isAdFiltered( newURL.url() )) return false; // Prohibit non-file URLs if we are asked to. --Boundary-00=_qzvSHoWBV+PbR/q--