[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

weinig at apple.com weinig at apple.com
Wed Dec 22 16:18:19 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 51815ae7a865374de3e676663f1ff2f4af390635
Author: weinig at apple.com <weinig at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Nov 22 02:08:50 2010 +0000

    Textareas should be resizable by default
    https://bugs.webkit.org/show_bug.cgi?id=49892
    
    Reviewed by Dan Bernstein.
    
    WebKit2:
    
    Test: WebKit2/WKPreferences
    
    * Shared/WebPreferencesStore.cpp:
    (WebKit::WebPreferencesStore::WebPreferencesStore):
    (WebKit::WebPreferencesStore::encode):
    (WebKit::WebPreferencesStore::decode):
    * Shared/WebPreferencesStore.h:
    Add textAreasAreResizable bit.
    
    * UIProcess/API/C/WKPreferences.cpp:
    (WKPreferencesSetJavaEnabled):
    (WKPreferencesGetJavaEnabled):
    Fix typo, WKPRe... -> WKPre...
    
    (WKPreferencesSetMinimumFontSize):
    (WKPreferencesGetMinimumFontSize):
    Fix comment to correctly reflect that the default minimumFontSize is 0, not 1.
    
    (WKPreferencesSetTextAreasAreResizable):
    (WKPreferencesGetTextAreasAreResizable):
    * UIProcess/API/C/WKPreferences.h:
    Add API.
    
    * UIProcess/API/C/WKPreferencesPrivate.h:
    Don't use PLATFORM in API headers.
    
    * UIProcess/WebPreferences.cpp:
    (WebKit::WebPreferences::setTextAreasAreResizable):
    (WebKit::WebPreferences::textAreasAreResizable):
    * UIProcess/WebPreferences.h:
    * WebProcess/WebPage/WebPage.cpp:
    (WebKit::WebPage::updatePreferences):
    Pipe bit through to the WebProcess and onto WebCore::Settings.
    
    WebKitTools:
    
    * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
    * TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp: Added.
    * TestWebKitAPI/win/TestWebKitAPI.vcproj:
    Add preferences test.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72501 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index ba6b3bf..ee282af 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,44 @@
+2010-11-21  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Dan Bernstein.
+
+        Textareas should be resizable by default
+        https://bugs.webkit.org/show_bug.cgi?id=49892
+
+        Test: WebKit2/WKPreferences
+
+        * Shared/WebPreferencesStore.cpp:
+        (WebKit::WebPreferencesStore::WebPreferencesStore):
+        (WebKit::WebPreferencesStore::encode):
+        (WebKit::WebPreferencesStore::decode):
+        * Shared/WebPreferencesStore.h:
+        Add textAreasAreResizable bit.
+
+        * UIProcess/API/C/WKPreferences.cpp:
+        (WKPreferencesSetJavaEnabled):
+        (WKPreferencesGetJavaEnabled):
+        Fix typo, WKPRe... -> WKPre...
+
+        (WKPreferencesSetMinimumFontSize):
+        (WKPreferencesGetMinimumFontSize):
+        Fix comment to correctly reflect that the default minimumFontSize is 0, not 1.
+
+        (WKPreferencesSetTextAreasAreResizable):
+        (WKPreferencesGetTextAreasAreResizable):
+        * UIProcess/API/C/WKPreferences.h:
+        Add API.
+
+        * UIProcess/API/C/WKPreferencesPrivate.h:
+        Don't use PLATFORM in API headers.
+
+        * UIProcess/WebPreferences.cpp:
+        (WebKit::WebPreferences::setTextAreasAreResizable):
+        (WebKit::WebPreferences::textAreasAreResizable):
+        * UIProcess/WebPreferences.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences):
+        Pipe bit through to the WebProcess and onto WebCore::Settings.
+
 2010-11-19  Zalan Bujtas  <zbujtas at gmail.com>
 
         Reviewed by Andreas Kling.
diff --git a/WebKit2/Shared/WebPreferencesStore.cpp b/WebKit2/Shared/WebPreferencesStore.cpp
index 22165c0..2e26ffd 100644
--- a/WebKit2/Shared/WebPreferencesStore.cpp
+++ b/WebKit2/Shared/WebPreferencesStore.cpp
@@ -43,6 +43,7 @@ WebPreferencesStore::WebPreferencesStore()
     , frameFlatteningEnabled(false)
     , developerExtrasEnabled(false)
     , privateBrowsingEnabled(false)
