[Qt] Move WebKit2 C++ APIs to private API and build QML extension plugin on top of...
authorvestbo@webkit.org <vestbo@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Nov 2011 12:27:55 +0000 (12:27 +0000)
committervestbo@webkit.org <vestbo@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Nov 2011 12:27:55 +0000 (12:27 +0000)
A new extension object has been added to QQuickWebView (the same approach should be used
for other API classes that need experimental APIs). The QML extension mechanism is then
built on top of the experimental object.

https://bugs.webkit.org/show_bug.cgi?id=72522

Reviewed by Simon Hausmann.

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

46 files changed:
ChangeLog
Source/QtWebKit.pro
Source/WebKit/qt/ChangeLog
Source/WebKit/qt/declarative/declarative.pro
Source/WebKit/qt/declarative/experimental/experimental.pri [moved from Source/WebKit/qt/declarative/private/private.pro with 87% similarity]
Source/WebKit/qt/declarative/experimental/plugin.cpp [moved from Source/WebKit/qt/declarative/private/plugin.cpp with 53% similarity]
Source/WebKit/qt/declarative/experimental/qmldir [moved from Source/WebKit/qt/declarative/private/qmldir with 100% similarity]
Source/WebKit/qt/declarative/plugin.cpp
Source/WebKit/qt/declarative/public.pri [new file with mode: 0644]
Source/WebKit2/ChangeLog
Source/WebKit2/Target.pri
Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp
Source/WebKit2/UIProcess/API/qt/qquickwebpage.h [deleted file]
Source/WebKit2/UIProcess/API/qt/qquickwebpage_p.h
Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h [moved from Source/WebKit2/UIProcess/API/qt/qquickwebviewprivateextension_p.h with 55% similarity]
Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
Source/WebKit2/UIProcess/API/qt/qquickwebview.h [deleted file]
Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h
Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/qt/qquickwebviewprivateextension.cpp [deleted file]
Source/WebKit2/UIProcess/API/qt/qwebdownloaditem.cpp
Source/WebKit2/UIProcess/API/qt/qwebdownloaditem.h [deleted file]
Source/WebKit2/UIProcess/API/qt/qwebdownloaditem_p.h
Source/WebKit2/UIProcess/API/qt/qwebdownloaditem_p_p.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/qt/qwebpreferences.cpp
Source/WebKit2/UIProcess/API/qt/qwebpreferences.h [deleted file]
Source/WebKit2/UIProcess/API/qt/qwebpreferences_p.h
Source/WebKit2/UIProcess/API/qt/qwebpreferences_p_p.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/qt/tests/qmltests/qmltests.pro
Source/WebKit2/UIProcess/API/qt/tests/qmltests/tst_qmltests.cpp
Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/qquickwebview.pro
Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp
Source/WebKit2/UIProcess/qt/QtDownloadManager.cpp
Source/WebKit2/UIProcess/qt/QtViewInterface.cpp
Source/WebKit2/UIProcess/qt/QtWebError.h
Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp
Source/api.pri
Tools/ChangeLog
Tools/MiniBrowser/qt/BrowserWindow.cpp
Tools/MiniBrowser/qt/BrowserWindow.h
Tools/MiniBrowser/qt/UrlLoader.cpp
Tools/WebKitTestRunner/qt/PlatformWebViewQt.cpp
Tools/qmake/mkspecs/features/default_post.prf
Tools/qmake/mkspecs/features/default_pre.prf
Tools/qmake/mkspecs/features/qtwebkit-private.prf [new file with mode: 0644]
Tools/qmake/mkspecs/features/qtwebkit.prf

index 933a56f..f25acc3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2011-11-17  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
+
+        [Qt] Move WebKit2 C++ APIs to private API and build QML extension plugin on top of that
+
+        A new extension object has been added to QQuickWebView (the same approach should be used
+        for other API classes that need experimental APIs). The QML extension mechanism is then
+        built on top of the experimental object.
+
+        https://bugs.webkit.org/show_bug.cgi?id=72522
+
+        Reviewed by Simon Hausmann.
+
+        * Source/QtWebKit.pro:
+        * Source/api.pri:
+
 2011-11-11  Adrienne Walker  <enne@google.com>
 
         [chromium] Expose mock scrollbars to window.internals
index ed00ddb..8b27cae 100644 (file)
@@ -17,12 +17,9 @@ SUBDIRS += api
 
 include(WebKit/qt/docs/docs.pri)
 
-SUBDIRS += WebKit/qt/declarative
-haveQt(5) {
-    !no_webkit2 {
-        SUBDIRS += WebKit/qt/declarative/private
-    }
-}
+declarative.file = WebKit/qt/declarative/declarative.pro
+declarative.makefile = Makefile.declarative
+SUBDIRS += declarative
 
 tests.file = tests.pri
 SUBDIRS += tests
index 3853341..0377223 100644 (file)
@@ -1,3 +1,24 @@
+2011-11-17  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
+
+        [Qt] Move WebKit2 C++ APIs to private API and build QML extension plugin on top of that
+
+        A new extension object has been added to QQuickWebView (the same approach should be used
+        for other API classes that need experimental APIs). The QML extension mechanism is then
+        built on top of the experimental object.
+
+        https://bugs.webkit.org/show_bug.cgi?id=72522
+
+        Reviewed by Simon Hausmann.
+
+        * declarative/declarative.pro:
+        * declarative/experimental/experimental.pri: Renamed from Source/WebKit/qt/declarative/private/private.pro.
+        * declarative/experimental/plugin.cpp: Renamed from Source/WebKit/qt/declarative/private/plugin.cpp.
+        (QQuickWebViewExperimentalExtension::QQuickWebViewExperimentalExtension):
+        (QQuickWebViewExperimentalExtension::experimental):
+        * declarative/experimental/qmldir: Renamed from Source/WebKit/qt/declarative/private/qmldir.
+        * declarative/plugin.cpp:
+        * declarative/public.pri: Copied from Source/WebKit/qt/declarative/declarative.pro.
+
 2011-11-16  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r100448.
index f81719e..7379283 100644 (file)
@@ -1,58 +1,18 @@
 # -------------------------------------------------------------------
-# Project file for the QtWebKit QML plugin
+# Main project file for the Qt Quick (QML) plugin
 #
 # See 'Tools/qmake/README' for an overview of the build system
 # -------------------------------------------------------------------
 
-TEMPLATE = lib
-TARGET  = qmlwebkitplugin
+TEMPLATE = subdirs
+CONFIG += ordered
 
-TARGET.module_name = QtWebKit
+public_api.file = public.pri
+public_api.makefile = Makefile.declarative.public
+SUBDIRS += public_api
 
