From db7bfc5604d5a0d951316ce7d42e90cc18ae63f1 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 29 Jun 2018 07:35:57 +0200 Subject: Compile with -no-feature-tabletevent Change-Id: I7e03d6e3347ee9b81a7414574098827b5773b7b4 Reviewed-by: Allan Sandfeld Jensen --- src/core/render_widget_host_view_qt.cpp | 4 ++++ src/core/render_widget_host_view_qt.h | 2 ++ src/core/web_event_factory.cpp | 6 ++++++ src/core/web_event_factory.h | 4 ++++ 4 files changed, 16 insertions(+) (limited to 'src') diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index 443a299ac..7cb23bb58 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -1090,12 +1090,14 @@ bool RenderWidgetHostViewQt::forwardEvent(QEvent *event) case QEvent::TouchCancel: handleTouchEvent(static_cast(event)); break; +#if QT_CONFIG(tabletevent) case QEvent::TabletPress: Focus(); // Fall through. case QEvent::TabletRelease: case QEvent::TabletMove: handleTabletEvent(static_cast(event)); break; +#endif #ifndef QT_NO_GESTURES case QEvent::NativeGesture: handleGestureEvent(static_cast(event)); @@ -1613,10 +1615,12 @@ void RenderWidgetHostViewQt::handleTouchEvent(QTouchEvent *ev) } } +#if QT_CONFIG(tabletevent) void RenderWidgetHostViewQt::handleTabletEvent(QTabletEvent *event) { handlePointerEvent(event); } +#endif template void RenderWidgetHostViewQt::handlePointerEvent(T *event) diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h index 2a1485510..0c62b7279 100644 --- a/src/core/render_widget_host_view_qt.h +++ b/src/core/render_widget_host_view_qt.h @@ -188,7 +188,9 @@ public: void handleKeyEvent(QKeyEvent*); void handleWheelEvent(QWheelEvent*); void handleTouchEvent(QTouchEvent*); +#if QT_CONFIG(tabletevent) void handleTabletEvent(QTabletEvent *ev); +#endif #ifndef QT_NO_GESTURES void handleGestureEvent(QNativeGestureEvent *); #endif diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp index 1eeca8093..792c4c612 100644 --- a/src/core/web_event_factory.cpp +++ b/src/core/web_event_factory.cpp @@ -76,7 +76,9 @@ #include #include #include +#if QT_CONFIG(tabletevent) #include +#endif #include using namespace blink; @@ -1186,6 +1188,7 @@ static WebInputEvent::Type webEventTypeForEvent(const QEvent* event) } } +#if QT_CONFIG(tabletevent) static WebPointerProperties::PointerType pointerTypeForTabletEvent(const QTabletEvent *ev) { switch (ev->pointerType()) { @@ -1199,6 +1202,7 @@ static WebPointerProperties::PointerType pointerTypeForTabletEvent(const QTablet return WebPointerProperties::PointerType::kMouse; } } +#endif WebMouseEvent WebEventFactory::toWebMouseEvent(QMouseEvent *ev, double dpiScale) { @@ -1230,6 +1234,7 @@ WebMouseEvent WebEventFactory::toWebMouseEvent(QHoverEvent *ev, double dpiScale) return webKitEvent; } +#if QT_CONFIG(tabletevent) WebMouseEvent WebEventFactory::toWebMouseEvent(QTabletEvent *ev, double dpiScale) { WebMouseEvent webKitEvent(webEventTypeForEvent(ev), @@ -1248,6 +1253,7 @@ WebMouseEvent WebEventFactory::toWebMouseEvent(QTabletEvent *ev, double dpiScale webKitEvent.pointer_type = pointerTypeForTabletEvent(ev); return webKitEvent; } +#endif WebMouseEvent WebEventFactory::toWebMouseEvent(QEvent *ev) { diff --git a/src/core/web_event_factory.h b/src/core/web_event_factory.h index 442f04054..81f940c4b 100644 --- a/src/core/web_event_factory.h +++ b/src/core/web_event_factory.h @@ -54,7 +54,9 @@ class QEvent; class QHoverEvent; class QKeyEvent; class QMouseEvent; +#ifndef QT_NO_TABLETEVENT class QTabletEvent; +#endif class QWheelEvent; #ifndef QT_NO_GESTURES class QNativeGestureEvent; @@ -66,7 +68,9 @@ class WebEventFactory { public: static blink::WebMouseEvent toWebMouseEvent(QMouseEvent*, double dpiScale); static blink::WebMouseEvent toWebMouseEvent(QHoverEvent*, double dpiScale); +#ifndef QT_NO_TABLETEVENT static blink::WebMouseEvent toWebMouseEvent(QTabletEvent*, double dpiScale); +#endif static blink::WebMouseEvent toWebMouseEvent(QEvent *); #ifndef QT_NO_GESTURES static blink::WebGestureEvent toWebGestureEvent(QNativeGestureEvent *, double dpiScale); -- cgit v1.2.3 From 730e74c1da6cac774c4d7d861559ea37d845913e Mon Sep 17 00:00:00 2001 From: Venugopal Shivashankar Date: Mon, 2 Jul 2018 14:50:46 +0200 Subject: Doc: Mark \snippet entries with .pro files This should enable excluding such snippets from documentation in some cases. Change-Id: I46854412546e3774889e09831254828d18362f29 Reviewed-by: Leena Miettinen --- src/core/doc/src/qtwebenginecore-module.qdoc | 2 ++ src/webengine/doc/src/qtwebengine-module.qdoc | 2 ++ src/webenginewidgets/doc/src/qtwebenginewidgets-module.qdoc | 2 ++ 3 files changed, 6 insertions(+) (limited to 'src') diff --git a/src/core/doc/src/qtwebenginecore-module.qdoc b/src/core/doc/src/qtwebenginecore-module.qdoc index 2ed0a4c06..65e0766de 100644 --- a/src/core/doc/src/qtwebenginecore-module.qdoc +++ b/src/core/doc/src/qtwebenginecore-module.qdoc @@ -43,9 +43,11 @@ indirectly included through the \l{Qt WebEngine QML Types}{Qt WebEngine} or \l{Qt WebEngine Widgets C++ Classes}{Qt WebEngine Widgets} modules. + \if !defined(qtforpython) To link against the module, add this line to your qmake project file: \snippet qtwebenginecore_build_snippet.qdoc 0 However, \c webenginecore is implied by adding \c webengine or \c webenginewidgets. + \endif */ diff --git a/src/webengine/doc/src/qtwebengine-module.qdoc b/src/webengine/doc/src/qtwebengine-module.qdoc index 97657f6a9..2d4d1b8da 100644 --- a/src/webengine/doc/src/qtwebengine-module.qdoc +++ b/src/webengine/doc/src/qtwebengine-module.qdoc @@ -38,7 +38,9 @@ \snippet qtwebengine_build_snippet.qdoc 1 + \if !defined(qtforpython) To link against the module, add the following to your qmake project file: \snippet qtwebengine_build_snippet.qdoc 0 + \endif */ diff --git a/src/webenginewidgets/doc/src/qtwebenginewidgets-module.qdoc b/src/webenginewidgets/doc/src/qtwebenginewidgets-module.qdoc index e4f259882..35fed802c 100644 --- a/src/webenginewidgets/doc/src/qtwebenginewidgets-module.qdoc +++ b/src/webenginewidgets/doc/src/qtwebenginewidgets-module.qdoc @@ -41,7 +41,9 @@ \snippet qtwebenginewidgets_build_snippet.qdoc 1 + \if !defined(qtforpython) To link against the module, add the following to your qmake project file: \snippet qtwebenginewidgets_build_snippet.qdoc 0 + \endif */ -- cgit v1.2.3 From 45e51288ca8eb1ed3ee74460bf164f82db41a918 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 6 Jul 2018 10:14:34 +0200 Subject: Enforce Visual Studio check in windows.pri Because windows.pri is included from a replace function gnArgs, fatal does not work: src/core/config/windows.pri:60: 'fatal' is not a recognized test function. Change-Id: Ib831e1ffa7e8e345477692d453bbcc568864b98c Reviewed-by: Andy Shaw --- src/core/config/windows.pri | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/core/config/windows.pri b/src/core/config/windows.pri index b3e4cf77d..5aa511da3 100644 --- a/src/core/config/windows.pri +++ b/src/core/config/windows.pri @@ -57,7 +57,7 @@ msvc { equals(MSVC_VER, 15.0) { MSVS_VERSION = 2017 } else { - fatal("Visual Studio compiler version \"$$MSVC_VER\" is not supported by Qt WebEngine") + error("Visual Studio compiler version \"$$MSVC_VER\" is not supported by Qt WebEngine") } gn_args += visual_studio_version=$$MSVS_VERSION @@ -71,5 +71,5 @@ msvc { gn_args += target_cpu=\"$$GN_TARGET_CPU\" } else { - fatal("Qt WebEngine for Windows can only be built with the Microsoft Visual Studio C++ compiler") + error("Qt WebEngine for Windows can only be built with the Microsoft Visual Studio C++ compiler") } -- cgit v1.2.3 From 136bf6d507d7aa84f1aa97ad22b56d574581e227 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCri=20Valdmann?= Date: Wed, 11 Jul 2018 16:41:18 +0200 Subject: Forward mouse and keyboard modifiers from QDropEvent Task-number: QTBUG-69231 Change-Id: I35b503dae7e2d90b26b6e61a4c7c260e45df2b62 Reviewed-by: Filipe Azevedo Reviewed-by: Kai Koehne --- src/core/web_contents_adapter.cpp | 7 ++++--- src/core/web_contents_adapter.h | 3 ++- src/webengine/api/qquickwebengineview.cpp | 2 +- src/webenginewidgets/api/qwebengineview.cpp | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 63cda7fa1..8fe86ddc2 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -1625,15 +1625,16 @@ void WebContentsAdapter::updateDragAction(int action) d->currentDropAction = static_cast(action); } -void WebContentsAdapter::endDragging(const QPointF &clientPos, const QPointF &screenPos) +void WebContentsAdapter::endDragging(QDropEvent *e, const QPointF &screenPos) { Q_D(WebContentsAdapter); CHECK_INITIALIZED(); content::RenderViewHost *rvh = d->webContents->GetRenderViewHost(); rvh->GetWidget()->FilterDropData(d->currentDropData.get()); - d->lastDragClientPos = toGfx(clientPos); + d->lastDragClientPos = toGfx(e->posF()); d->lastDragScreenPos = toGfx(screenPos); - rvh->GetWidget()->DragTargetDrop(*d->currentDropData, d->lastDragClientPos, d->lastDragScreenPos, 0); + rvh->GetWidget()->DragTargetDrop(*d->currentDropData, d->lastDragClientPos, d->lastDragScreenPos, + toWeb(e->mouseButtons()) | toWeb(e->keyboardModifiers())); d->currentDropData.reset(); } diff --git a/src/core/web_contents_adapter.h b/src/core/web_contents_adapter.h index 111100bba..d5dbcf122 100644 --- a/src/core/web_contents_adapter.h +++ b/src/core/web_contents_adapter.h @@ -61,6 +61,7 @@ QT_BEGIN_NAMESPACE class QAccessibleInterface; class QDragEnterEvent; class QDragMoveEvent; +class QDropEvent; class QMimeData; class QPageLayout; class QString; @@ -188,7 +189,7 @@ public: void enterDrag(QDragEnterEvent *e, const QPointF &screenPos); Qt::DropAction updateDragPosition(QDragMoveEvent *e, const QPointF &screenPos); void updateDragAction(int action); - void endDragging(const QPointF &clientPos, const QPointF &screenPos); + void endDragging(QDropEvent *e, const QPointF &screenPos); void leaveDrag(); #endif // QT_CONFIG(draganddrop) void printToPDF(const QPageLayout&, const QString&); diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index babfbd014..86fea67e8 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -1414,7 +1414,7 @@ void QQuickWebEngineView::dropEvent(QDropEvent *e) { Q_D(QQuickWebEngineView); e->accept(); - d->adapter->endDragging(e->pos(), mapToScreen(this, e->pos())); + d->adapter->endDragging(e, mapToScreen(this, e->pos())); } #endif // QT_CONFIG(draganddrop) diff --git a/src/webenginewidgets/api/qwebengineview.cpp b/src/webenginewidgets/api/qwebengineview.cpp index f03679d17..f515f0c9f 100644 --- a/src/webenginewidgets/api/qwebengineview.cpp +++ b/src/webenginewidgets/api/qwebengineview.cpp @@ -417,7 +417,7 @@ void QWebEngineView::dropEvent(QDropEvent *e) if (!d->m_dragEntered) return; e->accept(); - d->page->d_ptr->adapter->endDragging(e->pos(), mapToGlobal(e->pos())); + d->page->d_ptr->adapter->endDragging(e, mapToGlobal(e->pos())); d->m_dragEntered = false; } #endif // QT_CONFIG(draganddrop) -- cgit v1.2.3 From 1a70d36b8908f81710e2db9018ccb48d97749cd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCri=20Valdmann?= Date: Thu, 12 Jul 2018 13:36:57 +0200 Subject: Fix enum mismatch in WebContentsAdapter::enterDrag DragTargetDragEnter expects the 'int key_modifiers' parameter to have values from the enum blink::WebInputEvent::Modifiers and not ui::EventFlags. Also, contrary to the name, mouse modifiers are also expected. Task-number: QTBUG-69231 Change-Id: I2369609775243fded563dde7675c4bc2dfc81021 Reviewed-by: Kai Koehne --- src/core/web_contents_adapter.cpp | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 8fe86ddc2..57b2039ed 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -1526,24 +1526,6 @@ static void fillDropDataFromMimeData(content::DropData *dropData, const QMimeDat } } -void WebContentsAdapter::enterDrag(QDragEnterEvent *e, const QPointF &screenPos) -{ - Q_D(WebContentsAdapter); - CHECK_INITIALIZED(); - - if (!d->currentDropData) { - // The drag originated outside the WebEngineView. - d->currentDropData.reset(new content::DropData); - fillDropDataFromMimeData(d->currentDropData.get(), e->mimeData()); - } - - content::RenderViewHost *rvh = d->webContents->GetRenderViewHost(); - rvh->GetWidget()->FilterDropData(d->currentDropData.get()); - rvh->GetWidget()->DragTargetDragEnter(*d->currentDropData, toGfx(e->posF()), toGfx(screenPos), - toWeb(e->possibleActions()), - flagsFromModifiers(e->keyboardModifiers())); -} - Qt::DropAction toQt(blink::WebDragOperation op) { if (op & blink::kWebDragOperationCopy) @@ -1581,6 +1563,24 @@ static int toWeb(Qt::KeyboardModifiers modifiers) return result; } +void WebContentsAdapter::enterDrag(QDragEnterEvent *e, const QPointF &screenPos) +{ + Q_D(WebContentsAdapter); + CHECK_INITIALIZED(); + + if (!d->currentDropData) { + // The drag originated outside the WebEngineView. + d->currentDropData.reset(new content::DropData); + fillDropDataFromMimeData(d->currentDropData.get(), e->mimeData()); + } + + content::RenderViewHost *rvh = d->webContents->GetRenderViewHost(); + rvh->GetWidget()->FilterDropData(d->currentDropData.get()); + rvh->GetWidget()->DragTargetDragEnter(*d->currentDropData, toGfx(e->posF()), toGfx(screenPos), + toWeb(e->possibleActions()), + toWeb(e->mouseButtons()) | toWeb(e->keyboardModifiers())); +} + Qt::DropAction WebContentsAdapter::updateDragPosition(QDragMoveEvent *e, const QPointF &screenPos) { Q_D(WebContentsAdapter); -- cgit v1.2.3 From f055da31fb011e852345665fceb6933fa966f731 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCri=20Valdmann?= Date: Mon, 9 Jul 2018 09:27:33 +0200 Subject: Fix segfault in devtools openInNewTab handling - Use OpenURL on the devtools WebContents. - Guard against self-destruction (otherwise quicknanobrowser crashes). - Change quicknanobrowser to open links in new tabs. Task-number: QTBUG-69359 Change-Id: I4db379731c6fa855124d38c5066b0aad622861d2 Reviewed-by: Allan Sandfeld Jensen --- src/core/devtools_frontend_qt.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/core/devtools_frontend_qt.cpp b/src/core/devtools_frontend_qt.cpp index 810235dba..1f741f526 100644 --- a/src/core/devtools_frontend_qt.cpp +++ b/src/core/devtools_frontend_qt.cpp @@ -428,7 +428,16 @@ void DevToolsFrontendQt::HandleMessageFromDevToolsFrontend(const std::string &me WindowOpenDisposition::NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, false); - m_frontendDelegate->OpenURLFromTab(nullptr, openParams); + // OpenURL will (via WebContentsDelegateQt::OpenURLFromTab) call + // application code, which may decide to close this devtools view (see + // quicknanobrowser for example). + // + // Chromium always calls SendMessageAck through a callback bound to a + // WeakPtr, we do the same here, except without the callback. + base::WeakPtr weakThis = m_weakFactory.GetWeakPtr(); + web_contents()->OpenURL(openParams); + if (!weakThis) + return; } else if (method == "bringToFront") { Activate(); } else { -- cgit v1.2.3 From 8f914155c4d32fd8befa01c6cc09957d082ca7fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCri=20Valdmann?= Date: Thu, 19 Jul 2018 10:54:33 +0200 Subject: QWebEngineUrlRequestJob: QUrl("null") for unique initiator origins The empty URL is used both for representing a missing origin (browser-initiated navigation request) and a unique/opaque origin. This is problematic since the security implications are very different in these two cases: browser-initiated requests usually should have high security clearance, while requests from unique origins should be restricted. Task-number: QTBUG-69372 Change-Id: Iff73fd1c9a29f1c5c281a8945536333081ff2d6b Reviewed-by: Allan Sandfeld Jensen --- src/core/api/qwebengineurlrequestjob.cpp | 21 ++++++++++++++++++--- src/core/net/url_request_custom_job_proxy.cpp | 2 +- 2 files changed, 19 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/core/api/qwebengineurlrequestjob.cpp b/src/core/api/qwebengineurlrequestjob.cpp index c028a1167..f741b88e8 100644 --- a/src/core/api/qwebengineurlrequestjob.cpp +++ b/src/core/api/qwebengineurlrequestjob.cpp @@ -115,9 +115,24 @@ QByteArray QWebEngineUrlRequestJob::requestMethod() const /*! \since 5.11 - Returns the origin URL of the content that initiated the request. If the - request was not initiated by web content the function will return an - empty QUrl. + Returns the serialized origin of the content that initiated the request. + + Generally, the origin consists of a scheme, hostname, and port. For example, + \c "http://localhost:8080" would be a valid origin. The port is omitted if + it is the scheme's default port (80 for \c http, 443 for \c https). The + hostname is omitted for non-network schemes such as \c file and \c qrc. + + However, there is also the special value \c "null" representing a unique + origin. It is, for example, the origin of a sandboxed iframe. The purpose of + this special origin is to be always different from all other origins in the + same-origin check. In other words, content with a unique origin should never + have privileged access to any other content. + + Finally, if the request was not initiated by web content, the function will + return an empty QUrl. This happens, for example, when you call \l + QWebEnginePage::setUrl(). + + This value can be used for implementing secure cross-origin checks. */ QUrl QWebEngineUrlRequestJob::initiator() const { diff --git a/src/core/net/url_request_custom_job_proxy.cpp b/src/core/net/url_request_custom_job_proxy.cpp index 6c9824bb9..526ac2f8b 100644 --- a/src/core/net/url_request_custom_job_proxy.cpp +++ b/src/core/net/url_request_custom_job_proxy.cpp @@ -158,7 +158,7 @@ void URLRequestCustomJobProxy::initialize(GURL url, std::string method, base::Op QUrl initiatorOrigin; if (initiator.has_value()) - initiatorOrigin = toQt(initiator.value().GetURL()); + initiatorOrigin = QUrl::fromEncoded(QByteArray::fromStdString(initiator.value().Serialize())); QWebEngineUrlSchemeHandler *schemeHandler = 0; QSharedPointer browserContext = m_adapter.toStrongRef(); -- cgit v1.2.3 From 10376cbe5d653f1fd1a5554e00d288eaf3e94a78 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Fri, 6 Jul 2018 20:07:44 +0200 Subject: Add threading and security note for print() Adds note for QWebEnginePage::print(...) function. Change-Id: I52ec78ccfc5c4eeb98ee69f9aaab01b380f97a81 Reviewed-by: Leena Miettinen Reviewed-by: Szabolcs David Reviewed-by: Kai Koehne --- src/webenginewidgets/api/qwebenginepage.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index 10c9e586c..745ce03fc 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -2267,6 +2267,11 @@ void QWebEnginePage::printToPdf(const QWebEngineCallback &res It is the users responsibility to ensure the \a printer remains valid until \a resultCallback has been called. + \note The rendering of the current content into a temporary PDF document is asynchronous and does + not block the main thread. However, the subsequent rendering of PDF into \a printer runs on the + main thread and will therefore block the event loop. Moreover, printing runs on the browser + process, which is by default not sandboxed. + The \a resultCallback must take a boolean as parameter. If printing was successful, this boolean will have the value \c true, otherwise, its value will be \c false. \since 5.8 -- cgit v1.2.3 From 38952ec359423a060d9e2f500f2d9eba2336f532 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCri=20Valdmann?= Date: Fri, 20 Jul 2018 10:22:12 +0200 Subject: Fix minimum GCC version in documentation The documentation says we require 4.7 or later but actually already since the 5.10.0 release our qmake config has been checking for version 5 or later. Task-number: QTBUG-69535 Change-Id: Ia2f74b35570a9ba6fd1423b9507fe636d850db76 Reviewed-by: Kai Koehne --- src/webengine/doc/src/qtwebengine-platform-notes.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc index 5d7c70560..f72a3e5be 100644 --- a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc +++ b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc @@ -73,7 +73,7 @@ \section2 Linux - On Linux, Clang or GCC version 4.7 or later is required. + On Linux, Clang or GCC version 5 or later is required. Supported configurations are \c linux-g++ and \c{linux-clang}. Qt WebEngine requires \c pkg-config to detect most of its dependencies. The -- cgit v1.2.3 From 4097c53421c6aed90c5e78f974c1d2ab4fdf339f Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 23 Jul 2018 09:09:19 +0200 Subject: Update Chromium Include following patches: c020786f57 Fix compilation failure in time_win.cc eea22d3cac [Backport] media: Increase DecoderBuffer::kPaddingSize to 64 91d24cdd6f Reduce severity level of messages when kDisableGpu switch is used 298fb05460 Fix --single-process --disable-gpu combination not to hit asserts db81dc68a8 Remove incomplete logic to detect AMD K2 CPU's b11fd882e8 Do not write .json to source directory Change-Id: I4e3c0c2f3908f358b43ae4af8baebc2012c9830b Reviewed-by: Alexandru Croitor --- src/3rdparty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/3rdparty b/src/3rdparty index bad02200c..c020786f5 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit bad02200c68d7e0c758dc4f1805e58d0e03fdea9 +Subproject commit c020786f57b8f5f3a450a8b77f850afe7c0d3f25 -- cgit v1.2.3 From d603b705539e1ec0d93761707d7df6d07bced98a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCri=20Valdmann?= Date: Tue, 24 Jul 2018 17:21:34 +0200 Subject: Use net::TransportSecurityPersister to persist HSTS state Task-number: QTBUG-69605 Change-Id: I863db484ff2bcf558585f75c73963097fb43148a Reviewed-by: Allan Sandfeld Jensen --- src/core/net/url_request_context_getter_qt.cpp | 18 +++++++++++++++++- src/core/net/url_request_context_getter_qt.h | 3 +++ 2 files changed, 20 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/core/net/url_request_context_getter_qt.cpp b/src/core/net/url_request_context_getter_qt.cpp index 904130611..1bb7b080f 100644 --- a/src/core/net/url_request_context_getter_qt.cpp +++ b/src/core/net/url_request_context_getter_qt.cpp @@ -64,6 +64,7 @@ #include "net/http/http_auth_scheme.h" #include "net/http/http_cache.h" #include "net/http/http_server_properties_impl.h" +#include "net/http/transport_security_persister.h" #include "net/proxy/proxy_script_fetcher_impl.h" #include "net/proxy/proxy_service.h" #include "net/ssl/channel_id_service.h" @@ -142,6 +143,7 @@ void URLRequestContextGetterQt::setFullConfiguration(QSharedPointerhttpCachePath(); m_httpCacheMaxSize = browserContext->httpCacheMaxSize(); m_customUrlSchemes = browserContext->customUrlSchemes(); + m_dataPath = browserContext->dataPath(); } net::URLRequestContext *URLRequestContextGetterQt::GetURLRequestContext() @@ -235,6 +237,7 @@ void URLRequestContextGetterQt::generateStorage() // we need to get rid of dangling pointer due to coming storage deletion m_urlRequestContext->set_http_transaction_factory(0); m_httpNetworkSession.reset(); + m_transportSecurityPersister.reset(); } @@ -266,7 +269,20 @@ void URLRequestContextGetterQt::generateStorage() m_networkDelegate.get())); m_storage->set_ssl_config_service(new net::SSLConfigServiceDefaults); - m_storage->set_transport_security_state(std::unique_ptr(new net::TransportSecurityState())); + m_storage->set_transport_security_state(std::make_unique()); + + if (!m_dataPath.isEmpty()) { + scoped_refptr background_task_runner( + base::CreateSequencedTaskRunnerWithTraits( + {base::MayBlock(), + base::TaskPriority::BACKGROUND, + base::TaskShutdownBehavior::BLOCK_SHUTDOWN})); + m_transportSecurityPersister = + std::make_unique( + m_urlRequestContext->transport_security_state(), + toFilePath(m_dataPath), + background_task_runner); + } if (!m_httpAuthPreferences) { std::vector auth_types(std::begin(kDefaultAuthSchemes), std::end(kDefaultAuthSchemes)); diff --git a/src/core/net/url_request_context_getter_qt.h b/src/core/net/url_request_context_getter_qt.h index 0eb4a2fe4..717827543 100644 --- a/src/core/net/url_request_context_getter_qt.h +++ b/src/core/net/url_request_context_getter_qt.h @@ -63,6 +63,7 @@ namespace net { class HttpAuthPreferences; class MappedHostResolver; class ProxyConfigService; +class TransportSecurityPersister; } namespace QtWebEngineCore { @@ -126,6 +127,7 @@ private: std::unique_ptr m_httpNetworkSession; std::unique_ptr m_httpAuthPreferences; proxy_resolver::mojom::ProxyResolverFactoryPtr m_proxyResolverFactory; + std::unique_ptr m_transportSecurityPersister; QList m_installedCustomSchemes; QWebEngineUrlRequestInterceptor* m_requestInterceptor; @@ -141,6 +143,7 @@ private: QString m_httpCachePath; int m_httpCacheMaxSize; QList m_customUrlSchemes; + QString m_dataPath; friend class NetworkDelegateQt; }; -- cgit v1.2.3 From c56169f7a1bcbe45f3c89a78b8a5a4606666db83 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Mon, 8 May 2017 11:39:28 +0200 Subject: Close popups when parent window is moved MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When an HTML select box was clicked inside of a QWebEngineView and the parent QWebEngineView window was moved using the mouse (via window decoration toolbar for example) the popup window would stay around instead of being closed. This happened because of the usage of the Qt:Tool window flag for the popup window, which implies a tool that floats near its parent window. The fix is threefold: 1) Use Qt::Popup instead, similarly to how QMenu does it. Whenever the parent window is moved, the popup will now get a CloseEvent. 2) Handle the CloseEvent by telling Chromium to close and destroy the popup. 3) On Windows the OS might send mouse move events to the popup RWHVQD instance after its parent QWebEngineView, RWHVQD, QWebEnginePagePrivate (client adapter) is destroyed. We need to guard the mouse forwarding code not to access the client adapter if it has already been destroyed. The second point is done by telling Chromium that its popup lost focus which it interprets as a sign to hide it, and automatically destroy it. This will destroy the underlying RWHVQtDelegateWidget and RWHVQt instances. Task-number: QTBUG-59891 Change-Id: I47f94a93c495a6caa5de92a6022eaca154994eda Reviewed-by: Michael Brüning --- src/core/render_widget_host_view_qt.cpp | 15 ++++++++++++++- src/core/render_widget_host_view_qt.h | 1 + src/core/render_widget_host_view_qt_delegate.h | 1 + .../render_widget_host_view_qt_delegate_widget.cpp | 22 +++++++++++++--------- .../render_widget_host_view_qt_delegate_widget.h | 1 + 5 files changed, 30 insertions(+), 10 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 7cb23bb58..3641398f6 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -1072,7 +1072,11 @@ bool RenderWidgetHostViewQt::forwardEvent(QEvent *event) case QEvent::MouseMove: // Skip second MouseMove event when a window is being adopted, so that Chromium // can properly handle further move events. - if (m_adapterClient->isBeingAdopted()) + // Also make sure the adapter client exists to prevent a null pointer dereference, + // because it's possible for a QWebEnginePagePrivate (adapter) instance to be destroyed, + // and then the OS (observed on Windows) might still send mouse move events to a still + // existing popup RWHVQDW instance. + if (m_adapterClient && m_adapterClient->isBeingAdopted()) return false; handleMouseEvent(static_cast(event)); break; @@ -1171,6 +1175,15 @@ QVariant RenderWidgetHostViewQt::inputMethodQuery(Qt::InputMethodQuery query) } } +void RenderWidgetHostViewQt::closePopup() +{ + // We notify the popup to be closed by telling it that it lost focus. WebKit does the rest + // (hiding the widget and automatic memory cleanup via + // RenderWidget::CloseWidgetSoon() -> RenderWidgetHostImpl::ShutdownAndDestroyWidget(true). + m_host->SetActive(false); + m_host->Blur(); +} + void RenderWidgetHostViewQt::ProcessAckedTouchEvent(const content::TouchEventWithLatencyInfo &touch, content::InputEventAckState ack_result) { Q_UNUSED(touch); const bool eventConsumed = ack_result == content::INPUT_EVENT_ACK_STATE_CONSUMED; diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h index 0c62b7279..cc62fa110 100644 --- a/src/core/render_widget_host_view_qt.h +++ b/src/core/render_widget_host_view_qt.h @@ -174,6 +174,7 @@ public: void windowChanged() override; bool forwardEvent(QEvent *) override; QVariant inputMethodQuery(Qt::InputMethodQuery query) override; + void closePopup() override; // Overridden from content::TextInputManager::Observer void OnUpdateTextInputStateCalled(content::TextInputManager *text_input_manager, RenderWidgetHostViewBase *updated_view, bool did_update_state) override; diff --git a/src/core/render_widget_host_view_qt_delegate.h b/src/core/render_widget_host_view_qt_delegate.h index bcd0f49f7..3ac3ccc1e 100644 --- a/src/core/render_widget_host_view_qt_delegate.h +++ b/src/core/render_widget_host_view_qt_delegate.h @@ -78,6 +78,7 @@ public: virtual void windowChanged() = 0; virtual bool forwardEvent(QEvent *) = 0; virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) = 0; + virtual void closePopup() = 0; }; class QWEBENGINE_EXPORT RenderWidgetHostViewQtDelegate { 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 98482ae78..c32e89f0c 100644 --- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp +++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp @@ -218,20 +218,24 @@ void RenderWidgetHostViewQtDelegateWidget::initAsPopup(const QRect& screenRect) // to be destroyed. setAttribute(Qt::WA_ShowWithoutActivating); setFocusPolicy(Qt::NoFocus); - -#ifdef Q_OS_MACOS - // macOS doesn't like Qt::ToolTip when QWebEngineView is inside a modal dialog, specifically by - // not forwarding click events to the popup. So we use Qt::Tool which behaves the same way, but - // works on macOS too. - setWindowFlags(Qt::Tool | Qt::FramelessWindowHint | Qt::WindowDoesNotAcceptFocus); -#else - setWindowFlags(Qt::ToolTip | Qt::FramelessWindowHint | Qt::WindowDoesNotAcceptFocus); -#endif + setWindowFlags(Qt::Popup | Qt::FramelessWindowHint | Qt::WindowDoesNotAcceptFocus); setGeometry(screenRect); show(); } +void RenderWidgetHostViewQtDelegateWidget::closeEvent(QCloseEvent *event) +{ + Q_UNUSED(event); + + // If a close event was received from the window manager (e.g. when moving the parent window, + // clicking outside the popup area) + // make sure to notify the Chromium WebUI popup and its underlying + // RenderWidgetHostViewQtDelegate instance to be closed. + if (m_isPopup) + m_client->closePopup(); +} + QRectF RenderWidgetHostViewQtDelegateWidget::screenRect() const { return QRectF(x(), y(), width(), height()); diff --git a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h index 79958132c..ab24b1e41 100644 --- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h +++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h @@ -83,6 +83,7 @@ protected: void resizeEvent(QResizeEvent *resizeEvent) override; void showEvent(QShowEvent *) override; void hideEvent(QHideEvent *) override; + void closeEvent(QCloseEvent *event) override; QVariant inputMethodQuery(Qt::InputMethodQuery query) const override; -- cgit v1.2.3 From 8d8287035ce8730065d61937bee665055348fcb2 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Mon, 30 Jul 2018 12:58:24 +0200 Subject: Fix bougs documentation for QWebEngineUrlRequestJob::reply IODevice::close and therefore aboutToClose is called by io thread, connecting it to deleteLater will register deferred delete on event loop of IODevice instance, which is on ui thread. This could be racy since deletion on ui thread can happen before job is done. Change-Id: I895e6a71649ba65944d069f254d119cc60aada6c Reviewed-by: Allan Sandfeld Jensen --- src/core/api/qwebengineurlrequestjob.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/core/api/qwebengineurlrequestjob.cpp b/src/core/api/qwebengineurlrequestjob.cpp index f741b88e8..c3541598b 100644 --- a/src/core/api/qwebengineurlrequestjob.cpp +++ b/src/core/api/qwebengineurlrequestjob.cpp @@ -151,9 +151,10 @@ QUrl QWebEngineUrlRequestJob::initiator() const The device should remain available at least as long as the job exists. When calling this method with a newly constructed device, one solution is to - make the device delete itself when closed, like this: + make the device as a child of the job or delete itself when job is deleted, + like this: \code - connect(device, &QIODevice::aboutToClose, device, &QObject::deleteLater); + connect(job, &QObject::destroyed, device, &QObject::deleteLater); \endcode */ void QWebEngineUrlRequestJob::reply(const QByteArray &contentType, QIODevice *device) -- cgit v1.2.3 From 6f9edfab79b53c06152bc9e049c4f69bc0c440e4 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 26 Jul 2018 14:41:14 +0200 Subject: Clarify how key / mouse QEvents are propagated to a popup RWHVQD object Change-Id: I74f6a607d96733fa379526be40c6a13c31203d4e Reviewed-by: Michal Klocek Reviewed-by: Qt CI Bot --- src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h index ab24b1e41..42b454bc5 100644 --- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h +++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h @@ -48,6 +48,12 @@ namespace QtWebEngineCore { +// Useful information keyboard and mouse QEvent propagation. +// A RenderWidgetHostViewQtDelegateWidget instance initialized as a popup will receive +// no keyboard focus (so all keyboard QEvents will be sent to the parent RWHVQD instance), +// but will still receive mouse input (all mouse QEvent moves and clicks will be given to the popup +// RWHVQD instance, and the mouse interaction area covers the surface of the whole parent +// QWebEngineView, and not only the smaller surface that an HTML select popup would occupy). class RenderWidgetHostViewQtDelegateWidget : public QQuickWidget, public RenderWidgetHostViewQtDelegate { Q_OBJECT public: -- cgit v1.2.3 From 0c01be81920123a3c3456b727efcb2e9593c65df Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 3 Aug 2018 14:36:10 +0200 Subject: Update Chromium Changes: 2d61f0a269 Work around MSVC2017 optimizer bug when printing a page usind Pdfium 6d6103fe51 [Backport] flush to zero tiny radii edf63ed29d [Backport] use double to compute root to avoid overflow 7777b6ac95 [Backport] Generate GL errors more strictly in StrictIdHandler. 0c00f4a924 [Backport] Validate all incoming WebGLObjects. a6a96845cc [Backport] Prevent potential buffer overflow in UlpfecReceiver a3d55fb8e4 [Backport] Check number of nalus in packet before checking nalu types. Change-Id: Icd501a956ce396a38098272848bc25065ad92748 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 c020786f5..a3d55fb8e 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit c020786f57b8f5f3a450a8b77f850afe7c0d3f25 +Subproject commit a3d55fb8e46caed89ea49aaa0604e1251ce6ab0d -- cgit v1.2.3 From 410c22978c2add5f9427af08d97356d6e959e412 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCri=20Valdmann?= Date: Tue, 7 Aug 2018 09:15:53 +0200 Subject: MediaCaptureDevicesDispatcher: Disable getDefaultScreenId on X11 Not needed and triggers race condition. Task-number: QTBUG-69007 Change-Id: Id57ba527387e5dbe44a8dd6c5a49e7278403ce64 Reviewed-by: Michal Klocek --- src/core/media_capture_devices_dispatcher.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/core/media_capture_devices_dispatcher.cpp b/src/core/media_capture_devices_dispatcher.cpp index 87fe543b1..7f521dd10 100644 --- a/src/core/media_capture_devices_dispatcher.cpp +++ b/src/core/media_capture_devices_dispatcher.cpp @@ -123,7 +123,16 @@ std::unique_ptr getDevicesForDesktopCapture(content::Med content::DesktopMediaID getDefaultScreenId() { -#if BUILDFLAG(ENABLE_WEBRTC) + // While this function is executing another thread may also want to create a + // DesktopCapturer [1]. Unfortunately, creating a DesktopCapturer is not + // thread safe on X11 due to the use of webrtc::XErrorTrap. It's safe to + // disable this code on X11 since we don't actually need to create a + // DesktopCapturer to get the screen id anyway + // (ScreenCapturerLinux::GetSourceList always returns 0 as the id). + // + // [1]: webrtc::InProcessVideoCaptureDeviceLauncher::DoStartDesktopCaptureOnDeviceThread + +#if BUILDFLAG(ENABLE_WEBRTC) && !defined(USE_X11) // Source id patterns are different across platforms. // On Linux, the hardcoded value "0" is used. // On Windows, the screens are enumerated consecutively in increasing order from 0. -- cgit v1.2.3 From 1cf852f6312e2918765e30f02657e9ad04e5cdff Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Fri, 10 Aug 2018 16:57:58 +0200 Subject: Update Chromium MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit pulls in security patches: * CVE-2018-6150 * CVE-2018-6152 * CVE-2018-6175 * CVE-2018-6155 Task-number: QTBUG-69663 Change-Id: If70e7817f4f9aa1fa482559b734085e6cdff89ed Reviewed-by: Michael Brüning --- src/3rdparty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/3rdparty b/src/3rdparty index a3d55fb8e..0ce2beac9 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit a3d55fb8e46caed89ea49aaa0604e1251ce6ab0d +Subproject commit 0ce2beac90d6996a23854a95c91880695059d073 -- cgit v1.2.3 From eb9f64c845eca80ec3f609c3dca62b353321ba86 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 27 Jul 2018 09:42:36 +0200 Subject: Fix --enable-webgl-software-rendering with drivers that don't support OpenGL --enable-webgl-software-rendering is supposed to be used together with mesa llvmpipe / opengl32sw.dll. However, Chromium did still use the built-in GPU blacklist to disable features based on the hardware GPU driver. Avoid this by always passing --ignore-gpu-blacklist for this mode. Task-number: QTBUG-69236 Change-Id: I430d101f6eac64478585de54f705e76859c80597 Reviewed-by: Alexandru Croitor --- src/core/web_engine_context.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 35402cdb0..62d62119a 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -493,8 +493,10 @@ WebEngineContext::WebEngineContext() parsedCommandLine->AppendSwitchASCII(switches::kUseGL, glType); parsedCommandLine->AppendSwitch(switches::kInProcessGPU); #ifdef Q_OS_WIN - if (enableWebGLSoftwareRendering) + if (enableWebGLSoftwareRendering) { parsedCommandLine->AppendSwitch(switches::kDisableGpuRasterization); + parsedCommandLine->AppendSwitch(switches::kIgnoreGpuBlacklist); + } #endif } else { parsedCommandLine->AppendSwitch(switches::kDisableGpu); -- cgit v1.2.3 From e56dd7e37ea96c4ba1354e319bdaa9d01c401747 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Br=C3=BCning?= Date: Wed, 15 Aug 2018 16:55:24 +0200 Subject: Update Chromium MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This pulls in the following changes : * 827405 [Backport] Security fix for Chromium bug 854887 * e79b92 [Backport] Security fix for Chromium bug 861571 * d845af [Backport] CVE-2018-6161 * 3cdf31 [Backport] CVE-2018-6159 * 625870 [Backport] CVE-2018-6162 * 2b111a [Backport] CVE-2018-6164 * eb5360 [Backport] blink: disable XML catalogs at runtime * 273272 Bump maximum number of custom isolated world ids * 8f53e0 [Backport] CVE-2018-6167 * 07c34e [Backport] CVE-2018-6172 CVE-2018-6163 * 5d8596 [Backport] CVE-2018-6165 * e8b9ae [Backport] CVE-2018-6177 CVE-2018-6168 * 0cce34 [Backport] CVE-2018-4117 Task-number: QTBUG-69663 Change-Id: Ied119f9d0b28ccba4954c087ab7bcf129969d52a Reviewed-by: Jüri Valdmann --- src/3rdparty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/3rdparty b/src/3rdparty index 0ce2beac9..82740520c 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit 0ce2beac90d6996a23854a95c91880695059d073 +Subproject commit 82740520c942c91f596ee53ff3ca09ac4e494890 -- cgit v1.2.3