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:
parent
6b7a39685e
commit
4046615b37
@ -184,7 +184,7 @@ class WebEngineScroller(browsertab.AbstractScroller):
|
|||||||
|
|
||||||
def __init__(self, tab, parent=None):
|
def __init__(self, tab, parent=None):
|
||||||
super().__init__(tab, parent)
|
super().__init__(tab, parent)
|
||||||
self._pos_perc = (None, None)
|
self._pos_perc = (0, 0)
|
||||||
self._pos_px = QPoint()
|
self._pos_px = QPoint()
|
||||||
|
|
||||||
def _init_widget(self, widget):
|
def _init_widget(self, widget):
|
||||||
@ -194,6 +194,7 @@ class WebEngineScroller(browsertab.AbstractScroller):
|
|||||||
page.scrollPositionChanged.connect(self._update_pos)
|
page.scrollPositionChanged.connect(self._update_pos)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
log.stub('scrollPositionChanged, on Qt < 5.7')
|
log.stub('scrollPositionChanged, on Qt < 5.7')
|
||||||
|
self._pos_perc = (None, None)
|
||||||
|
|
||||||
def _key_press(self, key, count=1):
|
def _key_press(self, key, count=1):
|
||||||
# FIXME:qtwebengine Abort scrolling if the minimum/maximum was reached.
|
# FIXME:qtwebengine Abort scrolling if the minimum/maximum was reached.
|
||||||
|
Loading…
Reference in New Issue
Block a user