Source/WebKit/mac: WebKit/mac part of <rdar://problem/11455228> [mac] Stop using...
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Sep 2012 05:13:21 +0000 (05:13 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Sep 2012 05:13:21 +0000 (05:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=97620

Reviewed by John Sullivan.

* WebView/WebPreferences.mm:
(+[WebPreferences initialize]): Changed the default value of the screenFontSubstitutionEnabled
preference to NO.
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):  Changed to enable screen font substitution also if
the value of the NSFontDefaultScreenFontSubstitutionEnabled user defaults key is YES.

Source/WebKit2: WebKit2 part of <rdar://problem/11455228> [mac] Stop using screen fonts
https://bugs.webkit.org/show_bug.cgi?id=97620

Reviewed by John Sullivan.

* Shared/WebPreferencesStore.h:
(WebKit): Changed the default value of the screenFontSubstitutionEnabled preference to false.
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::WebProcessCreationParameters): Added an initializer for
the new shouldForceScreenFontSubstitution data member.
(WebKit::WebProcessCreationParameters::encode): Added encoding of shouldForceScreenFontSubstitution.
(WebKit::WebProcessCreationParameters::decode): Added decoding of shouldForceScreenFontSubstitution.
* Shared/WebProcessCreationParameters.h:
(WebProcessCreationParameters): Added shouldForceScreenFontSubstitution boolean data member.
* UIProcess/mac/WebContextMac.mm:
(WebKit::WebContext::platformInitializeWebProcess): Added code to set shouldForceScreenFontSubstitution
in the process creation parameters to the value of the NSFontDefaultScreenFontSubstitutionEnabled user
defaults key.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences): Changed to enable screen font substitution also if
shouldForceScreenFontSubstitution() is true.
* WebProcess/WebProcess.h:
(WebKit::WebProcess::shouldForceScreenFontSubstitution): Added this getter.
(WebProcess): Added m_shouldForceScreenFontSubstitution boolean data member.
* WebProcess/mac/WebProcessMac.mm:
(WebKit::WebProcess::platformInitializeWebProcess): Added initialization of
m_shouldForceScreenFontSubstitution from the creation parameters.

Tools: Tools part of <rdar://problem/11455228> [mac] Stop using screen fonts
https://bugs.webkit.org/show_bug.cgi?id=97620

Reviewed by John Sullivan.

* DumpRenderTree/mac/DumpRenderTree.mm:
(resetDefaultsToConsistentValues): Enable screen font substitution when
running the tests.
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetStateToConsistentValues): Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@129593 268f45cc-cd09-0410-ab3c-d52691b4dbfc

14 files changed:
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebPreferences.mm
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebPreferencesStore.h
Source/WebKit2/Shared/WebProcessCreationParameters.cpp
Source/WebKit2/Shared/WebProcessCreationParameters.h
Source/WebKit2/UIProcess/mac/WebContextMac.mm
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebProcess.h
Source/WebKit2/WebProcess/mac/WebProcessMac.mm
Tools/ChangeLog
Tools/DumpRenderTree/mac/DumpRenderTree.mm
Tools/WebKitTestRunner/TestController.cpp

index c999c59..bc30006 100644 (file)
@@ -1,3 +1,17 @@
+2012-09-25  Dan Bernstein  <mitz@apple.com>
+
+        WebKit/mac part of <rdar://problem/11455228> [mac] Stop using screen fonts
+        https://bugs.webkit.org/show_bug.cgi?id=97620
+
+        Reviewed by John Sullivan.
+
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]): Changed the default value of the screenFontSubstitutionEnabled
+        preference to NO.
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]):  Changed to enable screen font substitution also if
+        the value of the NSFontDefaultScreenFontSubstitutionEnabled user defaults key is YES.
+
 2012-09-21  Jeffrey Pfau  <jpfau@apple.com>
 
         Add WebKit1 SPI for storage blocking preference
index 2f5c135..7c44824 100644 (file)
@@ -399,7 +399,12 @@ public:
         [NSNumber numberWithBool:YES],  WebKitRequestAnimationFrameEnabledPreferenceKey,
         [NSNumber numberWithBool:NO],   WebKitWantsBalancedSetDefersLoadingBehaviorKey,
         [NSNumber numberWithBool:NO],   WebKitDiagnosticLoggingEnabledKey,
