RESOLVED FIXED 188239
Using the keyboard arrow keys to scroll a webpage is very slow, not smooth, takes too long
https://bugs.webkit.org/show_bug.cgi?id=188239
Summary Using the keyboard arrow keys to scroll a webpage is very slow, not smooth, t...
Tim Horton
Reported 2018-08-01 14:44:01 PDT
Using the keyboard arrow keys to scroll a webpage is very slow, not smooth, takes too long
Attachments
Patch (32.75 KB, patch)
2018-08-01 14:44 PDT, Tim Horton
no flags
Patch (32.75 KB, patch)
2018-08-01 14:59 PDT, Tim Horton
no flags
Patch (32.15 KB, patch)
2018-08-01 16:24 PDT, Tim Horton
no flags
Patch (33.60 KB, patch)
2018-08-01 16:47 PDT, Tim Horton
no flags
Tim Horton
Comment 1 2018-08-01 14:44:56 PDT
Tim Horton
Comment 2 2018-08-01 14:45:43 PDT
Tim Horton
Comment 3 2018-08-01 14:59:02 PDT
Simon Fraser (smfr)
Comment 4 2018-08-01 15:34:24 PDT
Comment on attachment 346304 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=346304&action=review > Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:3647 > + if ([_keyboardScrollingAnimator handleKeyEvent:theEvent]) > + return; If a page does preventDefault on arrow key events, should it be able to override keyboard scrolling? > Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:3753 > + return false; NO > Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:3756 > + return false; NO > Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:3758 > + return true; YES > Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm:114 > + if ([charactersIgnoringModifiers isEqualToString:UIKeyInputUpArrow]) Blank line above please. This code is pretty hard to read. Would be nice to be able to just have one call to computeOffset(). > Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm:136 > + Remove blank line. > Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm:141 > + _scrollOffsetPerIncrement = *offset; or offset.value(); that doesn't make me go looking for pointers. > Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm:174 > + _displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(displayLinkFired:)]; OK to not retain this? > Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm:187 > + const CFTimeInterval secondsPerScrollIncrement = 0.05; // Seconds it should take to cover one increment when at full speed. Odd that this isn't some multiple of 16.667ms? > Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm:188 > + const float maximumVelocity = 2000; // Maximum velocity in pixels per second. Empirically determined. How well does this work on differently sized devices?
Tim Horton
Comment 5 2018-08-01 16:20:37 PDT
Comment on attachment 346304 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=346304&action=review >> Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm:114 >> + if ([charactersIgnoringModifiers isEqualToString:UIKeyInputUpArrow]) > > Blank line above please. > > This code is pretty hard to read. Would be nice to be able to just have one call to computeOffset(). I rewrote this, see how you like it. >> Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm:174 >> + _displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(displayLinkFired:)]; > > OK to not retain this? It sits in a retainptr. This is autoreleased so it's all good. >> Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm:187 >> + const CFTimeInterval secondsPerScrollIncrement = 0.05; // Seconds it should take to cover one increment when at full speed. > > Odd that this isn't some multiple of 16.667ms? It is exactly 3 frames @ 60fps, actually! That was unintentional. >> Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm:188 >> + const float maximumVelocity = 2000; // Maximum velocity in pixels per second. Empirically determined. > > How well does this work on differently sized devices? We'll probably need to tune this, because I don't know that what feels reasonable to me makes sense. That said, I don't think you hit this cap on iPhone, for example.
Tim Horton
Comment 6 2018-08-01 16:24:47 PDT
Tim Horton
Comment 7 2018-08-01 16:47:29 PDT
WebKit Commit Bot
Comment 8 2018-08-01 17:30:17 PDT
Comment on attachment 346313 [details] Patch Clearing flags on attachment: 346313 Committed r234488: <https://trac.webkit.org/changeset/234488>
WebKit Commit Bot
Comment 9 2018-08-01 17:30:19 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.