[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

rjw rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:24:11 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 5fd5a7f5781979cd66b83a6f24adbe968aeace47
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Feb 7 22:08:16 2003 +0000

    WebKit:
            Changes to support per WebController preferences.
    
            Reviewed by Maciej and Ken.
    
            * WebView.subproj/WebController.m:
            (-[WebController setPreferences:]):
            * WebView.subproj/WebControllerPrivate.h:
            * WebView.subproj/WebControllerPrivate.m:
            (-[WebControllerPrivate init]):
            (-[WebControllerPrivate dealloc]):
            (-[WebController _setFormDelegate:]):
            (-[WebController _formDelegate]):
            (-[WebController _settings]):
            (-[WebController _updateWebCoreSettingsFromPreferences:]):
            (-[WebController _releaseUserAgentStrings]):
            (-[WebController _preferencesChangedNotification:]):
            * WebView.subproj/WebFrame.m:
            (-[WebFrame initWithName:webView:controller:]):
            * WebView.subproj/WebPreferences.h:
            * WebView.subproj/WebPreferences.m:
            (-[WebPreferences _postPreferencesChangesNotification]):
            (+[WebPreferences load]):
            (-[WebPreferences _stringValueForKey:]):
            (-[WebPreferences _setStringValue:forKey:]):
            (-[WebPreferences _integerValueForKey:]):
            (-[WebPreferences _setIntegerValue:forKey:]):
            (-[WebPreferences _boolValueForKey:]):
            (-[WebPreferences _setBoolValue:forKey:]):
            (-[WebPreferences standardFontFamily]):
            (-[WebPreferences setStandardFontFamily:]):
            (-[WebPreferences fixedFontFamily]):
            (-[WebPreferences setFixedFontFamily:]):
            (-[WebPreferences serifFontFamily]):
            (-[WebPreferences setSerifFontFamily:]):
            (-[WebPreferences sansSerifFontFamily]):
            (-[WebPreferences setSansSerifFontFamily:]):
            (-[WebPreferences cursiveFontFamily]):
            (-[WebPreferences setCursiveFontFamily:]):
            (-[WebPreferences fantasyFontFamily]):
            (-[WebPreferences setFantasyFontFamily:]):
            (-[WebPreferences defaultFontSize]):
            (-[WebPreferences setDefaultFontSize:]):
            (-[WebPreferences defaultFixedFontSize]):
            (-[WebPreferences setDefaultFixedFontSize:]):
            (-[WebPreferences minimumFontSize]):
            (-[WebPreferences setMinimumFontSize:]):
            (-[WebPreferences defaultTextEncodingName]):
            (-[WebPreferences setDefaultTextEncodingName:]):
            (-[WebPreferences userStyleSheetEnabled]):
            (-[WebPreferences setUserStyleSheetEnabled:]):
            (-[WebPreferences userStyleSheetLocation]):
            (-[WebPreferences setUserStyleSheetLocation:]):
            (-[WebPreferences JavaEnabled]):
            (-[WebPreferences setJavaEnabled:]):
            (-[WebPreferences JavaScriptEnabled]):
            (-[WebPreferences setJavaScriptEnabled:]):
            (-[WebPreferences JavaScriptCanOpenWindowsAutomatically]):
            (-[WebPreferences setJavaScriptCanOpenWindowsAutomatically:]):
            (-[WebPreferences pluginsEnabled]):
            (-[WebPreferences setPluginsEnabled:]):
            (-[WebPreferences allowAnimatedImages]):
            (-[WebPreferences allowAnimatedImageLooping]):
            (-[WebPreferences setAllowAnimatedImageLooping:]):
            (-[WebPreferences setWillLoadImagesAutomatically:]):
            (-[WebPreferences willLoadImagesAutomatically]):
            (-[WebPreferences _initialTimedLayoutDelay]):
            (-[WebPreferences _initialTimedLayoutSize]):
            (-[WebPreferences _pageCacheSize]):
            (-[WebPreferences _objectCacheSize]):
            (-[WebPreferences _initialTimedLayoutEnabled]):
            (-[WebPreferences _resourceTimedLayoutDelay]):
            (-[WebPreferences _resourceTimedLayoutEnabled]):
            * WebView.subproj/WebPreferencesPrivate.h:
    WebCore:
            Changes to support per WebController preferences.
            KHTMLPart now always accesses preferences from it's m_setting.
            Changes made to WebPreferences pass to WebCoreSetting to KTMLSettings.
            Added JavaScriptCanOpenWindowsAutomatically to KHTMLSettings.
    
            Reviewed by Maciej and Ken.
    
            * khtml/ecma/kjs_window.cpp:
            (WindowFunc::tryCall):
            * khtml/khtml_part.cpp:
            (KHTMLPart::init):
            (KHTMLPart::restoreURL):
            (KHTMLPart::openURL):
            (KHTMLPart::begin):
            (KHTMLPart::reparseConfiguration):
            * khtml/khtmlpart_p.h:
            * kwq/KWQKConfigBase.h:
            * kwq/KWQKConfigBase.mm:
            (KConfig::readUnsignedNumEntry):
            * kwq/KWQKHTMLPart.h:
            * kwq/KWQKHTMLPart.mm:
            (KWQKHTMLPart::setSettings):
            * kwq/KWQKHTMLSettings.h:
            * kwq/KWQKHTMLSettings.mm:
            (KHTMLSettings::stdFontName):
            (KHTMLSettings::fixedFontName):
            (KHTMLSettings::serifFontName):
            (KHTMLSettings::sansSerifFontName):
            (KHTMLSettings::cursiveFontName):
            (KHTMLSettings::fantasyFontName):
            (KHTMLSettings::minFontSize):
            (KHTMLSettings::mediumFontSize):
            (KHTMLSettings::mediumFixedFontSize):
            (KHTMLSettings::isJavaEnabled):
            (KHTMLSettings::autoLoadImages):
            (KHTMLSettings::isPluginsEnabled):
            (KHTMLSettings::isJavaScriptEnabled):
            (KHTMLSettings::JavaScriptCanOpenWindowsAutomatically):
            (KHTMLSettings::userStyleSheet):
            (KHTMLSettings::setStdFontName):
            (KHTMLSettings::setFixedFontName):
            (KHTMLSettings::setSerifFontName):
            (KHTMLSettings::setSansSerifFontName):
            (KHTMLSettings::setCursiveFontName):
            (KHTMLSettings::setFantasyFontName):
            (KHTMLSettings::setMinFontSize):
            (KHTMLSettings::setMediumFontSize):
            (KHTMLSettings::setMediumFixedFontSize):
            (KHTMLSettings::setAutoLoadImages):
            (KHTMLSettings::setIsJavaScriptEnabled):
            (KHTMLSettings::setIsJavaEnabled):
            (KHTMLSettings::setArePluginsEnabled):
            (KHTMLSettings::setJavaScriptCanOpenWindowsAutomatically):
            (KHTMLSettings::setUserStyleSheet):
            * kwq/WebCoreBridge.h:
            * kwq/WebCoreBridge.mm:
            (-[WebCoreBridge init]):
            (-[WebCoreBridge initializeSettings:]):
            * kwq/WebCoreSettings.h:
            * kwq/WebCoreSettings.mm:
            (-[WebCoreSettings dealloc]):
            (-[WebCoreSettings init]):
            (-[WebCoreSettings setStandardFontFamily:]):
            (-[WebCoreSettings setFixedFontFamily:]):
            (-[WebCoreSettings setSerifFontFamily:]):
            (-[WebCoreSettings setSansSerifFontFamily:]):
            (-[WebCoreSettings setCursiveFontFamily:]):
            (-[WebCoreSettings setFantasyFontFamily:]):
            (-[WebCoreSettings setMinimumFontSize:]):
            (-[WebCoreSettings setDefaultFontSize:]):
            (-[WebCoreSettings setDefaultFixedFontSize:]):
            (-[WebCoreSettings setJavaEnabled:]):
            (-[WebCoreSettings setPluginsEnabled:]):
            (-[WebCoreSettings setJavaScriptEnabled:]):
            (-[WebCoreSettings setJavaScriptCanOpenWindowsAutomatically:]):
            (-[WebCoreSettings setWillLoadImagesAutomatically:]):
            (-[WebCoreSettings setUserStyleSheetLocation:]):
            (-[WebCoreSettings userStyleSheetLocation]):
            (-[WebCoreSettings settings]):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3610 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index c55a59a..4e918fe 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,85 @@
+2003-02-07  Richard Williamson   <rjw at apple.com>
+
+        Changes to support per WebController preferences.
+        KHTMLPart now always accesses preferences from it's m_setting.
+        Changes made to WebPreferences pass to WebCoreSetting to KTMLSettings.
+        Added JavaScriptCanOpenWindowsAutomatically to KHTMLSettings.
+        
+        Reviewed by Maciej and Ken.
+
+        * khtml/ecma/kjs_window.cpp:
+        (WindowFunc::tryCall):
+        * khtml/khtml_part.cpp:
+        (KHTMLPart::init):
+        (KHTMLPart::restoreURL):
+        (KHTMLPart::openURL):
+        (KHTMLPart::begin):
+        (KHTMLPart::reparseConfiguration):
+        * khtml/khtmlpart_p.h:
+        * kwq/KWQKConfigBase.h:
+        * kwq/KWQKConfigBase.mm:
+        (KConfig::readUnsignedNumEntry):
+        * kwq/KWQKHTMLPart.h:
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::setSettings):
+        * kwq/KWQKHTMLSettings.h:
+        * kwq/KWQKHTMLSettings.mm:
+        (KHTMLSettings::stdFontName):
+        (KHTMLSettings::fixedFontName):
+        (KHTMLSettings::serifFontName):
+        (KHTMLSettings::sansSerifFontName):
+        (KHTMLSettings::cursiveFontName):
+        (KHTMLSettings::fantasyFontName):
+        (KHTMLSettings::minFontSize):
+        (KHTMLSettings::mediumFontSize):
+        (KHTMLSettings::mediumFixedFontSize):
+        (KHTMLSettings::isJavaEnabled):
+        (KHTMLSettings::autoLoadImages):
+        (KHTMLSettings::isPluginsEnabled):
+        (KHTMLSettings::isJavaScriptEnabled):
+        (KHTMLSettings::JavaScriptCanOpenWindowsAutomatically):
+        (KHTMLSettings::userStyleSheet):
+        (KHTMLSettings::setStdFontName):
+        (KHTMLSettings::setFixedFontName):
+        (KHTMLSettings::setSerifFontName):
+        (KHTMLSettings::setSansSerifFontName):
+        (KHTMLSettings::setCursiveFontName):
+        (KHTMLSettings::setFantasyFontName):
+        (KHTMLSettings::setMinFontSize):
+        (KHTMLSettings::setMediumFontSize):
+        (KHTMLSettings::setMediumFixedFontSize):
+        (KHTMLSettings::setAutoLoadImages):
+        (KHTMLSettings::setIsJavaScriptEnabled):
+        (KHTMLSettings::setIsJavaEnabled):
+        (KHTMLSettings::setArePluginsEnabled):
+        (KHTMLSettings::setJavaScriptCanOpenWindowsAutomatically):
+        (KHTMLSettings::setUserStyleSheet):
+        * kwq/WebCoreBridge.h:
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge init]):
+        (-[WebCoreBridge initializeSettings:]):
+        * kwq/WebCoreSettings.h:
+        * kwq/WebCoreSettings.mm:
+        (-[WebCoreSettings dealloc]):
+        (-[WebCoreSettings init]):
+        (-[WebCoreSettings setStandardFontFamily:]):
+        (-[WebCoreSettings setFixedFontFamily:]):
+        (-[WebCoreSettings setSerifFontFamily:]):
+        (-[WebCoreSettings setSansSerifFontFamily:]):
+        (-[WebCoreSettings setCursiveFontFamily:]):
+        (-[WebCoreSettings setFantasyFontFamily:]):
+        (-[WebCoreSettings setMinimumFontSize:]):
+        (-[WebCoreSettings setDefaultFontSize:]):
+        (-[WebCoreSettings setDefaultFixedFontSize:]):
+        (-[WebCoreSettings setJavaEnabled:]):
+        (-[WebCoreSettings setPluginsEnabled:]):
+        (-[WebCoreSettings setJavaScriptEnabled:]):
+        (-[WebCoreSettings setJavaScriptCanOpenWindowsAutomatically:]):
+        (-[WebCoreSettings setWillLoadImagesAutomatically:]):
+        (-[WebCoreSettings setUserStyleSheetLocation:]):
+        (-[WebCoreSettings userStyleSheetLocation]):
+        (-[WebCoreSettings settings]):
+
 2003-02-07  Darin Adler  <darin at apple.com>
 
         * khtml/rendering/render_table.h: Added copyright date.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index c55a59a..4e918fe 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,85 @@
