summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.qmake.conf2
-rw-r--r--config.tests/libvpx/libvpx.cpp5
-rw-r--r--examples/webenginewidgets/demobrowser/downloadmanager.cpp2
-rw-r--r--examples/webenginewidgets/stylesheetbrowser/doc/images/stylesheetbrowser.pngbin0 -> 45161 bytes
-rw-r--r--examples/webenginewidgets/stylesheetbrowser/doc/src/stylesheetbrowser.qdoc58
-rw-r--r--examples/webenginewidgets/stylesheetbrowser/main.cpp57
-rw-r--r--examples/webenginewidgets/stylesheetbrowser/mainwindow.cpp127
-rw-r--r--examples/webenginewidgets/stylesheetbrowser/mainwindow.h74
-rw-r--r--examples/webenginewidgets/stylesheetbrowser/mainwindow.ui89
-rw-r--r--examples/webenginewidgets/stylesheetbrowser/stylesheetbrowser.pro23
-rw-r--r--examples/webenginewidgets/stylesheetbrowser/stylesheetbrowser.qrc5
-rw-r--r--examples/webenginewidgets/stylesheetbrowser/stylesheetdialog.cpp132
-rw-r--r--examples/webenginewidgets/stylesheetbrowser/stylesheetdialog.h71
-rw-r--r--examples/webenginewidgets/stylesheetbrowser/stylesheetdialog.ui195
-rw-r--r--examples/webenginewidgets/stylesheetbrowser/view-refresh.pngbin0 -> 1364 bytes
-rw-r--r--examples/webenginewidgets/webenginewidgets.pro1
m---------src/3rdparty0
-rw-r--r--src/core/browser_accessibility_qt.cpp24
-rw-r--r--src/core/browser_context_adapter.cpp10
-rw-r--r--src/core/browser_context_adapter.h2
-rw-r--r--src/core/browser_context_adapter_client.h2
-rw-r--r--src/core/chromium_gpu_helper.cpp4
-rw-r--r--src/core/chromium_overrides.cpp7
-rw-r--r--src/core/clipboard_qt.h2
-rw-r--r--src/core/config/desktop_linux.pri1
-rw-r--r--src/core/config/embedded_linux.pri1
-rw-r--r--src/core/config/windows.pri8
-rw-r--r--src/core/content_browser_client_qt.cpp16
-rw-r--r--src/core/content_browser_client_qt.h8
-rw-r--r--src/core/content_client_qt.cpp11
-rw-r--r--src/core/content_client_qt.h4
-rw-r--r--src/core/delegated_frame_node.cpp45
-rw-r--r--src/core/delegated_frame_node.h12
-rw-r--r--src/core/desktop_screen_qt.cpp5
-rw-r--r--src/core/desktop_screen_qt.h2
-rw-r--r--src/core/download_manager_delegate_qt.cpp22
-rw-r--r--src/core/download_manager_delegate_qt.h2
-rw-r--r--src/core/gl_context_qt.cpp11
-rw-r--r--src/core/gl_context_qt.h5
-rw-r--r--src/core/gl_surface_qt.cpp51
-rw-r--r--src/core/gl_surface_qt.h2
-rw-r--r--src/core/javascript_dialog_manager_qt.cpp9
-rw-r--r--src/core/javascript_dialog_manager_qt.h11
-rw-r--r--src/core/media_capture_devices_dispatcher.cpp10
-rw-r--r--src/core/native_web_keyboard_event_qt.cpp6
-rw-r--r--src/core/network_delegate_qt.cpp5
-rw-r--r--src/core/network_delegate_qt.h1
-rw-r--r--src/core/ozone_platform_qt.cpp4
-rw-r--r--src/core/pdfium_document_wrapper_qt.cpp7
-rw-r--r--src/core/permission_manager_qt.cpp8
-rw-r--r--src/core/permission_manager_qt.h5
-rw-r--r--src/core/print_view_manager_base_qt.cpp2
-rw-r--r--src/core/print_view_manager_base_qt.h2
-rw-r--r--src/core/print_view_manager_qt.cpp1
-rw-r--r--src/core/qtwebengine.gni9
-rw-r--r--src/core/qtwebengine_resources.gni2
-rw-r--r--src/core/qtwebengine_sources.gni5
-rw-r--r--src/core/render_widget_host_view_qt.cpp58
-rw-r--r--src/core/render_widget_host_view_qt.h6
-rw-r--r--src/core/renderer/content_renderer_client_qt.cpp6
-rw-r--r--src/core/renderer/pepper/pepper_flash_renderer_host_qt.cpp3
-rw-r--r--src/core/renderer/render_frame_observer_qt.cpp2
-rw-r--r--src/core/renderer/render_frame_observer_qt.h3
-rw-r--r--src/core/renderer/render_view_observer_qt.cpp4
-rw-r--r--src/core/renderer/web_channel_ipc_transport.cpp6
-rw-r--r--src/core/renderer_host/user_resource_controller_host.cpp6
-rw-r--r--src/core/resource_bundle_qt.cpp2
-rw-r--r--src/core/surface_factory_qt.cpp42
-rw-r--r--src/core/surface_factory_qt.h7
-rw-r--r--src/core/url_request_context_getter_qt.cpp10
-rw-r--r--src/core/web_contents_adapter.cpp31
-rw-r--r--src/core/web_contents_adapter_client.h11
-rw-r--r--src/core/web_contents_delegate_qt.cpp103
-rw-r--r--src/core/web_contents_delegate_qt.h10
-rw-r--r--src/core/web_contents_view_qt.cpp1
-rw-r--r--src/core/web_engine_context.cpp12
-rw-r--r--src/core/web_engine_settings.cpp7
-rw-r--r--src/core/web_engine_settings.h5
-rw-r--r--src/core/web_event_factory.cpp39
-rw-r--r--src/core/web_event_factory.h3
-rw-r--r--src/webengine/api/qquickwebenginecontextmenurequest.cpp3
-rw-r--r--src/webengine/api/qquickwebenginedownloaditem.cpp82
-rw-r--r--src/webengine/api/qquickwebenginedownloaditem_p.h8
-rw-r--r--src/webengine/api/qquickwebenginedownloaditem_p_p.h2
-rw-r--r--src/webengine/api/qquickwebengineprofile.cpp2
-rw-r--r--src/webengine/api/qquickwebenginesettings.cpp18
-rw-r--r--src/webengine/api/qquickwebenginesettings_p.h4
-rw-r--r--src/webengine/api/qquickwebenginetestsupport.cpp49
-rw-r--r--src/webengine/api/qquickwebenginetestsupport_p.h22
-rw-r--r--src/webengine/api/qquickwebengineview.cpp52
-rw-r--r--src/webengine/api/qquickwebengineview_p.h16
-rw-r--r--src/webengine/doc/src/webengineview.qdoc40
-rw-r--r--src/webengine/plugin/plugin.cpp3
-rw-r--r--src/webengine/plugin/plugin.pro2
-rw-r--r--src/webengine/plugin/plugins.qmltypes23
-rw-r--r--src/webengine/plugin/testsupport/plugin.cpp2
-rw-r--r--src/webengine/plugin/testsupport/testsupport.pro2
-rw-r--r--src/webengine/render_widget_host_view_qt_delegate_quick.cpp9
-rw-r--r--src/webengine/webengine.pro2
-rw-r--r--src/webenginewidgets/api/qwebenginecontextmenudata.cpp3
-rw-r--r--src/webenginewidgets/api/qwebenginedownloaditem.cpp87
-rw-r--r--src/webenginewidgets/api/qwebenginedownloaditem.h4
-rw-r--r--src/webenginewidgets/api/qwebenginedownloaditem_p.h1
-rw-r--r--src/webenginewidgets/api/qwebenginepage.cpp86
-rw-r--r--src/webenginewidgets/api/qwebenginepage.h16
-rw-r--r--src/webenginewidgets/api/qwebengineprofile.cpp7
-rw-r--r--src/webenginewidgets/api/qwebengineprofile_p.h1
-rw-r--r--src/webenginewidgets/api/qwebenginesettings.cpp2
-rw-r--r--src/webenginewidgets/api/qwebenginesettings.h3
-rw-r--r--src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc40
-rw-r--r--src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc3
-rw-r--r--src/webenginewidgets/ui/messagebubblewidget.cpp1
-rw-r--r--tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp9
-rw-r--r--tests/auto/quick/qmltests/data/tst_favicon.qml1
-rw-r--r--tests/auto/quick/qmltests/data/tst_inputMethod.qml76
-rw-r--r--tests/auto/quick/qmltests/data/tst_loadUrl.qml7
-rw-r--r--tests/auto/quick/qmltests/qmltests.pro1
-rw-r--r--tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp53
-rw-r--r--tests/auto/quick/qquickwebengineviewgraphics/qquickwebengineviewgraphics.pro2
-rw-r--r--tests/auto/quick/shared/util.h22
-rw-r--r--tests/auto/widgets/qwebengineaccessibility/tst_qwebengineaccessibility.cpp146
-rw-r--r--tests/auto/widgets/qwebenginepage/BLACKLIST2
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp6
-rw-r--r--tests/auto/widgets/qwebenginespellcheck/dict/de-DE.dic1
-rw-r--r--tests/auto/widgets/qwebenginespellcheck/dict/en-US.dic1
-rw-r--r--tests/auto/widgets/qwebenginespellcheck/tst_qwebenginespellcheck.cpp13
-rwxr-xr-xtools/scripts/take_snapshot.py5
-rw-r--r--tools/scripts/version_resolver.py4
128 files changed, 2116 insertions, 390 deletions
diff --git a/.qmake.conf b/.qmake.conf
index d5977d016..76ab2f4b2 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -5,4 +5,4 @@ QTWEBENGINE_OUT_ROOT = $$shadowed($$PWD)
load(qt_build_config)
CONFIG += warning_clean
-MODULE_VERSION = 5.9.2
+MODULE_VERSION = 5.10.0
diff --git a/config.tests/libvpx/libvpx.cpp b/config.tests/libvpx/libvpx.cpp
index 258790309..ec261cd5a 100644
--- a/config.tests/libvpx/libvpx.cpp
+++ b/config.tests/libvpx/libvpx.cpp
@@ -28,6 +28,11 @@
#include <vpx/svc_context.h>
#include <vpx/vpx_frame_buffer.h>
+#include <vpx/vp8dx.h>
+
+#ifndef VPX_CTRL_VPXD_GET_LAST_QUANTIZER
+#error "This version of libvpx is too old, it is missing VPX_CTRL_VPXD_GET_LAST_QUANTIZER define"
+#endif
int main(int, char **)
{
diff --git a/examples/webenginewidgets/demobrowser/downloadmanager.cpp b/examples/webenginewidgets/demobrowser/downloadmanager.cpp
index 33893c912..012d0620e 100644
--- a/examples/webenginewidgets/demobrowser/downloadmanager.cpp
+++ b/examples/webenginewidgets/demobrowser/downloadmanager.cpp
@@ -263,7 +263,7 @@ void DownloadWidget::finished()
interrupted = true;
break;
case QWebEngineDownloadItem::DownloadInterrupted:
- message = QStringLiteral("Download interrupted");
+ message = QStringLiteral("Download interrupted: %1").arg(m_download->interruptReasonString());
interrupted = true;
break;
}
diff --git a/examples/webenginewidgets/stylesheetbrowser/doc/images/stylesheetbrowser.png b/examples/webenginewidgets/stylesheetbrowser/doc/images/stylesheetbrowser.png
new file mode 100644
index 000000000..32c7c43ed
--- /dev/null
+++ b/examples/webenginewidgets/stylesheetbrowser/doc/images/stylesheetbrowser.png
Binary files differ
diff --git a/examples/webenginewidgets/stylesheetbrowser/doc/src/stylesheetbrowser.qdoc b/examples/webenginewidgets/stylesheetbrowser/doc/src/stylesheetbrowser.qdoc
new file mode 100644
index 000000000..c5506a623
--- /dev/null
+++ b/examples/webenginewidgets/stylesheetbrowser/doc/src/stylesheetbrowser.qdoc
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example webenginewidgets/stylesheetbrowser
+ \title WebEngine StyleSheet Browser Example
+ \ingroup webengine-widgetexamples
+ \brief Demonstrates how to inject CSS into web pages using user scripts
+
+ \image stylesheetbrowser.png
+
+ \e {StyleSheet Browser} demonstrates how to use the \l{Qt WebEngine Widgets C++ Classes}
+ {Qt WebEngine C++ classes} to inject user stylesheets into web pages.
+
+ \include examples-run.qdocinc
+
+ \section1 Working With Stylesheets
+
+ We use JavaScript to create and append CSS elements to the documents.
+ After declaring the script source, QWebEnginePage::runJavaScript() can run it
+ immediately and apply newly created styles on the current content of the web view.
+ Encapsulating the script into a QWebEngineScript and adding it to the script collection
+ of QWebEnginePage makes its effect permanent.
+
+ \quotefromfile webenginewidgets/stylesheetbrowser/mainwindow.cpp
+ \skipto MainWindow::insertStyleSheet
+ \printuntil /^\}/
+
+ Removing stylesheets can be done similarly:
+
+ \quotefromfile webenginewidgets/stylesheetbrowser/mainwindow.cpp
+ \skipto MainWindow::removeStyleSheet
+ \printuntil /^\}/
+*/
diff --git a/examples/webenginewidgets/stylesheetbrowser/main.cpp b/examples/webenginewidgets/stylesheetbrowser/main.cpp
new file mode 100644
index 000000000..c353a704b
--- /dev/null
+++ b/examples/webenginewidgets/stylesheetbrowser/main.cpp
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the demonstration applications 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "mainwindow.h"
+#include <QApplication>
+#include <QUrl>
+
+int main(int argc, char *argv[])
+{
+ QCoreApplication::setOrganizationName("The Qt Company");
+ QCoreApplication::setOrganizationDomain("www.qt.io");
+ QCoreApplication::setApplicationName("StyleSheet Browser");
+
+ QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+ QApplication a(argc, argv);
+ MainWindow w(QUrl("http://qt.io"));
+ w.show();
+ return a.exec();
+}
diff --git a/examples/webenginewidgets/stylesheetbrowser/mainwindow.cpp b/examples/webenginewidgets/stylesheetbrowser/mainwindow.cpp
new file mode 100644
index 000000000..01697e8e4
--- /dev/null
+++ b/examples/webenginewidgets/stylesheetbrowser/mainwindow.cpp
@@ -0,0 +1,127 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the demonstration applications 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+
+#include "stylesheetdialog.h"
+
+MainWindow::MainWindow(const QUrl &url) :
+ QMainWindow(),
+ ui(new Ui::MainWindow)
+{
+ ui->setupUi(this);
+
+ connect(ui->urlBar, &QLineEdit::returnPressed, this, &MainWindow::urlEntered);
+ connect(ui->webEngineView, &QWebEngineView::urlChanged, this, &MainWindow::urlChanged);
+ connect(ui->settingsButton, &QPushButton::clicked, this, &MainWindow::showStyleSheetsDialog);
+ connect(ui->reloadButton, &QPushButton::clicked, this, &MainWindow::reloadRequested);
+
+ QSettings settings;
+ settings.beginGroup("styleSheets");
+ QStringList styleSheets = settings.allKeys();
+ for (auto name : qAsConst(styleSheets))
+ insertStyleSheet(name, settings.value(name, QString()).toString(), false);
+ settings.endGroup();
+
+ ui->webEngineView->setUrl(url);
+}
+
+MainWindow::~MainWindow()
+{
+ delete ui;
+}
+
+void MainWindow::insertStyleSheet(const QString &name, const QString &source, bool immediately)
+{
+ QWebEngineScript script;
+ QString s = QString::fromLatin1("(function() {"\
+ " css = document.createElement('style');"\
+ " css.type = 'text/css';"\
+ " css.id = '%1';"\
+ " document.head.appendChild(css);"\
+ " css.innerText = '%2';"\
+ "})()").arg(name).arg(source.simplified());
+ if (immediately)
+ ui->webEngineView->page()->runJavaScript(s, QWebEngineScript::ApplicationWorld);
+
+ script.setName(name);
+ script.setSourceCode(s);
+ script.setInjectionPoint(QWebEngineScript::DocumentReady);
+ script.setRunsOnSubFrames(true);
+ script.setWorldId(QWebEngineScript::ApplicationWorld);
+ ui->webEngineView->page()->scripts().insert(script);
+}
+
+void MainWindow::removeStyleSheet(const QString &name, bool immediately)
+{
+ QString s = QString::fromLatin1("(function() {"\
+ " var element = document.getElementById('%1');"\
+ " element.outerHTML = '';"\
+ " delete element;"\
+ "})()").arg(name);
+ if (immediately)
+ ui->webEngineView->page()->runJavaScript(s, QWebEngineScript::ApplicationWorld);
+
+ QWebEngineScript script = ui->webEngineView->page()->scripts().findScript(name);
+ ui->webEngineView->page()->scripts().remove(script);
+}
+
+void MainWindow::urlEntered()
+{
+ ui->webEngineView->setUrl(QUrl::fromUserInput(ui->urlBar->text()));
+}
+
+void MainWindow::urlChanged(const QUrl &url)
+{
+ ui->urlBar->setText(url.toString());
+}
+
+void MainWindow::showStyleSheetsDialog()
+{
+ StylesheetDialog *dialog = new StylesheetDialog(this);
+ dialog->show();
+}
+
+void MainWindow::reloadRequested()
+{
+ ui->webEngineView->reload();
+}
diff --git a/examples/webenginewidgets/stylesheetbrowser/mainwindow.h b/examples/webenginewidgets/stylesheetbrowser/mainwindow.h
new file mode 100644
index 000000000..a6ee6a44f
--- /dev/null
+++ b/examples/webenginewidgets/stylesheetbrowser/mainwindow.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the demonstration applications 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+#include <QSettings>
+#include <QWebEngineScriptCollection>
+
+namespace Ui {
+class MainWindow;
+}
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ explicit MainWindow(const QUrl &url);
+ ~MainWindow();
+
+ void insertStyleSheet(const QString &name, const QString &source, bool immediately);
+ void removeStyleSheet(const QString &name, bool immediately);
+
+private slots:
+ void urlEntered();
+ void urlChanged(const QUrl &url);
+ void showStyleSheetsDialog();
+ void reloadRequested();
+
+private:
+ Ui::MainWindow *ui;
+};
+
+#endif // MAINWINDOW_H
diff --git a/examples/webenginewidgets/stylesheetbrowser/mainwindow.ui b/examples/webenginewidgets/stylesheetbrowser/mainwindow.ui
new file mode 100644
index 000000000..f9c1af969
--- /dev/null
+++ b/examples/webenginewidgets/stylesheetbrowser/mainwindow.ui
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>713</width>
+ <height>455</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>StyleSheet Browser</string>
+ </property>
+ <property name="unifiedTitleAndToolBarOnMac">
+ <bool>false</bool>
+ </property>
+ <widget class="QWidget" name="centralWidget">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QWidget" name="webContentsWidget" native="true">
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QWidget" name="urlBarWidget" native="true">
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QLineEdit" name="urlBar"/>
+ </item>
+ <item>
+ <widget class="QPushButton" name="reloadButton">
+ <property name="text">
+ <string/>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+R</string>
+ </property>
+ <property name="icon">
+ <iconset resource="stylesheetbrowser.qrc">
+ <normaloff>:/view-refresh.png</normaloff>:/view-refresh.png</iconset>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="settingsButton">
+ <property name="text">
+ <string>Settings</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QWebEngineView" name="webEngineView">
+ <property name="url">
+ <url>
+ <string>about:blank</string>
+ </url>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QMenuBar" name="menuBar">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>713</width>
+ <height>20</height>
+ </rect>
+ </property>
+ </widget>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <customwidgets>
+ <customwidget>
+ <class>QWebEngineView</class>
+ <extends>QWidget</extends>
+ <header location="global">QtWebEngineWidgets/QWebEngineView</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/examples/webenginewidgets/stylesheetbrowser/stylesheetbrowser.pro b/examples/webenginewidgets/stylesheetbrowser/stylesheetbrowser.pro
new file mode 100644
index 000000000..c5f1080e3
--- /dev/null
+++ b/examples/webenginewidgets/stylesheetbrowser/stylesheetbrowser.pro
@@ -0,0 +1,23 @@
+TEMPLATE = app
+TARGET = stylesheetbrowser
+QT += webenginewidgets
+CONFIG += c++11
+
+HEADERS += \
+ mainwindow.h \
+ stylesheetdialog.h
+
+SOURCES += \
+ main.cpp \
+ mainwindow.cpp \
+ stylesheetdialog.cpp
+
+FORMS += \
+ mainwindow.ui \
+ stylesheetdialog.ui
+
+RESOURCES += stylesheetbrowser.qrc
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/webenginewidgets/stylesheetbrowser
+INSTALLS += target
diff --git a/examples/webenginewidgets/stylesheetbrowser/stylesheetbrowser.qrc b/examples/webenginewidgets/stylesheetbrowser/stylesheetbrowser.qrc
new file mode 100644
index 000000000..8805f2c53
--- /dev/null
+++ b/examples/webenginewidgets/stylesheetbrowser/stylesheetbrowser.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>view-refresh.png</file>
+ </qresource>
+</RCC>
diff --git a/examples/webenginewidgets/stylesheetbrowser/stylesheetdialog.cpp b/examples/webenginewidgets/stylesheetbrowser/stylesheetdialog.cpp
new file mode 100644
index 000000000..65c50bfb3
--- /dev/null
+++ b/examples/webenginewidgets/stylesheetbrowser/stylesheetdialog.cpp
@@ -0,0 +1,132 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the demonstration applications 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "mainwindow.h"
+#include "stylesheetdialog.h"
+#include "ui_stylesheetdialog.h"
+
+StylesheetDialog::StylesheetDialog(QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::StylesheetDialog)
+{
+ ui->setupUi(this);
+
+ connect(ui->styleSheetList, &QListWidget::currentItemChanged, this, &StylesheetDialog::currentStyleSheetChanged);
+ connect(ui->fileNameEdit, &QLineEdit::textChanged, this, &StylesheetDialog::fileNameChanged);
+
+ connect(ui->addButton, &QPushButton::clicked, this, &StylesheetDialog::addButtonClicked);
+ connect(ui->removeButton, &QPushButton::clicked, this, &StylesheetDialog::removeButtonClicked);
+
+ QSettings settings;
+ settings.beginGroup("styleSheets");
+ for (auto name : settings.allKeys())
+ new QListWidgetItem(name, ui->styleSheetList);
+ settings.endGroup();
+}
+
+StylesheetDialog::~StylesheetDialog()
+{
+ delete ui;
+}
+
+void StylesheetDialog::currentStyleSheetChanged(QListWidgetItem *current, QListWidgetItem *previous)
+{
+ if (!previous) {
+ // Select the first item on startup
+ ui->styleSheetList->setCurrentItem(current);
+ }
+
+ if (!current) {
+ ui->fileNameEdit->setText(QString());
+ ui->sourceCodeEdit->setPlainText(QString());
+ return;
+ }
+
+ QSettings settings;
+ settings.beginGroup("styleSheets");
+ ui->fileNameEdit->setText(current->text());
+ ui->sourceCodeEdit->setPlainText(settings.value(current->text(), QString()).toString());
+ settings.endGroup();
+}
+
+void StylesheetDialog::fileNameChanged(const QString &text)
+{
+ QList<QListWidgetItem *> items = ui->styleSheetList->findItems(text, Qt::MatchFixedString);
+ if (items.size())
+ ui->addButton->setEnabled(false);
+ else
+ ui->addButton->setEnabled(true);
+}
+
+void StylesheetDialog::addButtonClicked()
+{
+ new QListWidgetItem(ui->fileNameEdit->text(), ui->styleSheetList);
+
+ MainWindow *window = static_cast<MainWindow *>(parent());
+ const QString name = ui->fileNameEdit->text();
+ const QString source = ui->sourceCodeEdit->toPlainText();
+ window->insertStyleSheet(name, source, true);
+
+ QSettings settings;
+ settings.beginGroup("styleSheets");
+ settings.setValue(name, source);
+ settings.endGroup();
+
+ ui->addButton->setEnabled(false);
+}
+
+void StylesheetDialog::removeButtonClicked()
+{
+ if (ui->styleSheetList->selectedItems().isEmpty())
+ return;
+
+ MainWindow *window = static_cast<MainWindow *>(parent());
+ QSettings settings;
+ settings.beginGroup("styleSheets");
+
+ QListWidgetItem *item = ui->styleSheetList->selectedItems().first();
+ const QString name = item->text();
+ window->removeStyleSheet(name, true);
+ settings.remove(name);
+ delete item;
+
+ settings.endGroup();
+}
diff --git a/examples/webenginewidgets/stylesheetbrowser/stylesheetdialog.h b/examples/webenginewidgets/stylesheetbrowser/stylesheetdialog.h
new file mode 100644
index 000000000..3b21350c7
--- /dev/null
+++ b/examples/webenginewidgets/stylesheetbrowser/stylesheetdialog.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the demonstration applications 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef STYLESHEETDIALOG_H
+#define STYLESHEETDIALOG_H
+
+#include <QDialog>
+#include <QListWidgetItem>
+
+namespace Ui {
+class StylesheetDialog;
+}
+
+class StylesheetDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit StylesheetDialog(QWidget *parent = 0);
+ ~StylesheetDialog();
+
+private slots:
+ void currentStyleSheetChanged(QListWidgetItem *current, QListWidgetItem *previous);
+ void fileNameChanged(const QString &text);
+
+ void addButtonClicked();
+ void removeButtonClicked();
+
+private:
+ Ui::StylesheetDialog *ui;
+};
+
+#endif // STYLESHEETDIALOG_H
diff --git a/examples/webenginewidgets/stylesheetbrowser/stylesheetdialog.ui b/examples/webenginewidgets/stylesheetbrowser/stylesheetdialog.ui
new file mode 100644
index 000000000..3e70ce89a
--- /dev/null
+++ b/examples/webenginewidgets/stylesheetbrowser/stylesheetdialog.ui
@@ -0,0 +1,195 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>StylesheetDialog</class>
+ <widget class="QDialog" name="StylesheetDialog">
+ <property name="windowModality">
+ <enum>Qt::ApplicationModal</enum>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>547</width>
+ <height>431</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>547</width>
+ <height>431</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>547</width>
+ <height>431</height>
+ </size>
+ </property>
+ <property name="windowTitle">
+ <string>Stylesheets</string>
+ </property>
+ <property name="modal">
+ <bool>true</bool>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QWidget" name="widget" native="true">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <widget class="QWidget" name="horizontalLayoutWidget">
+ <property name="geometry">
+ <rect>
+ <x>9</x>
+ <y>9</y>
+ <width>511</width>
+ <height>371</height>
+ </rect>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetDefaultConstraint</enum>
+ </property>
+ <item>
+ <widget class="QListWidget" name="styleSheetList"/>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QLabel" name="fileNameLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Stylesheet name:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="fileNameEdit">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QLabel" name="sourceLabel">
+ <property name="text">
+ <string>Source code:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPlainTextEdit" name="sourceCodeEdit">
+ <property name="font">
+ <font>
+ <family>Courier New</family>
+ <pointsize>10</pointsize>
+ </font>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <item>
+ <widget class="QPushButton" name="addButton">
+ <property name="text">
+ <string>Add</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="removeButton">
+ <property name="text">
+ <string>Remove</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>StylesheetDialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>StylesheetDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/examples/webenginewidgets/stylesheetbrowser/view-refresh.png b/examples/webenginewidgets/stylesheetbrowser/view-refresh.png
new file mode 100644
index 000000000..cab4d02c7
--- /dev/null
+++ b/examples/webenginewidgets/stylesheetbrowser/view-refresh.png
Binary files differ
diff --git a/examples/webenginewidgets/webenginewidgets.pro b/examples/webenginewidgets/webenginewidgets.pro
index 61b294d7a..217c4f016 100644
--- a/examples/webenginewidgets/webenginewidgets.pro
+++ b/examples/webenginewidgets/webenginewidgets.pro
@@ -8,6 +8,7 @@ SUBDIRS += \
html2pdf \
markdowneditor \
simplebrowser \
+ stylesheetbrowser \
videoplayer
qtHaveModule(positioning): SUBDIRS += maps
diff --git a/src/3rdparty b/src/3rdparty
-Subproject 53521384e3d0ab71727ae950c37951f7d3402ce
+Subproject 0e828760a46a39f26c7d9fd86654c363f4218be
diff --git a/src/core/browser_accessibility_qt.cpp b/src/core/browser_accessibility_qt.cpp
index ac4649d3d..4a995b0e0 100644
--- a/src/core/browser_accessibility_qt.cpp
+++ b/src/core/browser_accessibility_qt.cpp
@@ -207,11 +207,11 @@ QAccessible::Role BrowserAccessibilityQt::role() const
case ui::AX_ROLE_BLOCKQUOTE:
return QAccessible::Section;
case ui::AX_ROLE_BUSY_INDICATOR:
- return QAccessible::Animation; // FIXME
+ return QAccessible::NoRole; // This is unused and planned to be removed.
case ui::AX_ROLE_BUTTON:
return QAccessible::Button;
case ui::AX_ROLE_BUTTON_DROP_DOWN:
- return QAccessible::Button;
+ return QAccessible::ButtonDropDown;
case ui::AX_ROLE_CANVAS:
return QAccessible::Canvas;
case ui::AX_ROLE_CELL:
@@ -277,13 +277,13 @@ QAccessible::Role BrowserAccessibilityQt::role() const
case ui::AX_ROLE_LABEL_TEXT:
return QAccessible::StaticText;
case ui::AX_ROLE_LEGEND:
- return QAccessible::NoRole; // FIXME
+ return QAccessible::StaticText;
case ui::AX_ROLE_LINK:
return QAccessible::Link;
case ui::AX_ROLE_LIST:
return QAccessible::List;
case ui::AX_ROLE_LIST_BOX:
- return QAccessible::List;
+ return QAccessible::ComboBox;
case ui::AX_ROLE_LIST_BOX_OPTION:
return QAccessible::ListItem;
case ui::AX_ROLE_LIST_ITEM:
@@ -293,11 +293,11 @@ QAccessible::Role BrowserAccessibilityQt::role() const
case ui::AX_ROLE_LOCATION_BAR:
return QAccessible::NoRole; // FIXME
case ui::AX_ROLE_LOG:
- return QAccessible::NoRole; // FIXME
+ return QAccessible::Section;
case ui::AX_ROLE_MAIN:
- return QAccessible::NoRole; // FIXME
+ return QAccessible::Grouping;
case ui::AX_ROLE_MARQUEE:
- return QAccessible::NoRole; // FIXME
+ return QAccessible::Section;
case ui::AX_ROLE_MATH:
return QAccessible::Equation;
case ui::AX_ROLE_MENU:
@@ -363,7 +363,7 @@ QAccessible::Role BrowserAccessibilityQt::role() const
case ui::AX_ROLE_STATIC_TEXT:
return QAccessible::StaticText;
case ui::AX_ROLE_STATUS:
- return QAccessible::StatusBar;
+ return QAccessible::Indicator;
case ui::AX_ROLE_SVG_ROOT:
return QAccessible::Graphic;
case ui::AX_ROLE_TABLE:
@@ -491,7 +491,7 @@ QStringList BrowserAccessibilityQt::keyBindingsForAction(const QString &actionNa
void BrowserAccessibilityQt::addSelection(int startOffset, int endOffset)
{
- manager()->SetTextSelection(*this, startOffset, endOffset);
+ manager()->SetSelection(AXPlatformRange(CreatePositionAt(startOffset), CreatePositionAt(endOffset)));
}
QString BrowserAccessibilityQt::attributes(int offset, int *startOffset, int *endOffset) const
@@ -549,19 +549,19 @@ QString BrowserAccessibilityQt::text(int startOffset, int endOffset) const
void BrowserAccessibilityQt::removeSelection(int selectionIndex)
{
- manager()->SetTextSelection(*this, 0, 0);
+ manager()->SetSelection(AXPlatformRange(CreatePositionAt(0), CreatePositionAt(0)));
}
void BrowserAccessibilityQt::setCursorPosition(int position)
{
- manager()->SetTextSelection(*this, position, position);
+ manager()->SetSelection(AXPlatformRange(CreatePositionAt(position), CreatePositionAt(position)));
}
void BrowserAccessibilityQt::setSelection(int selectionIndex, int startOffset, int endOffset)
{
if (selectionIndex != 0)
return;
- manager()->SetTextSelection(*this, startOffset, endOffset);
+ manager()->SetSelection(AXPlatformRange(CreatePositionAt(startOffset), CreatePositionAt(endOffset)));
}
int BrowserAccessibilityQt::characterCount() const
diff --git a/src/core/browser_context_adapter.cpp b/src/core/browser_context_adapter.cpp
index bec76ad81..f76969c74 100644
--- a/src/core/browser_context_adapter.cpp
+++ b/src/core/browser_context_adapter.cpp
@@ -184,6 +184,16 @@ void BrowserContextAdapter::cancelDownload(quint32 downloadId)
downloadManagerDelegate()->cancelDownload(downloadId);
}
+void BrowserContextAdapter::pauseDownload(quint32 downloadId)
+{
+ downloadManagerDelegate()->pauseDownload(downloadId);
+}
+
+void BrowserContextAdapter::resumeDownload(quint32 downloadId)
+{
+ downloadManagerDelegate()->resumeDownload(downloadId);
+}
+
QSharedPointer<BrowserContextAdapter> BrowserContextAdapter::defaultContext()
{
return WebEngineContext::current()->defaultBrowserContext();
diff --git a/src/core/browser_context_adapter.h b/src/core/browser_context_adapter.h
index f6ebfd51c..5960014b9 100644
--- a/src/core/browser_context_adapter.h
+++ b/src/core/browser_context_adapter.h
@@ -86,6 +86,8 @@ public:
void removeClient(BrowserContextAdapterClient *adapterClient);
void cancelDownload(quint32 downloadId);
+ void pauseDownload(quint32 downloadId);
+ void resumeDownload(quint32 downloadId);
BrowserContextQt *browserContext();
diff --git a/src/core/browser_context_adapter_client.h b/src/core/browser_context_adapter_client.h
index e1fd02f96..02bee8ed6 100644
--- a/src/core/browser_context_adapter_client.h
+++ b/src/core/browser_context_adapter_client.h
@@ -118,6 +118,8 @@ public:
QString path;
int savePageFormat;
bool accepted;
+ bool paused;
+ bool done;
int downloadType;
int downloadInterruptReason;
};
diff --git a/src/core/chromium_gpu_helper.cpp b/src/core/chromium_gpu_helper.cpp
index 1b415b9ec..cea3aacaf 100644
--- a/src/core/chromium_gpu_helper.cpp
+++ b/src/core/chromium_gpu_helper.cpp
@@ -65,13 +65,13 @@ base::MessageLoop *gpu_message_loop()
gpu::SyncPointManager *sync_point_manager()
{
- gpu::GpuChannelManager *gpuChannelManager = content::GpuChildThread::instance()->ChannelManager();
+ gpu::GpuChannelManager *gpuChannelManager = content::GpuChildThread::instance()->gpu_channel_manager();
return gpuChannelManager->sync_point_manager();
}
gpu::gles2::MailboxManager *mailbox_manager()
{
- gpu::GpuChannelManager *gpuChannelManager = content::GpuChildThread::instance()->ChannelManager();
+ gpu::GpuChannelManager *gpuChannelManager = content::GpuChildThread::instance()->gpu_channel_manager();
return gpuChannelManager->mailbox_manager();
}
diff --git a/src/core/chromium_overrides.cpp b/src/core/chromium_overrides.cpp
index 9afa80757..9aeeb1327 100644
--- a/src/core/chromium_overrides.cpp
+++ b/src/core/chromium_overrides.cpp
@@ -49,6 +49,7 @@
#include "content/common/font_list.h"
#include "ui/base/dragdrop/os_exchange_data.h"
#include "ui/base/dragdrop/os_exchange_data_provider_factory.h"
+#include "ppapi/features/features.h"
#include <QGuiApplication>
#include <QScreen>
@@ -141,7 +142,7 @@ std::unique_ptr<base::ListValue> GetFontList_SlowBlocking()
return std::move(font_list);
}
-#if defined(ENABLE_PLUGINS)
+#if BUILDFLAG(ENABLE_PLUGINS)
// content/browser/renderer_host/pepper/pepper_truetype_font_list.h
void GetFontFamilies_SlowBlocking(std::vector<std::string> *font_families)
{
@@ -155,7 +156,7 @@ void GetFontsInFamily_SlowBlocking(const std::string &, std::vector<ppapi::proxy
{
QT_NOT_USED
}
-#endif //defined(ENABLE_PLUGINS)
+#endif // BUILDFLAG(ENABLE_PLUGINS)
} // namespace content
@@ -170,7 +171,7 @@ ui::OSExchangeDataProviderFactory::CreateProvider() {
#if defined(USE_OPENSSL_CERTS)
namespace net {
-scoped_refptr<SSLPrivateKey> FetchClientCertPrivateKey(X509Certificate* certificate)
+scoped_refptr<SSLPrivateKey> FetchClientCertPrivateKey(const X509Certificate* certificate)
{
return OpenSSLClientKeyStore::GetInstance()->FetchClientCertPrivateKey(certificate);
}
diff --git a/src/core/clipboard_qt.h b/src/core/clipboard_qt.h
index c2ced4941..20b51a599 100644
--- a/src/core/clipboard_qt.h
+++ b/src/core/clipboard_qt.h
@@ -82,6 +82,8 @@ public:
void ReadBookmark(base::string16* title, std::string* url) const override;
void ReadData(const FormatType& format, std::string* result) const override;
+ virtual void OnPreShutdown() Q_DECL_OVERRIDE { }
+
protected:
void WriteObjects(ui::ClipboardType type, const ObjectMap& objects) override;
void WriteText(const char* text_data, size_t text_len) override;
diff --git a/src/core/config/desktop_linux.pri b/src/core/config/desktop_linux.pri
index 9918e1bb2..4d3f923e1 100644
--- a/src/core/config/desktop_linux.pri
+++ b/src/core/config/desktop_linux.pri
@@ -3,7 +3,6 @@ include(linux.pri)
gn_args += \
use_sysroot=false \
enable_session_service=false \
- enable_notifications=false \
toolkit_views=false
use?(icecc) {
diff --git a/src/core/config/embedded_linux.pri b/src/core/config/embedded_linux.pri
index d5f6d4bf5..e48f1fc12 100644
--- a/src/core/config/embedded_linux.pri
+++ b/src/core/config/embedded_linux.pri
@@ -6,7 +6,6 @@ gn_args += \
use_ozone=true \
use_sysroot=false \
enable_session_service=false \
- enable_notifications=false \
ozone_auto_platforms=false \
ozone_platform_headless=true \
ozone_platform_external=true \
diff --git a/src/core/config/windows.pri b/src/core/config/windows.pri
index db1fbd3d7..f5dd4a9d3 100644
--- a/src/core/config/windows.pri
+++ b/src/core/config/windows.pri
@@ -4,19 +4,15 @@ gn_args += \
is_clang=false \
use_sysroot=false \
use_kerberos=true \
- enable_notifications=false \
enable_session_service=false \
ninja_use_custom_environment_files=false \
is_multi_dll_chrome=false \
+ use_incremental_linking=false \
win_linker_timing=true
isDeveloperBuild() {
gn_args += \
- is_win_fastlink=true \
- use_incremental_linking=true
-} else {
- gn_args += \
- use_incremental_linking=false
+ is_win_fastlink=true
}
defineTest(usingMSVC32BitCrossCompiler) {
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp
index d446d8ff4..5bce81f25 100644
--- a/src/core/content_browser_client_qt.cpp
+++ b/src/core/content_browser_client_qt.cpp
@@ -59,6 +59,7 @@
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/resource_dispatcher_host.h"
+#include "content/public/browser/storage_partition.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_user_data.h"
#include "content/public/common/content_switches.h"
@@ -107,7 +108,7 @@
#include "ui/base/resource/resource_bundle.h"
#endif
-#if defined(ENABLE_PLUGINS)
+#if BUILDFLAG(ENABLE_PLUGINS)
#include "content/public/browser/browser_ppapi_host.h"
#include "ppapi/host/ppapi_host.h"
#include "renderer_host/pepper/pepper_host_factory_qt.h"
@@ -459,6 +460,17 @@ content::QuotaPermissionContext *ContentBrowserClientQt::CreateQuotaPermissionCo
return new QuotaPermissionContextQt;
}
+void ContentBrowserClientQt::GetQuotaSettings(content::BrowserContext *context,
+ content::StoragePartition *partition,
+ const storage::OptionalQuotaSettingsCallback &callback)
+{
+ content::BrowserThread::PostTaskAndReplyWithResult(
+ content::BrowserThread::FILE, FROM_HERE,
+ base::Bind(&storage::CalculateNominalDynamicSettings,
+ partition->GetPath(), context->IsOffTheRecord()),
+ callback);
+}
+
void ContentBrowserClientQt::AllowCertificateError(content::WebContents *webContents,
int cert_error,
const net::SSLInfo& ssl_info,
@@ -522,7 +534,7 @@ void ContentBrowserClientQt::GetAdditionalMappedFilesForChildProcess(const base:
}
#endif
-#if defined(ENABLE_PLUGINS)
+#if BUILDFLAG(ENABLE_PLUGINS)
void ContentBrowserClientQt::DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host)
{
browser_host->GetPpapiHost()->AddHostFactoryFilter(
diff --git a/src/core/content_browser_client_qt.h b/src/core/content_browser_client_qt.h
index b17dd3e39..95c7d2894 100644
--- a/src/core/content_browser_client_qt.h
+++ b/src/core/content_browser_client_qt.h
@@ -42,6 +42,7 @@
#include "base/memory/ref_counted.h"
#include "content/public/browser/content_browser_client.h"
+#include "ppapi/features/features.h"
#include <QtGlobal>
@@ -53,7 +54,7 @@ namespace content {
class BrowserContext;
class BrowserMainParts;
-#if defined(ENABLE_PLUGINS)
+#if BUILDFLAG(ENABLE_PLUGINS)
class BrowserPpapiHost;
#endif
@@ -93,6 +94,9 @@ public:
gl::GLShareGroup* GetInProcessGpuShareGroup() override;
content::MediaObserver* GetMediaObserver() override;
content::QuotaPermissionContext *CreateQuotaPermissionContext() override;
+ void GetQuotaSettings(content::BrowserContext *context,
+ content::StoragePartition *partition,
+ const storage::OptionalQuotaSettingsCallback &callback) override;
void OverrideWebkitPrefs(content::RenderViewHost *, content::WebPreferences *) override;
void AllowCertificateError(content::WebContents* web_contents,
int cert_error,
@@ -119,7 +123,7 @@ public:
void GetAdditionalMappedFilesForChildProcess(const base::CommandLine& command_line, int child_process_id, content::FileDescriptorInfo* mappings) override;
#endif
-#if defined(ENABLE_PLUGINS)
+#if BUILDFLAG(ENABLE_PLUGINS)
void DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host) override;
#endif
diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp
index e58fa93d7..10e198d6a 100644
--- a/src/core/content_client_qt.cpp
+++ b/src/core/content_client_qt.cpp
@@ -50,6 +50,8 @@
#include "ui/base/layout.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
+
+#include "qrc_protocol_handler_qt.h"
#include "type_conversion.h"
#include <QCoreApplication>
@@ -69,7 +71,7 @@ static QString getLocalAppDataDir()
}
#endif
-#if defined(ENABLE_PLUGINS)
+#if BUILDFLAG(ENABLE_PLUGINS)
// The plugin logic is based on chrome/common/chrome_content_client.cc:
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
@@ -284,7 +286,7 @@ void ContentClientQt::AddPepperPlugins(std::vector<content::PepperPluginInfo>* p
}
}
-#endif
+#endif // BUILDFLAG(ENABLE_PLUGINS)
#include <QCoreApplication>
@@ -316,4 +318,9 @@ std::string ContentClientQt::GetProduct() const
return productName.toStdString();
}
+void ContentClientQt::AddAdditionalSchemes(Schemes* schemes)
+{
+ schemes->secure_schemes.push_back(kQrcSchemeQt);
+}
+
} // namespace QtWebEngineCore
diff --git a/src/core/content_client_qt.h b/src/core/content_client_qt.h
index 7104b98b6..341406380 100644
--- a/src/core/content_client_qt.h
+++ b/src/core/content_client_qt.h
@@ -42,6 +42,7 @@
#include "base/strings/string_piece.h"
#include "content/public/common/content_client.h"
+#include "ppapi/features/features.h"
#include "ui/base/layout.h"
namespace QtWebEngineCore {
@@ -50,9 +51,10 @@ class ContentClientQt : public content::ContentClient {
public:
static std::string getUserAgent();
-#if defined(ENABLE_PLUGINS)
+#if BUILDFLAG(ENABLE_PLUGINS)
void AddPepperPlugins(std::vector<content::PepperPluginInfo>* plugins) override;
#endif
+ void AddAdditionalSchemes(Schemes* schemes) override;
base::StringPiece GetDataResource(int, ui::ScaleFactor) const override;
base::RefCountedMemory* GetDataResourceBytes(int resource_id) const override;
diff --git a/src/core/delegated_frame_node.cpp b/src/core/delegated_frame_node.cpp
index e49bc553f..9a4d1ba91 100644
--- a/src/core/delegated_frame_node.cpp
+++ b/src/core/delegated_frame_node.cpp
@@ -57,7 +57,8 @@
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
#include "base/threading/thread_task_runner_handle.h"
-#include "cc/output/delegated_frame_data.h"
+#include "cc/output/compositor_frame.h"
+#include "cc/output/compositor_frame_metadata.h"
#include "cc/quads/debug_border_draw_quad.h"
#include "cc/quads/draw_quad.h"
#include "cc/quads/render_pass_draw_quad.h"
@@ -435,9 +436,9 @@ private:
};
-static inline QSharedPointer<QSGLayer> findRenderPassLayer(const cc::RenderPassId &id, const QVector<QPair<cc::RenderPassId, QSharedPointer<QSGLayer> > > &list)
+static inline QSharedPointer<QSGLayer> findRenderPassLayer(const int &id, const QVector<QPair<int, QSharedPointer<QSGLayer> > > &list)
{
- typedef QPair<cc::RenderPassId, QSharedPointer<QSGLayer> > Pair;
+ typedef QPair<int, QSharedPointer<QSGLayer> > Pair;
Q_FOREACH (const Pair &pair, list)
if (pair.first == id)
return pair.second;
@@ -753,7 +754,7 @@ void DelegatedFrameNode::preprocess()
fetchAndSyncMailboxes(mailboxesToFetch);
// Then render any intermediate RenderPass in order.
- typedef QPair<cc::RenderPassId, QSharedPointer<QSGLayer> > Pair;
+ typedef QPair<int, QSharedPointer<QSGLayer> > Pair;
Q_FOREACH (const Pair &pair, m_sgObjects.renderPassLayers) {
// The layer is non-live, request a one-time update here.
pair.second->scheduleUpdate();
@@ -791,8 +792,8 @@ static bool areSharedQuadStatesEqual(const cc::SharedQuadState *layerState,
// Compares if the frame data that we got from the Chromium Compositor is
// *structurally* equivalent to the one of the previous frame.
// If it is, we will just reuse and update the old nodes where necessary.
-static bool areRenderPassStructuresEqual(cc::DelegatedFrameData *frameData,
- cc::DelegatedFrameData *previousFrameData)
+static bool areRenderPassStructuresEqual(cc::CompositorFrame *frameData,
+ cc::CompositorFrame *previousFrameData)
{
if (!previousFrameData)
return false;
@@ -840,8 +841,8 @@ void DelegatedFrameNode::commit(ChromiumCompositorData *chromiumCompositorData,
RenderWidgetHostViewQtDelegate *apiDelegate)
{
m_chromiumCompositorData = chromiumCompositorData;
- cc::DelegatedFrameData* frameData = m_chromiumCompositorData->frameData.get();
- if (!frameData)
+ cc::CompositorFrame* frameData = &m_chromiumCompositorData->frameData;
+ if (frameData->render_pass_list.empty())
return;
// DelegatedFrameNode is a transform node only for the purpose of
@@ -875,14 +876,14 @@ void DelegatedFrameNode::commit(ChromiumCompositorData *chromiumCompositorData,
// equivalent to the render passes in the current frame data. If they are, we are going
// to reuse the old nodes. Otherwise, we will delete the old nodes and build a new tree.
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
- cc::DelegatedFrameData *previousFrameData = m_chromiumCompositorData->previousFrameData.get();
+ cc::CompositorFrame *previousFrameData = &m_chromiumCompositorData->previousFrameData;
const bool buildNewTree = !areRenderPassStructuresEqual(frameData, previousFrameData) || m_sceneGraphNodes.empty();
#else
// No updates possible with old scenegraph nodes
const bool buildNewTree = true;
#endif
- m_chromiumCompositorData->previousFrameData = nullptr;
+ m_chromiumCompositorData->previousFrameData = cc::CompositorFrame();
SGObjects previousSGObjects;
QVector<QSharedPointer<QSGTexture> > textureStrongRefs;
if (buildNewTree) {
@@ -926,7 +927,7 @@ void DelegatedFrameNode::commit(ChromiumCompositorData *chromiumCompositorData,
}
QSharedPointer<QSGRootNode> rootNode(new QSGRootNode);
rpLayer->setItem(rootNode.data());
- m_sgObjects.renderPassLayers.append(QPair<cc::RenderPassId,
+ m_sgObjects.renderPassLayers.append(QPair<int,
QSharedPointer<QSGLayer> >(pass->id, rpLayer));
m_sgObjects.renderPassRootNodes.append(rootNode);
renderPassParent = rootNode.data();
@@ -1128,27 +1129,15 @@ void DelegatedFrameNode::fetchAndSyncMailboxes(QList<MailboxTexture *> &mailboxe
QMutexLocker lock(&m_mutex);
gpu::SyncPointManager *syncPointManager = sync_point_manager();
- if (!m_syncPointClient)
- m_syncPointClient = syncPointManager->CreateSyncPointClientWaiter();
base::MessageLoop *gpuMessageLoop = gpu_message_loop();
Q_ASSERT(m_numPendingSyncPoints == 0);
m_numPendingSyncPoints = mailboxesToFetch.count();
- auto it = mailboxesToFetch.constBegin();
- auto end = mailboxesToFetch.constEnd();
- for (; it != end; ++it) {
- MailboxTexture *mailboxTexture = *it;
+ for (MailboxTexture *mailboxTexture : qAsConst(mailboxesToFetch)) {
gpu::SyncToken &syncToken = mailboxTexture->mailboxHolder().sync_token;
- if (syncToken.HasData()) {
- scoped_refptr<gpu::SyncPointClientState> release_state =
- syncPointManager->GetSyncPointClientState(syncToken.namespace_id(), syncToken.command_buffer_id());
- if (release_state && !release_state->IsFenceSyncReleased(syncToken.release_count())) {
- m_syncPointClient->WaitOutOfOrderNonThreadSafe(
- release_state.get(), syncToken.release_count(),
- gpuMessageLoop->task_runner(), base::Bind(&DelegatedFrameNode::pullTexture, this, mailboxTexture));
- continue;
- }
- }
- gpuMessageLoop->task_runner()->PostTask(FROM_HERE, base::Bind(&DelegatedFrameNode::pullTexture, this, mailboxTexture));
+ const auto task = base::Bind(&DelegatedFrameNode::pullTexture, this, mailboxTexture);
+ if (syncPointManager->WaitOutOfOrderNonThreadSafe(syncToken, gpuMessageLoop->task_runner(), task))
+ continue;
+ gpuMessageLoop->task_runner()->PostTask(FROM_HERE, task);
}
m_mailboxesFetchedWaitCond.wait(&m_mutex);
diff --git a/src/core/delegated_frame_node.h b/src/core/delegated_frame_node.h
index 6178bd232..b2b87a2f8 100644
--- a/src/core/delegated_frame_node.h
+++ b/src/core/delegated_frame_node.h
@@ -40,6 +40,7 @@
#ifndef DELEGATED_FRAME_NODE_H
#define DELEGATED_FRAME_NODE_H
+#include "cc/output/compositor_frame.h"
#include "cc/quads/render_pass.h"
#include "cc/resources/transferable_resource.h"
#include "gpu/command_buffer/service/sync_point_manager.h"
@@ -58,10 +59,6 @@ QT_BEGIN_NAMESPACE
class QSGLayer;
QT_END_NAMESPACE
-namespace cc {
-class DelegatedFrameData;
-}
-
namespace QtWebEngineCore {
class MailboxTexture;
@@ -73,8 +70,8 @@ class ChromiumCompositorData : public QSharedData {
public:
ChromiumCompositorData() : frameDevicePixelRatio(1) { }
QHash<unsigned, QSharedPointer<ResourceHolder> > resourceHolders;
- std::unique_ptr<cc::DelegatedFrameData> frameData;
- std::unique_ptr<cc::DelegatedFrameData> previousFrameData;
+ cc::CompositorFrame frameData;
+ cc::CompositorFrame previousFrameData;
qreal frameDevicePixelRatio;
};
@@ -97,7 +94,7 @@ private:
QExplicitlySharedDataPointer<ChromiumCompositorData> m_chromiumCompositorData;
struct SGObjects {
- QVector<QPair<cc::RenderPassId, QSharedPointer<QSGLayer> > > renderPassLayers;
+ QVector<QPair<int, QSharedPointer<QSGLayer> > > renderPassLayers;
QVector<QSharedPointer<QSGRootNode> > renderPassRootNodes;
QVector<QSharedPointer<QSGTexture> > textureStrongRefs;
} m_sgObjects;
@@ -106,7 +103,6 @@ private:
QWaitCondition m_mailboxesFetchedWaitCond;
QMutex m_mutex;
QList<gl::TransferableFence> m_textureFences;
- std::unique_ptr<gpu::SyncPointClient> m_syncPointClient;
#if defined(USE_X11)
bool m_contextShared;
QScopedPointer<QOffscreenSurface> m_offsurface;
diff --git a/src/core/desktop_screen_qt.cpp b/src/core/desktop_screen_qt.cpp
index 1f4c9730f..ec7b6ce98 100644
--- a/src/core/desktop_screen_qt.cpp
+++ b/src/core/desktop_screen_qt.cpp
@@ -70,10 +70,11 @@ int DesktopScreenQt::GetNumDisplays() const
return 0;
}
-std::vector<display::Display> DesktopScreenQt::GetAllDisplays() const
+std::vector<display::Display>& DesktopScreenQt::GetAllDisplays() const
{
Q_UNREACHABLE();
- return std::vector<display::Display>();
+ static std::vector<display::Display> empty;
+ return empty;
}
display::Display DesktopScreenQt::GetDisplayNearestWindow(gfx::NativeView window) const
diff --git a/src/core/desktop_screen_qt.h b/src/core/desktop_screen_qt.h
index f052461a2..b91cb6aab 100644
--- a/src/core/desktop_screen_qt.h
+++ b/src/core/desktop_screen_qt.h
@@ -51,7 +51,7 @@ public:
bool IsWindowUnderCursor(gfx::NativeWindow) override;
gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override;
int GetNumDisplays() const override;
- std::vector<display::Display> GetAllDisplays() const override;
+ std::vector<display::Display>& GetAllDisplays() const override;
display::Display GetDisplayNearestWindow(gfx::NativeView window) const override;
display::Display GetDisplayNearestPoint(const gfx::Point& point) const override;
display::Display GetDisplayMatching(const gfx::Rect& match_rect) const override;
diff --git a/src/core/download_manager_delegate_qt.cpp b/src/core/download_manager_delegate_qt.cpp
index 77469a8ea..67c809032 100644
--- a/src/core/download_manager_delegate_qt.cpp
+++ b/src/core/download_manager_delegate_qt.cpp
@@ -92,6 +92,22 @@ void DownloadManagerDelegateQt::cancelDownload(quint32 downloadId)
download->Cancel(/* user_cancel */ true);
}
+void DownloadManagerDelegateQt::pauseDownload(quint32 downloadId)
+{
+ content::DownloadManager* dlm = content::BrowserContext::GetDownloadManager(m_contextAdapter->browserContext());
+ content::DownloadItem *download = dlm->GetDownload(downloadId);
+ if (download)
+ download->Pause();
+}
+
+void DownloadManagerDelegateQt::resumeDownload(quint32 downloadId)
+{
+ content::DownloadManager* dlm = content::BrowserContext::GetDownloadManager(m_contextAdapter->browserContext());
+ content::DownloadItem *download = dlm->GetDownload(downloadId);
+ if (download)
+ download->Resume();
+}
+
bool DownloadManagerDelegateQt::DetermineDownloadTarget(content::DownloadItem* item,
const content::DownloadTargetCallback& callback)
{
@@ -155,6 +171,8 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(content::DownloadItem* i
suggestedFilePath,
BrowserContextAdapterClient::UnknownSavePageFormat,
false /* accepted */,
+ false /* paused */,
+ false /* done */,
m_downloadType,
item->GetLastReason()
};
@@ -245,6 +263,8 @@ void DownloadManagerDelegateQt::ChooseSavePath(content::WebContents *web_content
suggestedFilePath,
suggestedSaveFormat,
acceptedByDefault,
+ false, /* paused */
+ false, /* done */
BrowserContextAdapterClient::SavePage,
BrowserContextAdapterClient::NoReason
};
@@ -283,6 +303,8 @@ void DownloadManagerDelegateQt::OnDownloadUpdated(content::DownloadItem *downloa
QString(),
BrowserContextAdapterClient::UnknownSavePageFormat,
true /* accepted */,
+ download->IsPaused(),
+ download->IsDone(),
m_downloadType,
download->GetLastReason()
};
diff --git a/src/core/download_manager_delegate_qt.h b/src/core/download_manager_delegate_qt.h
index cd21d330c..aec83cb41 100644
--- a/src/core/download_manager_delegate_qt.h
+++ b/src/core/download_manager_delegate_qt.h
@@ -83,6 +83,8 @@ public:
const content::SavePackagePathPickedCallback &callback) override;
void cancelDownload(quint32 downloadId);
+ void pauseDownload(quint32 downloadId);
+ void resumeDownload(quint32 downloadId);
void setDownloadType(int downloadType) { m_downloadType = downloadType; }
diff --git a/src/core/gl_context_qt.cpp b/src/core/gl_context_qt.cpp
index 8f812a9cb..cd82b1069 100644
--- a/src/core/gl_context_qt.cpp
+++ b/src/core/gl_context_qt.cpp
@@ -93,21 +93,20 @@ void GLContextHelper::destroy()
contextHelper = 0;
}
-bool GLContextHelper::initializeContextOnBrowserThread(gl::GLContext* context, gl::GLSurface* surface)
+bool GLContextHelper::initializeContextOnBrowserThread(gl::GLContext* context, gl::GLSurface* surface, gl::GLContextAttribs attribs)
{
- gl::GLContextAttribs attribs;
- attribs.gpu_preference = gl::PreferDiscreteGpu;
return context->Initialize(surface, attribs);
}
-bool GLContextHelper::initializeContext(gl::GLContext* context, gl::GLSurface* surface)
+bool GLContextHelper::initializeContext(gl::GLContext* context, gl::GLSurface* surface, gl::GLContextAttribs attribs)
{
bool ret = false;
Qt::ConnectionType connType = (QThread::currentThread() == qApp->thread()) ? Qt::DirectConnection : Qt::BlockingQueuedConnection;
QMetaObject::invokeMethod(contextHelper, "initializeContextOnBrowserThread", connType,
Q_RETURN_ARG(bool, ret),
Q_ARG(gl::GLContext*, context),
- Q_ARG(gl::GLSurface*, surface));
+ Q_ARG(gl::GLSurface*, surface),
+ Q_ARG(gl::GLContextAttribs, attribs));
return ret;
}
@@ -171,7 +170,7 @@ scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group,
scoped_refptr<GLContext> context = new GLContextEGL(share_group);
#endif
- if (!GLContextHelper::initializeContext(context.get(), compatible_surface))
+ if (!GLContextHelper::initializeContext(context.get(), compatible_surface, attribs))
return NULL;
return context;
diff --git a/src/core/gl_context_qt.h b/src/core/gl_context_qt.h
index 47cd7dc7f..9c8a43a0a 100644
--- a/src/core/gl_context_qt.h
+++ b/src/core/gl_context_qt.h
@@ -41,6 +41,7 @@
#define GL_GL_CONTEXT_QT_H_
#include <QObject>
+#include "ui/gl/gl_context.h"
namespace gl {
class GLContext;
@@ -54,7 +55,7 @@ class GLContextHelper : public QObject {
public:
static void initialize();
static void destroy();
- static bool initializeContext(gl::GLContext* context, gl::GLSurface* surface);
+ static bool initializeContext(gl::GLContext* context, gl::GLSurface* surface, gl::GLContextAttribs attribs);
static void* getEGLConfig();
static void* getXConfig();
@@ -63,7 +64,7 @@ public:
static void* getNativeDisplay();
private:
- Q_INVOKABLE bool initializeContextOnBrowserThread(gl::GLContext* context, gl::GLSurface* surface);
+ Q_INVOKABLE bool initializeContextOnBrowserThread(gl::GLContext* context, gl::GLSurface* surface, gl::GLContextAttribs attribs);
static GLContextHelper* contextHelper;
};
diff --git a/src/core/gl_surface_qt.cpp b/src/core/gl_surface_qt.cpp
index 766c14738..e0672f14f 100644
--- a/src/core/gl_surface_qt.cpp
+++ b/src/core/gl_surface_qt.cpp
@@ -102,7 +102,7 @@ public:
static bool InitializeOneOff();
- bool Initialize() override;
+ bool Initialize(GLSurfaceFormat format) override;
void Destroy() override;
void* GetHandle() override;
bool Resize(const gfx::Size& size, float scale_factor, bool has_alpha) override;
@@ -124,7 +124,7 @@ public:
explicit GLSurfacelessQtEGL(const gfx::Size& size);
public:
- bool Initialize() override;
+ bool Initialize(GLSurfaceFormat format) override;
void Destroy() override;
bool IsSurfaceless() const override;
bool Resize(const gfx::Size& size, float scale_factor, bool has_alpha) override;
@@ -152,7 +152,7 @@ public:
static bool InitializeOneOff();
- bool Initialize() override;
+ bool Initialize(GLSurfaceFormat format) override;
void Destroy() override;
void* GetHandle() override;
@@ -246,7 +246,7 @@ bool GLSurfaceQtGLX::InitializeOneOff()
return true;
}
-bool GLSurfaceQtGLX::Initialize()
+bool GLSurfaceQtGLX::Initialize(GLSurfaceFormat format)
{
Q_ASSERT(!m_surfaceBuffer);
@@ -260,6 +260,7 @@ bool GLSurfaceQtGLX::Initialize()
};
m_surfaceBuffer = glXCreatePbuffer(display, static_cast<GLXFBConfig>(g_config), pbuffer_attributes);
+ m_format = format;
if (!m_surfaceBuffer) {
Destroy();
@@ -296,7 +297,7 @@ public:
static bool InitializeOneOff();
- bool Initialize() override;
+ bool Initialize(GLSurfaceFormat format) override;
void Destroy() override;
void *GetHandle() override;
void *GetDisplay() override;
@@ -326,11 +327,12 @@ bool GLSurfaceQtWGL::InitializeOneOff()
return GLSurfaceWGL::InitializeOneOff();
}
-bool GLSurfaceQtWGL::Initialize()
+bool GLSurfaceQtWGL::Initialize(GLSurfaceFormat format)
{
m_surfaceBuffer = new PbufferGLSurfaceWGL(m_size);
+ m_format = format;
- return m_surfaceBuffer->Initialize(gl::GLSurface::SURFACE_DEFAULT);
+ return m_surfaceBuffer->Initialize(format);
}
void GLSurfaceQtWGL::Destroy()
@@ -425,6 +427,10 @@ bool GLSurfaceEGL::IsCreateContextWebGLCompatabilitySupported()
return false;
}
+void GLSurfaceEGL::ShutdownOneOff()
+{
+}
+
const char* GLSurfaceEGL::GetEGLExtensions()
{
return g_extensions;
@@ -435,6 +441,11 @@ bool GLSurfaceEGL::HasEGLExtension(const char* name)
return ExtensionsContain(GetEGLExtensions(), name);
}
+bool GLSurfaceEGL::InitializeOneOff(EGLNativeDisplayType /*native_display*/)
+{
+ return GLSurfaceQtEGL::InitializeOneOff();
+}
+
GLSurfaceQt::GLSurfaceQt(const gfx::Size& size)
: m_size(size)
{
@@ -455,9 +466,10 @@ GLSurfaceQtEGL::GLSurfaceQtEGL(const gfx::Size& size)
{
}
-bool GLSurfaceQtEGL::Initialize()
+bool GLSurfaceQtEGL::Initialize(GLSurfaceFormat format)
{
Q_ASSERT(!m_surfaceBuffer);
+ m_format = format;
EGLDisplay display = g_display;
if (!display) {
@@ -512,6 +524,12 @@ gfx::Size GLSurfaceQt::GetSize()
}
+GLSurfaceFormat GLSurfaceQt::GetFormat()
+{
+ return m_format;
+}
+
+
bool GLSurfaceQtEGL::Resize(const gfx::Size& size, float scale_factor, bool has_alpha)
{
if (size == m_size)
@@ -526,7 +544,7 @@ bool GLSurfaceQtEGL::Resize(const gfx::Size& size, float scale_factor, bool has_
m_size = size;
- if (!Initialize()) {
+ if (!Initialize(GetFormat())) {
LOG(ERROR) << "Failed to resize pbuffer.";
return false;
}
@@ -557,8 +575,9 @@ GLSurfacelessQtEGL::GLSurfacelessQtEGL(const gfx::Size& size)
{
}
-bool GLSurfacelessQtEGL::Initialize()
+bool GLSurfacelessQtEGL::Initialize(GLSurfaceFormat format)
{
+ m_format = format;
return true;
}
@@ -619,7 +638,7 @@ bool InitializeGLOneOffPlatform()
}
scoped_refptr<GLSurface>
-CreateOffscreenGLSurface(const gfx::Size& size)
+CreateOffscreenGLSurfaceWithFormat(const gfx::Size& size, GLSurfaceFormat format)
{
scoped_refptr<GLSurface> surface;
switch (GetGLImplementation()) {
@@ -627,13 +646,13 @@ CreateOffscreenGLSurface(const gfx::Size& size)
case kGLImplementationDesktopGL: {
#if defined(OS_WIN)
surface = new GLSurfaceQtWGL(size);
- if (surface->Initialize())
+ if (surface->Initialize(format))
return surface;
break;
#elif defined(USE_X11)
if (!g_initializedEGL) {
surface = new GLSurfaceQtGLX(size);
- if (surface->Initialize())
+ if (surface->Initialize(format))
return surface;
}
// no break
@@ -641,7 +660,7 @@ CreateOffscreenGLSurface(const gfx::Size& size)
}
case kGLImplementationEGLGLES2: {
surface = new GLSurfaceQtEGL(size);
- if (surface->Initialize())
+ if (surface->Initialize(format))
return surface;
// Surfaceless context will be used ONLY if pseudo surfaceless context
@@ -649,7 +668,7 @@ CreateOffscreenGLSurface(const gfx::Size& size)
// have problems. (e.g. QTBUG-57290)
if (g_egl_surfaceless_context_supported) {
surface = new GLSurfacelessQtEGL(size);
- if (surface->Initialize())
+ if (surface->Initialize(format))
return surface;
}
LOG(WARNING) << "Failed to create offscreen GL surface";
@@ -689,7 +708,7 @@ namespace gpu {
class GpuCommandBufferStub;
class GpuChannelManager;
scoped_refptr<gl::GLSurface> ImageTransportSurface::CreateNativeSurface(base::WeakPtr<ImageTransportSurfaceDelegate>,
- SurfaceHandle, gl::GLSurface::Format)
+ SurfaceHandle, gl::GLSurfaceFormat)
{
QT_NOT_USED
return scoped_refptr<gl::GLSurface>();
diff --git a/src/core/gl_surface_qt.h b/src/core/gl_surface_qt.h
index 08b501846..c26cb7ed0 100644
--- a/src/core/gl_surface_qt.h
+++ b/src/core/gl_surface_qt.h
@@ -59,12 +59,14 @@ public:
bool IsOffscreen() override;
gfx::SwapResult SwapBuffers() override;
gfx::Size GetSize() override;
+ GLSurfaceFormat GetFormat() override;
protected:
GLSurfaceQt();
virtual ~GLSurfaceQt();
gfx::Size m_size;
+ GLSurfaceFormat m_format;
private:
DISALLOW_COPY_AND_ASSIGN(GLSurfaceQt);
diff --git a/src/core/javascript_dialog_manager_qt.cpp b/src/core/javascript_dialog_manager_qt.cpp
index 5fac12dd3..a1a8604a4 100644
--- a/src/core/javascript_dialog_manager_qt.cpp
+++ b/src/core/javascript_dialog_manager_qt.cpp
@@ -48,14 +48,17 @@
namespace QtWebEngineCore {
-Q_STATIC_ASSERT_X(static_cast<int>(content::JAVASCRIPT_MESSAGE_TYPE_PROMPT) == static_cast<int>(WebContentsAdapterClient::PromptDialog), "These enums should be in sync.");
+ASSERT_ENUMS_MATCH(content::JAVASCRIPT_DIALOG_TYPE_ALERT, WebContentsAdapterClient::AlertDialog)
+ASSERT_ENUMS_MATCH(content::JAVASCRIPT_DIALOG_TYPE_CONFIRM, WebContentsAdapterClient::ConfirmDialog)
+ASSERT_ENUMS_MATCH(content::JAVASCRIPT_DIALOG_TYPE_PROMPT, WebContentsAdapterClient::PromptDialog)
+
JavaScriptDialogManagerQt *JavaScriptDialogManagerQt::GetInstance()
{
return base::Singleton<JavaScriptDialogManagerQt>::get();
}
-void JavaScriptDialogManagerQt::RunJavaScriptDialog(content::WebContents *webContents, const GURL &originUrl, content::JavaScriptMessageType javascriptMessageType, const base::string16 &messageText, const base::string16 &defaultPromptText, const content::JavaScriptDialogManager::DialogClosedCallback &callback, bool *didSuppressMessage)
+void JavaScriptDialogManagerQt::RunJavaScriptDialog(content::WebContents *webContents, const GURL &originUrl, content::JavaScriptDialogType dialog_type, const base::string16 &messageText, const base::string16 &defaultPromptText, const content::JavaScriptDialogManager::DialogClosedCallback &callback, bool *didSuppressMessage)
{
WebContentsAdapterClient *client = WebContentsViewQt::from(static_cast<content::WebContentsImpl*>(webContents)->GetView())->client();
if (!client) {
@@ -64,7 +67,7 @@ void JavaScriptDialogManagerQt::RunJavaScriptDialog(content::WebContents *webCon
return;
}
- WebContentsAdapterClient::JavascriptDialogType dialogType = static_cast<WebContentsAdapterClient::JavascriptDialogType>(javascriptMessageType);
+ WebContentsAdapterClient::JavascriptDialogType dialogType = static_cast<WebContentsAdapterClient::JavascriptDialogType>(dialog_type);
runDialogForContents(webContents, dialogType, toQt(messageText).toHtmlEscaped(), toQt(defaultPromptText).toHtmlEscaped(), toQt(originUrl.GetOrigin()), callback);
}
diff --git a/src/core/javascript_dialog_manager_qt.h b/src/core/javascript_dialog_manager_qt.h
index ad2a54cac..291f027a9 100644
--- a/src/core/javascript_dialog_manager_qt.h
+++ b/src/core/javascript_dialog_manager_qt.h
@@ -40,7 +40,6 @@
#define JAVASCRIPT_DIALOG_MANAGER_QT_H
#include "content/public/browser/javascript_dialog_manager.h"
-#include "content/public/common/javascript_message_type.h"
#include "web_contents_adapter_client.h"
@@ -60,13 +59,15 @@ public:
// For use with the Singleton helper class from chromium
static JavaScriptDialogManagerQt *GetInstance();
- void RunJavaScriptDialog(content::WebContents *, const GURL &, content::JavaScriptMessageType javascriptMessageType,
+ void RunJavaScriptDialog(content::WebContents *, const GURL &, content::JavaScriptDialogType dialog_type,
const base::string16 &messageText, const base::string16 &defaultPromptText,
- const content::JavaScriptDialogManager::DialogClosedCallback &callback, bool *didSuppressMessage) override;
+ const content::JavaScriptDialogManager::DialogClosedCallback &callback,
+ bool *didSuppressMessage) override;
- void RunBeforeUnloadDialog(content::WebContents *, bool isReload, const content::JavaScriptDialogManager::DialogClosedCallback &callback) override;
+ void RunBeforeUnloadDialog(content::WebContents *, bool isReload,
+ const content::JavaScriptDialogManager::DialogClosedCallback &callback) override;
bool HandleJavaScriptDialog(content::WebContents *, bool accept, const base::string16 *promptOverride) override;
- void CancelDialogs(content::WebContents *contents, bool /*suppress_callbacks*/, bool /*reset_state*/) override
+ void CancelDialogs(content::WebContents *contents, bool /*reset_state*/) override
{
takeDialogForContents(contents);
}
diff --git a/src/core/media_capture_devices_dispatcher.cpp b/src/core/media_capture_devices_dispatcher.cpp
index 65c818903..8bdbaadd2 100644
--- a/src/core/media_capture_devices_dispatcher.cpp
+++ b/src/core/media_capture_devices_dispatcher.cpp
@@ -62,9 +62,13 @@
#include "content/public/common/media_stream_request.h"
#include "media/audio/audio_device_description.h"
#include "media/audio/audio_manager_base.h"
+#include "media/media_features.h"
+#include "ui/base/l10n/l10n_util.h"
+
+#if BUILDFLAG(ENABLE_WEBRTC)
#include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h"
-#include "ui/base/l10n/l10n_util.h"
+#endif
#include <QtCore/qcoreapplication.h>
@@ -332,6 +336,7 @@ void MediaCaptureDevicesDispatcher::handleScreenCaptureAccessRequest(content::We
{
content::MediaStreamDevices devices;
std::unique_ptr<content::MediaStreamUI> ui;
+#if BUILDFLAG(ENABLE_WEBRTC)
if (userAccepted) {
// Source id patterns are different across platforms.
// On Linux, the hardcoded value "0" is used.
@@ -339,7 +344,6 @@ void MediaCaptureDevicesDispatcher::handleScreenCaptureAccessRequest(content::We
// On macOS the source ids are randomish numbers assigned by the OS.
webrtc::DesktopCapturer::SourceId id = 0;
-#if defined(ENABLE_WEBRTC)
// In order to provide a correct screen id, we query for the available screen ids, and
// select the first one as the main display id.
// The code is based on the file
@@ -358,12 +362,12 @@ void MediaCaptureDevicesDispatcher::handleScreenCaptureAccessRequest(content::We
}
}
}
-#endif
content::DesktopMediaID screenId = content::DesktopMediaID(
content::DesktopMediaID::TYPE_SCREEN, id);
ui = getDevicesForDesktopCapture(&devices, screenId, false/*capture_audio*/, false/*display_notification*/, getContentsUrl(webContents));
}
+#endif
std::map<content::WebContents*, RequestsQueue>::iterator it =
m_pendingRequests.find(webContents);
if (it == m_pendingRequests.end()) {
diff --git a/src/core/native_web_keyboard_event_qt.cpp b/src/core/native_web_keyboard_event_qt.cpp
index 2bb190ceb..c2e48826e 100644
--- a/src/core/native_web_keyboard_event_qt.cpp
+++ b/src/core/native_web_keyboard_event_qt.cpp
@@ -66,9 +66,9 @@ using blink::WebKeyboardEvent;
namespace content {
-NativeWebKeyboardEvent::NativeWebKeyboardEvent()
- : os_event(0),
- skip_in_browser(false)
+NativeWebKeyboardEvent::NativeWebKeyboardEvent(blink::WebInputEvent::Type, int, base::TimeTicks)
+ : os_event(0)
+ , skip_in_browser(false)
{
}
diff --git a/src/core/network_delegate_qt.cpp b/src/core/network_delegate_qt.cpp
index 9b4c415c9..5878095e6 100644
--- a/src/core/network_delegate_qt.cpp
+++ b/src/core/network_delegate_qt.cpp
@@ -311,11 +311,6 @@ bool NetworkDelegateQt::OnAreExperimentalCookieFeaturesEnabled() const
return false;
}
-bool NetworkDelegateQt::OnAreStrictSecureCookiesEnabled() const
-{
- return false;
-}
-
bool NetworkDelegateQt::OnCancelURLRequestWithPolicyViolatingReferrerHeader(const net::URLRequest&, const GURL&, const GURL&) const
{
return false;
diff --git a/src/core/network_delegate_qt.h b/src/core/network_delegate_qt.h
index 4ded56a9d..da5b36d19 100644
--- a/src/core/network_delegate_qt.h
+++ b/src/core/network_delegate_qt.h
@@ -92,7 +92,6 @@ public:
virtual bool OnCanAccessFile(const net::URLRequest& request, const base::FilePath& path) const override;
virtual bool OnCanEnablePrivacyMode(const GURL&, const GURL&) const override;
virtual bool OnAreExperimentalCookieFeaturesEnabled() const override;
- virtual bool OnAreStrictSecureCookiesEnabled() const override;
virtual bool OnCancelURLRequestWithPolicyViolatingReferrerHeader(const net::URLRequest&, const GURL&, const GURL&) const override;
};
diff --git a/src/core/ozone_platform_qt.cpp b/src/core/ozone_platform_qt.cpp
index 9cdafa279..20c1f43c8 100644
--- a/src/core/ozone_platform_qt.cpp
+++ b/src/core/ozone_platform_qt.cpp
@@ -143,7 +143,7 @@ public:
ui::CursorFactoryOzone* GetCursorFactoryOzone() override;
GpuPlatformSupportHost* GetGpuPlatformSupportHost() override;
std::unique_ptr<PlatformWindow> CreatePlatformWindow(PlatformWindowDelegate* delegate, const gfx::Rect& bounds) override;
- std::unique_ptr<ui::NativeDisplayDelegate> CreateNativeDisplayDelegate() override;
+ std::unique_ptr<display::NativeDisplayDelegate> CreateNativeDisplayDelegate() override;
ui::InputController* GetInputController() override;
std::unique_ptr<ui::SystemInputInjector> CreateSystemInputInjector() override;
ui::OverlayManagerOzone* GetOverlayManager() override;
@@ -202,7 +202,7 @@ ui::OverlayManagerOzone* OzonePlatformQt::GetOverlayManager()
return overlay_manager_.get();
}
-std::unique_ptr<ui::NativeDisplayDelegate> OzonePlatformQt::CreateNativeDisplayDelegate()
+std::unique_ptr<display::NativeDisplayDelegate> OzonePlatformQt::CreateNativeDisplayDelegate()
{
NOTREACHED();
return nullptr;
diff --git a/src/core/pdfium_document_wrapper_qt.cpp b/src/core/pdfium_document_wrapper_qt.cpp
index 7c43c77db..df829a426 100644
--- a/src/core/pdfium_document_wrapper_qt.cpp
+++ b/src/core/pdfium_document_wrapper_qt.cpp
@@ -36,7 +36,12 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#if defined (ENABLE_PDF)
+#include "pdf/features.h"
+#if BUILDFLAG(ENABLE_PDF)
+#define ENABLE_PDF
+#endif
+
+#if defined(ENABLE_PDF)
#include "pdfium_document_wrapper_qt.h"
#include <QtCore/qhash.h>
diff --git a/src/core/permission_manager_qt.cpp b/src/core/permission_manager_qt.cpp
index 970a608a3..4c941406c 100644
--- a/src/core/permission_manager_qt.cpp
+++ b/src/core/permission_manager_qt.cpp
@@ -202,14 +202,6 @@ void PermissionManagerQt::ResetPermission(
m_permissions.remove(key);
}
-void PermissionManagerQt::RegisterPermissionUsage(
- content::PermissionType /*permission*/,
- const GURL& /*requesting_origin*/,
- const GURL& /*embedding_origin*/)
-{
- // We do not currently track which permissions are used.
-}
-
int PermissionManagerQt::SubscribePermissionStatusChange(
content::PermissionType permission,
const GURL& requesting_origin,
diff --git a/src/core/permission_manager_qt.h b/src/core/permission_manager_qt.h
index 1cbb41b5e..e98174762 100644
--- a/src/core/permission_manager_qt.h
+++ b/src/core/permission_manager_qt.h
@@ -87,11 +87,6 @@ public:
const base::Callback<void(
const std::vector<blink::mojom::PermissionStatus>&)>& callback) override;
- void RegisterPermissionUsage(
- content::PermissionType permission,
- const GURL& requesting_origin,
- const GURL& embedding_origin) override;
-
int SubscribePermissionStatusChange(
content::PermissionType permission,
const GURL& requesting_origin,
diff --git a/src/core/print_view_manager_base_qt.cpp b/src/core/print_view_manager_base_qt.cpp
index 81e07707a..50b529efa 100644
--- a/src/core/print_view_manager_base_qt.cpp
+++ b/src/core/print_view_manager_base_qt.cpp
@@ -68,7 +68,9 @@ namespace QtWebEngineCore {
PrintViewManagerBaseQt::PrintViewManagerBaseQt(content::WebContents *contents)
: printing::PrintManager(contents)
, m_isInsideInnerMessageLoop(false)
+#if !defined(OS_MACOSX)
, m_isExpectingFirstPage(false)
+#endif
, m_didPrintingSucceed(false)
, m_printerQueriesQueue(WebEngineContext::current()->getPrintJobManager()->queue())
{
diff --git a/src/core/print_view_manager_base_qt.h b/src/core/print_view_manager_base_qt.h
index 65bdbe3f1..9b302f960 100644
--- a/src/core/print_view_manager_base_qt.h
+++ b/src/core/print_view_manager_base_qt.h
@@ -146,7 +146,9 @@ private:
base::Closure m_quitClosure;
bool m_isInsideInnerMessageLoop;
+#if !defined(OS_MACOSX)
bool m_isExpectingFirstPage;
+#endif
bool m_didPrintingSucceed;
scoped_refptr<printing::PrintQueriesQueue> m_printerQueriesQueue;
// content::WebContentsObserver implementation.
diff --git a/src/core/print_view_manager_qt.cpp b/src/core/print_view_manager_qt.cpp
index 8a43cc419..6493bb7d5 100644
--- a/src/core/print_view_manager_qt.cpp
+++ b/src/core/print_view_manager_qt.cpp
@@ -138,6 +138,7 @@ static base::DictionaryValue *createPrintSettings()
printSettings->SetBoolean(printing::kSettingShouldPrintSelectionOnly, false);
printSettings->SetBoolean(printing::kSettingShouldPrintBackgrounds, true);
printSettings->SetBoolean(printing::kSettingHeaderFooterEnabled, false);
+ printSettings->SetBoolean(printing::kSettingRasterizePdf, false);
printSettings->SetInteger(printing::kSettingScaleFactor, 100);
printSettings->SetString(printing::kSettingDeviceName, "");
printSettings->SetInteger(printing::kPreviewUIID, 12345678);
diff --git a/src/core/qtwebengine.gni b/src/core/qtwebengine.gni
index bb269baa2..c9f766a36 100644
--- a/src/core/qtwebengine.gni
+++ b/src/core/qtwebengine.gni
@@ -1,3 +1,4 @@
+import("//media/media_options.gni")
import("//third_party/widevine/cdm/widevine.gni")
chromium_version = exec_script("//build/util/version.py", [ "-f", rebase_path("//chrome/VERSION"),
@@ -11,6 +12,7 @@ include_dirs = [
deps = [
"//base",
+ "//chrome/common:features",
"//components/error_page/common",
"//components/keyed_service/content",
"//components/visitedlink/browser",
@@ -22,10 +24,11 @@ deps = [
"//content/public/browser",
"//content/public/common",
"//content/public/renderer",
+ "//media:media_features",
"//net:net_browser_services",
+ "//net:net_with_v8",
"//skia",
"//third_party/WebKit/public:blink",
- "//third_party/webrtc/base:base",
"//ui/accessibility",
"//third_party/mesa:mesa_headers",
":qtwebengine_sources",
@@ -36,6 +39,10 @@ if (enable_widevine) {
deps += [ "//components/cdm/renderer"]
}
+if (enable_webrtc) {
+ deps += [ "//third_party/webrtc/base:base" ]
+}
+
if (is_linux && !is_desktop_linux) {
deps += [ "//ui/events/ozone:events_ozone_evdev"]
}
diff --git a/src/core/qtwebengine_resources.gni b/src/core/qtwebengine_resources.gni
index a7ffb40f3..acf5f1590 100644
--- a/src/core/qtwebengine_resources.gni
+++ b/src/core/qtwebengine_resources.gni
@@ -70,7 +70,7 @@ repack("qtwebengine_repack_resources_200") {
repack("qtwebengine_repack_resources_devtools") {
sources = [
- "$root_gen_dir/blink/devtools_resources.pak",
+ "$root_gen_dir/content/browser/devtools/devtools_resources.pak",
]
output = "$root_out_dir/qtwebengine_devtools_resources.pak"
deps = [
diff --git a/src/core/qtwebengine_sources.gni b/src/core/qtwebengine_sources.gni
index 9a559732d..785c252cb 100644
--- a/src/core/qtwebengine_sources.gni
+++ b/src/core/qtwebengine_sources.gni
@@ -1,5 +1,8 @@
import("//build/config/features.gni")
+import("//build/config/ui.gni")
import("//components/spellcheck/spellcheck_build_features.gni")
+import("//pdf/features.gni")
+import("//ppapi/features/features.gni")
import("//printing/features/features.gni")
source_set("qtwebengine_spellcheck_sources") {
@@ -99,10 +102,10 @@ source_set("qtwebengine_sources") {
if (enable_pdf) {
deps += [
"//pdf",
+ "//pdf:features",
"//components/printing/browser",
"//components/printing/renderer",
]
}
-
}
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp
index 131f2a664..4e98a1016 100644
--- a/src/core/render_widget_host_view_qt.cpp
+++ b/src/core/render_widget_host_view_qt.cpp
@@ -104,9 +104,9 @@ enum ImStateFlags {
static inline ui::LatencyInfo CreateLatencyInfo(const blink::WebInputEvent& event) {
ui::LatencyInfo latency_info;
// The latency number should only be added if the timestamp is valid.
- if (event.timeStampSeconds) {
+ if (event.timeStampSeconds()) {
const int64_t time_micros = static_cast<int64_t>(
- event.timeStampSeconds * base::Time::kMicrosecondsPerSecond);
+ event.timeStampSeconds() * base::Time::kMicrosecondsPerSecond);
latency_info.AddLatencyNumberWithTimestamp(
ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT,
0,
@@ -639,39 +639,11 @@ void RenderWidgetHostViewQt::SetTooltipText(const base::string16 &tooltip_text)
m_adapterClient->setToolTip(toQt(tooltip_text));
}
-void RenderWidgetHostViewQt::CopyFromCompositingSurface(const gfx::Rect& src_subrect, const gfx::Size& dst_size, const content::ReadbackRequestCallback& callback, const SkColorType color_type)
-{
- NOTIMPLEMENTED();
- Q_UNUSED(src_subrect);
- Q_UNUSED(dst_size);
- Q_UNUSED(color_type);
- callback.Run(SkBitmap(), content::READBACK_FAILED);
-}
-
-void RenderWidgetHostViewQt::CopyFromCompositingSurfaceToVideoFrame(const gfx::Rect& src_subrect, const scoped_refptr<media::VideoFrame>& target, const base::Callback<void(const gfx::Rect&, bool)>& callback)
-{
- NOTIMPLEMENTED();
- callback.Run(gfx::Rect(), false);
-}
-
-bool RenderWidgetHostViewQt::CanCopyToVideoFrame() const
-{
- return false;
-}
-
bool RenderWidgetHostViewQt::HasAcceleratedSurface(const gfx::Size&)
{
return false;
}
-void RenderWidgetHostViewQt::LockCompositingSurface()
-{
-}
-
-void RenderWidgetHostViewQt::UnlockCompositingSurface()
-{
-}
-
void RenderWidgetHostViewQt::OnSwapCompositorFrame(uint32_t output_surface_id, cc::CompositorFrame frame)
{
bool scrollOffsetChanged = (m_lastScrollOffset != frame.metadata.root_scroll_offset);
@@ -681,12 +653,9 @@ void RenderWidgetHostViewQt::OnSwapCompositorFrame(uint32_t output_surface_id, c
Q_ASSERT(!m_needsDelegatedFrameAck);
m_needsDelegatedFrameAck = true;
m_pendingOutputSurfaceId = output_surface_id;
- Q_ASSERT(frame.delegated_frame_data);
- Q_ASSERT(!m_chromiumCompositorData->frameData || m_chromiumCompositorData->frameData->resource_list.empty());
- if (m_chromiumCompositorData->frameData.get())
- m_chromiumCompositorData->previousFrameData = std::move(m_chromiumCompositorData->frameData);
- m_chromiumCompositorData->frameData = std::move(frame.delegated_frame_data);
+ m_chromiumCompositorData->previousFrameData = std::move(m_chromiumCompositorData->frameData);
m_chromiumCompositorData->frameDevicePixelRatio = frame.metadata.device_scale_factor;
+ m_chromiumCompositorData->frameData = std::move(frame);
// Support experimental.viewport.devicePixelRatio, see GetScreenInfo implementation below.
float dpiScale = this->dpiScale();
@@ -828,7 +797,7 @@ void RenderWidgetHostViewQt::selectionChanged()
if (!selection)
return;
- if (!selection->range.IsValid())
+ if (!selection->range().IsValid())
return;
// Avoid duplicate empty selectionChanged() signals
@@ -842,11 +811,11 @@ void RenderWidgetHostViewQt::selectionChanged()
int newCursorPositionWithinSelection = 0;
if (text_input_manager_->GetSelectionRegion()->anchor.type() == gfx::SelectionBound::RIGHT) {
- newAnchorPositionWithinSelection = selection->range.GetMax() - selection->offset;
- newCursorPositionWithinSelection = selection->range.GetMin() - selection->offset;
+ newAnchorPositionWithinSelection = selection->range().GetMax() - selection->offset();
+ newCursorPositionWithinSelection = selection->range().GetMin() - selection->offset();
} else {
- newAnchorPositionWithinSelection = selection->range.GetMin() - selection->offset;
- newCursorPositionWithinSelection = selection->range.GetMax() - selection->offset;
+ newAnchorPositionWithinSelection = selection->range().GetMin() - selection->offset();
+ newCursorPositionWithinSelection = selection->range().GetMax() - selection->offset();
}
if (m_anchorPositionWithinSelection == newAnchorPositionWithinSelection && m_cursorPositionWithinSelection == newCursorPositionWithinSelection)
@@ -1010,7 +979,8 @@ void RenderWidgetHostViewQt::ProcessAckedTouchEvent(const content::TouchEventWit
void RenderWidgetHostViewQt::sendDelegatedFrameAck()
{
- m_beginFrameSource->DidFinishFrame(this, 0);
+ const cc::BeginFrameAck ack;
+ m_beginFrameSource->DidFinishFrame(this, ack);
cc::ReturnedResourceArray resources;
m_resourcesToRelease.swap(resources);
content::RenderWidgetHostImpl::SendReclaimCompositorResources(
@@ -1068,7 +1038,7 @@ void RenderWidgetHostViewQt::handleMouseEvent(QMouseEvent* event)
return;
blink::WebMouseEvent webEvent = WebEventFactory::toWebMouseEvent(event, dpiScale());
- if ((webEvent.type == blink::WebInputEvent::MouseDown || webEvent.type == blink::WebInputEvent::MouseUp)
+ if ((webEvent.type() == blink::WebInputEvent::MouseDown || webEvent.type() == blink::WebInputEvent::MouseUp)
&& webEvent.button == blink::WebMouseEvent::Button::NoButton) {
// Blink can only handle the 3 main mouse-buttons and may assert when processing mouse-down for no button.
return;
@@ -1139,7 +1109,7 @@ void RenderWidgetHostViewQt::handleKeyEvent(QKeyEvent *ev)
}
content::NativeWebKeyboardEvent webEvent = WebEventFactory::toWebKeyboardEvent(ev);
- bool keyDownTextInsertion = webEvent.type == blink::WebInputEvent::RawKeyDown && webEvent.text[0];
+ bool keyDownTextInsertion = webEvent.type() == blink::WebInputEvent::RawKeyDown && webEvent.text[0];
webEvent.skip_in_browser = keyDownTextInsertion;
m_host->ForwardKeyboardEvent(webEvent);
@@ -1147,7 +1117,7 @@ void RenderWidgetHostViewQt::handleKeyEvent(QKeyEvent *ev)
// Blink won't consume the RawKeyDown, but rather the Char event in this case.
// Make sure to skip the former on the way back. The same os_event will be set on both of them.
webEvent.skip_in_browser = true;
- webEvent.type = blink::WebInputEvent::Char;
+ webEvent.setType(blink::WebInputEvent::Char);
m_host->ForwardKeyboardEvent(webEvent);
}
}
diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h
index 3b679923e..cb1a5980d 100644
--- a/src/core/render_widget_host_view_qt.h
+++ b/src/core/render_widget_host_view_qt.h
@@ -148,10 +148,6 @@ public:
void RenderProcessGone(base::TerminationStatus, int) override;
void Destroy() override;
void SetTooltipText(const base::string16 &tooltip_text) override;
- void CopyFromCompositingSurface(const gfx::Rect& src_subrect, const gfx::Size& dst_size, const content::ReadbackRequestCallback& callback, const SkColorType preferred_color_type) override;
- void CopyFromCompositingSurfaceToVideoFrame(const gfx::Rect& src_subrect, const scoped_refptr<media::VideoFrame>& target, const base::Callback<void(const gfx::Rect&, bool)>& callback) override;
-
- bool CanCopyToVideoFrame() const override;
bool HasAcceleratedSurface(const gfx::Size&) override;
void OnSwapCompositorFrame(uint32_t output_surface_id, cc::CompositorFrame frame) override;
@@ -159,8 +155,6 @@ public:
gfx::Rect GetBoundsInRootWindow() override;
void ProcessAckedTouchEvent(const content::TouchEventWithLatencyInfo &touch, content::InputEventAckState ack_result) override;
void ClearCompositorFrame() override;
- void LockCompositingSurface() override;
- void UnlockCompositingSurface() override;
void SetNeedsBeginFrames(bool needs_begin_frames) override;
// Overridden from ui::GestureProviderClient.
diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp
index a2c2a722e..f09aa48f0 100644
--- a/src/core/renderer/content_renderer_client_qt.cpp
+++ b/src/core/renderer/content_renderer_client_qt.cpp
@@ -63,7 +63,6 @@
#include "third_party/WebKit/public/platform/WebString.h"
#include "third_party/WebKit/public/platform/WebURLError.h"
#include "third_party/WebKit/public/platform/WebURLRequest.h"
-#include "third_party/WebKit/public/web/WebSecurityPolicy.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/webui/jstemplate_builder.h"
#include "content/public/common/web_preferences.h"
@@ -85,7 +84,6 @@
namespace QtWebEngineCore {
static const char kHttpErrorDomain[] = "http";
-static const char kQrcSchemeQt[] = "qrc";
ContentRendererClientQt::ContentRendererClientQt()
{
@@ -108,10 +106,6 @@ void ContentRendererClientQt::RenderThreadStarted()
m_spellCheck.reset(new SpellCheck());
renderThread->AddObserver(m_spellCheck.data());
#endif
-
- blink::WebString qrcScheme(base::ASCIIToUTF16(kQrcSchemeQt));
- // mark qrc as a secure scheme (avoids deprecation warnings)
- blink::WebSecurityPolicy::registerURLSchemeAsSecure(qrcScheme);
}
void ContentRendererClientQt::RenderViewCreated(content::RenderView* render_view)
diff --git a/src/core/renderer/pepper/pepper_flash_renderer_host_qt.cpp b/src/core/renderer/pepper/pepper_flash_renderer_host_qt.cpp
index a46454407..3a34d5f93 100644
--- a/src/core/renderer/pepper/pepper_flash_renderer_host_qt.cpp
+++ b/src/core/renderer/pepper/pepper_flash_renderer_host_qt.cpp
@@ -48,7 +48,8 @@
#include <vector>
#include "base/lazy_instance.h"
-#include "base/metrics/histogram.h"
+#include "base/macros.h"
+#include "base/metrics/histogram_macros.h"
#include "base/strings/string_util.h"
#include "content/public/renderer/pepper_plugin_instance.h"
#include "content/public/renderer/render_thread.h"
diff --git a/src/core/renderer/render_frame_observer_qt.cpp b/src/core/renderer/render_frame_observer_qt.cpp
index 53e9407db..111323b8a 100644
--- a/src/core/renderer/render_frame_observer_qt.cpp
+++ b/src/core/renderer/render_frame_observer_qt.cpp
@@ -64,7 +64,7 @@ RenderFrameObserverQt::~RenderFrameObserverQt()
{
}
-#if defined(ENABLE_PLUGINS)
+#if BUILDFLAG(ENABLE_PLUGINS)
void RenderFrameObserverQt::DidCreatePepperPlugin(content::RendererPpapiHost* host)
{
host->GetPpapiHost()->AddHostFactoryFilter(
diff --git a/src/core/renderer/render_frame_observer_qt.h b/src/core/renderer/render_frame_observer_qt.h
index b74be5cd1..7abd17e96 100644
--- a/src/core/renderer/render_frame_observer_qt.h
+++ b/src/core/renderer/render_frame_observer_qt.h
@@ -43,6 +43,7 @@
#include "base/compiler_specific.h"
#include "content/public/renderer/render_frame_observer.h"
#include "content/public/renderer/render_frame_observer_tracker.h"
+#include "ppapi/features/features.h"
namespace content {
@@ -59,7 +60,7 @@ public:
explicit RenderFrameObserverQt(content::RenderFrame* render_frame);
~RenderFrameObserverQt();
-#if defined(ENABLE_PLUGINS)
+#if BUILDFLAG(ENABLE_PLUGINS)
void DidCreatePepperPlugin(content::RendererPpapiHost* host) override;
#endif
void OnDestruct() override { }
diff --git a/src/core/renderer/render_view_observer_qt.cpp b/src/core/renderer/render_view_observer_qt.cpp
index 97485afad..54aed8b59 100644
--- a/src/core/renderer/render_view_observer_qt.cpp
+++ b/src/core/renderer/render_view_observer_qt.cpp
@@ -65,7 +65,7 @@ void RenderViewObserverQt::onFetchDocumentMarkup(quint64 requestId)
if (render_view()->GetWebView()->mainFrame()->isWebLocalFrame())
markup = blink::WebFrameContentDumper::dumpAsMarkup(
static_cast<blink::WebLocalFrame*>(render_view()->GetWebView()->mainFrame()));
- Send(new RenderViewObserverHostQt_DidFetchDocumentMarkup(routing_id(), requestId, markup));
+ Send(new RenderViewObserverHostQt_DidFetchDocumentMarkup(routing_id(), requestId, markup.utf16()));
}
void RenderViewObserverQt::onFetchDocumentInnerText(quint64 requestId)
@@ -75,7 +75,7 @@ void RenderViewObserverQt::onFetchDocumentInnerText(quint64 requestId)
text = blink::WebFrameContentDumper::dumpWebViewAsText(
render_view()->GetWebView(),
std::numeric_limits<std::size_t>::max());
- Send(new RenderViewObserverHostQt_DidFetchDocumentInnerText(routing_id(), requestId, text));
+ Send(new RenderViewObserverHostQt_DidFetchDocumentInnerText(routing_id(), requestId, text.utf16()));
}
void RenderViewObserverQt::onSetBackgroundColor(quint32 color)
diff --git a/src/core/renderer/web_channel_ipc_transport.cpp b/src/core/renderer/web_channel_ipc_transport.cpp
index 161d6f493..173b403a5 100644
--- a/src/core/renderer/web_channel_ipc_transport.cpp
+++ b/src/core/renderer/web_channel_ipc_transport.cpp
@@ -102,7 +102,7 @@ void WebChannelTransport::Install(blink::WebFrame *frame, uint worldId)
if (worldId == 0)
context = frame->mainWorldScriptContext();
else
- context = frame->toWebLocalFrame()->isolatedWorldScriptContext(worldId, 0);
+ context = frame->toWebLocalFrame()->isolatedWorldScriptContext(worldId);
v8::Context::Scope contextScope(context);
gin::Handle<WebChannelTransport> transport = gin::CreateHandle(isolate, new WebChannelTransport);
@@ -123,7 +123,7 @@ void WebChannelTransport::Uninstall(blink::WebFrame *frame, uint worldId)
if (worldId == 0)
context = frame->mainWorldScriptContext();
else
- context = frame->toWebLocalFrame()->isolatedWorldScriptContext(worldId, 0);
+ context = frame->toWebLocalFrame()->isolatedWorldScriptContext(worldId);
v8::Context::Scope contextScope(context);
v8::Handle<v8::Object> global(context->Global());
@@ -206,7 +206,7 @@ void WebChannelIPCTransport::dispatchWebChannelMessage(const std::vector<char> &
if (worldId == 0)
context = frame->mainWorldScriptContext();
else
- context = frame->toWebLocalFrame()->isolatedWorldScriptContext(worldId, 0);
+ context = frame->toWebLocalFrame()->isolatedWorldScriptContext(worldId);
v8::Context::Scope contextScope(context);
v8::Handle<v8::Object> global(context->Global());
diff --git a/src/core/renderer_host/user_resource_controller_host.cpp b/src/core/renderer_host/user_resource_controller_host.cpp
index 95385ae2f..0a6decaf9 100644
--- a/src/core/renderer_host/user_resource_controller_host.cpp
+++ b/src/core/renderer_host/user_resource_controller_host.cpp
@@ -140,7 +140,7 @@ void UserResourceControllerHost::addUserScript(const UserScript &script, WebCont
m_perContentsScripts.insert(contents, currentScripts);
}
}
- contents->Send(new RenderViewObserverHelper_AddScript(contents->GetRoutingID(), script.data()));
+ contents->Send(new RenderViewObserverHelper_AddScript(contents->GetRenderViewHost()->GetRoutingID(), script.data()));
}
}
@@ -174,7 +174,7 @@ bool UserResourceControllerHost::removeUserScript(const UserScript &script, WebC
QList<UserScript>::iterator it = std::find(list.begin(), list.end(), script);
if (it == list.end())
return false;
- contents->Send(new RenderViewObserverHelper_RemoveScript(contents->GetRoutingID(), (*it).data()));
+ contents->Send(new RenderViewObserverHelper_RemoveScript(contents->GetRenderViewHost()->GetRoutingID(), (*it).data()));
list.erase(it);
}
return true;
@@ -189,7 +189,7 @@ void UserResourceControllerHost::clearAllScripts(WebContentsAdapter *adapter)
} else {
content::WebContents *contents = adapter->webContents();
m_perContentsScripts.remove(contents);
- contents->Send(new RenderViewObserverHelper_ClearScripts(contents->GetRoutingID()));
+ contents->Send(new RenderViewObserverHelper_ClearScripts(contents->GetRenderViewHost()->GetRoutingID()));
}
}
diff --git a/src/core/resource_bundle_qt.cpp b/src/core/resource_bundle_qt.cpp
index cc3c1de06..c37854ea6 100644
--- a/src/core/resource_bundle_qt.cpp
+++ b/src/core/resource_bundle_qt.cpp
@@ -38,7 +38,7 @@
****************************************************************************/
#include "base/command_line.h"
-#include "base/metrics/histogram.h"
+#include "base/metrics/histogram_macros.h"
#include "content/public/common/content_switches.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/data_pack.h"
diff --git a/src/core/surface_factory_qt.cpp b/src/core/surface_factory_qt.cpp
index 36c05ec5d..9e72885c3 100644
--- a/src/core/surface_factory_qt.cpp
+++ b/src/core/surface_factory_qt.cpp
@@ -44,7 +44,12 @@
#include "base/files/file_path.h"
#include "base/native_library.h"
+#include "ui/gl/gl_context_egl.h"
#include "ui/gl/gl_implementation.h"
+#include "ui/gl/gl_surface.h"
+#include "ui/gl/init/gl_initializer.h"
+#include "ui/gl/init/gl_factory.h"
+#include "ui/ozone/common/gl_ozone_egl.h"
#include <QGuiApplication>
@@ -61,6 +66,27 @@
namespace QtWebEngineCore {
+class GLOzoneQt : public ui::GLOzoneEGL {
+public:
+ scoped_refptr<gl::GLSurface> CreateViewGLSurface(gfx::AcceleratedWidget /*window*/) override
+ {
+ return nullptr;
+ }
+ scoped_refptr<gl::GLSurface> CreateOffscreenGLSurface(const gfx::Size& /*size*/) override
+ {
+ return nullptr;
+ }
+
+protected:
+ // Returns native platform display handle. This is used to obtain the EGL
+ // display connection for the native display.
+ intptr_t GetNativeDisplay() override;
+
+ // Sets up GL bindings for the native surface.
+ bool LoadGLES2Bindings() override;
+
+};
+
base::NativeLibrary LoadLibrary(const base::FilePath& filename) {
base::NativeLibraryLoadError error;
base::NativeLibrary library = base::LoadNativeLibrary(filename, &error);
@@ -71,7 +97,7 @@ base::NativeLibrary LoadLibrary(const base::FilePath& filename) {
return library;
}
-bool SurfaceFactoryQt::LoadEGLGLES2Bindings()
+bool GLOzoneQt::LoadGLES2Bindings()
{
base::FilePath libEGLPath = QtWebEngineCore::toFilePath(QT_LIBDIR_EGL);
libEGLPath = libEGLPath.Append("libEGL.so.1");
@@ -99,7 +125,7 @@ bool SurfaceFactoryQt::LoadEGLGLES2Bindings()
return true;
}
-intptr_t SurfaceFactoryQt::GetNativeDisplay()
+intptr_t GLOzoneQt::GetNativeDisplay()
{
static void *display = GLContextHelper::getNativeDisplay();
@@ -109,6 +135,18 @@ intptr_t SurfaceFactoryQt::GetNativeDisplay()
return reinterpret_cast<intptr_t>(EGL_DEFAULT_DISPLAY);
}
+std::vector<gl::GLImplementation> SurfaceFactoryQt::GetAllowedGLImplementations()
+{
+ std::vector<gl::GLImplementation> impls;
+ impls.push_back(gl::kGLImplementationEGLGLES2);
+ return impls;
+}
+
+ui::GLOzone* SurfaceFactoryQt::GetGLOzone(gl::GLImplementation implementation)
+{
+ return new GLOzoneQt();
+}
+
} // namespace QtWebEngineCore
#endif // defined(USE_OZONE)
diff --git a/src/core/surface_factory_qt.h b/src/core/surface_factory_qt.h
index 76b6dc6ed..b7991829c 100644
--- a/src/core/surface_factory_qt.h
+++ b/src/core/surface_factory_qt.h
@@ -46,11 +46,10 @@
namespace QtWebEngineCore {
-class SurfaceFactoryQt
- : public ui::SurfaceFactoryOzone
+class SurfaceFactoryQt : public ui::SurfaceFactoryOzone
{
- bool LoadEGLGLES2Bindings() override;
- intptr_t GetNativeDisplay() override;
+ std::vector<gl::GLImplementation> GetAllowedGLImplementations() override;
+ ui::GLOzone* GetGLOzone(gl::GLImplementation implementation) override;
};
} // namespace QtWebEngineCore
diff --git a/src/core/url_request_context_getter_qt.cpp b/src/core/url_request_context_getter_qt.cpp
index 1f3d6fcbe..fe1758655 100644
--- a/src/core/url_request_context_getter_qt.cpp
+++ b/src/core/url_request_context_getter_qt.cpp
@@ -295,8 +295,7 @@ void URLRequestContextGetterQt::generateCookieStore()
m_storage->set_channel_id_service(
base::WrapUnique(new net::ChannelIDService(
- new net::DefaultChannelIDStore(channel_id_db.get()),
- base::WorkerPool::GetTaskRunner(true))));
+ new net::DefaultChannelIDStore(channel_id_db.get()))));
// Unset it first to get a chance to destroy and flush the old cookie store before opening a new on possibly the same file.
m_storage->set_cookie_store(0);
@@ -572,10 +571,11 @@ void URLRequestContextGetterQt::generateJobFactory()
// Set up interceptors in the reverse order.
std::unique_ptr<net::URLRequestJobFactory> topJobFactory = std::move(jobFactory);
- for (content::URLRequestInterceptorScopedVector::reverse_iterator i = m_requestInterceptors.rbegin(); i != m_requestInterceptors.rend(); ++i)
- topJobFactory.reset(new net::URLRequestInterceptingJobFactory(std::move(topJobFactory), std::unique_ptr<net::URLRequestInterceptor>(*i)));
+ for (content::URLRequestInterceptorScopedVector::reverse_iterator i = m_requestInterceptors.rbegin(); i != m_requestInterceptors.rend(); ++i) {
+ topJobFactory.reset(new net::URLRequestInterceptingJobFactory(std::move(topJobFactory), std::move(*i)));
+ }
- m_requestInterceptors.weak_clear();
+ m_requestInterceptors.clear();
m_jobFactory = std::move(topJobFactory);
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index 93e8674bd..399c036a4 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -50,7 +50,6 @@
#include "browser_context_qt.h"
#include "download_manager_delegate_qt.h"
#include "media_capture_devices_dispatcher.h"
-#include "pdfium_document_wrapper_qt.h"
#include "print_view_manager_qt.h"
#include "qwebenginecallback_p.h"
#include "renderer_host/web_channel_ipc_transport_host.h"
@@ -106,37 +105,37 @@ static QVariant fromJSValue(const base::Value *result)
{
QVariant ret;
switch (result->GetType()) {
- case base::Value::TYPE_NULL:
+ case base::Value::Type::NONE:
break;
- case base::Value::TYPE_BOOLEAN:
+ case base::Value::Type::BOOLEAN:
{
bool out;
if (result->GetAsBoolean(&out))
ret.setValue(out);
break;
}
- case base::Value::TYPE_INTEGER:
+ case base::Value::Type::INTEGER:
{
int out;
if (result->GetAsInteger(&out))
ret.setValue(out);
break;
}
- case base::Value::TYPE_DOUBLE:
+ case base::Value::Type::DOUBLE:
{
double out;
if (result->GetAsDouble(&out))
ret.setValue(out);
break;
}
- case base::Value::TYPE_STRING:
+ case base::Value::Type::STRING:
{
base::string16 out;
if (result->GetAsString(&out))
ret.setValue(toQt(out));
break;
}
- case base::Value::TYPE_LIST:
+ case base::Value::Type::LIST:
{
const base::ListValue *out;
if (result->GetAsList(&out)) {
@@ -151,7 +150,7 @@ static QVariant fromJSValue(const base::Value *result)
}
break;
}
- case base::Value::TYPE_DICTIONARY:
+ case base::Value::Type::DICTIONARY:
{
const base::DictionaryValue *out;
if (result->GetAsDictionary(&out)) {
@@ -165,7 +164,7 @@ static QVariant fromJSValue(const base::Value *result)
}
break;
}
- case base::Value::TYPE_BINARY:
+ case base::Value::Type::BINARY:
{
const base::BinaryValue *out = static_cast<const base::BinaryValue*>(result);
QByteArray data(out->GetBuffer(), out->GetSize());
@@ -484,14 +483,14 @@ void WebContentsAdapter::stop()
void WebContentsAdapter::reload()
{
Q_D(WebContentsAdapter);
- d->webContents->GetController().Reload(/*checkRepost = */false);
+ d->webContents->GetController().Reload(content::ReloadType::NORMAL, /*checkRepost = */false);
focusIfNecessary();
}
void WebContentsAdapter::reloadAndBypassCache()
{
Q_D(WebContentsAdapter);
- d->webContents->GetController().ReloadBypassingCache(/*checkRepost = */false);
+ d->webContents->GetController().Reload(content::ReloadType::BYPASSING_CACHE, /*checkRepost = */false);
focusIfNecessary();
}
@@ -593,7 +592,7 @@ void WebContentsAdapter::setContent(const QByteArray &data, const QString &mimeT
params.override_user_agent = content::NavigationController::UA_OVERRIDE_TRUE;
d->webContents->GetController().LoadURLWithParams(params);
focusIfNecessary();
- d->webContents->Unselect();
+ d->webContents->CollapseSelection();
}
void WebContentsAdapter::save(const QString &filePath, int savePageFormat)
@@ -701,7 +700,7 @@ void WebContentsAdapter::requestClose()
void WebContentsAdapter::unselect()
{
Q_D(const WebContentsAdapter);
- d->webContents->Unselect();
+ d->webContents->CollapseSelection();
}
void WebContentsAdapter::navigateToIndex(int offset)
@@ -901,7 +900,7 @@ void WebContentsAdapter::stopFinding()
d->webContentsDelegate->setLastSearchedString(QString());
// Clear any previous selection,
// but keep the renderer blue rectangle selection just like Chromium does.
- d->webContents->Unselect();
+ d->webContents->CollapseSelection();
d->webContents->StopFinding(content::STOP_FIND_ACTION_KEEP_SELECTION);
}
@@ -1178,7 +1177,7 @@ void WebContentsAdapter::startDragging(QObject *dragSource, const content::DropD
d->currentDropData.reset(new content::DropData(dropData));
d->currentDropData->download_metadata.clear();
d->currentDropData->file_contents.clear();
- d->currentDropData->file_description_filename.clear();
+ d->currentDropData->file_contents_content_disposition.clear();
d->currentDropAction = blink::WebDragOperationNone;
QDrag *drag = new QDrag(dragSource); // will be deleted by Qt's DnD implementation
@@ -1344,7 +1343,7 @@ void WebContentsAdapter::leaveDrag()
{
Q_D(WebContentsAdapter);
content::RenderViewHost *rvh = d->webContents->GetRenderViewHost();
- rvh->GetWidget()->DragTargetDragLeave();
+ rvh->GetWidget()->DragTargetDragLeave(d->lastDragClientPos, d->lastDragScreenPos);
d->currentDropData.reset();
}
diff --git a/src/core/web_contents_adapter_client.h b/src/core/web_contents_adapter_client.h
index e1fb3dc4c..8d75f24b7 100644
--- a/src/core/web_contents_adapter_client.h
+++ b/src/core/web_contents_adapter_client.h
@@ -90,6 +90,7 @@ public:
uint mediaFlags;
QPoint pos;
QUrl linkUrl;
+ QUrl unfilteredLinkUrl;
QUrl mediaUrl;
QString linkText;
QString selectedText;
@@ -156,6 +157,14 @@ public:
return d->linkUrl;
}
+ void setUnfilteredLinkUrl(const QUrl &url) {
+ d->unfilteredLinkUrl = url;
+ }
+
+ QUrl unfilteredLinkUrl() const {
+ return d->unfilteredLinkUrl;
+ }
+
void setLinkText(const QString &text) {
d->linkText = text;
}
@@ -265,7 +274,7 @@ public:
IgnoreActionDisposition = 9,
};
- // Must match the values in javascript_message_type.h.
+ // Must match the values in javascript_dialog_type.h.
enum JavascriptDialogType {
AlertDialog,
ConfirmDialog,
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp
index 86366abaa..a6e1fb438 100644
--- a/src/core/web_contents_delegate_qt.cpp
+++ b/src/core/web_contents_delegate_qt.cpp
@@ -63,6 +63,7 @@
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/public/browser/invalidate_type.h"
#include "content/public/browser/navigation_entry.h"
+#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
@@ -169,10 +170,10 @@ void WebContentsDelegateQt::AddNewContents(content::WebContents* source, content
void WebContentsDelegateQt::CloseContents(content::WebContents *source)
{
m_viewClient->close();
- GetJavaScriptDialogManager(source)->CancelDialogs(source, /* whatever?: */false, false);
+ GetJavaScriptDialogManager(source)->CancelDialogs(source, /* whatever?: */false);
}
-void WebContentsDelegateQt::LoadProgressChanged(content::WebContents* source, double progress)
+void WebContentsDelegateQt::LoadProgressChanged(content::WebContents */*source*/, double progress)
{
if (!m_loadingErrorFrameList.isEmpty())
return;
@@ -191,59 +192,82 @@ void WebContentsDelegateQt::RenderFrameDeleted(content::RenderFrameHost *render_
m_loadingErrorFrameList.removeOne(render_frame_host->GetRoutingID());
}
-void WebContentsDelegateQt::DidStartProvisionalLoadForFrame(content::RenderFrameHost* render_frame_host, const GURL& validated_url, bool is_error_page, bool is_iframe_srcdoc)
+void WebContentsDelegateQt::DidStartNavigation(content::NavigationHandle *navigation_handle)
{
- if (is_error_page) {
- m_loadingErrorFrameList.append(render_frame_host->GetRoutingID());
-
- // Trigger LoadStarted signal for main frame's error page only.
- if (!render_frame_host->GetParent()) {
- m_faviconManager->resetCandidates();
- m_viewClient->loadStarted(toQt(validated_url), true);
- }
-
+ if (!navigation_handle->IsInMainFrame())
return;
- }
- if (render_frame_host->GetParent())
- return;
+ // Error-pages are not reported as separate started navigations.
+ Q_ASSERT(!navigation_handle->IsErrorPage());
m_loadingErrorFrameList.clear();
m_faviconManager->resetCandidates();
- m_viewClient->loadStarted(toQt(validated_url));
+ m_viewClient->loadStarted(toQt(navigation_handle->GetURL()));
}
-void WebContentsDelegateQt::DidCommitProvisionalLoadForFrame(content::RenderFrameHost* render_frame_host, const GURL& url, ui::PageTransition transition_type)
+void WebContentsDelegateQt::DidFinishNavigation(content::NavigationHandle *navigation_handle)
{
- // Make sure that we don't set the findNext WebFindOptions on a new frame.
- m_lastSearchedString = QString();
+ if (!navigation_handle->IsInMainFrame())
+ return;
+
+ if (navigation_handle->HasCommitted() && !navigation_handle->IsErrorPage()) {
+ // VisistedLinksMaster asserts !IsOffTheRecord().
+ if (navigation_handle->ShouldUpdateHistory() && m_viewClient->browserContextAdapter()->trackVisitedLinks())
+ m_viewClient->browserContextAdapter()->visitedLinksManager()->addUrl(navigation_handle->GetURL());
+
+ // Make sure that we don't set the findNext WebFindOptions on a new frame.
+ m_lastSearchedString = QString();
- // This is currently used for canGoBack/Forward values, which is flattened across frames. For other purposes we might have to pass is_main_frame.
- m_viewClient->loadCommitted();
+ // This is currently used for canGoBack/Forward values, which is flattened across frames. For other purposes we might have to pass is_main_frame.
+ m_viewClient->loadCommitted();
+ }
+ // Success is reported by DidFinishLoad, but DidFailLoad is now dead code and needs to be handled below
+ if (navigation_handle->GetNetErrorCode() == net::OK)
+ return;
+
+ // WebContentsObserver::DidFailLoad is not called any longer so we have to report the failure here.
+ const net::Error error_code = navigation_handle->GetNetErrorCode();
+ const std::string error_description = net::ErrorToString(error_code);
+ didFailLoad(toQt(navigation_handle->GetURL()), error_code, toQt(error_description));
+
+ // The load will succede as an error-page load later, and we reported the original error above
+ if (navigation_handle->IsErrorPage()) {
+ // Now report we are starting to load an error-page.
+ m_loadingErrorFrameList.append(navigation_handle->GetRenderFrameHost()->GetRoutingID());
+ m_faviconManager->resetCandidates();
+ m_viewClient->loadStarted(toQt(GURL(content::kUnreachableWebDataURL)), true);
+
+ // If it is already committed we will not see another DidFinishNavigation call or a DidFinishLoad call.
+ if (navigation_handle->HasCommitted()) {
+ m_lastSearchedString = QString();
+ m_viewClient->loadCommitted();
+ }
+ }
}
-void WebContentsDelegateQt::DidFailProvisionalLoad(content::RenderFrameHost* render_frame_host, const GURL& validated_url, int error_code, const base::string16& error_description, bool was_ignored_by_handler)
+void WebContentsDelegateQt::didFailLoad(const QUrl &url, int errorCode, const QString &errorDescription)
{
- DidFailLoad(render_frame_host, validated_url, error_code, error_description, was_ignored_by_handler);
+ m_viewClient->iconChanged(QUrl());
+ m_viewClient->loadFinished(false /* success */ , url, false /* isErrorPage */, errorCode, errorDescription);
+ m_viewClient->loadProgressChanged(0);
}
void WebContentsDelegateQt::DidFailLoad(content::RenderFrameHost* render_frame_host, const GURL& validated_url, int error_code, const base::string16& error_description, bool was_ignored_by_handler)
{
Q_UNUSED(was_ignored_by_handler);
+ if (render_frame_host->GetParent())
+ return;
+
if (validated_url.spec() == content::kUnreachableWebDataURL) {
+ // error-pages should only ever fail due to abort:
+ Q_ASSERT(error_code == -3 /* ERR_ABORTED */);
m_loadingErrorFrameList.removeOne(render_frame_host->GetRoutingID());
- qCritical("Loading error-page failed. This shouldn't happen.");
- if (!render_frame_host->GetParent())
- m_viewClient->loadFinished(false /* success */, toQt(validated_url), true /* isErrorPage */);
+ m_viewClient->iconChanged(QUrl());
+ m_viewClient->loadFinished(false /* success */, toQt(validated_url), true /* isErrorPage */);
return;
}
- if (render_frame_host->GetParent())
- return;
-
- m_viewClient->iconChanged(QUrl());
- m_viewClient->loadFinished(false /* success */ , toQt(validated_url), false /* isErrorPage */, error_code, toQt(error_description));
- m_viewClient->loadProgressChanged(0);
+ didFailLoad(toQt(validated_url), error_code, toQt(error_description));
}
void WebContentsDelegateQt::DidFinishLoad(content::RenderFrameHost* render_frame_host, const GURL& validated_url)
@@ -380,14 +404,6 @@ void WebContentsDelegateQt::UpdateTargetURL(content::WebContents* source, const
m_viewClient->didUpdateTargetURL(toQt(url));
}
-void WebContentsDelegateQt::DidNavigateAnyFrame(content::RenderFrameHost* render_frame_host, const content::LoadCommittedDetails& details, const content::FrameNavigateParams& params)
-{
- // VisistedLinksMaster asserts !IsOffTheRecord().
- if (!params.should_update_history || !m_viewClient->browserContextAdapter()->trackVisitedLinks())
- return;
- m_viewClient->browserContextAdapter()->visitedLinksManager()->addUrl(params.url);
-}
-
void WebContentsDelegateQt::WasShown()
{
web_cache::WebCacheManager::GetInstance()->ObserveActivity(web_contents()->GetRenderProcessHost()->GetID());
@@ -408,6 +424,13 @@ void WebContentsDelegateQt::DidFirstVisuallyNonEmptyPaint()
}
}
+void WebContentsDelegateQt::ActivateContents(content::WebContents* contents)
+{
+ WebEngineSettings *settings = m_viewClient->webEngineSettings();
+ if (settings->testAttribute(settings->Attribute::AllowWindowActivationFromJavaScript))
+ contents->Focus();
+}
+
void WebContentsDelegateQt::RequestToLockMouse(content::WebContents *web_contents, bool user_gesture, bool last_unlocked_by_target)
{
Q_UNUSED(user_gesture);
diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h
index 913bf356c..84799c2cd 100644
--- a/src/core/web_contents_delegate_qt.h
+++ b/src/core/web_contents_delegate_qt.h
@@ -126,18 +126,18 @@ public:
// WebContentsObserver overrides
void RenderFrameDeleted(content::RenderFrameHost *render_frame_host) override;
- void DidStartProvisionalLoadForFrame(content::RenderFrameHost *render_frame_host, const GURL &validated_url, bool is_error_page, bool is_iframe_srcdoc) override;
- void DidCommitProvisionalLoadForFrame(content::RenderFrameHost *render_frame_host, const GURL &url, ui::PageTransition transition_type) override;
- void DidFailProvisionalLoad(content::RenderFrameHost *render_frame_host, const GURL &validated_url,
- int error_code, const base::string16 &error_description, bool was_ignored_by_handler) override;
+ void DidStartNavigation(content::NavigationHandle *navigation_handle) override;
+ void DidFinishNavigation(content::NavigationHandle *navigation_handle) override;
void DidFailLoad(content::RenderFrameHost *render_frame_host, const GURL &validated_url,
int error_code, const base::string16 &error_description, bool was_ignored_by_handler) override;
void DidFinishLoad(content::RenderFrameHost *render_frame_host, const GURL &validated_url) override;
void DidUpdateFaviconURL(const std::vector<content::FaviconURL> &candidates) override;
- void DidNavigateAnyFrame(content::RenderFrameHost *render_frame_host, const content::LoadCommittedDetails &details, const content::FrameNavigateParams &params) override;
void WasShown() override;
void DidFirstVisuallyNonEmptyPaint() override;
+ void ActivateContents(content::WebContents* contents) override;
+
+ void didFailLoad(const QUrl &url, int errorCode, const QString &errorDescription);
void overrideWebPreferences(content::WebContents *, content::WebPreferences*);
void allowCertificateError(const QSharedPointer<CertificateErrorController> &) ;
void requestGeolocationPermission(const QUrl &requestingOrigin);
diff --git a/src/core/web_contents_view_qt.cpp b/src/core/web_contents_view_qt.cpp
index 844544887..e627fa06d 100644
--- a/src/core/web_contents_view_qt.cpp
+++ b/src/core/web_contents_view_qt.cpp
@@ -164,6 +164,7 @@ static inline WebEngineContextMenuData fromParams(const content::ContextMenuPara
ret.setPosition(QPoint(params.x, params.y));
ret.setLinkUrl(toQt(params.link_url));
ret.setLinkText(toQt(params.link_text.data()));
+ ret.setUnfilteredLinkUrl(toQt(params.unfiltered_link_url));
ret.setSelectedText(toQt(params.selection_text.data()));
ret.setMediaUrl(toQt(params.src_url));
ret.setMediaType((WebEngineContextMenuData::MediaType)params.media_type);
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp
index 2748d2a0f..f8875f82e 100644
--- a/src/core/web_engine_context.cpp
+++ b/src/core/web_engine_context.cpp
@@ -52,7 +52,7 @@
#include "chrome/browser/printing/print_job_manager.h"
#endif // defined(ENABLE_BASIC_PRINTING)
#include "content/browser/devtools/devtools_http_handler.h"
-#include "content/browser/gpu/gpu_process_host.h"
+#include "content/browser/gpu/gpu_main_thread_factory.h"
#include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/browser/utility_process_host_impl.h"
#include "content/gpu/in_process_gpu_thread.h"
@@ -67,6 +67,7 @@
#include "content/renderer/in_process_renderer_thread.h"
#include "content/utility/in_process_utility_thread.h"
#include "gpu/command_buffer/service/gpu_switches.h"
+#include "ppapi/features/features.h"
#include "ui/events/event_switches.h"
#include "ui/native_theme/native_theme_switches.h"
#include "ui/gl/gl_switches.h"
@@ -173,7 +174,7 @@ bool usingQtQuick2DRenderer()
return device != QLatin1String("default");
}
#endif //QT_NO_OPENGL
-#if defined(ENABLE_PLUGINS)
+#if BUILDFLAG(ENABLE_PLUGINS)
void dummyGetPluginCallback(const std::vector<content::WebPluginInfo>&)
{
}
@@ -392,6 +393,9 @@ WebEngineContext::WebEngineContext()
if (!qt_gl_global_share_context()->isOpenGLES())
glType = gl::kGLImplementationDesktopName;
}
+
+ if (qt_gl_global_share_context()->format().profile() == QSurfaceFormat::CompatibilityProfile)
+ parsedCommandLine->AppendSwitch(switches::kCreateDefaultGLContext);
} else {
qWarning("WebEngineContext used before QtWebEngine::initialize() or OpenGL context creation failed.");
}
@@ -405,7 +409,7 @@ WebEngineContext::WebEngineContext()
content::UtilityProcessHostImpl::RegisterUtilityMainThreadFactory(content::CreateInProcessUtilityThread);
content::RenderProcessHostImpl::RegisterRendererMainThreadFactory(content::CreateInProcessRendererThread);
- content::GpuProcessHost::RegisterGpuMainThreadFactory(content::CreateInProcessGpuThread);
+ content::RegisterGpuMainThreadFactory(content::CreateInProcessGpuThread);
content::ContentMainParams contentMainParams(m_mainDelegate.get());
contentMainParams.setup_signal_handlers = false;
@@ -430,7 +434,7 @@ WebEngineContext::WebEngineContext()
base::ThreadRestrictions::SetIOAllowed(true);
-#if defined(ENABLE_PLUGINS)
+#if BUILDFLAG(ENABLE_PLUGINS)
// Creating pepper plugins from the page (which calls PluginService::GetPluginInfoArray)
// might fail unless the page queried the list of available plugins at least once
// (which ends up calling PluginService::GetPlugins). Since the plugins list can only
diff --git a/src/core/web_engine_settings.cpp b/src/core/web_engine_settings.cpp
index 58f0a3e2c..4be985e0c 100644
--- a/src/core/web_engine_settings.cpp
+++ b/src/core/web_engine_settings.cpp
@@ -204,7 +204,7 @@ QString WebEngineSettings::defaultTextEncoding() const
return m_defaultEncoding.isEmpty()? parentSettings->defaultTextEncoding() : m_defaultEncoding;
}
-void WebEngineSettings::initDefaults(bool offTheRecord)
+void WebEngineSettings::initDefaults()
{
if (s_defaultAttributes.isEmpty()) {
// Initialize the default settings.
@@ -243,9 +243,8 @@ void WebEngineSettings::initDefaults(bool offTheRecord)
s_defaultAttributes.insert(PrintElementBackgrounds, true);
s_defaultAttributes.insert(AllowRunningInsecureContent, allowRunningInsecureContent);
s_defaultAttributes.insert(AllowGeolocationOnInsecureOrigins, false);
+ s_defaultAttributes.insert(AllowWindowActivationFromJavaScript, false);
}
- if (offTheRecord)
- m_attributes.insert(LocalStorageEnabled, false);
if (s_defaultFontFamilies.isEmpty()) {
// Default fonts
@@ -298,7 +297,7 @@ void WebEngineSettings::doApply()
void WebEngineSettings::applySettingsToWebPreferences(content::WebPreferences *prefs)
{
// Override for now
- prefs->touch_enabled = isTouchScreenAvailable();
+ prefs->device_supports_touch = isTouchScreenAvailable();
if (prefs->viewport_enabled) {
// We should enable viewport and viewport-meta together, but since 5.7 we
// no longer have a command-line flag for viewport-meta.
diff --git a/src/core/web_engine_settings.h b/src/core/web_engine_settings.h
index 4b0ce7b39..7defb0013 100644
--- a/src/core/web_engine_settings.h
+++ b/src/core/web_engine_settings.h
@@ -83,7 +83,8 @@ public:
FocusOnNavigationEnabled,
PrintElementBackgrounds,
AllowRunningInsecureContent,
- AllowGeolocationOnInsecureOrigins
+ AllowGeolocationOnInsecureOrigins,
+ AllowWindowActivationFromJavaScript
};
// Must match the values from the public API in qwebenginesettings.h.
@@ -127,7 +128,7 @@ public:
void setDefaultTextEncoding(const QString &encoding);
QString defaultTextEncoding() const;
- void initDefaults(bool offTheRecord = false);
+ void initDefaults();
void scheduleApply();
void scheduleApplyRecursively();
diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp
index a7df934e4..65f8431d7 100644
--- a/src/core/web_event_factory.cpp
+++ b/src/core/web_event_factory.cpp
@@ -903,11 +903,11 @@ static ui::DomKey getDomKeyFromQKeyEvent(QKeyEvent *ev)
// Audio Keys
case Qt::Key_BassDown:
- return ui::DomKey::AUDIO_BASS_DOWN;
+ return ui::DomKey::AUDIO_BASS_BOOST_DOWN;
case Qt::Key_BassBoost:
return ui::DomKey::AUDIO_BASS_BOOST_TOGGLE;
case Qt::Key_BassUp:
- return ui::DomKey::AUDIO_BASS_UP;
+ return ui::DomKey::AUDIO_BASS_BOOST_UP;
case Qt::Key_TrebleDown:
return ui::DomKey::AUDIO_TREBLE_DOWN;
case Qt::Key_TrebleUp:
@@ -1182,16 +1182,17 @@ static WebInputEvent::Type webEventTypeForEvent(const QEvent* event)
WebMouseEvent WebEventFactory::toWebMouseEvent(QMouseEvent *ev, double dpiScale)
{
WebMouseEvent webKitEvent;
- webKitEvent.timeStampSeconds = currentTimeForEvent(ev);
+ webKitEvent.setTimeStampSeconds(currentTimeForEvent(ev));
+ webKitEvent.setModifiers(modifiersForEvent(ev));
+ webKitEvent.setType(webEventTypeForEvent(ev));
+
webKitEvent.button = mouseButtonForEvent(ev);
- webKitEvent.modifiers = modifiersForEvent(ev);
webKitEvent.x = webKitEvent.windowX = ev->x() / dpiScale;
webKitEvent.y = webKitEvent.windowY = ev->y() / dpiScale;
webKitEvent.globalX = ev->globalX();
webKitEvent.globalY = ev->globalY();
- webKitEvent.type = webEventTypeForEvent(ev);
webKitEvent.clickCount = 0;
return webKitEvent;
@@ -1200,23 +1201,23 @@ WebMouseEvent WebEventFactory::toWebMouseEvent(QMouseEvent *ev, double dpiScale)
WebMouseEvent WebEventFactory::toWebMouseEvent(QHoverEvent *ev, double dpiScale)
{
WebMouseEvent webKitEvent;
- webKitEvent.timeStampSeconds = currentTimeForEvent(ev);
- webKitEvent.modifiers = modifiersForEvent(ev);
+ webKitEvent.setTimeStampSeconds(currentTimeForEvent(ev));
+ webKitEvent.setModifiers(modifiersForEvent(ev));
+ webKitEvent.setType(webEventTypeForEvent(ev));
webKitEvent.x = webKitEvent.windowX = ev->pos().x() / dpiScale;
webKitEvent.y = webKitEvent.windowY = ev->pos().y() / dpiScale;
webKitEvent.movementX = ev->pos().x() - ev->oldPos().x();
webKitEvent.movementY = ev->pos().y() - ev->oldPos().y();
- webKitEvent.type = webEventTypeForEvent(ev);
return webKitEvent;
}
WebGestureEvent WebEventFactory::toWebGestureEvent(QNativeGestureEvent *ev, double dpiScale)
{
WebGestureEvent webKitEvent;
- webKitEvent.timeStampSeconds = currentTimeForEvent(ev);
- webKitEvent.modifiers = modifiersForEvent(ev);
+ webKitEvent.setTimeStampSeconds(currentTimeForEvent(ev));
+ webKitEvent.setModifiers(modifiersForEvent(ev));
webKitEvent.x = static_cast<int>(ev->localPos().x() / dpiScale);
webKitEvent.y = static_cast<int>(ev->localPos().y() / dpiScale);
@@ -1229,11 +1230,11 @@ WebGestureEvent WebEventFactory::toWebGestureEvent(QNativeGestureEvent *ev, doub
Qt::NativeGestureType gestureType = ev->gestureType();
switch (gestureType) {
case Qt::ZoomNativeGesture:
- webKitEvent.type = WebInputEvent::GesturePinchUpdate;
+ webKitEvent.setType(WebInputEvent::GesturePinchUpdate);
webKitEvent.data.pinchUpdate.scale = static_cast<float>(ev->value() + 1.0);
break;
case Qt::SmartZoomNativeGesture:
- webKitEvent.type = WebInputEvent::GestureDoubleTap;
+ webKitEvent.setType(WebInputEvent::GestureDoubleTap);
webKitEvent.data.tap.tapCount = 1;
break;
case Qt::BeginNativeGesture:
@@ -1242,7 +1243,7 @@ WebGestureEvent WebEventFactory::toWebGestureEvent(QNativeGestureEvent *ev, doub
case Qt::PanNativeGesture:
case Qt::SwipeNativeGesture:
// Not implemented by Chromium for now.
- webKitEvent.type = blink::WebInputEvent::Undefined;
+ webKitEvent.setType(blink::WebInputEvent::Undefined);
break;
}
@@ -1252,13 +1253,13 @@ WebGestureEvent WebEventFactory::toWebGestureEvent(QNativeGestureEvent *ev, doub
blink::WebMouseWheelEvent WebEventFactory::toWebWheelEvent(QWheelEvent *ev, double dpiScale)
{
WebMouseWheelEvent webEvent;
- webEvent.type = webEventTypeForEvent(ev);
webEvent.deltaX = 0;
webEvent.deltaY = 0;
webEvent.wheelTicksX = 0;
webEvent.wheelTicksY = 0;
- webEvent.modifiers = modifiersForEvent(ev);
- webEvent.timeStampSeconds = currentTimeForEvent(ev);
+ webEvent.setType(webEventTypeForEvent(ev));
+ webEvent.setModifiers(modifiersForEvent(ev));
+ webEvent.setTimeStampSeconds(currentTimeForEvent(ev));
webEvent.wheelTicksX = static_cast<float>(ev->angleDelta().x()) / QWheelEvent::DefaultDeltasPerStep;
webEvent.wheelTicksY = static_cast<float>(ev->angleDelta().y()) / QWheelEvent::DefaultDeltasPerStep;
@@ -1280,9 +1281,9 @@ blink::WebMouseWheelEvent WebEventFactory::toWebWheelEvent(QWheelEvent *ev, doub
content::NativeWebKeyboardEvent WebEventFactory::toWebKeyboardEvent(QKeyEvent *ev)
{
content::NativeWebKeyboardEvent webKitEvent(reinterpret_cast<gfx::NativeEvent>(ev));
- webKitEvent.timeStampSeconds = currentTimeForEvent(ev);
- webKitEvent.modifiers = modifiersForEvent(ev);
- webKitEvent.type = webEventTypeForEvent(ev);
+ webKitEvent.setTimeStampSeconds(currentTimeForEvent(ev));
+ webKitEvent.setModifiers(modifiersForEvent(ev));
+ webKitEvent.setType(webEventTypeForEvent(ev));
webKitEvent.nativeKeyCode = ev->nativeVirtualKey();
webKitEvent.windowsKeyCode = windowsKeyCodeForKeyEvent(ev->key(), ev->modifiers() & Qt::KeypadModifier);
diff --git a/src/core/web_event_factory.h b/src/core/web_event_factory.h
index d82113db3..b5e465610 100644
--- a/src/core/web_event_factory.h
+++ b/src/core/web_event_factory.h
@@ -41,8 +41,9 @@
#define WEB_EVENT_FACTORY_H
#include "content/public/browser/native_web_keyboard_event.h"
-#include "third_party/WebKit/public/platform/WebInputEvent.h"
#include "third_party/WebKit/public/platform/WebGestureEvent.h"
+#include "third_party/WebKit/public/platform/WebMouseEvent.h"
+#include "third_party/WebKit/public/platform/WebMouseWheelEvent.h"
#include <QtGlobal>
diff --git a/src/webengine/api/qquickwebenginecontextmenurequest.cpp b/src/webengine/api/qquickwebenginecontextmenurequest.cpp
index df57442a1..c53e28d93 100644
--- a/src/webengine/api/qquickwebenginecontextmenurequest.cpp
+++ b/src/webengine/api/qquickwebenginecontextmenurequest.cpp
@@ -159,11 +159,12 @@ QString QQuickWebEngineContextMenuRequest::linkText() const
\readonly
The URL of the link if the selected web page content is a link.
+ It is not guaranteed to be a valid URL.
*/
QUrl QQuickWebEngineContextMenuRequest::linkUrl() const
{
- return m_data->linkUrl();
+ return m_data->unfilteredLinkUrl();
}
/*!
diff --git a/src/webengine/api/qquickwebenginedownloaditem.cpp b/src/webengine/api/qquickwebenginedownloaditem.cpp
index bc40e6771..5afb19531 100644
--- a/src/webengine/api/qquickwebenginedownloaditem.cpp
+++ b/src/webengine/api/qquickwebenginedownloaditem.cpp
@@ -39,6 +39,8 @@
#include "qquickwebenginedownloaditem_p.h"
#include "qquickwebenginedownloaditem_p_p.h"
+
+#include "browser_context_adapter.h"
#include "qquickwebengineprofile_p.h"
using QtWebEngineCore::BrowserContextAdapterClient;
@@ -103,6 +105,8 @@ QQuickWebEngineDownloadItemPrivate::QQuickWebEngineDownloadItemPrivate(QQuickWeb
, interruptReason(QQuickWebEngineDownloadItem::NoReason)
, totalBytes(-1)
, receivedBytes(0)
+ , downloadFinished(false)
+ , downloadPaused(false)
{
}
@@ -145,6 +149,16 @@ void QQuickWebEngineDownloadItemPrivate::update(const BrowserContextAdapterClien
totalBytes = info.totalBytes;
Q_EMIT q->totalBytesChanged();
}
+
+ if (info.done != downloadFinished) {
+ downloadFinished = info.done;
+ Q_EMIT q->isFinishedChanged();
+ }
+
+ if (info.paused != downloadPaused) {
+ downloadPaused = info.paused;
+ Q_EMIT q->isPausedChanged();
+ }
}
void QQuickWebEngineDownloadItemPrivate::updateState(QQuickWebEngineDownloadItem::DownloadState newState)
@@ -199,6 +213,46 @@ void QQuickWebEngineDownloadItem::cancel()
}
}
+
+/*!
+ \qmlmethod void WebEngineDownloadItem::pause()
+ \since QtWebEngine 1.6
+
+ Pauses the download.
+*/
+
+void QQuickWebEngineDownloadItem::pause()
+{
+ Q_D(QQuickWebEngineDownloadItem);
+
+ QQuickWebEngineDownloadItem::DownloadState state = d->downloadState;
+
+ if (state != QQuickWebEngineDownloadItem::DownloadInProgress)
+ return;
+
+ if (d->profile)
+ d->profile->d_ptr->browserContext()->pauseDownload(d->downloadId);
+}
+
+/*!
+ \qmlmethod void WebEngineDownloadItem::resume()
+ \since QtWebEngine 1.6
+
+ Resumes the download if it was paused or interrupted.
+*/
+void QQuickWebEngineDownloadItem::resume()
+{
+ Q_D(QQuickWebEngineDownloadItem);
+
+ QQuickWebEngineDownloadItem::DownloadState state = d->downloadState;
+
+ if (d->downloadFinished || (state != QQuickWebEngineDownloadItem::DownloadInProgress && state != QQuickWebEngineDownloadItem::DownloadInterrupted))
+ return;
+
+ if (d->profile)
+ d->profile->d_ptr->browserContext()->resumeDownload(d->downloadId);
+}
+
/*!
\qmlproperty int WebEngineDownloadItem::id
@@ -426,6 +480,34 @@ QString QQuickWebEngineDownloadItem::interruptReasonString() const
static_cast<BrowserContextAdapterClient::DownloadInterruptReason>(interruptReason()));
}
+/*!
+ \qmlproperty bool WebEngineDownloadItem::isFinished
+ \readonly
+ \since QtWebEngine 1.6
+
+ Whether this download is finished (completed, cancelled, or non-resumable interrupted state).
+ */
+
+bool QQuickWebEngineDownloadItem::isFinished() const
+{
+ Q_D(const QQuickWebEngineDownloadItem);
+ return d->downloadFinished;
+}
+
+/*!
+ \qmlproperty bool WebEngineDownloadItem::isPaused
+ \readonly
+ \since QtWebEngine 1.6
+
+ Whether this download is paused.
+ */
+
+bool QQuickWebEngineDownloadItem::isPaused() const
+{
+ Q_D(const QQuickWebEngineDownloadItem);
+ return d->downloadPaused;
+}
+
QQuickWebEngineDownloadItem::QQuickWebEngineDownloadItem(QQuickWebEngineDownloadItemPrivate *p, QObject *parent)
: QObject(parent)
, d_ptr(p)
diff --git a/src/webengine/api/qquickwebenginedownloaditem_p.h b/src/webengine/api/qquickwebenginedownloaditem_p.h
index 889d0bcb7..972b130aa 100644
--- a/src/webengine/api/qquickwebenginedownloaditem_p.h
+++ b/src/webengine/api/qquickwebenginedownloaditem_p.h
@@ -131,9 +131,13 @@ public:
Q_PROPERTY(DownloadType type READ type NOTIFY typeChanged REVISION 3 FINAL)
Q_PROPERTY(DownloadInterruptReason interruptReason READ interruptReason NOTIFY interruptReasonChanged REVISION 4 FINAL)
Q_PROPERTY(QString interruptReasonString READ interruptReasonString NOTIFY interruptReasonChanged REVISION 4 FINAL)
+ Q_PROPERTY(bool isFinished READ isFinished NOTIFY isFinishedChanged REVISION 5 FINAL)
+ Q_PROPERTY(bool isPaused READ isPaused NOTIFY isPausedChanged REVISION 5 FINAL)
Q_INVOKABLE void accept();
Q_INVOKABLE void cancel();
+ Q_INVOKABLE void pause();
+ Q_INVOKABLE void resume();
quint32 id() const;
DownloadState state() const;
@@ -147,6 +151,8 @@ public:
DownloadType type() const;
DownloadInterruptReason interruptReason() const;
QString interruptReasonString() const;
+ bool isFinished() const;
+ bool isPaused() const;
Q_SIGNALS:
void stateChanged();
@@ -157,6 +163,8 @@ Q_SIGNALS:
void pathChanged();
Q_REVISION(3) void typeChanged();
Q_REVISION(4) void interruptReasonChanged();
+ Q_REVISION(5) void isFinishedChanged();
+ Q_REVISION(5) void isPausedChanged();
private:
QQuickWebEngineDownloadItem(QQuickWebEngineDownloadItemPrivate*, QObject *parent = 0);
diff --git a/src/webengine/api/qquickwebenginedownloaditem_p_p.h b/src/webengine/api/qquickwebenginedownloaditem_p_p.h
index 4fb609492..6b4f7c8d3 100644
--- a/src/webengine/api/qquickwebenginedownloaditem_p_p.h
+++ b/src/webengine/api/qquickwebenginedownloaditem_p_p.h
@@ -79,6 +79,8 @@ public:
qint64 receivedBytes;
QString mimeType;
QString downloadPath;
+ bool downloadFinished;
+ bool downloadPaused;
void update(const QtWebEngineCore::BrowserContextAdapterClient::DownloadItemInfo &info);
void updateState(QQuickWebEngineDownloadItem::DownloadState newState);
diff --git a/src/webengine/api/qquickwebengineprofile.cpp b/src/webengine/api/qquickwebengineprofile.cpp
index 260d8958b..74ff1c8a1 100644
--- a/src/webengine/api/qquickwebengineprofile.cpp
+++ b/src/webengine/api/qquickwebengineprofile.cpp
@@ -145,7 +145,7 @@ QQuickWebEngineProfilePrivate::QQuickWebEngineProfilePrivate(QSharedPointer<Brow
, m_browserContextRef(browserContext)
{
m_browserContextRef->addClient(this);
- m_settings->d_ptr->initDefaults(browserContext->isOffTheRecord());
+ m_settings->d_ptr->initDefaults();
// Fullscreen API was implemented before the supported setting, so we must
// make it default true to avoid change in default API behavior.
m_settings->d_ptr->setAttribute(QtWebEngineCore::WebEngineSettings::FullScreenSupportEnabled, true);
diff --git a/src/webengine/api/qquickwebenginesettings.cpp b/src/webengine/api/qquickwebenginesettings.cpp
index ff2541376..cdbb25e4c 100644
--- a/src/webengine/api/qquickwebenginesettings.cpp
+++ b/src/webengine/api/qquickwebenginesettings.cpp
@@ -363,6 +363,16 @@ bool QQuickWebEngineSettings::allowGeolocationOnInsecureOrigins() const
}
/*!
+ \qmlproperty bool WebEngineSettings::allowWindowActivationFromJavaScript
+ \since QtWebEngine 1.6
+ Allows the window.focus() method in JavaScript. Disallowed by default.
+*/
+bool QQuickWebEngineSettings::allowWindowActivationFromJavaScript() const
+{
+ return d_ptr->testAttribute(WebEngineSettings::AllowWindowActivationFromJavaScript);
+}
+
+/*!
\qmlproperty string WebEngineSettings::defaultTextEncoding
\since QtWebEngine 1.2
@@ -564,6 +574,14 @@ void QQuickWebEngineSettings::setAllowGeolocationOnInsecureOrigins(bool on)
Q_EMIT allowGeolocationOnInsecureOriginsChanged();
}
+void QQuickWebEngineSettings::setAllowWindowActivationFromJavaScript(bool on)
+{
+ bool wasOn = d_ptr->testAttribute(WebEngineSettings::AllowWindowActivationFromJavaScript);
+ d_ptr->setAttribute(WebEngineSettings::AllowWindowActivationFromJavaScript, on);
+ if (wasOn != on)
+ Q_EMIT allowWindowActivationFromJavaScriptChanged();
+}
+
void QQuickWebEngineSettings::setParentSettings(QQuickWebEngineSettings *parentSettings)
{
d_ptr->setParentSettings(parentSettings->d_ptr.data());
diff --git a/src/webengine/api/qquickwebenginesettings_p.h b/src/webengine/api/qquickwebenginesettings_p.h
index 10217c678..1b9988bce 100644
--- a/src/webengine/api/qquickwebenginesettings_p.h
+++ b/src/webengine/api/qquickwebenginesettings_p.h
@@ -86,6 +86,7 @@ class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineSettings : public QObject {
Q_PROPERTY(bool printElementBackgrounds READ printElementBackgrounds WRITE setPrintElementBackgrounds NOTIFY printElementBackgroundsChanged REVISION 3 FINAL)
Q_PROPERTY(bool allowRunningInsecureContent READ allowRunningInsecureContent WRITE setAllowRunningInsecureContent NOTIFY allowRunningInsecureContentChanged REVISION 3 FINAL)
Q_PROPERTY(bool allowGeolocationOnInsecureOrigins READ allowGeolocationOnInsecureOrigins WRITE setAllowGeolocationOnInsecureOrigins NOTIFY allowGeolocationOnInsecureOriginsChanged REVISION 4 FINAL)
+ Q_PROPERTY(bool allowWindowActivationFromJavaScript READ allowWindowActivationFromJavaScript WRITE setAllowWindowActivationFromJavaScript NOTIFY allowWindowActivationFromJavaScriptChanged REVISION 5 FINAL)
public:
~QQuickWebEngineSettings();
@@ -113,6 +114,7 @@ public:
bool printElementBackgrounds() const;
bool allowRunningInsecureContent() const;
bool allowGeolocationOnInsecureOrigins() const;
+ bool allowWindowActivationFromJavaScript() const;
void setAutoLoadImages(bool on);
void setJavascriptEnabled(bool on);
@@ -137,6 +139,7 @@ public:
void setPrintElementBackgrounds(bool on);
void setAllowRunningInsecureContent(bool on);
void setAllowGeolocationOnInsecureOrigins(bool on);
+ void setAllowWindowActivationFromJavaScript(bool on);
signals:
void autoLoadImagesChanged();
@@ -162,6 +165,7 @@ signals:
Q_REVISION(3) void printElementBackgroundsChanged();
Q_REVISION(3) void allowRunningInsecureContentChanged();
Q_REVISION(4) void allowGeolocationOnInsecureOriginsChanged();
+ Q_REVISION(5) void allowWindowActivationFromJavaScriptChanged();
private:
explicit QQuickWebEngineSettings(QQuickWebEngineSettings *parentSettings = 0);
diff --git a/src/webengine/api/qquickwebenginetestsupport.cpp b/src/webengine/api/qquickwebenginetestsupport.cpp
index 46ffb06f4..41f374766 100644
--- a/src/webengine/api/qquickwebenginetestsupport.cpp
+++ b/src/webengine/api/qquickwebenginetestsupport.cpp
@@ -49,8 +49,6 @@ QQuickWebEngineErrorPage::QQuickWebEngineErrorPage()
void QQuickWebEngineErrorPage::loadFinished(bool success, const QUrl &url)
{
- // Loading of the error page should not fail.
- Q_ASSERT(success);
Q_UNUSED(success);
QQuickWebEngineLoadRequest loadRequest(url, QQuickWebEngineView::LoadSucceededStatus);
@@ -64,8 +62,48 @@ void QQuickWebEngineErrorPage::loadStarted(const QUrl &provisionalUrl)
Q_EMIT loadingChanged(&loadRequest);
}
+
+QQuickWebEngineTestInputContext::QQuickWebEngineTestInputContext()
+ : m_visible(false)
+{
+}
+
+QQuickWebEngineTestInputContext::~QQuickWebEngineTestInputContext()
+{
+ release();
+}
+
+void QQuickWebEngineTestInputContext::create()
+{
+ QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod());
+ inputMethodPrivate->testContext = this;
+}
+
+void QQuickWebEngineTestInputContext::release()
+{
+ QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod());
+ inputMethodPrivate->testContext = 0;
+}
+
+void QQuickWebEngineTestInputContext::showInputPanel()
+{
+ m_visible = true;
+}
+
+void QQuickWebEngineTestInputContext::hideInputPanel()
+{
+ m_visible = false;
+}
+
+bool QQuickWebEngineTestInputContext::isInputPanelVisible() const
+{
+ return m_visible;
+}
+
+
QQuickWebEngineTestSupport::QQuickWebEngineTestSupport()
- : m_errorPage(new QQuickWebEngineErrorPage())
+ : m_errorPage(new QQuickWebEngineErrorPage)
+ , m_testInputContext(new QQuickWebEngineTestInputContext)
{
}
@@ -74,6 +112,11 @@ QQuickWebEngineErrorPage *QQuickWebEngineTestSupport::errorPage() const
return m_errorPage.data();
}
+QQuickWebEngineTestInputContext *QQuickWebEngineTestSupport::testInputContext() const
+{
+ return m_testInputContext.data();
+}
+
QT_END_NAMESPACE
#include "moc_qquickwebenginetestsupport_p.cpp"
diff --git a/src/webengine/api/qquickwebenginetestsupport_p.h b/src/webengine/api/qquickwebenginetestsupport_p.h
index cca8d1df4..a84d00307 100644
--- a/src/webengine/api/qquickwebenginetestsupport_p.h
+++ b/src/webengine/api/qquickwebenginetestsupport_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <private/qinputmethod_p.h>
#include <private/qtwebengineglobal_p.h>
#include <QObject>
@@ -73,13 +74,33 @@ Q_SIGNALS:
void loadingChanged(QQuickWebEngineLoadRequest *loadRequest);
};
+class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineTestInputContext : public QPlatformInputContext {
+ Q_OBJECT
+
+public:
+ QQuickWebEngineTestInputContext();
+ ~QQuickWebEngineTestInputContext();
+
+ Q_INVOKABLE void create();
+ Q_INVOKABLE void release();
+
+ virtual void showInputPanel();
+ virtual void hideInputPanel();
+ virtual bool isInputPanelVisible() const;
+
+private:
+ bool m_visible;
+};
+
class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineTestSupport : public QObject {
Q_OBJECT
Q_PROPERTY(QQuickWebEngineErrorPage *errorPage READ errorPage CONSTANT FINAL)
+ Q_PROPERTY(QQuickWebEngineTestInputContext *testInputContext READ testInputContext CONSTANT FINAL)
public:
QQuickWebEngineTestSupport();
QQuickWebEngineErrorPage *errorPage() const;
+ QQuickWebEngineTestInputContext *testInputContext() const;
Q_SIGNALS:
void windowCloseRejected();
@@ -87,6 +108,7 @@ Q_SIGNALS:
private:
QScopedPointer<QQuickWebEngineErrorPage> m_errorPage;
+ QScopedPointer<QQuickWebEngineTestInputContext> m_testInputContext;
};
QT_END_NAMESPACE
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
index aae0efea8..1fceb4366 100644
--- a/src/webengine/api/qquickwebengineview.cpp
+++ b/src/webengine/api/qquickwebengineview.cpp
@@ -265,10 +265,12 @@ bool QQuickWebEngineViewPrivate::contextMenuRequested(const WebEngineContextMenu
ui()->addMenuItem(item, QQuickWebEngineView::tr("Unselect"));
}
- if (!data.linkText().isEmpty() && data.linkUrl().isValid()) {
+ if (!data.linkText().isEmpty() && !data.unfilteredLinkUrl().isEmpty()) {
item = new MenuItemHandler(menu);
QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::CopyLinkToClipboard); });
ui()->addMenuItem(item, QQuickWebEngineView::tr("Copy Link URL"));
+ }
+ if (!data.linkText().isEmpty() && data.linkUrl().isValid()) {
item = new MenuItemHandler(menu);
QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::DownloadLinkToDisk); });
ui()->addMenuItem(item, QQuickWebEngineView::tr("Save Link"));
@@ -564,6 +566,9 @@ void QQuickWebEngineViewPrivate::loadFinished(bool success, const QUrl &url, boo
void QQuickWebEngineViewPrivate::focusContainer()
{
Q_Q(QQuickWebEngineView);
+ QQuickWindow *window = q->window();
+ if (window)
+ window->requestActivate();
q->forceActiveFocus();
}
@@ -865,8 +870,7 @@ QQuickWebEngineView::QQuickWebEngineView(QQuickItem *parent)
Q_D(QQuickWebEngineView);
d->q_ptr = this;
this->setActiveFocusOnTab(true);
- this->setFlags(QQuickItem::ItemIsFocusScope | QQuickItem::ItemAcceptsInputMethod
- | QQuickItem::ItemAcceptsDrops);
+ this->setFlags(QQuickItem::ItemIsFocusScope | QQuickItem::ItemAcceptsDrops);
#ifndef QT_NO_ACCESSIBILITY
QQuickAccessibleAttached *accessible = QQuickAccessibleAttached::qmlAttachedProperties(this);
@@ -1604,14 +1608,14 @@ void QQuickWebEngineView::triggerWebAction(WebAction action)
}
break;
case CopyLinkToClipboard:
- if (d->m_contextMenuData.linkUrl().isValid()) {
- QString urlString = d->m_contextMenuData.linkUrl().toString(QUrl::FullyEncoded);
+ if (!d->m_contextMenuData.unfilteredLinkUrl().isEmpty()) {
+ QString urlString = d->m_contextMenuData.unfilteredLinkUrl().toString(QUrl::FullyEncoded);
QString title = d->m_contextMenuData.linkText().toHtmlEscaped();
QMimeData *data = new QMimeData();
data->setText(urlString);
QString html = QStringLiteral("<a href=\"") + urlString + QStringLiteral("\">") + title + QStringLiteral("</a>");
data->setHtml(html);
- data->setUrls(QList<QUrl>() << d->m_contextMenuData.linkUrl());
+ data->setUrls(QList<QUrl>() << d->m_contextMenuData.unfilteredLinkUrl());
qApp->clipboard()->setMimeData(data);
}
break;
@@ -1707,6 +1711,42 @@ void QQuickWebEngineView::triggerWebAction(WebAction action)
case ViewSource:
d->adapter->viewSource();
break;
+ case ToggleBold:
+ runJavaScript(QStringLiteral("document.execCommand('bold');"), QQuickWebEngineScript::ApplicationWorld);
+ break;
+ case ToggleItalic:
+ runJavaScript(QStringLiteral("document.execCommand('italic');"), QQuickWebEngineScript::ApplicationWorld);
+ break;
+ case ToggleUnderline:
+ runJavaScript(QStringLiteral("document.execCommand('underline');"), QQuickWebEngineScript::ApplicationWorld);
+ break;
+ case ToggleStrikethrough:
+ runJavaScript(QStringLiteral("document.execCommand('strikethrough');"), QQuickWebEngineScript::ApplicationWorld);
+ break;
+ case AlignLeft:
+ runJavaScript(QStringLiteral("document.execCommand('justifyLeft');"), QQuickWebEngineScript::ApplicationWorld);
+ break;
+ case AlignCenter:
+ runJavaScript(QStringLiteral("document.execCommand('justifyCenter');"), QQuickWebEngineScript::ApplicationWorld);
+ break;
+ case AlignRight:
+ runJavaScript(QStringLiteral("document.execCommand('justifyRight');"), QQuickWebEngineScript::ApplicationWorld);
+ break;
+ case AlignJustified:
+ runJavaScript(QStringLiteral("document.execCommand('justifyFull');"), QQuickWebEngineScript::ApplicationWorld);
+ break;
+ case Indent:
+ runJavaScript(QStringLiteral("document.execCommand('indent');"), QQuickWebEngineScript::ApplicationWorld);
+ break;
+ case Outdent:
+ runJavaScript(QStringLiteral("document.execCommand('outdent');"), QQuickWebEngineScript::ApplicationWorld);
+ break;
+ case InsertOrderedList:
+ runJavaScript(QStringLiteral("document.execCommand('insertOrderedList');"), QQuickWebEngineScript::ApplicationWorld);
+ break;
+ case InsertUnorderedList:
+ runJavaScript(QStringLiteral("document.execCommand('insertUnorderedList');"), QQuickWebEngineScript::ApplicationWorld);
+ break;
default:
Q_UNREACHABLE();
}
diff --git a/src/webengine/api/qquickwebengineview_p.h b/src/webengine/api/qquickwebengineview_p.h
index 8112c7609..32419329a 100644
--- a/src/webengine/api/qquickwebengineview_p.h
+++ b/src/webengine/api/qquickwebengineview_p.h
@@ -244,6 +244,22 @@ public:
Unselect,
SavePage,
ViewSource,
+
+ ToggleBold,
+ ToggleItalic,
+ ToggleUnderline,
+ ToggleStrikethrough,
+
+ AlignLeft,
+ AlignCenter,
+ AlignRight,
+ AlignJustified,
+ Indent,
+ Outdent,
+
+ InsertOrderedList,
+ InsertUnorderedList,
+
WebActionCount
};
Q_ENUM(WebAction)
diff --git a/src/webengine/doc/src/webengineview.qdoc b/src/webengine/doc/src/webengineview.qdoc
index 27c3d6920..e452746d9 100644
--- a/src/webengine/doc/src/webengineview.qdoc
+++ b/src/webengine/doc/src/webengineview.qdoc
@@ -793,6 +793,46 @@
\value WebEngineView.ViewSource
Show the source of the current page in a new tab. (Added in Qt 5.8)
+ \value WebEngineView.ToggleBold
+ Toggles boldness for the selection or at the cursor position.
+ Requires \c contenteditable="true". (Added in Qt 5.10)
+ \value WebEngineView.ToggleItalic
+ Toggles italics for the selection or at the cursor position.
+ Requires \c contenteditable="true". (Added in Qt 5.10)
+ \value WebEngineView.ToggleUnderline
+ Toggles underlining of the selection or at the cursor position.
+ Requires \c contenteditable="true". (Added in Qt 5.10)
+ \value WebEngineView.ToggleStrikethrough
+ Toggles striking through the selection or at the cursor position.
+ Requires \c contenteditable="true". (Added in Qt 5.10)
+
+ \value WebEngineView.AlignLeft
+ Aligns the lines containing the selection or the cursor to the left.
+ Requires \c contenteditable="true". (Added in Qt 5.10)
+ \value WebEngineView.AlignCenter
+ Aligns the lines containing the selection or the cursor at the center.
+ Requires \c contenteditable="true". (Added in Qt 5.10)
+ \value WebEngineView.AlignRight
+ Aligns the lines containing the selection or the cursor to the right.
+ Requires \c contenteditable="true". (Added in Qt 5.10)
+ \value WebEngineView.AlignJustified
+ Stretches the lines containing the selection or the cursor so that each
+ line has equal width.
+ Requires \c contenteditable="true". (Added in Qt 5.10)
+ \value WebEngineView.Indent
+ Indents the lines containing the selection or the cursor.
+ Requires \c contenteditable="true". (Added in Qt 5.10)
+ \value WebEngineView.Outdent
+ Outdents the lines containing the selection or the cursor.
+ Requires \c contenteditable="true". (Added in Qt 5.10)
+
+ \value WebEngineView.InsertOrderedList
+ Inserts an ordered list at the current cursor position, deleting the current selection.
+ Requires \c contenteditable="true". (Added in Qt 5.10)
+ \value WebEngineView.InsertUnorderedList
+ Inserts an unordered list at the current cursor position,
+ deleting the current selection.
+ Requires \c contenteditable="true". (Added in Qt 5.10)
\omitvalue WebActionCount
*/
diff --git a/src/webengine/plugin/plugin.cpp b/src/webengine/plugin/plugin.cpp
index 3c8991ff7..e58b2ab61 100644
--- a/src/webengine/plugin/plugin.cpp
+++ b/src/webengine/plugin/plugin.cpp
@@ -102,6 +102,8 @@ public:
tr("Cannot create a separate instance of WebEngineDownloadItem"));
qmlRegisterUncreatableType<QQuickWebEngineDownloadItem, 4>(uri, 1, 5, "WebEngineDownloadItem",
tr("Cannot create a separate instance of WebEngineDownloadItem"));
+ qmlRegisterUncreatableType<QQuickWebEngineDownloadItem, 5>(uri, 1, 6, "WebEngineDownloadItem",
+ tr("Cannot create a separate instance of WebEngineDownloadItem"));
qmlRegisterUncreatableType<QQuickWebEngineNewViewRequest>(uri, 1, 1, "WebEngineNewViewRequest", msgUncreatableType("WebEngineNewViewRequest"));
qmlRegisterUncreatableType<QQuickWebEngineNewViewRequest, 1>(uri, 1, 5, "WebEngineNewViewRequest", tr("Cannot create separate instance of WebEngineNewViewRequest"));
qmlRegisterUncreatableType<QQuickWebEngineSettings>(uri, 1, 1, "WebEngineSettings", tr("Cannot create a separate instance of WebEngineSettings"));
@@ -109,6 +111,7 @@ public:
qmlRegisterUncreatableType<QQuickWebEngineSettings, 2>(uri, 1, 3, "WebEngineSettings", tr("Cannot create a separate instance of WebEngineSettings"));
qmlRegisterUncreatableType<QQuickWebEngineSettings, 3>(uri, 1, 4, "WebEngineSettings", tr("Cannot create a separate instance of WebEngineSettings"));
qmlRegisterUncreatableType<QQuickWebEngineSettings, 4>(uri, 1, 5, "WebEngineSettings", tr("Cannot create a separate instance of WebEngineSettings"));
+ qmlRegisterUncreatableType<QQuickWebEngineSettings, 5>(uri, 1, 6, "WebEngineSettings", tr("Cannot create a separate instance of WebEngineSettings"));
qmlRegisterSingletonType<QQuickWebEngineSingleton>(uri, 1, 1, "WebEngine", webEngineSingletonProvider);
qmlRegisterUncreatableType<QQuickWebEngineHistory>(uri, 1, 1, "NavigationHistory",
tr("Cannot create a separate instance of NavigationHistory"));
diff --git a/src/webengine/plugin/plugin.pro b/src/webengine/plugin/plugin.pro
index 68404b4f8..1f9ef00c5 100644
--- a/src/webengine/plugin/plugin.pro
+++ b/src/webengine/plugin/plugin.pro
@@ -1,7 +1,7 @@
CXX_MODULE = qml
TARGET = qtwebengineplugin
TARGETPATH = QtWebEngine
-IMPORT_VERSION = 1.5
+IMPORT_VERSION = 1.6
QT += webengine qml quick
QT_PRIVATE += webengine-private
diff --git a/src/webengine/plugin/plugins.qmltypes b/src/webengine/plugin/plugins.qmltypes
index 459d56c75..0cfa2d25b 100644
--- a/src/webengine/plugin/plugins.qmltypes
+++ b/src/webengine/plugin/plugins.qmltypes
@@ -4,7 +4,7 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -defaultplatform -dependencies dependencies.json -nonrelocatable QtWebEngine 1.5'
+// 'qmlplugindump -defaultplatform -dependencies dependencies.json -nonrelocatable QtWebEngine 1.6'
Module {
dependencies: ["QtQuick 2.6"]
@@ -509,10 +509,11 @@ Module {
"QtWebEngine/WebEngineSettings 1.2",
"QtWebEngine/WebEngineSettings 1.3",
"QtWebEngine/WebEngineSettings 1.4",
- "QtWebEngine/WebEngineSettings 1.5"
+ "QtWebEngine/WebEngineSettings 1.5",
+ "QtWebEngine/WebEngineSettings 1.6"
]
isCreatable: false
- exportMetaObjectRevisions: [0, 1, 2, 3, 4]
+ exportMetaObjectRevisions: [0, 1, 2, 3, 4, 5]
Property { name: "autoLoadImages"; type: "bool" }
Property { name: "javascriptEnabled"; type: "bool" }
Property { name: "javascriptCanOpenWindows"; type: "bool" }
@@ -536,6 +537,7 @@ Module {
Property { name: "printElementBackgrounds"; revision: 3; type: "bool" }
Property { name: "allowRunningInsecureContent"; revision: 3; type: "bool" }
Property { name: "allowGeolocationOnInsecureOrigins"; revision: 4; type: "bool" }
+ Property { name: "allowWindowActivationFromJavaScript"; revision: 5; type: "bool" }
Signal { name: "fullScreenSupportEnabledChanged"; revision: 1 }
Signal { name: "screenCaptureEnabledChanged"; revision: 2 }
Signal { name: "webGLEnabledChanged"; revision: 2 }
@@ -546,6 +548,7 @@ Module {
Signal { name: "printElementBackgroundsChanged"; revision: 3 }
Signal { name: "allowRunningInsecureContentChanged"; revision: 3 }
Signal { name: "allowGeolocationOnInsecureOriginsChanged"; revision: 4 }
+ Signal { name: "allowWindowActivationFromJavaScriptChanged"; revision: 5 }
}
Component {
name: "QQuickWebEngineSingleton"
@@ -669,7 +672,19 @@ Module {
"Unselect": 29,
"SavePage": 30,
"ViewSource": 31,
- "WebActionCount": 32
+ "ToggleBold": 32,
+ "ToggleItalic": 33,
+ "ToggleUnderline": 34,
+ "ToggleStrikethrough": 35,
+ "AlignLeft": 36,
+ "AlignCenter": 37,
+ "AlignRight": 38,
+ "AlignJustified": 39,
+ "Indent": 40,
+ "Outdent": 41,
+ "InsertOrderedList": 42,
+ "InsertUnorderedList": 43,
+ "WebActionCount": 44
}
}
Enum {
diff --git a/src/webengine/plugin/testsupport/plugin.cpp b/src/webengine/plugin/testsupport/plugin.cpp
index 9352e3666..c7eda2405 100644
--- a/src/webengine/plugin/testsupport/plugin.cpp
+++ b/src/webengine/plugin/testsupport/plugin.cpp
@@ -58,6 +58,8 @@ public:
qmlRegisterType<QQuickWebEngineTestSupport>(uri, 1, 0, "WebEngineTestSupport");
qmlRegisterUncreatableType<QQuickWebEngineErrorPage>(uri, 1, 0, "WebEngineErrorPage",
tr("Cannot create a separate instance of WebEngineErrorPage"));
+ qmlRegisterUncreatableType<QQuickWebEngineTestInputContext>(uri, 1, 0, "TestInputContext",
+ tr("Cannot create a separate instance of WebEngineErrorPage"));
}
};
diff --git a/src/webengine/plugin/testsupport/testsupport.pro b/src/webengine/plugin/testsupport/testsupport.pro
index 1a45ad56a..2804635f8 100644
--- a/src/webengine/plugin/testsupport/testsupport.pro
+++ b/src/webengine/plugin/testsupport/testsupport.pro
@@ -4,7 +4,7 @@ TARGETPATH = QtWebEngine/testsupport
IMPORT_VERSION = 1.0
QT += webengine qml quick
-QT_PRIVATE += webengine-private
+QT_PRIVATE += webengine-private gui-private
INCLUDEPATH += $$QTWEBENGINE_ROOT/src/core $$QTWEBENGINE_ROOT/src/webengine $$QTWEBENGINE_ROOT/src/webengine/api
diff --git a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
index b6069d519..a0ed00918 100644
--- a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
+++ b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
@@ -228,14 +228,15 @@ void RenderWidgetHostViewQtDelegateQuick::resize(int width, int height)
void RenderWidgetHostViewQtDelegateQuick::inputMethodStateChanged(bool editorVisible)
{
- if (qApp->inputMethod()->isVisible() == editorVisible)
- return;
+ setFlag(QQuickItem::ItemAcceptsInputMethod, editorVisible);
+
+ if (parentItem())
+ parentItem()->setFlag(QQuickItem::ItemAcceptsInputMethod, editorVisible);
- if (parentItem() && parentItem()->flags() & QQuickItem::ItemAcceptsInputMethod) {
+ if (qApp->inputMethod()->isVisible() != editorVisible) {
qApp->inputMethod()->update(Qt::ImQueryInput | Qt::ImEnabled | Qt::ImHints);
qApp->inputMethod()->setVisible(editorVisible);
}
-
}
bool RenderWidgetHostViewQtDelegateQuick::event(QEvent *event)
diff --git a/src/webengine/webengine.pro b/src/webengine/webengine.pro
index 5ac93c9a7..f8df714c0 100644
--- a/src/webengine/webengine.pro
+++ b/src/webengine/webengine.pro
@@ -77,7 +77,7 @@ use?(pdf) {
$$python chromium/tools/licenses.py \
--file-template ../../tools/about_credits.tmpl \
--entry-template ../../tools/about_credits_entry.tmpl credits \
- > $$shell_quote($$shell_path($$OUT_PWD/chromium_attributions.qdoc))
+ $$shell_quote($$shell_path($$OUT_PWD/chromium_attributions.qdoc))
chromium_attributions.CONFIG += phony
QMAKE_EXTRA_TARGETS += chromium_attributions
diff --git a/src/webenginewidgets/api/qwebenginecontextmenudata.cpp b/src/webenginewidgets/api/qwebenginecontextmenudata.cpp
index 5d68ed0ec..63e11175b 100644
--- a/src/webenginewidgets/api/qwebenginecontextmenudata.cpp
+++ b/src/webenginewidgets/api/qwebenginecontextmenudata.cpp
@@ -148,10 +148,11 @@ QString QWebEngineContextMenuData::linkText() const
/*!
Returns the URL of a link if the context is a link.
+ It is not guaranteed to be a valid URL.
*/
QUrl QWebEngineContextMenuData::linkUrl() const
{
- return d ? d->linkUrl() : QUrl();
+ return d ? d->unfilteredLinkUrl() : QUrl();
}
/*!
diff --git a/src/webenginewidgets/api/qwebenginedownloaditem.cpp b/src/webenginewidgets/api/qwebenginedownloaditem.cpp
index c1d9a3698..a5569e408 100644
--- a/src/webenginewidgets/api/qwebenginedownloaditem.cpp
+++ b/src/webenginewidgets/api/qwebenginedownloaditem.cpp
@@ -38,10 +38,12 @@
****************************************************************************/
#include "qwebenginedownloaditem.h"
-
#include "qwebenginedownloaditem_p.h"
+
+#include "browser_context_adapter.h"
#include "qwebengineprofile_p.h"
+
QT_BEGIN_NAMESPACE
using QtWebEngineCore::BrowserContextAdapterClient;
@@ -116,6 +118,7 @@ QWebEngineDownloadItemPrivate::QWebEngineDownloadItemPrivate(QWebEngineProfilePr
, type(QWebEngineDownloadItem::Attachment)
, interruptReason(QWebEngineDownloadItem::NoReason)
, downloadUrl(url)
+ , downloadPaused(false)
, totalBytes(-1)
, receivedBytes(0)
{
@@ -145,10 +148,16 @@ void QWebEngineDownloadItemPrivate::update(const BrowserContextAdapterClient::Do
Q_EMIT q->downloadProgress(receivedBytes, totalBytes);
}
- downloadFinished = downloadState != QWebEngineDownloadItem::DownloadInProgress;
+ if (info.done != downloadFinished) {
+ downloadFinished = info.done;
+ if (downloadFinished)
+ Q_EMIT q->finished();
+ }
- if (downloadFinished)
- Q_EMIT q->finished();
+ if (downloadPaused != info.paused) {
+ downloadPaused = info.paused;
+ Q_EMIT q->isPausedChanged(downloadPaused);
+ }
}
/*!
@@ -184,13 +193,50 @@ void QWebEngineDownloadItem::cancel()
|| state == QWebEngineDownloadItem::DownloadCancelled)
return;
- d->downloadState = QWebEngineDownloadItem::DownloadCancelled;
- Q_EMIT stateChanged(d->downloadState);
-
// We directly cancel the download request if the user cancels
// before it even started, so no need to notify the profile here.
if (state == QWebEngineDownloadItem::DownloadInProgress)
- d->profile->cancelDownload(d->downloadId);
+ d->profile->browserContext()->cancelDownload(d->downloadId);
+ else {
+ d->downloadState = QWebEngineDownloadItem::DownloadCancelled;
+ Q_EMIT stateChanged(d->downloadState);
+ }
+}
+
+/*!
+ \since 5.10
+ Pauses the current download. Has no effect if the state is not \c DownloadInProgress.
+
+ \sa resume()
+*/
+
+void QWebEngineDownloadItem::pause()
+{
+ Q_D(QWebEngineDownloadItem);
+
+ QWebEngineDownloadItem::DownloadState state = d->downloadState;
+
+ if (state != QWebEngineDownloadItem::DownloadInProgress)
+ return;
+
+ d->profile->browserContext()->pauseDownload(d->downloadId);
+}
+
+/*!
+ \since 5.10
+ Resumes the current download if it was paused or interrupted.
+
+ \sa pause(), isPaused(), state()
+*/
+void QWebEngineDownloadItem::resume()
+{
+ Q_D(QWebEngineDownloadItem);
+
+ QWebEngineDownloadItem::DownloadState state = d->downloadState;
+
+ if (d->downloadFinished || (state != QWebEngineDownloadItem::DownloadInProgress && state != QWebEngineDownloadItem::DownloadInterrupted))
+ return;
+ d->profile->browserContext()->resumeDownload(d->downloadId);
}
/*!
@@ -206,12 +252,21 @@ quint32 QWebEngineDownloadItem::id() const
/*!
\fn QWebEngineDownloadItem::finished()
- This signal is emitted whenever the download finishes.
+ This signal is emitted when the download finishes.
\sa state(), isFinished()
*/
/*!
+ \fn QWebEngineDownloadItem::isPausedChanged(bool isPaused)
+ \since 5.10
+
+ This signal is emitted whenever \a isPaused changes.
+
+ \sa pause(), isPaused()
+*/
+
+/*!
\fn QWebEngineDownloadItem::stateChanged(DownloadState state)
This signal is emitted whenever the download's \a state changes.
@@ -407,7 +462,7 @@ void QWebEngineDownloadItem::setPath(QString path)
}
/*!
- Returns whether this download is finished (not in progress).
+ Returns whether this download is finished (completed, cancelled, or non-resumable interrupted state).
\sa finished(), state(),
*/
@@ -419,6 +474,18 @@ bool QWebEngineDownloadItem::isFinished() const
}
/*!
+ Returns whether this download is paused.
+
+ \sa pause()
+*/
+
+bool QWebEngineDownloadItem::isPaused() const
+{
+ Q_D(const QWebEngineDownloadItem);
+ return d->downloadPaused;
+}
+
+/*!
Returns the format the web page will be saved in if this is a download request for a web page.
\since 5.7
diff --git a/src/webenginewidgets/api/qwebenginedownloaditem.h b/src/webenginewidgets/api/qwebenginedownloaditem.h
index a4b6c08aa..2aca2bb2a 100644
--- a/src/webenginewidgets/api/qwebenginedownloaditem.h
+++ b/src/webenginewidgets/api/qwebenginedownloaditem.h
@@ -120,6 +120,7 @@ public:
QString path() const;
void setPath(QString path);
bool isFinished() const;
+ bool isPaused() const;
SavePageFormat savePageFormat() const;
void setSavePageFormat(SavePageFormat format);
DownloadType type() const;
@@ -129,11 +130,14 @@ public:
public Q_SLOTS:
void accept();
void cancel();
+ void pause();
+ void resume();
Q_SIGNALS:
void finished();
void stateChanged(QWebEngineDownloadItem::DownloadState state);
void downloadProgress(qint64 bytesReceived, qint64 bytesTotal);
+ void isPausedChanged(bool isPaused);
private:
Q_DISABLE_COPY(QWebEngineDownloadItem)
diff --git a/src/webenginewidgets/api/qwebenginedownloaditem_p.h b/src/webenginewidgets/api/qwebenginedownloaditem_p.h
index 038332da3..da765e5c5 100644
--- a/src/webenginewidgets/api/qwebenginedownloaditem_p.h
+++ b/src/webenginewidgets/api/qwebenginedownloaditem_p.h
@@ -77,6 +77,7 @@ public:
QString downloadPath;
const QUrl downloadUrl;
QString mimeType;
+ bool downloadPaused;
qint64 totalBytes;
qint64 receivedBytes;
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp
index 6042b9fdc..d0305f81a 100644
--- a/src/webenginewidgets/api/qwebenginepage.cpp
+++ b/src/webenginewidgets/api/qwebenginepage.cpp
@@ -60,6 +60,7 @@
#include "render_widget_host_view_qt_delegate_widget.h"
#include "web_contents_adapter.h"
#include "web_engine_settings.h"
+#include "qwebenginescript.h"
#ifdef QT_UI_DELEGATES
#include "ui/messagebubblewidget_p.h"
@@ -352,7 +353,6 @@ void QWebEnginePagePrivate::loadFinished(bool success, const QUrl &url, bool isE
if (isErrorPage) {
Q_ASSERT(settings->testAttribute(QWebEngineSettings::ErrorPageEnabled));
- Q_ASSERT(success);
Q_EMIT q->loadFinished(false);
return;
}
@@ -376,8 +376,10 @@ void QWebEnginePagePrivate::didPrintPageToPdf(const QString &filePath, bool succ
void QWebEnginePagePrivate::focusContainer()
{
- if (view)
+ if (view) {
+ view->activateWindow();
view->setFocus();
+ }
}
void QWebEnginePagePrivate::unhandledKeyEvent(QKeyEvent *event)
@@ -1140,6 +1142,42 @@ QAction *QWebEnginePage::action(WebAction action) const
case ViewSource:
text = tr("&View Page Source");
break;
+ case ToggleBold:
+ text = tr("&Bold");
+ break;
+ case ToggleItalic:
+ text = tr("&Italic");
+ break;
+ case ToggleUnderline:
+ text = tr("&Underline");
+ break;
+ case ToggleStrikethrough:
+ text = tr("&Strikethrough");
+ break;
+ case AlignLeft:
+ text = tr("Align &Left");
+ break;
+ case AlignCenter:
+ text = tr("Align &Center");
+ break;
+ case AlignRight:
+ text = tr("Align &Right");
+ break;
+ case AlignJustified:
+ text = tr("Align &Justified");
+ break;
+ case Indent:
+ text = tr("&Indent");
+ break;
+ case Outdent:
+ text = tr("&Outdent");
+ break;
+ case InsertOrderedList:
+ text = tr("Insert &Ordered List");
+ break;
+ case InsertUnorderedList:
+ text = tr("Insert &Unordered List");
+ break;
case NoWebAction:
case WebActionCount:
Q_UNREACHABLE();
@@ -1229,14 +1267,14 @@ void QWebEnginePage::triggerAction(WebAction action, bool)
}
break;
case CopyLinkToClipboard:
- if (menuData.linkUrl().isValid()) {
- QString urlString = menuData.linkUrl().toString(QUrl::FullyEncoded);
+ if (!menuData.unfilteredLinkUrl().isEmpty()) {
+ QString urlString = menuData.unfilteredLinkUrl().toString(QUrl::FullyEncoded);
QString title = menuData.linkText().toHtmlEscaped();
QMimeData *data = new QMimeData();
data->setText(urlString);
QString html = QStringLiteral("<a href=\"") + urlString + QStringLiteral("\">") + title + QStringLiteral("</a>");
data->setHtml(html);
- data->setUrls(QList<QUrl>() << menuData.linkUrl());
+ data->setUrls(QList<QUrl>() << menuData.unfilteredLinkUrl());
qApp->clipboard()->setMimeData(data);
}
break;
@@ -1341,6 +1379,42 @@ void QWebEnginePage::triggerAction(WebAction action, bool)
// the viewSource() call after the QMenu's destruction.
QTimer::singleShot(0, this, [d](){ d->adapter->viewSource(); });
break;
+ case ToggleBold:
+ runJavaScript(QStringLiteral("document.execCommand('bold');"), QWebEngineScript::ApplicationWorld);
+ break;
+ case ToggleItalic:
+ runJavaScript(QStringLiteral("document.execCommand('italic');"), QWebEngineScript::ApplicationWorld);
+ break;
+ case ToggleUnderline:
+ runJavaScript(QStringLiteral("document.execCommand('underline');"), QWebEngineScript::ApplicationWorld);
+ break;
+ case ToggleStrikethrough:
+ runJavaScript(QStringLiteral("document.execCommand('strikethrough');"), QWebEngineScript::ApplicationWorld);
+ break;
+ case AlignLeft:
+ runJavaScript(QStringLiteral("document.execCommand('justifyLeft');"), QWebEngineScript::ApplicationWorld);
+ break;
+ case AlignCenter:
+ runJavaScript(QStringLiteral("document.execCommand('justifyCenter');"), QWebEngineScript::ApplicationWorld);
+ break;
+ case AlignRight:
+ runJavaScript(QStringLiteral("document.execCommand('justifyRight');"), QWebEngineScript::ApplicationWorld);
+ break;
+ case AlignJustified:
+ runJavaScript(QStringLiteral("document.execCommand('justifyFull');"), QWebEngineScript::ApplicationWorld);
+ break;
+ case Indent:
+ runJavaScript(QStringLiteral("document.execCommand('indent');"), QWebEngineScript::ApplicationWorld);
+ break;
+ case Outdent:
+ runJavaScript(QStringLiteral("document.execCommand('outdent');"), QWebEngineScript::ApplicationWorld);
+ break;
+ case InsertOrderedList:
+ runJavaScript(QStringLiteral("document.execCommand('insertOrderedList');"), QWebEngineScript::ApplicationWorld);
+ break;
+ case InsertUnorderedList:
+ runJavaScript(QStringLiteral("document.execCommand('insertUnorderedList');"), QWebEngineScript::ApplicationWorld);
+ break;
case NoWebAction:
break;
case WebActionCount:
@@ -1605,7 +1679,7 @@ QMenu *QWebEnginePage::createStandardContextMenu()
menu->addAction(QWebEnginePage::action(Unselect));
}
- if (!contextMenuData.linkText().isEmpty() && contextMenuData.linkUrl().isValid()) {
+ if (!contextMenuData.linkText().isEmpty() && !contextMenuData.unfilteredLinkUrl().isEmpty()) {
menu->addAction(QWebEnginePage::action(CopyLinkToClipboard));
}
if (contextMenuData.mediaUrl().isValid()) {
diff --git a/src/webenginewidgets/api/qwebenginepage.h b/src/webenginewidgets/api/qwebenginepage.h
index 5619639c7..74ebd0a35 100644
--- a/src/webenginewidgets/api/qwebenginepage.h
+++ b/src/webenginewidgets/api/qwebenginepage.h
@@ -128,6 +128,22 @@ public:
SavePage,
OpenLinkInNewBackgroundTab,
ViewSource,
+
+ ToggleBold,
+ ToggleItalic,
+ ToggleUnderline,
+ ToggleStrikethrough,
+
+ AlignLeft,
+ AlignCenter,
+ AlignRight,
+ AlignJustified,
+ Indent,
+ Outdent,
+
+ InsertOrderedList,
+ InsertUnorderedList,
+
WebActionCount
};
Q_ENUM(WebAction)
diff --git a/src/webenginewidgets/api/qwebengineprofile.cpp b/src/webenginewidgets/api/qwebengineprofile.cpp
index cd4fc8b02..73998030c 100644
--- a/src/webenginewidgets/api/qwebengineprofile.cpp
+++ b/src/webenginewidgets/api/qwebengineprofile.cpp
@@ -151,7 +151,7 @@ QWebEngineProfilePrivate::QWebEngineProfilePrivate(QSharedPointer<BrowserContext
, m_browserContextRef(browserContext)
{
m_browserContextRef->addClient(this);
- m_settings->d_ptr->initDefaults(browserContext->isOffTheRecord());
+ m_settings->d_ptr->initDefaults();
}
QWebEngineProfilePrivate::~QWebEngineProfilePrivate()
@@ -172,11 +172,6 @@ QWebEngineProfilePrivate::~QWebEngineProfilePrivate()
m_ongoingDownloads.clear();
}
-void QWebEngineProfilePrivate::cancelDownload(quint32 downloadId)
-{
- browserContext()->cancelDownload(downloadId);
-}
-
void QWebEngineProfilePrivate::downloadDestroyed(quint32 downloadId)
{
m_ongoingDownloads.remove(downloadId);
diff --git a/src/webenginewidgets/api/qwebengineprofile_p.h b/src/webenginewidgets/api/qwebengineprofile_p.h
index 4d31c5a81..c5a75f6d4 100644
--- a/src/webenginewidgets/api/qwebengineprofile_p.h
+++ b/src/webenginewidgets/api/qwebengineprofile_p.h
@@ -76,7 +76,6 @@ public:
QSharedPointer<QtWebEngineCore::BrowserContextAdapter> browserContext() const { return m_browserContextRef; }
QWebEngineSettings *settings() const { return m_settings; }
- void cancelDownload(quint32 downloadId);
void downloadDestroyed(quint32 downloadId);
void downloadRequested(DownloadItemInfo &info) Q_DECL_OVERRIDE;
diff --git a/src/webenginewidgets/api/qwebenginesettings.cpp b/src/webenginewidgets/api/qwebenginesettings.cpp
index 65c77a54d..6e24b4b51 100644
--- a/src/webenginewidgets/api/qwebenginesettings.cpp
+++ b/src/webenginewidgets/api/qwebenginesettings.cpp
@@ -97,6 +97,8 @@ static WebEngineSettings::Attribute toWebEngineAttribute(QWebEngineSettings::Web
return WebEngineSettings::AllowRunningInsecureContent;
case QWebEngineSettings::AllowGeolocationOnInsecureOrigins:
return WebEngineSettings::AllowGeolocationOnInsecureOrigins;
+ case QWebEngineSettings::AllowWindowActivationFromJavaScript:
+ return WebEngineSettings::AllowWindowActivationFromJavaScript;
default:
return WebEngineSettings::UnsupportedInCoreSettings;
diff --git a/src/webenginewidgets/api/qwebenginesettings.h b/src/webenginewidgets/api/qwebenginesettings.h
index 73995a457..4b997f0ac 100644
--- a/src/webenginewidgets/api/qwebenginesettings.h
+++ b/src/webenginewidgets/api/qwebenginesettings.h
@@ -89,7 +89,8 @@ public:
FocusOnNavigationEnabled,
PrintElementBackgrounds,
AllowRunningInsecureContent,
- AllowGeolocationOnInsecureOrigins
+ AllowGeolocationOnInsecureOrigins,
+ AllowWindowActivationFromJavaScript
};
enum FontSize {
diff --git a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc
index 715fce6d0..621982951 100644
--- a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc
+++ b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc
@@ -158,6 +158,46 @@
the web page on disk. (Added in Qt 5.7)
\value ViewSource Show the source of the current page in a new tab. (Added in Qt 5.8)
+ \value ToggleBold
+ Toggles boldness for the selection or at the cursor position.
+ Requires \c contenteditable="true". (Added in Qt 5.10)
+ \value ToggleItalic
+ Toggles italics for the selection or at the cursor position.
+ Requires \c contenteditable="true". (Added in Qt 5.10)
+ \value ToggleUnderline
+ Toggles underlining of the selection or at the cursor position.
+ Requires \c contenteditable="true". (Added in Qt 5.10)
+ \value ToggleStrikethrough
+ Toggles striking through the selection or at the cursor position.
+ Requires \c contenteditable="true". (Added in Qt 5.10)
+
+ \value AlignLeft
+ Aligns the lines containing the selection or the cursor to the left.
+ Requires \c contenteditable="true". (Added in Qt 5.10)
+ \value AlignCenter
+ Aligns the lines containing the selection or the cursor at the center.
+ Requires \c contenteditable="true". (Added in Qt 5.10)
+ \value AlignRight
+ Aligns the lines containing the selection or the cursor to the right.
+ Requires \c contenteditable="true". (Added in Qt 5.10)
+ \value AlignJustified
+ Stretches the lines containing the selection or the cursor so that each
+ line has equal width.
+ Requires \c contenteditable="true". (Added in Qt 5.10)
+ \value Indent
+ Indents the lines containing the selection or the cursor.
+ Requires \c contenteditable="true". (Added in Qt 5.10)
+ \value Outdent
+ Outdents the lines containing the selection or the cursor.
+ Requires \c contenteditable="true". (Added in Qt 5.10)
+
+ \value InsertOrderedList
+ Inserts an ordered list at the current cursor position, deleting the current selection.
+ Requires \c contenteditable="true". (Added in Qt 5.10)
+ \value InsertUnorderedList
+ Inserts an unordered list at the current cursor position,
+ deleting the current selection.
+ Requires \c contenteditable="true". (Added in Qt 5.10)
\omitvalue WebActionCount
*/
diff --git a/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc
index d26babd5a..26f3964da 100644
--- a/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc
+++ b/src/webenginewidgets/doc/src/qwebenginesettings_lgpl.qdoc
@@ -162,6 +162,9 @@
Geolocation features. This provides an override to allow non secure
origins to access Geolocation again.
Disabled by default. (Added in Qt 5.9)
+ \value AllowWindowActivationFromJavaScript
+ Allows the window.focus() method in JavaScript. Disallowed by default.
+ (Added in Qt 5.10)
*/
diff --git a/src/webenginewidgets/ui/messagebubblewidget.cpp b/src/webenginewidgets/ui/messagebubblewidget.cpp
index 4a53a421f..70dada0c4 100644
--- a/src/webenginewidgets/ui/messagebubblewidget.cpp
+++ b/src/webenginewidgets/ui/messagebubblewidget.cpp
@@ -41,6 +41,7 @@
#include "api/qwebengineview.h"
+#include <qglobal.h>
#include <QBitmap>
#include <QHBoxLayout>
#include <QIcon>
diff --git a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp
index 89ebbac62..daf4d811e 100644
--- a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp
+++ b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp
@@ -106,6 +106,7 @@ void tst_QWebEngineUrlRequestInterceptor::interceptRequest()
{
QWebEngineView view;
TestRequestInterceptor interceptor(/* intercept */ true);
+ view.page()->settings()->setAttribute(QWebEngineSettings::ErrorPageEnabled, false);
QSignalSpy loadSpy(&view, SIGNAL(loadFinished(bool)));
view.page()->profile()->setRequestInterceptor(&interceptor);
@@ -193,21 +194,19 @@ void tst_QWebEngineUrlRequestInterceptor::requestedUrl()
page.setUrl(QUrl("qrc:///resources/__placeholder__"));
QVERIFY(spy.wait());
- QCOMPARE(spy.count(), 1);
+ QTRY_COMPARE(spy.count(), 1);
QCOMPARE(interceptor.observedUrls.at(0), QUrl("qrc:///resources/content.html"));
QCOMPARE(page.requestedUrl(), QUrl("qrc:///resources/__placeholder__"));
QCOMPARE(page.url(), QUrl("qrc:///resources/content.html"));
page.setUrl(QUrl("qrc:/non-existent.html"));
- QVERIFY(spy.wait());
- QCOMPARE(spy.count(), 2);
+ QTRY_COMPARE(spy.count(), 2);
QCOMPARE(interceptor.observedUrls.at(2), QUrl("qrc:/non-existent.html"));
QCOMPARE(page.requestedUrl(), QUrl("qrc:///resources/__placeholder__"));
QCOMPARE(page.url(), QUrl("qrc:///resources/content.html"));
page.setUrl(QUrl("http://abcdef.abcdef"));
- QVERIFY(spy.wait());
- QCOMPARE(spy.count(), 3);
+ QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 3, 12000);
QCOMPARE(interceptor.observedUrls.at(3), QUrl("http://abcdef.abcdef/"));
QCOMPARE(page.requestedUrl(), QUrl("qrc:///resources/__placeholder__"));
QCOMPARE(page.url(), QUrl("qrc:///resources/content.html"));
diff --git a/tests/auto/quick/qmltests/data/tst_favicon.qml b/tests/auto/quick/qmltests/data/tst_favicon.qml
index f8ad998ef..ea474e0dc 100644
--- a/tests/auto/quick/qmltests/data/tst_favicon.qml
+++ b/tests/auto/quick/qmltests/data/tst_favicon.qml
@@ -152,6 +152,7 @@ TestWebEngineView {
var url = Qt.resolvedUrl("invalid://url")
webEngineView.url = url
+ verify(webEngineView.waitForLoadFailed())
verify(webEngineView.testSupport.waitForErrorPageLoadSucceeded())
compare(iconChangedSpy.count, 0)
diff --git a/tests/auto/quick/qmltests/data/tst_inputMethod.qml b/tests/auto/quick/qmltests/data/tst_inputMethod.qml
new file mode 100644
index 000000000..c09a8bdd9
--- /dev/null
+++ b/tests/auto/quick/qmltests/data/tst_inputMethod.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtTest 1.0
+import QtWebEngine 1.4
+import QtWebEngine.testsupport 1.0
+
+TestWebEngineView {
+ id: webEngineView
+ width: 200
+ height: 400
+
+ testSupport: WebEngineTestSupport { }
+
+ TestCase {
+ name: "WebEngineViewInputMethod"
+ when: windowShown
+
+ function init() {
+ testSupport.testInputContext.create();
+ }
+
+ function cleanup() {
+ testSupport.testInputContext.release();
+ }
+
+ function test_softwareInputPanel() {
+ verify(!Qt.inputMethod.visible);
+ webEngineView.loadHtml(
+ "<html><body>" +
+ " <form><input id='textInput' type='text' /></form>" +
+ "</body></html");
+ verify(webEngineView.waitForLoadSucceeded());
+
+ verify(!getActiveElementId());
+ verify(!Qt.inputMethod.visible);
+
+ // Show input panel
+ webEngineView.runJavaScript("document.getElementById('textInput').focus()");
+ webEngineView.verifyElementHasFocus("textInput");
+ tryVerify(function() { return Qt.inputMethod.visible; });
+
+ // Hide input panel
+ webEngineView.runJavaScript("document.getElementById('textInput').blur()");
+ verify(!getActiveElementId());
+ tryVerify(function() { return !Qt.inputMethod.visible; });
+ }
+ }
+}
+
diff --git a/tests/auto/quick/qmltests/data/tst_loadUrl.qml b/tests/auto/quick/qmltests/data/tst_loadUrl.qml
index 2cb9f6b81..84509eb01 100644
--- a/tests/auto/quick/qmltests/data/tst_loadUrl.qml
+++ b/tests/auto/quick/qmltests/data/tst_loadUrl.qml
@@ -217,7 +217,7 @@ TestWebEngineView {
}
webEngineView.loadingChanged.connect(handleLoadFailed);
webEngineView.url = bogusSite
- tryCompare(loadRequestArray, "length", 4, 12000);
+ tryCompare(loadRequestArray, "length", 5, 12000);
webEngineView.loadingChanged.disconnect(handleLoadFailed);
loadRequest = loadRequestArray[0];
@@ -231,7 +231,12 @@ TestWebEngineView {
loadRequest = loadRequestArray[2];
compare(loadRequest.status, WebEngineView.LoadStartedStatus);
compare(loadRequest.activeUrl, aboutBlank);
+ // FIXME: This 4th request probably shouldn't be here as it an error-page of sorts in dataUrl form
+ // Appeared with Chromium 58
loadRequest = loadRequestArray[3];
+ compare(loadRequest.status, WebEngineView.LoadStartedStatus);
+ compare(loadRequest.activeUrl, aboutBlank);
+ loadRequest = loadRequestArray[4];
compare(loadRequest.status, WebEngineView.LoadSucceededStatus);
compare(loadRequest.activeUrl, bogusSite);
webEngineView.clear();
diff --git a/tests/auto/quick/qmltests/qmltests.pro b/tests/auto/quick/qmltests/qmltests.pro
index e7c5ededc..d2c9245bd 100644
--- a/tests/auto/quick/qmltests/qmltests.pro
+++ b/tests/auto/quick/qmltests/qmltests.pro
@@ -52,6 +52,7 @@ OTHER_FILES += \
$$PWD/data/tst_focusOnNavigation.qml \
$$PWD/data/tst_formValidation.qml \
$$PWD/data/tst_geopermission.qml \
+ $$PWD/data/tst_inputMethod.qml \
$$PWD/data/tst_javaScriptDialogs.qml \
$$PWD/data/tst_linkHovered.qml \
$$PWD/data/tst_loadFail.qml \
diff --git a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
index 2f9063ea5..8af5a2808 100644
--- a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
+++ b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp
@@ -36,6 +36,7 @@
#include <QtTest/QtTest>
#include <QtWebEngine/QQuickWebEngineProfile>
#include <private/qquickwebengineview_p.h>
+#include <private/qquickwebenginesettings_p.h>
#include <functional>
@@ -383,7 +384,8 @@ void tst_QQuickWebEngineView::titleUpdate()
titleSpy.clear();
- // No titleChanged signal for failed load
+ // No titleChanged signal for failed load (with no error-page)
+ webEngineView()->settings()->setErrorPageEnabled(false);
webEngineView()->setUrl(urlFromTestPath("html/file_that_does_not_exist.html"));
QVERIFY(waitForLoadFailed(webEngineView()));
QCOMPARE(titleSpy.size(), 0);
@@ -435,50 +437,69 @@ void tst_QQuickWebEngineView::transparentWebEngineViews()
void tst_QQuickWebEngineView::inputMethod()
{
-#if !defined(QQUICKWEBENGINEVIEW_ITEMACCEPTSINPUTMETHOD)
- QSKIP("QQUICKWEBENGINEVIEW_ITEMACCEPTSINPUTMETHOD");
-#else
+ m_window->show();
+ QTRY_VERIFY(qApp->focusObject());
+ QQuickItem *input;
+
QQuickWebEngineView *view = webEngineView();
view->setUrl(urlFromTestPath("html/inputmethod.html"));
QVERIFY(waitForLoadSucceeded(view));
+ input = qobject_cast<QQuickItem *>(qApp->focusObject());
+ QVERIFY(!input->flags().testFlag(QQuickItem::ItemAcceptsInputMethod));
QVERIFY(!view->flags().testFlag(QQuickItem::ItemAcceptsInputMethod));
+
runJavaScript("document.getElementById('inputField').focus();");
+ QTRY_COMPARE(activeElementId(view), QStringLiteral("inputField"));
+ input = qobject_cast<QQuickItem *>(qApp->focusObject());
+ QTRY_VERIFY(input->flags().testFlag(QQuickItem::ItemAcceptsInputMethod));
QVERIFY(view->flags().testFlag(QQuickItem::ItemAcceptsInputMethod));
+
runJavaScript("document.getElementById('inputField').blur();");
+ QTRY_VERIFY(activeElementId(view).isEmpty());
+ input = qobject_cast<QQuickItem *>(qApp->focusObject());
+ QTRY_VERIFY(!input->flags().testFlag(QQuickItem::ItemAcceptsInputMethod));
QVERIFY(!view->flags().testFlag(QQuickItem::ItemAcceptsInputMethod));
-#endif
}
void tst_QQuickWebEngineView::inputMethodHints()
{
-#if !defined(QQUICKWEBENGINEVIEW_ITEMACCEPTSINPUTMETHOD)
- QSKIP("QQUICKWEBENGINEVIEW_ITEMACCEPTSINPUTMETHOD");
-#else
- QQuickWebEngineView *view = webEngineView();
+ m_window->show();
+ QTRY_VERIFY(qApp->focusObject());
+ QQuickItem *input;
+ QQuickWebEngineView *view = webEngineView();
view->setUrl(urlFromTestPath("html/inputmethod.html"));
QVERIFY(waitForLoadSucceeded(view));
+ // Initialize input fields with values to check input method query is being updated.
+ runJavaScript("document.getElementById('emailInputField').value = 'a@b.com';");
+ runJavaScript("document.getElementById('editableDiv').innerText = 'bla';");
+
// Setting focus on an input element results in an element in its shadow tree becoming the focus node.
// Input hints should not be set from this shadow tree node but from the input element itself.
runJavaScript("document.getElementById('emailInputField').focus();");
+ QTRY_COMPARE(activeElementId(view), QStringLiteral("emailInputField"));
+ input = qobject_cast<QQuickItem *>(qApp->focusObject());
+ QTRY_COMPARE(input->inputMethodQuery(Qt::ImSurroundingText).toString(), QString("a@b.com"));
+ QVERIFY(input->flags().testFlag(QQuickItem::ItemAcceptsInputMethod));
QVERIFY(view->flags().testFlag(QQuickItem::ItemAcceptsInputMethod));
QInputMethodQueryEvent query(Qt::ImHints);
- QGuiApplication::sendEvent(view, &query);
- Qt::InputMethodHints hints(query.value(Qt::ImHints).toUInt() & Qt::ImhExclusiveInputMask);
- QCOMPARE(hints, Qt::ImhEmailCharactersOnly);
+ QGuiApplication::sendEvent(input, &query);
+ QTRY_COMPARE(Qt::InputMethodHints(query.value(Qt::ImHints).toUInt() & Qt::ImhExclusiveInputMask), Qt::ImhEmailCharactersOnly);
// The focus of an editable DIV is given directly to it, so no shadow root element
// is necessary. This tests the WebPage::editorState() method ability to get the
// right element without breaking.
runJavaScript("document.getElementById('editableDiv').focus();");
+ QTRY_COMPARE(activeElementId(view), QStringLiteral("editableDiv"));
+ input = qobject_cast<QQuickItem *>(qApp->focusObject());
+ QTRY_COMPARE(input->inputMethodQuery(Qt::ImSurroundingText).toString(), QString("bla"));
+ QVERIFY(input->flags().testFlag(QQuickItem::ItemAcceptsInputMethod));
QVERIFY(view->flags().testFlag(QQuickItem::ItemAcceptsInputMethod));
query = QInputMethodQueryEvent(Qt::ImHints);
- QGuiApplication::sendEvent(view, &query);
- hints = Qt::InputMethodHints(query.value(Qt::ImHints).toUInt());
- QCOMPARE(hints, Qt::ImhNone);
-#endif
+ QGuiApplication::sendEvent(input, &query);
+ QTRY_COMPARE(Qt::InputMethodHints(query.value(Qt::ImHints).toUInt()), Qt::ImhPreferLowercase | Qt::ImhMultiLine);
}
void tst_QQuickWebEngineView::setZoomFactor()
diff --git a/tests/auto/quick/qquickwebengineviewgraphics/qquickwebengineviewgraphics.pro b/tests/auto/quick/qquickwebengineviewgraphics/qquickwebengineviewgraphics.pro
index 9471def00..2a2155e44 100644
--- a/tests/auto/quick/qquickwebengineviewgraphics/qquickwebengineviewgraphics.pro
+++ b/tests/auto/quick/qquickwebengineviewgraphics/qquickwebengineviewgraphics.pro
@@ -1,4 +1,4 @@
include(../tests.pri)
CONFIG -= testcase # remove, once this passes in the CI
exists($${TARGET}.qrc):RESOURCES += $${TARGET}.qrc
-QT_PRIVATE += webengine-private
+QT_PRIVATE += webengine-private gui-private
diff --git a/tests/auto/quick/shared/util.h b/tests/auto/quick/shared/util.h
index dce0afb8e..98f19bd49 100644
--- a/tests/auto/quick/shared/util.h
+++ b/tests/auto/quick/shared/util.h
@@ -142,4 +142,26 @@ inline QString bodyInnerText(QQuickWebEngineView *webEngineView)
return arguments.at(1).toString();
}
+inline QString activeElementId(QQuickWebEngineView *webEngineView)
+{
+ qRegisterMetaType<QQuickWebEngineView::JavaScriptConsoleMessageLevel>("JavaScriptConsoleMessageLevel");
+ QSignalSpy consoleMessageSpy(webEngineView, &QQuickWebEngineView::javaScriptConsoleMessage);
+
+ webEngineView->runJavaScript(
+ "if (document.activeElement == null)"
+ " console.log('');"
+ "else"
+ " console.log(document.activeElement.id);"
+ );
+
+ if (!consoleMessageSpy.wait())
+ return QString();
+
+ QList<QVariant> arguments = consoleMessageSpy.takeFirst();
+ if (static_cast<QQuickWebEngineView::JavaScriptConsoleMessageLevel>(arguments.at(0).toInt()) != QQuickWebEngineView::InfoMessageLevel)
+ return QString();
+
+ return arguments.at(1).toString();
+}
+
#endif /* UTIL_H */
diff --git a/tests/auto/widgets/qwebengineaccessibility/tst_qwebengineaccessibility.cpp b/tests/auto/widgets/qwebengineaccessibility/tst_qwebengineaccessibility.cpp
index 3d2c04486..29f10ef3b 100644
--- a/tests/auto/widgets/qwebengineaccessibility/tst_qwebengineaccessibility.cpp
+++ b/tests/auto/widgets/qwebengineaccessibility/tst_qwebengineaccessibility.cpp
@@ -40,6 +40,8 @@ private Q_SLOTS:
void hierarchy();
void text();
void value();
+ void roles_data();
+ void roles();
};
// This will be called before the first test function is executed.
@@ -248,6 +250,150 @@ void tst_QWebEngineAccessibility::value()
QCOMPARE(progressBarValueInterface->maximumValue().toInt(), 99);
}
+void tst_QWebEngineAccessibility::roles_data()
+{
+ QTest::addColumn<QString>("html");
+ QTest::addColumn<bool>("isSection");
+ QTest::addColumn<QAccessible::Role>("role");
+
+ QTest::newRow("AX_ROLE_ALERT") << QString("<div role='alert'>alert</div>") << true << QAccessible::AlertMessage;
+ QTest::newRow("AX_ROLE_ALERT_DIALOG") << QString("<div role='alertdialog'>alert</div>") << true << QAccessible::AlertMessage;
+ QTest::newRow("AX_ROLE_ANNOTATION") << QString("<rt>a</rt>") << false << QAccessible::StaticText;
+ QTest::newRow("AX_ROLE_APPLICATION") << QString("<div role='application'>landmark</div>") << true << QAccessible::Document;
+ QTest::newRow("AX_ROLE_ARTICLE") << QString("<article>a</article>") << true << QAccessible::Section;
+ QTest::newRow("AX_ROLE_BANNER") << QString("<header>a</header>") << true << QAccessible::Section;
+ QTest::newRow("AX_ROLE_BLOCKQUOTE") << QString("<blockquote>a</blockquote>") << true << QAccessible::Section;
+ //QTest::newRow("AX_ROLE_BUSY_INDICATOR"); // Deprecated
+ QTest::newRow("AX_ROLE_BUTTON") << QString("<button>a</button>") << false << QAccessible::Button;
+ //QTest::newRow("AX_ROLE_BUTTON_DROP_DOWN"); // Not a blink accessibility role
+ //QTest::newRow("AX_ROLE_CANVAS") << QString("<canvas width='10' height='10'></canvas>") << true << QAccessible::Canvas; // FIXME: The test case might be wrong (see AXLayoutObject.cpp)
+ //QTest::newRow("AX_ROLE_CELL") << QString("<td role='cell'>a</td>") << true << QAccessible::Cell; // FIXME: Aria role 'cell' should work for <td>
+ QTest::newRow("AX_ROLE_CHECK_BOX") << QString("<input type='checkbox'>a</input>") << false << QAccessible::CheckBox;
+ QTest::newRow("AX_ROLE_CLIENT") << QString("") << true << QAccessible::Client;
+ QTest::newRow("AX_ROLE_COLOR_WELL") << QString("<input type='color'>a</input>") << false << QAccessible::ColorChooser;
+ //QTest::newRow("AX_ROLE_COLUMN") << QString("<table><tr><td>a</td></tr>") << true << QAccessible::Column; // FIXME: The test case might be wrong (see AXTableColumn.h)
+ QTest::newRow("AX_ROLE_COLUMN_HEADER") << QString("<div role='columnheader'>a</div>") << true << QAccessible::ColumnHeader;
+ QTest::newRow("AX_ROLE_COMBO_BOX") << QString("<select><option>a</option></select>") << false << QAccessible::ComboBox;
+ QTest::newRow("AX_ROLE_COMPLEMENTARY") << QString("<aside>a</aside>") << true << QAccessible::ComplementaryContent;
+ QTest::newRow("AX_ROLE_CONTENT_INFO") << QString("<address>a</address>") << true << QAccessible::Section;
+ QTest::newRow("AX_ROLE_DEFINITION") << QString("<div role='definition'>landmark</div>") << true << QAccessible::Paragraph;
+ QTest::newRow("AX_ROLE_DESCRIPTION_LIST_DETAIL") << QString("<dd>a</dd>") << true << QAccessible::Paragraph;
+ QTest::newRow("AX_ROLE_DESCRIPTION_LIST_TERM") << QString("<dt>a</dt>") << true << QAccessible::ListItem;
+ //QTest::newRow("AX_ROLE_DESKTOP"); // Not a blink accessibility role
+ QTest::newRow("AX_ROLE_DIALOG") << QString("<div role='dialog'></div>") << true << QAccessible::Dialog;
+ //QTest::newRow("AX_ROLE_DIRECTORY") << QString("<div role='directory'></div>") << true << QAccessible::NoRole; // FIXME: Aria role 'directory' should work
+ QTest::newRow("AX_ROLE_DISCLOSURE_TRIANGLE") << QString("<details><summary>a</summary></details>") << true << QAccessible::NoRole;
+ QTest::newRow("AX_ROLE_DIV") << QString("<div>a</div>") << true << QAccessible::Section;
+ QTest::newRow("AX_ROLE_DOCUMENT") << QString("<div role='document'>a</div>") << true << QAccessible::Document;
+ QTest::newRow("AX_ROLE_EMBEDDED_OBJECT") << QString("<object width='10' height='10'></object>") << false << QAccessible::Grouping;
+ QTest::newRow("AX_ROLE_FOOTER") << QString("<footer>a</footer>") << true << QAccessible::Footer;
+ QTest::newRow("AX_ROLE_FORM") << QString("<form></form>") << true << QAccessible::Form;
+ QTest::newRow("AX_ROLE_GRID") << QString("<div role='grid'></div>") << true << QAccessible::Table;
+ QTest::newRow("AX_ROLE_GROUP") << QString("<fieldset></fieldset>") << true << QAccessible::Grouping;
+ QTest::newRow("AX_ROLE_HEADING") << QString("<h1>a</h1>") << true << QAccessible::Heading;
+ QTest::newRow("AX_ROLE_IFRAME") << QString("<iframe>a</iframe>") << true << QAccessible::Grouping;
+ //QTest::newRow("AX_ROLE_IGNORED") << QString("<tag>a</tag>") << true << QAccessible::NoRole; // FIXME: The HTML element should not be exposed as an element (see AXNodeObject.cpp)
+ QTest::newRow("AX_ROLE_IMAGE") << QString("<img>") << false << QAccessible::Graphic;
+ //QTest::newRow("AX_ROLE_IMAGE_MAP") << QString("<map>a</map>") << true << QAccessible::Graphic; // FIXME: The test case might be wrong (see AXLayoutObject.cpp)
+ //QTest::newRow("AX_ROLE_IMAGE_MAP_LINK") << QString("<map>a</map>") << true << QAccessible::Graphic; // FIXME: The test case might be wrong (see AXLayoutObject.cpp)
+ QTest::newRow("AX_ROLE_INLINE_TEXT_BOX") << QString("<textarea rows='4' cols='50'></textarea>") << false << QAccessible::EditableText;
+ QTest::newRow("AX_ROLE_LABEL_TEXT") << QString("<label>a</label>") << false << QAccessible::StaticText;
+ QTest::newRow("AX_ROLE_LEGEND") << QString("<legend>a</legend>") << true << QAccessible::StaticText;
+ QTest::newRow("AX_ROLE_LINK") << QString("<a href=''>link</a>") << false << QAccessible::Link;
+ QTest::newRow("AX_ROLE_LIST") << QString("<ul></ul>") << true << QAccessible::List;
+ QTest::newRow("AX_ROLE_LIST_BOX") << QString("<select role='listbox'></select>") << false << QAccessible::ComboBox;
+ QTest::newRow("AX_ROLE_LIST_BOX_OPTION") << QString("<option>a</option>") << true << QAccessible::ListItem;
+ QTest::newRow("AX_ROLE_LIST_ITEM") << QString("<li>a</li>") << true << QAccessible::ListItem;
+ QTest::newRow("AX_ROLE_LIST_MARKER") << QString("<li><ul></ul></li>") << false << QAccessible::StaticText;
+ //QTest::newRow("AX_ROLE_LOCATION_BAR"); // Not a blink accessibility role
+ QTest::newRow("AX_ROLE_LOG") << QString("<div role='log'>a</div>") << true << QAccessible::Section;
+ QTest::newRow("AX_ROLE_MAIN") << QString("<main>a</main>") << true << QAccessible::Grouping;
+ QTest::newRow("AX_ROLE_MARQUEE") << QString("<div role='marquee'>a</div>") << true << QAccessible::Section;
+ QTest::newRow("AX_ROLE_MATH") << QString("<math>a</math>") << false << QAccessible::Equation;
+ QTest::newRow("AX_ROLE_MENU") << QString("<div role='menu'>a</div>") << true << QAccessible::PopupMenu;
+ QTest::newRow("AX_ROLE_MENU_BAR") << QString("<div role='menubar'>a</div>") << true << QAccessible::MenuBar;
+ QTest::newRow("AX_ROLE_MENU_ITEM") << QString("<menu role='menu'><input type='button' /></menu>") << false << QAccessible::MenuItem;
+ QTest::newRow("AX_ROLE_MENU_BUTTON") << QString("<menu role='group'><div role='menuitem'>a</div></menu>") << false << QAccessible::MenuItem;
+ //QTest::newRow("AX_ROLE_MENU_LIST_OPTION") << QString("<select role='menu'><option>a</option></select>") << false << QAccessible::MenuItem; // FIXME: <select> should be a menu list (see AXMenuListOption.cpp)
+ //QTest::newRow("AX_ROLE_MENU_LIST_POPUP") << QString("<menu type='context'>a</menu>") << true << QAccessible::PopupMenu; // FIXME: <menu> is not fully supported by Chromium (see AXMenuListPopup.h)
+ QTest::newRow("AX_ROLE_NAVIGATION") << QString("<nav>a</nav>") << true << QAccessible::Section;
+ QTest::newRow("AX_ROLE_NOTE") << QString("<div role='note'>a</div>") << true << QAccessible::Note;
+ //QTest::newRow("AX_ROLE_OUTLINE"); // No mapping to ARIA role
+ //QTest::newRow("AX_ROLE_PANE"); // Not a blink accessibility role
+ QTest::newRow("AX_ROLE_PARAGRAH") << QString("<p>a</p>") << true << QAccessible::Paragraph;
+ QTest::newRow("AX_ROLE_POP_UP_BUTTON") << QString("<select multiple></select>") << false << QAccessible::ComboBox;
+ QTest::newRow("AX_ROLE_PRE") << QString("<pre>a</pre>") << true << QAccessible::Section;
+ //QTest::newRow("AX_ROLE_PRESENTATIONAL") << QString("<div role='presentation'>a</div>") << true << QAccessible::NoRole; // FIXME: Aria role 'presentation' should work
+ QTest::newRow("AX_ROLE_PROGRESS_INDICATOR") << QString("<div role='progressbar' aria-valuenow='77' aria-valuemin='22' aria-valuemax='99'></div>") << true << QAccessible::ProgressBar;
+ QTest::newRow("AX_ROLE_RADIO_BUTTON") << QString("<input type='radio'></input>") << false << QAccessible::RadioButton;
+ QTest::newRow("AX_ROLE_RADIO_GROUP") << QString("<fieldset role='radiogroup'></fieldset>") << true << QAccessible::Grouping;
+ QTest::newRow("AX_ROLE_REGION") << QString("<section>a</section>") << true << QAccessible::Section;
+ //QTest::newRow("AX_ROLE_ROW") << QString("<tr role='row'>a</tr>") << true << QAccessible::Row; // FIXME: Aria role 'row' should work for <tr>
+ //QTest::newRow("AX_ROLE_ROW_HEADER") << QString("<td role='rowheader'>a</td>") << true << QAccessible::RowHeader; // FIXME: Aria role 'rowheader' should work for <td>
+ //QTest::newRow("AX_ROLE_RULER"); // No mapping to ARIA role
+ //QTest::newRow("AX_ROLE_SCROLL_AREA"); // No mapping to ARIA role
+ QTest::newRow("AX_ROLE_SCROLL_BAR") << QString("<div role='scrollbar'>a</a>") << true << QAccessible::ScrollBar;
+ //QTest::newRow("AX_ROLE_SEAMLESS_WEB_AREA"); // No mapping to ARIA role
+ QTest::newRow("AX_ROLE_SEARCH") << QString("<div role='search'>landmark</div>") << true << QAccessible::Section;
+ QTest::newRow("AX_ROLE_SLIDER") << QString("<input type='range'></input>") << false << QAccessible::Slider;
+ //QTest::newRow("AX_ROLE_SLIDER_THUMB"); // No mapping to ARIA role
+ QTest::newRow("AX_ROLE_SPIN_BUTTON") << QString("<input type='number'></input>") << false << QAccessible::SpinBox;
+ //QTest::newRow("AX_ROLE_SPIN_BUTTON_PART"); // No mapping to ARIA role
+ QTest::newRow("AX_ROLE_SPLITER") << QString("<hr>") << true << QAccessible::Splitter;
+ QTest::newRow("AX_ROLE_STATIC_TEXT") << QString("a") << false << QAccessible::StaticText;
+ QTest::newRow("AX_ROLE_STATUS") << QString("<output>a</output>") << false << QAccessible::Indicator;
+ QTest::newRow("AX_ROLE_SVG_ROOT") << QString("<svg width='10' height='10'></svg>") << false << QAccessible::Graphic;
+ //QTest::newRow("AX_ROLE_TABLE") << QString("<table>a</table>") << true << QAccessible::Table; // FIXME: The test case might be wrong (see AXTable.cpp)
+ //QTest::newRow("AX_ROLE_TABLE_HEADER_CONTAINER"); // No mapping to ARIA role
+ QTest::newRow("AX_ROLE_TAB") << QString("<div role='tab'>a</div>") << true << QAccessible::PageTab;
+ //QTest::newRow("AX_ROLE_TAB_GROUP"); // No mapping to ARIA role
+ QTest::newRow("AX_ROLE_TAB_LIST") << QString("<div role='tablist'>a</div>") << true << QAccessible::PageTabList;
+ QTest::newRow("AX_ROLE_TAB_PANEL") << QString("<div role='tab'>a</div>") << true << QAccessible::PageTab;
+ QTest::newRow("AX_ROLE_TEXT_FIELD") << QString("<input type='text'></input>") << false << QAccessible::EditableText;
+ QTest::newRow("AX_ROLE_TIMER") << QString("<div role='timer'>a</div>") << true << QAccessible::Clock;
+ //QTest::newRow("AX_ROLE_TITLE_BAR"); // Not a blink accessibility role
+ QTest::newRow("AX_ROLE_TOGGLE_BUTTON") << QString("<button aria-pressed='false'>a</button>") << false << QAccessible::Button;
+ QTest::newRow("AX_ROLE_TOOLBAR") << QString("<div role='toolbar'>a</div>") << true << QAccessible::ToolBar;
+ QTest::newRow("AX_ROLE_TOOLTIP") << QString("<div role='tooltip'>a</div>") << true << QAccessible::ToolTip;
+ QTest::newRow("AX_ROLE_TREE") << QString("<div role='tree'>a</div>") << true << QAccessible::Tree;
+ //QTest::newRow("AX_ROLE_TREE_GRID") << QString("<div role='treegrid'>a</div>") << true << QAccessible::Tree; // FIXME: Aria role 'treegrid' should work
+ QTest::newRow("AX_ROLE_TREE_ITEM") << QString("<div role='treeitem'>a</div>") << true << QAccessible::TreeItem;
+ //QTest::newRow("AX_ROLE_WINDOW"); // No mapping to ARIA role
+}
+
+void tst_QWebEngineAccessibility::roles()
+{
+ QFETCH(QString, html);
+ QFETCH(bool, isSection);
+ QFETCH(QAccessible::Role, role);
+
+ QWebEngineView webView;
+ webView.setHtml("<html><body>" + html + "</body></html>");
+ QSignalSpy spyFinished(&webView, &QWebEngineView::loadFinished);
+ QVERIFY(spyFinished.wait());
+
+ QAccessibleInterface *view = QAccessible::queryAccessibleInterface(&webView);
+
+ // Corner case for Client role
+ if (html.isEmpty()) {
+ QCOMPARE(view->role(), QAccessible::Client);
+ return;
+ }
+
+ QTRY_COMPARE(view->child(0)->childCount(), 1);
+ QAccessibleInterface *document = view->child(0);
+ QAccessibleInterface *section = document->child(0);
+
+ if (isSection) {
+ QCOMPARE(section->role(), role);
+ return;
+ }
+
+ QVERIFY(section->childCount() > 0);
+ QAccessibleInterface *element = section->child(0);
+ QCOMPARE(element->role(), role);
+}
+
static QByteArrayList params = QByteArrayList()
<< "--force-renderer-accessibility";
diff --git a/tests/auto/widgets/qwebenginepage/BLACKLIST b/tests/auto/widgets/qwebenginepage/BLACKLIST
index b376cd375..7470a1523 100644
--- a/tests/auto/widgets/qwebenginepage/BLACKLIST
+++ b/tests/auto/widgets/qwebenginepage/BLACKLIST
@@ -7,8 +7,6 @@
[macCopyUnicodeToClipboard]
osx
-[getUserMediaRequest]
-*
[mouseMovementProperties]
osx-10.11
osx-10.12
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index bef77d3f1..cd80db9a3 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -4090,10 +4090,10 @@ void tst_QWebEnginePage::toPlainTextLoadFinishedRace()
QVERIFY(s.contains("foobarbaz") == !enableErrorPage);
page->load(QUrl("data:text/plain,lalala"));
- QTRY_VERIFY(spy.count() == 3);
- QCOMPARE(toPlainTextSync(page.data()), QString("lalala"));
+ QTRY_COMPARE(spy.count(), 3);
+ QTRY_COMPARE(toPlainTextSync(page.data()), QString("lalala"));
page.reset();
- QVERIFY(spy.count() == 3);
+ QCOMPARE(spy.count(), 3);
}
void tst_QWebEnginePage::setZoomFactor()
diff --git a/tests/auto/widgets/qwebenginespellcheck/dict/de-DE.dic b/tests/auto/widgets/qwebenginespellcheck/dict/de-DE.dic
index d10ae2600..a57ab15b4 100644
--- a/tests/auto/widgets/qwebenginespellcheck/dict/de-DE.dic
+++ b/tests/auto/widgets/qwebenginespellcheck/dict/de-DE.dic
@@ -8,6 +8,7 @@ liebe/Q
lieben/Q
liebst/Q
liebt/Q
+löwe/Q
qt/Q
sie/Q
Sie/Q
diff --git a/tests/auto/widgets/qwebenginespellcheck/dict/en-US.dic b/tests/auto/widgets/qwebenginespellcheck/dict/en-US.dic
index 3d4ecdfa4..63e9164cc 100644
--- a/tests/auto/widgets/qwebenginespellcheck/dict/en-US.dic
+++ b/tests/auto/widgets/qwebenginespellcheck/dict/en-US.dic
@@ -4,6 +4,7 @@ I/Q
it/Q
love/Q
loves/Q
+low/Q
qt/Q
she/Q
they/Q
diff --git a/tests/auto/widgets/qwebenginespellcheck/tst_qwebenginespellcheck.cpp b/tests/auto/widgets/qwebenginespellcheck/tst_qwebenginespellcheck.cpp
index c7b083660..d5e8a21cf 100644
--- a/tests/auto/widgets/qwebenginespellcheck/tst_qwebenginespellcheck.cpp
+++ b/tests/auto/widgets/qwebenginespellcheck/tst_qwebenginespellcheck.cpp
@@ -148,19 +148,20 @@ void tst_QWebEngineSpellcheck::spellcheck()
profile->setSpellCheckLanguages(languages);
profile->setSpellCheckEnabled(true);
load();
+ QCOMPARE(profile->spellCheckLanguages(), languages);
// make textarea editable
evaluateJavaScriptSync(m_view->page(), "makeEditable();");
// calcuate position of misspelled word
- QVariantList list = evaluateJavaScriptSync(m_view->page(), "findWordPosition('I lovee Qt ....','lovee');").toList();
+ QVariantList list = evaluateJavaScriptSync(m_view->page(), "findWordPosition('I lowe Qt ....','lowe');").toList();
QRect rect(list[0].value<int>(),list[1].value<int>(),list[2].value<int>(),list[3].value<int>());
//type text, spellchecker needs time
QTest::mouseMove(m_view->focusWidget(), QPoint(20,20));
QTest::mousePress(m_view->focusWidget(), Qt::LeftButton, 0, QPoint(20,20));
QTest::mouseRelease(m_view->focusWidget(), Qt::LeftButton, 0, QPoint(20,20));
- QString text("I lovee Qt ....");
+ QString text("I lowe Qt ....");
for (int i = 0; i < text.length(); i++) {
QTest::keyClicks(m_view->focusWidget(), text.at(i));
QTest::qWait(60);
@@ -180,10 +181,10 @@ void tst_QWebEngineSpellcheck::spellcheck()
QVERIFY(m_view->data().isContentEditable());
// check misspelled word
- QVERIFY(m_view->data().misspelledWord() == "lovee");
+ QCOMPARE(m_view->data().misspelledWord(), QStringLiteral("lowe"));
// check suggestions
- QVERIFY(m_view->data().spellCheckerSuggestions() == suggestions);
+ QCOMPARE(m_view->data().spellCheckerSuggestions(), suggestions);
// check replace word
m_view->page()->replaceMisspelledWord("love");
@@ -195,8 +196,8 @@ void tst_QWebEngineSpellcheck::spellcheck_data()
{
QTest::addColumn<QStringList>("languages");
QTest::addColumn<QStringList>("suggestions");
- QTest::newRow("en-US") << QStringList({"en-US"}) << QStringList({"love", "loves"});
- QTest::newRow("en-US,de-DE") << QStringList({"en-US","de-DE"}) << QStringList({"love", "liebe", "loves"});
+ QTest::newRow("en-US") << QStringList({"en-US"}) << QStringList({"low", "love"});
+ QTest::newRow("en-US,de-DE") << QStringList({"en-US", "de-DE"}) << QStringList({"low", "löwe", "love"});
}
QTEST_MAIN(tst_QWebEngineSpellcheck)
diff --git a/tools/scripts/take_snapshot.py b/tools/scripts/take_snapshot.py
index 7af70bf22..3cc1af618 100755
--- a/tools/scripts/take_snapshot.py
+++ b/tools/scripts/take_snapshot.py
@@ -113,6 +113,7 @@ def isInChromiumBlacklist(file_path):
or file_path.startswith('chrome_frame')
or file_path.startswith('chromecast')
or file_path.startswith('chromeos')
+ or file_path.startswith('cloud_print')
or file_path.startswith('components/chrome_apps/')
or file_path.startswith('components/cronet/')
or file_path.startswith('components/drive/')
@@ -144,6 +145,7 @@ def isInChromiumBlacklist(file_path):
or file_path.startswith('testing/buildbot')
or file_path.startswith('third_party/WebKit/LayoutTests')
or file_path.startswith('third_party/WebKit/ManualTests')
+ or file_path.startswith('third_party/WebKit/Source/devtools/devtools-node-modules')
or file_path.startswith('third_party/WebKit/PerformanceTests')
or file_path.startswith('third_party/accessibility-audit')
or file_path.startswith('third_party/android_')
@@ -168,6 +170,7 @@ def isInChromiumBlacklist(file_path):
or file_path.startswith('third_party/google_input_tools')
or file_path.startswith('third_party/gperf')
or file_path.startswith('third_party/gnu_binutils')
+ or file_path.startswith('third_party/grpc')
or file_path.startswith('third_party/gtk+')
or file_path.startswith('third_party/google_appengine_cloudstorage')
or file_path.startswith('third_party/google_toolbox_for_mac')
@@ -183,6 +186,7 @@ def isInChromiumBlacklist(file_path):
or file_path.startswith('third_party/libc++')
or file_path.startswith('third_party/liblouis')
or file_path.startswith('third_party/lighttpd')
+ or file_path.startswith('third_party/libwebm/source/webm_parser/fuzzing')
or file_path.startswith('third_party/logilab')
or file_path.startswith('third_party/markdown')
or file_path.startswith('third_party/mingw-w64')
@@ -198,6 +202,7 @@ def isInChromiumBlacklist(file_path):
or file_path.startswith('third_party/pylint')
or file_path.startswith('third_party/scons-2.0.1')
or file_path.startswith('third_party/sfntly/src/cpp/data/fonts')
+ or file_path.startswith('third_party/skia/infra')
or file_path.startswith('third_party/speech-dispatcher')
or file_path.startswith('third_party/talloc')
or file_path.startswith('third_party/trace-viewer')
diff --git a/tools/scripts/version_resolver.py b/tools/scripts/version_resolver.py
index 4c0b03a97..c6385b57d 100644
--- a/tools/scripts/version_resolver.py
+++ b/tools/scripts/version_resolver.py
@@ -38,8 +38,8 @@ import json
import urllib2
import git_submodule as GitSubmodule
-chromium_version = '56.0.2924.122'
-chromium_branch = '2924'
+chromium_version = '58.0.3029.54'
+chromium_branch = '3029'
ninja_version = 'v1.7.2'
json_url = 'http://omahaproxy.appspot.com/all.json'