-        [NSNumber numberWithBool:YES],  WebKitScreenFontSubstitutionEnabledKey,
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
+        [NSNumber numberWithBool:NO],
+#else
+        [NSNumber numberWithBool:YES],
+#endif
+                                        WebKitScreenFontSubstitutionEnabledKey,
         [NSNumber numberWithInt:WebAllowAllStorage], WebKitStorageBlockingPolicyKey,
 
         [NSNumber numberWithLongLong:ApplicationCacheStorage::noQuota()], WebKitApplicationCacheTotalQuota,
index 89afd59..457d406 100644 (file)
@@ -1444,7 +1444,12 @@ static bool needsSelfRetainWhileLoadingQuirk()
     settings->setUsesEncodingDetector([preferences usesEncodingDetector]);
     settings->setFantasyFontFamily([preferences fantasyFontFamily]);
     settings->setFixedFontFamily([preferences fixedFontFamily]);
-    settings->setScreenFontSubstitutionEnabled([preferences screenFontSubstitutionEnabled]);
+    settings->setScreenFontSubstitutionEnabled(
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
+        [[NSUserDefaults standardUserDefaults] boolForKey:@"NSFontDefaultScreenFontSubstitutionEnabled"] ||
+#endif
+        [preferences screenFontSubstitutionEnabled]
+    );
     settings->setForceFTPDirectoryListings([preferences _forceFTPDirectoryListings]);
     settings->setFTPDirectoryTemplatePath([preferences _ftpDirectoryTemplatePath]);
     settings->setLocalStorageDatabasePath([preferences _localStorageDatabasePath]);
index cdc784d..5f13e67 100644 (file)
@@ -1,3 +1,33 @@
+2012-09-25  Dan Bernstein  <mitz@apple.com>
+
+        WebKit2 part of <rdar://problem/11455228> [mac] Stop using screen fonts
+        https://bugs.webkit.org/show_bug.cgi?id=97620
+
+        Reviewed by John Sullivan.
+
+        * Shared/WebPreferencesStore.h:
+        (WebKit): Changed the default value of the screenFontSubstitutionEnabled preference to false.
+        * Shared/WebProcessCreationParameters.cpp:
+        (WebKit::WebProcessCreationParameters::WebProcessCreationParameters): Added an initializer for
+        the new shouldForceScreenFontSubstitution data member.
+        (WebKit::WebProcessCreationParameters::encode): Added encoding of shouldForceScreenFontSubstitution.
+        (WebKit::WebProcessCreationParameters::decode): Added decoding of shouldForceScreenFontSubstitution.
+        * Shared/WebProcessCreationParameters.h:
+        (WebProcessCreationParameters): Added shouldForceScreenFontSubstitution boolean data member.
+        * UIProcess/mac/WebContextMac.mm:
+        (WebKit::WebContext::platformInitializeWebProcess): Added code to set shouldForceScreenFontSubstitution
+        in the process creation parameters to the value of the NSFontDefaultScreenFontSubstitutionEnabled user
+        defaults key.
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences): Changed to enable screen font substitution also if
+        shouldForceScreenFontSubstitution() is true.
+        * WebProcess/WebProcess.h:
+        (WebKit::WebProcess::shouldForceScreenFontSubstitution): Added this getter.
+        (WebProcess): Added m_shouldForceScreenFontSubstitution boolean data member.
+        * WebProcess/mac/WebProcessMac.mm:
+        (WebKit::WebProcess::platformInitializeWebProcess): Added initialization of
+        m_shouldForceScreenFontSubstitution from the creation parameters.
+
 2012-09-25  Alexey Proskuryakov  <ap@apple.com>
 
         Get rid of WebContext::m_pendingMessagesToPostToInjectedBundle