+2003-02-07  Richard Williamson   <rjw at apple.com>
+
+        Changes to support per WebController preferences.
+        KHTMLPart now always accesses preferences from it's m_setting.
+        Changes made to WebPreferences pass to WebCoreSetting to KTMLSettings.
+        Added JavaScriptCanOpenWindowsAutomatically to KHTMLSettings.
+        
+        Reviewed by Maciej and Ken.
+
+        * khtml/ecma/kjs_window.cpp:
+        (WindowFunc::tryCall):
+        * khtml/khtml_part.cpp:
+        (KHTMLPart::init):
+        (KHTMLPart::restoreURL):
+        (KHTMLPart::openURL):
+        (KHTMLPart::begin):
+        (KHTMLPart::reparseConfiguration):
+        * khtml/khtmlpart_p.h:
+        * kwq/KWQKConfigBase.h:
+        * kwq/KWQKConfigBase.mm:
+        (KConfig::readUnsignedNumEntry):
+        * kwq/KWQKHTMLPart.h:
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::setSettings):
+        * kwq/KWQKHTMLSettings.h:
+        * kwq/KWQKHTMLSettings.mm:
+        (KHTMLSettings::stdFontName):
+        (KHTMLSettings::fixedFontName):
+        (KHTMLSettings::serifFontName):
+        (KHTMLSettings::sansSerifFontName):
+        (KHTMLSettings::cursiveFontName):
+        (KHTMLSettings::fantasyFontName):
+        (KHTMLSettings::minFontSize):
+        (KHTMLSettings::mediumFontSize):
+        (KHTMLSettings::mediumFixedFontSize):
+        (KHTMLSettings::isJavaEnabled):
+        (KHTMLSettings::autoLoadImages):
+        (KHTMLSettings::isPluginsEnabled):
+        (KHTMLSettings::isJavaScriptEnabled):
+        (KHTMLSettings::JavaScriptCanOpenWindowsAutomatically):
+        (KHTMLSettings::userStyleSheet):
+        (KHTMLSettings::setStdFontName):
+        (KHTMLSettings::setFixedFontName):
+        (KHTMLSettings::setSerifFontName):
+        (KHTMLSettings::setSansSerifFontName):
+        (KHTMLSettings::setCursiveFontName):
+        (KHTMLSettings::setFantasyFontName):
+        (KHTMLSettings::setMinFontSize):
+        (KHTMLSettings::setMediumFontSize):
+        (KHTMLSettings::setMediumFixedFontSize):
+        (KHTMLSettings::setAutoLoadImages):
+        (KHTMLSettings::setIsJavaScriptEnabled):
+        (KHTMLSettings::setIsJavaEnabled):
+        (KHTMLSettings::setArePluginsEnabled):
+        (KHTMLSettings::setJavaScriptCanOpenWindowsAutomatically):
+        (KHTMLSettings::setUserStyleSheet):
+        * kwq/WebCoreBridge.h:
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge init]):
+        (-[WebCoreBridge initializeSettings:]):
+        * kwq/WebCoreSettings.h:
+        * kwq/WebCoreSettings.mm:
+        (-[WebCoreSettings dealloc]):
+        (-[WebCoreSettings init]):
+        (-[WebCoreSettings setStandardFontFamily:]):
+        (-[WebCoreSettings setFixedFontFamily:]):
+        (-[WebCoreSettings setSerifFontFamily:]):
+        (-[WebCoreSettings setSansSerifFontFamily:]):
+        (-[WebCoreSettings setCursiveFontFamily:]):
+        (-[WebCoreSettings setFantasyFontFamily:]):
+        (-[WebCoreSettings setMinimumFontSize:]):
+        (-[WebCoreSettings setDefaultFontSize:]):
+        (-[WebCoreSettings setDefaultFixedFontSize:]):
+        (-[WebCoreSettings setJavaEnabled:]):
+        (-[WebCoreSettings setPluginsEnabled:]):
+        (-[WebCoreSettings setJavaScriptEnabled:]):
+        (-[WebCoreSettings setJavaScriptCanOpenWindowsAutomatically:]):
+        (-[WebCoreSettings setWillLoadImagesAutomatically:]):
+        (-[WebCoreSettings setUserStyleSheetLocation:]):
+        (-[WebCoreSettings userStyleSheetLocation]):
+        (-[WebCoreSettings settings]):
+
 2003-02-07  Darin Adler  <darin at apple.com>
 
         * khtml/rendering/render_table.h: Added copyright date.
diff --git a/WebCore/khtml/ecma/kjs_window.cpp b/WebCore/khtml/ecma/kjs_window.cpp
index ed08717..3606daa 100644
--- a/WebCore/khtml/ecma/kjs_window.cpp
+++ b/WebCore/khtml/ecma/kjs_window.cpp
@@ -36,6 +36,7 @@
 
 #if APPLE_CHANGES
 #include "KWQLogging.h"
+#include "KWQKConfigBase.h"
 #endif
 #include <kjs/collector.h>
 #include "kjs_proxy.h"
