Permalink
Browse files

QtWebEngine: Implement WebEngineScroller.at_bottom

  • Loading branch information...
The-Compiler committed Sep 7, 2016
1 parent cf6cffe commit 919196714b0e4b5ac9dbb0d8d4e4f5f0a7543299
@@ -189,6 +189,7 @@ def __init__(self, tab, parent=None):
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 @@ def update_pos_cb(jsret):
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 @@ def at_top(self):
return self.pos_px().y() == 0
def at_bottom(self):
- log.stub()
+ return self._at_bottom
class WebEngineHistory(browsertab.AbstractHistory):
@@ -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));
@@ -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

0 comments on commit 9191967

Please sign in to comment.