-CONFIG += qt plugin
-
-win32|mac:!wince*:!win32-msvc:!macx-xcode:CONFIG += debug_and_release
-
-QMLDIRFILE = $${_PRO_FILE_PWD_}/qmldir
-copy2build.input = QMLDIRFILE
-copy2build.output = $${ROOT_BUILD_DIR}/imports/$${TARGET.module_name}/qmldir
-!contains(TEMPLATE_PREFIX, vc):copy2build.variable_out = PRE_TARGETDEPS
-copy2build.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
-copy2build.name = COPY ${QMAKE_FILE_IN}
-copy2build.CONFIG += no_link
-QMAKE_EXTRA_COMPILERS += copy2build
-
-TARGET = $$qtLibraryTarget($$TARGET)
-contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols
-
-wince*:LIBS += $$QMAKE_LIBS_GUI
-
-CONFIG += qtwebkit
-
-QT += declarative
-haveQt(5): QT += widgets
-
-contains(QT_CONFIG, qtquick1): {
-    QT += qtquick1
-}
-
-DESTDIR = $${ROOT_BUILD_DIR}/imports/$${TARGET.module_name}
-
-CONFIG += rpath
-RPATHDIR_RELATIVE_TO_DESTDIR = ../../lib
-
-SOURCES += qdeclarativewebview.cpp plugin.cpp
-HEADERS += qdeclarativewebview_p.h
-
-!no_webkit2: {
-    DEFINES += HAVE_WEBKIT2
-    QT += network
+haveQt(5):!no_webkit2 {
+    experimental_api.file = experimental/experimental.pri
+    experimental_api.makefile = Makefile.declarative.experimental
+    SUBDIRS += experimental_api
 }
-
-target.path = $$[QT_INSTALL_IMPORTS]/$${TARGET.module_name}
-
-
-qmldir.files += $$PWD/qmldir
-qmldir.path +=  $$[QT_INSTALL_IMPORTS]/$${TARGET.module_name}
-
-INSTALLS += target qmldir
@@ -1,13 +1,13 @@
 # -------------------------------------------------------------------
-# Project file for the QtWebKit QML private plugin
+# Project file for the Qt Quick (QML) experimental API plugin
 #
 # See 'Tools/qmake/README' for an overview of the build system
 # -------------------------------------------------------------------
 
 TEMPLATE = lib
-TARGET  = qmlwebkitprivateplugin
+TARGET  = qmlwebkitexperimentalplugin
 
-TARGET.module_name = QtWebKit/private
+TARGET.module_name = QtWebKit/experimental
 
 CONFIG += qt plugin
 
@@ -27,10 +27,7 @@ contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols
 
 wince*:LIBS += $$QMAKE_LIBS_GUI
 
-load(javascriptcore)
-load(webcore)
-load(webkit2)
-CONFIG += qtwebkit
+CONFIG += qtwebkit qtwebkit-private
 
 QT += declarative widgets network
 
@@ -52,3 +49,4 @@ qmldir.path +=  $$[QT_INSTALL_IMPORTS]/$${TARGET.module_name}
 
 INSTALLS += target qmldir
 
+
     Boston, MA 02110-1301, USA.
 */
 
-#include "config.h"
-
-#include "qquickwebpage.h"
-#include "qquickwebview.h"
+#include "qquickwebpage_p.h"
 #include "qquickwebview_p.h"
-#include "qquickwebviewprivateextension_p.h"
 
 #include <QtDeclarative/qdeclarative.h>
 #include <QtDeclarative/qdeclarativeextensionplugin.h>
 
 QT_BEGIN_NAMESPACE
 
-class WebKitQmlPluginPrivate : public QDeclarativeExtensionPlugin {
+class QQuickWebViewExperimentalExtension : public QObject {
+    Q_OBJECT
+    Q_PROPERTY(QQuickWebViewExperimental* experimental READ experimental CONSTANT FINAL)
+public:
+    QQuickWebViewExperimentalExtension(QObject *parent = 0) : QObject(parent) { }
+    QQuickWebViewExperimental* experimental() { return static_cast<QQuickWebView*>(parent())->experimental(); }
+};
+
+class WebKitQmlExperimentalExtensionPlugin: public QDeclarativeExtensionPlugin {
     Q_OBJECT
 public:
     virtual void registerTypes(const char* uri)
     {
-        Q_ASSERT(QLatin1String(uri) == QLatin1String("QtWebKit.private"));
-        qmlRegisterExtendedType<QQuickWebView, QQuickWebViewPrivateExtension>(uri, 3, 0, "WebView");
-        qmlRegisterUncreatableType<QQuickWebViewPrivate>(uri, 3, 0, "WebViewPrivate", QObject::tr("Cannot create separate instance of WebViewPrivate"));
+        Q_ASSERT(QLatin1String(uri) == QLatin1String("QtWebKit.experimental"));
+
+        qmlRegisterExtendedType<QQuickWebView, QQuickWebViewExperimentalExtension>(uri, 3, 0, "WebView");
+        qmlRegisterUncreatableType<QQuickWebViewExperimental>(uri, 3, 0, "QQuickWebViewExperimental",
+            QObject::tr("Cannot create separate instance of QQuickWebViewExperimental"));
     }
 };
 
@@ -44,4 +50,4 @@ QT_END_NAMESPACE
 
 #include "plugin.moc"
 
-Q_EXPORT_PLUGIN2(qmlwebkitpluginprivate, QT_PREPEND_NAMESPACE(WebKitQmlPluginPrivate));
+Q_EXPORT_PLUGIN2(qmlwebkitpluginexperimental, QT_PREPEND_NAMESPACE(WebKitQmlExperimentalExtensionPlugin));
index 379b979..91634ee 100644 (file)
 #include <QtDeclarative/qdeclarativeextensionplugin.h>
 
 #if defined(HAVE_WEBKIT2)
-#include "qquickwebpage.h"
-#include "qquickwebview.h"
-#include "qwebdownloaditem.h"
-#include "qwebpreferences.h"
+#include "qquickwebpage_p.h"
+#include "qquickwebview_p.h"
+#include "qwebdownloaditem_p.h"
+#include "qwebpreferences_p.h"
 
 #include <QtNetwork/qnetworkreply.h>
 #endif
diff --git a/Source/WebKit/qt/declarative/public.pri b/Source/WebKit/qt/declarative/public.pri
new file mode 100644 (file)
index 0000000..b331339
--- /dev/null
@@ -0,0 +1,58 @@
+# -------------------------------------------------------------------
+# Project file for the QtWebKit QML plugin
+#
+# See 'Tools/qmake/README' for an overview of the build system
+# -------------------------------------------------------------------
+
+TEMPLATE = lib
+TARGET  = qmlwebkitplugin
+
+TARGET.module_name = QtWebKit
+
+CONFIG += qt plugin
+
+win32|mac:!wince*:!win32-msvc:!macx-xcode:CONFIG += debug_and_release
+
+QMLDIRFILE = $${_PRO_FILE_PWD_}/qmldir
+copy2build.input = QMLDIRFILE
+copy2build.output = $${ROOT_BUILD_DIR}/imports/$${TARGET.module_name}/qmldir
+!contains(TEMPLATE_PREFIX, vc):copy2build.variable_out = PRE_TARGETDEPS
+copy2build.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
+copy2build.name = COPY ${QMAKE_FILE_IN}
+copy2build.CONFIG += no_link
+QMAKE_EXTRA_COMPILERS += copy2build
+
+TARGET = $$qtLibraryTarget($$TARGET)
+contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols
+
+wince*:LIBS += $$QMAKE_LIBS_GUI
+
+CONFIG += qtwebkit qtwebkit-private
+
+QT += declarative
+haveQt(5): QT += widgets
+
+contains(QT_CONFIG, qtquick1): {
+    QT += qtquick1
+}
+
+DESTDIR = $${ROOT_BUILD_DIR}/imports/$${TARGET.module_name}
+
+CONFIG += rpath
+RPATHDIR_RELATIVE_TO_DESTDIR = ../../lib
+
+SOURCES += qdeclarativewebview.cpp plugin.cpp
+HEADERS += qdeclarativewebview_p.h
+
+!no_webkit2: {
+    DEFINES += HAVE_WEBKIT2
+    QT += network
+}
+
+target.path = $$[QT_INSTALL_IMPORTS]/$${TARGET.module_name}
+
+
+qmldir.files += $$PWD/qmldir
+qmldir.path +=  $$[QT_INSTALL_IMPORTS]/$${TARGET.module_name}
+
+INSTALLS += target qmldir
index a9b6365..60973f1 100644 (file)
@@ -1,3 +1,48 @@
+2011-11-17  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
+
+        [Qt] Move WebKit2 C++ APIs to private API and build QML extension plugin on top of that
+
+        A new extension object has been added to QQuickWebView (the same approach should be used
+        for other API classes that need experimental APIs). The QML extension mechanism is then
+        built on top of the experimental object.
+
+        https://bugs.webkit.org/show_bug.cgi?id=72522
+
+        Reviewed by Simon Hausmann.
+
+        * Target.pri:
+        * UIProcess/API/qt/qquickwebpage.cpp:
+        * UIProcess/API/qt/qquickwebpage.h: Removed.
+        * UIProcess/API/qt/qquickwebpage_p.h:
+        * UIProcess/API/qt/qquickwebpage_p_p.h: Renamed from Source/WebKit2/UIProcess/API/qt/qquickwebviewprivateextension_p.h.
+        * UIProcess/API/qt/qquickwebview.cpp:
+        (QQuickWebViewExperimental::QQuickWebViewExperimental):
+        (QQuickWebViewExperimental::~QQuickWebViewExperimental):
+        (QQuickWebViewExperimental::setUseTraditionalDesktopBehaviour):
+        (QQuickWebView::QQuickWebView):
+        (QQuickWebView::experimental):
+        * UIProcess/API/qt/qquickwebview.h: Removed.
+        * UIProcess/API/qt/qquickwebview_p.h:
+        * UIProcess/API/qt/qquickwebview_p_p.h: Copied from Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h.
+        * UIProcess/API/qt/qquickwebviewprivateextension.cpp: Removed.
+        * UIProcess/API/qt/qwebdownloaditem.cpp:
+        * UIProcess/API/qt/qwebdownloaditem.h: Removed.
+        * UIProcess/API/qt/qwebdownloaditem_p.h:
+        * UIProcess/API/qt/qwebdownloaditem_p_p.h: Copied from Source/WebKit2/UIProcess/API/qt/qwebdownloaditem_p.h.
+        (QWebDownloadItemPrivate::didReceiveResponse):
+        * UIProcess/API/qt/qwebpreferences.cpp:
+        * UIProcess/API/qt/qwebpreferences.h: Removed.
+        * UIProcess/API/qt/qwebpreferences_p.h:
+        * UIProcess/API/qt/tests/qmltests/qmltests.pro:
+        * UIProcess/API/qt/tests/qmltests/tst_qmltests.cpp:
+        (DesktopWebView::DesktopWebView):
+        * UIProcess/API/qt/tests/qquickwebview/qquickwebview.pro:
+        * UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp:
+        * UIProcess/qt/QtDownloadManager.cpp:
+        * UIProcess/qt/QtViewInterface.cpp:
+        * UIProcess/qt/QtWebError.h:
+        * UIProcess/qt/QtWebPageProxy.cpp:
+
 2011-11-17  Kenneth Rohde Christiansen  <kenneth@webkit.org>
 
         Unreviewed build fix.
index d378c54..d4a7405 100644 (file)
@@ -242,15 +242,14 @@ HEADERS += \
     UIProcess/API/cpp/WKRetainPtr.h \
     UIProcess/API/cpp/qt/WKStringQt.h \
     UIProcess/API/cpp/qt/WKURLQt.h \
-    UIProcess/API/qt/qwebpreferences.h \
     UIProcess/API/qt/qwebpreferences_p.h \
-    UIProcess/API/qt/qwebdownloaditem.h \
+    UIProcess/API/qt/qwebpreferences_p_p.h \
     UIProcess/API/qt/qwebdownloaditem_p.h \
-    UIProcess/API/qt/qquickwebpage.h \
+    UIProcess/API/qt/qwebdownloaditem_p_p.h \
     UIProcess/API/qt/qquickwebpage_p.h \
-    UIProcess/API/qt/qquickwebview.h \
+    UIProcess/API/qt/qquickwebpage_p_p.h \
     UIProcess/API/qt/qquickwebview_p.h \
-    UIProcess/API/qt/qquickwebviewprivateextension_p.h \
+    UIProcess/API/qt/qquickwebview_p_p.h \
     UIProcess/Authentication/AuthenticationChallengeProxy.h \
     UIProcess/Authentication/AuthenticationDecisionListener.h \
     UIProcess/Authentication/WebCredential.h \
@@ -553,7 +552,6 @@ SOURCES += \
     UIProcess/API/qt/qquickwebpage.cpp \
     UIProcess/API/qt/qquickwebview.cpp \
     UIProcess/API/qt/qwebpreferences.cpp \
-    UIProcess/API/qt/qquickwebviewprivateextension.cpp \
     UIProcess/Authentication/AuthenticationChallengeProxy.cpp \
     UIProcess/Authentication/AuthenticationDecisionListener.cpp \
     UIProcess/Authentication/WebCredential.cpp \
index a12278f..ef1347e 100644 (file)
  */
 
 #include "config.h"
-#include "qquickwebpage.h"
+#include "qquickwebpage_p.h"
 
 #include "QtWebPageProxy.h"
 #include "TransformationMatrix.h"
-#include "qquickwebpage_p.h"
-#include "qquickwebview.h"
+#include "qquickwebpage_p_p.h"
+#include "qquickwebview_p.h"
 #include <QtCore/QUrl>
 #include <QtDeclarative/QQuickCanvas>
 #include <QtDeclarative/QSGEngine>
@@ -243,4 +243,4 @@ void QQuickWebPagePrivate::_q_onSceneGraphInitialized()
     QObject::connect(engine, SIGNAL(afterRendering()), q, SLOT(_q_onAfterSceneRender()), Qt::DirectConnection);
 }
 
-#include "moc_qquickwebpage.cpp"
+#include "moc_qquickwebpage_p.cpp"
diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebpage.h b/Source/WebKit2/UIProcess/API/qt/qquickwebpage.h
deleted file mode 100644 (file)
index 38b9cd4..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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 program 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 program; 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 qquickwebpage_h
-#define qquickwebpage_h
-
-#include "qwebkitglobal.h"
-
-#include <QtCore/QSharedPointer>
-#include <QtDeclarative/QQuickItem>
-
-class QQuickWebView;
-class QQuickWebPagePrivate;
-class QWebPreferences;
-
-namespace WebKit {
-class QtViewInterface;
-}
-
-class QWEBKIT_EXPORT QQuickWebPage : public QQuickItem {
-    Q_OBJECT
-public:
-    QQuickWebPage(QQuickItem* parent = 0);
-    virtual ~QQuickWebPage();
-
-protected:
-    virtual void keyPressEvent(QKeyEvent*);
-    virtual void keyReleaseEvent(QKeyEvent*);
-    virtual void inputMethodEvent(QInputMethodEvent*);
-    virtual void focusInEvent(QFocusEvent*);
-    virtual void focusOutEvent(QFocusEvent*);
-    virtual void mousePressEvent(QMouseEvent*);
-    virtual void mouseMoveEvent(QMouseEvent*);
-    virtual void mouseReleaseEvent(QMouseEvent *);
-    virtual void mouseDoubleClickEvent(QMouseEvent*);
-    virtual void wheelEvent(QWheelEvent*);
-    virtual void hoverEnterEvent(QHoverEvent*);
-    virtual void hoverMoveEvent(QHoverEvent*);
-    virtual void hoverLeaveEvent(QHoverEvent*);
-    virtual void dragMoveEvent(QDragMoveEvent*);
-    virtual void dragEnterEvent(QDragEnterEvent*);
-    virtual void dragLeaveEvent(QDragLeaveEvent*);
-    virtual void dropEvent(QDropEvent*);
-    virtual void touchEvent(QTouchEvent*);
-    virtual bool event(QEvent*);
-    virtual void geometryChanged(const QRectF&, const QRectF&);
-    virtual void itemChange(ItemChange, const ItemChangeData&);
-
-private:
-    Q_PRIVATE_SLOT(d, void _q_onAfterSceneRender());
-    Q_PRIVATE_SLOT(d, void _q_onSceneGraphInitialized());
-
-    QQuickWebPagePrivate* d;
-    friend class QQuickWebViewPrivate;
-    friend class WebKit::QtViewInterface;
-};
-
-QML_DECLARE_TYPE(QQuickWebPage)
-
-#endif /* qquickwebpage_h */
index 18d818d..bc9cb28 100644 (file)
 #ifndef qquickwebpage_p_h
 #define qquickwebpage_p_h
 
-#include "QtSGUpdateQueue.h"
-#include "QtViewInterface.h"
-#include "QtWebPageProxy.h"
-#include "qquickwebpage.h"
+#include "qwebkitglobal.h"
 
-QT_BEGIN_NAMESPACE
-class QRectF;
-class QSGNode;
-class QString;
-QT_END_NAMESPACE
+#include <QtCore/QSharedPointer>
+#include <QtDeclarative/QQuickItem>
 
-class QQuickWebPage;
+class QQuickWebView;
+class QQuickWebPagePrivate;
+class QWebPreferences;
 
-class QQuickWebPagePrivate {
-public:
-    QQuickWebPagePrivate(QQuickWebPage* view);
+namespace WebKit {
+class QtViewInterface;
+}
 
-    void setPageProxy(QtWebPageProxy*);
+class QWEBKIT_EXPORT QQuickWebPage : public QQuickItem {
+    Q_OBJECT
+public:
+    QQuickWebPage(QQuickItem* parent = 0);
+    virtual ~QQuickWebPage();
 
-    void initializeSceneGraphConnections();
+protected:
+    virtual void keyPressEvent(QKeyEvent*);
+    virtual void keyReleaseEvent(QKeyEvent*);
+    virtual void inputMethodEvent(QInputMethodEvent*);
+    virtual void focusInEvent(QFocusEvent*);
+    virtual void focusOutEvent(QFocusEvent*);
+    virtual void mousePressEvent(QMouseEvent*);
+    virtual void mouseMoveEvent(QMouseEvent*);
+    virtual void mouseReleaseEvent(QMouseEvent *);
+    virtual void mouseDoubleClickEvent(QMouseEvent*);
+    virtual void wheelEvent(QWheelEvent*);
+    virtual void hoverEnterEvent(QHoverEvent*);
+    virtual void hoverMoveEvent(QHoverEvent*);
+    virtual void hoverLeaveEvent(QHoverEvent*);
+    virtual void dragMoveEvent(QDragMoveEvent*);
+    virtual void dragEnterEvent(QDragEnterEvent*);
+    virtual void dragLeaveEvent(QDragLeaveEvent*);
+    virtual void dropEvent(QDropEvent*);
+    virtual void touchEvent(QTouchEvent*);
+    virtual bool event(QEvent*);
+    virtual void geometryChanged(const QRectF&, const QRectF&);
+    virtual void itemChange(ItemChange, const ItemChangeData&);
 
-    void _q_onAfterSceneRender();
-    void _q_onSceneGraphInitialized();
-    void paintToCurrentGLContext();
+private:
+    Q_PRIVATE_SLOT(d, void _q_onAfterSceneRender());
+    Q_PRIVATE_SLOT(d, void _q_onSceneGraphInitialized());
 
-    QQuickWebPage* const q;
-    QtWebPageProxy* pageProxy;
-    WebKit::QtSGUpdateQueue sgUpdateQueue;
-    bool paintingIsInitialized;
+    QQuickWebPagePrivate* d;
+    friend class QQuickWebViewPrivate;
+    friend class WebKit::QtViewInterface;
 };
 
-#endif /* qquickwebpage_p_h */
+QML_DECLARE_TYPE(QQuickWebPage)
+
+#endif // qquickwebpage_p_h
  *
  */
 
-#ifndef qquickwebviewprivateextension_p_h
-#define qquickwebviewprivateextension_p_h
+#ifndef qquickwebpage_p_p_h
+#define qquickwebpage_p_p_h
 
-#include "qwebkitglobal.h"
+#include "QtSGUpdateQueue.h"
+#include "QtViewInterface.h"
+#include "QtWebPageProxy.h"
+#include "qquickwebpage_p.h"
 
-#include <QObject>
+QT_BEGIN_NAMESPACE
+class QRectF;
+class QSGNode;
+class QString;
+QT_END_NAMESPACE
 
-class QQuickWebViewPrivate;
+class QQuickWebPage;
 
-class QWEBKIT_EXPORT QQuickWebViewPrivateExtension : public QObject {
-    Q_OBJECT
-    Q_PROPERTY(QQuickWebViewPrivate* privateObject READ viewPrivate CONSTANT FINAL)
+class QQuickWebPagePrivate {
 public:
-    QQuickWebViewPrivateExtension(QObject *parent = 0);
-    QQuickWebViewPrivate* viewPrivate();
+    QQuickWebPagePrivate(QQuickWebPage* view);
+
+    void setPageProxy(QtWebPageProxy*);
+
+    void initializeSceneGraphConnections();
+
+    void _q_onAfterSceneRender();
+    void _q_onSceneGraphInitialized();
+    void paintToCurrentGLContext();
+
+    QQuickWebPage* const q;
+    QtWebPageProxy* pageProxy;
+    WebKit::QtSGUpdateQueue sgUpdateQueue;
+    bool paintingIsInitialized;
 };
 
-#endif // qquickwebviewprivateextension_p_h
+#endif // qquickwebpage_p_p_h
index 3ec405e..562e794 100644 (file)
@@ -19,7 +19,7 @@
  */
 
 #include "config.h"
-#include "qquickwebview.h"
+#include "qquickwebview_p.h"
 
 #include "QtViewInterface.h"
 #include "QtWebPageProxy.h"
@@ -27,9 +27,9 @@
 #include "WebPageGroup.h"
 #include "WebPreferences.h"
 
-#include "qquickwebpage_p.h"
-#include "qquickwebview_p.h"
-#include "qwebpreferences_p.h"
+#include "qquickwebpage_p_p.h"
+#include "qquickwebview_p_p.h"
+#include "qwebpreferences_p_p.h"
 
 #include <QtDeclarative/QQuickCanvas>
 #include <QtWidgets/QFileDialog>
@@ -373,9 +373,27 @@ void QQuickWebViewPrivate::setPageProxy(QtWebPageProxy* pageProxy)
     QObject::connect(pageProxy, SIGNAL(receivedMessageFromNavigatorQtObject(QVariantMap)), q, SIGNAL(messageReceived(QVariantMap)));
 }
 
+QQuickWebViewExperimental::QQuickWebViewExperimental(QQuickWebView *webView)
+    : QObject(webView)
+    , q_ptr(webView)
+    , d_ptr(webView->d_ptr.data())
+{
+}
+
+QQuickWebViewExperimental::~QQuickWebViewExperimental()
+{
+}
+
+void QQuickWebViewExperimental::setUseTraditionalDesktopBehaviour(bool enable)
+{
+    Q_D(QQuickWebView);
+    d->setUseTraditionalDesktopBehaviour(enable);
+}
+
 QQuickWebView::QQuickWebView(QQuickItem* parent)
     : QQuickItem(parent)
     , d_ptr(new QQuickWebViewPrivate)
+    , m_experimental(new QQuickWebViewExperimental(this))
 {
     Q_D(QQuickWebView);
     d->initialize(this);
@@ -385,6 +403,7 @@ QQuickWebView::QQuickWebView(QQuickItem* parent)
 QQuickWebView::QQuickWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef, QQuickItem* parent)
     : QQuickItem(parent)
     , d_ptr(new QQuickWebViewPrivate)
+    , m_experimental(new QQuickWebViewExperimental(this))
 {
     Q_D(QQuickWebView);
     d->initialize(this, contextRef, pageGroupRef);
@@ -486,6 +505,11 @@ QWebPreferences* QQuickWebView::preferences() const
     return d->pageProxy->preferences();
 }
 
+QQuickWebViewExperimental* QQuickWebView::experimental() const
+{
+    return m_experimental;
+}
+
 void QQuickWebView::geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry)
 {
     Q_D(QQuickWebView);
@@ -511,5 +535,4 @@ WKPageRef QQuickWebView::pageRef() const
     return d->pageProxy->pageRef();
 }
 
-#include "moc_qquickwebview.cpp"
 #include "moc_qquickwebview_p.cpp"
diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview.h b/Source/WebKit2/UIProcess/API/qt/qquickwebview.h
deleted file mode 100644 (file)
index f8ba817..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * 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 program 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 program; 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 qquickwebview_h
-#define qquickwebview_h
-
-#include "qwebkitglobal.h"
-#include <QtDeclarative/qquickitem.h>
-
-class QQuickWebPage;
-class QQuickWebViewPrivate;
-class QWebDownloadItem;
-class QWebPreferences;
-
-namespace WebKit {
-class QtViewInterface;
-}
-
-namespace WTR {
-class PlatformWebView;
-}
-
-typedef const struct OpaqueWKContext* WKContextRef;
-typedef const struct OpaqueWKPageGroup* WKPageGroupRef;
-typedef const struct OpaqueWKPage* WKPageRef;
-
-QT_BEGIN_NAMESPACE
-class QPainter;
-class QUrl;
-QT_END_NAMESPACE
-
-class QWEBKIT_EXPORT QQuickWebView : public QQuickItem {
-    Q_OBJECT
-    Q_PROPERTY(QString title READ title NOTIFY titleChanged)
-    Q_PROPERTY(QUrl url READ url NOTIFY urlChanged)
-    Q_PROPERTY(int loadProgress READ loadProgress NOTIFY loadProgressChanged)
-    Q_PROPERTY(bool canGoBack READ canGoBack NOTIFY navigationStateChanged FINAL)
-    Q_PROPERTY(bool canGoForward READ canGoForward NOTIFY navigationStateChanged FINAL)
-    Q_PROPERTY(bool canStop READ canStop NOTIFY navigationStateChanged FINAL)
-    Q_PROPERTY(bool canReload READ canReload NOTIFY navigationStateChanged FINAL)
-    Q_PROPERTY(QWebPreferences* preferences READ preferences CONSTANT FINAL)
-    Q_PROPERTY(QQuickWebPage* page READ page CONSTANT FINAL)
-    Q_ENUMS(NavigationPolicy)
-    Q_ENUMS(ErrorType)
-public:
-    enum NavigationPolicy {
-        UsePolicy,
-        DownloadPolicy,
-        IgnorePolicy
-    };
-
-    enum ErrorType {
-        EngineError,
-        NetworkError,
-        HttpError,
-        DownloadError
-    };
-    QQuickWebView(QQuickItem* parent = 0);
-    virtual ~QQuickWebView();
-
-    QUrl url() const;
-    QString title() const;
-    int loadProgress() const;
-
-    bool canGoBack() const;
-    bool canGoForward() const;
-    bool canStop() const;
-    bool canReload() const;
-
-    QWebPreferences* preferences() const;
-    QQuickWebPage* page();
-
-public Q_SLOTS:
-    void load(const QUrl&);
-    void postMessage(const QString&);
-
-    void goBack();
-    void goForward();
-    void stop();
-    void reload();
-
-Q_SIGNALS:
-    void titleChanged(const QString& title);
-    void statusBarMessageChanged(const QString& message);
-    void loadStarted();
-    void loadSucceeded();
-    void loadFailed(QQuickWebView::ErrorType errorType, int errorCode, const QUrl& url);
-    void loadProgressChanged(int progress);
-    void urlChanged(const QUrl& url);
-    void messageReceived(const QVariantMap& message);
-    void downloadRequested(QWebDownloadItem* downloadItem);
-    void linkHovered(const QUrl& url, const QString& title);
-    void viewModeChanged();
-    void navigationStateChanged();
-
-protected:
-    virtual void geometryChanged(const QRectF&, const QRectF&);
-    virtual void touchEvent(QTouchEvent* event);
-
-private:
-    Q_DECLARE_PRIVATE(QQuickWebView)
-
-    QQuickWebView(WKContextRef, WKPageGroupRef, QQuickItem* parent = 0);
-    WKPageRef pageRef() const;
-
-    Q_PRIVATE_SLOT(d_func(), void _q_viewportUpdated());
-    Q_PRIVATE_SLOT(d_func(), void _q_viewportTrajectoryVectorChanged(const QPointF&));
-    Q_PRIVATE_SLOT(d_func(), void _q_onOpenPanelFilesSelected());
-    Q_PRIVATE_SLOT(d_func(), void _q_onOpenPanelFinished(int result));
-    Q_PRIVATE_SLOT(d_func(), void _q_onVisibleChanged());
-    // Hides QObject::d_ptr allowing us to use the convenience macros.
-    QScopedPointer<QQuickWebViewPrivate> d_ptr;
-
-    friend class QtWebPageProxy;
-    friend class WebKit::QtViewInterface;
-    friend class WTR::PlatformWebView;
-};
-
-QML_DECLARE_TYPE(QQuickWebView)
-
-#endif /* qquickwebview_h */
index b62ea56..d73faa6 100644 (file)
 #ifndef qquickwebview_p_h
 #define qquickwebview_p_h
 
-#include "QtPolicyInterface.h"
-#include "QtViewInterface.h"
-#include "QtViewportInteractionEngine.h"
-#include "QtWebPageProxy.h"
+#include "qwebkitglobal.h"
+#include <QtDeclarative/qquickitem.h>
 
-#include "qquickwebview.h"
+class QQuickWebPage;
+class QQuickWebViewPrivate;
+class QQuickWebViewExperimental;
+class QWebDownloadItem;
+class QWebPreferences;
 
-#include <QtCore/QObject>
-#include <QtCore/QScopedPointer>
-#include <wtf/OwnPtr.h>
+namespace WebKit {
+class QtViewInterface;
+}
 
-class QtWebPageProxy;
+namespace WTR {
+class PlatformWebView;
+}
+
+typedef const struct OpaqueWKContext* WKContextRef;
+typedef const struct OpaqueWKPageGroup* WKPageGroupRef;
+typedef const struct OpaqueWKPage* WKPageRef;
 
 QT_BEGIN_NAMESPACE
-class QFileDialog;
+class QPainter;
+class QUrl;
 QT_END_NAMESPACE
 
-class QWEBKIT_EXPORT QQuickWebViewPrivate : public QObject, public WebKit::QtPolicyInterface {
+class QWEBKIT_EXPORT QQuickWebView : public QQuickItem {
     Q_OBJECT
-    Q_DECLARE_PUBLIC(QQuickWebView)
+    Q_PROPERTY(QString title READ title NOTIFY titleChanged)
+    Q_PROPERTY(QUrl url READ url NOTIFY urlChanged)
+    Q_PROPERTY(int loadProgress READ loadProgress NOTIFY loadProgressChanged)
+    Q_PROPERTY(bool canGoBack READ canGoBack NOTIFY navigationStateChanged FINAL)
+    Q_PROPERTY(bool canGoForward READ canGoForward NOTIFY navigationStateChanged FINAL)
+    Q_PROPERTY(bool canStop READ canStop NOTIFY navigationStateChanged FINAL)
+    Q_PROPERTY(bool canReload READ canReload NOTIFY navigationStateChanged FINAL)
+    Q_PROPERTY(QWebPreferences* preferences READ preferences CONSTANT FINAL)
+    Q_PROPERTY(QQuickWebPage* page READ page CONSTANT FINAL)
+    Q_ENUMS(NavigationPolicy)
+    Q_ENUMS(ErrorType)
 public:
-    QQuickWebViewPrivate();
-    virtual ~QQuickWebViewPrivate() { }
-    void setPageProxy(QtWebPageProxy*);
-    void initialize(QQuickWebView* viewport, WKContextRef contextRef = 0, WKPageGroupRef pageGroupRef = 0);
-    void initializeTouch(QQuickWebView* viewport);
-    void initializeDesktop(QQuickWebView* viewport);
-    void enableMouseEvents();
-    void disableMouseEvents();
-
-    void loadDidCommit();
-
-    void didFinishFirstNonEmptyLayout();
-    void didChangeContentsSize(const QSize& newSize);
-    void didChangeViewportProperties(const WebCore::ViewportArguments& args);
-
-    void scrollPositionRequested(const QPoint& pos);
-    void updateViewportSize();
-    QtViewportInteractionEngine::Constraints computeViewportConstraints();
-
-    static QQuickWebViewPrivate* get(QQuickWebView* view)
-    {
-        return view->d_ptr.data();
-    }
-
-    void _q_viewportUpdated();
-    void _q_viewportTrajectoryVectorChanged(const QPointF&);
-    void _q_onOpenPanelFilesSelected();
-    void _q_onOpenPanelFinished(int result);
-    void _q_onVisibleChanged();
-
-    // QtPolicyInterface.
-    virtual QtPolicyInterface::PolicyAction navigationPolicyForURL(const QUrl&, Qt::MouseButton, Qt::KeyboardModifiers);
-
-    void chooseFiles(WKOpenPanelResultListenerRef, const QStringList& selectedFileNames, WebKit::QtViewInterface::FileChooserType);
-    void runJavaScriptAlert(const QString&);
-    bool runJavaScriptConfirm(const QString&);
-    QString runJavaScriptPrompt(const QString&, const QString& defaultValue, bool& ok);
-
-public slots:
-    void setUseTraditionalDesktopBehaviour(bool enable);
-
-private:
+    enum NavigationPolicy {
+        UsePolicy,
+        DownloadPolicy,
+        IgnorePolicy
+    };
 
-    // This class is responsible for collecting and applying all properties
-    // on the viewport item, when transitioning from page A to page B is finished.
-    // See more at https://trac.webkit.org/wiki/QtWebKitLayoutInteraction
-    class PostTransitionState {
-    public:
-        PostTransitionState(QQuickWebViewPrivate* parent)
-            : p(parent)
-        { }
-
-        void apply()
-        {
-            p->interactionEngine->reset();
-            p->interactionEngine->applyConstraints(p->computeViewportConstraints());
-
-            if (contentsSize.isValid()) {
-                p->pageView->setWidth(contentsSize.width());
-                p->pageView->setHeight(contentsSize.height());
-            }
-
-            contentsSize = QSize();
-        }
-
-        QQuickWebViewPrivate* p;
-        QSize contentsSize;
+    enum ErrorType {
+        EngineError,
+        NetworkError,
+        HttpError,
+        DownloadError
     };
+    QQuickWebView(QQuickItem* parent = 0);
+    virtual ~QQuickWebView();
+
+    QUrl url() const;
+    QString title() const;
+    int loadProgress() const;
+
+    bool canGoBack() const;
+    bool canGoForward() const;
+    bool canStop() const;
+    bool canReload() const;
+
+    QWebPreferences* preferences() const;
+    QQuickWebPage* page();
+
+    QQuickWebViewExperimental* experimental() const;
+
+public Q_SLOTS:
+    void load(const QUrl&);
+    void postMessage(const QString&);
+
+    void goBack();
+    void goForward();
+    void stop();
+    void reload();
+
+Q_SIGNALS:
+    void titleChanged(const QString& title);
+    void statusBarMessageChanged(const QString& message);
+    void loadStarted();
+    void loadSucceeded();
+    void loadFailed(QQuickWebView::ErrorType errorType, int errorCode, const QUrl& url);
+    void loadProgressChanged(int progress);
+    void urlChanged(const QUrl& url);
+    void messageReceived(const QVariantMap& message);
+    void downloadRequested(QWebDownloadItem* downloadItem);
+    void linkHovered(const QUrl& url, const QString& title);
+    void viewModeChanged();
+    void navigationStateChanged();
+
+protected:
+    virtual void geometryChanged(const QRectF&, const QRectF&);
+    virtual void touchEvent(QTouchEvent* event);
 
-    bool isTransitioningToNewPage() const { return transitioningToNewPage; }
+private:
+    Q_DECLARE_PRIVATE(QQuickWebView)
+
+    QQuickWebView(WKContextRef, WKPageGroupRef, QQuickItem* parent = 0);
+    WKPageRef pageRef() const;
+
+    Q_PRIVATE_SLOT(d_func(), void _q_viewportUpdated());
+    Q_PRIVATE_SLOT(d_func(), void _q_viewportTrajectoryVectorChanged(const QPointF&));
+    Q_PRIVATE_SLOT(d_func(), void _q_onOpenPanelFilesSelected());
+    Q_PRIVATE_SLOT(d_func(), void _q_onOpenPanelFinished(int result));
+    Q_PRIVATE_SLOT(d_func(), void _q_onVisibleChanged());
+    // Hides QObject::d_ptr allowing us to use the convenience macros.
+    QScopedPointer<QQuickWebViewPrivate> d_ptr;
+    QQuickWebViewExperimental* m_experimental;
+
+    friend class QtWebPageProxy;
+    friend class WebKit::QtViewInterface;
+    friend class WTR::PlatformWebView;
+    friend class QQuickWebViewExperimental;
+};
 
-    QScopedPointer<QQuickWebPage> pageView;
-    QScopedPointer<WebKit::QtViewInterface> viewInterface;
-    QScopedPointer<QtViewportInteractionEngine> interactionEngine;
+QML_DECLARE_TYPE(QQuickWebView)
 
-    QQuickWebView* q_ptr;
-    QScopedPointer<QtWebPageProxy> pageProxy;
+class QWEBKIT_EXPORT QQuickWebViewExperimental : public QObject {
+    Q_OBJECT
+public:
+    QQuickWebViewExperimental(QQuickWebView* webView);
+    virtual ~QQuickWebViewExperimental();
 
-    WebCore::ViewportArguments viewportArguments;
-    OwnPtr<PostTransitionState> postTransitionState;
-    bool transitioningToNewPage;
+    void setUseTraditionalDesktopBehaviour(bool enable);
+private:
+    QQuickWebView* q_ptr;
+    QQuickWebViewPrivate* d_ptr;
 
-    bool useTraditionalDesktopBehaviour;
-    QFileDialog* fileDialog;
-    WKOpenPanelResultListenerRef openPanelResultListener;
+    Q_DECLARE_PRIVATE(QQuickWebView)
+    Q_DECLARE_PUBLIC(QQuickWebView)
 };
 
-#endif /* qquickwebview_p_h */
+#endif // qquickwebview_p_h
diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h
new file mode 100644 (file)
index 0000000..7db16e7
--- /dev/null
@@ -0,0 +1,125 @@
+/*
+ * 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 program 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 program; 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 qquickwebview_p_p_h
+#define qquickwebview_p_p_h
+
+#include "QtPolicyInterface.h"
+#include "QtViewInterface.h"
+#include "QtViewportInteractionEngine.h"
+#include "QtWebPageProxy.h"
+
+#include "qquickwebview_p.h"
+
+#include <QtCore/QObject>
+#include <QtCore/QScopedPointer>
+#include <wtf/OwnPtr.h>
+
+class QtWebPageProxy;
+
+QT_BEGIN_NAMESPACE
+class QFileDialog;
+QT_END_NAMESPACE
+
+class QWEBKIT_EXPORT QQuickWebViewPrivate : public WebKit::QtPolicyInterface {
+
+    Q_DECLARE_PUBLIC(QQuickWebView)
+public:
+    QQuickWebViewPrivate();
+    virtual ~QQuickWebViewPrivate() { }
+    void setPageProxy(QtWebPageProxy*);
+    void initialize(QQuickWebView* viewport, WKContextRef contextRef = 0, WKPageGroupRef pageGroupRef = 0);
+    void initializeTouch(QQuickWebView* viewport);
+    void initializeDesktop(QQuickWebView* viewport);
+    void enableMouseEvents();
+    void disableMouseEvents();
+
+    void loadDidCommit();
+
+    void didFinishFirstNonEmptyLayout();
+    void didChangeContentsSize(const QSize& newSize);
+    void didChangeViewportProperties(const WebCore::ViewportArguments& args);
+
+    void scrollPositionRequested(const QPoint& pos);
+    void updateViewportSize();
+    QtViewportInteractionEngine::Constraints computeViewportConstraints();
+
+    void _q_viewportUpdated();
+    void _q_viewportTrajectoryVectorChanged(const QPointF&);
+    void _q_onOpenPanelFilesSelected();
+    void _q_onOpenPanelFinished(int result);
+    void _q_onVisibleChanged();
+
+    // QtPolicyInterface.
+    virtual QtPolicyInterface::PolicyAction navigationPolicyForURL(const QUrl&, Qt::MouseButton, Qt::KeyboardModifiers);
+
+    void chooseFiles(WKOpenPanelResultListenerRef, const QStringList& selectedFileNames, WebKit::QtViewInterface::FileChooserType);
+    void runJavaScriptAlert(const QString&);
+    bool runJavaScriptConfirm(const QString&);
+    QString runJavaScriptPrompt(const QString&, const QString& defaultValue, bool& ok);
+
+    void setUseTraditionalDesktopBehaviour(bool enable);
+
+private:
+    // This class is responsible for collecting and applying all properties
+    // on the viewport item, when transitioning from page A to page B is finished.
+    // See more at https://trac.webkit.org/wiki/QtWebKitLayoutInteraction
+    class PostTransitionState {
+    public:
+        PostTransitionState(QQuickWebViewPrivate* parent)
+            : p(parent)
+        { }
+
+        void apply()
+        {
+            p->interactionEngine->reset();
+            p->interactionEngine->applyConstraints(p->computeViewportConstraints());
+
+            if (contentsSize.isValid()) {
+                p->pageView->setWidth(contentsSize.width());
+                p->pageView->setHeight(contentsSize.height());
+            }
+
+            contentsSize = QSize();
+        }
+
+        QQuickWebViewPrivate* p;
+        QSize contentsSize;
+    };
+
+    bool isTransitioningToNewPage() const { return transitioningToNewPage; }
+
+    QScopedPointer<QQuickWebPage> pageView;
+    QScopedPointer<WebKit::QtViewInterface> viewInterface;
+    QScopedPointer<QtViewportInteractionEngine> interactionEngine;
+
+    QQuickWebView* q_ptr;
+    QScopedPointer<QtWebPageProxy> pageProxy;
+
+    WebCore::ViewportArguments viewportArguments;
+    OwnPtr<PostTransitionState> postTransitionState;
+    bool transitioningToNewPage;
+
+    bool useTraditionalDesktopBehaviour;
+    QFileDialog* fileDialog;
+    WKOpenPanelResultListenerRef openPanelResultListener;
+};
+
+#endif // qquickwebview_p_p_h
diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebviewprivateextension.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebviewprivateextension.cpp
deleted file mode 100644 (file)
index 7ac4395..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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 program 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 program; 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 "qquickwebviewprivateextension_p.h"
-
-#include "qquickwebpage.h"
-#include "qquickwebview.h"
-#include "qquickwebview_p.h"
-
-QQuickWebViewPrivateExtension::QQuickWebViewPrivateExtension(QObject* parent)
-    : QObject(parent)
-{
-}
-
-QQuickWebViewPrivate* QQuickWebViewPrivateExtension::viewPrivate()
-{
-    return QQuickWebViewPrivate::get(static_cast<QQuickWebView*>(parent()));
-}
index 6590b74..8547643 100644 (file)
  */
 
 #include "config.h"
-#include "qwebdownloaditem.h"
+#include "qwebdownloaditem_p.h"
 
 #include "DownloadProxy.h"
-#include "qwebdownloaditem_p.h"
+#include "qwebdownloaditem_p_p.h"
 
 QWebDownloadItemPrivate::QWebDownloadItemPrivate(QWebDownloadItem* qq)
     : q(qq)
diff --git a/Source/WebKit2/UIProcess/API/qt/qwebdownloaditem.h b/Source/WebKit2/UIProcess/API/qt/qwebdownloaditem.h
deleted file mode 100644 (file)
index b44c5b0..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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 program 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 program; 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 qwebdownloaditem_h
-#define qwebdownloaditem_h
-
-#include "qwebkitglobal.h"
-#include <QObject>
-#include <QUrl>
-
-class QWebDownloadItemPrivate;
-class QtWebError;
-
-QT_BEGIN_NAMESPACE
-class QString;
-QT_END_NAMESPACE
-
-namespace WebKit {
-class QtDownloadManager;
-}
-
-class QWEBKIT_EXPORT QWebDownloadItem : public QObject {
-    Q_OBJECT
-    Q_PROPERTY(quint64 expectedContentLength READ expectedContentLength CONSTANT FINAL)
-    Q_PROPERTY(QString destinationPath READ destinationPath WRITE setDestinationPath)
-    Q_PROPERTY(QString suggestedFilename READ suggestedFilename CONSTANT FINAL)
-    Q_PROPERTY(quint64 totalBytesReceived READ totalBytesReceived NOTIFY totalBytesReceivedChanged FINAL)
-    Q_PROPERTY(QUrl url READ url CONSTANT FINAL)
-    Q_ENUMS(DownloadError)
-public:
-    virtual ~QWebDownloadItem();
-
-    enum DownloadError {
-        Aborted = 0,
-        CannotWriteToFile,
-        CannotOpenFile,
-        DestinationAlreadyExists,
-        Cancelled,
-        CannotDetermineFilename,
-        NetworkFailure
-    };
-
-    QUrl url() const;
-    QString destinationPath() const;
-    QString suggestedFilename() const;
-    QString mimeType() const;
-    quint64 expectedContentLength() const;
-    quint64 totalBytesReceived() const;
-    void setDestinationPath(const QString& destination);
-
-public Q_SLOTS:
-    void start();
-    void cancel();
-
-Q_SIGNALS:
-    void destinationFileCreated(const QString& destinationPath);
-    void totalBytesReceivedChanged(quint64 bytesReceived);
-    void succeeded();
-    void failed(QWebDownloadItem::DownloadError error, const QUrl& url, const QString& description);
-
-private:
-    QWebDownloadItem(QObject* parent = 0);
-    QWebDownloadItemPrivate* d;
-
-    friend class WebKit::QtDownloadManager;
-    friend class QtWebPageProxy;
-};
-
-#endif /* qwebdownloaditem_h */
index bb8c252..e809236 100644 (file)
@@ -1,53 +1,86 @@
 /*
   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.
-*/
-
* 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 program 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 program; 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 qwebdownloaditem_p_h
 #define qwebdownloaditem_p_h
 
-#include "qwebdownloaditem.h"
+#include "qwebkitglobal.h"
+#include <QObject>
 #include <QUrl>
 
+class QWebDownloadItemPrivate;
+class QtWebError;
+
+QT_BEGIN_NAMESPACE
+class QString;
+QT_END_NAMESPACE
+
 namespace WebKit {
-class DownloadProxy;
+class QtDownloadManager;
 }
 
-class QWebDownloadItemPrivate : public QObject {
+class QWEBKIT_EXPORT QWebDownloadItem : public QObject {
     Q_OBJECT
+    Q_PROPERTY(quint64 expectedContentLength READ expectedContentLength CONSTANT FINAL)
+    Q_PROPERTY(QString destinationPath READ destinationPath WRITE setDestinationPath)
+    Q_PROPERTY(QString suggestedFilename READ suggestedFilename CONSTANT FINAL)
+    Q_PROPERTY(quint64 totalBytesReceived READ totalBytesReceived NOTIFY totalBytesReceivedChanged FINAL)
+    Q_PROPERTY(QUrl url READ url CONSTANT FINAL)
+    Q_ENUMS(DownloadError)
 public:
-    QWebDownloadItemPrivate(QWebDownloadItem*);
-
-    void didReceiveResponse(QWebDownloadItem* download) { emit receivedResponse(download); }
+    virtual ~QWebDownloadItem();
 
-    QWebDownloadItem* q;
+    enum DownloadError {
+        Aborted = 0,
+        CannotWriteToFile,
+        CannotOpenFile,
+        DestinationAlreadyExists,
+        Cancelled,
+        CannotDetermineFilename,
+        NetworkFailure
+    };
 
-    WebKit::DownloadProxy* downloadProxy;
+    QUrl url() const;
+    QString destinationPath() const;
+    QString suggestedFilename() const;
+    QString mimeType() const;
+    quint64 expectedContentLength() const;
+    quint64 totalBytesReceived() const;
+    void setDestinationPath(const QString& destination);
 
-    QUrl sourceUrl;
-    QString suggestedFilename;
-    QString destinationPath;
-    QString mimeType;
-    quint64 expectedContentLength;
-    quint64 totalBytesReceived;
+public Q_SLOTS:
+    void start();
+    void cancel();
 
 Q_SIGNALS:
-    void receivedResponse(QWebDownloadItem*);
+    void destinationFileCreated(const QString& destinationPath);
+    void totalBytesReceivedChanged(quint64 bytesReceived);
+    void succeeded();
+    void failed(QWebDownloadItem::DownloadError error, const QUrl& url, const QString& description);
+
+private:
+    QWebDownloadItem(QObject* parent = 0);
+    QWebDownloadItemPrivate* d;
+
+    friend class WebKit::QtDownloadManager;
+    friend class QtWebPageProxy;
 };
 
-#endif /* qwebdownloaditem_p_h */
+#endif // qwebdownloaditem_p_h
diff --git a/Source/WebKit2/UIProcess/API/qt/qwebdownloaditem_p_p.h b/Source/WebKit2/UIProcess/API/qt/qwebdownloaditem_p_p.h
new file mode 100644 (file)
index 0000000..780848b
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+    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 qwebdownloaditem_p_p_h
+#define qwebdownloaditem_p_p_h
+
+#include "qwebdownloaditem_p.h"
+#include <QUrl>
+
+namespace WebKit {
+class DownloadProxy;
+}
+
+class QWebDownloadItemPrivate : public QObject {
+    Q_OBJECT
+public:
+    QWebDownloadItemPrivate(QWebDownloadItem*);
+
+    void didReceiveResponse(QWebDownloadItem* download) { emit receivedResponse(download); }
+
+    QWebDownloadItem* q;
+
+    WebKit::DownloadProxy* downloadProxy;
+
+    QUrl sourceUrl;
+    QString suggestedFilename;
+    QString destinationPath;
+    QString mimeType;
+    quint64 expectedContentLength;
+    quint64 totalBytesReceived;
+
+Q_SIGNALS:
+    void receivedResponse(QWebDownloadItem*);
+};
+
+#endif // qwebdownloaditem_p_p_h
index ccef9eb..2071bae 100644 (file)
@@ -18,7 +18,7 @@
 */
 
 #include "config.h"
-#include "qwebpreferences.h"
+#include "qwebpreferences_p.h"
 
 #include "QtWebPageProxy.h"
 #include "WKPageGroup.h"
@@ -26,7 +26,7 @@
 #include "WKPreferencesPrivate.h"
 #include "WKRetainPtr.h"
 #include "WKStringQt.h"
-#include "qwebpreferences_p.h"
+#include "qwebpreferences_p_p.h"
 
 QWebPreferences* QWebPreferencesPrivate::createPreferences(QtWebPageProxy* qtWebPageProxy)
 {
diff --git a/Source/WebKit2/UIProcess/API/qt/qwebpreferences.h b/Source/WebKit2/UIProcess/API/qt/qwebpreferences.h
deleted file mode 100644 (file)
index 4e20073..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
-    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:
-    ~QWebPreferences();
-
-    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(bool navigatorQtObjectEnabled READ navigatorQtObjectEnabled WRITE setNavigatorQtObjectEnabled NOTIFY navigatorQtObjectEnabledChanged 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);
-
-    bool navigatorQtObjectEnabled() const;
-    void setNavigatorQtObjectEnabled(bool);
-
-    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 navigatorQtObjectEnabledChanged();
-
-    void standardFontFamilyChanged();
-    void fixedFontFamilyChanged();
-    void serifFontFamilyChanged();
-    void sansSerifFontFamilyChanged();
-    void cursiveFontFamilyChanged();
-    void fantasyFontFamilyChanged();
-
-    void minimumFontSizeChanged();
-    void defaultFontSizeChanged();
-    void defaultFixedFontSizeChanged();
-
-private:
-    Q_DISABLE_COPY(QWebPreferences)
-
-    QWebPreferences();
-
-    QWebPreferencesPrivate *d;
-
-    friend class QWebPreferencesPrivate;
-};
-
-#endif // qwebpreferences_h
index bda2f4a..29df04c 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+    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
     Boston, MA 02110-1301, USA.
 */
 
-#include "WKPreferences.h"
+#ifndef qwebpreferences_p_h
+#define qwebpreferences_p_h
 
-class QtWebPageProxy;
+#include "qwebkitglobal.h"
 
-class QWebPreferencesPrivate {
+#include <QtCore/QObject>
+
+class QWebPreferencesPrivate;
+
+class QWEBKIT_EXPORT QWebPreferences : public QObject {
+    Q_OBJECT
 public:
+    ~QWebPreferences();
+
+    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(bool navigatorQtObjectEnabled READ navigatorQtObjectEnabled WRITE setNavigatorQtObjectEnabled NOTIFY navigatorQtObjectEnabledChanged 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);
+
+    bool navigatorQtObjectEnabled() const;
+    void setNavigatorQtObjectEnabled(bool);
+
+    QString standardFontFamily() const;
+    void setStandardFontFamily(const QString& family);
 
-    enum WebAttribute {
-        AutoLoadImages,
-        JavascriptEnabled,
-        PluginsEnabled,
-        OfflineWebApplicationCacheEnabled,
-        LocalStorageEnabled,
-        XSSAuditingEnabled,
-        FrameFlatteningEnabled,
-        PrivateBrowsingEnabled,
-        AcceleratedCompositingEnabled,
-        DnsPrefetchEnabled
-    };
-
-    enum FontFamily {
-        StandardFont,
-        FixedFont,
-        SerifFont,
-        SansSerifFont,
-        CursiveFont,
-        FantasyFont
-    };
-
-    enum FontSizeType {
-        MinimumFontSize,
-        DefaultFontSize,
-        DefaultFixedFontSize
-    };
-
-    static QWebPreferences* createPreferences(QtWebPageProxy*);
-
-    void setAttribute(WebAttribute attr, bool enable);
-    bool testAttribute(WebAttribute attr) const;
-
-    void setFontFamily(FontFamily which, const QString& family);
-    QString fontFamily(FontFamily which) const;
-
-    void setFontSize(FontSizeType type, unsigned size);
-    unsigned fontSize(FontSizeType type) const;
-
-    WKPreferencesRef preferencesRef() const;
-
-    QtWebPageProxy* qtWebPageProxy;
-
-    static QWebPreferencesPrivate* get(QWebPreferences*);
+    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 navigatorQtObjectEnabledChanged();
+
+    void standardFontFamilyChanged();
+    void fixedFontFamilyChanged();
+    void serifFontFamilyChanged();
+    void sansSerifFontFamilyChanged();
+    void cursiveFontFamilyChanged();
+    void fantasyFontFamilyChanged();
+
+    void minimumFontSizeChanged();
+    void defaultFontSizeChanged();
+    void defaultFixedFontSizeChanged();
+
+private:
+    Q_DISABLE_COPY(QWebPreferences)
+
+    QWebPreferences();
+
+    QWebPreferencesPrivate *d;
+
+    friend class QWebPreferencesPrivate;
 };
+
+#endif // qwebpreferences_p_h
diff --git a/Source/WebKit2/UIProcess/API/qt/qwebpreferences_p_p.h b/Source/WebKit2/UIProcess/API/qt/qwebpreferences_p_p.h
new file mode 100644 (file)
index 0000000..b50791f
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+    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.
+*/
+
+#ifndef qwebpreferences_p_p_h
+#define qwebpreferences_p_p_h
+
+#include "WKPreferences.h"
+
+class QtWebPageProxy;
+
+class QWebPreferencesPrivate {
+public:
+
+    enum WebAttribute {
+        AutoLoadImages,
+        JavascriptEnabled,
+        PluginsEnabled,
+        OfflineWebApplicationCacheEnabled,
+        LocalStorageEnabled,
+        XSSAuditingEnabled,
+        FrameFlatteningEnabled,
+        PrivateBrowsingEnabled,
+        AcceleratedCompositingEnabled,
+        DnsPrefetchEnabled
+    };
+
+    enum FontFamily {
+        StandardFont,
+        FixedFont,
+        SerifFont,
+        SansSerifFont,
+        CursiveFont,
+        FantasyFont
+    };
+
+    enum FontSizeType {
+        MinimumFontSize,
+        DefaultFontSize,
+        DefaultFixedFontSize
+    };
+
+    static QWebPreferences* createPreferences(QtWebPageProxy*);
+
+    void setAttribute(WebAttribute attr, bool enable);
+    bool testAttribute(WebAttribute attr) const;
+
+    void setFontFamily(FontFamily which, const QString& family);
+    QString fontFamily(FontFamily which) const;
+
+    void setFontSize(FontSizeType type, unsigned size);
+    unsigned fontSize(FontSizeType type) const;
+
+    WKPreferencesRef preferencesRef() const;
+
+    QtWebPageProxy* qtWebPageProxy;
+
+    static QWebPreferencesPrivate* get(QWebPreferences*);
+};
+
+#endif // qwebpreferences_p_p_h
index f3db4d2..2d03376 100644 (file)
@@ -20,8 +20,7 @@
 #include "config.h"
 #include "../util.h"
 
-#include "qquickwebpage.h"
-#include "qquickwebview.h"
+#include "qquickwebpage_p.h"
 #include "qquickwebview_p.h"
 
 #include <QtQuickTest/quicktest.h>
@@ -32,7 +31,7 @@ public:
     DesktopWebView(QQuickItem* parent = 0)
         : QQuickWebView(parent)
     {
-        QQuickWebViewPrivate::get(this)->setUseTraditionalDesktopBehaviour(true);
+        experimental()->setUseTraditionalDesktopBehaviour(true);
     }
 };
 
index eb49f2e..e43e665 100644 (file)
@@ -22,8 +22,8 @@
 
 #include <QScopedPointer>
 #include <QtTest/QtTest>
-#include <qquickwebpage.h>
-#include <qquickwebview.h>
+#include <qquickwebpage_p.h>
+#include <qquickwebview_p.h>
 
 class tst_QQuickWebView : public QObject {
     Q_OBJECT
index 3f97fc6..10a40e2 100644 (file)
@@ -27,8 +27,8 @@
 #include "WKStringQt.h"
 #include "WKURLQt.h"
 #include "WebContext.h"
-#include "qwebdownloaditem.h"
 #include "qwebdownloaditem_p.h"
+#include "qwebdownloaditem_p_p.h"
 
 namespace WebKit {
 
index 84e7594..3c2d366 100644 (file)
 #include "QtViewInterface.h"
 
 #include "QtWebError.h"
-#include "qquickwebpage.h"
 #include "qquickwebpage_p.h"
-#include "qquickwebview.h"
+#include "qquickwebpage_p_p.h"
 #include "qquickwebview_p.h"
+#include "qquickwebview_p_p.h"
 
 #include <QtDeclarative/QDeclarativeEngine>
 #include <QtDeclarative/QQuickView>
index 91187e9..389b50f 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef QtWebError_h
 #define QtWebError_h
 
-#include "qwebdownloaditem.h"
+#include "qwebdownloaditem_p.h"
 #include "qwebkitglobal.h"
 #include <QtNetwork/QNetworkReply>
 #include <WKError.h>
index a58a7af..488f4ce 100644 (file)
 #include "QtWebPageProxy.h"
 
 #include "QtWebError.h"
-#include "qwebdownloaditem.h"
 #include "qwebdownloaditem_p.h"
-#include "qwebpreferences.h"
+#include "qwebdownloaditem_p_p.h"
 #include "qwebpreferences_p.h"
+#include "qwebpreferences_p_p.h"
 
 #include "ClientImpl.h"
 #include "DownloadProxy.h"
index b128187..1519c6a 100644 (file)
@@ -161,15 +161,12 @@ contains(CONFIG, texmap) {
 
 # ------------- Install rules -------------
 
-modulefile.files = $${ROOT_WEBKIT_DIR}/Tools/qmake/mkspecs/modules/qt_webkit.pri
+modulefile.files = $$QT.webkit.modulefile
 mkspecs = $$[QMAKE_MKSPECS]
 mkspecs = $$split(mkspecs, :)
 modulefile.path = $$last(mkspecs)/modules
 INSTALLS += modulefile
 
-include($$first(modulefile.files))
-VERSION = $${QT.webkit.VERSION}
-
 # Syncqt has already run at this point, so we can use headers.pri
 # as a basis for our install-rules
 HEADERS_PRI = $${ROOT_BUILD_DIR}/include/$$TARGET/headers.pri
index c6459f4..b497489 100644 (file)
@@ -1,3 +1,26 @@
+2011-11-17  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
+
+        [Qt] Move WebKit2 C++ APIs to private API and build QML extension plugin on top of that
+
+        A new extension object has been added to QQuickWebView (the same approach should be used
+        for other API classes that need experimental APIs). The QML extension mechanism is then
+        built on top of the experimental object.
+
+        https://bugs.webkit.org/show_bug.cgi?id=72522
+
+        Reviewed by Simon Hausmann.
+
+        * MiniBrowser/qt/BrowserWindow.cpp:
+        (BrowserWindow::BrowserWindow):
+        (BrowserWindow::webView):
+        * MiniBrowser/qt/BrowserWindow.h:
+        * MiniBrowser/qt/UrlLoader.cpp:
+        * WebKitTestRunner/qt/PlatformWebViewQt.cpp:
+        * qmake/mkspecs/features/default_post.prf:
+        * qmake/mkspecs/features/default_pre.prf:
+        * qmake/mkspecs/features/qtwebkit-private.prf: Added.
+        * qmake/mkspecs/features/qtwebkit.prf:
+
 2011-11-17  Adam Barth  <abarth@webkit.org>
 
         Move test_results_uploader.py out of layout_package
index f5613b6..58e5894 100644 (file)
@@ -29,7 +29,7 @@
 #include "BrowserWindow.h"
 
 #include "config.h"
-#include "qquickwebpage.h"
+#include "qquickwebpage_p.h"
 #include "qquickwebview_p.h"
 #include "utils.h"
 
@@ -53,7 +53,7 @@ BrowserWindow::BrowserWindow(WindowOptions* options)
     setSource(QUrl("qrc:/qml/BrowserWindow.qml"));
     connect(rootObject(), SIGNAL(pageTitleChanged(QString)), this, SLOT(setWindowTitle(QString)));
     if (!options->useTouchWebView())
-        QQuickWebViewPrivate::get(rootObject()->property("webview").value<QQuickWebView*>())->setUseTraditionalDesktopBehaviour(true);
+        webView()->experimental()->setUseTraditionalDesktopBehaviour(true);
     if (options->startMaximized())
         setWindowState(Qt::WindowMaximized);
     else
@@ -61,7 +61,7 @@ BrowserWindow::BrowserWindow(WindowOptions* options)
     show();
 }
 
-QObject* BrowserWindow::webView() const
+QQuickWebView* BrowserWindow::webView() const
 {
     return rootObject()->property("webview").value<QQuickWebView*>();
 }
index 651ea07..769e97d 100644 (file)
@@ -33,6 +33,8 @@
 #include <QStringList>
 #include <QtDeclarative/QQuickView>
 
+class QQuickWebView;
+
 class BrowserWindow : public QQuickView {
     Q_OBJECT
 
@@ -40,7 +42,7 @@ public:
     BrowserWindow(WindowOptions* = 0);
     ~BrowserWindow();
     void load(const QString& url);
-    QObject* webView() const;
+    QQuickWebView* webView() const;
 
 public slots:
     BrowserWindow* newWindow(const QString& url = "about:blank");
index ebd670e..daf5628 100644 (file)
@@ -27,6 +27,7 @@
  */
 
 #include "UrlLoader.h"
+#include "qquickwebview_p.h"
 
 #include <QDebug>
 #include <QFile>
index 9661b57..9201f92 100644 (file)
@@ -27,8 +27,8 @@
 #include "config.h"
 
 #include "PlatformWebView.h"
-#include "qquickwebview.h"
-#include "qquickwebpage.h"
+#include "qquickwebpage_p.h"
+#include "qquickwebview_p.h"
 
 #include <QApplication>
 #include <QDeclarativeProperty>
index c9493aa..82a3bbd 100644 (file)
@@ -37,7 +37,6 @@ DEPENDPATH += $$OUT_PWD
 
 INCLUDEPATH += \
     $${ROOT_WEBKIT_DIR}/Source \
-    $${ROOT_BUILD_DIR}/include/QtWebKit \
     $$buildDirForSource(Source/include) \
     $${QT.script.includes}
 
index f8d8c7b..6dca683 100644 (file)
@@ -101,5 +101,9 @@ haveQt(5): {
     }
 }
 
+QT.webkit.modulefile = $${ROOT_WEBKIT_DIR}/Tools/qmake/mkspecs/modules/qt_webkit.pri
+include($$QT.webkit.modulefile)
+VERSION = $${QT.webkit.VERSION}
+
 # Set some defaults for specific platforms
 CONFIG += include_webinspector
diff --git a/Tools/qmake/mkspecs/features/qtwebkit-private.prf b/Tools/qmake/mkspecs/features/qtwebkit-private.prf
new file mode 100644 (file)
index 0000000..05c68d9
--- /dev/null
@@ -0,0 +1,12 @@
+# -------------------------------------------------------------------
+# This file is used by tools that rely on private APIs of
+# the QtWebKit library
+#
+# FIXME: Can we use the same way as client applications would use?
+#
+# See 'Tools/qmake/README' for an overview of the build system
+# -------------------------------------------------------------------
+
+config_step {
+    INCLUDEPATH += $${ROOT_BUILD_DIR}/include/$${QT.webkit.name}/$${QT.webkit.VERSION}/$${QT.webkit.name}/private
+}
index a4320b3..90cbd6e 100644 (file)
@@ -24,5 +24,6 @@ config_step {
     }
 
     DEPENDPATH += $$ROOT_WEBKIT_DIR/Source/WebKit/qt/Api
+    INCLUDEPATH += $${ROOT_BUILD_DIR}/include/QtWebKit
 }