@@ -1087,7 +1088,11 @@ Value WindowFunc::tryCall(ExecState *exec, Object &thisObj, const List &args)
   {
     KConfig *config = new KConfig("konquerorrc");
     config->setGroup("Java/JavaScript Settings");
+#if !APPLE_CHANGES
     int policy = config->readUnsignedNumEntry( "WindowOpenPolicy", 0 ); // 0=allow, 1=ask, 2=deny, 3=smart
+#else    
+    int policy = config->readUnsignedNumEntry( part->settings(), "WindowOpenPolicy", 0 ); // 0=allow, 1=ask, 2=deny, 3=smart
+#endif
     delete config;
     if ( policy == 1 ) {
 #if !APPLE_CHANGES
diff --git a/WebCore/khtml/khtml_part.cpp b/WebCore/khtml/khtml_part.cpp
index ba347f7..ebfe59a 100644
--- a/WebCore/khtml/khtml_part.cpp
+++ b/WebCore/khtml/khtml_part.cpp
@@ -222,11 +222,16 @@ void KHTMLPart::init( KHTMLView *view, GUIProfile prof )
       d->m_paSelectAll->setShortcut( KShortcut() ); // avoid clashes
 #endif
 
+#if !APPLE_CHANGES
   // set the default java(script) flags according to the current host.
   d->m_bJScriptEnabled = KHTMLFactory::defaultHTMLSettings()->isJavaScriptEnabled();
   d->m_bJScriptDebugEnabled = KHTMLFactory::defaultHTMLSettings()->isJavaScriptDebugEnabled();
   d->m_bJavaEnabled = KHTMLFactory::defaultHTMLSettings()->isJavaEnabled();
   d->m_bPluginsEnabled = KHTMLFactory::defaultHTMLSettings()->isPluginsEnabled();
+#else
+  // The java, javascript, and plugin settings will be set after the settings
+  // have been initialized.
+#endif
 
 #if !APPLE_CHANGES
   connect( this, SIGNAL( completed() ),
@@ -324,10 +329,17 @@ bool KHTMLPart::restoreURL( const KURL &url )
   d->m_workingURL = url;
 
   // set the java(script) flags according to the current host.
+#if !APPLE_CHANGES
   d->m_bJScriptEnabled = KHTMLFactory::defaultHTMLSettings()->isJavaScriptEnabled(url.host());
   d->m_bJScriptDebugEnabled = KHTMLFactory::defaultHTMLSettings()->isJavaScriptDebugEnabled();
   d->m_bJavaEnabled = KHTMLFactory::defaultHTMLSettings()->isJavaEnabled(url.host());
   d->m_bPluginsEnabled = KHTMLFactory::defaultHTMLSettings()->isPluginsEnabled(url.host());
+#else
+  d->m_bJScriptEnabled = d->m_settings->isJavaScriptEnabled(url.host());
+  d->m_bJScriptDebugEnabled = d->m_settings->isJavaScriptDebugEnabled();
+  d->m_bJavaEnabled = d->m_settings->isJavaEnabled(url.host());
+  d->m_bPluginsEnabled = d->m_settings->isPluginsEnabled(url.host());
+#endif
 
   m_url = url;
 
@@ -463,9 +475,15 @@ bool KHTMLPart::openURL( const KURL &url )
   }
 
   // set the javascript flags according to the current url
+#if !APPLE_CHANGES
   d->m_bJScriptDebugEnabled = KHTMLFactory::defaultHTMLSettings()->isJavaScriptDebugEnabled();
   d->m_bJavaEnabled = KHTMLFactory::defaultHTMLSettings()->isJavaEnabled(url.host());
   d->m_bPluginsEnabled = KHTMLFactory::defaultHTMLSettings()->isPluginsEnabled(url.host());
+#else
+  d->m_bJScriptDebugEnabled = d->m_settings->isJavaScriptDebugEnabled();
+  d->m_bJavaEnabled = d->m_settings->isJavaEnabled(url.host());
+  d->m_bPluginsEnabled = d->m_settings->isPluginsEnabled(url.host());
+#endif
 
   // initializing m_url to the new url breaks relative links when opening such a link after this call and _before_ begin() is called (when the first
   // data arrives) (Simon)
@@ -1328,7 +1346,11 @@ void KHTMLPart::begin( const KURL &url, int xOffset, int yOffset )
 
   // Only do this after clearing the part, so that JavaScript can
   // clean up properly if it was on for the last load.
+#if !APPLE_CHANGES
   d->m_bJScriptEnabled = KHTMLFactory::defaultHTMLSettings()->isJavaScriptEnabled(url.host());
+#else
+  d->m_bJScriptEnabled = d->m_settings->isJavaScriptEnabled(url.host());
+#endif
 
   d->m_bCleared = false;
   d->m_cacheId = 0;
@@ -1395,7 +1417,11 @@ void KHTMLPart::begin( const KURL &url, int xOffset, int yOffset )
   // We prefer m_baseURL over m_url because m_url changes when we are
   // about to load a new page.
   d->m_doc->setBaseURL( baseurl.url() );
+#if !APPLE_CHANGES
   d->m_doc->docLoader()->setShowAnimations( KHTMLFactory::defaultHTMLSettings()->showAnimations() );
+#else
+  d->m_doc->docLoader()->setShowAnimations( d->m_settings->showAnimations() );
+#endif
 
 #if APPLE_CHANGES
   KWQ(this)->updatePolicyBaseURL();
@@ -1406,8 +1432,14 @@ void KHTMLPart::begin( const KURL &url, int xOffset, int yOffset )
   d->m_paUseStylesheet->setEnabled( false );
 #endif
 
+#if !APPLE_CHANGES
   setAutoloadImages( KHTMLFactory::defaultHTMLSettings()->autoLoadImages() );
   QString userStyleSheet = KHTMLFactory::defaultHTMLSettings()->userStyleSheet();
+#else
+  setAutoloadImages( d->m_settings->autoLoadImages() );
+  QString userStyleSheet = d->m_settings->userStyleSheet();
+#endif
+
   if ( !userStyleSheet.isEmpty() )
     setUserStyleSheet( KURL( userStyleSheet ) );
 
@@ -3874,9 +3906,7 @@ void KHTMLPart::slotLoadImages()
 
 void KHTMLPart::reparseConfiguration()
 {
-  KHTMLSettings *settings = KHTMLFactory::defaultHTMLSettings();
-  settings->init();
-
+#if !APPLE_CHANGES
   setAutoloadImages( settings->autoLoadImages() );
   if (d->m_doc)
      d->m_doc->docLoader()->setShowAnimations( settings->showAnimations() );
@@ -3889,6 +3919,18 @@ void KHTMLPart::reparseConfiguration()
   d->m_settings = new KHTMLSettings(*KHTMLFactory::defaultHTMLSettings());
 
   QString userStyleSheet = KHTMLFactory::defaultHTMLSettings()->userStyleSheet();
+#else
+  setAutoloadImages( d->m_settings->autoLoadImages() );
+  if (d->m_doc)
+     d->m_doc->docLoader()->setShowAnimations( d->m_settings->showAnimations() );
+
+  d->m_bJScriptEnabled = d->m_settings->isJavaScriptEnabled(m_url.host());
+  d->m_bJScriptDebugEnabled = d->m_settings->isJavaScriptDebugEnabled();
+  d->m_bJavaEnabled = d->m_settings->isJavaEnabled(m_url.host());
+  d->m_bPluginsEnabled = d->m_settings->isPluginsEnabled(m_url.host());
+
+  QString userStyleSheet = d->m_settings->userStyleSheet();
+#endif
   if ( !userStyleSheet.isEmpty() )
     setUserStyleSheet( KURL( userStyleSheet ) );
   else
diff --git a/WebCore/khtml/khtmlpart_p.h b/WebCore/khtml/khtmlpart_p.h
index 91f8287..2a7b6d1 100644
--- a/WebCore/khtml/khtmlpart_p.h
+++ b/WebCore/khtml/khtmlpart_p.h
@@ -109,7 +109,9 @@ public:
     m_bUnloadEventEmitted = true;
     m_cachePolicy = KIO::CC_Verify;
     m_manager = 0L;
+#if !APPLE_CHANGES
     m_settings = new KHTMLSettings(*KHTMLFactory::defaultHTMLSettings());
+#endif
     m_bClearing = false;
     m_bCleared = false;
     m_zoomFactor = 100;
@@ -183,7 +185,9 @@ public:
   {
     delete m_dcopobject;
     delete m_extension;
+#if !APPLE_CHANGES
     delete m_settings;
+#endif
     delete m_jscript;
     if ( m_kjs_lib)
        m_kjs_lib->unload();
diff --git a/WebCore/kwq/KWQKConfigBase.h b/WebCore/kwq/KWQKConfigBase.h
index 4069cae..a8155dc 100644
--- a/WebCore/kwq/KWQKConfigBase.h
+++ b/WebCore/kwq/KWQKConfigBase.h
@@ -27,6 +27,9 @@
 #define KCONFIG_H_
 
 #include "KWQString.h"
+#if APPLE_CHANGES
+#include "KWQKHTMLSettings.h"
+#endif
 
 class QColor;
 class QStringList;
@@ -44,7 +47,7 @@ public:
     QString readEntry(const char *pKey, const QString& aDefault=QString::null) const;
     
     int readNumEntry(const char *pKey, int nDefault=0) const;
-    unsigned int readUnsignedNumEntry(const char *pKey, unsigned int nDefault=0) const;
+    unsigned int readUnsignedNumEntry(const KHTMLSettings *settings, const char *pKey, unsigned int nDefault=0) const;
     
     bool readBoolEntry(const char *pKey, bool nDefault=0) const;
     
diff --git a/WebCore/kwq/KWQKConfigBase.mm b/WebCore/kwq/KWQKConfigBase.mm
index 8ac2e56..54ade67 100644
--- a/WebCore/kwq/KWQKConfigBase.mm
+++ b/WebCore/kwq/KWQKConfigBase.mm
@@ -27,6 +27,7 @@
 
 #import "KWQLogging.h"
 #import "KWQColor.h"
+#import "KWQKHTMLSettings.h"
 #import "KWQStringList.h"
 #import "WebCoreSettings.h"
 #import "WebCoreViewFactory.h"
@@ -112,10 +113,10 @@ int KConfig::readNumEntry(const char *pKey, int nDefault) const
     return nDefault;
 }
 
-unsigned int KConfig::readUnsignedNumEntry(const char *pKey, unsigned int nDefault) const
+unsigned int KConfig::readUnsignedNumEntry(const KHTMLSettings *settings, const char *pKey, unsigned int nDefault) const
 {
     if (impl->isKonquerorRC && strcmp(pKey, "WindowOpenPolicy") == 0) {
-	if ([[WebCoreSettings sharedSettings] JavaScriptCanOpenWindowsAutomatically]) {
+        if (settings->JavaScriptCanOpenWindowsAutomatically()) {
 	    return 0;
 	} else {
 	    return 3;
diff --git a/WebCore/kwq/KWQKHTMLPart.h b/WebCore/kwq/KWQKHTMLPart.h
index f2b40b4..e95003a 100644
--- a/WebCore/kwq/KWQKHTMLPart.h
+++ b/WebCore/kwq/KWQKHTMLPart.h
@@ -176,6 +176,8 @@ public:
     void clearRecordedFormValues();
     void recordFormValue(const QString &name, const QString &value);
 
+    void setSettings (KHTMLSettings *s);
+    
 private:
     virtual void khtmlMousePressEvent(khtml::MousePressEvent *);
     virtual void khtmlMouseDoubleClickEvent(khtml::MouseDoubleClickEvent *);
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index fe66065..4712b43 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -148,6 +148,11 @@ KWQKHTMLPart::~KWQKHTMLPart()
     [_formValues release];
 }
 
+void KWQKHTMLPart::setSettings (KHTMLSettings *settings)
+{
+    d->m_settings = settings;
+}
+
 WebCoreBridge *KWQKHTMLPart::bridgeForFrameName(const QString &frameName)
 {
     WebCoreBridge *frame;
diff --git a/WebCore/kwq/KWQKHTMLSettings.h b/WebCore/kwq/KWQKHTMLSettings.h
index fd107e2..c6c837c 100644
--- a/WebCore/kwq/KWQKHTMLSettings.h
+++ b/WebCore/kwq/KWQKHTMLSettings.h
@@ -40,59 +40,81 @@ public:
         KAnimationEnabled
     };
     
-    static void init() { }
-
+    KHTMLSettings() {};
+    
     // Font settings
-    static const QString &stdFontName();
-    static const QString &fixedFontName();
-    static const QString &serifFontName();
-    static const QString &sansSerifFontName();
-    static const QString &cursiveFontName();
-    static const QString &fantasyFontName();
+    const QString &stdFontName() const;
+    const QString &fixedFontName() const;
+    const QString &serifFontName() const;
+    const QString &sansSerifFontName() const;
+    const QString &cursiveFontName() const;
+    const QString &fantasyFontName() const;
     
     static const QString &settingsToCSS() { return QString::null; }
 
     static const QString &encoding();
 
-    static int minFontSize();
-    static int mediumFontSize();
-    static int mediumFixedFontSize();
+    int minFontSize() const;
+    int mediumFontSize() const;
+    int mediumFixedFontSize() const;
 
     static bool changeCursor() { return true; }
 
     static bool isFormCompletionEnabled() { return false; }
     static int maxFormCompletionItems() { return 0; }
 
-    static bool autoLoadImages();
+    bool autoLoadImages() const;
     static KAnimationAdvice showAnimations() { return KAnimationEnabled; }
 
-    static bool isJavaScriptEnabled();
-    static bool isJavaScriptEnabled(const QString &host) { return isJavaScriptEnabled(); }
-    static bool isJavaScriptDebugEnabled() { return false; }
-    static bool isJavaEnabled();
-    static bool isJavaEnabled(const QString &host) { return isJavaEnabled(); }
-    static bool isPluginsEnabled();
-    static bool isPluginsEnabled(const QString &host) { return isPluginsEnabled(); }
+    bool isJavaScriptEnabled() const;
+    bool JavaScriptCanOpenWindowsAutomatically() const;
+    bool isJavaScriptEnabled(const QString &host) const { return isJavaScriptEnabled(); }
+    bool isJavaScriptDebugEnabled() const { return false; }
+    bool isJavaEnabled() const;
+    bool isJavaEnabled(const QString &host) const { return isJavaEnabled(); }
+    bool isPluginsEnabled() const;
+    bool isPluginsEnabled(const QString &host) const { return isPluginsEnabled(); }
     
-    static const QString &userStyleSheet();
+    const QString &userStyleSheet();
 
-    static void setStdFontName(const QString &);
-    static void setFixedFontName(const QString &);
-    static void setSerifFontName(const QString &);
-    static void setSansSerifFontName(const QString &);
-    static void setCursiveFontName(const QString &);
-    static void setFantasyFontName(const QString &);
+    void setStdFontName(const QString &);
+    void setFixedFontName(const QString &);
+    void setSerifFontName(const QString &);
+    void setSansSerifFontName(const QString &);
+    void setCursiveFontName(const QString &);
+    void setFantasyFontName(const QString &);
     
-    static void setMinFontSize(int);
-    static void setMediumFontSize(int);
-    static void setMediumFixedFontSize(int);
+    void setMinFontSize(int);
+    void setMediumFontSize(int);
+    void setMediumFixedFontSize(int);
     
-    static void setAutoLoadImages(bool);
-    static void setIsJavaScriptEnabled(bool);
-    static void setIsJavaEnabled(bool);
-    static void setArePluginsEnabled(bool);
+    void setAutoLoadImages(bool);
+    void setIsJavaScriptEnabled(bool);
+    void setIsJavaEnabled(bool);
+    void setArePluginsEnabled(bool);
+    void setJavaScriptCanOpenWindowsAutomatically(bool);
+
+    void setUserStyleSheet(const QString &);
 
-    static void setUserStyleSheet(const QString &);
+private:
+    QString _stdFontName;
+    QString _fixedFontName;
+    QString _serifFontName;
+    QString _sansSerifFontName;
+    QString _cursiveFontName;
+    QString _fantasyFontName;
+    QString _encoding;
+    QString _userStyleSheetLocation;
+    
+    int _minimumFontSize;
+    int _defaultFontSize;
+    int _defaultFixedFontSize;
+    uint _JavaEnabled:1;
+    uint _willLoadImagesAutomatically:1;
+    uint _pluginsEnabled:1;
+    uint _JavaScriptEnabled:1;
+    uint _JavaScriptCanOpenWindowsAutomatically:1;
+    
 };
 
 #endif
diff --git a/WebCore/kwq/KWQKHTMLSettings.mm b/WebCore/kwq/KWQKHTMLSettings.mm
index e87fe4d..9b5bf81 100644
--- a/WebCore/kwq/KWQKHTMLSettings.mm
+++ b/WebCore/kwq/KWQKHTMLSettings.mm
@@ -25,48 +25,34 @@
 
 #import "KWQKHTMLSettings.h"
 
-static int minimumFontSize;
-static int defaultFontSize;
-static int defaultFixedFontSize;
-static bool JavaEnabled;
-static bool willLoadImagesAutomatically;
-static bool pluginsEnabled;
-static bool JavaScriptEnabled;
-
-const QString &KHTMLSettings::stdFontName()
+const QString &KHTMLSettings::stdFontName() const
 {
-    static QString name;
-    return name;
+    return _stdFontName;
 }
 
-const QString &KHTMLSettings::fixedFontName()
+const QString &KHTMLSettings::fixedFontName() const
 {
-    static QString name;
-    return name;
+    return _fixedFontName;
 }
 
-const QString &KHTMLSettings::serifFontName()
+const QString &KHTMLSettings::serifFontName() const
 {
-    static QString name;
-    return name;
+    return _fixedFontName;
 }
 
-const QString &KHTMLSettings::sansSerifFontName()
+const QString &KHTMLSettings::sansSerifFontName() const
 {
-    static QString name;
-    return name;
+    return _sansSerifFontName;
 }
 
-const QString &KHTMLSettings::cursiveFontName()
+const QString &KHTMLSettings::cursiveFontName() const
 {
-    static QString name;
-    return name;
+    return _cursiveFontName;
 }
 
-const QString &KHTMLSettings::fantasyFontName()
+const QString &KHTMLSettings::fantasyFontName() const
 {
-    static QString name;
-    return name;
+    return _fantasyFontName;
 }
 
 const QString &KHTMLSettings::encoding()
@@ -75,113 +61,122 @@ const QString &KHTMLSettings::encoding()
     return latin1;
 }
 
-int KHTMLSettings::minFontSize()
+int KHTMLSettings::minFontSize() const
+{
+    return _minimumFontSize;
+}
+
+int KHTMLSettings::mediumFontSize() const
 {
-    return minimumFontSize;
+    return _defaultFontSize;
 }
 
-int KHTMLSettings::mediumFontSize()
+int KHTMLSettings::mediumFixedFontSize() const
 {
-    return defaultFontSize;
+    return _defaultFixedFontSize;
 }
 
-int KHTMLSettings::mediumFixedFontSize()
+bool KHTMLSettings::isJavaEnabled() const
 {
-    return defaultFixedFontSize;
+    return _JavaEnabled;
 }
 
-bool KHTMLSettings::isJavaEnabled()
+bool KHTMLSettings::autoLoadImages() const
 {
-    return JavaEnabled;
+    return _willLoadImagesAutomatically;
 }
 
-bool KHTMLSettings::autoLoadImages()
+bool KHTMLSettings::isPluginsEnabled() const
 {
-    return willLoadImagesAutomatically;
+    return _pluginsEnabled;
 }
 
-bool KHTMLSettings::isPluginsEnabled()
+bool KHTMLSettings::isJavaScriptEnabled() const
 {
-    return pluginsEnabled;
+    return _JavaScriptEnabled;
 }
 
-bool KHTMLSettings::isJavaScriptEnabled()
+bool KHTMLSettings::JavaScriptCanOpenWindowsAutomatically() const
 {
-    return JavaScriptEnabled;
+    return _JavaScriptCanOpenWindowsAutomatically;
 }
 
 const QString &KHTMLSettings::userStyleSheet()
 {
-    static QString location;
-    return location;
+    return _userStyleSheetLocation;
 }
 
 void KHTMLSettings::setStdFontName(const QString &n)
 {
-    const_cast<QString &>(stdFontName()) = n;
+    _stdFontName = n;
 }
 
 void KHTMLSettings::setFixedFontName(const QString &n)
 {
-    const_cast<QString &>(fixedFontName()) = n;
+    _fixedFontName = n;
 }
 
 void KHTMLSettings::setSerifFontName(const QString &n)
 {
-    const_cast<QString &>(serifFontName()) = n;
+    _serifFontName = n;
 }
 
 void KHTMLSettings::setSansSerifFontName(const QString &n)
 {
-    const_cast<QString &>(sansSerifFontName()) = n;
+    _sansSerifFontName = n;
 }
 
 void KHTMLSettings::setCursiveFontName(const QString &n)
 {
-    const_cast<QString &>(cursiveFontName()) = n;
+    _cursiveFontName = n;
 }
 
 void KHTMLSettings::setFantasyFontName(const QString &n)
 {
-    const_cast<QString &>(fantasyFontName()) = n;
+    _fantasyFontName = n;
 }
 
 void KHTMLSettings::setMinFontSize(int i)
 {
-    minimumFontSize = i;
+    _minimumFontSize = i;
 }
 
 void KHTMLSettings::setMediumFontSize(int i)
 {
-    defaultFontSize = i;
+    _defaultFontSize = i;
 }
 
 void KHTMLSettings::setMediumFixedFontSize(int i)
 {
-    defaultFixedFontSize = i;
+    _defaultFixedFontSize = i;
 }
 
 void KHTMLSettings::setAutoLoadImages(bool b)
 {
-    willLoadImagesAutomatically = b;
+    _willLoadImagesAutomatically = b;
 }
 
 void KHTMLSettings::setIsJavaScriptEnabled(bool b)
 {
-    JavaScriptEnabled = b;
+    _JavaScriptEnabled = b;
 }
 
 void KHTMLSettings::setIsJavaEnabled(bool b)
 {
-    JavaEnabled = b;
+    _JavaEnabled = b;
 }
 
 void KHTMLSettings::setArePluginsEnabled(bool b)
 {
-    pluginsEnabled = b;
+    _pluginsEnabled = b;
+}
+
+void KHTMLSettings::setJavaScriptCanOpenWindowsAutomatically(bool b)
+{
+    _JavaScriptCanOpenWindowsAutomatically = b;
 }
 
 void KHTMLSettings::setUserStyleSheet(const QString &n)
 {
-    const_cast<QString &>(userStyleSheet()) = n;
+    _userStyleSheetLocation = n;
 }
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index 376bc6d..d9ebbca 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -49,6 +49,7 @@ typedef khtml::RenderPart KHTMLRenderPart;
 
 @class WebError;
 @class WebFrame;
+ at class WebCoreSettings;
 
 @protocol WebCoreDOMTreeCopier;
 @protocol WebCoreRenderTreeCopier;
@@ -91,6 +92,8 @@ enum FrameBorderStyle {
     BOOL _drawSelectionOnly;
 }
 
+- (void)initializeSettings: (WebCoreSettings *)settings;
+
 - (void)setRenderPart:(KHTMLRenderPart *)renderPart;
 - (KHTMLRenderPart *)renderPart;
 
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index d86e556..d8487a2 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -54,6 +54,7 @@
 #import "WebCoreDOMPrivate.h"
 #import "WebCoreImageRenderer.h"
 #import "WebCoreTextRendererFactory.h"
+#import "WebCoreSettings.h"
 
 using DOM::DocumentImpl;
 using DOM::Node;
@@ -96,11 +97,15 @@ static bool initializedObjectCacheSize = FALSE;
         khtml::Cache::setSize([self getObjectCacheSize]);
         initializedObjectCacheSize = TRUE;
     }
-
-
+    
     return self;
 }
 
+- (void)initializeSettings: (WebCoreSettings *)settings
+{
+    _part->setSettings ([settings settings]);
+}
+
 - (void)dealloc
 {
     [self removeFromFrame];
diff --git a/WebCore/kwq/WebCoreSettings.h b/WebCore/kwq/WebCoreSettings.h
index bb37a7f..02b7110 100644
--- a/WebCore/kwq/WebCoreSettings.h
+++ b/WebCore/kwq/WebCoreSettings.h
@@ -25,6 +25,12 @@
 
 #import <Foundation/Foundation.h>
 
+#ifdef __cplusplus
+class KHTMLSettings;
+#else
+ at class KHTMLSettings;
+#endif
+
 @interface WebCoreSettings : NSObject
 {
     NSString *standardFontFamily;
@@ -42,10 +48,10 @@
     BOOL JavaScriptCanOpenWindowsAutomatically;
     BOOL willLoadImagesAutomatically;
     NSString *userStyleSheetLocation;
+    
+    KHTMLSettings *settings;
 }
 
-+ (WebCoreSettings *)sharedSettings;
-
 - (void)setStandardFontFamily:(NSString *)family;
 - (NSString *)standardFontFamily;
 
@@ -91,4 +97,6 @@
 - (void)setUserStyleSheetLocation:(NSString *)location;
 - (NSString *)userStyleSheetLocation;
 
+- (KHTMLSettings *)settings;
+
 @end
diff --git a/WebCore/kwq/WebCoreSettings.mm b/WebCore/kwq/WebCoreSettings.mm
index 711dbf4..aecdf19 100644
--- a/WebCore/kwq/WebCoreSettings.mm
+++ b/WebCore/kwq/WebCoreSettings.mm
@@ -31,15 +31,6 @@
 
 @implementation WebCoreSettings
 
-+ (WebCoreSettings *)sharedSettings
-{
-    static WebCoreSettings *shared;
-    if (!shared) {
-        shared = [[WebCoreSettings alloc] init];
-    }
-    return shared;
-}
-
 - (void)dealloc
 {
     [standardFontFamily release];
@@ -49,9 +40,17 @@
     [cursiveFontFamily release];
     [fantasyFontFamily release];
 
+    delete settings;
+    
     [super dealloc];
 }
 
+- init
+{
+    settings = new KHTMLSettings();
+    return [super init];
+}
+
 - (void)_updateAllViews
 {
     for (QPtrListIterator<KWQKHTMLPart> it(KWQKHTMLPart::instances()); it.current(); ++it) {
@@ -66,7 +65,7 @@
     }
     [standardFontFamily release];
     standardFontFamily = [s copy];
-    KHTMLSettings::setStdFontName(QString::fromNSString(s));
+    settings->setStdFontName(QString::fromNSString(s));
     [self _updateAllViews];
 }
 
@@ -82,7 +81,7 @@
     }
     [fixedFontFamily release];
     fixedFontFamily = [s copy];
-    KHTMLSettings::setFixedFontName(QString::fromNSString(s));
+    settings->setFixedFontName(QString::fromNSString(s));
     [self _updateAllViews];
 }
 
@@ -98,7 +97,7 @@
     }
     [serifFontFamily release];
     serifFontFamily = [s copy];
