From f06cb10ce5a6d543d97bd05484179f56b60e6e5a Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Fri, 14 Mar 2014 18:28:33 +0100 Subject: 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 Change-Id: Ib6c0170df891d1b7f8ed4dc1d483985523e267dc Reviewed-by: Pierre Rossi Reviewed-by: Simon Hausmann --- src/webengine/api/qquickwebengineview.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'src/webengine/api/qquickwebengineview.cpp') diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index 58262cd3f..27282e111 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -72,7 +72,6 @@ QQuickWebEngineViewPrivate::QQuickWebEngineViewPrivate() , contextMenuExtraItems(0) , loadProgress(0) , inspectable(false) - , m_isLoading(false) , m_isFullScreen(false) , devicePixelRatio(QGuiApplication::primaryScreen()->devicePixelRatio()) , m_dpiScale(1.0) @@ -213,17 +212,6 @@ void QQuickWebEngineViewPrivate::iconChanged(const QUrl &url) Q_EMIT q->iconChanged(); } -void QQuickWebEngineViewPrivate::loadingStateChanged() -{ - Q_Q(QQuickWebEngineView); - const bool wasLoading = m_isLoading; - m_isLoading = adapter->isLoading(); - if (m_isLoading && !wasLoading) { - QQuickWebEngineLoadRequest loadRequest(q->url(), QQuickWebEngineView::LoadStartedStatus); - Q_EMIT q->loadingChanged(&loadRequest); - } -} - void QQuickWebEngineViewPrivate::loadProgressChanged(int progress) { Q_Q(QQuickWebEngineView); @@ -242,6 +230,13 @@ qreal QQuickWebEngineViewPrivate::dpiScale() const return m_dpiScale; } +void QQuickWebEngineViewPrivate::loadStarted(const QUrl &provisionalUrl) +{ + Q_Q(QQuickWebEngineView); + QQuickWebEngineLoadRequest loadRequest(provisionalUrl, QQuickWebEngineView::LoadStartedStatus); + Q_EMIT q->loadingChanged(&loadRequest); +} + void QQuickWebEngineViewPrivate::loadFinished(bool success, int error_code, const QString &error_description) { Q_Q(QQuickWebEngineView); -- cgit v1.2.3