[Qt][WK2] WebPreferences are impossible to use in QML.
authoralexis.menard@openbossa.org <alexis.menard@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Oct 2011 12:29:23 +0000 (12:29 +0000)
committeralexis.menard@openbossa.org <alexis.menard@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Oct 2011 12:29:23 +0000 (12:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=70141

Reviewed by Kenneth Rohde Christiansen.

Make it possible to use qwkpreferences in QML. Renamed it
to follow our new style regarding class names. This class is
now a QObject that is exposed as a property of the view.
The tests give an idea of the usage.

* UIProcess/API/qt/WKView.h:
* UIProcess/API/qt/qdesktopwebview.cpp:
(QDesktopWebView::preferences):
* UIProcess/API/qt/qdesktopwebview.h:
* UIProcess/API/qt/qmlplugin/plugin.cpp:
(WebKit2QmlPlugin::registerTypes):
* UIProcess/API/qt/qtouchwebpage.cpp:
(QTouchWebPage::preferences):
* UIProcess/API/qt/qtouchwebpage.h:
* UIProcess/API/qt/qwebpreferences.cpp: Added.
(QWebPreferencesPrivate::createPreferences):
(QWebPreferencesPrivate::testAttribute):
(QWebPreferencesPrivate::setAttribute):
(QWebPreferencesPrivate::setFontFamily):
(QWebPreferencesPrivate::fontFamily):
(QWebPreferencesPrivate::setFontSize):
(QWebPreferencesPrivate::fontSize):
(QWebPreferences::QWebPreferences):
(QWebPreferences::~QWebPreferences):
(QWebPreferences::autoLoadImages):
(QWebPreferences::setAutoLoadImages):
(QWebPreferences::javascriptEnabled):
(QWebPreferences::setJavascriptEnabled):
(QWebPreferences::pluginsEnabled):
(QWebPreferences::setPluginsEnabled):
(QWebPreferences::offlineWebApplicationCacheEnabled):
(QWebPreferences::setOfflineWebApplicationCacheEnabled):
(QWebPreferences::localStorageEnabled):
(QWebPreferences::setLocalStorageEnabled):
(QWebPreferences::XSSAuditingEnabled):
(QWebPreferences::setXSSAuditingEnabled):
(QWebPreferences::privateBrowsingEnabled):
(QWebPreferences::setPrivateBrowsingEnabled):
(QWebPreferences::dnsPrefetchEnabled):
(QWebPreferences::setDnsPrefetchEnabled):
(QWebPreferences::standardFontFamily):
(QWebPreferences::setStandardFontFamily):
(QWebPreferences::fixedFontFamily):
(QWebPreferences::setFixedFontFamily):
(QWebPreferences::serifFontFamily):
(QWebPreferences::setSerifFontFamily):
(QWebPreferences::sansSerifFontFamily):
(QWebPreferences::setSansSerifFontFamily):
(QWebPreferences::cursiveFontFamily):
(QWebPreferences::setCursiveFontFamily):
(QWebPreferences::fantasyFontFamily):
(QWebPreferences::setFantasyFontFamily):
(QWebPreferences::minimumFontSize):
(QWebPreferences::setMinimumFontSize):
(QWebPreferences::defaultFontSize):
(QWebPreferences::setDefaultFontSize):
(QWebPreferences::defaultFixedFontSize):
(QWebPreferences::setDefaultFixedFontSize):
* UIProcess/API/qt/qwebpreferences.h: Added.
* UIProcess/API/qt/qwebpreferences_p.h: Added.
* UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_preferences.qml: Added.
* UIProcess/API/qt/tests/qmltests/common/javascript.html: Added.
* UIProcess/API/qt/tests/qmltests/common/localStorage.html: Added.
* UIProcess/qt/QtWebPageProxy.cpp:
(QtWebPageProxy::preferences):
* UIProcess/qt/QtWebPageProxy.h:
* UIProcess/qt/qwkpreferences.cpp: Removed.
* UIProcess/qt/qwkpreferences.h: Removed.
* UIProcess/qt/qwkpreferences_p.h: Removed.
* WebKit2.pro:
* WebKit2API.pri:

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

19 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/qt/WKView.h
Source/WebKit2/UIProcess/API/qt/qdesktopwebview.cpp
Source/WebKit2/UIProcess/API/qt/qdesktopwebview.h
Source/WebKit2/UIProcess/API/qt/qmlplugin/plugin.cpp
Source/WebKit2/UIProcess/API/qt/qtouchwebpage.cpp
Source/WebKit2/UIProcess/API/qt/qtouchwebpage.h
Source/WebKit2/UIProcess/API/qt/qwebpreferences.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/API/qt/qwebpreferences.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/qt/qwebpreferences_p.h [moved from Source/WebKit2/UIProcess/qt/qwkpreferences.h with 73% similarity]
Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_preferences.qml [new file with mode: 0644]
Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/javascript.html [new file with mode: 0644]
Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/localStorage.html [new file with mode: 0644]
Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp
Source/WebKit2/UIProcess/qt/QtWebPageProxy.h
Source/WebKit2/UIProcess/qt/qwkpreferences.cpp [deleted file]
Source/WebKit2/UIProcess/qt/qwkpreferences_p.h [deleted file]
Source/WebKit2/WebKit2.pro
Source/WebKit2/WebKit2API.pri

index 289b009..46f3809 100644 (file)
@@ -1,3 +1,82 @@
+2011-10-18  Alexis Menard  <alexis.menard@openbossa.org>
+
+        [Qt][WK2] WebPreferences are impossible to use in QML.
+        https://bugs.webkit.org/show_bug.cgi?id=70141
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Make it possible to use qwkpreferences in QML. Renamed it
+        to follow our new style regarding class names. This class is 
+        now a QObject that is exposed as a property of the view.
+        The tests give an idea of the usage.
+
+        * UIProcess/API/qt/WKView.h:
+        * UIProcess/API/qt/qdesktopwebview.cpp:
+        (QDesktopWebView::preferences):
+        * UIProcess/API/qt/qdesktopwebview.h:
+        * UIProcess/API/qt/qmlplugin/plugin.cpp:
+        (WebKit2QmlPlugin::registerTypes):
+        * UIProcess/API/qt/qtouchwebpage.cpp:
+        (QTouchWebPage::preferences):
+        * UIProcess/API/qt/qtouchwebpage.h:
+        * UIProcess/API/qt/qwebpreferences.cpp: Added.
+        (QWebPreferencesPrivate::createPreferences):
+        (QWebPreferencesPrivate::testAttribute):
+        (QWebPreferencesPrivate::setAttribute):
+        (QWebPreferencesPrivate::setFontFamily):
+        (QWebPreferencesPrivate::fontFamily):
+        (QWebPreferencesPrivate::setFontSize):
+        (QWebPreferencesPrivate::fontSize):
+        (QWebPreferences::QWebPreferences):
+        (QWebPreferences::~QWebPreferences):
+        (QWebPreferences::autoLoadImages):
+        (QWebPreferences::setAutoLoadImages):
+        (QWebPreferences::javascriptEnabled):
+        (QWebPreferences::setJavascriptEnabled):
+        (QWebPreferences::pluginsEnabled):
+        (QWebPreferences::setPluginsEnabled):
+        (QWebPreferences::offlineWebApplicationCacheEnabled):
+        (QWebPreferences::setOfflineWebApplicationCacheEnabled):
+        (QWebPreferences::localStorageEnabled):
+        (QWebPreferences::setLocalStorageEnabled):
+        (QWebPreferences::XSSAuditingEnabled):
+        (QWebPreferences::setXSSAuditingEnabled):
+        (QWebPreferences::privateBrowsingEnabled):
+        (QWebPreferences::setPrivateBrowsingEnabled):
+        (QWebPreferences::dnsPrefetchEnabled):
+        (QWebPreferences::setDnsPrefetchEnabled):
+        (QWebPreferences::standardFontFamily):
+        (QWebPreferences::setStandardFontFamily):
+        (QWebPreferences::fixedFontFamily):
+        (QWebPreferences::setFixedFontFamily):
+        (QWebPreferences::serifFontFamily):
+        (QWebPreferences::setSerifFontFamily):
+        (QWebPreferences::sansSerifFontFamily):
+        (QWebPreferences::setSansSerifFontFamily):
+        (QWebPreferences::cursiveFontFamily):
+        (QWebPreferences::setCursiveFontFamily):
+        (QWebPreferences::fantasyFontFamily):
+        (QWebPreferences::setFantasyFontFamily):
+        (QWebPreferences::minimumFontSize):
+        (QWebPreferences::setMinimumFontSize):
+        (QWebPreferences::defaultFontSize):
+        (QWebPreferences::setDefaultFontSize):
+        (QWebPreferences::defaultFixedFontSize):
+        (QWebPreferences::setDefaultFixedFontSize):
+        * UIProcess/API/qt/qwebpreferences.h: Added.
+        * UIProcess/API/qt/qwebpreferences_p.h: Added.
+        * UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_preferences.qml: Added.
+        * UIProcess/API/qt/tests/qmltests/common/javascript.html: Added.
+        * UIProcess/API/qt/tests/qmltests/common/localStorage.html: Added.
+        * UIProcess/qt/QtWebPageProxy.cpp:
+        (QtWebPageProxy::preferences):
+        * UIProcess/qt/QtWebPageProxy.h:
+        * UIProcess/qt/qwkpreferences.cpp: Removed.
+        * UIProcess/qt/qwkpreferences.h: Removed.
+        * UIProcess/qt/qwkpreferences_p.h: Removed.
+        * WebKit2.pro:
+        * WebKit2API.pri:
+
 2011-10-18  Tomasz Morawski  <t.morawski@samsung.com>
 
         [EFL][WK2] Fix compilation error by include WebErrors.h file.
index 84ba1f7..f6892bd 100644 (file)
@@ -25,5 +25,6 @@
 #include <WebKit2/qtouchwebview.h>
 #include <WebKit2/qtouchwebpage.h>
 #include <WebKit2/qwebnavigationcontroller.h>
+#include <WebKit2/qwebpreferences.h>
 
 #endif /* WKView_h */
index 2967b53..9e127bf 100644 (file)
@@ -293,6 +293,11 @@ QWebNavigationController* QDesktopWebView::navigationController() const
     return d->navigationController;
 }
 
