From 4caea33d8f5ac4f40cf261856d07d8ad797fc013 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Br=C3=BCning?= Date: Mon, 12 Oct 2015 11:31:10 +0200 Subject: [Doc] Correct the name of WebEngineNewViewRequest::userInitiated QML property. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was named isUserInitiated, which is the name of the C++ method used internally, not the name of the QML property. Task-number: QTBUG-48699 Change-Id: I82d69e3c2e011f1cffadc106322709d2b22ef275 Reviewed-by: Topi Reiniö --- src/webengine/api/qquickwebenginenewviewrequest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/webengine/api/qquickwebenginenewviewrequest.cpp b/src/webengine/api/qquickwebenginenewviewrequest.cpp index 68ea73208..f66a44e5f 100644 --- a/src/webengine/api/qquickwebenginenewviewrequest.cpp +++ b/src/webengine/api/qquickwebenginenewviewrequest.cpp @@ -69,7 +69,7 @@ QQuickWebEngineView::NewViewDestination QQuickWebEngineNewViewRequest::destinati } /*! - \qmlproperty bool WebEngineNewViewRequest::isUserInitiated + \qmlproperty bool WebEngineNewViewRequest::userInitiated Whether this window request was directly triggered as the result of a keyboard or mouse event. Use this property to block possibly unwanted \e popups. -- cgit v1.2.3 From 9553493c55ff35215601de794e396605ae39a0e4 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 22 Sep 2015 18:22:04 +0200 Subject: make the render process DPI-aware On Windows, system calls that retrieve screen properties (like GetSystemMetrics to get the size of a scroll bar button) are dependent on the DPI awareness setting of the calling process. The render process must use the same DPI awareness setting as the browser process. Retrieve the DPI awareness of the parent process in the render process and set it accordingly. Task-number: QTBUG-48380 Change-Id: Ic17d29d0f584e3cf230ac6ea2b08e3aa0d87ccdd Reviewed-by: Allan Sandfeld Jensen --- src/process/main.cpp | 8 +++ src/process/process.pro | 5 ++ src/process/support_win.cpp | 155 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 168 insertions(+) create mode 100644 src/process/support_win.cpp (limited to 'src') diff --git a/src/process/main.cpp b/src/process/main.cpp index 446465ef7..8328c0022 100644 --- a/src/process/main.cpp +++ b/src/process/main.cpp @@ -146,8 +146,16 @@ int stat64_proxy(const char *path, struct stat64 *buf) #endif #endif // defined(OS_LINUX) +#ifdef Q_OS_WIN +void initDpiAwareness(); +#endif // defined(Q_OS_WIN) + int main(int argc, const char **argv) { +#ifdef Q_OS_WIN + initDpiAwareness(); +#endif + // QCoreApplication needs a non-const pointer, while the // ContentMain in Chromium needs the pointer to be const. QCoreApplication qtApplication(argc, const_cast(argv)); diff --git a/src/process/process.pro b/src/process/process.pro index 7844b1004..5526b0f1c 100644 --- a/src/process/process.pro +++ b/src/process/process.pro @@ -40,6 +40,11 @@ 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 { diff --git a/src/process/support_win.cpp b/src/process/support_win.cpp new file mode 100644 index 000000000..4ccd51627 --- /dev/null +++ b/src/process/support_win.cpp @@ -0,0 +1,155 @@ +/**************************************************************************** +** +** Copyright (C) 2015 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 +#include +#include +#include + +class User32DLL { +public: + User32DLL() + : setProcessDPIAware(0) + { + library.setFileName(QStringLiteral("User32")); + if (!library.load()) + return; + setProcessDPIAware = (SetProcessDPIAware)library.resolve("SetProcessDPIAware"); + } + + bool isValid() const + { + return setProcessDPIAware; + } + + typedef BOOL (WINAPI *SetProcessDPIAware)(); + + // Windows Vista onwards + SetProcessDPIAware setProcessDPIAware; + +private: + QLibrary library; +}; + +// This must match PROCESS_DPI_AWARENESS in ShellScalingApi.h +enum DpiAwareness { + PROCESS_PER_UNAWARE = 0, + PROCESS_PER_SYSTEM_DPI_AWARE = 1, + PROCESS_PER_MONITOR_DPI_AWARE = 2 +}; + +// Shell scaling library (Windows 8.1 onwards) +class ShcoreDLL { +public: + ShcoreDLL() + : getProcessDpiAwareness(0), setProcessDpiAwareness(0) + { + if (QSysInfo::windowsVersion() < QSysInfo::WV_WINDOWS8_1) + return; + library.setFileName(QStringLiteral("SHCore")); + if (!library.load()) + return; + getProcessDpiAwareness = (GetProcessDpiAwareness)library.resolve("GetProcessDpiAwareness"); + setProcessDpiAwareness = (SetProcessDpiAwareness)library.resolve("SetProcessDpiAwareness"); + } + + bool isValid() const + { + return getProcessDpiAwareness && setProcessDpiAwareness; + } + + typedef HRESULT (WINAPI *GetProcessDpiAwareness)(HANDLE, DpiAwareness *); + typedef HRESULT (WINAPI *SetProcessDpiAwareness)(DpiAwareness); + + GetProcessDpiAwareness getProcessDpiAwareness; + SetProcessDpiAwareness setProcessDpiAwareness; + +private: + QLibrary library; +}; + + +static DWORD getParentProcessId() +{ + HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); + if (hSnapshot == INVALID_HANDLE_VALUE) { + qErrnoWarning(GetLastError(), "CreateToolhelp32Snapshot failed."); + return NULL; + } + + PROCESSENTRY32 pe = {0}; + pe.dwSize = sizeof(PROCESSENTRY32); + + if (!Process32First(hSnapshot, &pe)) { + qWarning("Cannot retrieve parent process handle."); + return NULL; + } + + DWORD parentPid = NULL; + const DWORD pid = GetCurrentProcessId(); + do { + if (pe.th32ProcessID == pid) { + parentPid = pe.th32ParentProcessID; + break; + } + } while (Process32Next(hSnapshot, &pe)); + CloseHandle(hSnapshot); + return parentPid; +} + +void initDpiAwareness() +{ + ShcoreDLL shcore; + if (shcore.isValid()) { + DpiAwareness dpiAwareness = PROCESS_PER_MONITOR_DPI_AWARE; + const DWORD pid = getParentProcessId(); + if (pid) { + HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid); + DpiAwareness parentDpiAwareness; + HRESULT hr = shcore.getProcessDpiAwareness(hProcess, &parentDpiAwareness); + CloseHandle(hProcess); + if (hr == S_OK) + dpiAwareness = parentDpiAwareness; + } + if (shcore.setProcessDpiAwareness(dpiAwareness) != S_OK) + qErrnoWarning(GetLastError(), "SetProcessDPIAwareness failed."); + } else { + // Fallback. Use SetProcessDPIAware unconditionally. + User32DLL user32; + if (user32.isValid()) + user32.setProcessDPIAware(); + } +} -- cgit v1.2.3 From b54b46c70fd7c092c30c748655389df44ba6ced9 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 13 Oct 2015 10:56:37 +0200 Subject: Set off-the-record to true as documented The API had no way of setting off-the-record, because the constructor meant for it set it to false. The patch fixes the constructor and adds basic API tests for the QWebEngineProfiles. Change-Id: I407eb4a4b0524b6c4eb944d17d744620dd9db6fb Task-number: QTBUG-48724 Reviewed-by: Kai Koehne --- src/webenginewidgets/api/qwebengineprofile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/webenginewidgets/api/qwebengineprofile.cpp b/src/webenginewidgets/api/qwebengineprofile.cpp index 2e5f685fd..fee57f5ec 100644 --- a/src/webenginewidgets/api/qwebengineprofile.cpp +++ b/src/webenginewidgets/api/qwebengineprofile.cpp @@ -193,7 +193,7 @@ void QWebEngineProfilePrivate::downloadUpdated(const DownloadItemInfo &info) */ QWebEngineProfile::QWebEngineProfile(QObject *parent) : QObject(parent) - , d_ptr(new QWebEngineProfilePrivate(new BrowserContextAdapter(false))) + , d_ptr(new QWebEngineProfilePrivate(new BrowserContextAdapter(true))) { d_ptr->q_ptr = this; } -- cgit v1.2.3 From ce095e94b686196629244073990530441b9b5f4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Br=C3=BCning?= Date: Wed, 14 Oct 2015 17:13:52 +0200 Subject: Update qtwebengine-chromium sha1. This is needed to include a fix for windows developer builds. Change-Id: I341167adc89e1dec05180f48194c0c22b3a3a77a Reviewed-by: Allan Sandfeld Jensen --- src/3rdparty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/3rdparty b/src/3rdparty index 305284960..705542779 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit 305284960db83fe9b9ae47674db9914d82180c23 +Subproject commit 7055427796b506c44962d9332f7990136669c6a3 -- cgit v1.2.3 From fa06a1662b80160eb9bf475775345e8af49a9554 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Thu, 22 Oct 2015 15:50:33 +0200 Subject: Remove const from QWebEngineCookieStoreClient::FilterRequest in setCookieFilter callback FilterRequest can be rejected by changing FilterRequest::accepted to false, so it should not be const. Change-Id: I87cd0f97dd442c6676aeeda9e1cbeb582eb06741 Reviewed-by: Kai Koehne --- src/core/api/qwebenginecookiestoreclient.cpp | 4 ++-- src/core/api/qwebenginecookiestoreclient.h | 2 +- src/core/api/qwebenginecookiestoreclient_p.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/core/api/qwebenginecookiestoreclient.cpp b/src/core/api/qwebenginecookiestoreclient.cpp index 167b3f68c..bd43b871d 100644 --- a/src/core/api/qwebenginecookiestoreclient.cpp +++ b/src/core/api/qwebenginecookiestoreclient.cpp @@ -181,7 +181,7 @@ bool QWebEngineCookieStoreClientPrivate::canSetCookie(const QUrl &firstPartyUrl, request.firstPartyUrl = firstPartyUrl; request.cookieLine = cookieLine; request.cookieSource = url; - callbackDirectory.invokeDirectly(filterCallback, request); + callbackDirectory.invokeDirectly(filterCallback, request); return request.accepted; } return true; @@ -394,7 +394,7 @@ void QWebEngineCookieStoreClient::deleteAllCookies() \sa deleteAllCookiesWithCallback(), getAllCookies() */ -void QWebEngineCookieStoreClient::setCookieFilter(const QWebEngineCallback &filter) +void QWebEngineCookieStoreClient::setCookieFilter(const QWebEngineCallback &filter) { Q_D(QWebEngineCookieStoreClient); d->filterCallback = filter; diff --git a/src/core/api/qwebenginecookiestoreclient.h b/src/core/api/qwebenginecookiestoreclient.h index 8bdb988e2..4664a8459 100644 --- a/src/core/api/qwebenginecookiestoreclient.h +++ b/src/core/api/qwebenginecookiestoreclient.h @@ -77,7 +77,7 @@ public: void deleteSessionCookiesWithCallback(const QWebEngineCallback &resultCallback); void deleteAllCookiesWithCallback(const QWebEngineCallback &resultCallback); void getAllCookies(const QWebEngineCallback &resultCallback); - void setCookieFilter(const QWebEngineCallback &filterCallback); + void setCookieFilter(const QWebEngineCallback &filterCallback); #endif void setCookie(const QNetworkCookie &cookie, const QUrl &origin = QUrl()); void deleteCookie(const QNetworkCookie &cookie, const QUrl &origin = QUrl()); diff --git a/src/core/api/qwebenginecookiestoreclient_p.h b/src/core/api/qwebenginecookiestoreclient_p.h index 43652fba6..68ab6549f 100644 --- a/src/core/api/qwebenginecookiestoreclient_p.h +++ b/src/core/api/qwebenginecookiestoreclient_p.h @@ -74,7 +74,7 @@ class QWEBENGINE_PRIVATE_EXPORT QWebEngineCookieStoreClientPrivate { public: Q_DECLARE_PUBLIC(QWebEngineCookieStoreClient) QtWebEngineCore::CallbackDirectory callbackDirectory; - QWebEngineCallback filterCallback; + QWebEngineCallback filterCallback; QList m_pendingUserCookies; quint64 m_nextCallbackId; bool m_deleteSessionCookiesPending; -- cgit v1.2.3 From c66dd34cf7f13cf2208859023fcded1b41dee154 Mon Sep 17 00:00:00 2001 From: Szabolcs David Date: Wed, 21 Oct 2015 08:20:49 -0700 Subject: Remove revisioning from WebEngineSettings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We can't use revisions in uncreatable types because QTBUG-40043 is affecting our API. Change-Id: Id9bf18fe8cfda590079ed72d7ca8b1c298aff90e Reviewed-by: Peter Varga Reviewed-by: Michael Brüning Reviewed-by: Kai Koehne --- src/webengine/api/qquickwebenginesettings_p.h | 6 ++++-- src/webengine/plugin/plugin.cpp | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/webengine/api/qquickwebenginesettings_p.h b/src/webengine/api/qquickwebenginesettings_p.h index 604e5693d..030762ed3 100644 --- a/src/webengine/api/qquickwebenginesettings_p.h +++ b/src/webengine/api/qquickwebenginesettings_p.h @@ -72,7 +72,8 @@ class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineSettings : public QObject { Q_PROPERTY(bool hyperlinkAuditingEnabled READ hyperlinkAuditingEnabled WRITE setHyperlinkAuditingEnabled NOTIFY hyperlinkAuditingEnabledChanged) Q_PROPERTY(bool errorPageEnabled READ errorPageEnabled WRITE setErrorPageEnabled NOTIFY errorPageEnabledChanged) Q_PROPERTY(bool pluginsEnabled READ pluginsEnabled WRITE setPluginsEnabled NOTIFY pluginsEnabledChanged) - Q_PROPERTY(bool fullScreenSupportEnabled READ fullScreenSupportEnabled WRITE setFullScreenSupportEnabled NOTIFY fullScreenSupportEnabledChanged REVISION 1) + // FIXME(QTBUG-40043): Mark fullScreenSupportEnabled with REVISION 1 + Q_PROPERTY(bool fullScreenSupportEnabled READ fullScreenSupportEnabled WRITE setFullScreenSupportEnabled NOTIFY fullScreenSupportEnabledChanged) Q_PROPERTY(QString defaultTextEncoding READ defaultTextEncoding WRITE setDefaultTextEncoding NOTIFY defaultTextEncodingChanged) public: @@ -121,7 +122,8 @@ signals: void hyperlinkAuditingEnabledChanged(); void errorPageEnabledChanged(); void pluginsEnabledChanged(); - Q_REVISION(1) void fullScreenSupportEnabledChanged(); + // FIXME(QTBUG-40043): Mark fullScreenSupportEnabledChanged with Q_REVISION(1) + void fullScreenSupportEnabledChanged(); void defaultTextEncodingChanged(); private: diff --git a/src/webengine/plugin/plugin.cpp b/src/webengine/plugin/plugin.cpp index c42eb63d5..16d36b190 100644 --- a/src/webengine/plugin/plugin.cpp +++ b/src/webengine/plugin/plugin.cpp @@ -78,7 +78,7 @@ public: tr("Cannot create a separate instance of WebEngineDownloadItem")); qmlRegisterUncreatableType(uri, 1, 1, "WebEngineNewViewRequest", tr("Cannot create separate instance of WebEngineNewViewRequest")); qmlRegisterUncreatableType(uri, 1, 1, "WebEngineSettings", tr("Cannot create a separate instance of WebEngineSettings")); - qmlRegisterUncreatableType(uri, 1, 2, "WebEngineSettings", tr("Cannot create a separate instance of WebEngineSettings")); + // FIXME(QTBUG-40043): qmlRegisterUncreatableType(uri, 1, 2, "WebEngineSettings", tr("Cannot create a separate instance of WebEngineSettings")); qmlRegisterSingletonType(uri, 1, 1, "WebEngine", webEngineSingletonProvider); qmlRegisterUncreatableType(uri, 1, 1, "NavigationHistory", tr("Cannot create a separate instance of NavigationHistory")); -- cgit v1.2.3 From 5181419f88990d698d0b9e5bf6cf07260ceb5e53 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 22 Oct 2015 08:20:10 +0200 Subject: Compilation fixes for MSVC 2015 (64 bit) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Take in compile fixes for new ninja, and MSVC 2015 (64 bit). Change-Id: Iaa2531a507e2c7034dfe39813c952d7ad75e7285 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 9409dd360..ae431a6bc 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit 9409dd36053110043e048ebdc5ded4c72f26f479 +Subproject commit ae431a6bc66d30847024c5cbfa2b10bc931ef0da -- cgit v1.2.3 From cc3a0d7c39196937edf98c80d0c0a9f96443f6b6 Mon Sep 17 00:00:00 2001 From: Michael Bruning Date: Fri, 23 Oct 2015 14:04:43 +0200 Subject: Include memory leak fix in the 3rdparty submodule. Uses the backported fix from newer Chromium versions. Task-number: QTBUG-48822 Change-Id: If9c5746b350840ae1fdbd5331dd2abb8e6118b8a Reviewed-by: Florian Bruhin Reviewed-by: Kai Koehne --- src/3rdparty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/3rdparty b/src/3rdparty index 705542779..2ccb9f03c 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit 7055427796b506c44962d9332f7990136669c6a3 +Subproject commit 2ccb9f03c534c28b1c3d2f2d09d131a70cdfe9f3 -- cgit v1.2.3 From 427e5bc2d49ea4422eafbcd316c88d0713ac6ea8 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 23 Oct 2015 14:22:16 +0000 Subject: Revert "Fix build with freetype2 depending on harfbuzz" We should trust the global Qt configuration, the same issue should have been solved in qtbase already. This fixes RedHat builds where FreeType2 reports a wrong version. This reverts commit 981e38d2dc82c047c6ad8ec19427d3ac7434dc3c. Change-Id: I662105521b277585c83335e20831692f990e4dc1 Reviewed-by: Simon Hausmann --- src/core/config/linux.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/core/config/linux.pri b/src/core/config/linux.pri index 7f269245e..8d736d0c1 100644 --- a/src/core/config/linux.pri +++ b/src/core/config/linux.pri @@ -27,9 +27,9 @@ GYP_CONFIG += \ contains(QT_CONFIG, system-zlib): use?(system_minizip): GYP_CONFIG += use_system_zlib=1 contains(QT_CONFIG, system-png): GYP_CONFIG += use_system_libpng=1 contains(QT_CONFIG, system-jpeg): GYP_CONFIG += use_system_libjpeg=1 +contains(QT_CONFIG, system-harfbuzz): GYP_CONFIG += use_system_harfbuzz=1 !contains(QT_CONFIG, pulseaudio): GYP_CONFIG += use_pulseaudio=0 -use?(system_harfbuzz): GYP_CONFIG += use_system_harfbuzz=1 use?(system_libevent): GYP_CONFIG += use_system_libevent=1 use?(system_libwebp): GYP_CONFIG += use_system_libwebp=1 use?(system_libsrtp): GYP_CONFIG += use_system_libsrtp=1 -- cgit v1.2.3 From 09a341f4a62a0fe244dc188a75d77d0067ad1fe7 Mon Sep 17 00:00:00 2001 From: Christophe Chapuis Date: Tue, 13 Oct 2015 23:15:51 +0200 Subject: Fix touch events coordinates when using custom devicePixelRatio Task-number: QTBUG-48766 Change-Id: Idcae6dc84829fe96db62c6cb30ab193873d36709 Reviewed-by: Kai Koehne Reviewed-by: Joerg Bornemann --- src/core/render_widget_host_view_qt.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 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 572bc340c..7c5ed64e7 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -182,12 +182,13 @@ static inline int flagsFromModifiers(Qt::KeyboardModifiers modifiers) class MotionEventQt : public ui::MotionEvent { public: - MotionEventQt(const QList &touchPoints, const base::TimeTicks &eventTime, Action action, const Qt::KeyboardModifiers modifiers, int index = -1) + MotionEventQt(const QList &touchPoints, const base::TimeTicks &eventTime, Action action, const Qt::KeyboardModifiers modifiers, float dpiScale, int index = -1) : touchPoints(touchPoints) , eventTime(eventTime) , action(action) , flags(flagsFromModifiers(modifiers)) , index(index) + , dpiScale(dpiScale) { // ACTION_DOWN and ACTION_UP must be accesssed through pointer_index 0 Q_ASSERT((action != ACTION_DOWN && action != ACTION_UP) || index == 0); @@ -198,8 +199,8 @@ public: virtual int GetActionIndex() const Q_DECL_OVERRIDE { return index; } virtual size_t GetPointerCount() const Q_DECL_OVERRIDE { return touchPoints.size(); } virtual int GetPointerId(size_t pointer_index) const Q_DECL_OVERRIDE { return touchPoints.at(pointer_index).id(); } - virtual float GetX(size_t pointer_index) const Q_DECL_OVERRIDE { return touchPoints.at(pointer_index).pos().x(); } - virtual float GetY(size_t pointer_index) const Q_DECL_OVERRIDE { return touchPoints.at(pointer_index).pos().y(); } + virtual float GetX(size_t pointer_index) const Q_DECL_OVERRIDE { return touchPoints.at(pointer_index).pos().x() / dpiScale; } + virtual float GetY(size_t pointer_index) const Q_DECL_OVERRIDE { return touchPoints.at(pointer_index).pos().y() / dpiScale; } virtual float GetRawX(size_t pointer_index) const Q_DECL_OVERRIDE { return touchPoints.at(pointer_index).screenPos().x(); } virtual float GetRawY(size_t pointer_index) const Q_DECL_OVERRIDE { return touchPoints.at(pointer_index).screenPos().y(); } virtual float GetTouchMajor(size_t pointer_index) const Q_DECL_OVERRIDE @@ -234,6 +235,7 @@ private: Action action; int flags; int index; + float dpiScale; }; RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost* widget) @@ -999,7 +1001,7 @@ 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()); + MotionEventQt cancelEvent(touchPoints, eventTimestamp, ui::MotionEvent::ACTION_CANCEL, ev->modifiers(), dpiScale()); processMotionEvent(cancelEvent); return; } @@ -1032,7 +1034,7 @@ void RenderWidgetHostViewQt::handleTouchEvent(QTouchEvent *ev) continue; } - MotionEventQt motionEvent(touchPoints, eventTimestamp, action, ev->modifiers(), i); + MotionEventQt motionEvent(touchPoints, eventTimestamp, action, ev->modifiers(), dpiScale(), i); processMotionEvent(motionEvent); } } -- cgit v1.2.3 From 8af33b19f8f24f49a0ca8ef5c8097757103e5253 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 10 Sep 2015 11:36:08 +0200 Subject: Use web_cache component MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the web_cache component which monitors and adjusts the web cache, so that the memory use is limited across multiple renderer processes. Change-Id: I9faa060d48f99a3c527fe0e0963bbe86db4b502c Reviewed-by: Joerg Bornemann Reviewed-by: Michael Brüning --- src/core/qtwebengine.gypi | 2 ++ src/core/renderer/content_renderer_client_qt.cpp | 5 ++++- src/core/renderer/content_renderer_client_qt.h | 5 +++++ src/core/renderer/qt_render_view_observer.cpp | 12 +++++++++++- src/core/renderer/qt_render_view_observer.h | 10 +++++++++- src/core/web_contents_delegate_qt.cpp | 7 +++++++ src/core/web_contents_delegate_qt.h | 1 + 7 files changed, 39 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/core/qtwebengine.gypi b/src/core/qtwebengine.gypi index a420918a0..96b48e2ca 100644 --- a/src/core/qtwebengine.gypi +++ b/src/core/qtwebengine.gypi @@ -13,6 +13,8 @@ '<(chromium_src_dir)/components/components.gyp:error_page_renderer', '<(chromium_src_dir)/components/components.gyp:visitedlink_browser', '<(chromium_src_dir)/components/components.gyp:visitedlink_renderer', + '<(chromium_src_dir)/components/components.gyp:web_cache_browser', + '<(chromium_src_dir)/components/components.gyp:web_cache_renderer', '<(chromium_src_dir)/content/content.gyp:content', '<(chromium_src_dir)/content/content.gyp:content_app_browser', '<(chromium_src_dir)/content/content.gyp:content_browser', diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp index 72ca29be9..e281cbc95 100644 --- a/src/core/renderer/content_renderer_client_qt.cpp +++ b/src/core/renderer/content_renderer_client_qt.cpp @@ -40,6 +40,7 @@ #include "chrome/common/localized_error.h" #include "components/error_page/common/error_page_params.h" #include "components/visitedlink/renderer/visitedlink_slave.h" +#include "components/web_cache/renderer/web_cache_render_process_observer.h" #include "content/public/renderer/render_frame.h" #include "content/public/renderer/render_thread.h" #include "content/public/renderer/render_view.h" @@ -77,7 +78,9 @@ void ContentRendererClientQt::RenderThreadStarted() content::RenderThread *renderThread = content::RenderThread::Get(); renderThread->RegisterExtension(WebChannelIPCTransport::getV8Extension()); m_visitedLinkSlave.reset(new visitedlink::VisitedLinkSlave); + m_webCacheObserver.reset(new web_cache::WebCacheRenderProcessObserver()); renderThread->AddObserver(m_visitedLinkSlave.data()); + renderThread->AddObserver(m_webCacheObserver.data()); renderThread->AddObserver(UserScriptController::instance()); // mark qrc as a secure scheme (avoids deprecation warnings) @@ -87,7 +90,7 @@ void ContentRendererClientQt::RenderThreadStarted() void ContentRendererClientQt::RenderViewCreated(content::RenderView* render_view) { // RenderViewObservers destroy themselves with their RenderView. - new QtRenderViewObserver(render_view); + new QtRenderViewObserver(render_view, m_webCacheObserver.data()); new WebChannelIPCTransport(render_view); UserScriptController::instance()->renderViewCreated(render_view); } diff --git a/src/core/renderer/content_renderer_client_qt.h b/src/core/renderer/content_renderer_client_qt.h index fab88441f..eb55156ad 100644 --- a/src/core/renderer/content_renderer_client_qt.h +++ b/src/core/renderer/content_renderer_client_qt.h @@ -45,6 +45,10 @@ namespace visitedlink { class VisitedLinkSlave; } +namespace web_cache { +class WebCacheRenderProcessObserver; +} + namespace QtWebEngineCore { class ContentRendererClientQt : public content::ContentRendererClient { @@ -64,6 +68,7 @@ public: private: QScopedPointer m_visitedLinkSlave; + QScopedPointer m_webCacheObserver; }; } // namespace diff --git a/src/core/renderer/qt_render_view_observer.cpp b/src/core/renderer/qt_render_view_observer.cpp index ba91e54ae..086b07d17 100644 --- a/src/core/renderer/qt_render_view_observer.cpp +++ b/src/core/renderer/qt_render_view_observer.cpp @@ -38,14 +38,18 @@ #include "common/qt_messages.h" +#include "components/web_cache/renderer/web_cache_render_process_observer.h" #include "content/public/renderer/render_view.h" #include "third_party/WebKit/public/web/WebDocument.h" #include "third_party/WebKit/public/web/WebElement.h" #include "third_party/WebKit/public/web/WebFrame.h" #include "third_party/WebKit/public/web/WebView.h" -QtRenderViewObserver::QtRenderViewObserver(content::RenderView* render_view) +QtRenderViewObserver::QtRenderViewObserver( + content::RenderView* render_view, + web_cache::WebCacheRenderProcessObserver* web_cache_render_process_observer) : content::RenderViewObserver(render_view) + , m_web_cache_render_process_observer(web_cache_render_process_observer) { } @@ -86,3 +90,9 @@ bool QtRenderViewObserver::OnMessageReceived(const IPC::Message& message) IPC_END_MESSAGE_MAP() return handled; } + +void QtRenderViewObserver::Navigate(const GURL &) +{ + if (m_web_cache_render_process_observer) + m_web_cache_render_process_observer->ExecutePendingClearCache(); +} diff --git a/src/core/renderer/qt_render_view_observer.h b/src/core/renderer/qt_render_view_observer.h index 3f7829a92..1ead53141 100644 --- a/src/core/renderer/qt_render_view_observer.h +++ b/src/core/renderer/qt_render_view_observer.h @@ -40,9 +40,14 @@ #include +namespace web_cache { +class WebCacheRenderProcessObserver; +} + class QtRenderViewObserver : public content::RenderViewObserver { public: - QtRenderViewObserver(content::RenderView* render_view); + QtRenderViewObserver(content::RenderView* render_view, + web_cache::WebCacheRenderProcessObserver* web_cache_render_process_observer); private: void onFetchDocumentMarkup(quint64 requestId); @@ -52,6 +57,9 @@ private: void OnFirstVisuallyNonEmptyLayout() Q_DECL_OVERRIDE; virtual bool OnMessageReceived(const IPC::Message& message) Q_DECL_OVERRIDE; + virtual void Navigate(const GURL& url) Q_DECL_OVERRIDE; + + web_cache::WebCacheRenderProcessObserver* m_web_cache_render_process_observer; DISALLOW_COPY_AND_ASSIGN(QtRenderViewObserver); }; diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index 1f789161a..1897664e3 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -51,12 +51,14 @@ #include "web_engine_settings.h" #include "web_engine_visited_links_manager.h" +#include "components/web_cache/browser/web_cache_manager.h" #include "content/browser/renderer_host/render_widget_host_impl.h" #include "content/public/browser/favicon_status.h" #include "content/public/browser/invalidate_type.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/render_frame_host.h" +#include "content/public/browser/render_process_host.h" #include "content/public/browser/web_contents.h" #include "content/public/common/favicon_url.h" #include "content/public/common/file_chooser_params.h" @@ -315,6 +317,11 @@ void WebContentsDelegateQt::DidNavigateAnyFrame(content::RenderFrameHost* render m_viewClient->browserContextAdapter()->visitedLinksManager()->addUrl(params.url); } +void WebContentsDelegateQt::WasShown() +{ + web_cache::WebCacheManager::GetInstance()->ObserveActivity(web_contents()->GetRenderProcessHost()->GetID()); +} + void WebContentsDelegateQt::RequestToLockMouse(content::WebContents *web_contents, bool user_gesture, bool last_unlocked_by_target) { Q_UNUSED(user_gesture); diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h index abdf75fe5..8f1317b6d 100644 --- a/src/core/web_contents_delegate_qt.h +++ b/src/core/web_contents_delegate_qt.h @@ -104,6 +104,7 @@ public: virtual void DidFinishLoad(content::RenderFrameHost *render_frame_host, const GURL &validated_url) Q_DECL_OVERRIDE; virtual void DidUpdateFaviconURL(const std::vector &candidates) Q_DECL_OVERRIDE; virtual void DidNavigateAnyFrame(content::RenderFrameHost *render_frame_host, const content::LoadCommittedDetails &details, const content::FrameNavigateParams ¶ms) Q_DECL_OVERRIDE; + virtual void WasShown() Q_DECL_OVERRIDE; void overrideWebPreferences(content::WebContents *, content::WebPreferences*); void allowCertificateError(const QSharedPointer &) ; -- cgit v1.2.3 From 717f56999939bb9c1aeb88c959afdafb4ada02cc Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 28 Oct 2015 11:22:42 +0100 Subject: Add namespace to the specialized QSG nodes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add QtWebEngineCore namespace to classes I missed earlier. Change-Id: Ia40b03c58e0aec858e8fbe9a8fdb532349353046 Reviewed-by: Michael Brüning --- src/core/stream_video_node.cpp | 4 ++++ src/core/stream_video_node.h | 11 +++++++---- src/core/yuv_video_node.cpp | 4 ++++ src/core/yuv_video_node.h | 14 +++++++++----- 4 files changed, 24 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/core/stream_video_node.cpp b/src/core/stream_video_node.cpp index a5a6041f3..7481d49ed 100644 --- a/src/core/stream_video_node.cpp +++ b/src/core/stream_video_node.cpp @@ -38,6 +38,8 @@ #include +namespace QtWebEngineCore { + class StreamVideoMaterialShader : public QSGMaterialShader { public: @@ -141,3 +143,5 @@ void StreamVideoNode::setTextureMatrix(const QMatrix4x4 &matrix) { m_material->m_texMatrix = matrix; } + +} // namespace diff --git a/src/core/stream_video_node.h b/src/core/stream_video_node.h index f808bb609..bd2c3408a 100644 --- a/src/core/stream_video_node.h +++ b/src/core/stream_video_node.h @@ -40,9 +40,9 @@ #include #include -QT_BEGIN_NAMESPACE -class QSGTexture; -QT_END_NAMESPACE +QT_FORWARD_DECLARE_CLASS(QSGTexture) + +namespace QtWebEngineCore { // These classes duplicate, QtQuick style, the logic of GLRenderer::DrawStreamVideoQuad. // Their behavior should stay as close as possible to GLRenderer. @@ -52,7 +52,8 @@ class StreamVideoMaterial : public QSGMaterial public: StreamVideoMaterial(QSGTexture *texture); - virtual QSGMaterialType *type() const Q_DECL_OVERRIDE{ + virtual QSGMaterialType *type() const Q_DECL_OVERRIDE + { static QSGMaterialType theType; return &theType; } @@ -75,4 +76,6 @@ private: StreamVideoMaterial *m_material; }; +} // namespace + #endif // STREAM_VIDEO_NODE_H diff --git a/src/core/yuv_video_node.cpp b/src/core/yuv_video_node.cpp index 815ea7d51..7deeb5802 100644 --- a/src/core/yuv_video_node.cpp +++ b/src/core/yuv_video_node.cpp @@ -40,6 +40,8 @@ #include #include +namespace QtWebEngineCore { + class YUVVideoMaterialShader : public QSGMaterialShader { public: @@ -369,3 +371,5 @@ void YUVVideoNode::setRect(const QRectF &rect) { QSGGeometry::updateTexturedRectGeometry(geometry(), rect, QRectF(0, 0, 1, 1)); } + +} // namespace diff --git a/src/core/yuv_video_node.h b/src/core/yuv_video_node.h index 457c2c7fe..5b13879d3 100644 --- a/src/core/yuv_video_node.h +++ b/src/core/yuv_video_node.h @@ -40,9 +40,9 @@ #include #include -QT_BEGIN_NAMESPACE -class QSGTexture; -QT_END_NAMESPACE +QT_FORWARD_DECLARE_CLASS(QSGTexture) + +namespace QtWebEngineCore { // These classes duplicate, QtQuick style, the logic of GLRenderer::DrawYUVVideoQuad. // Their behavior should stay as close as possible to GLRenderer. @@ -59,7 +59,8 @@ public: const QRectF &yaTexCoordRect, const QRectF &uvTexCoordRect, const QSizeF &yaTexSize, const QSizeF &uvTexSize, ColorSpace colorspace); - virtual QSGMaterialType *type() const Q_DECL_OVERRIDE { + virtual QSGMaterialType *type() const Q_DECL_OVERRIDE + { static QSGMaterialType theType; return &theType; } @@ -85,7 +86,8 @@ public: const QRectF &yaTexCoordRect, const QRectF &uvTexCoordRect, const QSizeF &yaTexSize, const QSizeF &uvTexSize, ColorSpace colorspace); - virtual QSGMaterialType *type() const Q_DECL_OVERRIDE{ + virtual QSGMaterialType *type() const Q_DECL_OVERRIDE + { static QSGMaterialType theType; return &theType; } @@ -109,4 +111,6 @@ private: YUVVideoMaterial *m_material; }; +} // namespace + #endif // YUV_VIDEO_NODE_H -- cgit v1.2.3 From 0237a0c19e2b1ab840abe6dc649d31f4ae2863b9 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 28 Oct 2015 12:09:07 +0100 Subject: Remove left-overs of QWebEngineUrlSchemeHandlerPrivate The class no longer exists, these appears to have been overlooked when it was removed. Change-Id: I0f3632ac075f8e59bdb40b4178094fbb2cb348e4 Reviewed-by: Joerg Bornemann --- src/core/api/qwebengineurlschemehandler.cpp | 1 - src/core/api/qwebengineurlschemehandler.h | 3 --- 2 files changed, 4 deletions(-) (limited to 'src') diff --git a/src/core/api/qwebengineurlschemehandler.cpp b/src/core/api/qwebengineurlschemehandler.cpp index f887e4e98..7f9ebaf48 100644 --- a/src/core/api/qwebengineurlschemehandler.cpp +++ b/src/core/api/qwebengineurlschemehandler.cpp @@ -75,7 +75,6 @@ QWebEngineUrlSchemeHandler::QWebEngineUrlSchemeHandler(QObject *parent) QWebEngineUrlSchemeHandler::~QWebEngineUrlSchemeHandler() { Q_EMIT destroyed(this); - delete d_ptr; } /*! diff --git a/src/core/api/qwebengineurlschemehandler.h b/src/core/api/qwebengineurlschemehandler.h index 8c1e52646..66aebe00d 100644 --- a/src/core/api/qwebengineurlschemehandler.h +++ b/src/core/api/qwebengineurlschemehandler.h @@ -48,7 +48,6 @@ class URLRequestContextGetterQt; QT_BEGIN_NAMESPACE class QWebEngineUrlRequestJob; -class QWebEngineUrlSchemeHandlerPrivate; class QWEBENGINE_EXPORT QWebEngineUrlSchemeHandler : public QObject { Q_OBJECT @@ -63,8 +62,6 @@ Q_SIGNALS: private: Q_DISABLE_COPY(QWebEngineUrlSchemeHandler) - Q_DECLARE_PRIVATE(QWebEngineUrlSchemeHandler) - QWebEngineUrlSchemeHandlerPrivate *d_ptr; }; QT_END_NAMESPACE -- cgit v1.2.3 From 2cb021c2978d5d8ab5ba565f10d9eddc27c6347f Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 21 Oct 2015 09:26:47 +0200 Subject: Update plugins.qmltypes Change-Id: I1d628d9d2aab7c1b8144d79d8ce9d5dabdb99f32 Reviewed-by: Allan Sandfeld Jensen --- src/webengine/plugin/plugins.qmltypes | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/webengine/plugin/plugins.qmltypes b/src/webengine/plugin/plugins.qmltypes index 1e577bf51..7a310d268 100644 --- a/src/webengine/plugin/plugins.qmltypes +++ b/src/webengine/plugin/plugins.qmltypes @@ -488,8 +488,10 @@ Module { exports: ["QtWebEngine/FullScreenRequest 1.1"] isCreatable: false exportMetaObjectRevisions: [0] + Property { name: "origin"; type: "QUrl"; isReadonly: true } Property { name: "toggleOn"; type: "bool"; isReadonly: true } Method { name: "accept" } + Method { name: "reject" } } Component { name: "QQuickWebEngineHistory" @@ -609,11 +611,7 @@ Module { name: "downloadFinished" Parameter { name: "download"; type: "QQuickWebEngineDownloadItem"; isPointer: true } } - Method { - name: "setCookieStoreClient" - revision: 1 - Parameter { name: "client"; type: "QWebEngineCookieStoreClient"; isPointer: true } - } + Method { name: "cookieStoreClient"; revision: 1; type: "QWebEngineCookieStoreClient*" } } Component { name: "QQuickWebEngineScript" @@ -832,7 +830,8 @@ Module { "DownloadMediaToDisk": 25, "InspectElement": 26, "ExitFullScreen": 27, - "WebActionCount": 28 + "RequestClose": 28, + "WebActionCount": 29 } } Enum { @@ -953,6 +952,7 @@ Module { Parameter { name: "terminationStatus"; type: "RenderProcessTerminationStatus" } Parameter { name: "exitCode"; type: "int" } } + Signal { name: "windowCloseRequested"; revision: 2 } Method { name: "runJavaScript" Parameter { type: "string" } -- cgit v1.2.3 From b76be3dfc52ee7eb508e2837c9d83c8f79a5cb26 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 28 Oct 2015 10:58:35 +0100 Subject: Support IOSurface frames MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Support getting video as IOSurface frames on OS X. With Chromium 45 we only get IOSurface frame when using non-default command-line flags. Change-Id: Ibf5226db53fa6fb51112bec9061d701918798ddd Reviewed-by: Michael Brüning --- src/core/delegated_frame_node.cpp | 25 +++++++++++++++++++++++-- src/core/stream_video_node.cpp | 35 +++++++++++++++++++++++++++-------- src/core/stream_video_node.h | 8 ++++++-- 3 files changed, 56 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/core/delegated_frame_node.cpp b/src/core/delegated_frame_node.cpp index aebdfd027..1b6a80f82 100644 --- a/src/core/delegated_frame_node.cpp +++ b/src/core/delegated_frame_node.cpp @@ -57,6 +57,7 @@ #include "cc/quads/checkerboard_draw_quad.h" #include "cc/quads/debug_border_draw_quad.h" #include "cc/quads/draw_quad.h" +#include "cc/quads/io_surface_draw_quad.h" #include "cc/quads/render_pass_draw_quad.h" #include "cc/quads/solid_color_draw_quad.h" #include "cc/quads/stream_video_draw_quad.h" @@ -80,6 +81,10 @@ #define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull #endif +#ifndef GL_TEXTURE_RECTANGLE +#define GL_TEXTURE_RECTANGLE 0x84F5 +#endif + namespace QtWebEngineCore { class MailboxTexture : public QSGTexture, protected QOpenGLFunctions { @@ -655,13 +660,29 @@ void DelegatedFrameNode::commit(ChromiumCompositorData *chromiumCompositorData, MailboxTexture *texture = static_cast(initAndHoldTexture(resource, quad->ShouldDrawWithBlending())); texture->setTarget(GL_TEXTURE_EXTERNAL_OES); // since this is not default TEXTURE_2D type - StreamVideoNode *svideoNode = new StreamVideoNode(texture); + StreamVideoNode *svideoNode = new StreamVideoNode(texture, false, ExternalTarget); svideoNode->setRect(toQt(squad->rect)); svideoNode->setTextureMatrix(toQt(squad->matrix.matrix())); currentLayerChain->appendChildNode(svideoNode); break; #endif - } default: + } + case cc::DrawQuad::IO_SURFACE_CONTENT: { + const cc::IOSurfaceDrawQuad *ioquad = cc::IOSurfaceDrawQuad::MaterialCast(quad); + ResourceHolder *resource = findAndHoldResource(ioquad->io_surface_resource_id(), resourceCandidates); + MailboxTexture *texture = static_cast(initAndHoldTexture(resource, quad->ShouldDrawWithBlending())); + texture->setTarget(GL_TEXTURE_RECTANGLE); + + bool flip = ioquad->orientation != cc::IOSurfaceDrawQuad::FLIPPED; + StreamVideoNode *svideoNode = new StreamVideoNode(texture, flip, RectangleTarget); + QMatrix4x4 matrix; + matrix.scale(ioquad->io_surface_size.width(), ioquad->io_surface_size.height()); + svideoNode->setRect(toQt(ioquad->rect)); + svideoNode->setTextureMatrix(matrix); + currentLayerChain->appendChildNode(svideoNode); + break; + } + default: qWarning("Unimplemented quad material: %d", quad->material); } } diff --git a/src/core/stream_video_node.cpp b/src/core/stream_video_node.cpp index 7481d49ed..fdae5fee2 100644 --- a/src/core/stream_video_node.cpp +++ b/src/core/stream_video_node.cpp @@ -43,6 +43,7 @@ namespace QtWebEngineCore { class StreamVideoMaterialShader : public QSGMaterialShader { public: + StreamVideoMaterialShader(TextureTarget target) : m_target(target) { } virtual void updateState(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial); virtual char const *const *attributeNames() const Q_DECL_OVERRIDE { @@ -57,7 +58,7 @@ public: protected: virtual const char *vertexShader() const Q_DECL_OVERRIDE { // Keep in sync with cc::VertexShaderVideoTransform - const char *shader = + static const char *shader = "attribute highp vec4 a_position;\n" "attribute mediump vec2 a_texCoord;\n" "uniform highp mat4 matrix;\n" @@ -72,7 +73,7 @@ protected: virtual const char *fragmentShader() const Q_DECL_OVERRIDE { // Keep in sync with cc::FragmentShaderRGBATexAlpha - static const char *shader = + static const char *shaderExternal = "#extension GL_OES_EGL_image_external : require\n" "varying mediump vec2 v_texCoord;\n" "uniform samplerExternalOES s_texture;\n" @@ -81,7 +82,19 @@ protected: " lowp vec4 texColor = texture2D(s_texture, v_texCoord);\n" " gl_FragColor = texColor * alpha;\n" "}"; - return shader; + static const char *shader2DRect = + "#extension GL_ARB_texture_rectangle : require\n" + "varying mediump vec2 v_texCoord;\n" + "uniform sampler2DRect s_texture;\n" + "uniform lowp float alpha;\n" + "void main() {\n" + " lowp vec4 texColor = texture2DRect(s_texture, v_texCoord);\n" + " gl_FragColor = texColor * alpha;\n" + "}"; + if (m_target == ExternalTarget) + return shaderExternal; + else + return shader2DRect; } virtual void initialize() { @@ -95,6 +108,7 @@ protected: int m_id_texMatrix; int m_id_sTexture; int m_id_opacity; + TextureTarget m_target; }; void StreamVideoMaterialShader::updateState(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) @@ -115,28 +129,33 @@ void StreamVideoMaterialShader::updateState(const RenderState &state, QSGMateria program()->setUniformValue(m_id_texMatrix, mat->m_texMatrix); } -StreamVideoMaterial::StreamVideoMaterial(QSGTexture *texture) +StreamVideoMaterial::StreamVideoMaterial(QSGTexture *texture, TextureTarget target) : m_texture(texture) + , m_target(target) { } QSGMaterialShader *StreamVideoMaterial::createShader() const { - return new StreamVideoMaterialShader; + return new StreamVideoMaterialShader(m_target); } -StreamVideoNode::StreamVideoNode(QSGTexture *texture) +StreamVideoNode::StreamVideoNode(QSGTexture *texture, bool flip, TextureTarget target) : m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4) + , m_flip(flip) { setGeometry(&m_geometry); setFlag(QSGNode::OwnsMaterial); - m_material = new StreamVideoMaterial(texture); + m_material = new StreamVideoMaterial(texture, target); setMaterial(m_material); } void StreamVideoNode::setRect(const QRectF &rect) { - QSGGeometry::updateTexturedRectGeometry(geometry(), rect, QRectF(0, 0, 1, 1)); + if (m_flip) + QSGGeometry::updateTexturedRectGeometry(geometry(), rect, QRectF(0, 1, 1, -1)); + else + QSGGeometry::updateTexturedRectGeometry(geometry(), rect, QRectF(0, 0, 1, 1)); } void StreamVideoNode::setTextureMatrix(const QMatrix4x4 &matrix) diff --git a/src/core/stream_video_node.h b/src/core/stream_video_node.h index bd2c3408a..92c640811 100644 --- a/src/core/stream_video_node.h +++ b/src/core/stream_video_node.h @@ -47,10 +47,12 @@ namespace QtWebEngineCore { // These classes duplicate, QtQuick style, the logic of GLRenderer::DrawStreamVideoQuad. // Their behavior should stay as close as possible to GLRenderer. +enum TextureTarget { ExternalTarget, RectangleTarget }; + class StreamVideoMaterial : public QSGMaterial { public: - StreamVideoMaterial(QSGTexture *texture); + StreamVideoMaterial(QSGTexture *texture, TextureTarget target); virtual QSGMaterialType *type() const Q_DECL_OVERRIDE { @@ -62,17 +64,19 @@ public: QSGTexture *m_texture; QMatrix4x4 m_texMatrix; + TextureTarget m_target; }; class StreamVideoNode : public QSGGeometryNode { public: - StreamVideoNode(QSGTexture *texture); + StreamVideoNode(QSGTexture *texture, bool flip, TextureTarget target); void setRect(const QRectF &rect); void setTextureMatrix(const QMatrix4x4 &matrix); private: QSGGeometry m_geometry; + bool m_flip; StreamVideoMaterial *m_material; }; -- cgit v1.2.3 From 2db502bb2b68ce0bb8fa85e796a70ba4b794de8c Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 28 Oct 2015 13:27:44 +0100 Subject: Update Chromium SHA1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pulls in the lastest 45-based SHA1 Change-Id: I7111143db7697cfa3861ba26255102717d1d39e2 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 ae431a6bc..ec5b3304f 160000 --- a/src/3rdparty +++ b/src/3rdparty @@ -1 +1 @@ -Subproject commit ae431a6bc66d30847024c5cbfa2b10bc931ef0da +Subproject commit ec5b3304fc266dfdec7666b8b73d57a3971ea35f -- cgit v1.2.3 From b27161b6057295e43d5a45646a8cf22d4aefa18e Mon Sep 17 00:00:00 2001 From: Christophe Chapuis Date: Wed, 28 Oct 2015 18:45:57 +0100 Subject: adoptWebContents: re-associate webchannel with new adapter Task-number: QTBUG-48984 Change-Id: Ief41fe9619f4300d7a0c25a57f09f5eefe3fca3d Reviewed-by: Allan Sandfeld Jensen --- src/webengine/api/qquickwebengineview.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index 6c3452a6a..129cfd2de 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -558,11 +558,21 @@ void QQuickWebEngineViewPrivate::adoptWebContents(WebContentsAdapter *webContent } Q_Q(QQuickWebEngineView); + + // memorize what webChannel we had for the previous adapter + QQmlWebChannel *qmlWebChannel = NULL; + if (adapter) + qmlWebChannel = qobject_cast(adapter->webChannel()); + // This throws away the WebContentsAdapter that has been used until now. // All its states, particularly the loading URL, are replaced by the adopted WebContentsAdapter. adapter = webContents; adapter->initialize(this); + // associate the webChannel with the new adapter + if (qmlWebChannel) + adapter->setWebChannel(qmlWebChannel); + // Emit signals for values that might be different from the previous WebContentsAdapter. emit q->titleChanged(); emit q->urlChanged(); -- cgit v1.2.3 From 9ec4353648b549de6f95386ca18aafb2732a6a19 Mon Sep 17 00:00:00 2001 From: Michael Bruning Date: Thu, 29 Oct 2015 12:01:11 +0100 Subject: Do not display context menu when pending event flag is false. When an event filter is installed on the view, the right mouse click event may trigger Chromium to request a context menu even though the context menu events get filtered out. Removes a Q_ASSERT that would now never be triggered. Change-Id: I3ff496ec4e4ecbb4faa107f7e221765918c5fa06 Task-number: QTBUG-49092 Reviewed-by: Joerg Bornemann --- src/webenginewidgets/api/qwebenginepage.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index 6207a2b30..bb8babd7a 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -700,7 +700,7 @@ bool QWebEnginePage::event(QEvent *e) bool QWebEnginePagePrivate::contextMenuRequested(const WebEngineContextMenuData &data) { - if (!view) + if (!view || !view->d_func()->m_pendingContextMenuEvent) return false; QContextMenuEvent event(QContextMenuEvent::Mouse, data.pos, view->mapToGlobal(data.pos)); @@ -725,7 +725,6 @@ bool QWebEnginePagePrivate::contextMenuRequested(const WebEngineContextMenuData return false; break; } - Q_ASSERT(view->d_func()->m_pendingContextMenuEvent); view->d_func()->m_pendingContextMenuEvent = false; m_menuData = WebEngineContextMenuData(); return true; -- cgit v1.2.3 From cfee452174c58fe4048b1604503d03de2764fc8e Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 28 Oct 2015 13:23:12 +0100 Subject: Use consistent naming of Qt-specific Chromium classes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Most of our Qt specific versions of Chromium classes have Qt appended, but a few observers have it prepended. This patch renames them to keep naming consistent. Change-Id: I004b61e16bc47f39a6bbc16a5f5c10585626865c Reviewed-by: Michael Brüning --- src/core/common/qt_messages.h | 12 +-- src/core/core_gyp_generator.pro | 12 +-- src/core/qt_render_view_observer_host.cpp | 96 ----------------------- src/core/qt_render_view_observer_host.h | 70 ----------------- src/core/render_view_observer_host_qt.cpp | 96 +++++++++++++++++++++++ src/core/render_view_observer_host_qt.h | 70 +++++++++++++++++ src/core/render_widget_host_view_qt.cpp | 5 +- src/core/renderer/content_renderer_client_qt.cpp | 8 +- src/core/renderer/qt_render_frame_observer.cpp | 65 ---------------- src/core/renderer/qt_render_frame_observer.h | 66 ---------------- src/core/renderer/qt_render_view_observer.cpp | 98 ------------------------ src/core/renderer/qt_render_view_observer.h | 67 ---------------- src/core/renderer/render_frame_observer_qt.cpp | 65 ++++++++++++++++ src/core/renderer/render_frame_observer_qt.h | 66 ++++++++++++++++ src/core/renderer/render_view_observer_qt.cpp | 98 ++++++++++++++++++++++++ src/core/renderer/render_view_observer_qt.h | 67 ++++++++++++++++ src/core/web_contents_adapter.cpp | 4 +- src/core/web_contents_adapter_p.h | 4 +- 18 files changed, 485 insertions(+), 484 deletions(-) delete mode 100644 src/core/qt_render_view_observer_host.cpp delete mode 100644 src/core/qt_render_view_observer_host.h create mode 100644 src/core/render_view_observer_host_qt.cpp create mode 100644 src/core/render_view_observer_host_qt.h delete mode 100644 src/core/renderer/qt_render_frame_observer.cpp delete mode 100644 src/core/renderer/qt_render_frame_observer.h delete mode 100644 src/core/renderer/qt_render_view_observer.cpp delete mode 100644 src/core/renderer/qt_render_view_observer.h create mode 100644 src/core/renderer/render_frame_observer_qt.cpp create mode 100644 src/core/renderer/render_frame_observer_qt.h create mode 100644 src/core/renderer/render_view_observer_qt.cpp create mode 100644 src/core/renderer/render_view_observer_qt.h (limited to 'src') diff --git a/src/core/common/qt_messages.h b/src/core/common/qt_messages.h index 25a995b27..ae36a0d7f 100644 --- a/src/core/common/qt_messages.h +++ b/src/core/common/qt_messages.h @@ -25,13 +25,13 @@ IPC_STRUCT_TRAITS_END() // RenderView messages // These are messages sent from the browser to the renderer process. -IPC_MESSAGE_ROUTED1(QtRenderViewObserver_FetchDocumentMarkup, +IPC_MESSAGE_ROUTED1(RenderViewObserverQt_FetchDocumentMarkup, uint64 /* requestId */) -IPC_MESSAGE_ROUTED1(QtRenderViewObserver_FetchDocumentInnerText, +IPC_MESSAGE_ROUTED1(RenderViewObserverQt_FetchDocumentInnerText, uint64 /* requestId */) -IPC_MESSAGE_ROUTED1(QtRenderViewObserver_SetBackgroundColor, +IPC_MESSAGE_ROUTED1(RenderViewObserverQt_SetBackgroundColor, uint32 /* color */) IPC_MESSAGE_ROUTED1(WebChannelIPCTransport_Message, std::vector /*binaryJSON*/) @@ -51,14 +51,14 @@ IPC_MESSAGE_CONTROL0(UserScriptController_ClearScripts) // WebContents messages // These are messages sent from the renderer back to the browser process. -IPC_MESSAGE_ROUTED2(QtRenderViewObserverHost_DidFetchDocumentMarkup, +IPC_MESSAGE_ROUTED2(RenderViewObserverHostQt_DidFetchDocumentMarkup, uint64 /* requestId */, base::string16 /* markup */) -IPC_MESSAGE_ROUTED2(QtRenderViewObserverHost_DidFetchDocumentInnerText, +IPC_MESSAGE_ROUTED2(RenderViewObserverHostQt_DidFetchDocumentInnerText, uint64 /* requestId */, base::string16 /* innerText */) -IPC_MESSAGE_ROUTED0(QtRenderViewObserverHost_DidFirstVisuallyNonEmptyLayout) +IPC_MESSAGE_ROUTED0(RenderViewObserverHostQt_DidFirstVisuallyNonEmptyLayout) IPC_MESSAGE_ROUTED1(WebChannelIPCTransportHost_SendMessage, std::vector /*binaryJSON*/) diff --git a/src/core/core_gyp_generator.pro b/src/core/core_gyp_generator.pro index 813626dc3..14b8d78e2 100644 --- a/src/core/core_gyp_generator.pro +++ b/src/core/core_gyp_generator.pro @@ -62,15 +62,15 @@ SOURCES = \ process_main.cpp \ proxy_config_service_qt.cpp \ qrc_protocol_handler_qt.cpp \ - qt_render_view_observer_host.cpp \ + render_view_observer_host_qt.cpp \ render_widget_host_view_qt.cpp \ renderer/content_renderer_client_qt.cpp \ renderer/pepper/pepper_flash_browser_host_qt.cpp \ renderer/pepper/pepper_flash_renderer_host_qt.cpp \ renderer/pepper/pepper_host_factory_qt.cpp \ renderer/pepper/pepper_renderer_host_factory_qt.cpp \ - renderer/qt_render_frame_observer.cpp \ - renderer/qt_render_view_observer.cpp \ + renderer/render_frame_observer_qt.cpp \ + renderer/render_view_observer_qt.cpp \ renderer/user_script_controller.cpp \ renderer/web_channel_ipc_transport.cpp \ resource_bundle_qt.cpp \ @@ -134,7 +134,7 @@ HEADERS = \ process_main.h \ proxy_config_service_qt.h \ qrc_protocol_handler_qt.h \ - qt_render_view_observer_host.h \ + render_view_observer_host_qt.h \ render_widget_host_view_qt.h \ render_widget_host_view_qt_delegate.h \ renderer/content_renderer_client_qt.h \ @@ -142,8 +142,8 @@ HEADERS = \ renderer/pepper/pepper_flash_renderer_host_qt.h \ renderer/pepper/pepper_host_factory_qt.h \ renderer/pepper/pepper_renderer_host_factory_qt.h \ - renderer/qt_render_frame_observer.h \ - renderer/qt_render_view_observer.h \ + renderer/render_frame_observer_qt.h \ + renderer/render_view_observer_qt.h \ renderer/user_script_controller.h \ renderer/web_channel_ipc_transport.h \ resource_context_qt.h \ diff --git a/src/core/qt_render_view_observer_host.cpp b/src/core/qt_render_view_observer_host.cpp deleted file mode 100644 index 97d001ed6..000000000 --- a/src/core/qt_render_view_observer_host.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 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 "qt_render_view_observer_host.h" - -#include "common/qt_messages.h" -#include "content/public/browser/web_contents.h" -#include "render_widget_host_view_qt.h" -#include "type_conversion.h" -#include "web_contents_adapter_client.h" - -namespace QtWebEngineCore { - -QtRenderViewObserverHost::QtRenderViewObserverHost(content::WebContents *webContents, WebContentsAdapterClient *adapterClient) - : content::WebContentsObserver(webContents) - , m_adapterClient(adapterClient) -{ -} - -void QtRenderViewObserverHost::fetchDocumentMarkup(quint64 requestId) -{ - Send(new QtRenderViewObserver_FetchDocumentMarkup(routing_id(), requestId)); -} - -void QtRenderViewObserverHost::fetchDocumentInnerText(quint64 requestId) -{ - Send(new QtRenderViewObserver_FetchDocumentInnerText(routing_id(), requestId)); -} - -bool QtRenderViewObserverHost::OnMessageReceived(const IPC::Message& message) -{ - bool handled = true; - IPC_BEGIN_MESSAGE_MAP(QtRenderViewObserverHost, message) - IPC_MESSAGE_HANDLER(QtRenderViewObserverHost_DidFetchDocumentMarkup, - onDidFetchDocumentMarkup) - IPC_MESSAGE_HANDLER(QtRenderViewObserverHost_DidFetchDocumentInnerText, - onDidFetchDocumentInnerText) - IPC_MESSAGE_HANDLER(QtRenderViewObserverHost_DidFirstVisuallyNonEmptyLayout, - onDidFirstVisuallyNonEmptyLayout) - IPC_MESSAGE_UNHANDLED(handled = false) - IPC_END_MESSAGE_MAP() - return handled; - -} - -void QtRenderViewObserverHost::onDidFetchDocumentMarkup(quint64 requestId, const base::string16& markup) -{ - m_adapterClient->didFetchDocumentMarkup(requestId, toQt(markup)); -} - -void QtRenderViewObserverHost::onDidFetchDocumentInnerText(quint64 requestId, const base::string16& innerText) -{ - m_adapterClient->didFetchDocumentInnerText(requestId, toQt(innerText)); -} - -void QtRenderViewObserverHost::onDidFirstVisuallyNonEmptyLayout() -{ - RenderWidgetHostViewQt *rwhv = static_cast(web_contents()->GetRenderWidgetHostView()); - if (rwhv) - rwhv->didFirstVisuallyNonEmptyLayout(); -} - -} // namespace QtWebEngineCore diff --git a/src/core/qt_render_view_observer_host.h b/src/core/qt_render_view_observer_host.h deleted file mode 100644 index 148fcb9da..000000000 --- a/src/core/qt_render_view_observer_host.h +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 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 QT_RENDER_VIEW_OBSERVER_HOST_H -#define QT_RENDER_VIEW_OBSERVER_HOST_H - -#include "content/public/browser/web_contents_observer.h" - -#include - -namespace content { - class WebContents; -} - -namespace QtWebEngineCore { - -class WebContentsAdapterClient; - -class QtRenderViewObserverHost : public content::WebContentsObserver -{ -public: - QtRenderViewObserverHost(content::WebContents*, WebContentsAdapterClient *adapterClient); - void fetchDocumentMarkup(quint64 requestId); - void fetchDocumentInnerText(quint64 requestId); - -private: - bool OnMessageReceived(const IPC::Message& message) Q_DECL_OVERRIDE; - void onDidFetchDocumentMarkup(quint64 requestId, const base::string16& markup); - void onDidFetchDocumentInnerText(quint64 requestId, const base::string16& innerText); - void onDidFirstVisuallyNonEmptyLayout(); - - WebContentsAdapterClient *m_adapterClient; -}; - -} // namespace QtWebEngineCore - -#endif // QT_RENDER_VIEW_OBSERVER_HOST_H diff --git a/src/core/render_view_observer_host_qt.cpp b/src/core/render_view_observer_host_qt.cpp new file mode 100644 index 000000000..03c9d241f --- /dev/null +++ b/src/core/render_view_observer_host_qt.cpp @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2015 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 "render_view_observer_host_qt.h" + +#include "common/qt_messages.h" +#include "content/public/browser/web_contents.h" +#include "render_widget_host_view_qt.h" +#include "type_conversion.h" +#include "web_contents_adapter_client.h" + +namespace QtWebEngineCore { + +RenderViewObserverHostQt::RenderViewObserverHostQt(content::WebContents *webContents, WebContentsAdapterClient *adapterClient) + : content::WebContentsObserver(webContents) + , m_adapterClient(adapterClient) +{ +} + +void RenderViewObserverHostQt::fetchDocumentMarkup(quint64 requestId) +{ + Send(new RenderViewObserverQt_FetchDocumentMarkup(routing_id(), requestId)); +} + +void RenderViewObserverHostQt::fetchDocumentInnerText(quint64 requestId) +{ + Send(new RenderViewObserverQt_FetchDocumentInnerText(routing_id(), requestId)); +} + +bool RenderViewObserverHostQt::OnMessageReceived(const IPC::Message& message) +{ + bool handled = true; + IPC_BEGIN_MESSAGE_MAP(RenderViewObserverHostQt, message) + IPC_MESSAGE_HANDLER(RenderViewObserverHostQt_DidFetchDocumentMarkup, + onDidFetchDocumentMarkup) + IPC_MESSAGE_HANDLER(RenderViewObserverHostQt_DidFetchDocumentInnerText, + onDidFetchDocumentInnerText) + IPC_MESSAGE_HANDLER(RenderViewObserverHostQt_DidFirstVisuallyNonEmptyLayout, + onDidFirstVisuallyNonEmptyLayout) + IPC_MESSAGE_UNHANDLED(handled = false) + IPC_END_MESSAGE_MAP() + return handled; + +} + +void RenderViewObserverHostQt::onDidFetchDocumentMarkup(quint64 requestId, const base::string16& markup) +{ + m_adapterClient->didFetchDocumentMarkup(requestId, toQt(markup)); +} + +void RenderViewObserverHostQt::onDidFetchDocumentInnerText(quint64 requestId, const base::string16& innerText) +{ + m_adapterClient->didFetchDocumentInnerText(requestId, toQt(innerText)); +} + +void RenderViewObserverHostQt::onDidFirstVisuallyNonEmptyLayout() +{ + RenderWidgetHostViewQt *rwhv = static_cast(web_contents()->GetRenderWidgetHostView()); + if (rwhv) + rwhv->didFirstVisuallyNonEmptyLayout(); +} + +} // namespace QtWebEngineCore diff --git a/src/core/render_view_observer_host_qt.h b/src/core/render_view_observer_host_qt.h new file mode 100644 index 000000000..2683e5807 --- /dev/null +++ b/src/core/render_view_observer_host_qt.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2015 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 RENDER_VIEW_OBSERVER_HOST_QT_H +#define RENDER_VIEW_OBSERVER_HOST_QT_H + +#include "content/public/browser/web_contents_observer.h" + +#include + +namespace content { + class WebContents; +} + +namespace QtWebEngineCore { + +class WebContentsAdapterClient; + +class RenderViewObserverHostQt : public content::WebContentsObserver +{ +public: + RenderViewObserverHostQt(content::WebContents*, WebContentsAdapterClient *adapterClient); + void fetchDocumentMarkup(quint64 requestId); + void fetchDocumentInnerText(quint64 requestId); + +private: + bool OnMessageReceived(const IPC::Message& message) Q_DECL_OVERRIDE; + void onDidFetchDocumentMarkup(quint64 requestId, const base::string16& markup); + void onDidFetchDocumentInnerText(quint64 requestId, const base::string16& innerText); + void onDidFirstVisuallyNonEmptyLayout(); + + WebContentsAdapterClient *m_adapterClient; +}; + +} // namespace QtWebEngineCore + +#endif // RENDER_VIEW_OBSERVER_HOST_QT_H diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index 90c91fd47..330173880 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -416,12 +416,13 @@ gfx::Rect RenderWidgetHostViewQt::GetViewBounds() const return gfx::BoundingRect(p1, p2); } -void RenderWidgetHostViewQt::SetBackgroundColor(SkColor color) { +void RenderWidgetHostViewQt::SetBackgroundColor(SkColor color) +{ RenderWidgetHostViewBase::SetBackgroundColor(color); // Set the background of the compositor if necessary m_delegate->setClearColor(toQt(color)); // Set the background of the blink::FrameView - m_host->Send(new QtRenderViewObserver_SetBackgroundColor(m_host->GetRoutingID(), color)); + m_host->Send(new RenderViewObserverQt_SetBackgroundColor(m_host->GetRoutingID(), color)); } // Return value indicates whether the mouse is locked successfully or not. diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp index e281cbc95..261b9c581 100644 --- a/src/core/renderer/content_renderer_client_qt.cpp +++ b/src/core/renderer/content_renderer_client_qt.cpp @@ -54,8 +54,8 @@ #include "content/public/common/web_preferences.h" #include "renderer/web_channel_ipc_transport.h" -#include "renderer/qt_render_frame_observer.h" -#include "renderer/qt_render_view_observer.h" +#include "renderer/render_frame_observer_qt.h" +#include "renderer/render_view_observer_qt.h" #include "renderer/user_script_controller.h" #include "grit/renderer_resources.h" @@ -90,14 +90,14 @@ void ContentRendererClientQt::RenderThreadStarted() void ContentRendererClientQt::RenderViewCreated(content::RenderView* render_view) { // RenderViewObservers destroy themselves with their RenderView. - new QtRenderViewObserver(render_view, m_webCacheObserver.data()); + new RenderViewObserverQt(render_view, m_webCacheObserver.data()); new WebChannelIPCTransport(render_view); UserScriptController::instance()->renderViewCreated(render_view); } void ContentRendererClientQt::RenderFrameCreated(content::RenderFrame* render_frame) { - new QtWebEngineCore::QtRenderFrameObserver(render_frame); + new QtWebEngineCore::RenderFrameObserverQt(render_frame); } bool ContentRendererClientQt::HasErrorPage(int httpStatusCode, std::string *errorDomain) diff --git a/src/core/renderer/qt_render_frame_observer.cpp b/src/core/renderer/qt_render_frame_observer.cpp deleted file mode 100644 index 5f06d1e4e..000000000 --- a/src/core/renderer/qt_render_frame_observer.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 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 "qt_render_frame_observer.h" - -#include "content/public/renderer/renderer_ppapi_host.h" -#include "ppapi/host/ppapi_host.h" - -#include "renderer/pepper/pepper_renderer_host_factory_qt.h" -#include "renderer/pepper/pepper_flash_renderer_host_qt.h" - -namespace QtWebEngineCore { - -QtRenderFrameObserver::QtRenderFrameObserver(content::RenderFrame* render_frame) - : RenderFrameObserver(render_frame) -{ -} - -QtRenderFrameObserver::~QtRenderFrameObserver() -{ -} - -#if defined(ENABLE_PLUGINS) -void QtRenderFrameObserver::DidCreatePepperPlugin(content::RendererPpapiHost* host) -{ - host->GetPpapiHost()->AddHostFactoryFilter( - scoped_ptr( - new PepperRendererHostFactoryQt(host))); -} -#endif - -} // namespace QtWebEngineCore diff --git a/src/core/renderer/qt_render_frame_observer.h b/src/core/renderer/qt_render_frame_observer.h deleted file mode 100644 index 42f2b7464..000000000 --- a/src/core/renderer/qt_render_frame_observer.h +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 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 QT_RENDER_FRAME_OBSERVER_H -#define QT_RENDER_FRAME_OBSERVER_H - -#include "base/basictypes.h" -#include "base/compiler_specific.h" -#include "content/public/renderer/render_frame_observer.h" - - -namespace content { -class RenderFrame; -} - -namespace QtWebEngineCore { - -class QtRenderFrameObserver : public content::RenderFrameObserver { -public: - explicit QtRenderFrameObserver(content::RenderFrame* render_frame); - ~QtRenderFrameObserver(); - -#if defined(ENABLE_PLUGINS) - void DidCreatePepperPlugin(content::RendererPpapiHost* host) override; -#endif - -private: - DISALLOW_COPY_AND_ASSIGN(QtRenderFrameObserver); -}; - -} // namespace QtWebEngineCore - -#endif // QT_RENDER_FRAME_OBSERVER_H diff --git a/src/core/renderer/qt_render_view_observer.cpp b/src/core/renderer/qt_render_view_observer.cpp deleted file mode 100644 index 086b07d17..000000000 --- a/src/core/renderer/qt_render_view_observer.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 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 "renderer/qt_render_view_observer.h" - -#include "common/qt_messages.h" - -#include "components/web_cache/renderer/web_cache_render_process_observer.h" -#include "content/public/renderer/render_view.h" -#include "third_party/WebKit/public/web/WebDocument.h" -#include "third_party/WebKit/public/web/WebElement.h" -#include "third_party/WebKit/public/web/WebFrame.h" -#include "third_party/WebKit/public/web/WebView.h" - -QtRenderViewObserver::QtRenderViewObserver( - content::RenderView* render_view, - web_cache::WebCacheRenderProcessObserver* web_cache_render_process_observer) - : content::RenderViewObserver(render_view) - , m_web_cache_render_process_observer(web_cache_render_process_observer) -{ -} - -void QtRenderViewObserver::onFetchDocumentMarkup(quint64 requestId) -{ - Send(new QtRenderViewObserverHost_DidFetchDocumentMarkup( - routing_id(), - requestId, - render_view()->GetWebView()->mainFrame()->contentAsMarkup())); -} - -void QtRenderViewObserver::onFetchDocumentInnerText(quint64 requestId) -{ - Send(new QtRenderViewObserverHost_DidFetchDocumentInnerText( - routing_id(), - requestId, - render_view()->GetWebView()->mainFrame()->contentAsText(std::numeric_limits::max()))); -} - -void QtRenderViewObserver::onSetBackgroundColor(quint32 color) -{ - render_view()->GetWebView()->setBaseBackgroundColor(color); -} - -void QtRenderViewObserver::OnFirstVisuallyNonEmptyLayout() -{ - Send(new QtRenderViewObserverHost_DidFirstVisuallyNonEmptyLayout(routing_id())); -} - -bool QtRenderViewObserver::OnMessageReceived(const IPC::Message& message) -{ - bool handled = true; - IPC_BEGIN_MESSAGE_MAP(QtRenderViewObserver, message) - IPC_MESSAGE_HANDLER(QtRenderViewObserver_FetchDocumentMarkup, onFetchDocumentMarkup) - IPC_MESSAGE_HANDLER(QtRenderViewObserver_FetchDocumentInnerText, onFetchDocumentInnerText) - IPC_MESSAGE_HANDLER(QtRenderViewObserver_SetBackgroundColor, onSetBackgroundColor) - IPC_MESSAGE_UNHANDLED(handled = false) - IPC_END_MESSAGE_MAP() - return handled; -} - -void QtRenderViewObserver::Navigate(const GURL &) -{ - if (m_web_cache_render_process_observer) - m_web_cache_render_process_observer->ExecutePendingClearCache(); -} diff --git a/src/core/renderer/qt_render_view_observer.h b/src/core/renderer/qt_render_view_observer.h deleted file mode 100644 index 1ead53141..000000000 --- a/src/core/renderer/qt_render_view_observer.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 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 QT_RENDER_VIEW_OBSERVER_H -#define QT_RENDER_VIEW_OBSERVER_H - -#include "content/public/renderer/render_view_observer.h" - -#include - -namespace web_cache { -class WebCacheRenderProcessObserver; -} - -class QtRenderViewObserver : public content::RenderViewObserver { -public: - QtRenderViewObserver(content::RenderView* render_view, - web_cache::WebCacheRenderProcessObserver* web_cache_render_process_observer); - -private: - void onFetchDocumentMarkup(quint64 requestId); - void onFetchDocumentInnerText(quint64 requestId); - void onSetBackgroundColor(quint32 color); - - void OnFirstVisuallyNonEmptyLayout() Q_DECL_OVERRIDE; - - virtual bool OnMessageReceived(const IPC::Message& message) Q_DECL_OVERRIDE; - virtual void Navigate(const GURL& url) Q_DECL_OVERRIDE; - - web_cache::WebCacheRenderProcessObserver* m_web_cache_render_process_observer; - - DISALLOW_COPY_AND_ASSIGN(QtRenderViewObserver); -}; - -#endif // QT_RENDER_VIEW_OBSERVER_H diff --git a/src/core/renderer/render_frame_observer_qt.cpp b/src/core/renderer/render_frame_observer_qt.cpp new file mode 100644 index 000000000..8130cc53a --- /dev/null +++ b/src/core/renderer/render_frame_observer_qt.cpp @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2015 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 "render_frame_observer_qt.h" + +#include "content/public/renderer/renderer_ppapi_host.h" +#include "ppapi/host/ppapi_host.h" + +#include "renderer/pepper/pepper_renderer_host_factory_qt.h" +#include "renderer/pepper/pepper_flash_renderer_host_qt.h" + +namespace QtWebEngineCore { + +RenderFrameObserverQt::RenderFrameObserverQt(content::RenderFrame* render_frame) + : RenderFrameObserver(render_frame) +{ +} + +RenderFrameObserverQt::~RenderFrameObserverQt() +{ +} + +#if defined(ENABLE_PLUGINS) +void RenderFrameObserverQt::DidCreatePepperPlugin(content::RendererPpapiHost* host) +{ + host->GetPpapiHost()->AddHostFactoryFilter( + scoped_ptr( + new PepperRendererHostFactoryQt(host))); +} +#endif + +} // namespace QtWebEngineCore diff --git a/src/core/renderer/render_frame_observer_qt.h b/src/core/renderer/render_frame_observer_qt.h new file mode 100644 index 000000000..4835e442e --- /dev/null +++ b/src/core/renderer/render_frame_observer_qt.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2015 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 RENDER_FRAME_OBSERVER_QT_H +#define RENDER_FRAME_OBSERVER_QT_H + +#include "base/basictypes.h" +#include "base/compiler_specific.h" +#include "content/public/renderer/render_frame_observer.h" + + +namespace content { +class RenderFrame; +} + +namespace QtWebEngineCore { + +class RenderFrameObserverQt : public content::RenderFrameObserver { +public: + explicit RenderFrameObserverQt(content::RenderFrame* render_frame); + ~RenderFrameObserverQt(); + +#if defined(ENABLE_PLUGINS) + void DidCreatePepperPlugin(content::RendererPpapiHost* host) override; +#endif + +private: + DISALLOW_COPY_AND_ASSIGN(RenderFrameObserverQt); +}; + +} // namespace QtWebEngineCore + +#endif // RENDER_FRAME_OBSERVER_QT_H diff --git a/src/core/renderer/render_view_observer_qt.cpp b/src/core/renderer/render_view_observer_qt.cpp new file mode 100644 index 000000000..47efd07e4 --- /dev/null +++ b/src/core/renderer/render_view_observer_qt.cpp @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2015 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 "renderer/render_view_observer_qt.h" + +#include "common/qt_messages.h" + +#include "components/web_cache/renderer/web_cache_render_process_observer.h" +#include "content/public/renderer/render_view.h" +#include "third_party/WebKit/public/web/WebDocument.h" +#include "third_party/WebKit/public/web/WebElement.h" +#include "third_party/WebKit/public/web/WebFrame.h" +#include "third_party/WebKit/public/web/WebView.h" + +RenderViewObserverQt::RenderViewObserverQt( + content::RenderView* render_view, + web_cache::WebCacheRenderProcessObserver* web_cache_render_process_observer) + : content::RenderViewObserver(render_view) + , m_web_cache_render_process_observer(web_cache_render_process_observer) +{ +} + +void RenderViewObserverQt::onFetchDocumentMarkup(quint64 requestId) +{ + Send(new RenderViewObserverHostQt_DidFetchDocumentMarkup( + routing_id(), + requestId, + render_view()->GetWebView()->mainFrame()->contentAsMarkup())); +} + +void RenderViewObserverQt::onFetchDocumentInnerText(quint64 requestId) +{ + Send(new RenderViewObserverHostQt_DidFetchDocumentInnerText( + routing_id(), + requestId, + render_view()->GetWebView()->mainFrame()->contentAsText(std::numeric_limits::max()))); +} + +void RenderViewObserverQt::onSetBackgroundColor(quint32 color) +{ + render_view()->GetWebView()->setBaseBackgroundColor(color); +} + +void RenderViewObserverQt::OnFirstVisuallyNonEmptyLayout() +{ + Send(new RenderViewObserverHostQt_DidFirstVisuallyNonEmptyLayout(routing_id())); +} + +bool RenderViewObserverQt::OnMessageReceived(const IPC::Message& message) +{ + bool handled = true; + IPC_BEGIN_MESSAGE_MAP(RenderViewObserverQt, message) + IPC_MESSAGE_HANDLER(RenderViewObserverQt_FetchDocumentMarkup, onFetchDocumentMarkup) + IPC_MESSAGE_HANDLER(RenderViewObserverQt_FetchDocumentInnerText, onFetchDocumentInnerText) + IPC_MESSAGE_HANDLER(RenderViewObserverQt_SetBackgroundColor, onSetBackgroundColor) + IPC_MESSAGE_UNHANDLED(handled = false) + IPC_END_MESSAGE_MAP() + return handled; +} + +void RenderViewObserverQt::Navigate(const GURL &) +{ + if (m_web_cache_render_process_observer) + m_web_cache_render_process_observer->ExecutePendingClearCache(); +} diff --git a/src/core/renderer/render_view_observer_qt.h b/src/core/renderer/render_view_observer_qt.h new file mode 100644 index 000000000..166dcc9ea --- /dev/null +++ b/src/core/renderer/render_view_observer_qt.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2015 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 RENDER_VIEW_OBSERVER_QT_H +#define RENDER_VIEW_OBSERVER_QT_H + +#include "content/public/renderer/render_view_observer.h" + +#include + +namespace web_cache { +class WebCacheRenderProcessObserver; +} + +class RenderViewObserverQt : public content::RenderViewObserver { +public: + RenderViewObserverQt(content::RenderView* render_view, + web_cache::WebCacheRenderProcessObserver* web_cache_render_process_observer); + +private: + void onFetchDocumentMarkup(quint64 requestId); + void onFetchDocumentInnerText(quint64 requestId); + void onSetBackgroundColor(quint32 color); + + void OnFirstVisuallyNonEmptyLayout() Q_DECL_OVERRIDE; + + virtual bool OnMessageReceived(const IPC::Message& message) Q_DECL_OVERRIDE; + virtual void Navigate(const GURL& url) Q_DECL_OVERRIDE; + + web_cache::WebCacheRenderProcessObserver* m_web_cache_render_process_observer; + + DISALLOW_COPY_AND_ASSIGN(RenderViewObserverQt); +}; + +#endif // RENDER_VIEW_OBSERVER_QT_H diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 31ebb1244..608dbf7e7 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -45,8 +45,8 @@ #include "browser_context_adapter.h" #include "browser_context_qt.h" #include "media_capture_devices_dispatcher.h" -#include "qt_render_view_observer_host.h" #include "qwebenginecallback_p.h" +#include "render_view_observer_host_qt.h" #include "type_conversion.h" #include "web_channel_ipc_transport_host.h" #include "web_contents_adapter_client.h" @@ -385,7 +385,7 @@ void WebContentsAdapter::initialize(WebContentsAdapterClient *adapterClient) // Create and attach observers to the WebContents. d->webContentsDelegate.reset(new WebContentsDelegateQt(d->webContents.get(), adapterClient)); - d->renderViewObserverHost.reset(new QtRenderViewObserverHost(d->webContents.get(), adapterClient)); + d->renderViewObserverHost.reset(new RenderViewObserverHostQt(d->webContents.get(), adapterClient)); // Let the WebContent's view know about the WebContentsAdapterClient. WebContentsViewQt* contentsView = static_cast(static_cast(d->webContents.get())->GetView()); diff --git a/src/core/web_contents_adapter_p.h b/src/core/web_contents_adapter_p.h index 505f803b2..22f295b32 100644 --- a/src/core/web_contents_adapter_p.h +++ b/src/core/web_contents_adapter_p.h @@ -62,7 +62,7 @@ class WebEngineContext; namespace QtWebEngineCore { class BrowserContextAdapter; -class QtRenderViewObserverHost; +class RenderViewObserverHostQt; class UserScriptControllerHost; class WebChannelIPCTransportHost; class WebContentsAdapterClient; @@ -76,7 +76,7 @@ public: QExplicitlySharedDataPointer browserContextAdapter; scoped_ptr webContents; scoped_ptr webContentsDelegate; - scoped_ptr renderViewObserverHost; + scoped_ptr renderViewObserverHost; scoped_ptr webChannelTransport; QWebChannel *webChannel; WebContentsAdapterClient *adapterClient; -- cgit v1.2.3 From 8bc8777ef3b4fd9032eb5b6be46ee47f60fc9ec2 Mon Sep 17 00:00:00 2001 From: Michael Bruning Date: Fri, 30 Oct 2015 09:45:37 +0100 Subject: Do not use system harfbuzz unless it is configured. Change-Id: I8d2aca1d3192be08295af57b08489bfefc8e0dc4 Task-number: QTBUG-49128 Reviewed-by: Liang Qi Reviewed-by: Allan Sandfeld Jensen --- src/core/config/desktop_linux.pri | 2 ++ src/core/config/embedded_linux.pri | 1 + 2 files changed, 3 insertions(+) (limited to 'src') diff --git a/src/core/config/desktop_linux.pri b/src/core/config/desktop_linux.pri index 041b094a1..7f27659e3 100644 --- a/src/core/config/desktop_linux.pri +++ b/src/core/config/desktop_linux.pri @@ -19,3 +19,5 @@ GYP_CONFIG += \ contains(QT_CONFIG, system-jpeg): GYP_CONFIG += use_system_libjpeg=1 !contains(QT_CONFIG, pulseaudio): GYP_CONFIG += use_pulseaudio=0 + +!contains(QT_CONFIG, system-harfbuzz): GYP_CONFIG += use_system_harfbuzz=0 diff --git a/src/core/config/embedded_linux.pri b/src/core/config/embedded_linux.pri index cc8c40f8e..3cf1add0d 100644 --- a/src/core/config/embedded_linux.pri +++ b/src/core/config/embedded_linux.pri @@ -52,3 +52,4 @@ GYP_CONFIG += \ contains(QT_CONFIG, system-jpeg): GYP_CONFIG += use_system_libjpeg=1 !contains(QT_CONFIG, pulseaudio): GYP_CONFIG += use_pulseaudio=0 +!contains(QT_CONFIG, system-harfbuzz): GYP_CONFIG += use_system_harfbuzz=0 -- cgit v1.2.3 From eca92de29c5a9048f4b15c5f9aa96b7ad8235b49 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 28 Oct 2015 17:04:51 +0100 Subject: fix frequent deadlocks on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With a desktop OpenGL build of Qt we encountered frequent deadlocks when creating OpenGL contexts. Initialize the context directly on the calling thread instead of the browser thread and do not synchronize with the browser thread. Task-number: QTBUG-48276 Change-Id: I0970c66cb230881cdc53f22d4a255ea08e6fe63a Reviewed-by: Michael Brüning Reviewed-by: Allan Sandfeld Jensen --- src/core/gl_context_qt.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/core/gl_context_qt.cpp b/src/core/gl_context_qt.cpp index b350c3c5b..3a6de6935 100644 --- a/src/core/gl_context_qt.cpp +++ b/src/core/gl_context_qt.cpp @@ -146,10 +146,16 @@ scoped_refptr GLContext::CreateGLContext(GLShareGroup* share_group, G { #if defined(OS_WIN) scoped_refptr context; - if (GetGLImplementation() == kGLImplementationDesktopGL) + if (GetGLImplementation() == kGLImplementationDesktopGL) { context = new GLContextWGL(share_group); - else + if (!context->Initialize(compatible_surface, gpu_preference)) { + delete context; + return nullptr; + } + return context; + } else { context = new GLContextEGL(share_group); + } #else scoped_refptr context = new GLContextEGL(share_group); #endif -- cgit v1.2.3 From b4c9c02e736b70572d30311e080a3d5cdf9ca154 Mon Sep 17 00:00:00 2001 From: Michael Bruning Date: Wed, 28 Oct 2015 16:00:20 +0100 Subject: Revert "Remove rpath workaround from QtWebProcess build." It does not work properly with the new rpath logic and causes problems with the installer packages. This should be a temporary fix until the rpath situation has been cleaned up again. This reverts commit 819279827a4ce05562909994468ec5604392c672. Change-Id: I082ba0118d410f90d202c786d07717bf224d5f70 Reviewed-by: Allan Sandfeld Jensen --- src/process/process.pro | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/process/process.pro b/src/process/process.pro index ee859a05c..6174e53bf 100644 --- a/src/process/process.pro +++ b/src/process/process.pro @@ -8,8 +8,23 @@ 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 - + # FIXME: remove the following workaround with proper rpath handling or + # patching of the installed QtWebEngineProcess binary. + # Since QtWebEngineCore is now built as a framework, we need to pull + # in and fixup its dependencies as well. QT += webenginecore + QMAKE_POST_LINK = \ + "xcrun install_name_tool -change " \ + "`xcrun otool -X -L $(TARGET) | grep QtWebEngineCore | cut -d ' ' -f 1` " \ + "@executable_path/../../../../QtWebEngineCore " \ + "$(TARGET); " + linked_frameworks = QtQuick QtQml QtNetwork QtCore QtGui QtWebChannel + for (current_framework, linked_frameworks) { + QMAKE_POST_LINK += "xcrun install_name_tool -change " \ + "`xcrun otool -X -L $(TARGET) | grep $${current_framework} | cut -d ' ' -f 1` " \ + "@executable_path/../../../../../../../$${current_framework}.framework/$${current_framework} " \ + "$(TARGET);" + } } else { CONFIG -= app_bundle win32: DESTDIR = $$MODULE_BASE_OUTDIR/bin -- cgit v1.2.3 From f05d65a3c5e85751062fe08bceab0907f6994b2f Mon Sep 17 00:00:00 2001 From: Christophe Chapuis Date: Wed, 28 Oct 2015 18:49:18 +0100 Subject: adoptWebContents: re-bind user scripts with new adapter Task-number: QTBUG-48984 Change-Id: I87cb224899458ba8f2d0343ed98932cfc8a6947f Reviewed-by: Allan Sandfeld Jensen --- src/webengine/api/qquickwebengineview.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index 129cfd2de..d262c38c8 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -573,6 +573,10 @@ void QQuickWebEngineViewPrivate::adoptWebContents(WebContentsAdapter *webContent if (qmlWebChannel) adapter->setWebChannel(qmlWebChannel); + // re-bind the userscrips to the new adapter + Q_FOREACH (QQuickWebEngineScript *script, m_userScripts) + script->d_func()->bind(browserContextAdapter()->userScriptController(), adapter.data()); + // Emit signals for values that might be different from the previous WebContentsAdapter. emit q->titleChanged(); emit q->urlChanged(); -- cgit v1.2.3 From 10cd4401b9e4e9fde2a8e17c70a0d11d2dfc306f Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 28 Sep 2015 12:09:01 +0200 Subject: Properly mark value based classes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I937ce0daf2fa73d7179a5f62585abfb1acea7264 Reviewed-by: Michael Brüning Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Marc Mutz --- src/core/api/qwebenginecallback.h | 7 +++++++ src/core/api/qwebenginecallback_p.h | 6 ++++++ src/core/api/qwebenginecookiestoreclient_p.h | 4 +++- src/core/common/user_script_data.h | 6 ++++++ src/webenginewidgets/api/qwebenginehistory.h | 4 ++++ src/webenginewidgets/api/qwebenginescript.h | 2 +- 6 files changed, 27 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/core/api/qwebenginecallback.h b/src/core/api/qwebenginecallback.h index ddee20d06..b675438f5 100644 --- a/src/core/api/qwebenginecallback.h +++ b/src/core/api/qwebenginecallback.h @@ -81,12 +81,19 @@ public: : d(new QtWebEnginePrivate::QWebEngineCallbackPrivate(f)) { } QWebEngineCallback() { } + void swap(QWebEngineCallback &other) Q_DECL_NOTHROW { qSwap(d, other.d); } operator bool() const { return d; } private: friend class QtWebEngineCore::CallbackDirectory; QExplicitlySharedDataPointer > d; }; +Q_DECLARE_SHARED(QWebEngineCallback) +Q_DECLARE_SHARED(QWebEngineCallback) +Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QWebEngineCallback) +Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QWebEngineCallback) +Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QWebEngineCallback) + QT_END_NAMESPACE #endif // QWEBENGINECALLBACK_H diff --git a/src/core/api/qwebenginecallback_p.h b/src/core/api/qwebenginecallback_p.h index f0c25fe9e..9bc9b9727 100644 --- a/src/core/api/qwebenginecallback_p.h +++ b/src/core/api/qwebenginecallback_p.h @@ -47,6 +47,7 @@ #include #include +// keep in sync with Q_DECLARE_SHARED... in qwebenginecallback.h #define FOR_EACH_TYPE(F) \ F(bool) \ F(int) \ @@ -227,6 +228,11 @@ void CallbackDirectory::CallbackSharedDataPointer::invokeEmpty() parent->invokeEmptyInternal(callback); } +#define CHECK_RELOCATABLE(x) \ + Q_STATIC_ASSERT((QTypeInfoQuery >::isRelocatable)); +FOR_EACH_TYPE(CHECK_RELOCATABLE) +#undef CHECK_RELOCATABLE + } // namespace QtWebEngineCore #endif // QWEBENGINECALLBACK_P_H diff --git a/src/core/api/qwebenginecookiestoreclient_p.h b/src/core/api/qwebenginecookiestoreclient_p.h index 68ab6549f..6b959c562 100644 --- a/src/core/api/qwebenginecookiestoreclient_p.h +++ b/src/core/api/qwebenginecookiestoreclient_p.h @@ -70,7 +70,7 @@ class QWEBENGINE_PRIVATE_EXPORT QWebEngineCookieStoreClientPrivate { QNetworkCookie cookie; QUrl origin; }; - + friend class QTypeInfo; public: Q_DECLARE_PUBLIC(QWebEngineCookieStoreClient) QtWebEngineCore::CallbackDirectory callbackDirectory; @@ -102,6 +102,8 @@ public: void onCookieChanged(const QNetworkCookie &cookie, bool removed); }; +Q_DECLARE_TYPEINFO(QWebEngineCookieStoreClientPrivate::CookieData, Q_MOVABLE_TYPE); + QT_END_NAMESPACE #endif // QWEBENGINECOOKIESTORECLIENT_P_H diff --git a/src/core/common/user_script_data.h b/src/core/common/user_script_data.h index 3dfec0ec3..d0856e02a 100644 --- a/src/core/common/user_script_data.h +++ b/src/core/common/user_script_data.h @@ -60,4 +60,10 @@ struct UserScriptData { uint64 scriptId; }; +QT_BEGIN_NAMESPACE + +Q_DECLARE_TYPEINFO(UserScriptData, Q_MOVABLE_TYPE); + +QT_END_NAMESPACE + #endif // USER_SCRIPT_DATA_H diff --git a/src/webenginewidgets/api/qwebenginehistory.h b/src/webenginewidgets/api/qwebenginehistory.h index 0471e28e6..3dcea9469 100644 --- a/src/webenginewidgets/api/qwebenginehistory.h +++ b/src/webenginewidgets/api/qwebenginehistory.h @@ -65,6 +65,9 @@ public: QUrl iconUrl() const; bool isValid() const; + + void swap(QWebEngineHistoryItem &other) Q_DECL_NOTHROW { qSwap(d, other.d); } + private: QWebEngineHistoryItem(QWebEngineHistoryItemPrivate *priv); Q_DECLARE_PRIVATE_D(d.data(), QWebEngineHistoryItem) @@ -73,6 +76,7 @@ private: friend class QWebEngineHistoryPrivate; }; +Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QWebEngineHistoryItem) class QWebEngineHistoryPrivate; class QWEBENGINEWIDGETS_EXPORT QWebEngineHistory { diff --git a/src/webenginewidgets/api/qwebenginescript.h b/src/webenginewidgets/api/qwebenginescript.h index 4cff2631d..29126b110 100644 --- a/src/webenginewidgets/api/qwebenginescript.h +++ b/src/webenginewidgets/api/qwebenginescript.h @@ -99,7 +99,7 @@ private: QSharedDataPointer d; }; -Q_DECLARE_SHARED(QWebEngineScript) +Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QWebEngineScript) #ifndef QT_NO_DEBUG_STREAM QWEBENGINEWIDGETS_EXPORT QDebug operator<<(QDebug, const QWebEngineScript &); -- cgit v1.2.3 From 215fe3b16d35f3a597658fd378d35bdb56116267 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 4 Nov 2015 10:41:47 +0100 Subject: Fix build on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We can't delete a scoped_refptr, but just returning should cause it to do so automatically. Change-Id: I7d7ba28d0264506d608f64847cbfb8a7cb63cf5e Reviewed-by: Michael Brüning --- src/core/gl_context_qt.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/core/gl_context_qt.cpp b/src/core/gl_context_qt.cpp index 3a6de6935..3c3b8225d 100644 --- a/src/core/gl_context_qt.cpp +++ b/src/core/gl_context_qt.cpp @@ -148,10 +148,8 @@ scoped_refptr GLContext::CreateGLContext(GLShareGroup* share_group, G scoped_refptr context; if (GetGLImplementation() == kGLImplementationDesktopGL) { context = new GLContextWGL(share_group); - if (!context->Initialize(compatible_surface, gpu_preference)) { - delete context; + if (!context->Initialize(compatible_surface, gpu_preference)) return nullptr; - } return context; } else { context = new GLContextEGL(share_group); -- cgit v1.2.3 From 3c8235193b7e9283bfb40dc0a1b4fe72c1947dbf Mon Sep 17 00:00:00 2001 From: Michael Bruning Date: Wed, 4 Nov 2015 12:58:36 +0100 Subject: [Windows] Fix build on 32 bit hosts. The default Windows SDK path is different on 32 bit machines. Adjust it to look for the D3D dlls in the right location. Co-Authored with Kai Koehne. Change-Id: If313188cdcc4634c3c9bf9dad6d2dce229fa3faa Reviewed-by: Kai Koehne --- src/core/config/windows.pri | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/core/config/windows.pri b/src/core/config/windows.pri index 602afbc67..f0c0c8f43 100644 --- a/src/core/config/windows.pri +++ b/src/core/config/windows.pri @@ -39,6 +39,11 @@ msvc { GYP_ARGS += "-G msvs_version=$$MSVS_VERSION" + # The check below is ugly, but necessary, as it seems to be the only reliable way to detect if the host + # architecture is 32 bit. QMAKE_HOST.arch does not work as it returns the architecture that the toolchain + # is building for, not the system's actual architecture. + PROGRAM_FILES_X86 = $$(ProgramW6432) + isEmpty(PROGRAM_FILES_X86): GYP_ARGS += "-D windows_sdk_path=\"C:/Program Files/Windows Kits/8.1\"" } else { fatal("Qt WebEngine for Windows can only be built with the Microsoft Visual Studio C++ compiler") } -- cgit v1.2.3 From a5e14c7abf8fddfbcbc3223e093f8acb50c459d5 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 3 Nov 2015 14:40:58 +0100 Subject: Update devtools discovery page Update the page to follow recent versions of Chromium's, now renders both title and URL for items. Change-Id: I0bc6dd4c2e4078bf9197d0f0af67747728bf6e8e Reviewed-by: Kai Koehne --- src/core/resources/devtools_discovery_page.html | 106 +++++++++++++++--------- 1 file changed, 69 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/core/resources/devtools_discovery_page.html b/src/core/resources/devtools_discovery_page.html index 7aac74932..d37dbfcf4 100644 --- a/src/core/resources/devtools_discovery_page.html +++ b/src/core/resources/devtools_discovery_page.html @@ -3,44 +3,68 @@ QtWebEngine Remote Debugging
Inspectable pages
+
-
-- cgit v1.2.3 From 40ef43e0d69c4a86c9430b7f264d2cde6340ee0f Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 5 Nov 2015 13:34:14 +0100 Subject: Improve documentation for QWebEngineScript Change-Id: I9274a3cacaa04529152a5d827c47cf6fc831df19 Reviewed-by: Allan Sandfeld Jensen --- src/webenginewidgets/api/qwebenginepage.cpp | 8 ++++++-- src/webenginewidgets/api/qwebengineprofile.cpp | 6 ++++-- src/webenginewidgets/api/qwebenginescript.cpp | 3 +++ src/webenginewidgets/api/qwebenginescriptcollection.cpp | 5 +++++ 4 files changed, 18 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index acce76910..c0323a87e 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -1210,8 +1210,12 @@ void QWebEnginePage::runJavaScript(const QString& scriptSource, const QWebEngine } /*! - Returns the script collection used by this page. - \sa QWebEngineScriptCollection + Returns the collection of scripts that are injected into the page. + + In addition, a page might also execute scripts + added through QWebEngineProfile::scripts(). + + \sa QWebEngineScriptCollection, QWebEngineScript */ QWebEngineScriptCollection &QWebEnginePage::scripts() diff --git a/src/webenginewidgets/api/qwebengineprofile.cpp b/src/webenginewidgets/api/qwebengineprofile.cpp index 07deeeefc..5fbc4d63c 100644 --- a/src/webenginewidgets/api/qwebengineprofile.cpp +++ b/src/webenginewidgets/api/qwebengineprofile.cpp @@ -490,8 +490,10 @@ bool QWebEngineProfile::visitedLinksContainsUrl(const QUrl &url) const } /*! - Returns the script collection used by this profile. - \sa QWebEngineScriptCollection + Returns the collection of scripts that are injected into all pages that share + this profile. + + \sa QWebEngineScriptCollection, QWebEngineScript, QWebEnginePage::scripts() */ QWebEngineScriptCollection *QWebEngineProfile::scripts() const { diff --git a/src/webenginewidgets/api/qwebenginescript.cpp b/src/webenginewidgets/api/qwebenginescript.cpp index 1bd56604d..058f58475 100644 --- a/src/webenginewidgets/api/qwebenginescript.cpp +++ b/src/webenginewidgets/api/qwebenginescript.cpp @@ -58,6 +58,9 @@ using QtWebEngineCore::UserScript; not accessible from a different one. ScriptWorldId provides some predefined IDs for this purpose. + 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. */ /*! \enum QWebEngineScript::InjectionPoint diff --git a/src/webenginewidgets/api/qwebenginescriptcollection.cpp b/src/webenginewidgets/api/qwebenginescriptcollection.cpp index 80a7f9b6e..9967cde85 100644 --- a/src/webenginewidgets/api/qwebenginescriptcollection.cpp +++ b/src/webenginewidgets/api/qwebenginescriptcollection.cpp @@ -47,6 +47,11 @@ using QtWebEngineCore::UserScript; \since 5.5 \brief The QWebEngineScriptCollection class represents a collection of user scripts. + QWebEngineScriptCollection manages a set of user scripts. + + 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 2c61b458f829ebb3047927d9eb68dfad2b4a3425 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 4 Nov 2015 16:03:44 +0100 Subject: Use relative paths instead of absolute Ninja will build to source-directory when using absolute paths, to get it to build to build-directory we need to use relative paths. Fortunately we can use the DEPTH variable to get relative path to the chromium src dir. Change-Id: I6b97ef20f2800721cfc399b6f9b6621f5656f7ee Reviewed-by: Kai Koehne --- src/core/chrome_qt.gyp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/core/chrome_qt.gyp b/src/core/chrome_qt.gyp index 0f30b7a04..de49d8826 100644 --- a/src/core/chrome_qt.gyp +++ b/src/core/chrome_qt.gyp @@ -16,13 +16,13 @@ '<(SHARED_INTERMEDIATE_DIR)/chrome', # Needed to include grit-generated files in localized_error.cc ], 'sources': [ - '<(chromium_src_dir)/chrome/browser/media/desktop_streams_registry.cc', - '<(chromium_src_dir)/chrome/browser/media/desktop_streams_registry.h', - '<(chromium_src_dir)/chrome/browser/media/desktop_media_list.h', - '<(chromium_src_dir)/chrome/common/chrome_switches.cc', - '<(chromium_src_dir)/chrome/common/chrome_switches.h', - '<(chromium_src_dir)/chrome/common/localized_error.cc', - '<(chromium_src_dir)/chrome/common/localized_error.h', + '<(DEPTH)/chrome/browser/media/desktop_streams_registry.cc', + '<(DEPTH)/chrome/browser/media/desktop_streams_registry.h', + '<(DEPTH)/chrome/browser/media/desktop_media_list.h', + '<(DEPTH)/chrome/common/chrome_switches.cc', + '<(DEPTH)/chrome/common/chrome_switches.h', + '<(DEPTH)/chrome/common/localized_error.cc', + '<(DEPTH)/chrome/common/localized_error.h', ], }, { -- cgit v1.2.3 From 1881ce5d63c25838aabfc3cd939312e6b9352e05 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 19 Oct 2015 12:48:33 +0200 Subject: Replace QList with QVector Replace QList with QVector in all places where the type isn't a pointer, and is not already (indirectly) exposed through public API. Change-Id: I90e3db56bf9ebda6b3cb8fb4396d2ae283159727 Reviewed-by: Allan Sandfeld Jensen --- src/core/api/qwebenginecookiestoreclient_p.h | 5 ++--- src/core/cookie_monster_delegate_qt.h | 1 - src/core/delegated_frame_node.cpp | 2 +- src/core/delegated_frame_node.h | 6 +++--- src/core/permission_manager_qt.h | 4 ++-- src/core/web_contents_delegate_qt.h | 3 ++- src/core/web_engine_context.cpp | 2 +- 7 files changed, 11 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/core/api/qwebenginecookiestoreclient_p.h b/src/core/api/qwebenginecookiestoreclient_p.h index 6b959c562..54f3b9eb7 100644 --- a/src/core/api/qwebenginecookiestoreclient_p.h +++ b/src/core/api/qwebenginecookiestoreclient_p.h @@ -53,8 +53,7 @@ #include "qwebenginecallback_p.h" #include "qwebenginecookiestoreclient.h" -#include -#include +#include #include #include @@ -75,7 +74,7 @@ public: Q_DECLARE_PUBLIC(QWebEngineCookieStoreClient) QtWebEngineCore::CallbackDirectory callbackDirectory; QWebEngineCallback filterCallback; - QList m_pendingUserCookies; + QVector m_pendingUserCookies; quint64 m_nextCallbackId; bool m_deleteSessionCookiesPending; bool m_deleteAllCookiesPending; diff --git a/src/core/cookie_monster_delegate_qt.h b/src/core/cookie_monster_delegate_qt.h index 7592d57fa..db80bf0a1 100644 --- a/src/core/cookie_monster_delegate_qt.h +++ b/src/core/cookie_monster_delegate_qt.h @@ -47,7 +47,6 @@ QT_WARNING_DISABLE_CLANG("-Wunused-parameter") #include "net/cookies/cookie_monster.h" QT_WARNING_POP -#include #include #include diff --git a/src/core/delegated_frame_node.cpp b/src/core/delegated_frame_node.cpp index 1b6a80f82..07b3131ce 100644 --- a/src/core/delegated_frame_node.cpp +++ b/src/core/delegated_frame_node.cpp @@ -136,7 +136,7 @@ private: QSGGeometry m_geometry; }; -static inline QSharedPointer findRenderPassLayer(const cc::RenderPassId &id, const QList > > &list) +static inline QSharedPointer findRenderPassLayer(const cc::RenderPassId &id, const QVector > > &list) { typedef QPair > Pair; Q_FOREACH (const Pair &pair, list) diff --git a/src/core/delegated_frame_node.h b/src/core/delegated_frame_node.h index 60a1535d2..eed03fadd 100644 --- a/src/core/delegated_frame_node.h +++ b/src/core/delegated_frame_node.h @@ -90,9 +90,9 @@ private: QExplicitlySharedDataPointer m_chromiumCompositorData; struct SGObjects { - QList > > renderPassLayers; - QList > renderPassRootNodes; - QList > textureStrongRefs; + QVector > > renderPassLayers; + QVector > renderPassRootNodes; + QVector > textureStrongRefs; } m_sgObjects; int m_numPendingSyncPoints; QMap m_mailboxGLFences; diff --git a/src/core/permission_manager_qt.h b/src/core/permission_manager_qt.h index d4ee72bae..6dfc60c39 100644 --- a/src/core/permission_manager_qt.h +++ b/src/core/permission_manager_qt.h @@ -102,7 +102,7 @@ private: QUrl origin; base::Callback callback; }; - QList m_requests; + QVector m_requests; struct Subscriber { int id; PermissionType type; @@ -110,7 +110,7 @@ private: base::Callback callback; }; int m_subscriberCount; - QList m_subscribers; + QVector m_subscribers; }; diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h index 8f1317b6d..d3075cfbf 100644 --- a/src/core/web_contents_delegate_qt.h +++ b/src/core/web_contents_delegate_qt.h @@ -44,6 +44,7 @@ #include "base/callback.h" #include "javascript_dialog_manager_qt.h" +#include #include QT_FORWARD_DECLARE_CLASS(CertificateErrorController) @@ -117,7 +118,7 @@ private: WebContentsAdapterClient *m_viewClient; QString m_lastSearchedString; int m_lastReceivedFindReply; - QList m_loadingErrorFrameList; + QVector m_loadingErrorFrameList; }; } // namespace QtWebEngineCore diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 4e4159cef..12b8bdadb 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -199,7 +199,7 @@ WebEngineContext::WebEngineContext() , m_browserRunner(content::BrowserMainRunner::Create()) , m_globalQObject(new QObject()) { - QList args; + QVector args; Q_FOREACH (const QString& arg, QCoreApplication::arguments()) args << arg.toUtf8(); -- cgit v1.2.3 From fce0c120e4e67496e4a8d76398a8c105a76c42c4 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 30 Oct 2015 14:55:32 +0100 Subject: Ensure WebContents::WasShown/WasHidden are called MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Forward WebEngineView visibility to WebContents visibility, and call WebContentsView visibiliy on actual show/hide events to avoid a recursion when WebContents visbility triggers it. Change-Id: I0c336359fb35bf93874aa1092767177d7a5ce341 Reviewed-by: Michael Brüning --- src/webenginewidgets/api/qwebenginepage.cpp | 10 ++++++++++ src/webenginewidgets/api/qwebenginepage_p.h | 3 +++ src/webenginewidgets/api/qwebengineview.cpp | 18 ++++++++++++++++++ src/webenginewidgets/api/qwebengineview.h | 2 ++ .../render_widget_host_view_qt_delegate_widget.cpp | 9 +++++++-- .../render_widget_host_view_qt_delegate_widget.h | 1 + 6 files changed, 41 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index c0323a87e..a1c009cc3 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -859,6 +859,16 @@ bool QWebEnginePage::event(QEvent *e) return QObject::event(e); } +void QWebEnginePagePrivate::wasShown() +{ + adapter->wasShown(); +} + +void QWebEnginePagePrivate::wasHidden() +{ + adapter->wasHidden(); +} + bool QWebEnginePagePrivate::contextMenuRequested(const WebEngineContextMenuData &data) { if (!view || !view->d_func()->m_pendingContextMenuEvent) diff --git a/src/webenginewidgets/api/qwebenginepage_p.h b/src/webenginewidgets/api/qwebenginepage_p.h index 8009336ec..f6f76dec2 100644 --- a/src/webenginewidgets/api/qwebenginepage_p.h +++ b/src/webenginewidgets/api/qwebenginepage_p.h @@ -129,6 +129,9 @@ public: void updateNavigationActions(); void _q_webActionTriggered(bool checked); + void wasShown(); + void wasHidden(); + QtWebEngineCore::WebContentsAdapter *webContents() { return adapter.data(); } void recreateFromSerializedHistory(QDataStream &input); diff --git a/src/webenginewidgets/api/qwebengineview.cpp b/src/webenginewidgets/api/qwebengineview.cpp index 9baa8e34a..362849732 100644 --- a/src/webenginewidgets/api/qwebengineview.cpp +++ b/src/webenginewidgets/api/qwebengineview.cpp @@ -294,6 +294,24 @@ void QWebEngineView::contextMenuEvent(QContextMenuEvent *event) menu->popup(event->globalPos()); } +/*! + * \reimp + */ +void QWebEngineView::showEvent(QShowEvent *event) +{ + QWidget::showEvent(event); + page()->d_ptr->wasShown(); +} + +/*! + * \reimp + */ +void QWebEngineView::hideEvent(QHideEvent *event) +{ + QWidget::hideEvent(event); + page()->d_ptr->wasHidden(); +} + #ifndef QT_NO_ACCESSIBILITY int QWebEngineViewAccessible::childCount() const { diff --git a/src/webenginewidgets/api/qwebengineview.h b/src/webenginewidgets/api/qwebengineview.h index ae38e6c5c..e16bbf4af 100644 --- a/src/webenginewidgets/api/qwebengineview.h +++ b/src/webenginewidgets/api/qwebengineview.h @@ -120,6 +120,8 @@ protected: virtual QWebEngineView *createWindow(QWebEnginePage::WebWindowType type); virtual void contextMenuEvent(QContextMenuEvent*) Q_DECL_OVERRIDE; virtual bool event(QEvent*) Q_DECL_OVERRIDE; + virtual void showEvent(QShowEvent *) Q_DECL_OVERRIDE; + virtual void hideEvent(QHideEvent *) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(QWebEngineView) 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 76ca8d354..57631c4cc 100644 --- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp +++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp @@ -139,14 +139,12 @@ void RenderWidgetHostViewQtDelegateWidget::show() // want to show anything else than popups as top-level. if (parent() || m_isPopup) { QOpenGLWidget::show(); - m_client->notifyShown(); } } void RenderWidgetHostViewQtDelegateWidget::hide() { QOpenGLWidget::hide(); - m_client->notifyHidden(); } bool RenderWidgetHostViewQtDelegateWidget::isVisible() const @@ -257,6 +255,13 @@ void RenderWidgetHostViewQtDelegateWidget::showEvent(QShowEvent *event) m_windowConnections.append(connect(w, SIGNAL(yChanged(int)), SLOT(onWindowPosChanged()))); } m_client->windowChanged(); + m_client->notifyShown(); +} + +void RenderWidgetHostViewQtDelegateWidget::hideEvent(QHideEvent *event) +{ + QOpenGLWidget::hideEvent(event); + m_client->notifyHidden(); } bool RenderWidgetHostViewQtDelegateWidget::event(QEvent *event) 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 d228bd487..fddc79c2f 100644 --- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h +++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.h @@ -84,6 +84,7 @@ protected: bool event(QEvent *event) Q_DECL_OVERRIDE; void resizeEvent(QResizeEvent *resizeEvent) Q_DECL_OVERRIDE; void showEvent(QShowEvent *) Q_DECL_OVERRIDE; + void hideEvent(QHideEvent *) Q_DECL_OVERRIDE; void initializeGL() Q_DECL_OVERRIDE; void paintGL() Q_DECL_OVERRIDE; -- cgit v1.2.3 From be8c12a814cbed3f1fcb7097f6980fae6112cbc3 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 9 Oct 2015 09:32:55 +0200 Subject: Print JS console messages by default Change the behavior of QWebEnginePage/WebEngineView to print JavaScript console.warn and console.error messages by default in a 'js' logging category. This matches also the behavior for QtQml, where console messages end up in a 'qml' logging category by default. So far access to the JavaScript console required either use of the remote debugging functionality, subclassing of QWebEnginePage, or implementing a custom handler. Anyhow, even then writing a seamless forwarding of the data and metadata to the Qt message handler is difficult. This patches implements this forwarding by default. The behavior can be changed by either setting up rules for the 'js' category, e.g. setFilterRules("js.*=false"); or by implementing onJavaScriptConsoleMessage(), or overriding QWebEnginePage::javaScriptConsoleMessage. [ChangeLog] Unhandled JS console messages are now forwarded to to the Qt message handler inside a 'js' category. Change-Id: I5480383a80dcf7a122496f9b7915264ef9036db3 Reviewed-by: Joerg Bornemann --- src/webengine/api/qquickwebengineview.cpp | 25 +++++++++++++++++++++- src/webengine/doc/src/webengineview.qdoc | 3 ++- src/webenginewidgets/api/qwebenginepage.cpp | 23 ++++++++++++++++---- .../doc/src/qwebenginepage_lgpl.qdoc | 3 ++- 4 files changed, 47 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index 29f819eb3..f45dd67fe 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -67,6 +67,7 @@ #include #include +#include #include #include #include @@ -531,7 +532,29 @@ bool QQuickWebEngineViewPrivate::isFullScreenMode() const void QQuickWebEngineViewPrivate::javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, const QString& message, int lineNumber, const QString& sourceID) { Q_Q(QQuickWebEngineView); - Q_EMIT q->javaScriptConsoleMessage(static_cast(level), message, lineNumber, sourceID); + if (q->receivers(SIGNAL(javaScriptConsoleMessage(JavaScriptConsoleMessageLevel,QString,int,QString))) > 0) { + Q_EMIT q->javaScriptConsoleMessage(static_cast(level), message, lineNumber, sourceID); + return; + } + + static QLoggingCategory loggingCategory("js", QtWarningMsg); + const QByteArray file = sourceID.toUtf8(); + QMessageLogger logger(file.constData(), lineNumber, nullptr, loggingCategory.categoryName()); + + switch (level) { + case JavaScriptConsoleMessageLevel::Info: + if (loggingCategory.isInfoEnabled()) + logger.info().noquote() << message; + break; + case JavaScriptConsoleMessageLevel::Warning: + if (loggingCategory.isWarningEnabled()) + logger.warning().noquote() << message; + break; + case JavaScriptConsoleMessageLevel::Error: + if (loggingCategory.isCriticalEnabled()) + logger.critical().noquote() << message; + break; + } } void QQuickWebEngineViewPrivate::authenticationRequired(QSharedPointer controller) diff --git a/src/webengine/doc/src/webengineview.qdoc b/src/webengine/doc/src/webengineview.qdoc index f230ba261..82bec2472 100644 --- a/src/webengine/doc/src/webengineview.qdoc +++ b/src/webengine/doc/src/webengineview.qdoc @@ -434,7 +434,8 @@ \a level indicates the severity of the event that triggered the message, that is, whether it was triggered by an error or a less severe event. - The corresponding handler is \c onJavaScriptConsoleMessage. + The corresponding handler is \c onJavaScriptConsoleMessage. If no handler is specified, + the view will log the messages into a \c js \l{QLoggingCategory}{logging category}. */ /*! diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index a1c009cc3..75f722f8c 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -55,6 +55,7 @@ #include #include #include +#include #include #include #include @@ -1303,10 +1304,24 @@ bool QWebEnginePage::javaScriptPrompt(const QUrl &securityOrigin, const QString void QWebEnginePage::javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, const QString &message, int lineNumber, const QString &sourceID) { - Q_UNUSED(level); - Q_UNUSED(message); - Q_UNUSED(lineNumber); - Q_UNUSED(sourceID); + static QLoggingCategory loggingCategory("js", QtWarningMsg); + static QByteArray file = sourceID.toUtf8(); + QMessageLogger logger(file.constData(), lineNumber, nullptr, loggingCategory.categoryName()); + + switch (level) { + case JavaScriptConsoleMessageLevel::InfoMessageLevel: + if (loggingCategory.isInfoEnabled()) + logger.info().noquote() << message; + break; + case JavaScriptConsoleMessageLevel::WarningMessageLevel: + if (loggingCategory.isWarningEnabled()) + logger.warning().noquote() << message; + break; + case JavaScriptConsoleMessageLevel::ErrorMessageLevel: + if (loggingCategory.isCriticalEnabled()) + logger.critical().noquote() << message; + break; + } } bool QWebEnginePage::certificateError(const QWebEngineCertificateError &) diff --git a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc index b7b3bf022..9c07ce543 100644 --- a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc +++ b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc @@ -262,7 +262,8 @@ \a level indicates the severity of the event that triggered the message. That is, whether it was triggered by an error or a less severe event. - The default implementation prints nothing. + Since Qt 5.6, the default implementation logs the messages in a \c js + \l{QLoggingCategory}{logging category}. */ /*! -- cgit v1.2.3 From d6878aa0c67f4559881e74d3dbe8172006f3732c Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 9 Oct 2015 10:29:02 +0200 Subject: Add documentation about console logging Change-Id: I50ae0beb54f70c232eed0d9bd47b0dc01dadc130 Reviewed-by: Leena Miettinen --- src/webengine/doc/src/external-resources.qdoc | 5 ++ src/webengine/doc/src/qtwebengine-debugging.qdoc | 74 ++++++++++++++++++++++ src/webengine/doc/src/qtwebengine-devtools.qdoc | 58 ----------------- src/webengine/doc/src/qtwebengine-index.qdoc | 2 +- src/webengine/doc/src/webengineview.qdoc | 2 + .../doc/src/qwebenginepage_lgpl.qdoc | 2 + 6 files changed, 84 insertions(+), 59 deletions(-) create mode 100644 src/webengine/doc/src/qtwebengine-debugging.qdoc delete mode 100644 src/webengine/doc/src/qtwebengine-devtools.qdoc (limited to 'src') diff --git a/src/webengine/doc/src/external-resources.qdoc b/src/webengine/doc/src/external-resources.qdoc index 34a66291e..2987f1fca 100644 --- a/src/webengine/doc/src/external-resources.qdoc +++ b/src/webengine/doc/src/external-resources.qdoc @@ -35,6 +35,11 @@ \title Chrome DevTools */ +/*! + \externalpage https://developers.google.com/web/tools/javascript/console/console-write + \title Chrome console API +*/ + /* This prevents autolinking of each occurrence of 'WebEngine' To link to the WebEngine QML type, use explicit linking: diff --git a/src/webengine/doc/src/qtwebengine-debugging.qdoc b/src/webengine/doc/src/qtwebengine-debugging.qdoc new file mode 100644 index 000000000..bffcd1669 --- /dev/null +++ b/src/webengine/doc/src/qtwebengine-debugging.qdoc @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** 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 Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \page qtwebengine-debugging.html + \title Qt WebEngine Debugging and Profiling + + \section1 Console Logging + + JavaScript executed inside Qt WebEngine can use the + \l{Chrome console API} to log information to a console. The logging messages + are forwarded to Qt's logging facilities inside a \c js + \l{QLoggingCategory}{logging category}. However, only warning and fatal + messages are printed by default. To change this, you either have to set custom + rules for the \c js category, or provide custom message handlers + by reimplementing \l{QWebEnginePage::javaScriptConsoleMessage()}, or + connecting to \l{WebEngineView::javaScriptConsoleMessage()}. + + All messages can also be accessed through the Qt WebEngine developer + tools. + + \section1 Qt WebEngine Developer Tools + + The Qt WebEngine module provides web developer tools that make it easy + to inspect and debug layout and performance issues of any web content. + + The developer tools are accessed as a local web page using a Chromium or + Qt WebEngine based browser, such as the Chrome browser. + + To activate the developer tools, start an application that uses Qt + WebEngine with the command-line arguments: + + \badcode + --remote-debugging-port= + \endcode + + Where \c refers to a local network port. The web developer + tools can then be accessed by launching a browser at the address + \c http://localhost:. + + Alternatively, the environment variable QTWEBENGINE_REMOTE_DEBUGGING + can be set. It can be set as either just a port working similarly to + \c --remote-debugging-port or given both a host address and a port. The + latter can be used to control which network interface to export the + interface on, so that you can access the developer tools from a remote + device. + + For a detailed explanation of the capabilities of developer tools, see the + \l {Chrome DevTools} page. +*/ diff --git a/src/webengine/doc/src/qtwebengine-devtools.qdoc b/src/webengine/doc/src/qtwebengine-devtools.qdoc deleted file mode 100644 index ee87214e1..000000000 --- a/src/webengine/doc/src/qtwebengine-devtools.qdoc +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \page qtwebengine-devtools.html - \title Qt WebEngine Web Developer Tools - - The Qt WebEngine module provides web developer tools that make it easy - to inspect and debug layout and performance issues of any web content. - - The developer tools are accessed as a local web page using a Chromium or - Qt WebEngine based browser, such as the Chrome browser. - - To activate the developer tools, start an application that uses Qt - WebEngine with the command-line arguments: - - \badcode - --remote-debugging-port= - \endcode - - Where \c refers to a local network port. The web developer - tools can then be accessed by launching a browser at the address - \c http://localhost:. - - Alternatively, the environment variable QTWEBENGINE_REMOTE_DEBUGGING - can be set. It can be set as either just a port working similarly to - \c --remote-debugging-port or given both a host address and a port. The - latter can be used to control which network interface to export the - interface on, so that you can access the developer tools from a remote - device. - - For a detailed explanation of the capabilities of developer tools, see the - \l {Chrome DevTools} page. -*/ diff --git a/src/webengine/doc/src/qtwebengine-index.qdoc b/src/webengine/doc/src/qtwebengine-index.qdoc index e67bd43fd..671425e75 100644 --- a/src/webengine/doc/src/qtwebengine-index.qdoc +++ b/src/webengine/doc/src/qtwebengine-index.qdoc @@ -70,7 +70,7 @@ \list \li \l{Qt WebEngine Overview} \li \l{Qt WebEngine Platform Notes} - \li \l{Qt WebEngine Web Developer Tools} + \li \l{Qt WebEngine Debugging and Profiling} \li \l{Porting from Qt WebKit to Qt WebEngine} \endlist diff --git a/src/webengine/doc/src/webengineview.qdoc b/src/webengine/doc/src/webengineview.qdoc index 82bec2472..d1b4e722b 100644 --- a/src/webengine/doc/src/webengineview.qdoc +++ b/src/webengine/doc/src/webengineview.qdoc @@ -436,6 +436,8 @@ The corresponding handler is \c onJavaScriptConsoleMessage. If no handler is specified, the view will log the messages into a \c js \l{QLoggingCategory}{logging category}. + + \sa{Console Logging} */ /*! diff --git a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc index 9c07ce543..17dd15630 100644 --- a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc +++ b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc @@ -264,6 +264,8 @@ Since Qt 5.6, the default implementation logs the messages in a \c js \l{QLoggingCategory}{logging category}. + + \sa{Console Logging} */ /*! -- cgit v1.2.3 From be5a8eda40cba8a017c0044739e9347d6c6051ff Mon Sep 17 00:00:00 2001 From: Michael Bruning Date: Thu, 5 Nov 2015 18:30:02 +0100 Subject: Fix multiple symbol definition error with gold linker. We should not need to include the moc'ed sources here anymore. Change-Id: I2417e71aac9495e6f85653c7636be882b02e8a74 Reviewed-by: Allan Sandfeld Jensen --- src/webengine/api/qquickwebengineview.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index f45dd67fe..cef1004cc 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -1461,5 +1461,3 @@ void QQuickWebEngineViewport::setDevicePixelRatio(qreal devicePixelRatio) QT_END_NAMESPACE -#include "moc_qquickwebengineview_p.cpp" -#include "moc_qquickwebengineview_p_p.cpp" -- cgit v1.2.3 From cadcec655e53819e891eb3c7b0155087d86b2688 Mon Sep 17 00:00:00 2001 From: Michael Bruning Date: Thu, 5 Nov 2015 18:06:24 +0100 Subject: Apply glib usage from the Qt configuration to QtWebEngine as well. It was previously ignored and libQt5WebEngineCore.so.5 still linked dynamically to libglib-2.0.so Change-Id: I0b0b128c9eb36d94af9f5f91f212d1371403adad Task-number: QTBUG-49253 Reviewed-by: Kai Koehne Reviewed-by: Allan Sandfeld Jensen --- src/core/config/linux.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/core/config/linux.pri b/src/core/config/linux.pri index 8d736d0c1..9868d6848 100644 --- a/src/core/config/linux.pri +++ b/src/core/config/linux.pri @@ -29,7 +29,7 @@ contains(QT_CONFIG, system-png): GYP_CONFIG += use_system_libpng=1 contains(QT_CONFIG, system-jpeg): GYP_CONFIG += use_system_libjpeg=1 contains(QT_CONFIG, system-harfbuzz): GYP_CONFIG += use_system_harfbuzz=1 !contains(QT_CONFIG, pulseaudio): GYP_CONFIG += use_pulseaudio=0 - +!contains(QT_CONFIG, glib): GYP_CONFIG += use_glib=0 use?(system_libevent): GYP_CONFIG += use_system_libevent=1 use?(system_libwebp): GYP_CONFIG += use_system_libwebp=1 use?(system_libsrtp): GYP_CONFIG += use_system_libsrtp=1 -- cgit v1.2.3 From 161eba561d854c3f0125a859b40b11ba3131ea5c Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 5 Nov 2015 17:35:38 +0100 Subject: find high accuracy geo position source if requested If a high accuracy geo position source is requested, iterate through all available sources and return one that supports satellite positioning methods. Change-Id: I0c76bb8f8a6502b62e3a2e012327babbab2715ad Reviewed-by: Allan Sandfeld Jensen --- src/core/location_provider_qt.cpp | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/core/location_provider_qt.cpp b/src/core/location_provider_qt.cpp index e3be01b36..222d15354 100644 --- a/src/core/location_provider_qt.cpp +++ b/src/core/location_provider_qt.cpp @@ -88,12 +88,15 @@ QtPositioningHelper::~QtPositioningHelper() m_locationProvider->m_positioningHelper = 0; } +static bool isHighAccuracySource(const QGeoPositionInfoSource *source) +{ + return source->supportedPositioningMethods().testFlag( + QGeoPositionInfoSource::SatellitePositioningMethods); +} + void QtPositioningHelper::start(bool highAccuracy) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - Q_UNUSED(highAccuracy); - // FIXME: go through availableSources until one supports QGeoPositionInfoSource::SatellitePositioningMethods - // for the highAccuracy case. m_positionInfoSource = QGeoPositionInfoSource::createDefaultSource(this); if (!m_positionInfoSource) { qWarning("Failed to initialize location provider: The system either has no default " @@ -103,6 +106,23 @@ void QtPositioningHelper::start(bool highAccuracy) return; } + // Find high accuracy source if the default source is not already one. + if (highAccuracy && !isHighAccuracySource(m_positionInfoSource)) { + Q_FOREACH (const QString &name, QGeoPositionInfoSource::availableSources()) { + if (name == m_positionInfoSource->sourceName()) + continue; + QGeoPositionInfoSource *source = QGeoPositionInfoSource::createSource(name, this); + if (source && isHighAccuracySource(source)) { + delete m_positionInfoSource; + m_positionInfoSource = source; + break; + } + delete source; + } + m_positionInfoSource->setPreferredPositioningMethods( + QGeoPositionInfoSource::SatellitePositioningMethods); + } + connect(m_positionInfoSource, &QGeoPositionInfoSource::positionUpdated, this, &QtPositioningHelper::updatePosition); // disambiguate the error getter and the signal in QGeoPositionInfoSource. connect(m_positionInfoSource, static_cast(&QGeoPositionInfoSource::error) -- cgit v1.2.3 From 8b37025cde3848fbd8acabe9ff50fbd68a196416 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 6 Nov 2015 16:38:50 +0100 Subject: fix translations in UIDelegatesManager Declare UIDelegatesManager::tr and harmonize translations in that class. Change-Id: I6dfdb29b24d8912150d0af637b8dc1af633e21df Reviewed-by: Michal Klocek Reviewed-by: Kai Koehne --- src/webengine/ui_delegates_manager.cpp | 13 ++++++------- src/webengine/ui_delegates_manager.h | 6 ++++-- 2 files changed, 10 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/webengine/ui_delegates_manager.cpp b/src/webengine/ui_delegates_manager.cpp index 6c4282eb3..91cec865b 100644 --- a/src/webengine/ui_delegates_manager.cpp +++ b/src/webengine/ui_delegates_manager.cpp @@ -44,7 +44,6 @@ #include #include #include -#include #include #include #include @@ -249,19 +248,19 @@ void UIDelegatesManager::showDialog(QSharedPointer d switch (dialogController->type()) { case WebContentsAdapterClient::AlertDialog: dialogComponentType = AlertDialog; - title = QCoreApplication::translate("UIDelegatesManager", "Javascript Alert - %1").arg(m_view->url().toString()); + title = tr("Javascript Alert - %1").arg(m_view->url().toString()); break; case WebContentsAdapterClient::ConfirmDialog: dialogComponentType = ConfirmDialog; - title = QCoreApplication::translate("UIDelegatesManager", "Javascript Confirm - %1").arg(m_view->url().toString()); + title = tr("Javascript Confirm - %1").arg(m_view->url().toString()); break; case WebContentsAdapterClient::PromptDialog: dialogComponentType = PromptDialog; - title = QCoreApplication::translate("UIDelegatesManager", "Javascript Prompt - %1").arg(m_view->url().toString()); + title = tr("Javascript Prompt - %1").arg(m_view->url().toString()); break; case WebContentsAdapterClient::UnloadDialog: dialogComponentType = ConfirmDialog; - title = QCoreApplication::translate("UIDelegatesManager", "Are you sure you want to leave this page?"); + title = tr("Are you sure you want to leave this page?"); break; case WebContentsAdapterClient::InternalAuthorizationDialog: dialogComponentType = ConfirmDialog; @@ -339,10 +338,10 @@ void UIDelegatesManager::showDialog(QSharedPointerisProxy()) { - introMessage = QObject::tr("Connect to proxy \"%1\" using:"); + introMessage = tr("Connect to proxy \"%1\" using:"); introMessage = introMessage.arg(dialogController->host().toHtmlEscaped()); } else { - introMessage = QObject::tr("Enter username and password for \"%1\" at %2"); + introMessage = tr("Enter username and password for \"%1\" at %2"); introMessage = introMessage.arg(dialogController->realm()).arg(dialogController->url().toString().toHtmlEscaped()); } QQmlProperty textProp(authenticationDialog, QStringLiteral("text")); diff --git a/src/webengine/ui_delegates_manager.h b/src/webengine/ui_delegates_manager.h index 2a86b2803..5eeaf6e03 100644 --- a/src/webengine/ui_delegates_manager.h +++ b/src/webengine/ui_delegates_manager.h @@ -41,6 +41,7 @@ #include "web_contents_adapter.h" #include "web_contents_adapter_client.h" +#include #include #include #include @@ -88,8 +89,9 @@ Q_SIGNALS: void triggered(); }; -class UIDelegatesManager { - +class UIDelegatesManager +{ + Q_DECLARE_TR_FUNCTIONS(UIDelegatesManager) public: enum ComponentType { Invalid = -1, -- cgit v1.2.3 From ca2098638a51f5541cce3f9d8a23c0c6fe76eaa7 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 6 Nov 2015 16:49:37 +0100 Subject: rework QML authentication dialog Improve AuthenticationDialog.qml in the following ways: - Make all user-visible strings translatable. - Make the dialog a Window instead of an ApplicationWindow, because we don't need status bar or tool bar support. - Do not mix layouts and anchors. - Do not hard-code the dialog's size. - Longer strings in the message label are now actually visible. - Pressing enter in input fields accepts the dialog. - Remove calls to destroy() that would not destroy the dialog but the Button items. Task-number: QTBUG-49244 Change-Id: I490d30aeea740d436e060aa2b5f5bf288603b8f2 Reviewed-by: Kai Koehne --- src/webengine/ui/AuthenticationDialog.qml | 77 +++++++++++++++++++------------ 1 file changed, 47 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/webengine/ui/AuthenticationDialog.qml b/src/webengine/ui/AuthenticationDialog.qml index 46e2e3151..441235980 100644 --- a/src/webengine/ui/AuthenticationDialog.qml +++ b/src/webengine/ui/AuthenticationDialog.qml @@ -35,71 +35,88 @@ ****************************************************************************/ // FIXME: authentication missing in Qt Quick Dialogs atm. Make our own for now. +import QtQuick 2.5 import QtQuick.Controls 1.4 import QtQuick.Layouts 1.0 -import QtQuick 2.5 +import QtQuick.Window 2.2 -ApplicationWindow { +Window { signal accepted(string user, string password); signal rejected; - property alias text: message.text; + property alias text: message.text - width: 350 - height: 100 + title: qsTr("Authentication Required") flags: Qt.Dialog + modality: Qt.WindowModal - title: "Authentication Required" + width: minimumWidth + height: minimumHeight + minimumWidth: rootLayout.implicitWidth + rootLayout.doubleMargins + minimumHeight: rootLayout.implicitHeight + rootLayout.doubleMargins + + SystemPalette { id: palette; colorGroup: SystemPalette.Active } + color: palette.window function open() { show(); } + function acceptDialog() { + accepted(userField.text, passwordField.text); + close(); + } + ColumnLayout { - anchors.fill: parent; - anchors.margins: 4; + id: rootLayout + anchors.fill: parent + anchors.margins: 4 + property int doubleMargins: anchors.margins * 2 Text { id: message; - Layout.fillWidth: true; + color: palette.windowText } - RowLayout { + GridLayout { + columns: 2 Label { - text: "Username:" + text: qsTr("Username:") + color: palette.windowText } TextField { - id: userField; - Layout.fillWidth: true; + id: userField + focus: true + Layout.fillWidth: true + onAccepted: acceptDialog() } - } - RowLayout { Label { - text: "Password:" + text: qsTr("Password:") + color: palette.windowText } TextField { - id: passwordField; - Layout.fillWidth: true; - echoMode: TextInput.Password; + id: passwordField + Layout.fillWidth: true + echoMode: TextInput.Password + onAccepted: acceptDialog() } } + Item { + Layout.fillHeight: true + } RowLayout { Layout.alignment: Qt.AlignRight - spacing: 8; + spacing: 8 Button { - text: "Log In" + id: cancelButton + text: qsTr("&Cancel") onClicked: { - accepted(userField.text, passwordField.text); + rejected(); close(); - destroy(); } } Button { - text: "Cancel" - onClicked: { - rejected(); - close(); - destroy(); - } + text: qsTr("&Log In") + isDefault: true + onClicked: acceptDialog() } } } - } -- cgit v1.2.3 From cf55c06cf2a661be0e169a4406a9b79346d26ca5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Br=C3=BCning?= Date: Mon, 9 Nov 2015 17:49:10 +0100 Subject: [Docs] Add clarification on differences between Chromium and Google Chrome. Includes link to the upstream documentation that lives in the Chromium source tree. Change-Id: I7a4e061437547d554f004e8db3cec60c5c0d0800 Reviewed-by: Florian Bruhin Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Leena Miettinen --- src/webengine/doc/src/qtwebengine-overview.qdoc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/webengine/doc/src/qtwebengine-overview.qdoc b/src/webengine/doc/src/qtwebengine-overview.qdoc index fa30892d3..0e306db1d 100644 --- a/src/webengine/doc/src/qtwebengine-overview.qdoc +++ b/src/webengine/doc/src/qtwebengine-overview.qdoc @@ -67,6 +67,12 @@ specification than Qt WebKit. However, Qt WebEngine is thus heavier than Qt WebKit and does not provide direct access to the network stack and the HTML document through C++ APIs. + Please note that Qt WebEngine is based on Chromium, but does not contain or use any services + or add-ons that might be part of the Chrome browser that is built and delivered by Google. + You can find more detailed information about the differences between Chromium and Chrome in this + \l{https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md}{overview} + that is part of the documentation in the \l {Chromium Project} upstream source tree. + Chromium is tightly integrated to the \l{Qt Quick Scene Graph}{Qt Quick scene graph}, which is based on OpenGL ES 2.0 or OpenGL 2.0 for its rendering. This provides you with one-pass compositing of web content and all the Qt Quick UI. The integration to Chromium is transparent -- cgit v1.2.3 From 6677ddec16488f21c5f730f4a4005c66d11d81e1 Mon Sep 17 00:00:00 2001 From: Szabolcs David Date: Fri, 6 Nov 2015 05:33:47 -0800 Subject: Fix resetting attributes in top level WebEngineSettings Store default values in separate containers and remove related FIXMEs from WebEngineSettings. Add API test case in order to demonstrate the bug. Change-Id: If9d98265cab0f41b543fe690d534879b65f2b577 Reviewed-by: Kai Koehne Reviewed-by: Joerg Bornemann --- src/core/web_engine_settings.cpp | 118 +++++++++++++++++++++++---------------- src/core/web_engine_settings.h | 4 ++ 2 files changed, 74 insertions(+), 48 deletions(-) (limited to 'src') diff --git a/src/core/web_engine_settings.cpp b/src/core/web_engine_settings.cpp index 19558980b..ff67ed6a6 100644 --- a/src/core/web_engine_settings.cpp +++ b/src/core/web_engine_settings.cpp @@ -46,6 +46,10 @@ namespace QtWebEngineCore { +QHash WebEngineSettings::m_defaultAttributes; +QHash WebEngineSettings::m_defaultFontFamilies; +QHash WebEngineSettings::m_defaultFontSizes; + static const int batchTimerTimeout = 0; class BatchTimer : public QTimer { @@ -132,9 +136,12 @@ bool WebEngineSettings::testAttribute(WebEngineSettings::Attribute attr) const void WebEngineSettings::resetAttribute(WebEngineSettings::Attribute attr) { - if (!parentSettings) // FIXME: Set initial defaults. - return; - m_attributes.remove(attr); + if (!parentSettings) { + Q_ASSERT(m_defaultAttributes.contains(attr)); + m_attributes.insert(attr, m_defaultAttributes.value(attr)); + } else { + m_attributes.remove(attr); + } scheduleApplyRecursively(); } @@ -155,9 +162,12 @@ QString WebEngineSettings::fontFamily(WebEngineSettings::FontFamily which) void WebEngineSettings::resetFontFamily(WebEngineSettings::FontFamily which) { - if (!parentSettings) // FIXME: Set initial defaults. - return; - m_fontFamilies.remove(which); + if (!parentSettings) { + Q_ASSERT(m_defaultFontFamilies.contains(which)); + m_fontFamilies.insert(which, m_defaultFontFamilies.value(which)); + } else { + m_fontFamilies.remove(which); + } scheduleApplyRecursively(); } @@ -178,9 +188,12 @@ int WebEngineSettings::fontSize(WebEngineSettings::FontSize type) const void WebEngineSettings::resetFontSize(WebEngineSettings::FontSize type) { - if (!parentSettings) // FIXME: Set initial defaults. - return; - m_fontSizes.remove(type); + if (!parentSettings) { + Q_ASSERT(m_defaultFontSizes.contains(type)); + m_fontSizes.insert(type, m_defaultFontSizes.value(type)); + } else { + m_fontSizes.remove(type); + } scheduleApplyRecursively(); } @@ -199,45 +212,54 @@ QString WebEngineSettings::defaultTextEncoding() const void WebEngineSettings::initDefaults(bool offTheRecord) { - // Initialize the default settings. - m_attributes.insert(AutoLoadImages, true); - m_attributes.insert(JavascriptEnabled, true); - m_attributes.insert(JavascriptCanOpenWindows, true); - m_attributes.insert(JavascriptCanAccessClipboard, false); - m_attributes.insert(LinksIncludedInFocusChain, true); - m_attributes.insert(LocalStorageEnabled, !offTheRecord); - m_attributes.insert(LocalContentCanAccessRemoteUrls, false); - m_attributes.insert(XSSAuditingEnabled, false); - m_attributes.insert(SpatialNavigationEnabled, false); - m_attributes.insert(LocalContentCanAccessFileUrls, true); - m_attributes.insert(HyperlinkAuditingEnabled, false); - m_attributes.insert(ScrollAnimatorEnabled, false); - m_attributes.insert(ErrorPageEnabled, true); - m_attributes.insert(PluginsEnabled, false); - m_attributes.insert(FullScreenSupportEnabled, false); - - // Default fonts - QFont defaultFont; - defaultFont.setStyleHint(QFont::Serif); - m_fontFamilies.insert(StandardFont, defaultFont.defaultFamily()); - m_fontFamilies.insert(SerifFont, defaultFont.defaultFamily()); - - defaultFont.setStyleHint(QFont::Fantasy); - m_fontFamilies.insert(FantasyFont, defaultFont.defaultFamily()); - - defaultFont.setStyleHint(QFont::Cursive); - m_fontFamilies.insert(CursiveFont, defaultFont.defaultFamily()); - - defaultFont.setStyleHint(QFont::SansSerif); - m_fontFamilies.insert(SansSerifFont, defaultFont.defaultFamily()); - - defaultFont.setStyleHint(QFont::Monospace); - m_fontFamilies.insert(FixedFont, defaultFont.defaultFamily()); - - m_fontSizes.insert(MinimumFontSize, 0); - m_fontSizes.insert(MinimumLogicalFontSize, 6); - m_fontSizes.insert(DefaultFixedFontSize, 13); - m_fontSizes.insert(DefaultFontSize, 16); + if (m_defaultAttributes.isEmpty()) { + // Initialize the default settings. + m_defaultAttributes.insert(AutoLoadImages, true); + m_defaultAttributes.insert(JavascriptEnabled, true); + m_defaultAttributes.insert(JavascriptCanOpenWindows, true); + m_defaultAttributes.insert(JavascriptCanAccessClipboard, false); + m_defaultAttributes.insert(LinksIncludedInFocusChain, true); + m_defaultAttributes.insert(LocalStorageEnabled, !offTheRecord); + m_defaultAttributes.insert(LocalContentCanAccessRemoteUrls, false); + m_defaultAttributes.insert(XSSAuditingEnabled, false); + m_defaultAttributes.insert(SpatialNavigationEnabled, false); + m_defaultAttributes.insert(LocalContentCanAccessFileUrls, true); + m_defaultAttributes.insert(HyperlinkAuditingEnabled, false); + m_defaultAttributes.insert(ScrollAnimatorEnabled, false); + m_defaultAttributes.insert(ErrorPageEnabled, true); + m_defaultAttributes.insert(PluginsEnabled, false); + m_defaultAttributes.insert(FullScreenSupportEnabled, false); + } + m_attributes = m_defaultAttributes; + + if (m_defaultFontFamilies.isEmpty()) { + // Default fonts + QFont defaultFont; + defaultFont.setStyleHint(QFont::Serif); + m_defaultFontFamilies.insert(StandardFont, defaultFont.defaultFamily()); + m_defaultFontFamilies.insert(SerifFont, defaultFont.defaultFamily()); + + defaultFont.setStyleHint(QFont::Fantasy); + m_defaultFontFamilies.insert(FantasyFont, defaultFont.defaultFamily()); + + defaultFont.setStyleHint(QFont::Cursive); + m_defaultFontFamilies.insert(CursiveFont, defaultFont.defaultFamily()); + + defaultFont.setStyleHint(QFont::SansSerif); + m_defaultFontFamilies.insert(SansSerifFont, defaultFont.defaultFamily()); + + defaultFont.setStyleHint(QFont::Monospace); + m_defaultFontFamilies.insert(FixedFont, defaultFont.defaultFamily()); + } + m_fontFamilies = m_defaultFontFamilies; + + if (m_defaultFontSizes.isEmpty()) { + m_defaultFontSizes.insert(MinimumFontSize, 0); + m_defaultFontSizes.insert(MinimumLogicalFontSize, 6); + m_defaultFontSizes.insert(DefaultFixedFontSize, 13); + m_defaultFontSizes.insert(DefaultFontSize, 16); + } + m_fontSizes = m_defaultFontSizes; m_defaultEncoding = QStringLiteral("ISO-8859-1"); } diff --git a/src/core/web_engine_settings.h b/src/core/web_engine_settings.h index 29ef079b7..3d3d734d0 100644 --- a/src/core/web_engine_settings.h +++ b/src/core/web_engine_settings.h @@ -136,6 +136,10 @@ private: WebEngineSettings *parentSettings; QSet childSettings; + static QHash m_defaultAttributes; + static QHash m_defaultFontFamilies; + static QHash m_defaultFontSizes; + friend class BatchTimer; friend class WebContentsAdapter; }; -- cgit v1.2.3 From 70a376d73718cc4ff8d96f6761b8c1896ca25c23 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 9 Nov 2015 15:23:32 +0100 Subject: Make QWebEngineFullScreenRequest const correct Let QWebEngineFullScreenRequest be logically const-correct. It feels weird to be allowed to call "accept()" or "reject()" on a constant object. Also allow the user to copy the request, but check whether the page is still valid in the implementations of accept(), reject(). Change-Id: Ibf139a126734fc8e2db68ec26dc8f24cd4438942 Reviewed-by: Allan Sandfeld Jensen --- .../api/qwebenginefullscreenrequest.cpp | 22 ++++++++++++++++------ .../api/qwebenginefullscreenrequest.h | 15 +++++++-------- src/webenginewidgets/api/qwebenginepage.cpp | 4 ++-- src/webenginewidgets/api/qwebenginepage.h | 3 ++- 4 files changed, 27 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/webenginewidgets/api/qwebenginefullscreenrequest.cpp b/src/webenginewidgets/api/qwebenginefullscreenrequest.cpp index 6223c070d..7db86e6f2 100644 --- a/src/webenginewidgets/api/qwebenginefullscreenrequest.cpp +++ b/src/webenginewidgets/api/qwebenginefullscreenrequest.cpp @@ -39,21 +39,31 @@ QT_BEGIN_NAMESPACE -QWebEngineFullScreenRequest::QWebEngineFullScreenRequest(QWebEnginePagePrivate *pagePrivate, const QUrl &origin, bool fullscreen) - : m_pagePrivate(pagePrivate) +QWebEngineFullScreenRequest::QWebEngineFullScreenRequest(QWebEnginePage *page, const QUrl &origin, bool fullscreen) + : m_page(page) , m_origin(origin) , m_toggleOn(fullscreen) { } -void QWebEngineFullScreenRequest::reject() const +void QWebEngineFullScreenRequest::reject() { - m_pagePrivate->setFullScreenMode(!m_toggleOn); + if (!m_page) { + qWarning("Cannot reject QWebEngineFullScreenRequest: Originating page is already deleted"); + return; + } + + m_page->d_func()->setFullScreenMode(!m_toggleOn); } -void QWebEngineFullScreenRequest::accept() const +void QWebEngineFullScreenRequest::accept() { - m_pagePrivate->setFullScreenMode(m_toggleOn); + if (!m_page) { + qWarning("Cannot accept QWebEngineFullScreenRequest: Originating page is already deleted"); + return; + } + + m_page->d_func()->setFullScreenMode(m_toggleOn); } QT_END_NAMESPACE diff --git a/src/webenginewidgets/api/qwebenginefullscreenrequest.h b/src/webenginewidgets/api/qwebenginefullscreenrequest.h index c6768f4d6..26f7247e0 100644 --- a/src/webenginewidgets/api/qwebenginefullscreenrequest.h +++ b/src/webenginewidgets/api/qwebenginefullscreenrequest.h @@ -38,26 +38,25 @@ #define QWEBENGINEFULLSCREENREQUEST_H #include -#include -#include +#include +#include QT_BEGIN_NAMESPACE -class QWebEnginePagePrivate; +class QWebEnginePage; class QWEBENGINEWIDGETS_EXPORT QWebEngineFullScreenRequest { Q_GADGET Q_PROPERTY(bool toggleOn READ toggleOn) Q_PROPERTY(QUrl origin READ origin) public: - Q_INVOKABLE void reject() const; - Q_INVOKABLE void accept() const; + Q_INVOKABLE void reject(); + Q_INVOKABLE void accept(); bool toggleOn() const { return m_toggleOn; } const QUrl &origin() const { return m_origin; } private: - Q_DISABLE_COPY(QWebEngineFullScreenRequest) - QWebEngineFullScreenRequest(QWebEnginePagePrivate *pagePrivate, const QUrl &origin, bool toggleOn); - QWebEnginePagePrivate *m_pagePrivate; + QWebEngineFullScreenRequest(QWebEnginePage *page, const QUrl &origin, bool toggleOn); + QPointer m_page; const QUrl m_origin; const bool m_toggleOn; friend class QWebEnginePagePrivate; diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index 75f722f8c..49c0cf5dd 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -420,7 +420,7 @@ QWebEnginePage::QWebEnginePage(QObject* parent) */ /*! - \fn QWebEnginePage::fullScreenRequested(const QWebEngineFullScreenRequest &request) + \fn QWebEnginePage::fullScreenRequested(QWebEngineFullScreenRequest request) This signal is emitted when the web page issues the request to enter fullscreen mode for a web-element, usually a video element. @@ -912,7 +912,7 @@ void QWebEnginePagePrivate::navigationRequested(int navigationType, const QUrl & void QWebEnginePagePrivate::requestFullScreenMode(const QUrl &origin, bool fullscreen) { Q_Q(QWebEnginePage); - QWebEngineFullScreenRequest request(this, origin, fullscreen); + QWebEngineFullScreenRequest request(q, origin, fullscreen); Q_EMIT q->fullScreenRequested(request); } diff --git a/src/webenginewidgets/api/qwebenginepage.h b/src/webenginewidgets/api/qwebenginepage.h index 07b27deee..83faaf42e 100644 --- a/src/webenginewidgets/api/qwebenginepage.h +++ b/src/webenginewidgets/api/qwebenginepage.h @@ -252,7 +252,7 @@ Q_SIGNALS: void featurePermissionRequested(const QUrl &securityOrigin, QWebEnginePage::Feature feature); void featurePermissionRequestCanceled(const QUrl &securityOrigin, QWebEnginePage::Feature feature); - void fullScreenRequested(const QWebEngineFullScreenRequest &fullScreenRequest); + void fullScreenRequested(QWebEngineFullScreenRequest fullScreenRequest); void authenticationRequired(const QUrl &requestUrl, QAuthenticator *authenticator); void proxyAuthenticationRequired(const QUrl &requestUrl, QAuthenticator *authenticator, const QString &proxyHost); @@ -283,6 +283,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_webActionTriggered(bool checked)) #endif + friend class QWebEngineFullScreenRequest; friend class QWebEngineView; friend class QWebEngineViewPrivate; #ifndef QT_NO_ACCESSIBILITY -- cgit v1.2.3 From 1a6b32fa543ae95b343b3b86d7a4716a44b73825 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 13 Nov 2015 12:52:35 +0100 Subject: use Q_ENUM instead of Q_ENUMS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes the enum values available as strings in qDebug, QCOMPARE and such. Change-Id: Id57a2002451337fcc8aedac673f834445913895c Reviewed-by: Michael Brüning --- src/webengine/api/qquickwebenginecertificateerror_p.h | 2 +- src/webengine/api/qquickwebenginedownloaditem_p.h | 2 +- src/webengine/api/qquickwebengineprofile_p.h | 4 ++-- src/webengine/api/qquickwebenginescript_p.h | 4 ++-- src/webengine/api/qquickwebengineview_p.h | 18 +++++++++--------- src/webenginewidgets/api/qwebenginedownloaditem.h | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/webengine/api/qquickwebenginecertificateerror_p.h b/src/webengine/api/qquickwebenginecertificateerror_p.h index 6f54528d4..7deeac932 100644 --- a/src/webengine/api/qquickwebenginecertificateerror_p.h +++ b/src/webengine/api/qquickwebenginecertificateerror_p.h @@ -62,7 +62,6 @@ class Q_WEBENGINE_EXPORT QQuickWebEngineCertificateError : public QObject { Q_PROPERTY(Error error READ error) Q_PROPERTY(QString description READ description) Q_PROPERTY(bool overridable READ overridable) - Q_ENUMS(Error) public: @@ -82,6 +81,7 @@ public: CertificateWeakKey = -211, CertificateNameConstraintViolation = -212, }; + Q_ENUM(Error) QQuickWebEngineCertificateError(const QSharedPointer &controller, QObject *parent = 0); ~QQuickWebEngineCertificateError(); diff --git a/src/webengine/api/qquickwebenginedownloaditem_p.h b/src/webengine/api/qquickwebenginedownloaditem_p.h index 9a30eb4ca..d0be2f99a 100644 --- a/src/webengine/api/qquickwebenginedownloaditem_p.h +++ b/src/webengine/api/qquickwebenginedownloaditem_p.h @@ -69,7 +69,7 @@ public: DownloadCancelled, DownloadInterrupted }; - Q_ENUMS(DownloadState) + Q_ENUM(DownloadState) Q_PROPERTY(quint32 id READ id CONSTANT FINAL) Q_PROPERTY(DownloadState state READ state NOTIFY stateChanged) diff --git a/src/webengine/api/qquickwebengineprofile_p.h b/src/webengine/api/qquickwebengineprofile_p.h index b4e0d173c..1ed15aec2 100644 --- a/src/webengine/api/qquickwebengineprofile_p.h +++ b/src/webengine/api/qquickwebengineprofile_p.h @@ -67,8 +67,6 @@ class QWebEngineCookieStoreClient; class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineProfile : public QObject { Q_OBJECT - Q_ENUMS(HttpCacheType); - Q_ENUMS(PersistentCookiesPolicy); Q_PROPERTY(QString storageName READ storageName WRITE setStorageName NOTIFY storageNameChanged FINAL) Q_PROPERTY(bool offTheRecord READ isOffTheRecord WRITE setOffTheRecord NOTIFY offTheRecordChanged FINAL) Q_PROPERTY(QString persistentStoragePath READ persistentStoragePath WRITE setPersistentStoragePath NOTIFY persistentStoragePathChanged FINAL) @@ -86,12 +84,14 @@ public: MemoryHttpCache, DiskHttpCache }; + Q_ENUM(HttpCacheType) enum PersistentCookiesPolicy { NoPersistentCookies, AllowPersistentCookies, ForcePersistentCookies }; + Q_ENUM(PersistentCookiesPolicy) QString storageName() const; void setStorageName(const QString &name); diff --git a/src/webengine/api/qquickwebenginescript_p.h b/src/webengine/api/qquickwebenginescript_p.h index de91134ef..c9d6f5d26 100644 --- a/src/webengine/api/qquickwebenginescript_p.h +++ b/src/webengine/api/qquickwebenginescript_p.h @@ -59,8 +59,6 @@ class QQuickWebEngineView; class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineScript : public QObject { Q_OBJECT - Q_ENUMS(InjectionPoint) - Q_ENUMS(ScriptWorldId) Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) Q_PROPERTY(QUrl sourceUrl READ sourceUrl WRITE setSourceUrl NOTIFY sourceUrlChanged) Q_PROPERTY(QString sourceCode READ sourceCode WRITE setSourceCode NOTIFY sourceCodeChanged) @@ -75,12 +73,14 @@ public: DocumentReady, DocumentCreation }; + Q_ENUM(InjectionPoint) enum ScriptWorldId { MainWorld = 0, ApplicationWorld, UserWorld }; + Q_ENUM(ScriptWorldId) QQuickWebEngineScript(); ~QQuickWebEngineScript(); diff --git a/src/webengine/api/qquickwebengineview_p.h b/src/webengine/api/qquickwebengineview_p.h index ddc656a58..34224ad31 100644 --- a/src/webengine/api/qquickwebengineview_p.h +++ b/src/webengine/api/qquickwebengineview_p.h @@ -113,16 +113,7 @@ class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineView : public QQuickItem { Q_PROPERTY(QQuickWebEngineTestSupport *testSupport READ testSupport WRITE setTestSupport FINAL) #endif - Q_ENUMS(NavigationRequestAction); - Q_ENUMS(NavigationType); - Q_ENUMS(LoadStatus); - Q_ENUMS(ErrorDomain); - Q_ENUMS(NewViewDestination); - Q_ENUMS(Feature); - Q_ENUMS(JavaScriptConsoleMessageLevel); - Q_ENUMS(RenderProcessTerminationStatus); Q_FLAGS(FindFlags); - Q_ENUMS(WebAction); public: QQuickWebEngineView(QQuickItem *parent = 0); @@ -151,6 +142,7 @@ public: // we can expose extra actions in experimental. IgnoreRequest = 0xFF }; + Q_ENUM(NavigationRequestAction) // must match WebContentsAdapterClient::NavigationType enum NavigationType { @@ -161,6 +153,7 @@ public: ReloadNavigation, OtherNavigation }; + Q_ENUM(NavigationType) enum LoadStatus { LoadStartedStatus, @@ -168,6 +161,7 @@ public: LoadSucceededStatus, LoadFailedStatus }; + Q_ENUM(LoadStatus) enum ErrorDomain { NoErrorDomain, @@ -178,6 +172,7 @@ public: FtpErrorDomain, DnsErrorDomain }; + Q_ENUM(ErrorDomain) enum NewViewDestination { NewViewInWindow, @@ -185,6 +180,7 @@ public: NewViewInDialog, NewViewInBackgroundTab }; + Q_ENUM(NewViewDestination) enum Feature { MediaAudioCapture, @@ -192,6 +188,7 @@ public: MediaAudioVideoCapture, Geolocation }; + Q_ENUM(Feature) enum WebAction { NoWebAction = - 1, @@ -234,6 +231,7 @@ public: WebActionCount }; + Q_ENUM(WebAction) // must match WebContentsAdapterClient::JavaScriptConsoleMessageLevel enum JavaScriptConsoleMessageLevel { @@ -241,6 +239,7 @@ public: WarningMessageLevel, ErrorMessageLevel }; + Q_ENUM(JavaScriptConsoleMessageLevel) // must match WebContentsAdapterClient::RenderProcessTerminationStatus enum RenderProcessTerminationStatus { @@ -249,6 +248,7 @@ public: CrashedTerminationStatus, KilledTerminationStatus }; + Q_ENUM(RenderProcessTerminationStatus) enum FindFlag { FindBackward = 1, diff --git a/src/webenginewidgets/api/qwebenginedownloaditem.h b/src/webenginewidgets/api/qwebenginedownloaditem.h index 05e0f8765..38b9a4ad8 100644 --- a/src/webenginewidgets/api/qwebenginedownloaditem.h +++ b/src/webenginewidgets/api/qwebenginedownloaditem.h @@ -59,7 +59,7 @@ public: DownloadCancelled, DownloadInterrupted }; - Q_ENUMS(DownloadState) + Q_ENUM(DownloadState) quint32 id() const; DownloadState state() const; -- cgit v1.2.3 From 1173d48149a8133b607894b67e1ec32de68e21e8 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 17 Nov 2015 14:56:08 +0100 Subject: Fix crash in PermissionManagerQt std::vector::erase invalidates the end() iterator. We must not cache end(). This fixes crashes of tst_qwebenginepage::geolocationRequestJS on Windows. Change-Id: Ie2c28c413947bb9ee6580625e07b9d3099d69b06 Reviewed-by: Kai Koehne --- src/core/permission_manager_qt.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/core/permission_manager_qt.cpp b/src/core/permission_manager_qt.cpp index d89b530ee..b322e507e 100644 --- a/src/core/permission_manager_qt.cpp +++ b/src/core/permission_manager_qt.cpp @@ -78,8 +78,7 @@ void PermissionManagerQt::permissionRequestReply(const QUrl &origin, BrowserCont m_permissions[key] = reply; content::PermissionStatus status = reply ? content::PERMISSION_STATUS_GRANTED : content::PERMISSION_STATUS_DENIED; auto it = m_requests.begin(); - const auto end = m_requests.end(); - while (it != end) { + while (it != m_requests.end()) { if (it->origin == origin && it->type == type) { it->callback.Run(status); it = m_requests.erase(it); @@ -133,8 +132,7 @@ void PermissionManagerQt::CancelPermissionRequest(content::PermissionType permis // Should we add API to cancel permissions in the UI level? const QUrl origin = toQt(requesting_origin); auto it = m_requests.begin(); - const auto end = m_requests.end(); - while (it != end) { + while (it != m_requests.end()) { if (it->id == request_id && it->type == permissionType && it->origin == origin) { m_requests.erase(it); return; -- cgit v1.2.3