summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2019-09-12 10:00:03 +0200
committerLiang Qi <liang.qi@qt.io>2019-09-12 20:19:28 +0200
commit2f71cdff2cda7903fd0b5ff0033d790877e40181 (patch)
tree0255e40f5366123bedefcbc9ad7d482f2e8198a2
parentd91b839d67bcfa1cfeb3d095b6885c97c53b9812 (diff)
parent5b0bbd7345b698faab0116b821802fb4a30c0fa4 (diff)
downloadqtwebengine-wip/qt6.tar.gz
Merge "Merge remote-tracking branch 'origin/5.14' into wip/qt6"wip/qt6
-rw-r--r--config.tests/alsa/alsa.pro2
-rw-r--r--config.tests/alsa/alsatest.cpp37
-rw-r--r--config.tests/glibc/glibc.cpp38
-rw-r--r--config.tests/glibc/glibc.pro5
-rw-r--r--config.tests/khr/khr.cpp34
-rw-r--r--config.tests/khr/khr.pro6
-rw-r--r--config.tests/libvpx/libvpx.cpp41
-rw-r--r--config.tests/libvpx/libvpx.pro4
-rw-r--r--config.tests/re2/re2.cpp36
-rw-r--r--config.tests/re2/re2.pro3
-rw-r--r--config.tests/snappy/snappy.cpp36
-rw-r--r--config.tests/snappy/snappy.pro3
-rw-r--r--config.tests/winversion/winversion.cpp36
-rw-r--r--config.tests/winversion/winversion.pro3
-rw-r--r--config.tests/xml2/xml2.cpp37
-rw-r--r--config.tests/xml2/xml2.pro3
-rw-r--r--configure.json4
-rw-r--r--configure.pri24
-rw-r--r--examples/webengine/minimal/main.cpp1
-rw-r--r--examples/webengine/quicknanobrowser/BrowserWindow.qml59
-rw-r--r--examples/webengine/quicknanobrowser/FindBar.qml146
-rw-r--r--examples/webengine/quicknanobrowser/quicknanobrowser.pro1
-rw-r--r--examples/webengine/quicknanobrowser/resources.qrc1
-rw-r--r--examples/webenginewidgets/simplebrowser/browserwindow.cpp20
-rw-r--r--examples/webenginewidgets/simplebrowser/browserwindow.h1
-rw-r--r--examples/webenginewidgets/simplebrowser/downloadwidget.cpp3
-rw-r--r--examples/webenginewidgets/simplebrowser/downloadwidget.h4
-rw-r--r--examples/webenginewidgets/simplebrowser/tabwidget.cpp4
-rw-r--r--examples/webenginewidgets/simplebrowser/tabwidget.h1
-rw-r--r--examples/webenginewidgets/simplebrowser/webpage.cpp42
-rw-r--r--examples/webenginewidgets/simplebrowser/webpopupwindow.cpp2
-rw-r--r--mkspecs/features/configure.prf103
-rw-r--r--mkspecs/features/functions.prf105
-rw-r--r--mkspecs/features/platform.prf5
-rw-r--r--qtwebengine.pro15
m---------src/3rdparty0
-rw-r--r--src/buildtools/config/common.pri (renamed from src/core/config/common.pri)22
-rw-r--r--src/buildtools/config/functions.pri (renamed from src/core/config/functions.pri)0
-rw-r--r--src/buildtools/config/linux.pri (renamed from src/core/config/linux.pri)0
-rw-r--r--src/buildtools/config/mac_osx.pri (renamed from src/core/config/mac_osx.pri)0
-rw-r--r--src/buildtools/config/windows.pri (renamed from src/core/config/windows.pri)2
-rw-r--r--src/buildtools/configure.json716
-rw-r--r--src/buildtools/gn.pro4
-rw-r--r--src/buildtools/ninja.pro4
-rw-r--r--src/core/api/core_api.pro2
-rw-r--r--src/core/api/qwebenginefindtextresult.cpp116
-rw-r--r--src/core/api/qwebenginefindtextresult.h81
-rw-r--r--src/core/api/qwebengineurlrequestinfo.cpp12
-rw-r--r--src/core/certificate_error_controller.cpp12
-rw-r--r--src/core/certificate_error_controller.h2
-rw-r--r--src/core/certificate_error_controller_p.h1
-rw-r--r--src/core/compositor/compositor_resource_fence.cpp8
-rw-r--r--src/core/compositor/compositor_resource_fence.h2
-rw-r--r--src/core/compositor/display_consumer.h62
-rw-r--r--src/core/compositor/display_frame_sink.cpp140
-rw-r--r--src/core/compositor/display_frame_sink.h77
-rw-r--r--src/core/compositor/display_gl_output_surface.cpp292
-rw-r--r--src/core/compositor/display_gl_output_surface.h148
-rw-r--r--src/core/compositor/display_gl_output_surface_qsg.cpp121
-rw-r--r--src/core/compositor/display_overrides.cpp80
-rw-r--r--src/core/compositor/display_producer.h69
-rw-r--r--src/core/compositor/display_software_output_surface.cpp173
-rw-r--r--src/core/compositor/display_software_output_surface.h62
-rw-r--r--src/core/configure.json587
-rw-r--r--src/core/core_chromium.pri13
-rw-r--r--src/core/core_common.pri3
-rw-r--r--src/core/core_module.pro2
-rw-r--r--src/core/delegated_frame_host_client_qt.cpp91
-rw-r--r--src/core/delegated_frame_host_client_qt.h73
-rw-r--r--src/core/favicon_manager.h2
-rw-r--r--src/core/find_text_helper.cpp171
-rw-r--r--src/core/find_text_helper.h102
-rw-r--r--src/core/gn_run.pro3
-rw-r--r--src/core/pref_service_adapter.h6
-rw-r--r--src/core/profile_io_data_qt.cpp37
-rw-r--r--src/core/profile_io_data_qt.h7
-rw-r--r--src/core/render_widget_host_view_qt.cpp191
-rw-r--r--src/core/render_widget_host_view_qt.h32
-rw-r--r--src/core/type_conversion.cpp19
-rw-r--r--src/core/type_conversion.h7
-rw-r--r--src/core/web_contents_adapter.cpp52
-rw-r--r--src/core/web_contents_adapter.h5
-rw-r--r--src/core/web_contents_adapter_client.h3
-rw-r--r--src/core/web_contents_delegate_qt.cpp27
-rw-r--r--src/core/web_contents_delegate_qt.h9
-rw-r--r--src/core/web_engine_context.cpp29
-rw-r--r--src/core/web_event_factory.cpp14
-rw-r--r--src/process/support_win.cpp3
-rw-r--r--src/src.pro58
-rw-r--r--src/webengine/api/qquickwebengineview.cpp35
-rw-r--r--src/webengine/api/qquickwebengineview_p.h2
-rw-r--r--src/webengine/api/qquickwebengineview_p_p.h3
-rw-r--r--src/webengine/configure.json13
-rw-r--r--src/webengine/doc/src/webengineview_lgpl.qdoc43
-rw-r--r--src/webengine/plugin/plugin.cpp3
-rw-r--r--src/webenginewidgets/api/qwebenginecertificateerror.cpp109
-rw-r--r--src/webenginewidgets/api/qwebenginecertificateerror.h22
-rw-r--r--src/webenginewidgets/api/qwebenginedownloaditem.cpp21
-rw-r--r--src/webenginewidgets/api/qwebenginepage.cpp48
-rw-r--r--src/webenginewidgets/api/qwebenginepage.h3
-rw-r--r--src/webenginewidgets/api/qwebenginepage_p.h5
-rw-r--r--src/webenginewidgets/api/qwebengineprofile.cpp2
-rw-r--r--src/webenginewidgets/configure.json28
-rw-r--r--src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc7
-rw-r--r--src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc2
-rw-r--r--src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc2
-rw-r--r--tests/auto/auto.pro8
-rw-r--r--tests/auto/quick/dialogs/BLACKLIST6
-rw-r--r--tests/auto/quick/publicapi/tst_publicapi.cpp5
-rw-r--r--tests/auto/quick/qmltests/data/tst_download.qml21
-rw-r--r--tests/auto/quick/qmltests/data/tst_findText.qml84
-rw-r--r--tests/auto/shared/https.pri4
-rw-r--r--tests/auto/shared/httpserver.cpp31
-rw-r--r--tests/auto/shared/httpserver.h13
-rw-r--r--tests/auto/shared/httpsserver.h81
-rw-r--r--tests/auto/shared/httpsserver.qrc6
-rw-r--r--tests/auto/shared/resources/cert.pem64
-rw-r--r--tests/auto/shared/resources/key.pem27
-rw-r--r--tests/auto/widgets/certificateerror/certificateerror.pro3
-rw-r--r--tests/auto/widgets/certificateerror/tst_certificateerror.cpp126
-rw-r--r--tests/auto/widgets/qwebenginepage/BLACKLIST3
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp136
-rw-r--r--tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp17
-rw-r--r--tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp83
-rw-r--r--tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp2
-rw-r--r--tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp25
-rw-r--r--tests/auto/widgets/widgets.pro1
-rw-r--r--tests/manual/widgets/webgl/main.cpp6
-rw-r--r--tests/tests.pro6
129 files changed, 4351 insertions, 1374 deletions
diff --git a/config.tests/alsa/alsa.pro b/config.tests/alsa/alsa.pro
deleted file mode 100644
index 7322b6fb8..000000000
--- a/config.tests/alsa/alsa.pro
+++ /dev/null
@@ -1,2 +0,0 @@
-SOURCES = alsatest.cpp
-
diff --git a/config.tests/alsa/alsatest.cpp b/config.tests/alsa/alsatest.cpp
deleted file mode 100644
index 0b0ca71ec..000000000
--- a/config.tests/alsa/alsatest.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <alsa/asoundlib.h>
-#if SND_LIB_VERSION < 0x1000a // 1.0.10
-#error "Alsa version found too old, require >= 1.0.10"
-#endif
-
-int main(int argc, char **argv)
-{
-}
-
diff --git a/config.tests/glibc/glibc.cpp b/config.tests/glibc/glibc.cpp
deleted file mode 100644
index e78994b64..000000000
--- a/config.tests/glibc/glibc.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <features.h>
-
-#if __GLIBC__ < 2 || __GLIBC_MINOR__ < 27
-#error glibc versions below 2.27 are not supported
-#endif
-
-int main(int , char **) {
- return 0;
-}
-
diff --git a/config.tests/glibc/glibc.pro b/config.tests/glibc/glibc.pro
deleted file mode 100644
index f72bfb804..000000000
--- a/config.tests/glibc/glibc.pro
+++ /dev/null
@@ -1,5 +0,0 @@
-TARGET = glibc
-SOURCES = glibc.cpp
-CONFIG -= qt
-CONFIG += console
-
diff --git a/config.tests/khr/khr.cpp b/config.tests/khr/khr.cpp
deleted file mode 100644
index df81bd6b2..000000000
--- a/config.tests/khr/khr.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <KHR/khrplatform.h>
-
-int main(int, char **)
-{
- return 0;
-}
diff --git a/config.tests/khr/khr.pro b/config.tests/khr/khr.pro
deleted file mode 100644
index b8e935f5a..000000000
--- a/config.tests/khr/khr.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-!isEmpty(QMAKE_INCDIR_EGL): INCLUDEPATH += $$QMAKE_INCDIR_EGL
-!isEmpty(QMAKE_INCDIR_OPENGL): INCLUDEPATH += $$QMAKE_INCDIR_OPENGL
-
-CONFIG-=qt
-
-linux:SOURCES += khr.cpp
diff --git a/config.tests/libvpx/libvpx.cpp b/config.tests/libvpx/libvpx.cpp
deleted file mode 100644
index 06c34476b..000000000
--- a/config.tests/libvpx/libvpx.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <vpx/vpx_encoder.h>
-
-int main(int, char **)
-{
- vpx_codec_cx_pkt pkt;
- // Members added (as ints) by
- // https://chromium-review.googlesource.com/c/webm/libvpx/+/798222
- // And changed to int arrays by
- // https://chromium-review.googlesource.com/c/webm/libvpx/+/879089
- pkt.data.frame.width[0] = 0u;
- pkt.data.frame.height[0] = 0u;
- return 0;
-}
diff --git a/config.tests/libvpx/libvpx.pro b/config.tests/libvpx/libvpx.pro
deleted file mode 100644
index 13ce13647..000000000
--- a/config.tests/libvpx/libvpx.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-SOURCES += libvpx.cpp
-CONFIG += link_pkgconfig
-PKGCONFIG += vpx
-CONFIG -= qt
diff --git a/config.tests/re2/re2.cpp b/config.tests/re2/re2.cpp
deleted file mode 100644
index bd3b80a82..000000000
--- a/config.tests/re2/re2.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/****************************************************************************
-**
-** 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:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <re2/re2.h>
-
-int main(int, char **)
-{
- std::string s("dummytest");
- RE2 re2(s);
- return 0;
-}
diff --git a/config.tests/re2/re2.pro b/config.tests/re2/re2.pro
deleted file mode 100644
index b1a26d918..000000000
--- a/config.tests/re2/re2.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-SOURCES += re2.cpp
-LIBS += -lre2
-CONFIG -= qt
diff --git a/config.tests/snappy/snappy.cpp b/config.tests/snappy/snappy.cpp
deleted file mode 100644
index d52c73bd0..000000000
--- a/config.tests/snappy/snappy.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <snappy.h>
-
-int main(int, char **)
-{
- snappy::Source* src = 0;
- snappy::Sink* sink = 0;
- return 0;
-}
diff --git a/config.tests/snappy/snappy.pro b/config.tests/snappy/snappy.pro
deleted file mode 100644
index 890174a13..000000000
--- a/config.tests/snappy/snappy.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-linux:SOURCES += snappy.cpp
-LIBS += -lsnappy
-CONFIG -= qt
diff --git a/config.tests/winversion/winversion.cpp b/config.tests/winversion/winversion.cpp
deleted file mode 100644
index e9a4cff59..000000000
--- a/config.tests/winversion/winversion.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/****************************************************************************
-**
-** 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:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#if !defined(__clang__) && _MSC_FULL_VER < 191426428
-#error unsupported Visual Studio version
-#endif
-
-int main(int, char **)
-{
- return 0;
-}
diff --git a/config.tests/winversion/winversion.pro b/config.tests/winversion/winversion.pro
deleted file mode 100644
index dc501a2f6..000000000
--- a/config.tests/winversion/winversion.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-CONFIG-=qt
-CONFIG+=console
-win32: SOURCES += winversion.cpp
diff --git a/config.tests/xml2/xml2.cpp b/config.tests/xml2/xml2.cpp
deleted file mode 100644
index 497653d9c..000000000
--- a/config.tests/xml2/xml2.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 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:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <libxml/xmlversion.h>
-#if !defined(LIBXML_ICU_ENABLED)
-#error "libxml icu not enabled"
-#endif
-
-int main(int argc, char **argv)
-{
-}
-
diff --git a/config.tests/xml2/xml2.pro b/config.tests/xml2/xml2.pro
deleted file mode 100644
index 6fad45f2f..000000000
--- a/config.tests/xml2/xml2.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-SOURCES = xml2.cpp
-CONFIG += link_pkgconfig
-PKGCONFIG += libxml-2.0
diff --git a/configure.json b/configure.json
index 60b7342f7..8caad24f0 100644
--- a/configure.json
+++ b/configure.json
@@ -1,6 +1,8 @@
{
"subconfigs": [
+ "src/buildtools",
"src/core",
- "src/webengine"
+ "src/webengine",
+ "src/webenginewidgets"
]
}
diff --git a/configure.pri b/configure.pri
index 23f72c5c6..eff7d8f61 100644
--- a/configure.pri
+++ b/configure.pri
@@ -1,4 +1,4 @@
-include(src/core/config/functions.pri)
+include(src/buildtools/config/functions.pri)
# this must be done outside any function
QTWEBENGINE_SOURCE_TREE = $$PWD
@@ -22,6 +22,26 @@ defineTest(isPythonVersionSupported) {
return(false)
}
+defineTest(qtConfTest_detectJumboBuild) {
+ mergeLimit = $$eval(config.input.merge_limit)
+ mergeLimit = $$find(mergeLimit, "\\d")
+ isEmpty(mergeLimit): mergeLimit = 0
+ qtLog("Setting jumbo build merge batch limit to $${mergeLimit}.")
+ $${1}.merge_limit = $$mergeLimit
+ export($${1}.merge_limit)
+ $${1}.cache += merge_limit
+ export($${1}.cache)
+
+ return(true)
+}
+
+defineTest(qtConfReport_jumboBuild) {
+ mergeLimit = $$eval(config.input.merge_limit)
+ mergeLimit = $$find(mergeLimit, "\d")
+ isEmpty(mergeLimit): mergeLimit = "no"
+ qtConfReportPadded($${1}, $$mergeLimit)
+}
+
defineTest(qtConfTest_detectPython2) {
python = $$qtConfFindInPath("python2$$EXE_SUFFIX")
isEmpty(python) {
@@ -120,7 +140,7 @@ defineTest(qtConfTest_detectGn) {
return(false)
}
-defineTest(qtConfTest_embedded) {
+defineTest(qtConfTest_detectEmbedded) {
lessThan(QT_MINOR_VERSION, 9) {
cross_compile: return(true)
return(false)
diff --git a/examples/webengine/minimal/main.cpp b/examples/webengine/minimal/main.cpp
index 9db6ea6aa..8bcd0e0e9 100644
--- a/examples/webengine/minimal/main.cpp
+++ b/examples/webengine/minimal/main.cpp
@@ -56,6 +56,7 @@ int main(int argc, char *argv[])
{
QCoreApplication::setOrganizationName("QtExamples");
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+ QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
QGuiApplication app(argc, argv);
QtWebEngine::initialize();
diff --git a/examples/webengine/quicknanobrowser/BrowserWindow.qml b/examples/webengine/quicknanobrowser/BrowserWindow.qml
index 088b23e59..39a13df59 100644
--- a/examples/webengine/quicknanobrowser/BrowserWindow.qml
+++ b/examples/webengine/quicknanobrowser/BrowserWindow.qml
@@ -57,7 +57,7 @@ import QtQuick.Controls.Styles 1.0
import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.0
import QtQuick.Window 2.1
-import QtWebEngine 1.10
+import QtWebEngine 1.11
ApplicationWindow {
id: browserWindow
@@ -73,6 +73,10 @@ ApplicationWindow {
// Make sure the Qt.WindowFullscreenButtonHint is set on OS X.
Component.onCompleted: flags = flags | Qt.WindowFullscreenButtonHint
+ onCurrentWebViewChanged: {
+ findBar.reset();
+ }
+
// Create a styleItem to determine the platform.
// When using style "mac", ToolButtons are not supposed to accept focus.
QQCPrivate.StyleItem { id: styleItem }
@@ -136,6 +140,9 @@ ApplicationWindow {
fullScreenNotification.hide();
currentWebView.triggerWebAction(WebEngineView.ExitFullScreen);
}
+
+ if (findBar.visible)
+ findBar.visible = false;
}
}
Action {
@@ -187,6 +194,21 @@ ApplicationWindow {
shortcut: StandardKey.Forward
onTriggered: currentWebView.triggerWebAction(WebEngineView.Forward)
}
+ Action {
+ shortcut: StandardKey.Find
+ onTriggered: {
+ if (!findBar.visible)
+ findBar.visible = true;
+ }
+ }
+ Action {
+ shortcut: StandardKey.FindNext
+ onTriggered: findBar.findNext()
+ }
+ Action {
+ shortcut: StandardKey.FindPrevious
+ onTriggered: findBar.findPrevious()
+ }
toolBar: ToolBar {
id: navigationBar
@@ -553,6 +575,19 @@ ApplicationWindow {
selection.certificates[0].select();
}
+ onFindTextFinished: function(result) {
+ if (!findBar.visible)
+ findBar.visible = true;
+
+ findBar.numberOfMatches = result.numberOfMatches;
+ findBar.activeMatchOrdinal = result.activeMatchOrdinal;
+ }
+
+ onLoadingChanged: function(loadRequest) {
+ if (loadRequest.status == WebEngineView.LoadStartedStatus)
+ findBar.reset();
+ }
+
Timer {
id: reloadTimer
interval: 0
@@ -625,6 +660,28 @@ ApplicationWindow {
download.accept();
}
+ FindBar {
+ id: findBar
+ visible: false
+ anchors.right: parent.right
+ anchors.rightMargin: 10
+ anchors.top: parent.top
+
+ onFindNext: {
+ if (text)
+ currentWebView && currentWebView.findText(text);
+ else if (!visible)
+ visible = true;
+ }
+ onFindPrevious: {
+ if (text)
+ currentWebView && currentWebView.findText(text, WebEngineView.FindBackward);
+ else if (!visible)
+ visible = true;
+ }
+ }
+
+
Rectangle {
id: statusBubble
color: "oldlace"
diff --git a/examples/webengine/quicknanobrowser/FindBar.qml b/examples/webengine/quicknanobrowser/FindBar.qml
new file mode 100644
index 000000000..2d673592a
--- /dev/null
+++ b/examples/webengine/quicknanobrowser/FindBar.qml
@@ -0,0 +1,146 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.5
+import QtQuick.Controls 1.4
+import QtQuick.Controls.Styles 1.4
+import QtQuick.Layouts 1.0
+
+Rectangle {
+ id: root
+
+ property int numberOfMatches: 0
+ property int activeMatchOrdinal: 0
+ property alias text: findTextField.text
+
+ function reset() {
+ numberOfMatches = 0;
+ activeMatchOrdinal = 0;
+ visible = false;
+ }
+
+ signal findNext()
+ signal findPrevious()
+
+ width: 250
+ height: 35
+ radius: 2
+
+ border.width: 1
+ border.color: "black"
+ color: "white"
+
+ onVisibleChanged: {
+ if (visible)
+ findTextField.forceActiveFocus();
+ }
+
+
+ RowLayout {
+ anchors.fill: parent
+ anchors.topMargin: 5
+ anchors.bottomMargin: 5
+ anchors.leftMargin: 10
+ anchors.rightMargin: 10
+
+ spacing: 5
+
+ Rectangle {
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+
+ TextField {
+ id: findTextField
+ anchors.fill: parent
+
+ style: TextFieldStyle {
+ background: Rectangle {
+ color: "transparent"
+ }
+ }
+
+ onAccepted: root.findNext()
+ onTextChanged: root.findNext()
+ onActiveFocusChanged: activeFocus ? selectAll() : deselect()
+ }
+ }
+
+ Label {
+ text: activeMatchOrdinal + "/" + numberOfMatches
+ visible: findTextField.text != ""
+ }
+
+ Rectangle {
+ border.width: 1
+ border.color: "#ddd"
+ width: 2
+ height: parent.height
+ anchors.topMargin: 5
+ anchors.bottomMargin: 5
+ }
+
+ ToolButton {
+ text: "<"
+ enabled: numberOfMatches > 0
+ onClicked: root.findPrevious()
+ }
+
+ ToolButton {
+ text: ">"
+ enabled: numberOfMatches > 0
+ onClicked: root.findNext()
+ }
+
+ ToolButton {
+ text: "x"
+ onClicked: root.visible = false
+ }
+ }
+}
diff --git a/examples/webengine/quicknanobrowser/quicknanobrowser.pro b/examples/webengine/quicknanobrowser/quicknanobrowser.pro
index 5a27f5fd4..922cf79e2 100644
--- a/examples/webengine/quicknanobrowser/quicknanobrowser.pro
+++ b/examples/webengine/quicknanobrowser/quicknanobrowser.pro
@@ -10,6 +10,7 @@ OTHER_FILES += ApplicationRoot.qml \
BrowserDialog.qml \
BrowserWindow.qml \
DownloadView.qml \
+ FindBar.qml \
FullScreenNotification.qml
RESOURCES += resources.qrc
diff --git a/examples/webengine/quicknanobrowser/resources.qrc b/examples/webengine/quicknanobrowser/resources.qrc
index c6270897d..50ea05f5e 100644
--- a/examples/webengine/quicknanobrowser/resources.qrc
+++ b/examples/webengine/quicknanobrowser/resources.qrc
@@ -4,6 +4,7 @@
<file>BrowserDialog.qml</file>
<file>BrowserWindow.qml</file>
<file>DownloadView.qml</file>
+ <file>FindBar.qml</file>
<file>FullScreenNotification.qml</file>
</qresource>
<qresource prefix="icons">
diff --git a/examples/webenginewidgets/simplebrowser/browserwindow.cpp b/examples/webenginewidgets/simplebrowser/browserwindow.cpp
index 5d00cd19a..7b167ded7 100644
--- a/examples/webenginewidgets/simplebrowser/browserwindow.cpp
+++ b/examples/webenginewidgets/simplebrowser/browserwindow.cpp
@@ -66,6 +66,7 @@
#include <QStatusBar>
#include <QToolBar>
#include <QVBoxLayout>
+#include <QWebEngineFindTextResult>
#include <QWebEngineProfile>
BrowserWindow::BrowserWindow(Browser *browser, QWebEngineProfile *profile, bool forDevTools)
@@ -99,7 +100,7 @@ BrowserWindow::BrowserWindow(Browser *browser, QWebEngineProfile *profile, bool
QWidget *centralWidget = new QWidget(this);
QVBoxLayout *layout = new QVBoxLayout;
layout->setSpacing(0);
- layout->setMargin(0);
+ layout->setContentsMargins(0, 0, 0, 0);
if (!forDevTools) {
addToolBarBreak();
@@ -129,6 +130,7 @@ BrowserWindow::BrowserWindow(Browser *browser, QWebEngineProfile *profile, bool
connect(m_urlLineEdit, &QLineEdit::returnPressed, [this]() {
m_tabWidget->setUrl(QUrl::fromUserInput(m_urlLineEdit->text()));
});
+ connect(m_tabWidget, &TabWidget::findTextFinished, this, &BrowserWindow::handleFindTextFinished);
QAction *focusUrlLineEditAction = new QAction(this);
addAction(focusUrlLineEditAction);
@@ -460,10 +462,7 @@ void BrowserWindow::handleFindActionTriggered()
m_lastSearch, &ok);
if (ok && !search.isEmpty()) {
m_lastSearch = search;
- currentTab()->findText(m_lastSearch, 0, [this](bool found) {
- if (!found)
- statusBar()->showMessage(tr("\"%1\" not found.").arg(m_lastSearch));
- });
+ currentTab()->findText(m_lastSearch);
}
}
@@ -526,3 +525,14 @@ void BrowserWindow::handleDevToolsRequested(QWebEnginePage *source)
source->setDevToolsPage(m_browser->createDevToolsWindow()->currentTab()->page());
source->triggerAction(QWebEnginePage::InspectElement);
}
+
+void BrowserWindow::handleFindTextFinished(const QWebEngineFindTextResult &result)
+{
+ if (result.numberOfMatches() == 0) {
+ statusBar()->showMessage(tr("\"%1\" not found.").arg(m_lastSearch));
+ } else {
+ statusBar()->showMessage(tr("\"%1\" found: %2/%3").arg(m_lastSearch,
+ QString::number(result.activeMatchOrdinal()),
+ QString::number(result.numberOfMatches())));
+ }
+}
diff --git a/examples/webenginewidgets/simplebrowser/browserwindow.h b/examples/webenginewidgets/simplebrowser/browserwindow.h
index 8f328b751..11a655469 100644
--- a/examples/webenginewidgets/simplebrowser/browserwindow.h
+++ b/examples/webenginewidgets/simplebrowser/browserwindow.h
@@ -88,6 +88,7 @@ private slots:
void handleWebViewTitleChanged(const QString &title);
void handleWebActionEnabledChanged(QWebEnginePage::WebAction action, bool enabled);
void handleDevToolsRequested(QWebEnginePage *source);
+ void handleFindTextFinished(const QWebEngineFindTextResult &result);
private:
QMenu *createFileMenu(TabWidget *tabWidget);
diff --git a/examples/webenginewidgets/simplebrowser/downloadwidget.cpp b/examples/webenginewidgets/simplebrowser/downloadwidget.cpp
index 835a901c6..ddddc5e5d 100644
--- a/examples/webenginewidgets/simplebrowser/downloadwidget.cpp
+++ b/examples/webenginewidgets/simplebrowser/downloadwidget.cpp
@@ -57,8 +57,9 @@
DownloadWidget::DownloadWidget(QWebEngineDownloadItem *download, QWidget *parent)
: QFrame(parent)
, m_download(download)
- , m_timeAdded(QTime::currentTime())
+ , m_timeAdded()
{
+ m_timeAdded.start();
setupUi(this);
m_dstName->setText(m_download->downloadFileName());
m_srcUrl->setText(m_download->url().toDisplayString());
diff --git a/examples/webenginewidgets/simplebrowser/downloadwidget.h b/examples/webenginewidgets/simplebrowser/downloadwidget.h
index c08b298bc..c20676aa6 100644
--- a/examples/webenginewidgets/simplebrowser/downloadwidget.h
+++ b/examples/webenginewidgets/simplebrowser/downloadwidget.h
@@ -54,7 +54,7 @@
#include "ui_downloadwidget.h"
#include <QFrame>
-#include <QTime>
+#include <QElapsedTimer>
QT_BEGIN_NAMESPACE
class QWebEngineDownloadItem;
@@ -80,7 +80,7 @@ private:
QString withUnit(qreal bytes);
QWebEngineDownloadItem *m_download;
- QTime m_timeAdded;
+ QElapsedTimer m_timeAdded;
};
#endif // DOWNLOADWIDGET_H
diff --git a/examples/webenginewidgets/simplebrowser/tabwidget.cpp b/examples/webenginewidgets/simplebrowser/tabwidget.cpp
index 369bebfd9..3b6d84ebe 100644
--- a/examples/webenginewidgets/simplebrowser/tabwidget.cpp
+++ b/examples/webenginewidgets/simplebrowser/tabwidget.cpp
@@ -200,6 +200,10 @@ void TabWidget::setupView(WebView *webView)
closeTab(index);
});
connect(webView, &WebView::devToolsRequested, this, &TabWidget::devToolsRequested);
+ connect(webPage, &QWebEnginePage::findTextFinished, [this, webView](const QWebEngineFindTextResult &result) {
+ if (currentIndex() == indexOf(webView))
+ emit findTextFinished(result);
+ });
}
WebView *TabWidget::createTab()
diff --git a/examples/webenginewidgets/simplebrowser/tabwidget.h b/examples/webenginewidgets/simplebrowser/tabwidget.h
index bf83781df..fba61d44f 100644
--- a/examples/webenginewidgets/simplebrowser/tabwidget.h
+++ b/examples/webenginewidgets/simplebrowser/tabwidget.h
@@ -78,6 +78,7 @@ signals:
void favIconChanged(const QIcon &icon);
void webActionEnabledChanged(QWebEnginePage::WebAction action, bool enabled);
void devToolsRequested(QWebEnginePage *source);
+ void findTextFinished(const QWebEngineFindTextResult &result);
public slots:
// current tab/page slots
diff --git a/examples/webenginewidgets/simplebrowser/webpage.cpp b/examples/webenginewidgets/simplebrowser/webpage.cpp
index 99849c77d..2e49f651f 100644
--- a/examples/webenginewidgets/simplebrowser/webpage.cpp
+++ b/examples/webenginewidgets/simplebrowser/webpage.cpp
@@ -57,6 +57,7 @@
#include <QAuthenticator>
#include <QMessageBox>
#include <QStyle>
+#include <QTimer>
#include <QWebEngineCertificateError>
WebPage::WebPage(QWebEngineProfile *profile, QObject *parent)
@@ -74,22 +75,33 @@ WebPage::WebPage(QWebEngineProfile *profile, QObject *parent)
bool WebPage::certificateError(const QWebEngineCertificateError &error)
{
QWidget *mainWindow = view()->window();
- if (error.isOverridable()) {
- QDialog dialog(mainWindow);
- dialog.setModal(true);
- dialog.setWindowFlags(dialog.windowFlags() & ~Qt::WindowContextHelpButtonHint);
- Ui::CertificateErrorDialog certificateDialog;
- certificateDialog.setupUi(&dialog);
- certificateDialog.m_iconLabel->setText(QString());
- QIcon icon(mainWindow->style()->standardIcon(QStyle::SP_MessageBoxWarning, 0, mainWindow));
- certificateDialog.m_iconLabel->setPixmap(icon.pixmap(32, 32));
- certificateDialog.m_errorLabel->setText(error.errorDescription());
- dialog.setWindowTitle(tr("Certificate Error"));
- return dialog.exec() == QDialog::Accepted;
- }
- QMessageBox::critical(mainWindow, tr("Certificate Error"), error.errorDescription());
- return false;
+ QWebEngineCertificateError deferredError = error;
+ deferredError.defer();
+
+ QTimer::singleShot(0, mainWindow, [mainWindow, error = std::move(deferredError)] () mutable {
+ if (!error.deferred()) {
+ QMessageBox::critical(mainWindow, tr("Certificate Error"), error.errorDescription());
+ } else {
+ QDialog dialog(mainWindow);
+ dialog.setModal(true);
+ dialog.setWindowFlags(dialog.windowFlags() & ~Qt::WindowContextHelpButtonHint);
+
+ Ui::CertificateErrorDialog certificateDialog;
+ certificateDialog.setupUi(&dialog);
+ certificateDialog.m_iconLabel->setText(QString());
+ QIcon icon(mainWindow->style()->standardIcon(QStyle::SP_MessageBoxWarning, 0, mainWindow));
+ certificateDialog.m_iconLabel->setPixmap(icon.pixmap(32, 32));
+ certificateDialog.m_errorLabel->setText(error.errorDescription());
+ dialog.setWindowTitle(tr("Certificate Error"));
+
+ if (dialog.exec() == QDialog::Accepted)
+ error.ignoreCertificateError();
+ else
+ error.rejectCertificate();
+ }
+ });
+ return true;
}
void WebPage::handleAuthenticationRequired(const QUrl &requestUrl, QAuthenticator *auth)
diff --git a/examples/webenginewidgets/simplebrowser/webpopupwindow.cpp b/examples/webenginewidgets/simplebrowser/webpopupwindow.cpp
index 19e3b0124..566723e1f 100644
--- a/examples/webenginewidgets/simplebrowser/webpopupwindow.cpp
+++ b/examples/webenginewidgets/simplebrowser/webpopupwindow.cpp
@@ -66,7 +66,7 @@ WebPopupWindow::WebPopupWindow(QWebEngineProfile *profile)
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
QVBoxLayout *layout = new QVBoxLayout;
- layout->setMargin(0);
+ layout->setContentsMargins(0, 0, 0, 0);
setLayout(layout);
layout->addWidget(m_urlLineEdit);
layout->addWidget(m_view);
diff --git a/mkspecs/features/configure.prf b/mkspecs/features/configure.prf
deleted file mode 100644
index cc84182b7..000000000
--- a/mkspecs/features/configure.prf
+++ /dev/null
@@ -1,103 +0,0 @@
-# Load configure.prf from qtbase first
-load(configure)
-load(functions)
-load(platform)
-
-defineTest(runConfigure) {
- !qtHaveModule(gui) {
- skipBuild("QtWebEngine requires QtGui.")
- return(false)
- }
-
- !exists(src/3rdparty/chromium) {
- skipBuild("Submodule qtwebengine-chromium does not exist. Run 'git submodule update --init'.")
- return(false)
- }
-
- WSPC = $$find(OUT_PWD, \\s)
- !isEmpty(WSPC) {
- skipBuild("QtWebEngine cannot be built in a path that contains whitespace characters.")
- return(false)
- }
-
- !isPlatformSupported() {
- # make sure we have skipBuildReason
- isEmpty(skipBuildReason): skipBuild("Unknow error. Platform unspported")
- return(false)
- }
-
- linux:contains(QT_CONFIG,no-pkg-config) {
- skipBuild("pkg-config is required")
- return(false)
- }
-
- include($$QTWEBENGINE_OUT_ROOT/src/core/qtwebenginecore-config.pri)
- QT_FOR_CONFIG += webenginecore-private
-
- !qtConfig(webengine-v8-snapshot-support):qtConfig(webengine-v8-snapshot) {
- skipBuild("V8 snapshot cannot be built. Most likely, the 32-bit host compiler does not work."\
- "Please make sure you have 32-bit devel environment installed, or "\
- "configure webengine with '-no-webengine-v8-snapshot'")
- return(false)
- }
-
- win32:!qtConfig(webengine-win-compiler64) {
- skipBuild("Required 64-bit cross-building or native toolchain could not be found.")
- return(false)
- }
-
- !qtConfig(webengine-gperf) {
- skipBuild("Required gperf could not be found.")
- return(false)
- }
- !qtConfig(webengine-bison) {
- skipBuild("Required bison could not be found.")
- return(false)
- }
- !qtConfig(webengine-flex) {
- skipBuild("Required flex could not be found.")
- return(false)
- }
- !qtConfig(webengine-python2) {
- skipBuild("A suitable version of python2 could not be found.")
- return(false)
- }
-
- sanitizer: !qtConfig(webengine-sanitizer) {
- skipBuild("Chosen sanitizer configuration is not supported. Check config.log for details or use -feature-webengine-sanitizer to force build with the chosen sanitizer configuration.")
- return(false);
- }
-
- linux {
-
- !qtConfig(webengine-host-pkg-config) {
- skipBuild("Host pkg-config is required")
- return(false)
- }
-
- !qtConfig(webengine-system-glibc) {
- skipBuild("A suitable version >= 2.27 of libc could not be found.")
- return(false)
- }
-
- QT_FOR_CONFIG += gui-private
-
- !qtConfig(webengine-system-khr) {
- skipBuild("khronos development headers appear to be missing (mesa/libegl1-mesa-dev)")
- return(false)
- }
-
- for(package, $$list("nss dbus fontconfig")) {
- !qtConfig(webengine-system-$$package) {
- skipBuild("A suitable version of $$package could not be found.")
- return(false)
- }
- }
-
- !qtConfig(webengine-embedded-build): qtConfig(xcb) : !qtConfig(webengine-ozone-x11) {
- skipBuild("Could not find all necessary libraries for qpa-xcb support")
- return(false)
- }
- }
-}
-
diff --git a/mkspecs/features/functions.prf b/mkspecs/features/functions.prf
index d3eda85b2..a301929dc 100644
--- a/mkspecs/features/functions.prf
+++ b/mkspecs/features/functions.prf
@@ -70,9 +70,9 @@ defineReplace(gnPath) {
}
defineReplace(gnArgs) {
- linux: include($$QTWEBENGINE_ROOT/src/core/config/linux.pri)
- macos: include($$QTWEBENGINE_ROOT/src/core/config/mac_osx.pri)
- win32: include($$QTWEBENGINE_ROOT/src/core/config/windows.pri)
+ linux: include($$QTWEBENGINE_ROOT/src/buildtools/config/linux.pri)
+ macos: include($$QTWEBENGINE_ROOT/src/buildtools/config/mac_osx.pri)
+ win32: include($$QTWEBENGINE_ROOT/src/buildtools/config/windows.pri)
isEmpty(gn_args): error(No gn_args found please make sure you have valid configuration.)
return($$gn_args)
}
@@ -96,16 +96,103 @@ defineReplace(gnOS) {
return(unknown)
}
-defineTest(isDeveloperBuild) {
- qtConfig(private_tests): return(true) # enabled for developer-build
- return(false)
-}
-
defineTest(skipBuild) {
- skipBuildReason = "$$skipBuildReason $${EOL}$$1"
+ isEmpty(skipBuildReason): skipBuildReason = $$1
+ else: skipBuildReason = "$$skipBuildReason $${EOL}$$1"
export(skipBuildReason)
}
+defineTest(isWebEngineCoreBuild) {
+ !qtHaveModule(gui) {
+ skipBuild("QtWebEngine requires QtGui.")
+ return(false)
+ }
+
+ !exists($$QTWEBENGINE_ROOT/src/3rdparty/chromium) {
+ skipBuild("Submodule qtwebengine-chromium does not exist. Run 'git submodule update --init'.")
+ return(false)
+ }
+
+ WSPC = $$find(OUT_PWD, \\s)
+ !isEmpty(WSPC) {
+ skipBuild("QtWebEngine cannot be built in a path that contains whitespace characters.")
+ return(false)
+ }
+
+ !isPlatformSupported() {
+ # make sure we have skipBuildReason
+ isEmpty(skipBuildReason): skipBuild("Unknow error. Platform unspported")
+ return(false)
+ }
+
+ linux:contains(QT_CONFIG,no-pkg-config) {
+ skipBuild("pkg-config is required")
+ return(false)
+ }
+
+ include($$QTWEBENGINE_OUT_ROOT/src/buildtools/qtbuildtools-config.pri)
+ QT_FOR_CONFIG += buildtools-private
+
+ win32:!qtConfig(webengine-win-compiler64) {
+ skipBuild("Required 64-bit cross-building or native toolchain could not be found.")
+ return(false)
+ }
+
+ !qtConfig(webengine-gperf) {
+ skipBuild("Required gperf could not be found.")
+ return(false)
+ }
+ !qtConfig(webengine-bison) {
+ skipBuild("Required bison could not be found.")
+ return(false)
+ }
+ !qtConfig(webengine-flex) {
+ skipBuild("Required flex could not be found.")
+ return(false)
+ }
+ !qtConfig(webengine-python2) {
+ skipBuild("A suitable version of python2 could not be found.")
+ return(false)
+ }
+
+ sanitizer: !qtConfig(webengine-sanitizer) {
+ skipBuild("Chosen sanitizer configuration is not supported. Check config.log for details or use -feature-webengine-sanitizer to force build with the chosen sanitizer configuration.")
+ return(false);
+ }
+
+ linux {
+
+ !qtConfig(webengine-host-pkg-config) {
+ skipBuild("Host pkg-config is required")
+ return(false)
+ }
+
+ !qtConfig(webengine-system-glibc) {
+ skipBuild("A suitable version >= 2.27 of libc could not be found.")
+ return(false)
+ }
+
+ QT_FOR_CONFIG += gui-private
+
+ !qtConfig(webengine-system-khr) {
+ skipBuild("khronos development headers appear to be missing (mesa/libegl1-mesa-dev)")
+ return(false)
+ }
+
+ for(package, $$list("nss dbus fontconfig")) {
+ !qtConfig(webengine-system-$$package) {
+ skipBuild("A suitable version of $$package could not be found.")
+ return(false)
+ }
+ }
+
+ qtConfig(xcb) : !qtConfig(webengine-ozone-x11) {
+ skipBuild("Could not find all necessary libraries for qpa-xcb support")
+ return(false)
+ }
+ }
+}
+
defineReplace(pkgConfigHostExecutable) {
wrapper_name = $$OUT_PWD/pkg-config-host_wrapper.sh
wrapper_cmd = $$QMAKE_PKG_CONFIG_HOST
diff --git a/mkspecs/features/platform.prf b/mkspecs/features/platform.prf
index ef1c86d39..97cf96a78 100644
--- a/mkspecs/features/platform.prf
+++ b/mkspecs/features/platform.prf
@@ -1,5 +1,5 @@
-include($$QTWEBENGINE_OUT_ROOT/src/core/qtwebenginecore-config.pri)
-QT_FOR_CONFIG += webenginecore-private
+include($$QTWEBENGINE_OUT_ROOT/src/buildtools/qtbuildtools-config.pri)
+QT_FOR_CONFIG += buildtools-private
defineTest(isQtMinimum) {
!equals(QT_MAJOR_VERSION, $$1): return(false)
@@ -24,6 +24,7 @@ defineTest(isPlatformSupported) {
}
isBuildingOnWin32() {
skipBuild("Qt WebEngine on Windows must be built on a 64-bit machine.")
+ return(false)
}
!msvc|intel_icl {
skipBuild("Qt WebEngine on Windows requires MSVC or Clang (MSVC mode).")
diff --git a/qtwebengine.pro b/qtwebengine.pro
index 620f451f1..6d4089b26 100644
--- a/qtwebengine.pro
+++ b/qtwebengine.pro
@@ -1,13 +1,6 @@
load(qt_parts)
-load(configure)
-
-runConfigure()
-
-!isEmpty(skipBuildReason) {
- SUBDIRS =
- log($${skipBuildReason}$${EOL})
- log(QtWebEngine will not be built.$${EOL})
-}
+load(functions)
+load(platform)
QMAKE_DISTCLEAN += .qmake.cache
@@ -20,3 +13,7 @@ OTHER_FILES = \
config.tests/snappy/* \
config.tests/re2/* \
mkspecs/features/*
+
+!isWebEngineCoreBuild():!isEmpty(skipBuildReason):!build_pass {
+ log(QtWebEngine will not be built. $${skipBuildReason} $${EOL})
+}
diff --git a/src/3rdparty b/src/3rdparty
-Subproject f5613a4bc321972b8f72654d4c4bc9ba0c36ffb
+Subproject feccbb4ea7fa685dcd013f5a3f6c14ea768636c
diff --git a/src/core/config/common.pri b/src/buildtools/config/common.pri
index edebdb33c..1a54f1559 100644
--- a/src/core/config/common.pri
+++ b/src/buildtools/config/common.pri
@@ -1,6 +1,7 @@
# Shared configuration for all our supported platforms
+include($$QTWEBENGINE_OUT_ROOT/src/buildtools/qtbuildtools-config.pri)
include($$QTWEBENGINE_OUT_ROOT/src/core/qtwebenginecore-config.pri)
-QT_FOR_CONFIG += webenginecore
+QT_FOR_CONFIG += buildtools-private webenginecore webenginecore-private
gn_args += \
use_qt=true \
@@ -28,10 +29,15 @@ gn_args += \
safe_browsing_mode=0 \
optimize_webui=false
-!win32: gn_args += \
- use_jumbo_build=true \
- jumbo_file_merge_limit=8 \
- jumbo_build_excluded="[\"browser\"]"
+greaterThan(QMAKE_JUMBO_MERGE_LIMIT,0) {
+ gn_args += \
+ use_jumbo_build=true \
+ jumbo_file_merge_limit=$$QMAKE_JUMBO_MERGE_LIMIT
+}
+
+!greaterThan(QMAKE_JUMBO_MERGE_LIMIT,8) {
+ gn_args += jumbo_build_excluded="[\"browser\"]"
+}
qtConfig(webengine-printing-and-pdf) {
gn_args += enable_basic_printing=true enable_print_preview=true
@@ -73,11 +79,11 @@ precompile_header {
gn_args += enable_precompiled_headers=false
}
-CONFIG(release, debug|release):!isDeveloperBuild() {
+CONFIG(release, debug|release):!qtConfig(webengine-developer-build) {
gn_args += is_official_build=true
} else {
gn_args += is_official_build=false
- !isDeveloperBuild(): gn_args += is_unsafe_developer_build=false
+ !qtConfig(webengine-developer-build): gn_args += is_unsafe_developer_build=false
}
CONFIG(release, debug|release) {
@@ -116,7 +122,7 @@ optimize_size: gn_args += optimize_for_size=true
sanitize_undefined: gn_args += is_ubsan=true is_ubsan_vptr=true
}
-qtConfig(webengine-v8-snapshot) {
+qtConfig(webengine-v8-snapshot):qtConfig(webengine-v8-snapshot-support) {
gn_args += v8_use_snapshot=true
} else {
gn_args += v8_use_snapshot=false
diff --git a/src/core/config/functions.pri b/src/buildtools/config/functions.pri
index 8c11faa16..8c11faa16 100644
--- a/src/core/config/functions.pri
+++ b/src/buildtools/config/functions.pri
diff --git a/src/core/config/linux.pri b/src/buildtools/config/linux.pri
index 998aedc40..998aedc40 100644
--- a/src/core/config/linux.pri
+++ b/src/buildtools/config/linux.pri
diff --git a/src/core/config/mac_osx.pri b/src/buildtools/config/mac_osx.pri
index 3f2fe9c0a..3f2fe9c0a 100644
--- a/src/core/config/mac_osx.pri
+++ b/src/buildtools/config/mac_osx.pri
diff --git a/src/core/config/windows.pri b/src/buildtools/config/windows.pri
index 385faeed0..dfa40e9dc 100644
--- a/src/core/config/windows.pri
+++ b/src/buildtools/config/windows.pri
@@ -22,7 +22,7 @@ clang_cl {
gn_args += is_clang=false use_lld=false
}
-isDeveloperBuild() {
+qtConfig(webengine-developer-build) {
gn_args += \
is_win_fastlink=true
diff --git a/src/buildtools/configure.json b/src/buildtools/configure.json
new file mode 100644
index 000000000..3fc342992
--- /dev/null
+++ b/src/buildtools/configure.json
@@ -0,0 +1,716 @@
+{
+ "module": "buildtools",
+ "depends": [
+ "core-private",
+ "gui-private",
+ "printsupport"
+ ],
+ "commandline": {
+ "options": {
+ "webengine-core": "boolean",
+ "webengine-jumbo-build": { "type": "optionalString", "name": "merge_limit"}
+ }
+ },
+ "libraries": {
+ "webengine-dbus": {
+ "label": "d-bus",
+ "sources": [
+ { "type": "pkgConfig", "args": "dbus-1" }
+ ]
+ },
+ "webengine-fontconfig": {
+ "label": "fontconfig",
+ "sources": [
+ { "type": "pkgConfig", "args": "fontconfig" }
+ ]
+ },
+ "webengine-libdrm": {
+ "label": "libdrm",
+ "sources": [
+ { "type": "pkgConfig", "args": "libdrm" }
+ ]
+ },
+ "webengine-xcomposite": {
+ "label": "xcomposite",
+ "sources": [
+ { "type": "pkgConfig", "args": "xcomposite" }
+ ]
+ },
+ "webengine-xcursor": {
+ "label": "xcursor",
+ "sources": [
+ { "type": "pkgConfig", "args": "xcursor" }
+ ]
+ },
+ "webengine-xi": {
+ "label": "xi",
+ "sources": [
+ { "type": "pkgConfig", "args": "xi" }
+ ]
+ },
+ "webengine-xtst": {
+ "label": "xtst",
+ "sources": [
+ { "type": "pkgConfig", "args": "xtst" }
+ ]
+ },
+ "webengine-nss": {
+ "label": "nss >= 3.26",
+ "sources": [
+ { "type": "pkgConfig", "args": "nss >= 3.26" }
+ ]
+ },
+ "webengine-x11" : {
+ "label" : "x11",
+ "sources": [
+ { "type": "pkgConfig", "args": "x11" }
+ ]
+ },
+ "webengine-glib": {
+ "label": "glib-2.0 >= 2.32.0",
+ "sources": [
+ { "type": "pkgConfig", "args": "glib-2.0 >= 2.32.0" }
+ ]
+ },
+ "webengine-harfbuzz": {
+ "label": "harfbuzz >= 2.2.0",
+ "sources": [
+ { "type": "pkgConfig", "args": "harfbuzz >= 2.2.0" }
+ ]
+ },
+ "webengine-jpeglib": {
+ "label": "compatible jpeglib",
+ "type": "compile",
+ "test": {
+ "head": [
+ "#include <cstdio>",
+ "#include <cstring>",
+ "extern \"C\" {",
+ " #include <jpeglib.h>",
+ "}"
+ ],
+ "main": [
+ "JDIMENSION dummy;",
+ "jpeg_crop_scanline(nullptr, &dummy, &dummy);",
+ "jpeg_skip_scanlines(nullptr, dummy);"
+ ]
+ },
+ "sources": [
+ { "type": "pkgConfig", "args": "libjpeg" },
+ "-ljpeg"
+ ]
+ },
+ "webengine-jsoncpp": {
+ "label": "jsoncpp",
+ "sources": [
+ { "type": "pkgConfig", "args": "jsoncpp" }
+ ]
+ },
+ "webengine-libevent": {
+ "label": "libevent",
+ "sources": [
+ { "type": "pkgConfig", "args": "libevent" }
+ ]
+ },
+ "webengine-minizip": {
+ "label": "minizip",
+ "sources": [
+ { "type": "pkgConfig", "args": "minizip" }
+ ]
+ },
+ "webengine-png": {
+ "label": "libpng >= 1.6.0",
+ "sources": [
+ { "type": "pkgConfig", "args": "libpng >= 1.6.0" }
+ ]
+ },
+ "webengine-protobuf": {
+ "label": "protobuf",
+ "sources": [
+ { "type": "pkgConfig", "args": "protobuf" }
+ ]
+ },
+ "webengine-zlib": {
+ "label": "zlib",
+ "sources": [
+ { "type": "pkgConfig", "args": "zlib" }
+ ]
+ },
+ "webengine-re2": {
+ "label": "re2",
+ "test" : {
+ "main": [
+ "std::string s;",
+ "RE2 re2(s);"
+ ]
+ },
+ "headers": "re2/re2.h",
+ "sources": [
+ { "type": "pkgConfig", "args": "re2" }
+ ]
+ },
+ "webengine-icu": {
+ "label": "icu >= 63",
+ "sources": [
+ { "type": "pkgConfig", "args": "icu-uc >= 63 icu-i18n >= 63" }
+ ]
+ },
+ "webengine-webp": {
+ "label": "libwebp, libwebpmux and libwebpdemux",
+ "sources": [
+ { "type": "pkgConfig", "args": "libwebp libwebpmux libwebpdemux" }
+ ]
+ },
+ "webengine-lcms2": {
+ "label": "lcms2",
+ "sources": [
+ { "type": "pkgConfig", "args": "lcms2" }
+ ]
+ },
+ "webengine-freetype": {
+ "label": "freetype >= 2.4.2",
+ "test": {
+ "head": [
+ "#include <ft2build.h>",
+ "#include FT_FREETYPE_H",
+ "#if ((FREETYPE_MAJOR*10000 + FREETYPE_MINOR*100 + FREETYPE_PATCH) < 20402)",
+ "# error This version of freetype is too old.",
+ "#endif"
+ ],
+ "main": [
+ "FT_Face ft_face = 0;",
+ "FT_Reference_Face(ft_face);"
+ ]
+ },
+ "sources": [
+ { "type": "pkgConfig", "args": "freetype2" }
+ ]
+ },
+ "webengine-libxml2": {
+ "label": "compatible libxml2 and libxslt",
+ "type": "compile",
+ "test": {
+ "tail": [
+ "#if !defined(LIBXML_ICU_ENABLED)",
+ "#error libxml icu not enabled",
+ "#endif"
+ ]
+ },
+ "headers": "libxml/xmlversion.h",
+ "sources": [
+ { "type": "pkgConfig", "args": "libxml-2.0 libxslt" }
+ ]
+ },
+ "webengine-libdrm": {
+ "label": "libdrm",
+ "sources": [
+ { "type": "pkgConfig", "args": "libdrm" }
+ ]
+ },
+ "webengine-xcomposite": {
+ "label": "xcomposite",
+ "sources": [
+ { "type": "pkgConfig", "args": "xcomposite" }
+ ]
+ },
+ "webengine-xcursor": {
+ "label": "xcursor",
+ "sources": [
+ { "type": "pkgConfig", "args": "xcursor" }
+ ]
+ },
+ "webengine-xi": {
+ "label": "xi",
+ "sources": [
+ { "type": "pkgConfig", "args": "xi" }
+ ]
+ },
+ "webengine-xtst": {
+ "label": "xtst",
+ "sources": [
+ { "type": "pkgConfig", "args": "xtst" }
+ ]
+ },
+ "webengine-ffmpeg": {
+ "label": "libavcodec libavformat libavutil",
+ "sources": [
+ { "type": "pkgConfig", "args": "libavcodec libavformat libavutil" }
+ ]
+ },
+ "webengine-opus": {
+ "label": "opus",
+ "sources": [
+ { "type": "pkgConfig", "args": "opus" }
+ ]
+ },
+ "webengine-snappy": {
+ "label": "snappy",
+ "test": {
+ "main": [
+ "snappy::Source *src = 0;",
+ "snappy::Sink *sink = 0;"
+ ]
+ },
+ "headers": "snappy.h",
+ "sources": [
+ "-lsnappy"
+ ]
+ },
+ "webengine-libvpx": {
+ "label": "libvpx",
+ "test": {
+ "main": [
+ "vpx_codec_cx_pkt pkt;",
+ "pkt.data.frame.width[0] = 0u;",
+ "pkt.data.frame.height[0] = 0u;"
+ ]
+ },
+ "headers": "vpx/vpx_encoder.h",
+ "sources": [
+ { "type": "pkgConfig", "args": "vpx" },
+ "-lvpx"
+ ]
+ }
+ },
+
+ "testDir": "config.tests",
+ "tests" : {
+ "webengine-bison": {
+ "label": "bison",
+ "type": "detectBison"
+ },
+ "webengine-flex": {
+ "label": "flex",
+ "type": "detectFlex"
+ },
+ "webengine-gn": {
+ "label": "system gn",
+ "type": "detectGn"
+ },
+ "webengine-glibc": {
+ "label": "glibc > 2.16",
+ "type": "compile",
+ "test": {
+ "include": "features.h",
+ "tail": [
+ "#if __GLIBC__ < 2 || __GLIBC_MINOR__ < 17",
+ "#error glibc versions below 2.17 are not supported",
+ "#endif"
+ ]
+ }
+ },
+ "webengine-gperf": {
+ "label": "gperf",
+ "type": "detectGperf"
+ },
+ "webengine-khr": {
+ "label": "khr",
+ "type": "compile",
+ "test": {
+ "include": "KHR/khrplatform.h",
+ "qmake" : [
+ "!isEmpty(QMAKE_INCDIR_EGL): INCLUDEPATH += $$QMAKE_INCDIR_EGL",
+ "!isEmpty(QMAKE_INCDIR_OPENGL): INCLUDEPATH += $$QMAKE_INCDIR_OPENGL"
+ ]
+ }
+ },
+ "webengine-ninja": {
+ "label": "system ninja",
+ "type": "detectNinja"
+ },
+ "webengine-python2": {
+ "label": "python2",
+ "type": "detectPython2",
+ "log": "location"
+ },
+ "webengine-winversion": {
+ "label": "winversion",
+ "type": "compile",
+ "test": {
+ "head" : [
+ "#if !defined(__clang__) && _MSC_FULL_VER < 191426428",
+ "#error unsupported Visual Studio version",
+ "#endif"
+ ]
+ }
+ },
+ "webengine-host-pkg-config": {
+ "label": "host pkg-config",
+ "type": "detectHostPkgConfig",
+ "log": "path"
+ },
+ "webengine-jumbo-build": {
+ "label": "jumbo build merge limit",
+ "type": "detectJumboBuild",
+ "log": "merge_limit"
+ },
+ "webengine-protoc": {
+ "label": "protoc",
+ "type": "detectProtoc"
+ },
+ "webengine-win-compiler64": {
+ "label": "64bit compiler",
+ "type": "isWindowsHostCompiler64"
+ }
+ },
+ "features": {
+ "webengine-core": {
+ "label": "Support Qt WebEngine Core",
+ "purpose": "Provides WebEngine Core support.",
+ "condition": "module.gui
+ && features.webengine-python2
+ && features.webengine-gperf
+ && features.webengine-bison
+ && features.webengine-flex
+ && (!features.xcb || features.webengine-ozone-x11)",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-python2": {
+ "label": "python2",
+ "condition": "tests.webengine-python2",
+ "output": [
+ "privateFeature",
+ { "type": "varAssign", "name": "QMAKE_PYTHON2", "value": "tests.webengine-python2.location" }
+ ]
+ },
+ "webengine-gperf": {
+ "label": "gperf",
+ "condition": "tests.webengine-gperf",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-bison": {
+ "label": "bison",
+ "condition": "tests.webengine-bison",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-flex": {
+ "label": "flex",
+ "condition": "tests.webengine-flex",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-system-ninja": {
+ "label": "Use System Ninja",
+ "condition": "tests.webengine-ninja",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-system-fontconfig": {
+ "label": "fontconfig",
+ "condition": "libs.webengine-fontconfig",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-system-dbus": {
+ "label": "dbus",
+ "condition": "libs.webengine-dbus",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-system-libdrm": {
+ "label": "libdrm",
+ "condition": "libs.webengine-libdrm",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-system-xcomposite": {
+ "label": "xcomposite",
+ "condition": "libs.webengine-xcomposite",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-system-xcursor": {
+ "label": "xcursor",
+ "condition": "libs.webengine-xcursor",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-system-xi": {
+ "label": "xi",
+ "condition": "libs.webengine-xi",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-system-xtst": {
+ "label": "xtst",
+ "condition": "libs.webengine-xtst",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-system-gn": {
+ "label": "Use System Gn",
+ "autoDetect": "false",
+ "condition": "tests.webengine-gn",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-system-khr" : {
+ "label": "khr",
+ "condition": "config.unix && tests.webengine-khr",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-system-nss": {
+ "label": "nss",
+ "condition": "config.unix && !config.darwin && libs.webengine-nss",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-system-glibc": {
+ "label": "glibc",
+ "condition": "config.linux && tests.webengine-glibc",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-system-x11" : {
+ "label": "x11",
+ "condition": "config.unix && libs.webengine-x11",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-host-pkg-config": {
+ "label": "host-pkg-config",
+ "condition": "config.unix && tests.webengine-host-pkg-config",
+ "output": [
+ "privateFeature",
+ { "type": "varAssign", "name": "QMAKE_PKG_CONFIG_HOST", "value": "tests.webengine-host-pkg-config.path" }
+ ]
+ },
+ "webengine-ozone-x11" : {
+ "label": "Support qpa-xcb",
+ "condition": "config.unix
+ && features.xcb
+ && features.webengine-system-x11
+ && features.webengine-system-libdrm
+ && features.webengine-system-xcomposite
+ && features.webengine-system-xcursor
+ && features.webengine-system-xi
+ && features.webengine-system-xtst",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-jumbo-build": {
+ "label": "jumbo build merge batch",
+ "condition": "tests.webengine-jumbo-build",
+ "output": [
+ "privateFeature",
+ { "type": "varAssign", "name": "QMAKE_JUMBO_MERGE_LIMIT", "value": "tests.webengine-jumbo-build.merge_limit" }
+ ]
+ },
+ "webengine-system-libdrm": {
+ "label": "libdrm",
+ "condition": "libs.webengine-libdrm",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-system-xcomposite": {
+ "label": "xcomposite",
+ "condition": "libs.webengine-xcomposite",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-system-xcursor": {
+ "label": "xcursor",
+ "condition": "libs.webengine-xcursor",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-system-xi": {
+ "label": "xi",
+ "condition": "libs.webengine-xi",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-system-xtst": {
+ "label": "xtst",
+ "condition": "libs.webengine-xtst",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-system-harfbuzz": {
+ "label": "harfbuzz",
+ "condition": "config.unix && features.system-harfbuzz && libs.webengine-harfbuzz",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-system-glib" : {
+ "label": "glib",
+ "condition": "config.unix && libs.webengine-glib",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-system-minizip" : {
+ "label": "minizip",
+ "condition": "config.unix && libs.webengine-minizip",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-system-zlib" : {
+ "label": "zlib",
+ "condition": "config.unix && features.system-zlib && libs.webengine-zlib",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-system-libevent" : {
+ "label": "libevent",
+ "condition": "config.unix && libs.webengine-libevent",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-system-jsoncpp" : {
+ "label": "jsoncpp",
+ "condition": "config.unix && libs.webengine-jsoncpp",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-system-protobuf" : {
+ "label": "protobuf",
+ "condition": "config.unix && libs.webengine-protobuf && tests.webengine-protoc",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-system-png" : {
+ "label": "png",
+ "condition": "config.unix && features.system-png && libs.webengine-png",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-system-jpeg" : {
+ "label": "JPEG",
+ "condition": "config.unix && features.system-jpeg && libs.webengine-jpeglib",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-system-re2": {
+ "label": "re2",
+ "condition": "config.unix && libs.webengine-re2",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-system-icu": {
+ "label": "icu",
+ "autoDetect": "false",
+ "condition": "libs.webengine-icu",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-system-libwebp": {
+ "label": "libwebp, libwebpmux and libwebpdemux",
+ "condition": "config.unix && libs.webengine-webp",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-system-opus": {
+ "label": "opus",
+ "condition": "config.unix && libs.webengine-opus",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-system-ffmpeg": {
+ "label": "ffmpeg",
+ "autoDetect": "false",
+ "condition": "libs.webengine-ffmpeg && features.webengine-system-opus && features.webengine-system-libwebp",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-system-libxml2": {
+ "label": "libxml2 and libxslt",
+ "condition": "config.unix && libs.webengine-libxml2",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-system-lcms2" : {
+ "label": "lcms2",
+ "condition": "config.unix && libs.webengine-lcms2",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-system-freetype" : {
+ "label": "freetype",
+ "condition": "config.unix && features.system-freetype && libs.webengine-freetype",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-system-libvpx" : {
+ "label": "libvpx",
+ "condition": "config.unix && libs.webengine-libvpx",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-system-snappy" : {
+ "label": "snappy",
+ "condition": "config.unix && libs.webengine-snappy",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-winversion" : {
+ "label": "winversion",
+ "condition": "config.win32 && tests.webengine-winversion",
+ "output": [ "privateFeature" ]
+ },
+ "webengine-win-compiler64": {
+ "label": "64bit compiler",
+ "condition": "config.win32 && tests.webengine-win-compiler64",
+ "output": [ "privateFeature" ]
+ }
+ },
+ "report": [
+ {
+ "type": "warning",
+ "condition": "!module.gui",
+ "message": "QtWebEngine requires QtGui."
+ },
+ {
+ "type": "warning",
+ "condition": "!features.webengine-python2",
+ "message": "Python version 2 (2.7.5 or later) is required to build QtWebEngine."
+ },
+ {
+ "type": "warning",
+ "condition": "!features.webengine-gperf",
+ "message": "gperf is required to build QtWebEngine."
+ },
+ {
+ "type": "warning",
+ "condition": "!features.webengine-bison",
+ "message": "bison is required to build QtWebEngine."
+ },
+ {
+ "type": "warning",
+ "condition": "!features.webengine-flex",
+ "message": "flex is required to build QtWebEngine."
+ },
+ {
+ "type": "warning",
+ "condition": "config.linux && !features.webengine-ozone-x11 && features.xcb",
+ "message": "Could not find all necessary libraries for qpa-xcb support."
+ },
+ {
+ "type": "warning",
+ "condition": "config.win32 && !features.webengine-win-compiler64",
+ "message": "64-bit cross-building or native toolchain is required to build QtWebEngine."
+ }
+ ],
+ "summary": [
+ {
+ "section": "Qt WebEngine Build Tools",
+ "entries": [
+ "webengine-system-ninja",
+ "webengine-system-gn",
+ {
+ "message": "Jumbo Build Merge Limit",
+ "type": "jumboBuild"
+ },
+ {
+ "section": "Required system libraries",
+ "condition": "config.unix && !config.macos && features.webengine-core",
+ "entries": [
+ "webengine-system-fontconfig",
+ "webengine-system-dbus",
+ "webengine-system-nss",
+ "webengine-system-khr",
+ "webengine-system-glibc"
+ ]
+ },
+ {
+ "section": "Required system libraries for qpa-xcb",
+ "condition": "config.unix && !config.macos && features.webengine-core",
+ "entries": [
+ "webengine-system-x11",
+ "webengine-system-libdrm",
+ "webengine-system-xcomposite",
+ "webengine-system-xcursor",
+ "webengine-system-xi",
+ "webengine-system-xtst"
+ ]
+ },
+ {
+ "section": "Optional system libraries used",
+ "condition": "config.unix",
+ "entries": [
+ "webengine-system-re2",
+ "webengine-system-icu",
+ "webengine-system-libwebp",
+ "webengine-system-opus",
+ "webengine-system-ffmpeg",
+ "webengine-system-libvpx",
+ "webengine-system-snappy",
+ "webengine-system-glib",
+ "webengine-system-zlib",
+ "webengine-system-minizip",
+ "webengine-system-libevent",
+ "webengine-system-jsoncpp",
+ "webengine-system-protobuf",
+ "webengine-system-libxml2",
+ "webengine-system-lcms2",
+ "webengine-system-png",
+ "webengine-system-jpeg",
+ "webengine-system-harfbuzz",
+ "webengine-system-freetype"
+ ]
+ }
+ ]
+ }
+ ]
+}
diff --git a/src/buildtools/gn.pro b/src/buildtools/gn.pro
index b6bf9cfc4..033202e6e 100644
--- a/src/buildtools/gn.pro
+++ b/src/buildtools/gn.pro
@@ -3,8 +3,8 @@ option(host_build)
!debug_and_release: CONFIG += release
-include($$QTWEBENGINE_OUT_ROOT/src/core/qtwebenginecore-config.pri)
-QT_FOR_CONFIG += webenginecore-private
+include($$QTWEBENGINE_OUT_ROOT/src/buildtools/qtbuildtools-config.pri)
+QT_FOR_CONFIG += buildtools-private
build_pass|!debug_and_release {
!qtConfig(webengine-system-gn): CONFIG(release, debug|release) {
diff --git a/src/buildtools/ninja.pro b/src/buildtools/ninja.pro
index 6382d6cfb..66a6d5aa6 100644
--- a/src/buildtools/ninja.pro
+++ b/src/buildtools/ninja.pro
@@ -2,8 +2,8 @@ TEMPLATE = aux
!debug_and_release: CONFIG += release
-include($$QTWEBENGINE_OUT_ROOT/src/core/qtwebenginecore-config.pri)
-QT_FOR_CONFIG += webenginecore-private
+include($$QTWEBENGINE_OUT_ROOT/src/buildtools/qtbuildtools-config.pri)
+QT_FOR_CONFIG += buildtools-private
build_pass|!debug_and_release {
!qtConfig(webengine-system-ninja): CONFIG(release, debug|release) {
diff --git a/src/core/api/core_api.pro b/src/core/api/core_api.pro
index 1c5f140e0..f14b4b01d 100644
--- a/src/core/api/core_api.pro
+++ b/src/core/api/core_api.pro
@@ -37,6 +37,7 @@ HEADERS = \
qtwebenginecoreglobal_p.h \
qwebenginecookiestore.h \
qwebenginecookiestore_p.h \
+ qwebenginefindtextresult.h \
qwebenginehttprequest.h \
qwebenginemessagepumpscheduler_p.h \
qwebenginenotification.h \
@@ -53,6 +54,7 @@ SOURCES = \
qtwebenginecoreglobal.cpp \
qwebengineclientcertificatestore.cpp \
qwebenginecookiestore.cpp \
+ qwebenginefindtextresult.cpp \
qwebenginehttprequest.cpp \
qwebenginemessagepumpscheduler.cpp \
qwebenginenotification.cpp \
diff --git a/src/core/api/qwebenginefindtextresult.cpp b/src/core/api/qwebenginefindtextresult.cpp
new file mode 100644
index 000000000..ce1be359e
--- /dev/null
+++ b/src/core/api/qwebenginefindtextresult.cpp
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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 "qwebenginefindtextresult.h"
+
+QT_BEGIN_NAMESPACE
+
+class QWebEngineFindTextResultPrivate : public QSharedData {
+public:
+ int numberOfMatches = 0;
+ int activeMatchOrdinal = 0;
+};
+
+/*!
+ \class QWebEngineFindTextResult
+ \brief The QWebEngineFindTextResult class encapsulates the result of a string search on a page.
+ \since 5.14
+
+ \inmodule QtWebEngineCore
+
+ Results are passed to the user in the
+ \l QWebEnginePage::findTextFinished() and
+ \l{WebEngineView::findTextFinished()}{WebEngineView.findTextFinished()} signals.
+*/
+
+/*! \internal
+*/
+QWebEngineFindTextResult::QWebEngineFindTextResult()
+ : d(new QWebEngineFindTextResultPrivate)
+{}
+
+/*! \internal
+*/
+QWebEngineFindTextResult::QWebEngineFindTextResult(int numberOfMatches, int activeMatchOrdinal)
+ : d(new QWebEngineFindTextResultPrivate)
+{
+ d->numberOfMatches = numberOfMatches;
+ d->activeMatchOrdinal = activeMatchOrdinal;
+}
+
+/*! \internal
+*/
+QWebEngineFindTextResult::QWebEngineFindTextResult(const QWebEngineFindTextResult &other)
+ : d(other.d)
+{}
+
+/*! \internal
+*/
+QWebEngineFindTextResult &QWebEngineFindTextResult::operator=(const QWebEngineFindTextResult &other)
+{
+ d = other.d;
+ return *this;
+}
+
+/*! \internal
+*/
+QWebEngineFindTextResult::~QWebEngineFindTextResult()
+{}
+
+/*!
+ \property QWebEngineFindTextResult::numberOfMatches
+ \brief The number of matches found.
+*/
+int QWebEngineFindTextResult::numberOfMatches() const
+{
+ return d->numberOfMatches;
+}
+
+/*!
+ \property QWebEngineFindTextResult::activeMatchOrdinal
+ \brief The index of the currently highlighted match.
+*/
+int QWebEngineFindTextResult::activeMatchOrdinal() const
+{
+ return d->activeMatchOrdinal;
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qwebenginefindtextresult.cpp"
diff --git a/src/core/api/qwebenginefindtextresult.h b/src/core/api/qwebenginefindtextresult.h
new file mode 100644
index 000000000..073a8135f
--- /dev/null
+++ b/src/core/api/qwebenginefindtextresult.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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$
+**
+****************************************************************************/
+
+#ifndef QWEBENGINEFINDTEXTRESULT_H
+#define QWEBENGINEFINDTEXTRESULT_H
+
+#include <QtWebEngineCore/qtwebenginecoreglobal.h>
+#include <QtCore/QObject>
+#include <QtCore/QSharedData>
+
+namespace QtWebEngineCore {
+class FindTextHelper;
+}
+
+QT_BEGIN_NAMESPACE
+
+class QWebEngineFindTextResultPrivate;
+
+class Q_WEBENGINECORE_EXPORT QWebEngineFindTextResult {
+ Q_GADGET
+ Q_PROPERTY(int numberOfMatches READ numberOfMatches CONSTANT FINAL)
+ Q_PROPERTY(int activeMatchOrdinal READ activeMatchOrdinal CONSTANT FINAL)
+
+public:
+ int numberOfMatches() const;
+ int activeMatchOrdinal() const;
+
+ QWebEngineFindTextResult();
+ QWebEngineFindTextResult(const QWebEngineFindTextResult &other);
+ QWebEngineFindTextResult &operator=(const QWebEngineFindTextResult &other);
+ ~QWebEngineFindTextResult();
+
+private:
+ QWebEngineFindTextResult(int numberOfMatches, int activeMatchOrdinal);
+
+ QSharedDataPointer<QWebEngineFindTextResultPrivate> d;
+
+ friend class QtWebEngineCore::FindTextHelper;
+};
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(QWebEngineFindTextResult)
+
+#endif // QWEBENGINEFINDTEXTRESULT_H
diff --git a/src/core/api/qwebengineurlrequestinfo.cpp b/src/core/api/qwebengineurlrequestinfo.cpp
index e2101fd02..2aa43a318 100644
--- a/src/core/api/qwebengineurlrequestinfo.cpp
+++ b/src/core/api/qwebengineurlrequestinfo.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtWebEngine module of the Qt Toolkit.
@@ -185,7 +185,9 @@ QWebEngineUrlRequestInfo::QWebEngineUrlRequestInfo(QWebEngineUrlRequestInfoPriva
\value ResourceTypeCspReport A report of Content Security Policy (CSP)
violations. CSP reports are in JSON format and they are delivered by
HTTP POST requests to specified servers. (Added in Qt 5.7)
- \value ResourceTypePluginResource A resource requested by a plugin. (Added in Qt 5.7)
+ \value ResourceTypePluginResource A resource requested by a plugin. (Added in Qt 5.7)
+ \value ResourceTypeNavigationPreload A service worker navigation preload
+ request. (Added in Qt 5.14)
\value ResourceTypeUnknown Unknown request type.
\note For forward compatibility all values not matched should be treated as unknown,
@@ -248,8 +250,10 @@ QUrl QWebEngineUrlRequestInfo::firstPartyUrl() const
}
/*!
- Returns the origin url of the document which initiated
- the navigation when a frame navigates another frame.
+ Returns the origin URL of the document that initiated
+ the navigation of a frame to another frame.
+
+ \since 5.14
*/
QUrl QWebEngineUrlRequestInfo::initiator() const
diff --git a/src/core/certificate_error_controller.cpp b/src/core/certificate_error_controller.cpp
index a747451df..71465a1af 100644
--- a/src/core/certificate_error_controller.cpp
+++ b/src/core/certificate_error_controller.cpp
@@ -90,9 +90,10 @@ CertificateErrorControllerPrivate::CertificateErrorControllerPrivate(int cert_er
, strictEnforcement(strict_enforcement)
, callback(cb)
{
- if (ssl_info.cert.get()) {
- validStart = toQt(ssl_info.cert->valid_start());
- validExpiry = toQt(ssl_info.cert->valid_expiry());
+ if (auto cert = ssl_info.cert.get()) {
+ validStart = toQt(cert->valid_start());
+ validExpiry = toQt(cert->valid_expiry());
+ chain = toCertificateChain(cert);
}
}
@@ -186,4 +187,9 @@ QString CertificateErrorController::errorString() const
return getQStringForMessageId(IDS_CERT_ERROR_UNKNOWN_ERROR_DESCRIPTION);
}
+QList<QSslCertificate> CertificateErrorController::chain() const
+{
+ return d->chain;
+}
+
QT_END_NAMESPACE
diff --git a/src/core/certificate_error_controller.h b/src/core/certificate_error_controller.h
index 5bea61c9b..7f5300dc8 100644
--- a/src/core/certificate_error_controller.h
+++ b/src/core/certificate_error_controller.h
@@ -55,6 +55,7 @@
#include <QtCore/QDateTime>
#include <QtCore/QUrl>
+#include <QtNetwork/QSslCertificate>
QT_BEGIN_NAMESPACE
@@ -95,6 +96,7 @@ public:
QString errorString() const;
QDateTime validStart() const;
QDateTime validExpiry() const;
+ QList<QSslCertificate> chain() const;
void accept(bool);
diff --git a/src/core/certificate_error_controller_p.h b/src/core/certificate_error_controller_p.h
index abde9a7d5..f3b0c23fa 100644
--- a/src/core/certificate_error_controller_p.h
+++ b/src/core/certificate_error_controller_p.h
@@ -71,6 +71,7 @@ public:
bool overridable;
bool strictEnforcement;
const base::Callback<void(content::CertificateRequestResultType)> callback;
+ QList<QSslCertificate> chain;
};
QT_END_NAMESPACE
diff --git a/src/core/compositor/compositor_resource_fence.cpp b/src/core/compositor/compositor_resource_fence.cpp
index 7fc5fbfb2..4179395d6 100644
--- a/src/core/compositor/compositor_resource_fence.cpp
+++ b/src/core/compositor/compositor_resource_fence.cpp
@@ -146,12 +146,12 @@ void CompositorResourceFence::release()
}
// static
-scoped_refptr<CompositorResourceFence> CompositorResourceFence::create()
+scoped_refptr<CompositorResourceFence> CompositorResourceFence::create(std::unique_ptr<gl::GLFence> glFence)
{
- if (gl::GLContext::GetCurrent() && gl::GLFence::IsSupported()) {
- std::unique_ptr<gl::GLFence> glFence{gl::GLFence::Create()};
+ if (!glFence && gl::GLContext::GetCurrent() && gl::GLFence::IsSupported())
+ glFence = gl::GLFence::Create();
+ if (glFence)
return base::MakeRefCounted<CompositorResourceFence>(glFence->Transfer());
- }
return nullptr;
}
diff --git a/src/core/compositor/compositor_resource_fence.h b/src/core/compositor/compositor_resource_fence.h
index 1c2ea3695..196297f78 100644
--- a/src/core/compositor/compositor_resource_fence.h
+++ b/src/core/compositor/compositor_resource_fence.h
@@ -60,7 +60,7 @@ public:
void release();
// May be used only by GPU thread.
- static scoped_refptr<CompositorResourceFence> create();
+ static scoped_refptr<CompositorResourceFence> create(std::unique_ptr<gl::GLFence> glFence = nullptr);
private:
gl::TransferableFence m_sync;
diff --git a/src/core/compositor/display_consumer.h b/src/core/compositor/display_consumer.h
new file mode 100644
index 000000000..d220088ad
--- /dev/null
+++ b/src/core/compositor/display_consumer.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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$
+**
+****************************************************************************/
+
+#ifndef DISPLAY_CONSUMER_H
+#define DISPLAY_CONSUMER_H
+
+#include "qtwebenginecoreglobal_p.h"
+
+namespace QtWebEngineCore {
+
+// Receives composited frames for display.
+class DisplayConsumer
+{
+public:
+ // Schedule a call to updatePaintNode soon.
+ //
+ // Called on the consumer thread.
+ virtual void scheduleUpdate() = 0;
+
+protected:
+ ~DisplayConsumer() {}
+};
+
+} // namespace QtWebEngineCore
+
+#endif // !DISPLAY_CONSUMER_H
diff --git a/src/core/compositor/display_frame_sink.cpp b/src/core/compositor/display_frame_sink.cpp
new file mode 100644
index 000000000..945600299
--- /dev/null
+++ b/src/core/compositor/display_frame_sink.cpp
@@ -0,0 +1,140 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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 "display_frame_sink.h"
+
+#include <QMap>
+
+namespace QtWebEngineCore {
+
+namespace {
+
+class DisplayFrameSinkMap
+{
+public:
+ static DisplayFrameSinkMap *instance()
+ {
+ static DisplayFrameSinkMap map;
+ return &map;
+ }
+
+ scoped_refptr<DisplayFrameSink> findOrCreate(viz::FrameSinkId frameSinkId)
+ {
+ QMutexLocker locker(&m_mutex);
+ auto it = m_map.find(frameSinkId);
+ if (it == m_map.end())
+ it = m_map.insert(frameSinkId, new DisplayFrameSink(frameSinkId));
+ return *it;
+ }
+
+ void remove(viz::FrameSinkId frameSinkId)
+ {
+ QMutexLocker locker(&m_mutex);
+ m_map.remove(frameSinkId);
+ }
+
+private:
+ mutable QMutex m_mutex;
+ QMap<viz::FrameSinkId, DisplayFrameSink *> m_map;
+};
+
+} // namespace
+
+// static
+scoped_refptr<DisplayFrameSink> DisplayFrameSink::findOrCreate(viz::FrameSinkId frameSinkId)
+{
+ return DisplayFrameSinkMap::instance()->findOrCreate(frameSinkId);
+}
+
+DisplayFrameSink::DisplayFrameSink(viz::FrameSinkId frameSinkId)
+ : m_frameSinkId(frameSinkId)
+{
+ DCHECK(m_frameSinkId.is_valid());
+}
+
+DisplayFrameSink::~DisplayFrameSink()
+{
+ DisplayFrameSinkMap::instance()->remove(m_frameSinkId);
+}
+
+void DisplayFrameSink::connect(DisplayConsumer *consumer)
+{
+ QMutexLocker locker(&m_mutex);
+ DCHECK(m_consumer == nullptr);
+ m_consumer = consumer;
+}
+
+void DisplayFrameSink::connect(DisplayProducer *producer)
+{
+ QMutexLocker locker(&m_mutex);
+ DCHECK(m_producer == nullptr);
+ m_producer = producer;
+}
+
+void DisplayFrameSink::disconnect(DisplayConsumer *consumer)
+{
+ QMutexLocker locker(&m_mutex);
+ DCHECK(m_consumer == consumer);
+ m_consumer = nullptr;
+}
+
+void DisplayFrameSink::disconnect(DisplayProducer *producer)
+{
+ QMutexLocker locker(&m_mutex);
+ DCHECK(m_producer == producer);
+ m_producer = nullptr;
+}
+
+void DisplayFrameSink::scheduleUpdate()
+{
+ QMutexLocker locker(&m_mutex);
+ if (m_consumer)
+ m_consumer->scheduleUpdate();
+}
+
+QSGNode *DisplayFrameSink::updatePaintNode(QSGNode *oldNode, RenderWidgetHostViewQtDelegate *delegate)
+{
+ QMutexLocker locker(&m_mutex);
+ QSGNode *newNode = oldNode;
+ if (m_producer)
+ newNode = m_producer->updatePaintNode(oldNode, delegate);
+ return newNode;
+}
+
+} // namespace QtWebEngineCore
diff --git a/src/core/compositor/display_frame_sink.h b/src/core/compositor/display_frame_sink.h
new file mode 100644
index 000000000..f620dc4f2
--- /dev/null
+++ b/src/core/compositor/display_frame_sink.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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$
+**
+****************************************************************************/
+
+#ifndef DISPLAY_FRAME_SINK_H
+#define DISPLAY_FRAME_SINK_H
+
+#include "display_consumer.h"
+#include "display_producer.h"
+
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_refptr.h"
+#include "components/viz/common/surfaces/frame_sink_id.h"
+
+#include <QMutex>
+
+namespace QtWebEngineCore {
+
+// Connects a DisplayConsumer with a DisplayProducer.
+class DisplayFrameSink final : public base::RefCountedThreadSafe<DisplayFrameSink>
+{
+public:
+ static scoped_refptr<DisplayFrameSink> findOrCreate(viz::FrameSinkId frameSinkId);
+ DisplayFrameSink(viz::FrameSinkId frameSinkId);
+ ~DisplayFrameSink();
+ void connect(DisplayConsumer *consumer);
+ void connect(DisplayProducer *producer);
+ void disconnect(DisplayConsumer *consumer);
+ void disconnect(DisplayProducer *producer);
+ void scheduleUpdate();
+ QSGNode *updatePaintNode(QSGNode *oldNode, RenderWidgetHostViewQtDelegate *delegate);
+
+private:
+ const viz::FrameSinkId m_frameSinkId;
+ mutable QMutex m_mutex;
+ DisplayProducer *m_producer = nullptr;
+ DisplayConsumer *m_consumer = nullptr;
+};
+
+} // namespace QtWebEngineCore
+
+#endif // !DISPLAY_FRAME_SINK_H
diff --git a/src/core/compositor/display_gl_output_surface.cpp b/src/core/compositor/display_gl_output_surface.cpp
new file mode 100644
index 000000000..5a78b8322
--- /dev/null
+++ b/src/core/compositor/display_gl_output_surface.cpp
@@ -0,0 +1,292 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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 "display_gl_output_surface.h"
+
+#include "chromium_gpu_helper.h"
+
+#include "base/threading/thread_task_runner_handle.h"
+#include "components/viz/service/display/display.h"
+#include "components/viz/service/display/output_surface_frame.h"
+#include "gpu/command_buffer/client/gles2_implementation.h"
+#include "gpu/command_buffer/client/gles2_interface.h"
+#include "gpu/command_buffer/service/mailbox_manager.h"
+#include "gpu/command_buffer/service/texture_base.h"
+#include "gpu/ipc/in_process_command_buffer.h"
+#include "ui/gl/color_space_utils.h"
+
+namespace QtWebEngineCore {
+
+DisplayGLOutputSurface::DisplayGLOutputSurface(
+ scoped_refptr<viz::VizProcessContextProvider> contextProvider,
+ viz::UpdateVSyncParametersCallback callback)
+ : OutputSurface(contextProvider)
+ , m_commandBuffer(contextProvider->command_buffer())
+ , m_gl(contextProvider->ContextGL())
+{
+ capabilities_.uses_default_gl_framebuffer = false;
+ m_gl->GenFramebuffers(1, &m_fboId);
+ contextProvider->SetUpdateVSyncParametersCallback(std::move(callback));
+}
+
+DisplayGLOutputSurface::~DisplayGLOutputSurface()
+{
+ m_gl->DeleteFramebuffers(1, &m_fboId);
+ if (m_sink)
+ m_sink->disconnect(this);
+}
+
+// Called from viz::Display::Initialize.
+void DisplayGLOutputSurface::BindToClient(viz::OutputSurfaceClient *client)
+{
+ m_display = static_cast<viz::Display *>(client);
+ m_sink = DisplayFrameSink::findOrCreate(m_display->frame_sink_id());
+ m_sink->connect(this);
+}
+
+// Triggered by ui::Compositor::SetVisible(true).
+void DisplayGLOutputSurface::EnsureBackbuffer()
+{
+}
+
+// Triggered by ui::Compositor::SetVisible(false). Framebuffer must be cleared.
+void DisplayGLOutputSurface::DiscardBackbuffer()
+{
+ NOTIMPLEMENTED();
+ // m_gl->DiscardBackbufferCHROMIUM();
+}
+
+// Called from viz::DirectRenderer::DrawFrame before rendering starts, but only
+// if the parameters differ from the previous Reshape call.
+//
+// Parameters:
+//
+// - sizeInPixels comes from ui::Compositor::SetScaleAndSize via
+// viz::HostContextFactoryPrivate::ResizeDisplay.
+//
+// - devicePixelRatio comes from viz::CompositorFrame::device_scale_factor()
+// via viz::RootCompositorFrameSinkImpl::SubmitCompositorFrame and
+// viz::Display::SetLocalSurfaceId.
+//
+// - colorSpace and hasAlpha correspond to the color_space and
+// has_transparent_background properties of the root viz::RenderPass.
+//
+// - useStencil should create a stencil buffer, but this is only needed for
+// overdraw feedback (--show-overdraw-feedback), so it's safe to ignore.
+// Accordingly, capabilities_.supports_stencil should be set to false.
+//
+void DisplayGLOutputSurface::Reshape(const gfx::Size &sizeInPixels,
+ float devicePixelRatio,
+ const gfx::ColorSpace &colorSpace,
+ bool hasAlpha,
+ bool /*useStencil*/)
+{
+ m_currentShape = Shape{sizeInPixels, devicePixelRatio, colorSpace, hasAlpha};
+ m_gl->ResizeCHROMIUM(sizeInPixels.width(), sizeInPixels.height(), devicePixelRatio,
+ gl::ColorSpaceUtils::GetGLColorSpace(colorSpace), hasAlpha);
+}
+
+std::unique_ptr<DisplayGLOutputSurface::Buffer> DisplayGLOutputSurface::makeBuffer(const Shape &shape)
+{
+ std::unique_ptr<Buffer> buffer = std::make_unique<Buffer>(this);
+ buffer->shape = shape;
+ m_gl->GenTextures(1, &buffer->clientId);
+ m_gl->BindTexture(GL_TEXTURE_2D, buffer->clientId);
+ m_gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ m_gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ m_gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ m_gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ uint32_t width = shape.sizeInPixels.width();
+ uint32_t height = shape.sizeInPixels.height();
+ uint32_t format = shape.hasAlpha ? GL_RGBA : GL_RGB;
+ m_gl->TexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, nullptr);
+ return buffer;
+}
+
+void DisplayGLOutputSurface::deleteBufferResources(Buffer *buffer)
+{
+ m_gl->DeleteTextures(1, &buffer->clientId);
+}
+
+// Called by viz::GLRenderer during rendering whenever it switches to the root
+// render pass.
+void DisplayGLOutputSurface::BindFramebuffer()
+{
+ if (!m_backBuffer || m_backBuffer->shape != m_currentShape)
+ m_backBuffer = makeBuffer(m_currentShape);
+
+ m_gl->BindFramebuffer(GL_FRAMEBUFFER, m_fboId);
+ m_gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_backBuffer->clientId, 0);
+}
+
+// Called from viz::Display::DrawAndSwap after rendering.
+//
+// Parameters:
+//
+// - frame.size is the same as the size given to Reshape.
+//
+// - frame.sub_buffer_rect and frame.content_bounds are never used since these
+// are only enabled if gl::GLSurface::SupportsPostSubBuffer() or
+// gl::GLSurface::SupportsSwapBuffersWithBounds() are true, respectively,
+// but this not the case for any offscreen gl::GLSurface.
+//
+// - frame.latency_info is viz::CompositorFrame::metadata.latency_info.
+void DisplayGLOutputSurface::SwapBuffers(viz::OutputSurfaceFrame frame)
+{
+ DCHECK(frame.size == m_currentShape.sizeInPixels);
+ DCHECK(!frame.sub_buffer_rect.has_value());
+ DCHECK(frame.content_bounds.empty());
+ DCHECK(m_backBuffer);
+
+ m_gl->BindFramebuffer(GL_FRAMEBUFFER, m_fboId);
+ m_gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0);
+ gpu::SyncToken syncToken;
+ m_gl->GenSyncTokenCHROMIUM(syncToken.GetData());
+
+ unsigned int clientId = m_backBuffer->clientId;
+
+ // Now some thread-hopping:
+ //
+ // - We start here on the viz thread (client side of command buffer).
+ //
+ // - Then we'll jump to the gpu thread (service side of command buffer) to
+ // get the real OpenGL texture id.
+ //
+ // - Then we'll get a call from the Qt Quick Scene Graph thread (could be
+ // a separate thread or the main thread).
+ //
+ // - Finally we'll return to the viz thread to acknowledge the swap.
+
+ {
+ QMutexLocker locker(&m_mutex);
+ m_taskRunner = base::ThreadTaskRunnerHandle::Get();
+ m_middleBuffer = std::move(m_backBuffer);
+ m_middleBuffer->serviceId = 0;
+ }
+
+ m_commandBuffer->GetTextureQt(
+ clientId,
+ base::BindOnce(&DisplayGLOutputSurface::swapBuffersOnGpuThread, base::Unretained(this)),
+ std::vector<gpu::SyncToken>{syncToken});
+}
+
+void DisplayGLOutputSurface::swapBuffersOnGpuThread(unsigned int id, std::unique_ptr<gl::GLFence> fence)
+{
+ {
+ QMutexLocker locker(&m_mutex);
+ m_middleBuffer->serviceId = id;
+ m_middleBuffer->fence = CompositorResourceFence::create(std::move(fence));
+ }
+
+ m_sink->scheduleUpdate();
+}
+
+void DisplayGLOutputSurface::swapBuffersOnVizThread()
+{
+ {
+ QMutexLocker locker(&m_mutex);
+ m_backBuffer = std::move(m_middleBuffer);
+ }
+
+ m_display->DidReceiveSwapBuffersAck();
+ m_display->DidReceivePresentationFeedback(
+ gfx::PresentationFeedback(base::TimeTicks::Now(), base::TimeDelta(),
+ gfx::PresentationFeedback::Flags::kVSync));
+}
+
+void DisplayGLOutputSurface::SetDrawRectangle(const gfx::Rect &)
+{
+}
+
+// Returning nullptr here effectively disables viz::OverlayProcessor.
+viz::OverlayCandidateValidator *DisplayGLOutputSurface::GetOverlayCandidateValidator() const
+{
+ return nullptr;
+}
+
+// Returning true here will cause viz::GLRenderer to try to render the output
+// surface as an overlay plane (see viz::DirectRenderer::DrawFrame and
+// viz::GLRenderer::ScheduleOverlays).
+bool DisplayGLOutputSurface::IsDisplayedAsOverlayPlane() const
+{
+ return false;
+}
+
+// Only used if IsDisplayedAsOverlayPlane was true (called from
+// viz::GLRenderer::ScheduleOverlays).
+unsigned DisplayGLOutputSurface::GetOverlayTextureId() const
+{
+ return 0;
+}
+
+// Only used if IsDisplayedAsOverlayPlane was true (called from
+// viz::DirectRender::DrawFrame).
+gfx::BufferFormat DisplayGLOutputSurface::GetOverlayBufferFormat() const
+{
+ return gfx::BufferFormat();
+}
+
+// Called by viz::GLRenderer but always false in all implementations except for
+// android_webview::ParentOutputSurface.
+bool DisplayGLOutputSurface::HasExternalStencilTest() const
+{
+ return false;
+}
+
+// Only called if HasExternalStencilTest was true. Dead code?
+void DisplayGLOutputSurface::ApplyExternalStencil()
+{
+ NOTREACHED();
+}
+
+// Called from GLRenderer::GetFramebufferCopyTextureFormat when using
+// glCopyTexSubImage2D on our framebuffer.
+uint32_t DisplayGLOutputSurface::GetFramebufferCopyTextureFormat()
+{
+ return GL_RGBA;
+}
+
+// Called from viz::DirectRenderer::DrawFrame, only used for overlays.
+unsigned DisplayGLOutputSurface::UpdateGpuFence()
+{
+ NOTREACHED();
+ return 0;
+}
+
+} // namespace QtWebEngineCore
diff --git a/src/core/compositor/display_gl_output_surface.h b/src/core/compositor/display_gl_output_surface.h
new file mode 100644
index 000000000..c42a6630a
--- /dev/null
+++ b/src/core/compositor/display_gl_output_surface.h
@@ -0,0 +1,148 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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$
+**
+****************************************************************************/
+
+#ifndef DISPLAY_GL_OUTPUT_SURFACE_H
+#define DISPLAY_GL_OUTPUT_SURFACE_H
+
+#include "compositor_resource_fence.h"
+#include "display_frame_sink.h"
+
+#include "components/viz/common/display/update_vsync_parameters_callback.h"
+#include "components/viz/service/display/output_surface.h"
+#include "components/viz/service/display_embedder/viz_process_context_provider.h"
+#include "gpu/command_buffer/common/mailbox.h"
+#include "gpu/command_buffer/common/sync_token.h"
+
+namespace viz {
+class Display;
+class SyntheticBeginFrameSource;
+} // namespace viz
+
+namespace QtWebEngineCore {
+
+// NOTE: Some methods are defined in display_gl_output_surface_qsg.cpp due
+// to conflicts between Qt & Chromium OpenGL APIs.
+class DisplayGLOutputSurface final : public viz::OutputSurface, public DisplayProducer
+{
+public:
+ DisplayGLOutputSurface(
+ scoped_refptr<viz::VizProcessContextProvider> contextProvider,
+ viz::UpdateVSyncParametersCallback callback);
+ ~DisplayGLOutputSurface() override;
+
+ // Overridden from viz::OutputSurface.
+ void BindToClient(viz::OutputSurfaceClient *client) override;
+ void EnsureBackbuffer() override;
+ void DiscardBackbuffer() override;
+ void BindFramebuffer() override;
+ void SetDrawRectangle(const gfx::Rect &drawRect) override;
+ viz::OverlayCandidateValidator *GetOverlayCandidateValidator() const override;
+ bool IsDisplayedAsOverlayPlane() const override;
+ unsigned GetOverlayTextureId() const override;
+ gfx::BufferFormat GetOverlayBufferFormat() const override;
+ void Reshape(const gfx::Size &size,
+ float devicePixelRatio,
+ const gfx::ColorSpace &colorSpace,
+ bool hasAlpha,
+ bool useStencil) override;
+ bool HasExternalStencilTest() const override;
+ void ApplyExternalStencil() override;
+ uint32_t GetFramebufferCopyTextureFormat() override;
+ void SwapBuffers(viz::OutputSurfaceFrame frame) override;
+ unsigned UpdateGpuFence() override;
+
+ // Overridden from DisplayProducer.
+ QSGNode *updatePaintNode(QSGNode *oldNode, RenderWidgetHostViewQtDelegate *delegate) override;
+
+private:
+ struct Shape
+ {
+ gfx::Size sizeInPixels;
+ float devicePixelRatio;
+ gfx::ColorSpace colorSpace;
+ bool hasAlpha;
+
+ bool operator==(const Shape &that) const
+ {
+ return (sizeInPixels == that.sizeInPixels &&
+ devicePixelRatio == that.devicePixelRatio &&
+ colorSpace == that.colorSpace &&
+ hasAlpha == that.hasAlpha);
+ }
+ bool operator!=(const Shape &that) const { return !(*this == that); }
+ };
+
+ struct Buffer
+ {
+ DisplayGLOutputSurface *parent;
+ Shape shape;
+ uint32_t clientId = 0;
+ uint32_t serviceId = 0;
+ scoped_refptr<CompositorResourceFence> fence;
+
+ Buffer(DisplayGLOutputSurface *parent) : parent(parent) {}
+ ~Buffer() { parent->deleteBufferResources(this); }
+ };
+
+ class Texture;
+
+ void swapBuffersOnGpuThread(unsigned int id, std::unique_ptr<gl::GLFence> fence);
+ void swapBuffersOnVizThread();
+
+ std::unique_ptr<Buffer> makeBuffer(const Shape &shape);
+ void deleteBufferResources(Buffer *buffer);
+ void attachBuffer();
+ void detachBuffer();
+
+ gpu::InProcessCommandBuffer *const m_commandBuffer;
+ gpu::gles2::GLES2Interface *const m_gl;
+ mutable QMutex m_mutex;
+ uint32_t m_fboId = 0;
+ viz::Display *m_display = nullptr;
+ scoped_refptr<DisplayFrameSink> m_sink;
+ Shape m_currentShape;
+ std::unique_ptr<Buffer> m_backBuffer;
+ std::unique_ptr<Buffer> m_middleBuffer;
+ std::unique_ptr<Buffer> m_frontBuffer;
+ scoped_refptr<base::SingleThreadTaskRunner> m_taskRunner;
+};
+
+} // namespace QtWebEngineCore
+
+#endif // !DISPLAY_GL_OUTPUT_SURFACE_H
diff --git a/src/core/compositor/display_gl_output_surface_qsg.cpp b/src/core/compositor/display_gl_output_surface_qsg.cpp
new file mode 100644
index 000000000..2f7b3de84
--- /dev/null
+++ b/src/core/compositor/display_gl_output_surface_qsg.cpp
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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 "display_gl_output_surface.h"
+
+#include "compositor_resource_fence.h"
+#include "render_widget_host_view_qt_delegate.h"
+#include "type_conversion.h"
+
+#include <QOpenGLFunctions>
+#include <QSGImageNode>
+#include <QSGTexture>
+
+namespace QtWebEngineCore {
+
+class DisplayGLOutputSurface::Texture final : public QSGTexture
+{
+public:
+ Texture(uint32_t id, QSize sizeInPixels, bool hasAlphaChannel, scoped_refptr<CompositorResourceFence> fence)
+ : m_id(id)
+ , m_sizeInPixels(sizeInPixels)
+ , m_hasAlphaChannel(hasAlphaChannel)
+ , m_fence(std::move(fence))
+ {
+ }
+
+ // QSGTexture:
+ int textureId() const override { return m_id; }
+ QSize textureSize() const override { return m_sizeInPixels; }
+ bool hasAlphaChannel() const override { return m_hasAlphaChannel; }
+ bool hasMipmaps() const override { return false; }
+ void bind() override
+ {
+ if (m_fence) {
+ m_fence->wait();
+ m_fence.reset();
+ }
+
+ QOpenGLContext *context = QOpenGLContext::currentContext();
+ QOpenGLFunctions *funcs = context->functions();
+ funcs->glBindTexture(GL_TEXTURE_2D, m_id);
+ }
+
+private:
+ uint32_t m_id;
+ QSize m_sizeInPixels;
+ bool m_hasAlphaChannel;
+ scoped_refptr<CompositorResourceFence> m_fence;
+};
+
+QSGNode *DisplayGLOutputSurface::updatePaintNode(QSGNode *oldNode, RenderWidgetHostViewQtDelegate *delegate)
+{
+ {
+ QMutexLocker locker(&m_mutex);
+ if (m_middleBuffer && m_middleBuffer->serviceId) {
+ std::swap(m_middleBuffer, m_frontBuffer);
+ m_taskRunner->PostTask(
+ FROM_HERE,
+ base::BindOnce(&DisplayGLOutputSurface::swapBuffersOnVizThread, base::Unretained(this)));
+ m_taskRunner.reset();
+ }
+ }
+
+ if (!m_frontBuffer)
+ return oldNode;
+
+ auto node = static_cast<QSGImageNode *>(oldNode);
+ if (!node)
+ node = delegate->createImageNode();
+
+ QSize sizeInPixels = toQt(m_frontBuffer->shape.sizeInPixels);
+ QSizeF sizeInDips = QSizeF(sizeInPixels) / m_frontBuffer->shape.devicePixelRatio;
+ QRectF rectInDips(QPointF(0, 0), sizeInDips);
+ node->setRect(rectInDips);
+ node->setOwnsTexture(true);
+ node->setTexture(new Texture(m_frontBuffer->serviceId,
+ sizeInPixels,
+ m_frontBuffer->shape.hasAlpha,
+ m_frontBuffer->fence));
+ node->setTextureCoordinatesTransform(QSGImageNode::MirrorVertically);
+
+ return node;
+}
+
+} // namespace QtWebEngineCore
diff --git a/src/core/compositor/display_overrides.cpp b/src/core/compositor/display_overrides.cpp
new file mode 100644
index 000000000..4547bb04b
--- /dev/null
+++ b/src/core/compositor/display_overrides.cpp
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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 "display_gl_output_surface.h"
+#include "display_software_output_surface.h"
+
+#include "components/viz/service/display_embedder/gpu_display_provider.h"
+#include "gpu/ipc/in_process_command_buffer.h"
+
+std::unique_ptr<viz::OutputSurface>
+viz::GpuDisplayProvider::CreateGLOutputSurface(
+ scoped_refptr<VizProcessContextProvider> context_provider,
+ UpdateVSyncParametersCallback update_vsync_callback)
+{
+ return std::make_unique<QtWebEngineCore::DisplayGLOutputSurface>(
+ std::move(context_provider), std::move(update_vsync_callback));
+}
+
+std::unique_ptr<viz::OutputSurface>
+viz::GpuDisplayProvider::CreateSoftwareOutputSurface(
+ UpdateVSyncParametersCallback update_vsync_callback)
+{
+ return std::make_unique<QtWebEngineCore::DisplaySoftwareOutputSurface>(std::move(update_vsync_callback));
+}
+
+void gpu::InProcessCommandBuffer::GetTextureQt(
+ unsigned int client_id,
+ GetTextureCallback callback,
+ const std::vector<SyncToken>& sync_token_fences)
+{
+ ScheduleGpuTask(base::BindOnce(&InProcessCommandBuffer::GetTextureQtOnGpuThread,
+ gpu_thread_weak_ptr_factory_.GetWeakPtr(),
+ client_id,
+ std::move(callback)),
+ sync_token_fences);
+}
+
+void gpu::InProcessCommandBuffer::GetTextureQtOnGpuThread(
+ unsigned int client_id, GetTextureCallback callback)
+{
+ MakeCurrent();
+ gpu::TextureBase *texture = decoder_->GetTextureBase(client_id);
+ std::move(callback).Run(texture ? texture->service_id() : 0, gl::GLFence::Create());
+}
diff --git a/src/core/compositor/display_producer.h b/src/core/compositor/display_producer.h
new file mode 100644
index 000000000..5de09d2d2
--- /dev/null
+++ b/src/core/compositor/display_producer.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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$
+**
+****************************************************************************/
+
+#ifndef DISPLAY_PRODUCER_H
+#define DISPLAY_PRODUCER_H
+
+#include "qtwebenginecoreglobal_p.h"
+
+QT_BEGIN_NAMESPACE
+class QSGNode;
+QT_END_NAMESPACE
+
+namespace QtWebEngineCore {
+class RenderWidgetHostViewQtDelegate;
+
+// Produces composited frames for display.
+class DisplayProducer
+{
+public:
+ // Generate scene graph nodes for the current frame.
+ //
+ // If this is a scheduled update (that is, scheduleUpdate was called
+ // earlier), then updatePaintNode will generate nodes for a new frame.
+ // Otherwise, it will just regenerate nodes for the old frame.
+ virtual QSGNode *updatePaintNode(QSGNode *oldNode, RenderWidgetHostViewQtDelegate *delegate) = 0;
+
+protected:
+ ~DisplayProducer() {}
+};
+
+} // namespace QtWebEngineCore
+
+#endif // !DISPLAY_PRODUCER_H
diff --git a/src/core/compositor/display_software_output_surface.cpp b/src/core/compositor/display_software_output_surface.cpp
new file mode 100644
index 000000000..13f8e8f38
--- /dev/null
+++ b/src/core/compositor/display_software_output_surface.cpp
@@ -0,0 +1,173 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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 "display_software_output_surface.h"
+
+#include "display_frame_sink.h"
+#include "render_widget_host_view_qt_delegate.h"
+#include "type_conversion.h"
+
+#include "base/threading/thread_task_runner_handle.h"
+#include "components/viz/service/display/display.h"
+#include "components/viz/service/display/output_surface_frame.h"
+
+#include <QMutex>
+#include <QPainter>
+#include <QSGImageNode>
+
+namespace QtWebEngineCore {
+
+class DisplaySoftwareOutputSurface::Device final : public viz::SoftwareOutputDevice, public DisplayProducer
+{
+public:
+ ~Device();
+
+ // Called from DisplaySoftwareOutputSurface.
+ void bind(viz::FrameSinkId frameSinkId);
+
+ // Overridden from viz::SoftwareOutputDevice.
+ void Resize(const gfx::Size &sizeInPixels, float devicePixelRatio) override;
+ void OnSwapBuffers(base::OnceClosure swapCompletionCallback) override;
+
+ // Overridden from DisplayProducer.
+ QSGNode *updatePaintNode(QSGNode *oldNode, RenderWidgetHostViewQtDelegate *delegate) override;
+
+private:
+ mutable QMutex m_mutex;
+ scoped_refptr<DisplayFrameSink> m_sink;
+ float m_devicePixelRatio = 1.0;
+ scoped_refptr<base::SingleThreadTaskRunner> m_taskRunner;
+ base::OnceClosure m_swapCompletionCallback;
+ QImage m_image;
+ float m_imageDevicePixelRatio = 1.0;
+};
+
+DisplaySoftwareOutputSurface::Device::~Device()
+{
+ if (m_sink)
+ m_sink->disconnect(this);
+}
+
+void DisplaySoftwareOutputSurface::Device::bind(viz::FrameSinkId frameSinkId)
+{
+ m_sink = DisplayFrameSink::findOrCreate(frameSinkId);
+ m_sink->connect(this);
+}
+
+void DisplaySoftwareOutputSurface::Device::Resize(const gfx::Size &sizeInPixels, float devicePixelRatio)
+{
+ if (viewport_pixel_size_ == sizeInPixels && m_devicePixelRatio == devicePixelRatio)
+ return;
+ m_devicePixelRatio = devicePixelRatio;
+ viewport_pixel_size_ = sizeInPixels;
+ surface_ = SkSurface::MakeRaster(SkImageInfo::MakeN32Premul(sizeInPixels.width(), sizeInPixels.height()));
+}
+
+void DisplaySoftwareOutputSurface::Device::OnSwapBuffers(base::OnceClosure swapCompletionCallback)
+{
+ QMutexLocker locker(&m_mutex);
+ m_taskRunner = base::ThreadTaskRunnerHandle::Get();
+ m_swapCompletionCallback = std::move(swapCompletionCallback);
+ m_sink->scheduleUpdate();
+}
+
+inline QImage::Format imageFormat(SkColorType colorType)
+{
+ switch (colorType) {
+ case kBGRA_8888_SkColorType:
+ return QImage::Format_ARGB32_Premultiplied;
+ case kRGBA_8888_SkColorType:
+ return QImage::Format_RGBA8888_Premultiplied;
+ default:
+ Q_UNREACHABLE();
+ return QImage::Format_ARGB32_Premultiplied;
+ }
+}
+
+QSGNode *DisplaySoftwareOutputSurface::Device::updatePaintNode(
+ QSGNode *oldNode, RenderWidgetHostViewQtDelegate *delegate)
+{
+ QMutexLocker locker(&m_mutex);
+
+ // Delete old node to make sure refcount of m_image is at most 1.
+ delete oldNode;
+ QSGImageNode *node = delegate->createImageNode();
+
+ if (m_swapCompletionCallback) {
+ SkPixmap skPixmap;
+ surface_->peekPixels(&skPixmap);
+ QImage image(reinterpret_cast<const uchar *>(skPixmap.addr()),
+ viewport_pixel_size_.width(), viewport_pixel_size_.height(),
+ skPixmap.rowBytes(), imageFormat(skPixmap.colorType()));
+ if (m_image.size() == image.size()) {
+ QRect damageRect = toQt(damage_rect_);
+ QPainter(&m_image).drawImage(damageRect, image, damageRect);
+ } else {
+ m_image = image;
+ m_image.detach();
+ }
+ m_imageDevicePixelRatio = m_devicePixelRatio;
+ m_taskRunner->PostTask(FROM_HERE, std::move(m_swapCompletionCallback));
+ m_taskRunner.reset();
+ }
+
+ QSizeF sizeInDips = QSizeF(m_image.size()) / m_imageDevicePixelRatio;
+ node->setRect(QRectF(QPointF(0, 0), sizeInDips));
+ node->setOwnsTexture(true);
+ node->setTexture(delegate->createTextureFromImage(m_image));
+
+ return node;
+}
+
+DisplaySoftwareOutputSurface::DisplaySoftwareOutputSurface(viz::UpdateVSyncParametersCallback callback)
+ : SoftwareOutputSurface(std::make_unique<Device>(), std::move(callback))
+{}
+
+DisplaySoftwareOutputSurface::~DisplaySoftwareOutputSurface() {}
+
+// Called from viz::Display::Initialize.
+void DisplaySoftwareOutputSurface::BindToClient(viz::OutputSurfaceClient *client)
+{
+ auto display = static_cast<viz::Display *>(client);
+ auto device = static_cast<Device *>(software_device());
+ device->bind(display->frame_sink_id());
+ SoftwareOutputSurface::BindToClient(client);
+}
+
+} // namespace QtWebEngineCore
diff --git a/src/core/compositor/display_software_output_surface.h b/src/core/compositor/display_software_output_surface.h
new file mode 100644
index 000000000..6707c74dc
--- /dev/null
+++ b/src/core/compositor/display_software_output_surface.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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$
+**
+****************************************************************************/
+
+#ifndef DISPLAY_SOFTWARE_OUTPUT_SURFACE_H
+#define DISPLAY_SOFTWARE_OUTPUT_SURFACE_H
+
+#include "components/viz/service/display_embedder/software_output_surface.h"
+
+namespace QtWebEngineCore {
+
+class DisplaySoftwareOutputSurface final : public viz::SoftwareOutputSurface
+{
+public:
+ DisplaySoftwareOutputSurface(viz::UpdateVSyncParametersCallback callback);
+ ~DisplaySoftwareOutputSurface() override;
+
+ // Overridden from viz::SoftwareOutputSurface.
+ void BindToClient(viz::OutputSurfaceClient *client) override;
+
+private:
+ class Device;
+};
+
+} // namespace QtWebEngineCore
+
+#endif // !DISPLAY_SOFTWARE_OUTPUT_SURFACE_H
diff --git a/src/core/configure.json b/src/core/configure.json
index 66e39ddc2..cf01b9914 100644
--- a/src/core/configure.json
+++ b/src/core/configure.json
@@ -1,11 +1,12 @@
{
"module": "webenginecore",
"depends": [
+ "buildtools-private",
"core-private",
"gui-private",
"printsupport"
],
- "condition": "module.gui",
+ "condition": "features.webengine-core",
"testDir": "../../config.tests",
"commandline": {
"options": {
@@ -28,8 +29,6 @@
"webengine-v8-snapshot": "boolean",
"webengine-webchannel": "boolean",
"webengine-kerberos": "boolean",
- "webengine-widgets": "boolean",
- "webengine-qml": "boolean",
"alsa": { "type": "boolean", "name": "webengine-alsa" },
"pulseaudio": { "type": "boolean", "name": "webengine-pulseaudio" },
"ffmpeg": { "type": "enum", "name": "webengine-system-ffmpeg", "values": { "system": "yes", "qt": "no" } },
@@ -45,94 +44,17 @@
},
"libraries": {
- "webengine-dbus": {
- "label": "d-bus",
- "sources": [
- { "type": "pkgConfig", "args": "dbus-1" }
- ]
- },
- "webengine-fontconfig": {
- "label": "fontconfig",
- "sources": [
- { "type": "pkgConfig", "args": "fontconfig" }
- ]
- },
- "webengine-libdrm": {
- "label": "libdrm",
- "sources": [
- { "type": "pkgConfig", "args": "libdrm" }
- ]
- },
- "webengine-xcomposite": {
- "label": "xcomposite",
- "sources": [
- { "type": "pkgConfig", "args": "xcomposite" }
- ]
- },
- "webengine-xcursor": {
- "label": "xcursor",
- "sources": [
- { "type": "pkgConfig", "args": "xcursor" }
- ]
- },
- "webengine-xi": {
- "label": "xi",
- "sources": [
- { "type": "pkgConfig", "args": "xi" }
- ]
- },
- "webengine-xtst": {
- "label": "xtst",
- "sources": [
- { "type": "pkgConfig", "args": "xtst" }
- ]
- },
- "webengine-harfbuzz": {
- "label": "harfbuzz >= 2.2.0",
- "sources": [
- { "type": "pkgConfig", "args": "harfbuzz >= 2.2.0" }
- ]
- },
- "webengine-glib": {
- "label": "glib-2.0 >= 2.32.0",
- "sources": [
- { "type": "pkgConfig", "args": "glib-2.0 >= 2.32.0" }
- ]
- },
- "webengine-zlib": {
- "label": "zlib",
- "sources": [
- { "type": "pkgConfig", "args": "zlib" }
- ]
- },
- "webengine-minizip": {
- "label": "minizip",
- "sources": [
- { "type": "pkgConfig", "args": "minizip" }
- ]
- },
- "webengine-libevent": {
- "label": "libevent",
- "sources": [
- { "type": "pkgConfig", "args": "libevent" }
- ]
- },
- "webengine-libxml2": {
- "label": "libxml2 and libxslt",
- "sources": [
- { "type": "pkgConfig", "args": "libxml-2.0 libxslt" }
- ]
- },
- "webengine-jsoncpp": {
- "label": "jsoncpp",
- "sources": [
- { "type": "pkgConfig", "args": "jsoncpp" }
- ]
- },
- "webengine-protobuf": {
- "label": "protobuf",
- "sources": [
- { "type": "pkgConfig", "args": "protobuf" }
+ "webengine-alsa": {
+ "label": "alsa",
+ "test": {
+ "tail": [
+ "#if SND_LIB_VERSION < 0x1000a // 1.0.10",
+ "#error Alsa version found too old, require >= 1.0.10",
+ "#endif"
+ ]
+ },
+ "headers" : ["alsa/asoundlib.h"],
+ "sources" : [{ "type": "pkgConfig", "args": "alsa" }
]
},
"webengine-poppler-cpp": {
@@ -141,195 +63,33 @@
{ "type": "pkgConfig", "args": "poppler-cpp" }
]
},
- "pulseaudio": {
+ "webengine-pulseaudio": {
"label": "pulseaudio >= 0.9.10",
"sources": [
{ "type": "pkgConfig", "args": "libpulse >= 0.9.10 libpulse-mainloop-glib" }
]
- },
- "webengine-icu": {
- "label": "icu >= 63",
- "sources": [
- { "type": "pkgConfig", "args": "icu-uc >= 63 icu-i18n >= 63" }
- ]
- },
- "webengine-ffmpeg": {
- "label": "libavcodec libavformat libavutil",
- "sources": [
- { "type": "pkgConfig", "args": "libavcodec libavformat libavutil" }
- ]
- },
- "webengine-opus": {
- "label": "opus",
- "sources": [
- { "type": "pkgConfig", "args": "opus" }
- ]
- },
- "webengine-webp": {
- "label": "libwebp, libwebpmux and libwebpdemux",
- "sources": [
- { "type": "pkgConfig", "args": "libwebp libwebpmux libwebpdemux" }
- ]
- },
- "webengine-nss": {
- "label": "nss >= 3.26",
- "sources": [
- { "type": "pkgConfig", "args": "nss >= 3.26" }
- ]
- },
- "webengine-png": {
- "label": "libpng >= 1.6.0",
- "sources": [
- { "type": "pkgConfig", "args": "libpng >= 1.6.0" }
- ]
- },
- "webengine-jpeglib": {
- "label": "compatible jpeglib",
- "type": "compile",
- "test": {
- "head": [
- "#include <cstdio>",
- "#include <cstring>",
- "extern \"C\" {",
- " #include <jpeglib.h>",
- "}"
- ],
- "main": [
- "JDIMENSION dummy;",
- "jpeg_crop_scanline(nullptr, &dummy, &dummy);",
- "jpeg_skip_scanlines(nullptr, dummy);"
- ]
- },
- "sources": [
- { "type": "pkgConfig", "args": "libjpeg" },
- "-ljpeg"
- ]
- },
- "webengine-lcms2": {
- "label": "lcms2",
- "sources": [
- { "type": "pkgConfig", "args": "lcms2" }
- ]
- },
- "webengine-freetype": {
- "label": "freetype >= 2.4.2",
- "test": {
- "head": [
- "#include <ft2build.h>",
- "#include FT_FREETYPE_H",
- "#if ((FREETYPE_MAJOR*10000 + FREETYPE_MINOR*100 + FREETYPE_PATCH) < 20402)",
- "# error This version of freetype is too old.",
- "#endif"
- ],
- "main": [
- "FT_Face ft_face = 0;",
- "FT_Reference_Face(ft_face);"
- ]
- },
- "sources": [
- { "type": "pkgConfig", "args": "freetype2" }
- ]
- },
- "webengine-x11" : {
- "label" : "x11",
- "sources": [
- { "type": "pkgConfig", "args": "x11" }
- ]
}
},
"tests" : {
- "webengine-alsa": {
- "label": "alsa",
- "test": "alsa",
- "type": "compile"
- },
"webengine-host-compiler": {
"label": "host compiler",
"test": "hostcompiler",
"host": "true",
"type": "compile"
},
- "webengine-khr": {
- "label": "khr",
- "test": "khr",
- "type": "compile"
- },
- "webengine-libvpx": {
- "label": "libvpx",
- "test": "libvpx",
- "type": "compile"
- },
- "webengine-snappy": {
- "label": "snappy",
- "test": "snappy",
- "type": "compile"
- },
- "webengine-winversion": {
- "label": "winversion",
- "test": "winversion",
- "type": "compile"
- },
- "webengine-protoc": {
- "label": "protoc",
- "type": "detectProtoc"
- },
- "webengine-python2": {
- "label": "python2",
- "type": "detectPython2",
- "log": "location"
- },
"webengine-host-pkg-config": {
"label": "host pkg-config",
"type": "detectHostPkgConfig",
"log": "path"
},
- "webengine-gperf": {
- "label": "gperf",
- "type": "detectGperf"
- },
- "webengine-bison": {
- "label": "bison",
- "type": "detectBison"
- },
- "webengine-flex": {
- "label": "flex",
- "type": "detectFlex"
- },
- "webengine-ninja": {
- "label": "system ninja",
- "type": "detectNinja"
- },
- "webengine-gn": {
- "label": "system gn",
- "type": "detectGn"
- },
"webengine-embedded-build": {
- "label": "embedded",
- "type": "embedded"
- },
- "webengine-re2": {
- "label": "re2",
- "test": "re2",
- "type": "compile"
- },
- "webengine-glibc": {
- "label": "glibc > 2.26",
- "type": "compile",
- "test": "glibc"
- },
- "webengine-libxml2-compatible": {
- "label" : "compatible system libxml2",
- "test" : "xml2",
- "type": "compile"
+ "label": "embedded build",
+ "type": "detectEmbedded"
},
"webengine-sanitizer": {
"label" : "sanitizer support",
"type": "isSanitizerSupported"
},
- "webengine-win-compiler64": {
- "label": "64bit compiler",
- "type": "isWindowsHostCompiler64"
- },
"webengine-arm-thumb" : {
"label": "thumb instruction set",
"type": "hasThumbFlag"
@@ -344,119 +104,7 @@
"flag": "-z,noexecstack"
}
},
-
"features": {
- "webengine-system-fontconfig": {
- "label": "fontconfig",
- "condition": "libs.webengine-fontconfig",
- "output": [ "privateFeature" ]
- },
- "webengine-system-dbus": {
- "label": "dbus",
- "condition": "libs.webengine-dbus",
- "output": [ "privateFeature" ]
- },
- "webengine-system-libdrm": {
- "label": "libdrm",
- "condition": "libs.webengine-libdrm",
- "output": [ "privateFeature" ]
- },
- "webengine-system-xcomposite": {
- "label": "xcomposite",
- "condition": "libs.webengine-xcomposite",
- "output": [ "privateFeature" ]
- },
- "webengine-system-xcursor": {
- "label": "xcursor",
- "condition": "libs.webengine-xcursor",
- "output": [ "privateFeature" ]
- },
- "webengine-system-xi": {
- "label": "xi",
- "condition": "libs.webengine-xi",
- "output": [ "privateFeature" ]
- },
- "webengine-system-xtst": {
- "label": "xtst",
- "condition": "libs.webengine-xtst",
- "output": [ "privateFeature" ]
- },
- "webengine-system-harfbuzz": {
- "label": "harfbuzz",
- "condition": "config.unix && features.system-harfbuzz && libs.webengine-harfbuzz",
- "output": [ "privateFeature" ]
- },
- "webengine-system-glib" : {
- "label": "glib",
- "condition": "config.unix && libs.webengine-glib",
- "output": [ "privateFeature" ]
- },
- "webengine-system-minizip" : {
- "label": "minizip",
- "condition": "config.unix && libs.webengine-minizip",
- "output": [ "privateFeature" ]
- },
- "webengine-system-zlib" : {
- "label": "zlib",
- "condition": "config.unix && features.system-zlib && libs.webengine-zlib",
- "output": [ "privateFeature" ]
- },
- "webengine-system-libevent" : {
- "label": "libevent",
- "condition": "config.unix && libs.webengine-libevent",
- "output": [ "privateFeature" ]
- },
- "webengine-system-jsoncpp" : {
- "label": "jsoncpp",
- "condition": "config.unix && libs.webengine-jsoncpp",
- "output": [ "privateFeature" ]
- },
- "webengine-system-protobuf" : {
- "label": "protobuf",
- "condition": "config.unix && libs.webengine-protobuf && tests.webengine-protoc",
- "output": [ "privateFeature" ]
- },
- "webengine-system-png" : {
- "label": "png",
- "condition": "config.unix && features.system-png && libs.webengine-png",
- "output": [ "privateFeature" ]
- },
- "webengine-system-jpeg" : {
- "label": "JPEG",
- "condition": "config.unix && features.system-jpeg && libs.webengine-jpeglib",
- "output": [ "privateFeature" ]
- },
- "webengine-python2": {
- "label": "python2",
- "condition": "tests.webengine-python2",
- "output": [
- "privateFeature",
- { "type": "varAssign", "name": "QMAKE_PYTHON2", "value": "tests.webengine-python2.location" }
- ]
- },
- "webengine-host-pkg-config": {
- "label": "host-pkg-config",
- "condition": "config.unix && tests.webengine-host-pkg-config",
- "output": [
- "privateFeature",
- { "type": "varAssign", "name": "QMAKE_PKG_CONFIG_HOST", "value": "tests.webengine-host-pkg-config.path" }
- ]
- },
- "webengine-gperf": {
- "label": "gperf",
- "condition": "tests.webengine-gperf",
- "output": [ "privateFeature" ]
- },
- "webengine-bison": {
- "label": "bison",
- "condition": "tests.webengine-bison",
- "output": [ "privateFeature" ]
- },
- "webengine-flex": {
- "label": "flex",
- "condition": "tests.webengine-flex",
- "output": [ "privateFeature" ]
- },
"webengine-embedded-build": {
"label": "Embedded build",
"purpose": "Enables the embedded build configuration.",
@@ -465,9 +113,15 @@
"autoDetect": "tests.webengine-embedded-build",
"output": [ "privateFeature" ]
},
+ "webengine-developer-build": {
+ "label": "Developer build",
+ "purpose": "Enables the developer build configuration.",
+ "autoDetect": "features.private_tests",
+ "output": [ "privateFeature" ]
+ },
"webengine-alsa": {
"label": "Use ALSA",
- "condition": "config.unix && tests.webengine-alsa",
+ "condition": "config.unix && libs.webengine-alsa",
"output": [ "privateFeature" ]
},
"webengine-v8-snapshot": {
@@ -481,26 +135,6 @@
"condition": "!config.unix || !features.cross_compile || arch.arm64 || tests.webengine-host-compiler",
"output": [ "privateFeature" ]
},
- "webengine-system-khr" : {
- "label": "khr",
- "condition": "config.unix && tests.webengine-khr",
- "output": [ "privateFeature" ]
- },
- "webengine-system-libvpx" : {
- "label": "libvpx",
- "condition": "config.unix && tests.webengine-libvpx",
- "output": [ "privateFeature" ]
- },
- "webengine-system-snappy" : {
- "label": "snappy",
- "condition": "config.unix && tests.webengine-snappy",
- "output": [ "privateFeature" ]
- },
- "webengine-winversion" : {
- "label": "winversion",
- "condition": "config.win32 && tests.webengine-winversion",
- "output": [ "privateFeature" ]
- },
"webengine-geolocation": {
"label": "Geolocation",
"condition": "module.positioning",
@@ -509,7 +143,7 @@
"webengine-pulseaudio": {
"label": "Use PulseAudio",
"autoDetect": "config.unix",
- "condition": "libs.pulseaudio",
+ "condition": "libs.webengine-pulseaudio",
"output": [ "privateFeature" ]
},
"webengine-pepper-plugins": {
@@ -577,80 +211,6 @@
"autoDetect": "!features.webengine-embedded-build",
"output": [ "privateFeature" ]
},
- "webengine-system-nss": {
- "label": "nss",
- "condition": "config.unix && !config.darwin && libs.webengine-nss",
- "output": [ "privateFeature" ]
- },
- "webengine-system-libwebp": {
- "label": "libwebp, libwebpmux and libwebpdemux",
- "autoDetect": "config.unix",
- "condition": "libs.webengine-webp",
- "output": [ "privateFeature" ]
- },
- "webengine-system-opus": {
- "label": "opus",
- "autoDetect": "config.unix",
- "condition": "libs.webengine-opus",
- "output": [ "privateFeature" ]
- },
- "webengine-system-ffmpeg": {
- "label": "ffmpeg",
- "autoDetect": false,
- "condition": "libs.webengine-ffmpeg && features.webengine-system-opus && features.webengine-system-libwebp",
- "output": [ "privateFeature" ]
- },
- "webengine-system-icu": {
- "label": "icu",
- "autoDetect": false,
- "condition": "libs.webengine-icu",
- "output": [ "privateFeature" ]
- },
- "webengine-system-re2": {
- "label": "re2",
- "autoDetect": "config.unix",
- "condition": "tests.webengine-re2",
- "output": [ "privateFeature" ]
- },
- "webengine-system-ninja": {
- "label": "Use System Ninja",
- "condition": "tests.webengine-ninja",
- "output": [ "privateFeature" ]
- },
- "webengine-system-gn": {
- "label": "Use System Gn",
- "autoDetect": false,
- "condition": "tests.webengine-gn",
- "output": [ "privateFeature" ]
- },
- "webengine-system-glibc": {
- "label": "glibc",
- "condition": "config.linux && tests.webengine-glibc",
- "output": [ "privateFeature" ]
- },
- "webengine-system-libxml2": {
- "label": "libxml2 and libxslt",
- "condition": "config.unix
- && libs.webengine-libxml2
- && tests.webengine-libxml2-compatible",
- "output": [ "privateFeature" ]
- },
- "webengine-system-lcms2" : {
- "label": "lcms2",
- "autoDetect": "features.webengine-printing-and-pdf",
- "condition": "config.unix && libs.webengine-lcms2",
- "output": [ "privateFeature" ]
- },
- "webengine-system-freetype" : {
- "label": "freetype",
- "condition": "config.unix && features.system-freetype && libs.webengine-freetype",
- "output": [ "privateFeature" ]
- },
- "webengine-system-x11" : {
- "label": "x11",
- "condition": "config.unix && libs.webengine-x11",
- "output": [ "privateFeature" ]
- },
"webengine-ozone-x11" : {
"label": "Support qpa-xcb",
"condition": "config.unix
@@ -674,29 +234,11 @@
"condition": "libs.webengine-poppler-cpp",
"output": [ "privateFeature" ]
},
- "webengine-win-compiler64": {
- "label": "64bit compiler",
- "condition": "config.win32 && tests.webengine-win-compiler64",
- "output": [ "privateFeature" ]
- },
"webengine-arm-thumb": {
"label": "Thumb instruction set",
"condition": "config.linux && features.webengine-embedded-build && arch.arm && tests.webengine-arm-thumb",
"output": [ "privateFeature" ]
},
- "webengine-widgets": {
- "label": "Qt WebEngine Widgets",
- "purpose": "Provides WebEngine Widgets support.",
- "section": "WebEngine",
- "condition": "module.widgets",
- "output": [ "privateFeature" ]
- },
- "webengine-qml": {
- "label": "Qt WebEngine Qml",
- "purpose": "Provides WebEngine Qml support.",
- "section": "WebEngine",
- "output": [ "privateFeature" ]
- },
"webengine-full-debug-info": {
"label": "Full debug information",
"purpose": "Enables debug information for Blink and V8.",
@@ -717,26 +259,6 @@
"report": [
{
"type": "warning",
- "condition": "!features.webengine-python2",
- "message": "Python version 2 (2.7.5 or later) is required to build QtWebEngine."
- },
- {
- "type": "warning",
- "condition": "!features.webengine-gperf",
- "message": "gperf is required to build QtWebEngine."
- },
- {
- "type": "warning",
- "condition": "!features.webengine-bison",
- "message": "bison is required to build QtWebEngine."
- },
- {
- "type": "warning",
- "condition": "!features.webengine-flex",
- "message": "flex is required to build QtWebEngine."
- },
- {
- "type": "warning",
"condition": "config.sanitizer && !tests.webengine-sanitizer && !features.webengine-sanitizer",
"message": "Qt WebEngine cannot be built with the chosen sanitizer configuration. Check config.log for details or use -feature-webengine-sanitizer to force the build."
},
@@ -747,23 +269,23 @@
},
{
"type": "warning",
- "condition": "config.win32 && !features.webengine-win-compiler64",
- "message": "64-bit cross-building or native toolchain is required to build QtWebEngine."
+ "condition": "config.linux && features.webengine-embedded-build && !features.webengine-system-ffmpeg && arch.arm && !features.webengine-arm-thumb",
+ "message": "Thumb instruction set is required to build ffmpeg for QtWebEngine."
},
{
"type": "warning",
- "condition": "config.linux && features.webengine-embedded-build && !features.webengine-system-ffmpeg && arch.arm && !features.webengine-arm-thumb",
- "message": "Thumb instruction set is required to build ffmpeg for QtWebEngine."
+ "condition": "config.linux && features.webengine-v8-snapshot && !features.webengine-v8-snapshot-support",
+ "message": "V8 snapshot cannot be built. Most likely, the 32-bit host compiler does not work. Please make sure you have 32-bit devel environment installed."
}
],
"summary": [
{
"section": "Qt WebEngineCore",
+ "condition": "features.webengine-core",
"entries": [
- "webengine-widgets",
- "webengine-qml",
"webengine-embedded-build",
+ "webengine-developer-build",
"webengine-full-debug-info",
"webengine-pepper-plugins",
"webengine-printing-and-pdf",
@@ -771,7 +293,6 @@
"webengine-spellchecker",
"webengine-native-spellchecker",
"webengine-webrtc",
- "webengine-system-ninja",
"webengine-geolocation",
"webengine-webchannel",
"webengine-v8-snapshot",
@@ -831,54 +352,6 @@
"type": "macosToolchainVersion",
"args": "deploymentTarget",
"condition": "config.macos"
- },
- {
- "section": "Optional system libraries used",
- "condition": "config.unix",
- "entries": [
- "webengine-system-re2",
- "webengine-system-icu",
- "webengine-system-libwebp",
- "webengine-system-opus",
- "webengine-system-ffmpeg",
- "webengine-system-libvpx",
- "webengine-system-snappy",
- "webengine-system-glib",
- "webengine-system-zlib",
- "webengine-system-minizip",
- "webengine-system-libevent",
- "webengine-system-jsoncpp",
- "webengine-system-protobuf",
- "webengine-system-libxml2",
- "webengine-system-lcms2",
- "webengine-system-png",
- "webengine-system-jpeg",
- "webengine-system-harfbuzz",
- "webengine-system-freetype"
- ]
- },
- {
- "section": "Required system libraries",
- "condition": "config.unix && !config.macos",
- "entries": [
- "webengine-system-fontconfig",
- "webengine-system-dbus",
- "webengine-system-nss",
- "webengine-system-khr",
- "webengine-system-glibc"
- ]
- },
- {
- "section": "Required system libraries for qpa-xcb",
- "condition": "config.unix && !config.macos",
- "entries": [
- "webengine-system-x11",
- "webengine-system-libdrm",
- "webengine-system-xcomposite",
- "webengine-system-xcursor",
- "webengine-system-xi",
- "webengine-system-xtst"
- ]
}
]
}
diff --git a/src/core/core_chromium.pri b/src/core/core_chromium.pri
index 908387788..810ec9a0f 100644
--- a/src/core/core_chromium.pri
+++ b/src/core/core_chromium.pri
@@ -59,16 +59,21 @@ SOURCES = \
compositor/compositor_resource_tracker.cpp \
compositor/content_gpu_client_qt.cpp \
compositor/delegated_frame_node.cpp \
+ compositor/display_frame_sink.cpp \
+ compositor/display_overrides.cpp \
+ compositor/display_software_output_surface.cpp \
content_client_qt.cpp \
content_browser_client_qt.cpp \
content_main_delegate_qt.cpp \
content_utility_client_qt.cpp \
+ delegated_frame_host_client_qt.cpp \
desktop_screen_qt.cpp \
devtools_frontend_qt.cpp \
devtools_manager_delegate_qt.cpp \
download_manager_delegate_qt.cpp \
favicon_manager.cpp \
file_picker_controller.cpp \
+ find_text_helper.cpp \
javascript_dialog_controller.cpp \
javascript_dialog_manager_qt.cpp \
login_delegate_qt.cpp \
@@ -163,16 +168,20 @@ HEADERS = \
compositor/compositor_resource_tracker.h \
compositor/content_gpu_client_qt.h \
compositor/delegated_frame_node.h \
+ compositor/display_frame_sink.h \
+ compositor/display_software_output_surface.h \
content_client_qt.h \
content_browser_client_qt.h \
content_main_delegate_qt.h \
content_utility_client_qt.h \
+ delegated_frame_host_client_qt.h \
desktop_screen_qt.h \
devtools_frontend_qt.h \
devtools_manager_delegate_qt.h \
download_manager_delegate_qt.h \
favicon_manager.h \
file_picker_controller.h \
+ find_text_helper.h \
global_descriptors_qt.h \
javascript_dialog_controller_p.h \
javascript_dialog_controller.h \
@@ -292,11 +301,13 @@ qtConfig(webengine-printing-and-pdf) {
contains(QT_CONFIG, opengl) {
SOURCES += \
compositor/compositor_resource_fence.cpp \
+ compositor/display_gl_output_surface.cpp \
+ compositor/display_gl_output_surface_qsg.cpp \
compositor/stream_video_node.cpp \
compositor/yuv_video_node.cpp
-
HEADERS += \
compositor/compositor_resource_fence.h \
+ compositor/display_gl_output_surface.h \
compositor/stream_video_node.h \
compositor/yuv_video_node.h
}
diff --git a/src/core/core_common.pri b/src/core/core_common.pri
index c92278657..2a9dc90c0 100644
--- a/src/core/core_common.pri
+++ b/src/core/core_common.pri
@@ -1,5 +1,6 @@
+include($$QTWEBENGINE_OUT_ROOT/src/buildtools/qtbuildtools-config.pri)
include($$QTWEBENGINE_OUT_ROOT/src/core/qtwebenginecore-config.pri)
-QT_FOR_CONFIG += webenginecore webenginecore-private
+QT_FOR_CONFIG += buildtools-private webenginecore webenginecore-private
# NOTE: The TARGET, QT, QT_PRIVATE variables are used in both core_module.pro and core_gyp_generator.pro
# gyp/ninja will take care of the compilation, qmake/make will finish with linking and install.
diff --git a/src/core/core_module.pro b/src/core/core_module.pro
index b220af4a5..4b9268e1a 100644
--- a/src/core/core_module.pro
+++ b/src/core/core_module.pro
@@ -63,7 +63,7 @@ CONFIG *= no_smart_library_merge
osx {
LIBS_PRIVATE += -Wl,-force_load,$${api_library_path}$${QMAKE_DIR_SEP}lib$${api_library_name}.a
} else: win32 {
- !isDeveloperBuild() {
+ !qtConfig(webengine-developer-build) {
# Remove unused functions and data in debug non-developer builds, because the binaries will
# be smaller in the shipped packages.
QMAKE_LFLAGS += /OPT:REF
diff --git a/src/core/delegated_frame_host_client_qt.cpp b/src/core/delegated_frame_host_client_qt.cpp
new file mode 100644
index 000000000..d3f5a4ade
--- /dev/null
+++ b/src/core/delegated_frame_host_client_qt.cpp
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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 "delegated_frame_host_client_qt.h"
+
+#include "render_widget_host_view_qt.h"
+
+namespace QtWebEngineCore {
+
+ui::Layer *DelegatedFrameHostClientQt::DelegatedFrameHostGetLayer() const
+{
+ return p->m_rootLayer.get();
+}
+
+bool DelegatedFrameHostClientQt::DelegatedFrameHostIsVisible() const
+{
+ return !p->host()->is_hidden();
+}
+
+SkColor DelegatedFrameHostClientQt::DelegatedFrameHostGetGutterColor() const
+{
+ return p->GetBackgroundColor().value_or(SK_ColorWHITE);
+}
+
+void DelegatedFrameHostClientQt::OnBeginFrame(base::TimeTicks frame_time)
+{
+ p->host()->ProgressFlingIfNeeded(frame_time);
+}
+
+void DelegatedFrameHostClientQt::OnFrameTokenChanged(uint32_t frame_token)
+{
+ p->OnFrameTokenChangedForView(frame_token);
+}
+
+float DelegatedFrameHostClientQt::GetDeviceScaleFactor() const
+{
+ return p->m_screenInfo.device_scale_factor;
+}
+
+void DelegatedFrameHostClientQt::InvalidateLocalSurfaceIdOnEviction()
+{
+ p->m_dfhLocalSurfaceIdAllocator.Invalidate();
+}
+
+std::vector<viz::SurfaceId> DelegatedFrameHostClientQt::CollectSurfaceIdsForEviction()
+{
+ return p->host()->CollectSurfaceIdsForEviction();
+}
+
+bool DelegatedFrameHostClientQt::ShouldShowStaleContentOnEviction()
+{
+ return p->host()->ShouldShowStaleContentOnEviction();
+}
+
+} // namespace QtWebEngineCore
diff --git a/src/core/delegated_frame_host_client_qt.h b/src/core/delegated_frame_host_client_qt.h
new file mode 100644
index 000000000..b5dc6eb59
--- /dev/null
+++ b/src/core/delegated_frame_host_client_qt.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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$
+**
+****************************************************************************/
+
+#ifndef DELEGATED_FRAME_HOST_CLIENT_QT_H
+#define DELEGATED_FRAME_HOST_CLIENT_QT_H
+
+#include "qtwebenginecoreglobal_p.h"
+
+#include "content/browser/renderer_host/delegated_frame_host.h"
+#include "content/browser/renderer_host/render_widget_host_impl.h"
+
+namespace QtWebEngineCore {
+
+class RenderWidgetHostViewQt;
+class DelegatedFrameHostClientQt : public content::DelegatedFrameHostClient
+{
+public:
+ explicit DelegatedFrameHostClientQt(RenderWidgetHostViewQt *p) : p(p) {}
+
+ // Overridden from content::DelegatedFrameHostClient
+ ui::Layer *DelegatedFrameHostGetLayer() const override;
+ bool DelegatedFrameHostIsVisible() const override;
+ SkColor DelegatedFrameHostGetGutterColor() const override;
+ void OnBeginFrame(base::TimeTicks frame_time) override;
+ void OnFrameTokenChanged(uint32_t frame_token) override;
+ float GetDeviceScaleFactor() const override;
+ void InvalidateLocalSurfaceIdOnEviction() override;
+ std::vector<viz::SurfaceId> CollectSurfaceIdsForEviction() override;
+ bool ShouldShowStaleContentOnEviction() override;
+
+private:
+ RenderWidgetHostViewQt *p;
+};
+
+} // namespace QtWebEngineCore
+
+#endif // !DELEGATED_FRAME_HOST_CLIENT_QT_H
diff --git a/src/core/favicon_manager.h b/src/core/favicon_manager.h
index df74f6303..a8247d15f 100644
--- a/src/core/favicon_manager.h
+++ b/src/core/favicon_manager.h
@@ -90,7 +90,7 @@ public:
TouchIcon = 1 << 1,
TouchPrecomposedIcon = 1 << 2
};
- Q_DECLARE_FLAGS(FaviconTypeFlags, FaviconTypeFlag);
+ Q_DECLARE_FLAGS(FaviconTypeFlags, FaviconTypeFlag)
FaviconInfo();
FaviconInfo(const FaviconInfo &);
diff --git a/src/core/find_text_helper.cpp b/src/core/find_text_helper.cpp
new file mode 100644
index 000000000..effda529f
--- /dev/null
+++ b/src/core/find_text_helper.cpp
@@ -0,0 +1,171 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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 "find_text_helper.h"
+#include "qwebenginefindtextresult.h"
+#include "type_conversion.h"
+#include "web_contents_adapter_client.h"
+
+#include "content/public/browser/web_contents.h"
+#include "third_party/blink/public/mojom/frame/find_in_page.mojom.h"
+
+namespace QtWebEngineCore {
+
+// static
+int FindTextHelper::m_findRequestIdCounter = -1;
+
+FindTextHelper::FindTextHelper(content::WebContents *webContents, WebContentsAdapterClient *viewClient)
+ : m_webContents(webContents)
+ , m_viewClient(viewClient)
+ , m_currentFindRequestId(m_findRequestIdCounter++)
+ , m_lastCompletedFindRequestId(m_currentFindRequestId)
+{
+}
+
+FindTextHelper::~FindTextHelper()
+{
+ if (isFindTextInProgress())
+ stopFinding();
+}
+
+void FindTextHelper::startFinding(const QString &findText, bool caseSensitively, bool findBackward, const QWebEngineCallback<bool> resultCallback)
+{
+ if (findText.isEmpty()) {
+ stopFinding();
+ m_viewClient->findTextFinished(QWebEngineFindTextResult());
+ m_widgetCallbacks.invokeEmpty(resultCallback);
+ return;
+ }
+
+ startFinding(findText, caseSensitively, findBackward);
+ m_widgetCallbacks.registerCallback(m_currentFindRequestId, resultCallback);
+}
+
+void FindTextHelper::startFinding(const QString &findText, bool caseSensitively, bool findBackward, const QJSValue &resultCallback)
+{
+ if (findText.isEmpty()) {
+ stopFinding();
+ m_viewClient->findTextFinished(QWebEngineFindTextResult());
+ if (!resultCallback.isUndefined()) {
+ QJSValueList args;
+ args.append(QJSValue(0));
+ const_cast<QJSValue&>(resultCallback).call(args);
+ }
+ return;
+ }
+
+ startFinding(findText, caseSensitively, findBackward);
+ if (!resultCallback.isUndefined())
+ m_quickCallbacks.insert(m_currentFindRequestId, resultCallback);
+}
+
+void FindTextHelper::startFinding(const QString &findText, bool caseSensitively, bool findBackward)
+{
+ if (findText.isEmpty()) {
+ stopFinding();
+ return;
+ }
+
+ if (m_currentFindRequestId > m_lastCompletedFindRequestId) {
+ // There are cases where the render process will overwrite a previous request
+ // with the new search and we'll have a dangling callback, leaving the application
+ // waiting for it forever.
+ // Assume that any unfinished find has been unsuccessful when a new one is started
+ // to cover that case.
+ m_viewClient->findTextFinished(QWebEngineFindTextResult());
+ invokeResultCallback(m_currentFindRequestId, 0);
+ }
+
+ blink::mojom::FindOptionsPtr options = blink::mojom::FindOptions::New();
+ options->forward = !findBackward;
+ options->match_case = caseSensitively;
+ options->find_next = findText == m_previousFindText;
+ m_previousFindText = findText;
+
+ m_currentFindRequestId = m_findRequestIdCounter++;
+ m_webContents->Find(m_currentFindRequestId, toString16(findText), std::move(options));
+}
+
+void FindTextHelper::stopFinding()
+{
+ m_lastCompletedFindRequestId = m_currentFindRequestId;
+ m_previousFindText = QString();
+ m_webContents->StopFinding(content::STOP_FIND_ACTION_KEEP_SELECTION);
+}
+
+bool FindTextHelper::isFindTextInProgress() const
+{
+ return m_currentFindRequestId != m_lastCompletedFindRequestId;
+}
+
+void FindTextHelper::handleFindReply(content::WebContents *source, int requestId, int numberOfMatches,
+ const gfx::Rect &selectionRect, int activeMatchOrdinal, bool finalUpdate)
+{
+ Q_UNUSED(selectionRect);
+
+ Q_ASSERT(source == m_webContents);
+
+ if (!finalUpdate || requestId <= m_lastCompletedFindRequestId)
+ return;
+
+ Q_ASSERT(m_currentFindRequestId == requestId);
+ m_lastCompletedFindRequestId = requestId;
+ m_viewClient->findTextFinished(QWebEngineFindTextResult(numberOfMatches, activeMatchOrdinal));
+ invokeResultCallback(requestId, numberOfMatches);
+}
+
+void FindTextHelper::handleLoadCommitted()
+{
+ // Make sure that we don't set the findNext WebFindOptions on a new frame.
+ m_previousFindText = QString();
+}
+
+void FindTextHelper::invokeResultCallback(int requestId, int numberOfMatches)
+{
+ if (m_quickCallbacks.contains(requestId)) {
+ QJSValue resultCallback = m_quickCallbacks.take(requestId);
+ QJSValueList args;
+ args.append(QJSValue(numberOfMatches));
+ resultCallback.call(args);
+ } else {
+ m_widgetCallbacks.invoke(requestId, numberOfMatches > 0);
+ }
+}
+
+} // namespace QtWebEngineCore
diff --git a/src/core/find_text_helper.h b/src/core/find_text_helper.h
new file mode 100644
index 000000000..e8f186272
--- /dev/null
+++ b/src/core/find_text_helper.h
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#ifndef FIND_TEXT_HELPER_H
+#define FIND_TEXT_HELPER_H
+
+#include "qtwebenginecoreglobal_p.h"
+
+#include "qwebenginecallback_p.h"
+#include <QJSValue>
+
+namespace content {
+class WebContents;
+}
+
+namespace gfx {
+class Rect;
+}
+
+namespace QtWebEngineCore {
+
+class WebContentsAdapterClient;
+
+class Q_WEBENGINECORE_PRIVATE_EXPORT FindTextHelper {
+public:
+ FindTextHelper(content::WebContents *webContents, WebContentsAdapterClient *viewClient);
+ ~FindTextHelper();
+
+ void startFinding(const QString &findText, bool caseSensitively, bool findBackward, const QWebEngineCallback<bool> resultCallback);
+ void startFinding(const QString &findText, bool caseSensitively, bool findBackward, const QJSValue &resultCallback);
+ void startFinding(const QString &findText, bool caseSensitively, bool findBackward);
+ void stopFinding();
+ bool isFindTextInProgress() const;
+ void handleFindReply(content::WebContents *source, int requestId, int numberOfMatches, const gfx::Rect &selectionRect, int activeMatchOrdinal, bool finalUpdate);
+ void handleLoadCommitted();
+
+private:
+ void invokeResultCallback(int requestId, int numberOfMatches);
+
+ content::WebContents *m_webContents;
+ WebContentsAdapterClient *m_viewClient;
+
+ static int m_findRequestIdCounter;
+ int m_currentFindRequestId;
+ int m_lastCompletedFindRequestId;
+
+ QString m_previousFindText;
+
+ QMap<int, QJSValue> m_quickCallbacks;
+ CallbackDirectory m_widgetCallbacks;
+};
+
+} // namespace QtWebEngineCore
+
+#endif // FIND_TEXT_HELPER_H
diff --git a/src/core/gn_run.pro b/src/core/gn_run.pro
index 0219a2be9..377d8363c 100644
--- a/src/core/gn_run.pro
+++ b/src/core/gn_run.pro
@@ -1,5 +1,6 @@
+include($$QTWEBENGINE_OUT_ROOT/src/buildtools/qtbuildtools-config.pri)
include($$QTWEBENGINE_OUT_ROOT/src/core/qtwebenginecore-config.pri)
-QT_FOR_CONFIG += webenginecore-private
+QT_FOR_CONFIG += buildtools-private webenginecore-private core-private gui-private
TEMPLATE = aux
diff --git a/src/core/pref_service_adapter.h b/src/core/pref_service_adapter.h
index 83f6a322e..1c7c44a96 100644
--- a/src/core/pref_service_adapter.h
+++ b/src/core/pref_service_adapter.h
@@ -38,8 +38,8 @@
**
****************************************************************************/
-#ifndef PREF_SRVICE_ADAPTER_H
-#define PREF_SERIVE_ADAPTER_H
+#ifndef PREF_SERVICE_ADAPTER_H
+#define PREF_SERVICE_ADAPTER_H
#include "components/prefs/pref_service.h"
#include "qtwebenginecoreglobal_p.h"
@@ -82,4 +82,4 @@ private:
}
-#endif // PREF_SERIVE_ADAPTER_H
+#endif // PREF_SERVICE_ADAPTER_H
diff --git a/src/core/profile_io_data_qt.cpp b/src/core/profile_io_data_qt.cpp
index 9a5058a5a..38fe56f7d 100644
--- a/src/core/profile_io_data_qt.cpp
+++ b/src/core/profile_io_data_qt.cpp
@@ -100,6 +100,8 @@
#include "net/cert_net/cert_net_fetcher_impl.h"
#endif
+#include <mutex>
+
namespace QtWebEngineCore {
static bool doNetworkSessionParamsMatch(const net::HttpNetworkSession::Params &first,
@@ -164,7 +166,6 @@ ProfileIODataQt::ProfileIODataQt(ProfileQt *profile)
#if QT_CONFIG(ssl)
m_clientCertificateStoreData(new ClientCertificateStoreData),
#endif
- m_mutex(QMutex::Recursive),
m_removerObserver(this),
m_weakPtrFactory(this)
{
@@ -243,7 +244,7 @@ void ProfileIODataQt::initializeOnIOThread()
m_urlRequestContext->set_enable_brotli(base::FeatureList::IsEnabled(features::kBrotliEncoding));
// this binds factory to io thread
m_weakPtr = m_weakPtrFactory.GetWeakPtr();
- QMutexLocker lock(&m_mutex);
+ const std::lock_guard<QRecursiveMutex> lock(m_mutex);
generateAllStorage();
generateJobFactory();
setGlobalCertificateVerification();
@@ -283,7 +284,7 @@ void ProfileIODataQt::cancelAllUrlRequests()
void ProfileIODataQt::generateAllStorage()
{
Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
- QMutexLocker lock(&m_mutex);
+ const std::lock_guard<QRecursiveMutex> lock(m_mutex);
generateStorage();
generateCookieStore();
generateUserAgent();
@@ -390,7 +391,7 @@ void ProfileIODataQt::generateCookieStore()
Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
Q_ASSERT(m_urlRequestContext);
- QMutexLocker lock(&m_mutex);
+ const std::lock_guard<QRecursiveMutex> lock(m_mutex);
// FIXME: Add code to remove the old database.
m_storage->set_channel_id_service(
@@ -443,7 +444,7 @@ void ProfileIODataQt::generateUserAgent()
Q_ASSERT(m_urlRequestContext);
Q_ASSERT(m_storage);
- QMutexLocker lock(&m_mutex);
+ const std::lock_guard<QRecursiveMutex> lock(m_mutex);
m_storage->set_http_user_agent_settings(std::unique_ptr<net::HttpUserAgentSettings>(
new net::StaticHttpUserAgentSettings(m_httpAcceptLanguage.toStdString(),
m_httpUserAgent.toStdString())));
@@ -455,7 +456,7 @@ void ProfileIODataQt::generateHttpCache()
Q_ASSERT(m_urlRequestContext);
Q_ASSERT(m_storage);
- QMutexLocker lock(&m_mutex);
+ const std::lock_guard<QRecursiveMutex> lock(m_mutex);
net::HttpCache::DefaultBackend* main_backend = 0;
switch (m_httpCacheType) {
@@ -508,7 +509,7 @@ void ProfileIODataQt::generateJobFactory()
Q_ASSERT(m_urlRequestContext);
Q_ASSERT(!m_jobFactory);
- QMutexLocker lock(&m_mutex);
+ const std::lock_guard<QRecursiveMutex> lock(m_mutex);
m_updateJobFactory = false;
std::unique_ptr<net::URLRequestJobFactoryImpl> jobFactory(new net::URLRequestJobFactoryImpl());
@@ -563,7 +564,7 @@ void ProfileIODataQt::regenerateJobFactory()
Q_ASSERT(m_jobFactory);
Q_ASSERT(m_baseJobFactory);
- QMutexLocker lock(&m_mutex);
+ const std::lock_guard<QRecursiveMutex> lock(m_mutex);
m_updateJobFactory = false;
if (m_customUrlSchemes == m_installedCustomSchemes)
@@ -584,7 +585,7 @@ void ProfileIODataQt::regenerateJobFactory()
void ProfileIODataQt::setGlobalCertificateVerification()
{
Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
- QMutexLocker lock(&m_mutex);
+ const std::lock_guard<QRecursiveMutex> lock(m_mutex);
if (m_useForGlobalCertificateVerification) {
#if defined(USE_NSS_CERTS)
// Set request context used by NSS for OCSP requests.
@@ -623,7 +624,7 @@ void ProfileIODataQt::setFullConfiguration()
void ProfileIODataQt::requestStorageGeneration() {
Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- QMutexLocker lock(&m_mutex);
+ const std::lock_guard<QRecursiveMutex> lock(m_mutex);
if (m_initialized && !m_updateAllStorage) {
m_updateAllStorage = true;
createProxyConfig();
@@ -636,7 +637,7 @@ void ProfileIODataQt::requestStorageGeneration() {
void ProfileIODataQt::createProxyConfig()
{
Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- QMutexLocker lock(&m_mutex);
+ const std::lock_guard<QRecursiveMutex> lock(m_mutex);
// We must create the proxy config service on the UI loop on Linux because it
// must synchronously run on the glib message loop. This will be passed to
// the URLRequestContextStorage on the IO thread in GetURLRequestContext().
@@ -657,7 +658,7 @@ void ProfileIODataQt::updateStorageSettings()
{
Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- QMutexLocker lock(&m_mutex);
+ const std::lock_guard<QRecursiveMutex> lock(m_mutex);
setFullConfiguration();
base::Token groupId = content::BrowserContext::GetServiceInstanceGroupFor(m_profile);
@@ -672,7 +673,7 @@ void ProfileIODataQt::updateStorageSettings()
void ProfileIODataQt::updateCookieStore()
{
Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- QMutexLocker lock(&m_mutex);
+ const std::lock_guard<QRecursiveMutex> lock(m_mutex);
m_persistentCookiesPolicy = m_profileAdapter->persistentCookiesPolicy();
m_cookiesPath = m_profileAdapter->cookiesPath();
if (!m_pendingStorageRequestGeneration)
@@ -682,7 +683,7 @@ void ProfileIODataQt::updateCookieStore()
void ProfileIODataQt::updateUserAgent()
{
Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- QMutexLocker lock(&m_mutex);
+ const std::lock_guard<QRecursiveMutex> lock(m_mutex);
m_httpAcceptLanguage = m_profileAdapter->httpAcceptLanguage();
m_httpUserAgent = m_profileAdapter->httpUserAgent();
if (!m_pendingStorageRequestGeneration)
@@ -692,7 +693,7 @@ void ProfileIODataQt::updateUserAgent()
void ProfileIODataQt::updateHttpCache()
{
Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- QMutexLocker lock(&m_mutex);
+ const std::lock_guard<QRecursiveMutex> lock(m_mutex);
m_httpCacheType = m_profileAdapter->httpCacheType();
m_httpCachePath = m_profileAdapter->httpCachePath();
m_httpCacheMaxSize = m_profileAdapter->httpCacheMaxSize();
@@ -716,7 +717,7 @@ void ProfileIODataQt::updateHttpCache()
void ProfileIODataQt::updateJobFactory()
{
Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- QMutexLocker lock(&m_mutex);
+ const std::lock_guard<QRecursiveMutex> lock(m_mutex);
m_customUrlSchemes = m_profileAdapter->customUrlSchemes();
@@ -730,7 +731,7 @@ void ProfileIODataQt::updateJobFactory()
void ProfileIODataQt::updateRequestInterceptor()
{
Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- QMutexLocker lock(&m_mutex);
+ const std::lock_guard<QRecursiveMutex> lock(m_mutex);
m_requestInterceptor = m_profileAdapter->requestInterceptor();
m_hasPageInterceptors = m_profileAdapter->hasPageRequestInterceptor();
// We in this case do not need to regenerate any Chromium classes.
@@ -772,7 +773,7 @@ bool ProfileIODataQt::canGetCookies(const QUrl &firstPartyUrl, const QUrl &url)
void ProfileIODataQt::updateUsedForGlobalCertificateVerification()
{
Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- QMutexLocker lock(&m_mutex);
+ const std::lock_guard<QRecursiveMutex> lock(m_mutex);
m_useForGlobalCertificateVerification = m_profileAdapter->isUsedForGlobalCertificateVerification();
if (m_useForGlobalCertificateVerification)
diff --git a/src/core/profile_io_data_qt.h b/src/core/profile_io_data_qt.h
index f2dc67f44..4a5b9f77d 100644
--- a/src/core/profile_io_data_qt.h
+++ b/src/core/profile_io_data_qt.h
@@ -177,7 +177,12 @@ private:
QList<QByteArray> m_customUrlSchemes;
QList<QByteArray> m_installedCustomSchemes;
QWebEngineUrlRequestInterceptor* m_requestInterceptor = nullptr;
- QMutex m_mutex;
+#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
+ QMutex m_mutex{QMutex::Recursive};
+ using QRecursiveMutex = QMutex;
+#else
+ QRecursiveMutex m_mutex;
+#endif
int m_httpCacheMaxSize = 0;
bool m_initialized = false;
bool m_updateAllStorage = false;
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp
index 0242506ee..2918fd8bc 100644
--- a/src/core/render_widget_host_view_qt.cpp
+++ b/src/core/render_widget_host_view_qt.cpp
@@ -51,6 +51,9 @@
#include "web_contents_adapter_client.h"
#include "web_event_factory.h"
+#include "base/threading/thread_task_runner_handle.h"
+#include "components/viz/common/features.h"
+#include "components/viz/common/frame_sinks/begin_frame_source.h"
#include "components/viz/common/surfaces/frame_sink_id_allocator.h"
#include "components/viz/host/host_frame_sink_manager.h"
#include "content/browser/compositor/surface_utils.h"
@@ -271,10 +274,12 @@ static content::ScreenInfo screenInfoFromQScreen(QScreen *screen)
RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost *widget)
: content::RenderWidgetHostViewBase::RenderWidgetHostViewBase(widget)
+ , m_taskRunner(base::ThreadTaskRunnerHandle::Get())
, m_gestureProvider(QtGestureProviderConfig(), this)
, m_sendMotionActionDown(false)
, m_touchMotionStarted(false)
- , m_compositor(new Compositor(widget))
+ , m_enableViz(features::IsVizDisplayCompositorEnabled())
+ , m_visible(false)
, m_loadVisuallyCommittedState(NotCommitted)
, m_adapterClient(0)
, m_imeInProgress(false)
@@ -288,14 +293,39 @@ RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost *widget
, m_mouseWheelPhaseHandler(this)
, m_frameSinkId(host()->GetFrameSinkId())
{
- host()->SetView(this);
-
if (GetTextInputManager())
GetTextInputManager()->AddObserver(this);
const QPlatformInputContext *context = QGuiApplicationPrivate::platformIntegration()->inputContext();
m_imeHasHiddenTextCapability = context && context->hasCapability(QPlatformInputContext::HiddenTextCapability);
+ if (m_enableViz) {
+ m_rootLayer.reset(new ui::Layer(ui::LAYER_SOLID_COLOR));
+ m_rootLayer->SetColor(SK_ColorTRANSPARENT);
+
+ m_delegatedFrameHost.reset(new content::DelegatedFrameHost(
+ host()->GetFrameSinkId(),
+ &m_delegatedFrameHostClient,
+ true /* should_register_frame_sink_id */));
+
+ content::ImageTransportFactory *imageTransportFactory = content::ImageTransportFactory::GetInstance();
+ ui::ContextFactory *contextFactory = imageTransportFactory->GetContextFactory();
+ ui::ContextFactoryPrivate *contextFactoryPrivate = imageTransportFactory->GetContextFactoryPrivate();
+ m_uiCompositor.reset(new ui::Compositor(
+ contextFactoryPrivate->AllocateFrameSinkId(),
+ contextFactory,
+ contextFactoryPrivate,
+ m_taskRunner,
+ false /* enable_pixel_canvas */));
+ m_uiCompositor->SetAcceleratedWidget(gfx::kNullAcceleratedWidget); // null means offscreen
+ m_uiCompositor->SetRootLayer(m_rootLayer.get());
+
+ m_displayFrameSink = DisplayFrameSink::findOrCreate(m_uiCompositor->frame_sink_id());
+ m_displayFrameSink->connect(this);
+ } else {
+ m_compositor.reset(new Compositor(widget));
+ }
+
if (host()->delegate() && host()->delegate()->GetInputEventRouter())
host()->delegate()->GetInputEventRouter()->AddFrameSinkIdOwner(GetFrameSinkId(), this);
@@ -305,12 +335,22 @@ RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost *widget
config.tap_slop = ui::GestureConfiguration::GetInstance()->max_touch_move_in_pixels_for_click();
config.enable_longpress_drag_selection = false;
m_touchSelectionController.reset(new ui::TouchSelectionController(m_touchSelectionControllerClient.get(), config));
+
+ host()->render_frame_metadata_provider()->ReportAllFrameSubmissionsForTesting(true);
+
+ // May call SetNeedsBeginFrames
+ host()->SetView(this);
}
RenderWidgetHostViewQt::~RenderWidgetHostViewQt()
{
+ m_delegate.reset();
+
QObject::disconnect(m_adapterClientDestroyedConnection);
+ if (m_enableViz)
+ m_displayFrameSink->disconnect(this);
+
if (text_input_manager_)
text_input_manager_->RemoveObserver(this);
@@ -404,6 +444,8 @@ bool RenderWidgetHostViewQt::HasFocus()
bool RenderWidgetHostViewQt::IsSurfaceAvailableForCopy()
{
+ if (m_enableViz)
+ return m_delegatedFrameHost->CanCopyFromCompositingSurface();
return true;
}
@@ -411,6 +453,11 @@ void RenderWidgetHostViewQt::CopyFromSurface(const gfx::Rect &src_rect,
const gfx::Size &output_size,
base::OnceCallback<void(const SkBitmap &)> callback)
{
+ if (m_enableViz) {
+ m_delegatedFrameHost->CopyFromCompositingSurface(src_rect, output_size, std::move(callback));
+ return;
+ }
+
QImage image;
if (m_delegate->copySurface(toQt(src_rect), toQt(output_size), image))
std::move(callback).Run(toSkBitmap(image));
@@ -441,6 +488,18 @@ gfx::Rect RenderWidgetHostViewQt::GetViewBounds()
void RenderWidgetHostViewQt::UpdateBackgroundColor()
{
+ if (m_enableViz) {
+ DCHECK(GetBackgroundColor());
+ SkColor color = *GetBackgroundColor();
+ bool opaque = SkColorGetA(color) == SK_AlphaOPAQUE;
+ m_rootLayer->SetFillsBoundsOpaquely(opaque);
+ m_rootLayer->SetColor(color);
+ m_uiCompositor->SetBackgroundColor(color);
+ m_delegate->setClearColor(toQt(color));
+ host()->Send(new RenderViewObserverQt_SetBackgroundColor(host()->GetRoutingID(), color));
+ return;
+ }
+
auto color = GetBackgroundColor();
if (color) {
m_delegate->setClearColor(toQt(*color));
@@ -662,17 +721,15 @@ void RenderWidgetHostViewQt::DisplayTooltipText(const base::string16 &tooltip_te
m_adapterClient->setToolTip(toQt(tooltip_text));
}
-void RenderWidgetHostViewQt::DidCreateNewRendererCompositorFrameSink(viz::mojom::CompositorFrameSinkClient *frameSink)
+void RenderWidgetHostViewQt::DidCreateNewRendererCompositorFrameSink(viz::mojom::CompositorFrameSinkClient *frameSinkClient)
{
- m_compositor->setFrameSinkClient(frameSink);
+ DCHECK(!m_enableViz);
+ m_compositor->setFrameSinkClient(frameSinkClient);
}
-void RenderWidgetHostViewQt::SubmitCompositorFrame(const viz::LocalSurfaceId &local_surface_id, viz::CompositorFrame frame, base::Optional<viz::HitTestRegionList>)
+void RenderWidgetHostViewQt::SubmitCompositorFrame(const viz::LocalSurfaceId &local_surface_id, viz::CompositorFrame frame, base::Optional<viz::HitTestRegionList> hit_test_region_list)
{
- bool scrollOffsetChanged = (m_lastScrollOffset != frame.metadata.root_scroll_offset);
- bool contentsSizeChanged = (m_lastContentsSize != frame.metadata.root_layer_size);
- m_lastScrollOffset = frame.metadata.root_scroll_offset;
- m_lastContentsSize = frame.metadata.root_layer_size;
+ DCHECK(!m_enableViz);
// Force to process swap messages
uint32_t frame_token = frame.metadata.frame_token;
@@ -681,19 +738,7 @@ void RenderWidgetHostViewQt::SubmitCompositorFrame(const viz::LocalSurfaceId &lo
m_compositor->submitFrame(
std::move(frame),
- base::BindOnce(&RenderWidgetHostViewQtDelegate::update, base::Unretained(m_delegate.get())));
-
- if (m_loadVisuallyCommittedState == NotCommitted) {
- m_loadVisuallyCommittedState = DidFirstCompositorFrameSwap;
- } else if (m_loadVisuallyCommittedState == DidFirstVisuallyNonEmptyPaint) {
- m_adapterClient->loadVisuallyCommitted();
- m_loadVisuallyCommittedState = NotCommitted;
- }
-
- if (scrollOffsetChanged)
- m_adapterClient->updateScrollPosition(toQt(m_lastScrollOffset));
- if (contentsSizeChanged)
- m_adapterClient->updateContentsSize(toQt(m_lastContentsSize));
+ base::BindOnce(&RenderWidgetHostViewQt::callUpdate, base::Unretained(this)));
}
void RenderWidgetHostViewQt::GetScreenInfo(content::ScreenInfo *results)
@@ -906,7 +951,7 @@ viz::ScopedSurfaceIdAllocator RenderWidgetHostViewQt::DidUpdateVisualProperties(
base::OnceCallback<void()> allocation_task =
base::BindOnce(&RenderWidgetHostViewQt::OnDidUpdateVisualPropertiesComplete,
base::Unretained(this), metadata);
- return viz::ScopedSurfaceIdAllocator(std::move(allocation_task));
+ return viz::ScopedSurfaceIdAllocator(&m_dfhLocalSurfaceIdAllocator, std::move(allocation_task));
}
void RenderWidgetHostViewQt::OnDidUpdateVisualPropertiesComplete(const cc::RenderFrameMetadata &metadata)
@@ -914,19 +959,71 @@ void RenderWidgetHostViewQt::OnDidUpdateVisualPropertiesComplete(const cc::Rende
synchronizeVisualProperties(metadata.local_surface_id_allocation);
}
+void RenderWidgetHostViewQt::OnDidFirstVisuallyNonEmptyPaint()
+{
+ if (m_loadVisuallyCommittedState == NotCommitted) {
+ m_loadVisuallyCommittedState = DidFirstVisuallyNonEmptyPaint;
+ } else if (m_loadVisuallyCommittedState == DidFirstCompositorFrameSwap) {
+ m_adapterClient->loadVisuallyCommitted();
+ m_loadVisuallyCommittedState = NotCommitted;
+ }
+}
+
+void RenderWidgetHostViewQt::scheduleUpdate()
+{
+ DCHECK(m_enableViz);
+ m_taskRunner->PostTask(
+ FROM_HERE,
+ base::BindOnce(&RenderWidgetHostViewQt::callUpdate, m_weakPtrFactory.GetWeakPtr()));
+}
+
+void RenderWidgetHostViewQt::callUpdate()
+{
+ m_delegate->update();
+
+ if (m_loadVisuallyCommittedState == NotCommitted) {
+ m_loadVisuallyCommittedState = DidFirstCompositorFrameSwap;
+ } else if (m_loadVisuallyCommittedState == DidFirstVisuallyNonEmptyPaint) {
+ m_adapterClient->loadVisuallyCommitted();
+ m_loadVisuallyCommittedState = NotCommitted;
+ }
+}
+
QSGNode *RenderWidgetHostViewQt::updatePaintNode(QSGNode *oldNode)
{
+ if (m_enableViz)
+ return m_displayFrameSink->updatePaintNode(oldNode, m_delegate.get());
return m_compositor->updatePaintNode(oldNode, m_delegate.get());
}
void RenderWidgetHostViewQt::notifyShown()
{
- host()->WasShown(false);
+ if (m_enableViz) {
+ if (m_visible)
+ return;
+ m_visible = true;
+ m_delegatedFrameHost->AttachToCompositor(m_uiCompositor.get());
+ m_delegatedFrameHost->WasShown(GetLocalSurfaceIdAllocation().local_surface_id(),
+ m_viewRectInDips.size(),
+ false /* record_presentation_time */);
+ host()->WasShown(false);
+ } else {
+ host()->WasShown(false);
+ }
}
void RenderWidgetHostViewQt::notifyHidden()
{
- host()->WasHidden();
+ if (m_enableViz) {
+ if (!m_visible)
+ return;
+ m_visible = false;
+ host()->WasHidden();
+ m_delegatedFrameHost->WasHidden();
+ m_delegatedFrameHost->DetachFromCompositor();
+ } else {
+ host()->WasHidden();
+ }
}
void RenderWidgetHostViewQt::visualPropertiesChanged()
@@ -1644,6 +1741,7 @@ void RenderWidgetHostViewQt::handleFocusEvent(QFocusEvent *ev)
void RenderWidgetHostViewQt::SetNeedsBeginFrames(bool needs_begin_frames)
{
+ DCHECK(!m_enableViz);
m_compositor->setNeedsBeginFrames(needs_begin_frames);
}
@@ -1683,26 +1781,35 @@ void RenderWidgetHostViewQt::SetWantsAnimateOnlyBeginFrames()
viz::SurfaceId RenderWidgetHostViewQt::GetCurrentSurfaceId() const
{
+ if (m_enableViz)
+ return m_delegatedFrameHost->GetCurrentSurfaceId();
return viz::SurfaceId();
}
const viz::FrameSinkId &RenderWidgetHostViewQt::GetFrameSinkId() const
{
+ if (m_enableViz)
+ return m_delegatedFrameHost->frame_sink_id();
return m_frameSinkId;
}
const viz::LocalSurfaceIdAllocation &RenderWidgetHostViewQt::GetLocalSurfaceIdAllocation() const
{
- return m_localSurfaceIdAllocator.GetCurrentLocalSurfaceIdAllocation();
+ return m_dfhLocalSurfaceIdAllocator.GetCurrentLocalSurfaceIdAllocation();
}
void RenderWidgetHostViewQt::TakeFallbackContentFrom(content::RenderWidgetHostView *view)
{
DCHECK(!static_cast<RenderWidgetHostViewBase*>(view)->IsRenderWidgetHostViewChildFrame());
DCHECK(!static_cast<RenderWidgetHostViewBase*>(view)->IsRenderWidgetHostViewGuest());
- base::Optional<SkColor> color = view->GetBackgroundColor();
+ RenderWidgetHostViewQt *viewQt = static_cast<RenderWidgetHostViewQt *>(view);
+ base::Optional<SkColor> color = viewQt->GetBackgroundColor();
if (color)
SetBackgroundColor(*color);
+ if (m_enableViz) {
+ m_delegatedFrameHost->TakeFallbackContentFrom(viewQt->m_delegatedFrameHost.get());
+ host()->GetContentRenderingTimeoutFrom(viewQt->host());
+ }
}
void RenderWidgetHostViewQt::EnsureSurfaceSynchronizedForWebTest()
@@ -1729,14 +1836,38 @@ void RenderWidgetHostViewQt::OnRenderFrameMetadataChangedAfterActivation()
m_selectionEnd = metadata.selection.end;
m_touchSelectionControllerClient->UpdateClientSelectionBounds(m_selectionStart, m_selectionEnd);
}
+
+ gfx::Vector2dF scrollOffset = metadata.root_scroll_offset.value_or(gfx::Vector2dF());
+ gfx::SizeF contentsSize = metadata.root_layer_size;
+ std::swap(m_lastScrollOffset, scrollOffset);
+ std::swap(m_lastContentsSize, contentsSize);
+ if (scrollOffset != m_lastScrollOffset)
+ m_adapterClient->updateScrollPosition(toQt(m_lastScrollOffset));
+ if (contentsSize != m_lastContentsSize)
+ m_adapterClient->updateContentsSize(toQt(m_lastContentsSize));
}
void RenderWidgetHostViewQt::synchronizeVisualProperties(const base::Optional<viz::LocalSurfaceIdAllocation> &childSurfaceId)
{
if (childSurfaceId)
- m_localSurfaceIdAllocator.UpdateFromChild(*childSurfaceId);
+ m_dfhLocalSurfaceIdAllocator.UpdateFromChild(*childSurfaceId);
else
- m_localSurfaceIdAllocator.GenerateId();
+ m_dfhLocalSurfaceIdAllocator.GenerateId();
+
+ if (m_enableViz) {
+ gfx::Size viewSizeInDips = GetRequestedRendererSize();
+ gfx::Size viewSizeInPixels = GetCompositorViewportPixelSize();
+ m_rootLayer->SetBounds(gfx::Rect(gfx::Point(), viewSizeInPixels));
+ m_uiCompositorLocalSurfaceIdAllocator.GenerateId();
+ m_uiCompositor->SetScaleAndSize(
+ m_screenInfo.device_scale_factor,
+ viewSizeInPixels,
+ m_uiCompositorLocalSurfaceIdAllocator.GetCurrentLocalSurfaceIdAllocation());
+ m_delegatedFrameHost->EmbedSurface(
+ m_dfhLocalSurfaceIdAllocator.GetCurrentLocalSurfaceIdAllocation().local_surface_id(),
+ viewSizeInDips,
+ cc::DeadlinePolicy::UseDefaultDeadline());
+ }
host()->SynchronizeVisualProperties();
}
diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h
index 91d5b8610..5935f477a 100644
--- a/src/core/render_widget_host_view_qt.h
+++ b/src/core/render_widget_host_view_qt.h
@@ -40,10 +40,11 @@
#ifndef RENDER_WIDGET_HOST_VIEW_QT_H
#define RENDER_WIDGET_HOST_VIEW_QT_H
+#include "compositor/display_frame_sink.h"
+#include "delegated_frame_host_client_qt.h"
#include "render_widget_host_view_qt_delegate.h"
#include "base/memory/weak_ptr.h"
-#include "components/viz/common/frame_sinks/begin_frame_source.h"
#include "components/viz/common/resources/transferable_resource.h"
#include "components/viz/common/surfaces/parent_local_surface_id_allocator.h"
#include "components/viz/host/host_frame_sink_client.h"
@@ -53,7 +54,7 @@
#include "content/browser/renderer_host/text_input_manager.h"
#include "gpu/ipc/common/gpu_messages.h"
#include "ui/events/gesture_detection/filtered_gesture_provider.h"
-#include "qtwebenginecoreglobal_p.h"
+
#include <QMap>
#include <QPoint>
#include <QtGlobal>
@@ -104,6 +105,7 @@ class RenderWidgetHostViewQt
, public RenderWidgetHostViewQtDelegateClient
, public base::SupportsWeakPtr<RenderWidgetHostViewQt>
, public content::TextInputManager::Observer
+ , public DisplayConsumer
{
public:
enum LoadVisuallyCommittedState {
@@ -215,12 +217,16 @@ public:
// Overridden from content::BrowserAccessibilityDelegate
content::BrowserAccessibilityManager* CreateBrowserAccessibilityManager(content::BrowserAccessibilityDelegate* delegate, bool for_root_frame) override;
- LoadVisuallyCommittedState getLoadVisuallyCommittedState() const { return m_loadVisuallyCommittedState; }
- void setLoadVisuallyCommittedState(LoadVisuallyCommittedState state) { m_loadVisuallyCommittedState = state; }
+
+ // Called from WebContentsDelegateQt
+ void OnDidFirstVisuallyNonEmptyPaint();
// Overridden from content::RenderFrameMetadataProvider::Observer
void OnRenderFrameMetadataChangedAfterActivation() override;
+ // Overridden from DisplayConsumer
+ void scheduleUpdate() override;
+
gfx::SizeF lastContentsSize() const { return m_lastContentsSize; }
gfx::Vector2dF lastScrollOffset() const { return m_lastScrollOffset; }
@@ -230,6 +236,8 @@ public:
ui::TextInputType getTextInputType() const;
private:
+ friend class DelegatedFrameHostClientQt;
+
void processMotionEvent(const ui::MotionEvent &motionEvent);
void clearPreviousTouchMotionState();
QList<QTouchEvent::TouchPoint> mapTouchPointIds(const QList<QTouchEvent::TouchPoint> &inputPoints);
@@ -241,12 +249,16 @@ private:
void synchronizeVisualProperties(const base::Optional<viz::LocalSurfaceIdAllocation> &childSurfaceId);
+ void callUpdate();
+
// Geometry of the view in screen DIPs.
gfx::Rect m_viewRectInDips;
// Geometry of the window, including frame, in screen DIPs.
gfx::Rect m_windowRectInDips;
content::ScreenInfo m_screenInfo;
+ scoped_refptr<base::SingleThreadTaskRunner> m_taskRunner;
+
ui::FilteredGestureProvider m_gestureProvider;
base::TimeDelta m_eventsToNowDelta;
bool m_sendMotionActionDown;
@@ -255,6 +267,13 @@ private:
QList<QTouchEvent::TouchPoint> m_previousTouchPoints;
std::unique_ptr<RenderWidgetHostViewQtDelegate> m_delegate;
+ const bool m_enableViz;
+ bool m_visible;
+ DelegatedFrameHostClientQt m_delegatedFrameHostClient{this};
+ std::unique_ptr<content::DelegatedFrameHost> m_delegatedFrameHost;
+ std::unique_ptr<ui::Layer> m_rootLayer;
+ std::unique_ptr<ui::Compositor> m_uiCompositor;
+ scoped_refptr<DisplayFrameSink> m_displayFrameSink;
std::unique_ptr<Compositor> m_compositor;
LoadVisuallyCommittedState m_loadVisuallyCommittedState;
@@ -268,7 +287,8 @@ private:
gfx::Vector2dF m_lastScrollOffset;
gfx::SizeF m_lastContentsSize;
- viz::ParentLocalSurfaceIdAllocator m_localSurfaceIdAllocator;
+ viz::ParentLocalSurfaceIdAllocator m_dfhLocalSurfaceIdAllocator;
+ viz::ParentLocalSurfaceIdAllocator m_uiCompositorLocalSurfaceIdAllocator;
uint m_imState;
int m_anchorPositionWithinSelection;
@@ -290,6 +310,8 @@ private:
std::unique_ptr<ui::TouchSelectionController> m_touchSelectionController;
gfx::SelectionBound m_selectionStart;
gfx::SelectionBound m_selectionEnd;
+
+ base::WeakPtrFactory<RenderWidgetHostViewQt> m_weakPtrFactory{this};
};
} // namespace QtWebEngineCore
diff --git a/src/core/type_conversion.cpp b/src/core/type_conversion.cpp
index 02d2db448..ddadeb9f2 100644
--- a/src/core/type_conversion.cpp
+++ b/src/core/type_conversion.cpp
@@ -40,11 +40,14 @@
#include "type_conversion.h"
#include <content/public/common/favicon_url.h>
+#include <net/cert/x509_certificate.h>
+#include <net/cert/x509_util.h>
#include <ui/events/event_constants.h>
#include <ui/gfx/image/image_skia.h>
#include <QtCore/qcoreapplication.h>
#include <QtGui/qmatrix4x4.h>
+#include <QtNetwork/qsslcertificate.h>
namespace QtWebEngineCore {
@@ -256,4 +259,20 @@ void convertToQt(const SkMatrix44 &m, QMatrix4x4 &c)
c = qtMatrix;
}
+static QSslCertificate toCertificate(CRYPTO_BUFFER *buffer)
+{
+ auto derCert = net::x509_util::CryptoBufferAsStringPiece(buffer);
+ return QSslCertificate(QByteArray::fromRawData(derCert.data(), derCert.size()), QSsl::Der);
+}
+
+QList<QSslCertificate> toCertificateChain(net::X509Certificate *certificate)
+{
+ // from leaf to root as in QtNetwork
+ QList<QSslCertificate> chain;
+ chain.append(toCertificate(certificate->cert_buffer()));
+ for (auto &&buffer : certificate->intermediate_buffers())
+ chain.append(toCertificate(buffer.get()));
+ return chain;
+}
+
} // namespace QtWebEngineCore
diff --git a/src/core/type_conversion.h b/src/core/type_conversion.h
index 7b1f1b4d6..dfd8e8fef 100644
--- a/src/core/type_conversion.h
+++ b/src/core/type_conversion.h
@@ -64,6 +64,7 @@
#include "url/gurl.h"
QT_FORWARD_DECLARE_CLASS(QMatrix4x4)
+QT_FORWARD_DECLARE_CLASS(QSslCertificate)
namespace content {
struct FaviconURL;
@@ -73,6 +74,10 @@ namespace gfx {
class ImageSkiaRep;
}
+namespace net {
+class X509Certificate;
+}
+
namespace QtWebEngineCore {
inline QString toQt(const base::string16 &string)
@@ -291,6 +296,8 @@ inline QStringList fromVector(const std::vector<base::string16> &vector)
FaviconInfo toFaviconInfo(const content::FaviconURL &);
+QList<QSslCertificate> toCertificateChain(net::X509Certificate *certificate);
+
} // namespace QtWebEngineCore
#endif // TYPE_CONVERSION_H
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index ee0b8cc39..85e63c5a4 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -86,7 +86,6 @@
#include "content/public/common/web_preferences.h"
#include "content/public/common/webrtc_ip_handling_policy.h"
#include "extensions/buildflags/buildflags.h"
-#include "third_party/blink/public/mojom/frame/find_in_page.mojom.h"
#include "third_party/blink/public/web/web_media_player_action.h"
#include "printing/buildflags/buildflags.h"
#include "ui/base/clipboard/clipboard.h"
@@ -416,7 +415,6 @@ WebContentsAdapter::WebContentsAdapter()
#endif
, m_adapterClient(nullptr)
, m_nextRequestId(CallbackDirectory::ReservedCallbackIdsEnd)
- , m_lastFindRequestId(0)
, m_currentDropAction(blink::kWebDragOperationNone)
, m_devToolsFrontend(nullptr)
{
@@ -433,7 +431,6 @@ WebContentsAdapter::WebContentsAdapter(std::unique_ptr<content::WebContents> web
#endif
, m_adapterClient(nullptr)
, m_nextRequestId(CallbackDirectory::ReservedCallbackIdsEnd)
- , m_lastFindRequestId(0)
, m_currentDropAction(blink::kWebDragOperationNone)
, m_devToolsFrontend(nullptr)
{
@@ -694,7 +691,7 @@ void WebContentsAdapter::load(const QWebEngineHttpRequest &request)
}
auto navigate = [](QWeakPointer<WebContentsAdapter> weakAdapter, const content::NavigationController::LoadURLParams &params) {
- WebContentsAdapter *adapter = weakAdapter.data();
+ const auto adapter = weakAdapter.toStrongRef();
if (!adapter)
return;
adapter->webContents()->GetController().LoadURLWithParams(params);
@@ -1046,41 +1043,6 @@ quint64 WebContentsAdapter::fetchDocumentInnerText()
return m_nextRequestId++;
}
-quint64 WebContentsAdapter::findText(const QString &subString, bool caseSensitively, bool findBackward)
-{
- CHECK_INITIALIZED(0);
- if (m_lastFindRequestId > m_webContentsDelegate->lastReceivedFindReply()) {
- // There are cases where the render process will overwrite a previous request
- // with the new search and we'll have a dangling callback, leaving the application
- // waiting for it forever.
- // Assume that any unfinished find has been unsuccessful when a new one is started
- // to cover that case.
- m_webContentsDelegate->setLastReceivedFindReply(m_lastFindRequestId);
- m_adapterClient->didFindText(m_lastFindRequestId, 0);
- }
-
- blink::mojom::FindOptionsPtr options = blink::mojom::FindOptions::New();
- options->forward = !findBackward;
- options->match_case = caseSensitively;
- options->find_next = subString == m_webContentsDelegate->lastSearchedString();
- m_webContentsDelegate->setLastSearchedString(subString);
-
- // Find already allows a request ID as input, but only as an int.
- // Use the same counter but mod it to MAX_INT, this keeps the same likeliness of request ID clashing.
- int shrunkRequestId = m_nextRequestId++ & 0x7fffffff;
- m_webContents->Find(shrunkRequestId, toString16(subString), std::move(options));
- m_lastFindRequestId = shrunkRequestId;
- return shrunkRequestId;
-}
-
-void WebContentsAdapter::stopFinding()
-{
- CHECK_INITIALIZED();
- m_webContentsDelegate->setLastReceivedFindReply(m_lastFindRequestId);
- m_webContentsDelegate->setLastSearchedString(QString());
- m_webContents->StopFinding(content::STOP_FIND_ACTION_KEEP_SELECTION);
-}
-
void WebContentsAdapter::updateWebPreferences(const content::WebPreferences & webPreferences)
{
CHECK_INITIALIZED();
@@ -1696,12 +1658,6 @@ void WebContentsAdapter::focusIfNecessary()
m_webContents->Focus();
}
-bool WebContentsAdapter::isFindTextInProgress() const
-{
- CHECK_INITIALIZED(false);
- return m_lastFindRequestId != m_webContentsDelegate->lastReceivedFindReply();
-}
-
bool WebContentsAdapter::hasFocusedFrame() const
{
CHECK_INITIALIZED(false);
@@ -1745,6 +1701,12 @@ FaviconManager *WebContentsAdapter::faviconManager()
return m_webContentsDelegate->faviconManager();
}
+FindTextHelper *WebContentsAdapter::findTextHelper()
+{
+ CHECK_INITIALIZED(nullptr);
+ return m_webContentsDelegate->findTextHelper();
+}
+
void WebContentsAdapter::viewSource()
{
CHECK_INITIALIZED();
diff --git a/src/core/web_contents_adapter.h b/src/core/web_contents_adapter.h
index baf9d241c..11f8f9cb1 100644
--- a/src/core/web_contents_adapter.h
+++ b/src/core/web_contents_adapter.h
@@ -85,6 +85,7 @@ namespace QtWebEngineCore {
class DevToolsFrontendQt;
class FaviconManager;
+class FindTextHelper;
class MessagePassingInterface;
class ProfileQt;
class RenderViewObserverHostQt;
@@ -158,8 +159,6 @@ public:
quint64 runJavaScriptCallbackResult(const QString &javaScript, quint32 worldId);
quint64 fetchDocumentMarkup();
quint64 fetchDocumentInnerText();
- quint64 findText(const QString &subString, bool caseSensitively, bool findBackward);
- void stopFinding();
void updateWebPreferences(const content::WebPreferences &webPreferences);
void download(const QUrl &url, const QString &suggestedFileName,
const QUrl &referrerUrl = QUrl(),
@@ -205,6 +204,7 @@ public:
void setWebChannel(QWebChannel *, uint worldId);
#endif
FaviconManager *faviconManager();
+ FindTextHelper *findTextHelper();
QPointF lastScrollOffset() const;
QSizeF lastContentsSize() const;
@@ -263,7 +263,6 @@ private:
#endif
WebContentsAdapterClient *m_adapterClient;
quint64 m_nextRequestId;
- int m_lastFindRequestId;
std::unique_ptr<content::DropData> m_currentDropData;
uint m_currentDropAction;
bool m_updateDragActionCalled;
diff --git a/src/core/web_contents_adapter_client.h b/src/core/web_contents_adapter_client.h
index d53568215..4bdb55b4c 100644
--- a/src/core/web_contents_adapter_client.h
+++ b/src/core/web_contents_adapter_client.h
@@ -64,6 +64,7 @@ QT_FORWARD_DECLARE_CLASS(CertificateErrorController)
QT_FORWARD_DECLARE_CLASS(ClientCertSelectController)
QT_FORWARD_DECLARE_CLASS(QKeyEvent)
QT_FORWARD_DECLARE_CLASS(QVariant)
+QT_FORWARD_DECLARE_CLASS(QWebEngineFindTextResult)
QT_FORWARD_DECLARE_CLASS(QWebEngineQuotaRequest)
QT_FORWARD_DECLARE_CLASS(QWebEngineRegisterProtocolHandlerRequest)
QT_FORWARD_DECLARE_CLASS(QWebEngineUrlRequestInfo)
@@ -461,7 +462,6 @@ public:
virtual void didRunJavaScript(quint64 requestId, const QVariant& result) = 0;
virtual void didFetchDocumentMarkup(quint64 requestId, const QString& result) = 0;
virtual void didFetchDocumentInnerText(quint64 requestId, const QString& result) = 0;
- virtual void didFindText(quint64 requestId, int matchCount) = 0;
virtual void didPrintPage(quint64 requestId, QSharedPointer<QByteArray>) = 0;
virtual void didPrintPageToPdf(const QString &filePath, bool success) = 0;
virtual bool passOnFocus(bool reverse) = 0;
@@ -499,6 +499,7 @@ public:
virtual TouchHandleDrawableClient *createTouchHandle(const QMap<int, QImage> &images) = 0;
virtual void showTouchSelectionMenu(TouchSelectionMenuController *menuController, const QRect &bounds, const QSize &handleSize) = 0;
virtual void hideTouchSelectionMenu() = 0;
+ virtual void findTextFinished(const QWebEngineFindTextResult &result) = 0;
virtual ProfileAdapter *profileAdapter() = 0;
virtual WebContentsAdapter* webContentsAdapter() = 0;
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp
index f18617f8e..9855e3859 100644
--- a/src/core/web_contents_delegate_qt.cpp
+++ b/src/core/web_contents_delegate_qt.cpp
@@ -102,8 +102,8 @@ static WebContentsAdapterClient::JavaScriptConsoleMessageLevel mapToJavascriptCo
WebContentsDelegateQt::WebContentsDelegateQt(content::WebContents *webContents, WebContentsAdapterClient *adapterClient)
: m_viewClient(adapterClient)
- , m_lastReceivedFindReply(0)
, m_faviconManager(new FaviconManager(webContents, adapterClient))
+ , m_findTextHelper(new FindTextHelper(webContents, adapterClient))
, m_lastLoadProgress(-1)
, m_loadingState(determineLoadingState(webContents))
, m_didStartLoadingSeen(m_loadingState == LoadingState::Loading)
@@ -350,9 +350,7 @@ void WebContentsDelegateQt::EmitLoadFinished(bool success, const QUrl &url, bool
void WebContentsDelegateQt::EmitLoadCommitted()
{
- // Make sure that we don't set the findNext WebFindOptions on a new frame.
- m_lastSearchedString = QString();
-
+ m_findTextHelper->handleLoadCommitted();
m_viewClient->loadCommitted();
m_viewClient->updateNavigationActions();
}
@@ -577,13 +575,7 @@ bool WebContentsDelegateQt::DidAddMessageToConsole(content::WebContents *source,
void WebContentsDelegateQt::FindReply(content::WebContents *source, int request_id, int number_of_matches, const gfx::Rect& selection_rect, int active_match_ordinal, bool final_update)
{
- Q_UNUSED(source)
- Q_UNUSED(selection_rect)
- Q_UNUSED(active_match_ordinal)
- if (final_update && request_id > m_lastReceivedFindReply) {
- m_lastReceivedFindReply = request_id;
- m_viewClient->didFindText(request_id, number_of_matches);
- }
+ m_findTextHelper->handleFindReply(source, request_id, number_of_matches, selection_rect, active_match_ordinal, final_update);
}
void WebContentsDelegateQt::RequestMediaAccessPermission(content::WebContents *web_contents, const content::MediaStreamRequest &request, content::MediaResponseCallback callback)
@@ -623,13 +615,7 @@ void WebContentsDelegateQt::DidFirstVisuallyNonEmptyPaint()
if (!rwhv)
return;
- RenderWidgetHostViewQt::LoadVisuallyCommittedState loadVisuallyCommittedState = rwhv->getLoadVisuallyCommittedState();
- if (loadVisuallyCommittedState == RenderWidgetHostViewQt::NotCommitted) {
- rwhv->setLoadVisuallyCommittedState(RenderWidgetHostViewQt::DidFirstVisuallyNonEmptyPaint);
- } else if (loadVisuallyCommittedState == RenderWidgetHostViewQt::DidFirstCompositorFrameSwap) {
- m_viewClient->loadVisuallyCommitted();
- rwhv->setLoadVisuallyCommittedState(RenderWidgetHostViewQt::NotCommitted);
- }
+ rwhv->OnDidFirstVisuallyNonEmptyPaint();
}
void WebContentsDelegateQt::ActivateContents(content::WebContents* contents)
@@ -798,6 +784,11 @@ FaviconManager *WebContentsDelegateQt::faviconManager()
return m_faviconManager.data();
}
+FindTextHelper *WebContentsDelegateQt::findTextHelper()
+{
+ return m_findTextHelper.data();
+}
+
WebEngineSettings *WebContentsDelegateQt::webEngineSettings() const {
return m_viewClient->webEngineSettings();
}
diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h
index 00b715c30..f1d5ed76c 100644
--- a/src/core/web_contents_delegate_qt.h
+++ b/src/core/web_contents_delegate_qt.h
@@ -50,6 +50,7 @@
#include "color_chooser_controller.h"
#include "favicon_manager.h"
+#include "find_text_helper.h"
#include "javascript_dialog_manager_qt.h"
#include <QtCore/qvector.h>
@@ -112,10 +113,6 @@ class WebContentsDelegateQt : public content::WebContentsDelegate
public:
WebContentsDelegateQt(content::WebContents*, WebContentsAdapterClient *adapterClient);
~WebContentsDelegateQt();
- QString lastSearchedString() const { return m_lastSearchedString; }
- void setLastSearchedString(const QString &s) { m_lastSearchedString = s; }
- int lastReceivedFindReply() const { return m_lastReceivedFindReply; }
- void setLastReceivedFindReply(int id) { m_lastReceivedFindReply = id; }
QUrl url() const { return m_url; }
QString title() const { return m_title; }
@@ -178,6 +175,7 @@ public:
void requestUserNotificationPermission(const QUrl &requestingOrigin);
void launchExternalURL(const QUrl &url, ui::PageTransition page_transition, bool is_main_frame, bool has_user_gesture);
FaviconManager *faviconManager();
+ FindTextHelper *findTextHelper();
void setSavePageInfo(const SavePageInfo &spi) { m_savePageInfo = spi; }
const SavePageInfo &savePageInfo() { return m_savePageInfo; }
@@ -213,10 +211,9 @@ private:
int &streamCount(blink::MediaStreamType type);
WebContentsAdapterClient *m_viewClient;
- QString m_lastSearchedString;
- int m_lastReceivedFindReply;
QVector<int64_t> m_loadingErrorFrameList;
QScopedPointer<FaviconManager> m_faviconManager;
+ QScopedPointer<FindTextHelper> m_findTextHelper;
SavePageInfo m_savePageInfo;
QSharedPointer<FilePickerController> m_filePickerController;
QUrl m_initialTargetUrl;
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp
index a988040ee..a42565c2b 100644
--- a/src/core/web_engine_context.cpp
+++ b/src/core/web_engine_context.cpp
@@ -488,6 +488,16 @@ WebEngineContext::WebEngineContext()
parsedCommandLine->AppendSwitch(switches::kDisableES3GLContext);
#endif
+ bool threadedGpu = true;
+#ifndef QT_NO_OPENGL
+ threadedGpu = QOpenGLContext::supportsThreadedOpenGL();
+#endif
+
+ bool enableViz = ((threadedGpu && !parsedCommandLine->HasSwitch("disable-viz-display-compositor"))
+ || parsedCommandLine->HasSwitch("enable-viz-display-compositor"));
+ parsedCommandLine->RemoveSwitch("disable-viz-display-compositor");
+ parsedCommandLine->RemoveSwitch("enable-viz-display-compositor");
+
std::string disableFeatures;
std::string enableFeatures;
// Needed to allow navigations within pages that were set using setHtml(). One example is
@@ -495,10 +505,6 @@ WebEngineContext::WebEngineContext()
// This is deprecated behavior, and will be removed in a future Chromium version, as per
// upstream Chromium commit ba52f56207a4b9d70b34880fbff2352e71a06422.
appendToFeatureList(enableFeatures, features::kAllowContentInitiatedDataUrlNavigations.name);
- // Surface synchronization breaks our current graphics integration (since 65)
- appendToFeatureList(disableFeatures, features::kEnableSurfaceSynchronization.name);
- // Viz Display Compositor is enabled by default since 73. Doesn't work for us (also implies SurfaceSynchronization)
- appendToFeatureList(disableFeatures, features::kVizDisplayCompositor.name);
// The video-capture service is not functioning at this moment (since 69)
appendToFeatureList(disableFeatures, features::kMojoVideoCapture.name);
// Breaks WebEngineNewViewRequest.userInitiated API (since 73)
@@ -506,8 +512,6 @@ WebEngineContext::WebEngineContext()
// We do not yet support the network-service, but it is enabled by default since 75.
appendToFeatureList(disableFeatures, network::features::kNetworkService.name);
- // VideoSurfaceLayer is enabled by default since 75. We don't support it.
- appendToFeatureList(disableFeatures, media::kUseSurfaceLayerForVideo.name);
// BlinkGenPropertyTrees is enabled by default in 75, but causes regressions.
appendToFeatureList(disableFeatures, blink::features::kBlinkGenPropertyTrees.name);
@@ -531,6 +535,15 @@ WebEngineContext::WebEngineContext()
parsedCommandLine->AppendSwitch(cc::switches::kDisableCompositedAntialiasing);
}
+ if (!enableViz) {
+ // Surface synchronization breaks our current graphics integration (since 65)
+ appendToFeatureList(disableFeatures, features::kEnableSurfaceSynchronization.name);
+ // Viz Display Compositor is enabled by default since 73. Doesn't work for us (also implies SurfaceSynchronization)
+ appendToFeatureList(disableFeatures, features::kVizDisplayCompositor.name);
+ // VideoSurfaceLayer is enabled by default since 75. We don't support it.
+ appendToFeatureList(disableFeatures, media::kUseSurfaceLayerForVideo.name);
+ }
+
appendToFeatureSwitch(parsedCommandLine, switches::kDisableFeatures, disableFeatures);
appendToFeatureSwitch(parsedCommandLine, switches::kEnableFeatures, enableFeatures);
base::FeatureList::InitializeInstance(
@@ -619,10 +632,6 @@ WebEngineContext::WebEngineContext()
parsedCommandLine->AppendSwitch(switches::kDisableGpu);
}
- bool threadedGpu = true;
-#ifndef QT_NO_OPENGL
- threadedGpu = QOpenGLContext::supportsThreadedOpenGL();
-#endif
registerMainThreadFactories(threadedGpu);
SetContentClient(new ContentClientQt);
diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp
index 1b0723cb5..7f5306e67 100644
--- a/src/core/web_event_factory.cpp
+++ b/src/core/web_event_factory.cpp
@@ -1490,8 +1490,15 @@ blink::WebMouseWheelEvent WebEventFactory::toWebWheelEvent(QWheelEvent *ev)
webEvent.SetType(webEventTypeForEvent(ev));
webEvent.SetModifiers(modifiersForEvent(ev));
webEvent.SetTimeStamp(base::TimeTicks::Now());
+#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
webEvent.SetPositionInWidget(ev->x(), ev->y());
webEvent.SetPositionInScreen(ev->globalX(), ev->globalY());
+#else
+ webEvent.SetPositionInWidget(static_cast<float>(ev->position().x()),
+ static_cast<float>(ev->position().y()));
+ webEvent.SetPositionInScreen(static_cast<float>(ev->globalPosition().x()),
+ static_cast<float>(ev->globalPosition().y()));
+#endif
webEvent.wheel_ticks_x = static_cast<float>(ev->angleDelta().x()) / QWheelEvent::DefaultDeltasPerStep;
webEvent.wheel_ticks_y = static_cast<float>(ev->angleDelta().y()) / QWheelEvent::DefaultDeltasPerStep;
@@ -1520,8 +1527,15 @@ bool WebEventFactory::coalesceWebWheelEvent(blink::WebMouseWheelEvent &webEvent,
#endif
webEvent.SetTimeStamp(base::TimeTicks::Now());
+#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
webEvent.SetPositionInWidget(ev->x(), ev->y());
webEvent.SetPositionInScreen(ev->globalX(), ev->globalY());
+#else
+ webEvent.SetPositionInWidget(static_cast<float>(ev->position().x()),
+ static_cast<float>(ev->position().y()));
+ webEvent.SetPositionInScreen(static_cast<float>(ev->globalPosition().x()),
+ static_cast<float>(ev->globalPosition().y()));
+#endif
webEvent.wheel_ticks_x += static_cast<float>(ev->angleDelta().x()) / QWheelEvent::DefaultDeltasPerStep;
webEvent.wheel_ticks_y += static_cast<float>(ev->angleDelta().y()) / QWheelEvent::DefaultDeltasPerStep;
diff --git a/src/process/support_win.cpp b/src/process/support_win.cpp
index 21481ce08..3d0ef37bf 100644
--- a/src/process/support_win.cpp
+++ b/src/process/support_win.cpp
@@ -38,6 +38,7 @@
****************************************************************************/
#include <qlibrary.h>
+#include <qoperatingsystemversion.h>
#include <qsysinfo.h>
#include <qt_windows.h>
#include <Tlhelp32.h>
@@ -80,7 +81,7 @@ public:
ShcoreDLL()
: getProcessDpiAwareness(0), setProcessDpiAwareness(0)
{
- if (QSysInfo::windowsVersion() < QSysInfo::WV_WINDOWS8_1)
+ if (QOperatingSystemVersion::current() < QOperatingSystemVersion::Windows8_1)
return;
library.setFileName(QStringLiteral("SHCore"));
if (!library.load())
diff --git a/src/src.pro b/src/src.pro
index 30562686a..99967fd82 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -1,32 +1,50 @@
-include($$QTWEBENGINE_OUT_ROOT/src/core/qtwebenginecore-config.pri)
-QT_FOR_CONFIG += webenginecore webenginecore-private
+load(platform)
+
+include($$QTWEBENGINE_OUT_ROOT/src/buildtools/qtbuildtools-config.pri)
+QT_FOR_CONFIG += buildtools-private
TEMPLATE = subdirs
-process.depends = core
-webengine.depends = core
-webenginewidgets.depends = core webengine
-webengine_plugin.subdir = webengine/plugin
-webengine_plugin.target = sub-webengine-plugin
-webengine_plugin.depends = webengine
+isWebEngineCoreBuild():qtConfig(webengine-core) {
+ include($$QTWEBENGINE_OUT_ROOT/src/core/qtwebenginecore-config.pri)
+ include($$QTWEBENGINE_OUT_ROOT/src/webengine/qtwebengine-config.pri)
+ include($$QTWEBENGINE_OUT_ROOT/src/webenginewidgets/qtwebenginewidgets-config.pri)
+ QT_FOR_CONFIG += webenginecore webenginecore-private webengine-private webenginewidgets-private
+
+ process.depends = core
+ webengine.depends = core
+ webenginewidgets.depends = core webengine
+ webengine_plugin.subdir = webengine/plugin
+ webengine_plugin.target = sub-webengine-plugin
+ webengine_plugin.depends = webengine
-core.depends = buildtools
+ core.depends = buildtools
-SUBDIRS += buildtools \
- core \
- process
+ SUBDIRS += buildtools \
+ core \
+ process
-qtConfig(webengine-spellchecker):!qtConfig(webengine-native-spellchecker):!cross_compile {
+ qtConfig(webengine-spellchecker):!qtConfig(webengine-native-spellchecker):!cross_compile {
SUBDIRS += qwebengine_convert_dict
qwebengine_convert_dict.subdir = tools/qwebengine_convert_dict
qwebengine_convert_dict.depends = core
-}
+ }
-qtConfig(webengine-qml) {
- SUBDIRS += webengine
-}
+ qtConfig(webengine-qml) {
+ SUBDIRS += webengine
+ }
-qtConfig(webengine-widgets) {
- SUBDIRS += plugins webenginewidgets
- plugins.depends = webenginewidgets
+ qtConfig(webengine-widgets) {
+ SUBDIRS += plugins webenginewidgets
+ plugins.depends = webenginewidgets
+ }
+} else {
+ !isEmpty(skipBuildReason):!build_pass {
+ log(QtWebEngine will not be built. $${skipBuildReason} $${EOL})
+ errorbuild.commands = @echo QtWebEngine will not be built. $${skipBuildReason}
+ errorbuild.CONFIG = phony
+ QMAKE_EXTRA_TARGETS += errorbuild
+ first.depends += errorbuild
+ QMAKE_EXTRA_TARGETS += first
+ }
}
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
index 30283dc03..58d950cd9 100644
--- a/src/webengine/api/qquickwebengineview.cpp
+++ b/src/webengine/api/qquickwebengineview.cpp
@@ -43,6 +43,7 @@
#include "profile_adapter.h"
#include "certificate_error_controller.h"
#include "file_picker_controller.h"
+#include "find_text_helper.h"
#include "javascript_dialog_controller.h"
#include "touch_selection_menu_controller.h"
@@ -61,6 +62,7 @@
#include "qquickwebenginesettings_p.h"
#include "qquickwebenginescript_p.h"
#include "qquickwebenginetouchhandleprovider_p_p.h"
+#include "qwebenginefindtextresult.h"
#include "qwebenginequotarequest.h"
#include "qwebengineregisterprotocolhandlerrequest.h"
@@ -164,7 +166,6 @@ QQuickWebEngineViewPrivate::~QQuickWebEngineViewPrivate()
{
Q_ASSERT(m_profileInitialized);
m_profile->d_ptr->removeWebContentsAdapterClient(this);
- adapter->stopFinding();
if (faviconProvider)
faviconProvider->detach(q_ptr);
// q_ptr->d_ptr might be null due to destroy()
@@ -273,8 +274,8 @@ void QQuickWebEngineViewPrivate::navigationRequested(int navigationType, const Q
Q_EMIT q->navigationRequested(&navigationRequest);
navigationRequestAction = navigationRequest.action();
- if ((navigationRequestAction == WebContentsAdapterClient::AcceptRequest) && adapter->isFindTextInProgress())
- adapter->stopFinding();
+ if ((navigationRequestAction == WebContentsAdapterClient::AcceptRequest) && adapter->findTextHelper()->isFindTextInProgress())
+ adapter->findTextHelper()->stopFinding();
}
void QQuickWebEngineViewPrivate::javascriptDialog(QSharedPointer<JavaScriptDialogController> dialog)
@@ -699,6 +700,12 @@ void QQuickWebEngineViewPrivate::widgetChanged(RenderWidgetHostViewQtDelegate *n
bindViewAndWidget(q, static_cast<RenderWidgetHostViewQtDelegateQuick *>(newWidgetBase));
}
+void QQuickWebEngineViewPrivate::findTextFinished(const QWebEngineFindTextResult &result)
+{
+ Q_Q(QQuickWebEngineView);
+ Q_EMIT q->findTextFinished(result);
+}
+
WebEngineSettings *QQuickWebEngineViewPrivate::webEngineSettings() const
{
return m_settings->d_ptr.data();
@@ -1185,14 +1192,6 @@ void QQuickWebEngineViewPrivate::didRunJavaScript(quint64 requestId, const QVari
callback.call(args);
}
-void QQuickWebEngineViewPrivate::didFindText(quint64 requestId, int matchCount)
-{
- QJSValue callback = m_callbacks.take(requestId);
- QJSValueList args;
- args.append(QJSValue(matchCount));
- callback.call(args);
-}
-
void QQuickWebEngineViewPrivate::didPrintPage(quint64 requestId, QSharedPointer<QByteArray> result)
{
Q_Q(QQuickWebEngineView);
@@ -1464,18 +1463,8 @@ void QQuickWebEngineView::findText(const QString &subString, FindFlags options,
Q_D(QQuickWebEngineView);
if (!d->adapter->isInitialized())
return;
- if (subString.isEmpty()) {
- d->adapter->stopFinding();
- if (!callback.isUndefined()) {
- QJSValueList args;
- args.append(QJSValue(0));
- const_cast<QJSValue&>(callback).call(args);
- }
- } else {
- quint64 requestId = d->adapter->findText(subString, options & FindCaseSensitively, options & FindBackward);
- if (!callback.isUndefined())
- d->m_callbacks.insert(requestId, callback);
- }
+
+ d->adapter->findTextHelper()->startFinding(subString, options & FindCaseSensitively, options & FindBackward, callback);
}
QQuickWebEngineHistory *QQuickWebEngineView::navigationHistory() const
diff --git a/src/webengine/api/qquickwebengineview_p.h b/src/webengine/api/qquickwebengineview_p.h
index 3c8e1d9ec..4a88e3c28 100644
--- a/src/webengine/api/qquickwebengineview_p.h
+++ b/src/webengine/api/qquickwebengineview_p.h
@@ -79,6 +79,7 @@ class QQuickWebEngineSettings;
class QQuickWebEngineTooltipRequest;
class QQuickWebEngineFormValidationMessageRequest;
class QQuickWebEngineViewPrivate;
+class QWebEngineFindTextResult;
class QWebEngineQuotaRequest;
class QWebEngineRegisterProtocolHandlerRequest;
@@ -574,6 +575,7 @@ Q_SIGNALS:
Q_REVISION(10) void tooltipRequested(QQuickWebEngineTooltipRequest *request);
Q_REVISION(11) void lifecycleStateChanged(LifecycleState state);
Q_REVISION(11) void recommendedStateChanged(LifecycleState state);
+ Q_REVISION(11) void findTextFinished(const QWebEngineFindTextResult &result);
#if QT_CONFIG(webengine_testsupport)
void testSupportChanged();
diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h
index e0f2595ec..df6843ac3 100644
--- a/src/webengine/api/qquickwebengineview_p_p.h
+++ b/src/webengine/api/qquickwebengineview_p_p.h
@@ -80,6 +80,7 @@ class QQuickWebEngineSettings;
class QQuickWebEngineFaviconProvider;
class QQuickWebEngineProfilePrivate;
class QQuickWebEngineTouchHandleProvider;
+class QWebEngineFindTextResult;
QQuickWebEngineView::WebAction editorActionForKeyEvent(QKeyEvent* event);
@@ -133,7 +134,6 @@ public:
void didRunJavaScript(quint64, const QVariant&) override;
void didFetchDocumentMarkup(quint64, const QString&) override { }
void didFetchDocumentInnerText(quint64, const QString&) override { }
- void didFindText(quint64, int) override;
void didPrintPage(quint64 requestId, QSharedPointer<QByteArray>) override;
void didPrintPageToPdf(const QString &filePath, bool success) override;
bool passOnFocus(bool reverse) override;
@@ -170,6 +170,7 @@ public:
QtWebEngineCore::WebContentsAdapter *webContentsAdapter() override;
void printRequested() override;
void widgetChanged(QtWebEngineCore::RenderWidgetHostViewQtDelegate *newWidgetBase) override;
+ void findTextFinished(const QWebEngineFindTextResult &result) override;
void updateAction(QQuickWebEngineView::WebAction) const;
void adoptWebContents(QtWebEngineCore::WebContentsAdapter *webContents);
diff --git a/src/webengine/configure.json b/src/webengine/configure.json
index ec5ad34d9..ebe1ddb2b 100644
--- a/src/webengine/configure.json
+++ b/src/webengine/configure.json
@@ -1,9 +1,20 @@
{
"module": "webengine",
+ "condition": "module.webenginecore && features.webengine-qml",
"depends": [
"webenginecore-private"
],
+ "commandline": {
+ "options": {
+ "webengine-qml": "boolean"
+ }
+ },
"features": {
+ "webengine-qml": {
+ "label": "Support Qt WebEngine Qml",
+ "purpose": "Provides WebEngine Qml support.",
+ "output": [ "privateFeature" ]
+ },
"webengine-ui-delegates": {
"label": "UI Delegates",
"section": "WebEngine",
@@ -18,8 +29,8 @@
"summary": [
{
"section": "Qt WebEngineQml",
- "condition": "features.webengine-qml",
"entries": [
+ "webengine-qml",
"webengine-ui-delegates",
"webengine-testsupport"
]
diff --git a/src/webengine/doc/src/webengineview_lgpl.qdoc b/src/webengine/doc/src/webengineview_lgpl.qdoc
index 1c4328d01..8f03774c8 100644
--- a/src/webengine/doc/src/webengineview_lgpl.qdoc
+++ b/src/webengine/doc/src/webengineview_lgpl.qdoc
@@ -414,26 +414,33 @@
\qmlmethod void WebEngineView::findText(string subString)
\since QtWebEngine 1.1
Finds the specified string, \a subString, in the page.
+ The findTextFinished() signal is emitted when a string search is completed.
To clear the search highlight, just pass an empty string.
+
+ \sa findTextFinished()
*/
/*!
\qmlmethod void WebEngineView::findText(string subString, FindFlags options)
\since QtWebEngine 1.1
Finds the specified string, \a subString, in the page, using the given \a options.
+ The findTextFinished() signal is emitted when a string search is completed.
To clear the search highlight, just pass an empty string.
\code
findText("Qt", WebEngineView.FindBackward | WebEngineView.FindCaseSensitively);
\endcode
+
+ \sa findTextFinished()
*/
/*!
\qmlmethod void WebEngineView::findText(string subString, FindFlags options, variant resultCallback)
\since QtWebEngine 1.1
Finds the specified string, \a subString, in the page, using the given \a options.
+ The findTextFinished() signal is emitted when a string search is completed.
To clear the search highlight, just pass an empty string.
@@ -447,6 +454,8 @@
console.log("Qt was found!");
});
\endcode
+
+ \sa findTextFinished()
*/
/*!
@@ -1569,5 +1578,39 @@
resource state is however completely safe.
\sa lifecycleState, {WebEngine Lifecycle Example}
+*/
+
+/*!
+ \qmltype FindTextResult
+ \instantiates QWebEngineFindTextResult
+ \inqmlmodule QtWebEngine
+ \since QtWebEngine 1.11
+
+ \brief A utility type for encapsulating the result of a string search on a page.
+
+ \sa WebEngineView::findTextFinished()
+*/
+
+/*!
+ \qmlproperty int FindTextResult::numberOfMatches
+ \readonly
+
+ \brief The number of matches found.
+*/
+
+/*!
+ \qmlproperty int FindTextResult::activeMatchOrdinal
+ \readonly
+
+ \brief The index of the currently highlighted match.
+*/
+
+/*!
+ \qmlsignal WebEngineView::findTextFinished(FindTextResult result)
+ \since QtWebEngine 1.11
+
+ This signal is emitted when a string search on a page is completed. \a result is
+ the result of the string search.
+ \sa findText(), FindTextResult
*/
diff --git a/src/webengine/plugin/plugin.cpp b/src/webengine/plugin/plugin.cpp
index ad49d6543..e47a46a95 100644
--- a/src/webengine/plugin/plugin.cpp
+++ b/src/webengine/plugin/plugin.cpp
@@ -55,6 +55,7 @@
#include <QtWebEngine/private/qquickwebenginetouchhandleprovider_p_p.h>
#include <QtWebEngine/private/qquickwebengineview_p.h>
#include <QtWebEngine/private/qquickwebengineaction_p.h>
+#include <QtWebEngineCore/qwebenginefindtextresult.h>
#include <QtWebEngineCore/qwebenginenotification.h>
#include <QtWebEngineCore/qwebenginequotarequest.h>
#include <QtWebEngineCore/qwebengineregisterprotocolhandlerrequest.h>
@@ -170,6 +171,8 @@ public:
qmlRegisterUncreatableType<QWebEngineNotification>(uri, 1, 9, "WebEngineNotification", msgUncreatableType("WebEngineNotification"));
qmlRegisterUncreatableType<QQuickWebEngineTooltipRequest>(uri, 1, 10, "TooltipRequest",
msgUncreatableType("TooltipRequest"));
+ qRegisterMetaType<QWebEngineFindTextResult>();
+ qmlRegisterUncreatableType<QWebEngineFindTextResult>(uri, 1, 11, "FindTextResult", msgUncreatableType("FindTextResult"));
}
private:
diff --git a/src/webenginewidgets/api/qwebenginecertificateerror.cpp b/src/webenginewidgets/api/qwebenginecertificateerror.cpp
index f04b73615..a61d98f94 100644
--- a/src/webenginewidgets/api/qwebenginecertificateerror.cpp
+++ b/src/webenginewidgets/api/qwebenginecertificateerror.cpp
@@ -39,6 +39,8 @@
#include "qwebenginecertificateerror.h"
+#include "certificate_error_controller.h"
+
QT_BEGIN_NAMESPACE
/*!
@@ -51,14 +53,38 @@ QT_BEGIN_NAMESPACE
QWebEnginePage::certificateError().
*/
-class QWebEngineCertificateErrorPrivate {
+class QWebEngineCertificateErrorPrivate : public QSharedData {
public:
QWebEngineCertificateErrorPrivate(int error, QUrl url, bool overridable, QString errorDescription);
+ ~QWebEngineCertificateErrorPrivate() {
+ if (deferred && !answered)
+ rejectCertificate();
+ }
+
+ void resolveError(bool accept) {
+ if (answered)
+ return;
+ answered = true;
+ if (overridable) {
+ if (auto ctl = controller.lock())
+ ctl->accept(accept);
+ }
+ }
+
+ void ignoreCertificateError() { resolveError(true); }
+ void rejectCertificate() { resolveError(false); }
+
QWebEngineCertificateError::Error error;
QUrl url;
bool overridable;
QString errorDescription;
+ QList<QSslCertificate> chain;
+
+ bool answered = false, deferred = false;
+ QWeakPointer<CertificateErrorController> controller;
+
+ Q_DISABLE_COPY(QWebEngineCertificateErrorPrivate)
};
QWebEngineCertificateErrorPrivate::QWebEngineCertificateErrorPrivate(int error, QUrl url, bool overridable, QString errorDescription)
@@ -68,17 +94,31 @@ QWebEngineCertificateErrorPrivate::QWebEngineCertificateErrorPrivate(int error,
, errorDescription(errorDescription)
{ }
-
/*! \internal
*/
QWebEngineCertificateError::QWebEngineCertificateError(int error, QUrl url, bool overridable, QString errorDescription)
- : d_ptr(new QWebEngineCertificateErrorPrivate(error, url, overridable, errorDescription))
+ : d(new QWebEngineCertificateErrorPrivate(error, url, overridable, errorDescription))
{ }
/*! \internal
*/
+QWebEngineCertificateError::QWebEngineCertificateError(const QSharedPointer<CertificateErrorController> &controller)
+ : d(new QWebEngineCertificateErrorPrivate(controller->error(), controller->url(),
+ controller->overridable(), controller->errorString()))
+{
+ d->controller = controller;
+ d->chain = controller->chain();
+}
+
+QWebEngineCertificateError::QWebEngineCertificateError(const QWebEngineCertificateError &other) = default;
+
+QWebEngineCertificateError& QWebEngineCertificateError::operator=(const QWebEngineCertificateError &other) = default;
+
+/*! \internal
+*/
QWebEngineCertificateError::~QWebEngineCertificateError()
{
+
}
/*!
@@ -116,7 +156,6 @@ QWebEngineCertificateError::~QWebEngineCertificateError()
*/
bool QWebEngineCertificateError::isOverridable() const
{
- const Q_D(QWebEngineCertificateError);
return d->overridable;
}
@@ -127,7 +166,6 @@ bool QWebEngineCertificateError::isOverridable() const
*/
QUrl QWebEngineCertificateError::url() const
{
- const Q_D(QWebEngineCertificateError);
return d->url;
}
@@ -138,7 +176,6 @@ QUrl QWebEngineCertificateError::url() const
*/
QWebEngineCertificateError::Error QWebEngineCertificateError::error() const
{
- const Q_D(QWebEngineCertificateError);
return d->error;
}
@@ -149,8 +186,66 @@ QWebEngineCertificateError::Error QWebEngineCertificateError::error() const
*/
QString QWebEngineCertificateError::errorDescription() const
{
- const Q_D(QWebEngineCertificateError);
return d->errorDescription;
}
+/*!
+ Marks the certificate error for delayed handling.
+
+ This function should be called when there is a need to postpone the decision whether to ignore a
+ certificate error, for example, while waiting for user input. When called, the function pauses the
+ URL request until ignoreCertificateError() or rejectCertificate() is called.
+
+ \note It is only possible to defer overridable certificate errors.
+
+ \sa isOverridable(), deferred()
+*/
+void QWebEngineCertificateError::defer()
+{
+ if (isOverridable())
+ d->deferred = true;
+}
+
+/*!
+ Returns whether the decision for error handling was delayed and the URL load was halted.
+*/
+bool QWebEngineCertificateError::deferred() const
+{
+ return d->deferred;
+}
+
+/*!
+ Ignores the certificate error and continues the loading of the requested URL.
+*/
+void QWebEngineCertificateError::ignoreCertificateError()
+{
+ d->ignoreCertificateError();
+}
+
+/*!
+ Rejects the certificate and aborts the loading of the requested URL.
+*/
+void QWebEngineCertificateError::rejectCertificate()
+{
+ d->rejectCertificate();
+}
+
+/*!
+ Returns \c true if the error was explicitly rejected or accepted.
+*/
+bool QWebEngineCertificateError::answered() const
+{
+ return d->answered;
+}
+
+/*!
+ Returns the peer's chain of digital certificates
+
+ Chain starts with the peer's immediate certificate and ending with the CA's certificate.
+*/
+QList<QSslCertificate> QWebEngineCertificateError::chain() const
+{
+ return d->chain;
+}
+
QT_END_NAMESPACE
diff --git a/src/webenginewidgets/api/qwebenginecertificateerror.h b/src/webenginewidgets/api/qwebenginecertificateerror.h
index 82ac281be..b2dd65a9f 100644
--- a/src/webenginewidgets/api/qwebenginecertificateerror.h
+++ b/src/webenginewidgets/api/qwebenginecertificateerror.h
@@ -42,11 +42,13 @@
#include <QtWebEngineWidgets/qtwebenginewidgetsglobal.h>
-#include <QtCore/qscopedpointer.h>
+#include <QtCore/qsharedpointer.h>
#include <QtCore/qurl.h>
+#include <QtNetwork/QSslCertificate>
QT_BEGIN_NAMESPACE
+class CertificateErrorController;
class QWebEngineCertificateErrorPrivate;
class QWEBENGINEWIDGETS_EXPORT QWebEngineCertificateError {
@@ -78,10 +80,22 @@ public:
bool isOverridable() const;
QString errorDescription() const;
+ QWebEngineCertificateError(const QWebEngineCertificateError &other);
+ QWebEngineCertificateError& operator=(const QWebEngineCertificateError &other);
+
+ void defer();
+ bool deferred() const;
+
+ void rejectCertificate();
+ void ignoreCertificateError();
+ bool answered() const;
+
+ QList<QSslCertificate> chain() const;
+
private:
- Q_DISABLE_COPY(QWebEngineCertificateError)
- Q_DECLARE_PRIVATE(QWebEngineCertificateError)
- QScopedPointer<QWebEngineCertificateErrorPrivate> d_ptr;
+ friend class QWebEnginePagePrivate;
+ QWebEngineCertificateError(const QSharedPointer<CertificateErrorController> &controller);
+ QExplicitlySharedDataPointer<QWebEngineCertificateErrorPrivate> d;
};
QT_END_NAMESPACE
diff --git a/src/webenginewidgets/api/qwebenginedownloaditem.cpp b/src/webenginewidgets/api/qwebenginedownloaditem.cpp
index 7ce572e2f..7b0cfe074 100644
--- a/src/webenginewidgets/api/qwebenginedownloaditem.cpp
+++ b/src/webenginewidgets/api/qwebenginedownloaditem.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtWebEngine module of the Qt Toolkit.
@@ -124,8 +124,9 @@ static inline QWebEngineDownloadItem::DownloadInterruptReason toDownloadInterrup
then the download request will be automatically rejected and nothing will be
written to disk.
- \note Some properties, like the \l path under which the file will be saved,
- can only be changed before calling accept().
+ \note Some properties, such as setting the path and file name where the file
+ will be saved (see \l downloadDirectory() and \l downloadFileName()), can
+ only be changed before calling accept().
\section2 Object Life Cycle
@@ -510,6 +511,10 @@ QString QWebEngineDownloadItem::mimeType() const
/*!
\obsolete
+
+ Use \l suggestedFileName(), \l downloadDirectory(), and
+ \l downloadFileName() instead.
+
Returns the full target path where data is being downloaded to.
The path includes the file name. The default suggested path is the standard download location
@@ -523,6 +528,10 @@ QString QWebEngineDownloadItem::path() const
}
/*!
+ \obsolete
+
+ Use \l setDownloadDirectory() and \l setDownloadFileName() instead.
+
Sets the full target path to download the file to.
The \a path should also include the file name. The download path can only be set in response
@@ -572,7 +581,7 @@ QString QWebEngineDownloadItem::downloadDirectory() const
/*!
\since 5.14
- Sets the directory path to download the file to.
+ Sets \a directory as the directory path to download the file to.
The download directory path can only be set in response to the QWebEngineProfile::downloadRequested()
signal before the download is accepted. Past that point, this function has no effect on the
@@ -598,7 +607,7 @@ void QWebEngineDownloadItem::setDownloadDirectory(QString directory)
/*!
\since 5.14
- Returns the suggested file name.
+ Returns the file name to download the file to.
*/
QString QWebEngineDownloadItem::downloadFileName() const
@@ -610,7 +619,7 @@ QString QWebEngineDownloadItem::downloadFileName() const
/*!
\since 5.14
- Sets the file name to download the file to.
+ Sets \a fileName as the file name to download the file to.
The download file name can only be set in response to the QWebEngineProfile::downloadRequested()
signal before the download is accepted. Past that point, this function has no effect on the
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp
index e990170eb..b22d47916 100644
--- a/src/webenginewidgets/api/qwebenginepage.cpp
+++ b/src/webenginewidgets/api/qwebenginepage.cpp
@@ -45,12 +45,14 @@
#include "certificate_error_controller.h"
#include "color_chooser_controller.h"
#include "favicon_manager.h"
+#include "find_text_helper.h"
#include "file_picker_controller.h"
#include "javascript_dialog_controller.h"
#if QT_CONFIG(webengine_printing_and_pdf)
#include "printer_worker.h"
#endif
#include "qwebenginecertificateerror.h"
+#include "qwebenginefindtextresult.h"
#include "qwebenginefullscreenrequest.h"
#include "qwebenginehistory.h"
#include "qwebenginehistory_p.h"
@@ -170,6 +172,7 @@ QWebEnginePagePrivate::QWebEnginePagePrivate(QWebEngineProfile *_profile)
qRegisterMetaType<QWebEngineQuotaRequest>();
qRegisterMetaType<QWebEngineRegisterProtocolHandlerRequest>();
+ qRegisterMetaType<QWebEngineFindTextResult>();
// See setVisible().
wasShownTimer.setSingleShot(true);
@@ -291,6 +294,7 @@ void QWebEnginePagePrivate::loadStarted(const QUrl &provisionalUrl, bool isError
return;
isLoading = true;
+ m_certificateErrorControllers.clear();
QTimer::singleShot(0, q, &QWebEnginePage::loadStarted);
}
@@ -420,11 +424,6 @@ void QWebEnginePagePrivate::didFetchDocumentInnerText(quint64 requestId, const Q
m_callbacks.invoke(requestId, result);
}
-void QWebEnginePagePrivate::didFindText(quint64 requestId, int matchCount)
-{
- m_callbacks.invoke(requestId, matchCount > 0);
-}
-
void QWebEnginePagePrivate::didPrintPage(quint64 requestId, QSharedPointer<QByteArray> result)
{
#if QT_CONFIG(webengine_printing_and_pdf)
@@ -702,6 +701,12 @@ void QWebEnginePagePrivate::widgetChanged(RenderWidgetHostViewQtDelegate *newWid
bindPageAndWidget(q, static_cast<RenderWidgetHostViewQtDelegateWidget *>(newWidgetBase));
}
+void QWebEnginePagePrivate::findTextFinished(const QWebEngineFindTextResult &result)
+{
+ Q_Q(QWebEnginePage);
+ Q_EMIT q->findTextFinished(result);
+}
+
void QWebEnginePagePrivate::ensureInitialized() const
{
if (!adapter->isInitialized())
@@ -802,6 +807,16 @@ QWebEnginePage::QWebEnginePage(QObject* parent)
}
/*!
+ \fn void QWebEnginePage::findTextFinished(const QWebEngineFindTextResult &result)
+ \since 5.14
+
+ This signal is emitted when a search string search on a page is completed. \a result is
+ the result of the string search.
+
+ \sa findText()
+*/
+
+/*!
\fn void QWebEnginePage::printRequested()
\since 5.12
@@ -963,7 +978,6 @@ QWebEnginePage::~QWebEnginePage()
if (d_ptr) {
// d_ptr might be exceptionally null if profile adapter got deleted first
setDevToolsPage(nullptr);
- d_ptr->adapter->stopFinding();
QWebEnginePagePrivate::bindPageAndView(this, nullptr);
QWebEnginePagePrivate::bindPageAndWidget(this, nullptr);
}
@@ -1592,16 +1606,11 @@ void QWebEnginePage::findText(const QString &subString, FindFlags options, const
{
Q_D(QWebEnginePage);
if (!d->adapter->isInitialized()) {
- d->m_callbacks.invokeEmpty(resultCallback);
+ QtWebEngineCore::CallbackDirectory().invokeEmpty(resultCallback);
return;
}
- if (subString.isEmpty()) {
- d->adapter->stopFinding();
- d->m_callbacks.invokeEmpty(resultCallback);
- } else {
- quint64 requestId = d->adapter->findText(subString, options & FindCaseSensitively, options & FindBackward);
- d->m_callbacks.registerCallback(requestId, resultCallback);
- }
+
+ d->adapter->findTextHelper()->startFinding(subString, options & FindCaseSensitively, options & FindBackward, resultCallback);
}
/*!
@@ -1652,8 +1661,8 @@ void QWebEnginePagePrivate::navigationRequested(int navigationType, const QUrl &
{
Q_Q(QWebEnginePage);
bool accepted = q->acceptNavigationRequest(url, static_cast<QWebEnginePage::NavigationType>(navigationType), isMainFrame);
- if (accepted && adapter->isFindTextInProgress())
- adapter->stopFinding();
+ if (accepted && adapter->findTextHelper()->isFindTextInProgress())
+ adapter->findTextHelper()->stopFinding();
navigationRequestAction = accepted ? WebContentsAdapterClient::AcceptRequest : WebContentsAdapterClient::IgnoreRequest;
}
@@ -1707,10 +1716,11 @@ void QWebEnginePagePrivate::allowCertificateError(const QSharedPointer<Certifica
Q_Q(QWebEnginePage);
bool accepted = false;
- QWebEngineCertificateError error(controller->error(), controller->url(), controller->overridable() && !controller->strictEnforcement(), controller->errorString());
+ QWebEngineCertificateError error(controller);
accepted = q->certificateError(error);
-
- if (error.isOverridable())
+ if (error.deferred() && !error.answered())
+ m_certificateErrorControllers.append(controller);
+ else if (!error.answered() && error.isOverridable())
controller->accept(accepted);
}
diff --git a/src/webenginewidgets/api/qwebenginepage.h b/src/webenginewidgets/api/qwebenginepage.h
index 736d7ed69..cd012ea70 100644
--- a/src/webenginewidgets/api/qwebenginepage.h
+++ b/src/webenginewidgets/api/qwebenginepage.h
@@ -62,6 +62,7 @@ class QWebChannel;
class QWebEngineCertificateError;
class QWebEngineClientCertificateSelection;
class QWebEngineContextMenuData;
+class QWebEngineFindTextResult;
class QWebEngineFullScreenRequest;
class QWebEngineHistory;
class QWebEnginePage;
@@ -369,6 +370,8 @@ Q_SIGNALS:
void lifecycleStateChanged(LifecycleState state);
void recommendedStateChanged(LifecycleState state);
+ void findTextFinished(const QWebEngineFindTextResult &result);
+
protected:
virtual QWebEnginePage *createWindow(WebWindowType type);
virtual QStringList chooseFiles(FileSelectionMode mode, const QStringList &oldFiles, const QStringList &acceptedMimeTypes);
diff --git a/src/webenginewidgets/api/qwebenginepage_p.h b/src/webenginewidgets/api/qwebenginepage_p.h
index acf95a265..2843f69c4 100644
--- a/src/webenginewidgets/api/qwebenginepage_p.h
+++ b/src/webenginewidgets/api/qwebenginepage_p.h
@@ -72,6 +72,7 @@ class WebContentsAdapter;
}
QT_BEGIN_NAMESPACE
+class QWebEngineFindTextResult;
class QWebEngineHistory;
class QWebEnginePage;
class QWebEngineProfile;
@@ -127,7 +128,6 @@ public:
void didRunJavaScript(quint64 requestId, const QVariant& result) override;
void didFetchDocumentMarkup(quint64 requestId, const QString& result) override;
void didFetchDocumentInnerText(quint64 requestId, const QString& result) override;
- void didFindText(quint64 requestId, int matchCount) override;
void didPrintPage(quint64 requestId, QSharedPointer<QByteArray> result) override;
void didPrintPageToPdf(const QString &filePath, bool success) override;
bool passOnFocus(bool reverse) override;
@@ -163,6 +163,7 @@ public:
ClientType clientType() override { return QtWebEngineCore::WebContentsAdapterClient::WidgetsClient; }
void interceptRequest(QWebEngineUrlRequestInfo &) override;
void widgetChanged(QtWebEngineCore::RenderWidgetHostViewQtDelegate *newWidget) override;
+ void findTextFinished(const QWebEngineFindTextResult &result) override;
QtWebEngineCore::ProfileAdapter *profileAdapter() override;
QtWebEngineCore::WebContentsAdapter *webContentsAdapter() override;
@@ -209,6 +210,8 @@ public:
#if QT_CONFIG(webengine_printing_and_pdf)
QPrinter *currentPrinter;
#endif
+
+ QList<QSharedPointer<CertificateErrorController>> m_certificateErrorControllers;
};
class QContextMenuBuilder : public QtWebEngineCore::RenderViewContextMenuQt
diff --git a/src/webenginewidgets/api/qwebengineprofile.cpp b/src/webenginewidgets/api/qwebengineprofile.cpp
index 6e2db533e..4a77eb8cf 100644
--- a/src/webenginewidgets/api/qwebengineprofile.cpp
+++ b/src/webenginewidgets/api/qwebengineprofile.cpp
@@ -101,7 +101,7 @@ using QtWebEngineCore::ProfileAdapter;
web pages not specifically created with another profile belong to.
Implementing the QWebEngineUrlRequestInterceptor interface and registering the interceptor on a
- profile by setRequestInterceptor() enables intercepting, blocking, and modifying URL
+ profile by setUrlRequestInterceptor() enables intercepting, blocking, and modifying URL
requests (QWebEngineUrlRequestInfo) before they reach the networking stack of Chromium.
A QWebEngineUrlSchemeHandler can be registered for a profile by installUrlSchemeHandler()
diff --git a/src/webenginewidgets/configure.json b/src/webenginewidgets/configure.json
new file mode 100644
index 000000000..a27faf78d
--- /dev/null
+++ b/src/webenginewidgets/configure.json
@@ -0,0 +1,28 @@
+{
+ "module": "webenginewidgets",
+ "condition": "module.webenginecore && features.webengine-widgets",
+ "depends": [
+ "webenginecore-private"
+ ],
+ "commandline": {
+ "options": {
+ "webengine-widgets": "boolean"
+ }
+ },
+ "features": {
+ "webengine-widgets": {
+ "label": "Support Qt WebEngine Widgets",
+ "purpose": "Provides WebEngine Widgets support.",
+ "condition": "module.widgets",
+ "output": [ "privateFeature" ]
+ }
+ },
+ "summary": [
+ {
+ "section": "Qt WebEngineWidgets",
+ "entries": [
+ "webengine-widgets"
+ ]
+ }
+ ]
+}
diff --git a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc
index 99bbc5162..699d7f181 100644
--- a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc
+++ b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc
@@ -489,6 +489,7 @@
/*!
\fn void QWebEnginePage::findText(const QString &subString, QWebEnginePage::FindFlags options = FindFlags(), const QWebEngineCallback<bool> &resultCallback = QWebEngineCallback<bool>())
Finds the specified string, \a subString, in the page, using the given \a options.
+ The findTextFinished() signal is emitted when a string search is completed.
To clear the search highlight, just pass an empty string.
@@ -501,13 +502,15 @@
For example:
\snippet qtwebengine_qwebenginepage_snippet.cpp 0
+
+ \sa findTextFinished()
*/
/*!
\fn QWebEngineSettings *QWebEnginePage::settings() const
Returns a pointer to the page's settings object.
- \sa QWebEngineSettings::globalSettings()
+ \sa QWebEngineSettings::defaultSettings()
*/
/*!
@@ -519,6 +522,8 @@
Return \c true to ignore the error and complete the request. Return \c false to stop loading
the request.
+ \note If the error was successfully deferred then the returned value will be ignored.
+
\sa QWebEngineCertificateError
*/
diff --git a/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc
index ce75a4203..0706598ef 100644
--- a/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc
+++ b/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc
@@ -22,12 +22,14 @@
// by its LGPL license. Documentation written from scratch for new methods should be
// placed inline in the code as usual.
+#if QT_DEPRECATED_SINCE(5, 5)
/*!
\fn static QWebEngineSettings *QWebEngineSettings::globalSettings()
\obsolete
Use defaultSettings() instead.
*/
+#endif
/*!
\class QWebEngineSettings
diff --git a/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc
index 1b7812dff..3f1b6e509 100644
--- a/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc
+++ b/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc
@@ -393,5 +393,5 @@
\snippet qtwebengine_qwebengineview_snippet.cpp 6
- \sa QWebEngineSettings::globalSettings()
+ \sa QWebEngineSettings::defaultSettings()
*/
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index 06430cf8e..59bcd5aef 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -1,9 +1,9 @@
TEMPLATE = subdirs
-SUBDIRS = quick
+qtHaveModule(webengine) {
+ SUBDIRS += quick
+}
qtHaveModule(webenginewidgets) {
- SUBDIRS += widgets
-# core tests depend on widgets for now
- SUBDIRS += core
+ SUBDIRS += core widgets
}
diff --git a/tests/auto/quick/dialogs/BLACKLIST b/tests/auto/quick/dialogs/BLACKLIST
index 6d7e2a2fc..10b7391a0 100644
--- a/tests/auto/quick/dialogs/BLACKLIST
+++ b/tests/auto/quick/dialogs/BLACKLIST
@@ -1,2 +1,8 @@
[contextMenuRequested]
osx-10.13
+[javaScriptDialogRequested]
+osx-10.13
+[colorDialogRequested]
+osx-10.13
+[fileDialogRequested]
+osx-10.13
diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp
index f464d58d0..9f7dfa8ad 100644
--- a/tests/auto/quick/publicapi/tst_publicapi.cpp
+++ b/tests/auto/quick/publicapi/tst_publicapi.cpp
@@ -35,6 +35,7 @@
#include <QtTest/QtTest>
#include <QtWebEngine/QQuickWebEngineProfile>
#include <QtWebEngine/QQuickWebEngineScript>
+#include <QtWebEngineCore/QWebEngineFindTextResult>
#include <QtWebEngineCore/QWebEngineNotification>
#include <QtWebEngineCore/QWebEngineQuotaRequest>
#include <QtWebEngineCore/QWebEngineRegisterProtocolHandlerRequest>
@@ -85,6 +86,7 @@ static const QList<const QMetaObject *> typesToCheck = QList<const QMetaObject *
<< &QWebEngineQuotaRequest::staticMetaObject
<< &QWebEngineRegisterProtocolHandlerRequest::staticMetaObject
<< &QWebEngineNotification::staticMetaObject
+ << &QWebEngineFindTextResult::staticMetaObject
;
static QList<const char *> knownEnumNames = QList<const char *>();
@@ -276,6 +278,8 @@ static const QStringList expectedAPI = QStringList()
<< "QQuickWebEngineFileDialogRequest.dialogAccept(QStringList) --> void"
<< "QQuickWebEngineFileDialogRequest.dialogReject() --> void"
<< "QQuickWebEngineFileDialogRequest.mode --> FileMode"
+ << "QWebEngineFindTextResult.numberOfMatches --> int"
+ << "QWebEngineFindTextResult.activeMatchOrdinal --> int"
<< "QQuickWebEngineFormValidationMessageRequest.Hide --> RequestType"
<< "QQuickWebEngineFormValidationMessageRequest.Move --> RequestType"
<< "QQuickWebEngineFormValidationMessageRequest.Show --> RequestType"
@@ -694,6 +698,7 @@ static const QStringList expectedAPI = QStringList()
<< "QQuickWebEngineView.findText(QString) --> void"
<< "QQuickWebEngineView.findText(QString,FindFlags) --> void"
<< "QQuickWebEngineView.findText(QString,FindFlags,QJSValue) --> void"
+ << "QQuickWebEngineView.findTextFinished(QWebEngineFindTextResult) --> void"
<< "QQuickWebEngineView.formValidationMessageRequested(QQuickWebEngineFormValidationMessageRequest*) --> void"
<< "QQuickWebEngineView.fullScreenCancelled() --> void"
<< "QQuickWebEngineView.fullScreenRequested(QQuickWebEngineFullScreenRequest) --> void"
diff --git a/tests/auto/quick/qmltests/data/tst_download.qml b/tests/auto/quick/qmltests/data/tst_download.qml
index ff57c76c7..c38018ffd 100644
--- a/tests/auto/quick/qmltests/data/tst_download.qml
+++ b/tests/auto/quick/qmltests/data/tst_download.qml
@@ -53,7 +53,10 @@ TestWebEngineView {
function urlToPath(url) {
var path = url.toString()
- path = path.replace(/^(file:\/{2})/,"")
+ if (Qt.platform.os !== "windows")
+ path = path.replace(/^(file:\/{2})/, "")
+ else
+ path = path.replace(/^(file:\/{3})/, "")
return path
}
@@ -90,14 +93,9 @@ TestWebEngineView {
download.cancel()
} else {
totalBytes = download.totalBytes
- download.downloadDirectory = testDownloadProfile.downloadPath
- download.downloadFileName = "testfile.zip"
- if (downloadDirectory.length != 0)
- download.downloadDirectory = testDownloadProfile.downloadPath + downloadDirectory
-
- if (downloadFileName.length != 0)
- download.downloadFileName = downloadFileName
+ download.downloadDirectory = downloadDirectory.length != 0 ? testDownloadProfile.downloadPath + downloadDirectory : testDownloadProfile.downloadPath
+ download.downloadFileName = downloadFileName.length != 0 ? downloadFileName : "testfile.zip"
download.accept()
}
@@ -125,6 +123,9 @@ TestWebEngineView {
downloadDirectoryChanged = 0
downloadFileNameChanged = 0
downloadPathChanged = 0
+ downloadDirectory = ""
+ downloadFileName = ""
+ downloadedPath = ""
}
function test_downloadRequest() {
@@ -203,8 +204,8 @@ TestWebEngineView {
tryCompare(downloadState, "1", WebEngineDownloadItem.DownloadInProgress);
compare(downloadedPath, testDownloadProfile.downloadPath + downloadDirectory + downloadFileName);
compare(downloadDirectoryChanged, 1);
- compare(downloadFileNameChanged, 3);
- compare(downloadPathChanged, 4);
+ compare(downloadFileNameChanged, 1);
+ compare(downloadPathChanged, 2);
downloadFinishedSpy.wait();
compare(totalBytes, receivedBytes);
tryCompare(downloadState, "2", WebEngineDownloadItem.DownloadCompleted);
diff --git a/tests/auto/quick/qmltests/data/tst_findText.qml b/tests/auto/quick/qmltests/data/tst_findText.qml
index 14053a675..040d324e6 100644
--- a/tests/auto/quick/qmltests/data/tst_findText.qml
+++ b/tests/auto/quick/qmltests/data/tst_findText.qml
@@ -38,9 +38,16 @@ TestWebEngineView {
property int matchCount: 0
property bool findFailed: false
+ SignalSpy {
+ id: findTextSpy
+ target: webEngineView
+ signalName: "findTextFinished"
+ }
+
function clear() {
findFailed = false
matchCount = -1
+ findTextSpy.clear()
}
function findCallbackCalled() { return matchCount != -1 }
@@ -104,6 +111,9 @@ TestWebEngineView {
webEngineView.findText("Hello", findFlags, webEngineView.findTextCallback)
tryCompare(webEngineView, "matchCount", 1)
verify(!findFailed)
+ tryCompare(findTextSpy, "count", 1)
+ compare(findTextSpy.signalArguments[0][0].numberOfMatches, 1)
+ compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 1)
}
function test_findTextCaseInsensitive() {
@@ -115,6 +125,9 @@ TestWebEngineView {
webEngineView.findText("heLLo", findFlags, webEngineView.findTextCallback)
tryCompare(webEngineView, "matchCount", 1)
verify(!findFailed)
+ tryCompare(findTextSpy, "count", 1)
+ compare(findTextSpy.signalArguments[0][0].numberOfMatches, 1)
+ compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 1)
}
function test_findTextManyMatches() {
@@ -126,6 +139,9 @@ TestWebEngineView {
webEngineView.findText("bla", findFlags, webEngineView.findTextCallback)
tryCompare(webEngineView, "matchCount", 100, 20000)
verify(!findFailed)
+ tryCompare(findTextSpy, "count", 1)
+ compare(findTextSpy.signalArguments[0][0].numberOfMatches, 100)
+ compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 1)
}
@@ -138,6 +154,9 @@ TestWebEngineView {
webEngineView.findText("heLLo", findFlags, webEngineView.findTextCallback)
tryCompare(webEngineView, "matchCount", 0)
verify(findFailed)
+ tryCompare(findTextSpy, "count", 1)
+ compare(findTextSpy.signalArguments[0][0].numberOfMatches, 0)
+ compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 0)
}
function test_findTextNotFound() {
@@ -149,6 +168,9 @@ TestWebEngineView {
webEngineView.findText("string-that-is-not-threre", findFlags, webEngineView.findTextCallback)
tryCompare(webEngineView, "matchCount", 0)
verify(findFailed)
+ tryCompare(findTextSpy, "count", 1)
+ compare(findTextSpy.signalArguments[0][0].numberOfMatches, 0)
+ compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 0)
}
function test_findTextAfterNotFound() {
@@ -160,6 +182,9 @@ TestWebEngineView {
webEngineView.findText("hello", findFlags, webEngineView.findTextCallback)
tryCompare(webEngineView, "matchCount", 0)
verify(findFailed)
+ tryCompare(findTextSpy, "count", 1)
+ compare(findTextSpy.signalArguments[0][0].numberOfMatches, 0)
+ compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 0)
webEngineView.url = Qt.resolvedUrl("test1.html")
verify(webEngineView.waitForLoadSucceeded())
@@ -168,6 +193,9 @@ TestWebEngineView {
webEngineView.findText("hello", findFlags, webEngineView.findTextCallback)
tryCompare(webEngineView, "matchCount", 1)
verify(!findFailed)
+ tryCompare(findTextSpy, "count", 1)
+ compare(findTextSpy.signalArguments[0][0].numberOfMatches, 1)
+ compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 1)
}
function test_findTextInModifiedDOMAfterNotFound() {
@@ -182,6 +210,9 @@ TestWebEngineView {
webEngineView.findText("hello", findFlags, webEngineView.findTextCallback)
tryCompare(webEngineView, "matchCount", 0, 20000)
verify(findFailed)
+ tryCompare(findTextSpy, "count", 1)
+ compare(findTextSpy.signalArguments[0][0].numberOfMatches, 0)
+ compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 0)
runJavaScript("document.body.innerHTML = 'blahellobla'");
tryVerify(function() { return getBodyInnerHTML() == "blahellobla"; }, 20000);
@@ -190,6 +221,9 @@ TestWebEngineView {
webEngineView.findText("hello", findFlags, webEngineView.findTextCallback)
tryCompare(webEngineView, "matchCount", 1)
verify(!findFailed)
+ tryCompare(findTextSpy, "count", 1)
+ compare(findTextSpy.signalArguments[0][0].numberOfMatches, 1)
+ compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 1)
}
function test_findTextInterruptedByLoad() {
@@ -227,5 +261,55 @@ TestWebEngineView {
webEngineView.findText('New page', findFlags, webEngineView.findTextCallback)
tryCompare(webEngineView, 'matchCount', 1)
}
+
+ function test_findTextActiveMatchOrdinal() {
+ webEngineView.loadHtml(
+ "<html><body>" +
+ "foo bar foo bar foo" +
+ "</body></html>");
+ verify(webEngineView.waitForLoadSucceeded());
+
+ // Iterate over all "foo" matches.
+ webEngineView.clear();
+ for (var i = 1; i <= 3; ++i) {
+ webEngineView.findText("foo");
+ findTextSpy.wait();
+ compare(findTextSpy.count, i);
+ compare(findTextSpy.signalArguments[i-1][0].numberOfMatches, 3);
+ compare(findTextSpy.signalArguments[i-1][0].activeMatchOrdinal, i);
+ }
+
+ // The last match is followed by the fist one.
+ webEngineView.clear();
+ webEngineView.findText("foo");
+ findTextSpy.wait();
+ compare(findTextSpy.count, 1);
+ compare(findTextSpy.signalArguments[0][0].numberOfMatches, 3);
+ compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 1);
+
+ // The first match is preceded by the last one.
+ webEngineView.clear();
+ webEngineView.findText("foo", WebEngineView.FindBackward);
+ findTextSpy.wait();
+ compare(findTextSpy.count, 1);
+ compare(findTextSpy.signalArguments[0][0].numberOfMatches, 3);
+ compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 3);
+
+ // Finding another word resets the activeMatchOrdinal.
+ webEngineView.clear();
+ webEngineView.findText("bar");
+ findTextSpy.wait();
+ compare(findTextSpy.count, 1);
+ compare(findTextSpy.signalArguments[0][0].numberOfMatches, 2);
+ compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 1);
+
+ // If no match activeMatchOrdinal is 0.
+ webEngineView.clear();
+ webEngineView.findText("bla");
+ findTextSpy.wait();
+ compare(findTextSpy.count, 1);
+ compare(findTextSpy.signalArguments[0][0].numberOfMatches, 0);
+ compare(findTextSpy.signalArguments[0][0].activeMatchOrdinal, 0);
+ }
}
}
diff --git a/tests/auto/shared/https.pri b/tests/auto/shared/https.pri
new file mode 100644
index 000000000..ce4c147f7
--- /dev/null
+++ b/tests/auto/shared/https.pri
@@ -0,0 +1,4 @@
+include($$PWD/http.pri)
+
+HEADERS += $$PWD/httpsserver.h
+RESOURCES += $$PWD/httpsserver.qrc
diff --git a/tests/auto/shared/httpserver.cpp b/tests/auto/shared/httpserver.cpp
index b85af9901..e282fc8b8 100644
--- a/tests/auto/shared/httpserver.cpp
+++ b/tests/auto/shared/httpserver.cpp
@@ -31,9 +31,21 @@
Q_LOGGING_CATEGORY(gHttpServerLog, "HttpServer")
-HttpServer::HttpServer(QObject *parent) : QObject(parent)
+HttpServer::HttpServer(QObject *parent) : HttpServer(new QTcpServer, "http", parent)
{
- connect(&m_tcpServer, &QTcpServer::newConnection, this, &HttpServer::handleNewConnection);
+}
+
+HttpServer::HttpServer(QTcpServer *tcpServer, const QString &protocol, QObject *parent)
+ : QObject(parent), m_tcpServer(tcpServer)
+{
+ m_url.setHost(QStringLiteral("127.0.0.1"));
+ m_url.setScheme(protocol);
+ connect(tcpServer, &QTcpServer::newConnection, this, &HttpServer::handleNewConnection);
+}
+
+HttpServer::~HttpServer()
+{
+ delete m_tcpServer;
}
bool HttpServer::start()
@@ -41,21 +53,18 @@ bool HttpServer::start()
m_error = false;
m_expectingError = false;
- if (!m_tcpServer.listen()) {
- qCWarning(gHttpServerLog).noquote() << m_tcpServer.errorString();
+ if (!m_tcpServer->listen()) {
+ qCWarning(gHttpServerLog).noquote() << m_tcpServer->errorString();
return false;
}
- m_url.setScheme(QStringLiteral("http"));
- m_url.setHost(QStringLiteral("127.0.0.1"));
- m_url.setPort(m_tcpServer.serverPort());
-
+ m_url.setPort(m_tcpServer->serverPort());
return true;
}
bool HttpServer::stop()
{
- m_tcpServer.close();
+ m_tcpServer->close();
return m_error == m_expectingError;
}
@@ -73,12 +82,12 @@ QUrl HttpServer::url(const QString &path) const
void HttpServer::handleNewConnection()
{
- auto rr = new HttpReqRep(m_tcpServer.nextPendingConnection(), this);
+ auto rr = new HttpReqRep(m_tcpServer->nextPendingConnection(), this);
connect(rr, &HttpReqRep::requestReceived, [this, rr]() {
Q_EMIT newRequest(rr);
rr->close();
});
- connect(rr, &HttpReqRep::responseSent, [this, rr]() {
+ connect(rr, &HttpReqRep::responseSent, [rr]() {
qCInfo(gHttpServerLog).noquote() << rr->requestMethod() << rr->requestPath()
<< rr->responseStatus() << rr->responseBody().size();
});
diff --git a/tests/auto/shared/httpserver.h b/tests/auto/shared/httpserver.h
index b4649244e..57f824bb5 100644
--- a/tests/auto/shared/httpserver.h
+++ b/tests/auto/shared/httpserver.h
@@ -59,19 +59,22 @@ class HttpServer : public QObject
Q_OBJECT
public:
explicit HttpServer(QObject *parent = nullptr);
+ explicit HttpServer(QTcpServer *server, const QString &protocol, QObject *parent = nullptr);
+
+ ~HttpServer() override;
// Must be called to start listening.
//
// Returns true if a TCP port has been successfully bound.
- Q_REQUIRED_RESULT bool start();
+ Q_INVOKABLE Q_REQUIRED_RESULT bool start();
// Stops listening and performs final error checks.
- Q_REQUIRED_RESULT bool stop();
+ Q_INVOKABLE Q_REQUIRED_RESULT bool stop();
- void setExpectError(bool b);
+ Q_INVOKABLE void setExpectError(bool b);
// Full URL for given relative path
- QUrl url(const QString &path = QStringLiteral("/")) const;
+ Q_INVOKABLE QUrl url(const QString &path = QStringLiteral("/")) const;
Q_SIGNALS:
// Emitted after a HTTP request has been successfully parsed.
@@ -81,7 +84,7 @@ private Q_SLOTS:
void handleNewConnection();
private:
- QTcpServer m_tcpServer;
+ QTcpServer *m_tcpServer;
QUrl m_url;
bool m_error = false;
bool m_expectingError = false;
diff --git a/tests/auto/shared/httpsserver.h b/tests/auto/shared/httpsserver.h
new file mode 100644
index 000000000..32c8e8345
--- /dev/null
+++ b/tests/auto/shared/httpsserver.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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:GPL-EXCEPT$
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef HTTPSSERVER_H
+#define HTTPSSERVER_H
+
+#include "httpreqrep.h"
+#include "httpserver.h"
+
+#include <QDebug>
+#include <QFile>
+#include <QSslKey>
+#include <QSslSocket>
+#include <QSslConfiguration>
+#include <QTcpServer>
+
+struct SslTcpServer : QTcpServer
+{
+ SslTcpServer() {
+ sslconf.setLocalCertificateChain(QSslCertificate::fromPath(":/resources/cert.pem"));
+ sslconf.setPrivateKey(readKey(":/resources/key.pem"));
+ }
+
+ void incomingConnection(qintptr d) override {
+ auto socket = new QSslSocket(this);
+ socket->setSslConfiguration(sslconf);
+
+ if (!socket->setSocketDescriptor(d)) {
+ qWarning() << "Failed to setup ssl socket!";
+ delete socket;
+ return;
+ }
+
+ connect(socket, QOverload<QSslSocket::SocketError>::of(&QSslSocket::error),
+ [] (QSslSocket::SocketError e) { qWarning() << "! Socket Error:" << e; });
+ connect(socket, QOverload<const QList<QSslError> &>::of(&QSslSocket::sslErrors),
+ [] (const QList<QSslError> &le) { qWarning() << "! SSL Errors:\n" << le; });
+
+ addPendingConnection(socket);
+ socket->startServerEncryption();
+ }
+
+ QSslKey readKey(const QString &path) const {
+ QFile file(path);
+ file.open(QIODevice::ReadOnly);
+ return QSslKey(file.readAll(), QSsl::Rsa, QSsl::Pem);
+ }
+
+ QSslConfiguration sslconf;
+};
+
+struct HttpsServer : HttpServer
+{
+ HttpsServer(QObject *parent = nullptr) : HttpServer(new SslTcpServer, "https", parent) { }
+};
+
+#endif
diff --git a/tests/auto/shared/httpsserver.qrc b/tests/auto/shared/httpsserver.qrc
new file mode 100644
index 000000000..ec57a1983
--- /dev/null
+++ b/tests/auto/shared/httpsserver.qrc
@@ -0,0 +1,6 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+ <file>resources/cert.pem</file>
+ <file>resources/key.pem</file>
+</qresource>
+</RCC>
diff --git a/tests/auto/shared/resources/cert.pem b/tests/auto/shared/resources/cert.pem
new file mode 100644
index 000000000..3aaaf289c
--- /dev/null
+++ b/tests/auto/shared/resources/cert.pem
@@ -0,0 +1,64 @@
+-----BEGIN CERTIFICATE-----
+MIIEpDCCAoygAwIBAgIUO90aty9AMjvBvzfUhr1WwdBrKkMwDQYJKoZIhvcNAQEL
+BQAwfzELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcM
+DVNhbiBGcmFuY2lzY28xDzANBgNVBAoMBkJhZFNTTDEyMDAGA1UEAwwpQmFkU1NM
+IEludGVybWVkaWF0ZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTkwODI2MTQ0
+NDIxWhcNMTkwODI3MTQ0NDIxWjBjMQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2Fs
+aWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzEPMA0GA1UECgwGQmFkU1NM
+MRYwFAYDVQQDDA0qLmJhZHNzbC50ZXN0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
+MIIBCgKCAQEAkybT/L4zJCqefpd+eYT6aQ0PtobQfFgP+n+z5wWoUxIAJnjb5ZW4
+7IJxka/2/ggzJOfrUBur54LkTfFQ+yX85eKYCuH0GLz+Rve50LDn0ya6qSgmEhDG
+0bend2tMZY+Nl3B+5Ane1vua8hdJjv3ZO3e5UgpQwysL54eYyhEWWlbFWF11LhEd
+MYp953UGLqoV4Mlw+Li8TmFwdKQx6icgBTuloXLzk9aUU+b6NbXdadNXkmzg09IC
+sb8pnMXiF2P9Xm5rK0IoiRkSHxVnU12nQXh65Ns/2Dj5DcbHmVdvallfr4wnLeFP
+UotysZnvFmE7FLMSr/eQfkTG+Jlb7ZhoGwIDAQABozQwMjAJBgNVHRMEAjAAMCUG
+A1UdEQQeMByCDSouYmFkc3NsLnRlc3SCC2JhZHNzbC50ZXN0MA0GCSqGSIb3DQEB
+CwUAA4ICAQA7Yc+QQzqSK15ibmaYrkqq+cumggsWLCprW8jvzhpWBt9IjToP5nsy
+sKinYPoZR8jvZ1YVotcts7uQT7DkqeWkB+l+88c7gQdgujvBo6v9/g+jrXFKgsJD
+IBmkho8hpd63Slqv2Yp4bYT20O5EvR9CQvwSkwTs+ylBNEs1Q+AbekxmBjuYUxHn
+9xL4/GZ6ufoNv676iCoXo4mnDrCD8e8MRiZoU9Lq4G41HGiLWV0tM/M6BdVJYGzl
+FcBg0ZKnQT9OCWEPRe3zyRS6a+MivPAzxS8z/kYaRN+C7H68Mib3xPDsEETz1MnO
+uzGAPHAAgtYWYJi+CaaNWkgAv4n+UIQa0oyqPn4z5hLcsO+nMBws2Sg0mkQLilBX
+N1ciCdVMi7sHKuLa7GVksq/RQrXnZcQhoYQRrZAaAHKbxyo/M2pNqmDiFJppdH7a
+6Rj2vYf6ig/FXAzDGsDvf/tsGCxgJTFzGly+GsWVe40vyjfWHxWWDU/eGjfGO05k
+Xzjm+kYGJnH2hfiIlX1Jeu/jjIodiSy31F0hvuKlJu8PfaQ7oo5neRzwRO6Wq9rR
+7DMsQN6OtXGnnA+ogC0korA+aXev6wzbwYUhzMf1YTzEjrFNIXeIHsQSzq6lPcIE
+JOly5wjyO/eNF7mpHyDX8brY6Hn+bgyDeKAmsUvhOCEXgaPpKlP4gQ==
+-----END CERTIFICATE-----
+-----BEGIN CERTIFICATE-----
+MIIGeTCCBGGgAwIBAgIUbVL7tFc7sgPIYnt+REVc0wiHdBcwDQYJKoZIhvcNAQEL
+BQAwdzELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcM
+DVNhbiBGcmFuY2lzY28xDzANBgNVBAoMBkJhZFNTTDEqMCgGA1UEAwwhQmFkU1NM
+IFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MB4XDTE5MDgyNjE0NDQyMFoXDTI5
+MDgyMzE0NDQyMFowfzELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWEx
+FjAUBgNVBAcMDVNhbiBGcmFuY2lzY28xDzANBgNVBAoMBkJhZFNTTDEyMDAGA1UE
+AwwpQmFkU1NMIEludGVybWVkaWF0ZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggIi
+MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCgoU4q43DJEUyoAOeK31uyEgLn
+s5CCd6XFmGp6wln0yupwmYRaDiCoSJ1qpmjYt+gIHpDAFS2ZzR4TbZORFirjY0cQ
+6+IWwpBEQR0hOluWN99CqjdCxfuZwiTvTV3FQv1IJZ13g23Uh2xRbnrzC2muDHzT
+4ZNM3aayvziMGY6n33aksEc6WMZb3p/Qn2OepeC7EzZiy4tXKPf9OaOPbae5aJWZ
+bOzzydFLkV4UqZb5FfySt8toIivPeIlRCiPodWLb2y5DYUXyWBk1dpbIcVa/LusV
+vsBELeJ+BFDRH1NHtwOrhOkZHKMr3SQ1YRlNDEeHUVmQkori397j9JjpPzScQJ6r
+d/W4mGyzgRmguIy9IpKMbxX5/1A6c6l5q0HqMgPv84GWxlhav4xwsOf90iT2vLPZ
+yllVCgCsCfvLEyVFhER18HAo8mTkQqKL7ZO96xXHgugA7dFN/C3BdC9kYP/GbAwd
+J0R6qKrfSiyyk1VbjWfFdFH/G/bT9H0nrjMj5tCT4q/zDCb5HkBp3BOoyUKb9yyt
+a1Cht/Iu3f1SlQzsrDBt9iMMCjXoNNAJcV7ZZ6HCxcWwfAwxgylQgq8UG60shxhn
+CBPhcA8JM+mk2nghTU2pxwY/KpAd0H4/a79b0DE97dCOnNHzyP3tqP8RenG549B0
+gsNO60aG01k6P9jFuQIDAQABo4H0MIHxMB0GA1UdDgQWBBQgvWmDuYqQ6xX7y8xc
+cgky1FO7jzCBtAYDVR0jBIGsMIGpgBTUGo+svIaoSMF/shILSbeiQ1zAQKF7pHkw
+dzELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDVNh
+biBGcmFuY2lzY28xDzANBgNVBAoMBkJhZFNTTDEqMCgGA1UEAwwhQmFkU1NMIFJv
+b3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5ghR1qCPxzkfCSCwMFHm98245f0pk0zAM
+BgNVHRMEBTADAQH/MAsGA1UdDwQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAnGr6
+t1+KNGZV9hmAE3SyMzHRpgwtqIG4kl94A7Pz3CbA8+q7u7DW8l1GdaNx2J2wo+R5
+rJi02V5e7TNa7ZS5S9WGYHZ2y6QOjXuT28VMAPX+3HAgxk3RMxocpLpkPp8hhD/9
+S5KxA6AQDUN6av8E3xeuuWYWmTvAXNHK5ABXDFxxTp902ozNnZaSk2DxAUqcsOD4
+ago0IhRdkFGe1Q7F8gOxtlUL5owNL4uhRP8BbwOja2Gopn2+kA9CNqdwPI4Ipjlr
+yo61oCqzy3RAXOUct8WAvybacADmJODAxDq9O5fAZuYZScjjj1ASowmbyDH/Wb9z
++WfiKKH4BfgOIukzK3I1M9wiSDefIodCFfEVXbdNudZj8f9Gw4RrZwkUuxDLeRWG
+ReDtzAWq7G0Diw3uX40S4jaj3MeS6oHp2Nrj/VyjSRiYTeN/pnA9N0M5VuCYYvXD
+f50rrigjQfOgb4TmnyJAjXWVkXW7Fa+ooLsbvlfr8wP8f31y1cgWPHTVIv6Kmug7
+Bg88k3x5gLTXmutDjseORonhGMRdAxHgJVf5aKfzdRpwXZTDZJXhsAz9OdlOhNZd
+UrYo680QugA0V3H5D8Egbr2AUUSMDkn133COjeOIDknFxX3qDqeTzqLZCAEBIoKn
+Adpix0jvG1Ys4Ayq6K2wQFdGFjtl6LsiGC7pWWU=
+-----END CERTIFICATE-----
diff --git a/tests/auto/shared/resources/key.pem b/tests/auto/shared/resources/key.pem
new file mode 100644
index 000000000..89922679a
--- /dev/null
+++ b/tests/auto/shared/resources/key.pem
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEowIBAAKCAQEAkybT/L4zJCqefpd+eYT6aQ0PtobQfFgP+n+z5wWoUxIAJnjb
+5ZW47IJxka/2/ggzJOfrUBur54LkTfFQ+yX85eKYCuH0GLz+Rve50LDn0ya6qSgm
+EhDG0bend2tMZY+Nl3B+5Ane1vua8hdJjv3ZO3e5UgpQwysL54eYyhEWWlbFWF11
+LhEdMYp953UGLqoV4Mlw+Li8TmFwdKQx6icgBTuloXLzk9aUU+b6NbXdadNXkmzg
+09ICsb8pnMXiF2P9Xm5rK0IoiRkSHxVnU12nQXh65Ns/2Dj5DcbHmVdvallfr4wn
+LeFPUotysZnvFmE7FLMSr/eQfkTG+Jlb7ZhoGwIDAQABAoIBADRXy3BL98UVo+tD
+2ClBtBFKJBy5N9ADQyvH4SZ8TLO/423L7+xqpaz7eYppHWKfaBHorTuBnFRtquhO
+vo+Xo63iPFMirMFf+NMlq2MgilYBoMQrE9+5N//BZECGWlaGCcekrH5RRIMUXLlg
+rzm98lfE7pbQNIo39bQV97NpAJqBWPuoIvCrbRCysGoA5j7ptZ/EhSlC00eA7ybD
+CeYHmh8NrsapKOTGb5u1v3paV8X/mH6vKmsVs7n6LC0opBxzM8eAHEAQ6h8rmz9H
+y99FWDYha3lOS4SLkTnuRnNHOMLJajPq3Isu+BgzLWuRGnKZ3rmuUFwPNkCZTvsV
+dTdBE4ECgYEAw6jBEil0e8Pc9sGqnz93e8qrYE9wSPso4q3BNJgTbN48kon6mqh7
+gQVgEP/75Th5YrJUrY9Pd/8H9uoMOxbDXgOXG/xNnhC0L+7aM8nhKlxCLndY1e56
+/YymYYH4+D9ZD2u526mK/nmCg2QGOkCVYYp7NXe/mA0g34drKjefmj8CgYEAwIhq
+rZhlfAvQThSOqQA9zA7NXPDh4KzIjr8htVu5YvVcv5W2uhsni9DXFaloPnhuLdJ7
+MnPF2WqzQ9YqFrGn/9/OTqeE23f60ed04qLGM4BApb45y5Kw6sCPnWu7dMYfny9i
+XeZA2A+ODmqVkrU+ZNVzqzS1krYyUP3exd1voyUCgYEAqPRARH6np3gqhqoVvA4C
+D1OjSTdPrrWzSIriG5h2rbv6ck/Tp1l1zKPnoMZrrjRmHWQA2x61cNk4926DwUKW
+0cgn5HKqU6P49Ks8oRvi48FnJNjKTXHxoqChy/GAHF4Xecl8ZMKy06v5l5v4BLVg
+SSpb2n/dYl9z05IMaBhAKeECgYBKB2n1S6ah1q0GiLL92mDoiDyAYwKG8AjBkk40
+vIsAuNUruTYkQvKmuOsqohO6CXZb2hWSpZ9KZNN+3ucaCL9PDE/4QEM+W9iuQu/X
+gLzy6npxAD6avtGVweq2ncjbMp7QB1ksP69pJDn74xGV8miGPuiVyNOUEMgyChtR
+Oz6EnQKBgEth0w80CBg6b3NKuASoc/vC08njZQvWpe5xrzY2DL8epVKb1qf6+8SE
+eX34cIcSaonEZ2g67MAeIG6jtmPwxWk4EYAsO1u4XiyziABkoNyLKVH4hZg61BsV
+jL7R5UrUvBbhKLFOwkcB4Kwdwu7COB/UKa5XJBTMbuw1UTyxlUeI
+-----END RSA PRIVATE KEY-----
diff --git a/tests/auto/widgets/certificateerror/certificateerror.pro b/tests/auto/widgets/certificateerror/certificateerror.pro
new file mode 100644
index 000000000..73ba7515b
--- /dev/null
+++ b/tests/auto/widgets/certificateerror/certificateerror.pro
@@ -0,0 +1,3 @@
+include(../tests.pri)
+include(../../shared/https.pri)
+QT *= core-private
diff --git a/tests/auto/widgets/certificateerror/tst_certificateerror.cpp b/tests/auto/widgets/certificateerror/tst_certificateerror.cpp
new file mode 100644
index 000000000..5fd765ed5
--- /dev/null
+++ b/tests/auto/widgets/certificateerror/tst_certificateerror.cpp
@@ -0,0 +1,126 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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:GPL-EXCEPT$
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <httpsserver.h>
+#include <util.h>
+
+#include <QWebEngineCertificateError>
+#include <QWebEnginePage>
+#include <QWebEngineSettings>
+
+#include <QtTest/QtTest>
+
+class tst_CertificateError : public QObject
+{
+ Q_OBJECT
+public:
+ tst_CertificateError() { }
+
+private Q_SLOTS:
+ void handleError_data();
+ void handleError();
+};
+
+struct PageWithCertificateErrorHandler : QWebEnginePage
+{
+ PageWithCertificateErrorHandler(bool defer, bool accept, QObject *p = nullptr)
+ : QWebEnginePage(p), deferError(defer), acceptCertificate(accept) {
+ connect(this, &QWebEnginePage::loadFinished, [&] (bool result) { spyLoad(result); });
+ }
+
+ bool deferError, acceptCertificate;
+
+ CallbackSpy<bool> spyLoad;
+ QScopedPointer<QWebEngineCertificateError> error;
+
+ bool certificateError(const QWebEngineCertificateError &e) override {
+ error.reset(new QWebEngineCertificateError(e));
+ if (deferError)
+ error->defer();
+ return acceptCertificate;
+ }
+};
+
+void tst_CertificateError::handleError_data()
+{
+ QTest::addColumn<bool>("deferError");
+ QTest::addColumn<bool>("acceptCertificate");
+ QTest::addColumn<QString>("expectedContent");
+ QTest::addRow("Reject") << false << false << QString();
+ QTest::addRow("DeferReject") << true << false << QString();
+ QTest::addRow("DeferAccept") << true << true << "TEST";
+}
+
+void tst_CertificateError::handleError()
+{
+ HttpsServer server;
+ server.setExpectError(true);
+ QVERIFY(server.start());
+
+ connect(&server, &HttpsServer::newRequest, [&] (HttpReqRep *rr) {
+ rr->setResponseBody(QByteArrayLiteral("<html><body>TEST</body></html>"));
+ rr->sendResponse();
+ });
+
+ QFETCH(bool, deferError);
+ QFETCH(bool, acceptCertificate);
+ QFETCH(QString, expectedContent);
+
+ PageWithCertificateErrorHandler page(deferError, acceptCertificate);
+ page.settings()->setAttribute(QWebEngineSettings::ErrorPageEnabled, false);
+
+ page.setUrl(server.url());
+ QTRY_VERIFY(page.error);
+ QVERIFY(page.error->isOverridable());
+ auto chain = page.error->chain();
+ QCOMPARE(chain.size(), 2);
+ QCOMPARE(chain[0].serialNumber(), "3b:dd:1a:b7:2f:40:32:3b:c1:bf:37:d4:86:bd:56:c1:d0:6b:2a:43");
+ QCOMPARE(chain[1].serialNumber(), "6d:52:fb:b4:57:3b:b2:03:c8:62:7b:7e:44:45:5c:d3:08:87:74:17");
+
+ if (deferError) {
+ QVERIFY(page.error->deferred());
+ QVERIFY(!page.error->answered());
+ QVERIFY(!page.spyLoad.wasCalled());
+ QCOMPARE(toPlainTextSync(&page), QString());
+
+ if (acceptCertificate)
+ page.error->ignoreCertificateError();
+ else
+ page.error->rejectCertificate();
+
+ QVERIFY(page.error->answered());
+ page.error.reset();
+ }
+
+ bool loadResult = page.spyLoad.waitForResult();
+ QVERIFY(page.spyLoad.wasCalled());
+ QCOMPARE(loadResult, acceptCertificate);
+ QCOMPARE(toPlainTextSync(&page), expectedContent);
+}
+
+QTEST_MAIN(tst_CertificateError)
+#include <tst_certificateerror.moc>
diff --git a/tests/auto/widgets/qwebenginepage/BLACKLIST b/tests/auto/widgets/qwebenginepage/BLACKLIST
index 4e344c936..e6fad8b20 100644
--- a/tests/auto/widgets/qwebenginepage/BLACKLIST
+++ b/tests/auto/widgets/qwebenginepage/BLACKLIST
@@ -7,3 +7,6 @@ windows
[runJavaScriptFromSlot]
osx
linux
+
+[fullScreenRequested]
+windows
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index 713feca6d..dbb15ba10 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -47,6 +47,7 @@
#include <qnetworkreply.h>
#include <qnetworkrequest.h>
#include <qwebenginedownloaditem.h>
+#include <qwebenginefindtextresult.h>
#include <qwebenginefullscreenrequest.h>
#include <qwebenginehistory.h>
#include <qwebenginenotification.h>
@@ -127,6 +128,8 @@ private Q_SLOTS:
void findText();
void findTextResult();
void findTextSuccessiveShouldCallAllCallbacks();
+ void findTextCalledOnMatch();
+ void findTextActiveMatchOrdinal();
void deleteQWebEngineViewTwice();
void loadSignalsOrder_data();
void loadSignalsOrder();
@@ -941,18 +944,24 @@ void tst_QWebEnginePage::findText()
// Invoking a stopFinding operation will not change or clear the currently selected text,
// if nothing was found beforehand.
{
- CallbackSpy<bool> spy;
- m_view->findText("", 0, spy.ref());
- QVERIFY(spy.wasCalled());
+ CallbackSpy<bool> callbackSpy;
+ QSignalSpy signalSpy(m_view->page(), &QWebEnginePage::findTextFinished);
+ m_view->findText("", 0, callbackSpy.ref());
+ QVERIFY(callbackSpy.wasCalled());
+ QCOMPARE(signalSpy.count(), 1);
QTRY_COMPARE(m_view->selectedText(), QString("foo bar"));
}
// Invoking a startFinding operation with text that won't be found, will clear the current
// selection.
{
- CallbackSpy<bool> spy;
- m_view->findText("Will not be found", 0, spy.ref());
- QCOMPARE(spy.waitForResult(), false);
+ CallbackSpy<bool> callbackSpy;
+ QSignalSpy signalSpy(m_view->page(), &QWebEnginePage::findTextFinished);
+ m_view->findText("Will not be found", 0, callbackSpy.ref());
+ QCOMPARE(callbackSpy.waitForResult(), false);
+ QTRY_COMPARE(signalSpy.count(), 1);
+ auto result = signalSpy.takeFirst().value(0).value<QWebEngineFindTextResult>();
+ QCOMPARE(result.numberOfMatches(), 0);
QTRY_VERIFY(m_view->selectedText().isEmpty());
}
@@ -963,24 +972,36 @@ void tst_QWebEnginePage::findText()
// Invoking a startFinding operation with text that will be found, will clear the current
// selection as well.
{
- CallbackSpy<bool> spy;
- m_view->findText("foo", 0, spy.ref());
- QVERIFY(spy.waitForResult());
+ CallbackSpy<bool> callbackSpy;
+ QSignalSpy signalSpy(m_view->page(), &QWebEnginePage::findTextFinished);
+ m_view->findText("foo", 0, callbackSpy.ref());
+ QVERIFY(callbackSpy.waitForResult());
+ QTRY_COMPARE(signalSpy.count(), 1);
QTRY_VERIFY(m_view->selectedText().isEmpty());
}
// Invoking a stopFinding operation after text was found, will set the selected text to the
// found text.
{
- CallbackSpy<bool> spy;
- m_view->findText("", 0, spy.ref());
- QTRY_VERIFY(spy.wasCalled());
+ CallbackSpy<bool> callbackSpy;
+ QSignalSpy signalSpy(m_view->page(), &QWebEnginePage::findTextFinished);
+ m_view->findText("", 0, callbackSpy.ref());
+ QTRY_VERIFY(callbackSpy.wasCalled());
+ QTRY_COMPARE(signalSpy.count(), 1);
QTRY_COMPARE(m_view->selectedText(), QString("foo"));
}
}
void tst_QWebEnginePage::findTextResult()
{
+ QSignalSpy findTextSpy(m_view->page(), &QWebEnginePage::findTextFinished);
+ auto signalResult = [&findTextSpy]() -> QVector<int> {
+ if (findTextSpy.count() != 1)
+ return QVector<int>({-1, -1});
+ auto r = findTextSpy.takeFirst().value(0).value<QWebEngineFindTextResult>();
+ return QVector<int>({ r.numberOfMatches(), r.activeMatchOrdinal() });
+ };
+
// findText will abort in blink if the view has an empty size.
m_view->resize(800, 600);
m_view->show();
@@ -990,15 +1011,21 @@ void tst_QWebEnginePage::findTextResult()
QTRY_COMPARE(loadSpy.count(), 1);
QCOMPARE(findTextSync(m_page, ""), false);
+ QCOMPARE(signalResult(), QVector<int>({0, 0}));
const QStringList words = { "foo", "bar" };
for (const QString &subString : words) {
QCOMPARE(findTextSync(m_page, subString), true);
+ QCOMPARE(signalResult(), QVector<int>({1, 1}));
+
QCOMPARE(findTextSync(m_page, ""), false);
+ QCOMPARE(signalResult(), QVector<int>({0, 0}));
}
QCOMPARE(findTextSync(m_page, "blahhh"), false);
+ QCOMPARE(signalResult(), QVector<int>({0, 0}));
QCOMPARE(findTextSync(m_page, ""), false);
+ QCOMPARE(signalResult(), QVector<int>({0, 0}));
}
void tst_QWebEnginePage::findTextSuccessiveShouldCallAllCallbacks()
@@ -1024,6 +1051,91 @@ void tst_QWebEnginePage::findTextSuccessiveShouldCallAllCallbacks()
QVERIFY(spy5.wasCalled());
}
+void tst_QWebEnginePage::findTextCalledOnMatch()
+{
+ QSignalSpy loadSpy(m_view->page(), &QWebEnginePage::loadFinished);
+
+ // findText will abort in blink if the view has an empty size.
+ m_view->resize(800, 600);
+ m_view->show();
+ m_view->setHtml(QString("<html><head></head><body><div>foo bar</div></body></html>"));
+ QTRY_COMPARE(loadSpy.count(), 1);
+
+ // CALLBACK
+ bool callbackCalled = false;
+ m_view->page()->findText("foo", 0, [this, &callbackCalled](bool found) {
+ QVERIFY(found);
+
+ m_view->page()->findText("bar", 0, [&callbackCalled](bool found) {
+ QVERIFY(found);
+ callbackCalled = true;
+ });
+ });
+ QTRY_VERIFY(callbackCalled);
+
+ // SIGNAL
+ int findTextFinishedCount = 0;
+ connect(m_view->page(), &QWebEnginePage::findTextFinished, [this, &findTextFinishedCount](QWebEngineFindTextResult result) {
+ QCOMPARE(result.numberOfMatches(), 1);
+ if (findTextFinishedCount == 0)
+ m_view->page()->findText("bar");
+ findTextFinishedCount++;
+ });
+
+ m_view->page()->findText("foo");
+ QTRY_COMPARE(findTextFinishedCount, 2);
+}
+
+void tst_QWebEnginePage::findTextActiveMatchOrdinal()
+{
+ QSignalSpy loadSpy(m_view->page(), &QWebEnginePage::loadFinished);
+ QSignalSpy findTextSpy(m_view->page(), &QWebEnginePage::findTextFinished);
+ QWebEngineFindTextResult result;
+
+ // findText will abort in blink if the view has an empty size.
+ m_view->resize(800, 600);
+ m_view->show();
+ m_view->setHtml(QString("<html><head></head><body><div>foo bar foo bar foo</div></body></html>"));
+ QTRY_COMPARE(loadSpy.count(), 1);
+
+ // Iterate over all "foo" matches.
+ for (int i = 1; i <= 3; ++i) {
+ m_view->page()->findText("foo", 0);
+ QTRY_COMPARE(findTextSpy.count(), 1);
+ result = findTextSpy.takeFirst().value(0).value<QWebEngineFindTextResult>();
+ QCOMPARE(result.numberOfMatches(), 3);
+ QCOMPARE(result.activeMatchOrdinal(), i);
+ }
+
+ // The last match is followed by the fist one.
+ m_view->page()->findText("foo", 0);
+ QTRY_COMPARE(findTextSpy.count(), 1);
+ result = findTextSpy.takeFirst().value(0).value<QWebEngineFindTextResult>();
+ QCOMPARE(result.numberOfMatches(), 3);
+ QCOMPARE(result.activeMatchOrdinal(), 1);
+
+ // The first match is preceded by the last one.
+ m_view->page()->findText("foo", QWebEnginePage::FindBackward);
+ QTRY_COMPARE(findTextSpy.count(), 1);
+ result = findTextSpy.takeFirst().value(0).value<QWebEngineFindTextResult>();
+ QCOMPARE(result.numberOfMatches(), 3);
+ QCOMPARE(result.activeMatchOrdinal(), 3);
+
+ // Finding another word resets the activeMatchOrdinal.
+ m_view->page()->findText("bar", 0);
+ QTRY_COMPARE(findTextSpy.count(), 1);
+ result = findTextSpy.takeFirst().value(0).value<QWebEngineFindTextResult>();
+ QCOMPARE(result.numberOfMatches(), 2);
+ QCOMPARE(result.activeMatchOrdinal(), 1);
+
+ // If no match activeMatchOrdinal is 0.
+ m_view->page()->findText("bla", 0);
+ QTRY_COMPARE(findTextSpy.count(), 1);
+ result = findTextSpy.takeFirst().value(0).value<QWebEngineFindTextResult>();
+ QCOMPARE(result.numberOfMatches(), 0);
+ QCOMPARE(result.activeMatchOrdinal(), 0);
+}
+
static QWindow *findNewTopLevelWindow(const QWindowList &oldTopLevelWindows)
{
const auto tlws = QGuiApplication::topLevelWindows();
diff --git a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
index 8b75067ee..25afa5849 100644
--- a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
+++ b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
@@ -40,6 +40,8 @@
#include <QtWebEngineWidgets/qwebengineview.h>
#include <QtWebEngineWidgets/qwebenginedownloaditem.h>
+#include <mutex>
+
class tst_QWebEngineProfile : public QObject
{
Q_OBJECT
@@ -255,18 +257,18 @@ public:
bool isSequential() const override { return true; }
qint64 bytesAvailable() const override
{
- QMutexLocker lock(&m_mutex);
+ const std::lock_guard<QRecursiveMutex> lock(m_mutex);
return m_bytesAvailable;
}
bool atEnd() const override
{
- QMutexLocker lock(&m_mutex);
+ const std::lock_guard<QRecursiveMutex> lock(m_mutex);
return (m_data.size() >= 1000 && m_bytesRead >= 1000);
}
protected:
void timerEvent(QTimerEvent *) override
{
- QMutexLocker lock(&m_mutex);
+ const std::lock_guard<QRecursiveMutex> lock(m_mutex);
m_bytesAvailable += 200;
m_data.append(200, 'c');
emit readyRead();
@@ -278,7 +280,7 @@ protected:
qint64 readData(char *data, qint64 maxlen) override
{
- QMutexLocker lock(&m_mutex);
+ const std::lock_guard<QRecursiveMutex> lock(m_mutex);
qint64 len = qMin(qint64(m_bytesAvailable), maxlen);
if (len) {
memcpy(data, m_data.constData() + m_bytesRead, len);
@@ -295,7 +297,12 @@ protected:
}
private:
+#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
mutable QMutex m_mutex{QMutex::Recursive};
+ using QRecursiveMutex = QMutex;
+#else
+ mutable QRecursiveMutex m_mutex;
+#endif
QByteArray m_data;
QBasicTimer m_timer;
int m_bytesRead;
@@ -519,7 +526,7 @@ void tst_QWebEngineProfile::urlSchemeHandlerRequestHeaders()
QWebEngineProfile profile;
profile.installUrlSchemeHandler("myscheme", &handler);
- profile.setRequestInterceptor(&interceptor);
+ profile.setUrlRequestInterceptor(&interceptor);
QWebEnginePage page(&profile);
QSignalSpy loadFinishedSpy(&page, SIGNAL(loadFinished(bool)));
diff --git a/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp b/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp
index 1ba9c13e8..90361f2c9 100644
--- a/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp
+++ b/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp
@@ -30,6 +30,26 @@
#include <QWebChannel>
#endif
+static bool verifyOrder(QStringList orderList)
+{
+ QStringList expected = {
+ "DocumentCreation",
+ "DOMContentLoaded",
+ "DocumentReady",
+ "load",
+ "Deferred"
+ };
+
+ if (orderList.at(4) == "load (timeout)") {
+ if (orderList.at(3) != "Deferred")
+ return false;
+ expected[3] = "Deferred";
+ expected[4] = "load (timeout)";
+ }
+
+ return orderList == expected;
+}
+
class tst_QWebEngineScript: public QObject {
Q_OBJECT
@@ -101,15 +121,28 @@ void tst_QWebEngineScript::loadEvents()
script.setRunsOnSubFrames(true);
if (injectionPoint == QWebEngineScript::DocumentCreation) {
script.setSourceCode(QStringLiteral(R"(
- var log = ["DocumentCreation"];
- for (let type of ["DOMContentLoaded", "load"]) {
- window.addEventListener(type, () => log.push(type));
+ var log = ['DocumentCreation'];
+ var timestamps = {'DocumentCreation': Date.now()};
+ for (let type of ['DOMContentLoaded', 'load']) {
+ window.addEventListener(type, () => {
+ timestamps[type] = Date.now();
+ if (type === 'load' && log.includes('Deferred') && timestamps['Deferred'] - timestamps['DOMContentLoaded'] > 500)
+ log.push(type + ' (timeout)');
+ else
+ log.push(type);
+ });
}
)"));
} else if (injectionPoint == QWebEngineScript::DocumentReady) {
- script.setSourceCode(QStringLiteral(R"(log.push("DocumentReady"))"));
+ script.setSourceCode(QStringLiteral(R"(
+ timestamps['DocumentReady'] = Date.now();
+ log.push('DocumentReady');
+ )"));
} else {
- script.setSourceCode(QStringLiteral(R"(log.push("Deferred"))"));
+ script.setSourceCode(QStringLiteral(R"(
+ timestamps['Deferred'] = Date.now();
+ log.push('Deferred');
+ )"));
}
return script;
}
@@ -144,46 +177,38 @@ void tst_QWebEngineScript::loadEvents()
profile.pages.emplace_back(profile);
Page &page = profile.pages.back();
- const QStringList expected = {
- "DocumentCreation",
- "DOMContentLoaded",
- "DocumentReady",
- "load",
- "Deferred"
- };
-
// Single frame / setHtml
page.setHtml(QStringLiteral("<!DOCTYPE html><html><head><title>mr</title></head><body></body></html>"));
QTRY_COMPARE(page.spy.count(), 1);
QCOMPARE(page.spy.takeFirst().value(0).toBool(), true);
- QCOMPARE(page.eval("window.log", QWebEngineScript::MainWorld).toStringList(), expected);
- QCOMPARE(page.eval("window.log", QWebEngineScript::ApplicationWorld).toStringList(), expected);
+ QVERIFY(verifyOrder(page.eval("window.log", QWebEngineScript::MainWorld).toStringList()));
+ QVERIFY(verifyOrder(page.eval("window.log", QWebEngineScript::ApplicationWorld).toStringList()));
// After discard
page.setLifecycleState(QWebEnginePage::LifecycleState::Discarded);
page.setLifecycleState(QWebEnginePage::LifecycleState::Active);
QTRY_COMPARE(page.spy.count(), 1);
QCOMPARE(page.spy.takeFirst().value(0).toBool(), true);
- QCOMPARE(page.eval("window.log", QWebEngineScript::MainWorld).toStringList(), expected);
- QCOMPARE(page.eval("window.log", QWebEngineScript::ApplicationWorld).toStringList(), expected);
+ QVERIFY(verifyOrder(page.eval("window.log", QWebEngineScript::MainWorld).toStringList()));
+ QVERIFY(verifyOrder(page.eval("window.log", QWebEngineScript::ApplicationWorld).toStringList()));
// Multiple frames
page.load(QUrl("qrc:/resources/test_iframe_main.html"));
QTRY_COMPARE(page.spy.count(), 1);
QCOMPARE(page.spy.takeFirst().value(0).toBool(), true);
- QCOMPARE(page.eval("window.log", QWebEngineScript::MainWorld).toStringList(), expected);
- QCOMPARE(page.eval("window.log", QWebEngineScript::ApplicationWorld).toStringList(), expected);
- QCOMPARE(page.eval("window[0].log", QWebEngineScript::MainWorld).toStringList(), expected);
- QCOMPARE(page.eval("window[0].log", QWebEngineScript::ApplicationWorld).toStringList(), expected);
- QCOMPARE(page.eval("window[0][0].log", QWebEngineScript::MainWorld).toStringList(), expected);
- QCOMPARE(page.eval("window[0][0].log", QWebEngineScript::ApplicationWorld).toStringList(), expected);
+ QVERIFY(verifyOrder(page.eval("window.log", QWebEngineScript::MainWorld).toStringList()));
+ QVERIFY(verifyOrder(page.eval("window.log", QWebEngineScript::ApplicationWorld).toStringList()));
+ QVERIFY(verifyOrder(page.eval("window[0].log", QWebEngineScript::MainWorld).toStringList()));
+ QVERIFY(verifyOrder(page.eval("window[0].log", QWebEngineScript::ApplicationWorld).toStringList()));
+ QVERIFY(verifyOrder(page.eval("window[0][0].log", QWebEngineScript::MainWorld).toStringList()));
+ QVERIFY(verifyOrder(page.eval("window[0][0].log", QWebEngineScript::ApplicationWorld).toStringList()));
// Cross-process navigation
page.load(QUrl("chrome://gpu"));
QTRY_COMPARE_WITH_TIMEOUT(page.spy.count(), 1, 20000);
QCOMPARE(page.spy.takeFirst().value(0).toBool(), true);
- QCOMPARE(page.eval("window.log", QWebEngineScript::MainWorld).toStringList(), expected);
- QCOMPARE(page.eval("window.log", QWebEngineScript::ApplicationWorld).toStringList(), expected);
+ QVERIFY(verifyOrder(page.eval("window.log", QWebEngineScript::MainWorld).toStringList()));
+ QVERIFY(verifyOrder(page.eval("window.log", QWebEngineScript::ApplicationWorld).toStringList()));
// Using window.open from JS
QVERIFY(profile.pages.size() == 1);
@@ -191,10 +216,10 @@ void tst_QWebEngineScript::loadEvents()
QTRY_VERIFY(profile.pages.size() == 2);
QTRY_COMPARE(profile.pages.front().spy.count(), 1);
QTRY_COMPARE(profile.pages.back().spy.count(), 1);
- QCOMPARE(profile.pages.front().eval("window.log", QWebEngineScript::MainWorld).toStringList(), expected);
- QCOMPARE(profile.pages.front().eval("window.log", QWebEngineScript::ApplicationWorld).toStringList(), expected);
- QCOMPARE(profile.pages.back().eval("window.log", QWebEngineScript::MainWorld).toStringList(), expected);
- QCOMPARE(profile.pages.back().eval("window.log", QWebEngineScript::ApplicationWorld).toStringList(), expected);
+ QVERIFY(verifyOrder(profile.pages.front().eval("window.log", QWebEngineScript::MainWorld).toStringList()));
+ QVERIFY(verifyOrder(profile.pages.front().eval("window.log", QWebEngineScript::ApplicationWorld).toStringList()));
+ QVERIFY(verifyOrder(profile.pages.back().eval("window.log", QWebEngineScript::MainWorld).toStringList()));
+ QVERIFY(verifyOrder(profile.pages.back().eval("window.log", QWebEngineScript::ApplicationWorld).toStringList()));
}
void tst_QWebEngineScript::scriptWorld_data()
diff --git a/tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp b/tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp
index 0704cf383..b4061b984 100644
--- a/tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp
+++ b/tests/auto/widgets/qwebenginesettings/tst_qwebenginesettings.cpp
@@ -177,7 +177,7 @@ void tst_QWebEngineSettings::setInAcceptNavigationRequest()
{
NavigationRequestOverride page;
QSignalSpy loadFinishedSpy(&page, SIGNAL(loadFinished(bool)));
- QWebEngineSettings::globalSettings()->setAttribute(QWebEngineSettings::JavascriptEnabled, false);
+ QWebEngineSettings::defaultSettings()->setAttribute(QWebEngineSettings::JavascriptEnabled, false);
QVERIFY(!page.settings()->testAttribute(QWebEngineSettings::JavascriptEnabled));
page.load(QUrl("about:blank"));
diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
index fa179f2f8..827ac2757 100644
--- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
+++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
@@ -237,31 +237,46 @@ void tst_QWebEngineView::renderHints()
QVERIFY(!(webView.renderHints() & QPainter::Antialiasing));
QVERIFY(webView.renderHints() & QPainter::TextAntialiasing);
QVERIFY(webView.renderHints() & QPainter::SmoothPixmapTransform);
+#if QT_DEPRECATED_SINCE(5, 14)
QVERIFY(!(webView.renderHints() & QPainter::HighQualityAntialiasing));
+#endif
+ QVERIFY(!(webView.renderHints() & QPainter::Antialiasing));
webView.setRenderHint(QPainter::Antialiasing, true);
QVERIFY(webView.renderHints() & QPainter::Antialiasing);
QVERIFY(webView.renderHints() & QPainter::TextAntialiasing);
QVERIFY(webView.renderHints() & QPainter::SmoothPixmapTransform);
+#if QT_DEPRECATED_SINCE(5, 14)
QVERIFY(!(webView.renderHints() & QPainter::HighQualityAntialiasing));
+#endif
+ QVERIFY(!(webView.renderHints() & QPainter::Antialiasing));
webView.setRenderHint(QPainter::Antialiasing, false);
QVERIFY(!(webView.renderHints() & QPainter::Antialiasing));
QVERIFY(webView.renderHints() & QPainter::TextAntialiasing);
QVERIFY(webView.renderHints() & QPainter::SmoothPixmapTransform);
+#if QT_DEPRECATED_SINCE(5, 14)
QVERIFY(!(webView.renderHints() & QPainter::HighQualityAntialiasing));
+#endif
+ QVERIFY(!(webView.renderHints() & QPainter::Antialiasing));
webView.setRenderHint(QPainter::SmoothPixmapTransform, true);
QVERIFY(!(webView.renderHints() & QPainter::Antialiasing));
QVERIFY(webView.renderHints() & QPainter::TextAntialiasing);
QVERIFY(webView.renderHints() & QPainter::SmoothPixmapTransform);
+#if QT_DEPRECATED_SINCE(5, 14)
QVERIFY(!(webView.renderHints() & QPainter::HighQualityAntialiasing));
+#endif
+ QVERIFY(!(webView.renderHints() & QPainter::Antialiasing));
webView.setRenderHint(QPainter::SmoothPixmapTransform, false);
QVERIFY(webView.renderHints() & QPainter::TextAntialiasing);
QVERIFY(!(webView.renderHints() & QPainter::SmoothPixmapTransform));
+#if QT_DEPRECATED_SINCE(5, 14)
QVERIFY(!(webView.renderHints() & QPainter::HighQualityAntialiasing));
#endif
+ QVERIFY(!(webView.renderHints() & QPainter::Antialiasing));
+#endif
}
void tst_QWebEngineView::getWebKitVersion()
@@ -480,14 +495,14 @@ void tst_QWebEngineView::microFocusCoordinates()
evaluateJavaScriptSync(webView.page(), "document.getElementById('input1').focus()");
QTRY_COMPARE(evaluateJavaScriptSync(webView.page(), "document.activeElement.id").toString(), QStringLiteral("input1"));
- QTRY_VERIFY(webView.focusProxy()->inputMethodQuery(Qt::ImMicroFocus).isValid());
- QVariant initialMicroFocus = webView.focusProxy()->inputMethodQuery(Qt::ImMicroFocus);
+ QTRY_VERIFY(webView.focusProxy()->inputMethodQuery(Qt::ImCursorRectangle).isValid());
+ QVariant initialMicroFocus = webView.focusProxy()->inputMethodQuery(Qt::ImCursorRectangle);
evaluateJavaScriptSync(webView.page(), "window.scrollBy(0, 50)");
QTRY_VERIFY(scrollSpy.count() > 0);
- QTRY_VERIFY(webView.focusProxy()->inputMethodQuery(Qt::ImMicroFocus).isValid());
- QVariant currentMicroFocus = webView.focusProxy()->inputMethodQuery(Qt::ImMicroFocus);
+ QTRY_VERIFY(webView.focusProxy()->inputMethodQuery(Qt::ImCursorRectangle).isValid());
+ QVariant currentMicroFocus = webView.focusProxy()->inputMethodQuery(Qt::ImCursorRectangle);
QCOMPARE(initialMicroFocus.toRect().translated(QPoint(0,-50)), currentMicroFocus.toRect());
}
@@ -2989,7 +3004,7 @@ void tst_QWebEngineView::mouseLeave()
QVBoxLayout *layout = new QVBoxLayout;
layout->setAlignment(Qt::AlignTop);
layout->setSpacing(0);
- layout->setMargin(0);
+ layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(label);
layout->addWidget(view);
containerWidget->setLayout(layout);
diff --git a/tests/auto/widgets/widgets.pro b/tests/auto/widgets/widgets.pro
index 92159bf83..df553df55 100644
--- a/tests/auto/widgets/widgets.pro
+++ b/tests/auto/widgets/widgets.pro
@@ -4,6 +4,7 @@ QT_FOR_CONFIG += webenginecore webenginecore-private
TEMPLATE = subdirs
SUBDIRS += \
+ certificateerror \
defaultsurfaceformat \
devtools \
faviconmanager \
diff --git a/tests/manual/widgets/webgl/main.cpp b/tests/manual/widgets/webgl/main.cpp
index 364eda8b9..c18a15bac 100644
--- a/tests/manual/widgets/webgl/main.cpp
+++ b/tests/manual/widgets/webgl/main.cpp
@@ -30,9 +30,9 @@
#include <QtCore/QLoggingCategory>
#include <QtCore/QOperatingSystemVersion>
#include <QtGui/QOpenGLContext>
+#include <QtGui/QScreen>
#include <QtGui/QSurfaceFormat>
#include <QtWidgets/QApplication>
-#include <QtWidgets/QDesktopWidget>
#include <QtWidgets/QGroupBox>
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QMainWindow>
@@ -104,7 +104,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
QSize MainWindow::sizeHint() const
{
- const QRect desktopRect = QApplication::desktop()->screenGeometry();
+ const QRect desktopRect = QGuiApplication::primaryScreen()->geometry();
const QSize size = desktopRect.size() * qreal(0.9);
return size;
}
@@ -172,7 +172,7 @@ int main(int argc, char *argv[])
MainWindow w;
// Move middle-ish.
- const QRect desktopRect = QApplication::desktop()->screenGeometry();
+ const QRect desktopRect = QGuiApplication::primaryScreen()->geometry();
const QSize pos = desktopRect.size() * qreal(0.1);
w.move(pos.width(), pos.height());
diff --git a/tests/tests.pro b/tests/tests.pro
index 2922e5076..acb223640 100644
--- a/tests/tests.pro
+++ b/tests/tests.pro
@@ -1,3 +1,7 @@
TEMPLATE = subdirs
-SUBDIRS += auto quicktestbrowser
+SUBDIRS += auto
+
+qtHaveModule(webengine) {
+ SUBDIRS += quicktestbrowser
+}