Title: [287228] trunk
Revision
287228
Author
[email protected]
Date
2021-12-18 12:11:35 -0800 (Sat, 18 Dec 2021)

Log Message

Read the default value of the ScrollAnimatorEnabled setting from NSUserDefaults
https://bugs.webkit.org/show_bug.cgi?id=234456

Reviewed by Tim Horton.

Source/WebCore:

It's impossible for a test to run with an animated keyboard scroll because platformAllowsScrollAnimation(),
which reads from NSUserDefaults, always trumps the Setting.

Fix by initializing the setting from NSUserDefaults and removing the platformAllowsScrollAnimation()
check. This allows for a WebKitTestRunner test override the setting. Remove the WTR code
that sets @"NSScrollAnimationEnabled" to @NO.

Unfortunately in WebKitLegacy AppKit code consults the @"NSScrollAnimationEnabled" key, so
DumpRenderTree has to continue to initialize this NSUserDefault to @NO and tests that
try to change the Setting will fail.

* platform/ScrollAnimator.cpp:
(WebCore::ScrollAnimator::singleAxisScroll):
(WebCore::ScrollAnimator::scrollAnimationEnabled const):
* platform/ScrollAnimator.h:
(WebCore::ScrollAnimator::platformAllowsScrollAnimation const): Deleted.
* platform/mac/ScrollAnimatorMac.h:
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::platformAllowsScrollAnimation const): Deleted.

Source/WebKit:

It's impossible for a test to run with an animated keyboard scroll because platformAllowsScrollAnimation(),
which reads from NSUserDefaults, always trumps the Setting.

Fix by initializing the setting from NSUserDefaults and removing the platformAllowsScrollAnimation()
check. This allows for a WebKitTestRunner test override the setting. Remove the WTR code
that sets @"NSScrollAnimationEnabled" to @NO.

Unfortunately in WebKitLegacy AppKit code consults the @"NSScrollAnimationEnabled" key, so
DumpRenderTree has to continue to initialize this NSUserDefault to @NO and tests that
try to change the Setting will fail.

* Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm:
(WebKit::defaultScrollAnimatorEnabled):
* Shared/WebPreferencesDefaultValues.h:

Source/WebKitLegacy/mac:

It's impossible for a test to run with an animated keyboard scroll because platformAllowsScrollAnimation(),
which reads from NSUserDefaults, always trumps the Setting.

Fix by initializing the setting from NSUserDefaults and removing the platformAllowsScrollAnimation()
check. This allows for a WebKitTestRunner test override the setting.

Unfortunately in WebKitLegacy AppKit code consults the @"NSScrollAnimationEnabled" key, so
DumpRenderTree has to continue to initialize this NSUserDefault to @NO and tests that
try to change the Setting will fail.

* WebView/WebPreferencesDefaultValues.h:
* WebView/WebPreferencesDefaultValues.mm:
(WebKit::defaultScrollAnimatorEnabled):

Source/WTF:

It's impossible for a test to run with an animated keyboard scroll because platformAllowsScrollAnimation(),
which reads from NSUserDefaults, always trumps the Setting.

Fix by initializing the setting from NSUserDefaults and removing the platformAllowsScrollAnimation()
check. This allows for a WebKitTestRunner test override the setting. Remove the WTR code
that sets @"NSScrollAnimationEnabled" to @NO.

Unfortunately in WebKitLegacy AppKit code consults the @"NSScrollAnimationEnabled" key, so
DumpRenderTree has to continue to initialize this NSUserDefault to @NO and tests that
try to change the Setting will fail.

* Scripts/Preferences/WebPreferences.yaml:

Tools:

It's impossible for a test to run with an animated keyboard scroll because platformAllowsScrollAnimation(),
which reads from NSUserDefaults, always trumps the Setting.

Fix by initializing the setting from NSUserDefaults and removing the platformAllowsScrollAnimation()
check. This allows for a WebKitTestRunner test override the setting.

