diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-04-25 11:47:47 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-04-25 12:40:00 +0200 |
commit | 658a964cf2593e6da3b1a822124e796bbe354d36 (patch) | |
tree | 8c35a964023069a974f1c54cd679490593e485f2 /src/webengine | |
parent | 63cf26268996ae5580c77095a252696fa549b593 (diff) | |
parent | a3318c84b022282a5a4a2babc51d1e3ca634e25b (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
Change-Id: I329397621f19ba3890be5daf44a6bb2d668ad2d8
Diffstat (limited to 'src/webengine')
-rw-r--r-- | src/webengine/api/qquickwebenginehistory.cpp | 11 | ||||
-rw-r--r-- | src/webengine/api/qquickwebengineprofile.cpp | 7 | ||||
-rw-r--r-- | src/webengine/api/qquickwebengineprofile_p.h | 7 | ||||
-rw-r--r-- | src/webengine/api/qquickwebengineview.cpp | 17 | ||||
-rw-r--r-- | src/webengine/api/qquickwebengineview_p_p.h | 3 |
5 files changed, 28 insertions, 17 deletions
diff --git a/src/webengine/api/qquickwebenginehistory.cpp b/src/webengine/api/qquickwebenginehistory.cpp index 96a4415e0..8c7662028 100644 --- a/src/webengine/api/qquickwebenginehistory.cpp +++ b/src/webengine/api/qquickwebenginehistory.cpp @@ -223,7 +223,7 @@ QQuickWebEngineHistoryPrivate::~QQuickWebEngineHistoryPrivate() The WebEngineHistory type can be accessed by using the \l{WebEngineView::navigationHistory}{WebEngineView.navigationHistory} property. - The WebEngineHistory type providess the following WebEngineHistoryListModel data model objects: + The WebEngineHistory type provides the following WebEngineHistoryListModel data model objects: \list \li \c backItems, which contains the URLs of visited pages. @@ -283,9 +283,8 @@ QQuickWebEngineHistory::~QQuickWebEngineHistory() } /*! - \qmlproperty QQuickWebEngineHistoryListModel WebEngineHistory::items + \qmlproperty WebEngineHistoryListModel WebEngineHistory::items \readonly - \since QtWebEngine 1.1 URLs of back items, forward items, and the current item in the history. */ @@ -298,9 +297,8 @@ QQuickWebEngineHistoryListModel *QQuickWebEngineHistory::items() const } /*! - \qmlproperty QQuickWebEngineHistoryListModel WebEngineHistory::backItems + \qmlproperty WebEngineHistoryListModel WebEngineHistory::backItems \readonly - \since QtWebEngine 1.1 URLs of visited pages. */ @@ -313,9 +311,8 @@ QQuickWebEngineHistoryListModel *QQuickWebEngineHistory::backItems() const } /*! - \qmlproperty QQuickWebEngineHistoryListModel WebEngineHistory::forwardItems + \qmlproperty WebEngineHistoryListModel WebEngineHistory::forwardItems \readonly - \since QtWebEngine 1.1 URLs of the pages that were visited after visiting the current page. */ diff --git a/src/webengine/api/qquickwebengineprofile.cpp b/src/webengine/api/qquickwebengineprofile.cpp index f38422966..d7a84c106 100644 --- a/src/webengine/api/qquickwebengineprofile.cpp +++ b/src/webengine/api/qquickwebengineprofile.cpp @@ -134,7 +134,7 @@ ASSERT_ENUMS_MATCH(QQuickWebEngineDownloadItem::MimeHtmlSaveFormat, QtWebEngineC The \a download argument holds the state of the finished download instance. */ -QQuickWebEngineProfilePrivate::QQuickWebEngineProfilePrivate(BrowserContextAdapter* browserContext) +QQuickWebEngineProfilePrivate::QQuickWebEngineProfilePrivate(QSharedPointer<BrowserContextAdapter> browserContext) : m_settings(new QQuickWebEngineSettings()) , m_browserContextRef(browserContext) { @@ -261,7 +261,7 @@ void QQuickWebEngineProfilePrivate::downloadUpdated(const DownloadItemInfo &info */ QQuickWebEngineProfile::QQuickWebEngineProfile(QObject *parent) : QObject(parent), - d_ptr(new QQuickWebEngineProfilePrivate(new BrowserContextAdapter(false))) + d_ptr(new QQuickWebEngineProfilePrivate(QSharedPointer<BrowserContextAdapter>::create(false))) { // Sets up the global WebEngineContext QQuickWebEngineProfile::defaultProfile(); @@ -822,8 +822,7 @@ void QQuickWebEngineProfile::removeUrlScheme(const QByteArray &scheme) void QQuickWebEngineProfile::removeAllUrlSchemeHandlers() { Q_D(QQuickWebEngineProfile); - d->browserContext()->customUrlSchemeHandlers().clear(); - d->browserContext()->updateCustomUrlSchemeHandlers(); + d->browserContext()->clearCustomUrlSchemeHandlers(); } void QQuickWebEngineProfile::destroyedUrlSchemeHandler(QWebEngineUrlSchemeHandler *obj) diff --git a/src/webengine/api/qquickwebengineprofile_p.h b/src/webengine/api/qquickwebengineprofile_p.h index f9bb08500..1ba1eb53f 100644 --- a/src/webengine/api/qquickwebengineprofile_p.h +++ b/src/webengine/api/qquickwebengineprofile_p.h @@ -58,6 +58,7 @@ #include <QExplicitlySharedDataPointer> #include <QMap> #include <QPointer> +#include <QSharedPointer> QT_BEGIN_NAMESPACE @@ -67,10 +68,10 @@ class QQuickWebEngineSettings; class QQuickWebEngineProfilePrivate : public QtWebEngineCore::BrowserContextAdapterClient { public: Q_DECLARE_PUBLIC(QQuickWebEngineProfile) - QQuickWebEngineProfilePrivate(QtWebEngineCore::BrowserContextAdapter* browserContext); + QQuickWebEngineProfilePrivate(QSharedPointer<QtWebEngineCore::BrowserContextAdapter> browserContext); ~QQuickWebEngineProfilePrivate(); - QtWebEngineCore::BrowserContextAdapter *browserContext() const { return m_browserContextRef.data(); } + QSharedPointer<QtWebEngineCore::BrowserContextAdapter> browserContext() const { return m_browserContextRef; } QQuickWebEngineSettings *settings() const { return m_settings.data(); } void cancelDownload(quint32 downloadId); @@ -83,7 +84,7 @@ private: friend class QQuickWebEngineViewPrivate; QQuickWebEngineProfile *q_ptr; QScopedPointer<QQuickWebEngineSettings> m_settings; - QExplicitlySharedDataPointer<QtWebEngineCore::BrowserContextAdapter> m_browserContextRef; + QSharedPointer<QtWebEngineCore::BrowserContextAdapter> m_browserContextRef; QMap<quint32, QPointer<QQuickWebEngineDownloadItem> > m_ongoingDownloads; }; diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index 122ae2350..0f50328e6 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -123,6 +123,7 @@ QQuickWebEngineViewPrivate::QQuickWebEngineViewPrivate() , m_webChannelWorld(0) , m_dpiScale(1.0) , m_backgroundColor(Qt::white) + , m_defaultZoomFactor(1.0) { // The gold standard for mobile web content is 160 dpi, and the devicePixelRatio expected // is the (possibly quantized) ratio of device dpi to 160 dpi. @@ -652,7 +653,7 @@ QObject *QQuickWebEngineViewPrivate::accessibilityParentObject() } #endif // QT_NO_ACCESSIBILITY -BrowserContextAdapter *QQuickWebEngineViewPrivate::browserContextAdapter() +QSharedPointer<BrowserContextAdapter> QQuickWebEngineViewPrivate::browserContextAdapter() { return m_profile->d_ptr->browserContext(); } @@ -771,6 +772,10 @@ void QQuickWebEngineViewPrivate::adoptWebContents(WebContentsAdapter *webContent Q_FOREACH (QQuickWebEngineScript *script, m_userScripts) script->d_func()->bind(browserContextAdapter()->userResourceController(), adapter.data()); + // set the zoomFactor if it had been changed on the old adapter. + if (!qFuzzyCompare(adapter->currentZoomFactor(), m_defaultZoomFactor)) + q->setZoomFactor(m_defaultZoomFactor); + // Emit signals for values that might be different from the previous WebContentsAdapter. emit q->titleChanged(); emit q->urlChanged(); @@ -807,6 +812,7 @@ QQuickWebEngineView::~QQuickWebEngineView() void QQuickWebEngineViewPrivate::ensureContentsAdapter() { + Q_Q(QQuickWebEngineView); if (!adapter) { adapter = new WebContentsAdapter(); adapter->initialize(this); @@ -819,6 +825,10 @@ void QQuickWebEngineViewPrivate::ensureContentsAdapter() // push down the page's user scripts Q_FOREACH (QQuickWebEngineScript *script, m_userScripts) script->d_func()->bind(browserContextAdapter()->userResourceController(), adapter.data()); + // set the zoomFactor if it had been changed on the old adapter. + if (!qFuzzyCompare(adapter->currentZoomFactor(), m_defaultZoomFactor)) + q->setZoomFactor(m_defaultZoomFactor); + } } @@ -910,8 +920,11 @@ void QQuickWebEngineView::stop() void QQuickWebEngineView::setZoomFactor(qreal arg) { Q_D(QQuickWebEngineView); + d->m_defaultZoomFactor = arg; + if (!d->adapter) return; + qreal oldFactor = d->adapter->currentZoomFactor(); d->adapter->setZoomFactor(arg); if (qFuzzyCompare(oldFactor, d->adapter->currentZoomFactor())) @@ -1139,7 +1152,7 @@ qreal QQuickWebEngineView::zoomFactor() const { Q_D(const QQuickWebEngineView); if (!d->adapter) - return 1.0; + return d->m_defaultZoomFactor; return d->adapter->currentZoomFactor(); } diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h index 892e99cb9..82a9e9612 100644 --- a/src/webengine/api/qquickwebengineview_p_p.h +++ b/src/webengine/api/qquickwebengineview_p_p.h @@ -188,7 +188,7 @@ public: void startDragging(const content::DropData &dropData, Qt::DropActions allowedActions, const QPixmap &pixmap, const QPoint &offset) Q_DECL_OVERRIDE; - virtual QtWebEngineCore::BrowserContextAdapter *browserContextAdapter() Q_DECL_OVERRIDE; + virtual QSharedPointer<QtWebEngineCore::BrowserContextAdapter> browserContextAdapter() Q_DECL_OVERRIDE; QtWebEngineCore::WebContentsAdapter *webContentsAdapter() Q_DECL_OVERRIDE; void setDevicePixelRatio(qreal); @@ -232,6 +232,7 @@ private: QList<QQuickWebEngineScript *> m_userScripts; qreal m_dpiScale; QColor m_backgroundColor; + qreal m_defaultZoomFactor; }; #ifndef QT_NO_ACCESSIBILITY |