Bug 233869

Summary: [Web Animations] Add a way to run scripted animations
Product: WebKit Reporter: Antoine Quint <graouts>
Component: AnimationsAssignee: Antoine Quint <graouts>
Status: RESOLVED FIXED    
Severity: Normal CC: annulen, benjamin, calvaris, cdumez, dino, esprehn+autocc, ews-watchlist, graouts, gyuyoung.kim, kondapallykalyan, ryuan.choi, sergio, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar, WebExposed
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 233868    
Bug Blocks:    
Attachments:
Description Flags
Patch dino: review+, ews-feeder: commit-queue-

Description Antoine Quint 2021-12-06 02:12:15 PST
[Web Animations] Add a way to run scripted animations
Comment 1 Antoine Quint 2021-12-06 02:29:50 PST
rdar://85983542
Comment 2 Antoine Quint 2021-12-06 02:31:05 PST
Created attachment 446016 [details]
Patch

This patch is expected not to build until the patch for bug 233868 lands but can already be reviewed.
Comment 3 Antoine Quint 2021-12-06 02:58:08 PST
I filed https://github.com/w3c/csswg-drafts/issues/6861 to propose to revive the discussion of custom effects in Web Animations.
Comment 4 Dean Jackson 2021-12-06 10:07:33 PST
Comment on attachment 446016 [details]
Patch

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

> LayoutTests/ChangeLog:19
> +2021-12-06  Antoine Quint  <graouts@webkit.org>
> +
> +        [Web Animations] Add a way to run scripted animations
> +        https://bugs.webkit.org/show_bug.cgi?id=233869
> +
> +        Reviewed by NOBODY (OOPS!).
> +
> +        * webanimations/custom-effect/custom-effect-expected.txt: Added.
> +        * webanimations/custom-effect/custom-effect.html: Added.
> +        * webanimations/custom-effect/document-timeline-animate-expected.txt: Added.
> +        * webanimations/custom-effect/document-timeline-animate.html: Added.
> +
> +2021-12-06  Antoine Quint  <graouts@webkit.org>
> +
> +        [Web Animations] Add a way to run scripted animations
> +        https://bugs.webkit.org/show_bug.cgi?id=233869
> +        rdar://85983542
> +
> +        Reviewed by NOBODY (OOPS!).

oops

> LayoutTests/webanimations/custom-effect/custom-effect.html:30
> +    assert_not_equals(customEffectProgress, 1, "Callback is first fired with progress = 0.");

Did you want to change this message?

> Source/WTF/ChangeLog:12
> +2021-12-06  Antoine Quint  <graouts@webkit.org>
> +
> +        [Web Animations] Add a way to run scripted animations
> +        https://bugs.webkit.org/show_bug.cgi?id=233869
> +
> +        Reviewed by NOBODY (OOPS!).
> +
> +        * Scripts/Preferences/WebPreferencesExperimental.yaml:
> +
> +2021-12-06  Antoine Quint  <graouts@webkit.org>
> +
> +        [Web Animations] Add a way to run scripted animations

oops

> Source/WebCore/ChangeLog:39
> +2021-12-06  Antoine Quint  <graouts@webkit.org>
> +
> +        [Web Animations] Add a way to run scripted animations
> +        https://bugs.webkit.org/show_bug.cgi?id=233869
> +
> +        Reviewed by NOBODY (OOPS!).
> +
> +        Tests: webanimations/custom-effect/custom-effect.html
> +               webanimations/custom-effect/document-timeline-animate.html
> +
> +        * CMakeLists.txt:
> +        * DerivedSources-input.xcfilelist:
> +        * DerivedSources-output.xcfilelist:
> +        * DerivedSources.make:
> +        * Headers.cmake:
> +        * Sources.txt:
> +        * WebCore.xcodeproj/project.pbxproj:
> +        * animation/AnimationEffect.h:
> +        (WebCore::AnimationEffect::isCustomEffect const):
> +        * animation/CustomAnimationOptions.h: Copied from Source/WebCore/animation/DocumentTimeline.idl.
> +        * animation/CustomAnimationOptions.idl: Copied from Source/WebCore/animation/DocumentTimeline.idl.
> +        * animation/CustomEffect.cpp: Added.
> +        (WebCore::CustomEffect::create):
> +        (WebCore::CustomEffect::CustomEffect):
> +        (WebCore::CustomEffect::animationDidTick):
> +        * animation/CustomEffect.h: Copied from Source/WebCore/animation/DocumentTimeline.idl.
> +        (WebCore::CustomEffect::~CustomEffect):
> +        * animation/CustomEffect.idl: Copied from Source/WebCore/animation/DocumentTimeline.idl.
> +        * animation/CustomEffectCallback.h: Copied from Source/WebCore/animation/DocumentTimeline.idl.
> +        * animation/CustomEffectCallback.idl: Copied from Source/WebCore/animation/DocumentTimeline.idl.
> +        * animation/DocumentTimeline.cpp:
> +        (WebCore::DocumentTimeline::animate):
> +        * animation/DocumentTimeline.h:
> +        * animation/DocumentTimeline.idl:
> +        * bindings/js/WebCoreBuiltinNames.h:
> +
> +2021-12-06  Antoine Quint  <graouts@webkit.org>
> +
> +        [Web Animations] Add a way to run scripted animations

oops

> Source/WebCore/animation/CustomEffect.cpp:43
> +            std::variant<double, String> duration = std::get<double>(optionsValue);

We don't have a type for duration?

> Source/WebCore/animation/DocumentTimeline.cpp:516
> +        std::variant<double, EffectTiming> customEffectOptionsVariant;
> +        if (std::holds_alternative<double>(*options))
> +            customEffectOptionsVariant = std::get<double>(*options);
> +        else {
> +            auto customEffectOptions = std::get<CustomAnimationOptions>(*options);
> +            id = customEffectOptions.id;
> +            customEffectOptionsVariant = WTFMove(customEffectOptions);
> +        }
> +        customEffectOptions = customEffectOptionsVariant;

This might be nicer as a function that returns the variant directly into customEffectOptions.
Comment 5 Antoine Quint 2021-12-06 11:28:36 PST
Will fix Windows failures in https://bugs.webkit.org/show_bug.cgi?id=233887.
Comment 6 Antoine Quint 2021-12-06 11:31:10 PST
Committed r286555 (244885@main): <https://commits.webkit.org/244885@main>