Bug 218842

Summary: Force wheel event listeners on the root to be passive
Product: WebKit Reporter: Simon Fraser (smfr) <simon.fraser>
Component: UI EventsAssignee: Simon Fraser (smfr) <simon.fraser>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, graouts, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari Technology Preview   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=218931
Attachments:
Description Flags
Patch
cdumez: review+, ews-feeder: commit-queue-
Patch
ews-feeder: commit-queue-
Patch ews-feeder: commit-queue-

Description Simon Fraser (smfr) 2020-11-11 21:24:44 PST
Follow Chrome:
   https://www.chromestatus.com/feature/6662647093133312
   https://developers.google.com/web/updates/2019/02/scrolling-intervention

and make wheel/mousewheel event listeners registered on the window/document/body to be passive, as we do for touch listeners.
Comment 1 Radar WebKit Bug Importer 2020-11-11 21:25:21 PST
<rdar://problem/71312668>
Comment 2 Simon Fraser (smfr) 2020-11-12 16:56:32 PST
Created attachment 413985 [details]
Patch
Comment 3 Chris Dumez 2020-11-12 17:10:05 PST
Comment on attachment 413985 [details]
Patch

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

r=me with nits

> Source/WebCore/page/Quirks.cpp:818
> +        if (is<DOMWindow>(eventTarget))

I believe can can  simply do:
return downcast<Document>(eventTarget.scriptExecutionContext());

since we know here to EventTarget is a Window or a Node, and thus its script execution context has to be a Document.

> LayoutTests/fast/events/wheel/wheel-event-listeners-on-body-made-passive.html:26
> +                event.preventDefault();

In these tests, I would recommend checking event.defaultPrevented after calling preventDefault(). This is the easiest way to check if we are passive.
Comment 4 Simon Fraser (smfr) 2020-11-12 19:28:58 PST
Created attachment 413994 [details]
Patch
Comment 5 Simon Fraser (smfr) 2020-11-12 20:26:52 PST
Created attachment 414001 [details]
Patch
Comment 6 Simon Fraser (smfr) 2020-11-13 10:40:56 PST
https://trac.webkit.org/changeset/269780/webkit