diff --git a/qutebrowser/browser/webengine/webenginetab.py b/qutebrowser/browser/webengine/webenginetab.py index 5e48b7cf5..0abf327bf 100644 --- a/qutebrowser/browser/webengine/webenginetab.py +++ b/qutebrowser/browser/webengine/webenginetab.py @@ -189,6 +189,7 @@ class WebEngineScroller(browsertab.AbstractScroller): super().__init__(tab, parent) self._pos_perc = (0, 0) self._pos_px = QPoint() + self._at_bottom = False def _init_widget(self, widget): super()._init_widget(widget) @@ -219,6 +220,7 @@ class WebEngineScroller(browsertab.AbstractScroller): assert isinstance(jsret, dict), jsret self._pos_perc = (jsret['perc']['x'], jsret['perc']['y']) self._pos_px = QPoint(jsret['px']['x'], jsret['px']['y']) + self._at_bottom = jsret['at_bottom'] self.perc_changed.emit(*self._pos_perc) js_code = javascript.assemble('scroll', 'pos') @@ -273,7 +275,7 @@ class WebEngineScroller(browsertab.AbstractScroller): return self.pos_px().y() == 0 def at_bottom(self): - log.stub() + return self._at_bottom class WebEngineHistory(browsertab.AbstractHistory): diff --git a/qutebrowser/javascript/scroll.js b/qutebrowser/javascript/scroll.js index 67ec2b8fd..69e8adf9c 100644 --- a/qutebrowser/javascript/scroll.js +++ b/qutebrowser/javascript/scroll.js @@ -80,6 +80,7 @@ window._qutebrowser.scroll = (function() { var pos = { "perc": {"x": perc_x, "y": perc_y}, "px": {"x": window.scrollX, "y": window.scrollY}, + "at_bottom": dy === window.scrollY, }; // console.log(JSON.stringify(pos)); diff --git a/tests/end2end/features/scroll.feature b/tests/end2end/features/scroll.feature index 49ad4d9ee..db48613b5 100644 --- a/tests/end2end/features/scroll.feature +++ b/tests/end2end/features/scroll.feature @@ -279,13 +279,20 @@ Feature: Scrolling And I wait until the scroll position changed to 0/0 Then the page should not be scrolled - @qtwebengine_todo: at_bottom is not implemented yet Scenario: :scroll-page with --bottom-navigate When I run :scroll-perc 100 And I wait until the scroll position changed And I run :scroll-page --bottom-navigate next 0 1 Then data/hello2.txt should be loaded + Scenario: :scroll-page with --bottom-navigate and zoom + When I run :zoom 200 + And I wait until the scroll position changed + And I run :scroll-perc 100 + And I wait until the scroll position changed + And I run :scroll-page --bottom-navigate next 0 1 + Then data/hello2.txt should be loaded + Scenario: :scroll-page with --top-navigate When I run :scroll-page --top-navigate prev 0 -1 Then data/hello3.txt should be loaded