QtWebEngine: Implement WebEngineScroller.at_bottom
This commit is contained in:
parent
cf6cffeb08
commit
919196714b
@ -189,6 +189,7 @@ class WebEngineScroller(browsertab.AbstractScroller):
|
|||||||
super().__init__(tab, parent)
|
super().__init__(tab, parent)
|
||||||
self._pos_perc = (0, 0)
|
self._pos_perc = (0, 0)
|
||||||
self._pos_px = QPoint()
|
self._pos_px = QPoint()
|
||||||
|
self._at_bottom = False
|
||||||
|
|
||||||
def _init_widget(self, widget):
|
def _init_widget(self, widget):
|
||||||
super()._init_widget(widget)
|
super()._init_widget(widget)
|
||||||
@ -219,6 +220,7 @@ class WebEngineScroller(browsertab.AbstractScroller):
|
|||||||
assert isinstance(jsret, dict), jsret
|
assert isinstance(jsret, dict), jsret
|
||||||
self._pos_perc = (jsret['perc']['x'], jsret['perc']['y'])
|
self._pos_perc = (jsret['perc']['x'], jsret['perc']['y'])
|
||||||
self._pos_px = QPoint(jsret['px']['x'], jsret['px']['y'])
|
self._pos_px = QPoint(jsret['px']['x'], jsret['px']['y'])
|
||||||
|
self._at_bottom = jsret['at_bottom']
|
||||||
self.perc_changed.emit(*self._pos_perc)
|
self.perc_changed.emit(*self._pos_perc)
|
||||||
|
|
||||||
js_code = javascript.assemble('scroll', 'pos')
|
js_code = javascript.assemble('scroll', 'pos')
|
||||||
@ -273,7 +275,7 @@ class WebEngineScroller(browsertab.AbstractScroller):
|
|||||||
return self.pos_px().y() == 0
|
return self.pos_px().y() == 0
|
||||||
|
|
||||||
def at_bottom(self):
|
def at_bottom(self):
|
||||||
log.stub()
|
return self._at_bottom
|
||||||
|
|
||||||
|
|
||||||
class WebEngineHistory(browsertab.AbstractHistory):
|
class WebEngineHistory(browsertab.AbstractHistory):
|
||||||
|
@ -80,6 +80,7 @@ window._qutebrowser.scroll = (function() {
|
|||||||
var pos = {
|
var pos = {
|
||||||
"perc": {"x": perc_x, "y": perc_y},
|
"perc": {"x": perc_x, "y": perc_y},
|
||||||
"px": {"x": window.scrollX, "y": window.scrollY},
|
"px": {"x": window.scrollX, "y": window.scrollY},
|
||||||
|
"at_bottom": dy === window.scrollY,
|
||||||
};
|
};
|
||||||
|
|
||||||
// console.log(JSON.stringify(pos));
|
// console.log(JSON.stringify(pos));
|
||||||
|
@ -279,13 +279,20 @@ Feature: Scrolling
|
|||||||
And I wait until the scroll position changed to 0/0
|
And I wait until the scroll position changed to 0/0
|
||||||
Then the page should not be scrolled
|
Then the page should not be scrolled
|
||||||
|
|
||||||
@qtwebengine_todo: at_bottom is not implemented yet
|
|
||||||
Scenario: :scroll-page with --bottom-navigate
|
Scenario: :scroll-page with --bottom-navigate
|
||||||
When I run :scroll-perc 100
|
When I run :scroll-perc 100
|
||||||
And I wait until the scroll position changed
|
And I wait until the scroll position changed
|
||||||
And I run :scroll-page --bottom-navigate next 0 1
|
And I run :scroll-page --bottom-navigate next 0 1
|
||||||
Then data/hello2.txt should be loaded
|
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
|
Scenario: :scroll-page with --top-navigate
|
||||||
When I run :scroll-page --top-navigate prev 0 -1
|
When I run :scroll-page --top-navigate prev 0 -1
|
||||||
Then data/hello3.txt should be loaded
|
Then data/hello3.txt should be loaded
|
||||||
|
Loading…
Reference in New Issue
Block a user