-    KHTMLSettings::setSerifFontName(QString::fromNSString(s));
+    settings->setSerifFontName(QString::fromNSString(s));
     [self _updateAllViews];
 }
 
@@ -114,7 +113,7 @@
     }
     [sansSerifFontFamily release];
     sansSerifFontFamily = [s copy];
-    KHTMLSettings::setSansSerifFontName(QString::fromNSString(s));
+    settings->setSansSerifFontName(QString::fromNSString(s));
     [self _updateAllViews];
 }
 
@@ -130,7 +129,7 @@
     }
     [cursiveFontFamily release];
     cursiveFontFamily = [s copy];
-    KHTMLSettings::setCursiveFontName(QString::fromNSString(s));
+    settings->setCursiveFontName(QString::fromNSString(s));
     [self _updateAllViews];
 }
 
@@ -146,7 +145,7 @@
     }
     [fantasyFontFamily release];
     fantasyFontFamily = [s copy];
-    KHTMLSettings::setFantasyFontName(QString::fromNSString(s));
+    settings->setFantasyFontName(QString::fromNSString(s));
     [self _updateAllViews];
 }
 
@@ -161,7 +160,7 @@
         return;
     }
     minimumFontSize = size;
-    KHTMLSettings::setMinFontSize((int)rint(size));
+    settings->setMinFontSize((int)rint(size));
     [self _updateAllViews];
 }
 