+QWebPreferences* QDesktopWebView::preferences() const
+{
+    return d->page.preferences();
+}
+
 static void paintCrashedPage(QPainter* painter, const QRectF& rect)
 {
     painter->fillRect(rect, Qt::gray);
index a3af328..d93d5d8 100644 (file)
@@ -29,6 +29,7 @@
 
 class QDesktopWebViewPrivate;
 class QWebNavigationController;
+class QWebPreferences;
 
 QT_BEGIN_NAMESPACE
 class QFocusEvent;
@@ -56,6 +57,7 @@ class QWEBKIT_EXPORT QDesktopWebView : public QSGPaintedItem {
     Q_PROPERTY(QUrl url READ url NOTIFY urlChanged)
     Q_PROPERTY(int loadProgress READ loadProgress NOTIFY loadProgressChanged)
     Q_PROPERTY(QWebNavigationController* navigation READ navigationController CONSTANT FINAL)
+    Q_PROPERTY(QWebPreferences* preferences READ preferences CONSTANT FINAL)
     Q_ENUMS(NavigationPolicy)
     Q_ENUMS(ErrorType)
 public:
@@ -79,6 +81,7 @@ public:
     int loadProgress() const;
 
     QWebNavigationController* navigationController() const;
+    QWebPreferences* preferences() const;
 
 public Q_SLOTS:
      void load(const QUrl&);
index 85d7d08..8e76f35 100644 (file)
@@ -21,6 +21,7 @@
 #include "qtouchwebpage.h"
 #include "qtouchwebview.h"
 #include "qwebnavigationcontroller.h"
+#include "qwebpreferences.h"
 
 #include <QtDeclarative/qdeclarative.h>
 #include <QtDeclarative/qdeclarativeextensionplugin.h>
@@ -37,6 +38,7 @@ public:
         qmlRegisterType<QDesktopWebView>(uri, 5, 0, "DesktopWebView");
         qmlRegisterType<QTouchWebView>(uri, 5, 0, "TouchWebView");
         qmlRegisterUncreatableType<QWebNavigationController>(uri, 5, 0, "NavigationController", QObject::tr("Cannot create separate instance of NavigationController"));
+        qmlRegisterUncreatableType<QWebPreferences>(uri, 5, 0, "WebPreferences", QObject::tr("Cannot create separate instance of WebPreferences"));
         qmlRegisterUncreatableType<QTouchWebPage>(uri, 5, 0, "TouchWebPage", QObject::tr("Cannot create separate instance of TouchWebPage, use TouchWebView"));
         qmlRegisterUncreatableType<QNetworkReply>(uri, 5, 0, "NetworkReply", QObject::tr("Cannot create separate instance of NetworkReply"));
     }
index f564a4d..01f4099 100644 (file)
@@ -141,6 +141,11 @@ QWebNavigationController* QTouchWebPage::navigationController() const
     return d->navigationController;
 }
 
+QWebPreferences* QTouchWebPage::preferences() const
+{
+    return d->page->preferences();
+}
+
 QTouchWebPagePrivate::QTouchWebPagePrivate(QTouchWebPage* view)
     : q(view)
     , page(0)
