Diff
Modified: trunk/ChangeLog (92276 => 92277)
--- trunk/ChangeLog 2011-08-03 13:15:39 UTC (rev 92276)
+++ trunk/ChangeLog 2011-08-03 14:25:23 UTC (rev 92277)
@@ -1,3 +1,12 @@
+2011-08-02 Caio Marcelo de Oliveira Filho <[email protected]>
+
+ [Qt] [WK2] Expose web view classes to QML
+ https://bugs.webkit.org/show_bug.cgi?id=65339
+
+ Reviewed by Benjamin Poulain.
+
+ * Source/WebKit.pro: Include QML plugin subdir in the build system for WK2.
+
2011-08-03 Carlos Garcia Campos <[email protected]>
[GTK] Install web and plugin processes in libexecdir instead of bindir
Modified: trunk/Source/WebKit.pro (92276 => 92277)
--- trunk/Source/WebKit.pro 2011-08-03 13:15:39 UTC (rev 92276)
+++ trunk/Source/WebKit.pro 2011-08-03 14:25:23 UTC (rev 92277)
@@ -23,6 +23,7 @@
webkit2 {
exists($$PWD/WebKit2/WebProcess.pro): SUBDIRS += WebKit2/WebProcess.pro
exists($$PWD/WebKit2/UIProcess/API/qt/tests): SUBDIRS += WebKit2/UIProcess/API/qt/tests
+ SUBDIRS += WebKit2/UIProcess/API/qt/qmlplugin
}
exists($$PWD/WebKit/qt/declarative) {
Modified: trunk/Source/WebKit2/ChangeLog (92276 => 92277)
--- trunk/Source/WebKit2/ChangeLog 2011-08-03 13:15:39 UTC (rev 92276)
+++ trunk/Source/WebKit2/ChangeLog 2011-08-03 14:25:23 UTC (rev 92277)
@@ -1,3 +1,29 @@
+2011-08-02 Caio Marcelo de Oliveira Filho <[email protected]>
+
+ [Qt] [WK2] Expose web view classes to QML
+ https://bugs.webkit.org/show_bug.cgi?id=65339
+
+ Reviewed by Benjamin Poulain.
+
+ This patch also uses QuickTest from QtDeclarative to provide the basic autotest
+ infrastructure for the exposed elements.
+
+ * UIProcess/API/qt/qmlplugin/plugin.cpp: Added.
+ (WebKit2QmlPlugin::registerTypes):
+ * UIProcess/API/qt/qmlplugin/qmldir: Added.
+ * UIProcess/API/qt/qmlplugin/qmlplugin.pro: Added.
+ * UIProcess/API/qt/qtouchwebpage.h: Expose load() to QML environment.
+ * UIProcess/API/qt/qtouchwebview.h: Since QTouchWebPage* doesn't change once set
+ in the constructor, we mark the page property as CONSTANT. This avoid QML
+ warnings for not having a NOTIFY signal for the property change.
+
+ * UIProcess/API/qt/tests/tests.pro:
+ * UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_properties.qml: Added.
+ * UIProcess/API/qt/tests/qmltests/TouchWebView/tst_properties.qml: Added.
+ * UIProcess/API/qt/tests/qmltests/common/test1.html: Added.
+ * UIProcess/API/qt/tests/qmltests/qmltests.pro: Added.
+ * UIProcess/API/qt/tests/qmltests/tst_qmltests.cpp: Added.
+
2011-08-03 Carlos Garcia Campos <[email protected]>
[GTK] Install web and plugin processes in libexecdir instead of bindir
Added: trunk/Source/WebKit2/UIProcess/API/qt/qmlplugin/plugin.cpp (0 => 92277)
--- trunk/Source/WebKit2/UIProcess/API/qt/qmlplugin/plugin.cpp (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qmlplugin/plugin.cpp 2011-08-03 14:25:23 UTC (rev 92277)
@@ -0,0 +1,46 @@
+/*
+ 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 "qdesktopwebview.h"
+#include "qtouchwebpage.h"
+#include "qtouchwebview.h"
+
+#include <QtDeclarative/qdeclarative.h>
+#include <QtDeclarative/qdeclarativeextensionplugin.h>
+
+QT_BEGIN_NAMESPACE
+
+class WebKit2QmlPlugin : public QDeclarativeExtensionPlugin {
+ Q_OBJECT
+public:
+ virtual void registerTypes(const char* uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == QLatin1String("QtWebKit.experimental"));
+ qmlRegisterType<QDesktopWebView>(uri, 5, 0, "DesktopWebView");
+ qmlRegisterType<QTouchWebView>(uri, 5, 0, "TouchWebView");
+ qmlRegisterUncreatableType<QTouchWebPage>(uri, 5, 0, "TouchWebPage", QObject::tr("Cannot create separate instance of TouchWebPage, use TouchWebView"));
+ }
+};
+
+QT_END_NAMESPACE
+
+#include "plugin.moc"
+
+Q_EXPORT_PLUGIN2(webkit2qmlplugin, QT_PREPEND_NAMESPACE(WebKit2QmlPlugin));
+
Added: trunk/Source/WebKit2/UIProcess/API/qt/qmlplugin/qmldir (0 => 92277)
--- trunk/Source/WebKit2/UIProcess/API/qt/qmlplugin/qmldir (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qmlplugin/qmldir 2011-08-03 14:25:23 UTC (rev 92277)
@@ -0,0 +1 @@
+plugin webkit2qmlplugin
Added: trunk/Source/WebKit2/UIProcess/API/qt/qmlplugin/qmlplugin.pro (0 => 92277)
--- trunk/Source/WebKit2/UIProcess/API/qt/qmlplugin/qmlplugin.pro (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qmlplugin/qmlplugin.pro 2011-08-03 14:25:23 UTC (rev 92277)
@@ -0,0 +1,40 @@
+TEMPLATE = lib
+TARGET = webkit2qmlplugin
+TARGETPATH = QtWebKit/experimental
+CONFIG += qt plugin
+
+SOURCES += plugin.cpp
+
+include(../../../../../WebKit.pri)
+QT += declarative
+
+QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
+
+
+# From WK1 qml module. Copies the qmldir file to the build directory,
+# so we can use it in place without installing.
+QMLDIRFILE = $${_PRO_FILE_PWD_}/qmldir
+copy2build.input = QMLDIRFILE
+CONFIG(QTDIR_build) {
+ copy2build.output = $$QT_BUILD_TREE/imports/$$TARGETPATH/qmldir
+} else {
+ copy2build.output = $$OUTPUT_DIR/imports/$$TARGETPATH/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
+
+
+CONFIG(QTDIR_build) {
+ DESTDIR = $$QT_BUILD_TREE/imports/$$TARGETPATH
+} else {
+ DESTDIR = $$OUTPUT_DIR/imports/$$TARGETPATH
+}
+target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
+
+qmldir.files += $$PWD/qmldir
+qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
+
+INSTALLS += target qmldir
Modified: trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebpage.h (92276 => 92277)
--- trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebpage.h 2011-08-03 13:15:39 UTC (rev 92276)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebpage.h 2011-08-03 14:25:23 UTC (rev 92277)
@@ -46,7 +46,7 @@
virtual ~QTouchWebPage();
- void load(const QUrl&);
+ Q_INVOKABLE void load(const QUrl&);
Q_INVOKABLE QUrl url() const;
Q_INVOKABLE QString title() const;
Modified: trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebview.h (92276 => 92277)
--- trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebview.h 2011-08-03 13:15:39 UTC (rev 92276)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebview.h 2011-08-03 14:25:23 UTC (rev 92277)
@@ -35,7 +35,7 @@
class QWEBKIT_EXPORT QTouchWebView : public QSGItem
{
Q_OBJECT
- Q_PROPERTY(QTouchWebPage* page READ page)
+ Q_PROPERTY(QTouchWebPage* page READ page CONSTANT)
public:
QTouchWebView(QSGItem* parent = 0);
Added: trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_properties.qml (0 => 92277)
--- trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_properties.qml (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopWebView/tst_properties.qml 2011-08-03 14:25:23 UTC (rev 92277)
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+import QtTest 1.0
+import QtWebKit.experimental 5.0
+
+DesktopWebView {
+ id: webView
+
+ SignalSpy {
+ id: spy
+ target: webView
+ signalName: "loadSucceeded"
+ }
+
+ TestCase {
+ name: "DesktopWebViewProperties"
+
+ function test_title() {
+ compare(spy.count, 0)
+ webView.load(Qt.resolvedUrl("../common/test1.html"))
+ spy.wait()
+ compare(webView.title, "Test page 1")
+ }
+ }
+}
Added: trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/TouchWebView/tst_properties.qml (0 => 92277)
--- trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/TouchWebView/tst_properties.qml (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/TouchWebView/tst_properties.qml 2011-08-03 14:25:23 UTC (rev 92277)
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+import QtTest 1.0
+import QtWebKit.experimental 5.0
+
+TouchWebView {
+ id: webView
+
+ SignalSpy {
+ id: spy
+ target: webView.page
+ signalName: "loadSucceeded"
+ }
+
+ TestCase {
+ name: "TouchWebViewProperties"
+
+ function test_title() {
+ compare(spy.count, 0)
+ webView.page.load(Qt.resolvedUrl("../common/test1.html"))
+ spy.wait()
+ compare(webView.page.title, "Test page 1")
+ }
+ }
+}
Added: trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test1.html (0 => 92277)
--- trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test1.html (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test1.html 2011-08-03 14:25:23 UTC (rev 92277)
@@ -0,0 +1,6 @@
+<html>
+<head><title>Test page 1</title></head>
+<body>
+Hello.
+</body>
+</html>
Added: trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/qmltests.pro (0 => 92277)
--- trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/qmltests.pro (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/qmltests.pro 2011-08-03 14:25:23 UTC (rev 92277)
@@ -0,0 +1,16 @@
+TEMPLATE = app
+TARGET = tst_qmltests
+CONFIG += warn_on testcase
+SOURCES += tst_qmltests.cpp
+
+QT += declarative qmltest
+
+# QML files tested are the ones in WebKit source repository.
+DEFINES += QUICK_TEST_SOURCE_DIR=\"\\\"$$PWD\\\"\"
+
+message($$PWD)
+
+OTHER_FILES += \
+ DesktopWebView/tst_properties.qml \
+ TouchWebView/tst_properties.qml
+
Added: trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/tst_qmltests.cpp (0 => 92277)
--- trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/tst_qmltests.cpp (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/tst_qmltests.cpp 2011-08-03 14:25:23 UTC (rev 92277)
@@ -0,0 +1,21 @@
+/*
+ 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 <QtQuickTest/quicktest.h>
+QUICK_TEST_MAIN(qmltests)
Modified: trunk/Source/WebKit2/UIProcess/API/qt/tests/tests.pro (92276 => 92277)
--- trunk/Source/WebKit2/UIProcess/API/qt/tests/tests.pro 2011-08-03 13:15:39 UTC (rev 92276)
+++ trunk/Source/WebKit2/UIProcess/API/qt/tests/tests.pro 2011-08-03 14:25:23 UTC (rev 92277)
@@ -1,2 +1,2 @@
TEMPLATE = subdirs
-SUBDIRS = qtouchwebview qdesktopwebview commonviewtests
+SUBDIRS = qtouchwebview qdesktopwebview commonviewtests qmltests