diff options
author | Jüri Valdmann <juri.valdmann@qt.io> | 2018-02-26 12:48:03 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-04-06 06:36:24 +0000 |
commit | 3bc5b9d4f9d481707c02e83e0cd20f60dec425f2 (patch) | |
tree | f29ba0036095fcf178133281be582d5fe650814b /src/webenginewidgets/api/qwebenginepage_p.h | |
parent | fbfc9ee7f06c6f36b79145bc7e8ba05c5d3fa621 (diff) |
Avoid creating temporary blank WebContents
- Avoid creating a blank WebContents for new QWebEnginePages only to replace it
with a different blank WebContents moments later. This problem is already
solved in QQuickWebEngineView by lazy initialization, therefore the patch
moves this lazy initialization into WebContentsAdapter itself so that it can
be applied to both QQuickWebEngineView and QWebEnginePage.
- Try to delay WebContents creation until the first navigation so that we have
enough information available to pick the right initial SiteInstance when
calling WebContents::Create. This is done by triggering WebContents creation
from the first call to a WebContentsAdapter::load* method.
- Use the SiteInstance from WebContentsDelegate::OpenURLFromTab. This method
gets a SiteInstance pointer which we should give to WebContents::Create.
Task-number: QTBUG-65561
Task-number: QTBUG-67163
Change-Id: Id7b351998adefb810cf27c61a1447b61d7f4c606
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/webenginewidgets/api/qwebenginepage_p.h')
-rw-r--r-- | src/webenginewidgets/api/qwebenginepage_p.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/webenginewidgets/api/qwebenginepage_p.h b/src/webenginewidgets/api/qwebenginepage_p.h index 81caaf415..fd7928006 100644 --- a/src/webenginewidgets/api/qwebenginepage_p.h +++ b/src/webenginewidgets/api/qwebenginepage_p.h @@ -61,6 +61,7 @@ #include <QtCore/qcompilerdetection.h> #include <QtCore/QPointer> +#include <QtCore/QTimer> namespace QtWebEngineCore { class RenderWidgetHostViewQtDelegate; @@ -87,6 +88,7 @@ public: QtWebEngineCore::RenderWidgetHostViewQtDelegate* CreateRenderWidgetHostViewQtDelegate(QtWebEngineCore::RenderWidgetHostViewQtDelegateClient *client) override; QtWebEngineCore::RenderWidgetHostViewQtDelegate* CreateRenderWidgetHostViewQtDelegateForPopup(QtWebEngineCore::RenderWidgetHostViewQtDelegateClient *client) override { return CreateRenderWidgetHostViewQtDelegate(client); } + void initializationFinished() override; void titleChanged(const QString&) override; void urlChanged(const QUrl&) override; void iconChanged(const QUrl&) override; @@ -158,6 +160,7 @@ public: void recreateFromSerializedHistory(QDataStream &input); void setFullScreenMode(bool); + void ensureInitialized() const; QSharedPointer<QtWebEngineCore::WebContentsAdapter> adapter; QWebEngineHistory *history; @@ -177,6 +180,9 @@ public: bool m_navigationActionTriggered; QPointer<QWebEnginePage> inspectedPage; QPointer<QWebEnginePage> devToolsPage; + bool defaultAudioMuted; + qreal defaultZoomFactor; + QTimer wasShownTimer; mutable QtWebEngineCore::CallbackDirectory m_callbacks; mutable QAction *actions[QWebEnginePage::WebActionCount]; |