Bug 209134 - Add support for scrollend event of programmatic scroll
Summary: Add support for scrollend event of programmatic scroll
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Scrolling (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: cathiechen
URL:
Keywords:
Depends on: 208802 210281
Blocks: 201556
  Show dependency treegraph
 
Reported: 2020-03-16 01:49 PDT by cathiechen
Modified: 2024-02-12 01:53 PST (History)
34 users (show)

See Also:


Attachments
scrollend-programmatic-for-ews (94.13 KB, patch)
2020-03-17 05:26 PDT, cathiechen
no flags Details | Formatted Diff | Diff
scrollend-programmatic-for-review (30.11 KB, patch)
2020-03-17 05:27 PDT, cathiechen
no flags Details | Formatted Diff | Diff
scrollend-programmatic-for-ews (94.13 KB, patch)
2020-03-17 05:49 PDT, cathiechen
no flags Details | Formatted Diff | Diff
scrollend-programmatic-for-ews (94.34 KB, patch)
2020-03-17 06:22 PDT, cathiechen
no flags Details | Formatted Diff | Diff
scrollend-programmatic-for-ews (140.45 KB, patch)
2020-04-08 06:32 PDT, cathiechen
no flags Details | Formatted Diff | Diff
scrollend-programmatic-for-review (57.59 KB, patch)
2020-04-08 06:32 PDT, cathiechen
no flags Details | Formatted Diff | Diff
scrollend-programmatic-for-ews (140.48 KB, patch)
2020-04-08 06:47 PDT, cathiechen
no flags Details | Formatted Diff | Diff
scrollend-programmatic-for-review (57.62 KB, patch)
2020-04-08 06:47 PDT, cathiechen
no flags Details | Formatted Diff | Diff
scrollend-programmatic-for-ews (140.68 KB, patch)
2020-04-08 07:13 PDT, cathiechen
no flags Details | Formatted Diff | Diff
scrollend-programmatic-for-review (57.42 KB, patch)
2020-04-08 07:13 PDT, cathiechen
no flags Details | Formatted Diff | Diff
scrollend-programmatic-for-ews (142.82 KB, patch)
2020-04-09 05:25 PDT, cathiechen
no flags Details | Formatted Diff | Diff
scrollend-programmatic-for-review (59.56 KB, patch)
2020-04-09 05:25 PDT, cathiechen
no flags Details | Formatted Diff | Diff
scrollend-programmatic-for-ews (142.59 KB, patch)
2020-04-09 06:14 PDT, cathiechen
no flags Details | Formatted Diff | Diff
scrollend-programmatic-for-review (59.47 KB, patch)
2020-04-09 06:15 PDT, cathiechen
no flags Details | Formatted Diff | Diff
scrollend-programmatic-for-ews (116.86 KB, patch)
2020-04-10 00:24 PDT, cathiechen
no flags Details | Formatted Diff | Diff
scrollend-programmatic-for-review (51.24 KB, patch)
2020-04-10 00:24 PDT, cathiechen
no flags Details | Formatted Diff | Diff
scrollend-programmatic-for-review (51.25 KB, patch)
2020-04-10 00:41 PDT, cathiechen
no flags Details | Formatted Diff | Diff
scrollend-programmatic-for-ews (112.39 KB, patch)
2020-05-15 02:18 PDT, cathiechen
no flags Details | Formatted Diff | Diff
scrollend-programmatic-for-review (46.67 KB, patch)
2020-05-15 02:19 PDT, cathiechen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description cathiechen 2020-03-16 01:49:59 PDT
The programmatic scroll would fire scrollend events.
Comment 1 cathiechen 2020-03-17 05:26:34 PDT
Created attachment 393744 [details]
scrollend-programmatic-for-ews
Comment 2 cathiechen 2020-03-17 05:27:06 PDT
Created attachment 393745 [details]
scrollend-programmatic-for-review
Comment 3 cathiechen 2020-03-17 05:49:12 PDT
Created attachment 393746 [details]
scrollend-programmatic-for-ews
Comment 4 cathiechen 2020-03-17 06:22:31 PDT
Created attachment 393747 [details]
scrollend-programmatic-for-ews
Comment 5 Frédéric Wang (:fredw) 2020-03-19 08:01:05 PDT
Comment on attachment 393745 [details]
scrollend-programmatic-for-review

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

> Source/WebCore/dom/Document.cpp:804
> +    m_pendingScrollendEventTargetList = nullptr;

Should everything in this patch be "ScrollEnd"? Did you check what we do for other events?

> Source/WebCore/page/FrameView.cpp:2286
> +void FrameView::setScrollPosition(const ScrollPosition& scrollPosition, ScrollClamping clamping, bool animated, bool saveScrollendPosition)

I believe Simon complained in the past about "boolean trap". I wonder whether we want enums here?

> Source/WebCore/platform/ScrollView.cpp:543
> +    if ((!delegatesScrolling() || currentScrollType() == ScrollType::User) && currentScrollBehaviorStatus() == ScrollBehaviorStatus::NotInAnimation && newScrollPosition == this->scrollPosition()) {

this line is very long, maybe consider https://webkit.org/code-style-guidelines/#indentation-wrap-bool-op ?

> Source/WebCore/platform/ScrollView.cpp:-534
> -        scrollAnimator().cancelAnimations();

Can you explain this behavior change? It seems you move it above where the if is no longer done.

> Source/WebCore/rendering/RenderLayer.cpp:2848
> +    bool autoscrollNotInProgress = !renderer().frame().eventHandler().autoscrollInProgress();

It seems the autscrollstatus change can be done in a separate preliminary patch?
Comment 6 cathiechen 2020-04-08 06:32:03 PDT
Created attachment 395799 [details]
scrollend-programmatic-for-ews
Comment 7 cathiechen 2020-04-08 06:32:43 PDT
Created attachment 395800 [details]
scrollend-programmatic-for-review
Comment 8 cathiechen 2020-04-08 06:47:27 PDT
Created attachment 395801 [details]
scrollend-programmatic-for-ews
Comment 9 cathiechen 2020-04-08 06:47:51 PDT
Created attachment 395802 [details]
scrollend-programmatic-for-review
Comment 10 cathiechen 2020-04-08 07:13:13 PDT
Created attachment 395805 [details]
scrollend-programmatic-for-ews
Comment 11 cathiechen 2020-04-08 07:13:36 PDT
Created attachment 395806 [details]
scrollend-programmatic-for-review
Comment 12 cathiechen 2020-04-08 08:58:18 PDT
Hi Fred,
Thanks for the review:)

> 
> > Source/WebCore/dom/Document.cpp:804
> > +    m_pendingScrollendEventTargetList = nullptr;
> 
> Should everything in this patch be "ScrollEnd"? Did you check what we do for
> other events?
> 

Done.

> > Source/WebCore/page/FrameView.cpp:2286
> > +void FrameView::setScrollPosition(const ScrollPosition& scrollPosition, ScrollClamping clamping, bool animated, bool saveScrollendPosition)
> 
> I believe Simon complained in the past about "boolean trap". I wonder
> whether we want enums here?
> 

Done.

> > Source/WebCore/platform/ScrollView.cpp:543
> > +    if ((!delegatesScrolling() || currentScrollType() == ScrollType::User) && currentScrollBehaviorStatus() == ScrollBehaviorStatus::NotInAnimation && newScrollPosition == this->scrollPosition()) {
> 
> this line is very long, maybe consider
> https://webkit.org/code-style-guidelines/#indentation-wrap-bool-op ?
> 

Done.

> > Source/WebCore/platform/ScrollView.cpp:-534
> > -        scrollAnimator().cancelAnimations();
> 
> Can you explain this behavior change? It seems you move it above where the
> if is no longer done.
> 

We should cancel the animation before return. There's a tiny chance that animation doesn't stop. Moved this change to https://bugs.webkit.org/show_bug.cgi?id=210171.

> > Source/WebCore/rendering/RenderLayer.cpp:2848
> > +    bool autoscrollNotInProgress = !renderer().frame().eventHandler().autoscrollInProgress();
> 
> It seems the autscrollstatus change can be done in a separate preliminary
> patch?

Done, I move this change to https://bugs.webkit.org/show_bug.cgi?id=210171
Comment 13 cathiechen 2020-04-09 05:25:27 PDT
Created attachment 395939 [details]
scrollend-programmatic-for-ews
Comment 14 cathiechen 2020-04-09 05:25:54 PDT
Created attachment 395940 [details]
scrollend-programmatic-for-review
Comment 15 cathiechen 2020-04-09 06:14:54 PDT
Created attachment 395943 [details]
scrollend-programmatic-for-ews
Comment 16 cathiechen 2020-04-09 06:15:20 PDT
Created attachment 395944 [details]
scrollend-programmatic-for-review
Comment 17 cathiechen 2020-04-09 07:42:10 PDT
Comment on attachment 395944 [details]
scrollend-programmatic-for-review

Hi,
The patch is ready to review\o/ Thanks:)
This is based on the parsing patch(208802) and code style fix up for scroll animated patch(bug 210171).
Comment 18 cathiechen 2020-04-10 00:24:12 PDT
Created attachment 396058 [details]
scrollend-programmatic-for-ews
Comment 19 cathiechen 2020-04-10 00:24:41 PDT
Created attachment 396059 [details]
scrollend-programmatic-for-review
Comment 20 cathiechen 2020-04-10 00:41:44 PDT
Created attachment 396062 [details]
scrollend-programmatic-for-review
Comment 21 cathiechen 2020-04-10 06:35:38 PDT
Comment on attachment 396062 [details]
scrollend-programmatic-for-review

Hi,
Rebase the code.
After commit the code style fix up patch and test import patch, now this patch is only based on the parsing patch(bug 208802). I wonder if I can commit the parsing patch now?
Comment 22 cathiechen 2020-05-15 02:18:33 PDT
Created attachment 399465 [details]
scrollend-programmatic-for-ews
Comment 23 cathiechen 2020-05-15 02:19:10 PDT
Created attachment 399466 [details]
scrollend-programmatic-for-review
Comment 24 mic.gallego 2022-09-24 05:04:54 PDT
Chrome has shipped the new "scrollend" event as an experimental feature. Are there plans to enable this feature to Safari as well?
Comment 25 Simon Fraser (smfr) 2022-09-24 10:49:21 PDT
Is there a spec for this new event?
Comment 26 mic.gallego 2022-09-24 19:03:08 PDT
(In reply to Simon Fraser (smfr) from comment #25)
> Is there a spec for this new event?

Yes, here you are: https://wicg.github.io/overscroll-scrollend-events/
Chrome has shipped it behind experimental flag (for now, I think they only implemented the scrollend event).
Comment 27 Šime Vidas 2023-06-10 09:03:50 PDT
The scrollend event shipped in Chrome 114 last month.

Simple test page (the page will turn yellow after the scroll): https://output.jsbin.com/ludiban/quiet

The event seems to now be defined in the CSSOM View spec: https://drafts.csswg.org/cssom-view/#eventdef-document-scrollend
Comment 28 Ernst 2023-07-31 08:45:44 PDT
Firefox also shipped 'scrollend'. Please also enable it in Safari on both iOS and macOS. Would make some components much easier than with debouncing and heuristics to detect scroll end. Thanks.
Comment 29 Rado 2023-12-04 07:15:40 PST
Please implement the 'scrollend' event, because we must use a polyfill for Safari only. Thanks!