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.
This commit is contained in:
parent
f136f78802
commit
d132b6ed71
@ -137,6 +137,7 @@ Fixed
|
|||||||
fixed.
|
fixed.
|
||||||
- Scrolling to an anchor in a background tab now works correctly, and javascript
|
- Scrolling to an anchor in a background tab now works correctly, and javascript
|
||||||
gets the correct window size for background tabs.
|
gets the correct window size for background tabs.
|
||||||
|
- `:scroll-page` with `--bottom-navigate` now works correctly on QtWebEngine
|
||||||
|
|
||||||
v0.10.1
|
v0.10.1
|
||||||
-------
|
-------
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
"""Wrapper over a QWebEngineView."""
|
"""Wrapper over a QWebEngineView."""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import math
|
||||||
import functools
|
import functools
|
||||||
|
|
||||||
import sip
|
import sip
|
||||||
@ -342,7 +343,7 @@ class WebEngineScroller(browsertab.AbstractScroller):
|
|||||||
else:
|
else:
|
||||||
perc_y = min(100, round(100 / dy * jsret['px']['y']))
|
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._pos_perc = perc_x, perc_y
|
||||||
|
|
||||||
self.perc_changed.emit(*self._pos_perc)
|
self.perc_changed.emit(*self._pos_perc)
|
||||||
|
@ -292,6 +292,13 @@ Feature: Scrolling
|
|||||||
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 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
|
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