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/webengine/api | |
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/webengine/api')
-rw-r--r-- | src/webengine/api/qquickwebengineview.cpp | 19 | ||||
-rw-r--r-- | src/webengine/api/qquickwebengineview_p_p.h | 4 |
2 files changed, 9 insertions, 14 deletions
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); diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h index 8b489138c..564287114 100644 --- a/src/webengine/api/qquickwebengineview_p_p.h +++ b/src/webengine/api/qquickwebengineview_p_p.h @@ -131,11 +131,12 @@ public: virtual void titleChanged(const QString&) Q_DECL_OVERRIDE; virtual void urlChanged(const QUrl&) Q_DECL_OVERRIDE; virtual void iconChanged(const QUrl&) Q_DECL_OVERRIDE; - virtual void loadingStateChanged() Q_DECL_OVERRIDE; virtual void loadProgressChanged(int progress) Q_DECL_OVERRIDE; virtual void selectionChanged() Q_DECL_OVERRIDE { } virtual QRectF viewportRect() const Q_DECL_OVERRIDE; virtual qreal dpiScale() const Q_DECL_OVERRIDE; + virtual void loadStarted(const QUrl &provisionalUrl) Q_DECL_OVERRIDE; + virtual void loadCommitted() Q_DECL_OVERRIDE { } virtual void loadFinished(bool success, int error_code = 0, const QString &error_description = QString()) Q_DECL_OVERRIDE; virtual void focusContainer() Q_DECL_OVERRIDE; virtual void adoptNewWindow(WebContentsAdapter *newWebContents, WindowOpenDisposition disposition, const QRect &) Q_DECL_OVERRIDE; @@ -164,7 +165,6 @@ public: QUrl icon; int loadProgress; bool inspectable; - bool m_isLoading; bool m_isFullScreen; qreal devicePixelRatio; QMap<quint64, QJSValue> m_callbacks; |