Bug 234456 - Read the default value of the ScrollAnimatorEnabled setting from NSUserDefaults
Summary: Read the default value of the ScrollAnimatorEnabled setting from NSUserDefaults
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Simon Fraser (smfr)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-12-17 18:00 PST by Simon Fraser (smfr)
Modified: 2022-02-28 14:22 PST (History)
4 users (show)

See Also:


Attachments
Patch (22.36 KB, patch)
2021-12-17 18:05 PST, Simon Fraser (smfr)
no flags Details | Formatted Diff | Diff
Patch (23.48 KB, patch)
2021-12-17 21:17 PST, Simon Fraser (smfr)
thorton: review+
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) 2021-12-17 18:00:20 PST
Read the default value of the ScrollAnimatorEnabled setting from NSUserDefaults
Comment 1 Simon Fraser (smfr) 2021-12-17 18:05:59 PST
Created attachment 447498 [details]
Patch
Comment 2 Simon Fraser (smfr) 2021-12-17 21:17:58 PST
Created attachment 447510 [details]
Patch
Comment 3 Simon Fraser (smfr) 2021-12-18 23:09:33 PST
https://trac.webkit.org/changeset/287228/webkit
Comment 4 Radar WebKit Bug Importer 2021-12-18 23:10:19 PST
<rdar://problem/86679058>
Comment 5 Sam Weinig 2021-12-19 10:12:59 PST
Comment on attachment 447510 [details]
Patch

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

> LayoutTests/fast/dom/horizontal-scrollbar-in-rtl.html:36
> +                if (window.internals)
> +                    internals.settings.setScrollAnimatorEnabled(false);

Is there a benefit here to using the internals function rather than a header <!-- webkit-test-runner [ ScrollAnimatorEnabled=false ] -->?

My preference is to prefer the comment command over programatic except in cases where either dynamic changes are needed or we are modifying an external test via some platform hook function.
Comment 6 Sam Weinig 2021-12-19 10:15:42 PST
Comment on attachment 447510 [details]
Patch

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

> Source/WebKit/Shared/Cocoa/WebPreferencesDefaultValuesCocoa.mm:71
> +    return [[NSUserDefaults standardUserDefaults] boolForKey:@"NSScrollAnimationEnabled"];

I think this will give weird / unexpected behavior if this returns different values for the WebProcess and the UIProcess (a quirk of the preferences where we don't serialize values that have the default value when sending them to the web process).

Is there a guarantee that NSScrollAnimationEnabled is set the same in both processes?
Comment 7 Simon Fraser (smfr) 2021-12-20 08:41:15 PST
(In reply to Sam Weinig from comment #5)
> Comment on attachment 447510 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=447510&action=review
> 
> > LayoutTests/fast/dom/horizontal-scrollbar-in-rtl.html:36
> > +                if (window.internals)
> > +                    internals.settings.setScrollAnimatorEnabled(false);
> 
> Is there a benefit here to using the internals function rather than a header
> <!-- webkit-test-runner [ ScrollAnimatorEnabled=false ] -->?
> 
> My preference is to prefer the comment command over programatic except in
> cases where either dynamic changes are needed or we are modifying an
> external test via some platform hook function.

The header comment didn't work (because this is not an internal or experimental feature). That was what I tried initially.
Comment 8 Sam Weinig 2021-12-26 10:59:05 PST
(In reply to Simon Fraser (smfr) from comment #7)
> (In reply to Sam Weinig from comment #5)
> > Comment on attachment 447510 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=447510&action=review
> > 
> > > LayoutTests/fast/dom/horizontal-scrollbar-in-rtl.html:36
> > > +                if (window.internals)
> > > +                    internals.settings.setScrollAnimatorEnabled(false);
> > 
> > Is there a benefit here to using the internals function rather than a header
> > <!-- webkit-test-runner [ ScrollAnimatorEnabled=false ] -->?
> > 
> > My preference is to prefer the comment command over programatic except in
> > cases where either dynamic changes are needed or we are modifying an
> > external test via some platform hook function.
> 
> The header comment didn't work (because this is not an internal or
> experimental feature). That was what I tried initially.

Header comments should be working for any type of preference. It does not need to be experimental or internal.