+    , textAreasAreResizable(true)
     , needsSiteSpecificQuirks(false)
     , acceleratedCompositingEnabled(true)
     , compositingBordersVisible(false)
@@ -81,6 +82,7 @@ void WebPreferencesStore::encode(CoreIPC::ArgumentEncoder* encoder) const
     encoder->encode(xssAuditorEnabled);
     encoder->encode(frameFlatteningEnabled);
     encoder->encode(privateBrowsingEnabled);
+    encoder->encode(textAreasAreResizable);
     encoder->encode(developerExtrasEnabled);
     encoder->encode(fontSmoothingLevel);
     encoder->encode(minimumFontSize);
@@ -119,6 +121,8 @@ bool WebPreferencesStore::decode(CoreIPC::ArgumentDecoder* decoder, WebPreferenc
         return false;
     if (!decoder->decode(s.privateBrowsingEnabled))
         return false;
+    if (!decoder->decode(s.textAreasAreResizable))
+        return false;
     if (!decoder->decode(s.developerExtrasEnabled))
         return false;
     if (!decoder->decode(s.fontSmoothingLevel))
diff --git a/WebKit2/Shared/WebPreferencesStore.h b/WebKit2/Shared/WebPreferencesStore.h
index c7b02e1..329f4c1 100644
--- a/WebKit2/Shared/WebPreferencesStore.h
+++ b/WebKit2/Shared/WebPreferencesStore.h
@@ -52,6 +52,7 @@ struct WebPreferencesStore {
     bool frameFlatteningEnabled;
     bool developerExtrasEnabled;
     bool privateBrowsingEnabled;
+    bool textAreasAreResizable;
     bool needsSiteSpecificQuirks;
     bool acceleratedCompositingEnabled;
     bool compositingBordersVisible;
diff --git a/WebKit2/UIProcess/API/C/WKPreferences.cpp b/WebKit2/UIProcess/API/C/WKPreferences.cpp
index b3059ac..73956ea 100644
--- a/WebKit2/UIProcess/API/C/WKPreferences.cpp
+++ b/WebKit2/UIProcess/API/C/WKPreferences.cpp
@@ -120,12 +120,12 @@ bool WKPreferencesGetPluginsEnabled(WKPreferencesRef preferencesRef)
     return toImpl(preferencesRef)->pluginsEnabled();
 }
 
-void WKPReferencesSetJavaEnabled(WKPreferencesRef preferencesRef, bool javaEnabled)
+void WKPreferencesSetJavaEnabled(WKPreferencesRef preferencesRef, bool javaEnabled)
 {
     toImpl(preferencesRef)->setJavaEnabled(javaEnabled);
 }
 
-bool WKPReferencesGetJavaEnabled(WKPreferencesRef preferencesRef)
+bool WKPreferencesGetJavaEnabled(WKPreferencesRef preferencesRef)
 {
     return toImpl(preferencesRef)->javaEnabled();
 }
@@ -220,6 +220,16 @@ bool WKPreferencesGetDeveloperExtrasEnabled(WKPreferencesRef preferencesRef)
     return toImpl(preferencesRef)->developerExtrasEnabled();
 }
 
