diff options
19 files changed, 548 insertions, 40 deletions
diff --git a/dist/changes-5.13.0 b/dist/changes-5.13.0 index 6370cc9ed..fbd2c54e9 100644 --- a/dist/changes-5.13.0 +++ b/dist/changes-5.13.0 @@ -30,7 +30,7 @@ Chromium Snapshot ----------------- - Updated the Chromium version to 73.0.3683.105 - - Applied security fixes from Chrome up to version 74.0.3729.108 + - Applied security fixes from Chrome up to version 74.0.3729.157 Platforms diff --git a/examples/webenginewidgets/notifications/data/data.qrc b/examples/webenginewidgets/notifications/data/data.qrc new file mode 100644 index 000000000..bc252b89c --- /dev/null +++ b/examples/webenginewidgets/notifications/data/data.qrc @@ -0,0 +1,6 @@ +<RCC> + <qresource prefix="/"> + <file>index.html</file> + <file>icon.png</file> + </qresource> +</RCC> diff --git a/examples/webenginewidgets/notifications/data/icon.png b/examples/webenginewidgets/notifications/data/icon.png Binary files differnew file mode 100644 index 000000000..4c3870c06 --- /dev/null +++ b/examples/webenginewidgets/notifications/data/icon.png diff --git a/examples/webenginewidgets/notifications/data/index.html b/examples/webenginewidgets/notifications/data/index.html new file mode 100644 index 000000000..ebb73b573 --- /dev/null +++ b/examples/webenginewidgets/notifications/data/index.html @@ -0,0 +1,90 @@ +<!doctype html> +<html> +<head> +<title>Web Notifications Example</title> +<script> + var notificationsCreated = 0 + + function getPermission() { return document.Notification } + function resetPermission(permission = 'default') { + document.Notification = permission + document.getElementById('state').value = getPermission() + } + + function createNotification() { + let title = 'Notification #' + ++notificationsCreated + let options = { body: 'Visit doc.qt.io for more info!', icon: 'icon.png', } + + let notification = new Notification(title, options) + document.notification = notification + + notification.onerror = function(error) { + document.getElementById('act').value += ' with error' + document.notification = null + } + notification.onshow = function() { + document.getElementById('act').value += ', shown' + document.getElementById('close').style.display = 'inline' + } + notification.onclick = function() { + document.getElementById('act').value += ', clicked' + } + notification.onclose = function() { + if (document.notification && notification == document.notification) { + document.getElementById('act').value += ' and closed' + document.getElementById('close').style.display = 'none' + document.notification = null + } + } + + console.log('...notification created [Title: ' + title + ']') + document.getElementById('act').value = 'Notification was created' + } + + function onMakeNotification() { + if (getPermission() == 'granted') { + createNotification() + } else if (getPermission() == 'denied') { + setTimeout(function() { + if (window.confirm('Notifications are disabled!\n' + + 'Permission needs to be granted by user. Reset?')) + resetPermission() + }, 1) + } else { + Notification.requestPermission().then(function (permission) { + console.info('notifications request: ' + permission) + resetPermission(permission) + if (permission == 'granted') + createNotification() + }) + } + } + + function closeNotification() { if (document.notification) document.notification.close() } + + document.addEventListener('DOMContentLoaded', function() { resetPermission(Notification.permission) }) +</script> +</head> +<body style='text-align:center;'> + <h3>Click the button to send a notification</h3> + + <button onclick='onMakeNotification()'>Notify!</button> + + <p> + <output id='act'></output> + <button id='close' style='display: none;' onclick='closeNotification()'>Close</button> + </p><br> + + <p> + <label for='state'>Permission:</label> + <output id='state'></output> + <button onclick='resetPermission()'>Reset</button> + </p><br> + + <h4>More info can be found on:</h4> + <ul style='list-style-type: none;'> + <li>W3 <a href='https://www.w3.org/TR/notifications'>Web Notifications</a> standard</li> + <li>Documentation for <a href='https://doc.qt.io'>Qt WebEngine</a> module</li> + </ul> +</body> +</html> diff --git a/examples/webenginewidgets/notifications/doc/images/notifications-example.png b/examples/webenginewidgets/notifications/doc/images/notifications-example.png Binary files differnew file mode 100644 index 000000000..671cd1703 --- /dev/null +++ b/examples/webenginewidgets/notifications/doc/images/notifications-example.png diff --git a/examples/webenginewidgets/notifications/doc/src/notifications.qdoc b/examples/webenginewidgets/notifications/doc/src/notifications.qdoc new file mode 100644 index 000000000..2c999e7e1 --- /dev/null +++ b/examples/webenginewidgets/notifications/doc/src/notifications.qdoc @@ -0,0 +1,156 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://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: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example webenginewidgets/notifications + \title WebEngine Notifications Example + \ingroup webengine-widgetexamples + \brief Demonstrates how to pass HTML5 web notifications to users. + + \image notifications-example.png + + \e {\WebEngine Notifications} demonstrates how to use the + \l QWebEngineProfile::setNotificationPresenter() method and + \l QWebEngineNotification class to show an HTML5 web + notification to the user. + + \include examples-run.qdocinc + + \section1 HTML Page + + In this example, we create an internal HTML page that is added through + a resource collection file (.qrc). The page displays buttons for requesting + permissions and creating a notification. In addition, it contains JavaScript + logic for triggering these actions. + + \quotefromfile webenginewidgets/notifications/data/index.html + \skipto Notification.requestPermission + \printline requestPermission + \dots + \skipto if + \printuntil createNotification() + \printline /^})$/ + + \quotefromfile webenginewidgets/notifications/data/index.html + \skipto createNotification() + \printuntil Notification + \dots + \printline /^})$/ + + \section1 Main Function + + In the \c main function, we instantiate a QWebEngineView, load our internal + HTML page, and set up the required callbacks for notifications handling. + + \section2 Requesting Feature Permissions + + We then use the \l QWebEnginePage::featurePermissionRequested() call to + request the user's permission to show notifications on their device. + + \quotefromfile webenginewidgets/notifications/main.cpp + \skipto featurePermissionRequested + \printuntil }); + + \section2 Handling New Notifications + + We then construct a \c NotificationPopup that encapsulates + the data of the HTML web notification. We also use the + \l QWebEngineProfile::setNotificationPresenter() call to set + our handler, which we use in conjunction with our \c popup + to handle all new notifications. + + \skipto popup + \printuntil }); + + \section1 Presenting Notifications to Users + + The \c NotificationPopup class in this example is a simple + QWidget-based class that uses multiple QLabel instances + for displaying the notification's title, message, and icon. + + \quotefromfile webenginewidgets/notifications/notificationpopup.h + \skipto class NotificationPopup + \printto public: + + \section2 Presenting Notifications + + Inside the \c present method, we first close and release the previous + notification if we have one and then take ownership of a new notification + by calling the \c std::unique_ptr::swap method on our internal notification + instance. + + \skipto present + \printto m_title + + Then we query the notification instance for a title, a message, + and an icon by calling \l QWebEngineNotification::title(), + \l QWebEngineNotification::message(), \l QWebEngineNotification::icon() + and set up the appropriate labels in our popup. + + \printuntil m_icon + + After that we are ready to display our notification to the user + by calling the \l QWidget::show() method. On this step we also call the + \l QWebEngineNotification::show() method to notify \c JavaScript code + about our \e show event. + + \printuntil notification->show + + Finally, we set up a callback to handle the \e close event from the + \c JavaScript side by connecting to the \l QWebEngineNotification::closed() + signal. We also schedule a timer event to close our active notification + automatically. + + \skipto QWebEngineNotification::closed + \printuntil QTimer + \printline /^\}/ + + \section2 Closing Active Notification + + We execute the \e close step for the currently active notification either by + timeout or by handling the \c JavaScript event. First, we hide the popup + widget itself by calling \l QWidget::hide(). Then, we notify the \c JavaScript + code by calling the \l QWebEngineNotification::close() method. Finally, we + destroy the notification object through the \c std::unique_ptr::reset() method. + + \skipto onClosed + \dots + \skipto hide() + \printuntil reset + + \section2 Implementing User Interaction + + To implement the \e click step for a notification, we handle mouse interaction + through \l QWidget::mouseReleaseEvent(). On this event, the \c JavaScript code + is notified by calling the \l QWebEngineNotification::click() method. + Then we automatically perform the \e close step as a notification is + considered fully handled and no longer needed, and therefore can be destroyed. + + \skipto mouseReleaseEvent + \printuntil onClosed + \printuntil /^\}/ +*/ diff --git a/examples/webenginewidgets/notifications/main.cpp b/examples/webenginewidgets/notifications/main.cpp new file mode 100644 index 000000000..661b82ff5 --- /dev/null +++ b/examples/webenginewidgets/notifications/main.cpp @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "notificationpopup.h" + +#include <QApplication> +#include <QDesktopServices> +#include <QWebEnginePage> +#include <QWebEngineProfile> +#include <QWebEngineView> + +class WebEnginePage : public QWebEnginePage { +public: + WebEnginePage(QWidget *parent) : QWebEnginePage(parent) { } + + bool acceptNavigationRequest(const QUrl &url, NavigationType, bool) override { + if (url.scheme() != "https") + return true; + QDesktopServices::openUrl(url); + return false; + } +}; + +int main(int argc, char *argv[]) +{ + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + QCoreApplication::setOrganizationName("QtExamples"); + QApplication app(argc, argv); + + QWebEngineView view; + + // set custom page to open all page's links for https scheme in system browser + view.setPage(new WebEnginePage(&view)); + + QObject::connect(view.page(), &QWebEnginePage::featurePermissionRequested, + [&] (const QUrl &origin, QWebEnginePage::Feature feature) { + if (feature != QWebEnginePage::Notifications) + return; + view.page()->setFeaturePermission(origin, feature, QWebEnginePage::PermissionGrantedByUser); + }); + + auto profile = view.page()->profile(); + auto popup = new NotificationPopup(&view); + profile->setNotificationPresenter([&] (std::unique_ptr<QWebEngineNotification> notification) { + popup->present(notification); + }); + + view.resize(640, 480); + view.show(); + view.setUrl(QStringLiteral("qrc:/index.html")); + return app.exec(); +} + diff --git a/examples/webenginewidgets/notifications/notificationpopup.h b/examples/webenginewidgets/notifications/notificationpopup.h new file mode 100644 index 000000000..fcbb003b9 --- /dev/null +++ b/examples/webenginewidgets/notifications/notificationpopup.h @@ -0,0 +1,132 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#pragma once + +#include <QHBoxLayout> +#include <QLabel> +#include <QMouseEvent> +#include <QPushButton> +#include <QSpacerItem> +#include <QTimer> +#include <QVBoxLayout> +#include <QWebEngineNotification> + +#include <memory> + +class NotificationPopup : public QWidget { + Q_OBJECT + + QLabel m_icon, m_title, m_message; + std::unique_ptr<QWebEngineNotification> notification; + +public: + NotificationPopup(QWidget *parent) : QWidget(parent) { + setWindowFlags(Qt::ToolTip); + auto rootLayout = new QHBoxLayout(this); + + rootLayout->addWidget(&m_icon); + + auto bodyLayout = new QVBoxLayout; + rootLayout->addLayout(bodyLayout); + + auto titleLayout = new QHBoxLayout; + bodyLayout->addLayout(titleLayout); + + titleLayout->addWidget(&m_title); + titleLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding)); + + auto close = new QPushButton(tr("Close")); + titleLayout->addWidget(close); + connect(close, &QPushButton::clicked, this, &NotificationPopup::onClosed); + + bodyLayout->addWidget(&m_message); + adjustSize(); + } + + void present(std::unique_ptr<QWebEngineNotification> &newNotification) { + if (notification) { + notification->close(); + notification.reset(); + } + + notification.swap(newNotification); + + m_title.setText("<b>" + notification->title() + "</b>"); + m_message.setText(notification->message()); + m_icon.setPixmap(QPixmap::fromImage(notification->icon()).scaledToHeight(m_icon.height())); + + show(); + notification->show(); + + connect(notification.get(), &QWebEngineNotification::closed, this, &NotificationPopup::onClosed); + QTimer::singleShot(10000, notification.get(), [&] () { onClosed(); }); + + // position our popup in the right corner of its parent widget + move(parentWidget()->mapToGlobal(parentWidget()->rect().bottomRight() - QPoint(width() + 10, height() + 10))); + } + +protected slots: + void onClosed() { + hide(); + notification->close(); + notification.reset(); + } + +protected: + void mouseReleaseEvent(QMouseEvent *event) override { + QWidget::mouseReleaseEvent(event); + if (notification && event->button() == Qt::LeftButton) { + notification->click(); + onClosed(); + } + } +}; + diff --git a/examples/webenginewidgets/notifications/notifications.pro b/examples/webenginewidgets/notifications/notifications.pro new file mode 100644 index 000000000..6e276d405 --- /dev/null +++ b/examples/webenginewidgets/notifications/notifications.pro @@ -0,0 +1,10 @@ +QT += webenginewidgets + +HEADERS = notificationpopup.h + +SOURCES = main.cpp + +RESOURCES = data/data.qrc + +target.path = $$[QT_INSTALL_EXAMPLES]/webenginewidgets/notifications +INSTALLS += target diff --git a/examples/webenginewidgets/webenginewidgets.pro b/examples/webenginewidgets/webenginewidgets.pro index 0d47aac80..deb42a8cd 100644 --- a/examples/webenginewidgets/webenginewidgets.pro +++ b/examples/webenginewidgets/webenginewidgets.pro @@ -7,6 +7,7 @@ SUBDIRS += \ minimal \ contentmanipulation \ cookiebrowser \ + notifications \ simplebrowser \ stylesheetbrowser \ videoplayer \ diff --git a/mkspecs/features/gn_generator.prf b/mkspecs/features/gn_generator.prf index 78b56d123..863169c4d 100644 --- a/mkspecs/features/gn_generator.prf +++ b/mkspecs/features/gn_generator.prf @@ -26,8 +26,6 @@ isEmpty(GN_FILE): GN_FILE = $$system_path($$_PRO_FILE_PWD_/BUILD.gn) isEmpty(GN_RUN_BINARY_SCRIPT): GN_RUN_BINARY_SCRIPT = "//build/gn_run_binary.py" isEmpty(GN_FIND_MOCABLES_SCRIPT): GN_FIND_MOCABLES_SCRIPT = "//build/gn_find_mocables.py" -GN_CONTENTS += "import(\"//build/config/jumbo.gni\")" - # MOC SETUP GN_CONTENTS += "moc_source_h_files = exec_script(\"$$GN_FIND_MOCABLES_SCRIPT\"," @@ -176,26 +174,6 @@ GN_CONTENTS += "}" # TARGET SETUP -GN_CONTENTS += "jumbo_source_set(\"$${TARGET}_MOC\") {" -GN_CONTENTS += " configs += [ \":$${TARGET}_config\" ]" -GN_CONTENTS += " configs += [ \"//build/config:precompiled_headers\" ]" -GN_CONTENTS += " sources = []" -GN_CONTENTS += " deps = []" -GN_CONTENTS += " if (moc_source_h_files != []) {" -GN_CONTENTS += " deps += [" -GN_CONTENTS += " \":generate_h_mocs\"," -GN_CONTENTS += " ]" -# Add moc output files to compile -GN_CONTENTS += " sources += get_target_outputs(\":generate_h_mocs\")" -GN_CONTENTS += " }" -GN_CONTENTS += " if (moc_source_cpp_files != []) {" -GN_CONTENTS += " deps += [" -GN_CONTENTS += " \":generate_cpp_mocs\"," -GN_CONTENTS += " ]" -GN_CONTENTS += " }" -GN_CONTENTS += "}" - - TARGET_TYPE = $$getTargetType() GN_CONTENTS += "$${TARGET_TYPE}(\"$$TARGET\") {" @@ -248,7 +226,18 @@ win32 { CONFIG(rtti): GN_CONTENTS += " configs += [\"//build/config/compiler:rtti\"]" } -GN_CONTENTS += " deps += [ \":$${TARGET}_MOC\" ]" +GN_CONTENTS += " if (moc_source_h_files != []) {" +GN_CONTENTS += " deps += [" +GN_CONTENTS += " \":generate_h_mocs\"," +GN_CONTENTS += " ]" +# Add moc output files to compile +GN_CONTENTS += " sources += get_target_outputs(\":generate_h_mocs\")" +GN_CONTENTS += " }" +GN_CONTENTS += " if (moc_source_cpp_files != []) {" +GN_CONTENTS += " deps += [" +GN_CONTENTS += " \":generate_cpp_mocs\"," +GN_CONTENTS += " ]" +GN_CONTENTS += " }" GN_CONTENTS += "}" GN_CONTENTS += "" GN_CONTENTS += "if (!defined(core_include_dirs)) {"\ diff --git a/src/3rdparty b/src/3rdparty -Subproject 7e110d51ae0f456e2bb8e273f52107d22196e47 +Subproject 8a28c0bb19fc8627812cb7c3154408b71ff2bf5 diff --git a/src/core/core_chromium.pri b/src/core/core_chromium.pri index 4d8db0d1e..d8ef25d8c 100644 --- a/src/core/core_chromium.pri +++ b/src/core/core_chromium.pri @@ -33,8 +33,6 @@ RCC_DIR = $$OUT_PWD/$$getConfigDir()/.rcc # whenever we are cross compiling. qtConfig(webengine-embedded-build): DEFINES += QTWEBENGINE_EMBEDDED_SWITCHES -qtConfig(egl): CONFIG += egl - INCLUDEPATH += $$PWD $$PWD/api clang_cl { diff --git a/src/core/core_common.pri b/src/core/core_common.pri index 8375d89e5..51f5e21b0 100644 --- a/src/core/core_common.pri +++ b/src/core/core_common.pri @@ -2,8 +2,8 @@ # gyp/ninja will take care of the compilation, qmake/make will finish with linking and install. TARGET = QtWebEngineCore -QT += qml quick -QT_PRIVATE += quick-private gui-private core-private webenginecoreheaders-private +QT += qml-private quick-private gui-private core-private +QT_PRIVATE += webenginecoreheaders-private qtConfig(webengine-geolocation): QT += positioning qtConfig(webengine-webchannel): QT += webchannel diff --git a/src/core/core_headers.pro b/src/core/core_headers.pro index 21b5d58c3..cd5352eb7 100644 --- a/src/core/core_headers.pro +++ b/src/core/core_headers.pro @@ -1,5 +1,6 @@ TARGET = QtWebEngineCore CONFIG += no_private_module header_module internal_module no_plist +QT -= core gui MODULE = webenginecoreheaders MODULE_CFG_FILE = qtwebenginecore-config load(qt_module) diff --git a/src/core/core_module.pro b/src/core/core_module.pro index f9f72176f..f5234f88b 100644 --- a/src/core/core_module.pro +++ b/src/core/core_module.pro @@ -10,8 +10,6 @@ linking_pri = $$OUT_PWD/$$getConfigDir()/$${TARGET}.pri error("Could not find the linking information that gn should have generated.") } -load(qt_module) - api_library_name = qtwebenginecoreapi$$qtPlatformTargetSuffix() api_library_path = $$OUT_PWD/api/$$getConfigDir() @@ -25,14 +23,17 @@ isEmpty(NINJA_LIBS): error("Missing library files from QtWebEngineCore linking p NINJA_OBJECTS = $$eval($$list($$NINJA_OBJECTS)) # Do manual response file linking for macOS and Linux -RSP_FILE = $$OUT_PWD/$$getConfigDir()/$${TARGET}.rsp -for(object, NINJA_OBJECTS): RSP_CONTENT += $$object -write_file($$RSP_FILE, RSP_CONTENT) -macos:LIBS_PRIVATE += -Wl,-filelist,$$shell_quote($$RSP_FILE) -linux:LIBS_PRIVATE += @$$RSP_FILE +RSP_OBJECT_FILE = $$OUT_PWD/$$getConfigDir()/$${TARGET}_o.rsp +for(object, NINJA_OBJECTS): RSP_O_CONTENT += $$object +write_file($$RSP_OBJECT_FILE, RSP_O_CONTENT) +RSP_ARCHIVE_FILE = $$OUT_PWD/$$getConfigDir()/$${TARGET}_a.rsp +for(archive, NINJA_ARCHIVES): RSP_A_CONTENT += $$archive +write_file($$RSP_ARCHIVE_FILE, RSP_A_CONTENT) +macos:LIBS_PRIVATE += -Wl,-filelist,$$shell_quote($$RSP_OBJECT_FILE) +linux:QMAKE_LFLAGS += @$${RSP_OBJECT_FILE} # QTBUG-58710 add main rsp file on windows -win32:QMAKE_LFLAGS += @$$RSP_FILE -linux: LIBS_PRIVATE += -Wl,--start-group $$NINJA_ARCHIVES -Wl,--end-group +win32:QMAKE_LFLAGS += @$${RSP_OBJECT_FILE} +linux:QMAKE_LFLAGS += -Wl,--start-group @$${RSP_ARCHIVE_FILE} -Wl,--end-group else: LIBS_PRIVATE += $$NINJA_ARCHIVES LIBS_PRIVATE += $$NINJA_LIB_DIRS $$NINJA_LIBS # GN's LFLAGS doesn't always work across all the Linux configurations we support. @@ -71,7 +72,7 @@ osx { # API library as response file to the linker. QMAKE_LFLAGS += @$${api_library_path}$${QMAKE_DIR_SEP}$${api_library_name}.lib.objects } else { - LIBS_PRIVATE += -Wl,-whole-archive -l$$api_library_name -Wl,-no-whole-archive + QMAKE_LFLAGS += -Wl,-whole-archive -l$$api_library_name -Wl,-no-whole-archive } win32 { @@ -84,8 +85,6 @@ win32 { # and doesn't let Chromium get access to libc symbols through dlsym. CONFIG -= bsymbolic_functions -qtConfig(egl): CONFIG += egl - linux:qtConfig(separate_debug_info): QMAKE_POST_LINK="cd $(DESTDIR) && $(STRIP) --strip-unneeded $(TARGET)" REPACK_DIR = $$OUT_PWD/$$getConfigDir() @@ -154,3 +153,6 @@ OTHER_FILES = \ $$files(../3rdparty/chromium/*.gypi, true) \ $$files(../3rdparty/chromium/*.gn, true) \ $$files(../3rdparty/chromium/*.gni, true) + +load(qt_module) + diff --git a/src/core/web_engine_settings.cpp b/src/core/web_engine_settings.cpp index 5a01308a1..b6250a65f 100644 --- a/src/core/web_engine_settings.cpp +++ b/src/core/web_engine_settings.cpp @@ -345,6 +345,10 @@ void WebEngineSettings::applySettingsToWebPreferences(content::WebPreferences *p { // Override for now prefs->touch_event_feature_detection_enabled = isTouchEventsAPIEnabled(); +#if !QT_CONFIG(webengine_embedded_build) + prefs->available_hover_types = ui::HOVER_TYPE_HOVER; + prefs->primary_hover_type = ui::HOVER_TYPE_HOVER; +#endif if (prefs->viewport_enabled) { // We need to enable the viewport options together as it doesn't really work // to enable them separately. With viewport-enabled we match Android defaults. diff --git a/src/webengine/doc/src/qtwebengine-features.qdoc b/src/webengine/doc/src/qtwebengine-features.qdoc index 5c6bdda5d..08c189740 100644 --- a/src/webengine/doc/src/qtwebengine-features.qdoc +++ b/src/webengine/doc/src/qtwebengine-features.qdoc @@ -44,6 +44,7 @@ \li \l{HTTP/2 Protocol} \li \l{Native Dialogs} \li \l{Pepper Plugin API} + \li \l{PDF File Viewing} \li \l{Print to PDF} \li \l{Process Models} \li \l{Spellchecker} @@ -319,6 +320,21 @@ feature, the \c https://helpx.adobe.com/flash-player.html page can be opened in the browser. + \section1 PDF File Viewing + + \QWE supports viewing PDF documents by navigating to them. This feature uses the Chromium + extensions API and PDF viewer plugin to display the PDF documents. + It can be tested in \l{WebEngine Widgets Simple Browser Example}{Simple Browser} or + \l{WebEngine Quick Nano Browser}{Nano Browser}. + + Loading plugins needs to be enabled using QWebEngineSettings::PluginsEnabled or + WebEngineSettings::pluginsEnabled in order to use this feature. + + This feature can be turned on (default) or off via the QWebEngineSettings::PdfViewerEnabled or + WebEngineSettings::pdfViewerEnabled setting. + + Support for this feature was added in Qt 5.13.0. + \section1 Print to PDF \QWE supports printing a web page to a PDF file. For more diff --git a/tests/auto/widgets/qwebengineview/BLACKLIST b/tests/auto/widgets/qwebengineview/BLACKLIST index 7c86a72d6..9a574a687 100644 --- a/tests/auto/widgets/qwebengineview/BLACKLIST +++ b/tests/auto/widgets/qwebengineview/BLACKLIST @@ -6,3 +6,6 @@ osx [textSelectionOutOfInputField] * + +[inputContextQueryInput] +windows |