@@ -176,7 +175,7 @@
         return;
     }
     defaultFontSize = size;
-    KHTMLSettings::setMediumFontSize((int)rint(size));
+    settings->setMediumFontSize((int)rint(size));
     [self _updateAllViews];
 }
 
@@ -191,7 +190,7 @@
         return;
     }
     defaultFixedFontSize = size;
-    KHTMLSettings::setMediumFixedFontSize((int)rint(size));
+    settings->setMediumFixedFontSize((int)rint(size));
     [self _updateAllViews];
 }
 
@@ -203,7 +202,7 @@
 - (void)setJavaEnabled:(BOOL)enabled
 {
     JavaEnabled = enabled;
-    KHTMLSettings::setIsJavaEnabled(enabled);
+    settings->setIsJavaEnabled(enabled);
 }
 
 - (BOOL)JavaEnabled
@@ -214,7 +213,7 @@
 - (void)setPluginsEnabled:(BOOL)enabled
 {
     pluginsEnabled = enabled;
-    KHTMLSettings::setArePluginsEnabled(enabled);
+    settings->setArePluginsEnabled(enabled);
 }
 
 - (BOOL)pluginsEnabled
@@ -225,7 +224,7 @@
 - (void)setJavaScriptEnabled:(BOOL)enabled
 {
     JavaScriptEnabled = enabled;
-    KHTMLSettings::setIsJavaScriptEnabled(enabled);
+    settings->setIsJavaScriptEnabled(enabled);
 }
 
 - (BOOL)JavaScriptEnabled
@@ -236,6 +235,7 @@
 - (void)setJavaScriptCanOpenWindowsAutomatically:(BOOL)enabled
 {
     JavaScriptCanOpenWindowsAutomatically = enabled;
+    settings->setJavaScriptCanOpenWindowsAutomatically(enabled);
 }
 
 - (BOOL)JavaScriptCanOpenWindowsAutomatically
@@ -246,7 +246,7 @@
 - (void)setWillLoadImagesAutomatically:(BOOL)load
 {
     willLoadImagesAutomatically = load;
-    KHTMLSettings::setAutoLoadImages(load);
+    settings->setAutoLoadImages(load);
 }
 
 - (BOOL)willLoadImagesAutomatically
@@ -261,7 +261,7 @@
     }
     [userStyleSheetLocation release];
     userStyleSheetLocation = [s copy];
-    KHTMLSettings::setUserStyleSheet(QString::fromNSString(s));
+    settings->setUserStyleSheet(QString::fromNSString(s));
     [self _updateAllViews];
 }
 
@@ -270,4 +270,9 @@
     return userStyleSheetLocation;
 }
 
+- (KHTMLSettings *)settings
+{
+    return settings;
+}
+
 @end
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index ea82f23..5ccb2d0 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,79 @@
+2003-02-07  Richard Williamson   <rjw at apple.com>
+
+        Changes to support per WebController preferences.
+        
+        Reviewed by Maciej and Ken.
+
+        * WebView.subproj/WebController.m:
+        (-[WebController setPreferences:]):
+        * WebView.subproj/WebControllerPrivate.h:
+        * WebView.subproj/WebControllerPrivate.m:
+        (-[WebControllerPrivate init]):
+        (-[WebControllerPrivate dealloc]):
+        (-[WebController _setFormDelegate:]):
+        (-[WebController _formDelegate]):
+        (-[WebController _settings]):
+        (-[WebController _updateWebCoreSettingsFromPreferences:]):
+        (-[WebController _releaseUserAgentStrings]):
+        (-[WebController _preferencesChangedNotification:]):
+        * WebView.subproj/WebFrame.m:
+        (-[WebFrame initWithName:webView:controller:]):
+        * WebView.subproj/WebPreferences.h:
+        * WebView.subproj/WebPreferences.m:
+        (-[WebPreferences _postPreferencesChangesNotification]):
+        (+[WebPreferences load]):
+        (-[WebPreferences _stringValueForKey:]):
+        (-[WebPreferences _setStringValue:forKey:]):
+        (-[WebPreferences _integerValueForKey:]):
+        (-[WebPreferences _setIntegerValue:forKey:]):
+        (-[WebPreferences _boolValueForKey:]):
+        (-[WebPreferences _setBoolValue:forKey:]):
+        (-[WebPreferences standardFontFamily]):
+        (-[WebPreferences setStandardFontFamily:]):
+        (-[WebPreferences fixedFontFamily]):
+        (-[WebPreferences setFixedFontFamily:]):
+        (-[WebPreferences serifFontFamily]):
+        (-[WebPreferences setSerifFontFamily:]):
+        (-[WebPreferences sansSerifFontFamily]):
+        (-[WebPreferences setSansSerifFontFamily:]):
+        (-[WebPreferences cursiveFontFamily]):
+        (-[WebPreferences setCursiveFontFamily:]):
+        (-[WebPreferences fantasyFontFamily]):
+        (-[WebPreferences setFantasyFontFamily:]):
+        (-[WebPreferences defaultFontSize]):
+        (-[WebPreferences setDefaultFontSize:]):
+        (-[WebPreferences defaultFixedFontSize]):
+        (-[WebPreferences setDefaultFixedFontSize:]):
+        (-[WebPreferences minimumFontSize]):
+        (-[WebPreferences setMinimumFontSize:]):
+        (-[WebPreferences defaultTextEncodingName]):
+        (-[WebPreferences setDefaultTextEncodingName:]):
+        (-[WebPreferences userStyleSheetEnabled]):
+        (-[WebPreferences setUserStyleSheetEnabled:]):
+        (-[WebPreferences userStyleSheetLocation]):
+        (-[WebPreferences setUserStyleSheetLocation:]):
+        (-[WebPreferences JavaEnabled]):
+        (-[WebPreferences setJavaEnabled:]):
+        (-[WebPreferences JavaScriptEnabled]):
+        (-[WebPreferences setJavaScriptEnabled:]):
+        (-[WebPreferences JavaScriptCanOpenWindowsAutomatically]):
+        (-[WebPreferences setJavaScriptCanOpenWindowsAutomatically:]):
+        (-[WebPreferences pluginsEnabled]):
+        (-[WebPreferences setPluginsEnabled:]):
+        (-[WebPreferences allowAnimatedImages]):
+        (-[WebPreferences allowAnimatedImageLooping]):
+        (-[WebPreferences setAllowAnimatedImageLooping:]):
+        (-[WebPreferences setWillLoadImagesAutomatically:]):
+        (-[WebPreferences willLoadImagesAutomatically]):
+        (-[WebPreferences _initialTimedLayoutDelay]):
+        (-[WebPreferences _initialTimedLayoutSize]):
+        (-[WebPreferences _pageCacheSize]):
+        (-[WebPreferences _objectCacheSize]):
+        (-[WebPreferences _initialTimedLayoutEnabled]):
+        (-[WebPreferences _resourceTimedLayoutDelay]):
+        (-[WebPreferences _resourceTimedLayoutEnabled]):
+        * WebView.subproj/WebPreferencesPrivate.h:
+
 2003-02-06  Chris Blumenberg  <cblu at apple.com>
 
 	- Made WebDownload.h a public header.
diff --git a/WebKit/WebView.subproj/WebController.m b/WebKit/WebView.subproj/WebController.m
index fd21bad..f440999 100644
--- a/WebKit/WebView.subproj/WebController.m
+++ b/WebKit/WebView.subproj/WebController.m
@@ -72,13 +72,12 @@ NSString *WebElementLinkTitleKey = 		@"WebElementLinkTitle";
 
     [self setUsesBackForwardList: YES];
     
-    [[NSNotificationCenter defaultCenter] addObserver:self
-                                             selector:@selector(_defaultsDidChange)
-                                                 name:NSUserDefaultsDidChangeNotification
-                                               object:[NSUserDefaults standardUserDefaults]];
-    
     ++WebControllerCount;
 
+    [self _updateWebCoreSettingsFromPreferences: [WebPreferences standardPreferences]];
+
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_preferencesChangedNotification:)
+                                                 name:WebPreferencesChangedNotification object:[self preferences]];
     return self;
 }
 
@@ -99,8 +98,11 @@ NSString *WebElementLinkTitleKey = 		@"WebElementLinkTitle";
 - (void)setPreferences: (WebPreferences *)prefs
 {
     if (_private->preferences != prefs){
+        [[NSNotificationCenter defaultCenter] removeObserver: self name: WebPreferencesChangedNotification object: [self preferences]];
         [_private->preferences release];
         _private->preferences = [prefs retain];
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_preferencesChangedNotification:)
+                                                    name:WebPreferencesChangedNotification object:[self preferences]];
     }
 }
 
diff --git a/WebKit/WebView.subproj/WebControllerPrivate.h b/WebKit/WebView.subproj/WebControllerPrivate.h
index a7c159c..733fa7b 100644
--- a/WebKit/WebView.subproj/WebControllerPrivate.h
+++ b/WebKit/WebView.subproj/WebControllerPrivate.h
@@ -9,6 +9,7 @@
 @class WebError;
 @class WebFrame;
 @class WebPreferences;
+ at class WebCoreSettings;
 @protocol WebFormDelegate;
 
 typedef enum { Safari, MacIE, WinIE } UserAgentStringType;
