Bug 218842 - Force wheel event listeners on the root to be passive
Summary: Force wheel event listeners on the root to be passive
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: UI Events (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Simon Fraser (smfr)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-11-11 21:24 PST by Simon Fraser (smfr)
Modified: 2020-11-13 19:38 PST (History)
4 users (show)

See Also:


Attachments
Patch (22.64 KB, patch)
2020-11-12 16:56 PST, Simon Fraser (smfr)
cdumez: review+
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (24.55 KB, patch)
2020-11-12 19:28 PST, Simon Fraser (smfr)
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (24.55 KB, patch)
2020-11-12 20:26 PST, Simon Fraser (smfr)
ews-feeder: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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