Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webengine backend with smooth scrolling enabled is jittery while scrolling #2233

Closed
pkillnine opened this issue Jan 12, 2017 · 21 comments
Closed
Labels
bug: behavior Something doesn't work as intended, but doesn't crash. component: QtWebEngine Issues related to the QtWebEngine backend, based on Chromium. priority: 1 - middle Issues which should be done at some point, but aren't that important.

Comments

@pkillnine
Copy link

pkillnine commented Jan 12, 2017

I posted this issue on the Qt bug tracker.

qutebrowser v0.9.0
Git commit: v0.8.0-2066-g282180e76 (2017-01-08 00:21:57 +0000)
Backend: Webengine

To replicate:

  • Open Qutebrowser with --backend webengine

  • Enable smooth scrolling (:set ui smooth-scrolling true)

  • Scrolling this example webpage will be very jittery and not smooth at all.

  • However, if that webpage is within a html frame, then scrolling the page is very smooth.

@pkillnine
Copy link
Author

pkillnine commented Jan 14, 2017

Hmm, I find on qute://help/settings.html that the jittering stops if I :set tabs show never. Other websites, like store.steampowered.com are also smoother when scrolling, but still jittery.

The example webpage is still jittery when scrolling however.

Update: Hiding the statusbar too completely eliminates all scroll-jittering on all webpages for me.

@The-Compiler
Copy link
Member

You mentioned seeing the same in QupZilla, so closing this as a QtWebEngine issue.

@wezzynl
Copy link

wezzynl commented Mar 4, 2017

I know that this issue is closed but I just noticed that when I do :set tabs show never and directly after that :set tabs show always the jitteryness is gone and stays gone. The jitteryness is very apparent as I have a very high key repeat rate. After the "trick", all is well. P.s. running latest git version and on MacOS Sierra 10.12.3.

@wezzynl
Copy link

wezzynl commented Mar 4, 2017

Actually. That tab show never/always was just a coincidence. I can reliably get the scrolling to be non-jerky responsive by doing this:

  1. Go to a website that has loads of content so you can scroll
  2. Use j/k to move down/up
  3. Observe it being really jerky and laggy
  4. Hit gg to jump to the top of the page
  5. Use j/k to move down/up
  6. Observe smooth, non-laggy and responsive scrolling

@The-Compiler
Copy link
Member

@wezzynl Can you please also check how things look in QupZilla for you? They also have a .dmg for OS X available.

@wezzynl
Copy link

wezzynl commented Mar 4, 2017

Sure. Just tried, QupZilla seems to work fine when using the arrow keys. Though I have to also mention that Qutebrowser also works fine when I use the arrow keys, it is only laggy and jerky when using j/k.

Also: After gg the lagging stays gone for new tabs etc. It only returns when I exit and restart Qutebrowser.

@The-Compiler
Copy link
Member

That's weird... All hjkl does is faking arrow keys.

@The-Compiler The-Compiler reopened this Mar 4, 2017
@The-Compiler The-Compiler changed the title Webengine backend with smooth scrolling enabled is jittery while scrolling, except for scrolling a page in a html frame Webengine backend with smooth scrolling enabled is jittery while scrolling Mar 4, 2017
@The-Compiler The-Compiler added priority: 2 - low Issues which are currently not very important. component: QtWebEngine Issues related to the QtWebEngine backend, based on Chromium. labels Mar 4, 2017
@dset0x
Copy link

dset0x commented Mar 14, 2017

I can observe this too. No difference between arrow keys / j/k / mouse scrolling from what I can tell.

Intel HD Graphics 4600
xf86-video-intel c28e62f94f15c9f5c4fb0744588f08ae18e4a9b5 [with dri,sna,uxa]
X Server 1.18.4 [with glamor]

Ping @pkill-nine

Edit: I wouldn't call the framed version butter smooth, but definitely smoother.

@pkillnine
Copy link
Author

pkillnine commented Mar 14, 2017

Interesting, for me a page spawned from right-clicking a page and clicking "View Page Source" is completely smooth. If I run :view-source it's not smooth.

@The-Compiler
Copy link
Member

@pkill-nine Those are two different source views (Chromium's vs. qutebrowser's one generated with pygments)

@The-Compiler
Copy link
Member

As tests here seem to be inconclusive and this happens outside of qutebrowser as well, I'm closing this.

@braham-snyder
Copy link

With either tabs or the status bar visible (or both), I'm getting jumpy scrolling despite smooth-scrolling on Mac OS X (El Capitan) and Windows (10) using qutebrowser v0.11.0.

