Add fourth preference value for GDI text font smoothing to WebKit.
authorhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Dec 2007 19:13:16 +0000 (19:13 +0000)
committerhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Dec 2007 19:13:16 +0000 (19:13 +0000)
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@28866 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/win/ChangeLog
WebKit/win/Interfaces/IWebPreferences.idl
WebKit/win/WebPreferenceKeysPrivate.h
WebKit/win/WebPreferences.cpp
WebKit/win/WebView.cpp

index 64fbc4961541181c65914477ce3561f50ad61a6f..fcf30a756607ba927cabfbec5daf110a5e237466 100644 (file)
@@ -1,3 +1,18 @@
+2007-12-19  Dave Hyatt <hyatt@apple.com>
+
+        Add a fourth preference value for GDI text in the font smoothing prefs.
+        
+        Reviewed by mitz
+
+        * Interfaces/IWebPreferences.idl:
+        * WebPreferenceKeysPrivate.h:
+        * WebPreferences.cpp:
+        (WebPreferences::initializeDefaultSettings):
+        (WebPreferences::fontSmoothing):
+        (WebPreferences::setFontSmoothing):
+        * WebView.cpp:
+        (WebView::notifyPreferencesChanged):
+
 2007-12-17  Darin Adler  <darin@apple.com>
 
         Reviewed by Sam.
index 9bc0dc86d06d8f09a4c8fb7017842648e468ade0..a93f3b877522ac7e01b942ae3cc7630ae1f293ee 100644 (file)
@@ -58,7 +58,8 @@ typedef enum FontSmoothingType {
     FontSmoothingTypeStandard=0,
     FontSmoothingTypeLight,
     FontSmoothingTypeMedium,
-    FontSmoothingTypeStrong
+    FontSmoothingTypeStrong,
+    FontSmoothingTypeWindows
 } FontSmoothingType;
 
 typedef enum WebKitEditableLinkBehavior {
index c479ceacaf7d712b54c4dcd1959af57f3e2946c4..51e9e67b31737fb176c2cba94715ef067723801c 100644 (file)
@@ -88,7 +88,7 @@
 #define WebKitHistoryAgeInDaysLimitKey "WebKitHistoryAgeInDaysLimit" // default: "7"
 
 // Windows-specific keys
-#define WebKitFontSmothingTypePreferenceKey "WebKitFontSmoothingType" // default: FontSmoothingTypeMedium (2)
+#define WebKitFontSmoothingTypePreferenceKey "WebKitFontSmoothingType" // default: FontSmoothingTypeMedium (2)
 #define WebKitCookieStorageAcceptPolicyPreferenceKey "WebKitCookieStorageAcceptPolicy" // default: WebKitCookieStorageAcceptPolicyOnlyFromMainDocumentDomain
 
 #define WebContinuousSpellCheckingEnabledPreferenceKey "WebContinuousSpellCheckingEnabled" // default: false
index 37ae61fba4bd1574fc7cb6e501d339de79044c8f..855624a67e56c792cfac321a98a5f9adb679af21 100644 (file)
@@ -182,7 +182,7 @@ void WebPreferences::initializeDefaultSettings()
     CFDictionaryAddValue(defaults, CFSTR(WebKitHistoryAgeInDaysLimitKey), CFSTR("7"));
     CFDictionaryAddValue(defaults, CFSTR(WebKitIconDatabaseLocationKey), CFSTR(""));
     CFDictionaryAddValue(defaults, CFSTR(WebKitIconDatabaseEnabledPreferenceKey), kCFBooleanTrue);
-    CFDictionaryAddValue(defaults, CFSTR(WebKitFontSmothingTypePreferenceKey), CFSTR("2"));
+    CFDictionaryAddValue(defaults, CFSTR(WebKitFontSmoothingTypePreferenceKey), CFSTR("2"));
     CFDictionaryAddValue(defaults, CFSTR(WebKitCookieStorageAcceptPolicyPreferenceKey), CFSTR("2"));
     CFDictionaryAddValue(defaults, CFSTR(WebContinuousSpellCheckingEnabledPreferenceKey), kCFBooleanFalse);
     CFDictionaryAddValue(defaults, CFSTR(WebGrammarCheckingEnabledPreferenceKey), kCFBooleanFalse);
@@ -977,14 +977,16 @@ HRESULT WebPreferences::setIconDatabaseEnabled(BOOL enabled )//location)
 HRESULT STDMETHODCALLTYPE WebPreferences::fontSmoothing( 
     /* [retval][out] */ FontSmoothingType* smoothingType)
 {
-    *smoothingType = (FontSmoothingType) integerValueForKey(CFSTR(WebKitFontSmothingTypePreferenceKey));
+    *smoothingType = (FontSmoothingType) integerValueForKey(CFSTR(WebKitFontSmoothingTypePreferenceKey));
     return S_OK;
 }
 
 HRESULT STDMETHODCALLTYPE WebPreferences::setFontSmoothing( 
     /* [in] */ FontSmoothingType smoothingType)
 {
-    setIntegerValue(CFSTR(WebKitFontSmothingTypePreferenceKey), smoothingType);
+    setIntegerValue(CFSTR(WebKitFontSmoothingTypePreferenceKey), smoothingType);
+    if (smoothingType == FontSmoothingTypeWindows)
+        smoothingType = FontSmoothingTypeStandard;
     wkSetFontSmoothingLevel((int)smoothingType);
     return S_OK;
 }
index 07138c113a1ecd7b653f464bc6f875ebe96d254d..f0a7f432dd34b383612c4b92c69cd53673de6e07 100644 (file)
@@ -3857,6 +3857,12 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification)
     settings->setForceFTPDirectoryListings(true);
     settings->setDeveloperExtrasEnabled(developerExtrasEnabled());
 
+    FontSmoothingType smoothingType;
+    hr = preferences->fontSmoothing(&smoothingType);
+    if (FAILED(hr))
+        return hr;
+    settings->setFontRenderingMode(smoothingType != FontSmoothingTypeWindows ? NormalRenderingMode : AlternateRenderingMode);
+
     COMPtr<IWebPreferencesPrivate> prefsPrivate(Query, preferences);
     if (prefsPrivate) {
         unsigned long long defaultQuota = 0;