Bug 218857 - Use native animations for scroll-behavior:smooth on Mac
Summary: Use native animations for scroll-behavior:smooth on Mac
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Scrolling (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Martin Robinson
URL:
Keywords: InRadar
Depends on:
Blocks: 188043
  Show dependency treegraph
 
Reported: 2020-11-12 10:24 PST by cathiechen
Modified: 2021-07-06 08:27 PDT (History)
11 users (show)

See Also:


Attachments
Patch (13.54 KB, patch)
2021-06-29 02:18 PDT, Martin Robinson
no flags Details | Formatted Diff | Diff
Patch (13.64 KB, patch)
2021-06-30 03:48 PDT, Martin Robinson
no flags Details | Formatted Diff | Diff
Patch (14.14 KB, patch)
2021-07-02 02:11 PDT, Martin Robinson
no flags Details | Formatted Diff | Diff
Patch (14.72 KB, patch)
2021-07-06 07:46 PDT, Martin Robinson
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (15.09 KB, patch)
2021-07-06 08:15 PDT, Martin Robinson
mrobinson: review?
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description cathiechen 2020-11-12 10:24:50 PST
Try to use the native scroll animation of Mac (scrolling momentum) for smooth scroll.
Comment 1 Radar WebKit Bug Importer 2020-11-19 10:25:12 PST
<rdar://problem/71591918>
Comment 2 Martin Robinson 2021-06-29 02:18:59 PDT
Created attachment 432463 [details]
Patch
Comment 3 Martin Robinson 2021-06-30 03:48:14 PDT
Created attachment 432581 [details]
Patch
Comment 4 cathiechen 2021-07-02 01:54:41 PDT
Comment on attachment 432581 [details]
Patch

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

> Source/WebCore/platform/ScrollAnimator.cpp:-125
> -    m_scrollAnimation->setCurrentPosition(adjustedPosition);

I wonder would this change affect the platform still using m_scrollAnimation?

> Source/WebCore/platform/ScrollView.cpp:-540
> -    setScrollBehaviorStatus(ScrollBehaviorStatus::NotInAnimation);

Looks like we can also remove this in RenderLayerScrollableArea::scrollToOffset()?
Comment 5 Martin Robinson 2021-07-02 02:11:08 PDT
Created attachment 432772 [details]
Patch
Comment 6 Martin Robinson 2021-07-02 02:12:49 PDT
(In reply to cathiechen from comment #4)

Thanks for taking a look at this!

> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=432581&action=review
> 
> > Source/WebCore/platform/ScrollAnimator.cpp:-125
> > -    m_scrollAnimation->setCurrentPosition(adjustedPosition);
> 
> I wonder would this change affect the platform still using m_scrollAnimation?

I don't think this will, because setCurrentPosition is always called before starting a new animation with m_scrollAnimation.

> > Source/WebCore/platform/ScrollView.cpp:-540
> > -    setScrollBehaviorStatus(ScrollBehaviorStatus::NotInAnimation);
> 
> Looks like we can also remove this in
> RenderLayerScrollableArea::scrollToOffset()?

Nice catch! I thought I had gotten all of these, but I missed one.

I've uploaded a new version of the change.
Comment 7 Martin Robinson 2021-07-06 07:46:13 PDT
Created attachment 432928 [details]
Patch
Comment 8 Martin Robinson 2021-07-06 08:15:21 PDT
Created attachment 432931 [details]
Patch