diff options
author | Florian Bruhin <git@the-compiler.org> | 2017-10-15 22:30:17 +0200 |
---|---|---|
committer | Florian Bruhin <git@the-compiler.org> | 2017-11-24 16:02:50 +0100 |
commit | 30462b383930cd80bdc5722e8d6044db08a84158 (patch) | |
tree | a0ac681b0b5e251abda16a62ec982bc2e10a3dab | |
parent | 1a7669c8a2df48fff09615ff601c3c9da55d976e (diff) | |
download | qutebrowser-30462b383930cd80bdc5722e8d6044db08a84158.tar.gz qutebrowser-30462b383930cd80bdc5722e8d6044db08a84158.zip |
Fix overflow handling for QtWebKit scrolling
If we do "m * val / 100", the value gets bigger, so we need to check for an
overflow afterwards.
-rw-r--r-- | qutebrowser/browser/webkit/webkittab.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/qutebrowser/browser/webkit/webkittab.py b/qutebrowser/browser/webkit/webkittab.py index 43a38ea61..43bec3456 100644 --- a/qutebrowser/browser/webkit/webkittab.py +++ b/qutebrowser/browser/webkit/webkittab.py @@ -422,12 +422,13 @@ class WebKitScroller(browsertab.AbstractScroller): else: for val, orientation in [(x, Qt.Horizontal), (y, Qt.Vertical)]: if val is not None: - val = qtutils.check_overflow(val, 'int', fatal=False) frame = self._widget.page().mainFrame() - m = frame.scrollBarMaximum(orientation) - if m == 0: + maximum = frame.scrollBarMaximum(orientation) + if maximum == 0: continue - frame.setScrollBarValue(orientation, int(m * val / 100)) + pos = int(maximum * val / 100) + pos = qtutils.check_overflow(pos, 'int', fatal=False) + frame.setScrollBarValue(orientation, pos) def _key_press(self, key, count=1, getter_name=None, direction=None): frame = self._widget.page().mainFrame() |