@@ -29,8 +30,6 @@ enum { NumUserAgentStringTypes = WinIE + 1 };
     
     id <WebContextMenuDelegate> defaultContextMenuDelegate;
 
-    WebPreferences *preferences;
-    
     WebBackForwardList *backForwardList;
     BOOL useBackForwardList;
     
@@ -44,6 +43,9 @@ enum { NumUserAgentStringTypes = WinIE + 1 };
 
     NSString *controllerSetName;
     NSString *topLevelFrameName;
+
+    WebPreferences *preferences;
+    WebCoreSettings *settings;
     
     BOOL lastElementWasNonNil;
 }
@@ -80,5 +82,7 @@ enum { NumUserAgentStringTypes = WinIE + 1 };
 - (void)_setFormDelegate: (id<WebFormDelegate>)delegate;
 - (id<WebFormDelegate>)_formDelegate;
 
+- (WebCoreSettings *)_settings;
+- (void)_updateWebCoreSettingsFromPreferences: (WebPreferences *)prefs;
 
 @end
diff --git a/WebKit/WebView.subproj/WebControllerPrivate.m b/WebKit/WebView.subproj/WebControllerPrivate.m
index 23d5cdf..c9cc10a 100644
--- a/WebKit/WebView.subproj/WebControllerPrivate.m
+++ b/WebKit/WebView.subproj/WebControllerPrivate.m
@@ -27,6 +27,8 @@
 #import <WebFoundation/WebResourceHandle.h>
 #import <WebFoundation/WebResourceRequest.h>
 
+#import <WebCore/WebCoreSettings.h>
+
 @implementation WebControllerPrivate
 
 - init 
@@ -34,6 +36,9 @@
     backForwardList = [[WebBackForwardList alloc] init];
     defaultContextMenuDelegate = [[WebDefaultContextMenuDelegate alloc] init];
     textSizeMultiplier = 1;
+
+    settings = [[WebCoreSettings alloc] init];
+
     return self;
 }
 
@@ -75,6 +80,7 @@
     [topLevelFrameName release];
 
     [preferences release];
+    [settings release];
     
     [super dealloc];
 }
@@ -340,7 +346,46 @@
     _private->lastElementWasNonNil = dictionary != nil;
 }
 
-- (void)_defaultsDidChange
+- (void)_setFormDelegate: (id<WebFormDelegate>)delegate
+{
+    _private->formDelegate = delegate;
+}
+
+- (id<WebFormDelegate>)_formDelegate
+{
+    return _private->formDelegate;
+}
+
+- (WebCoreSettings *)_settings
+{
+    return _private->settings;
+}
+
+- (void)_updateWebCoreSettingsFromPreferences: (WebPreferences *)preferences
+{
+    [_private->settings setCursiveFontFamily:[preferences cursiveFontFamily]];
+    [_private->settings setDefaultFixedFontSize:[preferences defaultFixedFontSize]];
+    [_private->settings setDefaultFontSize:[preferences defaultFontSize]];
+    [_private->settings setFantasyFontFamily:[preferences fantasyFontFamily]];
+    [_private->settings setFixedFontFamily:[preferences fixedFontFamily]];
+    [_private->settings setJavaEnabled:[preferences JavaEnabled]];
+    [_private->settings setJavaScriptEnabled:[preferences JavaScriptEnabled]];
+    [_private->settings setJavaScriptCanOpenWindowsAutomatically:[preferences JavaScriptCanOpenWindowsAutomatically]];
+    [_private->settings setMinimumFontSize:[preferences minimumFontSize]];
+    [_private->settings setPluginsEnabled:[preferences pluginsEnabled]];
+    [_private->settings setSansSerifFontFamily:[preferences sansSerifFontFamily]];
+    [_private->settings setSerifFontFamily:[preferences serifFontFamily]];
+    [_private->settings setStandardFontFamily:[preferences standardFontFamily]];
+    [_private->settings setWillLoadImagesAutomatically:[preferences willLoadImagesAutomatically]];
+
+    if ([preferences userStyleSheetEnabled]) {
+        [_private->settings setUserStyleSheetLocation:[preferences userStyleSheetLocation]];
+    } else {
+        [_private->settings setUserStyleSheetLocation:@""];
+    }
+}
+
+- (void)_releaseUserAgentStrings
 {
     int i;
     for (i = 0; i != NumUserAgentStringTypes; ++i) {
@@ -349,14 +394,14 @@
     }
 }
 
-- (void)_setFormDelegate: (id<WebFormDelegate>)delegate
-{
-    _private->formDelegate = delegate;
-}
 
-- (id<WebFormDelegate>)_formDelegate
+- (void)_preferencesChangedNotification: (NSNotification *)notification
 {
-    return _private->formDelegate;
+    WebPreferences *preferences = (WebPreferences *)[notification object];
+    
+    ASSERT (preferences == [self preferences]);
+    [self _releaseUserAgentStrings];
+    [self _updateWebCoreSettingsFromPreferences: preferences];
 }
 
 @end
diff --git a/WebKit/WebView.subproj/WebFrame.m b/WebKit/WebView.subproj/WebFrame.m
index 74328e8..c72c816 100644
--- a/WebKit/WebView.subproj/WebFrame.m
+++ b/WebKit/WebView.subproj/WebFrame.m
@@ -42,6 +42,7 @@
     [self setController:c];
 
     _private->bridge = [[WebBridge alloc] init];
+    [_private->bridge initializeSettings: [c _settings]];
     [_private->bridge setFrame:self];
     [_private->bridge setName:n];
 
diff --git a/WebKit/WebView.subproj/WebPreferences.h b/WebKit/WebView.subproj/WebPreferences.h
index 8e42295..f2f87b8 100644
--- a/WebKit/WebView.subproj/WebPreferences.h
+++ b/WebKit/WebView.subproj/WebPreferences.h
@@ -7,10 +7,15 @@
 
 #import <Foundation/Foundation.h>
 
+extern NSString *WebPreferencesChangedNotification;
+
 /*!
     @class WebPreferences
 */
 @interface WebPreferences: NSObject
+{
+    NSMutableDictionary *values;
+}
 
 /*!
     @method standardPreferences
diff --git a/WebKit/WebView.subproj/WebPreferences.m b/WebKit/WebView.subproj/WebPreferences.m
index b8e4ec5..61c53ac 100644
--- a/WebKit/WebView.subproj/WebPreferences.m
+++ b/WebKit/WebView.subproj/WebPreferences.m
@@ -5,6 +5,8 @@
 
 #import "WebPreferences.h"
 
+#import <WebFoundation/WebNSDictionaryExtras.h>
+
 #import <WebCore/WebCoreSettings.h>
 
 // These are private because callers should be using the cover methods
@@ -36,6 +38,8 @@
 #define WebKitPageCacheSizePreferenceKey @"WebKitPageCacheSizePreferenceKey"
 #define WebKitObjectCacheSizePreferenceKey @"WebKitObjectCacheSizePreferenceKey"
 
+NSString *WebPreferencesChangedNotification = @"WebPreferencesChangedNotification";
+
 @implementation WebPreferences
 
 + (WebPreferences *)standardPreferences
@@ -49,30 +53,11 @@
     return _standardPreferences;
 }
 
-- (void)_updateWebCoreSettings
-{
-    WebCoreSettings *settings = [WebCoreSettings sharedSettings];
-
-    [settings setCursiveFontFamily:[self cursiveFontFamily]];
-    [settings setDefaultFixedFontSize:[self defaultFixedFontSize]];
-    [settings setDefaultFontSize:[self defaultFontSize]];
-    [settings setFantasyFontFamily:[self fantasyFontFamily]];
-    [settings setFixedFontFamily:[self fixedFontFamily]];
-    [settings setJavaEnabled:[self JavaEnabled]];
-    [settings setJavaScriptEnabled:[self JavaScriptEnabled]];
-    [settings setJavaScriptCanOpenWindowsAutomatically:[self JavaScriptCanOpenWindowsAutomatically]];
-    [settings setMinimumFontSize:[self minimumFontSize]];
-    [settings setPluginsEnabled:[self pluginsEnabled]];
-    [settings setSansSerifFontFamily:[self sansSerifFontFamily]];
-    [settings setSerifFontFamily:[self serifFontFamily]];
-    [settings setStandardFontFamily:[self standardFontFamily]];
-    [settings setWillLoadImagesAutomatically:[self willLoadImagesAutomatically]];
-    
-    if ([self userStyleSheetEnabled]) {
-        [settings setUserStyleSheetLocation:[self userStyleSheetLocation]];
-    } else {
-        [settings setUserStyleSheetLocation:@""];
-    }
+- (void)_postPreferencesChangesNotification
+{
+    [[NSNotificationCenter defaultCenter]
+        postNotificationName:WebPreferencesChangedNotification object:self
+                    userInfo:nil];
 }
 
 // if we ever have more than one WebPreferences object, this would move to init
@@ -112,256 +97,296 @@
 
     [[NSUserDefaults standardUserDefaults] registerDefaults:dict];
 
+/*
     [[NSNotificationCenter defaultCenter]
         addObserver:[self standardPreferences]
-           selector:@selector(_updateWebCoreSettings)
+           selector:@selector(_postPreferencesChangesNotification)
                name:NSUserDefaultsDidChangeNotification
              object:[NSUserDefaults standardUserDefaults]];
-    
-    [[self standardPreferences] _updateWebCoreSettings];
+*/    
+    [[self standardPreferences] _postPreferencesChangesNotification];
 
     [pool release];
 }
 
+- (NSString *)_stringValueForKey: (NSString *)key
+{
+    NSString *s = [values objectForKey:key];
+    if (s)
+        return s;
+    return [[NSUserDefaults standardUserDefaults] stringForKey:key];
+}
+
+- (void)_setStringValue: (NSString *)value forKey: (NSString *)key
+{
+    if (self == [WebPreferences standardPreferences])
+        [[NSUserDefaults standardUserDefaults] setObject:value forKey:key];
+    else
+        [values setObject: value forKey: key];
+    [self _postPreferencesChangesNotification];
+}
+
+- (int)_integerValueForKey: (NSString *)key
+{
+    NSNumber *n = [values objectForKey:key];
+    if (n)
+        return [n intValue];
+    return [[NSUserDefaults standardUserDefaults] integerForKey:key];
+}
+
+- (void)_setIntegerValue: (int)value forKey: (NSString *)key
+{
+    if (self == [WebPreferences standardPreferences])
+        [[NSUserDefaults standardUserDefaults] setInteger:value forKey:key];
+    else
+        [values _web_setInt: value forKey: key];
+    [self _postPreferencesChangesNotification];
+}
+
+- (int)_boolValueForKey: (NSString *)key
+{
+    NSNumber *n = [values objectForKey:key];
+    if (n)
+        return [n boolValue];
+    return [[NSUserDefaults standardUserDefaults] integerForKey:key];
+}
+
+- (void)_setBoolValue: (BOOL)value forKey: (NSString *)key
+{
+    if (self == [WebPreferences standardPreferences])
+        [[NSUserDefaults standardUserDefaults] setBool:value forKey:key];
+    else
+        [values _web_setBool: value forKey: key];
+    [self _postPreferencesChangesNotification];
+}
+
 - (NSString *)standardFontFamily
 {
-    return [[NSUserDefaults standardUserDefaults] stringForKey:WebKitStandardFontPreferenceKey];
+    return [self _stringValueForKey: WebKitStandardFontPreferenceKey];
 }
 
 - (void)setStandardFontFamily:(NSString *)family
 {
-    [[NSUserDefaults standardUserDefaults] setObject:family forKey:WebKitStandardFontPreferenceKey];
-    [self _updateWebCoreSettings];
+    [self _setStringValue: family forKey: WebKitStandardFontPreferenceKey];
 }
 
 - (NSString *)fixedFontFamily
 {
-    return [[NSUserDefaults standardUserDefaults] stringForKey:WebKitFixedFontPreferenceKey];
+    return [self _stringValueForKey: WebKitFixedFontPreferenceKey];
 }
 
 - (void)setFixedFontFamily:(NSString *)family
 {
-    [[NSUserDefaults standardUserDefaults] setObject:family forKey:WebKitFixedFontPreferenceKey];
-    [self _updateWebCoreSettings];
+    [self _setStringValue: family forKey: WebKitFixedFontPreferenceKey];
 }
 
 - (NSString *)serifFontFamily
 {
-    return [[NSUserDefaults standardUserDefaults] stringForKey:WebKitSerifFontPreferenceKey];
+    return [self _stringValueForKey: WebKitSerifFontPreferenceKey];
 }
 
