summaryrefslogtreecommitdiffstats
path: root/Source/WebKit/qt
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-08-12 09:27:39 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-08-12 09:27:39 +0200
commit3749d61e1f7a59f5ec5067e560af1eb610c82015 (patch)
tree73dc228333948738bbe02976cacca8cd382bc978 /Source/WebKit/qt
parentb32b4dcd9a51ab8de6afc53d9e17f8707e1f7a5e (diff)
Imported WebKit commit a77350243e054f3460d1137301d8b3faee3d2052 (http://svn.webkit.org/repository/webkit/trunk@125365)
New snapshot with build fixes for latest API changes in Qt and all WK1 Win MSVC fixes upstream
Diffstat (limited to 'Source/WebKit/qt')
-rw-r--r--Source/WebKit/qt/Api/qgraphicswebview.cpp2
-rw-r--r--Source/WebKit/qt/Api/qgraphicswebview.h4
-rw-r--r--Source/WebKit/qt/Api/qwebframe.cpp44
-rw-r--r--Source/WebKit/qt/Api/qwebframe.h10
-rw-r--r--Source/WebKit/qt/Api/qwebframe_p.h8
-rw-r--r--Source/WebKit/qt/Api/qwebpage.cpp3
-rw-r--r--Source/WebKit/qt/Api/qwebpage.h4
-rw-r--r--Source/WebKit/qt/Api/qwebsettings.cpp12
-rw-r--r--Source/WebKit/qt/Api/qwebview.cpp8
-rw-r--r--Source/WebKit/qt/Api/qwebview.h4
-rw-r--r--Source/WebKit/qt/ChangeLog159
-rw-r--r--Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp5
-rw-r--r--Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp41
-rw-r--r--Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h1
-rw-r--r--Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp4
-rw-r--r--Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.h8
-rw-r--r--Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp9
-rw-r--r--Source/WebKit/qt/WebCoreSupport/WebEventConversion.cpp2
-rw-r--r--Source/WebKit/qt/declarative/declarative.pro2
-rw-r--r--Source/WebKit/qt/declarative/plugin.cpp13
-rw-r--r--Source/WebKit/qt/declarative/public.pri4
-rw-r--r--Source/WebKit/qt/examples/platformplugin/WebPlugin.cpp4
-rw-r--r--Source/WebKit/qt/examples/platformplugin/WebPlugin.h2
-rw-r--r--Source/WebKit/qt/examples/platformplugin/platformplugin.pro3
-rw-r--r--Source/WebKit/qt/tests/qobjectbridge/tst_qobjectbridge.cpp99
-rw-r--r--Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp43
-rw-r--r--Source/WebKit/qt/tests/tests.pri5
-rw-r--r--Source/WebKit/qt/tests/util.h33
28 files changed, 288 insertions, 248 deletions
diff --git a/Source/WebKit/qt/Api/qgraphicswebview.cpp b/Source/WebKit/qt/Api/qgraphicswebview.cpp
index 343c2a166..3e8abbad9 100644
--- a/Source/WebKit/qt/Api/qgraphicswebview.cpp
+++ b/Source/WebKit/qt/Api/qgraphicswebview.cpp
@@ -309,9 +309,7 @@ bool QGraphicsWebView::sceneEvent(QEvent* event)
if (d->page && (event->type() == QEvent::TouchBegin
|| event->type() == QEvent::TouchEnd
|| event->type() == QEvent::TouchUpdate
-#if HAVE(QT5)
|| event->type() == QEvent::TouchCancel
-#endif
)) {
d->page->event(event);
diff --git a/Source/WebKit/qt/Api/qgraphicswebview.h b/Source/WebKit/qt/Api/qgraphicswebview.h
index 15fe087d6..0f9f17b48 100644
--- a/Source/WebKit/qt/Api/qgraphicswebview.h
+++ b/Source/WebKit/qt/Api/qgraphicswebview.h
@@ -23,11 +23,7 @@
#include "qwebkitglobal.h"
#include "qwebpage.h"
#include <QtCore/qurl.h>
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <QtWidgets/qgraphicswidget.h>
-#else
-#include <QtGui/qgraphicswidget.h>
-#endif
#include <QtGui/qevent.h>
#include <QtGui/qicon.h>
#include <QtGui/qpainter.h>
diff --git a/Source/WebKit/qt/Api/qwebframe.cpp b/Source/WebKit/qt/Api/qwebframe.cpp
index dac4165e9..52b97382d 100644
--- a/Source/WebKit/qt/Api/qwebframe.cpp
+++ b/Source/WebKit/qt/Api/qwebframe.cpp
@@ -97,10 +97,6 @@
#include <qregion.h>
#include <qnetworkrequest.h>
-#if ENABLE(ORIENTATION_EVENTS) && !HAVE(QT5)
-QTM_USE_NAMESPACE
-#endif
-
using namespace WebCore;
// from text/qfont.cpp
@@ -492,45 +488,9 @@ void QWebFramePrivate::_q_orientationChanged()
void QWebFramePrivate::didClearWindowObject()
{
- if (page->settings()->testAttribute(QWebSettings::JavascriptEnabled))
- addQtSenderToGlobalObject();
emit q->javaScriptWindowObjectCleared();
}
-static JSValueRef qtSenderCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef*)
-{
- QObject* sender = JSC::Bindings::QtInstance::qtSenderStack()->top();
- if (!sender)
- return JSValueMakeUndefined(context);
-
- JSC::ExecState* exec = ::toJS(context);
- RefPtr<JSC::Bindings::RootObject> rootObject = JSC::Bindings::findRootObject(exec->dynamicGlobalObject());
- JSC::JSObject* jsSender = JSC::Bindings::QtInstance::getQtInstance(sender, rootObject, JSC::Bindings::QtInstance::QtOwnership)->createRuntimeObject(exec);
- return ::toRef(jsSender);
-}
-
-void QWebFramePrivate::addQtSenderToGlobalObject()
-{
- JSDOMWindow* window = toJSDOMWindow(frame, mainThreadNormalWorld());
- Q_ASSERT(window);
-
- JSC::ExecState* exec = window->globalExec();
- Q_ASSERT(exec);
- JSC::JSLockHolder lock(exec);
-
- JSContextRef context = ::toRef(exec);
- JSRetainPtr<JSStringRef> propertyName(Adopt, JSStringCreateWithUTF8CString("__qt_sender__"));
- JSObjectRef function = JSObjectMakeFunctionWithCallback(context, propertyName.get(), qtSenderCallback);
-
- // JSC public API doesn't support setting a Getter for a property of a given object, https://bugs.webkit.org/show_bug.cgi?id=61374.
- JSC::PropertyDescriptor descriptor;
- descriptor.setGetter(::toJS(function));
- descriptor.setSetter(JSC::jsUndefined());
- descriptor.setEnumerable(false);
- descriptor.setConfigurable(false);
- window->methodTable()->defineOwnProperty(window, exec, propertyName.get()->identifier(&exec->globalData()), descriptor, false);
-}
-
/*!
\class QWebFrame
\since 4.4
@@ -650,11 +610,7 @@ QWebFrame::~QWebFrame()
The ownership of \a object is specified using \a own.
*/
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
void QWebFrame::addToJavaScriptWindowObject(const QString &name, QObject *object, ValueOwnership ownership)
-#else
-void QWebFrame::addToJavaScriptWindowObject(const QString &name, QObject *object, QScriptEngine::ValueOwnership ownership)
-#endif
{
if (!page()->settings()->testAttribute(QWebSettings::JavascriptEnabled))
return;
diff --git a/Source/WebKit/qt/Api/qwebframe.h b/Source/WebKit/qt/Api/qwebframe.h
index 6d486d50e..ca96661e3 100644
--- a/Source/WebKit/qt/Api/qwebframe.h
+++ b/Source/WebKit/qt/Api/qwebframe.h
@@ -28,10 +28,6 @@
#include <QtNetwork/qnetworkaccessmanager.h>
#include "qwebkitglobal.h"
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
-#include <QtScript/qscriptengine.h>
-#endif
-
QT_BEGIN_NAMESPACE
class QRect;
class QPoint;
@@ -124,13 +120,11 @@ private:
~QWebFrame();
public:
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
enum ValueOwnership {
QtOwnership,
ScriptOwnership,
AutoOwnership
};
-#endif
QWebPage *page() const;
@@ -139,11 +133,7 @@ public:
void setHtml(const QString &html, const QUrl &baseUrl = QUrl());
void setContent(const QByteArray &data, const QString &mimeType = QString(), const QUrl &baseUrl = QUrl());
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
void addToJavaScriptWindowObject(const QString &name, QObject *object, ValueOwnership ownership = QtOwnership);
-#else
- void addToJavaScriptWindowObject(const QString &name, QObject *object, QScriptEngine::ValueOwnership ownership = QScriptEngine::QtOwnership);
-#endif
QString toHtml() const;
QString toPlainText() const;
QString renderTreeDump() const;
diff --git a/Source/WebKit/qt/Api/qwebframe_p.h b/Source/WebKit/qt/Api/qwebframe_p.h
index 2762c2be7..3201aaa57 100644
--- a/Source/WebKit/qt/Api/qwebframe_p.h
+++ b/Source/WebKit/qt/Api/qwebframe_p.h
@@ -30,9 +30,6 @@
#include "PlatformString.h"
#if ENABLE(ORIENTATION_EVENTS)
#include "qorientationsensor.h"
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
-using QTM_NAMESPACE::QOrientationSensor;
-#endif
#endif // ENABLE(ORIENTATION_EVENTS).
#include "qwebelement.h"
#include "wtf/RefPtr.h"
@@ -132,11 +129,6 @@ public:
#if ENABLE(ORIENTATION_EVENTS)
QOrientationSensor m_orientation;
#endif // ENABLE(ORIENTATION_EVENTS).
-
-private:
-#if USE(JSC)
- void addQtSenderToGlobalObject();
-#endif
};
class QWebHitTestResultPrivate {
diff --git a/Source/WebKit/qt/Api/qwebpage.cpp b/Source/WebKit/qt/Api/qwebpage.cpp
index 8e9633d18..08e86183a 100644
--- a/Source/WebKit/qt/Api/qwebpage.cpp
+++ b/Source/WebKit/qt/Api/qwebpage.cpp
@@ -113,7 +113,6 @@
#include "SystemInfo.h"
#endif // Q_OS_WIN32
#include "TextIterator.h"
-#include "UtilsQt.h"
#include "WebEventConversion.h"
#include "WindowFeatures.h"
#include "WorkerThread.h"
@@ -3162,9 +3161,7 @@ bool QWebPage::event(QEvent *ev)
case QEvent::TouchBegin:
case QEvent::TouchUpdate:
case QEvent::TouchEnd:
-#if HAVE(QT5)
case QEvent::TouchCancel:
-#endif
// Return whether the default action was cancelled in the JS event handler
return d->touchEvent(static_cast<QTouchEvent*>(ev));
#ifndef QT_NO_PROPERTIES
diff --git a/Source/WebKit/qt/Api/qwebpage.h b/Source/WebKit/qt/Api/qwebpage.h
index 0bf35e247..66f89609b 100644
--- a/Source/WebKit/qt/Api/qwebpage.h
+++ b/Source/WebKit/qt/Api/qwebpage.h
@@ -26,11 +26,7 @@
#include <QtCore/qobject.h>
#include <QtCore/qurl.h>
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <QtWidgets/qwidget.h>
-#else
-#include <QtGui/qwidget.h>
-#endif
QT_BEGIN_NAMESPACE
class QNetworkProxy;
diff --git a/Source/WebKit/qt/Api/qwebsettings.cpp b/Source/WebKit/qt/Api/qwebsettings.cpp
index 588dcf7aa..774da5d31 100644
--- a/Source/WebKit/qt/Api/qwebsettings.cpp
+++ b/Source/WebKit/qt/Api/qwebsettings.cpp
@@ -46,11 +46,7 @@
#include "FileSystem.h"
#include <QApplication>
-#if HAVE(QT5)
#include <QStandardPaths>
-#else
-#include <QDesktopServices>
-#endif
#include <QDir>
#include <QHash>
#include <QSharedData>
@@ -1145,11 +1141,7 @@ void QWebSettings::enablePersistentStorage(const QString& path)
if (path.isEmpty()) {
-#if HAVE(QT5)
storagePath = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
-#else
- storagePath = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
-#endif
if (storagePath.isEmpty())
storagePath = WebCore::pathByAppendingComponent(QDir::homePath(), QCoreApplication::applicationName());
} else
@@ -1168,11 +1160,7 @@ void QWebSettings::enablePersistentStorage(const QString& path)
#if ENABLE(NETSCAPE_PLUGIN_METADATA_CACHE)
// All applications can share the common QtWebkit cache file(s).
// Path is not configurable and uses QDesktopServices::CacheLocation by default.
-#if HAVE(QT5)
QString cachePath = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
-#else
- QString cachePath = QDesktopServices::storageLocation(QDesktopServices::CacheLocation);
-#endif
WebCore::makeAllDirectories(cachePath);
QFileInfo info(cachePath);
diff --git a/Source/WebKit/qt/Api/qwebview.cpp b/Source/WebKit/qt/Api/qwebview.cpp
index a6082cf63..f90790f0c 100644
--- a/Source/WebKit/qt/Api/qwebview.cpp
+++ b/Source/WebKit/qt/Api/qwebview.cpp
@@ -34,10 +34,8 @@
#include "qdir.h"
#include "qfile.h"
#ifndef QT_NO_ACCESSIBILITY
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include "qwebviewaccessible_p.h"
#endif
-#endif
class QWebViewPrivate {
public:
@@ -154,7 +152,6 @@ void QWebViewPrivate::_q_pageDestroyed()
*/
#ifndef QT_NO_ACCESSIBILITY
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
static QAccessibleInterface* accessibleInterfaceFactory(const QString& key, QObject* object)
{
Q_UNUSED(key)
@@ -168,7 +165,6 @@ static QAccessibleInterface* accessibleInterfaceFactory(const QString& key, QObj
return 0;
}
#endif
-#endif
/*!
Constructs an empty QWebView with parent \a parent.
@@ -191,10 +187,8 @@ QWebView::QWebView(QWidget *parent)
setFocusPolicy(Qt::WheelFocus);
#ifndef QT_NO_ACCESSIBILITY
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QAccessible::installFactory(accessibleInterfaceFactory);
#endif
-#endif
}
/*!
@@ -732,9 +726,7 @@ bool QWebView::event(QEvent *e)
} else if (e->type() == QEvent::TouchBegin
|| e->type() == QEvent::TouchEnd
|| e->type() == QEvent::TouchUpdate
-#if HAVE(QT5)
|| e->type() == QEvent::TouchCancel
-#endif
) {
d->page->event(e);
diff --git a/Source/WebKit/qt/Api/qwebview.h b/Source/WebKit/qt/Api/qwebview.h
index 90d0a8e3b..d4b4dd917 100644
--- a/Source/WebKit/qt/Api/qwebview.h
+++ b/Source/WebKit/qt/Api/qwebview.h
@@ -23,11 +23,7 @@
#include "qwebkitglobal.h"
#include "qwebpage.h"
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <QtWidgets/qwidget.h>
-#else
-#include <QtGui/qwidget.h>
-#endif
#include <QtGui/qicon.h>
#include <QtGui/qpainter.h>
#include <QtCore/qurl.h>
diff --git a/Source/WebKit/qt/ChangeLog b/Source/WebKit/qt/ChangeLog
index 3262f75a1..b008c205d 100644
--- a/Source/WebKit/qt/ChangeLog
+++ b/Source/WebKit/qt/ChangeLog
@@ -1,3 +1,162 @@
+2012-08-11 Pierre Rossi <pierre.rossi@gmail.com>
+
+ [Qt] Add support for HTML5 state object history API in FrameLoaderClientQt
+ https://bugs.webkit.org/show_bug.cgi?id=93648
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Add support for push/replace/pop by implementing dispatchDidNavigateWithinPage.
+
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::dispatchDidNavigateWithinPage):
+ (WebCore::FrameLoaderClientQt::dispatchDidPushStateWithinPage):
+ (WebCore::FrameLoaderClientQt::dispatchDidReplaceStateWithinPage):
+ (WebCore::FrameLoaderClientQt::dispatchDidPopStateWithinPage):
+ * WebCoreSupport/FrameLoaderClientQt.h:
+ (FrameLoaderClientQt):
+ * tests/qwebframe/tst_qwebframe.cpp:
+ (tst_QWebFrame):
+ (tst_QWebFrame::setUrlUsingStateObject): Added. Tests that the urlChanged signal is fired.
+
+2012-08-10 Simon Hausmann <simon.hausmann@nokia.com>
+
+ [Qt] Remove QRegExp <> JS RegExp conversion
+ https://bugs.webkit.org/show_bug.cgi?id=93716
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Removed tests that cover the automatic QRegExp <> JS RegExp conversion. See WebCore
+ ChangeLog for details.
+
+ * tests/qobjectbridge/tst_qobjectbridge.cpp:
+ (MyQObject::emitMySignalWithDateTimeArg):
+ (MyQObject):
+ (tst_QObjectBridge::overloadedSlots):
+ (tst_QObjectBridge::typeConversion):
+
+2012-08-09 Simon Hausmann <simon.hausmann@nokia.com>
+
+ [Qt] Remove support for __qt_sender__ in QObject bridge
+ https://bugs.webkit.org/show_bug.cgi?id=93649
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Support for __qt_sender__ has also been removed from QtScript/QJSEngine. The right
+ JavaScript solution to the problem is Function.prototype.bind.
+
+ * Api/qwebframe.cpp:
+ (QWebFramePrivate::didClearWindowObject):
+ * Api/qwebframe_p.h:
+ (QWebFramePrivate):
+ * tests/qobjectbridge/tst_qobjectbridge.cpp:
+ (tst_QObjectBridge::connectAndDisconnect):
+
+2012-08-08 Simon Hausmann <simon.hausmann@nokia.com>
+
+ [Qt] Port internal findMethodIndex method matcher to use JSC C API
+ https://bugs.webkit.org/show_bug.cgi?id=93463
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Adjust the expectations of the unit test for some of the exceptions the
+ method throws when signals/slots cannot be found/matched. The C API doesn't allow
+ us to create syntax (type) errors, only generic error exceptions.
+
+ * tests/qobjectbridge/tst_qobjectbridge.cpp:
+ (tst_QObjectBridge::callQtInvokable):
+
+2012-08-08 Simon Hausmann <simon.hausmann@nokia.com>
+
+ [Qt] Add unit test for QObject bindings for scriptable plugins
+ https://bugs.webkit.org/show_bug.cgi?id=93462
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ The bindings code is subject to refactoring in the future, so added a unit test to verify that
+ accessing an embedded QWidget from JavaScript goes through the QObject bindings.
+
+ * tests/qobjectbridge/tst_qobjectbridge.cpp:
+ (tst_QObjectBridge):
+ (TestPluginWidget):
+ (TestPluginWidget::TestPluginWidget):
+ (TestPluginWidget::slotWithReturnValue):
+ (TestWebPage):
+ (TestWebPage::TestWebPage):
+ (TestWebPage::createPlugin):
+ (tst_QObjectBridge::scriptablePlugin):
+
+2012-08-07 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Unreviewed trivial fix: Missed HAVE_QT5 removal as part of r124879
+
+ Fixes failing auto-test.
+
+ * tests/qobjectbridge/tst_qobjectbridge.cpp:
+ (tst_QObjectBridge::enumerate_data):
+
+2012-08-02 Simon Hausmann <simon.hausmann@nokia.com>
+
+ [Qt] Remove Qt 4 specific code paths
+ https://bugs.webkit.org/show_bug.cgi?id=88161
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ * Api/qgraphicswebview.cpp:
+ (QGraphicsWebView::sceneEvent):
+ * Api/qgraphicswebview.h:
+ * Api/qwebframe.cpp:
+ * Api/qwebframe.h:
+ * Api/qwebframe_p.h:
+ * Api/qwebpage.cpp:
+ (QWebPage::event):
+ * Api/qwebpage.h:
+ * Api/qwebsettings.cpp:
+ (QWebSettings::enablePersistentStorage):
+ * Api/qwebview.cpp:
+ (QWebView::QWebView):
+ (QWebView::event):
+ * Api/qwebview.h:
+ * WebCoreSupport/ChromeClientQt.cpp:
+ (WebCore::ChromeClientQt::setToolTip):
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::createPlugin):
+ * WebCoreSupport/GeolocationClientQt.cpp:
+ * WebCoreSupport/GeolocationClientQt.h:
+ * WebCoreSupport/PageClientQt.cpp:
+ (createPlatformGraphicsContext3DFromWidget):
+ (QWebPageClient::ownerWindow):
+ * WebCoreSupport/WebEventConversion.cpp:
+ (WebCore::WebKitPlatformTouchEvent::WebKitPlatformTouchEvent):
+ * declarative/declarative.pro:
+ * declarative/plugin.cpp:
+ * declarative/public.pri:
+ * examples/platformplugin/WebPlugin.cpp:
+ (WebPlugin::createExtension):
+ * examples/platformplugin/WebPlugin.h:
+ (WebPlugin):
+ * examples/platformplugin/platformplugin.pro:
+ * tests/qobjectbridge/tst_qobjectbridge.cpp:
+ (tst_QObjectBridge::arrayObjectEnumerable):
+ (tst_QObjectBridge::ownership):
+ (tst_QObjectBridge::qObjectWrapperWithSameIdentity):
+ * tests/tests.pri:
+ * tests/util.h:
+
+2012-08-01 Zeno Albisser <zeno@webkit.org>
+
+ [Qt]REGRESSION(r123786): It made 3 fast/animation tests fail.
+ https://bugs.webkit.org/show_bug.cgi?id=92490
+
+ QAbstractAnimation:start() is implicitly calling updateTime
+ without going through the event loop. This resulted in executing
+ scripted animation callbacks right when registering a first callback.
+
+ Reviewed by Noam Rosenthal.
+
+ * WebCoreSupport/ChromeClientQt.cpp:
+ (WebCore::RefreshAnimation::scheduleAnimation):
+ Invoke QAbstractAnimation::start() method through the event loop.
+
2012-07-27 Csaba Osztrogonác <ossy@webkit.org>
[Qt][WK2] REGRESSION(r119127): resetting window.internals settings between tests doesn't work properly
diff --git a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
index 92814429b..912320ccd 100644
--- a/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
@@ -75,7 +75,6 @@
#include <qeventloop.h>
#include <qtooltip.h>
#include <wtf/OwnPtr.h>
-#include <wtf/qt/UtilsQt.h>
#if ENABLE(VIDEO) && ((USE(GSTREAMER) && !defined(GST_API_VERSION_1)) || USE(QT_MULTIMEDIA) || USE(QTKIT))
#include "FullScreenVideoQt.h"
@@ -104,7 +103,7 @@ public:
{
m_animationScheduled = true;
if (state() != QAbstractAnimation::Running)
- start();
+ QMetaObject::invokeMethod(this, "start", Qt::QueuedConnection);
}
protected:
@@ -549,7 +548,7 @@ void ChromeClientQt::setToolTip(const String &tip, TextDirection)
view->setToolTip(QString());
QToolTip::hideText();
} else {
- QString dtip = QLatin1String("<p>") + escapeHtml(tip) + QLatin1String("</p>");
+ QString dtip = QLatin1String("<p>") + QString(tip).toHtmlEscaped() + QLatin1String("</p>");
view->setToolTip(dtip);
}
#else
diff --git a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
index a2c3cb210..bcd1a18ec 100644
--- a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
@@ -372,6 +372,20 @@ void FrameLoaderClientQt::dispatchWillPerformClientRedirect(const KURL& url, dou
notImplemented();
}
+void FrameLoaderClientQt::dispatchDidNavigateWithinPage()
+{
+ if (!m_webFrame)
+ return;
+
+ FrameLoader* loader = m_frame->loader();
+ bool loaderCompleted = !(loader->activeDocumentLoader() && loader->activeDocumentLoader()->isLoadingInAPISense());
+
+ if (!loaderCompleted)
+ return;
+
+ dispatchDidCommitLoad();
+ dispatchDidFinishLoad();
+}
void FrameLoaderClientQt::dispatchDidChangeLocationWithinPage()
{
@@ -391,7 +405,7 @@ void FrameLoaderClientQt::dispatchDidPushStateWithinPage()
if (dumpFrameLoaderCallbacks)
printf("%s - dispatchDidPushStateWithinPage\n", qPrintable(drtDescriptionSuitableForTestResult(m_frame)));
- notImplemented();
+ dispatchDidNavigateWithinPage();
}
void FrameLoaderClientQt::dispatchDidReplaceStateWithinPage()
@@ -399,7 +413,7 @@ void FrameLoaderClientQt::dispatchDidReplaceStateWithinPage()
if (dumpFrameLoaderCallbacks)
printf("%s - dispatchDidReplaceStateWithinPage\n", qPrintable(drtDescriptionSuitableForTestResult(m_frame)));
- notImplemented();
+ dispatchDidNavigateWithinPage();
}
void FrameLoaderClientQt::dispatchDidPopStateWithinPage()
@@ -407,7 +421,7 @@ void FrameLoaderClientQt::dispatchDidPopStateWithinPage()
if (dumpFrameLoaderCallbacks)
printf("%s - dispatchDidPopStateWithinPage\n", qPrintable(drtDescriptionSuitableForTestResult(m_frame)));
- notImplemented();
+ // No need to call dispatchDidNavigateWithinPage here, it's already been done in loadInSameDocument().
}
void FrameLoaderClientQt::dispatchWillClose()
@@ -1604,22 +1618,13 @@ PassRefPtr<Widget> FrameLoaderClientQt::createPlugin(const IntSize& pluginSize,
Vector<String> params = paramNames;
Vector<String> values = paramValues;
if (mimeType == "application/x-shockwave-flash") {
-#if HAVE(QT5)
- const bool shouldInjectWmode = true;
-#else
// Inject wmode=opaque when there is no client or the client is not a QWebView.
- QWebPageClient* client = m_webFrame->page()->d->client.get();
- const bool shouldInjectWmode = !(client && qobject_cast<QWidget*>(client->pluginParent()));
-#endif
- if (shouldInjectWmode) {
- // Inject wmode=opaque when there is no client or the client is not a QWebView.
- size_t wmodeIndex = params.find("wmode");
- if (wmodeIndex == WTF::notFound) {
- params.append("wmode");
- values.append("opaque");
- } else if (equalIgnoringCase(values[wmodeIndex], "window"))
- values[wmodeIndex] = "opaque";
- }
+ size_t wmodeIndex = params.find("wmode");
+ if (wmodeIndex == WTF::notFound) {
+ params.append("wmode");
+ values.append("opaque");
+ } else if (equalIgnoringCase(values[wmodeIndex], "window"))
+ values[wmodeIndex] = "opaque";
}
RefPtr<PluginView> pluginView = PluginView::create(m_frame, pluginSize, element, url,
diff --git a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h
index 781971d15..8d1c770c8 100644
--- a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h
+++ b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h
@@ -108,6 +108,7 @@ public:
virtual void dispatchDidReceiveServerRedirectForProvisionalLoad();
virtual void dispatchDidCancelClientRedirect();
virtual void dispatchWillPerformClientRedirect(const KURL&, double interval, double fireDate);
+ virtual void dispatchDidNavigateWithinPage() OVERRIDE;
virtual void dispatchDidChangeLocationWithinPage();
virtual void dispatchDidPushStateWithinPage();
virtual void dispatchDidReplaceStateWithinPage();
diff --git a/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp
index 20ba353bd..b6b4d70bd 100644
--- a/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.cpp
@@ -38,11 +38,7 @@
#include "qwebpage.h"
#include "qwebpage_p.h"
-#if !HAVE(QT5)
-#include <QGeoPositionInfoSource>
-#elif HAVE(QT5)
#include <QtLocation/QGeoPositionInfoSource>
-#endif
namespace WebCore {
diff --git a/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.h b/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.h
index 726be157a..2e94bdebc 100644
--- a/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.h
+++ b/Source/WebKit/qt/WebCoreSupport/GeolocationClientQt.h
@@ -31,18 +31,10 @@
#include <QObject>
#include <wtf/RefPtr.h>
-#if !HAVE(QT5)
-#include <QGeoPositionInfo>
-namespace QtMobility {
-class QGeoPositionInfoSource;
-};
-using namespace QtMobility;
-#elif HAVE(QT5)
#include <QtLocation/QGeoPositionInfo>
QT_BEGIN_NAMESPACE
class QGeoPositionInfoSource;
QT_END_NAMESPACE
-#endif
class QWebPage;
diff --git a/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp
index 990179906..0093187af 100644
--- a/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp
@@ -33,9 +33,7 @@
#endif
#if USE(3D_GRAPHICS)
-#if HAVE(QT5)
#include <QWindow>
-#endif
static void createPlatformGraphicsContext3DFromWidget(QWidget* widget, PlatformGraphicsContext3D* context,
PlatformGraphicsSurface3D* surface)
@@ -54,13 +52,8 @@ static void createPlatformGraphicsContext3DFromWidget(QWidget* widget, PlatformG
if (glWidget->isValid()) {
// Geometry can be set to zero because m_glWidget is used only for its QGLContext.
glWidget->setGeometry(0, 0, 0, 0);
-#if HAVE(QT5)
*surface = glWidget->windowHandle();
*context = glWidget->context()->contextHandle();
-#else
- *surface = glWidget;
- *context = const_cast<QGLContext*>(glWidget->context());
-#endif
} else {
delete glWidget;
glWidget = 0;
@@ -74,7 +67,6 @@ static void createPlatformGraphicsContext3DFromWidget(QWidget* widget, PlatformG
#include "texmap/TextureMapperLayer.h"
#endif
-#if HAVE(QT5)
QWindow* QWebPageClient::ownerWindow() const
{
QWidget* widget = ownerWidget();
@@ -86,7 +78,6 @@ QWindow* QWebPageClient::ownerWindow() const
return nativeParent->windowHandle();
return 0;
}
-#endif
namespace WebCore {
diff --git a/Source/WebKit/qt/WebCoreSupport/WebEventConversion.cpp b/Source/WebKit/qt/WebCoreSupport/WebEventConversion.cpp
index 0b732a4ce..222676620 100644
--- a/Source/WebKit/qt/WebCoreSupport/WebEventConversion.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/WebEventConversion.cpp
@@ -243,11 +243,9 @@ WebKitPlatformTouchEvent::WebKitPlatformTouchEvent(QTouchEvent* event)
case QEvent::TouchEnd:
m_type = PlatformEvent::TouchEnd;
break;
-#if HAVE(QT5)
case QEvent::TouchCancel:
m_type = PlatformEvent::TouchCancel;
break;
-#endif
}
const QList<QTouchEvent::TouchPoint>& points = event->touchPoints();
diff --git a/Source/WebKit/qt/declarative/declarative.pro b/Source/WebKit/qt/declarative/declarative.pro
index 737928338..04f2298d0 100644
--- a/Source/WebKit/qt/declarative/declarative.pro
+++ b/Source/WebKit/qt/declarative/declarative.pro
@@ -11,7 +11,7 @@ public_api.file = public.pri
public_api.makefile = Makefile.declarative.public
SUBDIRS += public_api
-haveQt(5):!no_webkit2 {
+!no_webkit2 {
experimental_api.file = experimental/experimental.pri
experimental_api.makefile = Makefile.declarative.experimental
SUBDIRS += experimental_api
diff --git a/Source/WebKit/qt/declarative/plugin.cpp b/Source/WebKit/qt/declarative/plugin.cpp
index 1d44be23f..db748952a 100644
--- a/Source/WebKit/qt/declarative/plugin.cpp
+++ b/Source/WebKit/qt/declarative/plugin.cpp
@@ -25,13 +25,8 @@
#include "qdeclarativewebview_p.h"
#endif
-#if (HAVE(QT5))
#include <QtQml/qqml.h>
#include <QtQml/qqmlextensionplugin.h>
-#else
-#include <QtDeclarative/qdeclarative.h>
-#include <QtDeclarative/qdeclarativeextensionplugin.h>
-#endif
#if defined(HAVE_WEBKIT2)
#include "private/qquickwebpage_p.h"
@@ -46,12 +41,8 @@
QT_BEGIN_NAMESPACE
-#if QT_VERSION >= 0x050000
class WebKitQmlPlugin : public QQmlExtensionPlugin {
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface" FILE "plugin.json")
-#else
-class WebKitQmlPlugin : public QDeclarativeExtensionPlugin {
-#endif
Q_OBJECT
public:
#if defined(HAVE_WEBKIT2)
@@ -88,7 +79,3 @@ public:
QT_END_NAMESPACE
#include "plugin.moc"
-
-#if QT_VERSION < 0x050000
-Q_EXPORT_PLUGIN2(qmlwebkitplugin, QT_PREPEND_NAMESPACE(WebKitQmlPlugin));
-#endif
diff --git a/Source/WebKit/qt/declarative/public.pri b/Source/WebKit/qt/declarative/public.pri
index 34c66399f..e5c43db06 100644
--- a/Source/WebKit/qt/declarative/public.pri
+++ b/Source/WebKit/qt/declarative/public.pri
@@ -24,9 +24,7 @@ contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols
wince*:LIBS += $$QMAKE_LIBS_GUI
-QT += webkit webkit-private
-haveQt(4): QT += declarative
-haveQt(5): QT += widgets quick quick-private
+QT += webkit webkit-private widgets quick quick-private
contains(DEFINES, HAVE_QQUICK1=1) {
SOURCES += qdeclarativewebview.cpp
diff --git a/Source/WebKit/qt/examples/platformplugin/WebPlugin.cpp b/Source/WebKit/qt/examples/platformplugin/WebPlugin.cpp
index fdd990f57..c71751177 100644
--- a/Source/WebKit/qt/examples/platformplugin/WebPlugin.cpp
+++ b/Source/WebKit/qt/examples/platformplugin/WebPlugin.cpp
@@ -314,7 +314,3 @@ QObject* WebPlugin::createExtension(Extension extension) const
return 0;
}
}
-
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
-Q_EXPORT_PLUGIN2(platformplugin, WebPlugin)
-#endif
diff --git a/Source/WebKit/qt/examples/platformplugin/WebPlugin.h b/Source/WebKit/qt/examples/platformplugin/WebPlugin.h
index de06f4a84..446d0f754 100644
--- a/Source/WebKit/qt/examples/platformplugin/WebPlugin.h
+++ b/Source/WebKit/qt/examples/platformplugin/WebPlugin.h
@@ -139,9 +139,7 @@ class WebPlugin : public QObject, public QWebKitPlatformPlugin
{
Q_OBJECT
Q_INTERFACES(QWebKitPlatformPlugin)
-#if QT_VERSION >= 0x050000
Q_PLUGIN_METADATA(IID "org.qt-project.QtWebKit.PlatformPluginInterface")
-#endif
public:
virtual bool supportsExtension(Extension extension) const;
virtual QObject* createExtension(Extension extension) const;
diff --git a/Source/WebKit/qt/examples/platformplugin/platformplugin.pro b/Source/WebKit/qt/examples/platformplugin/platformplugin.pro
index b5da71ca0..fc533d3bb 100644
--- a/Source/WebKit/qt/examples/platformplugin/platformplugin.pro
+++ b/Source/WebKit/qt/examples/platformplugin/platformplugin.pro
@@ -1,8 +1,7 @@
TEMPLATE = lib
TARGET = platformplugin
-QT += core gui
-haveQt(5): QT += widgets
+QT += core gui widgets
CONFIG += plugin
## load mobilityconfig if mobility is available
diff --git a/Source/WebKit/qt/tests/qobjectbridge/tst_qobjectbridge.cpp b/Source/WebKit/qt/tests/qobjectbridge/tst_qobjectbridge.cpp
index 291f9b294..45626d9ef 100644
--- a/Source/WebKit/qt/tests/qobjectbridge/tst_qobjectbridge.cpp
+++ b/Source/WebKit/qt/tests/qobjectbridge/tst_qobjectbridge.cpp
@@ -37,12 +37,6 @@ Q_DECLARE_METATYPE(Qt::BrushStyle)
Q_DECLARE_METATYPE(QVariantList)
Q_DECLARE_METATYPE(QVariantMap)
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
-#define OwnershipClass QWebFrame
-#else
-#define OwnershipClass QScriptEngine
-#endif
-
class MyQObject : public QObject {
Q_OBJECT
@@ -448,10 +442,6 @@ public:
{
emit mySignalWithDateTimeArg(dt);
}
- void emitMySignalWithRegexArg(QRegExp r)
- {
- emit mySignalWithRegexArg(r);
- }
public Q_SLOTS:
void mySlot()
@@ -548,12 +538,6 @@ public Q_SLOTS:
m_actuals << arg;
}
- void myOverloadedSlot(const QRegExp &arg)
- {
- m_qtFunctionInvoked = 34;
- m_actuals << arg;
- }
-
void myOverloadedSlot(const QVariant &arg)
{
m_qtFunctionInvoked = 35;
@@ -581,7 +565,6 @@ Q_SIGNALS:
void mySignalWithDoubleArg(double);
void mySignal2(bool arg = false);
void mySignalWithDateTimeArg(QDateTime);
- void mySignalWithRegexArg(QRegExp);
private:
int m_intValue;
@@ -658,6 +641,7 @@ private slots:
void qObjectWrapperWithSameIdentity();
void introspectQtMethods_data();
void introspectQtMethods();
+ void scriptablePlugin();
private:
QString evalJS(const QString& s)
@@ -1147,7 +1131,7 @@ void tst_QObjectBridge::callQtInvokable()
QString type;
QString ret = evalJS("myObject.myInvokableWithVoidStarArg(123)", type);
QCOMPARE(type, sError);
- QCOMPARE(ret, QLatin1String("TypeError: incompatible type of argument(s) in call to myInvokableWithVoidStarArg(); candidates were\n myInvokableWithVoidStarArg(void*)"));
+ QCOMPARE(ret, QLatin1String("Error: incompatible type of argument(s) in call to myInvokableWithVoidStarArg(); candidates were\n myInvokableWithVoidStarArg(void*)"));
QCOMPARE(m_myObject->qtFunctionInvoked(), -1);
}
@@ -1156,7 +1140,7 @@ void tst_QObjectBridge::callQtInvokable()
QString type;
QString ret = evalJS("myObject.myInvokableWithAmbiguousArg(123)", type);
QCOMPARE(type, sError);
- QCOMPARE(ret, QLatin1String("TypeError: ambiguous call of overloaded function myInvokableWithAmbiguousArg(); candidates were\n myInvokableWithAmbiguousArg(int)\n myInvokableWithAmbiguousArg(uint)"));
+ QCOMPARE(ret, QLatin1String("Error: ambiguous call of overloaded function myInvokableWithAmbiguousArg(); candidates were\n myInvokableWithAmbiguousArg(int)\n myInvokableWithAmbiguousArg(uint)"));
}
m_myObject->resetQtFunctionInvoked();
@@ -1385,7 +1369,7 @@ void tst_QObjectBridge::callQtInvokable()
QString type;
QString ret = evalJS("myObject.myInvokableWithIntArg()", type);
QCOMPARE(type, sError);
- QCOMPARE(ret, QLatin1String("SyntaxError: too few arguments in call to myInvokableWithIntArg(); candidates are\n myInvokableWithIntArg(int,int)\n myInvokableWithIntArg(int)"));
+ QCOMPARE(ret, QLatin1String("Error: too few arguments in call to myInvokableWithIntArg(); candidates are\n myInvokableWithIntArg(int,int)\n myInvokableWithIntArg(int)"));
}
// call function where not all types have been registered
@@ -1394,7 +1378,7 @@ void tst_QObjectBridge::callQtInvokable()
QString type;
QString ret = evalJS("myObject.myInvokableWithBrushStyleArg(0)", type);
QCOMPARE(type, sError);
- QCOMPARE(ret, QLatin1String("TypeError: cannot call myInvokableWithBrushStyleArg(): unknown type `Qt::BrushStyle'"));
+ QCOMPARE(ret, QLatin1String("Error: cannot call myInvokableWithBrushStyleArg(): unknown type `Qt::BrushStyle'"));
QCOMPARE(m_myObject->qtFunctionInvoked(), -1);
}
@@ -1404,7 +1388,7 @@ void tst_QObjectBridge::callQtInvokable()
QString type;
QString ret = evalJS("myObject.myInvokableWithQBrushArg(null)", type);
QCOMPARE(type, sError);
- QCOMPARE(ret, QLatin1String("TypeError: incompatible type of argument(s) in call to myInvokableWithQBrushArg(); candidates were\n myInvokableWithQBrushArg(QBrush)"));
+ QCOMPARE(ret, QLatin1String("Error: incompatible type of argument(s) in call to myInvokableWithQBrushArg(); candidates were\n myInvokableWithQBrushArg(QBrush)"));
QCOMPARE(m_myObject->qtFunctionInvoked(), -1);
}
}
@@ -1422,7 +1406,7 @@ void tst_QObjectBridge::connectAndDisconnect()
QCOMPARE(type, sError);
}
- evalJS("myHandler = function() { window.gotSignal = true; window.signalArgs = arguments; window.slotThisObject = this; window.signalSender = __qt_sender__; }");
+ evalJS("myHandler = function() { window.gotSignal = true; window.signalArgs = arguments; window.slotThisObject = this; }");
QCOMPARE(evalJS("myObject.mySignal.connect(myHandler)"), sUndefined);
@@ -1430,7 +1414,6 @@ void tst_QObjectBridge::connectAndDisconnect()
evalJS("myObject.mySignal()");
QCOMPARE(evalJS("gotSignal"), sTrue);
QCOMPARE(evalJS("signalArgs.length == 0"), sTrue);
- QCOMPARE(evalJS("signalSender"), evalJS("myObject"));
QCOMPARE(evalJS("slotThisObject == window"), sTrue);
evalJS("gotSignal = false");
@@ -1494,7 +1477,6 @@ void tst_QObjectBridge::connectAndDisconnect()
QCOMPARE(evalJS("gotSignal"), sTrue);
QCOMPARE(evalJS("signalArgs.length == 0"), sTrue);
QCOMPARE(evalJS("slotThisObject"), evalJS("otherObject"));
- QCOMPARE(evalJS("signalSender"), evalJS("myObject"));
QCOMPARE(evalJS("slotThisObject.name"), QLatin1String("foo"));
QCOMPARE(evalJS("myObject.mySignal.disconnect(otherObject, myHandler)"), sUndefined);
@@ -1505,7 +1487,6 @@ void tst_QObjectBridge::connectAndDisconnect()
QCOMPARE(evalJS("gotSignal"), sTrue);
QCOMPARE(evalJS("signalArgs.length == 1"), sTrue);
QCOMPARE(evalJS("slotThisObject == yetAnotherObject"), sTrue);
- QCOMPARE(evalJS("signalSender == myObject"), sTrue);
QCOMPARE(evalJS("slotThisObject.name"), QLatin1String("bar"));
QCOMPARE(evalJS("myObject.mySignal2.disconnect(yetAnotherObject, myHandler)"), sUndefined);
@@ -1515,7 +1496,6 @@ void tst_QObjectBridge::connectAndDisconnect()
QCOMPARE(evalJS("gotSignal"), sTrue);
QCOMPARE(evalJS("signalArgs.length == 1"), sTrue);
QCOMPARE(evalJS("slotThisObject == myObject"), sTrue);
- QCOMPARE(evalJS("signalSender == myObject"), sTrue);
QCOMPARE(evalJS("myObject.mySignal2.disconnect(myObject, myHandler)"), sUndefined);
// connect(obj, string)
@@ -1756,11 +1736,6 @@ void tst_QObjectBridge::overloadedSlots()
evalJS("myObject.myOverloadedSlot(new Date())");
QCOMPARE(m_myObject->qtFunctionInvoked(), 32);
- // should pick myOverloadedSlot(QRegExp)
- m_myObject->resetQtFunctionInvoked();
- evalJS("myObject.myOverloadedSlot(new RegExp())");
- QCOMPARE(m_myObject->qtFunctionInvoked(), 34);
-
// should pick myOverloadedSlot(QVariant)
/* XFAIL
m_myObject->resetQtFunctionInvoked();
@@ -1831,9 +1806,7 @@ void tst_QObjectBridge::enumerate_data()
<< "dp1" << "dp2" << "dp3"
// inherited signals and slots
<< "destroyed(QObject*)" << "destroyed()"
-#if defined(HAVE_QT5) && HAVE_QT5
<< "objectNameChanged(QString)"
-#endif
<< "deleteLater()"
// not included because it's private:
// << "_q_reregisterTimers(void*)"
@@ -1982,8 +1955,6 @@ void tst_QObjectBridge::typeConversion()
QCOMPARE(evalJS("window.__date_equals"), sTrue);
evalJS("delete window.__date_equals");
evalJS("myObject.mySignalWithDateTimeArg.disconnect(checkDate); delete checkDate;");
-
- // ### RegExps
}
class StringListTestObject : public QObject {
@@ -2000,7 +1971,7 @@ void tst_QObjectBridge::arrayObjectEnumerable()
QWebPage page;
QWebFrame* frame = page.mainFrame();
QObject* qobject = new StringListTestObject();
- frame->addToJavaScriptWindowObject("test", qobject, OwnershipClass::ScriptOwnership);
+ frame->addToJavaScriptWindowObject("test", qobject, QWebFrame::ScriptOwnership);
const QString script("var stringArray = test.stringList();"
"var result = '';"
@@ -2041,7 +2012,7 @@ void tst_QObjectBridge::ownership()
{
QWebPage page;
QWebFrame* frame = page.mainFrame();
- frame->addToJavaScriptWindowObject("test", ptr.data(), OwnershipClass::ScriptOwnership);
+ frame->addToJavaScriptWindowObject("test", ptr.data(), QWebFrame::ScriptOwnership);
}
QVERIFY(!ptr);
}
@@ -2052,7 +2023,7 @@ void tst_QObjectBridge::ownership()
{
QWebPage page;
QWebFrame* frame = page.mainFrame();
- frame->addToJavaScriptWindowObject("test", ptr.data(), OwnershipClass::QtOwnership);
+ frame->addToJavaScriptWindowObject("test", ptr.data(), QWebFrame::QtOwnership);
}
QVERIFY(ptr.data() == before);
delete ptr.data();
@@ -2062,7 +2033,7 @@ void tst_QObjectBridge::ownership()
QObject* child = new QObject(parent);
QWebPage page;
QWebFrame* frame = page.mainFrame();
- frame->addToJavaScriptWindowObject("test", child, OwnershipClass::QtOwnership);
+ frame->addToJavaScriptWindowObject("test", child, QWebFrame::QtOwnership);
QVariant v = frame->evaluateJavaScript("test");
QCOMPARE(qvariant_cast<QObject*>(v), child);
delete parent;
@@ -2075,7 +2046,7 @@ void tst_QObjectBridge::ownership()
{
QWebPage page;
QWebFrame* frame = page.mainFrame();
- frame->addToJavaScriptWindowObject("test", ptr.data(), OwnershipClass::AutoOwnership);
+ frame->addToJavaScriptWindowObject("test", ptr.data(), QWebFrame::AutoOwnership);
}
// no parent, so it should be like ScriptOwnership
QVERIFY(!ptr);
@@ -2087,7 +2058,7 @@ void tst_QObjectBridge::ownership()
{
QWebPage page;
QWebFrame* frame = page.mainFrame();
- frame->addToJavaScriptWindowObject("test", child.data(), OwnershipClass::AutoOwnership);
+ frame->addToJavaScriptWindowObject("test", child.data(), QWebFrame::AutoOwnership);
}
// has parent, so it should be like QtOwnership
QVERIFY(child);
@@ -2129,7 +2100,7 @@ void tst_QObjectBridge::qObjectWrapperWithSameIdentity()
QWebFrame* mainFrame = m_view->page()->mainFrame();
QCOMPARE(mainFrame->toPlainText(), QString("test"));
- mainFrame->addToJavaScriptWindowObject("test", new TestFactory, OwnershipClass::ScriptOwnership);
+ mainFrame->addToJavaScriptWindowObject("test", new TestFactory, QWebFrame::ScriptOwnership);
mainFrame->evaluateJavaScript("triggerBug();");
QCOMPARE(mainFrame->toPlainText(), QString("test1"));
@@ -2189,5 +2160,47 @@ void tst_QObjectBridge::webElementSlotOnly()
QCOMPARE(evalJS("myWebElementSlotObject.tagName"), QString("BODY"));
}
+class TestPluginWidget : public QWidget {
+ Q_OBJECT
+public:
+ TestPluginWidget() { }
+
+public slots:
+ int slotWithReturnValue() { return 42; }
+};
+
+class TestWebPage : public QWebPage {
+ Q_OBJECT
+public:
+ TestWebPage(QObject* parent = 0)
+ : QWebPage(parent)
+ , creationCount(0)
+ { }
+
+ int creationCount;
+
+protected:
+ virtual QObject* createPlugin(const QString&, const QUrl&, const QStringList&, const QStringList&)
+ {
+ creationCount++;
+ return new TestPluginWidget;
+ }
+};
+
+void tst_QObjectBridge::scriptablePlugin()
+{
+ QWebView view;
+ TestWebPage* page = new TestWebPage;
+ view.setPage(page);
+ page->setParent(&view);
+ view.settings()->setAttribute(QWebSettings::PluginsEnabled, true);
+
+ page->mainFrame()->setHtml("<object width=100 height=100 type=\"application/x-qt-plugin\"></object>");
+ QCOMPARE(page->creationCount, 1);
+
+ QVariant result = page->mainFrame()->evaluateJavaScript("document.querySelector(\"object\").slotWithReturnValue()");
+ QCOMPARE(result.toString(), QLatin1String("42"));
+}
+
QTEST_MAIN(tst_QObjectBridge)
#include "tst_qobjectbridge.moc"
diff --git a/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
index 31d87b75a..d7db84726 100644
--- a/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
+++ b/Source/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
@@ -90,6 +90,7 @@ private slots:
void setUrlToEmpty();
void setUrlToInvalid();
void setUrlHistory();
+ void setUrlUsingStateObject();
void setUrlSameUrl();
void setUrlThenLoads_data();
void setUrlThenLoads();
@@ -1309,6 +1310,48 @@ void tst_QWebFrame::setUrlHistory()
QCOMPARE(m_page->history()->count(), 2);
}
+void tst_QWebFrame::setUrlUsingStateObject()
+{
+ const QUrl aboutBlank("about:blank");
+ QUrl url;
+ QWebFrame* frame = m_page->mainFrame();
+ QSignalSpy urlChangedSpy(frame, SIGNAL(urlChanged(QUrl)));
+ int expectedUrlChangeCount = 0;
+
+ QCOMPARE(m_page->history()->count(), 0);
+
+ url = QUrl("qrc:/test1.html");
+ frame->setUrl(url);
+ waitForSignal(m_page, SIGNAL(loadFinished(bool)));
+ expectedUrlChangeCount++;
+ QCOMPARE(urlChangedSpy.count(), expectedUrlChangeCount);
+ QCOMPARE(frame->url(), url);
+ QCOMPARE(m_page->history()->count(), 1);
+
+ frame->evaluateJavaScript("window.history.pushState(null,'push', 'navigate/to/here')");
+ expectedUrlChangeCount++;
+ QCOMPARE(urlChangedSpy.count(), expectedUrlChangeCount);
+ QCOMPARE(frame->url(), QUrl("qrc:/navigate/to/here"));
+ QCOMPARE(m_page->history()->count(), 2);
+ QVERIFY(m_page->history()->canGoBack());
+
+ frame->evaluateJavaScript("window.history.replaceState(null,'replace', 'another/location')");
+ expectedUrlChangeCount++;
+ QCOMPARE(urlChangedSpy.count(), expectedUrlChangeCount);
+ QCOMPARE(frame->url(), QUrl("qrc:/navigate/to/another/location"));
+ QCOMPARE(m_page->history()->count(), 2);
+ QVERIFY(!m_page->history()->canGoForward());
+ QVERIFY(m_page->history()->canGoBack());
+
+ frame->evaluateJavaScript("window.history.back()");
+ QTest::qWait(100);
+ expectedUrlChangeCount++;
+ QCOMPARE(urlChangedSpy.count(), expectedUrlChangeCount);
+ QCOMPARE(frame->url(), QUrl("qrc:/test1.html"));
+ QVERIFY(m_page->history()->canGoForward());
+ QVERIFY(!m_page->history()->canGoBack());
+}
+
void tst_QWebFrame::setUrlSameUrl()
{
const QUrl url1("qrc:/test1.html");
diff --git a/Source/WebKit/qt/tests/tests.pri b/Source/WebKit/qt/tests/tests.pri
index 90c61f093..5437baacc 100644
--- a/Source/WebKit/qt/tests/tests.pri
+++ b/Source/WebKit/qt/tests/tests.pri
@@ -16,10 +16,7 @@ INCLUDEPATH += \
$$PWD \
$$PWD/../Api
-QT += testlib network webkit
-haveQt(5): QT += widgets
-
-haveQt(4): haveQtModule(declarative): QT += declarative
+QT += testlib network webkit widgets
# This define is used by some tests to look up resources in the source tree
DEFINES += TESTS_SOURCE_DIR=\\\"$$PWD/\\\"
diff --git a/Source/WebKit/qt/tests/util.h b/Source/WebKit/qt/tests/util.h
index cfa22eb08..2869440cb 100644
--- a/Source/WebKit/qt/tests/util.h
+++ b/Source/WebKit/qt/tests/util.h
@@ -53,37 +53,4 @@ static bool waitForSignal(QObject* obj, const char* signal, int timeout = 10000)
return timeoutSpy.isEmpty();
}
-#if !(defined(HAVE_QT5) && HAVE_QT5)
-// Will try to wait for the condition while allowing event processing
-#define QTRY_VERIFY(__expr) \
- do { \
- const int __step = 50; \
- const int __timeout = 5000; \
- if (!(__expr)) { \
- QTest::qWait(0); \
- } \
- for (int __i = 0; __i < __timeout && !(__expr); __i+=__step) { \
- QTest::qWait(__step); \
- } \
- QVERIFY(__expr); \
- } while(0)
-
-// Will try to wait for the condition while allowing event processing
-#define QTRY_COMPARE(__expr, __expected) \
- do { \
- const int __step = 50; \
- const int __timeout = 5000; \
- if ((__expr) != (__expected)) { \
- QTest::qWait(0); \
- } \
- for (int __i = 0; __i < __timeout && ((__expr) != (__expected)); __i+=__step) { \
- QTest::qWait(__step); \
- } \
- QCOMPARE(__expr, __expected); \
- } while(0)
-
-// Compatibility for Qt5
-#define W_QSKIP(a, b) QSKIP(a, b)
-#else
#define W_QSKIP(a, b) QSKIP(a)
-#endif