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.
This commit is contained in:
Florian Bruhin 2016-08-09 13:15:32 +02:00
parent 6b7a39685e
commit 4046615b37

View File

@ -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.