Unfortunately in WebKitLegacy AppKit code consults the @"NSScrollAnimationEnabled" key, so
DumpRenderTree has to continue to initialize this NSUserDefault to @NO and tests that
try to change the Setting will fail.

* WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm:
(WTR::InjectedBundle::platformInitialize):
* WebKitTestRunner/mac/main.mm:
(setDefaultsToConsistentValuesForTesting):

LayoutTests:

Now that ScrollAnimatorEnabled is true by default, turn it off for these tests.

* tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal-with-keyboard-scaled.html:
* tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal-with-keyboard.html:
* tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical-with-keyboard-scaled.html:
* tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical-with-keyboard.html:
* tiled-drawing/scrolling/scroll-snap/scroll-snap-proximity-mainframe-horizontal-with-keyboard.html:
* tiled-drawing/scrolling/scroll-snap/scroll-snap-proximity-mainframe-vertical-with-keyboard.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (287227 => 287228)


--- trunk/LayoutTests/ChangeLog	2021-12-18 19:04:53 UTC (rev 287227)
+++ trunk/LayoutTests/ChangeLog	2021-12-18 20:11:35 UTC (rev 287228)
@@ -1,5 +1,21 @@
 2021-12-17  Simon Fraser  <[email protected]>
 
+        Read the default value of the ScrollAnimatorEnabled setting from NSUserDefaults
+        https://bugs.webkit.org/show_bug.cgi?id=234456
+
+        Reviewed by Tim Horton.
+
+        Now that ScrollAnimatorEnabled is true by default, turn it off for these tests.
+
+        * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal-with-keyboard-scaled.html:
+        * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal-with-keyboard.html:
+        * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical-with-keyboard-scaled.html:
+        * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical-with-keyboard.html:
+        * tiled-drawing/scrolling/scroll-snap/scroll-snap-proximity-mainframe-horizontal-with-keyboard.html:
+        * tiled-drawing/scrolling/scroll-snap/scroll-snap-proximity-mainframe-vertical-with-keyboard.html:
+
+2021-12-17  Simon Fraser  <[email protected]>
+
         Rename MockScrollAnimatorEnabled to MockScrollbarsControllerEnabled
         https://bugs.webkit.org/show_bug.cgi?id=234452
 

Modified: trunk/LayoutTests/fast/dom/horizontal-scrollbar-in-rtl.html (287227 => 287228)