+void WKPreferencesSetTextAreasAreResizable(WKPreferencesRef preferencesRef, bool resizable)
+{
+    toImpl(preferencesRef)->setTextAreasAreResizable(resizable);
+}
+
+bool WKPreferencesGetTextAreasAreResizable(WKPreferencesRef preferencesRef)
+{
+    return toImpl(preferencesRef)->textAreasAreResizable();
+}
+
 void WKPreferencesSetFontSmoothingLevel(WKPreferencesRef preferencesRef, WKFontSmoothingLevel wkLevel)
 {
     toImpl(preferencesRef)->setFontSmoothingLevel(toFontSmoothingLevel(wkLevel));
diff --git a/WebKit2/UIProcess/API/C/WKPreferences.h b/WebKit2/UIProcess/API/C/WKPreferences.h
index 16f7742..7acd05f 100644
--- a/WebKit2/UIProcess/API/C/WKPreferences.h
+++ b/WebKit2/UIProcess/API/C/WKPreferences.h
@@ -70,8 +70,8 @@ WK_EXPORT void WKPreferencesSetPluginsEnabled(WKPreferencesRef preferences, bool
 WK_EXPORT bool WKPreferencesGetPluginsEnabled(WKPreferencesRef preferences);
 
 // Defaults to true.
-WK_EXPORT void WKPReferencesSetJavaEnabled(WKPreferencesRef preferences, bool javaEnabled);
-WK_EXPORT bool WKPReferencesGetJavaEnabled(WKPreferencesRef preferences);
+WK_EXPORT void WKPreferencesSetJavaEnabled(WKPreferencesRef preferences, bool javaEnabled);
+WK_EXPORT bool WKPreferencesGetJavaEnabled(WKPreferencesRef preferences);
     
 WK_EXPORT void WKPreferencesSetStandardFontFamily(WKPreferencesRef preferencesRef, WKStringRef family);
 WK_EXPORT WKStringRef WKPreferencesCopyStandardFontFamily(WKPreferencesRef preferencesRef);
@@ -91,7 +91,7 @@ WK_EXPORT WKStringRef WKPreferencesCopyCursiveFontFamily(WKPreferencesRef prefer
 WK_EXPORT void WKPreferencesSetFantasyFontFamily(WKPreferencesRef preferencesRef, WKStringRef family);
 WK_EXPORT WKStringRef WKPreferencesCopyFantasyFontFamily(WKPreferencesRef preferencesRef);
 
-// Defaults to 1, which means "no minimum".
+// Defaults to 0.
 WK_EXPORT void WKPreferencesSetMinimumFontSize(WKPreferencesRef preferencesRef, uint32_t);
 WK_EXPORT uint32_t WKPreferencesGetMinimumFontSize(WKPreferencesRef preferencesRef);
 
@@ -103,6 +103,10 @@ WK_EXPORT bool WKPreferencesGetPrivateBrowsingEnabled(WKPreferencesRef preferenc
 WK_EXPORT void WKPreferencesSetDeveloperExtrasEnabled(WKPreferencesRef preferencesRef, bool enabled);
 WK_EXPORT bool WKPreferencesGetDeveloperExtrasEnabled(WKPreferencesRef preferencesRef);
 
+// Defaults to true.
+WK_EXPORT void WKPreferencesSetTextAreasAreResizable(WKPreferencesRef preferencesRef, bool resizable);
+WK_EXPORT bool WKPreferencesGetTextAreasAreResizable(WKPreferencesRef preferencesRef);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h b/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h
index 4c11232..ac2261a 100644
--- a/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h
+++ b/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h
@@ -37,7 +37,7 @@ enum WKFontSmoothingLevel {
     kWKFontSmoothingLevelLight = 1,
     kWKFontSmoothingLevelMedium = 2,
     kWKFontSmoothingLevelStrong = 3,
-#if PLATFORM(WIN)
+#if defined(WIN32) || defined(_WIN32)
     kWKFontSmoothingLevelWindows = 4,
 #endif
 };
diff --git a/WebKit2/UIProcess/WebPreferences.cpp b/WebKit2/UIProcess/WebPreferences.cpp
index c7f242f..6da80df 100644
--- a/WebKit2/UIProcess/WebPreferences.cpp
+++ b/WebKit2/UIProcess/WebPreferences.cpp
@@ -152,6 +152,17 @@ bool WebPreferences::developerExtrasEnabled() const
     return m_store.developerExtrasEnabled;
 }
 
+void WebPreferences::setTextAreasAreResizable(bool r)
+{
+    m_store.textAreasAreResizable = r;
+    update();
+}
+
+bool WebPreferences::textAreasAreResizable() const
+{
+    return m_store.textAreasAreResizable;
+}
+
 void WebPreferences::setNeedsSiteSpecificQuirks(bool b)
 {
     m_store.needsSiteSpecificQuirks = b;
diff --git a/WebKit2/UIProcess/WebPreferences.h b/WebKit2/UIProcess/WebPreferences.h
index 655e3a5..f7e0a0f 100644
--- a/WebKit2/UIProcess/WebPreferences.h
+++ b/WebKit2/UIProcess/WebPreferences.h
@@ -122,6 +122,9 @@ public:
     void setDeveloperExtrasEnabled(bool);
     bool developerExtrasEnabled() const;
 
+    void setTextAreasAreResizable(bool);
+    bool textAreasAreResizable() const;
+
     void setNeedsSiteSpecificQuirks(bool);
     bool needsSiteSpecificQuirks() const;
 
diff --git a/WebKit2/WebProcess/WebPage/WebPage.cpp b/WebKit2/WebProcess/WebPage/WebPage.cpp
index 6159ca7..27d4b7d 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -880,6 +880,7 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
     settings->setFrameFlatteningEnabled(store.frameFlatteningEnabled);
     settings->setPrivateBrowsingEnabled(store.privateBrowsingEnabled);
     settings->setDeveloperExtrasEnabled(store.developerExtrasEnabled);
+    settings->setTextAreasAreResizable(store.textAreasAreResizable);
     settings->setNeedsSiteSpecificQuirks(store.needsSiteSpecificQuirks);
     settings->setMinimumFontSize(store.minimumFontSize);
     settings->setMinimumLogicalFontSize(store.minimumLogicalFontSize);
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index d597cf6..1eceeff 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,15 @@
+2010-11-21  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Dan Bernstein.
+
+        Textareas should be resizable by default
+        https://bugs.webkit.org/show_bug.cgi?id=49892
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp: Added.
+        * TestWebKitAPI/win/TestWebKitAPI.vcproj:
+        Add preferences test.
+
 2010-11-19  Mihai Parparita  <mihaip at chromium.org>
 
         Reviewed by Tony Chang.
diff --git a/WebKitTools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj b/WebKitTools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
index ef55b28..69ce4dc 100644
--- a/WebKitTools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
+++ b/WebKitTools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
@@ -24,6 +24,7 @@
 		BC575BC0126F5752006F0F12 /* PlatformUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC575BBF126F5752006F0F12 /* PlatformUtilities.cpp */; };
 		BC575BD9126F58E2006F0F12 /* PlatformUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC575BBF126F5752006F0F12 /* PlatformUtilities.cpp */; };
 		BC575BE0126F590D006F0F12 /* PlatformUtilitiesMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC131884117114B600B69727 /* PlatformUtilitiesMac.mm */; };
+		BC7B61AA129A038700D174A4 /* WKPreferences.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC7B619A1299FE9E00D174A4 /* WKPreferences.cpp */; };
 		BC90955D125548AA00083756 /* PlatformWebViewMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC90955C125548AA00083756 /* PlatformWebViewMac.mm */; };
 		BC90964C125561BF00083756 /* VectorBasic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC90964B125561BF00083756 /* VectorBasic.cpp */; };
 		BC90964E1255620C00083756 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC90964D1255620C00083756 /* JavaScriptCore.framework */; };
