From 93f9eed62db271ae4b8896f48df72a956f3ce7be Mon Sep 17 00:00:00 2001 From: Viktor Engelmann Date: Mon, 13 Mar 2017 14:30:02 +0100 Subject: Store Target URL in WebContentsDelegateQt::WebContentsCreated When opening a new window, for example by using the JavaScript method window.open('...'), the requested url is not stored in the content::WebContents object we get in WebContentsDelegateQt::createWindow (at this point, it should at least be stored as pending request in the WebContents' NavigationController, but it is not). Because of this, the QQuickWebEngineNewViewRequest object in QQuickWebEngineViewPrivate::adoptNewWindow never contained the url. We have access to the target url in WebContentsDelegateQt::WebContentsCreated, so now we store it there in a new property m_initialTargetUrl, from where WebContentsDelegateQt::createWindow takes it and passes it to WebContentsAdapter::adoptNewWindow as a new parameter. [ChangeLog][WebEngine] Fix WebEngineNewViewRequest::requestedUrl being empty when opening window from JavaScript Task-number: QTBUG-57675 Change-Id: I7e2c7866899baade17ce2517e6be8b2b2709699e Reviewed-by: Allan Sandfeld Jensen --- src/webengine/api/qquickwebengineview.cpp | 5 ++--- src/webengine/api/qquickwebengineview_p_p.h | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'src/webengine') diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index be86f5daf..cd734f971 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -586,7 +586,7 @@ void QQuickWebEngineViewPrivate::unhandledKeyEvent(QKeyEvent *event) q->window()->sendEvent(q->parentItem(), event); } -void QQuickWebEngineViewPrivate::adoptNewWindow(QSharedPointer newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &) +void QQuickWebEngineViewPrivate::adoptNewWindow(QSharedPointer newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &, const QUrl &targetUrl) { Q_Q(QQuickWebEngineView); QQuickWebEngineNewViewRequest request; @@ -594,8 +594,7 @@ void QQuickWebEngineViewPrivate::adoptNewWindow(QSharedPointerrequestedUrl(); + request.m_requestedUrl = targetUrl; switch (disposition) { case WebContentsAdapterClient::NewForegroundTabDisposition: diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h index 2ecd70d78..64c63f31a 100644 --- a/src/webengine/api/qquickwebengineview_p_p.h +++ b/src/webengine/api/qquickwebengineview_p_p.h @@ -107,7 +107,7 @@ public: virtual void loadFinished(bool success, const QUrl &url, bool isErrorPage = false, int errorCode = 0, const QString &errorDescription = QString()) Q_DECL_OVERRIDE; virtual void focusContainer() Q_DECL_OVERRIDE; virtual void unhandledKeyEvent(QKeyEvent *event) Q_DECL_OVERRIDE; - virtual void adoptNewWindow(QSharedPointer newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &) Q_DECL_OVERRIDE; + virtual void adoptNewWindow(QSharedPointer newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &, const QUrl &targetUrl) Q_DECL_OVERRIDE; virtual bool isBeingAdopted() Q_DECL_OVERRIDE; virtual void close() Q_DECL_OVERRIDE; virtual void windowCloseRejected() Q_DECL_OVERRIDE; -- cgit v1.2.3 From 532cc891fdad5e329bb31724f527bfba1e2e8a44 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 29 May 2017 13:19:03 +0200 Subject: Override shortcuts only when an HTML input field has focus Otherwise an application shortcut like Shift+Delete would no longer work when webengine has focus (e.g. "delete mail" in KMail) This removes unconditional calls to editorActionForKeyEvent for ShortcutOverride event handling. We can remove those, because the key sequences that are checked by editorActionForKeyEvent are a subset of the key sequences checked by isCommonTextEditShortcut. This amends commit 3902b27e. Change-Id: I12a98368381edef36f11457c8b864d843efb871a Reviewed-by: David Faure Reviewed-by: Alexandru Croitor --- src/webengine/render_widget_host_view_qt_delegate_quick.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src/webengine') diff --git a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp index 749a2e0d8..b6069d519 100644 --- a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp +++ b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp @@ -240,14 +240,8 @@ void RenderWidgetHostViewQtDelegateQuick::inputMethodStateChanged(bool editorVis bool RenderWidgetHostViewQtDelegateQuick::event(QEvent *event) { - if (event->type() == QEvent::ShortcutOverride) { - QKeyEvent *keyEvent = static_cast(event); - if (m_client->handleShortcutOverrideEvent(keyEvent)) - return true; - if (editorActionForKeyEvent(keyEvent) != QQuickWebEngineView::NoWebAction) - event->accept(); - return true; - } + if (event->type() == QEvent::ShortcutOverride) + return m_client->handleShortcutOverrideEvent(static_cast(event)); if (event->type() == QEvent::NativeGesture) return m_client->forwardEvent(event); -- cgit v1.2.3 From 0c3542eb5e15013e1cece77acb7f1c69ba534891 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 19 Jun 2017 13:10:53 +0200 Subject: Avoid using string constructor of QJSValue for byte-array We were returning the PDF byte-data as a javascript unicode string using the deprecated ascii cast constructor. This patch changes the behavior to match that of runJavaScript callbacks and uses a script value over QVariant. [ChangeLog][QtWebEngine] The callback version of WebEngineView::printToPdf is now called with a proper bytearray result instead of PDF byte data in a javascript string. Change-Id: I71565623465c54052568bb5ff34665baaa93e187 Reviewed-by: Michal Klocek --- src/webengine/api/qquickwebengineview.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/webengine') diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index cd734f971..8021d0a1e 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -1097,9 +1097,10 @@ void QQuickWebEngineViewPrivate::didFindText(quint64 requestId, int matchCount) void QQuickWebEngineViewPrivate::didPrintPage(quint64 requestId, const QByteArray &result) { + Q_Q(QQuickWebEngineView); QJSValue callback = m_callbacks.take(requestId); QJSValueList args; - args.append(QJSValue(result.data())); + args.append(qmlEngine(q)->toScriptValue(result)); callback.call(args); } -- cgit v1.2.3 From 897d7d57d8d1b7a2aadb38294287d61816d5ba19 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 19 Jun 2017 13:46:35 +0200 Subject: Mention Visual Studio 2017 as supported Change-Id: Ice02dffc1db2f263c156f855c1f6f64713c6935d Reviewed-by: Joerg Bornemann --- src/webengine/doc/src/qtwebengine-platform-notes.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/webengine') diff --git a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc index 2eeda6e8a..ec678672c 100644 --- a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc +++ b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc @@ -69,7 +69,7 @@ \section2 Windows - On Windows, Visual Studio 2015 and Windows 10 SDK are required. + On Windows, Visual Studio 2015 or 2017 and Windows 10 SDK are required. \section2 Linux -- cgit v1.2.3 From 0a6707ac82b9a8bd3a810035ecd8db2269352b59 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 19 Jun 2017 16:04:54 +0200 Subject: Fix crash when accessibility is disabled With the no-accessibility feature moved to qtgui-config, we don't always include it where web_content_apapter_client.h is included, which gives it an inconsistent binary layout. Solve it by making the optional method always defined as it doesn't rely on anything from accessibility. Task-number: QTBUG-61200 Change-Id: I65f34ab2b6763f3166b945e700994bd8d019a835 Reviewed-by: Alexandru Croitor --- src/webengine/api/qquickwebengineview.cpp | 2 -- src/webengine/api/qquickwebengineview_p_p.h | 2 -- 2 files changed, 4 deletions(-) (limited to 'src/webengine') diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index cd734f971..22ff13d48 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -710,13 +710,11 @@ void QQuickWebEngineViewPrivate::runMouseLockPermissionRequest(const QUrl &secur adapter->grantMouseLockPermission(false); } -#ifndef QT_NO_ACCESSIBILITY QObject *QQuickWebEngineViewPrivate::accessibilityParentObject() { Q_Q(QQuickWebEngineView); return q; } -#endif // QT_NO_ACCESSIBILITY QSharedPointer QQuickWebEngineViewPrivate::browserContextAdapter() { diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h index 64c63f31a..19ecf5e1f 100644 --- a/src/webengine/api/qquickwebengineview_p_p.h +++ b/src/webengine/api/qquickwebengineview_p_p.h @@ -129,9 +129,7 @@ public: virtual void authenticationRequired(QSharedPointer) Q_DECL_OVERRIDE; virtual void runMediaAccessPermissionRequest(const QUrl &securityOrigin, MediaRequestFlags requestFlags) Q_DECL_OVERRIDE; virtual void runMouseLockPermissionRequest(const QUrl &securityOrigin) Q_DECL_OVERRIDE; -#ifndef QT_NO_ACCESSIBILITY virtual QObject *accessibilityParentObject() Q_DECL_OVERRIDE; -#endif // QT_NO_ACCESSIBILITY virtual QtWebEngineCore::WebEngineSettings *webEngineSettings() const Q_DECL_OVERRIDE; virtual void allowCertificateError(const QSharedPointer &errorController) Q_DECL_OVERRIDE; virtual void runGeolocationPermissionRequest(QUrl const&) Q_DECL_OVERRIDE; -- cgit v1.2.3