summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-05-29 10:32:39 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-05-29 08:33:31 +0000
commit95ca17c45aea718cade487640edc63e08bc23820 (patch)
tree53d6cc2102d18ed4b143cb69b378cbbeba7faee4 /src/core
parentfdbc265de10fe173b0c38e0be4c6e3eed1dc65b7 (diff)
parent73f7be5b2a95eab3dce11caede538eeb7beb71f2 (diff)
Merge remote-tracking branch 'origin/5.9.0' into 5.9
Diffstat (limited to 'src/core')
-rw-r--r--src/core/api/core_api.pro4
-rw-r--r--src/core/api/qtbug-60565.cpp121
-rw-r--r--src/core/browser_context_adapter.cpp2
-rw-r--r--src/core/config/mac_osx.pri2
-rw-r--r--src/core/delegated_frame_node.cpp9
-rw-r--r--src/core/render_widget_host_view_qt.cpp54
-rw-r--r--src/core/render_widget_host_view_qt.h4
-rw-r--r--src/core/web_contents_adapter.cpp2
-rw-r--r--src/core/web_engine_context.cpp10
9 files changed, 195 insertions, 13 deletions
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/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/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 60622b4ae..2748d2a0f 100644
--- a/src/core/web_engine_context.cpp
+++ b/src/core/web_engine_context.cpp
@@ -158,8 +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())
@@ -322,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))