diff options
Diffstat (limited to 'src/webengine')
19 files changed, 319 insertions, 22 deletions
diff --git a/src/webengine/api/qquickwebenginecontextmenurequest.cpp b/src/webengine/api/qquickwebenginecontextmenurequest.cpp index df57442a1..c53e28d93 100644 --- a/src/webengine/api/qquickwebenginecontextmenurequest.cpp +++ b/src/webengine/api/qquickwebenginecontextmenurequest.cpp @@ -159,11 +159,12 @@ QString QQuickWebEngineContextMenuRequest::linkText() const \readonly The URL of the link if the selected web page content is a link. + It is not guaranteed to be a valid URL. */ QUrl QQuickWebEngineContextMenuRequest::linkUrl() const { - return m_data->linkUrl(); + return m_data->unfilteredLinkUrl(); } /*! diff --git a/src/webengine/api/qquickwebenginedownloaditem.cpp b/src/webengine/api/qquickwebenginedownloaditem.cpp index bc40e6771..5afb19531 100644 --- a/src/webengine/api/qquickwebenginedownloaditem.cpp +++ b/src/webengine/api/qquickwebenginedownloaditem.cpp @@ -39,6 +39,8 @@ #include "qquickwebenginedownloaditem_p.h" #include "qquickwebenginedownloaditem_p_p.h" + +#include "browser_context_adapter.h" #include "qquickwebengineprofile_p.h" using QtWebEngineCore::BrowserContextAdapterClient; @@ -103,6 +105,8 @@ QQuickWebEngineDownloadItemPrivate::QQuickWebEngineDownloadItemPrivate(QQuickWeb , interruptReason(QQuickWebEngineDownloadItem::NoReason) , totalBytes(-1) , receivedBytes(0) + , downloadFinished(false) + , downloadPaused(false) { } @@ -145,6 +149,16 @@ void QQuickWebEngineDownloadItemPrivate::update(const BrowserContextAdapterClien totalBytes = info.totalBytes; Q_EMIT q->totalBytesChanged(); } + + if (info.done != downloadFinished) { + downloadFinished = info.done; + Q_EMIT q->isFinishedChanged(); + } + + if (info.paused != downloadPaused) { + downloadPaused = info.paused; + Q_EMIT q->isPausedChanged(); + } } void QQuickWebEngineDownloadItemPrivate::updateState(QQuickWebEngineDownloadItem::DownloadState newState) @@ -199,6 +213,46 @@ void QQuickWebEngineDownloadItem::cancel() } } + +/*! + \qmlmethod void WebEngineDownloadItem::pause() + \since QtWebEngine 1.6 + + Pauses the download. +*/ + +void QQuickWebEngineDownloadItem::pause() +{ + Q_D(QQuickWebEngineDownloadItem); + + QQuickWebEngineDownloadItem::DownloadState state = d->downloadState; + + if (state != QQuickWebEngineDownloadItem::DownloadInProgress) + return; + + if (d->profile) + d->profile->d_ptr->browserContext()->pauseDownload(d->downloadId); +} + +/*! + \qmlmethod void WebEngineDownloadItem::resume() + \since QtWebEngine 1.6 + + Resumes the download if it was paused or interrupted. +*/ +void QQuickWebEngineDownloadItem::resume() +{ + Q_D(QQuickWebEngineDownloadItem); + + QQuickWebEngineDownloadItem::DownloadState state = d->downloadState; + + if (d->downloadFinished || (state != QQuickWebEngineDownloadItem::DownloadInProgress && state != QQuickWebEngineDownloadItem::DownloadInterrupted)) + return; + + if (d->profile) + d->profile->d_ptr->browserContext()->resumeDownload(d->downloadId); +} + /*! \qmlproperty int WebEngineDownloadItem::id @@ -426,6 +480,34 @@ QString QQuickWebEngineDownloadItem::interruptReasonString() const static_cast<BrowserContextAdapterClient::DownloadInterruptReason>(interruptReason())); } +/*! + \qmlproperty bool WebEngineDownloadItem::isFinished + \readonly + \since QtWebEngine 1.6 + + Whether this download is finished (completed, cancelled, or non-resumable interrupted state). + */ + +bool QQuickWebEngineDownloadItem::isFinished() const +{ + Q_D(const QQuickWebEngineDownloadItem); + return d->downloadFinished; +} + +/*! + \qmlproperty bool WebEngineDownloadItem::isPaused + \readonly + \since QtWebEngine 1.6 + + Whether this download is paused. + */ + +bool QQuickWebEngineDownloadItem::isPaused() const +{ + Q_D(const QQuickWebEngineDownloadItem); + return d->downloadPaused; +} + QQuickWebEngineDownloadItem::QQuickWebEngineDownloadItem(QQuickWebEngineDownloadItemPrivate *p, QObject *parent) : QObject(parent) , d_ptr(p) diff --git a/src/webengine/api/qquickwebenginedownloaditem_p.h b/src/webengine/api/qquickwebenginedownloaditem_p.h index 889d0bcb7..972b130aa 100644 --- a/src/webengine/api/qquickwebenginedownloaditem_p.h +++ b/src/webengine/api/qquickwebenginedownloaditem_p.h @@ -131,9 +131,13 @@ public: Q_PROPERTY(DownloadType type READ type NOTIFY typeChanged REVISION 3 FINAL) Q_PROPERTY(DownloadInterruptReason interruptReason READ interruptReason NOTIFY interruptReasonChanged REVISION 4 FINAL) Q_PROPERTY(QString interruptReasonString READ interruptReasonString NOTIFY interruptReasonChanged REVISION 4 FINAL) + Q_PROPERTY(bool isFinished READ isFinished NOTIFY isFinishedChanged REVISION 5 FINAL) + Q_PROPERTY(bool isPaused READ isPaused NOTIFY isPausedChanged REVISION 5 FINAL) Q_INVOKABLE void accept(); Q_INVOKABLE void cancel(); + Q_INVOKABLE void pause(); + Q_INVOKABLE void resume(); quint32 id() const; DownloadState state() const; @@ -147,6 +151,8 @@ public: DownloadType type() const; DownloadInterruptReason interruptReason() const; QString interruptReasonString() const; + bool isFinished() const; + bool isPaused() const; Q_SIGNALS: void stateChanged(); @@ -157,6 +163,8 @@ Q_SIGNALS: void pathChanged(); Q_REVISION(3) void typeChanged(); Q_REVISION(4) void interruptReasonChanged(); + Q_REVISION(5) void isFinishedChanged(); + Q_REVISION(5) void isPausedChanged(); private: QQuickWebEngineDownloadItem(QQuickWebEngineDownloadItemPrivate*, QObject *parent = 0); diff --git a/src/webengine/api/qquickwebenginedownloaditem_p_p.h b/src/webengine/api/qquickwebenginedownloaditem_p_p.h index 4fb609492..6b4f7c8d3 100644 --- a/src/webengine/api/qquickwebenginedownloaditem_p_p.h +++ b/src/webengine/api/qquickwebenginedownloaditem_p_p.h @@ -79,6 +79,8 @@ public: qint64 receivedBytes; QString mimeType; QString downloadPath; + bool downloadFinished; + bool downloadPaused; void update(const QtWebEngineCore::BrowserContextAdapterClient::DownloadItemInfo &info); void updateState(QQuickWebEngineDownloadItem::DownloadState newState); diff --git a/src/webengine/api/qquickwebengineprofile.cpp b/src/webengine/api/qquickwebengineprofile.cpp index 260d8958b..74ff1c8a1 100644 --- a/src/webengine/api/qquickwebengineprofile.cpp +++ b/src/webengine/api/qquickwebengineprofile.cpp @@ -145,7 +145,7 @@ QQuickWebEngineProfilePrivate::QQuickWebEngineProfilePrivate(QSharedPointer<Brow , m_browserContextRef(browserContext) { m_browserContextRef->addClient(this); - m_settings->d_ptr->initDefaults(browserContext->isOffTheRecord()); + m_settings->d_ptr->initDefaults(); // Fullscreen API was implemented before the supported setting, so we must // make it default true to avoid change in default API behavior. m_settings->d_ptr->setAttribute(QtWebEngineCore::WebEngineSettings::FullScreenSupportEnabled, true); diff --git a/src/webengine/api/qquickwebenginesettings.cpp b/src/webengine/api/qquickwebenginesettings.cpp index ff2541376..cdbb25e4c 100644 --- a/src/webengine/api/qquickwebenginesettings.cpp +++ b/src/webengine/api/qquickwebenginesettings.cpp @@ -363,6 +363,16 @@ bool QQuickWebEngineSettings::allowGeolocationOnInsecureOrigins() const } /*! + \qmlproperty bool WebEngineSettings::allowWindowActivationFromJavaScript + \since QtWebEngine 1.6 + Allows the window.focus() method in JavaScript. Disallowed by default. +*/ +bool QQuickWebEngineSettings::allowWindowActivationFromJavaScript() const +{ + return d_ptr->testAttribute(WebEngineSettings::AllowWindowActivationFromJavaScript); +} + +/*! \qmlproperty string WebEngineSettings::defaultTextEncoding \since QtWebEngine 1.2 @@ -564,6 +574,14 @@ void QQuickWebEngineSettings::setAllowGeolocationOnInsecureOrigins(bool on) Q_EMIT allowGeolocationOnInsecureOriginsChanged(); } +void QQuickWebEngineSettings::setAllowWindowActivationFromJavaScript(bool on) +{ + bool wasOn = d_ptr->testAttribute(WebEngineSettings::AllowWindowActivationFromJavaScript); + d_ptr->setAttribute(WebEngineSettings::AllowWindowActivationFromJavaScript, on); + if (wasOn != on) + Q_EMIT allowWindowActivationFromJavaScriptChanged(); +} + void QQuickWebEngineSettings::setParentSettings(QQuickWebEngineSettings *parentSettings) { d_ptr->setParentSettings(parentSettings->d_ptr.data()); diff --git a/src/webengine/api/qquickwebenginesettings_p.h b/src/webengine/api/qquickwebenginesettings_p.h index 10217c678..1b9988bce 100644 --- a/src/webengine/api/qquickwebenginesettings_p.h +++ b/src/webengine/api/qquickwebenginesettings_p.h @@ -86,6 +86,7 @@ class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineSettings : public QObject { Q_PROPERTY(bool printElementBackgrounds READ printElementBackgrounds WRITE setPrintElementBackgrounds NOTIFY printElementBackgroundsChanged REVISION 3 FINAL) Q_PROPERTY(bool allowRunningInsecureContent READ allowRunningInsecureContent WRITE setAllowRunningInsecureContent NOTIFY allowRunningInsecureContentChanged REVISION 3 FINAL) Q_PROPERTY(bool allowGeolocationOnInsecureOrigins READ allowGeolocationOnInsecureOrigins WRITE setAllowGeolocationOnInsecureOrigins NOTIFY allowGeolocationOnInsecureOriginsChanged REVISION 4 FINAL) + Q_PROPERTY(bool allowWindowActivationFromJavaScript READ allowWindowActivationFromJavaScript WRITE setAllowWindowActivationFromJavaScript NOTIFY allowWindowActivationFromJavaScriptChanged REVISION 5 FINAL) public: ~QQuickWebEngineSettings(); @@ -113,6 +114,7 @@ public: bool printElementBackgrounds() const; bool allowRunningInsecureContent() const; bool allowGeolocationOnInsecureOrigins() const; + bool allowWindowActivationFromJavaScript() const; void setAutoLoadImages(bool on); void setJavascriptEnabled(bool on); @@ -137,6 +139,7 @@ public: void setPrintElementBackgrounds(bool on); void setAllowRunningInsecureContent(bool on); void setAllowGeolocationOnInsecureOrigins(bool on); + void setAllowWindowActivationFromJavaScript(bool on); signals: void autoLoadImagesChanged(); @@ -162,6 +165,7 @@ signals: Q_REVISION(3) void printElementBackgroundsChanged(); Q_REVISION(3) void allowRunningInsecureContentChanged(); Q_REVISION(4) void allowGeolocationOnInsecureOriginsChanged(); + Q_REVISION(5) void allowWindowActivationFromJavaScriptChanged(); private: explicit QQuickWebEngineSettings(QQuickWebEngineSettings *parentSettings = 0); diff --git a/src/webengine/api/qquickwebenginetestsupport.cpp b/src/webengine/api/qquickwebenginetestsupport.cpp index 46ffb06f4..41f374766 100644 --- a/src/webengine/api/qquickwebenginetestsupport.cpp +++ b/src/webengine/api/qquickwebenginetestsupport.cpp @@ -49,8 +49,6 @@ QQuickWebEngineErrorPage::QQuickWebEngineErrorPage() void QQuickWebEngineErrorPage::loadFinished(bool success, const QUrl &url) { - // Loading of the error page should not fail. - Q_ASSERT(success); Q_UNUSED(success); QQuickWebEngineLoadRequest loadRequest(url, QQuickWebEngineView::LoadSucceededStatus); @@ -64,8 +62,48 @@ void QQuickWebEngineErrorPage::loadStarted(const QUrl &provisionalUrl) Q_EMIT loadingChanged(&loadRequest); } + +QQuickWebEngineTestInputContext::QQuickWebEngineTestInputContext() + : m_visible(false) +{ +} + +QQuickWebEngineTestInputContext::~QQuickWebEngineTestInputContext() +{ + release(); +} + +void QQuickWebEngineTestInputContext::create() +{ + QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod()); + inputMethodPrivate->testContext = this; +} + +void QQuickWebEngineTestInputContext::release() +{ + QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod()); + inputMethodPrivate->testContext = 0; +} + +void QQuickWebEngineTestInputContext::showInputPanel() +{ + m_visible = true; +} + +void QQuickWebEngineTestInputContext::hideInputPanel() +{ + m_visible = false; +} + +bool QQuickWebEngineTestInputContext::isInputPanelVisible() const +{ + return m_visible; +} + + QQuickWebEngineTestSupport::QQuickWebEngineTestSupport() - : m_errorPage(new QQuickWebEngineErrorPage()) + : m_errorPage(new QQuickWebEngineErrorPage) + , m_testInputContext(new QQuickWebEngineTestInputContext) { } @@ -74,6 +112,11 @@ QQuickWebEngineErrorPage *QQuickWebEngineTestSupport::errorPage() const return m_errorPage.data(); } +QQuickWebEngineTestInputContext *QQuickWebEngineTestSupport::testInputContext() const +{ + return m_testInputContext.data(); +} + QT_END_NAMESPACE #include "moc_qquickwebenginetestsupport_p.cpp" diff --git a/src/webengine/api/qquickwebenginetestsupport_p.h b/src/webengine/api/qquickwebenginetestsupport_p.h index cca8d1df4..a84d00307 100644 --- a/src/webengine/api/qquickwebenginetestsupport_p.h +++ b/src/webengine/api/qquickwebenginetestsupport_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <private/qinputmethod_p.h> #include <private/qtwebengineglobal_p.h> #include <QObject> @@ -73,13 +74,33 @@ Q_SIGNALS: void loadingChanged(QQuickWebEngineLoadRequest *loadRequest); }; +class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineTestInputContext : public QPlatformInputContext { + Q_OBJECT + +public: + QQuickWebEngineTestInputContext(); + ~QQuickWebEngineTestInputContext(); + + Q_INVOKABLE void create(); + Q_INVOKABLE void release(); + + virtual void showInputPanel(); + virtual void hideInputPanel(); + virtual bool isInputPanelVisible() const; + +private: + bool m_visible; +}; + class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineTestSupport : public QObject { Q_OBJECT Q_PROPERTY(QQuickWebEngineErrorPage *errorPage READ errorPage CONSTANT FINAL) + Q_PROPERTY(QQuickWebEngineTestInputContext *testInputContext READ testInputContext CONSTANT FINAL) public: QQuickWebEngineTestSupport(); QQuickWebEngineErrorPage *errorPage() const; + QQuickWebEngineTestInputContext *testInputContext() const; Q_SIGNALS: void windowCloseRejected(); @@ -87,6 +108,7 @@ Q_SIGNALS: private: QScopedPointer<QQuickWebEngineErrorPage> m_errorPage; + QScopedPointer<QQuickWebEngineTestInputContext> m_testInputContext; }; QT_END_NAMESPACE diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index aae0efea8..1fceb4366 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -265,10 +265,12 @@ bool QQuickWebEngineViewPrivate::contextMenuRequested(const WebEngineContextMenu ui()->addMenuItem(item, QQuickWebEngineView::tr("Unselect")); } - if (!data.linkText().isEmpty() && data.linkUrl().isValid()) { + if (!data.linkText().isEmpty() && !data.unfilteredLinkUrl().isEmpty()) { item = new MenuItemHandler(menu); QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::CopyLinkToClipboard); }); ui()->addMenuItem(item, QQuickWebEngineView::tr("Copy Link URL")); + } + if (!data.linkText().isEmpty() && data.linkUrl().isValid()) { item = new MenuItemHandler(menu); QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::DownloadLinkToDisk); }); ui()->addMenuItem(item, QQuickWebEngineView::tr("Save Link")); @@ -564,6 +566,9 @@ void QQuickWebEngineViewPrivate::loadFinished(bool success, const QUrl &url, boo void QQuickWebEngineViewPrivate::focusContainer() { Q_Q(QQuickWebEngineView); + QQuickWindow *window = q->window(); + if (window) + window->requestActivate(); q->forceActiveFocus(); } @@ -865,8 +870,7 @@ QQuickWebEngineView::QQuickWebEngineView(QQuickItem *parent) Q_D(QQuickWebEngineView); d->q_ptr = this; this->setActiveFocusOnTab(true); - this->setFlags(QQuickItem::ItemIsFocusScope | QQuickItem::ItemAcceptsInputMethod - | QQuickItem::ItemAcceptsDrops); + this->setFlags(QQuickItem::ItemIsFocusScope | QQuickItem::ItemAcceptsDrops); #ifndef QT_NO_ACCESSIBILITY QQuickAccessibleAttached *accessible = QQuickAccessibleAttached::qmlAttachedProperties(this); @@ -1604,14 +1608,14 @@ void QQuickWebEngineView::triggerWebAction(WebAction action) } break; case CopyLinkToClipboard: - if (d->m_contextMenuData.linkUrl().isValid()) { - QString urlString = d->m_contextMenuData.linkUrl().toString(QUrl::FullyEncoded); + if (!d->m_contextMenuData.unfilteredLinkUrl().isEmpty()) { + QString urlString = d->m_contextMenuData.unfilteredLinkUrl().toString(QUrl::FullyEncoded); QString title = d->m_contextMenuData.linkText().toHtmlEscaped(); QMimeData *data = new QMimeData(); data->setText(urlString); QString html = QStringLiteral("<a href=\"") + urlString + QStringLiteral("\">") + title + QStringLiteral("</a>"); data->setHtml(html); - data->setUrls(QList<QUrl>() << d->m_contextMenuData.linkUrl()); + data->setUrls(QList<QUrl>() << d->m_contextMenuData.unfilteredLinkUrl()); qApp->clipboard()->setMimeData(data); } break; @@ -1707,6 +1711,42 @@ void QQuickWebEngineView::triggerWebAction(WebAction action) case ViewSource: d->adapter->viewSource(); break; + case ToggleBold: + runJavaScript(QStringLiteral("document.execCommand('bold');"), QQuickWebEngineScript::ApplicationWorld); + break; + case ToggleItalic: + runJavaScript(QStringLiteral("document.execCommand('italic');"), QQuickWebEngineScript::ApplicationWorld); + break; + case ToggleUnderline: + runJavaScript(QStringLiteral("document.execCommand('underline');"), QQuickWebEngineScript::ApplicationWorld); + break; + case ToggleStrikethrough: + runJavaScript(QStringLiteral("document.execCommand('strikethrough');"), QQuickWebEngineScript::ApplicationWorld); + break; + case AlignLeft: + runJavaScript(QStringLiteral("document.execCommand('justifyLeft');"), QQuickWebEngineScript::ApplicationWorld); + break; + case AlignCenter: + runJavaScript(QStringLiteral("document.execCommand('justifyCenter');"), QQuickWebEngineScript::ApplicationWorld); + break; + case AlignRight: + runJavaScript(QStringLiteral("document.execCommand('justifyRight');"), QQuickWebEngineScript::ApplicationWorld); + break; + case AlignJustified: + runJavaScript(QStringLiteral("document.execCommand('justifyFull');"), QQuickWebEngineScript::ApplicationWorld); + break; + case Indent: + runJavaScript(QStringLiteral("document.execCommand('indent');"), QQuickWebEngineScript::ApplicationWorld); + break; + case Outdent: + runJavaScript(QStringLiteral("document.execCommand('outdent');"), QQuickWebEngineScript::ApplicationWorld); + break; + case InsertOrderedList: + runJavaScript(QStringLiteral("document.execCommand('insertOrderedList');"), QQuickWebEngineScript::ApplicationWorld); + break; + case InsertUnorderedList: + runJavaScript(QStringLiteral("document.execCommand('insertUnorderedList');"), QQuickWebEngineScript::ApplicationWorld); + break; default: Q_UNREACHABLE(); } diff --git a/src/webengine/api/qquickwebengineview_p.h b/src/webengine/api/qquickwebengineview_p.h index 8112c7609..32419329a 100644 --- a/src/webengine/api/qquickwebengineview_p.h +++ b/src/webengine/api/qquickwebengineview_p.h @@ -244,6 +244,22 @@ public: Unselect, SavePage, ViewSource, + + ToggleBold, + ToggleItalic, + ToggleUnderline, + ToggleStrikethrough, + + AlignLeft, + AlignCenter, + AlignRight, + AlignJustified, + Indent, + Outdent, + + InsertOrderedList, + InsertUnorderedList, + WebActionCount }; Q_ENUM(WebAction) diff --git a/src/webengine/doc/src/webengineview.qdoc b/src/webengine/doc/src/webengineview.qdoc index 27c3d6920..e452746d9 100644 --- a/src/webengine/doc/src/webengineview.qdoc +++ b/src/webengine/doc/src/webengineview.qdoc @@ -793,6 +793,46 @@ \value WebEngineView.ViewSource Show the source of the current page in a new tab. (Added in Qt 5.8) + \value WebEngineView.ToggleBold + Toggles boldness for the selection or at the cursor position. + Requires \c contenteditable="true". (Added in Qt 5.10) + \value WebEngineView.ToggleItalic + Toggles italics for the selection or at the cursor position. + Requires \c contenteditable="true". (Added in Qt 5.10) + \value WebEngineView.ToggleUnderline + Toggles underlining of the selection or at the cursor position. + Requires \c contenteditable="true". (Added in Qt 5.10) + \value WebEngineView.ToggleStrikethrough + Toggles striking through the selection or at the cursor position. + Requires \c contenteditable="true". (Added in Qt 5.10) + + \value WebEngineView.AlignLeft + Aligns the lines containing the selection or the cursor to the left. + Requires \c contenteditable="true". (Added in Qt 5.10) + \value WebEngineView.AlignCenter + Aligns the lines containing the selection or the cursor at the center. + Requires \c contenteditable="true". (Added in Qt 5.10) + \value WebEngineView.AlignRight + Aligns the lines containing the selection or the cursor to the right. + Requires \c contenteditable="true". (Added in Qt 5.10) + \value WebEngineView.AlignJustified + Stretches the lines containing the selection or the cursor so that each + line has equal width. + Requires \c contenteditable="true". (Added in Qt 5.10) + \value WebEngineView.Indent + Indents the lines containing the selection or the cursor. + Requires \c contenteditable="true". (Added in Qt 5.10) + \value WebEngineView.Outdent + Outdents the lines containing the selection or the cursor. + Requires \c contenteditable="true". (Added in Qt 5.10) + + \value WebEngineView.InsertOrderedList + Inserts an ordered list at the current cursor position, deleting the current selection. + Requires \c contenteditable="true". (Added in Qt 5.10) + \value WebEngineView.InsertUnorderedList + Inserts an unordered list at the current cursor position, + deleting the current selection. + Requires \c contenteditable="true". (Added in Qt 5.10) \omitvalue WebActionCount */ diff --git a/src/webengine/plugin/plugin.cpp b/src/webengine/plugin/plugin.cpp index 3c8991ff7..e58b2ab61 100644 --- a/src/webengine/plugin/plugin.cpp +++ b/src/webengine/plugin/plugin.cpp @@ -102,6 +102,8 @@ public: tr("Cannot create a separate instance of WebEngineDownloadItem")); qmlRegisterUncreatableType<QQuickWebEngineDownloadItem, 4>(uri, 1, 5, "WebEngineDownloadItem", tr("Cannot create a separate instance of WebEngineDownloadItem")); + qmlRegisterUncreatableType<QQuickWebEngineDownloadItem, 5>(uri, 1, 6, "WebEngineDownloadItem", + tr("Cannot create a separate instance of WebEngineDownloadItem")); qmlRegisterUncreatableType<QQuickWebEngineNewViewRequest>(uri, 1, 1, "WebEngineNewViewRequest", msgUncreatableType("WebEngineNewViewRequest")); qmlRegisterUncreatableType<QQuickWebEngineNewViewRequest, 1>(uri, 1, 5, "WebEngineNewViewRequest", tr("Cannot create separate instance of WebEngineNewViewRequest")); qmlRegisterUncreatableType<QQuickWebEngineSettings>(uri, 1, 1, "WebEngineSettings", tr("Cannot create a separate instance of WebEngineSettings")); @@ -109,6 +111,7 @@ public: qmlRegisterUncreatableType<QQuickWebEngineSettings, 2>(uri, 1, 3, "WebEngineSettings", tr("Cannot create a separate instance of WebEngineSettings")); qmlRegisterUncreatableType<QQuickWebEngineSettings, 3>(uri, 1, 4, "WebEngineSettings", tr("Cannot create a separate instance of WebEngineSettings")); qmlRegisterUncreatableType<QQuickWebEngineSettings, 4>(uri, 1, 5, "WebEngineSettings", tr("Cannot create a separate instance of WebEngineSettings")); + qmlRegisterUncreatableType<QQuickWebEngineSettings, 5>(uri, 1, 6, "WebEngineSettings", tr("Cannot create a separate instance of WebEngineSettings")); qmlRegisterSingletonType<QQuickWebEngineSingleton>(uri, 1, 1, "WebEngine", webEngineSingletonProvider); qmlRegisterUncreatableType<QQuickWebEngineHistory>(uri, 1, 1, "NavigationHistory", tr("Cannot create a separate instance of NavigationHistory")); diff --git a/src/webengine/plugin/plugin.pro b/src/webengine/plugin/plugin.pro index 68404b4f8..1f9ef00c5 100644 --- a/src/webengine/plugin/plugin.pro +++ b/src/webengine/plugin/plugin.pro @@ -1,7 +1,7 @@ CXX_MODULE = qml TARGET = qtwebengineplugin TARGETPATH = QtWebEngine -IMPORT_VERSION = 1.5 +IMPORT_VERSION = 1.6 QT += webengine qml quick QT_PRIVATE += webengine-private diff --git a/src/webengine/plugin/plugins.qmltypes b/src/webengine/plugin/plugins.qmltypes index 459d56c75..0cfa2d25b 100644 --- a/src/webengine/plugin/plugins.qmltypes +++ b/src/webengine/plugin/plugins.qmltypes @@ -4,7 +4,7 @@ import QtQuick.tooling 1.2 // It is used for QML tooling purposes only. // // This file was auto-generated by: -// 'qmlplugindump -defaultplatform -dependencies dependencies.json -nonrelocatable QtWebEngine 1.5' +// 'qmlplugindump -defaultplatform -dependencies dependencies.json -nonrelocatable QtWebEngine 1.6' Module { dependencies: ["QtQuick 2.6"] @@ -509,10 +509,11 @@ Module { "QtWebEngine/WebEngineSettings 1.2", "QtWebEngine/WebEngineSettings 1.3", "QtWebEngine/WebEngineSettings 1.4", - "QtWebEngine/WebEngineSettings 1.5" + "QtWebEngine/WebEngineSettings 1.5", + "QtWebEngine/WebEngineSettings 1.6" ] isCreatable: false - exportMetaObjectRevisions: [0, 1, 2, 3, 4] + exportMetaObjectRevisions: [0, 1, 2, 3, 4, 5] Property { name: "autoLoadImages"; type: "bool" } Property { name: "javascriptEnabled"; type: "bool" } Property { name: "javascriptCanOpenWindows"; type: "bool" } @@ -536,6 +537,7 @@ Module { Property { name: "printElementBackgrounds"; revision: 3; type: "bool" } Property { name: "allowRunningInsecureContent"; revision: 3; type: "bool" } Property { name: "allowGeolocationOnInsecureOrigins"; revision: 4; type: "bool" } + Property { name: "allowWindowActivationFromJavaScript"; revision: 5; type: "bool" } Signal { name: "fullScreenSupportEnabledChanged"; revision: 1 } Signal { name: "screenCaptureEnabledChanged"; revision: 2 } Signal { name: "webGLEnabledChanged"; revision: 2 } @@ -546,6 +548,7 @@ Module { Signal { name: "printElementBackgroundsChanged"; revision: 3 } Signal { name: "allowRunningInsecureContentChanged"; revision: 3 } Signal { name: "allowGeolocationOnInsecureOriginsChanged"; revision: 4 } + Signal { name: "allowWindowActivationFromJavaScriptChanged"; revision: 5 } } Component { name: "QQuickWebEngineSingleton" @@ -669,7 +672,19 @@ Module { "Unselect": 29, "SavePage": 30, "ViewSource": 31, - "WebActionCount": 32 + "ToggleBold": 32, + "ToggleItalic": 33, + "ToggleUnderline": 34, + "ToggleStrikethrough": 35, + "AlignLeft": 36, + "AlignCenter": 37, + "AlignRight": 38, + "AlignJustified": 39, + "Indent": 40, + "Outdent": 41, + "InsertOrderedList": 42, + "InsertUnorderedList": 43, + "WebActionCount": 44 } } Enum { diff --git a/src/webengine/plugin/testsupport/plugin.cpp b/src/webengine/plugin/testsupport/plugin.cpp index 9352e3666..c7eda2405 100644 --- a/src/webengine/plugin/testsupport/plugin.cpp +++ b/src/webengine/plugin/testsupport/plugin.cpp @@ -58,6 +58,8 @@ public: qmlRegisterType<QQuickWebEngineTestSupport>(uri, 1, 0, "WebEngineTestSupport"); qmlRegisterUncreatableType<QQuickWebEngineErrorPage>(uri, 1, 0, "WebEngineErrorPage", tr("Cannot create a separate instance of WebEngineErrorPage")); + qmlRegisterUncreatableType<QQuickWebEngineTestInputContext>(uri, 1, 0, "TestInputContext", + tr("Cannot create a separate instance of WebEngineErrorPage")); } }; diff --git a/src/webengine/plugin/testsupport/testsupport.pro b/src/webengine/plugin/testsupport/testsupport.pro index 1a45ad56a..2804635f8 100644 --- a/src/webengine/plugin/testsupport/testsupport.pro +++ b/src/webengine/plugin/testsupport/testsupport.pro @@ -4,7 +4,7 @@ TARGETPATH = QtWebEngine/testsupport IMPORT_VERSION = 1.0 QT += webengine qml quick -QT_PRIVATE += webengine-private +QT_PRIVATE += webengine-private gui-private INCLUDEPATH += $$QTWEBENGINE_ROOT/src/core $$QTWEBENGINE_ROOT/src/webengine $$QTWEBENGINE_ROOT/src/webengine/api diff --git a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp index b6069d519..a0ed00918 100644 --- a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp +++ b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp @@ -228,14 +228,15 @@ void RenderWidgetHostViewQtDelegateQuick::resize(int width, int height) void RenderWidgetHostViewQtDelegateQuick::inputMethodStateChanged(bool editorVisible) { - if (qApp->inputMethod()->isVisible() == editorVisible) - return; + setFlag(QQuickItem::ItemAcceptsInputMethod, editorVisible); + + if (parentItem()) + parentItem()->setFlag(QQuickItem::ItemAcceptsInputMethod, editorVisible); - if (parentItem() && parentItem()->flags() & QQuickItem::ItemAcceptsInputMethod) { + if (qApp->inputMethod()->isVisible() != editorVisible) { qApp->inputMethod()->update(Qt::ImQueryInput | Qt::ImEnabled | Qt::ImHints); qApp->inputMethod()->setVisible(editorVisible); } - } bool RenderWidgetHostViewQtDelegateQuick::event(QEvent *event) diff --git a/src/webengine/webengine.pro b/src/webengine/webengine.pro index 5ac93c9a7..f8df714c0 100644 --- a/src/webengine/webengine.pro +++ b/src/webengine/webengine.pro @@ -77,7 +77,7 @@ use?(pdf) { $$python chromium/tools/licenses.py \ --file-template ../../tools/about_credits.tmpl \ --entry-template ../../tools/about_credits_entry.tmpl credits \ - > $$shell_quote($$shell_path($$OUT_PWD/chromium_attributions.qdoc)) + $$shell_quote($$shell_path($$OUT_PWD/chromium_attributions.qdoc)) chromium_attributions.CONFIG += phony QMAKE_EXTRA_TARGETS += chromium_attributions |