@@ -101,6 +102,7 @@
 		BC575AAF126E83C8006F0F12 /* InjectedBundleBasic_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleBasic_Bundle.cpp; sourceTree = "<group>"; };
 		BC575AE2126E88B1006F0F12 /* InjectedBundle.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = InjectedBundle.xcconfig; sourceTree = "<group>"; };
 		BC575BBF126F5752006F0F12 /* PlatformUtilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformUtilities.cpp; sourceTree = "<group>"; };
+		BC7B619A1299FE9E00D174A4 /* WKPreferences.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKPreferences.cpp; sourceTree = "<group>"; };
 		BC90951B125533D700083756 /* PlatformWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformWebView.h; sourceTree = "<group>"; };
 		BC90955C125548AA00083756 /* PlatformWebViewMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformWebViewMac.mm; sourceTree = "<group>"; };
 		BC90957E12554CF900083756 /* Base.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Base.xcconfig; sourceTree = "<group>"; };
@@ -227,20 +229,21 @@
 			isa = PBXGroup;
 			children = (
 				BC90977B125571AE00083756 /* Resources */,
+				BCB6803F126FBFE100642A61 /* DocumentStartUserScriptAlertCrash.cpp */,
+				BCB68041126FBFF100642A61 /* DocumentStartUserScriptAlertCrash_Bundle.cpp */,
 				1A5FEFDC1270E2A3000E2921 /* EvaluateJavaScript.cpp */,