index f2ecf60..0af0da5 100644 (file)
@@ -30,6 +30,7 @@
 class QTouchWebPagePrivate;
 class QTouchWebPageProxy;
 class QWebNavigationController;
+class QWebPreferences;
 
 namespace WebKit {
     class TouchViewInterface;
@@ -41,6 +42,7 @@ class QWEBKIT_EXPORT QTouchWebPage : public QSGItem {
     Q_PROPERTY(QUrl url READ url NOTIFY urlChanged)
     Q_PROPERTY(int loadProgress READ loadProgress NOTIFY loadProgressChanged)
     Q_PROPERTY(QWebNavigationController* navigation READ navigationController CONSTANT FINAL)
+    Q_PROPERTY(QWebPreferences* preferences READ preferences CONSTANT FINAL)
     Q_ENUMS(ErrorType)
 public:
     enum ErrorType {
@@ -60,6 +62,7 @@ public:
     int loadProgress() const;
 
     QWebNavigationController* navigationController() const;
+    QWebPreferences* preferences() const;
 
     virtual QSGNode* updatePaintNode(QSGNode* oldNode, UpdatePaintNodeData*);
     virtual bool event(QEvent*);
diff --git a/Source/WebKit2/UIProcess/API/qt/qwebpreferences.cpp b/Source/WebKit2/UIProcess/API/qt/qwebpreferences.cpp
new file mode 100644 (file)
index 0000000..9eae6e8
--- /dev/null
@@ -0,0 +1,378 @@
+/*
+    Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+#include "qwebpreferences.h"
+
+#include "WKPageGroup.h"
+#include "WKPreferences.h"
+#include "WKRetainPtr.h"
+#include "WKStringQt.h"
+#include "qwebpreferences_p.h"
+
+QWebPreferences* QWebPreferencesPrivate::createPreferences(WKPageGroupRef pageGroupRef)
+{
+    QWebPreferences* prefs = new QWebPreferences;
+    prefs->d->ref = WKPageGroupGetPreferences(pageGroupRef);
+    return prefs;
+}
+
+bool QWebPreferencesPrivate::testAttribute(QWebPreferencesPrivate::WebAttribute attr) const
+{
+    switch (attr) {
+    case AutoLoadImages:
+        return WKPreferencesGetLoadsImagesAutomatically(ref);
+    case JavascriptEnabled:
+        return WKPreferencesGetJavaScriptEnabled(ref);
+    case PluginsEnabled:
+        return WKPreferencesGetPluginsEnabled(ref);
+    case OfflineWebApplicationCacheEnabled:
+        return WKPreferencesGetOfflineWebApplicationCacheEnabled(ref);
+    case LocalStorageEnabled:
+        return WKPreferencesGetLocalStorageEnabled(ref);
+    case XSSAuditingEnabled:
+        return WKPreferencesGetXSSAuditorEnabled(ref);
+    case PrivateBrowsingEnabled:
+        return WKPreferencesGetPrivateBrowsingEnabled(ref);
+    case DnsPrefetchEnabled:
+        return WKPreferencesGetDNSPrefetchingEnabled(ref);
+    default:
+        ASSERT_NOT_REACHED();
+        return false;
+    }
+}
+
+void QWebPreferencesPrivate::setAttribute(QWebPreferencesPrivate::WebAttribute attr, bool enable)
+{
+    switch (attr) {
+    case AutoLoadImages:
+        WKPreferencesSetLoadsImagesAutomatically(ref, enable);
+        break;
+    case JavascriptEnabled:
+        WKPreferencesSetJavaScriptEnabled(ref, enable);
+        break;
+    case PluginsEnabled:
+        WKPreferencesSetPluginsEnabled(ref, enable);
+        break;
+    case OfflineWebApplicationCacheEnabled:
+        WKPreferencesSetOfflineWebApplicationCacheEnabled(ref, enable);
+        break;
+    case LocalStorageEnabled:
+        WKPreferencesSetLocalStorageEnabled(ref, enable);
+        break;
+    case XSSAuditingEnabled:
+        WKPreferencesSetXSSAuditorEnabled(ref, enable);
+        break;
+    case PrivateBrowsingEnabled:
+        WKPreferencesSetPrivateBrowsingEnabled(ref, enable);
+        break;
+    case DnsPrefetchEnabled:
+        WKPreferencesSetDNSPrefetchingEnabled(ref, enable);
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+    }
+}
+
+void QWebPreferencesPrivate::setFontFamily(QWebPreferencesPrivate::FontFamily which, const QString& family)
+{
+    switch (which) {
+    case StandardFont:
+        WKPreferencesSetStandardFontFamily(ref, WKStringCreateWithQString(family));
+        break;
+    case FixedFont:
+        WKPreferencesSetFixedFontFamily(ref, WKStringCreateWithQString(family));
+        break;
+    case SerifFont:
+        WKPreferencesSetSerifFontFamily(ref, WKStringCreateWithQString(family));
+        break;
+    case SansSerifFont:
+        WKPreferencesSetSansSerifFontFamily(ref, WKStringCreateWithQString(family));
+        break;
+    case CursiveFont:
+        WKPreferencesSetCursiveFontFamily(ref, WKStringCreateWithQString(family));
+        break;
+    case FantasyFont:
+        WKPreferencesSetFantasyFontFamily(ref, WKStringCreateWithQString(family));
+        break;
+    default:
+        break;
+    }
+}
+
+QString QWebPreferencesPrivate::fontFamily(QWebPreferencesPrivate::FontFamily which) const
+{
+    switch (which) {
+    case StandardFont: {
+        WKRetainPtr<WKStringRef> stringRef(AdoptWK, WKPreferencesCopyStandardFontFamily(ref));
+        return WKStringCopyQString(stringRef.get());
+    }
+    case FixedFont: {
+        WKRetainPtr<WKStringRef> stringRef(AdoptWK, WKPreferencesCopyFixedFontFamily(ref));
+        return WKStringCopyQString(stringRef.get());
+    }
+    case SerifFont: {
+        WKRetainPtr<WKStringRef> stringRef(AdoptWK, WKPreferencesCopySerifFontFamily(ref));
+        return WKStringCopyQString(stringRef.get());
+    }
+    case SansSerifFont: {
+        WKRetainPtr<WKStringRef> stringRef(AdoptWK, WKPreferencesCopySansSerifFontFamily(ref));
+        return WKStringCopyQString(stringRef.get());
+    }
+    case CursiveFont: {
+        WKRetainPtr<WKStringRef> stringRef(AdoptWK, WKPreferencesCopyCursiveFontFamily(ref));
+        return WKStringCopyQString(stringRef.get());
+    }
+    case FantasyFont: {
+        WKRetainPtr<WKStringRef> stringRef(AdoptWK, WKPreferencesCopyFantasyFontFamily(ref));
+        return WKStringCopyQString(stringRef.get());
+    }
+    default:
+        return QString();
+    }
+}
+
+void QWebPreferencesPrivate::setFontSize(QWebPreferencesPrivate::FontSizeType type, unsigned size)
+{
+    switch (type) {
+    case MinimumFontSize:
+         WKPreferencesSetMinimumFontSize(ref, size);
+         break;
+    case DefaultFontSize:
+         WKPreferencesSetDefaultFontSize(ref, size);
+         break;
+    case DefaultFixedFontSize:
+         WKPreferencesSetDefaultFixedFontSize(ref, size);
+         break;
+    default:
+        ASSERT_NOT_REACHED();
+    }
+}
+
+unsigned QWebPreferencesPrivate::fontSize(QWebPreferencesPrivate::FontSizeType type) const
+{
+    switch (type) {
+    case MinimumFontSize:
+         return WKPreferencesGetMinimumFontSize(ref);
+    case DefaultFontSize:
+         return WKPreferencesGetDefaultFontSize(ref);
+    case DefaultFixedFontSize:
+         return WKPreferencesGetDefaultFixedFontSize(ref);
+    default:
+        ASSERT_NOT_REACHED();
+        return false;
+    }
+}
+
+QWebPreferences::QWebPreferences()
+    : d(new QWebPreferencesPrivate)
+{
+}
+
+QWebPreferences::~QWebPreferences()
+{
+    delete d;
+}
+
+bool QWebPreferences::autoLoadImages() const
+{
+    return d->testAttribute(QWebPreferencesPrivate::AutoLoadImages);
+}
+
+void QWebPreferences::setAutoLoadImages(bool enable)
+{
+    d->setAttribute(QWebPreferencesPrivate::AutoLoadImages, enable);
+    emit autoLoadImagesChanged();
+}
+
+bool QWebPreferences::javascriptEnabled() const
+{
+    return d->testAttribute(QWebPreferencesPrivate::JavascriptEnabled);
+}
+
+void QWebPreferences::setJavascriptEnabled(bool enable)
+{
+    d->setAttribute(QWebPreferencesPrivate::JavascriptEnabled, enable);
+    emit javascriptEnabledChanged();
+}
+
+bool QWebPreferences::pluginsEnabled() const
+{
+    return d->testAttribute(QWebPreferencesPrivate::PluginsEnabled);
+}
+
+void QWebPreferences::setPluginsEnabled(bool enable)
+{
+    d->setAttribute(QWebPreferencesPrivate::PluginsEnabled, enable);
+    emit pluginsEnabledChanged();
+}
+
+bool QWebPreferences::offlineWebApplicationCacheEnabled() const
+{
+    return d->testAttribute(QWebPreferencesPrivate::OfflineWebApplicationCacheEnabled);
+}
+
+void QWebPreferences::setOfflineWebApplicationCacheEnabled(bool enable)
+{
+    d->setAttribute(QWebPreferencesPrivate::OfflineWebApplicationCacheEnabled, enable);
+    emit offlineWebApplicationCacheEnabledChanged();
+}
+
+bool QWebPreferences::localStorageEnabled() const
+{
+    return d->testAttribute(QWebPreferencesPrivate::LocalStorageEnabled);
+}
+
+void QWebPreferences::setLocalStorageEnabled(bool enable)
+{
+    d->setAttribute(QWebPreferencesPrivate::LocalStorageEnabled, enable);
+    emit localStorageEnabledChanged();
+}
+
+bool QWebPreferences::xssAuditingEnabled() const
+{
+    return d->testAttribute(QWebPreferencesPrivate::XSSAuditingEnabled);
+}
+
+void QWebPreferences::setXssAuditingEnabled(bool enable)
+{
+    d->setAttribute(QWebPreferencesPrivate::XSSAuditingEnabled, enable);
+    emit xssAuditingEnabledChanged();
+}
+
+bool QWebPreferences::privateBrowsingEnabled() const
+{
+    return d->testAttribute(QWebPreferencesPrivate::PrivateBrowsingEnabled);
+}
+
+void QWebPreferences::setPrivateBrowsingEnabled(bool enable)
+{
+    d->setAttribute(QWebPreferencesPrivate::PrivateBrowsingEnabled, enable);
+    emit privateBrowsingEnabledChanged();
+}
+
+bool QWebPreferences::dnsPrefetchEnabled() const
+{
+    return d->testAttribute(QWebPreferencesPrivate::DnsPrefetchEnabled);
+}
+
+void QWebPreferences::setDnsPrefetchEnabled(bool enable)
+{
+    d->setAttribute(QWebPreferencesPrivate::DnsPrefetchEnabled, enable);
+    emit dnsPrefetchEnabledChanged();
+}
+
+QString QWebPreferences::standardFontFamily() const
+{
+    return d->fontFamily(QWebPreferencesPrivate::StandardFont);
+}
+
+void QWebPreferences::setStandardFontFamily(const QString& family)
+{
+    d->setFontFamily(QWebPreferencesPrivate::StandardFont, family);
+    emit standardFontFamilyChanged();
+}
+
+QString QWebPreferences::fixedFontFamily() const
+{
+    return d->fontFamily(QWebPreferencesPrivate::FixedFont);
+}
+
+void QWebPreferences::setFixedFontFamily(const QString& family)
+{
+    d->setFontFamily(QWebPreferencesPrivate::FixedFont, family);
+    emit fixedFontFamilyChanged();
+}
+
+QString QWebPreferences::serifFontFamily() const
+{
+    return d->fontFamily(QWebPreferencesPrivate::SerifFont);
+}
+
+void QWebPreferences::setSerifFontFamily(const QString& family)
+{
+    d->setFontFamily(QWebPreferencesPrivate::SerifFont, family);
+    emit serifFontFamilyChanged();
+}
+
+QString QWebPreferences::sansSerifFontFamily() const
+{
+    return d->fontFamily(QWebPreferencesPrivate::SansSerifFont);
+}
+
+void QWebPreferences::setSansSerifFontFamily(const QString& family)
+{
+    d->setFontFamily(QWebPreferencesPrivate::SansSerifFont, family);
+    emit sansSerifFontFamilyChanged();
+}
+
+QString QWebPreferences::cursiveFontFamily() const
+{
+    return d->fontFamily(QWebPreferencesPrivate::CursiveFont);
+}
+
+void QWebPreferences::setCursiveFontFamily(const QString& family)
+{
+    d->setFontFamily(QWebPreferencesPrivate::CursiveFont, family);
+    emit cursiveFontFamilyChanged();
+}
+
+QString QWebPreferences::fantasyFontFamily() const
+{
+    return d->fontFamily(QWebPreferencesPrivate::FantasyFont);
+}
+
+void QWebPreferences::setFantasyFontFamily(const QString& family)
+{
+    d->setFontFamily(QWebPreferencesPrivate::FantasyFont, family);
+    emit fantasyFontFamilyChanged();
+}
+
+unsigned QWebPreferences::minimumFontSize() const
+{
+    return d->fontSize(QWebPreferencesPrivate::MinimumFontSize);
+}
+
+void QWebPreferences::setMinimumFontSize(unsigned size)
+{
+    d->setFontSize(QWebPreferencesPrivate::MinimumFontSize, size);
+    emit minimumFontSizeChanged();
+}
+
+unsigned QWebPreferences::defaultFontSize() const
+{
+    return d->fontSize(QWebPreferencesPrivate::DefaultFontSize);
+}
+
+void QWebPreferences::setDefaultFontSize(unsigned size)
+{
+    d->setFontSize(QWebPreferencesPrivate::DefaultFontSize, size);
+    emit defaultFontSizeChanged();
+}
+
+unsigned QWebPreferences::defaultFixedFontSize() const
+{
+    return d->fontSize(QWebPreferencesPrivate::DefaultFixedFontSize);
+}
+
+void QWebPreferences::setDefaultFixedFontSize(unsigned size)
+{
+    d->setFontSize(QWebPreferencesPrivate::DefaultFixedFontSize, size);
+    emit defaultFixedFontSizeChanged();
+}
diff --git a/Source/WebKit2/UIProcess/API/qt/qwebpreferences.h b/Source/WebKit2/UIProcess/API/qt/qwebpreferences.h
new file mode 100644 (file)
index 0000000..00d2c1e
--- /dev/null
@@ -0,0 +1,135 @@
+/*
+    Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#ifndef qwebpreferences_h
+#define qwebpreferences_h
+
+#include "qwebkitglobal.h"
+
+#include <QtCore/QObject>
+
+class QWebPreferencesPrivate;
+
+class QWEBKIT_EXPORT QWebPreferences : public QObject {
+    Q_OBJECT
+public:
+    Q_PROPERTY(bool autoLoadImages READ autoLoadImages WRITE setAutoLoadImages NOTIFY autoLoadImagesChanged FINAL)
+    Q_PROPERTY(bool javascriptEnabled READ javascriptEnabled WRITE setJavascriptEnabled NOTIFY javascriptEnabledChanged FINAL)
+    Q_PROPERTY(bool pluginsEnabled READ pluginsEnabled WRITE setPluginsEnabled NOTIFY pluginsEnabledChanged FINAL)
+    Q_PROPERTY(bool offlineWebApplicationCacheEnabled READ offlineWebApplicationCacheEnabled WRITE setOfflineWebApplicationCacheEnabled NOTIFY offlineWebApplicationCacheEnabledChanged FINAL)
+    Q_PROPERTY(bool localStorageEnabled READ localStorageEnabled WRITE setLocalStorageEnabled NOTIFY localStorageEnabledChanged FINAL)
+    Q_PROPERTY(bool xssAuditingEnabled READ xssAuditingEnabled WRITE setXssAuditingEnabled NOTIFY xssAuditingEnabledChanged FINAL)
+    Q_PROPERTY(bool privateBrowsingEnabled READ privateBrowsingEnabled WRITE setPrivateBrowsingEnabled NOTIFY privateBrowsingEnabledChanged FINAL)
+    Q_PROPERTY(bool dnsPrefetchEnabled READ dnsPrefetchEnabled WRITE setDnsPrefetchEnabled NOTIFY dnsPrefetchEnabledChanged FINAL)
+
+    Q_PROPERTY(QString standardFontFamily READ standardFontFamily WRITE setStandardFontFamily NOTIFY standardFontFamilyChanged FINAL)
+    Q_PROPERTY(QString fixedFontFamily READ fixedFontFamily WRITE setFixedFontFamily NOTIFY fixedFontFamilyChanged FINAL)
+    Q_PROPERTY(QString serifFontFamily READ serifFontFamily WRITE setSerifFontFamily NOTIFY serifFontFamilyChanged FINAL)
+    Q_PROPERTY(QString sansSerifFontFamily READ sansSerifFontFamily WRITE setSansSerifFontFamily NOTIFY sansSerifFontFamilyChanged FINAL)
+    Q_PROPERTY(QString cursiveFontFamily READ cursiveFontFamily WRITE setCursiveFontFamily NOTIFY cursiveFontFamilyChanged FINAL)
+    Q_PROPERTY(QString fantasyFontFamily READ fantasyFontFamily WRITE setFantasyFontFamily NOTIFY fantasyFontFamilyChanged FINAL)
+
+    Q_PROPERTY(unsigned minimumFontSize READ minimumFontSize WRITE setMinimumFontSize NOTIFY minimumFontSizeChanged FINAL)
+    Q_PROPERTY(unsigned defaultFontSize READ defaultFontSize WRITE setDefaultFontSize NOTIFY defaultFontSizeChanged FINAL)
+    Q_PROPERTY(unsigned defaultFixedFontSize READ defaultFixedFontSize WRITE setDefaultFixedFontSize NOTIFY defaultFixedFontSizeChanged FINAL)
+
+    bool autoLoadImages() const;
+    void setAutoLoadImages(bool enable);
+
+    bool javascriptEnabled() const;
+    void setJavascriptEnabled(bool enable);
+
+    bool pluginsEnabled() const;
+    void setPluginsEnabled(bool enable);
+
+    bool offlineWebApplicationCacheEnabled() const;
+    void setOfflineWebApplicationCacheEnabled(bool enable);
+
+    bool localStorageEnabled() const;
+    void setLocalStorageEnabled(bool enable);
+
+    bool xssAuditingEnabled() const;
+    void setXssAuditingEnabled(bool enable);
+
+    bool privateBrowsingEnabled() const;
+    void setPrivateBrowsingEnabled(bool enable);
+
+    bool dnsPrefetchEnabled() const;
+    void setDnsPrefetchEnabled(bool enable);
+
+    QString standardFontFamily() const;
+    void setStandardFontFamily(const QString& family);
+
+    QString fixedFontFamily() const;
+    void setFixedFontFamily(const QString& family);
+
+    QString serifFontFamily() const;
+    void setSerifFontFamily(const QString& family);
+
+    QString sansSerifFontFamily() const;
+    void setSansSerifFontFamily(const QString& family);
+
+    QString cursiveFontFamily() const;
+    void setCursiveFontFamily(const QString& family);
+
+    QString fantasyFontFamily() const;
+    void setFantasyFontFamily(const QString& family);
+
+    unsigned minimumFontSize() const;
+    void setMinimumFontSize(unsigned size);
+
+    unsigned defaultFontSize() const;
+    void setDefaultFontSize(unsigned size);
+
+    unsigned defaultFixedFontSize() const;
+    void setDefaultFixedFontSize(unsigned size);
+
+Q_SIGNALS:
+    void autoLoadImagesChanged();
+    void pluginsEnabledChanged();
+    void javascriptEnabledChanged();
+    void offlineWebApplicationCacheEnabledChanged();
+    void localStorageEnabledChanged();
+    void xssAuditingEnabledChanged();
+    void privateBrowsingEnabledChanged();
+    void dnsPrefetchEnabledChanged();
+
+    void standardFontFamilyChanged();
+    void fixedFontFamilyChanged();
+    void serifFontFamilyChanged();
+    void sansSerifFontFamilyChanged();
+    void cursiveFontFamilyChanged();
+    void fantasyFontFamilyChanged();
+
+    void minimumFontSizeChanged();
+    void defaultFontSizeChanged();
+    void defaultFixedFontSizeChanged();
+
+private:
+    Q_DISABLE_COPY(QWebPreferences)
+
+    QWebPreferences();
+    ~QWebPreferences();
+
+    QWebPreferencesPrivate *d;
+
+    friend class QWebPreferencesPrivate;
+};
+
+#endif // qwebpreferences_h
     Boston, MA 02110-1301, USA.
 */
 
-#ifndef QWKPREFERENCES_H
-#define QWKPREFERENCES_H
+#include "WKPreferences.h"
 
-#include "qwebkitglobal.h"
-
-class QWKPreferencesPrivate;
-
-class QWEBKIT_EXPORT QWKPreferences {
+class QWebPreferencesPrivate {
 public:
-    enum FontFamily {
-        StandardFont,
-        FixedFont,
-        SerifFont,
-        SansSerifFont,
-        CursiveFont,
-        FantasyFont
-    };
 
     enum WebAttribute {
         AutoLoadImages,
@@ -44,36 +31,34 @@ public:
         XSSAuditingEnabled,
         FrameFlatteningEnabled,
         PrivateBrowsingEnabled,
-        DeveloperExtrasEnabled,
         DnsPrefetchEnabled
     };
 
-    enum FontSize {
+    enum FontFamily {
+        StandardFont,
+        FixedFont,
+        SerifFont,
+        SansSerifFont,
+        CursiveFont,
+        FantasyFont
+    };
+
+    enum FontSizeType {
         MinimumFontSize,
         DefaultFontSize,
         DefaultFixedFontSize
     };
 
-    static QWKPreferences* sharedPreferences();
+    static QWebPreferences* createPreferences(WKPageGroupRef);
 
-    void setFontFamily(FontFamily which, const QString& family);
-    QString fontFamily(FontFamily which) const;
-
-    void setAttribute(WebAttribute attr, bool on);
+    void setAttribute(WebAttribute attr, bool enable);
     bool testAttribute(WebAttribute attr) const;
 
-    void setFontSize(FontSize type, int size);
-    int fontSize(FontSize type) const;
-
-private:
-    Q_DISABLE_COPY(QWKPreferences)
-
-    QWKPreferences();
-    ~QWKPreferences();
+    void setFontFamily(FontFamily which, const QString& family);
+    QString fontFamily(FontFamily which) const;
 
-    QWKPreferencesPrivate *d;
+    void setFontSize(FontSizeType type, unsigned size);
+    unsigned fontSize(FontSizeType type) const;
 
-    friend class QWKPreferencesPrivate;
+    WKPreferencesRef ref;
 };
-
-#endif // QWKPREFERENCES_H
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_preferences.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_preferences.qml
new file mode 100644 (file)
index 0000000..2abcb22
--- /dev/null
@@ -0,0 +1,84 @@
+import QtQuick 2.0
+import QtTest 1.0
+import QtWebKit.experimental 5.0
+
+DesktopWebView {
+    id: webView
+
+    preferences {
+        javascriptEnabled: true
+        localStorageEnabled: true
+        pluginsEnabled: true
+    }
+
+    SignalSpy {
+        id: spy
+        target: webView
+        signalName: "loadSucceeded"
+    }
+
+    TestCase {
+        name: "DesktopWebViewPreferences"
+
+        function init() {
+            webView.preferences.javascriptEnabled = true
+            webView.preferences.localStorageEnabled = true
+            webView.preferences.pluginsEnabled = true
+            spy.clear()
+        }
+
+        function test_javascriptEnabled() {
+            webView.preferences.javascriptEnabled = true
+            var testUrl = Qt.resolvedUrl("../common/javascript.html")
+            webView.load(testUrl)
+            spy.wait()
+            compare(webView.title, "New Title")
+        }
+
+        function test_javascriptDisabled() {
+            webView.preferences.javascriptEnabled = false
+            var testUrl = Qt.resolvedUrl("../common/javascript.html")
+            webView.load(testUrl)
+            spy.wait()
+            compare(webView.title, "Original Title")
+        }
+
+        function test_localStorageDisabled() {
+            webView.preferences.localStorageEnabled = false
+            var testUrl = Qt.resolvedUrl("../common/localStorage.html")
+            webView.load(testUrl)
+            spy.wait()
+            compare(webView.title, "Original Title")
+        }
+
+        function test_localStorageEnabled() {
+            webView.preferences.localStorageEnabled = true
+            var testUrl = Qt.resolvedUrl("../common/localStorage.html")
+            webView.load(testUrl)
+            spy.wait()
+            spy.clear()
+            webView.load(testUrl)
+            spy.wait()
+            compare(webView.title, "New Title")
+        }
+
+        function test_pluginsDisabled() {
+            webView.preferences.pluginsEnabled = false
+            var testUrl = Qt.resolvedUrl("../common/plugins.html")
+            webView.load(testUrl)
+            spy.wait()
+            compare(webView.title, "Plugins Not Loaded")
+        }
+
+        function test_pluginsEnabled() {
+            webView.preferences.pluginsEnabled = true
+            var testUrl = Qt.resolvedUrl("../common/plugins.html")
+            webView.load(testUrl)
+            spy.wait()
+            spy.clear()
+            webView.load(testUrl)
+            spy.wait()
+            compare(webView.title, "Original Title")
+        }
+    }
+}
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/javascript.html b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/javascript.html
new file mode 100644 (file)
index 0000000..7a3dc0a
--- /dev/null
@@ -0,0 +1,8 @@
+<html>
+<head><title>Original Title</title></head>
+<body>
+<script type="text/javascript">
+document.title = "New Title";
+</script>
+</body>
+</html>
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/localStorage.html b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/localStorage.html
new file mode 100644 (file)
index 0000000..a4e395f
--- /dev/null
@@ -0,0 +1,9 @@
+<html>
+<head><title>Original Title</title></head>
+<body>
+<script type="text/javascript">
+document.title = localStorage.getItem('title');
+localStorage.setItem('title', 'New Title');
+</script>
+</body>
+</html>
index 2b5e66a..7499b4a 100644 (file)
@@ -22,7 +22,7 @@
 #include "QtWebPageProxy.h"
 
 #include "qweberror.h"
-#include "qwkpreferences_p.h"
+#include "qwebpreferences_p.h"
 
 #include "ClientImpl.h"
 #include "qwkhistory.h"
@@ -493,11 +493,11 @@ void QtWebPageProxy::processDidCrash()
     m_viewInterface->processDidCrash();
 }
 
-QWKPreferences* QtWebPageProxy::preferences() const
+QWebPreferences* QtWebPageProxy::preferences() const
 {
     if (!m_preferences) {
         WKPageGroupRef pageGroupRef = WKPageGetPageGroup(pageRef());
-        m_preferences = QWKPreferencesPrivate::createPreferences(pageGroupRef);
+        m_preferences = QWebPreferencesPrivate::createPreferences(pageGroupRef);
     }
 
     return m_preferences;
index fbd6415..da5c4b6 100644 (file)
@@ -44,8 +44,8 @@ class QUndoStack;
 QT_END_NAMESPACE
 
 class QWebError;
+class QWebPreferences;
 class QWKHistory;
-class QWKPreferences;
 
 using namespace WebKit;
 
@@ -152,7 +152,7 @@ public:
 
     void setDrawingAreaSize(const QSize&);
 
-    QWKPreferences* preferences() const;
+    QWebPreferences* preferences() const;
 
     QString title() const;
 
@@ -203,7 +203,7 @@ private:
     QWKHistory* m_history;
 
     mutable QAction* m_actions[QtWebPageProxy::WebActionCount];
-    mutable QWKPreferences* m_preferences;
+    mutable QWebPreferences* m_preferences;
 
     OwnPtr<QUndoStack> m_undoStack;
     int m_loadProgress;
diff --git a/Source/WebKit2/UIProcess/qt/qwkpreferences.cpp b/Source/WebKit2/UIProcess/qt/qwkpreferences.cpp
deleted file mode 100644 (file)
index 0f54c00..0000000
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
-    Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library General Public
-    License as published by the Free Software Foundation; either
-    version 2 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Library General Public License for more details.
-
-    You should have received a copy of the GNU Library General Public License
-    along with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-    Boston, MA 02110-1301, USA.
-*/
-
-#include "config.h"
-#include "qwkpreferences.h"
-
-#include "WKPageGroup.h"
-#include "WKPreferences.h"
-#include "WKStringQt.h"
-#include "WKRetainPtr.h"
-#include "qwkpreferences_p.h"
-
-
-QWKPreferences* QWKPreferencesPrivate::createPreferences(WKPageGroupRef pageGroupRef)
-{
-    QWKPreferences* prefs = new QWKPreferences;
-    prefs->d->ref = WKPageGroupGetPreferences(pageGroupRef);
-    return prefs;
-}
-
-QWKPreferences* QWKPreferencesPrivate::createSharedPreferences()
-{
-    QWKPreferences* prefs = new QWKPreferences;
-    prefs->d->ref = WKPreferencesCreate();
-    return prefs;
-}
-
-QWKPreferences* QWKPreferences::sharedPreferences()
-{
-    static QWKPreferences* instance = 0;
-
-    if (!instance)
-        instance = QWKPreferencesPrivate::createSharedPreferences();
-    return instance;
-}
-
-QWKPreferences::QWKPreferences()
-    : d(new QWKPreferencesPrivate)
-{
-}
-
-QWKPreferences::~QWKPreferences()
-{
-    delete d;
-}
-
-void QWKPreferences::setFontFamily(FontFamily which, const QString& family)
-{
-    switch (which) {
-    case StandardFont:
-        WKPreferencesSetStandardFontFamily(d->ref, WKStringCreateWithQString(family));
-        break;
-    case FixedFont:
-        WKPreferencesSetFixedFontFamily(d->ref, WKStringCreateWithQString(family));
-        break;
-    case SerifFont:
-        WKPreferencesSetSerifFontFamily(d->ref, WKStringCreateWithQString(family));
-        break;
-    case SansSerifFont:
-        WKPreferencesSetSansSerifFontFamily(d->ref, WKStringCreateWithQString(family));
-        break;
-    case CursiveFont:
-        WKPreferencesSetCursiveFontFamily(d->ref, WKStringCreateWithQString(family));
-        break;
-    case FantasyFont:
-        WKPreferencesSetFantasyFontFamily(d->ref, WKStringCreateWithQString(family));
-        break;
-    default:
-        break;
-    }
-}
-
-QString QWKPreferences::fontFamily(FontFamily which) const
-{
-    switch (which) {
-    case StandardFont: {
-        WKRetainPtr<WKStringRef> stringRef(AdoptWK, WKPreferencesCopyStandardFontFamily(d->ref));
-        return WKStringCopyQString(stringRef.get());
-    }
-    case FixedFont: {
-        WKRetainPtr<WKStringRef> stringRef(AdoptWK, WKPreferencesCopyFixedFontFamily(d->ref));
-        return WKStringCopyQString(stringRef.get());
-    }
-    case SerifFont: {
-        WKRetainPtr<WKStringRef> stringRef(AdoptWK, WKPreferencesCopySerifFontFamily(d->ref));
-        return WKStringCopyQString(stringRef.get());
-    }
-    case SansSerifFont: {
-        WKRetainPtr<WKStringRef> stringRef(AdoptWK, WKPreferencesCopySansSerifFontFamily(d->ref));
-        return WKStringCopyQString(stringRef.get());
-    }
-    case CursiveFont: {
-        WKRetainPtr<WKStringRef> stringRef(AdoptWK, WKPreferencesCopyCursiveFontFamily(d->ref));
-        return WKStringCopyQString(stringRef.get());
-    }
-    case FantasyFont: {
-        WKRetainPtr<WKStringRef> stringRef(AdoptWK, WKPreferencesCopyFantasyFontFamily(d->ref));
-        return WKStringCopyQString(stringRef.get());
-    }
-    default:
-        return QString();
-    }
-}
-
-bool QWKPreferences::testAttribute(WebAttribute attr) const
-{
-    switch (attr) {
-    case AutoLoadImages:
-        return WKPreferencesGetLoadsImagesAutomatically(d->ref);
-    case JavascriptEnabled:
-        return WKPreferencesGetJavaScriptEnabled(d->ref);
-    case PluginsEnabled:
-        return WKPreferencesGetPluginsEnabled(d->ref);
-    case OfflineWebApplicationCacheEnabled:
-        return WKPreferencesGetOfflineWebApplicationCacheEnabled(d->ref);
-    case LocalStorageEnabled:
-        return WKPreferencesGetLocalStorageEnabled(d->ref);
-    case XSSAuditingEnabled:
-        return WKPreferencesGetXSSAuditorEnabled(d->ref);
-    case FrameFlatteningEnabled:
-        return WKPreferencesGetFrameFlatteningEnabled(d->ref);
-    case PrivateBrowsingEnabled:
-        return WKPreferencesGetPrivateBrowsingEnabled(d->ref);
-    case DeveloperExtrasEnabled:
-        return WKPreferencesGetDeveloperExtrasEnabled(d->ref);
-    case DnsPrefetchEnabled:
-        return WKPreferencesGetDNSPrefetchingEnabled(d->ref);
-    default:
-        ASSERT_NOT_REACHED();
-        return false;
-    }
-}
-
-void QWKPreferences::setAttribute(WebAttribute attr, bool on)
-{
-    switch (attr) {
-    case AutoLoadImages:
-        WKPreferencesSetLoadsImagesAutomatically(d->ref, on);
-        break;
-    case JavascriptEnabled:
-        WKPreferencesSetJavaScriptEnabled(d->ref, on);
-        break;
-    case PluginsEnabled:
-        WKPreferencesSetPluginsEnabled(d->ref, on);
-        break;
-    case OfflineWebApplicationCacheEnabled:
-        WKPreferencesSetOfflineWebApplicationCacheEnabled(d->ref, on);
-        break;
-    case LocalStorageEnabled:
-        WKPreferencesSetLocalStorageEnabled(d->ref, on);
-        break;
-    case XSSAuditingEnabled:
-        WKPreferencesSetXSSAuditorEnabled(d->ref, on);
-        break;
-    case FrameFlatteningEnabled:
-        WKPreferencesSetFrameFlatteningEnabled(d->ref, on);
-        break;
-    case PrivateBrowsingEnabled:
-        WKPreferencesSetPrivateBrowsingEnabled(d->ref, on);
-        break;
-    case DeveloperExtrasEnabled:
-        WKPreferencesSetDeveloperExtrasEnabled(d->ref, on);
-        break;
-    case DnsPrefetchEnabled:
-        WKPreferencesSetDNSPrefetchingEnabled(d->ref, on);
-        break;
-    default:
-        ASSERT_NOT_REACHED();
-    }
-}
-
-void QWKPreferences::setFontSize(FontSize type, int size)
-{
-    switch (type) {
-    case MinimumFontSize:
-         WKPreferencesSetMinimumFontSize(d->ref, size);
-         break;
-    case DefaultFontSize:
-         WKPreferencesSetDefaultFontSize(d->ref, size);
-         break;
-    case DefaultFixedFontSize:
-         WKPreferencesSetDefaultFixedFontSize(d->ref, size);
-         break;
-    default:
-        ASSERT_NOT_REACHED();
-    }
-}
-
-int QWKPreferences::fontSize(FontSize type) const
-{
-    switch (type) {
-    case MinimumFontSize:
-         return WKPreferencesGetMinimumFontSize(d->ref);
-    case DefaultFontSize:
-         return WKPreferencesGetDefaultFontSize(d->ref);
-    case DefaultFixedFontSize:
-         return WKPreferencesGetDefaultFixedFontSize(d->ref);
-    default:
-        ASSERT_NOT_REACHED();
-        return false;
-    }
-}
-
diff --git a/Source/WebKit2/UIProcess/qt/qwkpreferences_p.h b/Source/WebKit2/UIProcess/qt/qwkpreferences_p.h
deleted file mode 100644 (file)
index 7fe2389..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-    Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library General Public
-    License as published by the Free Software Foundation; either
-    version 2 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Library General Public License for more details.
-
-    You should have received a copy of the GNU Library General Public License
-    along with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-    Boston, MA 02110-1301, USA.
-*/
-
-#include "WKPreferences.h"
-
-class QWKPreferencesPrivate {
-public:
-    static QWKPreferences* createPreferences(WKPageGroupRef);
-    static QWKPreferences* createSharedPreferences();
-
-    WKPreferencesRef ref;
-};
index 989828b..8942eee 100644 (file)
@@ -264,8 +264,6 @@ HEADERS += \
     UIProcess/qt/QtWebPageProxy.h \
     UIProcess/qt/qwkhistory.h \
     UIProcess/qt/qwkhistory_p.h \
-    UIProcess/qt/qwkpreferences.h \
-    UIProcess/qt/qwkpreferences_p.h \
     UIProcess/qt/SGUpdateQueue.h \
     UIProcess/qt/SGTileNode.h \
     UIProcess/qt/ViewInterface.h \
@@ -506,7 +504,6 @@ SOURCES += \
     UIProcess/qt/qweberror.cpp \
     UIProcess/qt/QtWebPageProxy.cpp \
     UIProcess/qt/qwkhistory.cpp \
-    UIProcess/qt/qwkpreferences.cpp \
     UIProcess/qt/SGUpdateQueue.cpp \
     UIProcess/qt/SGTileNode.cpp \
     UIProcess/qt/TiledDrawingAreaProxyQt.cpp \
index 98b6b82..971d0a7 100644 (file)
@@ -52,6 +52,7 @@ WEBKIT2_API_SOURCES = \
     $$SOURCE_DIR/WebKit2/UIProcess/API/qt/qtouchwebpage.cpp \
     $$SOURCE_DIR/WebKit2/UIProcess/API/qt/qtouchwebview.cpp \
     $$SOURCE_DIR/WebKit2/UIProcess/API/qt/qwebnavigationcontroller.cpp \
+    $$SOURCE_DIR/WebKit2/UIProcess/API/qt/qwebpreferences.cpp \
     $$SOURCE_DIR/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp \
     $$SOURCE_DIR/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.cpp \
     $$SOURCE_DIR/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.cpp \
@@ -129,6 +130,8 @@ WEBKIT2_API_HEADERS += \
     $$SOURCE_DIR/WebKit2/UIProcess/API/cpp/qt/WKURLQt.h \
     $$SOURCE_DIR/WebKit2/UIProcess/API/qt/qdesktopwebview.h \
     $$SOURCE_DIR/WebKit2/UIProcess/API/qt/qdesktopwebview_p.h \
+    $$SOURCE_DIR/WebKit2/UIProcess/API/qt/qwebpreferences.h \
+    $$SOURCE_DIR/WebKit2/UIProcess/API/qt/qwebpreferences_p.h \
     $$SOURCE_DIR/WebKit2/UIProcess/API/qt/qtouchwebpage.h \
     $$SOURCE_DIR/WebKit2/UIProcess/API/qt/qtouchwebpage_p.h \
     $$SOURCE_DIR/WebKit2/UIProcess/API/qt/qtouchwebview.h \