Bug 218857

Summary: Use native animations for scroll-behavior:smooth on Mac
Product: WebKit Reporter: cathiechen <cathiechen>
Component: ScrollingAssignee: Martin Robinson <mrobinson>
Status: RESOLVED INVALID    
Severity: Normal CC: changseok, esprehn+autocc, ews-watchlist, fred.wang, glenn, kondapallykalyan, mrobinson, pdr, rik, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=230310
Bug Depends on:    
Bug Blocks: 188043    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
ews-feeder: commit-queue-
Patch none

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
Comment 9 Martin Robinson 2021-09-23 08:00:17 PDT
Now that ScrollAnimator and ScrollAnimatorMac use the same smooth animation, this change is no longer valid.

See: https://bugs.webkit.org/show_bug.cgi?id=230445
Comment 10 Simon Fraser (smfr) 2021-09-23 09:57:04 PDT
We still want to run smooth scrolling animations in the UI process on iOS, but we can do that via a separate bug.
Comment 11 Martin Robinson 2021-09-24 09:18:40 PDT
(In reply to Simon Fraser (smfr) from comment #10)
> We still want to run smooth scrolling animations in the UI process on iOS,
> but we can do that via a separate bug.

That's right. If I'm not mistaken it's tracked by: https://bugs.webkit.org/show_bug.cgi?id=204936.