From 4046615b3792e1f93de20ef161f3ea8b84aad790 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 9 Aug 2016 13:15:32 +0200 Subject: [PATCH] WebEngineScroller: Set position to (0,0) initially Since we now use QWebEngineScript, we can't easily know when the script finished running and we can access window._qutebrowser.scroll. We instead assume the initial position (if we don't get a scrollPositionChanged) will always be (0, 0), and explicitly set it to (None, None) (displaying ???) if we can't connect that signal. --- qutebrowser/browser/webengine/webenginetab.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qutebrowser/browser/webengine/webenginetab.py b/qutebrowser/browser/webengine/webenginetab.py index 08bfaa6f2..8d44de59d 100644 --- a/qutebrowser/browser/webengine/webenginetab.py +++ b/qutebrowser/browser/webengine/webenginetab.py @@ -184,7 +184,7 @@ class WebEngineScroller(browsertab.AbstractScroller): def __init__(self, tab, parent=None): super().__init__(tab, parent) - self._pos_perc = (None, None) + self._pos_perc = (0, 0) self._pos_px = QPoint() def _init_widget(self, widget): @@ -194,6 +194,7 @@ class WebEngineScroller(browsertab.AbstractScroller): page.scrollPositionChanged.connect(self._update_pos) except AttributeError: log.stub('scrollPositionChanged, on Qt < 5.7') + self._pos_perc = (None, None) def _key_press(self, key, count=1): # FIXME:qtwebengine Abort scrolling if the minimum/maximum was reached.