summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <git@the-compiler.org>2017-06-29 22:39:48 +0200
committerFlorian Bruhin <git@the-compiler.org>2017-06-29 22:39:48 +0200
commitd132b6ed71efa0f985b74ac51a2a91b66fc1f50e (patch)
treef97d4e5a44be84eee2df5d1dd1e96299d6641ee0
parentf136f78802db09a7de516f600f61699adb9c8b73 (diff)
downloadqutebrowser-d132b6ed71efa0f985b74ac51a2a91b66fc1f50e.tar.gz
qutebrowser-d132b6ed71efa0f985b74ac51a2a91b66fc1f50e.zip
Fix :scroll-page with --bottom-navigate on QtWebEngine
There were two issues here: - The comparison was backwards, causing scroller.at_bottom() to always return true. - When zoomed in, jsret['px']['y'] can be a float, which means we can be slightly off when checking the difference - math.ceil() fixes that.
-rw-r--r--CHANGELOG.asciidoc1
-rw-r--r--qutebrowser/browser/webengine/webenginetab.py3
-rw-r--r--tests/end2end/features/scroll.feature7
3 files changed, 10 insertions, 1 deletions
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 353bd3d00..598207bfb 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -137,6 +137,7 @@ Fixed
fixed.
- Scrolling to an anchor in a background tab now works correctly, and javascript
gets the correct window size for background tabs.
+- `:scroll-page` with `--bottom-navigate` now works correctly on QtWebEngine
v0.10.1
-------
diff --git a/qutebrowser/browser/webengine/webenginetab.py b/qutebrowser/browser/webengine/webenginetab.py
index 8acd0eda0..0a4c2dfc7 100644
--- a/qutebrowser/browser/webengine/webenginetab.py
+++ b/qutebrowser/browser/webengine/webenginetab.py
@@ -20,6 +20,7 @@
"""Wrapper over a QWebEngineView."""
import os
+import math
import functools
import sip
@@ -342,7 +343,7 @@ class WebEngineScroller(browsertab.AbstractScroller):
else:
perc_y = min(100, round(100 / dy * jsret['px']['y']))
- self._at_bottom = dy >= jsret['px']['y']
+ self._at_bottom = math.ceil(jsret['px']['y']) >= dy
self._pos_perc = perc_x, perc_y
self.perc_changed.emit(*self._pos_perc)
diff --git a/tests/end2end/features/scroll.feature b/tests/end2end/features/scroll.feature
index a69b6ffae..28658e1e6 100644
--- a/tests/end2end/features/scroll.feature
+++ b/tests/end2end/features/scroll.feature
@@ -292,6 +292,13 @@ Feature: Scrolling
And I run :scroll-page --bottom-navigate next 0 1
Then data/hello2.txt should be loaded
+ Scenario: :scroll-page with --bottom-navigate when not at the bottom
+ When I run :scroll-px 0 10
+ And I wait until the scroll position changed
+ And I run :scroll-page --bottom-navigate next 0 1
+ Then the following tabs should be open:
+ - data/scroll/simple.html
+
Scenario: :scroll-page with --top-navigate
When I run :scroll-page --top-navigate prev 0 -1
Then data/hello3.txt should be loaded