Bug 190345 - Adjust keyboard scrolling animator to be a bit more physical
Summary: Adjust keyboard scrolling animator to be a bit more physical
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tim Horton
URL:
Keywords: InRadar
Depends on:
Blocks: 191408
  Show dependency treegraph
 
Reported: 2018-10-08 00:15 PDT by Tim Horton
Modified: 2018-11-07 16:58 PST (History)
6 users (show)

See Also:


Attachments
Patch (39.74 KB, patch)
2018-10-08 00:20 PDT, Tim Horton
no flags Details | Formatted Diff | Diff
Patch (43.06 KB, patch)
2018-10-08 11:29 PDT, Tim Horton
no flags Details | Formatted Diff | Diff
Patch (43.06 KB, patch)
2018-10-08 11:30 PDT, Tim Horton
no flags Details | Formatted Diff | Diff
Patch (43.04 KB, patch)
2018-10-08 12:03 PDT, Tim Horton
no flags Details | Formatted Diff | Diff
Patch (43.43 KB, patch)
2018-10-08 12:49 PDT, Tim Horton
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Horton 2018-10-08 00:15:09 PDT
Adjust keyboard scrolling animator to be a bit more physical
Comment 1 Tim Horton 2018-10-08 00:20:52 PDT
Created attachment 351763 [details]
Patch
Comment 2 Tim Horton 2018-10-08 00:21:55 PDT
I'll flesh out the changelog a bit. Also I think maybe we can unit test the class independent of a scroll view, which would be nice, so I'll try that.
Comment 3 Tim Horton 2018-10-08 11:29:18 PDT
Created attachment 351794 [details]
Patch
Comment 4 Tim Horton 2018-10-08 11:30:03 PDT
Created attachment 351795 [details]
Patch
Comment 5 Simon Fraser (smfr) 2018-10-08 11:44:33 PDT
Comment on attachment 351795 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=351795&action=review

> Source/WebKit/ChangeLog:3
> +        Adjust keyboard scrolling animator to be a bit more physical

"a bit more"

> Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:3854
> +        return self.bounds.size.height * selfScale;

Wouldn't that be the content view height?

> Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:3858
> +        return WebCore::Scrollbar::pixelsPerLineStep() * selfScale;

Maybe get this from the content view too?

> Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm:46
> +    WebCore::FloatSize offset; // Points per increment.
> +    WebCore::FloatSize maximumVelocity; // Points per second.

The comments indicate that the members could be named better (or maybe some typedef types)

> Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm:142
> +        return WebCore::FloatSize(0, -1);

return { 0., -1. } ?

> Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm:292
> +        _velocity = WebCore::FloatSize();

= { }

> Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm:380
> +    _velocity = WebCore::FloatSize();

= { }

> Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm:391
> +        WebCore::RectEdges<bool> scrollableDirections = [_scrollable scrollableDirectionsFromOffset:_currentPosition];

auto

> Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm:421
> +    // Compute the spring's force, and apply it in allowed directions.
> +    // F_spring = -k * x - c * v
> +    auto springForce = - displacement.scaled(self.parameters.springStiffness) - _velocity.scaled(self.parameters.springDamping);
> +    force += springForce * axesToApplySpring;

I kinda feel like all the spring logic should be packaged up in a separate helper class.

> Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm:435
> +        _velocity = WebCore::FloatSize();

= { }

> Source/WebKit/UIProcess/ios/WKKeyboardScrollingAnimator.mm:580
> +    return CGSizeMake(scrollView._horizontalVelocity * 1000, scrollView._verticalVelocity * 1000);

Please document the * 1000
Comment 6 Tim Horton 2018-10-08 12:03:33 PDT
Created attachment 351799 [details]
Patch
Comment 7 Tim Horton 2018-10-08 12:49:28 PDT
Created attachment 351806 [details]
Patch
Comment 8 WebKit Commit Bot 2018-10-08 13:18:33 PDT
Comment on attachment 351806 [details]
Patch

Clearing flags on attachment: 351806

Committed r236935: <https://trac.webkit.org/changeset/236935>
Comment 9 WebKit Commit Bot 2018-10-08 13:18:35 PDT
All reviewed patches have been landed.  Closing bug.
Comment 10 Radar WebKit Bug Importer 2018-10-08 13:19:23 PDT
<rdar://problem/45101935>
Comment 11 Daniel Bates 2018-11-07 16:58:07 PST
(In reply to WebKit Commit Bot from comment #8)
> Comment on attachment 351806 [details]
> Patch
> 
> Clearing flags on attachment: 351806
> 
> Committed r236935: <https://trac.webkit.org/changeset/236935>

This regressed key repeats for arrow keys on iOS device. See bug #191408 for more details.