Bug 200869 - Multiple scroll events during one requestAnimationFrame cycle
Summary: Multiple scroll events during one requestAnimationFrame cycle
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Scrolling (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified macOS 10.14
: P2 Major
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks: 202843
  Show dependency treegraph
 
Reported: 2019-08-18 09:46 PDT by alex
Modified: 2021-10-15 16:30 PDT (History)
5 users (show)

See Also:


Attachments
Test (5.83 KB, text/html)
2021-10-15 16:30 PDT, Simon Fraser (smfr)
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description alex 2019-08-18 09:46:23 PDT
Safari dispatches multiple scroll events during one requestAnimationFrame "cycle". But the scroll event should be limited to the rAF.

Steps to reproduce:

1. open page:
Demo: https://jsbin.com/joculitacu/edit?console,output

2. Scroll the page

What you see:
You see multiple outputs `bug.` inside of the console.

What I expect:
No output.

To me it is not entirely clear wether this is a bug with the scroll event or the rAF.
Comment 1 Radar WebKit Bug Importer 2019-08-18 11:36:32 PDT
<rdar://problem/54446269>
Comment 2 alex 2019-08-19 01:30:34 PDT
Here you find an updated testcase:
https://jsbin.com/wiyehev/edit?console,output

The old one said "success." although it is a bug. Having multiple scroll events in one render cycle can lead to performance problems and layout thrashing. Additionally it is not standard complaint. This bug only occurs in Safari not in Chrome, FF or Edge.
Comment 3 Simon Fraser (smfr) 2021-10-15 16:30:05 PDT
I suspect this only happens in cross-origin iframes where rAF is throttled to 30fps.

Does it happen in the main frame? Attaching your testcase as an HTML file.
Comment 4 Simon Fraser (smfr) 2021-10-15 16:30:16 PDT
Created attachment 441451 [details]
Test