-- (void)setSerifFontFamily:(NSString *)family
+- (void)setSerifFontFamily:(NSString *)family 
 {
-    [[NSUserDefaults standardUserDefaults] setObject:family forKey:WebKitSerifFontPreferenceKey];
-    [self _updateWebCoreSettings];
+    [self _setStringValue: family forKey: WebKitSerifFontPreferenceKey];
 }
 
 - (NSString *)sansSerifFontFamily
 {
-    return [[NSUserDefaults standardUserDefaults] stringForKey:WebKitSansSerifFontPreferenceKey];
+    return [self _stringValueForKey: WebKitSansSerifFontPreferenceKey];
 }
 
 - (void)setSansSerifFontFamily:(NSString *)family
 {
-    [[NSUserDefaults standardUserDefaults] setObject:family forKey:WebKitSansSerifFontPreferenceKey];
-    [self _updateWebCoreSettings];
+    [self _setStringValue: family forKey: WebKitSansSerifFontPreferenceKey];
 }
 
 - (NSString *)cursiveFontFamily
 {
-    return [[NSUserDefaults standardUserDefaults] stringForKey:WebKitCursiveFontPreferenceKey];
+    return [self _stringValueForKey: WebKitCursiveFontPreferenceKey];
 }
 
 - (void)setCursiveFontFamily:(NSString *)family
 {
-    [[NSUserDefaults standardUserDefaults] setObject:family forKey:WebKitCursiveFontPreferenceKey];
-    [self _updateWebCoreSettings];
+    [self _setStringValue: family forKey: WebKitCursiveFontPreferenceKey];
 }
 
 - (NSString *)fantasyFontFamily
 {
-    return [[NSUserDefaults standardUserDefaults] stringForKey:WebKitFantasyFontPreferenceKey];
+    return [self _stringValueForKey: WebKitFantasyFontPreferenceKey];
 }
 
 - (void)setFantasyFontFamily:(NSString *)family
 {
-    [[NSUserDefaults standardUserDefaults] setObject:family forKey:WebKitFantasyFontPreferenceKey];
-    [self _updateWebCoreSettings];
+    [self _setStringValue: family forKey: WebKitFantasyFontPreferenceKey];
 }
 
 - (int)defaultFontSize
 {
-    return [[NSUserDefaults standardUserDefaults] integerForKey:WebKitDefaultFontSizePreferenceKey];
+    return [self _integerValueForKey: WebKitDefaultFontSizePreferenceKey];
 }
 
 - (void)setDefaultFontSize:(int)size
 {
-    [[NSUserDefaults standardUserDefaults] setInteger:size forKey:WebKitDefaultFontSizePreferenceKey];
-    [self _updateWebCoreSettings];
+    return [self _setIntegerValue: size forKey: WebKitDefaultFontSizePreferenceKey];
 }
 
 - (int)defaultFixedFontSize
 {
-    return [[NSUserDefaults standardUserDefaults] integerForKey:WebKitDefaultFixedFontSizePreferenceKey];
+    return [self _integerValueForKey: WebKitDefaultFixedFontSizePreferenceKey];
 }
 
 - (void)setDefaultFixedFontSize:(int)size
 {
-    [[NSUserDefaults standardUserDefaults] setInteger:size forKey:WebKitDefaultFixedFontSizePreferenceKey];
-    [self _updateWebCoreSettings];
+    return [self _setIntegerValue: size forKey: WebKitDefaultFixedFontSizePreferenceKey];
 }
 
 - (int)minimumFontSize
 {
-    return [[NSUserDefaults standardUserDefaults] integerForKey:WebKitMinimumFontSizePreferenceKey];
+    return [self _integerValueForKey: WebKitMinimumFontSizePreferenceKey];
 }
 
 - (void)setMinimumFontSize:(int)size
 {
-    [[NSUserDefaults standardUserDefaults] setInteger:size forKey:WebKitMinimumFontSizePreferenceKey];
-    [self _updateWebCoreSettings];
+    return [self _setIntegerValue: size forKey: WebKitMinimumFontSizePreferenceKey];
 }
 
 - (NSString *)defaultTextEncodingName
 {
-    return [[NSUserDefaults standardUserDefaults] stringForKey:WebKitDefaultTextEncodingNamePreferenceKey];
+    return [self _stringValueForKey: WebKitDefaultTextEncodingNamePreferenceKey];
 }
 
 - (void)setDefaultTextEncodingName:(NSString *)encoding
 {
-    [[NSUserDefaults standardUserDefaults] setObject:encoding forKey:WebKitDefaultTextEncodingNamePreferenceKey];
+    [self _setStringValue: encoding forKey: WebKitDefaultTextEncodingNamePreferenceKey];
 }
 
 - (BOOL)userStyleSheetEnabled
 {
-    return [[NSUserDefaults standardUserDefaults] boolForKey:WebKitUserStyleSheetEnabledPreferenceKey];
+    return [self _boolValueForKey: WebKitUserStyleSheetEnabledPreferenceKey];
 }
 
 - (void)setUserStyleSheetEnabled:(BOOL)flag
 {
-    [[NSUserDefaults standardUserDefaults] setBool:flag forKey:WebKitUserStyleSheetEnabledPreferenceKey];
-    [self _updateWebCoreSettings];
+    [self _setBoolValue: flag forKey: WebKitUserStyleSheetEnabledPreferenceKey];
 }
 
 - (NSString *)userStyleSheetLocation
 {
-    return [[NSUserDefaults standardUserDefaults] stringForKey:WebKitUserStyleSheetLocationPreferenceKey];
+    return [self _stringValueForKey: WebKitUserStyleSheetLocationPreferenceKey];
 }
 
 - (void)setUserStyleSheetLocation:(NSString *)string
 {
-    [[NSUserDefaults standardUserDefaults] setObject:string forKey:WebKitUserStyleSheetLocationPreferenceKey];
-    [self _updateWebCoreSettings];
+    [self _setStringValue: string forKey: WebKitUserStyleSheetLocationPreferenceKey];
 }
 
 - (BOOL)JavaEnabled
 {
-    return [[NSUserDefaults standardUserDefaults] boolForKey:WebKitJavaEnabledPreferenceKey];
+    return [self _boolValueForKey: WebKitJavaEnabledPreferenceKey];
 }
 
 - (void)setJavaEnabled:(BOOL)flag
 {
-    [[NSUserDefaults standardUserDefaults] setBool:flag forKey:WebKitJavaEnabledPreferenceKey];
-    [self _updateWebCoreSettings];
+    [self _setBoolValue: flag forKey: WebKitJavaEnabledPreferenceKey];
 }
 
 - (BOOL)JavaScriptEnabled
 {
-    return [[NSUserDefaults standardUserDefaults] boolForKey:WebKitJavaScriptEnabledPreferenceKey];
+    return [self _boolValueForKey: WebKitJavaScriptEnabledPreferenceKey];
 }
 
 - (void)setJavaScriptEnabled:(BOOL)flag
 {
-    [[NSUserDefaults standardUserDefaults] setBool:flag forKey:WebKitJavaScriptEnabledPreferenceKey];
-    [self _updateWebCoreSettings];
+    [self _setBoolValue: flag forKey: WebKitJavaScriptEnabledPreferenceKey];
 }
 
 - (BOOL)JavaScriptCanOpenWindowsAutomatically
 {
-    return [[NSUserDefaults standardUserDefaults] boolForKey:WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey];
+    return [self _boolValueForKey: WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey];
 }
 
 - (void)setJavaScriptCanOpenWindowsAutomatically:(BOOL)flag
 {
-    [[NSUserDefaults standardUserDefaults] setBool:flag forKey:WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey];
-    [self _updateWebCoreSettings];
+    [self _setBoolValue: flag forKey: WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey];
 }
 
 - (BOOL)pluginsEnabled
 {
-    return [[NSUserDefaults standardUserDefaults] boolForKey:WebKitPluginsEnabledPreferenceKey];
+    return [self _boolValueForKey: WebKitPluginsEnabledPreferenceKey];
 }
 
 - (void)setPluginsEnabled:(BOOL)flag
 {
-    [[NSUserDefaults standardUserDefaults] setBool:flag forKey:WebKitPluginsEnabledPreferenceKey];
-    [self _updateWebCoreSettings];
+    [self _setBoolValue: flag forKey: WebKitPluginsEnabledPreferenceKey];
 }
 
-- (NSTimeInterval)_initialTimedLayoutDelay
+- (BOOL)allowAnimatedImages
 {
-    return (NSTimeInterval)[[NSUserDefaults standardUserDefaults] floatForKey:WebKitInitialTimedLayoutDelayPreferenceKey];
+    return [self _boolValueForKey: WebKitAllowAnimatedImagesPreferenceKey];
 }
 
-- (int)_initialTimedLayoutSize
+- (void)setAllowAnimatedImages:(BOOL)flag;
 {
-    return [[NSUserDefaults standardUserDefaults] integerForKey:WebKitInitialTimedLayoutDelayPreferenceKey];
+    [self _setBoolValue: flag forKey: WebKitAllowAnimatedImagesPreferenceKey];
 }
 
-- (int)_pageCacheSize
+- (BOOL)allowAnimatedImageLooping
 {
-    return [[NSUserDefaults standardUserDefaults] integerForKey:WebKitPageCacheSizePreferenceKey];
+    return [self _boolValueForKey: WebKitAllowAnimatedImageLoopingPreferenceKey];
 }
 
-- (int)_objectCacheSize
+- (void)setAllowAnimatedImageLooping: (BOOL)flag
 {
-    return [[NSUserDefaults standardUserDefaults] integerForKey:WebKitObjectCacheSizePreferenceKey];
+    [self _setBoolValue: flag forKey: WebKitAllowAnimatedImageLoopingPreferenceKey];
 }
 
