From 29ad7a1476a4aab77477e59b0bba538a8371b264 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Mon, 21 Mar 2016 15:18:27 +0100 Subject: Doc: Attribute, not flag, can be used for initialization The Qt::AA_ShareOpenGLContexts attribute can be used to set up an OpenGL Context, instead of passing it in the constructor. Task-number: QTBUG-51379 Change-Id: I46bcb07fc69c0b8e7ac9bf632d328c15dca2ea45 Reviewed-by: Kai Koehne --- src/webengine/api/qtwebengineglobal.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/webengine/api/qtwebengineglobal.cpp b/src/webengine/api/qtwebengineglobal.cpp index 8efbc3799..c392a3c0b 100644 --- a/src/webengine/api/qtwebengineglobal.cpp +++ b/src/webengine/api/qtwebengineglobal.cpp @@ -62,8 +62,9 @@ namespace QtWebEngine { Sets up an OpenGL Context that can be shared between processes. This has to be done after QGuiApplication is created, but before a Qt Quick window is created. - This has the same effect as passing Qt::AA_ShareOpenGLContexts to the QGuiApplication - constructor. + This has the same effect as setting the Qt::AA_ShareOpenGLContexts + attribute with QCoreApplication::setAttribute before constructing + QGuiApplication. */ void initialize() { -- cgit v1.2.3 From b73cdfeb33459b06e26bd9137e0f1803cb30556c Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 18 Mar 2016 16:01:52 +0100 Subject: Set CFBundleIdentifier for QtWebEngineProcess to a proper value. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When QtWebEngineProcess bundle is created, the generated Info.plist CFBundleIdentifier contains the default dummy prefix added by qmake, namely: "com.yourcompany.QtWebEngineProcess". Make sure it uses the proper "org.qt-project.Qt" prefix. Change-Id: I8e060aeeeb8a53980139e790d3e3947752ffa1d3 Task-number: QTBUG-51942 Reviewed-by: Michael BrĂ¼ning --- src/process/Info_mac.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/process/Info_mac.plist b/src/process/Info_mac.plist index de1d010bc..dcadc2e8f 100644 --- a/src/process/Info_mac.plist +++ b/src/process/Info_mac.plist @@ -15,7 +15,7 @@ CFBundleExecutable @EXECUTABLE@ CFBundleIdentifier - @BUNDLEIDENTIFIER@ + org.qt-project.Qt.QtWebEngineProcess LSUIElement 1 -- cgit v1.2.3 From f62f223b28989ee827f26969274f544c8e7d3e97 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Wed, 2 Mar 2016 11:22:11 +0100 Subject: Doc: Quote example code from the Minimal example Change-Id: I0050a0090e4e0877dc56b8c529d9cbb77a0cdd33 Reviewed-by: Kai Koehne --- src/webengine/doc/src/qtwebengine-overview.qdoc | 35 +++++-------------------- src/webengine/doc/src/webengineview.qdoc | 35 +++++-------------------- 2 files changed, 12 insertions(+), 58 deletions(-) (limited to 'src') diff --git a/src/webengine/doc/src/qtwebengine-overview.qdoc b/src/webengine/doc/src/qtwebengine-overview.qdoc index 9dc78a736..6ec345cb0 100644 --- a/src/webengine/doc/src/qtwebengine-overview.qdoc +++ b/src/webengine/doc/src/qtwebengine-overview.qdoc @@ -164,19 +164,9 @@ engine must be initialized by using \l QtWebEngine::initialize in the application main source file, as illustrated by the following code snippet: - \code - int main(int argc, char **argv) - { - Application app(argc, argv); - - QtWebEngine::initialize(); - - QQmlApplicationEngine appEngine; - appEngine.load(QUrl("qrc:/main.qml")); - - return app.exec(); - } - \endcode + \quotefromfile webengine/minimal/main.cpp + \skipto main + \printuntil } An application can load pages into the WebEngineView, using either an URL or HTML string, and navigate within session history. By default, links to different pages load within the same @@ -186,22 +176,9 @@ The following sample QML application loads a web page using the \l{WebEngineView::}{url} property: - \qml - import QtQuick 2.1 - import QtQuick.Controls 1.1 - import QtWebEngine 1.1 - - ApplicationWindow { - width: 1280 - height: 720 - visible: true - WebEngineView { - id: webview - url: "http://www.qt.io" - anchors.fill: parent - } - } - \endqml + \quotefromfile webengine/minimal/main.qml + \skipto import + \printuntil /^\}/ \section1 Managing Certificates diff --git a/src/webengine/doc/src/webengineview.qdoc b/src/webengine/doc/src/webengineview.qdoc index fc21480ad..d2dc627a3 100644 --- a/src/webengine/doc/src/webengineview.qdoc +++ b/src/webengine/doc/src/webengineview.qdoc @@ -40,19 +40,9 @@ \l QtWebEngine::initialize in the application main source file, as illustrated by the following code snippet: - \code - int main(int argc, char **argv) - { - Application app(argc, argv); - - QtWebEngine::initialize(); - - QQmlApplicationEngine appEngine; - appEngine.load(QUrl("qrc:/main.qml")); - - return app.exec(); - } - \endcode + \quotefromfile webengine/minimal/main.cpp + \skipto main + \printuntil } \section2 Loading Web Pages @@ -62,22 +52,9 @@ The following sample QML application loads a web page using the \c url property: - \qml - import QtQuick 2.1 - import QtQuick.Controls 1.1 - import QtWebEngine 1.1 - - ApplicationWindow { - width: 1280 - height: 720 - visible: true - WebEngineView { - id: webview - url: "http://www.qt.io" - anchors.fill: parent - } - } - \endqml + \quotefromfile webengine/minimal/main.qml + \skipto import + \printuntil /^\}/ The \l loadingChanged() signal is emitted when loading a page begins, ends, or fails. The \l loading property holds whether the HTML page is currently loading and the load status is -- cgit v1.2.3 From fab5cff1171de54f43d9ab57ed16f8d0f85b433e Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Tue, 1 Mar 2016 16:21:49 +0100 Subject: Doc: Improve docs for the zoomFactor property In the WebEngineView type and QWebEnginePage and QWebEngineView docs. Change-Id: Ibbabcf6cc38a48fb14abb105f5fda4c03a89ccba Reviewed-by: Kai Koehne --- src/webengine/doc/src/webengineview.qdoc | 2 +- src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc | 6 ++++-- src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/webengine/doc/src/webengineview.qdoc b/src/webengine/doc/src/webengineview.qdoc index d2dc627a3..da0df4d9e 100644 --- a/src/webengine/doc/src/webengineview.qdoc +++ b/src/webengine/doc/src/webengineview.qdoc @@ -62,7 +62,7 @@ The title of an HTML page can be accessed with the \l title property. Additionally, a web page may specify an icon, which can be accessed using the \l icon property. The \l zoomFactor - property holds the overall size of the contents of the web page. + property enables zooming the contents of the web page by a scale factor. If a certificate error is raised while loading a web page, the \l certificateError() signal is emitted. Certificate errors are handled by using the methods of the WebEngineCertificateError diff --git a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc index 508c9f861..9be4a25e7 100644 --- a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc +++ b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc @@ -52,8 +52,8 @@ Additionally, a page may also specify an icon, which can be accessed using the iconUrl() property. If the title or the icon changes, the corresponding titleChanged() and iconUrlChanged() signals will be emitted. - The zoomFactor() property can be used to change the overall size - of the content displayed in the page. + The zoomFactor() property enables zooming the contents of the web page by a + scale factor. The loadStarted() signal is emitted when the page begins to load, whereas the loadProgress() signal is emitted whenever an element of the web page completes loading, such as an embedded @@ -627,6 +627,8 @@ /*! \property QWebEnginePage::zoomFactor \brief the zoom factor for the page content + + Valid values are within the range from \c{0.25} to \c{5.0}. The default factor is \c{1.0}. */ /*! diff --git a/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc index d7ecdb246..976a1a924 100644 --- a/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc +++ b/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc @@ -59,7 +59,7 @@ Additionally, a web site may specify an icon, which can be accessed using the iconUrl() property. If the title or the icon changes, the corresponding titleChanged() and iconUrlChanged() signals will be emitted. The - zoomFactor() property can be used to change the overall size of the contents of the web view. + zoomFactor() property enables zooming the contents of the web page by a scale factor. If you require a custom context menu, you can implement it by reimplementing \l{QWidget::}{contextMenuEvent()} and populating your QMenu with the actions @@ -231,6 +231,8 @@ /*! \property QWebEngineView::zoomFactor \brief the zoom factor for the view + + Valid values are within the range from \c{0.25} to \c{5.0}. The default factor is \c{1.0}. */ /*! -- cgit v1.2.3 From 9cdd03b44a09b6b40656d4a494f58384007d8aac Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 1 Mar 2016 14:16:05 +0100 Subject: Fix crash when link opens a modal QDialog, using the trackpad. When a QWebEngine link is clicked on, and as a result a modal dialog is opened, a QEvent::TouchCancel without any touch points is forwarded to Chromium, which tries to access the first touch point position, and causes a QList assertion. Fix consists of two parts: 1) Make sure that no TouchCancel is forwarded, in case if no TouchBegin or TouchUpdate was issued beforehand. 2) Because QEvent::TouchCancel events might contain an empty touch point list, and Chromium expects at least one point, make sure to forward the last saved touch points (saved in previous TouchUpdate) together with the TouchCancel. Task-number: QTBUG-48661 Change-Id: I1eeb2980417b1b04e8387dc9f82f935ef2bd8f00 Reviewed-by: Joerg Bornemann --- src/core/render_widget_host_view_qt.cpp | 53 ++++++++++++++++++++++++++++----- src/core/render_widget_host_view_qt.h | 3 ++ 2 files changed, 48 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index b15aa94ef..500a94659 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -249,6 +249,7 @@ RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost* widget : m_host(content::RenderWidgetHostImpl::From(widget)) , m_gestureProvider(QtGestureProviderConfig(), this) , m_sendMotionActionDown(false) + , m_touchMotionStarted(false) , m_chromiumCompositorData(new ChromiumCompositorData) , m_needsDelegatedFrameAck(false) , m_didFirstVisuallyNonEmptyLayout(false) @@ -1009,6 +1010,12 @@ void RenderWidgetHostViewQt::handleWheelEvent(QWheelEvent *ev) m_host->ForwardWheelEvent(WebEventFactory::toWebWheelEvent(ev, dpiScale())); } +void RenderWidgetHostViewQt::clearPreviousTouchMotionState() +{ + m_previousTouchPoints.clear(); + m_touchMotionStarted = false; +} + void RenderWidgetHostViewQt::handleTouchEvent(QTouchEvent *ev) { // Chromium expects the touch event timestamps to be comparable to base::TimeTicks::Now(). @@ -1023,19 +1030,46 @@ void RenderWidgetHostViewQt::handleTouchEvent(QTouchEvent *ev) QList touchPoints = mapTouchPointIds(ev->touchPoints()); - if (ev->type() == QEvent::TouchCancel) { - MotionEventQt cancelEvent(touchPoints, eventTimestamp, ui::MotionEvent::ACTION_CANCEL, ev->modifiers(), dpiScale()); + switch (ev->type()) { + case QEvent::TouchBegin: + m_sendMotionActionDown = true; + m_touchMotionStarted = true; + break; + case QEvent::TouchUpdate: + m_touchMotionStarted = true; + break; + case QEvent::TouchCancel: + { + // Don't process a TouchCancel event if no motion was started beforehand, or if there are + // no touch points in the current event or in the previously processed event. + if (!m_touchMotionStarted || (touchPoints.isEmpty() && m_previousTouchPoints.isEmpty())) { + clearPreviousTouchMotionState(); + return; + } + + // Use last saved touch points for the cancel event, to get rid of a QList assert, + // because Chromium expects a MotionEvent::ACTION_CANCEL instance to contain at least + // one touch point, whereas a QTouchCancel may not contain any touch points at all. + if (touchPoints.isEmpty()) + touchPoints = m_previousTouchPoints; + clearPreviousTouchMotionState(); + MotionEventQt cancelEvent(touchPoints, eventTimestamp, ui::MotionEvent::ACTION_CANCEL, + ev->modifiers(), dpiScale()); processMotionEvent(cancelEvent); return; } - - if (ev->type() == QEvent::TouchBegin) - m_sendMotionActionDown = true; + case QEvent::TouchEnd: + clearPreviousTouchMotionState(); + break; + default: + break; + } // Make sure that ACTION_POINTER_DOWN is delivered before ACTION_MOVE, // and ACTION_MOVE before ACTION_POINTER_UP. std::sort(touchPoints.begin(), touchPoints.end(), compareTouchPoints); + m_previousTouchPoints = touchPoints; for (int i = 0; i < touchPoints.size(); ++i) { ui::MotionEvent::Action action; switch (touchPoints[i].state()) { @@ -1043,21 +1077,24 @@ void RenderWidgetHostViewQt::handleTouchEvent(QTouchEvent *ev) if (m_sendMotionActionDown) { action = ui::MotionEvent::ACTION_DOWN; m_sendMotionActionDown = false; - } else + } else { action = ui::MotionEvent::ACTION_POINTER_DOWN; + } break; case Qt::TouchPointMoved: action = ui::MotionEvent::ACTION_MOVE; break; case Qt::TouchPointReleased: - action = touchPoints.size() > 1 ? ui::MotionEvent::ACTION_POINTER_UP : ui::MotionEvent::ACTION_UP; + action = touchPoints.size() > 1 ? ui::MotionEvent::ACTION_POINTER_UP : + ui::MotionEvent::ACTION_UP; break; default: // Ignore Qt::TouchPointStationary continue; } - MotionEventQt motionEvent(touchPoints, eventTimestamp, action, ev->modifiers(), dpiScale(), i); + MotionEventQt motionEvent(touchPoints, eventTimestamp, action, ev->modifiers(), dpiScale(), + i); processMotionEvent(motionEvent); } } diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h index 7c4723f0e..2a56f61a4 100644 --- a/src/core/render_widget_host_view_qt.h +++ b/src/core/render_widget_host_view_qt.h @@ -205,6 +205,7 @@ public: private: void sendDelegatedFrameAck(); void processMotionEvent(const ui::MotionEvent &motionEvent); + void clearPreviousTouchMotionState(); QList mapTouchPointIds(const QList &inputPoints); float dpiScale() const; @@ -214,7 +215,9 @@ private: ui::FilteredGestureProvider m_gestureProvider; base::TimeDelta m_eventsToNowDelta; bool m_sendMotionActionDown; + bool m_touchMotionStarted; QMap m_touchIdMapping; + QList m_previousTouchPoints; scoped_ptr m_delegate; QExplicitlySharedDataPointer m_chromiumCompositorData; -- cgit v1.2.3 From 8d693999de529a0a65305019778f259d9df8b5da Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 18 Mar 2016 17:13:22 +0100 Subject: Stop using QT_PRIVATE for QtWebEngineProcess in a non-framework build. For executables, QT and QT_PRIVATE are the same. Change-Id: I8f8ef29aea6f4ebb3d7b6cd2f3bc6a3cbf83b0e4 Reviewed-by: Joerg Bornemann --- src/process/process.pro | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/process/process.pro b/src/process/process.pro index eab11189e..5dc34884a 100644 --- a/src/process/process.pro +++ b/src/process/process.pro @@ -4,19 +4,17 @@ TEMPLATE = app # Needed to set LSUIElement=1 QMAKE_INFO_PLIST = Info_mac.plist +QT += webenginecore + load(qt_build_paths) contains(QT_CONFIG, qt_framework) { # Deploy the QtWebEngineProcess app bundle into the QtWebEngineCore framework. DESTDIR = $$MODULE_BASE_OUTDIR/lib/QtWebEngineCore.framework/Versions/5/Helpers - - QT += webenginecore QMAKE_RPATHDIR += @loader_path/../../../../../../../../Frameworks } else { CONFIG -= app_bundle win32: DESTDIR = $$MODULE_BASE_OUTDIR/bin else: DESTDIR = $$MODULE_BASE_OUTDIR/libexec - - QT_PRIVATE += webenginecore } msvc: QMAKE_LFLAGS *= /LARGEADDRESSAWARE -- cgit v1.2.3 From f1e764039fd701e4abc71b44f592e166222a3e3c Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 3 Mar 2016 10:03:10 +0100 Subject: Use qt_app -> relative_qt_rpath for QtWebEngineProcess. Use CONFIG+=relative_qt_rpath to make sure the web engine process contains a relative rpath instead of an absolute path rpath value. Change-Id: I5f3c9fb93273c41bed795aeba112f260382d2bf8 Task-number: QTBUG-50155 Reviewed-by: Jake Petroules Reviewed-by: Oswald Buddenhagen --- src/process/process.pro | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/process/process.pro b/src/process/process.pro index 5dc34884a..cdda429e7 100644 --- a/src/process/process.pro +++ b/src/process/process.pro @@ -1,36 +1,33 @@ TARGET = $$QTWEBENGINEPROCESS_NAME -TEMPLATE = app -!build_pass:contains(QT_CONFIG, debug_and_release):contains(QT_CONFIG, build_all): CONFIG += release + # Needed to set LSUIElement=1 QMAKE_INFO_PLIST = Info_mac.plist QT += webenginecore -load(qt_build_paths) +INCLUDEPATH += ../core + +SOURCES = main.cpp + +win32 { + SOURCES += \ + support_win.cpp +} + +load(qt_app) + contains(QT_CONFIG, qt_framework) { # Deploy the QtWebEngineProcess app bundle into the QtWebEngineCore framework. DESTDIR = $$MODULE_BASE_OUTDIR/lib/QtWebEngineCore.framework/Versions/5/Helpers - QMAKE_RPATHDIR += @loader_path/../../../../../../../../Frameworks } else { CONFIG -= app_bundle win32: DESTDIR = $$MODULE_BASE_OUTDIR/bin else: DESTDIR = $$MODULE_BASE_OUTDIR/libexec } - msvc: QMAKE_LFLAGS *= /LARGEADDRESSAWARE -INCLUDEPATH += ../core - -SOURCES = main.cpp - -win32 { - SOURCES += \ - support_win.cpp -} - contains(QT_CONFIG, qt_framework) { target.path = $$[QT_INSTALL_LIBS]/QtWebEngineCore.framework/Versions/5/Helpers } else { target.path = $$[QT_INSTALL_LIBEXECS] } -INSTALLS += target -- cgit v1.2.3 From 963f90b7a07236d81d7bb65798c641556501ab10 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Wed, 2 Mar 2016 13:21:18 +0100 Subject: Doc: Restructure paragraph about loading pages Describe the "loading" property first and remove the "LoadStatus" enumeration. Change-Id: I2357c604197c305e9cd2d3ff7dd322949b1b9e4b Reviewed-by: Kai Koehne --- src/webengine/doc/src/webengineview.qdoc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/webengine/doc/src/webengineview.qdoc b/src/webengine/doc/src/webengineview.qdoc index da0df4d9e..574b5e70f 100644 --- a/src/webengine/doc/src/webengineview.qdoc +++ b/src/webengine/doc/src/webengineview.qdoc @@ -56,9 +56,8 @@ \skipto import \printuntil /^\}/ - The \l loadingChanged() signal is emitted when loading a page begins, ends, or fails. The - \l loading property holds whether the HTML page is currently loading and the load status is - reflected in the \l LoadStatus property. + The \l loading property holds whether an HTML page is currently loading. + The \l loadingChanged() signal is emitted when loading the page begins, ends, or fails. The title of an HTML page can be accessed with the \l title property. Additionally, a web page may specify an icon, which can be accessed using the \l icon property. The \l zoomFactor -- cgit v1.2.3 From b6dc12bbb5059441363dcea3bcae94d17da482ec Mon Sep 17 00:00:00 2001 From: Szabolcs David Date: Tue, 14 Jul 2015 02:37:26 -0700 Subject: Move loadVisuallyCommitted signal to the test support API Change-Id: I877bbd8bc5c710370f135a27bcd7f0f7c95a7292 Reviewed-by: Joerg Bornemann --- src/webengine/api/qquickwebenginetestsupport_p.h | 1 + src/webengine/api/qquickwebengineview.cpp | 5 ++++- src/webengine/api/qquickwebengineview_p_p.h | 1 - 3 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/webengine/api/qquickwebenginetestsupport_p.h b/src/webengine/api/qquickwebenginetestsupport_p.h index d4b50ac2d..8ea023b63 100644 --- a/src/webengine/api/qquickwebenginetestsupport_p.h +++ b/src/webengine/api/qquickwebenginetestsupport_p.h @@ -81,6 +81,7 @@ public: Q_SIGNALS: void validationMessageShown(const QString &mainText, const QString &subText); void windowCloseRejected(); + void loadVisuallyCommitted(); private: QScopedPointer m_errorPage; diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index 25c4d28ed..066a45d07 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -420,7 +420,10 @@ void QQuickWebEngineViewPrivate::loadCommitted() void QQuickWebEngineViewPrivate::loadVisuallyCommitted() { - Q_EMIT e->loadVisuallyCommitted(); +#ifdef ENABLE_QML_TESTSUPPORT_API + if (m_testSupport) + Q_EMIT m_testSupport->loadVisuallyCommitted(); +#endif } Q_STATIC_ASSERT(static_cast(WebEngineError::NoErrorDomain) == static_cast(QQuickWebEngineView::NoErrorDomain)); diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h index dbbbf9168..65059c837 100644 --- a/src/webengine/api/qquickwebengineview_p_p.h +++ b/src/webengine/api/qquickwebengineview_p_p.h @@ -101,7 +101,6 @@ class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineViewExperimental : public QObjec Q_SIGNALS: void extraContextMenuEntriesComponentChanged(); - void loadVisuallyCommitted(); private: QQuickWebEngineViewExperimental(QQuickWebEngineViewPrivate* viewPrivate); -- cgit v1.2.3 From f66c8894268e25d58f7a405914f81595ce6ac8c1 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 29 Mar 2016 14:16:09 +0200 Subject: Doc: Fix documentation about cookie stores Remove misleading "singleton, if one has been set" from the accessor's documentation. Also link to the accessor's from the class documentation, and remove mentioning of cookie store as something that can be accessed for an individual page. Finally, mark QWebEngineProfile::cookieStore as new in Qt 5.6. Change-Id: Ia20ca0ef45a9a15de0052f7ceb7f59d454c70fdc Reviewed-by: Florian Bruhin Reviewed-by: Leena Miettinen --- src/core/api/qwebenginecookiestore.cpp | 3 +++ src/webengine/api/qquickwebengineprofile.cpp | 2 +- src/webengine/doc/src/qtwebengine-overview.qdoc | 2 +- src/webenginewidgets/api/qwebengineprofile.cpp | 4 +++- 4 files changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/core/api/qwebenginecookiestore.cpp b/src/core/api/qwebenginecookiestore.cpp index 5220073f3..df537a787 100644 --- a/src/core/api/qwebenginecookiestore.cpp +++ b/src/core/api/qwebenginecookiestore.cpp @@ -188,6 +188,9 @@ void QWebEngineCookieStorePrivate::onCookieChanged(const QNetworkCookie &cookie, to get notified about the success of the operation. The signal handlers for removal and addition should not be used to execute heavy tasks, because they might block the IO thread in case of a blocking connection. + + Use QWebEngineProfile::cookieStore() and QQuickWebEngineProfile::cookieStore() + to access the cookie store object for a specific profile. */ /*! diff --git a/src/webengine/api/qquickwebengineprofile.cpp b/src/webengine/api/qquickwebengineprofile.cpp index 3284d8491..c522ef1ea 100644 --- a/src/webengine/api/qquickwebengineprofile.cpp +++ b/src/webengine/api/qquickwebengineprofile.cpp @@ -592,7 +592,7 @@ QQuickWebEngineProfile *QQuickWebEngineProfile::defaultProfile() } /*! - Returns the cookie store singleton, if one has been set. + Returns the cookie store for this profile. */ QWebEngineCookieStore *QQuickWebEngineProfile::cookieStore() const { diff --git a/src/webengine/doc/src/qtwebengine-overview.qdoc b/src/webengine/doc/src/qtwebengine-overview.qdoc index 6ec345cb0..1ac7710a9 100644 --- a/src/webengine/doc/src/qtwebengine-overview.qdoc +++ b/src/webengine/doc/src/qtwebengine-overview.qdoc @@ -152,7 +152,7 @@ Each QWebEnginePage belongs to a QWebEngineProfile that can have a QWebEngineSettings for specifying page settings, a QWebEngineScriptCollection for running scripts on the page, and a QWebEngineCookieStore for accessing the HTTP cookies of Chromium. A QWebEnginePage can also - directly point to a script collection or cookie store. + directly point to a script collection. \section1 Embedding Web Content into Qt Quick Applications diff --git a/src/webenginewidgets/api/qwebengineprofile.cpp b/src/webenginewidgets/api/qwebengineprofile.cpp index 894db3251..b2cc23565 100644 --- a/src/webenginewidgets/api/qwebengineprofile.cpp +++ b/src/webenginewidgets/api/qwebengineprofile.cpp @@ -457,7 +457,9 @@ void QWebEngineProfile::setHttpCacheMaximumSize(int maxSize) } /*! - Returns the cookie store singleton, if one has been set. + Returns the cookie store for this profile. + + \since 5.6 */ QWebEngineCookieStore* QWebEngineProfile::cookieStore() -- cgit v1.2.3 From 173c421596beae6984fc7cb3c719670249f322bc Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 18 Mar 2016 15:45:47 +0100 Subject: Fix QtWebEngineProcess not being found after macdeployqt is used. Currently on OSX, two Info.plist files are generated and copied to the QtWebEngineCore framework, one into Contents/Info.plist and another into Resources/Info.plist. The first one is generated by core_headers.pro and the second by core_module.pro. OS X frameworks only use the plist found in the Resources directory, and the Contents one was generated by qmake erroneously, assuming that core_headers is an application, rather than a framework. When macdeployqt is used with -always-overwrite option, it copies Contents/Info.plist (which contained an incorrect bundle id) over to Resources/Info.plist, and afterwards when an application is executed, it cannot find the plist file because it contains the the wrong CFBundleIdentifier, thus not being able to find the QtWebEngineProcess. Fix consists in making sure code_headers.pro does not generate an Info.plist, and just use the one generated by core_module.pro. Change-Id: I6295bde3b1d1771ed45f3a2fdff9fc60577f2ab6 Task-number: QTBUG-51939 Reviewed-by: Kai Koehne --- src/core/core_headers.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/core/core_headers.pro b/src/core/core_headers.pro index ebafe58ec..52c6ca57d 100644 --- a/src/core/core_headers.pro +++ b/src/core/core_headers.pro @@ -1,5 +1,5 @@ TARGET = QtWebEngineCore -CONFIG += no_private_module header_module internal_module +CONFIG += no_private_module header_module internal_module no_plist MODULE = webenginecoreheaders load(qt_module) -- cgit v1.2.3 From 96eac3793be4db0bbaaefb7606d5dcbcfdeb769f Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 29 Mar 2016 09:53:00 +0200 Subject: Doc: Mention which settings properties are new in Qt 5.6 Change-Id: Ic99ce79856fdc9a528b78f518c27013579bf38cf Reviewed-by: Leena Miettinen --- src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc index df85c39fb..5b9d75314 100644 --- a/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc +++ b/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc @@ -127,9 +127,9 @@ \value ErrorPageEnabled Enables displaying the built-in error pages of Chromium. Enabled by default. \value PluginsEnabled - Enables support for Pepper plugins, such as the Flash player. Disabled by default. + Enables support for Pepper plugins, such as the Flash player. Disabled by default. (Added in Qt 5.6) \value FullScreenSupportEnabled - Enables fullscreen support in an application. Disabled by default. + Enables fullscreen support in an application. Disabled by default. (Added in Qt 5.6) */ /*! -- cgit v1.2.3 From 6de2c94b01fa249c3d051a472ce4073eedebe84e Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 29 Mar 2016 14:23:22 +0200 Subject: Doc: Mark QWebEngineProfile::setRequestInterceptor as new in Qt 5.6 Change-Id: I93f68098718d7f0303accabc9def49ff83e65ca2 Reviewed-by: Leena Miettinen --- src/webenginewidgets/api/qwebengineprofile.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/webenginewidgets/api/qwebengineprofile.cpp b/src/webenginewidgets/api/qwebengineprofile.cpp index b2cc23565..aa6101450 100644 --- a/src/webenginewidgets/api/qwebengineprofile.cpp +++ b/src/webenginewidgets/api/qwebengineprofile.cpp @@ -474,6 +474,7 @@ QWebEngineCookieStore* QWebEngineProfile::cookieStore() The profile does not take ownership of the pointer. + \since 5.6 \sa QWebEngineUrlRequestInfo */ -- cgit v1.2.3 From bc00d396585e75dcaaed5e954519723b5046e070 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Mon, 22 Feb 2016 16:08:29 +0100 Subject: OSX: Fix QSurfaceFormat check to allow < 3.2 OpenGL profiles. Currently if a < 3.2 OpenGL Compatibility profile is requested on OSX, a webengine application would crash saying that the global profile does not match the default profile. That happens because in the Cocoa QPA any requested OpenGL Compatibility profile or Core profile with version smaller than 3.2 gets reset to QSurfaceFormat::NoProfile and version 2.1. Fix consists in making sure that the QSurfaceFormat check only considers Core profile with versions >= 3.2. All other combinations would result in NoProfile 2.1 and thus not cause any issues for webengine. Change-Id: I7c9866d761c052e52389022abe8e213d062db41f Task-number: QTBUG-51058 Reviewed-by: Kai Koehne Reviewed-by: Laszlo Agocs --- src/webengine/render_widget_host_view_qt_delegate_quick.cpp | 13 +++++++++---- .../render_widget_host_view_qt_delegate_widget.cpp | 13 +++++++++---- 2 files changed, 18 insertions(+), 8 deletions(-) (limited to 'src') 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 b667bbc5c..3ba3d117e 100644 --- a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp +++ b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp @@ -63,14 +63,19 @@ RenderWidgetHostViewQtDelegateQuick::RenderWidgetHostViewQtDelegateQuick(RenderW setActiveFocusOnTab(true); #ifdef Q_OS_OSX - // Check that the default QSurfaceFormat OpenGL profile matches the global OpenGL shared - // context profile, otherwise this could lead to a nasty crash. + // Check that the default QSurfaceFormat OpenGL profile is compatible with the global OpenGL + // shared context profile, otherwise this could lead to a nasty crash. QOpenGLContext *globalSharedContext = QOpenGLContext::globalShareContext(); if (globalSharedContext) { QSurfaceFormat sharedFormat = globalSharedContext->format(); QSurfaceFormat defaultFormat = QSurfaceFormat::defaultFormat(); - if (defaultFormat.profile() != sharedFormat.profile()) { - qFatal("QWebEngine: Default QSurfaceFormat OpenGL profile does not match global shared context OpenGL profile. Please make sure you set a new QSurfaceFormat before the QtGui application instance is created."); + + if (defaultFormat.profile() != sharedFormat.profile() + && defaultFormat.profile() == QSurfaceFormat::CoreProfile + && defaultFormat.version() >= qMakePair(3, 2)) { + qFatal("QWebEngine: Default QSurfaceFormat OpenGL profile is not compatible with the " + "global shared context OpenGL profile. Please make sure you set a compatible " + "QSurfaceFormat before the QtGui application instance is created."); } } #endif diff --git a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp index 92d0c6de9..937b26c0b 100644 --- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp +++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp @@ -74,11 +74,16 @@ RenderWidgetHostViewQtDelegateWidget::RenderWidgetHostViewQtDelegateWidget(Rende QSurfaceFormat sharedFormat = globalSharedContext->format(); #ifdef Q_OS_OSX - // Check that the default QSurfaceFormat OpenGL profile matches the global OpenGL shared - // context profile, otherwise this could lead to a nasty crash. + // Check that the default QSurfaceFormat OpenGL profile is compatible with the global OpenGL + // shared context profile, otherwise this could lead to a nasty crash. QSurfaceFormat defaultFormat = QSurfaceFormat::defaultFormat(); - if (defaultFormat.profile() != sharedFormat.profile()) { - qFatal("QWebEngine: Default QSurfaceFormat OpenGL profile does not match global shared context OpenGL profile. Please make sure you set a new QSurfaceFormat before the QtGui application instance is created."); + + if (defaultFormat.profile() != sharedFormat.profile() + && defaultFormat.profile() == QSurfaceFormat::CoreProfile + && defaultFormat.version() >= qMakePair(3, 2)) { + qFatal("QWebEngine: Default QSurfaceFormat OpenGL profile is not compatible with the " + "global shared context OpenGL profile. Please make sure you set a compatible " + "QSurfaceFormat before the QtGui application instance is created."); } #endif -- cgit v1.2.3 From 665c422803e9d6767f9fa2fd69964c03a254167b Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 21 Mar 2016 13:56:20 +0100 Subject: Fix CommandLine initialization on Windows Chromium insists on getting the command line via the system call GetCommandLineW. QCoreApplication already did that, and we want to pass the already split argument vector to init CommandLine. This way, the user can pass custom arguments to QGuiApplication, and Chromium will pick those up correctly. Task-number: QTBUG-51971 Change-Id: I85b2071fcd8e5781b13ec8d22dc00b1a0c71601b Reviewed-by: Kai Koehne --- src/3rdparty | 2 +- src/core/web_engine_context.cpp | 27 ++++++++++++++++++++------- 2 files changed, 21 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/3rdparty b/src/3rdparty index cbe3845ef..3b2b78caa 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit cbe3845eff59c2d1726ed3dc0f934f7f483a1271 +Subproject commit 3b2b78caa761db2b7b25dc51c3dae8316f595db1 diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index a8cab45c5..8845cedbe 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -203,21 +203,34 @@ WebEngineContext::WebEngineContext() , m_browserRunner(content::BrowserMainRunner::Create()) , m_globalQObject(new QObject()) { - QVector args; - Q_FOREACH (const QString& arg, QCoreApplication::arguments()) - args << arg.toUtf8(); - - bool useEmbeddedSwitches = args.removeAll("--enable-embedded-switches"); + QStringList appArgs = QCoreApplication::arguments(); + bool useEmbeddedSwitches = appArgs.removeAll(QStringLiteral("--enable-embedded-switches")); #if defined(QTWEBENGINE_EMBEDDED_SWITCHES) - useEmbeddedSwitches = !args.removeAll("--disable-embedded-switches"); + useEmbeddedSwitches = !appArgs.removeAll(QStringLiteral("--disable-embedded-switches")); #endif +#if defined(Q_OS_WIN) + // We must initialize the command line with the UTF-16 arguments vector we got from + // QCoreApplication. CommandLine::Init ignores its arguments on Windows and calls + // GetCommandLineW() instead. + base::CommandLine::CreateEmpty(); + base::CommandLine* parsedCommandLine = base::CommandLine::ForCurrentProcess(); + base::CommandLine::StringVector argv; + argv.resize(appArgs.size()); + std::transform(appArgs.constBegin(), appArgs.constEnd(), argv.begin(), &toString16); + parsedCommandLine->InitFromArgv(argv); +#else + QVector args; + Q_FOREACH (const QString& arg, appArgs) + args << arg.toUtf8(); + QVector argv(args.size()); for (int i = 0; i < args.size(); ++i) argv[i] = args[i].constData(); base::CommandLine::Init(argv.size(), argv.constData()); - base::CommandLine* parsedCommandLine = base::CommandLine::ForCurrentProcess(); +#endif + parsedCommandLine->AppendSwitchPath(switches::kBrowserSubprocessPath, WebEngineLibraryInfo::getPath(content::CHILD_PROCESS_EXE)); parsedCommandLine->AppendSwitch(switches::kNoSandbox); parsedCommandLine->AppendSwitch(switches::kEnableDelegatedRenderer); -- cgit v1.2.3 From 204de3973d7063f9ec65c0cd1ac15a13cde228c6 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 30 Mar 2016 17:50:23 +0200 Subject: Fix Windows build when response files for moc are generated moc.prf contains magic (translation: weird heuristics) to determine if the moc command line would exceed the command line length limit on Windows. If such an excess is detected a response file is created in MOC_DIR. As our build directory is not qmake's default one, moc calls will not find the response file. Set MOC_DIR accordingly to generate the reponse file in the right location. Task-number: QTBUG-51847 Change-Id: Id0695451a986cd9514a7c965c6d33c5c3ef800cd Reviewed-by: Kai Koehne --- src/core/core_gyp_generator.pro | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/core/core_gyp_generator.pro b/src/core/core_gyp_generator.pro index e018c010f..58e83f954 100644 --- a/src/core/core_gyp_generator.pro +++ b/src/core/core_gyp_generator.pro @@ -17,6 +17,9 @@ DEFINES += QT_NO_KEYWORDS \ QTWEBENGINECORE_VERSION_STR=\\\"$$MODULE_VERSION\\\" \ BUILDING_CHROMIUM +# Ensure that response files, generated by qtbase/mkspecs/features/moc.prf, are found by moc. +MOC_DIR = $$OUT_PWD/$$getConfigDir()/.moc + # Assume that we want mobile touch and low-end hardware behaviors # whenever we are cross compiling. cross_compile: DEFINES += QTWEBENGINE_EMBEDDED_SWITCHES -- cgit v1.2.3 From 8dbb6dde40bba8f4269196fbcc4309f7b84da98f Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 24 Mar 2016 12:55:11 +0100 Subject: Add a Qt Designer plugin for QWebEngineView. Task-number: QTBUG-52104 Change-Id: Icf8b4eea7fc52498b2ce9a2c04da6a24e8bdb070 Reviewed-by: Kai Koehne --- src/plugins/plugins.pro | 2 + .../qwebengineview/images/qwebengineview.png | Bin 0 -> 1473 bytes src/plugins/qwebengineview/qwebengineview.pro | 11 ++ .../qwebengineview/qwebengineview_plugin.cpp | 132 +++++++++++++++++++++ src/plugins/qwebengineview/qwebengineview_plugin.h | 70 +++++++++++ .../qwebengineview/qwebengineview_plugin.qrc | 5 + src/src.pro | 4 +- 7 files changed, 223 insertions(+), 1 deletion(-) create mode 100644 src/plugins/plugins.pro create mode 100644 src/plugins/qwebengineview/images/qwebengineview.png create mode 100644 src/plugins/qwebengineview/qwebengineview.pro create mode 100644 src/plugins/qwebengineview/qwebengineview_plugin.cpp create mode 100644 src/plugins/qwebengineview/qwebengineview_plugin.h create mode 100644 src/plugins/qwebengineview/qwebengineview_plugin.qrc (limited to 'src') diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro new file mode 100644 index 000000000..32fce325b --- /dev/null +++ b/src/plugins/plugins.pro @@ -0,0 +1,2 @@ +TEMPLATE = subdirs +qtHaveModule(designer):qtHaveModule(webenginewidgets): SUBDIRS += qwebengineview diff --git a/src/plugins/qwebengineview/images/qwebengineview.png b/src/plugins/qwebengineview/images/qwebengineview.png new file mode 100644 index 000000000..01a0920c9 Binary files /dev/null and b/src/plugins/qwebengineview/images/qwebengineview.png differ diff --git a/src/plugins/qwebengineview/qwebengineview.pro b/src/plugins/qwebengineview/qwebengineview.pro new file mode 100644 index 000000000..c18b6fe94 --- /dev/null +++ b/src/plugins/qwebengineview/qwebengineview.pro @@ -0,0 +1,11 @@ +TARGET = qwebengineview +QT += designer webenginewidgets + +PLUGIN_CLASS_NAME = QWebEngineViewPlugin +PLUGIN_TYPE = designer +CONFIG += tool_plugin +load(qt_plugin) + +SOURCES += qwebengineview_plugin.cpp +HEADERS += qwebengineview_plugin.h +RESOURCES += qwebengineview_plugin.qrc diff --git a/src/plugins/qwebengineview/qwebengineview_plugin.cpp b/src/plugins/qwebengineview/qwebengineview_plugin.cpp new file mode 100644 index 000000000..2d331571b --- /dev/null +++ b/src/plugins/qwebengineview/qwebengineview_plugin.cpp @@ -0,0 +1,132 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwebengineview_plugin.h" + +#include +#include + +#include +#include + +QT_BEGIN_NAMESPACE + +static const char toolTipC[] = + QT_TRANSLATE_NOOP(QWebEngineViewPlugin, + "A widget for displaying a web page, from the Qt WebEngineWidgets module"); + +QWebEngineViewPlugin::QWebEngineViewPlugin(QObject *parent) : + QObject(parent), + m_initialized(false) +{ +} + +QString QWebEngineViewPlugin::name() const +{ + return QStringLiteral("QWebEngineView"); +} + +QString QWebEngineViewPlugin::group() const +{ + return QStringLiteral("Display Widgets"); +} + +QString QWebEngineViewPlugin::toolTip() const +{ + return tr(toolTipC); +} + +QString QWebEngineViewPlugin::whatsThis() const +{ + return tr(toolTipC); +} + +QString QWebEngineViewPlugin::includeFile() const +{ + return QStringLiteral(""); +} + +QIcon QWebEngineViewPlugin::icon() const +{ + return QIcon(QStringLiteral(":/qt-project.org/qwebengineview/images/qwebengineview.png")); +} + +bool QWebEngineViewPlugin::isContainer() const +{ + return false; +} + +QWidget *QWebEngineViewPlugin::createWidget(QWidget *parent) +{ + return new QWebEngineView(parent); +} + +bool QWebEngineViewPlugin::isInitialized() const +{ + return m_initialized; +} + +void QWebEngineViewPlugin::initialize(QDesignerFormEditorInterface * /*core*/) +{ + if (m_initialized) + return; + + m_initialized = true; +} + +QString QWebEngineViewPlugin::domXml() const +{ + return QStringLiteral("\ + \ + \ + \ + \ + about:blank\ + \ + \ + \ + \ + 0\ + 0\ + 300\ + 200\ + \ + \ + \ + "); +} + +QT_END_NAMESPACE diff --git a/src/plugins/qwebengineview/qwebengineview_plugin.h b/src/plugins/qwebengineview/qwebengineview_plugin.h new file mode 100644 index 000000000..8fa94625c --- /dev/null +++ b/src/plugins/qwebengineview/qwebengineview_plugin.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWEBENGINEVIEW_PLUGIN_H +#define QWEBENGINEVIEW_PLUGIN_H + +#include + +QT_BEGIN_NAMESPACE + +class QWebEngineViewPlugin: public QObject, public QDesignerCustomWidgetInterface +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDesignerCustomWidgetInterface") + Q_INTERFACES(QDesignerCustomWidgetInterface) +public: + explicit QWebEngineViewPlugin(QObject *parent = Q_NULLPTR); + + QString name() const Q_DECL_OVERRIDE; + QString group() const Q_DECL_OVERRIDE; + QString toolTip() const Q_DECL_OVERRIDE; + QString whatsThis() const Q_DECL_OVERRIDE; + QString includeFile() const Q_DECL_OVERRIDE; + QIcon icon() const Q_DECL_OVERRIDE; + bool isContainer() const Q_DECL_OVERRIDE; + QWidget *createWidget(QWidget *parent) Q_DECL_OVERRIDE; + bool isInitialized() const Q_DECL_OVERRIDE; + void initialize(QDesignerFormEditorInterface *core) Q_DECL_OVERRIDE; + QString domXml() const Q_DECL_OVERRIDE; + +private: + bool m_initialized; +}; + +QT_END_NAMESPACE + +#endif // QWEBENGINEVIEW_PLUGIN_H diff --git a/src/plugins/qwebengineview/qwebengineview_plugin.qrc b/src/plugins/qwebengineview/qwebengineview_plugin.qrc new file mode 100644 index 000000000..181625c48 --- /dev/null +++ b/src/plugins/qwebengineview/qwebengineview_plugin.qrc @@ -0,0 +1,5 @@ + + + images/qwebengineview.png + + diff --git a/src/src.pro b/src/src.pro index 2effb70ed..6a6a6abb8 100644 --- a/src/src.pro +++ b/src/src.pro @@ -14,7 +14,8 @@ SUBDIRS += core \ process \ webengine \ webengine_plugin \ - webengine_experimental_plugin + webengine_experimental_plugin \ + plugins isQMLTestSupportApiEnabled() { @@ -30,4 +31,5 @@ isQMLTestSupportApiEnabled() { qtHaveModule(widgets) { SUBDIRS += webenginewidgets + plugins.depends = webenginewidgets } -- cgit v1.2.3 From f22435da983a9e0070ef9c969bb9aa8c1191c0a6 Mon Sep 17 00:00:00 2001 From: Adam Kallai Date: Tue, 17 Nov 2015 17:47:43 +0100 Subject: Avoid triggering extra urlChanged signal Chromium usually clears the pending entry when it fails, so that an arbitrary URL is not left visible above a committed page. However, it does preserve the pending entry in some cases, such as on the initial navigation of an unmodified blank tab. So in other cases Chromium clears the pending entry (if the navigation is not in progress), and it does force the UI (URL bar) to refresh. In our case we allow failed URLs to stick around in the URL bar but only when alternate error pages are used. Change-Id: I26e81e7a99415aa184880dcb647a06d977584119 Task-number: QTBUG-48995 Reviewed-by: Kai Koehne --- src/core/web_contents_delegate_qt.cpp | 14 ++++++++++++++ src/core/web_contents_delegate_qt.h | 1 + 2 files changed, 15 insertions(+) (limited to 'src') diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index baf61b5fc..e3903c902 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -122,6 +122,20 @@ void WebContentsDelegateQt::NavigationStateChanged(content::WebContents* source, m_viewClient->titleChanged(toQt(source->GetTitle())); } +bool WebContentsDelegateQt::ShouldPreserveAbortedURLs(content::WebContents *source) +{ + Q_UNUSED(source) + + // Allow failed URLs to stick around in the URL bar, but only when the error-page is enabled. + WebEngineSettings *settings = m_viewClient->webEngineSettings(); + bool isErrorPageEnabled = settings->testAttribute(settings->Attribute::ErrorPageEnabled); + + if (isErrorPageEnabled) + return true; + + return false; +} + void WebContentsDelegateQt::AddNewContents(content::WebContents* source, content::WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture, bool* was_blocked) { Q_UNUSED(source) diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h index 356b2df88..c971c75e8 100644 --- a/src/core/web_contents_delegate_qt.h +++ b/src/core/web_contents_delegate_qt.h @@ -91,6 +91,7 @@ public: virtual bool IsPopupOrPanel(const content::WebContents *source) const Q_DECL_OVERRIDE; virtual void UpdateTargetURL(content::WebContents* source, const GURL& url) Q_DECL_OVERRIDE; virtual void RequestToLockMouse(content::WebContents *web_contents, bool user_gesture, bool last_unlocked_by_target) Q_DECL_OVERRIDE; + virtual bool ShouldPreserveAbortedURLs(content::WebContents *source) Q_DECL_OVERRIDE; virtual void ShowValidationMessage(content::WebContents *web_contents, const gfx::Rect &anchor_in_root_view, const base::string16 &main_text, const base::string16 &sub_text) Q_DECL_OVERRIDE; virtual void HideValidationMessage(content::WebContents *web_contents) Q_DECL_OVERRIDE; virtual void MoveValidationMessage(content::WebContents *web_contents, const gfx::Rect &anchor_in_root_view) Q_DECL_OVERRIDE; -- cgit v1.2.3 From 82900c7b96b2a6fb42fe3841df7685b820edd588 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 24 Mar 2016 13:55:28 +0100 Subject: Use system NSS only for certificate handling Compiling against NSS 3.23 fails with current Chromium. Also, with NSS 3.21 there are failures connecting to e.g. google.com. Fix this by adapting the setup endorsed by upstream Chromium: BoringSSL is always used for cryptography, and NSS only for certificate handlng. Patches included in 3rdparty update: 0a385bb [backport] Call EnsureNSSHttpIOInit in the chimera build. 0472123 Fix build against newer NSS 90c62c4 [Backport] update to libpng 1.2.56 34857b8 [Backport] Stop large iCCP chunks causing delays and "Aw Snap!" Task-number: QTBUG-52193 Task-number: QTBUG-51890 Task-number: QTBUG-52068 Change-Id: If8aaed9b9a09475c5ed0dfec64d31f45ce9670f5 Reviewed-by: Allan Sandfeld Jensen --- src/3rdparty | 2 +- src/core/config/linux.pri | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/3rdparty b/src/3rdparty index 3b2b78caa..0a385bb01 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit 3b2b78caa761db2b7b25dc51c3dae8316f595db1 +Subproject commit 0a385bb01d9cf060fae4c9d350ee98561654df96 diff --git a/src/core/config/linux.pri b/src/core/config/linux.pri index 88c1a41aa..39eeb2a90 100644 --- a/src/core/config/linux.pri +++ b/src/core/config/linux.pri @@ -18,11 +18,14 @@ GYP_CONFIG += \ use_gio=0 \ use_gnome_keyring=0 \ use_kerberos=0 \ - use_pango=0 + use_pango=0 \ + use_openssl=1 -!use?(nss) { +use?(nss) { + GYP_CONFIG += use_nss_certs=1 \ + use_openssl_certs=0 +} else { GYP_CONFIG += use_nss_certs=0 \ - use_openssl=1 \ use_openssl_certs=1 } -- cgit v1.2.3 From b98d79b561791459dd6bfb0fed5dc7462a1a09a7 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 30 Mar 2016 18:22:21 +0200 Subject: Fix crashes due to qputenv being called after Chromium initialization. The qputenv() call inside gl_surface_qt.cpp, which is executed on a GpuChildThread, can reallocate the process environment structure, and it is possible that at the same time the main thread calls getenv, which will dereference a pointer to the freed environment structure, essentially causing a use-after-free crash. Make sure the qputenv() call happens before Chromium initialization starts, so no thread-race can occur. Change-Id: I4ecbdc8bf2abbe45f7d6c5d2633dc9fe27f51e66 Task-number: QTBUG-52124 Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Kai Koehne (cherry picked from commit 76c61aa1400ef2def204c3732e30e08e40631e8d) --- src/core/gl_surface_qt.cpp | 3 --- src/core/web_engine_context.cpp | 6 ++++++ 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/core/gl_surface_qt.cpp b/src/core/gl_surface_qt.cpp index 86bb4fda9..7596fcaff 100644 --- a/src/core/gl_surface_qt.cpp +++ b/src/core/gl_surface_qt.cpp @@ -171,9 +171,6 @@ bool GLSurfaceQtGLX::InitializeOneOff() if (initialized) return true; - // http://crbug.com/245466 - qputenv("force_s3tc_enable", "true"); - XInitThreads(); g_display = GLContextHelper::getXDisplay(); diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 8845cedbe..9a96f695e 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -209,6 +209,12 @@ WebEngineContext::WebEngineContext() useEmbeddedSwitches = !appArgs.removeAll(QStringLiteral("--disable-embedded-switches")); #endif +#ifdef Q_OS_LINUX + // Call qputenv before BrowserMainRunnerImpl::Initialize is called. + // http://crbug.com/245466 + qputenv("force_s3tc_enable", "true"); +#endif + #if defined(Q_OS_WIN) // We must initialize the command line with the UTF-16 arguments vector we got from // QCoreApplication. CommandLine::Init ignores its arguments on Windows and calls -- cgit v1.2.3 From cc73ff24cb45e9b81c9f4ecb9174f19ef17fcb73 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Fri, 1 Apr 2016 11:44:23 +0200 Subject: Doc: Add docs for QWebEngineFullScreenRequest class Change-Id: I40706d93348c868f7572fa4c0485f0babf98a06e Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Kai Koehne --- .../api/qwebenginefullscreenrequest.cpp | 64 ++++++++++++++++++++++ 1 file changed, 64 insertions(+) (limited to 'src') diff --git a/src/webenginewidgets/api/qwebenginefullscreenrequest.cpp b/src/webenginewidgets/api/qwebenginefullscreenrequest.cpp index 7db86e6f2..3fe73b707 100644 --- a/src/webenginewidgets/api/qwebenginefullscreenrequest.cpp +++ b/src/webenginewidgets/api/qwebenginefullscreenrequest.cpp @@ -39,6 +39,64 @@ QT_BEGIN_NAMESPACE +/*! + \class QWebEngineFullScreenRequest + \brief The QWebEngineFullScreenRequest class enables accepting or rejecting + requests for entering and exiting the fullscreen mode. + + \since 5.6 + + \inmodule QtWebEngineWidgets + + To allow elements such as videos to be shown in the fullscreen mode, + applications must set QWebEngineSettings::FullScreenSupportEnabled and + connect to QWebEnginePage::fullScreenRequested, which takes a + QWebEngineFullScreenRequest instance as an argument. + + If an element of a web page requests to be shown in the fullscreen mode, + QWebEnginePage::fullScreenRequested will be emitted with an + QWebEngineFullScreenRequest instance as an argument where toggleOn() returns + \c true. The signal handler needs to then either call accept() or reject(). + + If the request to enter the fullscreen mode is accepted, the element + requesting fullscreen mode will fill the viewport, but it is up to the + application to make the view fullscreen or to move the page to a view that + is in the fullscreen mode. + + Likewise, a QWebEnginePage::fullScreenRequested will be emitted when + the user wants to leave the full screen mode (that is, through the + QWebEnginePage::ExitFullScreen context menu action). In this case, + toggleOn() will return \c false, and the signal handler again needs to + accept() or reject() the request. If it is accepted, the applicaton needs to + make sure that the global window state is restored. +*/ + +/*! + \property QWebEngineFullScreenRequest::toggleOn + \brief Whether the web page has issued a request to enter fullscreen mode. +*/ + +/*! + \property QWebEngineFullScreenRequest::origin + \brief The URL to be opened in the fullscreen mode. +*/ + +/*! + \fn QWebEngineFullScreenRequest::toggleOn() const + Returns \c true if the web page has issued a request to enter the fullscreen + mode, otherwise returns \c false. +*/ + +/*! + \fn QWebEngineFullScreenRequest::origin() const + Returns the URL to be opened in the fullscreen mode. +*/ + +/*! + Creates a request for opening the \a page from the URL specified by + \a origin in the fullscreen mode if \a fullscreen is \c true. +*/ + QWebEngineFullScreenRequest::QWebEngineFullScreenRequest(QWebEnginePage *page, const QUrl &origin, bool fullscreen) : m_page(page) , m_origin(origin) @@ -46,6 +104,9 @@ QWebEngineFullScreenRequest::QWebEngineFullScreenRequest(QWebEnginePage *page, c { } +/*! + Rejects a request to enter or exit the fullscreen mode. +*/ void QWebEngineFullScreenRequest::reject() { if (!m_page) { @@ -56,6 +117,9 @@ void QWebEngineFullScreenRequest::reject() m_page->d_func()->setFullScreenMode(!m_toggleOn); } +/*! + Accepts the request to enter or exit the fullscreen mode. +*/ void QWebEngineFullScreenRequest::accept() { if (!m_page) { -- cgit v1.2.3 From 004205323497bc50674133aa3c915d9284ccd266 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 1 Apr 2016 12:34:58 +0200 Subject: Doc: Link Pepper plugin platform information to respective settings Change-Id: I1bd0c58a0cee3933370238841c12cf0c1d965c93 Reviewed-by: Leena Miettinen --- src/webengine/api/qquickwebenginesettings.cpp | 2 ++ src/webengine/doc/src/qtwebengine-platform-notes.qdoc | 10 ++++++---- src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc | 3 ++- 3 files changed, 10 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/webengine/api/qquickwebenginesettings.cpp b/src/webengine/api/qquickwebenginesettings.cpp index fe421993a..58d2b681d 100644 --- a/src/webengine/api/qquickwebenginesettings.cpp +++ b/src/webengine/api/qquickwebenginesettings.cpp @@ -213,6 +213,8 @@ bool QQuickWebEngineSettings::errorPageEnabled() const Enables support for Pepper plugins, such as the Flash player. Disabled by default. + + \sa {Pepper Plugin API Support} */ bool QQuickWebEngineSettings::pluginsEnabled() const { diff --git a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc index e37817e0e..64bfba054 100644 --- a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc +++ b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc @@ -68,8 +68,12 @@ \section1 Pepper Plugin API Support - Qt WebEngine supports loading Pepper Plugin API (PPAPI) plugins. The plugins must be loaded - manually using the Chromium command line syntax with the \c --register-pepper-plugins argument. + Qt WebEngine supports loading Pepper Plugin API (PPAPI) plugins if + WebEngineSettings::pluginsEnabled or QWebEngineSettings::PluginsEnabled + is set. + + Except for the Adobe Flash Player plugin, the plugins must be loaded manually using the + Chromium command line syntax with the \c --register-pepper-plugins argument. The argument value is a list of entries, separated by commas, that contain the file path and one or several MIME types, separated by semicolons: @@ -85,8 +89,6 @@ The MIME type is important because it determines which embeds the plugin is used for. - This process has been automated for the Pepper Flash player plugin. - \section2 Pepper Flash Player Plugin Support The Pepper Flash player plugin can be loaded automatically if it is installed in one of the diff --git a/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc index 5b9d75314..04fbff925 100644 --- a/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc +++ b/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc @@ -127,7 +127,8 @@ \value ErrorPageEnabled Enables displaying the built-in error pages of Chromium. Enabled by default. \value PluginsEnabled - Enables support for Pepper plugins, such as the Flash player. Disabled by default. (Added in Qt 5.6) + Enables support for Pepper plugins, such as the Flash player. Disabled by default. + See also \l{Pepper Plugin API Support}. (Added in Qt 5.6) \value FullScreenSupportEnabled Enables fullscreen support in an application. Disabled by default. (Added in Qt 5.6) */ -- cgit v1.2.3 From 4ed08bb0a8195746c333dabbdb9da3400d174296 Mon Sep 17 00:00:00 2001 From: Szabolcs David Date: Wed, 16 Dec 2015 08:13:05 -0800 Subject: Fix typo in the folder name of the cookies Change-Id: I9e1acaa0dbd31978730dae33ebb517f467f8df49 Reviewed-by: Allan Sandfeld Jensen --- src/core/browser_context_adapter.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/core/browser_context_adapter.cpp b/src/core/browser_context_adapter.cpp index 52674e8bd..d394cd302 100644 --- a/src/core/browser_context_adapter.cpp +++ b/src/core/browser_context_adapter.cpp @@ -221,8 +221,13 @@ QString BrowserContextAdapter::cookiesPath() const if (m_offTheRecord) return QString(); QString basePath = dataPath(); - if (!basePath.isEmpty()) - return basePath % QLatin1String("/Coookies"); + if (!basePath.isEmpty()) { + // This is a typo fix. We still need the old path in order to avoid breaking migration. + QDir coookiesFolder(basePath % QLatin1String("/Coookies")); + if (coookiesFolder.exists()) + return coookiesFolder.path(); + return basePath % QLatin1String("/Cookies"); + } return QString(); } -- cgit v1.2.3 From 6d72c4ce5a6948d4c495b3d7560a7449a40917c0 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Mon, 4 Apr 2016 10:04:02 +0200 Subject: Doc: Replace "web engine script" with class and type names Change-Id: I644475dc966b9a0a13bba242b653d2bc2357f24b Reviewed-by: Allan Sandfeld Jensen --- src/webengine/doc/src/qtwebengine-overview.qdoc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/webengine/doc/src/qtwebengine-overview.qdoc b/src/webengine/doc/src/qtwebengine-overview.qdoc index 1ac7710a9..c26497799 100644 --- a/src/webengine/doc/src/qtwebengine-overview.qdoc +++ b/src/webengine/doc/src/qtwebengine-overview.qdoc @@ -121,8 +121,9 @@ created is not suitable for DOM operations, where one has to wait until the DOM is ready. In addition, an injected script shares the same \e world as the other scripts executed on the - page, which might lead to conflicts. To avoid this, the Chromium API for - \e{Content Script Extensions} is implemented by \e {web engine script}. It specifies the + page, which might lead to conflicts. To avoid this, the QWebEngineScript class and the + WebEngineScript QML type provide implementations of the Chromium API for + \e{Content Script Extensions}. They specify the script to run, the injection point, and the world where the script is run. This enables accessing the DOM to manipulate it within a world. -- cgit v1.2.3 From 9da7a0649cfa65c784e86cf3496b188c9d8d15c4 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Wed, 30 Mar 2016 12:54:35 +0300 Subject: Fix trying to open multiple windows if not supported We shouldn't special case some platform integration names, instead check if it supports the proper capabilities Change-Id: Ib8a28a974a4054cea4fbfb503be7c0e0f797e242 Reviewed-by: Kai Koehne --- src/webengine/api/qquickwebengineview.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index 066a45d07..1e3efd6c4 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -77,6 +77,8 @@ #include #include #include +#include +#include #ifndef QT_NO_ACCESSIBILITY #include #endif // QT_NO_ACCESSIBILITY @@ -164,7 +166,7 @@ RenderWidgetHostViewQtDelegate *QQuickWebEngineViewPrivate::CreateRenderWidgetHo RenderWidgetHostViewQtDelegate *QQuickWebEngineViewPrivate::CreateRenderWidgetHostViewQtDelegateForPopup(RenderWidgetHostViewQtDelegateClient *client) { Q_Q(QQuickWebEngineView); - const bool hasWindowCapability = qApp->platformName().toLower() != QLatin1String("eglfs"); + const bool hasWindowCapability = QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::MultipleWindows); RenderWidgetHostViewQtDelegateQuick *quickDelegate = new RenderWidgetHostViewQtDelegateQuick(client, /*isPopup = */ true); if (hasWindowCapability) { RenderWidgetHostViewQtDelegateQuickWindow *wrapperWindow = new RenderWidgetHostViewQtDelegateQuickWindow(quickDelegate); -- cgit v1.2.3 From 3e9a6407bbbc5f83eb8bd56c5c1d899dba9bc56f Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 4 Apr 2016 15:13:31 +0200 Subject: Implement CheckMediaAccessPermission Fixes access of label of MediaStream tracks Also fixes the logged error: WebContentsDelegate::CheckMediaAccessPermission: Not supported. Change-Id: I3fee9ccd9e8b2e5cbd6b707336cc61425a44ba31 Task-number: QTBUG-52216 Reviewed-by: Kai Koehne --- src/core/browser_context_adapter.cpp | 5 +++++ src/core/browser_context_adapter.h | 3 +++ src/core/permission_manager_qt.cpp | 6 ++++++ src/core/permission_manager_qt.h | 1 + src/core/web_contents_adapter.cpp | 5 +++++ src/core/web_contents_delegate_qt.cpp | 14 ++++++++++++++ src/core/web_contents_delegate_qt.h | 1 + 7 files changed, 35 insertions(+) (limited to 'src') diff --git a/src/core/browser_context_adapter.cpp b/src/core/browser_context_adapter.cpp index d394cd302..7f9363c06 100644 --- a/src/core/browser_context_adapter.cpp +++ b/src/core/browser_context_adapter.cpp @@ -405,6 +405,11 @@ void BrowserContextAdapter::permissionRequestReply(const QUrl &origin, Permissio static_cast(browserContext()->GetPermissionManager())->permissionRequestReply(origin, type, reply); } +bool BrowserContextAdapter::checkPermission(const QUrl &origin, PermissionType type) +{ + return static_cast(browserContext()->GetPermissionManager())->checkPermission(origin, type); +} + QString BrowserContextAdapter::httpAcceptLanguageWithoutQualities() const { const QStringList list = m_httpAcceptLanguage.split(QLatin1Char(',')); diff --git a/src/core/browser_context_adapter.h b/src/core/browser_context_adapter.h index 97a4dca4a..a388e9a0c 100644 --- a/src/core/browser_context_adapter.h +++ b/src/core/browser_context_adapter.h @@ -127,6 +127,8 @@ public: GeolocationPermission = 1, // Reserved: // NotificationPermission = 2, + AudioCapturePermission = 3, + VideoCapturePermission = 4, }; HttpCacheType httpCacheType() const; @@ -152,6 +154,7 @@ public: UserScriptControllerHost *userScriptController(); void permissionRequestReply(const QUrl &origin, PermissionType type, bool reply); + bool checkPermission(const QUrl &origin, PermissionType type); QString httpAcceptLanguageWithoutQualities() const; QString httpAcceptLanguage() const; diff --git a/src/core/permission_manager_qt.cpp b/src/core/permission_manager_qt.cpp index b322e507e..a4b763464 100644 --- a/src/core/permission_manager_qt.cpp +++ b/src/core/permission_manager_qt.cpp @@ -91,6 +91,12 @@ void PermissionManagerQt::permissionRequestReply(const QUrl &origin, BrowserCont } } +bool PermissionManagerQt::checkPermission(const QUrl &origin, BrowserContextAdapter::PermissionType type) +{ + QPair key(origin, type); + return m_permissions.contains(key) && m_permissions[key]; +} + void PermissionManagerQt::RequestPermission(content::PermissionType permission, content::RenderFrameHost *frameHost, int request_id, diff --git a/src/core/permission_manager_qt.h b/src/core/permission_manager_qt.h index 6dfc60c39..8d03f275e 100644 --- a/src/core/permission_manager_qt.h +++ b/src/core/permission_manager_qt.h @@ -54,6 +54,7 @@ public: typedef BrowserContextAdapter::PermissionType PermissionType; void permissionRequestReply(const QUrl &origin, PermissionType type, bool reply); + bool checkPermission(const QUrl &origin, PermissionType type); // content::PermissionManager implementation: void RequestPermission( diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 608dbf7e7..cd6505df5 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -844,6 +844,11 @@ void WebContentsAdapter::wasHidden() void WebContentsAdapter::grantMediaAccessPermission(const QUrl &securityOrigin, WebContentsAdapterClient::MediaRequestFlags flags) { Q_D(WebContentsAdapter); + // Let the permission manager remember the reply. + if (flags & WebContentsAdapterClient::MediaAudioCapture) + d->browserContextAdapter->permissionRequestReply(securityOrigin, BrowserContextAdapter::AudioCapturePermission, true); + if (flags & WebContentsAdapterClient::MediaVideoCapture) + d->browserContextAdapter->permissionRequestReply(securityOrigin, BrowserContextAdapter::VideoCapturePermission, true); MediaCaptureDevicesDispatcher::GetInstance()->handleMediaAccessPermissionResponse(d->webContents.get(), securityOrigin, flags); } diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index e3903c902..bf12537d1 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -438,4 +438,18 @@ void WebContentsDelegateQt::BeforeUnloadFired(content::WebContents *tab, bool pr m_viewClient->windowCloseRejected(); } +bool WebContentsDelegateQt::CheckMediaAccessPermission(content::WebContents *web_contents, const GURL& security_origin, content::MediaStreamType type) +{ + switch (type) { + case content::MEDIA_DEVICE_AUDIO_CAPTURE: + return m_viewClient->browserContextAdapter()->checkPermission(toQt(security_origin), BrowserContextAdapter::AudioCapturePermission); + case content::MEDIA_DEVICE_VIDEO_CAPTURE: + return m_viewClient->browserContextAdapter()->checkPermission(toQt(security_origin), BrowserContextAdapter::VideoCapturePermission); + default: + LOG(INFO) << "WebContentsDelegateQt::CheckMediaAccessPermission: " + << "Unsupported media stream type checked" << type; + return false; + } +} + } // namespace QtWebEngineCore diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h index c971c75e8..7ead8dc7c 100644 --- a/src/core/web_contents_delegate_qt.h +++ b/src/core/web_contents_delegate_qt.h @@ -96,6 +96,7 @@ public: virtual void HideValidationMessage(content::WebContents *web_contents) Q_DECL_OVERRIDE; virtual void MoveValidationMessage(content::WebContents *web_contents, const gfx::Rect &anchor_in_root_view) Q_DECL_OVERRIDE; void BeforeUnloadFired(content::WebContents* tab, bool proceed, bool* proceed_to_fire_unload) Q_DECL_OVERRIDE; + bool CheckMediaAccessPermission(content::WebContents *web_contents, const GURL& security_origin, content::MediaStreamType type) Q_DECL_OVERRIDE; // WebContentsObserver overrides virtual void RenderFrameDeleted(content::RenderFrameHost *render_frame_host) Q_DECL_OVERRIDE; -- cgit v1.2.3 From d8b5c233c10a68a7b7edbf44c22a711415ec784b Mon Sep 17 00:00:00 2001 From: Adam Kallai Date: Mon, 4 Apr 2016 10:09:08 +0200 Subject: Add missing revision tag to the mimeTypeChanged signal The mimeType property of the WebEngingeDownloadIten is tagged for REVISION 1 so the related signal should be tagged for REVISION 1 as well. Change-Id: I918de55c81779424011e42c358d5c7aeed2909ee Reviewed-by: Allan Sandfeld Jensen --- src/webengine/api/qquickwebenginedownloaditem_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/webengine/api/qquickwebenginedownloaditem_p.h b/src/webengine/api/qquickwebenginedownloaditem_p.h index 124cea1a5..a7f60199b 100644 --- a/src/webengine/api/qquickwebenginedownloaditem_p.h +++ b/src/webengine/api/qquickwebenginedownloaditem_p.h @@ -93,7 +93,7 @@ Q_SIGNALS: void stateChanged(); void receivedBytesChanged(); void totalBytesChanged(); - void mimeTypeChanged(); + Q_REVISION(1) void mimeTypeChanged(); void pathChanged(); private: -- cgit v1.2.3 From 58e26ce0fc9b04c015c450a5d2448a4cad0ddfe0 Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Mon, 4 Apr 2016 10:51:01 +0200 Subject: Doc: WebEngine does not support Chromium extensions For example, @include, @match, and @exclude. Change-Id: I16d29b4e72452980e43c8e7c5702e21cccf159d5 Reviewed-by: Kai Koehne --- src/webengine/api/qquickwebenginescript.cpp | 2 ++ src/webengine/doc/src/qtwebengine-overview.qdoc | 2 ++ src/webenginewidgets/api/qwebenginescript.cpp | 2 ++ 3 files changed, 6 insertions(+) (limited to 'src') diff --git a/src/webengine/api/qquickwebenginescript.cpp b/src/webengine/api/qquickwebenginescript.cpp index 68ea491b3..6d698c3c6 100644 --- a/src/webengine/api/qquickwebenginescript.cpp +++ b/src/webengine/api/qquickwebenginescript.cpp @@ -62,6 +62,8 @@ using QtWebEngineCore::UserScript; not accessible from a different one. The worldId property provides some predefined IDs for this purpose. + \note Chromium extensions, such as \c @include, \c @match, and \c @exclude, are not supported. + Use \l{WebEngineView::userScripts}{WebEngineView.userScripts} to access a list of scripts attached to the web view. */ diff --git a/src/webengine/doc/src/qtwebengine-overview.qdoc b/src/webengine/doc/src/qtwebengine-overview.qdoc index c26497799..08424f7c2 100644 --- a/src/webengine/doc/src/qtwebengine-overview.qdoc +++ b/src/webengine/doc/src/qtwebengine-overview.qdoc @@ -127,6 +127,8 @@ script to run, the injection point, and the world where the script is run. This enables accessing the DOM to manipulate it within a world. + \note Chromium extensions, such as \c @include, \c @match, and \c @exclude, are not supported. + Because the render process is separated from the GUI process, they should ideally share an OpenGL context to enable one process to access the resources uploaded by the other, such as images or textures. However, some inter-process communication is needed for safety and diff --git a/src/webenginewidgets/api/qwebenginescript.cpp b/src/webenginewidgets/api/qwebenginescript.cpp index 058f58475..6585ff559 100644 --- a/src/webenginewidgets/api/qwebenginescript.cpp +++ b/src/webenginewidgets/api/qwebenginescript.cpp @@ -58,6 +58,8 @@ using QtWebEngineCore::UserScript; not accessible from a different one. ScriptWorldId provides some predefined IDs for this purpose. + \note Chromium extensions, such as \c @include, \c @match, and \c @exclude, are not supported. + Use QWebEnginePage::scripts() and QWebEngineProfile::scripts() to access the collection of scripts associated with a single page or a number of pages sharing the same profile. -- cgit v1.2.3 From 409fe7849e9ce12c03ff674b6e3a28f61805069e Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 5 Apr 2016 10:30:55 +0200 Subject: Update Chromium Pulls in security fixes from Chromium 49.0.2623.108 Change-Id: Icb318aa21772eecb4b39f2bbe92ccdc0f020aee3 Reviewed-by: Joerg Bornemann --- src/3rdparty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/3rdparty b/src/3rdparty index 0a385bb01..5e09f6c06 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit 0a385bb01d9cf060fae4c9d350ee98561654df96 +Subproject commit 5e09f6c06e4c660924d483d01411e3c47ee0ef74 -- cgit v1.2.3 From 29f9a2fb68568208a70ba9efef0e455b50a4d3e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Br=C3=BCning?= Date: Tue, 1 Mar 2016 10:55:34 +0100 Subject: Register qrc as local after blink initialization. It is needed to let local content access the qrc resources by making them part of the same security origin. This is stated in the docs as the default behavior. This also backports change f7d343000d77c80f34a115fe9c78f101929292b1 from 5.7, which fixed some race condition with the qrc registration. Task-number: QTBUG-52085 Change-Id: Ia704fa6dbce8529f82695ab543244020cb9f8b8a Reviewed-by: Allan Sandfeld Jensen --- src/core/renderer/content_renderer_client_qt.cpp | 18 +++++++++++++++--- src/core/renderer/content_renderer_client_qt.h | 5 +++++ 2 files changed, 20 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp index 261b9c581..e53076525 100644 --- a/src/core/renderer/content_renderer_client_qt.cpp +++ b/src/core/renderer/content_renderer_client_qt.cpp @@ -65,6 +65,19 @@ namespace QtWebEngineCore { static const char kHttpErrorDomain[] = "http"; static const char kQrcSchemeQt[] = "qrc"; +class RenderProcessObserverQt : public content::RenderProcessObserver { +public: + void WebKitInitialized() override + { + // Can only be done after blink is initialized. + blink::WebString qrcScheme(base::ASCIIToUTF16(kQrcSchemeQt)); + // mark qrc as a secure scheme (avoids deprecation warnings) + blink::WebSecurityPolicy::registerURLSchemeAsSecure(qrcScheme); + // mark qrc as a local scheme (allows local access to qrc) + blink::WebSecurityPolicy::registerURLSchemeAsLocal(qrcScheme); + } +}; + ContentRendererClientQt::ContentRendererClientQt() { } @@ -79,12 +92,11 @@ void ContentRendererClientQt::RenderThreadStarted() renderThread->RegisterExtension(WebChannelIPCTransport::getV8Extension()); m_visitedLinkSlave.reset(new visitedlink::VisitedLinkSlave); m_webCacheObserver.reset(new web_cache::WebCacheRenderProcessObserver()); + m_renderProcessObserver.reset(new RenderProcessObserverQt()); renderThread->AddObserver(m_visitedLinkSlave.data()); renderThread->AddObserver(m_webCacheObserver.data()); renderThread->AddObserver(UserScriptController::instance()); - - // mark qrc as a secure scheme (avoids deprecation warnings) - blink::WebSecurityPolicy::registerURLSchemeAsSecure(blink::WebString::fromLatin1(kQrcSchemeQt)); + renderThread->AddObserver(m_renderProcessObserver.data()); } void ContentRendererClientQt::RenderViewCreated(content::RenderView* render_view) diff --git a/src/core/renderer/content_renderer_client_qt.h b/src/core/renderer/content_renderer_client_qt.h index eb55156ad..7df824e3e 100644 --- a/src/core/renderer/content_renderer_client_qt.h +++ b/src/core/renderer/content_renderer_client_qt.h @@ -41,6 +41,10 @@ #include #include +namespace content { +class RenderProcessObserver; +} + namespace visitedlink { class VisitedLinkSlave; } @@ -69,6 +73,7 @@ public: private: QScopedPointer m_visitedLinkSlave; QScopedPointer m_webCacheObserver; + QScopedPointer m_renderProcessObserver; }; } // namespace -- cgit v1.2.3 From 52b4dbc1e1104665b2bb6143f515a3f8aa927e79 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 5 Apr 2016 14:50:59 +0200 Subject: Revision DownloadItem.mimeType The property was already revisioned, but the signal was not. Also mark the property as new in the documentation. Change-Id: Iab50bea0d593e9dafb3e58b7f99dd5b95655a1a9 Reviewed-by: Allan Sandfeld Jensen --- src/webengine/api/qquickwebenginedownloaditem.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/webengine/api/qquickwebenginedownloaditem.cpp b/src/webengine/api/qquickwebenginedownloaditem.cpp index 2c1ec1ce9..8e5c0e160 100644 --- a/src/webengine/api/qquickwebenginedownloaditem.cpp +++ b/src/webengine/api/qquickwebenginedownloaditem.cpp @@ -218,6 +218,7 @@ qint64 QQuickWebEngineDownloadItem::receivedBytes() const /*! \qmlproperty QString WebEngineDownloadItem::mimeType + \since QtWebEngine 1.2 Holds the MIME type of the download. */ -- cgit v1.2.3 From 56955e73d4be21bc3f086d1c805352a96944a25c Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 6 Apr 2016 17:10:36 +0200 Subject: Update Chromium Pulls in build fix for MSVC 2015 Update 2. Task-number: QTBUG-52367 Change-Id: I57f17388b280eb79397cbba3e6b1b546d30be096 Reviewed-by: Michal Klocek --- src/3rdparty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/3rdparty b/src/3rdparty index 5e09f6c06..653f475d9 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit 5e09f6c06e4c660924d483d01411e3c47ee0ef74 +Subproject commit 653f475d91df7c9d0b973e89dad8b72f3aeceb40 -- cgit v1.2.3