Changeset 290125 in webkit


Ignore:
Timestamp:
Feb 18, 2022 7:44:59 AM (5 months ago)
Author:
graouts@webkit.org
Message:

[frame-rate] [custom-effect] allow setting frameRate as an option passed to document.timeline.animate()
https://bugs.webkit.org/show_bug.cgi?id=236831

Reviewed by Dean Jackson.

Source/WebCore:

  • animation/CustomAnimationOptions.h:
  • animation/CustomAnimationOptions.idl:
  • animation/DocumentTimeline.cpp:

(WebCore::DocumentTimeline::animate):

LayoutTests:

  • webanimations/frame-rate/animation-frame-rate-expected.txt:
  • webanimations/frame-rate/animation-frame-rate.html:
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r290124 r290125  
     12022-02-18  Antoine Quint  <graouts@webkit.org>
     2
     3        [frame-rate] [custom-effect] allow setting frameRate as an option passed to document.timeline.animate()
     4        https://bugs.webkit.org/show_bug.cgi?id=236831
     5
     6        Reviewed by Dean Jackson.
     7
     8        * webanimations/frame-rate/animation-frame-rate-expected.txt:
     9        * webanimations/frame-rate/animation-frame-rate.html:
     10
    1112022-02-18  Ziran Sun  <zsun@igalia.com>
    212
  • trunk/LayoutTests/webanimations/frame-rate/animation-frame-rate-expected.txt

    r290123 r290125  
    33PASS Invalid animation.frameRate values
    44PASS Calling element.animate() allows setting animation.frameRate
     5PASS Calling document.timeline.animate() allows setting animation.frameRate
    56
  • trunk/LayoutTests/webanimations/frame-rate/animation-frame-rate.html

    r290123 r290125  
    5252}, "Calling element.animate() allows setting animation.frameRate");
    5353
     54test(t => {
     55    const animation = frameRate => document.timeline.animate(() => { }, { frameRate });
     56
     57    // Numeric value.
     58    assert_equals(animation(30).frameRate, 30, "frameRate can be set to a numeric value");
     59
     60    // Presets.
     61    for (let value of presets)
     62        assert_equals(animation(value).frameRate, value, "frameRate can be set to a preset value");
     63
     64    // Invalid values.
     65    for (let value of invalidValues)
     66        assert_throws_js(TypeError, () => animation(value), `providing the invalid value "${value}" throws`);
     67}, "Calling document.timeline.animate() allows setting animation.frameRate");
     68
    5469</script>
    5570</body>
  • trunk/Source/WebCore/ChangeLog

    r290124 r290125  
     12022-02-18  Antoine Quint  <graouts@webkit.org>
     2
     3        [frame-rate] [custom-effect] allow setting frameRate as an option passed to document.timeline.animate()
     4        https://bugs.webkit.org/show_bug.cgi?id=236831
     5
     6        Reviewed by Dean Jackson.
     7
     8        * animation/CustomAnimationOptions.h:
     9        * animation/CustomAnimationOptions.idl:
     10        * animation/DocumentTimeline.cpp:
     11        (WebCore::DocumentTimeline::animate):
     12
    1132022-02-18  Ziran Sun  <zsun@igalia.com>
    214
  • trunk/Source/WebCore/animation/CustomAnimationOptions.h

    r286555 r290125  
    2626#pragma once
    2727
     28#include "AnimationFrameRate.h"
     29#include "AnimationFrameRatePreset.h"
    2830#include "EffectTiming.h"
    2931
     
    3234struct CustomAnimationOptions : EffectTiming {
    3335    String id;
     36    std::variant<FramesPerSecond, AnimationFrameRatePreset> frameRate;
    3437};
    3538
  • trunk/Source/WebCore/animation/CustomAnimationOptions.idl

    r286555 r290125  
    2424 */
    2525
     26typedef unsigned long FramesPerSecond;
     27
    2628dictionary CustomAnimationOptions : EffectTiming {
    2729    DOMString id = "";
     30    [EnabledBySetting=WebAnimationsCustomFrameRateEnabled] (FramesPerSecond or AnimationFrameRatePreset) frameRate = "auto";
    2831};
    2932
  • trunk/Source/WebCore/animation/DocumentTimeline.cpp

    r290003 r290125  
    454454
    455455    String id = "";
     456    std::variant<FramesPerSecond, AnimationFrameRatePreset> frameRate = AnimationFrameRatePreset::Auto;
    456457    std::optional<std::variant<double, EffectTiming>> customEffectOptions;
    457458
     
    463464            auto customEffectOptions = std::get<CustomAnimationOptions>(*options);
    464465            id = customEffectOptions.id;
     466            frameRate = customEffectOptions.frameRate;
    465467            customEffectOptionsVariant = WTFMove(customEffectOptions);
    466468        }
     
    474476    auto animation = WebAnimation::create(*document(), &customEffectResult.returnValue().get());
    475477    animation->setId(id);
     478    animation->setBindingsFrameRate(WTFMove(frameRate));
    476479
    477480    auto animationPlayResult = animation->play();
Note: See TracChangeset for help on using the changeset viewer.