--- trunk/LayoutTests/fast/dom/horizontal-scrollbar-in-rtl.html	2021-12-18 19:04:53 UTC (rev 287227)
+++ trunk/LayoutTests/fast/dom/horizontal-scrollbar-in-rtl.html	2021-12-18 20:11:35 UTC (rev 287228)
@@ -32,6 +32,8 @@
 
             _onload_ = function()
             {
+                if (window.internals)
+                    internals.settings.setScrollAnimatorEnabled(false);
                 if (window.testRunner)
                     testRunner.dumpAsText();
 

Modified: trunk/LayoutTests/fast/repaint/fixed-move-after-keyboard-scroll.html (287227 => 287228)


--- trunk/LayoutTests/fast/repaint/fixed-move-after-keyboard-scroll.html	2021-12-18 19:04:53 UTC (rev 287227)
+++ trunk/LayoutTests/fast/repaint/fixed-move-after-keyboard-scroll.html	2021-12-18 20:11:35 UTC (rev 287228)
@@ -4,6 +4,8 @@
   <script>
       function runTest()
       {
+          if (window.internals)
+              internals.settings.setScrollAnimatorEnabled(false);
           frames[0].focus();
           if (window.eventSender) {
               window.eventSender.keyDown("pageDown");

Modified: trunk/LayoutTests/fast/scrolling/arrow-key-scroll-in-rtl-document.html (287227 => 287228)


--- trunk/LayoutTests/fast/scrolling/arrow-key-scroll-in-rtl-document.html	2021-12-18 19:04:53 UTC (rev 287227)
+++ trunk/LayoutTests/fast/scrolling/arrow-key-scroll-in-rtl-document.html	2021-12-18 20:11:35 UTC (rev 287228)
@@ -23,6 +23,9 @@
             testRunner.waitUntilDone();
         }
 
+        if (window.internals)
+            internals.settings.setScrollAnimatorEnabled(false);
+
         function checkForScroll()
         {
             var expectedScrollLeft = -120;

Modified: trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal-with-keyboard-scaled.html (287227 => 287228)


--- trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal-with-keyboard-scaled.html	2021-12-18 19:04:53 UTC (rev 287227)
+++ trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal-with-keyboard-scaled.html	2021-12-18 20:11:35 UTC (rev 287228)
@@ -31,6 +31,8 @@
 
         async function runTests()
         {
+            if (window.internals)
+                internals.settings.setScrollAnimatorEnabled(false);
             try {
                 await UIHelper.delayFor(0);
 

Modified: trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal-with-keyboard.html (287227 => 287228)


--- trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal-with-keyboard.html	2021-12-18 19:04:53 UTC (rev 287227)
+++ trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal-with-keyboard.html	2021-12-18 20:11:35 UTC (rev 287228)
@@ -31,6 +31,8 @@
 
         async function runTests()
         {
+            if (window.internals)
+                internals.settings.setScrollAnimatorEnabled(false);
             try {
                 await UIHelper.delayFor(0);
 

Modified: trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical-with-keyboard-scaled.html (287227 => 287228)


--- trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical-with-keyboard-scaled.html	2021-12-18 19:04:53 UTC (rev 287227)
+++ trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical-with-keyboard-scaled.html	2021-12-18 20:11:35 UTC (rev 287228)
@@ -31,6 +31,8 @@
 
         async function runTests()
         {
+            if (window.internals)
+                internals.settings.setScrollAnimatorEnabled(false);
             try {
                 await UIHelper.delayFor(0);
 

Modified: trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical-with-keyboard.html (287227 => 287228)


--- trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical-with-keyboard.html	2021-12-18 19:04:53 UTC (rev 287227)
+++ trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical-with-keyboard.html	2021-12-18 20:11:35 UTC (rev 287228)
@@ -31,6 +31,8 @@
 
         async function runTests()
         {
+            if (window.internals)
+                internals.settings.setScrollAnimatorEnabled(false);
             try {
                 await UIHelper.delayFor(0);
 

Modified: trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-proximity-mainframe-horizontal-with-keyboard.html (287227 => 287228)


--- trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-proximity-mainframe-horizontal-with-keyboard.html	2021-12-18 19:04:53 UTC (rev 287227)
+++ trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-proximity-mainframe-horizontal-with-keyboard.html	2021-12-18 20:11:35 UTC (rev 287228)
@@ -31,6 +31,8 @@
 
         async function runTests()
         {
+            if (window.internals)
+                internals.settings.setScrollAnimatorEnabled(false);
             try {
                 await UIHelper.delayFor(0);
 

Modified: trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-proximity-mainframe-vertical-with-keyboard.html (287227 => 287228)


--- trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-proximity-mainframe-vertical-with-keyboard.html	2021-12-18 19:04:53 UTC (rev 287227)
+++ trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-proximity-mainframe-vertical-with-keyboard.html	2021-12-18 20:11:35 UTC (rev 287228)
@@ -31,6 +31,8 @@
 
         async function runTests()
         {
+            if (window.internals)
+                internals.settings.setScrollAnimatorEnabled(false);
             try {
                 await UIHelper.delayFor(0);
 

Modified: trunk/Source/WTF/ChangeLog (287227 => 287228)


--- trunk/Source/WTF/ChangeLog	2021-12-18 19:04:53 UTC (rev 287227)
+++ trunk/Source/WTF/ChangeLog	2021-12-18 20:11:35 UTC (rev 287228)
@@ -1,5 +1,25 @@
 2021-12-17  Simon Fraser  <[email protected]>
 
+        Read the default value of the ScrollAnimatorEnabled setting from NSUserDefaults
+        https://bugs.webkit.org/show_bug.cgi?id=234456
+
+        Reviewed by Tim Horton.
+
+        It's impossible for a test to run with an animated keyboard scroll because platformAllowsScrollAnimation(),
+        which reads from NSUserDefaults, always trumps the Setting.
+
+        Fix by initializing the setting from NSUserDefaults and removing the platformAllowsScrollAnimation()
+        check. This allows for a WebKitTestRunner test override the setting. Remove the WTR code 
+        that sets @"NSScrollAnimationEnabled" to @NO.
+
+        Unfortunately in WebKitLegacy AppKit code consults the @"NSScrollAnimationEnabled" key, so
+        DumpRenderTree has to continue to initialize this NSUserDefault to @NO and tests that
+        try to change the Setting will fail.
+
+        * Scripts/Preferences/WebPreferences.yaml:
+
+2021-12-17  Simon Fraser  <[email protected]>
+
         Rename MockScrollAnimatorEnabled to MockScrollbarsControllerEnabled
         https://bugs.webkit.org/show_bug.cgi?id=234452
 

Modified: trunk/Source/WTF/Scripts/Preferences/WebPreferences.yaml (287227 => 287228)


--- trunk/Source/WTF/Scripts/Preferences/WebPreferences.yaml	2021-12-18 19:04:53 UTC (rev 287227)
+++ trunk/Source/WTF/Scripts/Preferences/WebPreferences.yaml	2021-12-18 20:11:35 UTC (rev 287228)
@@ -1889,13 +1889,14 @@
   type: bool
   defaultValue:
     WebKitLegacy:
-      "PLATFORM(MAC)": true
+      "PLATFORM(MAC)": WebKit::defaultScrollAnimatorEnabled()
+      "PLATFORM(GTK) || PLATFORM(WPE)": true
       default: false
     WebKit:
-      "PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(WPE)": true
+      "PLATFORM(MAC)": WebKit::defaultScrollAnimatorEnabled()
+      "PLATFORM(GTK) || PLATFORM(WPE)": true
       default: false
     WebCore:
-      "PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(WPE)": true
       default: false
 
 # FIXME: This is handled via WebView SPI rather than WebPreferences for WebKitLegacy. We should change the SPI to lookup the WebPreferences value instead.

Modified: trunk/Source/WebCore/ChangeLog (287227 => 287228)


--- trunk/Source/WebCore/ChangeLog	2021-12-18 19:04:53 UTC (rev 287227)
+++ trunk/Source/WebCore/ChangeLog	2021-12-18 20:11:35 UTC (rev 287228)
@@ -1,5 +1,32 @@
 2021-12-17  Simon Fraser  <[email protected]>
 
+        Read the default value of the ScrollAnimatorEnabled setting from NSUserDefaults
+        https://bugs.webkit.org/show_bug.cgi?id=234456
+
+        Reviewed by Tim Horton.
+
+        It's impossible for a test to run with an animated keyboard scroll because platformAllowsScrollAnimation(),
+        which reads from NSUserDefaults, always trumps the Setting.
+
+        Fix by initializing the setting from NSUserDefaults and removing the platformAllowsScrollAnimation()
+        check. This allows for a WebKitTestRunner test override the setting. Remove the WTR code 
+        that sets @"NSScrollAnimationEnabled" to @NO.
+
+        Unfortunately in WebKitLegacy AppKit code consults the @"NSScrollAnimationEnabled" key, so
+        DumpRenderTree has to continue to initialize this NSUserDefault to @NO and tests that
+        try to change the Setting will fail.
+
+        * platform/ScrollAnimator.cpp:
+        (WebCore::ScrollAnimator::singleAxisScroll):
+        (WebCore::ScrollAnimator::scrollAnimationEnabled const):
+        * platform/ScrollAnimator.h:
+        (WebCore::ScrollAnimator::platformAllowsScrollAnimation const): Deleted.
+        * platform/mac/ScrollAnimatorMac.h:
+        * platform/mac/ScrollAnimatorMac.mm:
+        (WebCore::ScrollAnimatorMac::platformAllowsScrollAnimation const): Deleted.
+
+2021-12-17  Simon Fraser  <[email protected]>
+
         Rename MockScrollAnimatorEnabled to MockScrollbarsControllerEnabled
         https://bugs.webkit.org/show_bug.cgi?id=234452
 

Modified: trunk/Source/WebCore/platform/ScrollAnimator.cpp (287227 => 287228)


--- trunk/Source/WebCore/platform/ScrollAnimator.cpp	2021-12-18 19:04:53 UTC (rev 287227)
+++ trunk/Source/WebCore/platform/ScrollAnimator.cpp	2021-12-18 20:11:35 UTC (rev 287228)
@@ -78,7 +78,7 @@
         delta = newOffset - currentOffset;
     }
 
-    if (m_scrollableArea.scrollAnimatorEnabled() && platformAllowsScrollAnimation() && !behavior.contains(ScrollBehavior::NeverAnimate)) {
+    if (m_scrollableArea.scrollAnimatorEnabled() && !behavior.contains(ScrollBehavior::NeverAnimate)) {
         if (m_scrollController.retargetAnimatedScrollBy(delta))
             return true;
 
@@ -391,7 +391,7 @@
 #if PLATFORM(GTK) || USE(NICOSIA)
 bool ScrollAnimator::scrollAnimationEnabled() const
 {
-    return m_scrollableArea.scrollAnimatorEnabled() && platformAllowsScrollAnimation();
+    return m_scrollableArea.scrollAnimatorEnabled();
 }
 #endif
 

Modified: trunk/Source/WebCore/platform/ScrollAnimator.h (287227 => 287228)


--- trunk/Source/WebCore/platform/ScrollAnimator.h	2021-12-18 19:04:53 UTC (rev 287227)
+++ trunk/Source/WebCore/platform/ScrollAnimator.h	2021-12-18 20:11:35 UTC (rev 287228)
@@ -124,9 +124,6 @@
 
     ScrollAnimationStatus serviceScrollAnimation(MonotonicTime);
 
-protected:
-    virtual bool platformAllowsScrollAnimation() const { return true; }
-
 private:
     void notifyPositionChanged(const FloatSize& delta);
 

Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h (287227 => 287228)


--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h	2021-12-18 19:04:53 UTC (rev 287227)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.h	2021-12-18 20:11:35 UTC (rev 287228)
@@ -46,8 +46,6 @@
     bool shouldForwardWheelEventsToParent(const PlatformWheelEvent&) const;
     bool handleWheelEvent(const PlatformWheelEvent&) final;
 
-    bool platformAllowsScrollAnimation() const;
-
     void handleWheelEventPhase(PlatformWheelEventPhase) final;
 
     bool isRubberBandInProgress() const final;

Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (287227 => 287228)


--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2021-12-18 19:04:53 UTC (rev 287227)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2021-12-18 20:11:35 UTC (rev 287228)
@@ -51,12 +51,6 @@
 
 ScrollAnimatorMac::~ScrollAnimatorMac() = default;
 
-bool ScrollAnimatorMac::platformAllowsScrollAnimation() const
-{
-    static bool enabled = [[NSUserDefaults standardUserDefaults] boolForKey:@"NSScrollAnimationEnabled"];
-    return enabled;
-}
-
 static bool rubberBandingEnabledForSystem()
 {
     static bool initialized = false;

Modified: trunk/Source/WebKit/ChangeLog (287227 => 287228)


--- trunk/Source/WebKit/ChangeLog	2021-12-18 19:04:53 UTC (rev 287227)
+++ trunk/Source/WebKit/ChangeLog	2021-12-18 20:11:35 UTC (rev 287228)
@@ -1,3 +1,25 @@
+2021-12-17  Simon Fraser  <[email protected]>
+
+        Read the default value of the ScrollAnimatorEnabled setting from NSUserDefaults
+        https://bugs.webkit.org/show_bug.cgi?id=234456
+
+        Reviewed by Tim Horton.
+
+        It's impossible for a test to run with an animated keyboard scroll because platformAllowsScrollAnimation(),
+        which reads from NSUserDefaults, always trumps the Setting.
+
+        Fix by initializing the setting from NSUserDefaults and removing the platformAllowsScrollAnimation()
+        check. This allows for a WebKitTestRunner test override the setting. Remove the WTR code 
+        that sets @"NSScrollAnimationEnabled" to @NO.
+
+        Unfortunately in WebKitLegacy AppKit code consults the @"NSScrollAnimationEnabled" key, so
+        DumpRenderTree has to continue to initialize this NSUserDefault to @NO and tests that
+        try to change the Setting will fail.
+
+        * Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm:
+        (WebKit::defaultScrollAnimatorEnabled):
+        * Shared/WebPreferencesDefaultValues.h:
+
 2021-12-18  Chris Dumez  <[email protected]>
 
         Convert ProtectionSpace enums into enum classes

Modified: trunk/Source/WebKit/Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm (287227 => 287228)


--- trunk/Source/WebKit/Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm	2021-12-18 19:04:53 UTC (rev 287227)
+++ trunk/Source/WebKit/Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm	2021-12-18 20:11:35 UTC (rev 287228)
@@ -65,6 +65,13 @@
 #endif // HAVE(SYSTEM_FEATURE_FLAGS)
 }
 
+#if PLATFORM(MAC)
+bool defaultScrollAnimatorEnabled()
+{
+    return [[NSUserDefaults standardUserDefaults] boolForKey:@"NSScrollAnimationEnabled"];
+}
+#endif
+
 } // namespace WebKit
 
 #endif

Modified: trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.h (287227 => 287228)


--- trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.h	2021-12-18 19:04:53 UTC (rev 287227)
+++ trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.h	2021-12-18 20:11:35 UTC (rev 287228)
@@ -47,6 +47,7 @@
 #endif
 
 #if PLATFORM(MAC)
+bool defaultScrollAnimatorEnabled();
 bool defaultPassiveWheelListenersAsDefaultOnDocument();
 bool defaultWheelEventGesturesBecomeNonBlocking();
 #endif

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (287227 => 287228)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2021-12-18 19:04:53 UTC (rev 287227)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2021-12-18 20:11:35 UTC (rev 287228)
@@ -1,3 +1,24 @@
+2021-12-17  Simon Fraser  <[email protected]>
+
+        Read the default value of the ScrollAnimatorEnabled setting from NSUserDefaults
+        https://bugs.webkit.org/show_bug.cgi?id=234456
+
+        Reviewed by Tim Horton.
+
+        It's impossible for a test to run with an animated keyboard scroll because platformAllowsScrollAnimation(),
+        which reads from NSUserDefaults, always trumps the Setting.
+
+        Fix by initializing the setting from NSUserDefaults and removing the platformAllowsScrollAnimation()
+        check. This allows for a WebKitTestRunner test override the setting.
+
+        Unfortunately in WebKitLegacy AppKit code consults the @"NSScrollAnimationEnabled" key, so
+        DumpRenderTree has to continue to initialize this NSUserDefault to @NO and tests that
+        try to change the Setting will fail.
+
+        * WebView/WebPreferencesDefaultValues.h:
+        * WebView/WebPreferencesDefaultValues.mm:
+        (WebKit::defaultScrollAnimatorEnabled):
+
 2021-12-18  Chris Dumez  <[email protected]>
 
         Convert ProtectionSpace enums into enum classes

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesDefaultValues.h (287227 => 287228)


--- trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesDefaultValues.h	2021-12-18 19:04:53 UTC (rev 287227)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesDefaultValues.h	2021-12-18 20:11:35 UTC (rev 287228)
@@ -64,6 +64,7 @@
 bool defaultWindowFocusRestricted();
 bool defaultUsePreHTML5ParserQuirks();
 bool defaultNeedsAdobeFrameReloadingQuirk();
+bool defaultScrollAnimatorEnabled();
 bool defaultTreatsAnyTextCSSLinkAsStylesheet();
 bool defaultNeedsFrameNameFallbackToIdQuirk();
 bool defaultNeedsKeyboardEventDisambiguationQuirks();

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesDefaultValues.mm (287227 => 287228)


--- trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesDefaultValues.mm	2021-12-18 19:04:53 UTC (rev 287227)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesDefaultValues.mm	2021-12-18 20:11:35 UTC (rev 287228)
@@ -190,6 +190,12 @@
     return needsQuirk;
 }
 
+bool defaultScrollAnimatorEnabled()
+{
+    static bool enabled = [[NSUserDefaults standardUserDefaults] boolForKey:@"NSScrollAnimationEnabled"];
+    return enabled;
+}
+
 bool defaultTreatsAnyTextCSSLinkAsStylesheet()
 {
     static bool needsQuirk = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITHOUT_LINK_ELEMENT_TEXT_CSS_QUIRK)

Modified: trunk/Tools/ChangeLog (287227 => 287228)


--- trunk/Tools/ChangeLog	2021-12-18 19:04:53 UTC (rev 287227)
+++ trunk/Tools/ChangeLog	2021-12-18 20:11:35 UTC (rev 287228)
@@ -1,5 +1,27 @@
 2021-12-17  Simon Fraser  <[email protected]>
 
+        Read the default value of the ScrollAnimatorEnabled setting from NSUserDefaults
+        https://bugs.webkit.org/show_bug.cgi?id=234456
+
+        Reviewed by Tim Horton.
+
+        It's impossible for a test to run with an animated keyboard scroll because platformAllowsScrollAnimation(),
+        which reads from NSUserDefaults, always trumps the Setting.
+
+        Fix by initializing the setting from NSUserDefaults and removing the platformAllowsScrollAnimation()
+        check. This allows for a WebKitTestRunner test override the setting.
+
+        Unfortunately in WebKitLegacy AppKit code consults the @"NSScrollAnimationEnabled" key, so
+        DumpRenderTree has to continue to initialize this NSUserDefault to @NO and tests that
+        try to change the Setting will fail.
+
+        * WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm:
+        (WTR::InjectedBundle::platformInitialize):
+        * WebKitTestRunner/mac/main.mm:
+        (setDefaultsToConsistentValuesForTesting):
+
+2021-12-17  Simon Fraser  <[email protected]>
+
         Rename MockScrollAnimatorEnabled to MockScrollbarsControllerEnabled
         https://bugs.webkit.org/show_bug.cgi?id=234452
 

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm (287227 => 287228)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm	2021-12-18 19:04:53 UTC (rev 287227)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm	2021-12-18 20:11:35 UTC (rev 287228)
@@ -52,7 +52,6 @@
         @"AppleAquaColorVariant": @(BlueTintedAppearance),
         @"AppleHighlightColor": @"0.709800 0.835300 1.000000",
         @"AppleOtherHighlightColor": @"0.500000 0.500000 0.500000",
-        @"NSScrollAnimationEnabled": @NO,
         @"NSOverlayScrollersEnabled": @NO,
         @"AppleShowScrollBars": @"Always",
         @"NSButtonAnimationsEnabled": @NO, // Ideally, we should find a way to test animations, but for now, make sure that the dumped snapshot matches actual state.

Modified: trunk/Tools/WebKitTestRunner/mac/main.mm (287227 => 287228)


--- trunk/Tools/WebKitTestRunner/mac/main.mm	2021-12-18 19:04:53 UTC (rev 287227)
+++ trunk/Tools/WebKitTestRunner/mac/main.mm	2021-12-18 20:11:35 UTC (rev 287228)
@@ -42,7 +42,6 @@
         @"AppleEnableSwipeNavigateWithScrolls": @YES,
         @"com.apple.swipescrolldirection": @1,
         @"com.apple.trackpad.forceClick": @1,
-        @"NSScrollAnimationEnabled": @NO,
         @"NSOverlayScrollersEnabled": @NO,
         @"AppleShowScrollBars": @"Always",
         @"WebKit2UseRemoteLayerTreeDrawingArea": @NO,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to