diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-05-30 10:19:31 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-05-30 10:19:38 +0200 |
commit | d4cb1d15ae8cf57b931b021490b0776cc70f0b32 (patch) | |
tree | 86282a3ed6a2ada1905c00a5b695bfc0bfb525a2 /src | |
parent | b0324c5e020b98cbc0caf8176bbdfc5cd80b545e (diff) | |
parent | 95ca17c45aea718cade487640edc63e08bc23820 (diff) |
Merge remote-tracking branch 'origin/5.9' into dev
Change-Id: I962033871a1ef624807a4e1869fe869406aa73f7
Diffstat (limited to 'src')
29 files changed, 296 insertions, 61 deletions
diff --git a/src/3rdparty b/src/3rdparty -Subproject 898afbbf79637101bbd5e6ab12695ced6a759ae +Subproject aa2fdd6be3d465280d2a0c3aacdc738bb4ffec0 diff --git a/src/buildtools/configure_target.pro b/src/buildtools/configure_target.pro index 6ec914dd5..31aa283f6 100644 --- a/src/buildtools/configure_target.pro +++ b/src/buildtools/configure_target.pro @@ -29,3 +29,5 @@ GN_FILE = $$OUT_PWD/../toolchain/BUILD.gn !build_pass { write_file($$GN_FILE, GN_CONTENTS, append) } + +QMAKE_DISTCLEAN += $$GN_FILE diff --git a/src/core/api/core_api.pro b/src/core/api/core_api.pro index cda01db40..22c165e2a 100644 --- a/src/core/api/core_api.pro +++ b/src/core/api/core_api.pro @@ -50,6 +50,10 @@ SOURCES = \ qwebengineurlrequestjob.cpp \ qwebengineurlschemehandler.cpp +unix:!isEmpty(QMAKE_LFLAGS_VERSION_SCRIPT):!static { + SOURCES += qtbug-60565.cpp +} + msvc { # Create a list of object files that can be used as response file for the linker. # This is done to simulate -whole-archive on MSVC. diff --git a/src/core/api/qtbug-60565.cpp b/src/core/api/qtbug-60565.cpp new file mode 100644 index 000000000..21b545cca --- /dev/null +++ b/src/core/api/qtbug-60565.cpp @@ -0,0 +1,121 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <new> +#include <unistd.h> + +#if defined(__LP64__) +# define SIZE_T_MANGLING "m" +#else +# define SIZE_T_MANGLING "j" +#endif + +#define SHIM_ALIAS_SYMBOL(fn) __attribute__((weak, alias(#fn))) + +extern "C" { + +__asm__(".symver __ShimCppNew, _Znw" SIZE_T_MANGLING "@Qt_5"); +void* __ShimCppNew(size_t size) + SHIM_ALIAS_SYMBOL(ShimCppNew); + +__asm__(".symver __ShimCppDelete, _ZdlPv@Qt_5"); +void __ShimCppDelete(void* address) + SHIM_ALIAS_SYMBOL(ShimCppDelete); + +__asm__(".symver __ShimCppNewArray, _Zna" SIZE_T_MANGLING "@Qt_5"); +void* __ShimCppNewArray(size_t size) + SHIM_ALIAS_SYMBOL(ShimCppNewArray); + +__asm__(".symver __ShimCppDeleteArray, _ZdaPv@Qt_5"); +void __ShimCppDeleteArray(void* address) + SHIM_ALIAS_SYMBOL(ShimCppDeleteArray); + +__asm__(".symver __ShimCppNewNoThrow, _Znw" SIZE_T_MANGLING "RKSt9nothrow_t@Qt_5"); +void __ShimCppNewNoThrow(size_t size, const std::nothrow_t&) noexcept + SHIM_ALIAS_SYMBOL(ShimCppNew); + +__asm__(".symver __ShimCppNewArrayNoThrow, _Zna" SIZE_T_MANGLING "RKSt9nothrow_t@Qt_5"); +void __ShimCppNewArrayNoThrow(size_t size, const std::nothrow_t&) noexcept + SHIM_ALIAS_SYMBOL(ShimCppNewArray); + +__asm__(".symver __ShimCppDeleteNoThrow, _ZdlPvRKSt9nothrow_t@Qt_5"); +void __ShimCppDeleteNoThrow(void* address, const std::nothrow_t&) noexcept + SHIM_ALIAS_SYMBOL(ShimCppDelete); + +__asm__(".symver __ShimCppDeleteArrayNoThrow, _ZdaPvRKSt9nothrow_t@Qt_5"); +void __ShimCppDeleteArrayNoThrow(void* address, const std::nothrow_t&) noexcept + SHIM_ALIAS_SYMBOL(ShimCppDeleteArray); + +static void* __shimCppNew(size_t size); +static void* __shimCppNewArray(size_t size); +static void __shimCppDelete(void *address); +static void __shimCppDeleteArray(void *address); + +static void* ShimCppNew(size_t size) { + return __shimCppNew(size); +} + +static void* ShimCppNewArray(size_t size) { + return __shimCppNewArray(size); +} + +static void ShimCppDelete(void* address) { + __shimCppDelete(address); +} + +static void ShimCppDeleteArray(void* address) { + __shimCppDeleteArray(address); +} +} // extern "C" + +static void* __shimCppNew(size_t size) { + return operator new(size); +} + +static void* __shimCppNewArray(size_t size) { + return operator new[](size); +} + +static void __shimCppDelete(void* address) { + operator delete(address); +} + +static void __shimCppDeleteArray(void* address) { + operator delete[](address); +} diff --git a/src/core/browser_context_adapter.cpp b/src/core/browser_context_adapter.cpp index 1da186584..bec76ad81 100644 --- a/src/core/browser_context_adapter.cpp +++ b/src/core/browser_context_adapter.cpp @@ -162,6 +162,8 @@ QWebEngineUrlRequestInterceptor *BrowserContextAdapter::requestInterceptor() void BrowserContextAdapter::setRequestInterceptor(QWebEngineUrlRequestInterceptor *interceptor) { + if (m_requestInterceptor == interceptor) + return; m_requestInterceptor = interceptor; if (m_browserContext->url_request_getter_.get()) m_browserContext->url_request_getter_->updateRequestInterceptor(); diff --git a/src/core/config/mac_osx.pri b/src/core/config/mac_osx.pri index cdd1ce7b6..ddb397565 100644 --- a/src/core/config/mac_osx.pri +++ b/src/core/config/mac_osx.pri @@ -38,5 +38,3 @@ use?(spellchecker) { } else { macos: gn_args += use_browser_spellchecker=false } - -use?(appstore_compliant_code): gn_args += appstore_compliant_code=true diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp index b10a02fbd..e58fa93d7 100644 --- a/src/core/content_client_qt.cpp +++ b/src/core/content_client_qt.cpp @@ -161,7 +161,14 @@ void AddPepperFlashFromSystem(std::vector<content::PepperPluginInfo>* plugins) pluginPaths << ppapiPluginsPath() + QStringLiteral("/pepflashplayer.dll"); #endif #if defined(Q_OS_OSX) - pluginPaths << "/Library/Internet Plug-Ins/PepperFlashPlayer/PepperFlashPlayer.plugin"; // Mac OS X + pluginPaths << "/Library/Internet Plug-Ins/PepperFlashPlayer/PepperFlashPlayer.plugin"; // System path + QDir potentialDir(QDir::homePath() + "/Library/Application Support/Google/Chrome/PepperFlash"); + if (potentialDir.exists()) { + QFileInfoList versionDirs = potentialDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::Reversed); + for (int i = 0; i < versionDirs.size(); ++i) { + pluginPaths << versionDirs.at(i).absoluteFilePath() + "/PepperFlashPlayer.plugin"; + } + } pluginPaths << ppapiPluginsPath() + QStringLiteral("/PepperFlashPlayer.plugin"); #endif #if defined(Q_OS_LINUX) diff --git a/src/core/core.pro b/src/core/core.pro index 91c5044b6..6cc8080e0 100644 --- a/src/core/core.pro +++ b/src/core/core.pro @@ -41,7 +41,7 @@ core_api.depends = gn_run # A fake project for qt creator core_project.file = core_project.pro -core_project.depends = core_headers +core_project.depends = gn_run SUBDIRS += \ core_headers \ diff --git a/src/core/core_common.pri b/src/core/core_common.pri index 9c29aea71..370fe4d2a 100644 --- a/src/core/core_common.pri +++ b/src/core/core_common.pri @@ -5,8 +5,4 @@ TARGET = QtWebEngineCore QT += qml quick webchannel QT_PRIVATE += quick-private gui-private core-private webenginecoreheaders-private -# Make QtCreator happy. -CHROMIUM_SRC_DIR = $$QTWEBENGINE_ROOT/$$getChromiumSrcDir() -INCLUDEPATH += $$CHROMIUM_SRC_DIR - qtHaveModule(positioning):QT += positioning diff --git a/src/core/core_module.pro b/src/core/core_module.pro index f4f3fb736..44e8ac613 100644 --- a/src/core/core_module.pro +++ b/src/core/core_module.pro @@ -130,9 +130,6 @@ icu.files = $$OUT_PWD/$$getConfigDir()/icudtl.dat } OTHER_FILES = \ - $$files(../3rdparty/chromium/*.h, true) \ - $$files(../3rdparty/chromium/*.cc, true) \ - $$files(../3rdparty/chromium/*.mm, true) \ $$files(../3rdparty/chromium/*.py, true) \ $$files(../3rdparty/chromium/*.gyp, true) \ $$files(../3rdparty/chromium/*.gypi, true) \ diff --git a/src/core/core_project.pro b/src/core/core_project.pro index 8418ab22b..c046ce1ff 100644 --- a/src/core/core_project.pro +++ b/src/core/core_project.pro @@ -1,3 +1,18 @@ TEMPLATE = lib +# Fake project to make QtCreator happy. -include(core_chromium.pri) +include(core_common.pri) + +linking_pri = $$OUT_PWD/$$getConfigDir()/$${TARGET}.pri + +!include($$linking_pri) { + error("Could not find the linking information that gn should have generated.") +} + +CHROMIUM_SRC_DIR = $$QTWEBENGINE_ROOT/$$getChromiumSrcDir() +INCLUDEPATH += $$CHROMIUM_SRC_DIR \ + $$OUT_PWD/$$getConfigDir()/gen + +SOURCES += $$NINJA_SOURCES +HEADERS += $$NINJA_HEADERS +DEFINES += $$NINJA_DEFINES diff --git a/src/core/delegated_frame_node.cpp b/src/core/delegated_frame_node.cpp index a4b2a4036..e49bc553f 100644 --- a/src/core/delegated_frame_node.cpp +++ b/src/core/delegated_frame_node.cpp @@ -209,6 +209,7 @@ protected: QVector<QSGNode*> *m_sceneGraphNodes; }; +#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)) class DelegatedNodeTreeUpdater : public DelegatedNodeTreeHandler { public: @@ -303,6 +304,7 @@ public: private: QVector<QSGNode*>::iterator m_nodeIterator; }; +#endif class DelegatedNodeTreeCreator : public DelegatedNodeTreeHandler { @@ -872,8 +874,13 @@ void DelegatedFrameNode::commit(ChromiumCompositorData *chromiumCompositorData, // We first compare if the render passes from the previous frame data are structurally // equivalent to the render passes in the current frame data. If they are, we are going // to reuse the old nodes. Otherwise, we will delete the old nodes and build a new tree. +#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)) cc::DelegatedFrameData *previousFrameData = m_chromiumCompositorData->previousFrameData.get(); const bool buildNewTree = !areRenderPassStructuresEqual(frameData, previousFrameData) || m_sceneGraphNodes.empty(); +#else + // No updates possible with old scenegraph nodes + const bool buildNewTree = true; +#endif m_chromiumCompositorData->previousFrameData = nullptr; SGObjects previousSGObjects; @@ -887,11 +894,13 @@ void DelegatedFrameNode::commit(ChromiumCompositorData *chromiumCompositorData, delete oldChain; m_sceneGraphNodes.clear(); nodeHandler.reset(new DelegatedNodeTreeCreator(&m_sceneGraphNodes, apiDelegate)); +#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)) } else { // Save the texture strong refs so they only go out of scope when the method returns and // the new vector of texture strong refs has been filled. qSwap(m_sgObjects.textureStrongRefs, textureStrongRefs); nodeHandler.reset(new DelegatedNodeTreeUpdater(&m_sceneGraphNodes)); +#endif } // The RenderPasses list is actually a tree where a parent RenderPass is connected // to its dependencies through a RenderPassId reference in one or more RenderPassQuads. diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index 6568398a8..cf22273e4 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -97,6 +97,7 @@ enum ImStateFlags { TextInputStateUpdated = 1 << 0, TextSelectionUpdated = 1 << 1, TextSelectionBoundsUpdated = 1 << 2, + TextSelectionFlags = TextSelectionUpdated | TextSelectionBoundsUpdated, AllFlags = TextInputStateUpdated | TextSelectionUpdated | TextSelectionBoundsUpdated }; @@ -237,6 +238,19 @@ private: float dpiScale; }; +bool isAccessibilityEnabled() { + // On Linux accessibility is disabled by default due to performance issues, + // and can be re-enabled by setting the QTWEBENGINE_ENABLE_LINUX_ACCESSIBILITY environment + // variable. For details, see QTBUG-59922. +#ifdef Q_OS_LINUX + static bool accessibility_enabled + = qEnvironmentVariableIsSet("QTWEBENGINE_ENABLE_LINUX_ACCESSIBILITY"); +#else + const bool accessibility_enabled = true; +#endif + return accessibility_enabled; +} + RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost* widget) : m_host(content::RenderWidgetHostImpl::From(widget)) , m_gestureProvider(QtGestureProviderConfig(), this) @@ -253,16 +267,18 @@ RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost* widget , m_needsBeginFrames(false) , m_addedFrameObserver(false) , m_imState(0) - , m_anchorPositionWithinSelection(0) - , m_cursorPositionWithinSelection(0) + , m_anchorPositionWithinSelection(-1) + , m_cursorPositionWithinSelection(-1) , m_cursorPosition(0) , m_emptyPreviousSelection(true) { m_host->SetView(this); #ifndef QT_NO_ACCESSIBILITY - QAccessible::installActivationObserver(this); - if (QAccessible::isActive()) - content::BrowserAccessibilityStateImpl::GetInstance()->EnableAccessibility(); + if (isAccessibilityEnabled()) { + QAccessible::installActivationObserver(this); + if (QAccessible::isActive()) + content::BrowserAccessibilityStateImpl::GetInstance()->EnableAccessibility(); + } #endif // QT_NO_ACCESSIBILITY auto* task_runner = base::ThreadTaskRunnerHandle::Get().get(); m_beginFrameSource.reset(new cc::DelayBasedBeginFrameSource( @@ -761,8 +777,10 @@ void RenderWidgetHostViewQt::OnSelectionBoundsChanged(content::TextInputManager Q_UNUSED(updated_view); m_imState |= ImStateFlags::TextSelectionBoundsUpdated; - if (m_imState == ImStateFlags::AllFlags) + if (m_imState == ImStateFlags::AllFlags + || (m_imState == ImStateFlags::TextSelectionFlags && getTextInputType() == ui::TEXT_INPUT_TYPE_NONE)) { selectionChanged(); + } } void RenderWidgetHostViewQt::OnTextSelectionChanged(content::TextInputManager *text_input_manager, RenderWidgetHostViewBase *updated_view) @@ -779,8 +797,10 @@ void RenderWidgetHostViewQt::OnTextSelectionChanged(content::TextInputManager *t #endif // defined(USE_X11) m_imState |= ImStateFlags::TextSelectionUpdated; - if (m_imState == ImStateFlags::AllFlags) + if (m_imState == ImStateFlags::AllFlags + || (m_imState == ImStateFlags::TextSelectionFlags && getTextInputType() == ui::TEXT_INPUT_TYPE_NONE)) { selectionChanged(); + } } void RenderWidgetHostViewQt::selectionChanged() @@ -788,6 +808,22 @@ void RenderWidgetHostViewQt::selectionChanged() // Reset input manager state m_imState = 0; + // Handle text selection out of an input field + if (getTextInputType() == ui::TEXT_INPUT_TYPE_NONE) { + if (GetSelectedText().empty() && m_emptyPreviousSelection) + return; + + // Reset position values to emit selectionChanged signal when clearing text selection + // by clicking into an input field. These values are intended to be used by inputMethodQuery + // so they are not expected to be valid when selection is out of an input field. + m_anchorPositionWithinSelection = -1; + m_cursorPositionWithinSelection = -1; + + m_emptyPreviousSelection = GetSelectedText().empty(); + m_adapterClient->selectionChanged(); + return; + } + const content::TextInputManager::TextSelection *selection = text_input_manager_->GetTextSelection(); if (!selection) return; @@ -802,8 +838,8 @@ void RenderWidgetHostViewQt::selectionChanged() return; } - uint newAnchorPositionWithinSelection = 0; - uint newCursorPositionWithinSelection = 0; + int newAnchorPositionWithinSelection = 0; + int newCursorPositionWithinSelection = 0; if (text_input_manager_->GetSelectionRegion()->anchor.type() == gfx::SelectionBound::RIGHT) { newAnchorPositionWithinSelection = selection->range.GetMax() - selection->offset; diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h index 799930830..3b679923e 100644 --- a/src/core/render_widget_host_view_qt.h +++ b/src/core/render_widget_host_view_qt.h @@ -263,8 +263,8 @@ private: gfx::SizeF m_lastContentsSize; uint m_imState; - uint m_anchorPositionWithinSelection; - uint m_cursorPositionWithinSelection; + int m_anchorPositionWithinSelection; + int m_cursorPositionWithinSelection; uint m_cursorPosition; bool m_emptyPreviousSelection; QString m_surroundingText; diff --git a/src/core/url_request_context_getter_qt.cpp b/src/core/url_request_context_getter_qt.cpp index 561b3c2b0..234109f1f 100644 --- a/src/core/url_request_context_getter_qt.cpp +++ b/src/core/url_request_context_getter_qt.cpp @@ -369,7 +369,7 @@ void URLRequestContextGetterQt::generateUserAgent() Q_ASSERT(m_storage); QMutexLocker lock(&m_mutex); - m_updateUserAgent = true; + m_updateUserAgent = false; m_storage->set_http_user_agent_settings(std::unique_ptr<net::HttpUserAgentSettings>( new net::StaticHttpUserAgentSettings(m_httpAcceptLanguage.toStdString(), m_httpUserAgent.toStdString()))); diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index d67d972c8..444429c75 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -1184,7 +1184,9 @@ void WebContentsAdapter::startDragging(QObject *dragSource, const content::DropD bool dValid = true; QMetaObject::Connection onDestroyed = QObject::connect(dragSource, &QObject::destroyed, [&dValid](){ dValid = false; +#if (QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)) QDrag::cancel(); +#endif }); drag->setMimeData(mimeDataFromDropData(*d->currentDropData)); diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 81f968d11..2748d2a0f 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -91,6 +91,7 @@ #ifndef QT_NO_OPENGL # include <QOpenGLContext> #endif +#include <QQuickWindow> #include <QStringList> #include <QSurfaceFormat> #include <QVector> @@ -157,6 +158,10 @@ bool usingQtQuick2DRenderer() } } +#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)) + if (device.isEmpty()) + device = QQuickWindow::sceneGraphBackend(); +#endif if (device.isEmpty()) device = QString::fromLocal8Bit(qgetenv("QT_QUICK_BACKEND")); if (device.isEmpty()) @@ -319,6 +324,14 @@ WebEngineContext::WebEngineContext() // Enabled on OS X and Linux but currently not working. It worked in 5.7 on OS X. parsedCommandLine->AppendSwitch(switches::kDisableGpuMemoryBufferVideoFrames); +#if defined(Q_OS_MACOS) + // Accelerated decoding currently does not work on macOS due to issues with OpenGL Rectangle + // texture support. See QTBUG-60002. + parsedCommandLine->AppendSwitch(switches::kDisableAcceleratedVideoDecode); + // Same problem with Pepper using OpenGL images. + parsedCommandLine->AppendSwitch(switches::kDisablePepper3DImageChromium); +#endif + if (useEmbeddedSwitches) { // Inspired by the Android port's default switches if (!parsedCommandLine->HasSwitch(switches::kDisableOverlayScrollbar)) diff --git a/src/tools/qwebengine_convert_dict/main.cpp b/src/tools/qwebengine_convert_dict/main.cpp index 61e26c4a3..a86f868b3 100644 --- a/src/tools/qwebengine_convert_dict/main.cpp +++ b/src/tools/qwebengine_convert_dict/main.cpp @@ -107,6 +107,14 @@ inline bool VerifyWords(const convert_dict::DicReader::WordList& org_words, return true; } +#if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD) +QString frameworkIcuDataPath() +{ + return QLibraryInfo::location(QLibraryInfo::LibrariesPath) + + QStringLiteral("/QtWebEngineCore.framework/Resources/"); +} +#endif + int main(int argc, char *argv[]) { QTextStream out(stdout); @@ -132,6 +140,14 @@ int main(int argc, char *argv[]) icuDataDir = icuPossibleEnvDataDir; icuDataDirFound = true; } +#if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD) + // In a macOS Qt framework build, the resources are inside the QtWebEngineCore framework + // Resources directory, rather than in the Qt install location. + else if (QFileInfo::exists(frameworkIcuDataPath())) { + icuDataDir = frameworkIcuDataPath(); + icuDataDirFound = true; + } +#endif // Try to find the ICU data directory in the installed Qt location. else if (QFileInfo::exists(icuDataDir)) { icuDataDirFound = true; diff --git a/src/webengine/api/qquickwebengineprofile.cpp b/src/webengine/api/qquickwebengineprofile.cpp index f22ec86a4..260d8958b 100644 --- a/src/webengine/api/qquickwebengineprofile.cpp +++ b/src/webengine/api/qquickwebengineprofile.cpp @@ -153,6 +153,8 @@ QQuickWebEngineProfilePrivate::QQuickWebEngineProfilePrivate(QSharedPointer<Brow QQuickWebEngineProfilePrivate::~QQuickWebEngineProfilePrivate() { + m_browserContextRef->setRequestInterceptor(nullptr); + m_browserContextRef->removeClient(this); Q_FOREACH (QQuickWebEngineDownloadItem* download, m_ongoingDownloads) { diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index dac844fdb..ab6a9c79a 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -234,7 +234,7 @@ bool QQuickWebEngineViewPrivate::contextMenuRequested(const WebEngineContextMenu } ui()->addMenuSeparator(menu); } - if (!data.linkText().isEmpty() && data.linkUrl().isValid()) { + if (data.linkUrl().isValid()) { item = new MenuItemHandler(menu); QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::OpenLinkInThisWindow); }); ui()->addMenuItem(item, QQuickWebEngineView::tr("Follow Link")); diff --git a/src/webengine/doc/qtwebengine.qdocconf b/src/webengine/doc/qtwebengine.qdocconf index fe83b082f..ea9c6f21b 100644 --- a/src/webengine/doc/qtwebengine.qdocconf +++ b/src/webengine/doc/qtwebengine.qdocconf @@ -33,7 +33,7 @@ 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" \ +manifestmeta.highlighted.names += "QtWebEngine/WebEngine Widgets Simple Browser Example" \ "QtWebEngine/WebEngine Quick Nano Browser" tagfile = ../../../doc/qtwebengine/qtwebengine.tags @@ -67,7 +67,7 @@ exampledirs += . \ ../../core/doc/snippets \ ../../webenginewidgets/doc/snippets -examples.fileextensions += *.aff *.dic +examples.fileextensions += *.aff *.dic *.html imagedirs += images diff --git a/src/webengine/doc/src/qtwebengine-deploying.qdoc b/src/webengine/doc/src/qtwebengine-deploying.qdoc index 351ef49de..8530bc075 100644 --- a/src/webengine/doc/src/qtwebengine-deploying.qdoc +++ b/src/webengine/doc/src/qtwebengine-deploying.qdoc @@ -141,11 +141,4 @@ directory specified by QLibraryInfo::location(QLibraryInfo::TranslationsPath) \endlist - - \section2 Deploying Audio and Video Codecs - - To support HTML5 video, you must additionally deploy - \c ffmpegsumo.dll (WebM codec plugin) into the \c qtwebengine directory - under the application install path or under the path that the - \c PluginsPath variable was set to in \c qt.conf. */ diff --git a/src/webengine/doc/src/qtwebengine-overview.qdoc b/src/webengine/doc/src/qtwebengine-overview.qdoc index ff35b45cf..e180b22c0 100644 --- a/src/webengine/doc/src/qtwebengine-overview.qdoc +++ b/src/webengine/doc/src/qtwebengine-overview.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. @@ -89,7 +89,7 @@ \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. - This version of Qt WebEngine is based on Chromium version 53.0.2785.148, with + This version of Qt WebEngine is based on Chromium version 56.0.2924.122, with additional security fixes from newer versions. \section2 Qt WebEngine Process diff --git a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc index 06a4a53a9..2eeda6e8a 100644 --- a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc +++ b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc @@ -114,17 +114,18 @@ \section1 Mac App Store Compatibility - By default, Qt WebEngine uses private \macos API, which might cause an application to be - rejected when submitted to the Mac App Store. To configure Qt WebEngine not to use these API - calls, Qt has to be reconfigured with the \c -appstore-compliant switch. - - However, this will cause some behavioral changes, such as: + Applications using Qt WebEngine are not compatible with the Mac App Store, because: \list - \li The \macos Kill Ring functionality will no longer work (emacs-like copy pasting). - \li Certain Chromium sandboxing cleanup is not done. - \li Text areas will be painted with a different style. - \li Text fields might be painted with a different style on Mountain Lion (\macos 10.8). + \li The Chromium part of the code uses several private API methods, which are prohibited by + the App Store. + \li Applications submitted to the App Store must be code-signed with the App Sandbox feature + enabled. The App Sandbox feature interferes with Chromium's own sandbox + initialization, which results in Chromium not being properly initialized. This also + ties in with the private API usage. Furthermore, standalone Chromium itself is not + officially tested with the App Sandbox enabled, and even if work is done to bypass + the App Store's restrictions, that would not guarantee correct behavior of the library. + \endlist \section1 macOS Airplay Support on MacBooks with Dual GPUs @@ -161,4 +162,24 @@ set to 1 or alternatively the \c{--no-sandbox} command line argument can be passed to the user application executable. + \section1 Accessibility and Performance + + Qt WebEngine enables accessibility support for web pages when the following conditions + are met: + + \list + \li Qt Core is configured and built with accessibility support enabled. + \li The QPA plugin is notified by the operating system that accessibility should be + activated. This happens for example when using a screen reader application on Windows + or VoiceOver on \macos. + \endlist + + Due to some limitations, the Linux QPA plugin almost always reports that accessibility should + be activated. On big HTML pages, this can cause a significant slowdown in rendering speed. + + Because of that, from Qt 5.9 onwards, Qt WebEngine accessibility support is disabled by default + on Linux. + It can be re-enabled by setting the \c QTWEBENGINE_ENABLE_LINUX_ACCESSIBILITY environment + variable to a non-empty value. + */ diff --git a/src/webengine/ui_delegates_manager.cpp b/src/webengine/ui_delegates_manager.cpp index 4a47a49eb..6cc496d5b 100644 --- a/src/webengine/ui_delegates_manager.cpp +++ b/src/webengine/ui_delegates_manager.cpp @@ -50,6 +50,7 @@ #include <QQmlContext> #include <QQmlEngine> #include <QQmlProperty> +#include <QQuickWindow> #include <QCursor> #include <QList> #include <QScreen> @@ -559,7 +560,11 @@ void UIDelegatesManager::showToolTip(const QString &text) int width = QQmlProperty(m_toolTip.data(), QStringLiteral("width")).read().toInt(); QSize toolTipSize(width, height); QPoint position = m_view->cursor().pos(); +#if (QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)) position = m_view->mapFromGlobal(calculateToolTipPosition(position, toolTipSize)).toPoint(); +#else + position = m_view->window()->mapFromGlobal(calculateToolTipPosition(position, toolTipSize)); +#endif QQmlProperty(m_toolTip.data(), QStringLiteral("x")).write(position.x()); QQmlProperty(m_toolTip.data(), QStringLiteral("y")).write(position.y()); diff --git a/src/webenginewidgets/api/qwebenginedownloaditem.cpp b/src/webenginewidgets/api/qwebenginedownloaditem.cpp index 1950221c7..c1d9a3698 100644 --- a/src/webenginewidgets/api/qwebenginedownloaditem.cpp +++ b/src/webenginewidgets/api/qwebenginedownloaditem.cpp @@ -131,10 +131,8 @@ void QWebEngineDownloadItemPrivate::update(const BrowserContextAdapterClient::Do Q_ASSERT(downloadState != QWebEngineDownloadItem::DownloadRequested); - if (toDownloadInterruptReason(info.downloadInterruptReason) != interruptReason) { + if (toDownloadInterruptReason(info.downloadInterruptReason) != interruptReason) interruptReason = toDownloadInterruptReason(info.downloadInterruptReason); - Q_EMIT q->interruptReasonChanged(); - } if (toDownloadState(info.state) != downloadState) { downloadState = toDownloadState(info.state); @@ -224,19 +222,14 @@ quint32 QWebEngineDownloadItem::id() const /*! \fn QWebEngineDownloadItem::downloadProgress(qint64 bytesReceived, qint64 bytesTotal) - This signal is emitted whenever the download's \a bytesReceived or - \a bytesTotal changes. - - \sa totalBytes(), receivedBytes() -*/ - -/*! - \fn QWebEngineDownloadItem::interruptReasonChanged() - \since 5.9 + This signal is emitted to indicate the progress of the download request. - This signal is emitted whenever the reason of the download's interruption changes. + The \a bytesReceived parameter indicates the number of bytes received, while + \a bytesTotal indicates the total number of bytes expected to be downloaded. + If the size of the file to be downloaded is not known, \c bytesTotal will be + 0. - \sa interruptReason(), QWebEngineDownloadItem::DownloadInterruptReason + \sa totalBytes(), receivedBytes() */ /*! diff --git a/src/webenginewidgets/api/qwebenginedownloaditem.h b/src/webenginewidgets/api/qwebenginedownloaditem.h index 846194f40..a4b6c08aa 100644 --- a/src/webenginewidgets/api/qwebenginedownloaditem.h +++ b/src/webenginewidgets/api/qwebenginedownloaditem.h @@ -134,7 +134,6 @@ Q_SIGNALS: void finished(); void stateChanged(QWebEngineDownloadItem::DownloadState state); void downloadProgress(qint64 bytesReceived, qint64 bytesTotal); - void interruptReasonChanged(); private: Q_DISABLE_COPY(QWebEngineDownloadItem) diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index 40180d9b8..03e5ac3f5 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -1656,7 +1656,7 @@ QMenu *QWebEnginePage::createStandardContextMenu() menu->addSeparator(); } - if (!contextMenuData.linkText().isEmpty() && contextMenuData.linkUrl().isValid()) { + if (contextMenuData.linkUrl().isValid()) { action = QWebEnginePage::action(OpenLinkInThisWindow); action->setText(tr("Follow Link")); menu->addAction(action); diff --git a/src/webenginewidgets/api/qwebengineprofile.cpp b/src/webenginewidgets/api/qwebengineprofile.cpp index abed066d3..cd4fc8b02 100644 --- a/src/webenginewidgets/api/qwebengineprofile.cpp +++ b/src/webenginewidgets/api/qwebengineprofile.cpp @@ -156,6 +156,10 @@ QWebEngineProfilePrivate::QWebEngineProfilePrivate(QSharedPointer<BrowserContext QWebEngineProfilePrivate::~QWebEngineProfilePrivate() { + // In the case the user sets this profile as the parent of the interceptor + // it can be deleted before the browser-context still referencing it is. + m_browserContextRef->setRequestInterceptor(nullptr); + delete m_settings; m_settings = 0; m_browserContextRef->removeClient(this); |