diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-02-08 17:20:19 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-02-08 17:20:34 +0100 |
commit | 776442f2117c4b2d6dac75ab56b42bd82e2ce6d0 (patch) | |
tree | 8b1730f28cb700e58bf254c440c4167991b94fe3 /src | |
parent | 82f4d13a13b40d9cb7710f6dd4190175a272a394 (diff) | |
parent | 489c9d0f631f79057bb16994b6719395d97f80ab (diff) |
Merge remote-tracking branch 'origin/5.6.0' into 5.6
Change-Id: I98705a1bb82917147f36a89761eedfc755a45bc5
Diffstat (limited to 'src')
-rw-r--r-- | src/core/api/qwebenginecallback.h | 2 | ||||
-rw-r--r-- | src/core/api/qwebenginecallback_p.h | 2 | ||||
-rw-r--r-- | src/core/api/qwebengineurlrequestinfo.cpp | 3 | ||||
-rw-r--r-- | src/core/core.pro | 4 | ||||
-rw-r--r-- | src/webengine/api/qquickwebenginescript.cpp | 68 | ||||
-rw-r--r-- | src/webengine/doc/qtwebengine.qdocconf | 4 | ||||
-rw-r--r-- | src/webengine/doc/src/qtwebengine-platform-notes.qdoc | 10 | ||||
-rw-r--r-- | src/webengine/doc/src/webengineview.qdoc | 2 | ||||
-rw-r--r-- | src/webengine/render_widget_host_view_qt_delegate_quick.cpp | 15 | ||||
-rw-r--r-- | src/webenginewidgets/api/qwebenginehistory.h | 2 | ||||
-rw-r--r-- | src/webenginewidgets/api/qwebenginescript.h | 2 | ||||
-rw-r--r-- | src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc | 9 | ||||
-rw-r--r-- | src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc | 2 | ||||
-rw-r--r-- | src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp | 21 |
14 files changed, 140 insertions, 6 deletions
diff --git a/src/core/api/qwebenginecallback.h b/src/core/api/qwebenginecallback.h index a8758df7d..3bb993757 100644 --- a/src/core/api/qwebenginecallback.h +++ b/src/core/api/qwebenginecallback.h @@ -90,9 +90,11 @@ private: Q_DECLARE_SHARED(QWebEngineCallback<int>) Q_DECLARE_SHARED(QWebEngineCallback<const QByteArray &>) +#if QT_VERSION >= QT_VERSION_CHECK(5,6,0) Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QWebEngineCallback<bool>) Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QWebEngineCallback<const QString &>) Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QWebEngineCallback<const QVariant &>) +#endif QT_END_NAMESPACE diff --git a/src/core/api/qwebenginecallback_p.h b/src/core/api/qwebenginecallback_p.h index 348fed464..f93e863eb 100644 --- a/src/core/api/qwebenginecallback_p.h +++ b/src/core/api/qwebenginecallback_p.h @@ -239,10 +239,12 @@ void CallbackDirectory::CallbackSharedDataPointer<T>::invokeEmpty() parent->invokeEmptyInternal(callback); } +#if QT_VERSION >= QT_VERSION_CHECK(5,6,0) #define CHECK_RELOCATABLE(x) \ Q_STATIC_ASSERT((QTypeInfoQuery<QWebEngineCallback< x > >::isRelocatable)); FOR_EACH_TYPE(CHECK_RELOCATABLE) #undef CHECK_RELOCATABLE +#endif } // namespace QtWebEngineCore diff --git a/src/core/api/qwebengineurlrequestinfo.cpp b/src/core/api/qwebengineurlrequestinfo.cpp index e53d9afb6..f229a9748 100644 --- a/src/core/api/qwebengineurlrequestinfo.cpp +++ b/src/core/api/qwebengineurlrequestinfo.cpp @@ -107,6 +107,9 @@ ASSERT_ENUMS_MATCH(QtWebEngineCore::WebContentsAdapterClient::OtherNavigation, Q it possible to intercept URL requests. This function is executed on the IO thread, and therefore running long tasks here will block networking. + \a info contains the information about the URL request and will track internally + whether its members have been altered. + \sa QWebEngineProfile::setRequestInterceptor */ diff --git a/src/core/core.pro b/src/core/core.pro index 09eee496f..a205d39a0 100644 --- a/src/core/core.pro +++ b/src/core/core.pro @@ -20,7 +20,8 @@ core_api.depends = gyp_run core_module.file = core_module.pro core_module.depends = core_api -SUBDIRS += core_gyp_generator +SUBDIRS += core_headers \ + core_gyp_generator !win32 { # gyp_configure_host.pro and gyp_configure_target.pro are phony pro files that @@ -36,6 +37,5 @@ SUBDIRS += core_gyp_generator } SUBDIRS += gyp_run \ - core_headers \ core_api \ core_module diff --git a/src/webengine/api/qquickwebenginescript.cpp b/src/webengine/api/qquickwebenginescript.cpp index a19ec1534..68ea491b3 100644 --- a/src/webengine/api/qquickwebenginescript.cpp +++ b/src/webengine/api/qquickwebenginescript.cpp @@ -45,6 +45,27 @@ using QtWebEngineCore::UserScript; +/*! + \qmltype WebEngineScript + \instantiates QQuickWebEngineScript + \inqmlmodule QtWebEngine + \since QtWebEngine 1.1 + \brief Enables the programmatic injection of scripts in the JavaScript engine. + + The WebEngineScript type enables the programmatic injection of so called \e {user scripts} in + the JavaScript engine at different points, determined by injectionPoint, during the loading of + web content. + + Scripts can be executed either in the main JavaScript \e world, along with the rest of the + JavaScript coming from the web contents, or in their own isolated world. While the DOM of the + page can be accessed from any world, JavaScript variables of a function defined in one world are + not accessible from a different one. The worldId property provides some predefined IDs for this + purpose. + + Use \l{WebEngineView::userScripts}{WebEngineView.userScripts} to access a list of scripts + attached to the web view. +*/ + QQuickWebEngineScript::QQuickWebEngineScript() : d_ptr(new QQuickWebEngineScriptPrivate) { @@ -78,6 +99,12 @@ QString QQuickWebEngineScript::toString() const return ret; } +/*! + \qmlproperty QString WebEngineScript::name + + The name of the script. Can be useful to retrieve a particular script from + \l{WebEngineView::userScripts}{WebEngineView.userScripts}. +*/ QString QQuickWebEngineScript::name() const { Q_D(const QQuickWebEngineScript); @@ -90,7 +117,7 @@ QString QQuickWebEngineScript::name() const This property holds the remote source location of the user script (if any). Unlike \l sourceCode, this property allows referring to user scripts that - are not already loaded in memory, for instance, when stored on disk. + are not already loaded in memory, for instance, when stored on disk. Setting this property will change the \l sourceCode of the script. @@ -121,20 +148,57 @@ ASSERT_ENUMS_MATCH(QQuickWebEngineScript::Deferred, UserScript::AfterLoad) ASSERT_ENUMS_MATCH(QQuickWebEngineScript::DocumentReady, UserScript::DocumentLoadFinished) ASSERT_ENUMS_MATCH(QQuickWebEngineScript::DocumentCreation, UserScript::DocumentElementCreation) +/*! + \qmlproperty enumeration WebEngineScript::injectionPoint + + The point in the loading process at which the script will be executed. + The default value is \c Deferred. + + \value DocumentCreation + The script will be executed as soon as the document is created. This is not suitable for + any DOM operation. + \value DocumentReady + The script will run as soon as the DOM is ready. This is equivalent to the + \c DOMContentLoaded event firing in JavaScript. + \value Deferred + The script will run when the page load finishes, or 500 ms after the document is ready, + whichever comes first. +*/ QQuickWebEngineScript::InjectionPoint QQuickWebEngineScript::injectionPoint() const { Q_D(const QQuickWebEngineScript); return static_cast<QQuickWebEngineScript::InjectionPoint>(d->coreScript.injectionPoint()); } - +/*! + \qmlproperty enumeration WebEngineScript::worldId + + The world ID defining which isolated world the script is executed in. + + \value MainWorld + The world used by the page's web contents. It can be useful in order to expose custom + functionality to web contents in certain scenarios. + \value ApplicationWorld + The default isolated world used for application level functionality implemented in + JavaScript. + \value UserWorld + The first isolated world to be used by scripts set by users if the application is not + making use of more worlds. As a rule of thumb, if that functionality is exposed to the + application users, each individual script should probably get its own isolated world. +*/ QQuickWebEngineScript::ScriptWorldId QQuickWebEngineScript::worldId() const { Q_D(const QQuickWebEngineScript); return static_cast<QQuickWebEngineScript::ScriptWorldId>(d->coreScript.worldId()); } +/*! + \qmlproperty int WebEngineScript::runOnSubframes + Set this property to \c true if the script is executed on every frame in the page, or \c false + if it is only ran for the main frame. + The default value is \c{false}. + */ bool QQuickWebEngineScript::runOnSubframes() const { Q_D(const QQuickWebEngineScript); diff --git a/src/webengine/doc/qtwebengine.qdocconf b/src/webengine/doc/qtwebengine.qdocconf index 02f9a9ffd..2fbdef93e 100644 --- a/src/webengine/doc/qtwebengine.qdocconf +++ b/src/webengine/doc/qtwebengine.qdocconf @@ -35,6 +35,9 @@ qhp.QtWebEngine.subprojects.examples.indexTitle = Qt WebEngine Examples qhp.QtWebEngine.subprojects.examples.selectors = doc:example qhp.QtWebEngine.subprojects.examples.sortPages = true +manifestmeta.highlighted.names += "QtWebEngine/WebEngine Markdown Editor Example" \ + "QtWebEngine/WebEngine Quick Nano Browser" + tagfile = ../../../doc/qtwebengine/qtwebengine.tags depends += qtcore \ @@ -45,6 +48,7 @@ depends += qtcore \ qtquickcontrols \ qtdoc \ qtwebchannel \ + qtwebview \ qtwidgets headerdirs += .. \ diff --git a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc index 3e30e9606..f177c9598 100644 --- a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc +++ b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc @@ -116,4 +116,14 @@ be configured for use with several codecs, which rises licensing issues during distribution with the codec libraries. For some codecs, open source implementations, such as \l {OpenH264}, are available. + + \section1 Default QSurfaceFormat OpenGL Profile Support + + If a new default QSurfaceFormat with a modified OpenGL profile has to be set, it should be set + before the application instance is declared, to make sure that all created OpenGL contexts use + the same OpenGL profile. + + On OS X, if the default QSurfaceFormat is set after the application instance, the application + will exit with qFatal(), and print a message that the default QSurfaceFormat should be set + before the application instance. */ diff --git a/src/webengine/doc/src/webengineview.qdoc b/src/webengine/doc/src/webengineview.qdoc index 1d71a9cd9..0ce2f77be 100644 --- a/src/webengine/doc/src/webengineview.qdoc +++ b/src/webengine/doc/src/webengineview.qdoc @@ -227,6 +227,8 @@ \since QtWebEngine 1.1 List of script objects attached to the view. + + \sa WebEngineScript */ /*! 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 508420cf8..b667bbc5c 100644 --- a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp +++ b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp @@ -41,6 +41,7 @@ #include <QGuiApplication> #include <QQuickPaintedItem> #include <QQuickWindow> +#include <QSurfaceFormat> #include <QVariant> #include <QWindow> #include <private/qquickwindow_p.h> @@ -60,6 +61,20 @@ RenderWidgetHostViewQtDelegateQuick::RenderWidgetHostViewQtDelegateQuick(RenderW return; setFocus(true); setActiveFocusOnTab(true); + +#ifdef Q_OS_OSX + // Check that the default QSurfaceFormat OpenGL profile matches the global OpenGL shared + // context profile, otherwise this could lead to a nasty crash. + QOpenGLContext *globalSharedContext = QOpenGLContext::globalShareContext(); + if (globalSharedContext) { + QSurfaceFormat sharedFormat = globalSharedContext->format(); + QSurfaceFormat defaultFormat = QSurfaceFormat::defaultFormat(); + if (defaultFormat.profile() != sharedFormat.profile()) { + qFatal("QWebEngine: Default QSurfaceFormat OpenGL profile does not match global shared context OpenGL profile. Please make sure you set a new QSurfaceFormat before the QtGui application instance is created."); + } + } +#endif + } void RenderWidgetHostViewQtDelegateQuick::initAsChild(WebContentsAdapterClient* container) diff --git a/src/webenginewidgets/api/qwebenginehistory.h b/src/webenginewidgets/api/qwebenginehistory.h index 3dcea9469..81dd3fb34 100644 --- a/src/webenginewidgets/api/qwebenginehistory.h +++ b/src/webenginewidgets/api/qwebenginehistory.h @@ -76,7 +76,9 @@ private: friend class QWebEngineHistoryPrivate; }; +#if QT_VERSION >= QT_VERSION_CHECK(5,6,0) Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QWebEngineHistoryItem) +#endif class QWebEngineHistoryPrivate; class QWEBENGINEWIDGETS_EXPORT QWebEngineHistory { diff --git a/src/webenginewidgets/api/qwebenginescript.h b/src/webenginewidgets/api/qwebenginescript.h index 29126b110..a3cc66179 100644 --- a/src/webenginewidgets/api/qwebenginescript.h +++ b/src/webenginewidgets/api/qwebenginescript.h @@ -99,7 +99,9 @@ private: QSharedDataPointer<QtWebEngineCore::UserScript> d; }; +#if QT_VERSION >= QT_VERSION_CHECK(5,6,0) Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QWebEngineScript) +#endif #ifndef QT_NO_DEBUG_STREAM QWEBENGINEWIDGETS_EXPORT QDebug operator<<(QDebug, const QWebEngineScript &); diff --git a/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc index 3dc23e037..df85c39fb 100644 --- a/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc +++ b/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc @@ -99,7 +99,14 @@ \value LocalStorageEnabled Enables support for the HTML 5 local storage feature. Enabled by default. \value LocalContentCanAccessRemoteUrls - Allows locally loaded documents to access remote URLs. Disabled by default. + Allows locally loaded documents to ignore cross-origin rules so that they can access + remote resources that would normally be blocked, because all remote resources are + considered cross-origin for a local file. Remote access that would not be blocked by + cross-origin rules is still possible when this setting is disabled (default). + Note that disabling this setting does not stop XMLHttpRequests or media elements in + local files from accessing remote content. Basically, it only stops some HTML + subresources, such as scripts, and therefore disabling this setting is not a safety + mechanism. \value XSSAuditingEnabled Monitors load requests for cross-site scripting attempts. Suspicious scripts are blocked and reported in the inspector's JavaScript console. Disabled by default, because it diff --git a/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc index 397b9f51b..1ec831ac2 100644 --- a/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc +++ b/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc @@ -76,7 +76,7 @@ new windows, such as pop-up windows, you can subclass QWebEngineView and reimplement the createWindow() function. - \sa {WebEngine Demo Browser Example}, {WebEngine Content Manipulation Example}, {Markdown Editor Example} + \sa {WebEngine Demo Browser Example}, {WebEngine Content Manipulation Example}, {WebEngine Markdown Editor Example} */ 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 9871ecfb1..7eca835d5 100644 --- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp +++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp @@ -64,9 +64,30 @@ RenderWidgetHostViewQtDelegateWidget::RenderWidgetHostViewQtDelegateWidget(Rende setFocusPolicy(Qt::StrongFocus); #if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)) + QSurfaceFormat format; format.setDepthBufferSize(24); format.setStencilBufferSize(8); + + QOpenGLContext *globalSharedContext = QOpenGLContext::globalShareContext(); + if (globalSharedContext) { + QSurfaceFormat sharedFormat = globalSharedContext->format(); + +#ifdef Q_OS_OSX + // Check that the default QSurfaceFormat OpenGL profile matches the global OpenGL shared + // context profile, otherwise this could lead to a nasty crash. + QSurfaceFormat defaultFormat = QSurfaceFormat::defaultFormat(); + if (defaultFormat.profile() != sharedFormat.profile()) { + qFatal("QWebEngine: Default QSurfaceFormat OpenGL profile does not match global shared context OpenGL profile. Please make sure you set a new QSurfaceFormat before the QtGui application instance is created."); + } +#endif + + // Make sure the OpenGL profile of the QOpenGLWidget matches the shared context profile. + format.setMajorVersion(sharedFormat.majorVersion()); + format.setMinorVersion(sharedFormat.minorVersion()); + format.setProfile(sharedFormat.profile()); + } + setFormat(format); #endif |