diff options
author | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2014-03-14 18:28:33 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-21 14:39:36 +0100 |
commit | f06cb10ce5a6d543d97bd05484179f56b60e6e5a (patch) | |
tree | e352b7684b03fbb5e729204484178fd087971287 /src/webenginewidgets/api/qwebenginepage.cpp | |
parent | 5613f356635e810dcc1e3849011bec5764095963 (diff) |
Base load signals on Blink loader events
This mainly remove the use of the LoadingStateChanged callback, which
is tied to DidStartLoading and DidStopLoading.
Those signals are handled from the browser process side, also wrapping
the time where the render process is initialized. We can't rely on
those signals for loadStarted, but afterward rely on the Blink loader
for loadFinished. We must use the same source for both.
Instead only rely on Blink callbacks ultimately related to network
events. This gives us a behavior closer to QtWebKit.
The major compromise that this forces us to to accept is that
loadStarted is now triggered asynchronously. This will basically break
anything expecting loadStarted to be emitted synchronously from the
load method.
This also adjust autotests to get a few more passing.
Initial-patch-by: Pierre Rossi <pierre.rossi@digia.com>
Change-Id: Ib6c0170df891d1b7f8ed4dc1d483985523e267dc
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/webenginewidgets/api/qwebenginepage.cpp')
-rw-r--r-- | src/webenginewidgets/api/qwebenginepage.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index 4c4243ccc..a514882d6 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -151,7 +151,6 @@ QWebEnginePagePrivate::QWebEnginePagePrivate() , adapter(new WebContentsAdapter(SoftwareRenderingMode)) , history(new QWebEngineHistory(new QWebEngineHistoryPrivate(adapter.data()))) , view(0) - , m_isLoading(false) { memset(actions, 0, sizeof(actions)); } @@ -191,18 +190,6 @@ void QWebEnginePagePrivate::iconChanged(const QUrl &url) Q_UNUSED(url) } -void QWebEnginePagePrivate::loadingStateChanged() -{ - Q_Q(QWebEnginePage); - const bool wasLoading = m_isLoading; - m_isLoading = adapter->isLoading(); - if (m_isLoading != wasLoading) { - if (m_isLoading) - Q_EMIT q->loadStarted(); - } - updateNavigationActions(); -} - void QWebEnginePagePrivate::loadProgressChanged(int progress) { Q_Q(QWebEnginePage); @@ -228,15 +215,28 @@ qreal QWebEnginePagePrivate::dpiScale() const return 1.0; } +void QWebEnginePagePrivate::loadStarted(const QUrl &provisionalUrl) +{ + Q_UNUSED(provisionalUrl) + Q_Q(QWebEnginePage); + Q_EMIT q->loadStarted(); + updateNavigationActions(); +} + +void QWebEnginePagePrivate::loadCommitted() +{ + updateNavigationActions(); +} + void QWebEnginePagePrivate::loadFinished(bool success, int error_code, const QString &error_description) { Q_Q(QWebEnginePage); Q_UNUSED(error_code); Q_UNUSED(error_description); - m_isLoading = adapter->isLoading(); if (success) m_explicitUrl = QUrl(); Q_EMIT q->loadFinished(success); + updateNavigationActions(); } void QWebEnginePagePrivate::focusContainer() |