-- (BOOL)_initialTimedLayoutEnabled
+- (void)setWillLoadImagesAutomatically: (BOOL)flag
 {
-    return [[NSUserDefaults standardUserDefaults] boolForKey:WebKitInitialTimedLayoutEnabledPreferenceKey];
+    [self _setBoolValue: flag forKey: WebKitDisplayImagesKey];
 }
 
-- (NSTimeInterval)_resourceTimedLayoutDelay
+- (BOOL)willLoadImagesAutomatically
 {
-    return [[NSUserDefaults standardUserDefaults] floatForKey:WebKitResourceTimedLayoutDelayPreferenceKey];
+    return [self _boolValueForKey: WebKitDisplayImagesKey];
 }
 
-- (BOOL)_resourceTimedLayoutEnabled
+ at end
+
+ at implementation WebPreferences (WebPrivate)
+
+- (NSTimeInterval)_initialTimedLayoutDelay
 {
-    return [[NSUserDefaults standardUserDefaults] boolForKey:WebKitResourceTimedLayoutEnabledPreferenceKey];
+    return (NSTimeInterval)[[NSUserDefaults standardUserDefaults] floatForKey:WebKitInitialTimedLayoutDelayPreferenceKey];
 }
 
-- (BOOL)allowAnimatedImages
+- (int)_initialTimedLayoutSize
 {
-    return [[NSUserDefaults standardUserDefaults] boolForKey:WebKitAllowAnimatedImagesPreferenceKey];
+    return [[NSUserDefaults standardUserDefaults] integerForKey:WebKitInitialTimedLayoutDelayPreferenceKey];
 }
 
-- (void)setAllowAnimatedImages:(BOOL)flag;
+- (int)_pageCacheSize
 {
-    [[NSUserDefaults standardUserDefaults] setBool:flag forKey:WebKitAllowAnimatedImagesPreferenceKey];
+    return [[NSUserDefaults standardUserDefaults] integerForKey:WebKitPageCacheSizePreferenceKey];
 }
 
-- (BOOL)allowAnimatedImageLooping
+- (int)_objectCacheSize
 {
-    return [[NSUserDefaults standardUserDefaults] boolForKey:WebKitAllowAnimatedImageLoopingPreferenceKey];
+    return [[NSUserDefaults standardUserDefaults] integerForKey:WebKitObjectCacheSizePreferenceKey];
 }
 
-- (void)setAllowAnimatedImageLooping: (BOOL)flag
+- (BOOL)_initialTimedLayoutEnabled
 {
-    [[NSUserDefaults standardUserDefaults] setBool:flag forKey:WebKitAllowAnimatedImageLoopingPreferenceKey];
+    return [[NSUserDefaults standardUserDefaults] boolForKey:WebKitInitialTimedLayoutEnabledPreferenceKey];
 }
 
-- (void)setWillLoadImagesAutomatically: (BOOL)flag
+- (NSTimeInterval)_resourceTimedLayoutDelay
 {
-    [[NSUserDefaults standardUserDefaults] setBool:flag forKey:WebKitDisplayImagesKey];
-    [self _updateWebCoreSettings];
+    return [[NSUserDefaults standardUserDefaults] floatForKey:WebKitResourceTimedLayoutDelayPreferenceKey];
 }
 
-- (BOOL)willLoadImagesAutomatically
+- (BOOL)_resourceTimedLayoutEnabled
 {
-    return [[NSUserDefaults standardUserDefaults] boolForKey:WebKitDisplayImagesKey];
+    return [[NSUserDefaults standardUserDefaults] boolForKey:WebKitResourceTimedLayoutEnabledPreferenceKey];
 }
 
 @end
diff --git a/WebKit/WebView.subproj/WebPreferencesPrivate.h b/WebKit/WebView.subproj/WebPreferencesPrivate.h
index 8729ac5..dbc459f 100644
--- a/WebKit/WebView.subproj/WebPreferencesPrivate.h
+++ b/WebKit/WebView.subproj/WebPreferencesPrivate.h
@@ -16,5 +16,6 @@
 - (NSTimeInterval)_resourceTimedLayoutDelay;
 - (int)_pageCacheSize;
 - (int)_objectCacheSize;
+- (void)_postPreferencesChangesNotification;
 
 @end
diff --git a/WebKit/WebView.subproj/WebView.m b/WebKit/WebView.subproj/WebView.m
index fd21bad..f440999 100644
--- a/WebKit/WebView.subproj/WebView.m
+++ b/WebKit/WebView.subproj/WebView.m
@@ -72,13 +72,12 @@ NSString *WebElementLinkTitleKey = 		@"WebElementLinkTitle";
 
     [self setUsesBackForwardList: YES];
     
-    [[NSNotificationCenter defaultCenter] addObserver:self
-                                             selector:@selector(_defaultsDidChange)
-                                                 name:NSUserDefaultsDidChangeNotification
-                                               object:[NSUserDefaults standardUserDefaults]];
-    
     ++WebControllerCount;
 
+    [self _updateWebCoreSettingsFromPreferences: [WebPreferences standardPreferences]];
+
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_preferencesChangedNotification:)
+                                                 name:WebPreferencesChangedNotification object:[self preferences]];
     return self;
 }
 
@@ -99,8 +98,11 @@ NSString *WebElementLinkTitleKey = 		@"WebElementLinkTitle";
 - (void)setPreferences: (WebPreferences *)prefs
 {
     if (_private->preferences != prefs){
+        [[NSNotificationCenter defaultCenter] removeObserver: self name: WebPreferencesChangedNotification object: [self preferences]];
         [_private->preferences release];
         _private->preferences = [prefs retain];
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_preferencesChangedNotification:)
+                                                    name:WebPreferencesChangedNotification object:[self preferences]];
     }
 }
 
diff --git a/WebKit/WebView.subproj/WebViewPrivate.h b/WebKit/WebView.subproj/WebViewPrivate.h
index a7c159c..733fa7b 100644
--- a/WebKit/WebView.subproj/WebViewPrivate.h
+++ b/WebKit/WebView.subproj/WebViewPrivate.h
@@ -9,6 +9,7 @@
 @class WebError;
 @class WebFrame;
 @class WebPreferences;
+ at class WebCoreSettings;
 @protocol WebFormDelegate;
 
 typedef enum { Safari, MacIE, WinIE } UserAgentStringType;
@@ -29,8 +30,6 @@ enum { NumUserAgentStringTypes = WinIE + 1 };
     
     id <WebContextMenuDelegate> defaultContextMenuDelegate;
 
-    WebPreferences *preferences;
-    
     WebBackForwardList *backForwardList;
     BOOL useBackForwardList;
     
@@ -44,6 +43,9 @@ enum { NumUserAgentStringTypes = WinIE + 1 };
 
     NSString *controllerSetName;
     NSString *topLevelFrameName;
+
+    WebPreferences *preferences;
+    WebCoreSettings *settings;
     
     BOOL lastElementWasNonNil;
 }
@@ -80,5 +82,7 @@ enum { NumUserAgentStringTypes = WinIE + 1 };
 - (void)_setFormDelegate: (id<WebFormDelegate>)delegate;
 - (id<WebFormDelegate>)_formDelegate;
 
+- (WebCoreSettings *)_settings;
+- (void)_updateWebCoreSettingsFromPreferences: (WebPreferences *)prefs;
 
 @end
diff --git a/WebKit/WebView.subproj/WebViewPrivate.m b/WebKit/WebView.subproj/WebViewPrivate.m
index 23d5cdf..c9cc10a 100644
--- a/WebKit/WebView.subproj/WebViewPrivate.m
+++ b/WebKit/WebView.subproj/WebViewPrivate.m
@@ -27,6 +27,8 @@
 #import <WebFoundation/WebResourceHandle.h>
 #import <WebFoundation/WebResourceRequest.h>
 
+#import <WebCore/WebCoreSettings.h>
+
 @implementation WebControllerPrivate
 
 - init 
@@ -34,6 +36,9 @@
     backForwardList = [[WebBackForwardList alloc] init];
     defaultContextMenuDelegate = [[WebDefaultContextMenuDelegate alloc] init];
     textSizeMultiplier = 1;
+
+    settings = [[WebCoreSettings alloc] init];
+
     return self;
 }
 
@@ -75,6 +80,7 @@
     [topLevelFrameName release];
 
     [preferences release];
+    [settings release];
     
     [super dealloc];
 }
@@ -340,7 +346,46 @@
     _private->lastElementWasNonNil = dictionary != nil;
 }
 
-- (void)_defaultsDidChange
+- (void)_setFormDelegate: (id<WebFormDelegate>)delegate
+{
+    _private->formDelegate = delegate;
+}
+
+- (id<WebFormDelegate>)_formDelegate
+{
+    return _private->formDelegate;
+}
+
+- (WebCoreSettings *)_settings
+{
+    return _private->settings;
+}
+
+- (void)_updateWebCoreSettingsFromPreferences: (WebPreferences *)preferences
+{
+    [_private->settings setCursiveFontFamily:[preferences cursiveFontFamily]];
+    [_private->settings setDefaultFixedFontSize:[preferences defaultFixedFontSize]];
+    [_private->settings setDefaultFontSize:[preferences defaultFontSize]];
+    [_private->settings setFantasyFontFamily:[preferences fantasyFontFamily]];
+    [_private->settings setFixedFontFamily:[preferences fixedFontFamily]];
+    [_private->settings setJavaEnabled:[preferences JavaEnabled]];
+    [_private->settings setJavaScriptEnabled:[preferences JavaScriptEnabled]];
+    [_private->settings setJavaScriptCanOpenWindowsAutomatically:[preferences JavaScriptCanOpenWindowsAutomatically]];
+    [_private->settings setMinimumFontSize:[preferences minimumFontSize]];
+    [_private->settings setPluginsEnabled:[preferences pluginsEnabled]];
+    [_private->settings setSansSerifFontFamily:[preferences sansSerifFontFamily]];
+    [_private->settings setSerifFontFamily:[preferences serifFontFamily]];
+    [_private->settings setStandardFontFamily:[preferences standardFontFamily]];
+    [_private->settings setWillLoadImagesAutomatically:[preferences willLoadImagesAutomatically]];
+
+    if ([preferences userStyleSheetEnabled]) {
+        [_private->settings setUserStyleSheetLocation:[preferences userStyleSheetLocation]];
+    } else {
+        [_private->settings setUserStyleSheetLocation:@""];
+    }
+}
+
+- (void)_releaseUserAgentStrings
 {
     int i;
     for (i = 0; i != NumUserAgentStringTypes; ++i) {
@@ -349,14 +394,14 @@
     }
 }
 
-- (void)_setFormDelegate: (id<WebFormDelegate>)delegate
-{
-    _private->formDelegate = delegate;
-}
 
-- (id<WebFormDelegate>)_formDelegate
+- (void)_preferencesChangedNotification: (NSNotification *)notification
 {
-    return _private->formDelegate;
+    WebPreferences *preferences = (WebPreferences *)[notification object];
+    
+    ASSERT (preferences == [self preferences]);
+    [self _releaseUserAgentStrings];
+    [self _updateWebCoreSettingsFromPreferences: preferences];
 }
 
 @end

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list