⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 269780 in webkit


Ignore:
Timestamp:
Nov 13, 2020, 8:46:42 AM (6 years ago)
Author:
Simon Fraser
Message:

Force wheel event listeners on the root to be passive
https://bugs.webkit.org/show_bug.cgi?id=218842
<rdar://problem/71312668>

Reviewed by Chris Dumez.

Following Blink (https://www.chromestatus.com/feature/6662647093133312) force 'wheel' and
'mousewheel' event listeners on root objects (window, document and body) to be passive if
they were not explicitly registered as non-passive.

This behavior is controlled by an experimental feature flag, and a linked-on-or-after check
to avoid changing behavior for apps that embed WebKit until they link against new SDKs.

Source/WebCore:

Tests: fast/events/wheel/wheel-event-listeners-on-body-made-passive.html

fast/events/wheel/wheel-event-listeners-on-document-made-passive.html
fast/events/wheel/wheel-event-listeners-on-window-left-active.html
fast/events/wheel/wheel-event-listeners-on-window-made-passive.html

  • page/Quirks.cpp:

(WebCore::Quirks::shouldMakeEventListenerPassive):

  • platform/cocoa/VersionChecks.h:

Source/WebKit:

  • Shared/WebPreferencesDefaultValues.cpp:

(WebKit::defaultCSSOMViewScrollingAPIEnabled):
(WebKit::defaultPassiveWheelListenersAsDefaultOnDocument):

  • Shared/WebPreferencesDefaultValues.h:

Source/WebKitLegacy/mac:

  • WebView/WebPreferencesDefaultValues.h:
  • WebView/WebPreferencesDefaultValues.mm:

(WebKit::defaultPassiveTouchListenersAsDefaultOnDocument):
(WebKit::defaultPassiveWheelListenersAsDefaultOnDocument):

Source/WTF:

  • Scripts/Preferences/WebPreferencesExperimental.yaml:

LayoutTests:

  • fast/events/wheel/wheel-event-listeners-on-body-made-passive-expected.txt: Added.
  • fast/events/wheel/wheel-event-listeners-on-body-made-passive.html: Added.
  • fast/events/wheel/wheel-event-listeners-on-document-made-passive-expected.txt: Added.
  • fast/events/wheel/wheel-event-listeners-on-document-made-passive.html: Added.
  • fast/events/wheel/wheel-event-listeners-on-window-left-active-expected.txt: Added.
  • fast/events/wheel/wheel-event-listeners-on-window-left-active.html: Added.
  • fast/events/wheel/wheel-event-listeners-on-window-made-passive-expected.txt: Added.
  • fast/events/wheel/wheel-event-listeners-on-window-made-passive.html: Added.
Location:
trunk
Files:
8 added
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r269778 r269780  
     12020-11-12  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Force wheel event listeners on the root to be passive
     4        https://bugs.webkit.org/show_bug.cgi?id=218842
     5        <rdar://problem/71312668>
     6
     7        Reviewed by Chris Dumez.
     8
     9        Following Blink (https://www.chromestatus.com/feature/6662647093133312) force 'wheel' and
     10        'mousewheel' event listeners on root objects (window, document and body) to be passive if
     11        they were not explicitly registered as non-passive.
     12
     13        This behavior is controlled by an experimental feature flag, and a linked-on-or-after check
     14        to avoid changing behavior for apps that embed WebKit until they link against new SDKs.
     15
     16        * fast/events/wheel/wheel-event-listeners-on-body-made-passive-expected.txt: Added.
     17        * fast/events/wheel/wheel-event-listeners-on-body-made-passive.html: Added.
     18        * fast/events/wheel/wheel-event-listeners-on-document-made-passive-expected.txt: Added.
     19        * fast/events/wheel/wheel-event-listeners-on-document-made-passive.html: Added.
     20        * fast/events/wheel/wheel-event-listeners-on-window-left-active-expected.txt: Added.
     21        * fast/events/wheel/wheel-event-listeners-on-window-left-active.html: Added.
     22        * fast/events/wheel/wheel-event-listeners-on-window-made-passive-expected.txt: Added.
     23        * fast/events/wheel/wheel-event-listeners-on-window-made-passive.html: Added.
     24
    1252020-11-13  Julian Gonzalez  <julian_a_gonzalez@apple.com>
    226
  • trunk/LayoutTests/fast/scrolling/mac/wheel-event-listener-region-root-invalidation-expected.txt

    r261820 r269780  
    1212      (wheel event listener region
    1313        (rect (0,0) width=800 height=600)
    14         (non-passive
    15           (rect (0,0) width=800 height=600)
    16         )
    1714      )
    1815      )
  • trunk/LayoutTests/platform/win/TestExpectations

    r269759 r269780  
    276276fast/events/wheel/wheelevent-in-horizontal-scrollbar-in-rtl.html [ Failure ]
    277277fast/events/wheel/wheelevent-in-vertical-scrollbar-in-rtl.html [ Failure ]
     278fast/events/wheel/wheel-event-listeners-on-body-made-passive.html [ Skip ]
     279fast/events/wheel/wheel-event-listeners-on-document-made-passive.html [ Skip ]
     280fast/events/wheel/wheel-event-listeners-on-window-left-active.html [ Skip ]
     281fast/events/wheel/wheel-event-listeners-on-window-made-passive.html [ Skip ]
     282
    278283scrollbars/scroll-rtl-or-bt-layer.html [ Timeout ]
    279284webkit.org/b/208559 fast/scrolling/arrow-key-scroll-in-rtl-document.html [ Skip ]
  • trunk/LayoutTests/tiled-drawing/scrolling/non-fast-region/wheel-handler-on-document-expected.txt

    r268476 r269780  
    1313      (wheel event listener region
    1414        (rect (0,0) width=800 height=600)
    15         (non-passive
    16           (rect (0,0) width=800 height=600)
    17         )
    1815      )
    1916      )
  • trunk/Source/WTF/ChangeLog

    r269775 r269780  
     12020-11-12  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Force wheel event listeners on the root to be passive
     4        https://bugs.webkit.org/show_bug.cgi?id=218842
     5        <rdar://problem/71312668>
     6
     7        Reviewed by Chris Dumez.
     8
     9        Following Blink (https://www.chromestatus.com/feature/6662647093133312) force 'wheel' and
     10        'mousewheel' event listeners on root objects (window, document and body) to be passive if
     11        they were not explicitly registered as non-passive.
     12
     13        This behavior is controlled by an experimental feature flag, and a linked-on-or-after check
     14        to avoid changing behavior for apps that embed WebKit until they link against new SDKs.
     15
     16        * Scripts/Preferences/WebPreferencesExperimental.yaml:
     17
    1182020-11-13  Aditya Keerthi  <akeerthi@apple.com>
    219
  • trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml

    r269764 r269780  
    602602      default: true
    603603
     604PassiveWheelListenersAsDefaultOnDocument:
     605  type: bool
     606  humanReadableName: "Wheel Event listeners on the root made passive"
     607  humanReadableDescription: "Force wheel event listeners registered on the window, document or body to be passive"
     608  defaultValue:
     609    WebKitLegacy:
     610      "PLATFORM(MAC)": WebKit::defaultPassiveWheelListenersAsDefaultOnDocument()
     611      default: true
     612    WebKit:
     613      "PLATFORM(MAC)": WebKit::defaultPassiveWheelListenersAsDefaultOnDocument()
     614      default: true
     615    WebCore:
     616      default: true
     617
    604618# FIXME: Is this implemented for WebKitLegacy? If not, this should be excluded from WebKitLegacy entirely.
    605619PerElementSpeakerSelectionEnabled:
  • trunk/Source/WebCore/ChangeLog

    r269779 r269780  
     12020-11-12  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Force wheel event listeners on the root to be passive
     4        https://bugs.webkit.org/show_bug.cgi?id=218842
     5        <rdar://problem/71312668>
     6
     7        Reviewed by Chris Dumez.
     8
     9        Following Blink (https://www.chromestatus.com/feature/6662647093133312) force 'wheel' and
     10        'mousewheel' event listeners on root objects (window, document and body) to be passive if
     11        they were not explicitly registered as non-passive.
     12
     13        This behavior is controlled by an experimental feature flag, and a linked-on-or-after check
     14        to avoid changing behavior for apps that embed WebKit until they link against new SDKs.
     15
     16        Tests: fast/events/wheel/wheel-event-listeners-on-body-made-passive.html
     17               fast/events/wheel/wheel-event-listeners-on-document-made-passive.html
     18               fast/events/wheel/wheel-event-listeners-on-window-left-active.html
     19               fast/events/wheel/wheel-event-listeners-on-window-made-passive.html
     20
     21        * page/Quirks.cpp:
     22        (WebCore::Quirks::shouldMakeEventListenerPassive):
     23        * platform/cocoa/VersionChecks.h:
     24
    1252020-11-13  Antti Koivisto  <antti@apple.com>
    226
  • trunk/Source/WebCore/page/Quirks.cpp

    r268987 r269780  
    804804bool Quirks::shouldMakeEventListenerPassive(const EventTarget& eventTarget, const AtomString& eventType, const EventListener& eventListener)
    805805{
     806    auto eventTargetIsRoot = [](const EventTarget& eventTarget) {
     807        if (is<DOMWindow>(eventTarget))
     808            return true;
     809
     810        if (is<Node>(eventTarget)) {
     811            auto& node = downcast<Node>(eventTarget);
     812            return is<Document>(node) || node.document().documentElement() == &node || node.document().body() == &node;
     813        }
     814        return false;
     815    };
     816
     817    auto documentFromEventTarget = [](const EventTarget& eventTarget) -> Document* {
     818        return downcast<Document>(eventTarget.scriptExecutionContext());
     819    };
     820
    806821    if (eventNames().isTouchScrollBlockingEventType(eventType)) {
    807         if (is<DOMWindow>(eventTarget)) {
    808             auto& window = downcast<DOMWindow>(eventTarget);
    809             if (auto* document = window.document())
     822        if (eventTargetIsRoot(eventTarget)) {
     823            if (auto* document = documentFromEventTarget(eventTarget))
    810824                return document->settings().passiveTouchListenersAsDefaultOnDocument();
    811         } else if (is<Node>(eventTarget)) {
    812             auto& node = downcast<Node>(eventTarget);
    813             if (is<Document>(node) || node.document().documentElement() == &node || node.document().body() == &node)
    814                 return node.document().settings().passiveTouchListenersAsDefaultOnDocument();
     825        }
     826        return false;
     827    }
     828
     829    if (eventNames().isWheelEventType(eventType)) {
     830        if (eventTargetIsRoot(eventTarget)) {
     831            if (auto* document = documentFromEventTarget(eventTarget))
     832                return document->settings().passiveWheelListenersAsDefaultOnDocument();
    815833        }
    816834        return false;
  • trunk/Source/WebCore/platform/cocoa/VersionChecks.h

    r269279 r269780  
    7272    FirstWithDropToNavigateDisallowedByDefault = DYLD_MACOSX_VERSION_10_13,
    7373    FirstWithExpiredOnlyReloadBehavior = DYLD_MACOSX_VERSION_10_13,
     74    FirstThatDefaultsToPassiveWheelListenersOnDocument = DYLD_MACOSX_VERSION_11_3,
    7475    FirstWithWebIconDatabaseWarning = DYLD_MACOSX_VERSION_10_13,
    7576    FirstWithMainThreadReleaseAssertionInWebPageProxy = DYLD_MACOSX_VERSION_10_14,
  • trunk/Source/WebKit/ChangeLog

    r269777 r269780  
     12020-11-12  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Force wheel event listeners on the root to be passive
     4        https://bugs.webkit.org/show_bug.cgi?id=218842
     5        <rdar://problem/71312668>
     6
     7        Reviewed by Chris Dumez.
     8
     9        Following Blink (https://www.chromestatus.com/feature/6662647093133312) force 'wheel' and
     10        'mousewheel' event listeners on root objects (window, document and body) to be passive if
     11        they were not explicitly registered as non-passive.
     12
     13        This behavior is controlled by an experimental feature flag, and a linked-on-or-after check
     14        to avoid changing behavior for apps that embed WebKit until they link against new SDKs.
     15
     16        * Shared/WebPreferencesDefaultValues.cpp:
     17        (WebKit::defaultCSSOMViewScrollingAPIEnabled):
     18        (WebKit::defaultPassiveWheelListenersAsDefaultOnDocument):
     19        * Shared/WebPreferencesDefaultValues.h:
     20
    1212020-11-13  Eric Carlson  <eric.carlson@apple.com>
    222
  • trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.cpp

    r269374 r269780  
    5353#endif
    5454
     55#if PLATFORM(MAC)
     56
     57bool defaultPassiveWheelListenersAsDefaultOnDocument()
     58{
     59    static bool result = linkedOnOrAfter(WebCore::SDKVersion::FirstThatDefaultsToPassiveWheelListenersOnDocument);
     60    return result;
     61}
     62
     63#endif
     64
    5565#if PLATFORM(MAC) || PLATFORM(IOS_FAMILY)
    5666
  • trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.h

    r269374 r269780  
    4646bool defaultTextAutosizingUsesIdempotentMode();
    4747#endif
     48#endif
     49
     50#if PLATFORM(MAC)
     51bool defaultPassiveWheelListenersAsDefaultOnDocument();
    4852#endif
    4953
  • trunk/Source/WebKitLegacy/mac/ChangeLog

    r269760 r269780  
     12020-11-12  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Force wheel event listeners on the root to be passive
     4        https://bugs.webkit.org/show_bug.cgi?id=218842
     5        <rdar://problem/71312668>
     6
     7        Reviewed by Chris Dumez.
     8
     9        Following Blink (https://www.chromestatus.com/feature/6662647093133312) force 'wheel' and
     10        'mousewheel' event listeners on root objects (window, document and body) to be passive if
     11        they were not explicitly registered as non-passive.
     12
     13        This behavior is controlled by an experimental feature flag, and a linked-on-or-after check
     14        to avoid changing behavior for apps that embed WebKit until they link against new SDKs.
     15
     16        * WebView/WebPreferencesDefaultValues.h:
     17        * WebView/WebPreferencesDefaultValues.mm:
     18        (WebKit::defaultPassiveTouchListenersAsDefaultOnDocument):
     19        (WebKit::defaultPassiveWheelListenersAsDefaultOnDocument):
     20
    1212020-11-12  Sam Weinig  <weinig@apple.com>
    222
  • trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesDefaultValues.h

    r269760 r269780  
    8383bool defaultShouldConvertInvalidURLsToBlank();
    8484
     85#if PLATFORM(MAC)
     86bool defaultPassiveWheelListenersAsDefaultOnDocument();
     87#endif
     88
    8589} // namespace WebKit
  • trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesDefaultValues.mm

    r269760 r269780  
    133133bool defaultPassiveTouchListenersAsDefaultOnDocument()
    134134{
    135     return linkedOnOrAfter(WebCore::SDKVersion::FirstThatDefaultsToPassiveTouchListenersOnDocument);
     135    static bool result = linkedOnOrAfter(WebCore::SDKVersion::FirstThatDefaultsToPassiveTouchListenersOnDocument);
     136    return result;
    136137}
    137138
     
    283284}
    284285
     286#if PLATFORM(MAC)
     287
     288bool defaultPassiveWheelListenersAsDefaultOnDocument()
     289{
     290    static bool result = linkedOnOrAfter(WebCore::SDKVersion::FirstThatDefaultsToPassiveWheelListenersOnDocument);
     291    return result;
     292}
     293
     294#endif
     295
    285296} // namespace WebKit
Note: See TracChangeset for help on using the changeset viewer.