diff options
author | Viktor Engelmann <viktor.engelmann@qt.io> | 2017-08-18 12:56:53 +0200 |
---|---|---|
committer | Viktor Engelmann <viktor.engelmann@qt.io> | 2017-08-22 08:03:32 +0000 |
commit | 25bb229aa707d5652cf4479a8c7008a02574f2e3 (patch) | |
tree | eaf9d1e395783d9f6ea9a92cbf96fb3b95991ed9 /src/core/web_contents_delegate_qt.h | |
parent | 1ec53868363c41a4f08ca2660638da532eb56b10 (diff) |
Emit loadProgress only between loadStarted and loadFinished
We now track the values we send to the loadProgress signal. We store
the last value in a new int WebContentsDelegateQt::m_lastLoadProgress
and only send values that are >= m_lastLoadProgress to ensure
monotonicity.
A value < 0 indicates that no loading is going on. Only on loadStarted
it is set to 0 (and a loadProgress is emitted with progress 0) and
on loadFinished, it is set to -1 (and a loadProgress is emitted with
progress 100).
This way, we ensure that you first get a loadStarted signal, at least
two loadProgress signals (0 and 100) and a loadFinished signal
AND all loadProgress signals come in a monotonous order.
Task-number: QTBUG-57839
Task-number: QTBUG-61815
Change-Id: I219d3bffbd5691adb892a11b79647ba9e1ed248e
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'src/core/web_contents_delegate_qt.h')
-rw-r--r-- | src/core/web_contents_delegate_qt.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h index 84799c2cd..20c70ef21 100644 --- a/src/core/web_contents_delegate_qt.h +++ b/src/core/web_contents_delegate_qt.h @@ -149,6 +149,8 @@ public: private: QWeakPointer<WebContentsAdapter> createWindow(content::WebContents *new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture); + void EmitLoadStarted(const QUrl &url, bool isErrorPage = false); + void EmitLoadFinished(bool success, const QUrl &url, bool isErrorPage = false, int errorCode = 0, const QString &errorDescription = QString()); WebContentsAdapterClient *m_viewClient; QString m_lastSearchedString; @@ -158,6 +160,7 @@ private: SavePageInfo m_savePageInfo; QSharedPointer<FilePickerController> m_filePickerController; QUrl m_initialTargetUrl; + int m_lastLoadProgress; }; } // namespace QtWebEngineCore |