+				BCC8B95A12611F4700DE46A4 /* FailedLoad.cpp */,
 				1A02C84E125D4A8400E3F4BD /* Find.cpp */,
 				BCBD370F125AA2EB00D2C29F /* FrameMIMETypeHTML.cpp */,
 				BCBD3760125ABCFE00D2C29F /* FrameMIMETypePNG.cpp */,
+				BC575AAC126E83B9006F0F12 /* InjectedBundleBasic.cpp */,
+				BC575AAF126E83C8006F0F12 /* InjectedBundleBasic_Bundle.cpp */,
 				BC909779125571AB00083756 /* PageLoadBasic.cpp */,
 				333B9CE11277F23100FEFCE3 /* PreventEmptyUserAgent.cpp */,
 				C02B77F1126612140026BF0F /* SpacebarScrolling.cpp */,
+				BC7B619A1299FE9E00D174A4 /* WKPreferences.cpp */,
 				BC90995D12567BC100083756 /* WKString.cpp */,
 				BC9099931256ACF100083756 /* WKStringJSString.cpp */,
-				BCC8B95A12611F4700DE46A4 /* FailedLoad.cpp */,
-				BC575AAC126E83B9006F0F12 /* InjectedBundleBasic.cpp */,
-				BC575AAF126E83C8006F0F12 /* InjectedBundleBasic_Bundle.cpp */,
-				BCB6803F126FBFE100642A61 /* DocumentStartUserScriptAlertCrash.cpp */,
-				BCB68041126FBFF100642A61 /* DocumentStartUserScriptAlertCrash_Bundle.cpp */,
 			);
 			path = WebKit2;
 			sourceTree = "<group>";
@@ -381,6 +384,7 @@
 				BCB68040126FBFE100642A61 /* DocumentStartUserScriptAlertCrash.cpp in Sources */,
 				1A5FEFDD1270E2A3000E2921 /* EvaluateJavaScript.cpp in Sources */,
 				333B9CE21277F23100FEFCE3 /* PreventEmptyUserAgent.cpp in Sources */,