On both platforms, with both the tabs and status bar invisible, scrolling is buttery-smooth. On OS X, QupZilla scrolls smoothly for me (though it has that slow-scrolling Qt bug fixed in 5.9; didn't test QupZilla on Windows, but I could if it helps anyone).

@The-Compiler
Copy link
Member

#2822 might help - if not, I doubt there's anything qutebrowser can do.

@The-Compiler The-Compiler added bug: behavior Something doesn't work as intended, but doesn't crash. priority: 1 - middle Issues which should be done at some point, but aren't that important. and removed priority: 2 - low Issues which are currently not very important. labels Oct 5, 2017
@The-Compiler
Copy link
Member

Turns out this happens due to QtWebEngine emitting a scrollPositionChanged multiple times per scroll with smooth scrolling, which causes all UI things potentially having a scroll position to be redrawn, taking a handful of milliseconds (multiple times).

This should probably help already, but I'd like someone with those problems to test it:

diff --git a/qutebrowser/browser/webengine/webenginetab.py b/qutebrowser/browser/webengine/webenginetab.py
index 4de4bf26f..09df38e82 100644
--- a/qutebrowser/browser/webengine/webenginetab.py
+++ b/qutebrowser/browser/webengine/webenginetab.py
@@ -333,9 +333,10 @@ class WebEngineScroller(browsertab.AbstractScroller):
                 perc_y = min(100, round(100 / 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)
+            if self._pos_perc != (perc_x, perc_y):
+                self._pos_perc = perc_x, perc_y
+                self.perc_changed.emit(*self._pos_perc)
 
         js_code = javascript.assemble('scroll', 'pos')
         self._tab.run_js_async(js_code, update_pos_cb)

Maybe some more optimizations are needed though.

@The-Compiler The-Compiler reopened this Oct 5, 2017
The-Compiler added a commit that referenced this issue Oct 6, 2017
QtWebEngine emits scrollPositionChanged a lot during smooth scrolling, and
there's no reason we need to update percentages when they didn't *actually*
change.

This reduces the updates with a single spacebar press from 6-7 to 2-3 on my
machine, which might not be enough though.

See #2233
The-Compiler added a commit that referenced this issue Oct 6, 2017
QtWebEngine emits scrollPositionChanged a lot during smooth scrolling, and
there's no reason we need to update percentages when they didn't *actually*
change.

This reduces the updates with a single spacebar press from 6-7 to 2-3 on my
machine, which might not be enough though.

See #2233

(cherry picked from commit 1d50c2c)
@The-Compiler
Copy link
Member

I pushed that now - I'd still be glad if someone could check the difference between tabs.show being always/never with that.

@The-Compiler
Copy link
Member

I've had to revert this as it breaks various tests relying on it. I'll need to take a closer look first.

@braham-snyder
Copy link

FWIW, with that patch I am indeed seeing significantly smoother smooth scrolling when the tabs and/or the status bar are visible. It's not quite as smooth as it is without the UI bars visible, but it's definitely better than before.

The-Compiler added a commit that referenced this issue Oct 20, 2017
This way, if {scroll_pos} is not in the window/tab title template,
we don't redraw anything unnecessarily.

See #2233
The-Compiler added a commit that referenced this issue Oct 20, 2017
@The-Compiler
Copy link
Member

I've now pushed various improvements (hopefully) for this to the latest master. Can someone check how things are now?

@ghost
Copy link

ghost commented Oct 21, 2017

I'm using qutebrowser-git from the AUR and it appears to be much better, but still not as great as something like VimFX or Vimium. Here's a 60fps video of qutebrowser on the left, and Firefox 57+Vimium on the right (though in hindsight I think it would have been more meaningful to use chromium instead). I should note that these are all scrolled with j/k, not the mouse. The mouse exhibits similar symptoms

scroll.mp4.zip

@braham-snyder
Copy link

On OS X El Capitan I see similar results on that same bootstrap site. On sites like Wikipedia, however (video attached, with comparisons to Firefox and Chrome), qutebrowser seems to scroll more smoothly (well, at least usually -- e.g., the final scroll in my attached video is a bit choppy).

qb_scroll_wikipedia.mov.zip

@The-Compiler
Copy link
Member

https://codereview.qt-project.org/#/c/209352/ might also help here - I don't think there's much more qutebrowser can do, so I'm closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: behavior Something doesn't work as intended, but doesn't crash. component: QtWebEngine Issues related to the QtWebEngine backend, based on Chromium. priority: 1 - middle Issues which should be done at some point, but aren't that important.
Projects
None yet
Development

No branches or pull requests

5 participants