index b70767c..dbaa4f2 100644 (file)
@@ -54,6 +54,12 @@ namespace WebKit {
 #define DEFAULT_WEBKIT_SCROLL_ANIMATOR_ENABLED false
 #endif
 
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
+#define DEFAULT_SCREEN_FONT_SUBSTITUTION_ENABLED false
+#else
+#define DEFAULT_SCREEN_FONT_SUBSTITUTION_ENABLED true
+#endif
+
 #define FOR_EACH_WEBKIT_BOOL_PREFERENCE(macro) \
     macro(JavaScriptEnabled, javaScriptEnabled, Bool, bool, true) \
     macro(LoadsImagesAutomatically, loadsImagesAutomatically, Bool, bool, true) \
@@ -128,7 +134,7 @@ namespace WebKit {
     macro(ScrollingPerformanceLoggingEnabled, scrollingPerformanceLoggingEnabled, Bool, bool, false) \
     macro(StorageBlockingPolicy, storageBlockingPolicy, UInt32, uint32_t, 0) \
     macro(ScrollAnimatorEnabled, scrollAnimatorEnabled, Bool, bool, DEFAULT_WEBKIT_SCROLL_ANIMATOR_ENABLED) \
-    macro(ScreenFontSubstitutionEnabled, screenFontSubstitutionEnabled, Bool, bool, true) \
+    macro(ScreenFontSubstitutionEnabled, screenFontSubstitutionEnabled, Bool, bool, DEFAULT_SCREEN_FONT_SUBSTITUTION_ENABLED) \
     \
 
 #define FOR_EACH_WEBKIT_DOUBLE_PREFERENCE(macro) \
index 31f11a7..cc2cecc 100644 (file)
@@ -41,6 +41,7 @@ WebProcessCreationParameters::WebProcessCreationParameters()
 #if PLATFORM(MAC)
     , nsURLCacheMemoryCapacity(0)
     , nsURLCacheDiskCapacity(0)
+    , shouldForceScreenFontSubstitution(false)
 #elif PLATFORM(WIN)
     , shouldPaintNativeControls(false)
 #endif
@@ -91,6 +92,7 @@ void WebProcessCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) con
     encoder->encode(acceleratedCompositingPort);
     encoder->encode(uiProcessBundleResourcePath);
     encoder->encode(uiProcessBundleResourcePathExtensionHandle);
+    encoder->encode(shouldForceScreenFontSubstitution);
 #elif PLATFORM(WIN)
     encoder->encode(shouldPaintNativeControls);
     encoder->encode(cfURLCachePath);
@@ -196,6 +198,8 @@ bool WebProcessCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, Web
         return false;
     if (!decoder->decode(parameters.uiProcessBundleResourcePathExtensionHandle))
         return false;
+    if (!decoder->decode(parameters.shouldForceScreenFontSubstitution))
+        return false;
 #elif PLATFORM(WIN)
     if (!decoder->decode(parameters.shouldPaintNativeControls))
         return false;
index 892ab8b..67ab330 100644 (file)
@@ -115,6 +115,7 @@ struct WebProcessCreationParameters {
     String uiProcessBundleResourcePath;
     SandboxExtension::Handle uiProcessBundleResourcePathExtensionHandle;
 
+    bool shouldForceScreenFontSubstitution;
 #elif PLATFORM(WIN)
     String cfURLCachePath;
     uint64_t cfURLCacheDiskCapacity;
index b1d99c8..68c8e11 100644 (file)
@@ -97,6 +97,9 @@ void WebContext::platformInitializeWebProcess(WebProcessCreationParameters& para
     parameters.nsURLCacheMemoryCapacity = [urlCache memoryCapacity];
     parameters.nsURLCacheDiskCapacity = [urlCache diskCapacity];
 
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
+    parameters.shouldForceScreenFontSubstitution = [[NSUserDefaults standardUserDefaults] boolForKey:@"NSFontDefaultScreenFontSubstitutionEnabled"];
+#endif
 
 #if ENABLE(PLUGIN_PROCESS)
     parameters.disablePluginProcessMessageTimeout = [[NSUserDefaults standardUserDefaults] boolForKey:@"WebKitDisablePluginProcessMessageTimeout"];
index 7cf8355..a06c354 100644 (file)
@@ -2072,7 +2072,7 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
     settings->setMinimumLogicalFontSize(store.getUInt32ValueForKey(WebPreferencesKey::minimumLogicalFontSizeKey()));
     settings->setDefaultFontSize(store.getUInt32ValueForKey(WebPreferencesKey::defaultFontSizeKey()));
     settings->setDefaultFixedFontSize(store.getUInt32ValueForKey(WebPreferencesKey::defaultFixedFontSizeKey()));
-    settings->setScreenFontSubstitutionEnabled(store.getBoolValueForKey(WebPreferencesKey::screenFontSubstitutionEnabledKey()));
+    settings->setScreenFontSubstitutionEnabled(store.getBoolValueForKey(WebPreferencesKey::screenFontSubstitutionEnabledKey()) || WebProcess::shared().shouldForceScreenFontSubstitution());
     settings->setLayoutFallbackWidth(store.getUInt32ValueForKey(WebPreferencesKey::layoutFallbackWidthKey()));
     settings->setDeviceWidth(store.getUInt32ValueForKey(WebPreferencesKey::deviceWidthKey()));
     settings->setDeviceHeight(store.getUInt32ValueForKey(WebPreferencesKey::deviceHeightKey()));
index 0f542be..e34d15f 100644 (file)
@@ -149,6 +149,7 @@ public:
     WebPageGroupProxy* webPageGroup(const WebPageGroupData&);
 #if PLATFORM(MAC)
     pid_t presenterApplicationPid() const { return m_presenterApplicationPid; }
+    bool shouldForceScreenFontSubstitution() const { return m_shouldForceScreenFontSubstitution; }
 #endif 
     
 #if PLATFORM(QT)
@@ -304,6 +305,7 @@ private:
 #if PLATFORM(MAC)
     pid_t m_presenterApplicationPid;
     dispatch_group_t m_clearResourceCachesDispatchGroup;
+    bool m_shouldForceScreenFontSubstitution;
 #endif
 
     bool m_fullKeyboardAccessEnabled;
index 738e0d8..ff75ceb 100644 (file)
@@ -271,6 +271,8 @@ void WebProcess::platformInitializeWebProcess(const WebProcessCreationParameters
         [NSURLCache setSharedURLCache:parentProcessURLCache.get()];
     }
 
+    m_shouldForceScreenFontSubstitution = parameters.shouldForceScreenFontSubstitution;
+
     m_compositingRenderServerPort = parameters.acceleratedCompositingPort.port();
 
 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
index d446021..9eb5f00 100644 (file)
@@ -1,3 +1,16 @@
+2012-09-25  Dan Bernstein  <mitz@apple.com>
+
+        Tools part of <rdar://problem/11455228> [mac] Stop using screen fonts
+        https://bugs.webkit.org/show_bug.cgi?id=97620
+
+        Reviewed by John Sullivan.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (resetDefaultsToConsistentValues): Enable screen font substitution when
+        running the tests.
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::resetStateToConsistentValues): Ditto.
+
 2012-09-25  Ryosuke Niwa  <rniwa@webkit.org>
 
         Build fix. "values" doesn't necessarily contain multiple values but it needs to be always parsed as an array.
index ee82454..30ac825 100644 (file)
@@ -674,6 +674,8 @@ static void resetDefaultsToConsistentValues()
     [preferences setWebAudioEnabled:YES];
 #endif
 
+    [preferences setScreenFontSubstitutionEnabled:YES];
+
     [WebPreferences _setCurrentNetworkLoaderSessionCookieAcceptPolicy:NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain];
     
     TestRunner::setSerializeHTTPLoads(false);
index 3783313..33d913f 100644 (file)
@@ -515,6 +515,7 @@ bool TestController::resetStateToConsistentValues()
     WKPreferencesSetSansSerifFontFamily(preferences, sansSerifFontFamily);
     WKPreferencesSetSerifFontFamily(preferences, serifFontFamily);
 #endif
+    WKPreferencesSetScreenFontSubstitutionEnabled(preferences, true);
     WKPreferencesSetInspectorUsesWebKitUserInterface(preferences, true);
 
     // in the case that a test using the chrome input field failed, be sure to clean up for the next test