summaryrefslogtreecommitdiffstats
path: root/src/webengine
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-05-14 10:49:00 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-05-15 18:05:27 +0200
commit57ae490b073ea14a9e7b3439031040515237eeb6 (patch)
treea66d05c6c2c30643b77f204cb20b9e2ac4815804 /src/webengine
parent4d4330116471a495796e9d2723b3b5c508fc26b1 (diff)
parentbc6df3888128e3a0e0d4e2f8a69970ac36d8abe7 (diff)
Merge "Merge remote-tracking branch 'origin/5.15' into dev"
Diffstat (limited to 'src/webengine')
-rw-r--r--src/webengine/api/qquickwebengineview.cpp27
-rw-r--r--src/webengine/api/qquickwebengineview_p_p.h6
-rw-r--r--src/webengine/doc/src/external-resources.qdoc8
-rw-r--r--src/webengine/doc/src/qtwebengine-features.qdoc28
-rw-r--r--src/webengine/render_widget_host_view_qt_delegate_quick.cpp2
5 files changed, 52 insertions, 19 deletions
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
index f5cf2f5c2..6e5469ab4 100644
--- a/src/webengine/api/qquickwebengineview.cpp
+++ b/src/webengine/api/qquickwebengineview.cpp
@@ -129,6 +129,7 @@ QQuickWebEngineViewPrivate::QQuickWebEngineViewPrivate()
, devicePixelRatio(QGuiApplication::primaryScreen()->devicePixelRatio())
, m_webChannel(0)
, m_webChannelWorld(0)
+ , m_defaultAudioMuted(false)
, m_isBeingAdopted(false)
, m_backgroundColor(Qt::white)
, m_zoomFactor(1.0)
@@ -547,12 +548,13 @@ void QQuickWebEngineViewPrivate::unhandledKeyEvent(QKeyEvent *event)
QCoreApplication::sendEvent(q->parentItem(), event);
}
-void QQuickWebEngineViewPrivate::adoptNewWindow(QSharedPointer<WebContentsAdapter> newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &, const QUrl &targetUrl)
+QSharedPointer<WebContentsAdapter>
+QQuickWebEngineViewPrivate::adoptNewWindow(QSharedPointer<WebContentsAdapter> newWebContents,
+ WindowOpenDisposition disposition, bool userGesture,
+ const QRect &, const QUrl &targetUrl)
{
Q_Q(QQuickWebEngineView);
QQuickWebEngineNewViewRequest request;
- // This increases the ref-count of newWebContents and will tell Chromium
- // to start loading it and possibly return it to its parent page window.open().
request.m_adapter = newWebContents;
request.m_isUserInitiated = userGesture;
request.m_requestedUrl = targetUrl;
@@ -575,6 +577,8 @@ void QQuickWebEngineViewPrivate::adoptNewWindow(QSharedPointer<WebContentsAdapte
}
Q_EMIT q->newViewRequested(&request);
+
+ return newWebContents;
}
bool QQuickWebEngineViewPrivate::isBeingAdopted()
@@ -669,11 +673,8 @@ void QQuickWebEngineViewPrivate::runMediaAccessPermissionRequest(const QUrl &sec
void QQuickWebEngineViewPrivate::runMouseLockPermissionRequest(const QUrl &securityOrigin)
{
-
- Q_UNUSED(securityOrigin);
-
// TODO: Add mouse lock support
- adapter->grantMouseLockPermission(false);
+ adapter->grantMouseLockPermission(securityOrigin, false);
}
void QQuickWebEngineViewPrivate::runQuotaRequest(QWebEngineQuotaRequest request)
@@ -906,6 +907,9 @@ void QQuickWebEngineViewPrivate::initializationFinished()
adapter->setWebChannel(m_webChannel, m_webChannelWorld);
#endif
+ if (m_defaultAudioMuted != adapter->isAudioMuted())
+ adapter->setAudioMuted(m_defaultAudioMuted);
+
if (devToolsView && devToolsView->d_ptr->adapter)
adapter->openDevToolsFrontend(devToolsView->d_ptr->adapter);
@@ -1426,15 +1430,18 @@ void QQuickWebEngineView::setBackgroundColor(const QColor &color)
bool QQuickWebEngineView::isAudioMuted() const
{
const Q_D(QQuickWebEngineView);
- return d->adapter->isAudioMuted();
+ if (d->adapter->isInitialized())
+ return d->adapter->isAudioMuted();
+ return d->m_defaultAudioMuted;
}
void QQuickWebEngineView::setAudioMuted(bool muted)
{
Q_D(QQuickWebEngineView);
- bool wasAudioMuted = d->adapter->isAudioMuted();
+ bool wasAudioMuted = isAudioMuted();
+ d->m_defaultAudioMuted = muted;
d->adapter->setAudioMuted(muted);
- if (wasAudioMuted != d->adapter->isAudioMuted())
+ if (wasAudioMuted != isAudioMuted())
Q_EMIT audioMutedChanged(muted);
}
diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h
index 5c884e36e..12a991ffa 100644
--- a/src/webengine/api/qquickwebengineview_p_p.h
+++ b/src/webengine/api/qquickwebengineview_p_p.h
@@ -121,7 +121,10 @@ public:
void loadFinished(bool success, const QUrl &url, bool isErrorPage = false, int errorCode = 0, const QString &errorDescription = QString()) override;
void focusContainer() override;
void unhandledKeyEvent(QKeyEvent *event) override;
- void adoptNewWindow(QSharedPointer<QtWebEngineCore::WebContentsAdapter> newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &, const QUrl &targetUrl) override;
+ QSharedPointer<QtWebEngineCore::WebContentsAdapter>
+ adoptNewWindow(QSharedPointer<QtWebEngineCore::WebContentsAdapter> newWebContents,
+ WindowOpenDisposition disposition, bool userGesture, const QRect &,
+ const QUrl &targetUrl) override;
bool isBeingAdopted() override;
void close() override;
void windowCloseRejected() override;
@@ -214,6 +217,7 @@ public:
QPointer<QQuickWebEngineView> inspectedView;
QPointer<QQuickWebEngineView> devToolsView;
uint m_webChannelWorld;
+ bool m_defaultAudioMuted;
bool m_isBeingAdopted;
mutable QQuickWebEngineAction *actions[QQuickWebEngineView::WebActionCount];
QtWebEngineCore::RenderWidgetHostViewQtDelegateQuick *widget = nullptr;
diff --git a/src/webengine/doc/src/external-resources.qdoc b/src/webengine/doc/src/external-resources.qdoc
index acf63fb04..7878ed9f8 100644
--- a/src/webengine/doc/src/external-resources.qdoc
+++ b/src/webengine/doc/src/external-resources.qdoc
@@ -71,8 +71,8 @@
*/
/*!
- \externalpage http://www.widevine.com/wv_drm.html
- \title Widevine DRM
+ \externalpage http://www.widevine.com
+ \title Widevine CDM
*/
/*!
@@ -86,8 +86,8 @@
*/
/*!
- \externalpage https://shaka-player-demo.appspot.com/demo/
- \title Shaka Player
+ \externalpage https://bitmovin.com/demos/drm
+ \title Bitmovin Player
*/
/*!
diff --git a/src/webengine/doc/src/qtwebengine-features.qdoc b/src/webengine/doc/src/qtwebengine-features.qdoc
index 954992de1..431367765 100644
--- a/src/webengine/doc/src/qtwebengine-features.qdoc
+++ b/src/webengine/doc/src/qtwebengine-features.qdoc
@@ -181,8 +181,30 @@
\section1 HTML5 DRM
- \QWE supports viewing DRM protected videos if the \l{Widevine DRM}
- plugin has been installed.
+ \QWE supports viewing DRM protected videos if the \l{Widevine CDM} plugin has been installed.
+ CDM plugin is a replacement of Flash based plugins for displaying DRM-protected content.
+ It comes only in a binary format, so it can hide DRM decryption implementation details.
+ It can be obtained from a third party or from a Google Chrome installation.
+
+ \QWE on startup looks for the \l{Widevine CDM} plugin in well know locations, like
+ default Google Chrome installation directory or Linux distro specific paths. However, plugin
+ location can be also passed with \c {QTWEBENGINE_CHROMIUM_FLAGS} using \c {widevine-path}.
+
+ On Windows:
+ \code
+ set QTWEBENGINE_CHROMIUM_FLAGS=--widevine-path="C:/some path/widevinecdm.dll"
+ \endcode
+
+ On Linux:
+ \code
+ export QTWEBENGINE_CHROMIUM_FLAGS=--widevine-path="/some path/libwidevinecdm.so"
+ \endcode
+
+ On macOS:
+ \code
+ export QTWEBENGINE_CHROMIUM_FLAGS=--widevine-path="/some path/libwidevinecdm.dylib"
+ \endcode
+
The video format most commonly used by DRM services, H.264, requires
proprietary audio and video codecs. For more information about enabling the
@@ -190,7 +212,7 @@
This feature can be tested by playing a video in \l{WebEngine Widgets Simple Browser
Example}{Simple Browser} or \l{WebEngine Quick Nano Browser}{Nano Browser}
- from \l{castLabs}, \l{Swank Motion Pictures, Inc.}, or \l{Shaka Player}.
+ from \l{castLabs}, \l{Swank Motion Pictures, Inc.}, or \l{Bitmovin Player}.
Support for this feature was added in Qt 5.7.0.
diff --git a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
index 96b6a0a5b..3bba84b39 100644
--- a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
+++ b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
@@ -64,7 +64,7 @@ RenderWidgetHostViewQtDelegateQuick::RenderWidgetHostViewQtDelegateQuick(RenderW
setFocus(true);
setActiveFocusOnTab(true);
-#if defined(Q_OS_MACOS) && !defined(QT_NO_OPENGL)
+#if defined(Q_OS_MACOS) && QT_CONFIG(opengl)
// Check that the default QSurfaceFormat OpenGL profile is compatible with the global OpenGL
// shared context profile, otherwise this could lead to a nasty crash.
QOpenGLContext *globalSharedContext = QOpenGLContext::globalShareContext();