summaryrefslogtreecommitdiffstats
path: root/src/webengine
diff options
context:
space:
mode:
Diffstat (limited to 'src/webengine')
-rw-r--r--src/webengine/api/qquickwebenginecontextmenurequest.cpp119
-rw-r--r--src/webengine/api/qquickwebenginecontextmenurequest_p.h38
-rw-r--r--src/webengine/api/qquickwebenginedownloaditem.cpp115
-rw-r--r--src/webengine/api/qquickwebenginedownloaditem_p.h12
-rw-r--r--src/webengine/api/qquickwebenginedownloaditem_p_p.h4
-rw-r--r--src/webengine/api/qquickwebengineprofile.cpp44
-rw-r--r--src/webengine/api/qquickwebengineprofile_p.h4
-rw-r--r--src/webengine/api/qquickwebenginesettings.cpp149
-rw-r--r--src/webengine/api/qquickwebenginesettings_p.h32
-rw-r--r--src/webengine/api/qquickwebenginetestsupport.cpp132
-rw-r--r--src/webengine/api/qquickwebenginetestsupport_p.h41
-rw-r--r--src/webengine/api/qquickwebengineview.cpp608
-rw-r--r--src/webengine/api/qquickwebengineview_p.h95
-rw-r--r--src/webengine/api/qquickwebengineview_p_p.h154
-rw-r--r--src/webengine/doc/src/external-resources.qdoc10
-rw-r--r--src/webengine/doc/src/qtwebengine-features.qdoc67
-rw-r--r--src/webengine/doc/src/qtwebengine-overview.qdoc2
-rw-r--r--src/webengine/doc/src/qtwebengine-platform-notes.qdoc14
-rw-r--r--src/webengine/doc/src/webengineview_lgpl.qdoc216
-rw-r--r--src/webengine/plugin/plugin.cpp16
-rw-r--r--src/webengine/plugin/plugin.pro2
-rw-r--r--src/webengine/plugin/plugins.qmltypes128
-rw-r--r--src/webengine/plugin/testsupport/plugin.cpp4
-rw-r--r--src/webengine/plugin/testsupport/testsupport.pro2
-rw-r--r--src/webengine/render_widget_host_view_qt_delegate_quick.cpp34
-rw-r--r--src/webengine/render_widget_host_view_qt_delegate_quick.h83
-rw-r--r--src/webengine/render_widget_host_view_qt_delegate_quickwindow.h48
-rw-r--r--src/webengine/ui_delegates_manager.cpp4
-rw-r--r--src/webengine/webengine.pro13
29 files changed, 1729 insertions, 461 deletions
diff --git a/src/webengine/api/qquickwebenginecontextmenurequest.cpp b/src/webengine/api/qquickwebenginecontextmenurequest.cpp
index df57442a1..dea89b9ab 100644
--- a/src/webengine/api/qquickwebenginecontextmenurequest.cpp
+++ b/src/webengine/api/qquickwebenginecontextmenurequest.cpp
@@ -42,6 +42,7 @@
QT_BEGIN_NAMESPACE
+// Match MediaType enum
ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::MediaTypeNone,
QQuickWebEngineContextMenuRequest::MediaTypeNone)
ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::MediaTypeImage,
@@ -57,6 +58,52 @@ ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::MediaTypeFile,
ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::MediaTypePlugin,
QQuickWebEngineContextMenuRequest::MediaTypePlugin)
+// Match MediaFlag enum
+ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::MediaNone,
+ QQuickWebEngineContextMenuRequest::MediaNone)
+ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::MediaInError,
+ QQuickWebEngineContextMenuRequest::MediaInError)
+ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::MediaPaused,
+ QQuickWebEngineContextMenuRequest::MediaPaused)
+ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::MediaMuted,
+ QQuickWebEngineContextMenuRequest::MediaMuted)
+ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::MediaLoop,
+ QQuickWebEngineContextMenuRequest::MediaLoop)
+ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::MediaCanSave,
+ QQuickWebEngineContextMenuRequest::MediaCanSave)
+ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::MediaHasAudio,
+ QQuickWebEngineContextMenuRequest::MediaHasAudio)
+ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::MediaCanToggleControls,
+ QQuickWebEngineContextMenuRequest::MediaCanToggleControls)
+ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::MediaControls,
+ QQuickWebEngineContextMenuRequest::MediaControls)
+ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::MediaCanPrint,
+ QQuickWebEngineContextMenuRequest::MediaCanPrint)
+ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::MediaCanRotate,
+ QQuickWebEngineContextMenuRequest::MediaCanRotate)
+
+// Match EditFlag enum
+ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::CanDoNone,
+ QQuickWebEngineContextMenuRequest::CanDoNone)
+ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::CanUndo,
+ QQuickWebEngineContextMenuRequest::CanUndo)
+ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::CanRedo,
+ QQuickWebEngineContextMenuRequest::CanRedo)
+ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::CanCut,
+ QQuickWebEngineContextMenuRequest::CanCut)
+ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::CanCopy,
+ QQuickWebEngineContextMenuRequest::CanCopy)
+ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::CanPaste,
+ QQuickWebEngineContextMenuRequest::CanPaste)
+ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::CanDelete,
+ QQuickWebEngineContextMenuRequest::CanDelete)
+ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::CanSelectAll,
+ QQuickWebEngineContextMenuRequest::CanSelectAll)
+ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::CanTranslate,
+ QQuickWebEngineContextMenuRequest::CanTranslate)
+ASSERT_ENUMS_MATCH(QtWebEngineCore::WebEngineContextMenuData::CanEditRichly,
+ QQuickWebEngineContextMenuRequest::CanEditRichly)
+
/*!
\qmltype ContextMenuRequest
\instantiates QQuickWebEngineContextMenuRequest
@@ -159,11 +206,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();
}
/*!
@@ -271,4 +319,73 @@ void QQuickWebEngineContextMenuRequest::setAccepted(bool accepted)
m_accepted = accepted;
}
+/*!
+ \qmlproperty flags ContextMenuRequest::mediaFlags
+ \readonly
+ \since QtWebEngine 1.7
+
+ The current media element's status and its available operations.
+ \c MediaNone if the selected web page content is not a media element.
+
+ \value ContextMenuRequest.MediaNone
+ Not a media element.
+ \value ContextMenuRequest.MediaInError
+ An error occurred.
+ \value ContextMenuRequest.MediaPaused
+ Media is paused.
+ \value ContextMenuRequest.MediaMuted
+ Media is muted.
+ \value ContextMenuRequest.MediaLoop
+ Media can be looped.
+ \value ContextMenuRequest.MediaCanSave
+ Media can be saved.
+ \value ContextMenuRequest.MediaHasAudio
+ Media has audio.
+ \value ContextMenuRequest.MediaCanToggleControls
+ Media can show controls.
+ \value ContextMenuRequest.MediaControls
+ Media controls are shown.
+ \value ContextMenuRequest.MediaCanPrint
+ Media is printable.
+ \value ContextMenuRequest.MediaCanRotate
+ Media is rotatable.
+*/
+QQuickWebEngineContextMenuRequest::MediaFlags QQuickWebEngineContextMenuRequest::mediaFlags() const
+{
+ return static_cast<QQuickWebEngineContextMenuRequest::MediaFlags>(m_data->mediaFlags());
+}
+
+/*!
+ \qmlproperty flags ContextMenuRequest::editFlags
+ \readonly
+ \since QtWebEngine 1.7
+
+ The available edit operations in the current context or \c CanDoNone if no actions are available.
+
+ \value ContextMenuRequest.CanDoNone
+ Nothing can be done.
+ \value ContextMenuRequest.CanUndo
+ Undo is available.
+ \value ContextMenuRequest.CanRedo
+ Redo is available.
+ \value ContextMenuRequest.CanCut
+ Cut is available.
+ \value ContextMenuRequest.CanCopy
+ Copy is available.
+ \value ContextMenuRequest.CanPaste
+ Paste is available.
+ \value ContextMenuRequest.CanDelete
+ Delete is available.
+ \value ContextMenuRequest.CanSelectAll
+ Select All is available.
+ \value ContextMenuRequest.CanTranslate
+ Translate is available.
+ \value ContextMenuRequest.CanEditRichly
+ Context is richly editable.
+*/
+QQuickWebEngineContextMenuRequest::EditFlags QQuickWebEngineContextMenuRequest::editFlags() const
+{
+ return static_cast<QQuickWebEngineContextMenuRequest::EditFlags>(m_data->editFlags());
+}
+
QT_END_NAMESPACE
diff --git a/src/webengine/api/qquickwebenginecontextmenurequest_p.h b/src/webengine/api/qquickwebenginecontextmenurequest_p.h
index 3d2de14a2..5f0b0c282 100644
--- a/src/webengine/api/qquickwebenginecontextmenurequest_p.h
+++ b/src/webengine/api/qquickwebenginecontextmenurequest_p.h
@@ -75,6 +75,38 @@ public:
};
Q_ENUM(MediaType)
+ // Must match QWebEngineCore::WebEngineContextMenuData::MediaFlags:
+ enum MediaFlag {
+ MediaNone = 0x0,
+ MediaInError = 0x1,
+ MediaPaused = 0x2,
+ MediaMuted = 0x4,
+ MediaLoop = 0x8,
+ MediaCanSave = 0x10,
+ MediaHasAudio = 0x20,
+ MediaCanToggleControls = 0x40,
+ MediaControls = 0x80,
+ MediaCanPrint = 0x100,
+ MediaCanRotate = 0x200,
+ };
+ Q_DECLARE_FLAGS(MediaFlags, MediaFlag)
+
+
+ // Must match QWebEngineCore::WebEngineContextMenuData::EditFlags:
+ enum EditFlag {
+ CanDoNone = 0x0,
+ CanUndo = 0x1,
+ CanRedo = 0x2,
+ CanCut = 0x4,
+ CanCopy = 0x8,
+ CanPaste = 0x10,
+ CanDelete = 0x20,
+ CanSelectAll = 0x40,
+ CanTranslate = 0x80,
+ CanEditRichly = 0x100,
+ };
+ Q_DECLARE_FLAGS(EditFlags, EditFlag)
+
Q_PROPERTY(int x READ x CONSTANT FINAL)
Q_PROPERTY(int y READ y CONSTANT FINAL)
Q_PROPERTY(QString selectedText READ selectedText CONSTANT FINAL)
@@ -86,6 +118,8 @@ public:
Q_PROPERTY(QString misspelledWord READ misspelledWord CONSTANT FINAL)
Q_PROPERTY(QStringList spellCheckerSuggestions READ spellCheckerSuggestions CONSTANT FINAL)
Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted FINAL)
+ Q_PROPERTY(MediaFlags mediaFlags READ mediaFlags CONSTANT FINAL REVISION 1)
+ Q_PROPERTY(EditFlags editFlags READ editFlags CONSTANT FINAL REVISION 1)
~QQuickWebEngineContextMenuRequest();
int x() const;
@@ -100,11 +134,15 @@ public:
QStringList spellCheckerSuggestions() const;
bool isAccepted() const;
void setAccepted(bool accepted);
+ MediaFlags mediaFlags() const;
+ EditFlags editFlags() const;
private:
QQuickWebEngineContextMenuRequest(const QtWebEngineCore::WebEngineContextMenuData &data, QObject *parent = nullptr);
QScopedPointer<QtWebEngineCore::WebEngineContextMenuData> m_data;
bool m_accepted;
+ Q_FLAGS(MediaFlags)
+ Q_FLAGS(EditFlags)
friend class QQuickWebEngineView;
friend class QQuickWebEngineViewPrivate;
Q_DISABLE_COPY(QQuickWebEngineContextMenuRequest)
diff --git a/src/webengine/api/qquickwebenginedownloaditem.cpp b/src/webengine/api/qquickwebenginedownloaditem.cpp
index bc40e6771..8d7550d6c 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;
@@ -99,10 +101,12 @@ QQuickWebEngineDownloadItemPrivate::QQuickWebEngineDownloadItemPrivate(QQuickWeb
, downloadId(-1)
, downloadState(QQuickWebEngineDownloadItem::DownloadCancelled)
, savePageFormat(QQuickWebEngineDownloadItem::UnknownSaveFormat)
- , type(QQuickWebEngineDownloadItem::Attachment)
+ , isSavePageDownload(false)
, 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
@@ -343,26 +397,33 @@ void QQuickWebEngineDownloadItem::setSavePageFormat(QQuickWebEngineDownloadItem:
\qmlproperty enumeration WebEngineDownloadItem::type
\readonly
\since QtWebEngine 1.4
+ \obsolete
Describes the requested download's type.
- \value WebEngineDownloadItem.Attachment The web server's response includes a
- \c Content-Disposition header with the \c attachment directive. If \c Content-Disposition
- is present in the reply, the web server is indicating that the client should prompt the
- user to save the content regardless of the content type.
- See \l {RFC 2616 section 19.5.1} for details.
- \value WebEngineDownloadItem.DownloadAttribute The user clicked a link with the \c download
- attribute. See \l {HTML download attribute} for details.
- \value WebEngineDownloadItem.UserRequested The user initiated the download, for example by
- selecting a web action.
- \value WebEngineDownloadItem.SavePage Saving of the current page was requested (for example by
- the \l{WebEngineView::WebAction}{WebEngineView.SavePage} web action).
+ Unfortunately, this property only ever worked correctly for \c SavePage
+ downloads. In other cases, it followed the documented semantics rather
+ loosely, sometimes non-deterministically. Use \l isSavePageDownload instead.
*/
QQuickWebEngineDownloadItem::DownloadType QQuickWebEngineDownloadItem::type() const
{
+ return isSavePageDownload() ? SavePage : UserRequested;
+}
+
+/*!
+ \qmlproperty bool WebEngineDownloadItem::isSavePageDownload
+ \readonly
+ \since QtWebEngine 1.7
+
+ Whether this is a download request for saving a web page or a file.
+
+ \sa savePageFormat
+*/
+bool QQuickWebEngineDownloadItem::isSavePageDownload() const
+{
Q_D(const QQuickWebEngineDownloadItem);
- return d->type;
+ return d->isSavePageDownload;
}
/*!
@@ -426,6 +487,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..1699ee9dc 100644
--- a/src/webengine/api/qquickwebenginedownloaditem_p.h
+++ b/src/webengine/api/qquickwebenginedownloaditem_p.h
@@ -131,9 +131,14 @@ 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_PROPERTY(bool isSavePageDownload READ isSavePageDownload CONSTANT REVISION 6 FINAL)
Q_INVOKABLE void accept();
Q_INVOKABLE void cancel();
+ Q_INVOKABLE void pause();
+ Q_INVOKABLE void resume();
quint32 id() const;
DownloadState state() const;
@@ -144,9 +149,12 @@ public:
void setPath(QString path);
SavePageFormat savePageFormat() const;
void setSavePageFormat(SavePageFormat format);
- DownloadType type() const;
+ DownloadType Q_DECL_DEPRECATED type() const;
DownloadInterruptReason interruptReason() const;
QString interruptReasonString() const;
+ bool isFinished() const;
+ bool isPaused() const;
+ bool isSavePageDownload() const;
Q_SIGNALS:
void stateChanged();
@@ -157,6 +165,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..922b0379c 100644
--- a/src/webengine/api/qquickwebenginedownloaditem_p_p.h
+++ b/src/webengine/api/qquickwebenginedownloaditem_p_p.h
@@ -73,12 +73,14 @@ public:
quint32 downloadId;
QQuickWebEngineDownloadItem::DownloadState downloadState;
QQuickWebEngineDownloadItem::SavePageFormat savePageFormat;
- QQuickWebEngineDownloadItem::DownloadType type;
+ bool isSavePageDownload;
QQuickWebEngineDownloadItem::DownloadInterruptReason interruptReason;
qint64 totalBytes;
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 e051d8755..17c9738fb 100644
--- a/src/webengine/api/qquickwebengineprofile.cpp
+++ b/src/webengine/api/qquickwebengineprofile.cpp
@@ -98,9 +98,10 @@ ASSERT_ENUMS_MATCH(QQuickWebEngineDownloadItem::MimeHtmlSaveFormat, QtWebEngineC
This enum describes the HTTP cache type:
- \value MemoryHttpCache Use an in-memory cache. This is the only setting possible if
- \c off-the-record is set or no cache path is available.
- \value DiskHttpCache Use a disk cache. This is the default.
+ \value MemoryHttpCache Use an in-memory cache. This is the default if
+ \c off-the-record is set.
+ \value DiskHttpCache Use a disk cache. This is the default if \c off-the-record
+ is not set. Falls back to \c MemoryHttpCache if \c off-the-record is set.
\value NoCache Disable both in-memory and disk caching. (Added in Qt 5.7)
*/
@@ -144,7 +145,7 @@ QQuickWebEngineProfilePrivate::QQuickWebEngineProfilePrivate(QSharedPointer<Brow
: m_settings(new QQuickWebEngineSettings())
, m_browserContext(new QWebEngineBrowserContext(browserContext, 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);
@@ -192,7 +193,7 @@ void QQuickWebEngineProfilePrivate::downloadRequested(DownloadItemInfo &info)
itemPrivate->downloadPath = info.path;
itemPrivate->savePageFormat = static_cast<QQuickWebEngineDownloadItem::SavePageFormat>(
info.savePageFormat);
- itemPrivate->type = static_cast<QQuickWebEngineDownloadItem::DownloadType>(info.downloadType);
+ itemPrivate->isSavePageDownload = info.isSavePageDownload;
QQuickWebEngineDownloadItem *download = new QQuickWebEngineDownloadItem(itemPrivate, q);
@@ -676,34 +677,8 @@ QQuickWebEngineProfile *QQuickWebEngineProfile::defaultProfile()
For example, the language \c en-US will load the \c en-US.bdic
dictionary file.
- Qt WebEngine checks for the \c qtwebengine_dictionaries subdirectory
- first in the local directory and if it is not found, in the Qt
- installation directory.
-
- On macOS, depending on how Qt WebEngine is configured at build time, there are two possibilities
- how spellchecking data is found:
-
- \list
- \li Hunspell dictionaries (default) - .bdic dictionaries are used, just like on other
- platforms
- \li Native dictionaries - the macOS spellchecking APIs are used (which means the results
- will depend on the installed OS dictionaries)
- \endlist
-
- Thus, in the macOS Hunspell case, Qt WebEngine will look in the \e qtwebengine_dictionaries
- subdirectory located inside the application bundle \c Resources directory, and also in the
- \c Resources directory located inside the Qt framework bundle.
-
- To summarize, in case of Hunspell usage, the following paths are considered:
-
- \list
- \li QCoreApplication::applicationDirPath()/qtwebengine_dictionaries
- or QCoreApplication::applicationDirPath()/../Contents/Resources/qtwebengine_dictionaries
- (on macOS)
- \li [QLibraryInfo::DataPath]/qtwebengine_dictionaries
- or path/to/QtWebEngineCore.framework/Resources/qtwebengine_dictionaries (Qt framework
- bundle on macOS)
- \endlist
+ See the \l {Spellchecker}{Spellchecker feature documentation} for how
+ dictionary files are searched.
For more information about how to compile \c .bdic dictionaries, see the
\l{WebEngine Widgets Spellchecker Example}{Spellchecker Example}.
@@ -821,7 +796,8 @@ static bool checkInternalScheme(const QByteArray &scheme)
static QSet<QByteArray> internalSchemes;
if (internalSchemes.isEmpty()) {
internalSchemes << QByteArrayLiteral("qrc") << QByteArrayLiteral("data") << QByteArrayLiteral("blob")
- << QByteArrayLiteral("http") << QByteArrayLiteral("ftp") << QByteArrayLiteral("javascript");
+ << QByteArrayLiteral("http") << QByteArrayLiteral("https") << QByteArrayLiteral("ftp")
+ << QByteArrayLiteral("javascript");
}
return internalSchemes.contains(scheme);
}
diff --git a/src/webengine/api/qquickwebengineprofile_p.h b/src/webengine/api/qquickwebengineprofile_p.h
index 660433fd9..61968bf77 100644
--- a/src/webengine/api/qquickwebengineprofile_p.h
+++ b/src/webengine/api/qquickwebengineprofile_p.h
@@ -78,8 +78,8 @@ public:
void cancelDownload(quint32 downloadId);
void downloadDestroyed(quint32 downloadId);
- void downloadRequested(DownloadItemInfo &info) Q_DECL_OVERRIDE;
- void downloadUpdated(const DownloadItemInfo &info) Q_DECL_OVERRIDE;
+ void downloadRequested(DownloadItemInfo &info) override;
+ void downloadUpdated(const DownloadItemInfo &info) override;
// QQmlListPropertyHelpers
static void userScripts_append(QQmlListProperty<QQuickWebEngineScript> *p, QQuickWebEngineScript *script);
diff --git a/src/webengine/api/qquickwebenginesettings.cpp b/src/webengine/api/qquickwebenginesettings.cpp
index ff2541376..6203f20f1 100644
--- a/src/webengine/api/qquickwebenginesettings.cpp
+++ b/src/webengine/api/qquickwebenginesettings.cpp
@@ -73,6 +73,22 @@ QQuickWebEngineSettings::~QQuickWebEngineSettings()
{ }
/*!
+ \enum QQuickWebEngineSettings::UnknownUrlSchemePolicy
+ \since WebEngine 1.7
+
+ This enum describes how navigation requests to URLs with unknown schemes are handled.
+
+ \value DisallowUnknownUrlSchemes
+ Disallows all navigation requests to URLs with unknown schemes.
+ \value AllowUnknownUrlSchemesFromUserInteraction
+ Allows navigation requests to URLs with unknown schemes that are issued from
+ user-interaction (like a mouse-click), whereas other navigation requests (for example
+ from JavaScript) are suppressed.
+ \value AllowAllUnknownUrlSchemes
+ Allows all navigation requests to URLs with unknown schemes.
+*/
+
+/*!
\qmlproperty bool WebEngineSettings::autoLoadImages
Automatically loads images on web pages.
@@ -114,6 +130,9 @@ bool QQuickWebEngineSettings::javascriptCanOpenWindows() const
Allows JavaScript programs to read from or write to the clipboard.
Writing to the clipboard is always allowed if it is specifically requested by the user.
+ To enable also the pasting of clipboard content from JavaScript,
+ use javascriptCanPaste.
+
Disabled by default.
*/
bool QQuickWebEngineSettings::javascriptCanAccessClipboard() const
@@ -311,8 +330,7 @@ bool QQuickWebEngineSettings::touchIconsEnabled() const
Focus is given to the view whenever a navigation operation occurs
(load, stop, reload, reload and bypass cache, forward, backward, set content, and so on).
- Enabled by default. See \l{WebEngine Recipe Browser} for an example where
- this property is disabled.
+ Disabled by default.
*/
bool QQuickWebEngineSettings::focusOnNavigationEnabled() const
{
@@ -363,6 +381,68 @@ 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 bool WebEngineSettings::showScrollBars
+ \since QtWebEngine 1.6
+ Shows scroll bars. Enabled by default.
+*/
+bool QQuickWebEngineSettings::showScrollBars() const
+{
+ return d_ptr->testAttribute(WebEngineSettings::ShowScrollBars);
+}
+
+/*!
+ \qmlproperty bool WebEngineSettings::playbackRequiresUserGesture
+ \since QtWebEngine 1.7
+ Inhibits playback of media content until the user interacts with
+ the page. Disabled by default.
+
+ \note The behavior is similar to Chrome on Android when enabled,
+ and similar to Chrome on desktops when disabled (default).
+*/
+bool QQuickWebEngineSettings::playbackRequiresUserGesture() const
+{
+ return d_ptr->testAttribute(WebEngineSettings::PlaybackRequiresUserGesture);
+}
+
+/*!
+ \qmlproperty bool WebEngineSettings::webRTCPublicInterfacesOnly
+ \since QtWebEngine 1.7
+ Limits WebRTC to public IP addresses only. When disabled WebRTC may also use
+ local network IP addresses, but remote hosts can also see your local network
+ IP address.
+
+ Disabled by default.
+*/
+bool QQuickWebEngineSettings::webRTCPublicInterfacesOnly() const
+{
+ return d_ptr->testAttribute(WebEngineSettings::WebRTCPublicInterfacesOnly);
+}
+
+/*!
+ \qmlproperty bool WebEngineSettings::javascriptCanPaste
+ \since QtWebEngine 1.7
+
+ Enables JavaScript \c{execCommand("paste")}.
+ This also requires enabling javascriptCanAccessClipboard.
+
+ Disabled by default.
+*/
+bool QQuickWebEngineSettings::javascriptCanPaste() const
+{
+ return d_ptr->testAttribute(WebEngineSettings::JavascriptCanPaste);
+}
+
+/*!
\qmlproperty string WebEngineSettings::defaultTextEncoding
\since QtWebEngine 1.2
@@ -376,6 +456,22 @@ QString QQuickWebEngineSettings::defaultTextEncoding() const
return d_ptr->defaultTextEncoding();
}
+ASSERT_ENUMS_MATCH(QQuickWebEngineSettings::DisallowUnknownUrlSchemes, WebEngineSettings::DisallowUnknownUrlSchemes)
+ASSERT_ENUMS_MATCH(QQuickWebEngineSettings::AllowUnknownUrlSchemesFromUserInteraction, WebEngineSettings::AllowUnknownUrlSchemesFromUserInteraction)
+ASSERT_ENUMS_MATCH(QQuickWebEngineSettings::AllowAllUnknownUrlSchemes, WebEngineSettings::AllowAllUnknownUrlSchemes)
+
+/*!
+ \qmlproperty WebEngineSettings::UnknownUrlSchemePolicy WebEngineSettings::unknownUrlSchemePolicy
+ \since QtWebEngine 1.7
+ Specifies how navigation requests to URLs with unknown schemes are handled.
+
+ Default is \l{QWebEngineSettings::UnknownUrlSchemePolicy}{WebEngineSettings.AllowUnknownUrlSchemesFromUserInteraction}.
+*/
+QQuickWebEngineSettings::UnknownUrlSchemePolicy QQuickWebEngineSettings::unknownUrlSchemePolicy() const
+{
+ return static_cast<QQuickWebEngineSettings::UnknownUrlSchemePolicy>(d_ptr->unknownUrlSchemePolicy());
+}
+
void QQuickWebEngineSettings::setAutoLoadImages(bool on)
{
bool wasOn = d_ptr->testAttribute(WebEngineSettings::AutoLoadImages);
@@ -564,6 +660,55 @@ 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::setShowScrollBars(bool on)
+{
+ bool wasOn = d_ptr->testAttribute(WebEngineSettings::ShowScrollBars);
+ d_ptr->setAttribute(WebEngineSettings::ShowScrollBars, on);
+ if (wasOn != on)
+ Q_EMIT showScrollBarsChanged();
+}
+
+void QQuickWebEngineSettings::setPlaybackRequiresUserGesture(bool on)
+{
+ bool wasOn = d_ptr->testAttribute(WebEngineSettings::PlaybackRequiresUserGesture);
+ d_ptr->setAttribute(WebEngineSettings::PlaybackRequiresUserGesture, on);
+ if (wasOn != on)
+ Q_EMIT playbackRequiresUserGestureChanged();
+}
+
+void QQuickWebEngineSettings::setJavascriptCanPaste(bool on)
+{
+ bool wasOn = d_ptr->testAttribute(WebEngineSettings::JavascriptCanPaste);
+ d_ptr->setAttribute(WebEngineSettings::JavascriptCanPaste, on);
+ if (wasOn != on)
+ Q_EMIT javascriptCanPasteChanged();
+}
+
+void QQuickWebEngineSettings::setUnknownUrlSchemePolicy(QQuickWebEngineSettings::UnknownUrlSchemePolicy policy)
+{
+ WebEngineSettings::UnknownUrlSchemePolicy oldPolicy = d_ptr->unknownUrlSchemePolicy();
+ WebEngineSettings::UnknownUrlSchemePolicy newPolicy = static_cast<WebEngineSettings::UnknownUrlSchemePolicy>(policy);
+ d_ptr->setUnknownUrlSchemePolicy(newPolicy);
+ if (oldPolicy != newPolicy)
+ Q_EMIT unknownUrlSchemePolicyChanged();
+}
+
+void QQuickWebEngineSettings::setWebRTCPublicInterfacesOnly(bool on)
+{
+ bool wasOn = d_ptr->testAttribute(WebEngineSettings::WebRTCPublicInterfacesOnly);
+ d_ptr->setAttribute(WebEngineSettings::WebRTCPublicInterfacesOnly, on);
+ if (wasOn != on)
+ Q_EMIT webRTCPublicInterfacesOnlyChanged();
+}
+
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..267767941 100644
--- a/src/webengine/api/qquickwebenginesettings_p.h
+++ b/src/webengine/api/qquickwebenginesettings_p.h
@@ -86,8 +86,22 @@ 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)
+ Q_PROPERTY(bool showScrollBars READ showScrollBars WRITE setShowScrollBars NOTIFY showScrollBarsChanged REVISION 5 FINAL)
+ Q_PROPERTY(UnknownUrlSchemePolicy unknownUrlSchemePolicy READ unknownUrlSchemePolicy WRITE setUnknownUrlSchemePolicy NOTIFY unknownUrlSchemePolicyChanged REVISION 6 FINAL)
+ Q_PROPERTY(bool playbackRequiresUserGesture READ playbackRequiresUserGesture WRITE setPlaybackRequiresUserGesture NOTIFY playbackRequiresUserGestureChanged REVISION 6 FINAL)
+ Q_PROPERTY(bool webRTCPublicInterfacesOnly READ webRTCPublicInterfacesOnly WRITE setWebRTCPublicInterfacesOnly NOTIFY webRTCPublicInterfacesOnlyChanged REVISION 6 FINAL)
+ Q_PROPERTY(bool javascriptCanPaste READ javascriptCanPaste WRITE setJavascriptCanPaste NOTIFY javascriptCanPasteChanged REVISION 6 FINAL)
public:
+ enum UnknownUrlSchemePolicy {
+ DisallowUnknownUrlSchemes = 1,
+ AllowUnknownUrlSchemesFromUserInteraction,
+ AllowAllUnknownUrlSchemes
+ };
+
+ Q_ENUM(UnknownUrlSchemePolicy)
+
~QQuickWebEngineSettings();
bool autoLoadImages() const;
@@ -113,6 +127,12 @@ public:
bool printElementBackgrounds() const;
bool allowRunningInsecureContent() const;
bool allowGeolocationOnInsecureOrigins() const;
+ bool allowWindowActivationFromJavaScript() const;
+ bool showScrollBars() const;
+ UnknownUrlSchemePolicy unknownUrlSchemePolicy() const;
+ bool playbackRequiresUserGesture() const;
+ bool webRTCPublicInterfacesOnly() const;
+ bool javascriptCanPaste() const;
void setAutoLoadImages(bool on);
void setJavascriptEnabled(bool on);
@@ -137,6 +157,12 @@ public:
void setPrintElementBackgrounds(bool on);
void setAllowRunningInsecureContent(bool on);
void setAllowGeolocationOnInsecureOrigins(bool on);
+ void setAllowWindowActivationFromJavaScript(bool on);
+ void setShowScrollBars(bool on);
+ void setUnknownUrlSchemePolicy(UnknownUrlSchemePolicy policy);
+ void setPlaybackRequiresUserGesture(bool on);
+ void setWebRTCPublicInterfacesOnly(bool on);
+ void setJavascriptCanPaste(bool on);
signals:
void autoLoadImagesChanged();
@@ -162,6 +188,12 @@ signals:
Q_REVISION(3) void printElementBackgroundsChanged();
Q_REVISION(3) void allowRunningInsecureContentChanged();
Q_REVISION(4) void allowGeolocationOnInsecureOriginsChanged();
+ Q_REVISION(5) void allowWindowActivationFromJavaScriptChanged();
+ Q_REVISION(5) void showScrollBarsChanged();
+ Q_REVISION(6) void unknownUrlSchemePolicyChanged();
+ Q_REVISION(6) void playbackRequiresUserGestureChanged();
+ Q_REVISION(6) void webRTCPublicInterfacesOnlyChanged();
+ Q_REVISION(6) void javascriptCanPasteChanged();
private:
explicit QQuickWebEngineSettings(QQuickWebEngineSettings *parentSettings = 0);
diff --git a/src/webengine/api/qquickwebenginetestsupport.cpp b/src/webengine/api/qquickwebenginetestsupport.cpp
index 46ffb06f4..b7b863125 100644
--- a/src/webengine/api/qquickwebenginetestsupport.cpp
+++ b/src/webengine/api/qquickwebenginetestsupport.cpp
@@ -40,32 +40,136 @@
#include "qquickwebenginetestsupport_p.h"
#include "qquickwebengineloadrequest_p.h"
+#include <QQuickWindow>
+#include <QtTest/qtest.h>
+#include <QtCore/QTimer>
QT_BEGIN_NAMESPACE
+namespace QTest {
+ int Q_TESTLIB_EXPORT defaultMouseDelay();
+}
+
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);
- Q_EMIT loadingChanged(&loadRequest);
- return;
+ QTimer::singleShot(0, this, [this, url]() {
+ QQuickWebEngineLoadRequest loadRequest(url, QQuickWebEngineView::LoadSucceededStatus);
+ emit loadingChanged(&loadRequest);
+ });
}
void QQuickWebEngineErrorPage::loadStarted(const QUrl &provisionalUrl)
{
- QQuickWebEngineLoadRequest loadRequest(provisionalUrl, QQuickWebEngineView::LoadStartedStatus);
- Q_EMIT loadingChanged(&loadRequest);
+ QTimer::singleShot(0, this, [this, provisionalUrl]() {
+ QQuickWebEngineLoadRequest loadRequest(provisionalUrl, QQuickWebEngineView::LoadStartedStatus);
+ 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;
+}
+
+
+QQuickWebEngineTestEvent::QQuickWebEngineTestEvent()
+{
+}
+
+bool QQuickWebEngineTestEvent::mouseMultiClick(QObject *item, qreal x, qreal y, int clickCount)
+{
+ QTEST_ASSERT(item);
+
+ QWindow *view = eventWindow(item);
+ if (!view)
+ return false;
+
+ for (int i = 0; i < clickCount; ++i) {
+ mouseEvent(QMouseEvent::MouseButtonPress, view, item, QPointF(x, y));
+ mouseEvent(QMouseEvent::MouseButtonRelease, view, item, QPointF(x, y));
+ }
+ QTest::lastMouseTimestamp += QTest::mouseDoubleClickInterval;
+
+ return true;
+}
+
+QWindow *QQuickWebEngineTestEvent::eventWindow(QObject *item)
+{
+ QWindow *window = qobject_cast<QWindow *>(item);
+ if (window)
+ return window;
+
+ QQuickItem *quickItem = qobject_cast<QQuickItem *>(item);
+ if (quickItem)
+ return quickItem->window();
+
+ QQuickItem *testParentItem = qobject_cast<QQuickItem *>(parent());
+ if (testParentItem)
+ return testParentItem->window();
+
+ return nullptr;
+}
+
+void QQuickWebEngineTestEvent::mouseEvent(QEvent::Type type, QWindow *window, QObject *item, const QPointF &_pos)
+{
+ QTest::qWait(QTest::defaultMouseDelay());
+ QTest::lastMouseTimestamp += QTest::defaultMouseDelay();
+
+ QPoint pos;
+ QQuickItem *sgitem = qobject_cast<QQuickItem *>(item);
+ if (sgitem)
+ pos = sgitem->mapToScene(_pos).toPoint();
+
+ QMouseEvent me(type, pos, window->mapFromGlobal(pos), Qt::LeftButton, Qt::LeftButton, 0);
+ me.setTimestamp(++QTest::lastMouseTimestamp);
+
+ QSpontaneKeyEvent::setSpontaneous(&me);
+ if (!qApp->notify(window, &me))
+ QTest::qWarn("Mouse click event not accepted by receiving window");
+}
+
+
QQuickWebEngineTestSupport::QQuickWebEngineTestSupport()
- : m_errorPage(new QQuickWebEngineErrorPage())
+ : m_errorPage(new QQuickWebEngineErrorPage)
+ , m_testInputContext(new QQuickWebEngineTestInputContext)
+ , m_testEvent(new QQuickWebEngineTestEvent)
{
}
@@ -74,6 +178,16 @@ QQuickWebEngineErrorPage *QQuickWebEngineTestSupport::errorPage() const
return m_errorPage.data();
}
+QQuickWebEngineTestInputContext *QQuickWebEngineTestSupport::testInputContext() const
+{
+ return m_testInputContext.data();
+}
+
+QQuickWebEngineTestEvent * QQuickWebEngineTestSupport::testEvent() const
+{
+ return m_testEvent.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..b601fb47c 100644
--- a/src/webengine/api/qquickwebenginetestsupport_p.h
+++ b/src/webengine/api/qquickwebenginetestsupport_p.h
@@ -51,14 +51,17 @@
// We mean it.
//
+#include <private/qinputmethod_p.h>
#include <private/qtwebengineglobal_p.h>
+#include <QEvent>
#include <QObject>
#include <QUrl>
QT_BEGIN_NAMESPACE
class QQuickWebEngineLoadRequest;
+class QWindow;
class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineErrorPage : public QObject {
Q_OBJECT
@@ -73,13 +76,49 @@ 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 QQuickWebEngineTestEvent : public QObject {
+ Q_OBJECT
+
+public:
+ QQuickWebEngineTestEvent();
+
+public Q_SLOTS:
+ bool mouseMultiClick(QObject *item, qreal x, qreal y, int clickCount);
+
+private:
+ QWindow *eventWindow(QObject *item = 0);
+ void mouseEvent(QEvent::Type type, QWindow *window, QObject *item, const QPointF &_pos);
+};
+
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)
+ Q_PROPERTY(QQuickWebEngineTestEvent *testEvent READ testEvent CONSTANT FINAL)
public:
QQuickWebEngineTestSupport();
QQuickWebEngineErrorPage *errorPage() const;
+ QQuickWebEngineTestInputContext *testInputContext() const;
+ QQuickWebEngineTestEvent *testEvent() const;
Q_SIGNALS:
void windowCloseRejected();
@@ -87,6 +126,8 @@ Q_SIGNALS:
private:
QScopedPointer<QQuickWebEngineErrorPage> m_errorPage;
+ QScopedPointer<QQuickWebEngineTestInputContext> m_testInputContext;
+ QScopedPointer<QQuickWebEngineTestEvent> m_testEvent;
};
QT_END_NAMESPACE
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
index 297790f34..85681bfef 100644
--- a/src/webengine/api/qquickwebengineview.cpp
+++ b/src/webengine/api/qquickwebengineview.cpp
@@ -45,6 +45,8 @@
#include "certificate_error_controller.h"
#include "file_picker_controller.h"
#include "javascript_dialog_controller.h"
+#include "quota_permission_controller.h"
+#include "register_protocol_handler_permission_controller.h"
#include "qquickwebenginehistory_p.h"
#include "qquickwebenginecertificateerror_p.h"
#include "qquickwebenginecontextmenurequest_p.h"
@@ -94,27 +96,6 @@
QT_BEGIN_NAMESPACE
using namespace QtWebEngineCore;
-QQuickWebEngineView::WebAction editorActionForKeyEvent(QKeyEvent* event)
-{
- static struct {
- QKeySequence::StandardKey standardKey;
- QQuickWebEngineView::WebAction action;
- } editorActions[] = {
- { QKeySequence::Cut, QQuickWebEngineView::Cut },
- { QKeySequence::Copy, QQuickWebEngineView::Copy },
- { QKeySequence::Paste, QQuickWebEngineView::Paste },
- { QKeySequence::Undo, QQuickWebEngineView::Undo },
- { QKeySequence::Redo, QQuickWebEngineView::Redo },
- { QKeySequence::SelectAll, QQuickWebEngineView::SelectAll },
- { QKeySequence::UnknownKey, QQuickWebEngineView::NoWebAction }
- };
- for (int i = 0; editorActions[i].standardKey != QKeySequence::UnknownKey; ++i)
- if (event == editorActions[i].standardKey)
- return editorActions[i].action;
-
- return QQuickWebEngineView::NoWebAction;
-}
-
#ifndef QT_NO_ACCESSIBILITY
static QAccessibleInterface *webAccessibleFactory(const QString &, QObject *object)
{
@@ -138,6 +119,7 @@ QQuickWebEngineViewPrivate::QQuickWebEngineViewPrivate()
, m_fullscreenMode(false)
, isLoading(false)
, m_activeFocusOnPress(true)
+ , m_validationShowing(false)
, devicePixelRatio(QGuiApplication::primaryScreen()->devicePixelRatio())
, m_webChannel(0)
, m_webChannelWorld(0)
@@ -202,151 +184,43 @@ RenderWidgetHostViewQtDelegate *QQuickWebEngineViewPrivate::CreateRenderWidgetHo
return quickDelegate;
}
-bool QQuickWebEngineViewPrivate::contextMenuRequested(const WebEngineContextMenuData &data)
+void QQuickWebEngineViewPrivate::contextMenuRequested(const WebEngineContextMenuData &data)
{
Q_Q(QQuickWebEngineView);
m_contextMenuData = data;
QQuickWebEngineContextMenuRequest *request = new QQuickWebEngineContextMenuRequest(data);
+ QQmlEngine *engine = qmlEngine(q);
+
+ // TODO: this is a workaround for QTBUG-65044
+ if (!engine)
+ return;
+
// mark the object for gc by creating temporary jsvalue
- qmlEngine(q)->newQObject(request);
+ engine->newQObject(request);
Q_EMIT q->contextMenuRequested(request);
if (request->isAccepted())
- return true;
+ return;
// Assign the WebEngineView as the parent of the menu, so mouse events are properly propagated
// on OSX.
QObject *menu = ui()->addMenu(q, QString(), data.position());
if (!menu)
- return false;
-
- // Populate our menu
- MenuItemHandler *item = 0;
- if (data.isEditable() && !data.spellCheckerSuggestions().isEmpty()) {
- const QPointer<QQuickWebEngineView> qRef(q);
- for (int i=0; i < data.spellCheckerSuggestions().count() && i < 4; i++) {
- item = new MenuItemHandler(menu);
- QString replacement = data.spellCheckerSuggestions().at(i);
- QObject::connect(item, &MenuItemHandler::triggered, [qRef, replacement] { qRef->replaceMisspelledWord(replacement); });
- ui()->addMenuItem(item, replacement);
- }
- ui()->addMenuSeparator(menu);
- }
- if (data.linkUrl().isValid()) {
- item = new MenuItemHandler(menu);
- QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::OpenLinkInThisWindow); });
- ui()->addMenuItem(item, QQuickWebEngineView::tr("Follow Link"));
- }
-
- if (data.selectedText().isEmpty()) {
- item = new MenuItemHandler(menu);
- QObject::connect(item, &MenuItemHandler::triggered, q, &QQuickWebEngineView::goBack);
- ui()->addMenuItem(item, QQuickWebEngineView::tr("Back"), QStringLiteral("go-previous"), q->canGoBack());
-
- item = new MenuItemHandler(menu);
- QObject::connect(item, &MenuItemHandler::triggered, q, &QQuickWebEngineView::goForward);
- ui()->addMenuItem(item, QQuickWebEngineView::tr("Forward"), QStringLiteral("go-next"), q->canGoForward());
-
- item = new MenuItemHandler(menu);
- QObject::connect(item, &MenuItemHandler::triggered, q, &QQuickWebEngineView::reload);
- ui()->addMenuItem(item, QQuickWebEngineView::tr("Reload"), QStringLiteral("view-refresh"));
+ return;
- item = new MenuItemHandler(menu);
- QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::ViewSource); });
- ui()->addMenuItem(item, QQuickWebEngineView::tr("View Page Source"), QStringLiteral("view-source"), adapter->canViewSource());
- } else {
- item = new MenuItemHandler(menu);
- QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::Copy); });
- ui()->addMenuItem(item, QQuickWebEngineView::tr("Copy"));
- item = new MenuItemHandler(menu);
- QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::Unselect); });
- ui()->addMenuItem(item, QQuickWebEngineView::tr("Unselect"));
- }
+ QQuickContextMenuBuilder contextMenuBuilder(data, q, menu);
- if (!data.linkText().isEmpty() && data.linkUrl().isValid()) {
- item = new MenuItemHandler(menu);
- QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::CopyLinkToClipboard); });
- ui()->addMenuItem(item, QQuickWebEngineView::tr("Copy Link URL"));
- item = new MenuItemHandler(menu);
- QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::DownloadLinkToDisk); });
- ui()->addMenuItem(item, QQuickWebEngineView::tr("Save Link"));
- }
- if (data.mediaUrl().isValid()) {
- switch (data.mediaType()) {
- case WebEngineContextMenuData::MediaTypeImage:
- item = new MenuItemHandler(menu);
- QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::CopyImageUrlToClipboard); });
- ui()->addMenuItem(item, QQuickWebEngineView::tr("Copy Image URL"));
- item = new MenuItemHandler(menu);
- QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::CopyImageToClipboard); });
- ui()->addMenuItem(item, QQuickWebEngineView::tr("Copy Image"));
- item = new MenuItemHandler(menu);
- QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::DownloadImageToDisk); });
- ui()->addMenuItem(item, QQuickWebEngineView::tr("Save Image"));
- break;
- case WebEngineContextMenuData::MediaTypeCanvas:
- Q_UNREACHABLE(); // mediaUrl is invalid for canvases
- break;
- case WebEngineContextMenuData::MediaTypeAudio:
- case WebEngineContextMenuData::MediaTypeVideo:
- item = new MenuItemHandler(menu);
- QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::CopyMediaUrlToClipboard); });
- ui()->addMenuItem(item, QQuickWebEngineView::tr("Copy Media URL"));
- item = new MenuItemHandler(menu);
- QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::DownloadMediaToDisk); });
- ui()->addMenuItem(item, QQuickWebEngineView::tr("Save Media"));
- item = new MenuItemHandler(menu);
- QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::ToggleMediaPlayPause); });
- ui()->addMenuItem(item, QQuickWebEngineView::tr("Toggle Play/Pause"));
- item = new MenuItemHandler(menu);
- QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::ToggleMediaLoop); });
- ui()->addMenuItem(item, QQuickWebEngineView::tr("Toggle Looping"));
- if (data.mediaFlags() & WebEngineContextMenuData::MediaHasAudio) {
- item = new MenuItemHandler(menu);
- QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::ToggleMediaMute); });
- ui()->addMenuItem(item, QQuickWebEngineView::tr("Toggle Mute"));
- }
- if (data.mediaFlags() & WebEngineContextMenuData::MediaCanToggleControls) {
- item = new MenuItemHandler(menu);
- QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::ToggleMediaControls); });
- ui()->addMenuItem(item, QQuickWebEngineView::tr("Toggle Media Controls"));
- }
- break;
- default:
- break;
- }
- } else if (data.mediaType() == WebEngineContextMenuData::MediaTypeCanvas) {
- item = new MenuItemHandler(menu);
- QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::CopyImageToClipboard); });
- ui()->addMenuItem(item, QQuickWebEngineView::tr("Copy Image"));
- }
- if (adapter->hasInspector()) {
- item = new MenuItemHandler(menu);
- QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::InspectElement); });
- ui()->addMenuItem(item, QQuickWebEngineView::tr("Inspect Element"));
- }
- if (isFullScreenMode()) {
- item = new MenuItemHandler(menu);
- QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::ExitFullScreen); });
- ui()->addMenuItem(item, QQuickWebEngineView::tr("Exit Full Screen Mode"));
- }
+ // Populate our menu
+ contextMenuBuilder.initMenu();
// FIXME: expose the context menu data as an attached property to make this more useful
- if (contextMenuExtraItems) {
- ui()->addMenuSeparator(menu);
- if (QObject* menuExtras = contextMenuExtraItems->create(qmlContext(q))) {
- menuExtras->setParent(menu);
- QQmlListReference entries(menu, defaultPropertyName(menu), qmlEngine(q));
- if (entries.isValid())
- entries.append(menuExtras);
- }
- }
+ if (contextMenuExtraItems)
+ contextMenuBuilder.appendExtraItems(engine);
// Now fire the popup() method on the top level menu
ui()->showMenu(menu);
- return true;
}
void QQuickWebEngineViewPrivate::navigationRequested(int navigationType, const QUrl &url, int &navigationRequestAction, bool isMainFrame)
@@ -445,6 +319,11 @@ void QQuickWebEngineViewPrivate::iconChanged(const QUrl &url)
if (!faviconProvider) {
QQmlEngine *engine = qmlEngine(q);
+
+ // TODO: this is a workaround for QTBUG-65044
+ if (!engine)
+ return;
+
Q_ASSERT(engine);
faviconProvider = static_cast<QQuickWebEngineFaviconProvider *>(
engine->imageProvider(QQuickWebEngineFaviconProvider::identifier()));
@@ -453,14 +332,14 @@ void QQuickWebEngineViewPrivate::iconChanged(const QUrl &url)
iconUrl = faviconProvider->attach(q, url);
m_history->reset();
- Q_EMIT q->iconChanged();
+ QTimer::singleShot(0, q, &QQuickWebEngineView::iconChanged);
}
void QQuickWebEngineViewPrivate::loadProgressChanged(int progress)
{
Q_Q(QQuickWebEngineView);
loadProgress = progress;
- Q_EMIT q->loadProgressChanged();
+ QTimer::singleShot(0, q, &QQuickWebEngineView::loadProgressChanged);
}
void QQuickWebEngineViewPrivate::didUpdateTargetURL(const QUrl &hoveredUrl)
@@ -505,8 +384,12 @@ void QQuickWebEngineViewPrivate::loadStarted(const QUrl &provisionalUrl, bool is
isLoading = true;
m_history->reset();
m_certificateErrorControllers.clear();
- QQuickWebEngineLoadRequest loadRequest(provisionalUrl, QQuickWebEngineView::LoadStartedStatus);
- Q_EMIT q->loadingChanged(&loadRequest);
+
+ QTimer::singleShot(0, q, [q, provisionalUrl]() {
+ QQuickWebEngineLoadRequest loadRequest(provisionalUrl, QQuickWebEngineView::LoadStartedStatus);
+
+ emit q->loadingChanged(&loadRequest);
+ });
}
void QQuickWebEngineViewPrivate::loadCommitted()
@@ -541,51 +424,44 @@ void QQuickWebEngineViewPrivate::loadFinished(bool success, const QUrl &url, boo
isLoading = false;
m_history->reset();
if (errorCode == WebEngineError::UserAbortedError) {
- QQuickWebEngineLoadRequest loadRequest(url, QQuickWebEngineView::LoadStoppedStatus);
- Q_EMIT q->loadingChanged(&loadRequest);
+ QTimer::singleShot(0, q, [q, url]() {
+ QQuickWebEngineLoadRequest loadRequest(url, QQuickWebEngineView::LoadStoppedStatus);
+ emit q->loadingChanged(&loadRequest);
+ });
return;
}
if (success) {
explicitUrl = QUrl();
- QQuickWebEngineLoadRequest loadRequest(url, QQuickWebEngineView::LoadSucceededStatus);
- Q_EMIT q->loadingChanged(&loadRequest);
+ QTimer::singleShot(0, q, [q, url]() {
+ QQuickWebEngineLoadRequest loadRequest(url, QQuickWebEngineView::LoadSucceededStatus);
+ emit q->loadingChanged(&loadRequest);
+ });
return;
}
Q_ASSERT(errorCode);
- QQuickWebEngineLoadRequest loadRequest(
- url,
- QQuickWebEngineView::LoadFailedStatus,
- errorDescription,
- errorCode,
- static_cast<QQuickWebEngineView::ErrorDomain>(WebEngineError::toQtErrorDomain(errorCode)));
- Q_EMIT q->loadingChanged(&loadRequest);
+ QQuickWebEngineView::ErrorDomain errorDomain = static_cast<QQuickWebEngineView::ErrorDomain>(WebEngineError::toQtErrorDomain(errorCode));
+ QTimer::singleShot(0, q, [q, url, errorDescription, errorCode, errorDomain]() {
+ QQuickWebEngineLoadRequest loadRequest(url, QQuickWebEngineView::LoadFailedStatus,errorDescription, errorCode, errorDomain);
+ emit q->loadingChanged(&loadRequest);
+ });
return;
}
void QQuickWebEngineViewPrivate::focusContainer()
{
Q_Q(QQuickWebEngineView);
+ QQuickWindow *window = q->window();
+ if (window)
+ window->requestActivate();
q->forceActiveFocus();
}
void QQuickWebEngineViewPrivate::unhandledKeyEvent(QKeyEvent *event)
{
Q_Q(QQuickWebEngineView);
-#ifdef Q_OS_OSX
- if (event->type() == QEvent::KeyPress) {
- QQuickWebEngineView::WebAction action = editorActionForKeyEvent(event);
- if (action != QQuickWebEngineView::NoWebAction) {
- // Try triggering a registered short-cut
- if (QGuiApplicationPrivate::instance()->shortcutMap.tryShortcut(event))
- return;
- q->triggerWebAction(action);
- return;
- }
- }
-#endif
if (q->parentItem())
- q->window()->sendEvent(q->parentItem(), event);
+ QCoreApplication::sendEvent(q->parentItem(), event);
}
void QQuickWebEngineViewPrivate::adoptNewWindow(QSharedPointer<WebContentsAdapter> newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &, const QUrl &targetUrl)
@@ -698,8 +574,13 @@ void QQuickWebEngineViewPrivate::runMediaAccessPermissionRequest(const QUrl &sec
feature = QQuickWebEngineView::MediaAudioVideoCapture;
else if (requestFlags.testFlag(WebContentsAdapterClient::MediaAudioCapture))
feature = QQuickWebEngineView::MediaAudioCapture;
- else // WebContentsAdapterClient::MediaVideoCapture
+ else if (requestFlags.testFlag(WebContentsAdapterClient::MediaVideoCapture))
feature = QQuickWebEngineView::MediaVideoCapture;
+ else if (requestFlags.testFlag(WebContentsAdapterClient::MediaDesktopAudioCapture) &&
+ requestFlags.testFlag(WebContentsAdapterClient::MediaDesktopVideoCapture))
+ feature = QQuickWebEngineView::DesktopAudioVideoCapture;
+ else // if (requestFlags.testFlag(WebContentsAdapterClient::MediaDesktopVideoCapture))
+ feature = QQuickWebEngineView::DesktopVideoCapture;
Q_EMIT q->featurePermissionRequested(securityOrigin, feature);
}
@@ -712,6 +593,20 @@ void QQuickWebEngineViewPrivate::runMouseLockPermissionRequest(const QUrl &secur
adapter->grantMouseLockPermission(false);
}
+void QQuickWebEngineViewPrivate::runQuotaPermissionRequest(QSharedPointer<QtWebEngineCore::QuotaPermissionController> controller)
+{
+ Q_Q(QQuickWebEngineView);
+ QQuickWebEngineQuotaPermissionRequest request(controller);
+ Q_EMIT q->quotaPermissionRequested(request);
+}
+
+void QQuickWebEngineViewPrivate::runRegisterProtocolHandlerPermissionRequest(QSharedPointer<RegisterProtocolHandlerPermissionController> controller)
+{
+ Q_Q(QQuickWebEngineView);
+ QQuickWebEngineRegisterProtocolHandlerPermissionRequest request(std::move(controller));
+ Q_EMIT q->registerProtocolHandlerPermissionRequested(request);
+}
+
QObject *QQuickWebEngineViewPrivate::accessibilityParentObject()
{
Q_Q(QQuickWebEngineView);
@@ -837,6 +732,11 @@ void QQuickWebEngineViewPrivate::adoptWebContents(WebContentsAdapter *webContent
if (m_webChannel)
adapter->setWebChannel(m_webChannel, m_webChannelWorld);
+ if (devToolsView && devToolsView->d_ptr->adapter)
+ adapter->openDevToolsFrontend(devToolsView->d_ptr->adapter);
+ else if (inspectedView && inspectedView->d_ptr->adapter)
+ inspectedView->d_ptr->adapter->openDevToolsFrontend(adapter);
+
// set initial background color if non-default
if (m_backgroundColor != Qt::white)
adapter->backgroundColorChanged();
@@ -867,8 +767,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);
@@ -897,6 +796,8 @@ void QQuickWebEngineViewPrivate::ensureContentsAdapter()
adapter->setWebChannel(m_webChannel, m_webChannelWorld);
if (explicitUrl.isValid())
adapter->load(explicitUrl);
+ if (inspectedView)
+ inspectedView->d_ptr->adapter->openDevToolsFrontend(adapter);
// push down the page's user scripts
Q_FOREACH (QQuickWebEngineScript *script, m_userScripts)
script->d_func()->bind(browserContextAdapter()->userResourceController(), adapter.data());
@@ -1115,7 +1016,8 @@ void QQuickWebEngineViewPrivate::showValidationMessage(const QRect &anchor, cons
Q_Q(QQuickWebEngineView);
QQuickWebEngineFormValidationMessageRequest *request;
request = new QQuickWebEngineFormValidationMessageRequest(QQuickWebEngineFormValidationMessageRequest::Show,
- anchor,mainText,subText);
+ anchor,mainText,subText);
+ m_validationShowing = true;
// mark the object for gc by creating temporary jsvalue
qmlEngine(q)->newQObject(request);
Q_EMIT q->formValidationMessageRequested(request);
@@ -1126,8 +1028,12 @@ void QQuickWebEngineViewPrivate::showValidationMessage(const QRect &anchor, cons
void QQuickWebEngineViewPrivate::hideValidationMessage()
{
Q_Q(QQuickWebEngineView);
+ // Suppress the initial hide message before any show messages (Since 61-based)
+ if (!m_validationShowing)
+ return;
QQuickWebEngineFormValidationMessageRequest *request;
request = new QQuickWebEngineFormValidationMessageRequest(QQuickWebEngineFormValidationMessageRequest::Hide);
+ m_validationShowing = false;
// mark the object for gc by creating temporary jsvalue
qmlEngine(q)->newQObject(request);
Q_EMIT q->formValidationMessageRequested(request);
@@ -1168,6 +1074,12 @@ void QQuickWebEngineViewPrivate::renderProcessTerminated(
renderProcessExitStatus(terminationStatus)), exitCode);
}
+void QQuickWebEngineViewPrivate::requestGeometryChange(const QRect &geometry, const QRect &frameGeometry)
+{
+ Q_Q(QQuickWebEngineView);
+ Q_EMIT q->geometryChangeRequested(geometry, frameGeometry);
+}
+
void QQuickWebEngineViewPrivate::startDragging(const content::DropData &dropData,
Qt::DropActions allowedActions,
const QPixmap &pixmap, const QPoint &offset)
@@ -1423,11 +1335,60 @@ void QQuickWebEngineView::setWebChannelWorld(uint webChannelWorld)
Q_EMIT webChannelWorldChanged(webChannelWorld);
}
+QQuickWebEngineView *QQuickWebEngineView::inspectedView() const
+{
+ Q_D(const QQuickWebEngineView);
+ return d->inspectedView;
+}
+
+void QQuickWebEngineView::setInspectedView(QQuickWebEngineView *view)
+{
+ Q_D(QQuickWebEngineView);
+ if (d->inspectedView == view)
+ return;
+ QQuickWebEngineView *oldView = d->inspectedView;
+ d->inspectedView = nullptr;
+ if (oldView)
+ oldView->setDevToolsView(nullptr);
+ d->inspectedView = view;
+ if (view)
+ view->setDevToolsView(this);
+ Q_EMIT inspectedViewChanged();
+}
+
+QQuickWebEngineView *QQuickWebEngineView::devToolsView() const
+{
+ Q_D(const QQuickWebEngineView);
+ return d->devToolsView;
+}
+
+void QQuickWebEngineView::setDevToolsView(QQuickWebEngineView *devToolsView)
+{
+ Q_D(QQuickWebEngineView);
+ if (d->devToolsView == devToolsView)
+ return;
+ QQuickWebEngineView *oldView = d->devToolsView;
+ d->devToolsView = nullptr;
+ if (oldView)
+ oldView->setInspectedView(nullptr);
+ d->devToolsView = devToolsView;
+ if (devToolsView)
+ devToolsView->setInspectedView(this);
+ if (d->adapter) {
+ if (devToolsView)
+ d->adapter->openDevToolsFrontend(devToolsView->d_ptr->adapter);
+ else
+ d->adapter->closeDevToolsFrontend();
+ }
+ Q_EMIT devToolsViewChanged();
+}
+
void QQuickWebEngineView::grantFeaturePermission(const QUrl &securityOrigin, QQuickWebEngineView::Feature feature, bool granted)
{
if (!d_ptr->adapter)
return;
- if (!granted && feature >= MediaAudioCapture && feature <= MediaAudioVideoCapture) {
+ if (!granted && ((feature >= MediaAudioCapture && feature <= MediaAudioVideoCapture) ||
+ (feature >= DesktopVideoCapture && feature <= DesktopAudioVideoCapture))) {
d_ptr->adapter->grantMediaAccessPermission(securityOrigin, WebContentsAdapterClient::MediaNone);
return;
}
@@ -1445,6 +1406,16 @@ void QQuickWebEngineView::grantFeaturePermission(const QUrl &securityOrigin, QQu
case Geolocation:
d_ptr->adapter->runGeolocationRequestCallback(securityOrigin, granted);
break;
+ case DesktopVideoCapture:
+ d_ptr->adapter->grantMediaAccessPermission(securityOrigin, WebContentsAdapterClient::MediaDesktopVideoCapture);
+ break;
+ case DesktopAudioVideoCapture:
+ d_ptr->adapter->grantMediaAccessPermission(
+ securityOrigin,
+ WebContentsAdapterClient::MediaRequestFlags(
+ WebContentsAdapterClient::MediaDesktopAudioCapture |
+ WebContentsAdapterClient::MediaDesktopVideoCapture));
+ break;
default:
Q_UNREACHABLE();
}
@@ -1606,14 +1577,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;
@@ -1711,6 +1682,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();
}
@@ -1804,5 +1811,246 @@ void QQuickWebEngineFullScreenRequest::reject()
m_viewPrivate->setFullScreenMode(!m_toggleOn);
}
+QQuickWebEngineQuotaPermissionRequest::QQuickWebEngineQuotaPermissionRequest(QSharedPointer<QtWebEngineCore::QuotaPermissionController> controller)
+ : d_ptr(controller)
+{
+}
+
+QQuickWebEngineQuotaPermissionRequest::~QQuickWebEngineQuotaPermissionRequest()
+{
+}
+
+void QQuickWebEngineQuotaPermissionRequest::accept()
+{
+ d_ptr->accept();
+}
+
+void QQuickWebEngineQuotaPermissionRequest::reject()
+{
+ d_ptr->reject();
+}
+
+QUrl QQuickWebEngineQuotaPermissionRequest::origin() const
+{
+ return d_ptr->origin();
+}
+
+qint64 QQuickWebEngineQuotaPermissionRequest::requestedSize() const
+{
+ return d_ptr->requestedSize();
+}
+
+QQuickWebEngineRegisterProtocolHandlerPermissionRequest::QQuickWebEngineRegisterProtocolHandlerPermissionRequest(
+ QSharedPointer<QtWebEngineCore::RegisterProtocolHandlerPermissionController> d_ptr)
+ : d_ptr(std::move(d_ptr))
+{}
+
+void QQuickWebEngineRegisterProtocolHandlerPermissionRequest::accept()
+{
+ d_ptr->accept();
+}
+
+void QQuickWebEngineRegisterProtocolHandlerPermissionRequest::reject()
+{
+ d_ptr->reject();
+}
+
+QUrl QQuickWebEngineRegisterProtocolHandlerPermissionRequest::origin() const
+{
+ return d_ptr->origin();
+}
+
+QString QQuickWebEngineRegisterProtocolHandlerPermissionRequest::protocol() const
+{
+ return d_ptr->protocol();
+}
+
+QQuickContextMenuBuilder::QQuickContextMenuBuilder(const QtWebEngineCore::WebEngineContextMenuData &data,
+ QQuickWebEngineView *view,
+ QObject *menu)
+ : QtWebEngineCore::RenderViewContextMenuQt(data)
+ , m_view(view)
+ , m_menu(menu)
+{
+}
+
+void QQuickContextMenuBuilder::appendExtraItems(QQmlEngine *engine)
+{
+ m_view->d_ptr->ui()->addMenuSeparator(m_menu);
+ if (QObject *menuExtras = m_view->d_ptr->contextMenuExtraItems->create(qmlContext(m_view))) {
+ menuExtras->setParent(m_menu);
+ QQmlListReference entries(m_menu, defaultPropertyName(m_menu), engine);
+ if (entries.isValid())
+ entries.append(menuExtras);
+ }
+}
+
+bool QQuickContextMenuBuilder::hasInspector()
+{
+ return m_view->d_ptr->adapter->hasInspector();
+}
+
+bool QQuickContextMenuBuilder::isFullScreenMode()
+{
+ return m_view->d_ptr->isFullScreenMode();
+}
+
+void QQuickContextMenuBuilder::addMenuItem(ContextMenuItem menuItem)
+{
+ MenuItemHandler *item = new MenuItemHandler(m_menu);
+ QString menuItemIcon;
+ QPointer<QQuickWebEngineView> thisRef(m_view);
+
+ switch (menuItem) {
+ case ContextMenuItem::Back:
+ QObject::connect(item, &MenuItemHandler::triggered, thisRef, &QQuickWebEngineView::goBack);
+ menuItemIcon = QStringLiteral("go-previous");
+ break;
+ case ContextMenuItem::Forward:
+ QObject::connect(item, &MenuItemHandler::triggered, thisRef, &QQuickWebEngineView::goForward);
+ menuItemIcon = QStringLiteral("go-next");
+ break;
+ case ContextMenuItem::Reload:
+ QObject::connect(item, &MenuItemHandler::triggered, thisRef, &QQuickWebEngineView::reload);
+ menuItemIcon = QStringLiteral("view-refresh");
+ break;
+ case ContextMenuItem::Cut:
+ QObject::connect(item, &MenuItemHandler::triggered, [thisRef] { thisRef->triggerWebAction(QQuickWebEngineView::Cut); });
+ menuItemIcon = QStringLiteral("Cut");
+ break;
+ case ContextMenuItem::Copy:
+ QObject::connect(item, &MenuItemHandler::triggered, [thisRef] { thisRef->triggerWebAction(QQuickWebEngineView::Copy); });
+ menuItemIcon = QStringLiteral("Copy");
+ break;
+
+ case ContextMenuItem::Paste:
+ QObject::connect(item, &MenuItemHandler::triggered, [thisRef] { thisRef->triggerWebAction(QQuickWebEngineView::Paste); });
+ menuItemIcon = QStringLiteral("Paste");
+ break;
+ case ContextMenuItem::Undo:
+ QObject::connect(item, &MenuItemHandler::triggered, [thisRef] { thisRef->triggerWebAction(QQuickWebEngineView::Undo); });
+ menuItemIcon = QStringLiteral("Undo");
+ break;
+ case ContextMenuItem::Redo:
+ QObject::connect(item, &MenuItemHandler::triggered, [thisRef] { thisRef->triggerWebAction(QQuickWebEngineView::Redo); });
+ menuItemIcon = QStringLiteral("Redo");
+ break;
+ case ContextMenuItem::SelectAll:
+ QObject::connect(item, &MenuItemHandler::triggered, [thisRef] { thisRef->triggerWebAction(QQuickWebEngineView::SelectAll); });
+ menuItemIcon = QStringLiteral("Select All");
+ break;
+ case ContextMenuItem::PasteAndMatchStyle:
+ QObject::connect(item, &MenuItemHandler::triggered, [thisRef] { thisRef->triggerWebAction(QQuickWebEngineView::PasteAndMatchStyle); });
+ menuItemIcon = QStringLiteral("Paste And Match Style");
+ break;
+ case ContextMenuItem::OpenLinkInNewWindow:
+ QObject::connect(item, &MenuItemHandler::triggered, [thisRef] { thisRef->triggerWebAction(QQuickWebEngineView::OpenLinkInNewWindow); });
+ break;
+ case ContextMenuItem::OpenLinkInNewTab:
+ QObject::connect(item, &MenuItemHandler::triggered, [thisRef] { thisRef->triggerWebAction(QQuickWebEngineView::OpenLinkInNewTab); });
+ break;
+ case ContextMenuItem::CopyLinkToClipboard:
+ QObject::connect(item, &MenuItemHandler::triggered, [thisRef] { thisRef->triggerWebAction(QQuickWebEngineView::CopyLinkToClipboard); });
+ break;
+ case ContextMenuItem::DownloadLinkToDisk:
+ QObject::connect(item, &MenuItemHandler::triggered, [thisRef] { thisRef->triggerWebAction(QQuickWebEngineView::DownloadLinkToDisk); });
+ break;
+ case ContextMenuItem::CopyImageToClipboard:
+ QObject::connect(item, &MenuItemHandler::triggered, [thisRef] { thisRef->triggerWebAction(QQuickWebEngineView::CopyImageToClipboard); });
+ break;
+ case ContextMenuItem::CopyImageUrlToClipboard:
+ QObject::connect(item, &MenuItemHandler::triggered, [thisRef] { thisRef->triggerWebAction(QQuickWebEngineView::CopyImageUrlToClipboard); });
+ break;
+ case ContextMenuItem::DownloadImageToDisk:
+ QObject::connect(item, &MenuItemHandler::triggered, [thisRef] { thisRef->triggerWebAction(QQuickWebEngineView::DownloadImageToDisk); });
+ break;
+ case ContextMenuItem::CopyMediaUrlToClipboard:
+ QObject::connect(item, &MenuItemHandler::triggered, [thisRef] { thisRef->triggerWebAction(QQuickWebEngineView::CopyMediaUrlToClipboard); });
+ break;
+ case ContextMenuItem::ToggleMediaControls:
+ QObject::connect(item, &MenuItemHandler::triggered, [thisRef] { thisRef->triggerWebAction(QQuickWebEngineView::ToggleMediaControls); });
+ break;
+ case ContextMenuItem::ToggleMediaLoop:
+ QObject::connect(item, &MenuItemHandler::triggered, [thisRef] { thisRef->triggerWebAction(QQuickWebEngineView::ToggleMediaLoop); });
+ break;
+ case ContextMenuItem::DownloadMediaToDisk:
+ QObject::connect(item, &MenuItemHandler::triggered, [thisRef] { thisRef->triggerWebAction(QQuickWebEngineView::DownloadMediaToDisk); });
+ break;
+ case ContextMenuItem::InspectElement:
+ QObject::connect(item, &MenuItemHandler::triggered, [thisRef] { thisRef->triggerWebAction(QQuickWebEngineView::InspectElement); });
+ break;
+ case ContextMenuItem::ExitFullScreen:
+ QObject::connect(item, &MenuItemHandler::triggered, [thisRef] { thisRef->triggerWebAction(QQuickWebEngineView::ExitFullScreen); });
+ break;
+ case ContextMenuItem::SavePage:
+ QObject::connect(item, &MenuItemHandler::triggered, [thisRef] { thisRef->triggerWebAction(QQuickWebEngineView::SavePage); });
+ break;
+ case ContextMenuItem::ViewSource:
+ QObject::connect(item, &MenuItemHandler::triggered, [thisRef] { thisRef->triggerWebAction(QQuickWebEngineView::ViewSource); });
+ menuItemIcon = QStringLiteral("view-source");
+ break;
+ case ContextMenuItem::SpellingSuggestions:
+ for (int i=0; i < m_contextData.spellCheckerSuggestions().count() && i < 4; i++) {
+ item = new MenuItemHandler(m_menu);
+ QString replacement = m_contextData.spellCheckerSuggestions().at(i);
+ QObject::connect(item, &MenuItemHandler::triggered, [thisRef, replacement] { thisRef->replaceMisspelledWord(replacement); });
+ m_view->d_ptr->ui()->addMenuItem(item, replacement);
+ }
+ return;
+ case ContextMenuItem::Separator:
+ thisRef->d_ptr->ui()->addMenuSeparator(m_menu);
+ return;
+ }
+ QString menuItemName = RenderViewContextMenuQt::getMenuItemName(menuItem);
+ thisRef->d_ptr->ui()->addMenuItem(item, menuItemName, menuItemIcon, isMenuItemEnabled(menuItem));
+}
+
+bool QQuickContextMenuBuilder::isMenuItemEnabled(ContextMenuItem menuItem)
+{
+ switch (menuItem) {
+ case ContextMenuItem::Back:
+ return m_view->canGoBack();
+ case ContextMenuItem::Forward:
+ return m_view->canGoForward();
+ case ContextMenuItem::Reload:
+ return true;
+ case ContextMenuItem::Cut:
+ return m_contextData.editFlags() & QtWebEngineCore::WebEngineContextMenuData::CanCut;
+ case ContextMenuItem::Copy:
+ return m_contextData.editFlags() & QtWebEngineCore::WebEngineContextMenuData::CanCopy;
+ case ContextMenuItem::Paste:
+ return m_contextData.editFlags() & QtWebEngineCore::WebEngineContextMenuData::CanPaste;
+ case ContextMenuItem::Undo:
+ return m_contextData.editFlags() & QtWebEngineCore::WebEngineContextMenuData::CanUndo;
+ case ContextMenuItem::Redo:
+ return m_contextData.editFlags() & QtWebEngineCore::WebEngineContextMenuData::CanRedo;
+ case ContextMenuItem::SelectAll:
+ return m_contextData.editFlags() & QtWebEngineCore::WebEngineContextMenuData::CanSelectAll;
+ case ContextMenuItem::PasteAndMatchStyle:
+ return m_contextData.editFlags() & QtWebEngineCore::WebEngineContextMenuData::CanPaste;
+ case ContextMenuItem::OpenLinkInNewWindow:
+ case ContextMenuItem::OpenLinkInNewTab:
+ case ContextMenuItem::CopyLinkToClipboard:
+ case ContextMenuItem::DownloadLinkToDisk:
+ case ContextMenuItem::CopyImageToClipboard:
+ case ContextMenuItem::CopyImageUrlToClipboard:
+ case ContextMenuItem::DownloadImageToDisk:
+ case ContextMenuItem::CopyMediaUrlToClipboard:
+ case ContextMenuItem::ToggleMediaControls:
+ case ContextMenuItem::ToggleMediaLoop:
+ case ContextMenuItem::DownloadMediaToDisk:
+ case ContextMenuItem::InspectElement:
+ case ContextMenuItem::ExitFullScreen:
+ case ContextMenuItem::SavePage:
+ return true;
+ case ContextMenuItem::ViewSource:
+ return m_view->d_ptr->adapter->canViewSource();
+ case ContextMenuItem::SpellingSuggestions:
+ case ContextMenuItem::Separator:
+ return true;
+ }
+ Q_UNREACHABLE();
+}
+
QT_END_NAMESPACE
diff --git a/src/webengine/api/qquickwebengineview_p.h b/src/webengine/api/qquickwebengineview_p.h
index 8112c7609..5b018b8a8 100644
--- a/src/webengine/api/qquickwebengineview_p.h
+++ b/src/webengine/api/qquickwebengineview_p.h
@@ -56,9 +56,17 @@
#include <QQuickItem>
#include <QtGui/qcolor.h>
+
+namespace QtWebEngineCore {
+ class QuotaPermissionController;
+ class RegisterProtocolHandlerPermissionController;
+}
+
+
QT_BEGIN_NAMESPACE
class QQmlWebChannel;
+class QQuickContextMenuBuilder;
class QQuickWebEngineAuthenticationDialogRequest;
class QQuickWebEngineCertificateError;
class QQuickWebEngineColorDialogRequest;
@@ -98,6 +106,44 @@ private:
const bool m_toggleOn;
};
+class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineQuotaPermissionRequest {
+ Q_GADGET
+ Q_PROPERTY(QUrl origin READ origin CONSTANT FINAL)
+ Q_PROPERTY(qint64 requestedSize READ requestedSize CONSTANT FINAL)
+public:
+ QQuickWebEngineQuotaPermissionRequest() {}
+ QQuickWebEngineQuotaPermissionRequest(QSharedPointer<QtWebEngineCore::QuotaPermissionController> controller);
+ ~QQuickWebEngineQuotaPermissionRequest();
+
+ Q_INVOKABLE void accept();
+ Q_INVOKABLE void reject();
+ QUrl origin() const;
+ qint64 requestedSize() const;
+
+private:
+ QSharedPointer<QtWebEngineCore::QuotaPermissionController> d_ptr;
+};
+
+class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineRegisterProtocolHandlerPermissionRequest {
+ Q_GADGET
+ Q_PROPERTY(QUrl origin READ origin CONSTANT FINAL)
+ Q_PROPERTY(QString protocol READ protocol CONSTANT FINAL)
+public:
+ QQuickWebEngineRegisterProtocolHandlerPermissionRequest() {}
+ QQuickWebEngineRegisterProtocolHandlerPermissionRequest(
+ QSharedPointer<QtWebEngineCore::RegisterProtocolHandlerPermissionController>);
+
+ Q_INVOKABLE void accept();
+ Q_INVOKABLE void reject();
+ QUrl origin() const;
+ QString protocol() const;
+
+private:
+ QSharedPointer<QtWebEngineCore::RegisterProtocolHandlerPermissionController> d_ptr;
+};
+
+#define LATEST_WEBENGINEVIEW_REVISION 7
+
class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineView : public QQuickItem {
Q_OBJECT
Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged FINAL)
@@ -122,6 +168,8 @@ class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineView : public QQuickItem {
Q_PROPERTY(bool recentlyAudible READ recentlyAudible NOTIFY recentlyAudibleChanged FINAL REVISION 3)
Q_PROPERTY(uint webChannelWorld READ webChannelWorld WRITE setWebChannelWorld NOTIFY webChannelWorldChanged REVISION 3 FINAL)
+ Q_PROPERTY(QQuickWebEngineView *inspectedView READ inspectedView WRITE setInspectedView NOTIFY inspectedViewChanged REVISION 7 FINAL)
+ Q_PROPERTY(QQuickWebEngineView *devToolsView READ devToolsView WRITE setDevToolsView NOTIFY devToolsViewChanged REVISION 7 FINAL)
#ifdef ENABLE_QML_TESTSUPPORT_API
Q_PROPERTY(QQuickWebEngineTestSupport *testSupport READ testSupport WRITE setTestSupport NOTIFY testSupportChanged FINAL)
#endif
@@ -199,7 +247,9 @@ public:
MediaAudioCapture,
MediaVideoCapture,
MediaAudioVideoCapture,
- Geolocation
+ Geolocation,
+ DesktopVideoCapture,
+ DesktopAudioVideoCapture
};
Q_ENUM(Feature)
@@ -244,6 +294,22 @@ public:
Unselect,
SavePage,
ViewSource,
+
+ ToggleBold,
+ ToggleItalic,
+ ToggleUnderline,
+ ToggleStrikethrough,
+
+ AlignLeft,
+ AlignCenter,
+ AlignRight,
+ AlignJustified,
+ Indent,
+ Outdent,
+
+ InsertOrderedList,
+ InsertUnorderedList,
+
WebActionCount
};
Q_ENUM(WebAction)
@@ -432,7 +498,7 @@ public:
Q_ENUM(PrintedPageOrientation)
// QmlParserStatus
- virtual void componentComplete() Q_DECL_OVERRIDE;
+ void componentComplete() override;
QQuickWebEngineProfile *profile() const;
void setProfile(QQuickWebEngineProfile *);
@@ -456,6 +522,11 @@ public:
bool activeFocusOnPress() const;
+ void setInspectedView(QQuickWebEngineView *);
+ QQuickWebEngineView *inspectedView() const;
+ void setDevToolsView(QQuickWebEngineView *);
+ QQuickWebEngineView *devToolsView() const;
+
public Q_SLOTS:
void runJavaScript(const QString&, const QJSValue & = QJSValue());
Q_REVISION(3) void runJavaScript(const QString&, quint32 worldId, const QJSValue & = QJSValue());
@@ -511,23 +582,29 @@ Q_SIGNALS:
Q_REVISION(4) void fileDialogRequested(QQuickWebEngineFileDialogRequest *request);
Q_REVISION(4) void formValidationMessageRequested(QQuickWebEngineFormValidationMessageRequest *request);
Q_REVISION(5) void pdfPrintingFinished(const QString &filePath, bool success);
+ Q_REVISION(7) void quotaPermissionRequested(const QQuickWebEngineQuotaPermissionRequest &request);
+ Q_REVISION(7) void geometryChangeRequested(const QRect &geometry, const QRect &frameGeometry);
+ Q_REVISION(7) void inspectedViewChanged();
+ Q_REVISION(7) void devToolsViewChanged();
+ Q_REVISION(7) void registerProtocolHandlerPermissionRequested(const QQuickWebEngineRegisterProtocolHandlerPermissionRequest &request);
#ifdef ENABLE_QML_TESTSUPPORT_API
void testSupportChanged();
#endif
protected:
- void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
- void itemChange(ItemChange, const ItemChangeData &) Q_DECL_OVERRIDE;
- void dragEnterEvent(QDragEnterEvent *e) Q_DECL_OVERRIDE;
- void dragLeaveEvent(QDragLeaveEvent *e) Q_DECL_OVERRIDE;
- void dragMoveEvent(QDragMoveEvent *e) Q_DECL_OVERRIDE;
- void dropEvent(QDropEvent *e) Q_DECL_OVERRIDE;
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ void itemChange(ItemChange, const ItemChangeData &) override;
+ void dragEnterEvent(QDragEnterEvent *e) override;
+ void dragLeaveEvent(QDragLeaveEvent *e) override;
+ void dragMoveEvent(QDragMoveEvent *e) override;
+ void dropEvent(QDropEvent *e) override;
private:
Q_DECLARE_PRIVATE(QQuickWebEngineView)
QScopedPointer<QQuickWebEngineViewPrivate> d_ptr;
+ friend class QQuickContextMenuBuilder;
friend class QQuickWebEngineNewViewRequest;
friend class QQuickWebEngineFaviconProvider;
#ifndef QT_NO_ACCESSIBILITY
@@ -539,5 +616,7 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QQuickWebEngineView)
Q_DECLARE_METATYPE(QQuickWebEngineFullScreenRequest)
+Q_DECLARE_METATYPE(QQuickWebEngineQuotaPermissionRequest)
+Q_DECLARE_METATYPE(QQuickWebEngineRegisterProtocolHandlerPermissionRequest)
#endif // QQUICKWEBENGINEVIEW_P_H
diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h
index 19ecf5e1f..1b718a3da 100644
--- a/src/webengine/api/qquickwebengineview_p_p.h
+++ b/src/webengine/api/qquickwebengineview_p_p.h
@@ -52,8 +52,10 @@
//
#include "qquickwebengineview_p.h"
+#include "render_view_context_menu_qt.h"
#include "web_contents_adapter_client.h"
+#include <QPointer>
#include <QScopedPointer>
#include <QSharedData>
#include <QString>
@@ -89,66 +91,67 @@ public:
QtWebEngineCore::UIDelegatesManager *ui();
- virtual QtWebEngineCore::RenderWidgetHostViewQtDelegate* CreateRenderWidgetHostViewQtDelegate(QtWebEngineCore::RenderWidgetHostViewQtDelegateClient *client) Q_DECL_OVERRIDE;
- virtual QtWebEngineCore::RenderWidgetHostViewQtDelegate* CreateRenderWidgetHostViewQtDelegateForPopup(QtWebEngineCore::RenderWidgetHostViewQtDelegateClient *client) Q_DECL_OVERRIDE;
- virtual void titleChanged(const QString&) Q_DECL_OVERRIDE;
- virtual void urlChanged(const QUrl&) Q_DECL_OVERRIDE;
- virtual void iconChanged(const QUrl&) Q_DECL_OVERRIDE;
- virtual void loadProgressChanged(int progress) Q_DECL_OVERRIDE;
- virtual void didUpdateTargetURL(const QUrl&) Q_DECL_OVERRIDE;
- virtual void selectionChanged() Q_DECL_OVERRIDE { }
- virtual void recentlyAudibleChanged(bool recentlyAudible) Q_DECL_OVERRIDE;
- virtual QRectF viewportRect() const Q_DECL_OVERRIDE;
- virtual qreal dpiScale() const Q_DECL_OVERRIDE;
- virtual QColor backgroundColor() const Q_DECL_OVERRIDE;
- virtual void loadStarted(const QUrl &provisionalUrl, bool isErrorPage = false) Q_DECL_OVERRIDE;
- virtual void loadCommitted() Q_DECL_OVERRIDE;
- virtual void loadVisuallyCommitted() Q_DECL_OVERRIDE;
- virtual void loadFinished(bool success, const QUrl &url, bool isErrorPage = false, int errorCode = 0, const QString &errorDescription = QString()) Q_DECL_OVERRIDE;
- virtual void focusContainer() Q_DECL_OVERRIDE;
- virtual void unhandledKeyEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- virtual void adoptNewWindow(QSharedPointer<QtWebEngineCore::WebContentsAdapter> newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &, const QUrl &targetUrl) Q_DECL_OVERRIDE;
- virtual bool isBeingAdopted() Q_DECL_OVERRIDE;
- virtual void close() Q_DECL_OVERRIDE;
- virtual void windowCloseRejected() Q_DECL_OVERRIDE;
- virtual void requestFullScreenMode(const QUrl &origin, bool fullscreen) Q_DECL_OVERRIDE;
- virtual bool isFullScreenMode() const Q_DECL_OVERRIDE;
- virtual bool contextMenuRequested(const QtWebEngineCore::WebEngineContextMenuData &) Q_DECL_OVERRIDE;
- virtual void navigationRequested(int navigationType, const QUrl &url, int &navigationRequestAction, bool isMainFrame) Q_DECL_OVERRIDE;
- virtual void javascriptDialog(QSharedPointer<QtWebEngineCore::JavaScriptDialogController>) Q_DECL_OVERRIDE;
- virtual void runFileChooser(QSharedPointer<QtWebEngineCore::FilePickerController>) Q_DECL_OVERRIDE;
- virtual void showColorDialog(QSharedPointer<QtWebEngineCore::ColorChooserController>) Q_DECL_OVERRIDE;
- virtual void didRunJavaScript(quint64, const QVariant&) Q_DECL_OVERRIDE;
- virtual void didFetchDocumentMarkup(quint64, const QString&) Q_DECL_OVERRIDE { }
- virtual void didFetchDocumentInnerText(quint64, const QString&) Q_DECL_OVERRIDE { }
- virtual void didFindText(quint64, int) Q_DECL_OVERRIDE;
- virtual void didPrintPage(quint64 requestId, const QByteArray &result) Q_DECL_OVERRIDE;
- virtual void didPrintPageToPdf(const QString &filePath, bool success) Q_DECL_OVERRIDE;
- virtual void passOnFocus(bool reverse) Q_DECL_OVERRIDE;
- virtual void javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, const QString& message, int lineNumber, const QString& sourceID) Q_DECL_OVERRIDE;
- virtual void authenticationRequired(QSharedPointer<QtWebEngineCore::AuthenticationDialogController>) Q_DECL_OVERRIDE;
- virtual void runMediaAccessPermissionRequest(const QUrl &securityOrigin, MediaRequestFlags requestFlags) Q_DECL_OVERRIDE;
- virtual void runMouseLockPermissionRequest(const QUrl &securityOrigin) Q_DECL_OVERRIDE;
- virtual QObject *accessibilityParentObject() Q_DECL_OVERRIDE;
- virtual QtWebEngineCore::WebEngineSettings *webEngineSettings() const Q_DECL_OVERRIDE;
- virtual void allowCertificateError(const QSharedPointer<CertificateErrorController> &errorController) Q_DECL_OVERRIDE;
- virtual void runGeolocationPermissionRequest(QUrl const&) Q_DECL_OVERRIDE;
- virtual void showValidationMessage(const QRect &anchor, const QString &mainText, const QString &subText) Q_DECL_OVERRIDE;
- virtual void hideValidationMessage() Q_DECL_OVERRIDE;
- virtual void moveValidationMessage(const QRect &anchor) Q_DECL_OVERRIDE;
- virtual void renderProcessTerminated(RenderProcessTerminationStatus terminationStatus,
- int exitCode) Q_DECL_OVERRIDE;
- virtual void requestGeometryChange(const QRect &geometry) Q_DECL_OVERRIDE { Q_UNUSED(geometry); }
- virtual void updateScrollPosition(const QPointF &position) Q_DECL_OVERRIDE;
- virtual void updateContentsSize(const QSizeF &size) Q_DECL_OVERRIDE;
+ QtWebEngineCore::RenderWidgetHostViewQtDelegate* CreateRenderWidgetHostViewQtDelegate(QtWebEngineCore::RenderWidgetHostViewQtDelegateClient *client) override;
+ QtWebEngineCore::RenderWidgetHostViewQtDelegate* CreateRenderWidgetHostViewQtDelegateForPopup(QtWebEngineCore::RenderWidgetHostViewQtDelegateClient *client) override;
+ void titleChanged(const QString&) override;
+ void urlChanged(const QUrl&) override;
+ void iconChanged(const QUrl&) override;
+ void loadProgressChanged(int progress) override;
+ void didUpdateTargetURL(const QUrl&) override;
+ void selectionChanged() override { }
+ void recentlyAudibleChanged(bool recentlyAudible) override;
+ QRectF viewportRect() const override;
+ qreal dpiScale() const override;
+ QColor backgroundColor() const override;
+ void loadStarted(const QUrl &provisionalUrl, bool isErrorPage = false) override;
+ void loadCommitted() override;
+ void loadVisuallyCommitted() override;
+ void loadFinished(bool success, const QUrl &url, bool isErrorPage = false, int errorCode = 0, const QString &errorDescription = QString()) override;
+ void focusContainer() override;
+ void unhandledKeyEvent(QKeyEvent *event) override;
+ void adoptNewWindow(QSharedPointer<QtWebEngineCore::WebContentsAdapter> newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &, const QUrl &targetUrl) override;
+ bool isBeingAdopted() override;
+ void close() override;
+ void windowCloseRejected() override;
+ void requestFullScreenMode(const QUrl &origin, bool fullscreen) override;
+ bool isFullScreenMode() const override;
+ void contextMenuRequested(const QtWebEngineCore::WebEngineContextMenuData &) override;
+ void navigationRequested(int navigationType, const QUrl &url, int &navigationRequestAction, bool isMainFrame) override;
+ void javascriptDialog(QSharedPointer<QtWebEngineCore::JavaScriptDialogController>) override;
+ void runFileChooser(QSharedPointer<QtWebEngineCore::FilePickerController>) override;
+ void showColorDialog(QSharedPointer<QtWebEngineCore::ColorChooserController>) override;
+ void didRunJavaScript(quint64, const QVariant&) override;
+ void didFetchDocumentMarkup(quint64, const QString&) override { }
+ void didFetchDocumentInnerText(quint64, const QString&) override { }
+ void didFindText(quint64, int) override;
+ void didPrintPage(quint64 requestId, const QByteArray &result) override;
+ void didPrintPageToPdf(const QString &filePath, bool success) override;
+ void passOnFocus(bool reverse) override;
+ void javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, const QString& message, int lineNumber, const QString& sourceID) override;
+ void authenticationRequired(QSharedPointer<QtWebEngineCore::AuthenticationDialogController>) override;
+ void runMediaAccessPermissionRequest(const QUrl &securityOrigin, MediaRequestFlags requestFlags) override;
+ void runMouseLockPermissionRequest(const QUrl &securityOrigin) override;
+ void runQuotaPermissionRequest(QSharedPointer<QtWebEngineCore::QuotaPermissionController>) override;
+ void runRegisterProtocolHandlerPermissionRequest(QSharedPointer<QtWebEngineCore::RegisterProtocolHandlerPermissionController>) override;
+ QObject *accessibilityParentObject() override;
+ QtWebEngineCore::WebEngineSettings *webEngineSettings() const override;
+ void allowCertificateError(const QSharedPointer<CertificateErrorController> &errorController) override;
+ void runGeolocationPermissionRequest(QUrl const&) override;
+ void showValidationMessage(const QRect &anchor, const QString &mainText, const QString &subText) override;
+ void hideValidationMessage() override;
+ void moveValidationMessage(const QRect &anchor) override;
+ void renderProcessTerminated(RenderProcessTerminationStatus terminationStatus, int exitCode) override;
+ void requestGeometryChange(const QRect &geometry, const QRect &frameGeometry) override;
+ void updateScrollPosition(const QPointF &position) override;
+ void updateContentsSize(const QSizeF &size) override;
void startDragging(const content::DropData &dropData, Qt::DropActions allowedActions,
- const QPixmap &pixmap, const QPoint &offset) Q_DECL_OVERRIDE;
- virtual bool isEnabled() const Q_DECL_OVERRIDE;
- virtual void setToolTip(const QString &toolTipText) Q_DECL_OVERRIDE;
- const QObject *holdingQObject() const Q_DECL_OVERRIDE;
+ const QPixmap &pixmap, const QPoint &offset) override;
+ bool isEnabled() const override;
+ void setToolTip(const QString &toolTipText) override;
+ const QObject *holdingQObject() const override;
- virtual QSharedPointer<QtWebEngineCore::BrowserContextAdapter> browserContextAdapter() Q_DECL_OVERRIDE;
- QtWebEngineCore::WebContentsAdapter *webContentsAdapter() Q_DECL_OVERRIDE;
+ QSharedPointer<QtWebEngineCore::BrowserContextAdapter> browserContextAdapter() override;
+ QtWebEngineCore::WebContentsAdapter *webContentsAdapter() override;
void setDevicePixelRatio(qreal);
void adoptWebContents(QtWebEngineCore::WebContentsAdapter *webContents);
@@ -179,10 +182,13 @@ public:
bool isLoading;
bool m_activeFocusOnPress;
bool m_navigationActionTriggered;
+ bool m_validationShowing;
qreal devicePixelRatio;
QMap<quint64, QJSValue> m_callbacks;
QList<QSharedPointer<CertificateErrorController> > m_certificateErrorControllers;
QQmlWebChannel *m_webChannel;
+ QPointer<QQuickWebEngineView> inspectedView;
+ QPointer<QQuickWebEngineView> devToolsView;
uint m_webChannelWorld;
private:
@@ -199,18 +205,36 @@ class QQuickWebEngineViewAccessible : public QAccessibleObject
{
public:
QQuickWebEngineViewAccessible(QQuickWebEngineView *o);
- QAccessibleInterface *parent() const Q_DECL_OVERRIDE;
- int childCount() const Q_DECL_OVERRIDE;
- QAccessibleInterface *child(int index) const Q_DECL_OVERRIDE;
- int indexOfChild(const QAccessibleInterface*) const Q_DECL_OVERRIDE;
- QString text(QAccessible::Text) const Q_DECL_OVERRIDE;
- QAccessible::Role role() const Q_DECL_OVERRIDE;
- QAccessible::State state() const Q_DECL_OVERRIDE;
+ QAccessibleInterface *parent() const override;
+ int childCount() const override;
+ QAccessibleInterface *child(int index) const override;
+ int indexOfChild(const QAccessibleInterface*) const override;
+ QString text(QAccessible::Text) const override;
+ QAccessible::Role role() const override;
+ QAccessible::State state() const override;
private:
QQuickWebEngineView *engineView() const { return static_cast<QQuickWebEngineView*>(object()); }
};
#endif // QT_NO_ACCESSIBILITY
+
+class QQuickContextMenuBuilder : public QtWebEngineCore::RenderViewContextMenuQt
+{
+public:
+ QQuickContextMenuBuilder(const QtWebEngineCore::WebEngineContextMenuData &data, QQuickWebEngineView *view, QObject *menu);
+ void appendExtraItems(QQmlEngine *engine);
+
+private:
+ virtual bool hasInspector() override;
+ virtual bool isFullScreenMode() override;
+
+ virtual void addMenuItem(ContextMenuItem menuItem) override;
+ virtual bool isMenuItemEnabled(ContextMenuItem menuItem) override;
+
+ QQuickWebEngineView *m_view;
+ QObject *m_menu;
+};
+
QT_END_NAMESPACE
#endif // QQUICKWEBENGINEVIEW_P_P_H
diff --git a/src/webengine/doc/src/external-resources.qdoc b/src/webengine/doc/src/external-resources.qdoc
index 6cced588c..7ff6eea6b 100644
--- a/src/webengine/doc/src/external-resources.qdoc
+++ b/src/webengine/doc/src/external-resources.qdoc
@@ -113,11 +113,6 @@
*/
/*!
- \externalpage https://www.w3.org/TR/html5/links.html#downloading-resources
- \title HTML download attribute
-*/
-
-/*!
\externalpage https://www.iana.org/assignments/uri-schemes/prov/view-source
\title view-source URI scheme
*/
@@ -146,3 +141,8 @@
\externalpage https://wiki.greasespot.net/Metadata_Block#.40name
\title Metadata Block
*/
+
+/*!
+ \externalpage https://developer.mozilla.org/en-US/docs/Web/API/Navigator/registerProtocolHandler
+ \title registerProtocolHandler
+*/
diff --git a/src/webengine/doc/src/qtwebengine-features.qdoc b/src/webengine/doc/src/qtwebengine-features.qdoc
index 9e1979429..07d9269db 100644
--- a/src/webengine/doc/src/qtwebengine-features.qdoc
+++ b/src/webengine/doc/src/qtwebengine-features.qdoc
@@ -78,8 +78,8 @@
This feature can be tested by launching a Qt WebEngine application with the
command line option \c {--remote-debugging-port=[your-port]} or by setting
the environment variable \c QTWEBENGINE_REMOTE_DEBUGGING, and then using a
- Chromium based browser (such as \l{WebEngine Demo Browser Example}
- {Demo Browser} or \l{WebEngine Quick Nano Browser}{Nano Browser}) to connect
+ Chromium based browser (such as \l{WebEngine Widgets Simple Browser Example}
+ {Simple Browser} or \l{WebEngine Quick Nano Browser}{Nano Browser}) to connect
to \c {http://localhost:[your-port]}.
For more information, see \l {Qt WebEngine Debugging and Profiling}.
@@ -90,8 +90,8 @@
This feature can be tested by opening an HTML5 drag and drop demo, such as
\l{HTML5 Demos - Drag and Drop}, \l{HTML5 Demos - Simple Drag and Drop}, or
- \l{HTML5 Demos - Drag and Drop, Automatic Upload}, in \l{WebEngine Demo
- Browser Example}{Demo Browser} or \l{WebEngine Quick Nano Browser}
+ \l{HTML5 Demos - Drag and Drop, Automatic Upload}, in \l{WebEngine Widgets
+ Simple Browser Example}{Simple Browser} or \l{WebEngine Quick Nano Browser}
{Nano Browser}.
Dragging files into the browser is not actually part of HTML5, but it is
@@ -109,7 +109,7 @@
QWebEnginePage::fullScreenRequested.
This feature can be tested by playing a video from YouTube in \l{WebEngine
- Demo Browser Example}{Demo Browser} or \l{WebEngine Quick Nano Browser}
+ Widgets Video Player Example}{Video Player} or \l{WebEngine Quick Nano Browser}
{Nano Browser}, and clicking the full screen icon to go into fullscreen
mode.
@@ -124,8 +124,8 @@
proprietary audio and video codecs. For more information about enabling the
codecs, see \l{Audio and Video Codecs}.
- This feature can be tested by playing a video in \l{WebEngine Demo Browser
- Example}{Demo Browser} or \l{WebEngine Quick Nano Browser}{Nano Browser}
+ This feature can be tested by playing a video in \l{WebEngine Widgets Simple Browser
+ Example}{Simple Browser} or \l{WebEngine Quick Nano Browser}{Nano Browser}
from \l{castLabs}, \l{Swank Motion Pictures, Inc.}, or \l{Shaka Player}.
Support for this feature was added in Qt 5.7.0.
@@ -137,11 +137,11 @@
QWebEnginePage::Geolocation or \l{WebEngineView::Feature}
{WebEngineView.Feature}.
- This feature can be tested if Qt Location has been built before Qt WebEngine.
- The \c http://html5demos.com/geo page can be opened in the \l{WebEngine Demo
- Browser Example}{Demo Browser} and allowed to find the current position of
- the user. Note that on Windows an external GPS receiver must be connected to
- the application. For more information, see \l{Qt Positioning}.
+ If Qt Location has been built before Qt WebEngine then this feature can be
+ tested by using \l{WebEngine Widgets Maps Example}{Maps} and allowing it to
+ find the current position of the user. Note that on Windows an external GPS
+ receiver must be connected to the application. For more information, see
+ \l{Qt Positioning}.
Support for this feature was added in Qt 5.5.0.
@@ -254,7 +254,7 @@
--ppapi-flash-version=16.0.0.235
\endcode
- This feature can be tested in \l{WebEngine Demo Browser Example}{Demo Browser}
+ This feature can be tested in \l{WebEngine Widgets Simple Browser Example}{Simple Browser}
or \l{WebEngine Quick Nano Browser}{Nano Browser} if the Adobe Flash PPAPI
plugin is installed and plugins are enabled in the browser. To test the
feature, the \c https://helpx.adobe.com/flash-player.html page can be opened
@@ -266,8 +266,8 @@
information, see QWebEnginePage::printToPdf() and
\l{WebEngineView::printToPdf}{WebEngineView.printToPdf}.
- This feature can be tested in \l{WebEngine Demo Browser Example}
- {Demo Browser} by selecting \uicontrol File > \uicontrol {Print to PDF}.
+ This feature can be tested using \l{WebEngine Widgets Html2Pdf Example}
+ {Html2Pdf}.
Support for this feature was added in Qt 5.7.0.
@@ -294,9 +294,40 @@
These two files can be converted into the \c bdic format by using the
\c qwebengine_convert_dict tool that is shipped together with Qt.
When the Qt WebEngine spellchecker initializes, it will try to load the
- \c bdict dictionaries and to check them for consistency. First, it searches
- \e qtwebengine_dictionaries directories relative to the executable,
- then it will look in \c QT_INSTALL_PREFIX/qtwebengine_dictionaries.
+ \c bdict dictionaries and to check them for consistency.
+
+ If \c QTWEBENGINE_DICTIONARIES_PATH is set, the spellchecker uses the
+ dictionaries in the specified directory without looking anywere else.
+ Otherwise, it uses the \e qtwebengine_dictionaries directory relative to the
+ executable if it exists. If it does not exist, it will look in \c
+ QT_INSTALL_PREFIX/qtwebengines_dictionaries.
+
+ On macOS, depending on how Qt WebEngine is configured at build time, there
+ are two possibilities how spellchecking data is found:
+
+ \list
+ \li Hunspell dictionaries (default) - .bdic dictionaries are used, just
+ like on other platforms
+ \li Native dictionaries - the macOS spellchecking APIs are used (which
+ means the results will depend on the installed OS dictionaries)
+ \endlist
+
+ Thus, in the macOS Hunspell case, Qt WebEngine will look in the \e
+ qtwebengine_dictionaries subdirectory located inside the application bundle
+ \c Resources directory, and also in the \c Resources directory located
+ inside the Qt framework bundle.
+
+ To summarize, in case of Hunspell usage, the following paths are considered:
+
+ \list
+ \li \c QTWEBENGINE_DICTIONARIES_PATH, if set
+ \li QCoreApplication::applicationDirPath()/qtwebengine_dictionaries
+ or QCoreApplication::applicationDirPath()/../Contents/Resources/qtwebengine_dictionaries
+ (on macOS)
+ \li [QLibraryInfo::DataPath]/qtwebengine_dictionaries
+ or path/to/QtWebEngineCore.framework/Resources/qtwebengine_dictionaries (Qt framework
+ bundle on macOS)
+ \endlist
Spellchecking is disabled by default and can be enabled per profile by
using the QWebEngineProfile::setSpellCheckEnabled() method in widget-based
diff --git a/src/webengine/doc/src/qtwebengine-overview.qdoc b/src/webengine/doc/src/qtwebengine-overview.qdoc
index e9ca573b7..904e4a551 100644
--- a/src/webengine/doc/src/qtwebengine-overview.qdoc
+++ b/src/webengine/doc/src/qtwebengine-overview.qdoc
@@ -89,7 +89,7 @@
\l{https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md}{overview}
that is part of the documentation in the \l {Chromium Project} upstream source tree.
- This version of Qt WebEngine is based on Chromium version 56.0.2924.122, with
+ This version of Qt WebEngine is based on Chromium version 61.0.3163.99, with
additional security fixes from newer versions.
\section2 Qt WebEngine Process
diff --git a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc
index 068d395b6..6a9330583 100644
--- a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc
+++ b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc
@@ -112,6 +112,20 @@
\note Qt WebEngine cannot be built for the 32-bit mode of \macos (using the
\c macx-clang-32 \c mkspec).
+ \section1 Using Earlier Qt Versions to Build Qt WebEngine
+
+ Building Qt WebEngine with earlier Qt versions (down to the last LTS
+ version) is supported. It means that Qt WebEngine 5.11 can be built with
+ Qt 5.9.x, Qt 5.10.x, and Qt 5.11.
+
+ To use an earlier Qt version to build Qt Webengine:
+
+ \list 1
+ \li Download the qtwebengine sources.
+ \li From the earlier Qt version, run
+ \c {qmake && make (&& make install)}.
+ \endlist
+
\section1 Mac App Store Compatibility
Applications using Qt WebEngine are not compatible with the Mac App Store, because:
diff --git a/src/webengine/doc/src/webengineview_lgpl.qdoc b/src/webengine/doc/src/webengineview_lgpl.qdoc
index 27c3d6920..104397bf7 100644
--- a/src/webengine/doc/src/webengineview_lgpl.qdoc
+++ b/src/webengine/doc/src/webengineview_lgpl.qdoc
@@ -86,7 +86,7 @@
focus on press. This can be useful in a hybrid UI.
The \l {WebEngineSettings::focusOnNavigationEnabled} {focusOnNavigationEnabled} setting can be
- used to stop the view from automatically receiving focus when a navigation operation occurs
+ used to make the view automatically receive focus when a navigation operation occurs
(like loading or reloading a page or navigating through history).
The \l linkHovered() signal is emitted when a mouse pointer passes over a link and thus
@@ -112,7 +112,7 @@
A web page can request through the JavaScript API to be loaded in fullscreen mode. The
\l fullScreenRequested() signal is emitted when the web page issues the request. The
- WebEngineFullScreenRequest utility type can be used to toggle fullscreen requests. The
+ FullScreenRequest utility type can be used to toggle fullscreen requests. The
\l fullScreenCancelled method can be used to notify the browser engine when the windowing
system forces the application to leave fullscreen mode.
@@ -576,7 +576,7 @@
*/
/*!
- \qmlsignal WebEngineView::fullScreenRequested(WebEngineFullScreenRequest request)
+ \qmlsignal WebEngineView::fullScreenRequested(FullScreenRequest request)
\since QtWebEngine 1.1
This signal is emitted when the web page requests fullscreen mode through the
@@ -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
*/
@@ -810,6 +850,11 @@
Video devices, such as cameras.
\value WebEngineView.MediaAudioVideoCapture
Both audio and video capture devices.
+ \value DesktopVideoCapture
+ Video output capture, that is, the capture of the user's display.
+ (Added in Qt 5.10)
+ \value DesktopAudioVideoCapture
+ Both audio and video output capture. (Added in Qt 5.10)
\sa featurePermissionRequested(), grantFeaturePermission()
*/
@@ -994,7 +1039,7 @@
*/
/*!
- \qmltype WebEngineFullScreenRequest
+ \qmltype FullScreenRequest
\instantiates QQuickWebEngineFullScreenRequest
\inqmlmodule QtWebEngine
\since QtWebEngine 1.1
@@ -1005,13 +1050,13 @@
*/
/*!
- \qmlproperty url WebEngineFullScreenRequest::origin
+ \qmlproperty url FullScreenRequest::origin
\readonly
The URL of the web page that issued the fullscreen request.
*/
/*!
- \qmlproperty bool WebEngineFullScreenRequest::toggleOn
+ \qmlproperty bool FullScreenRequest::toggleOn
\readonly
Returns \c{true} if the application should toggle fullscreen mode on, \c{false} otherwise.
@@ -1020,7 +1065,7 @@
*/
/*!
- \qmlmethod void WebEngineFullScreenRequest::accept()
+ \qmlmethod void FullScreenRequest::accept()
Call this method to accept the fullscreen request. It sets the WebEngineView::isFullScreen
property to be equal to toggleOn.
@@ -1044,7 +1089,7 @@
*/
/*!
- \qmlmethod void WebEngineFullScreenRequest::reject()
+ \qmlmethod void FullScreenRequest::reject()
Rejects a fullscreen request.
*/
@@ -1252,3 +1297,158 @@
/*! \qmlsignal WebEngineView::navigationRequested(WebEngineNavigationRequest request)
This signal is emitted when the navigation request \a request is issued.
*/
+
+/*!
+ \qmlsignal WebEngineView::quotaPermissionRequested(QuotaPermissionRequest request)
+ \since QtWebEngine 1.7
+
+ This signal is emitted when the web page requests larger persistent storage
+ than the application's current allocation in File System API. The default quota
+ is 0 bytes.
+
+ \sa QuotaPermissionRequest
+*/
+
+/*!
+ \qmltype QuotaPermissionRequest
+ \instantiates QQuickWebEngineQuotaPermissionRequest
+ \inqmlmodule QtWebEngine
+ \since QtWebEngine 1.7
+
+ \brief A utility type for the WebEngineView::quotaPermissionRequested() signal.
+
+ \sa WebEngineView::quotaPermissionRequested()
+*/
+
+/*!
+ \qmlproperty url QuotaPermissionRequest::origin
+ \readonly
+
+ The URL of the web page that issued the quota permission request.
+*/
+
+/*!
+ \qmlproperty qint64 QuotaPermissionRequest::requestedSize
+ \readonly
+
+ Contains the size of the requested disk space in bytes.
+*/
+
+/*!
+ \qmlmethod void QuotaPermissionRequest::accept()
+
+ Accepts the quota permission request.
+
+ \qml
+ WebEngineView {
+ onQuotaPermissionRequested: function(request) {
+ if (request.requestedSize <= 5 * 1024 * 1024)
+ request.accept();
+ else
+ request.reject();
+ }
+ }
+ \endqml
+*/
+
+/*!
+ \qmlmethod void QuotaPermissionRequest::reject()
+ Rejects a quota permission request.
+*/
+
+/*!
+ \qmlsignal WebEngineView::registerProtocolHandlerPermissionRequested(RegisterProtocolHandlerPermissionRequest request)
+ \since QtWebEngine 1.7
+
+ This signal is emitted when the web page tries to register a custom protocol
+ using the \l registerProtocolHandler API.
+
+ \sa RegisterProtocolHandlerPermissionRequest
+*/
+
+/*!
+ \qmltype RegisterProtocolHandlerPermissionRequest
+ \instantiates QQuickWebEngineRegisterProtocolHandlerPermissionRequest
+ \inqmlmodule QtWebEngine
+ \since QtWebEngine 1.7
+ \brief The RegisterProtocolHandlerPermissionRequest type enables accepting
+ or rejecting requests from the \l registerProtocolHandler API.
+
+ \sa WebEngineView::registerProtocolHandlerPermissionRequested()
+*/
+
+/*!
+ \qmlproperty url RegisterProtocolHandlerPermissionRequest::origin
+ \brief The URL template for the protocol handler.
+
+ This is the second parameter from the \l registerProtocolHandler call.
+*/
+
+/*!
+ \qmlproperty string RegisterProtocolHandlerPermissionRequest::protocol
+ \brief The URL scheme for the protocol handler.
+
+ This is the first parameter from the \l registerProtocolHandler call.
+*/
+
+/*!
+ \qmlmethod void RegisterProtocolHandlerPermissionRequest::accept()
+ \brief Accepts the request.
+
+ Subsequent calls to accept() and reject() are ignored.
+*/
+
+/*!
+ \qmlmethod void RegisterProtocolHandlerPermissionRequest::reject()
+ \brief Accepts the request.
+
+ Subsequent calls to accept() and reject() are ignored.
+*/
+
+/*!
+ \qmlsignal WebEngineView::geometryChangeRequested(rect geometry, rect frameGeometry)
+ \since QtWebEngine 1.7
+
+ This signal is emitted whenever the document wants to change the position and size of the
+ page to \a frameGeometry. This can happen for example through JavaScript.
+
+ While \a frameGeometry includes, \a geometry excludes the size of frame margins.
+
+ \note Geometry related properties of QML Window expect a size excluding the window
+ decoration. You have to use \a geometry to handle this signal correctly.
+
+ \qml
+ onGeometryChangeRequested: {
+ window.x = geometry.x
+ window.y = geometry.y
+ window.width = geometry.width
+ window.height = geometry.height
+ }
+ \endqml
+*/
+
+/*!
+ \qmlproperty WebEngineView WebEngineView::inspectedView
+ \since QtWebEngine 1.7
+
+ The view this view is currently inspecting, if any. Setting it
+ will navigate to an internal URL with the developer tools of
+ the view set.
+
+ It is recommended to unset this property when developer tools
+ are not visible; otherwise some debug information may appear
+ in the inspected WebEngineView.
+
+ \sa devToolView
+*/
+
+/*!
+ \qmlproperty WebEngineView WebEngineView::devToolsView
+ \since QtWebEngine 1.7
+
+ The view currently hosting the developer tools for this view.
+ Setting it to a new view will navigate that view to an internal
+ URL with the developer tools, and bind it to this view.
+
+ \sa inspectedView
+*/
diff --git a/src/webengine/plugin/plugin.cpp b/src/webengine/plugin/plugin.cpp
index 3c8991ff7..a9f406d49 100644
--- a/src/webengine/plugin/plugin.cpp
+++ b/src/webengine/plugin/plugin.cpp
@@ -66,13 +66,13 @@ class QtWebEnginePlugin : public QQmlExtensionPlugin
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- virtual void initializeEngine(QQmlEngine *engine, const char *uri) Q_DECL_OVERRIDE
+ void initializeEngine(QQmlEngine *engine, const char *uri) override
{
Q_UNUSED(uri);
engine->addImageProvider(QQuickWebEngineFaviconProvider::identifier(), new QQuickWebEngineFaviconProvider);
}
- virtual void registerTypes(const char *uri) Q_DECL_OVERRIDE
+ void registerTypes(const char *uri) override
{
Q_ASSERT(QLatin1String(uri) == QLatin1String("QtWebEngine"));
@@ -85,6 +85,8 @@ public:
qmlRegisterType<QQuickWebEngineView, 3>(uri, 1, 3, "WebEngineView");
qmlRegisterType<QQuickWebEngineView, 4>(uri, 1, 4, "WebEngineView");
qmlRegisterType<QQuickWebEngineView, 5>(uri, 1, 5, "WebEngineView");
+ qmlRegisterType<QQuickWebEngineView, 6>(uri, 1, 6, "WebEngineView");
+ qmlRegisterType<QQuickWebEngineView, 7>(uri, 1, 7, "WebEngineView");
qmlRegisterType<QQuickWebEngineProfile>(uri, 1, 1, "WebEngineProfile");
qmlRegisterType<QQuickWebEngineProfile, 1>(uri, 1, 2, "WebEngineProfile");
qmlRegisterType<QQuickWebEngineProfile, 2>(uri, 1, 3, "WebEngineProfile");
@@ -102,6 +104,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 +113,8 @@ 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"));
+ qmlRegisterUncreatableType<QQuickWebEngineSettings, 6>(uri, 1, 7, "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"));
@@ -119,6 +125,8 @@ public:
qmlRegisterUncreatableType<QQuickWebEngineContextMenuRequest>(uri, 1, 4, "ContextMenuRequest",
msgUncreatableType("ContextMenuRequest"));
+ qmlRegisterUncreatableType<QQuickWebEngineContextMenuRequest, 1>(uri, 1, 7, "ContextMenuRequest",
+ msgUncreatableType("ContextMenuRequest"));
qmlRegisterUncreatableType<QQuickWebEngineAuthenticationDialogRequest>(uri, 1, 4, "AuthenticationDialogRequest",
msgUncreatableType("AuthenticationDialogRequest"));
qmlRegisterUncreatableType<QQuickWebEngineJavaScriptDialogRequest>(uri, 1, 4, "JavaScriptDialogRequest",
@@ -129,6 +137,10 @@ public:
msgUncreatableType("FileDialogRequest"));
qmlRegisterUncreatableType<QQuickWebEngineFormValidationMessageRequest>(uri, 1, 4, "FormValidationMessageRequest",
msgUncreatableType("FormValidationMessageRequest"));
+ qmlRegisterUncreatableType<QQuickWebEngineQuotaPermissionRequest>(uri, 1, 7, "QuotaPermissionRequest",
+ tr("Cannot create a separate instance of QuotaPermissionRequest"));
+ qmlRegisterUncreatableType<QQuickWebEngineRegisterProtocolHandlerPermissionRequest>(uri, 1, 7, "RegisterProtocolHandlerPermissionRequest",
+ tr("Cannot create a separate instance of RegisterProtocolHandlerPermissionRequest"));
}
private:
diff --git a/src/webengine/plugin/plugin.pro b/src/webengine/plugin/plugin.pro
index 68404b4f8..84b497e34 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.7
QT += webengine qml quick
QT_PRIVATE += webengine-private
diff --git a/src/webengine/plugin/plugins.qmltypes b/src/webengine/plugin/plugins.qmltypes
index 459d56c75..43d7d9064 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.7'
Module {
dependencies: ["QtQuick 2.6"]
@@ -84,9 +84,12 @@ Module {
Component {
name: "QQuickWebEngineContextMenuRequest"
prototype: "QObject"
- exports: ["QtWebEngine/ContextMenuRequest 1.4"]
+ exports: [
+ "QtWebEngine/ContextMenuRequest 1.4",
+ "QtWebEngine/ContextMenuRequest 1.7"
+ ]
isCreatable: false
- exportMetaObjectRevisions: [0]
+ exportMetaObjectRevisions: [0, 1]
Enum {
name: "MediaType"
values: {
@@ -99,6 +102,37 @@ Module {
"MediaTypePlugin": 6
}
}
+ Enum {
+ name: "MediaFlags"
+ values: {
+ "MediaNone": 0,
+ "MediaInError": 1,
+ "MediaPaused": 2,
+ "MediaMuted": 4,
+ "MediaLoop": 8,
+ "MediaCanSave": 16,
+ "MediaHasAudio": 32,
+ "MediaCanToggleControls": 64,
+ "MediaControls": 128,
+ "MediaCanPrint": 256,
+ "MediaCanRotate": 512
+ }
+ }
+ Enum {
+ name: "EditFlags"
+ values: {
+ "CanDoNone": 0,
+ "CanUndo": 1,
+ "CanRedo": 2,
+ "CanCut": 4,
+ "CanCopy": 8,
+ "CanPaste": 16,
+ "CanDelete": 32,
+ "CanSelectAll": 64,
+ "CanTranslate": 128,
+ "CanEditRichly": 256
+ }
+ }
Property { name: "x"; type: "int"; isReadonly: true }
Property { name: "y"; type: "int"; isReadonly: true }
Property { name: "selectedText"; type: "string"; isReadonly: true }
@@ -110,6 +144,8 @@ Module {
Property { name: "misspelledWord"; type: "string"; isReadonly: true }
Property { name: "spellCheckerSuggestions"; type: "QStringList"; isReadonly: true }
Property { name: "accepted"; type: "bool" }
+ Property { name: "mediaFlags"; revision: 1; type: "MediaFlags"; isReadonly: true }
+ Property { name: "editFlags"; revision: 1; type: "EditFlags"; isReadonly: true }
}
Component {
name: "QQuickWebEngineDownloadItem"
@@ -119,10 +155,11 @@ Module {
"QtWebEngine/WebEngineDownloadItem 1.2",
"QtWebEngine/WebEngineDownloadItem 1.3",
"QtWebEngine/WebEngineDownloadItem 1.4",
- "QtWebEngine/WebEngineDownloadItem 1.5"
+ "QtWebEngine/WebEngineDownloadItem 1.5",
+ "QtWebEngine/WebEngineDownloadItem 1.6"
]
isCreatable: false
- exportMetaObjectRevisions: [0, 1, 2, 3, 4]
+ exportMetaObjectRevisions: [0, 1, 2, 3, 4, 5]
Enum {
name: "DownloadState"
values: {
@@ -195,12 +232,19 @@ Module {
isReadonly: true
}
Property { name: "interruptReasonString"; revision: 4; type: "string"; isReadonly: true }
+ Property { name: "isFinished"; revision: 5; type: "bool"; isReadonly: true }
+ Property { name: "isPaused"; revision: 5; type: "bool"; isReadonly: true }
+ Property { name: "isSavePageDownload"; revision: 6; type: "bool"; isReadonly: true }
Signal { name: "savePageFormatChanged"; revision: 2 }
Signal { name: "mimeTypeChanged"; revision: 1 }
Signal { name: "typeChanged"; revision: 3 }
Signal { name: "interruptReasonChanged"; revision: 4 }
+ Signal { name: "isFinishedChanged"; revision: 5 }
+ Signal { name: "isPausedChanged"; revision: 5 }
Method { name: "accept" }
Method { name: "cancel" }
+ Method { name: "pause" }
+ Method { name: "resume" }
}
Component {
name: "QQuickWebEngineFileDialogRequest"
@@ -425,6 +469,16 @@ Module {
Method { name: "clearHttpCache"; revision: 2 }
}
Component {
+ name: "QQuickWebEngineQuotaPermissionRequest"
+ exports: ["QtWebEngine/QuotaPermissionRequest 1.7"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Property { name: "origin"; type: "QUrl"; isReadonly: true }
+ Property { name: "requestedSize"; type: "qlonglong"; isReadonly: true }
+ Method { name: "accept" }
+ Method { name: "reject" }
+ }
+ Component {
name: "QQuickWebEngineScript"
prototype: "QObject"
exports: ["QtWebEngine/WebEngineScript 1.1"]
@@ -509,10 +563,20 @@ 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",
+ "QtWebEngine/WebEngineSettings 1.7"
]
isCreatable: false
- exportMetaObjectRevisions: [0, 1, 2, 3, 4]
+ exportMetaObjectRevisions: [0, 1, 2, 3, 4, 5, 6]
+ Enum {
+ name: "UnknownUrlSchemePolicy"
+ values: {
+ "DisallowUnknownUrlSchemes": 1,
+ "AllowUnknownUrlSchemesFromUserInteraction": 2,
+ "AllowAllUnknownUrlSchemes": 3
+ }
+ }
Property { name: "autoLoadImages"; type: "bool" }
Property { name: "javascriptEnabled"; type: "bool" }
Property { name: "javascriptCanOpenWindows"; type: "bool" }
@@ -536,6 +600,11 @@ 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" }
+ Property { name: "showScrollBars"; revision: 5; type: "bool" }
+ Property { name: "unknownUrlSchemePolicy"; revision: 6; type: "UnknownUrlSchemePolicy" }
+ Property { name: "playbackRequiresUserGesture"; revision: 6; type: "bool" }
+ Property { name: "webRTCPublicInterfacesOnly"; revision: 6; type: "bool" }
Signal { name: "fullScreenSupportEnabledChanged"; revision: 1 }
Signal { name: "screenCaptureEnabledChanged"; revision: 2 }
Signal { name: "webGLEnabledChanged"; revision: 2 }
@@ -546,6 +615,11 @@ Module {
Signal { name: "printElementBackgroundsChanged"; revision: 3 }
Signal { name: "allowRunningInsecureContentChanged"; revision: 3 }
Signal { name: "allowGeolocationOnInsecureOriginsChanged"; revision: 4 }
+ Signal { name: "allowWindowActivationFromJavaScriptChanged"; revision: 5 }
+ Signal { name: "showScrollBarsChanged"; revision: 5 }
+ Signal { name: "unknownUrlSchemePolicyChanged"; revision: 6 }
+ Signal { name: "playbackRequiresUserGestureChanged"; revision: 6 }
+ Signal { name: "webRTCPublicInterfacesOnlyChanged"; revision: 6 }
}
Component {
name: "QQuickWebEngineSingleton"
@@ -573,9 +647,11 @@ Module {
"QtWebEngine/WebEngineView 1.2",
"QtWebEngine/WebEngineView 1.3",
"QtWebEngine/WebEngineView 1.4",
- "QtWebEngine/WebEngineView 1.5"
+ "QtWebEngine/WebEngineView 1.5",
+ "QtWebEngine/WebEngineView 1.6",
+ "QtWebEngine/WebEngineView 1.7"
]
- exportMetaObjectRevisions: [0, 1, 2, 3, 4, 5]
+ exportMetaObjectRevisions: [0, 1, 2, 3, 4, 5, 6, 7]
Enum {
name: "NavigationRequestAction"
values: {
@@ -630,7 +706,9 @@ Module {
"MediaAudioCapture": 0,
"MediaVideoCapture": 1,
"MediaAudioVideoCapture": 2,
- "Geolocation": 3
+ "Geolocation": 3,
+ "DesktopVideoCapture": 4,
+ "DesktopAudioVideoCapture": 5
}
}
Enum {
@@ -669,7 +747,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 {
@@ -874,6 +964,9 @@ Module {
Property { name: "audioMuted"; revision: 3; type: "bool" }
Property { name: "recentlyAudible"; revision: 3; type: "bool"; isReadonly: true }
Property { name: "webChannelWorld"; revision: 3; type: "uint" }
+ Property { name: "inspectedView"; revision: 7; type: "QQuickWebEngineView"; isPointer: true }
+ Property { name: "devToolsView"; revision: 7; type: "QQuickWebEngineView"; isPointer: true }
+ Property { name: "testSupport"; type: "QQuickWebEngineTestSupport"; isPointer: true }
Signal {
name: "loadingChanged"
Parameter { name: "loadRequest"; type: "QQuickWebEngineLoadRequest"; isPointer: true }
@@ -1004,6 +1097,19 @@ Module {
Parameter { name: "filePath"; type: "string" }
Parameter { name: "success"; type: "bool" }
}
+ Signal {
+ name: "quotaPermissionRequested"
+ revision: 7
+ Parameter { name: "request"; type: "QQuickWebEngineQuotaPermissionRequest" }
+ }
+ Signal {
+ name: "geometryChangeRequested"
+ revision: 7
+ Parameter { name: "geometry"; type: "QRect" }
+ Parameter { name: "frameGeometry"; type: "QRect" }
+ }
+ Signal { name: "inspectedViewChanged"; revision: 7 }
+ Signal { name: "devToolsViewChanged"; revision: 7 }
Method {
name: "runJavaScript"
Parameter { type: "string" }
diff --git a/src/webengine/plugin/testsupport/plugin.cpp b/src/webengine/plugin/testsupport/plugin.cpp
index 9352e3666..d5c43a859 100644
--- a/src/webengine/plugin/testsupport/plugin.cpp
+++ b/src/webengine/plugin/testsupport/plugin.cpp
@@ -58,6 +58,10 @@ 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"));
+ qmlRegisterUncreatableType<QQuickWebEngineTestEvent>(uri, 1, 0, "WebEngineTestEvent",
+ tr("Cannot create a separate instance of WebEngineTestEvent"));
}
};
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 0d77a5040..0a31811d9 100644
--- a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
+++ b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
@@ -48,18 +48,13 @@
#include <QVariant>
#include <QWindow>
#include <private/qquickwindow_p.h>
-#include <private/qsgcontext_p.h>
-
-#if (QT_VERSION < QT_VERSION_CHECK(5, 8, 0))
-#include <QSGSimpleRectNode>
-#include <QSGSimpleTextureNode>
-#endif
namespace QtWebEngineCore {
RenderWidgetHostViewQtDelegateQuick::RenderWidgetHostViewQtDelegateQuick(RenderWidgetHostViewQtDelegateClient *client, bool isPopup)
: m_client(client)
, m_isPopup(isPopup)
+ , m_isPasswordInput(false)
, m_initialized(false)
{
setFlag(ItemHasContents);
@@ -185,30 +180,17 @@ QSGLayer *RenderWidgetHostViewQtDelegateQuick::createLayer()
QSGInternalImageNode *RenderWidgetHostViewQtDelegateQuick::createImageNode()
{
QSGRenderContext *renderContext = QQuickWindowPrivate::get(QQuickItem::window())->context;
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
return renderContext->sceneGraphContext()->createInternalImageNode();
-#else
- return renderContext->sceneGraphContext()->createImageNode();
-#endif
}
QSGTextureNode *RenderWidgetHostViewQtDelegateQuick::createTextureNode()
{
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
return QQuickItem::window()->createImageNode();
-#else
- return new QSGSimpleTextureNode();
-#endif
}
QSGRectangleNode *RenderWidgetHostViewQtDelegateQuick::createRectangleNode()
{
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
return QQuickItem::window()->createRectangleNode();
-#else
- QSGRenderContext *renderContext = QQuickWindowPrivate::get(QQuickItem::window())->context;
- return renderContext->sceneGraphContext()->createRectangleNode();
-#endif
}
void RenderWidgetHostViewQtDelegateQuick::update()
@@ -226,22 +208,24 @@ void RenderWidgetHostViewQtDelegateQuick::resize(int width, int height)
setSize(QSizeF(width, height));
}
-void RenderWidgetHostViewQtDelegateQuick::inputMethodStateChanged(bool editorVisible)
+void RenderWidgetHostViewQtDelegateQuick::inputMethodStateChanged(bool editorVisible, bool passwordInput)
{
- if (qApp->inputMethod()->isVisible() == editorVisible)
- return;
+ setFlag(QQuickItem::ItemAcceptsInputMethod, editorVisible && !passwordInput);
+
+ if (parentItem())
+ parentItem()->setFlag(QQuickItem::ItemAcceptsInputMethod, editorVisible && !passwordInput);
- if (parentItem() && parentItem()->flags() & QQuickItem::ItemAcceptsInputMethod) {
+ if (qApp->inputMethod()->isVisible() != editorVisible || m_isPasswordInput != passwordInput) {
qApp->inputMethod()->update(Qt::ImQueryInput | Qt::ImEnabled | Qt::ImHints);
qApp->inputMethod()->setVisible(editorVisible);
+ m_isPasswordInput = passwordInput;
}
-
}
bool RenderWidgetHostViewQtDelegateQuick::event(QEvent *event)
{
if (event->type() == QEvent::ShortcutOverride)
- return m_client->handleShortcutOverrideEvent(static_cast<QKeyEvent *>(event));
+ return m_client->forwardEvent(event);
#ifndef QT_NO_GESTURES
if (event->type() == QEvent::NativeGesture)
diff --git a/src/webengine/render_widget_host_view_qt_delegate_quick.h b/src/webengine/render_widget_host_view_qt_delegate_quick.h
index eeb7db9cb..a5101d070 100644
--- a/src/webengine/render_widget_host_view_qt_delegate_quick.h
+++ b/src/webengine/render_widget_host_view_qt_delegate_quick.h
@@ -52,50 +52,50 @@ class RenderWidgetHostViewQtDelegateQuick : public QQuickItem, public RenderWidg
public:
RenderWidgetHostViewQtDelegateQuick(RenderWidgetHostViewQtDelegateClient *client, bool isPopup);
- virtual void initAsChild(WebContentsAdapterClient* container) Q_DECL_OVERRIDE;
- virtual void initAsPopup(const QRect&) Q_DECL_OVERRIDE;
- virtual QRectF screenRect() const Q_DECL_OVERRIDE;
- virtual QRectF contentsRect() const Q_DECL_OVERRIDE;
- virtual void setKeyboardFocus() Q_DECL_OVERRIDE;
- virtual bool hasKeyboardFocus() Q_DECL_OVERRIDE;
- virtual void lockMouse() Q_DECL_OVERRIDE;
- virtual void unlockMouse() Q_DECL_OVERRIDE;
- virtual void show() Q_DECL_OVERRIDE;
- virtual void hide() Q_DECL_OVERRIDE;
- virtual bool isVisible() const Q_DECL_OVERRIDE;
- virtual QWindow* window() const Q_DECL_OVERRIDE;
- virtual QSGTexture *createTextureFromImage(const QImage &) Q_DECL_OVERRIDE;
- virtual QSGLayer *createLayer() Q_DECL_OVERRIDE;
- virtual QSGInternalImageNode *createImageNode() Q_DECL_OVERRIDE;
- virtual QSGTextureNode *createTextureNode() Q_DECL_OVERRIDE;
- virtual QSGRectangleNode *createRectangleNode() Q_DECL_OVERRIDE;
- virtual void update() Q_DECL_OVERRIDE;
- virtual void updateCursor(const QCursor &) Q_DECL_OVERRIDE;
- virtual void resize(int width, int height) Q_DECL_OVERRIDE;
- virtual void move(const QPoint&) Q_DECL_OVERRIDE { }
- virtual void inputMethodStateChanged(bool editorVisible) Q_DECL_OVERRIDE;
- virtual void setInputMethodHints(Qt::InputMethodHints) Q_DECL_OVERRIDE { }
+ void initAsChild(WebContentsAdapterClient* container) override;
+ void initAsPopup(const QRect&) override;
+ QRectF screenRect() const override;
+ QRectF contentsRect() const override;
+ void setKeyboardFocus() override;
+ bool hasKeyboardFocus() override;
+ void lockMouse() override;
+ void unlockMouse() override;
+ void show() override;
+ void hide() override;
+ bool isVisible() const override;
+ QWindow* window() const override;
+ QSGTexture *createTextureFromImage(const QImage &) override;
+ QSGLayer *createLayer() override;
+ QSGInternalImageNode *createImageNode() override;
+ QSGTextureNode *createTextureNode() override;
+ QSGRectangleNode *createRectangleNode() override;
+ void update() override;
+ void updateCursor(const QCursor &) override;
+ void resize(int width, int height) override;
+ void move(const QPoint&) override { }
+ void inputMethodStateChanged(bool editorVisible, bool isPasswordInput) override;
+ void setInputMethodHints(Qt::InputMethodHints) override { }
// The QtQuick view doesn't have a backbuffer of its own and doesn't need this
- virtual void setClearColor(const QColor &) Q_DECL_OVERRIDE { }
+ void setClearColor(const QColor &) override { }
protected:
- virtual bool event(QEvent *event) Q_DECL_OVERRIDE;
- virtual void focusInEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
- virtual void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
- virtual void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- virtual void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- virtual void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- virtual void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- virtual void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
- virtual void touchEvent(QTouchEvent *event) Q_DECL_OVERRIDE;
- virtual void hoverMoveEvent(QHoverEvent *event) Q_DECL_OVERRIDE;
- virtual void hoverLeaveEvent(QHoverEvent *event) Q_DECL_OVERRIDE;
- virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const Q_DECL_OVERRIDE;
- virtual void inputMethodEvent(QInputMethodEvent *event) Q_DECL_OVERRIDE;
- virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
- virtual void itemChange(ItemChange change, const ItemChangeData &value) Q_DECL_OVERRIDE;
- virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) override;
+ void focusInEvent(QFocusEvent *event) override;
+ void focusOutEvent(QFocusEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
+ void keyPressEvent(QKeyEvent *event) override;
+ void keyReleaseEvent(QKeyEvent *event) override;
+ void wheelEvent(QWheelEvent *event) override;
+ void touchEvent(QTouchEvent *event) override;
+ void hoverMoveEvent(QHoverEvent *event) override;
+ void hoverLeaveEvent(QHoverEvent *event) override;
+ QVariant inputMethodQuery(Qt::InputMethodQuery query) const override;
+ void inputMethodEvent(QInputMethodEvent *event) override;
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ void itemChange(ItemChange change, const ItemChangeData &value) override;
+ QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override;
private slots:
void onWindowPosChanged();
@@ -105,6 +105,7 @@ private:
RenderWidgetHostViewQtDelegateClient *m_client;
QList<QMetaObject::Connection> m_windowConnections;
bool m_isPopup;
+ bool m_isPasswordInput;
bool m_initialized;
QPoint m_lastGlobalPos;
};
diff --git a/src/webengine/render_widget_host_view_qt_delegate_quickwindow.h b/src/webengine/render_widget_host_view_qt_delegate_quickwindow.h
index 057b91c75..be4033728 100644
--- a/src/webengine/render_widget_host_view_qt_delegate_quickwindow.h
+++ b/src/webengine/render_widget_host_view_qt_delegate_quickwindow.h
@@ -55,30 +55,30 @@ public:
RenderWidgetHostViewQtDelegateQuickWindow(RenderWidgetHostViewQtDelegate *realDelegate);
~RenderWidgetHostViewQtDelegateQuickWindow();
- virtual void initAsChild(WebContentsAdapterClient* container) Q_DECL_OVERRIDE;
- virtual void initAsPopup(const QRect&) Q_DECL_OVERRIDE;
- virtual QRectF screenRect() const Q_DECL_OVERRIDE;
- virtual QRectF contentsRect() const Q_DECL_OVERRIDE;
- virtual void setKeyboardFocus() Q_DECL_OVERRIDE {}
- virtual bool hasKeyboardFocus() Q_DECL_OVERRIDE { return false; }
- virtual void lockMouse() Q_DECL_OVERRIDE {}
- virtual void unlockMouse() Q_DECL_OVERRIDE {}
- virtual void show() Q_DECL_OVERRIDE;
- virtual void hide() Q_DECL_OVERRIDE;
- virtual bool isVisible() const Q_DECL_OVERRIDE;
- virtual QWindow* window() const Q_DECL_OVERRIDE;
- virtual QSGTexture *createTextureFromImage(const QImage &) Q_DECL_OVERRIDE;
- virtual QSGLayer *createLayer() Q_DECL_OVERRIDE;
- virtual QSGInternalImageNode *createImageNode() Q_DECL_OVERRIDE;
- virtual QSGTextureNode *createTextureNode() Q_DECL_OVERRIDE;
- virtual QSGRectangleNode *createRectangleNode() Q_DECL_OVERRIDE;
- virtual void update() Q_DECL_OVERRIDE;
- virtual void updateCursor(const QCursor &) Q_DECL_OVERRIDE;
- virtual void resize(int width, int height) Q_DECL_OVERRIDE;
- virtual void move(const QPoint &screenPos) Q_DECL_OVERRIDE;
- virtual void inputMethodStateChanged(bool) Q_DECL_OVERRIDE {}
- virtual void setInputMethodHints(Qt::InputMethodHints) Q_DECL_OVERRIDE { }
- virtual void setClearColor(const QColor &) Q_DECL_OVERRIDE { }
+ void initAsChild(WebContentsAdapterClient* container) override;
+ void initAsPopup(const QRect&) override;
+ QRectF screenRect() const override;
+ QRectF contentsRect() const override;
+ void setKeyboardFocus() override {}
+ bool hasKeyboardFocus() override { return false; }
+ void lockMouse() override {}
+ void unlockMouse() override {}
+ void show() override;
+ void hide() override;
+ bool isVisible() const override;
+ QWindow* window() const override;
+ QSGTexture *createTextureFromImage(const QImage &) override;
+ QSGLayer *createLayer() override;
+ QSGInternalImageNode *createImageNode() override;
+ QSGTextureNode *createTextureNode() override;
+ QSGRectangleNode *createRectangleNode() override;
+ void update() override;
+ void updateCursor(const QCursor &) override;
+ void resize(int width, int height) override;
+ void move(const QPoint &screenPos) override;
+ void inputMethodStateChanged(bool, bool) override {}
+ void setInputMethodHints(Qt::InputMethodHints) override { }
+ void setClearColor(const QColor &) override { }
private:
QScopedPointer<RenderWidgetHostViewQtDelegate> m_realDelegate;
diff --git a/src/webengine/ui_delegates_manager.cpp b/src/webengine/ui_delegates_manager.cpp
index 24861fd35..046affbf4 100644
--- a/src/webengine/ui_delegates_manager.cpp
+++ b/src/webengine/ui_delegates_manager.cpp
@@ -594,11 +594,7 @@ void UIDelegatesManager::showToolTip(const QString &text)
int width = QQmlProperty(m_toolTip.data(), QStringLiteral("width")).read().toInt();
QSize toolTipSize(width, height);
QPoint position = m_view->cursor().pos();
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 7, 0))
position = m_view->mapFromGlobal(calculateToolTipPosition(position, toolTipSize)).toPoint();
-#else
- position = m_view->window()->mapFromGlobal(calculateToolTipPosition(position, toolTipSize));
-#endif
QQmlProperty(m_toolTip.data(), QStringLiteral("x")).write(position.x());
QQmlProperty(m_toolTip.data(), QStringLiteral("y")).write(position.y());
diff --git a/src/webengine/webengine.pro b/src/webengine/webengine.pro
index 5ac93c9a7..570f41866 100644
--- a/src/webengine/webengine.pro
+++ b/src/webengine/webengine.pro
@@ -1,3 +1,6 @@
+include($$QTWEBENGINE_OUT_ROOT/qtwebengine-config.pri)
+QT_FOR_CONFIG += webengine webengine-private
+
TARGET = QtWebEngine
# For our export macros
@@ -55,18 +58,20 @@ HEADERS = \
render_widget_host_view_qt_delegate_quickwindow.h \
ui_delegates_manager.h
-isQMLTestSupportApiEnabled() {
+qtConfig(webengine-testsupport) {
+ QT_PRIVATE += testlib
+
SOURCES += api/qquickwebenginetestsupport.cpp
HEADERS += api/qquickwebenginetestsupport_p.h
DEFINES += ENABLE_QML_TESTSUPPORT_API
}
-contains(WEBENGINE_CONFIG, use_spellchecker) {
+qtConfig(webengine-spellchecker) {
DEFINES += ENABLE_SPELLCHECK
}
-use?(pdf) {
+qtConfig(webengine-printing-and-pdf) {
DEFINES += ENABLE_PDF
}
@@ -77,7 +82,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