diff --git a/qutebrowser/browser/webengine/webenginetab.py b/qutebrowser/browser/webengine/webenginetab.py index 1c2488181..81f5604ad 100644 --- a/qutebrowser/browser/webengine/webenginetab.py +++ b/qutebrowser/browser/webengine/webenginetab.py @@ -258,11 +258,18 @@ class WebEngineScroller(browsertab.AbstractScroller): self._pos_px = QPoint(jsret['px']['x'], jsret['px']['y']) dx = jsret['scroll']['width'] - jsret['inner']['width'] - perc_x = 0 if dx == 0 else round(100 / dx * jsret['px']['x']) - dy = jsret['scroll']['height'] - jsret['inner']['height'] - perc_y = 0 if dy == 0 else round(100 / dy * jsret['px']['y']) + if dx == 0: + perc_x = 0 + else: + perc_x = min(100, round(100 / dx * jsret['px']['x'])) - self._at_bottom = dy == jsret['px']['y'] + dy = jsret['scroll']['height'] - jsret['inner']['height'] + if dy == 0: + perc_y = 0 + else: + perc_y = min(100, round(100 / dy * jsret['px']['y'])) + + self._at_bottom = dy >= jsret['px']['y'] self._pos_perc = perc_x, perc_y self.perc_changed.emit(*self._pos_perc)