+				BC7B61AA129A038700D174A4 /* WKPreferences.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/WebKitTools/TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp b/WebKitTools/TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp
new file mode 100644
index 0000000..d4cd4b7
--- /dev/null
+++ b/WebKitTools/TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "Test.h"
+
+#include <WebKit2/WKPreferences.h>
+#include <WebKit2/WKPreferencesPrivate.h>
+#include <WebKit2/WKRetainPtr.h>
+#include <WebKit2/WKString.h>
+#include <wtf/Platform.h>
+
+namespace TestWebKitAPI {
+
+TEST(WebKit2, WKPreferencesBasic)
+{
+    WKPreferencesRef preference = WKPreferencesCreate();
+
+    TEST_ASSERT(WKGetTypeID(preference) == WKPreferencesGetTypeID());
+
+    WKRelease(preference);
+}
+
+TEST(WebKit2, WKPreferencesDefaults)
+{
+#if PLATFORM(WIN)
+    static const char* expectedStandardFontFamily = "Times New Roman";
+    static const char* expectedFixedFontFamily = "Courier New";
+    static const char* expectedSerifFontFamily = "Times New Roman";
+    static const char* expectedSansSerifFontFamily = "Arial";
+    static const char* expectedCursiveFontFamily = "Comic Sans MS";
+    static const char* expectedFantasyFontFamily = "Comic Sans MS";
+#elif PLATFORM(MAC)
+    static const char* expectedStandardFontFamily = "Times";
+    static const char* expectedFixedFontFamily = "Courier";
+    static const char* expectedSerifFontFamily = "Times";
+    static const char* expectedSansSerifFontFamily = "Helvetica";
+    static const char* expectedCursiveFontFamily = "Apple Chancery";
+    static const char* expectedFantasyFontFamily = "Papyrus";
+#endif
+
+    WKPreferencesRef preference = WKPreferencesCreate();
+
+    TEST_ASSERT(WKPreferencesGetJavaScriptEnabled(preference) == true);
+    TEST_ASSERT(WKPreferencesGetLoadsImagesAutomatically(preference) == true);
+    TEST_ASSERT(WKPreferencesGetOfflineWebApplicationCacheEnabled(preference) == false);
+    TEST_ASSERT(WKPreferencesGetLocalStorageEnabled(preference) == true);
+    TEST_ASSERT(WKPreferencesGetXSSAuditorEnabled(preference) == true);
+    TEST_ASSERT(WKPreferencesGetFrameFlatteningEnabled(preference) == false);
+    TEST_ASSERT(WKPreferencesGetPluginsEnabled(preference) == true);
+    TEST_ASSERT(WKPreferencesGetJavaEnabled(preference) == true);
+    WKRetainPtr<WKStringRef> standardFontFamily(AdoptWK, WKPreferencesCopyStandardFontFamily(preference));
+    TEST_ASSERT(WKStringIsEqualToUTF8CString(standardFontFamily.get(), expectedStandardFontFamily));
+    WKRetainPtr<WKStringRef> fixedFontFamily(AdoptWK, WKPreferencesCopyFixedFontFamily(preference));
+    TEST_ASSERT(WKStringIsEqualToUTF8CString(fixedFontFamily.get(), expectedFixedFontFamily));
+    WKRetainPtr<WKStringRef> serifFontFamily(AdoptWK, WKPreferencesCopySerifFontFamily(preference));
+    TEST_ASSERT(WKStringIsEqualToUTF8CString(serifFontFamily.get(), expectedSerifFontFamily));
+    WKRetainPtr<WKStringRef> sansSerifFontFamily(AdoptWK, WKPreferencesCopySansSerifFontFamily(preference));
+    TEST_ASSERT(WKStringIsEqualToUTF8CString(sansSerifFontFamily.get(), expectedSansSerifFontFamily));
+    WKRetainPtr<WKStringRef> cursiveFontFamily(AdoptWK, WKPreferencesCopyCursiveFontFamily(preference));
+    TEST_ASSERT(WKStringIsEqualToUTF8CString(cursiveFontFamily.get(), expectedCursiveFontFamily));
+    WKRetainPtr<WKStringRef> fantasyFontFamily(AdoptWK, WKPreferencesCopyFantasyFontFamily(preference));
+    TEST_ASSERT(WKStringIsEqualToUTF8CString(fantasyFontFamily.get(), expectedFantasyFontFamily));
+    TEST_ASSERT(WKPreferencesGetMinimumFontSize(preference) == 0);
+    TEST_ASSERT(WKPreferencesGetPrivateBrowsingEnabled(preference) == false);
+    TEST_ASSERT(WKPreferencesGetDeveloperExtrasEnabled(preference) == false);
+    TEST_ASSERT(WKPreferencesGetTextAreasAreResizable(preference) == true);
+    TEST_ASSERT(WKPreferencesGetFontSmoothingLevel(preference) == kWKFontSmoothingLevelMedium);
+    TEST_ASSERT(WKPreferencesGetAcceleratedCompositingEnabled(preference) == true);
+    TEST_ASSERT(WKPreferencesGetCompositingBordersVisible(preference) == false);
+    TEST_ASSERT(WKPreferencesGetCompositingRepaintCountersVisible(preference) == false);
+    TEST_ASSERT(WKPreferencesGetNeedsSiteSpecificQuirks(preference) == false);
+
+    WKRelease(preference);
+}
+
+} // namespace TestWebKitAPI
diff --git a/WebKitTools/TestWebKitAPI/win/TestWebKitAPI.vcproj b/WebKitTools/TestWebKitAPI/win/TestWebKitAPI.vcproj
index 882c609..0e36bda 100644
--- a/WebKitTools/TestWebKitAPI/win/TestWebKitAPI.vcproj
+++ b/WebKitTools/TestWebKitAPI/win/TestWebKitAPI.vcproj
@@ -461,6 +461,10 @@
 					>
 				</File>
 				<File
+					RelativePath="..\Tests\WebKit2\WKPreferences.cpp"
+					>
+				</File>
+				<File
 					RelativePath="..\Tests\WebKit2\WKString.cpp"
 					>
 				</File>

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list