QtWebEngine: Implement scroll.delta_page
This commit is contained in:
parent
602d10c495
commit
c83a8a64dc
@ -229,7 +229,11 @@ class WebEngineScroller(browsertab.AbstractScroller):
|
||||
self._tab.run_js_async("window.scrollBy({x}, {y});".format(x=x, y=y))
|
||||
|
||||
def delta_page(self, x=0, y=0):
|
||||
log.stub()
|
||||
js_code = """
|
||||
{scroll_js}
|
||||
scroll_delta_page({x}, {y});
|
||||
""".format(scroll_js=utils.read_file('javascript/scroll.js'), x=x, y=y)
|
||||
self._tab.run_js_async(js_code)
|
||||
|
||||
def up(self, count=1):
|
||||
self._key_press(Qt.Key_Up, count)
|
||||
|
@ -32,3 +32,9 @@ function scroll_to_perc(x, y) {
|
||||
|
||||
window.scroll(x_px, y_px);
|
||||
}
|
||||
|
||||
function scroll_delta_page(x, y) {
|
||||
var dx = document.documentElement.clientWidth * x;
|
||||
var dy = document.documentElement.clientHeight * y;
|
||||
window.scrollBy(dx, dy);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user