summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/webengine/quicknanobrowser/BrowserWindow.qml15
-rw-r--r--src/core/api/core_api.pro2
-rw-r--r--src/core/api/qwebenginecookiestore.cpp2
-rw-r--r--src/core/api/qwebenginemessagepumpscheduler.cpp72
-rw-r--r--src/core/api/qwebenginemessagepumpscheduler_p.h80
-rw-r--r--src/core/api/qwebengineurlschemehandler.cpp2
-rw-r--r--src/core/browser_main_parts_qt.cpp48
-rw-r--r--src/core/favicon_manager.cpp20
-rw-r--r--src/core/favicon_manager.h15
-rw-r--r--src/core/type_conversion.cpp2
-rw-r--r--src/core/web_engine_settings.cpp34
-rw-r--r--src/core/web_engine_settings.h5
-rw-r--r--src/webengine/api/qquickwebengineprofile.cpp2
-rw-r--r--src/webengine/api/qquickwebengineview.cpp2
-rw-r--r--src/webengine/doc/src/qtwebengine-examples.qdoc2
-rw-r--r--src/webengine/doc/src/qtwebengine-overview.qdoc16
-rw-r--r--src/webengine/doc/src/qtwebengine-qmlmodule.qdoc2
-rw-r--r--src/webenginewidgets/api/qwebenginepage.cpp12
-rw-r--r--src/webenginewidgets/api/qwebengineview.cpp2
-rw-r--r--src/webenginewidgets/doc/src/qtwebenginewidgets-examples.qdoc2
-rw-r--r--src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc20
-rw-r--r--src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc14
-rw-r--r--tests/auto/quick/qmltests/data/tst_favicon.qml33
-rw-r--r--tests/auto/widgets/faviconmanager/tst_faviconmanager.cpp38
24 files changed, 326 insertions, 116 deletions
diff --git a/examples/webengine/quicknanobrowser/BrowserWindow.qml b/examples/webengine/quicknanobrowser/BrowserWindow.qml
index 8d62482da..0ac69ef24 100644
--- a/examples/webengine/quicknanobrowser/BrowserWindow.qml
+++ b/examples/webengine/quicknanobrowser/BrowserWindow.qml
@@ -380,11 +380,12 @@ ApplicationWindow {
focus: true
onLinkHovered: function(hoveredUrl) {
- if (hoveredUrl === "")
- resetStatusText.start();
+ if (hoveredUrl == "")
+ hideStatusText.start();
else {
- resetStatusText.stop();
statusText.text = hoveredUrl;
+ statusBubble.visible = true;
+ hideStatusText.stop();
}
}
@@ -566,6 +567,7 @@ ApplicationWindow {
id: statusBubble
color: "oldlace"
property int padding: 8
+ visible: false
anchors.left: parent.left
anchors.bottom: parent.bottom
@@ -578,9 +580,12 @@ ApplicationWindow {
elide: Qt.ElideMiddle
Timer {
- id: resetStatusText
+ id: hideStatusText
interval: 750
- onTriggered: statusText.text = ""
+ onTriggered: {
+ statusText.text = "";
+ statusBubble.visible = false;
+ }
}
}
}
diff --git a/src/core/api/core_api.pro b/src/core/api/core_api.pro
index 38dc6b39d..4b69b348a 100644
--- a/src/core/api/core_api.pro
+++ b/src/core/api/core_api.pro
@@ -37,6 +37,7 @@ HEADERS = \
qwebenginecookiestore.h \
qwebenginecookiestore_p.h \
qwebenginehttprequest.h \
+ qwebenginemessagepumpscheduler_p.h \
qwebenginequotarequest.h \
qwebengineregisterprotocolhandlerrequest.h \
qwebengineurlrequestinterceptor.h \
@@ -50,6 +51,7 @@ SOURCES = \
qtwebenginecoreglobal.cpp \
qwebenginecookiestore.cpp \
qwebenginehttprequest.cpp \
+ qwebenginemessagepumpscheduler.cpp \
qwebenginequotarequest.cpp \
qwebengineregisterprotocolhandlerrequest.cpp \
qwebengineurlrequestinfo.cpp \
diff --git a/src/core/api/qwebenginecookiestore.cpp b/src/core/api/qwebenginecookiestore.cpp
index 035c98342..3897fb128 100644
--- a/src/core/api/qwebenginecookiestore.cpp
+++ b/src/core/api/qwebenginecookiestore.cpp
@@ -382,7 +382,7 @@ void QWebEngineCookieStore::setCookieFilter(std::function<bool(const FilterReque
\inmodule QtWebEngineCore
\since 5.11
- \brief This struct is used in conjunction with QWebEngineCookieStore::setCookieFilter() and is
+ \brief The QWebEngineCookieStore::FilterRequest struct is used in conjunction with QWebEngineCookieStore::setCookieFilter() and is
the type \a filterCallback operates on.
\sa QWebEngineCookieStore::setCookieFilter()
diff --git a/src/core/api/qwebenginemessagepumpscheduler.cpp b/src/core/api/qwebenginemessagepumpscheduler.cpp
new file mode 100644
index 000000000..34cbc49bf
--- /dev/null
+++ b/src/core/api/qwebenginemessagepumpscheduler.cpp
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qwebenginemessagepumpscheduler_p.h"
+
+#include <QAbstractEventDispatcher>
+#include <QCoreApplication>
+#include <QTimerEvent>
+
+QWebEngineMessagePumpScheduler::QWebEngineMessagePumpScheduler(std::function<void()> callback)
+ : m_callback(std::move(callback))
+{}
+
+void QWebEngineMessagePumpScheduler::scheduleWork()
+{
+ QCoreApplication::postEvent(this, new QTimerEvent(0));
+}
+
+void QWebEngineMessagePumpScheduler::scheduleDelayedWork(int delay)
+{
+ if (delay < 0) {
+ killTimer(m_timerId);
+ m_timerId = 0;
+ } else if (!m_timerId || delay < QAbstractEventDispatcher::instance()->remainingTime(m_timerId)) {
+ killTimer(m_timerId);
+ m_timerId = startTimer(delay);
+ }
+}
+
+void QWebEngineMessagePumpScheduler::timerEvent(QTimerEvent *ev)
+{
+ Q_ASSERT(!ev->timerId() || m_timerId == ev->timerId());
+ killTimer(m_timerId);
+ m_timerId = 0;
+ m_callback();
+}
diff --git a/src/core/api/qwebenginemessagepumpscheduler_p.h b/src/core/api/qwebenginemessagepumpscheduler_p.h
new file mode 100644
index 000000000..4c9e4d600
--- /dev/null
+++ b/src/core/api/qwebenginemessagepumpscheduler_p.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWEBENGINEMESSAGEPUMPSCHEDULER_P_H
+#define QWEBENGINEMESSAGEPUMPSCHEDULER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qtwebenginecoreglobal_p.h"
+
+#include <QtCore/qobject.h>
+
+#include <functional>
+
+QT_BEGIN_NAMESPACE
+
+class QWEBENGINECORE_PRIVATE_EXPORT QWebEngineMessagePumpScheduler : public QObject
+{
+ Q_OBJECT
+public:
+ QWebEngineMessagePumpScheduler(std::function<void()> callback);
+ void scheduleWork();
+ void scheduleDelayedWork(int delay);
+
+protected:
+ void timerEvent(QTimerEvent *ev) override;
+
+private:
+ int m_timerId = 0;
+ std::function<void()> m_callback;
+};
+
+QT_END_NAMESPACE
+
+#endif // !QWEBENGINEMESSAGEPUMPSCHEDULER_P_H
diff --git a/src/core/api/qwebengineurlschemehandler.cpp b/src/core/api/qwebengineurlschemehandler.cpp
index 6f06b2c6e..b5912703d 100644
--- a/src/core/api/qwebengineurlschemehandler.cpp
+++ b/src/core/api/qwebengineurlschemehandler.cpp
@@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QWebEngineUrlSchemeHandler
- \brief The QWebEngineUrlSchemeHandler is a base class for handling custom URL schemes.
+ \brief The QWebEngineUrlSchemeHandler class is a base class for handling custom URL schemes.
\since 5.6
To implement a custom URL scheme for QtWebEngine, you first have to create an instance of
diff --git a/src/core/browser_main_parts_qt.cpp b/src/core/browser_main_parts_qt.cpp
index 8f39386d4..3d85c04c4 100644
--- a/src/core/browser_main_parts_qt.cpp
+++ b/src/core/browser_main_parts_qt.cpp
@@ -39,6 +39,8 @@
#include "browser_main_parts_qt.h"
+#include "api/qwebenginemessagepumpscheduler_p.h"
+
#include "base/message_loop/message_loop.h"
#include "base/process/process.h"
#include "base/threading/thread_restrictions.h"
@@ -54,11 +56,7 @@
#include "service/service_qt.h"
#include "web_engine_context.h"
-#include <QCoreApplication>
-#include <QEvent>
#include <QEventLoop>
-#include <QObject>
-#include <QTimerEvent>
#if defined(OS_MACOSX)
#include "ui/base/idle/idle.h"
@@ -91,16 +89,12 @@ int GetTimeIntervalMilliseconds(const base::TimeTicks &from)
return delay < 0 ? 0 : delay;
}
-class MessagePumpForUIQt : public QObject,
- public base::MessagePump
+class MessagePumpForUIQt : public base::MessagePump
{
public:
MessagePumpForUIQt()
- : m_delegate(nullptr)
- , m_explicitLoop(nullptr)
- , m_timerId(0)
- {
- }
+ : m_scheduler([this]() { handleScheduledWork(); })
+ {}
void Run(Delegate *delegate) override
{
@@ -123,36 +117,17 @@ public:
void ScheduleWork() override
{
+ // NOTE: This method may called from any thread at any time.
if (!m_delegate)
m_delegate = base::MessageLoopForUI::current();
- QCoreApplication::postEvent(this, new QTimerEvent(0));
- m_timerScheduledTime = base::TimeTicks::Now();
+ m_scheduler.scheduleWork();
}
void ScheduleDelayedWork(const base::TimeTicks &delayed_work_time) override
{
if (!m_delegate)
m_delegate = base::MessageLoopForUI::current();
- if (delayed_work_time.is_null()) {
- killTimer(m_timerId);
- m_timerId = 0;
- m_timerScheduledTime = base::TimeTicks();
- } else if (!m_timerId || delayed_work_time < m_timerScheduledTime) {
- killTimer(m_timerId);
- m_timerId = startTimer(GetTimeIntervalMilliseconds(delayed_work_time));
- m_timerScheduledTime = delayed_work_time;
- }
- }
-
-protected:
- void timerEvent(QTimerEvent *ev) override
- {
- Q_ASSERT(!ev->timerId() || m_timerId == ev->timerId());
- killTimer(m_timerId);
- m_timerId = 0;
- m_timerScheduledTime = base::TimeTicks();
-
- handleScheduledWork();
+ m_scheduler.scheduleDelayedWork(GetTimeIntervalMilliseconds(delayed_work_time));
}
private:
@@ -173,10 +148,9 @@ private:
ScheduleDelayedWork(delayed_work_time);
}
- Delegate *m_delegate;
- QEventLoop *m_explicitLoop;
- int m_timerId;
- base::TimeTicks m_timerScheduledTime;
+ Delegate *m_delegate = nullptr;
+ QEventLoop *m_explicitLoop = nullptr;
+ QWebEngineMessagePumpScheduler m_scheduler;
};
} // anonymous namespace
diff --git a/src/core/favicon_manager.cpp b/src/core/favicon_manager.cpp
index de6a0f183..f7ba858c1 100644
--- a/src/core/favicon_manager.cpp
+++ b/src/core/favicon_manager.cpp
@@ -253,7 +253,7 @@ void FaviconManager::update(const QList<FaviconInfo> &candidates)
const QList<FaviconInfo> &faviconInfoList = getFaviconInfoList(true /* candidates only */);
for (auto it = faviconInfoList.cbegin(), end = faviconInfoList.cend(); it != end; ++it) {
- if (!touchIconsEnabled && it->type != FaviconInfo::Favicon)
+ if (!touchIconsEnabled && !(it->type & FaviconInfo::Favicon))
continue;
if (it->isValid())
@@ -272,6 +272,14 @@ void FaviconManager::update(const QList<FaviconInfo> &candidates)
void FaviconManager::updateCandidates(const QList<FaviconInfo> &candidates)
{
+ // Invalidate types of the already stored candidate icons because it might differ
+ // among pages.
+ for (FaviconInfo candidateFaviconInfo : candidates) {
+ const QUrl &candidateUrl = candidateFaviconInfo.url;
+ if (m_faviconInfoMap.contains(candidateUrl))
+ m_faviconInfoMap[candidateUrl].type = FaviconInfo::InvalidIcon;
+ }
+
m_candidateCount = candidates.count();
for (FaviconInfo candidateFaviconInfo : candidates) {
const QUrl &candidateUrl = candidateFaviconInfo.url;
@@ -279,8 +287,8 @@ void FaviconManager::updateCandidates(const QList<FaviconInfo> &candidates)
if (!m_faviconInfoMap.contains(candidateUrl))
m_faviconInfoMap.insert(candidateUrl, candidateFaviconInfo);
else {
- // The same icon can be used for more than one page with different types.
- m_faviconInfoMap[candidateUrl].type = candidateFaviconInfo.type;
+ // The same icon URL can be used for different types.
+ m_faviconInfoMap[candidateUrl].type |= candidateFaviconInfo.type;
}
m_faviconInfoMap[candidateUrl].candidate = true;
@@ -311,7 +319,7 @@ QUrl FaviconManager::candidateIconUrl(bool touchIconsEnabled) const
unsigned bestArea = 0;
for (auto it = faviconInfoList.cbegin(), end = faviconInfoList.cend(); it != end; ++it) {
- if (!touchIconsEnabled && it->type != FaviconInfo::Favicon)
+ if (!touchIconsEnabled && !(it->type & FaviconInfo::Favicon))
continue;
if (it->isValid() && bestArea < area(it->size)) {
@@ -331,7 +339,7 @@ void FaviconManager::generateCandidateIcon(bool touchIconsEnabled)
const QList<FaviconInfo> &faviconInfoList = getFaviconInfoList(true /* candidates only */);
for (auto it = faviconInfoList.cbegin(), end = faviconInfoList.cend(); it != end; ++it) {
- if (!touchIconsEnabled && it->type != FaviconInfo::Favicon)
+ if (!touchIconsEnabled && !(it->type & FaviconInfo::Favicon))
continue;
if (!it->isValid() || !it->isDownloaded())
@@ -373,7 +381,7 @@ FaviconInfo::FaviconInfo(const FaviconInfo &other)
{
}
-FaviconInfo::FaviconInfo(const QUrl &url, FaviconInfo::FaviconType type)
+FaviconInfo::FaviconInfo(const QUrl &url, FaviconInfo::FaviconTypeFlags type)
: url(url)
, type(type)
, size(QSize(0, 0))
diff --git a/src/core/favicon_manager.h b/src/core/favicon_manager.h
index f9758d0f0..60d194c4b 100644
--- a/src/core/favicon_manager.h
+++ b/src/core/favicon_manager.h
@@ -84,23 +84,24 @@ class WebContentsAdapterClient;
// Based on src/3rdparty/chromium/content/public/common/favicon_url.h
class QWEBENGINECORE_PRIVATE_EXPORT FaviconInfo {
public:
- enum FaviconType {
- InvalidIcon,
- Favicon,
- TouchIcon,
- TouchPrecomposedIcon
+ enum FaviconTypeFlag {
+ InvalidIcon = 0,
+ Favicon = 1 << 0,
+ TouchIcon = 1 << 1,
+ TouchPrecomposedIcon = 1 << 2
};
+ Q_DECLARE_FLAGS(FaviconTypeFlags, FaviconTypeFlag);
FaviconInfo();
FaviconInfo(const FaviconInfo &);
- FaviconInfo(const QUrl &, FaviconInfo::FaviconType);
+ FaviconInfo(const QUrl &, FaviconInfo::FaviconTypeFlags);
~FaviconInfo();
bool isValid() const;
bool isDownloaded() const;
QUrl url;
- FaviconType type;
+ FaviconTypeFlags type;
// Stores the largest size in case of multi-size icon
QSize size;
bool candidate;
diff --git a/src/core/type_conversion.cpp b/src/core/type_conversion.cpp
index d35426ac3..f69b2a297 100644
--- a/src/core/type_conversion.cpp
+++ b/src/core/type_conversion.cpp
@@ -216,7 +216,7 @@ int flagsFromModifiers(Qt::KeyboardModifiers modifiers)
return modifierFlags;
}
-FaviconInfo::FaviconType toQt(content::FaviconURL::IconType type)
+FaviconInfo::FaviconTypeFlags toQt(content::FaviconURL::IconType type)
{
switch (type) {
case content::FaviconURL::IconType::kFavicon:
diff --git a/src/core/web_engine_settings.cpp b/src/core/web_engine_settings.cpp
index 2e48a806a..664951e66 100644
--- a/src/core/web_engine_settings.cpp
+++ b/src/core/web_engine_settings.cpp
@@ -67,27 +67,6 @@ QHash<WebEngineSettings::FontSize, int> WebEngineSettings::s_defaultFontSizes;
static const int batchTimerTimeout = 0;
-class BatchTimer : public QTimer {
- Q_OBJECT
-public:
- BatchTimer(WebEngineSettings *settings)
- : m_settings(settings)
- {
- setSingleShot(true);
- setInterval(batchTimerTimeout);
- connect(this, SIGNAL(timeout()), SLOT(onTimeout()));
- }
-
-private Q_SLOTS:
- void onTimeout()
- {
- m_settings->doApply();
- }
-
-private:
- WebEngineSettings *m_settings;
-};
-
static inline bool isTouchEventsAPIEnabled() {
static bool initialized = false;
static bool touchEventsAPIEnabled = false;
@@ -113,12 +92,17 @@ static inline bool isTouchEventsAPIEnabled() {
WebEngineSettings::WebEngineSettings(WebEngineSettings *_parentSettings)
: m_adapter(0)
- , m_batchTimer(new BatchTimer(this))
, parentSettings(_parentSettings)
, m_unknownUrlSchemePolicy(WebEngineSettings::InheritedUnknownUrlSchemePolicy)
{
if (parentSettings)
parentSettings->childSettings.insert(this);
+
+ m_batchTimer.setSingleShot(true);
+ m_batchTimer.setInterval(batchTimerTimeout);
+ QObject::connect(&m_batchTimer, &QTimer::timeout, [this]() {
+ doApply();
+ });
}
WebEngineSettings::~WebEngineSettings()
@@ -335,8 +319,8 @@ void WebEngineSettings::initDefaults()
void WebEngineSettings::scheduleApply()
{
- if (!m_batchTimer->isActive())
- m_batchTimer->start();
+ if (!m_batchTimer.isActive())
+ m_batchTimer.start();
}
void WebEngineSettings::doApply()
@@ -448,5 +432,3 @@ void WebEngineSettings::setParentSettings(WebEngineSettings *_parentSettings)
}
} // namespace QtWebEngineCore
-
-#include "web_engine_settings.moc"
diff --git a/src/core/web_engine_settings.h b/src/core/web_engine_settings.h
index 06a7a6004..8930d7c27 100644
--- a/src/core/web_engine_settings.h
+++ b/src/core/web_engine_settings.h
@@ -57,6 +57,7 @@
#include <QHash>
#include <QUrl>
#include <QSet>
+#include <QTimer>
namespace content {
struct RendererPreferences;
@@ -65,7 +66,6 @@ struct WebPreferences;
}
namespace QtWebEngineCore {
-class BatchTimer;
class WebContentsAdapter;
class QWEBENGINECORE_PRIVATE_EXPORT WebEngineSettings {
@@ -177,7 +177,7 @@ private:
QHash<FontSize, int> m_fontSizes;
QString m_defaultEncoding;
QScopedPointer<content::WebPreferences> webPreferences;
- QScopedPointer<BatchTimer> m_batchTimer;
+ QTimer m_batchTimer;
WebEngineSettings *parentSettings;
QSet<WebEngineSettings *> childSettings;
@@ -187,7 +187,6 @@ private:
static QHash<FontSize, int> s_defaultFontSizes;
UnknownUrlSchemePolicy m_unknownUrlSchemePolicy;
- friend class BatchTimer;
friend class WebContentsAdapter;
};
diff --git a/src/webengine/api/qquickwebengineprofile.cpp b/src/webengine/api/qquickwebengineprofile.cpp
index 26fcf28f7..b7abb13fc 100644
--- a/src/webengine/api/qquickwebengineprofile.cpp
+++ b/src/webengine/api/qquickwebengineprofile.cpp
@@ -958,7 +958,7 @@ QQuickWebEngineSettings *QQuickWebEngineProfile::settings() const
\property QQuickWebEngineProfile::userScripts
\since 5.9
- \brief the collection of scripts that are injected into all pages that share
+ \brief The collection of scripts that are injected into all pages that share
this profile.
\sa QQuickWebEngineScript, QQmlListReference
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
index b9ae06aeb..35f797cb1 100644
--- a/src/webengine/api/qquickwebengineview.cpp
+++ b/src/webengine/api/qquickwebengineview.cpp
@@ -1277,7 +1277,7 @@ void QQuickWebEngineView::setBackgroundColor(const QColor &color)
/*!
\property QQuickWebEngineView::audioMuted
- \brief the state of whether the current page audio is muted.
+ \brief The state of whether the current page audio is muted.
\since 5.7
The default value is false.
diff --git a/src/webengine/doc/src/qtwebengine-examples.qdoc b/src/webengine/doc/src/qtwebengine-examples.qdoc
index 1f1780764..24604e3dd 100644
--- a/src/webengine/doc/src/qtwebengine-examples.qdoc
+++ b/src/webengine/doc/src/qtwebengine-examples.qdoc
@@ -28,7 +28,7 @@
/*!
\group webengine-examples
\title Qt WebEngine Examples
- \brief Examples demonstrating the Qt WebEngine usage
+ \brief Examples demonstrating the Qt WebEngine usage.
\ingroup all-examples
These examples and demonstrations show a range of different uses for \l{Qt WebEngine},
diff --git a/src/webengine/doc/src/qtwebengine-overview.qdoc b/src/webengine/doc/src/qtwebengine-overview.qdoc
index bd5569e3f..d83a65bdb 100644
--- a/src/webengine/doc/src/qtwebengine-overview.qdoc
+++ b/src/webengine/doc/src/qtwebengine-overview.qdoc
@@ -149,9 +149,19 @@
engine must be initialized by using \l QtWebEngine::initialize in the application main source
file, as illustrated by the following code snippet:
- \quotefromfile webengine/minimal/main.cpp
- \skipto main
- \printuntil }
+ \code
+ int main(int argc, char *argv[])
+ {
+ QGuiApplication app(argc, argv);
+
+ QtWebEngine::initialize();
+
+ QQmlApplicationEngine engine;
+ engine.load(QUrl("qrc:/main.qml"));
+
+ return app.exec();
+ }
+ \endcode
An application can load pages into the WebEngineView, using either an URL or HTML string, and
navigate within session history. By default, links to different pages load within the same
diff --git a/src/webengine/doc/src/qtwebengine-qmlmodule.qdoc b/src/webengine/doc/src/qtwebengine-qmlmodule.qdoc
index 17c29a126..5e172087d 100644
--- a/src/webengine/doc/src/qtwebengine-qmlmodule.qdoc
+++ b/src/webengine/doc/src/qtwebengine-qmlmodule.qdoc
@@ -28,7 +28,7 @@
/*!
\qmlmodule QtWebEngine 1.8
\title Qt WebEngine QML Types
- \brief Provides QML types for rendering web content within a QML application
+ \brief Provides QML types for rendering web content within a QML application.
\ingroup qtwebengine-modules
\ingroup qmlmodules
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp
index 67f3d7a76..aa1f7be7c 100644
--- a/src/webenginewidgets/api/qwebenginepage.cpp
+++ b/src/webenginewidgets/api/qwebenginepage.cpp
@@ -905,7 +905,7 @@ QWebEnginePage::QWebEnginePage(QObject* parent)
\property QWebEnginePage::contentsSize
\since 5.7
- The size of the page contents.
+ \brief The size of the page contents.
*/
/*!
@@ -1054,7 +1054,7 @@ void QWebEnginePage::setWebChannel(QWebChannel *channel, uint worldId)
/*!
\property QWebEnginePage::backgroundColor
- \brief the page's background color behind the document's body.
+ \brief The page's background color behind the document's body.
\since 5.6
You can set the background color to Qt::transparent or to a translucent
@@ -1105,7 +1105,7 @@ void QWebEnginePage::save(const QString &filePath,
/*!
\property QWebEnginePage::audioMuted
- \brief whether the current page audio is muted.
+ \brief Whether the current page audio is muted.
\since 5.7
The default value is \c false.
@@ -1127,7 +1127,7 @@ void QWebEnginePage::setAudioMuted(bool muted) {
/*!
\property QWebEnginePage::recentlyAudible
- \brief the current page's \e {audible state}, that is, whether audio was recently played
+ \brief The current page's \e {audible state}, that is, whether audio was recently played
or not.
\since 5.7
@@ -2046,7 +2046,7 @@ QUrl QWebEnginePage::requestedUrl() const
/*!
\property QWebEnginePage::iconUrl
- \brief the URL of the icon associated with the page currently viewed
+ \brief The URL of the icon associated with the page currently viewed.
By default, this property contains an empty URL.
@@ -2060,7 +2060,7 @@ QUrl QWebEnginePage::iconUrl() const
/*!
\property QWebEnginePage::icon
- \brief the icon associated with the page currently viewed
+ \brief The icon associated with the page currently viewed.
\since 5.7
By default, this property contains a null icon. If the web page specifies more than one icon,
diff --git a/src/webenginewidgets/api/qwebengineview.cpp b/src/webenginewidgets/api/qwebengineview.cpp
index 576baad17..966b30100 100644
--- a/src/webenginewidgets/api/qwebengineview.cpp
+++ b/src/webenginewidgets/api/qwebengineview.cpp
@@ -238,7 +238,7 @@ QUrl QWebEngineView::iconUrl() const
/*!
\property QWebEngineView::icon
- \brief the icon associated with the page currently viewed
+ \brief The icon associated with the page currently viewed.
\since 5.7
By default, this property contains a null icon.
diff --git a/src/webenginewidgets/doc/src/qtwebenginewidgets-examples.qdoc b/src/webenginewidgets/doc/src/qtwebenginewidgets-examples.qdoc
index 8accdf062..b6c5cb497 100644
--- a/src/webenginewidgets/doc/src/qtwebenginewidgets-examples.qdoc
+++ b/src/webenginewidgets/doc/src/qtwebenginewidgets-examples.qdoc
@@ -28,7 +28,7 @@
/*!
\group webengine-widgetexamples
\title Qt WebEngine Widgets Examples
- \brief Examples demonstrating the Qt WebEngine Widgets usage
+ \brief Examples demonstrating the Qt WebEngine Widgets usage.
\ingroup all-examples
Qt provides an integrated Web browser component based on Chromium, the popular
diff --git a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc
index 035b45a6d..517fdc7d9 100644
--- a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc
+++ b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc
@@ -449,14 +449,14 @@
/*!
\property QWebEnginePage::hasSelection
- \brief whether this page contains selected content or not.
+ \brief Whether this page contains selected content or not.
\sa selectionChanged()
*/
/*!
\property QWebEnginePage::selectedText
- \brief the text currently selected
+ \brief The text currently selected.
By default, this property contains an empty string.
@@ -641,14 +641,20 @@
/*!
\property QWebEnginePage::title
- \brief the title of the page as defined by the HTML \c <title> element
+ \brief The title of the page as defined by the HTML \c <title> element.
+
+ If the page has no \c <title> element, then the URL is used instead. For \c
+ file:// URLs only the filename is used and not the full path.
+
+ By default, before any content has been loaded, this property contains an
+ empty string.
\sa titleChanged()
*/
/*!
\property QWebEnginePage::url
- \brief the URL of the page currently viewed
+ \brief The URL of the page currently viewed.
Setting this property clears the view and loads the URL.
@@ -659,8 +665,8 @@
/*!
\property QWebEnginePage::requestedUrl
- \brief the URL that was originally requested to be loaded by the page
- that is currently viewed
+ \brief The URL that was originally requested to be loaded by the page
+ that is currently viewed.
\note The URL may differ from the one returned by url(), which is the actual
URL that results from DNS resolution or redirection.
@@ -727,7 +733,7 @@
/*!
\property QWebEnginePage::zoomFactor
- \brief the zoom factor for the page content
+ \brief The zoom factor for the page content.
Valid values are within the range from \c{0.25} to \c{5.0}. The default factor is \c{1.0}.
*/
diff --git a/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc
index 501959ab9..568e7a63a 100644
--- a/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc
+++ b/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc
@@ -173,16 +173,16 @@
/*!
\property QWebEngineView::title
- \brief the title of the web page currently viewed
+ \brief The title of the page as defined by the HTML \c <title> element.
- By default, this property contains an empty string.
+ Equivalent to \l {QWebEnginePage::title()}.
\sa titleChanged()
*/
/*!
\property QWebEngineView::url
- \brief the URL of the web page currently viewed
+ \brief The URL of the web page currently viewed.
Setting this property clears the view and loads the URL.
@@ -193,7 +193,7 @@
/*!
\property QWebEngineView::iconUrl
- \brief the URL of the icon associated with the page currently viewed
+ \brief The URL of the icon associated with the page currently viewed.
By default, this property contains an empty URL.
@@ -202,7 +202,7 @@
/*!
\property QWebEngineView::hasSelection
- \brief whether this page contains selected content or not.
+ \brief Whether this page contains selected content or not.
By default, this property is \c false.
@@ -211,7 +211,7 @@
/*!
\property QWebEngineView::selectedText
- \brief the text currently selected
+ \brief The text currently selected.
By default, this property contains an empty string.
@@ -238,7 +238,7 @@
/*!
\property QWebEngineView::zoomFactor
- \brief the zoom factor for the view
+ \brief The zoom factor for the view.
Valid values are within the range from \c{0.25} to \c{5.0}. The default factor is \c{1.0}.
*/
diff --git a/tests/auto/quick/qmltests/data/tst_favicon.qml b/tests/auto/quick/qmltests/data/tst_favicon.qml
index 563a87c83..50a412384 100644
--- a/tests/auto/quick/qmltests/data/tst_favicon.qml
+++ b/tests/auto/quick/qmltests/data/tst_favicon.qml
@@ -375,5 +375,38 @@ TestWebEngineView {
faviconImage.destroy()
}
+
+ function test_touchIconWithSameURL()
+ {
+ WebEngine.settings.touchIconsEnabled = false;
+
+ var icon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII=";
+
+ webEngineView.loadHtml(
+ "<html>" +
+ "<link rel='icon' type='image/png' href='" + icon + "'/>" +
+ "<link rel='apple-touch-icon' type='image/png' href='" + icon + "'/>" +
+ "</html>"
+ );
+ verify(webEngineView.waitForLoadSucceeded());
+
+ // The default favicon has to be loaded even if its URL is also set as a touch icon while touch icons are disabled.
+ tryCompare(iconChangedSpy, "count", 1);
+ compare(webEngineView.icon.toString().replace(/^image:\/\/favicon\//, ''), icon);
+
+ iconChangedSpy.clear();
+
+ webEngineView.loadHtml(
+ "<html>" +
+ "<link rel='apple-touch-icon' type='image/png' href='" + icon + "'/>" +
+ "</html>"
+ );
+ verify(webEngineView.waitForLoadSucceeded());
+
+ // This page only has a touch icon. With disabled touch icons we don't expect any icon to be shown even if the same icon
+ // was loaded previously.
+ tryCompare(iconChangedSpy, "count", 1);
+ verify(!webEngineView.icon.toString().replace(/^image:\/\/favicon\//, ''));
+ }
}
}
diff --git a/tests/auto/widgets/faviconmanager/tst_faviconmanager.cpp b/tests/auto/widgets/faviconmanager/tst_faviconmanager.cpp
index 606d05d9e..540c8d505 100644
--- a/tests/auto/widgets/faviconmanager/tst_faviconmanager.cpp
+++ b/tests/auto/widgets/faviconmanager/tst_faviconmanager.cpp
@@ -62,6 +62,7 @@ private Q_SLOTS:
void downloadTouchIconsEnabled_data();
void downloadTouchIconsEnabled();
void dynamicFavicon();
+ void touchIconWithSameURL();
private:
QWebEngineView *m_view;
@@ -508,6 +509,43 @@ void tst_FaviconManager::dynamicFavicon()
}
}
+void tst_FaviconManager::touchIconWithSameURL()
+{
+ m_page->settings()->setAttribute(QWebEngineSettings::TouchIconsEnabled, false);
+
+ const QString icon("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII=");
+ QSignalSpy loadFinishedSpy(m_page, SIGNAL(loadFinished(bool)));
+ QSignalSpy iconUrlChangedSpy(m_page, SIGNAL(iconUrlChanged(QUrl)));
+ QSignalSpy iconChangedSpy(m_page, SIGNAL(iconChanged(QIcon)));
+
+ m_page->setHtml("<html>"
+ "<link rel='icon' type='image/png' href='" + icon + "'/>"
+ "<link rel='apple-touch-icon' type='image/png' href='" + icon + "'/>"
+ "</html>");
+ QTRY_COMPARE(loadFinishedSpy.count(), 1);
+
+ // The default favicon has to be loaded even if its URL is also set as a touch icon while touch icons are disabled.
+ QTRY_COMPARE(iconUrlChangedSpy.count(), 1);
+ QCOMPARE(m_page->iconUrl().toString(), icon);
+ QTRY_COMPARE(iconChangedSpy.count(), 1);
+
+ loadFinishedSpy.clear();
+ iconUrlChangedSpy.clear();
+ iconChangedSpy.clear();
+
+ m_page->setHtml("<html>"
+ "<link rel='apple-touch-icon' type='image/png' href='" + icon + "'/>"
+ "</html>");
+ QTRY_COMPARE(loadFinishedSpy.count(), 1);
+
+ // This page only has a touch icon. With disabled touch icons we don't expect any icon to be shown even if the same icon
+ // was loaded previously.
+ QTRY_COMPARE(iconUrlChangedSpy.count(), 1);
+ QVERIFY(m_page->iconUrl().toString().isEmpty());
+ QTRY_COMPARE(iconChangedSpy.count(), 1);
+
+}
+
QTEST_MAIN(tst_FaviconManager)
#include "tst_faviconmanager.moc"