diff options
author | Michael Bruning <michael.bruning@theqtcompany.com> | 2016-05-23 15:02:12 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-05-23 16:51:11 +0200 |
commit | 59d211d8bbb42242ca355a7451b8a66ee5f30dc6 (patch) | |
tree | d51ef03184d1b9ef58fde30835a6c014c75b2c6d | |
parent | 7933be051938a2815ed44563d26126e5d4a40b06 (diff) | |
parent | ad8bc45732eeb2efa6e885d564c10761e7154889 (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7.0
Conflicts:
src/3rdparty
src/core/browser_context_adapter.cpp
src/core/web_contents_adapter.cpp
src/webengine/doc/src/qtwebengine-platform-notes.qdoc
tests/auto/widgets/qwebenginepage/BLACKLIST
Change-Id: I768fc954a9a2147fc3669961286163a0a824def3
33 files changed, 411 insertions, 116 deletions
diff --git a/dist/changes-5.6.1 b/dist/changes-5.6.1 new file mode 100644 index 000000000..5a568bda9 --- /dev/null +++ b/dist/changes-5.6.1 @@ -0,0 +1,65 @@ +Qt 5.6.1 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.6.0. + +Qt 5.6 introduces many new features and improvements as well as bugfixes +over the 5.5.x series. For more details, refer to the online documentation +included in this distribution. The documentation is also available online: + + http://doc.qt.io/qt-5/index.html + +The Qt version 5.6 series is binary compatible with the 5.5.x series. +Applications compiled for 5.5 will continue to run with 5.6. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + + https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* General * +**************************************************************************** + + - Chromium Snapshot: + * Security fixes from Chromium up to version 50.0.2661.94 + * [QTBUG-52602] Fixed devtools so it works with newer Chrome releases. + * [QTBUG-52085, QTBUG-53108] qrc urls can now load local files. + + - QtWebEngineCore: + * [QTBUG-52124] Fixed crashes due to multithreaded use of qputenv. + * [QTBUG-52216] Fixed access of labels of MediaStream tracks. + * [QTBUG-52715] Fixed copying images to clipboard. + * [QTBUG-51789] Fixed crashes when instantiating QCoreApplication. + * [QTBUG-52121] Ensured cookies are flushed to disk on exit. + * Fixed numerous race-conditions when changing profile settings and using + custom URL scheme handlers. + + - WebEnginePage: + * [QTBUG-48995] Stopped triggering extra urlChanged signals. + * [QTBUG-51319] Accepted certificate errors are now remembered correctly. + * [QTBUG-51851, QTBUG-51969] Fixed zoom behavior. + * [QTBUG-53033] Reset the selected text of a page when setHtml is called. + * Fixed memory leak in standardContextMenu() + + +**************************************************************************** +* Platform Specific Changes * +**************************************************************************** + + - Linux: + * NSS is now only used for certificate handling. BoringSSL is used + for SSL encryption like on OS X and Windows. + * [QTBUG-48298] Fixed compilation against old Linux kernel headers. + + - Windows: + * [QTBUG-51920] Fixed building on Japanese Windows. + * [QTBUG-50252] Fixed doubled characters when using IME. + * [QTBUG-51971] Fixed CommandLine initialization. + * [QTBUG-51847] Fixed compilation issue with moc. + * [QTBUG-46720] Added support for linking to QtWebEngine from a plugin. + + - OS X: + * [QTBUG-51939] Fixed QtWebEngineProcess not being found after + macdeployqt is used. diff --git a/examples/webenginewidgets/cookiebrowser/cookiebrowser.pro b/examples/webenginewidgets/cookiebrowser/cookiebrowser.pro index 66ea064ef..6b249cf59 100644 --- a/examples/webenginewidgets/cookiebrowser/cookiebrowser.pro +++ b/examples/webenginewidgets/cookiebrowser/cookiebrowser.pro @@ -17,3 +17,6 @@ FORMS += \ RESOURCES += \ cookiebrowser.qrc + +target.path = $$[QT_INSTALL_EXAMPLES]/webenginewidgets/cookiebrowser +INSTALLS += target diff --git a/examples/webenginewidgets/demobrowser/demobrowser.pro b/examples/webenginewidgets/demobrowser/demobrowser.pro index 87f362f90..aef7b9eac 100644 --- a/examples/webenginewidgets/demobrowser/demobrowser.pro +++ b/examples/webenginewidgets/demobrowser/demobrowser.pro @@ -86,7 +86,9 @@ mac { TARGET = Demobrowser } -EXAMPLE_FILES = Info_mac.plist demobrowser.icns demobrowser.ico demobrowser.rc +EXAMPLE_FILES = \ + Info_mac.plist demobrowser.icns demobrowser.ico demobrowser.rc \ + cookiejar.h cookiejar.cpp # FIXME: these are currently unused. # install target.path = $$[QT_INSTALL_EXAMPLES]/webenginewidgets/demobrowser diff --git a/examples/webenginewidgets/simplebrowser/main.cpp b/examples/webenginewidgets/simplebrowser/main.cpp index 761403fb5..750e7ae43 100644 --- a/examples/webenginewidgets/simplebrowser/main.cpp +++ b/examples/webenginewidgets/simplebrowser/main.cpp @@ -42,6 +42,18 @@ #include "browserwindow.h" #include <QApplication> +QString getCommandLineUrlArgument() +{ + const QStringList args = QCoreApplication::arguments(); + if (args.count() > 1) { + const QString lastArg = args.last(); + const bool isValidUrl = QUrl::fromUserInput(lastArg).isValid(); + if (isValidUrl) + return lastArg; + } + return QString(); +} + int main(int argc, char **argv) { QApplication app(argc, argv); @@ -50,9 +62,9 @@ int main(int argc, char **argv) BrowserWindow *window = new BrowserWindow(); Browser::instance().addWindow(window); - QStringList args = QCoreApplication::arguments(); - if (args.count() > 1) - window->loadPage(args.last()); + const QString url = getCommandLineUrlArgument(); + if (!url.isEmpty()) + window->loadPage(url); else window->loadHomePage(); diff --git a/src/3rdparty b/src/3rdparty -Subproject 06cde1e95d92936e5cf5f1dbd6c8aac8862eb0b +Subproject fac200c0c7bcc3f97f3d3c87fb3cd0433d566ee diff --git a/src/core/api/qwebenginecookiestore.h b/src/core/api/qwebenginecookiestore.h index 3b7b5e89b..5001ba3a1 100644 --- a/src/core/api/qwebenginecookiestore.h +++ b/src/core/api/qwebenginecookiestore.h @@ -73,7 +73,7 @@ Q_SIGNALS: void cookieRemoved(const QNetworkCookie &cookie); private: - explicit QWebEngineCookieStore(QObject *parent = 0); + explicit QWebEngineCookieStore(QObject *parent = Q_NULLPTR); friend class QtWebEngineCore::BrowserContextAdapter; friend class QtWebEngineCore::CookieMonsterDelegateQt; Q_DISABLE_COPY(QWebEngineCookieStore) diff --git a/src/core/api/qwebengineurlrequestinterceptor.h b/src/core/api/qwebengineurlrequestinterceptor.h index fb5861c7d..6e0f93e49 100644 --- a/src/core/api/qwebengineurlrequestinterceptor.h +++ b/src/core/api/qwebengineurlrequestinterceptor.h @@ -55,7 +55,7 @@ class QWEBENGINE_EXPORT QWebEngineUrlRequestInterceptor : public QObject Q_OBJECT Q_DISABLE_COPY(QWebEngineUrlRequestInterceptor) public: - explicit QWebEngineUrlRequestInterceptor(QObject *p = 0) + explicit QWebEngineUrlRequestInterceptor(QObject *p = Q_NULLPTR) : QObject (p) { } diff --git a/src/core/api/qwebengineurlschemehandler.h b/src/core/api/qwebengineurlschemehandler.h index 5075af6d5..757c461f4 100644 --- a/src/core/api/qwebengineurlschemehandler.h +++ b/src/core/api/qwebengineurlschemehandler.h @@ -55,7 +55,7 @@ class QWebEngineUrlRequestJob; class QWEBENGINE_EXPORT QWebEngineUrlSchemeHandler : public QObject { Q_OBJECT public: - QWebEngineUrlSchemeHandler(QObject *parent = 0); + QWebEngineUrlSchemeHandler(QObject *parent = Q_NULLPTR); ~QWebEngineUrlSchemeHandler(); virtual void requestStarted(QWebEngineUrlRequestJob*) = 0; diff --git a/src/core/browser_context_adapter.cpp b/src/core/browser_context_adapter.cpp index ba9d671ae..e3b757587 100644 --- a/src/core/browser_context_adapter.cpp +++ b/src/core/browser_context_adapter.cpp @@ -104,7 +104,8 @@ void BrowserContextAdapter::setStorageName(const QString &storageName) m_name = storageName; if (m_browserContext->url_request_getter_.get()) m_browserContext->url_request_getter_->updateStorageSettings(); - m_visitedLinksManager.reset(); + if (m_visitedLinksManager) + resetVisitedLinksManager(); } void BrowserContextAdapter::setOffTheRecord(bool offTheRecord) @@ -114,7 +115,8 @@ void BrowserContextAdapter::setOffTheRecord(bool offTheRecord) m_offTheRecord = offTheRecord; if (m_browserContext->url_request_getter_.get()) m_browserContext->url_request_getter_->updateStorageSettings(); - m_visitedLinksManager.reset(); + if (m_visitedLinksManager) + resetVisitedLinksManager(); } BrowserContextQt *BrowserContextAdapter::browserContext() @@ -125,7 +127,7 @@ BrowserContextQt *BrowserContextAdapter::browserContext() WebEngineVisitedLinksManager *BrowserContextAdapter::visitedLinksManager() { if (!m_visitedLinksManager) - m_visitedLinksManager.reset(new WebEngineVisitedLinksManager(this)); + resetVisitedLinksManager(); return m_visitedLinksManager.data(); } @@ -198,7 +200,8 @@ void BrowserContextAdapter::setDataPath(const QString &path) m_dataPath = path; if (m_browserContext->url_request_getter_.get()) m_browserContext->url_request_getter_->updateStorageSettings(); - m_visitedLinksManager.reset(); + if (m_visitedLinksManager) + resetVisitedLinksManager(); } QString BrowserContextAdapter::cachePath() const @@ -339,7 +342,8 @@ void BrowserContextAdapter::setVisitedLinksPolicy(BrowserContextAdapter::Visited if (m_visitedLinksPolicy == visitedLinksPolicy) return; m_visitedLinksPolicy = visitedLinksPolicy; - m_visitedLinksManager.reset(); + if (m_visitedLinksManager) + resetVisitedLinksManager(); } int BrowserContextAdapter::httpCacheMaxSize() const @@ -500,4 +504,9 @@ bool BrowserContextAdapter::isSpellCheckEnabled() const #endif } +void BrowserContextAdapter::resetVisitedLinksManager() +{ + m_visitedLinksManager.reset(new WebEngineVisitedLinksManager(this)); +} + } // namespace QtWebEngineCore diff --git a/src/core/browser_context_adapter.h b/src/core/browser_context_adapter.h index c3c3f153d..94bc5fcde 100644 --- a/src/core/browser_context_adapter.h +++ b/src/core/browser_context_adapter.h @@ -175,6 +175,7 @@ public: private: void updateCustomUrlSchemeHandlers(); + void resetVisitedLinksManager(); QString m_name; bool m_offTheRecord; diff --git a/src/core/clipboard_qt.cpp b/src/core/clipboard_qt.cpp index cd57995ea..bd62f4872 100644 --- a/src/core/clipboard_qt.cpp +++ b/src/core/clipboard_qt.cpp @@ -285,6 +285,8 @@ void ClipboardQt::ReadAvailableTypes(ui::ClipboardType type, std::vector<base::s types->clear(); const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData(type == ui::CLIPBOARD_TYPE_COPY_PASTE ? QClipboard::Clipboard : QClipboard::Selection); + if (mimeData->hasImage()) + types->push_back(toString16(QStringLiteral("image/png"))); Q_FOREACH (const QString &mimeType, mimeData->formats()) types->push_back(toString16(mimeType)); *contains_filenames = false; @@ -328,8 +330,6 @@ void ClipboardQt::ReadRTF(ui::ClipboardType type, std::string* result) const SkBitmap ClipboardQt::ReadImage(ui::ClipboardType type) const { - // FIXME: Untested, pasting image data seems to only be supported through - // FileReader.readAsDataURL in JavaScript and this isn't working down the pipe for some reason. const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData(type == ui::CLIPBOARD_TYPE_COPY_PASTE ? QClipboard::Clipboard : QClipboard::Selection); QImage image = qvariant_cast<QImage>(mimeData->imageData()); diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp index 6094be847..5d1780cbe 100644 --- a/src/core/renderer/content_renderer_client_qt.cpp +++ b/src/core/renderer/content_renderer_client_qt.cpp @@ -93,8 +93,6 @@ public: blink::WebString qrcScheme(base::ASCIIToUTF16(kQrcSchemeQt)); // mark qrc as a secure scheme (avoids deprecation warnings) blink::WebSecurityPolicy::registerURLSchemeAsSecure(qrcScheme); - // mark qrc as a local scheme (allows local access to qrc) - blink::WebSecurityPolicy::registerURLSchemeAsLocal(qrcScheme); } }; diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 82d21696c..5fe7c8dc9 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -70,6 +70,7 @@ #include "content/public/browser/navigation_entry.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/favicon_status.h" +#include "content/public/common/content_constants.h" #include <content/public/common/drop_data.h> #include "content/public/common/page_state.h" #include "content/public/common/page_zoom.h" @@ -426,6 +427,12 @@ void WebContentsAdapter::initialize(WebContentsAdapterClient *adapterClient) PrintViewManagerQt::CreateForWebContents(webContents()); #endif // defined(ENABLE_BASIC_PRINTING) + // Create an instance of WebEngineVisitedLinksManager to catch the first + // content::NOTIFICATION_RENDERER_PROCESS_CREATED event. This event will + // force to initialize visited links in VisitedLinkSlave. + // It must be done before creating a RenderView. + d->browserContextAdapter->visitedLinksManager(); + // Create a RenderView with the initial empty document content::RenderViewHost *rvh = d->webContents->GetRenderViewHost(); Q_ASSERT(rvh); @@ -511,7 +518,12 @@ void WebContentsAdapter::setContent(const QByteArray &data, const QString &mimeT urlString.append(","); urlString.append(encodedData.constData(), encodedData.length()); - content::NavigationController::LoadURLParams params((GURL(urlString))); + GURL dataUrlToLoad(urlString); + if (dataUrlToLoad.spec().size() > content::kMaxURLChars) { + d->adapterClient->loadFinished(false, baseUrl, false, net::ERR_ABORTED); + return; + } + content::NavigationController::LoadURLParams params((dataUrlToLoad)); params.load_type = content::NavigationController::LOAD_TYPE_DATA; params.base_url_for_data_url = toGurl(baseUrl); params.virtual_url_for_data_url = baseUrl.isEmpty() ? GURL(url::kAboutBlankURL) : toGurl(baseUrl); diff --git a/src/webengine/api/qquickwebengineprofile.h b/src/webengine/api/qquickwebengineprofile.h index 4f9684a86..9240132b2 100644 --- a/src/webengine/api/qquickwebengineprofile.h +++ b/src/webengine/api/qquickwebengineprofile.h @@ -150,7 +150,7 @@ private Q_SLOTS: private: Q_DECLARE_PRIVATE(QQuickWebEngineProfile) - QQuickWebEngineProfile(QQuickWebEngineProfilePrivate *, QObject *parent = 0); + QQuickWebEngineProfile(QQuickWebEngineProfilePrivate *, QObject *parent = Q_NULLPTR); QQuickWebEngineSettings *settings() const; friend class QQuickWebEngineSettings; diff --git a/src/webengine/api/qquickwebenginesettings.cpp b/src/webengine/api/qquickwebenginesettings.cpp index 9096dd604..3fea83166 100644 --- a/src/webengine/api/qquickwebenginesettings.cpp +++ b/src/webengine/api/qquickwebenginesettings.cpp @@ -217,7 +217,7 @@ bool QQuickWebEngineSettings::errorPageEnabled() const Disabled by default. - \sa {Pepper Plugin API Support} + \sa {Pepper Plugin API} */ bool QQuickWebEngineSettings::pluginsEnabled() const { diff --git a/src/webengine/doc/src/qtwebengine-features.qdoc b/src/webengine/doc/src/qtwebengine-features.qdoc new file mode 100644 index 000000000..ad053c4a9 --- /dev/null +++ b/src/webengine/doc/src/qtwebengine-features.qdoc @@ -0,0 +1,187 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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-features.html + \title Qt WebEngine Features + + \brief Summarizes Qt WebEngine features. + + Qt WebEngine supports the following Chromium features: + + \list + \li \l{Audio and Video Codecs} + \li \l{Chromium DevTools} + \li \l{Fullscreen} + \li \l{HTML5 Geolocation} + \li \l{Pepper Plugin API} + \li \l{WebRTC} + \endlist + + \section1 Audio and Video Codecs + + Qt WebEngine supports the MPEG-4 Part 14 (MP4) file format only if the + required proprietary audio and video codecs, such as H.264 and MPEG layer-3 + (MP3), have been enabled. Proprietary codecs can be enabled by passing the + following option to qmake when building Qt WebEngine: + + \code + qmake WEBENGINE_CONFIG+=use_proprietary_codecs + \endcode + + \warning When distributing proprietary codec libraries, you must acquire + licenses for them. + + \l FFmpeg is a cross-platform solution to record, convert, and stream audio + and video. It can 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 Chromium DevTools + + The Chromium DevTools provide the ability to inspect and debug layout and + performance issues of any web content. + + This feature can be tested by launching a Qt WebEngine application with the + command line option \c {--remote-debugging-port=[your-port]} or by setting + the environment variable \c QTWEBENGINE_REMOTE_DEBUGGING, and then using a + Chromium based browser (such as \l{WebEngine Demo Browser Example} + {Demo Browser} or \l{WebEngine Quick Nano Browser}{Nano Browser}) to connect + to \c {http://localhost:[your-port]}. + + For more information, see \l {Qt WebEngine Debugging and Profiling}. + + \section1 Fullscreen + + Qt WebEngine supports viewing web content in fullscreen mode. For more + information, see \l{WebEngineSettings::fullscreenSupportEnabled} + {WebEngineSettings.fullscreenSupportEnabled}, + \l{WebEngineView::fullScreenRequested}{WebEngineView.fullScreenRequested}, + QWebEngineSettings::FullScreenSupportEnabled, and + QWebEnginePage::fullScreenRequested. + + This feature can be tested by playing a video from YouTube in \l{WebEngine + Demo Browser Example}{Demo Browser} or \l{WebEngine Quick Nano Browser} + {Nano Browser}, and clicking the full screen icon to go into fullscreen + mode. + + Support for this feature was added in Qt 5.6.0. + + \section1 HTML5 Geolocation + + Qt WebEngine supports JavaScript Geolocation API with \l {Qt Location} as a + backend. The application has to explicitly allow the feature by using + QWebEnginePage::Geolocation or \l{WebEngineView::Feature} + {WebEngineView.Feature}. + + This feature can be tested if Qt Location has been built before Qt WebEngine. + The \c http://html5demos.com/geo page can be opened in the \l{WebEngine Demo + Browser Example}{Demo Browser} and allowed to find the current position of + the user. Note that on Windows an external GPS receiver must be connected to + the application. For more information, see \l{Qt Positioning}. + + \section1 Pepper Plugin API + + Qt WebEngine supports loading Pepper Plugin API (PPAPI) plugins if + WebEngineSettings::pluginsEnabled or QWebEngineSettings::PluginsEnabled + is set. + + Except for the Adobe Flash Player plugin, the plugins must be loaded + manually using the Chromium command line syntax with the + \c --register-pepper-plugins argument. The argument value is a list of + entries, separated by commas, that contain the file path and one or several + MIME types, separated by semicolons: + + \code + <file-path-plugin1>;<mime-type-plugin1>,<file-path-plugin2>;<mime-type1-plugin2>;<mime-type2-plugin2> + \endcode + + For example: + + \code + --register-pepper-plugins="libppapi_example.so;application/x-ppapi-example" + \endcode + + The MIME type is important because it determines which embeds the plugin is + used for. + + Support for this feature was added in Qt 5.6.0. + + \section2 Pepper Flash Player Plugin Support + + The Pepper Flash player plugin can be loaded automatically if it is + installed in one of the following locations, depending on the platform: + + \list + \li Windows + \code + C:\Windows\SysWOW64\Macromed\Flash\pepflashplayer*.dll + C:\Windows\System32\Macromed\Flash\pepflashplayer*.dll + \endcode + \li OS X + \code + /Library/Internet Plug-Ins/PepperFlashPlayer/PepperFlashPlayer.plugin + \endcode + \li Linux + \code + /usr/lib/pepperflashplugin-nonfree/libpepflashplayer.so + /usr/lib/PepperFlash/libpepflashplayer.so + /usr/lib64/chromium/PepperFlash/libpepflashplayer.so + \endcode + \endlist + + You can also load the Pepper Flash player from a specific location by using + command line arguments: + + \code + --ppapi-flash-path=./libpepflashplayer.so + \endcode + + By default, the Flash version is set to \c{11.2.999.999}. You can use the + \c{ppapi-flash-version=} argument to set another Flash version in the + format \c{major.minor.build.revision}: + + \code + --ppapi-flash-version=16.0.0.235 + \endcode + + This feature can be tested in \l{WebEngine Demo Browser Example}{Demo Browser} + or \l{WebEngine Quick Nano Browser}{Nano Browser} if the Adobe Flash PPAPI + plugin is installed and plugins are enabled in the browser. To test the + feature, the \c https://helpx.adobe.com/flash-player.html page can be opened + in the browser. + + \section1 WebRTC + + WebRTC provides browsers with Real-Time Communications (RTC) capabilities + via simple APIs. For more information, see \l{WebEngineView::Feature} + {WebEngineView.Feature} and QWebEnginePage::Feature. + + This feature can be tested by setting up a webcam or microphone and then + opening \c https://test.webrtc.org/ in \l{WebEngine Widgets Simple Browser + Example}{Simple Browser} or \l{WebEngine Quick Nano Browser}{Nano Browser}. +*/ diff --git a/src/webengine/doc/src/qtwebengine-index.qdoc b/src/webengine/doc/src/qtwebengine-index.qdoc index 809e10c72..a104f4066 100644 --- a/src/webengine/doc/src/qtwebengine-index.qdoc +++ b/src/webengine/doc/src/qtwebengine-index.qdoc @@ -46,6 +46,7 @@ \list \li \l{Qt WebEngine Overview} + \li \l{Qt WebEngine Features} \li \l{Qt WebEngine Platform Notes} \li \l{Qt WebEngine Debugging and Profiling} \li \l{Porting from Qt WebKit to Qt WebEngine} diff --git a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc index 4bb449016..edb9c8cdb 100644 --- a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc +++ b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc @@ -118,84 +118,6 @@ \note Qt WebEngine cannot be built for the 32-bit mode of OS X (using the \c macx-clang-32 \c mkspec). - \section1 Pepper Plugin API Support - - Qt WebEngine supports loading Pepper Plugin API (PPAPI) plugins if - WebEngineSettings::pluginsEnabled or QWebEngineSettings::PluginsEnabled - is set. - - Except for the Adobe Flash Player plugin, the plugins must be loaded manually using the - Chromium command line syntax with the \c --register-pepper-plugins argument. - The argument value is a list of entries, separated by commas, that contain the file path and - one or several MIME types, separated by semicolons: - - \code - <file-path-plugin1>;<mime-type-plugin1>,<file-path-plugin2>;<mime-type1-plugin2>;<mime-type2-plugin2> - \endcode - - For example: - - \code - --register-pepper-plugins="libppapi_example.so;application/x-ppapi-example" - \endcode - - The MIME type is important because it determines which embeds the plugin is used for. - - \section2 Pepper Flash Player Plugin Support - - The Pepper Flash player plugin can be loaded automatically if it is installed in one of the - following locations, depending on the platform: - - \list - \li Windows - \code - C:\Windows\SysWOW64\Macromed\Flash\pepflashplayer*.dll - C:\Windows\System32\Macromed\Flash\pepflashplayer*.dll - \endcode - \li OS X - \code - /Library/Internet Plug-Ins/PepperFlashPlayer/PepperFlashPlayer.plugin - \endcode - \li Linux - \code - /usr/lib/pepperflashplugin-nonfree/libpepflashplayer.so - /usr/lib/PepperFlash/libpepflashplayer.so - /usr/lib64/chromium/PepperFlash/libpepflashplayer.so - \endcode - \endlist - - You can also load the Pepper Flash player from a specific location by using command line - arguments: - - \code - --ppapi-flash-path=./libpepflashplayer.so - \endcode - - By default, the Flash version is set to \c{11.2.999.999}. You can use the - \c{ppapi-flash-version=} argument to set another Flash version in the - in the format \c{major.minor.build.revision}: - - \code - --ppapi-flash-version=16.0.0.235 - \endcode - - \section1 Audio and Video Codec Support - - Qt WebEngine supports the MPEG-4 Part 14 (MP4) file format only if the required proprietary - audio and video codecs, such as H.264 and MPEG layer-3 (MP3), have been enabled. Proprietary - codecs can be enabled by passing the following option to qmake: - - \code - qmake WEBENGINE_CONFIG+=use_proprietary_codecs - \endcode - - \warning When distributing proprietary codec libraries, you must acquire licenses for them. - - \l FFmpeg is a cross-platform solution to record, convert, and stream audio and video. It can - 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 Mac App Store Compatibility By default, Qt WebEngine uses private OS X API, which might cause an application to be diff --git a/src/webengine/doc/src/webengineview.qdoc b/src/webengine/doc/src/webengineview.qdoc index 444f0f398..a4630484e 100644 --- a/src/webengine/doc/src/webengineview.qdoc +++ b/src/webengine/doc/src/webengineview.qdoc @@ -47,8 +47,11 @@ \section2 Loading Web Pages An application can load pages into the WebEngineView, using either the \l url property or the - \l loadHtml method and navigate within the view's session history. The history is represented - by a WebEngineHistory data model that is held by the \l navigationHistory property. + \l loadHtml method and navigate within the view's session history. The GET + method is always used to load URLs. + + The history is represented by a WebEngineHistory data model that is held by + the \l navigationHistory property. The following sample QML application loads a web page using the \c url property: diff --git a/src/webenginewidgets/api/qwebenginecertificateerror.cpp b/src/webenginewidgets/api/qwebenginecertificateerror.cpp index 7d0c79de1..d6bffdac6 100644 --- a/src/webenginewidgets/api/qwebenginecertificateerror.cpp +++ b/src/webenginewidgets/api/qwebenginecertificateerror.cpp @@ -85,6 +85,10 @@ QWebEngineCertificateError::~QWebEngineCertificateError() This enum describes the type of certificate error encountered. + The values of this enum type match the SSL errors Chromium provides. + QSslError::SslError values are not used directly, because the Qt error + categories cannot be mapped to the Chromium error categories. + \value SslPinnedKeyNotInCertificateChain The certificate did not match the built-in public keys pinned for the host name. \value CertificateCommonNameInvalid The certificate's common name did not match the host name. diff --git a/src/webenginewidgets/api/qwebenginedownloaditem.h b/src/webenginewidgets/api/qwebenginedownloaditem.h index 390a1a598..80b5c06c5 100644 --- a/src/webenginewidgets/api/qwebenginedownloaditem.h +++ b/src/webenginewidgets/api/qwebenginedownloaditem.h @@ -99,7 +99,7 @@ private: friend class QWebEngineProfilePrivate; - QWebEngineDownloadItem(QWebEngineDownloadItemPrivate*, QObject *parent = 0); + QWebEngineDownloadItem(QWebEngineDownloadItemPrivate*, QObject *parent = Q_NULLPTR); QScopedPointer<QWebEngineDownloadItemPrivate> d_ptr; }; diff --git a/src/webenginewidgets/api/qwebenginepage.h b/src/webenginewidgets/api/qwebenginepage.h index 0c6450d20..2ac8e0f3e 100644 --- a/src/webenginewidgets/api/qwebenginepage.h +++ b/src/webenginewidgets/api/qwebenginepage.h @@ -188,8 +188,8 @@ public: KilledTerminationStatus }; - explicit QWebEnginePage(QObject *parent = 0); - QWebEnginePage(QWebEngineProfile *profile, QObject *parent = 0); + explicit QWebEnginePage(QObject *parent = Q_NULLPTR); + QWebEnginePage(QWebEngineProfile *profile, QObject *parent = Q_NULLPTR); ~QWebEnginePage(); QWebEngineHistory *history() const; @@ -208,10 +208,10 @@ public: virtual bool event(QEvent*); #ifdef Q_QDOC - void findText(const QString &subString, FindFlags options = 0); + void findText(const QString &subString, FindFlags options = FindFlags()); void findText(const QString &subString, FindFlags options, FunctorOrLambda resultCallback); #else - void findText(const QString &subString, FindFlags options = 0, const QWebEngineCallback<bool> &resultCallback = QWebEngineCallback<bool>()); + void findText(const QString &subString, FindFlags options = FindFlags(), const QWebEngineCallback<bool> &resultCallback = QWebEngineCallback<bool>()); #endif QMenu *createStandardContextMenu(); diff --git a/src/webenginewidgets/api/qwebengineprofile.h b/src/webenginewidgets/api/qwebengineprofile.h index 22a913fb2..d981fa5bb 100644 --- a/src/webenginewidgets/api/qwebengineprofile.h +++ b/src/webenginewidgets/api/qwebengineprofile.h @@ -63,8 +63,8 @@ class QWebEngineUrlSchemeHandler; class QWEBENGINEWIDGETS_EXPORT QWebEngineProfile : public QObject { Q_OBJECT public: - explicit QWebEngineProfile(QObject *parent = 0); - explicit QWebEngineProfile(const QString &name, QObject *parent = 0); + explicit QWebEngineProfile(QObject *parent = Q_NULLPTR); + explicit QWebEngineProfile(const QString &name, QObject *parent = Q_NULLPTR); virtual ~QWebEngineProfile(); enum HttpCacheType { @@ -132,7 +132,7 @@ private Q_SLOTS: private: Q_DISABLE_COPY(QWebEngineProfile) Q_DECLARE_PRIVATE(QWebEngineProfile) - QWebEngineProfile(QWebEngineProfilePrivate *, QObject *parent = 0); + QWebEngineProfile(QWebEngineProfilePrivate *, QObject *parent = Q_NULLPTR); friend class QWebEnginePagePrivate; friend class QWebEngineUrlSchemeHandler; diff --git a/src/webenginewidgets/api/qwebenginesettings.h b/src/webenginewidgets/api/qwebenginesettings.h index 6dc1b539b..0ba728c94 100644 --- a/src/webenginewidgets/api/qwebenginesettings.h +++ b/src/webenginewidgets/api/qwebenginesettings.h @@ -114,7 +114,7 @@ private: friend class QWebEngineProfilePrivate; ~QWebEngineSettings(); - explicit QWebEngineSettings(QWebEngineSettings *parentSettings = 0); + explicit QWebEngineSettings(QWebEngineSettings *parentSettings = Q_NULLPTR); }; QT_END_NAMESPACE diff --git a/src/webenginewidgets/api/qwebengineview.h b/src/webenginewidgets/api/qwebengineview.h index f7e846861..cb66bb75f 100644 --- a/src/webenginewidgets/api/qwebengineview.h +++ b/src/webenginewidgets/api/qwebengineview.h @@ -65,7 +65,7 @@ class QWEBENGINEWIDGETS_EXPORT QWebEngineView : public QWidget { Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor) public: - explicit QWebEngineView(QWidget* parent = 0); + explicit QWebEngineView(QWidget* parent = Q_NULLPTR); virtual ~QWebEngineView(); QWebEnginePage* page() const; @@ -95,10 +95,10 @@ public: void setZoomFactor(qreal factor); #ifdef Q_QDOC - void findText(const QString &subString, QWebEnginePage::FindFlags options = 0); + void findText(const QString &subString, QWebEnginePage::FindFlags options = QWebEnginePage::FindFlags()); void findText(const QString &subString, QWebEnginePage::FindFlags options, FunctorOrLambda resultCallback); #else - void findText(const QString &subString, QWebEnginePage::FindFlags options = 0, const QWebEngineCallback<bool> &resultCallback = QWebEngineCallback<bool>()); + void findText(const QString &subString, QWebEnginePage::FindFlags options = QWebEnginePage::FindFlags(), const QWebEngineCallback<bool> &resultCallback = QWebEngineCallback<bool>()); #endif virtual QSize sizeHint() const Q_DECL_OVERRIDE; diff --git a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc index 6f41c81fd..a6cb0a384 100644 --- a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc +++ b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc @@ -39,7 +39,8 @@ and findText(). A page can be loaded using load() or setUrl(). Alternatively, if you have - the HTML content readily available, you can use setHtml(). + the HTML content readily available, you can use setHtml(). The GET method is + always used to load URLs. The QWebEnginePage class also offers methods to retrieve both the URL currently loaded by the page (see url()) as well as the URL originally requested @@ -615,6 +616,10 @@ \warning This function works only for HTML, for other mime types (such as XHTML and SVG) setContent() should be used instead. + \warning The content will be percent encoded before being sent to the renderer via IPC. + This may increase its size. The maximum size of the percent encoded content is + 2 megabytes minus 30 bytes. + \sa toHtml(), setContent(), load() */ @@ -630,6 +635,10 @@ \note This method will not affect session or global history for the page. + \warning The content will be percent encoded before being sent to the renderer via IPC. + This may increase its size. The maximum size of the percent encoded content is + 2 megabytes minus 6 bytes plus the length of the mime type string. + \sa toHtml(), setHtml() */ diff --git a/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc index 3e0f4cf82..c2f810b2a 100644 --- a/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc +++ b/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc @@ -130,7 +130,7 @@ Enables displaying the built-in error pages of Chromium. Enabled by default. \value PluginsEnabled Enables support for Pepper plugins, such as the Flash player. Disabled by default. - See also \l{Pepper Plugin API Support}. (Added in Qt 5.6) + See also \l{Pepper Plugin API}. (Added in Qt 5.6) \value FullScreenSupportEnabled Enables fullscreen support in an application. Disabled by default. (Added in Qt 5.6) \value ScreenCaptureEnabled diff --git a/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc index feaa802d7..5a4c1b52b 100644 --- a/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc +++ b/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc @@ -37,8 +37,10 @@ It can be used in various applications to display web content live from the Internet. - A \e {web site} can be loaded to a web view with the load() function. Like all - Qt widgets, the show() function must be invoked in order to display + A \e {web site} can be loaded to a web view with the load() function. The + GET method is always used to load URLs. + + Like all Qt widgets, the show() function must be invoked in order to display the web view. The snippet below illustrates this: \snippet simple/main.cpp Using QWebEngineView diff --git a/tests/auto/widgets/qwebenginepage/BLACKLIST b/tests/auto/widgets/qwebenginepage/BLACKLIST index d4481dc3f..30b43d6b7 100644 --- a/tests/auto/widgets/qwebenginepage/BLACKLIST +++ b/tests/auto/widgets/qwebenginepage/BLACKLIST @@ -6,3 +6,6 @@ osx [getUserMediaRequest] windows + +[setHtmlWithImageResource] +* diff --git a/tests/auto/widgets/qwebenginepage/resources/pasteimage.html b/tests/auto/widgets/qwebenginepage/resources/pasteimage.html new file mode 100644 index 000000000..cc37d9319 --- /dev/null +++ b/tests/auto/widgets/qwebenginepage/resources/pasteimage.html @@ -0,0 +1,30 @@ +<html> + <head> + <meta charset="UTF-8"> + <script> + window.onload = function() { + document.getElementById("pasteArea").focus(); + } + document.onpaste = function(event) { + var items = (event.clipboardData || event.originalEvent.clipboardData).items; + var blob = null; + for (var i = 0; i < items.length; ++i) { + if (items[i].type.indexOf("image/png") !== -1) { + blob = items[i].getAsFile(); + break; + } + } + if (!blob) + return; + var reader = new FileReader(); + reader.onload = function(event) { + window.myImageDataURL = event.target.result; + } + reader.readAsDataURL(blob); + }; + </script> + </head> + <body> + <textarea id="pasteArea" placeholder="paste here"></textarea> + </body> +</html> diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index d617c23a0..df290babf 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -32,6 +32,7 @@ #include <QPushButton> #include <QStateMachine> #include <QStyle> +#include <QtGui/QClipboard> #include <QtTest/QtTest> #include <QTextCharFormat> #include <QWebChannel> @@ -121,6 +122,7 @@ private Q_SLOTS: void geolocationRequestJS(); void loadFinished(); void actionStates(); + void pasteImage(); void popupFormSubmission(); void userStyleSheet(); void userStyleSheetFromLocalFileUrl(); @@ -462,6 +464,35 @@ void tst_QWebEnginePage::actionStates() QTRY_VERIFY(!stopAction->isEnabled()); } +static QImage imageWithoutAlpha(const QImage &image) +{ + QImage result = image; + QPainter painter(&result); + painter.fillRect(result.rect(), Qt::green); + painter.drawImage(0, 0, image); + return result; +} + +void tst_QWebEnginePage::pasteImage() +{ + // Pixels with an alpha value of 0 will have different RGB values after the + // test -> clipboard -> webengine -> test roundtrip. + // Clear the alpha channel to make QCOMPARE happy. + const QImage origImage = imageWithoutAlpha(QImage(":/resources/image.png")); + QClipboard *clipboard = QGuiApplication::clipboard(); + clipboard->setImage(origImage); + QWebEnginePage *page = m_view->page(); + page->load(QUrl("qrc:///resources/pasteimage.html")); + QVERIFY(waitForSignal(m_view, SIGNAL(loadFinished(bool)))); + page->triggerAction(QWebEnginePage::Paste); + QTRY_VERIFY(evaluateJavaScriptSync(page, + "window.myImageDataURL ? window.myImageDataURL.length : 0").toInt() > 0); + QByteArray data = evaluateJavaScriptSync(page, "window.myImageDataURL").toByteArray(); + data.remove(0, data.indexOf(";base64,") + 8); + const QImage image = QImage::fromData(QByteArray::fromBase64(data), "PNG"); + QCOMPARE(image, origImage); +} + class ConsolePage : public QWebEnginePage { public: diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.qrc b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.qrc index c7bffd5bb..91adeb694 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.qrc +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.qrc @@ -12,6 +12,7 @@ <file>resources/script.html</file> <file>resources/user.css</file> <file>resources/image.png</file> + <file>resources/pasteimage.html</file> <file>resources/style.css</file> <file>resources/test1.html</file> <file>resources/test2.html</file> diff --git a/tools/qmake/mkspecs/features/configure.prf b/tools/qmake/mkspecs/features/configure.prf index 679b282b3..af87a587e 100644 --- a/tools/qmake/mkspecs/features/configure.prf +++ b/tools/qmake/mkspecs/features/configure.prf @@ -26,7 +26,7 @@ defineTest(runConfigure) { !config_khr:skipBuild("khronos development headers appear to be missing (mesa/libegl1-mesa-dev)") REQUIRED_PACKAGES = dbus-1 fontconfig - contains(QT_CONFIG, xcb): REQUIRED_PACKAGES += libdrm xcomposite xcursor xi xrandr xscrnsaver xtst + !cross_compile: contains(QT_CONFIG, xcb): REQUIRED_PACKAGES += libdrm xcomposite xcursor xi xrandr xscrnsaver xtst contains(QT_CONFIG, pulseaudio): REQUIRED_PACKAGES += libpulse contains(QT_CONFIG, system-png): REQUIRED_PACKAGES += libpng contains(QT_CONFIG, system-harfbuzz): REQUIRED_PACKAGES += harfbuzz |