Bug 213967 - [macOS 11] Indeterminate progress bar animation periodically jumps
Summary: [macOS 11] Indeterminate progress bar animation periodically jumps
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Wenson Hsieh
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-07-04 22:59 PDT by Wenson Hsieh
Modified: 2020-07-05 12:01 PDT (History)
14 users (show)

See Also:


Attachments
Patch (1.65 KB, patch)
2020-07-04 23:04 PDT, Wenson Hsieh
no flags Details | Formatted Diff | Diff
Patch (9.77 KB, patch)
2020-07-05 10:53 PDT, Wenson Hsieh
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Wenson Hsieh 2020-07-04 22:59:20 PDT
SSIA
Comment 1 Wenson Hsieh 2020-07-04 23:04:49 PDT Comment hidden (obsolete)
Comment 2 Sam Weinig 2020-07-05 06:38:34 PDT
Comment on attachment 403547 [details]
Patch

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

> Source/WebCore/rendering/RenderThemeMac.mm:128
> +#if HAVE(ALTERNATE_ICONS)
> +static const double progressAnimationNumFrames = 120;
> +#else
>  static const double progressAnimationNumFrames = 256;
> +#endif

The CoreUI folks don't really want anyone using kCUIAnimationFrameKey, which is what requires us to know the number of frames. Can we instead switch to kCUIAnimationStartTimeKey/kCUIAnimationTimeKey and avoid the problem of needing to know the number of frames entirely?
Comment 3 Sam Weinig 2020-07-05 09:41:06 PDT
(In reply to Sam Weinig from comment #2)
> Comment on attachment 403547 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=403547&action=review
> 
> > Source/WebCore/rendering/RenderThemeMac.mm:128
> > +#if HAVE(ALTERNATE_ICONS)
> > +static const double progressAnimationNumFrames = 120;
> > +#else
> >  static const double progressAnimationNumFrames = 256;
> > +#endif
> 
> The CoreUI folks don't really want anyone using kCUIAnimationFrameKey, which
> is what requires us to know the number of frames. Can we instead switch to
> kCUIAnimationStartTimeKey/kCUIAnimationTimeKey and avoid the problem of
> needing to know the number of frames entirely?

An added benefit of this would be that if we use a shared heartbeat, all the indeterminate progress indicators in a page will animate in sync, just like in a normal app.
Comment 4 Wenson Hsieh 2020-07-05 10:29:34 PDT
Comment on attachment 403547 [details]
Patch

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

>>> Source/WebCore/rendering/RenderThemeMac.mm:128
>>> +#endif
>> 
>> The CoreUI folks don't really want anyone using kCUIAnimationFrameKey, which is what requires us to know the number of frames. Can we instead switch to kCUIAnimationStartTimeKey/kCUIAnimationTimeKey and avoid the problem of needing to know the number of frames entirely?
> 
> An added benefit of this would be that if we use a shared heartbeat, all the indeterminate progress indicators in a page will animate in sync, just like in a normal app.

Yep, this works great!

I wish this meant we could just remove animationDurationForProgressBar and animationRepeatIntervalForProgressBar, but other ports (Adwaita?) seem to override this and return a non-zero value. That said, I can at least remove the hard-coded constants and stop overriding it in RenderThemeMac (and RenderThemeIOS as well, which for some reason overrides it but returns zero which is the default anyways 🤷🏻‍♂️).
Comment 5 Wenson Hsieh 2020-07-05 10:53:51 PDT
Created attachment 403558 [details]
Patch
Comment 6 Sam Weinig 2020-07-05 11:53:57 PDT
Comment on attachment 403558 [details]
Patch

Very nice. We could probably optimize things a bit in the future (and make it match macOS a bit more) if we wanted by having a shared heartbeat timer for all indeterminate progress indicators, instead of using a timer per-RenderProgress.
Comment 7 Wenson Hsieh 2020-07-05 11:58:01 PDT
Comment on attachment 403558 [details]
Patch

(In reply to Sam Weinig from comment #6)
> Comment on attachment 403558 [details]
> Patch
> 
> Very nice. We could probably optimize things a bit in the future (and make
> it match macOS a bit more) if we wanted by having a shared heartbeat timer
> for all indeterminate progress indicators, instead of using a timer
> per-RenderProgress.

Indeed!
Comment 8 EWS 2020-07-05 12:00:30 PDT
Committed r263952: <https://trac.webkit.org/changeset/263952>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 403558 [details].
Comment 9 Radar WebKit Bug Importer 2020-07-05 12:01:16 PDT
<rdar://problem/65109650>