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.
Source/WebKit2:
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.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@92277
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2011-08-02 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
+
+ [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 <cgarcia@igalia.com>
[GTK] Install web and plugin processes in libexecdir instead of bindir
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) {
+2011-08-02 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
+
+ [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 <cgarcia@igalia.com>
[GTK] Install web and plugin processes in libexecdir instead of bindir
--- /dev/null
+/*
+ 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));
+
--- /dev/null
+plugin webkit2qmlplugin
--- /dev/null
+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
virtual ~QTouchWebPage();
- void load(const QUrl&);
+ Q_INVOKABLE void load(const QUrl&);
Q_INVOKABLE QUrl url() const;
Q_INVOKABLE QString title() const;
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);
--- /dev/null
+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")
+ }
+ }
+}
--- /dev/null
+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")
+ }
+ }
+}
--- /dev/null
+<html>
+<head><title>Test page 1</title></head>
+<body>
+Hello.
+</body>
+</html>
--- /dev/null
+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
+
--- /dev/null
+/*
+ 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)
TEMPLATE = subdirs
-SUBDIRS = qtouchwebview qdesktopwebview commonviewtests
+SUBDIRS = qtouchwebview qdesktopwebview commonviewtests qmltests